@@ -6,6 +6,7 @@ import { capitalize } from 'vue'
66
77import { useInteractionDialog } from '@/composables/interactionDialog'
88import { sendManualControl } from '@/libs/communication/mavlink'
9+ import { manualControlAxisId } from '@/libs/joystick/protocols/manual-control-axis-id'
910import { modifierKeyActions , otherAvailableActions } from '@/libs/joystick/protocols/other'
1011import { round , scale } from '@/libs/utils'
1112import type { ArduPilot } from '@/libs/vehicle/ardupilot/ardupilot'
@@ -501,12 +502,12 @@ export class MavlinkManualControlManager {
501502 }
502503
503504 // Calculate axes values
504- const xCorrespondency = Object . entries ( this . currentActionsMapping . axesCorrespondencies ) . find ( ( entry ) => entry [ 1 ] . action . protocol === JoystickProtocol . MAVLinkManualControl && entry [ 1 ] . action . id === mavlinkManualControlAxes . axis_x . id )
505- const yCorrespondency = Object . entries ( this . currentActionsMapping . axesCorrespondencies ) . find ( ( entry ) => entry [ 1 ] . action . protocol === JoystickProtocol . MAVLinkManualControl && entry [ 1 ] . action . id === mavlinkManualControlAxes . axis_y . id )
506- const zCorrespondency = Object . entries ( this . currentActionsMapping . axesCorrespondencies ) . find ( ( entry ) => entry [ 1 ] . action . protocol === JoystickProtocol . MAVLinkManualControl && entry [ 1 ] . action . id === mavlinkManualControlAxes . axis_z . id )
507- const rCorrespondency = Object . entries ( this . currentActionsMapping . axesCorrespondencies ) . find ( ( entry ) => entry [ 1 ] . action . protocol === JoystickProtocol . MAVLinkManualControl && entry [ 1 ] . action . id === mavlinkManualControlAxes . axis_r . id )
508- const sCorrespondency = Object . entries ( this . currentActionsMapping . axesCorrespondencies ) . find ( ( entry ) => entry [ 1 ] . action . protocol === JoystickProtocol . MAVLinkManualControl && entry [ 1 ] . action . id === mavlinkManualControlAxes . axis_s . id )
509- const tCorrespondency = Object . entries ( this . currentActionsMapping . axesCorrespondencies ) . find ( ( entry ) => entry [ 1 ] . action . protocol === JoystickProtocol . MAVLinkManualControl && entry [ 1 ] . action . id === mavlinkManualControlAxes . axis_t . id )
505+ const xCorrespondency = Object . entries ( this . currentActionsMapping . axesCorrespondencies ) . find ( ( entry ) => manualControlAxisId ( entry [ 1 ] . action ) === mavlinkManualControlAxes . axis_x . id )
506+ const yCorrespondency = Object . entries ( this . currentActionsMapping . axesCorrespondencies ) . find ( ( entry ) => manualControlAxisId ( entry [ 1 ] . action ) === mavlinkManualControlAxes . axis_y . id )
507+ const zCorrespondency = Object . entries ( this . currentActionsMapping . axesCorrespondencies ) . find ( ( entry ) => manualControlAxisId ( entry [ 1 ] . action ) === mavlinkManualControlAxes . axis_z . id )
508+ const rCorrespondency = Object . entries ( this . currentActionsMapping . axesCorrespondencies ) . find ( ( entry ) => manualControlAxisId ( entry [ 1 ] . action ) === mavlinkManualControlAxes . axis_r . id )
509+ const sCorrespondency = Object . entries ( this . currentActionsMapping . axesCorrespondencies ) . find ( ( entry ) => manualControlAxisId ( entry [ 1 ] . action ) === mavlinkManualControlAxes . axis_s . id )
510+ const tCorrespondency = Object . entries ( this . currentActionsMapping . axesCorrespondencies ) . find ( ( entry ) => manualControlAxisId ( entry [ 1 ] . action ) === mavlinkManualControlAxes . axis_t . id )
510511
511512 // Populate MAVLink Manual Control state of axes and buttons
512513 this . manualControlState . x = xCorrespondency === undefined ? 0 : round ( scale ( this . joystickState . axes [ xCorrespondency [ 0 ] as unknown as JoystickAxis ] ?? 0 , - 1 , 1 , xCorrespondency [ 1 ] . min , xCorrespondency [ 1 ] . max ) , 0 )
0 commit comments