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

Add additional information to standard MobiFlight boards #1889

Merged
merged 5 commits into from
Jan 5, 2025
Merged
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
26 changes: 23 additions & 3 deletions Boards/arduino_mega.board.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "./mfboard.schema.json",
"AvrDudeSettings": {
"Device": "atmega2560",
"BaudRates": ["115200"],
"BaudRates": [ "115200" ],
"Programmer": "wiring",
"Timeout": 15000
},
Expand Down Expand Up @@ -40,7 +40,27 @@
"LatestFirmwareVersion": "2.5.1",
"FriendlyName": "Arduino Mega 2560",
"MobiFlightType": "MobiFlight Mega",
"ResetFirmwareFile": "reset.arduino_mega_1_0_2.hex"
"ResetFirmwareFile": "reset.arduino_mega_1_0_2.hex",
"Community": {
"Project": "MobiFlight Mega",
"Website": "https://mobiflight.com/links/connector/info/website/mega.html",
"Docs": "https://mobiflight.com/links/connector/info/docs/mega.html",
"Support": "https://mobiflight.com/discord"
},
"DeviceConfigs": [
{
"Name": "Prototyping Board (Latest version)",
"Description": "The device definitions for the Prototyping Board from the Community Shop",
"File": "prototyping-board-latest.mega.mfmc",
"DefaultUpload": false
},
{
"Name": "Prototyping Board v2.0",
"Description": "The device definitions for the Prototyping Board from the Community Shop",
"File": "prototyping-board-latest.mega.mfmc",
"DefaultUpload": false
}
]
},
"ModuleLimits": {
"MaxAnalogInputs": 16,
Expand All @@ -54,7 +74,7 @@
"MaxShifters": 6,
"MaxSteppers": 10,
"MaxInputMultiplexer": 6,
"MaxCustomDevices" : 0
"MaxCustomDevices": 0
},
"Pins": [
{
Expand Down
8 changes: 7 additions & 1 deletion Boards/arduino_micro.board.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@
"FriendlyName": "Arduino Pro Micro",
"LatestFirmwareVersion": "2.5.1",
"MobiFlightType": "MobiFlight Micro",
"ResetFirmwareFile": "reset.arduino_promicro_1_0_2.hex"
"ResetFirmwareFile": "reset.arduino_promicro_1_0_2.hex",
"Community": {
"Project": "MobiFlight Pro Micro",
"Website": "https://mobiflight.com/links/connector/info/website/micro.html",
"Docs": "https://mobiflight.com/links/connector/info/docs/micro.html",
"Support": "https://mobiflight.com/discord"
}
},
"ModuleLimits": {
"MaxAnalogInputs": 9,
Expand Down
8 changes: 7 additions & 1 deletion Boards/arduino_nano.board.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@
"FriendlyName": "Arduino Nano",
"LatestFirmwareVersion": "2.5.1",
"MobiFlightType": "MobiFlight Nano",
"ResetFirmwareFile": "reset.arduino_uno_1_0_2.hex"
"ResetFirmwareFile": "reset.arduino_uno_1_0_2.hex",
"Community": {
"Project": "MobiFlight Nano",
"Website": "https://mobiflight.com/links/connector/info/website/nano.html",
"Docs": "https://mobiflight.com/links/connector/info/docs/nano.html",
"Support": "https://mobiflight.com/discord"
}
},
"ModuleLimits": {
"MaxAnalogInputs": 8,
Expand Down
8 changes: 7 additions & 1 deletion Boards/arduino_uno.board.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@
"FirmwareExtension": "hex",
"LatestFirmwareVersion": "2.5.1",
"MobiFlightType": "MobiFlight Uno",
"ResetFirmwareFile": "reset.arduino_uno_1_0_2.hex"
"ResetFirmwareFile": "reset.arduino_uno_1_0_2.hex",
"Community": {
"Project": "MobiFlight Uno",
"Website": "https://mobiflight.com/links/connector/info/website/uno.html",
"Docs": "https://mobiflight.com/links/connector/info/docs/uno.html",
"Support": "https://mobiflight.com/discord"
}
},
"ModuleLimits": {
"MaxAnalogInputs": 6,
Expand Down
59 changes: 59 additions & 0 deletions Boards/config/prototyping-board-latest.mega.mfmc
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<Config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ModuleType>MobiFlight Mega</ModuleType>
<ModuleName>ProtoBoard-v2</ModuleName>
<PowerSavingTime>600</PowerSavingTime>
<Button Name="Button 3" Pin="4" />
<Button Name="Button 4" Pin="5" />
<Button Name="Button 5" Pin="6" />
<Button Name="Button 6" Pin="26" />
<Output Name="LED 1" Pin="7" />
<Output Name="LED 2" Pin="8" />
<Output Name="LED 3" Pin="9" />
<Output Name="LED 4" Pin="10" />
<Output Name="LED 5" Pin="11" />
<Output Name="LED 6" Pin="12" />
<Button Name="Switch 1-1" Pin="22" />
<Button Name="Switch 1-3" Pin="24" />
<Button Name="Switch 2-1" Pin="14" />
<Button Name="Switch 2-3" Pin="15" />
<Button Name="Switch 3-1" Pin="16" />
<Button Name="Switch 3-3" Pin="17" />
<Button Name="Switch 4-1" Pin="18" />
<Button Name="Switch 4-3" Pin="19" />
<Button Name="Switch 5-1" Pin="48" />
<Button Name="Switch 5-3" Pin="50" />
<Button Name="Switch 6-1" Pin="58" />
<Button Name="Switch 6-3" Pin="57" />
<Button Name="Switch 7-1" Pin="60" />
<Button Name="Switch 7-3" Pin="59" />
<Button Name="Switch 8-1" Pin="62" />
<Button Name="Switch 8-3" Pin="61" />
<Button Name="Switch 9-1" Pin="64" />
<Button Name="Switch 9-3" Pin="63" />
<Button Name="Switch 10-1" Pin="66" />
<Button Name="Switch 10-3" Pin="65" />
<LcdDisplay Name="LCD 1" Address="39" Cols="16" Lines="2" />
<LcdDisplay Name="LCD 2" Address="38" Cols="16" Lines="2" />
<LedModule Name="7-Segment" ModelType="0" DinPin="23" ClsPin="25" ClkPin="27" Brightness="15" NumModules="1" />
<Encoder Name="Encoder 1" PinLeft="28" PinRight="30" EncoderType="2" />
<Button Name="Encoder 1 Push" Pin="32" />
<Encoder Name="Encoder 2" PinLeft="29" PinRight="31" EncoderType="2" />
<Button Name="Encoder 2 Push" Pin="33" />
<Encoder Name="Encoder 3" PinLeft="44" PinRight="46" EncoderType="2" />
<Button Name="Encoder 3 Push" Pin="67" />
<Servo Name="Servo 1" DataPin="35" />
<Servo Name="Servo 2" DataPin="34" />
<Stepper Name="Stepper 1" Pin1="36" Pin2="38" Pin3="40" Pin4="42" BtnPin="0" Mode="0" Backlash="0" Deactivate="false" Profile="0" />
<ShiftRegister Name="ShiftRegister 1" LatchPin="45" ClockPin="47" DataPin="49" NumModules="1" />
<InputShiftRegister Name="InputShifter" LatchPin="51" ClockPin="52" DataPin="53" NumModules="1" />
<AnalogInput Name="POT 1" Pin="54" Sensitivity="5" />
<AnalogInput Name="POT 2" Pin="55" Sensitivity="5" />
<AnalogInput Name="POT 3" Pin="56" Sensitivity="5" />
<InputMultiplexer Name="Multiplexer 1-1" DataPin="2" NumBytes="2">
<Selector Name="MultiplexerDriver" PinSx="37 39 41 43" />
</InputMultiplexer>
<InputMultiplexer Name="Multiplexer 1-2" DataPin="3" NumBytes="2">
<Selector Name="MultiplexerDriver" PinSx="37 39 41 43" />
</InputMultiplexer>
</Config>
Binary file added Boards/mobiflight_mega.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Boards/mobiflight_micro.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Boards/mobiflight_nano.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Boards/mobiflight_uno.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 15 additions & 5 deletions MobiFlight/Board.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class DeviceConfigFile
public string Name;
public string Description;
public string File;
public bool DefaultUpload = true;
}

/// <summary>
Expand Down Expand Up @@ -445,7 +446,7 @@ public override string ToString()
/// <returns>The </returns>
protected string GetDefaultDeviceConfigFilePath()
{
return Path.Combine(BasePath, "config", $"{Info.FirmwareBaseName}.mfmc") ;
return Path.Combine(BasePath, "config", $"{Info.FirmwareBaseName}.mfmc");
}

public IEnumerable<DeviceConfigFile> GetExistingDeviceConfigFiles()
Expand All @@ -456,7 +457,7 @@ public IEnumerable<DeviceConfigFile> GetExistingDeviceConfigFiles()
var DefaultDeviceConfigFile = GetDefaultDeviceConfigFilePath();
if (!File.Exists(DefaultDeviceConfigFile))
return new List<DeviceConfigFile>();

return new List<DeviceConfigFile>
{
new DeviceConfigFile
Expand All @@ -467,13 +468,22 @@ public IEnumerable<DeviceConfigFile> GetExistingDeviceConfigFiles()
}
};
}


