Skip to content
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
Binary file modified Arduino/hardware/tools/avr/bin/avrdude.exe
Binary file not shown.
12,857 changes: 8,029 additions & 4,828 deletions Arduino/hardware/tools/avr/etc/avrdude.conf

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Boards/arduino_mega.board.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"$schema": "./mfboard.schema.json",
"AvrDudeSettings": {
"Attempts": 1,
"Device": "atmega2560",
"BaudRate": "115200",
"BaudRates": [ "115200" ],
"Programmer": "wiring",
"FirmwareBaseName": "mobiflight_mega",
"ResetFirmwareFile": "reset.arduino_mega_1_0_2.hex",
Expand Down
3 changes: 2 additions & 1 deletion Boards/arduino_micro.board.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"$schema": "./mfboard.schema.json",
"AvrDudeSettings": {
"BaudRate": "57600",
"Attempts": 1,
"BaudRates": [ "57600" ],
"Device": "atmega32u4",
"FirmwareBaseName": "mobiflight_micro",
"Programmer": "avr109",
Expand Down
166 changes: 166 additions & 0 deletions Boards/arduino_nano.board.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
{
"$schema": "./mfboard.schema.json",
"AvrDudeSettings": {
"Attempts": 1,
"Device": "atmega328p",
"BaudRates": [ "115200", "57600" ],
"Programmer": "arduino",
"FirmwareBaseName": "mobiflight_nano",
"Timeout": 15000,
"ResetFirmwareFile": "reset.arduino_uno_1_0_2.hex"
},
"Connection": {
"ConnectionDelay": 1750,
"DelayAfterFirmwareUpdate": 0,
"DtrEnable": true,
"EEPROMSize": 286,
"ExtraConnectionRetry": true,
"ForceResetOnFirmwareUpdate": false,
"MessageSize": 64,
"TimeoutForFirmwareUpdate": 60000
},
"HardwareIds": [
"^VID_2341&PID_0043",
"^VID_2A03&PID_0043",
"^VID_2341&PID_0243",
"^VID_2341&PID_0001",
"^VID_1A86&PID_7523",
"^VID_0403&PID_6001",
"^VID_0403\\+PID_6001\\+.+"
],
"Info": {
"CanInstallFirmware": true,
"FriendlyName": "Arduino Nano",
"LatestFirmwareVersion": "2.3.0",
"MobiFlightType": "MobiFlight Nano"
},
"ModuleLimits": {
"MaxAnalogInputs": 6,
"MaxButtons": 18,
"MaxEncoders": 9,
"MaxInputShifters": 2,
"MaxLcdI2C": 2,
"MaxLedSegments": 1,
"MaxOutputs": 18,
"MaxServos": 2,
"MaxShifters": 2,
"MaxSteppers": 2,
"MaxInputMultiplexer": 3
},
"Pins": [
{
"isAnalog": false,
"isI2C": false,
"isPWM": false,
"Pin": 2
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": true,
"Pin": 3
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": false,
"Pin": 4
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": true,
"Pin": 5
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": true,
"Pin": 6
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": false,
"Pin": 7
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": false,
"Pin": 8
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": true,
"Pin": 9
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": true,
"Pin": 10
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": true,
"Pin": 11
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": false,
"Pin": 12
},
{
"isAnalog": false,
"isI2C": false,
"isPWM": false,
"Pin": 13
},
{
"isAnalog": true,
"isI2C": false,
"isPWM": false,
"Name": "A0",
"Pin": 14
},
{
"isAnalog": true,
"isI2C": false,
"isPWM": false,
"Name": "A1",
"Pin": 15
},
{
"isAnalog": true,
"isI2C": false,
"isPWM": false,
"Name": "A2",
"Pin": 16
},
{
"isAnalog": true,
"isI2C": false,
"isPWM": false,
"Name": "A3",
"Pin": 17
},
{
"isAnalog": true,
"isI2C": true,
"isPWM": false,
"Name": "A4",
"Pin": 18
},
{
"isAnalog": true,
"isI2C": true,
"isPWM": false,
"Name": "A5",
"Pin": 19
}
]
}
3 changes: 2 additions & 1 deletion Boards/arduino_uno.board.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"$schema": "./mfboard.schema.json",
"AvrDudeSettings": {
"Attempts": 1,
"Device": "atmega328p",
"BaudRate": "115200",
"BaudRates": [ "115200" ],
"Programmer": "arduino",
"FirmwareBaseName": "mobiflight_uno",
"Timeout": 15000,
Expand Down
40 changes: 33 additions & 7 deletions Boards/mfboard.schema.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,44 @@
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$schema": "https://json-schema.org/draft/2019-09/schema#",
"$id": "https://mobiflight.com/mfboard.schema.json",
"title": "Root",
"type": "object",
"required": ["Connection", "HardwareIds", "Info", "ModuleLimits", "Pins"],
"required": [ "Connection", "HardwareIds", "Info", "ModuleLimits", "Pins" ],
"properties": {
"AvrDudeSettings": {
"$id": "#root/AvrDudeSettings",
"title": "Avrdudesettings",
"type": "object",
"description": "Settings for flashing Arduino devices with avrdude.",
"required": ["BaudRate", "Device", "FirmwareBaseName", "Programmer"],
"required": [ "Attempts", "BaudRates", "Device", "FirmwareBaseName", "Programmer" ],
"properties": {
"Attempts": {
"$id": "#root/AvrDudeSettings/Attempts",
"title": "Attempts",
"description": "Number of times AvrDude should retry connecting to the device.",
"type": "integer"
},
"BaudRate": {
"$id": "#root/AvrDudeSettings/BaudRate",
"title": "Baudrate",
"description": "Baud rate to use with AvrDude.",
"deprecated": true,
"description": "Baud rate to use with AvrDude. Deprecated. Use BaudRates instead.",
"type": "string"
},
"BaudRates": {
"$id": "#root/AvrDude/Settings/BaudRates",
"title": " Baudrates",
"description": "All supported baud rates to use with AvrDude.",
"type": "array",
"default": [],
"items": {
"$id": "#root/BaudRates/items",
"title": "Items",
"description": "A baud rate for communicating with the device.",
"type": "string"
}
},
"Device": {
"$id": "#root/AvrDudeSettings/Device",
"title": "Device",
Expand Down Expand Up @@ -107,6 +127,13 @@
"title": "Messagesize",
"description": "Maximum size of a CmdMessenger message, in bytes.",
"type": "integer"
},
"TimeoutForFirmwareUpdate": {
"$id": "#root/Connection/TimeoutForFirmwareUpdate",
"title": "Timeoutforfirmwareupdate",
"description": "Number of milliseconds to wait for the firmware update to complete before attempting to call GetInfo on the board. Default 15000.",
"type": "integer",
"default": 15000
}
}
},
Expand Down Expand Up @@ -176,7 +203,6 @@
"MaxOutputs",
"MaxServos",
"MaxSteppers",
"MaxInputShifters",
"MaxInputMultiplexer"
],
"properties": {
Expand Down Expand Up @@ -258,7 +284,7 @@
"$id": "#root/Pins/items",
"title": "Items",
"type": "object",
"required": ["isAnalog", "isPWM", "isI2C", "Pin"],
"required": [ "isAnalog", "isPWM", "isI2C", "Pin" ],
"properties": {
"isAnalog": {
"$id": "#root/Pins/items/isAnalog",
Expand All @@ -282,7 +308,7 @@
"$id": "#root/Pins/items/Name",
"title": "Name",
"description": "Optional display name for the pin.",
"examples": ["A1"],
"examples": [ "A1" ],
"type": "string"
},
"Pin": {
Expand Down
39 changes: 38 additions & 1 deletion MobiFlight/Board.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,21 @@ namespace MobiFlight
public class AvrDudeSettings
{
/// <summary>
/// Baud rate to use with AvrDude.
/// Number of times AvrDude should retry connecting to the device.
/// </summary>
public int Attempts;

/// <summary>
/// Baud rate to use with AvrDude. Deprecated. Use BaudRates instead.
/// </summary>
[Obsolete]
public String BaudRate;

/// <summary>
/// All supported baud rates to use with AvrDude.
/// </summary>
public List<String> BaudRates;

/// <summary>
/// AvrDude device type for the device.
/// </summary>
Expand Down Expand Up @@ -91,6 +102,11 @@ public class Connection
/// Maximum size of a CmdMessenger message, in bytes.
/// </summary>
public int MessageSize;

/// <summary>
/// Number of milliseconds to wait for the firmware update to complete before attempting to call GetInfo on the board.
/// </summary>
public int TimeoutForFirmwareUpdate = 15000;
}

/// <summary>
Expand Down Expand Up @@ -212,6 +228,27 @@ public class Board
/// </summary>
public List<MobiFlightPin> Pins;

/// <summary>
/// Migrates board definitions from older versions to newer versions.
/// </summary>
public void Migrate()
{
// Migrate AvrDudeSettings from older versions.
if (AvrDudeSettings != null)
{
// Older versions of boards only specified a single baud rate. Handle the case where
// an old file was loaded by migrating the BaudRate value into the BaudRates array.
if (!String.IsNullOrEmpty(AvrDudeSettings.BaudRate) && AvrDudeSettings.BaudRates == null)
{
AvrDudeSettings.BaudRates = new List<string>()
{
AvrDudeSettings.BaudRate
};
}

}
}

public override string ToString()
{
return $"{Info.MobiFlightType} ({Info.FriendlyName})";
Expand Down
1 change: 1 addition & 0 deletions MobiFlight/BoardDefinitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public static void Load()
try
{
var board = JsonConvert.DeserializeObject<Board>(File.ReadAllText(definitionFile));
board.Migrate();
boards.Add(board);
Log.Instance.log($"Loaded board definition for {board.Info.MobiFlightType} ({board.Info.FriendlyName})", LogSeverity.Info);
}
Expand Down
Loading