Skip to content

Commit

Permalink
Merge pull request #730 from bitcraze/rik/disarming
Browse files Browse the repository at this point in the history
Allow in-flight disarming via controller without triggering emergency stop
  • Loading branch information
gemenerik authored Oct 21, 2024
2 parents bfc728c + cc716e9 commit 002fd0a
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/cfclient/ui/tabs/FlightTab.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def __init__(self, helper):
self._emergency_stop_updated_signal.connect(self.updateEmergencyStop)
self._helper.inputDeviceReader.emergency_stop_updated.add_callback(
self._emergency_stop_updated_signal.emit)
self._arm_updated_signal.connect(self.updateArm)
self._arm_updated_signal.connect(lambda: self.updateArm(from_controller=True))
self._helper.inputDeviceReader.arm_updated.add_callback(self._arm_updated_signal.emit)

self._helper.inputDeviceReader.heighthold_input_updated.add_callback(
Expand Down Expand Up @@ -638,19 +638,16 @@ def updateEmergencyStop(self, emergencyStop):
else:
self.setMotorLabelsEnabled(True)

def updateArm(self):
if self._is_flying():
def updateArm(self, from_controller=False):
if self._is_flying() and not from_controller:
self._helper.cf.loc.send_emergency_stop()
# TODO krri disarm?
if self._is_crashed():
elif self._is_crashed():
self._helper.cf.platform.send_crash_recovery_request()
else:
if self._is_armed():
self._helper.cf.platform.send_arming_request(False)
else:
if self._can_arm():
self.armButton.setStyleSheet("background-color: orange")
self._helper.cf.platform.send_arming_request(True)
elif self._is_armed():
self._helper.cf.platform.send_arming_request(False)
elif self._can_arm():
self.armButton.setStyleSheet("background-color: orange")
self._helper.cf.platform.send_arming_request(True)

def flightmodeChange(self, item):
Config().set("flightmode", str(self.flightModeCombo.itemText(item)))
Expand Down

0 comments on commit 002fd0a

Please sign in to comment.