-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Improvement to Badger 2040 operation on battery #6208
Conversation
ImportError: cannot import name 'get_terminal_size' from 'click.termui' |
Yes, I see. I don't know what the issue there would be, given I do not even import those within my commit. Input would be welcome |
It's stemming from an update to the |
@jepler is working on sorting it out in adafruit/cascadetoml#8 |
@ZodiusInfuser If you push an empty commit or trivial change, it should now rebuild and work. We fixed a problem that was breaking the builds: #6210. |
Thanks @dhalbert. I've done as you suggested, though it doesn't look like any actions have been triggered. |
It's now failing for a different reason; there's a compile error, for example: https://github.com/adafruit/circuitpython/runs/5735590430?check_suite_focus=true#step:9:159 Re your pin query: In principle, I don't think there's a problem exposing an already-created If you do want to do this: since this is a new concept, there could be user confusion about whether you're exposing a I am surprised at your 10-second delay. Have you tried doing this in boot.py rather than code.py? If code.py is large, I guess the compilation might take a while. |
Now the build error is related to your change. Please take a look. I added an additional comment at the spot that may be the cause of this error, but didn't do any additional building or testing. Thanks!
|
I tried doing the HAL solution first, but think I encountered issues when the user code created the
Those do sound like better names, I'll switch to one of them.
The setup was within the user code I believe. I will give boot.py a try.
Odd, I haven't encountered that compiler error locally. Would that extern you suggested resolve this? |
I think it should (suggested by @jepler). What compiler version are you using? |
The extern thing made the CI happy @jepler!
Further to this. It does seem like the 10 second delay was just due to the example I was using. I wrote a simpler example and that kicks in within 2 seconds (not accurately measured), so I tried setting the pin in boot.py as suggested. Unfortunately, for whatever reason either the code didn't execute or the pin was reset between boot.py and code.py, causing the board to shut off upon button release. This premade |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your thoughts. I like this as is now. It's a new idea for default board objects, and that's good, and might be a model for other such things.
Thanks @dhalbert! |
@ZodiusInfuser Check the discussion here: #6227, about an issue that came up because I'm not sure tht |
Badger2040 has a 3V3 enable like that it can set high to keep itself awake, or set low to turn off. The 5 front buttons wake the board up.
The intention was that the user would press a button, then user code would kick in to enable the pin to keep the board awake from thereon. However, it seems that CircuitPython takes a while to set itself up, requiring the user to hold one of the front buttons for over 10 seconds.
I have now moved the pin initialisation and enabling into
board_init
, reducing that time down to around 1 second. Basically after the activity LED stops flashing. I have also exposed thedigitalio
object inboard
so the user can turn the board off after their code has run.Please let me know if this process is okay? The only example I could find of a similar use was:
circuitpython/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c
Line 119 in dd73182
Also, I wonder if I should do similar for all the user buttons on the product since everyone needs to include the same digitalio setup code anyway? 🤔