Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Also check target_system!=0 when toggling safety switch in ctl-F screen. #3317

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
}
}
}
}
Loading