From cfc80d28c24c02a3fa6ec464461daa2bd262cdaf Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 17 Aug 2026 14:24:07 +1000 Subject: [PATCH] FlightData: add mass storage reboot action --- GCSViews/FlightData.cs | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/GCSViews/FlightData.cs b/GCSViews/FlightData.cs index c2d650a800..2c6c25e3c9 100644 --- a/GCSViews/FlightData.cs +++ b/GCSViews/FlightData.cs @@ -187,6 +187,7 @@ public enum actions Preflight_Calibration, Mission_Start, Preflight_Reboot_Shutdown, + Reboot_Mass_Storage, Trigger_Camera, System_Time, Battery_Reset, @@ -1680,20 +1681,17 @@ private void BUT_speed1_Click(object sender, EventArgs e) private void BUTactiondo_Click(object sender, EventArgs e) { // Custom action handling + if (CustomActions.TryGetValue(CMB_action.Text, out var customAction)) { - var customAction = CustomActions[CMB_action.Text]; - if(customAction!=null) + try { - try - { - customAction.Invoke(CMB_action.Text); - } - catch (Exception ex) - { - CustomMessageBox.Show(Strings.CommandFailed + "\n" + ex.ToString(), Strings.ERROR); - } - return; + customAction.Invoke(CMB_action.Text); } + catch (Exception ex) + { + CustomMessageBox.Show(Strings.CommandFailed + "\n" + ex.ToString(), Strings.ERROR); + } + return; } if (CMB_action.Text == actions.Format_SD_Card.ToString()) @@ -1806,6 +1804,14 @@ private void BUTactiondo_Click(object sender, EventArgs e) ((Control) sender).Enabled = true; return; } + if (CMB_action.Text == actions.Reboot_Mass_Storage.ToString()) + { + const float rebootToMassStorage = 5; + MainV2.comPort.doCommand(MainV2.comPort.MAV.sysid, MainV2.comPort.MAV.compid, + MAVLink.MAV_CMD.PREFLIGHT_REBOOT_SHUTDOWN, rebootToMassStorage, 0, 0, 0, 0, 0, 0); + ((Control) sender).Enabled = true; + return; + } if (CMB_action.Text == actions.HighLatency_Enable.ToString()) { MainV2.comPort.doHighLatency(true);