I am looking to add a custom button to the actions tab that does the servo/relay tab 5 button function.
I have used c/c++ but not c#. To do this would I need to alter or create an cs file similar to the example-watchbutton.cs created in C:\Program Files (x86)\Mission Planner\plugins?
Thank you Andras for the response and the code! Sadly, I am struggling on how to implement the code(I’m new to c#) Looking at the example-watchbutton.cs below where would I add the code? I would assume that I would remove the private void MavOnOnPacketReceivedHandler() and the code in loaded() as well
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MissionPlanner.Utilities;
using System.IO;
using System.Windows.Forms;
using System.Diagnostics;
using MissionPlanner;
namespace Shortcuts
{
public class ButtonPlugin : MissionPlanner.Plugin.Plugin
{
public override string Name
{
get { return "Button change"; }
}
public override string Version
{
get { return "0.1"; }
}
public override string Author
{
get { return "EOSBandi"; }
}
public override bool Init()
{
return true;
}
public override bool Loaded()
{
Host.comPort.OnPacketReceived += MavOnOnPacketReceivedHandler;
return true;
}
public override bool Loop()
{
return true;
}
public override bool Exit()
{
return true;
}
private void MavOnOnPacketReceivedHandler(object o, MAVLink.MAVLinkMessage linkMessage)
{
if ((MAVLink.MAVLINK_MSG_ID) linkMessage.msgid == MAVLink.MAVLINK_MSG_ID.BUTTON_CHANGE)
{
//Button change message received
//Check and display message
Console.WriteLine("BUTTON CHANGE message received");
}
}
}
Hi Jon and Andras
I want to add one or two buttons for engine start and stop to the actions tab, but have never worked with C# - would you mind sharing your working button plugin or pointing me to an example for a button plugin?
Thanks!