diff --git a/MobiFlight/FirmwareFeature.cs b/MobiFlight/FirmwareFeature.cs index 401be2150..3c280eb36 100644 --- a/MobiFlight/FirmwareFeature.cs +++ b/MobiFlight/FirmwareFeature.cs @@ -6,5 +6,6 @@ public class FirmwareFeature public const string SetName = "1.6.0"; public const string LedModuleTypeTM1637 = "2.4.2"; public const string CustomDevices = "2.4.2"; + public const string Output_DeviceID = "3.0.0"; } } diff --git a/MobiFlight/MobiFlightModule.cs b/MobiFlight/MobiFlightModule.cs index dd06f5fb3..ad5e5581b 100644 --- a/MobiFlight/MobiFlightModule.cs +++ b/MobiFlight/MobiFlightModule.cs @@ -395,7 +395,9 @@ public void LoadConfig() { CmdMessenger = _cmdMessenger, Name = device.Name, - Pin = pin + Pin = pin, + OutputNumber = outputs.Count, + sendDeviceID = HasFirmwareFeature(FirmwareFeature.Output_DeviceID) }); break; case DeviceType.LcdDisplay: diff --git a/MobiFlight/MobiFlightOutput.cs b/MobiFlight/MobiFlightOutput.cs index 054a73945..86efbbdcd 100644 --- a/MobiFlight/MobiFlightOutput.cs +++ b/MobiFlight/MobiFlightOutput.cs @@ -27,17 +27,28 @@ public DeviceType Type public CmdMessenger CmdMessenger { get; set; } public int Pin { get; set; } - + + public int OutputNumber { get; set; } + + public bool sendDeviceID { get; set; } + public MobiFlightOutput() { } public void Set(int value) { var command = new SendCommand((int)MobiFlightModule.Command.SetPin); - command.AddArgument(Pin); + int output; + + if (sendDeviceID) + output = OutputNumber; + else + output = Pin; + + Log.Instance.log($"Command: SetPin <{(int)MobiFlightModule.Command.SetPin},{output},{value};>.", LogSeverity.Debug); + + command.AddArgument(output); command.AddArgument(value); // Send command - Log.Instance.log($"Command: SetPin <{(int)MobiFlightModule.Command.SetPin},{Pin},{value};>.", LogSeverity.Debug); - CmdMessenger.SendCommand(command); }