Skip to content

Commit

Permalink
FlightData: Actions: add engine start/stop
Browse files Browse the repository at this point in the history
  • Loading branch information
robertlong13 authored and meee1 committed Nov 27, 2024
1 parent e9cfa8c commit 718162a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
13 changes: 13 additions & 0 deletions ExtLibs/ArduPilot/Mavlink/MAVLinkInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2500,6 +2500,19 @@ public bool doHighLatency(bool onoff= false)
return ans1;
}

/// <summary>
/// Control ICE Engine
/// </summary>
/// <param name="onoff">true to enable, false to disable</param>
/// <returns></returns>
public bool doEngineControl(byte sysid, byte compid, bool onoff = false)
{
int param1 = onoff ? 1 : 0;

return doCommand(sysid, compid, MAV_CMD.DO_ENGINE_CONTROL,
param1, 0, 0, 0, 0, 0, 0);
}

/// <summary>
/// reboot the vehicle
/// </summary>
Expand Down
16 changes: 15 additions & 1 deletion GCSViews/FlightData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ public enum actions
HighLatency_Enable,
HighLatency_Disable,
Toggle_Safety_Switch,
Do_Parachute
Do_Parachute,
Engine_Start,
Engine_Stop,
}

private Dictionary<int, string> NIC_table = new Dictionary<int, string>()
Expand Down Expand Up @@ -1768,6 +1770,18 @@ private void BUTactiondo_Click(object sender, EventArgs e)
((Control)sender).Enabled = true;
return;
}
if (CMB_action.Text == actions.Engine_Start.ToString())
{
MainV2.comPort.doEngineControl((byte)MainV2.comPort.sysidcurrent, (byte)MainV2.comPort.compidcurrent, true);
((Control)sender).Enabled = true;
return;
}
if (CMB_action.Text == actions.Engine_Stop.ToString())
{
MainV2.comPort.doEngineControl((byte)MainV2.comPort.sysidcurrent, (byte)MainV2.comPort.compidcurrent, false);
((Control)sender).Enabled = true;
return;
}

if (CMB_action.Text == actions.Battery_Reset.ToString())
{
Expand Down

0 comments on commit 718162a

Please sign in to comment.