Skip to content

Commit

Permalink
mavlink-manual-control: Use already mapped functions slot backwards
Browse files Browse the repository at this point in the history
In the case all the button slots are already taken, we try to change the last button slots first, as in the case of vehicles with 32 buttons available, we prevent changing the first 16, which are usually used by other ground control stations, preventing clashs.
  • Loading branch information
rafaellehmkuhl committed Jan 12, 2024
1 parent f8bb832 commit 8922a40
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libs/joystick/protocols/mavlink-manual-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ export class MavlinkManualControlManager {
} else {
const mavlinkActionValue = this.vehicleButtonParameterTable.find((e) => e.title === actionId)
if (mavlinkActionValue === undefined) return
this.vehicle?.setParameter({ id: unnecessaryVehicleRegularButtons[indexRegularButtonToUse].button, value: mavlinkActionValue.value })
this.vehicle?.setParameter({ id: unnecessaryVehicleRegularButtons[unnecessaryVehicleRegularButtons.length - 1].button, value: mavlinkActionValue.value })
}
indexRegularButtonToUse++
})
Expand All @@ -578,7 +578,7 @@ export class MavlinkManualControlManager {
} else {
const mavlinkActionValue = this.vehicleButtonParameterTable.find((e) => e.title === actionId)
if (mavlinkActionValue === undefined) return
this.vehicle?.setParameter({ id: unnecessaryVehicleShiftButtons[indexShiftButtonToUse].button, value: mavlinkActionValue.value })
this.vehicle?.setParameter({ id: unnecessaryVehicleShiftButtons[unnecessaryVehicleShiftButtons.length - 1].button, value: mavlinkActionValue.value })
}
indexShiftButtonToUse++
})
Expand Down

0 comments on commit 8922a40

Please sign in to comment.