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

Support Arduino Nano #579

Closed
neilenns opened this issue Nov 21, 2021 · 21 comments · Fixed by #1016
Closed

Support Arduino Nano #579

neilenns opened this issue Nov 21, 2021 · 21 comments · Fixed by #1016
Assignees
Labels
enhancement Improvement of an existing feature

Comments

@neilenns
Copy link
Contributor

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.

@DocMoebiuz
Copy link
Collaborator

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

@neilenns
Copy link
Contributor Author

neilenns commented Dec 1, 2021

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
Copy link
Contributor Author

neilenns commented Dec 1, 2021

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

@DocMoebiuz
Copy link
Collaborator

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.

@neilenns
Copy link
Contributor Author

neilenns commented Dec 1, 2021

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

@MobiFlight-Admin MobiFlight-Admin added the enhancement Improvement of an existing feature label Dec 4, 2021
@MobiFlight-Admin MobiFlight-Admin added this to the 9.3 milestone Dec 4, 2021
@DocMoebiuz DocMoebiuz modified the milestones: 9.3, 10.0 Feb 20, 2022
@DocMoebiuz DocMoebiuz removed this from the 10.0 milestone Mar 7, 2022
@neilenns
Copy link
Contributor Author

@DocMoebiuz so should we do this or nah? 😂

@DocMoebiuz
Copy link
Collaborator

i thought we have everything we need now

@neilenns
Copy link
Contributor Author

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

@elral
Copy link
Contributor

elral commented Nov 16, 2022

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.

@neilenns
Copy link
Contributor Author

neilenns commented Nov 16, 2022 via email

@DocMoebiuz
Copy link
Collaborator

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)

@elral
Copy link
Contributor

elral commented Nov 16, 2022

@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.

@neilenns
Copy link
Contributor Author

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

@elral
Copy link
Contributor

elral commented Nov 16, 2022

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)

@neilenns
Copy link
Contributor Author

neilenns commented Nov 16, 2022 via email

@neilenns
Copy link
Contributor Author

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.

@DocMoebiuz
Copy link
Collaborator

DocMoebiuz commented Nov 16, 2022

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
Copy link
Collaborator

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.

@elral
Copy link
Contributor

elral commented Nov 16, 2022

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

@neilenns
Copy link
Contributor Author

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
Copy link
Contributor Author

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 😀

#1015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement of an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants