Replies: 10 comments 14 replies
-
I've started to play around with this and it's sooooooooooooo cool and has so much promise! |
Beta Was this translation helpful? Give feedback.
-
hi @neilenns! sounds really cool, but i would really appreciate to discuss things a bit more before going all into it. Maybe there is a clever way to keep the changes to the info class and not having to change so many places in the code. |
Beta Was this translation helpful? Give feedback.
-
There was a bunch of discussion in Discord today about the Nano and ProMini. Building the firmware for these is trivially possible now thanks to the PlatformIO migration. If MobiFlight supported dynamically loading board configurations from an XML file it would only require dropping new config files for the Nano and ProMini into the correct folder and then they would Just Work with MF. |
Beta Was this translation helpful? Give feedback.
-
I've spent a bunch of time digging through the code, understanding how things work today. Here's what I discovered. How things work todayWhen MobiFlight runs it needs to know two things:
For the first question MobiFlight uses the The second test is done in two different ways. If the MobiFlight firmware is installed then the type is determined based on the value reported from the firmware for The key thing to note with this approach is the type mapping based on the firmware reported value is hardcoded and only supports Uno, Pro Micro, and Mega boards. This hardcoded mapping is used throughout the code to make decisions on what is supported by the boards, how to flash devices, etc. Proposed changesMobiFlight is fundamentally doing the right checks today: first determine if the connected USB device is supported, then My proposal has two parts:
The first part relies on dynamically loading a list of board definitions from XML at startup instead of relying on a hardcoded list. The files contain the expected The second change is to associate the board definition with the Here's an example of how the code changes once the board definition is available in the module. Today Version latestVersion = new Version(MobiFlightModuleInfo.LatestFirmwareMega);
if (module.Type == MobiFlightModuleInfo.TYPE_MICRO)
latestVersion = new Version(MobiFlightModuleInfo.LatestFirmwareMicro);
if (module.Type == MobiFlightModuleInfo.TYPE_UNO)
latestVersion = new Version(MobiFlightModuleInfo.LatestFirmwareUno); with a board definition available on the module object this simply becomes: Version latestVersion = new Version(module.Board.LatestFirmwareVersion); Advantages to this approach
What changes in the code
A branch with these changes is available on GitHub. It works, both with current boards and new boards like the Nano or my custom ATmega32u4 board. The one thing I'm still not sure about is why |
Beta Was this translation helpful? Give feedback.
-
I thought severel times about this topic and if I should answer as I have to less knowledge on the connector side. /edit: not to forget, an editor for board xml files would be much helpfull |
Beta Was this translation helpful? Give feedback.
-
Hey Neill! Thanks for all the great write up and effort! In general, i had thought about this in the past and I am happy to see that we are now taking a stab at this. There are some concerns that I would like to bring up:
There should be an official repository then for boards probably and a community repository. I will have a look at all the changes later today - in general I am supporting this functionality a lot. |
Beta Was this translation helpful? Give feedback.
-
Opened a draft PR for this. I found a few places I need to make some tweaks while doing so, plus need to update the unit tests. |
Beta Was this translation helpful? Give feedback.
-
Let's go JSON
|
Beta Was this translation helpful? Give feedback.
-
It would be good directly to think about how different flash tools. A topic could be special procedures to get into the bootloader like the promicro (which also applies to e.g. the Raspberry Pico). |
Beta Was this translation helpful? Give feedback.
-
This has been implemented and is working great! Thanks @neilenns and everyone else who helped! |
Beta Was this translation helpful? Give feedback.
-
I'd like to change how board configurations are managed in MobiFlight-Connector so they load dynamically from XML files at runtime. Currently they are hardcoded in
MobiFlightModuleInfo.cs
which makes several scenarios challenging:We've briefly touched on two approaches to doing this in the Discord chat: dynamically load on the desktop or query the device for its capabilities. I believe the simplest approach is to load on the desktop. It scopes the changes to one side of the MobiFlight system, and doesn't require adding large amounts of static data (pin assignments) to an already size-constrained firmware. It also means all existing firmware out there (including custom versions) can take advantage of this without having to make any changes.
To implement this I will:
Board
class that encapsulates the various configuration options currently hard coded inMobiFlightModuleInfo.cs
BoardDefinition
class that loads XML files from disk when MobiFlight launches and providesGetBoardByHardwareId()
andGetBoardByName()
methods that return the appropriate board definitionBeta Was this translation helpful? Give feedback.
All reactions