Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/python_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
python-version: '3.11'

- name: Install dependencies
working-directory: radio
Expand All @@ -39,4 +39,5 @@ jobs:

- name: Test with pytest
working-directory: radio
timeout-minutes: 25
run: pytest --log-cli-level=DEBUG
8 changes: 5 additions & 3 deletions gcs/src/components/dashboard/statusMessages.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ export default function StatusMessages(props) {
key={index}
className={getMessageOutsideVisibilityClassNames()}
>
<p className="text-gray-400">
{moment.unix(message.timestamp).format("HH:mm:ss")}
</p>
{message.timestamp !== null && (
<p className="text-gray-400">
{moment.unix(message.timestamp).format("HH:mm:ss")}
</p>
)}
<p className={getSeverityClassNames(message.severity)}>
{message.text}
</p>
Expand Down
72 changes: 36 additions & 36 deletions gcs/src/dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,45 +236,45 @@ export default function Dashboard() {
{/* Video Widget for RTSP streams */}
<VideoWidget telemetryPanelWidth={telemetryPanelSize.width} />

{connectedToDrone && (
<div className="absolute bottom-0 right-0 z-20">
<ResizableBox
height={messagesPanelSize.height}
width={messagesPanelSize.width}
minConstraints={[600, 150]}
maxConstraints={[viewportWidth - 200, viewportHeight - 200]}
resizeHandles={["nw"]}
handle={(_, ref) => (
<span className={"custom-handle-nw"} ref={ref} />
)}
handleSize={[32, 32]}
onResize={(_, { size }) => {
setMessagesPanelSize({ width: size.width, height: size.height })
}}
>
<>
{/* Show a "Waiting for message area" */}
{statustextMessages.length == 0 && (
<StatusMessages
messages={[
{
timestamp: "0",
text: `Waiting for messages from ${aircraftTypeString}`,
severity: 7,
},
]}
className={`bg-[${tailwindColors.falcongrey["TRANSLUCENT"]}] h-full lucent max-w-1/2 object-fill text-xl`}
/>
)}
{/* Show real messages */}
<div className="absolute bottom-0 right-0 z-20">
<ResizableBox
height={messagesPanelSize.height}
width={messagesPanelSize.width}
minConstraints={[600, 150]}
maxConstraints={[viewportWidth - 200, viewportHeight - 200]}
resizeHandles={["nw"]}
handle={(_, ref) => (
<span className={"custom-handle-nw"} ref={ref} />
)}
handleSize={[32, 32]}
onResize={(_, { size }) => {
setMessagesPanelSize({ width: size.width, height: size.height })
}}
>
<>
{/* Show a "Waiting for message area" */}
{statustextMessages.length == 0 && (
<StatusMessages
messages={statustextMessages}
messages={[
{
timestamp: null,
text: connectedToDrone
? `Waiting for messages from ${aircraftTypeString}`
: "Not connected to drone",
severity: 7,
},
]}
className={`bg-[${tailwindColors.falcongrey["TRANSLUCENT"]}] h-full lucent max-w-1/2 object-fill text-xl`}
/>
</>
</ResizableBox>
</div>
)}
)}
{/* Show real messages */}
<StatusMessages
messages={statustextMessages}
className={`bg-[${tailwindColors.falcongrey["TRANSLUCENT"]}] h-full lucent max-w-1/2 object-fill text-xl`}
/>
</>
</ResizableBox>
</div>
</div>
</Layout>
)
Expand Down
6 changes: 5 additions & 1 deletion gcs/src/redux/middleware/socketMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import {
setDroneAircraftType,
setEkfStatusReportData,
setExtraData,
setFlightSwVersion,
setGpsData,
setGpsRawIntData,
setGuidedModePinData,
Expand Down Expand Up @@ -97,7 +98,7 @@ import {
setShownParams,
updateParamValue,
} from "../slices/paramsSlice.js"
import { pushMessage } from "../slices/statusTextSlice.js"
import { pushMessage, resetMessages } from "../slices/statusTextSlice.js"
import { handleEmitters } from "./emitters.js"

const SocketEvents = Object.freeze({
Expand Down Expand Up @@ -341,6 +342,8 @@ const socketMiddleware = (store) => {
if (msg.aircraft_type !== 1 && msg.aircraft_type !== 2) {
showErrorNotification("Aircraft not of type quadcopter or plane")
}

store.dispatch(setFlightSwVersion(msg.flight_sw_version))
store.dispatch(setConnected(true))
store.dispatch(setConnecting(false))
store.dispatch(setConnectionModal(false))
Expand All @@ -351,6 +354,7 @@ const socketMiddleware = (store) => {
store.dispatch(setAutoPilotRebootModalOpen(false))
store.dispatch(setShouldFetchAllMissionsOnDashboard(true))
store.dispatch(setShowMotorTestWarningModal(true))
store.dispatch(resetMessages())
})

// Link stats
Expand Down
8 changes: 8 additions & 0 deletions gcs/src/redux/slices/droneInfoSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
const droneInfoSlice = createSlice({
name: "droneInfo",
initialState: {
flightSwVersion: "",
attitudeData: {
roll: 0.0,
pitch: 0.0,
Expand Down Expand Up @@ -85,6 +86,9 @@ const droneInfoSlice = createSlice({
},
},
reducers: {
setFlightSwVersion: (state, action) => {
state.flightSwVersion = action.payload
},
setHeartbeatData: (state, action) => {
if (
action.payload.base_mode & 128 &&
Expand Down Expand Up @@ -225,6 +229,8 @@ const droneInfoSlice = createSlice({
},
},
selectors: {
selectFlightSwVersion: (state) => state.flightSwVersion,

selectAttitude: (state) => state.attitudeData,
selectTelemetry: (state) => state.telemetryData,

Expand Down Expand Up @@ -263,6 +269,7 @@ const droneInfoSlice = createSlice({
})

export const {
setFlightSwVersion,
setHeartbeatData,
soundPlayed,
changeExtraData,
Expand Down Expand Up @@ -335,6 +342,7 @@ export const selectFlightModeString = createSelector(
)

export const {
selectFlightSwVersion,
selectAttitude,
selectTelemetry,
selectGPS,
Expand Down
5 changes: 4 additions & 1 deletion gcs/src/redux/slices/statusTextSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ const statusTextSlice = createSlice({
pushMessage: (state, action) => {
state.messages.unshift(action.payload)
},
resetMessages: (state) => {
state.messages = []
},
},
selectors: {
selectMessages: (state) => {
Expand All @@ -15,7 +18,7 @@ const statusTextSlice = createSlice({
},
})

export const { pushMessage } = statusTextSlice.actions
export const { pushMessage, resetMessages } = statusTextSlice.actions
export const { selectMessages } = statusTextSlice.selectors

export default statusTextSlice
Loading