Skip to content

Commit

Permalink
We should alse check target_system!=0 when toggling safety switch in …
Browse files Browse the repository at this point in the history
…ctl-F screen. (ArduPilot#3317)

Toggle safety switch should perform the same in both action tab and ctl-F screen.
  • Loading branch information
ROSStargh authored Aug 15, 2024
1 parent b67ec8d commit c926166
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions temp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1103,12 +1103,16 @@ private void BUT_xplane_Click(object sender, EventArgs e)
private void but_disablearmswitch_Click(object sender, EventArgs e)
{
if (CustomMessageBox.Show("Are you sure?", "", MessageBoxButtons.YesNo) == (int)DialogResult.Yes)
MainV2.comPort.setMode(
new MAVLink.mavlink_set_mode_t()
{
custom_mode = (MainV2.comPort.MAV.cs.sensors_enabled.motor_control == true && MainV2.comPort.MAV.cs.sensors_enabled.seen) ? 1u : 0u,
target_system = (byte)MainV2.comPort.sysidcurrent
}, MAVLink.MAV_MODE_FLAG.SAFETY_ARMED);
{
var target_system = (byte)MainV2.comPort.sysidcurrent;
if (target_system == 0) {
log.Info("Not toggling safety on sysid 0");
return;
}
var custom_mode = (MainV2.comPort.MAV.cs.sensors_enabled.motor_control && MainV2.comPort.MAV.cs.sensors_enabled.seen) ? 1u : 0u;
var mode = new MAVLink.mavlink_set_mode_t() { custom_mode = custom_mode, target_system = target_system };
MainV2.comPort.setMode(mode, MAVLink.MAV_MODE_FLAG.SAFETY_ARMED);
}
}

private void but_hwids_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -1425,4 +1429,4 @@ private void BUT_forcecal_mag_Click(object sender, EventArgs e)
}
}
}
}
}

0 comments on commit c926166

Please sign in to comment.