Sorry,
I created this one :P

As Calamity pointed out there is some missing runtime type identification of the board, which I recently  commented out. (I owe a unit test ! :P)

Now some history on it :

MRL can now "potentially" compile and upload the board, its necessary to send the correct command line parameters to avrdude.  This is "sort of" done in the ArduinoUtils - but it does not have all the needed types for all the boards.

Previously an if statement existed in ArduinoUtils and depending on how MRL identified a board, it would switch to an something which might work .. 
 
args.add("--board");
if (board.equalsIgnoreCase("nano")) {
        args.add("arduino:avr:" + board + ":cpu=atmega328");
} else {
        args.add("arduino:avr:" + board);
}

The problem with the above code is its trying to support a mapping of  internal defintiions  - "nano" with needed compiler directives.   The "boards.txt" file does this already, and it is the controlling source of this information.  It's "from" the Arduino sdk.

So I made a parser which digests a boards.txt and, builds the UI and delivers the correct compiler directive based on user selection...

Below is how the code is now ..

    args.add(port);
    args.add("--board");
    
    String[] parts = boardKey.split("\\.");
No more growing exception of if statements to handle new types which don't work...
 
Unfortunately, the same material identifying the board coming from an Arduino runtime - is not the same :P.

Sorry I did not finish this (and then forgot that I did not finish is :P), but the intent was to have all 3 of these things agree

 
  • The UI
  • The compiler directive
  • The runtime board information

And have them ALL - base their information on the source which controls it in the Arduino SDK, ie "boards.txt"

Its not complete, but searching for runtime identification I found some more interesting info.

It would be nice if all the definitions would line up - For example if the user does not manually select board type, the connected board would send the correct identifier, such that it had enough information to have the correct parameters on the command line for avrdude to correctly compile and upload a new mrlcomm.

I "think" this is possible if "boards.txt" is used .. but not finished yet...

calamity

7 years 6 months ago

I completely agree with what you are trying to do.

I think to work fine, when MRL connect to an Arduino, the Arduino should answer "hello, i'm an UNO and I run MrlComm vXX.  Then Arduino.java can setup his things base on boards.txt.

Unfortunatly Arduino are stupid. You can't ask them who are you, it won't know how to answer. You can only ask if you are a UNO, do that.

That's why I made some define in MRLComm to it can send the board info to MRL. 

Maybe we can make that section auto-generated based on the info found in boards.txt. So whenever Arduino changes boards.txt, MRLComm can keep updated with it. So we never need to manually update that list