Skip to content

Commit

Permalink
joystick/main-vehicle: Add disarming cockpit action
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaellehmkuhl committed Jun 5, 2023
1 parent 186061b commit e997648
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/libs/joystick/protocols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export class MavlinkControllerState extends ProtocolControllerState {
export enum CockpitAction {
TOGGLE_FULL_SCREEN = 'Toggle full-screen',
MAVLINK_ARM = 'Mavlink Command - Arm',
MAVLINK_DISARM = 'Mavlink Command - Disarm',
}

export type CockpitActionCallback = () => void
Expand Down
2 changes: 2 additions & 0 deletions src/stores/mainVehicle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,10 @@ export const useMainVehicleStore = defineStore('main-vehicle', () => {
setFlightMode: setFlightMode,
}
const mavlinkArmId = registerActionCallback(CockpitAction.MAVLINK_ARM, arm)
const mavlinkDisarmId = registerActionCallback(CockpitAction.MAVLINK_DISARM, disarm)
onBeforeUnmount(() => {
unregisterActionCallback(mavlinkArmId)
unregisterActionCallback(mavlinkDisarmId)
})
})

Expand Down

0 comments on commit e997648

Please sign in to comment.