MobiFlight-Connector icon indicating copy to clipboard operation
MobiFlight-Connector copied to clipboard

Support Arduino Nano

Open neilenns opened this issue 2 years ago • 5 comments

Is your feature request related to a problem? Please describe.

It's basically an Uno. We should support the Nano :)

Describe the solution you'd like

Support the Nano

Describe alternatives you've considered

Don't support the Nano

Additional context

Once #553 is done this is trivial.

neilenns avatar Nov 21 '21 02:11 neilenns

@neilenns Would you like to add the board definition for the nano?

DocMoebiuz avatar Dec 01 '21 18:12 DocMoebiuz

I was thinking it should wait until after the 2.0 release? To give time for people to test and make sure the firmware actually works

neilenns avatar Dec 01 '21 18:12 neilenns

Also I ran into trouble when I was doing this locally because my nano has the same vid and PID as the mega

neilenns avatar Dec 01 '21 18:12 neilenns

That's fine. You are right... we can wait with this one until after the release. I have seen this problem before where VID/PID combos are used by mega and uno... which is even more disturbing. A user can now handle that locally by editing the info but maybe there is a better solution.

DocMoebiuz avatar Dec 01 '21 18:12 DocMoebiuz

The real way to solve it is to pop a dialogue and ask the user which of the matching boards should be used. That would only need to happen if the board doesn't have the mobile flight firmware already on it because once the firmware is on it the new board system knows what it is for real

neilenns avatar Dec 01 '21 18:12 neilenns

@DocMoebiuz so should we do this or nah? 😂

neilenns avatar Oct 28 '22 17:10 neilenns

i thought we have everything we need now

DocMoebiuz avatar Nov 16 '22 17:11 DocMoebiuz

With the changes you added to handle ambiguous boards we could. Requires:

  1. Building and bundling a nano built firmware
  2. Adding the nano board.json

neilenns avatar Nov 16 '22 18:11 neilenns

And old / new bootloader is considered? I tried to use 2.json files which just differ in the bootloader parameter, but this was not the best idea.

elral avatar Nov 16 '22 18:11 elral

And old / new bootloader is considered? I tried to use 2.json files which just differ in the bootloader parameter, but this was not the best idea.

that's how it is in the arduino IDE iirc. Arduino nano (old bootloader)

DocMoebiuz avatar Nov 16 '22 18:11 DocMoebiuz

@neilenns no board is recognized if 2 json files with the same type but different Baud rate are n the board folder. I couldn't find another way as to use 2 environments in PlatformIO for new and old bootloader and different Mobiflight types with 2 json files accordingly.

elral avatar Nov 16 '22 18:11 elral

Ahhhh right. Would need to report two different MobiFlight type which is weird because they would be identical otherwise. Hmmmmm.

neilenns avatar Nov 16 '22 18:11 neilenns

Maybe we should move the type to the platformio.ini file so at least the board file can be double used. Same would apply for the Leonardo (just a question on Discord)

elral avatar Nov 16 '22 19:11 elral

It just seems wrong to ship two firmwares that are identical other than MobiFlight type. This can probably be solved in the desktop side by grabbing all matching boards. I'll look later.


From: elral @.> Sent: Wednesday, November 16, 2022 11:02:43 AM To: MobiFlight/MobiFlight-Connector @.> Cc: Neil Enns @.>; Mention @.> Subject: Re: [MobiFlight/MobiFlight-Connector] Support Arduino Nano (Issue #579)

Maybe we should move the type to the platformio.ini file so at least the board file can be double used. Same would apply for the Leonardo (just a question on Discord)

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMobiFlight%2FMobiFlight-Connector%2Fissues%2F579%23issuecomment-1317527162&data=05%7C01%7C%7Ce2bc242edaf849539b0f08dac8052507%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638042221672567964%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=97gEVj2iU0FyduXPh9QItTs79EwFeAo45i8rxKHLMTM%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACIVHFTN74RMP67GJ64TG5LWIUVVHANCNFSM5IOT2N6A&data=05%7C01%7C%7Ce2bc242edaf849539b0f08dac8052507%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638042221672567964%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=wAWu%2FFsh0K3JVUeXA%2FsPZaG6dsQzvgfn%2B5Hg9rmcoIc%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

neilenns avatar Nov 16 '22 19:11 neilenns

Thinking about this more on the drive home the Nano is a giant pain. Even if we had firmware that reported two different MobiFlight Type values we still wouldn't know what baud rate to use when connecting to the board in the first place. It's a circular loop: to connect to the board we need to know the baud rate, but we don't know the baud rate unless we connect to the board and ask its type.

Even after flashing the board in the first place this would be a problem on every launch of MobiFlight on the desktop.

Possible solutions would be:

  1. Caching the working baud rate for each COM port
  2. Trying each matching board file in order until one of them works every time we want to connect
  3. Asking the user every time MobiFlight runs what kind of nano it is

All of these require real coding work beyond just shipping a .board.json and firmware.

neilenns avatar Nov 16 '22 20:11 neilenns

i was going with the assumption that the baudRate adjustment was only required for the bootloader when uploading the sketch. Is it really every time that you would want to connect?

DocMoebiuz avatar Nov 16 '22 20:11 DocMoebiuz

I am right with my assumption. It is only required for uploading the sketch. So we could very well talk to it during normal MF operations regardless of the variant.

Only the avrdude settings are different for one or the other. That is already supported.

DocMoebiuz avatar Nov 16 '22 20:11 DocMoebiuz

I am using both types since month w/o problems, just the two different json files and 2 different environments in PlatformIO.

elral avatar Nov 16 '22 21:11 elral

Ah, I thought the baud rate mattered when talking to the board after flash as well. Ok, let me go investigate some stuff on the Mobiflight board.json side of things.

neilenns avatar Nov 16 '22 21:11 neilenns

Opened a PR to support multiple baud rates in a given board.json file. No idea if it works. Someone with the two different Nanos should try it 😀

https://github.com/MobiFlight/MobiFlight-Connector/pull/1015

neilenns avatar Nov 17 '22 00:11 neilenns