var configFolder = Path.Combine(BasePath, "config");

if (PartnerLevel==BoardPartnerLevel.Core)
{
// for the built-in boards, the folder structure is not the same as for community boards
configFolder = Path.Combine(BasePath, "Boards/config");
}


return Info.DeviceConfigs
.Select(file => new DeviceConfigFile
.Select(file => new DeviceConfigFile()
{
Name = file.Name,
Description = file.Description,
File = Path.Combine(BasePath, "config", file.File)
File = Path.Combine(configFolder, file.File)
})
.Where(file => File.Exists(file.File));
}
Expand Down
15 changes: 15 additions & 0 deletions MobiFlightConnector.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,9 @@
<None Include="Boards\arduino_uno.board.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Boards\config\prototyping-board-latest.mega.mfmc">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Boards\mfboard.schema.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -1324,6 +1327,18 @@
<Content Include="Boards\board-logo.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Boards\mobiflight_mega.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Boards\mobiflight_micro.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Boards\mobiflight_nano.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Boards\mobiflight_uno.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="mobiflight.ico" />
<None Include="Resources\disabled.png" />
<Content Include="Resources\discord_icon.png" />
Expand Down
38 changes: 29 additions & 9 deletions UI/Panels/Device/MFModulePanel.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions UI/Panels/Device/MFModulePanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ public MFModulePanel(MobiFlightModule module)

PortValueLabel.Text = module.Port;

DisplayDetails(module.Board);
groupBoxDetails.Visible = false;

if (module.HasMfFirmware())
{
DisplayDetails(module.Board);
}

initialized = true;
}
Expand All @@ -64,6 +69,8 @@ private void DisplayDetails(Board board)
return;
}

groupBoxDetails.Visible = true;

if (board.Info.Community?.Project != null)
labelProjectValue.Text = board.Info.Community.Project;
else
Expand Down Expand Up @@ -105,7 +112,10 @@ private void DisplayDetails(Board board)
if (specificDeviceConfigs.Count() == 1)
{
var profile = specificDeviceConfigs.First();
UploadDefaultConfigRequested?.Invoke(this, profile.File);
if(profile.DefaultUpload)
{
UploadDefaultConfigRequested?.Invoke(this, profile.File);
}
}
// since we have more options, we present a context menu
else
Expand Down
Loading