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

Sending deviceID for outputs instead of pin number #1886

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions MobiFlight/FirmwareFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}
4 changes: 3 additions & 1 deletion MobiFlight/MobiFlightModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
19 changes: 15 additions & 4 deletions MobiFlight/MobiFlightOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down