-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Added Function To Check the Serial Connection From CircuitPython Layer #628
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
Conversation
ports/atmel-samd/Makefile
Outdated
@@ -268,6 +268,7 @@ SRC_COMMON_HAL = \ | |||
neopixel_write/__init__.c \ | |||
os/__init__.c \ | |||
storage/__init__.c \ | |||
supervisor/Status.c \ |
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.
supervisor/Status.c
line should have a single tab, not spaces.
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.
argh! I meant to go back and fix that before pushing...
@dhalbert did you have more feedback on this. I think we talked about it last week. |
@sommersoft I built this and tried it, but the use did not match the documentation:
Just doing |
Holy moly! I totally forgot to update the documentation after I moved it from With regards to putting this in If you'd rather this goes back into EDIT:
I may have misunderstood this. Is there is a way to leave it in |
If you think it would make sense to have a I was not in the loop on #544. @tannewt do you have a comment? |
I can further mimic I'll wait for any further comments from tannewt before I start pushing forward with changes. |
How about renaming the |
I wonder about permanently branding it that way, in case someone wants to fork. So would Maybe put some of this under
|
I don't know of anything we'd have directly under circuitpython yet. autoreload is two functions now because modules cannot have attributes that are backed by C. I'm ok with it being called something else. |
So I've taken some time to understand both of your points, and do some ponderin' and researchin'.
As with most things I've done so far, I'm of the position that if you want this in a certain place and to function a certain way...that's what I'll do (or attempt). |
Naming problems are hard. I forgot that modules can't have properties, which is one reason why we have I'm guessing that @tannewt's idea of I'm ok with |
The only contribution that I can think of is that That said it's clear that you folks are thinking about where this code should go so perhaps this comment doesn't apply to this scenario, but I thought I would just mention it. |
I like @sommersoft Newer nRF52 boards will likely follow the same "express" design of spare spi flash and status pixel. |
I've come to the conclusion that Pending any changes after review or further discussion, this is ready to merge. |
I like the naming now. I tested this with a CPX and the following
I am using a LiPo battery and the USB plug. If USB is connected, then the NeoPixels turn blue. They're red if USB is unconnected when |
On atmel, it calls |
I don't think we handle connect, disconnect and then reconnect well. (ASF4 USB code doesn't reset correctly as far as I know.) This is an artifact of it. |
I haven't dug all the way back to the ASF level on this yet. But, in |
NOTE TO SELF: revisit the nRF since the new version turns off the UARTtoUSB chip. GOING FURTHER: will this drive a much wider update for all things USB? |
RE: "Dynamic" USB Enabled Check
I'm thinking this simple change can allow it to be a little more accurate when it's called:
|
@sommersoft that looks ok to me. Did you change the files? |
@tannewt @dhalbert, I'll look into the new Feather52 USB stuff once I get one in hand. |
@sommersoft did you get a battery yet to test removing the USB plug while still being powered up? Also, could you merge from upstream now to fix the merge conflicts? Thanks. |
So, @tannewt was correct that the problem is probably deeper in ASF. The above "simple" fix does not work after testing with a battery. Still stays "connected" after removing the USB connection. Guess it's into the breach once more... |
Also, using the device class ( |
I don't think we should block this PR on fixing the after USB case. Its useful enough on start up. We likely won't do multiple USB enumerations until we switch to TinyUSB from ASF4. |
@sommersoft I agree with @tannewt that this is useful as is. Could you just add some documentation caveat that says this will detect if USB was connected at the time the board started, but doesn't detect disconnect (also connect? -- I don't know the answer) later? Then we'll merge it in. |
@dhalbert it does catch the connect scenario (just tested |
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.
Awesome job on this @sommersoft. Thank you so much!
See isREPLconnected & isUSBconnected issue #544.
This only includes
atmel-samd
andnRF
for now. ESP8266 will require more work sincesupervisor
is not an entity on that port.This is my first [sub]module from scratch, so please let me know if I totally bungled it. I kind of patchworked my way through it, after initially just putting it all in
__init__
then realizing that wouldn't work across ports.