PyPortal status LED not displaying expected color

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
macewmi
 
Posts: 69
Joined: Sat Feb 08, 2020 10:26 am

PyPortal status LED not displaying expected color

Post by macewmi »

According to https://learn.adafruit.com/welcome-to-c ... 2978455-24, the status pixel on a PyPortal displays the following colors.
What does the status NeoPixel indicate once my code.py is
running?
Once your PyPortal boots up and successfully loads your code.py or
main.py, the status NeoPixel will turn green briefly. Then, the
NeoPixel will show one of the following color codes to indicate the
status of the WiFi connection/activity or file operations:
Red = not connected to WiFi
Blue = connected to WiFi
Yellow = fetching data
Blue = got data
Cyan = file opening
But both the Countdown Timer https://learn.adafruit.com/pyportal-eve ... down-clock and Hurricane Tracker https://learn.adafruit.com/pyportal-hurricane-tracker example apps don't exhibit that behavior.
Countdown Timer goes to RED and stays there the entire time.
Hurricane Tracker goes RED, changes to YELLOW and stays there.

To test the status LED, I ran this code:

Code: Select all

import time
import board
import neopixel
pixels=neopixel.NeoPixel(board.NEOPIXEL, 1)
    pixels.fill((0, 0, 255))
whileTrue:
    pass
And the status LED turned BLUE suggesting that it's not a hardware problem.

Can anyone explain why those example apps don't work as expected?

TIA

User avatar
adafruit_support_carter
 
Posts: 29157
Joined: Tue Nov 29, 2016 2:45 pm

Re: PyPortal status LED not displaying expected color

Post by adafruit_support_carter »

What version of CircuitPython are you running? Can check by looking in the boot_out.txt file located in the CICUITPY folder.

User avatar
macewmi
 
Posts: 69
Joined: Sat Feb 08, 2020 10:26 am

Re: PyPortal status LED not displaying expected color

Post by macewmi »

I’m away right now, so without actually looking at the file, I want to say 7.3.3(?)

User avatar
adafruit_support_carter
 
Posts: 29157
Joined: Tue Nov 29, 2016 2:45 pm

Re: PyPortal status LED not displaying expected color

Post by adafruit_support_carter »

OK, I'm seeing same general behavior on a PyPortal running the Hurricane tracker. Code seems to run fine. But NeoPixel is not changing color exactly as described - or at least doesn't appear to be.

I've pinged the library author to take a look. Maybe something has changed and that info needs updating.

Just to check - is everything running OK for your setup? It's just the behavior of the NeoPixel that's in question?

User avatar
macewmi
 
Posts: 69
Joined: Sat Feb 08, 2020 10:26 am

Re: PyPortal status LED not displaying expected color

Post by macewmi »

Everything is running fine except for the status LED. Thanks.

User avatar
macewmi
 
Posts: 69
Joined: Sat Feb 08, 2020 10:26 am

Re: PyPortal status LED not displaying expected color

Post by macewmi »

Ran some additional tests. Very interesting results. Here's the code.

Code: Select all

import time
import board
from adafruit_pyportal import PyPortal

cwd = ("/"+__file__).rsplit('/', 1)[0]

pyportal = PyPortal(status_neopixel=board.NEOPIXEL,
                    default_bg=cwd+"/countdown_background.bmp")

print("Get time 1")
try:
    print("Getting time from internet!")
    pyportal.get_local_time()
except RuntimeError as e:
    print("Some error occured, retrying! -", e)
    continue
print("Time 1 got")
    
print("Get time 2")
try:
    print("Getting time from internet!")
    pyportal.get_local_time()
except RuntimeError as e:
    print("Some error occured, retrying! -", e)
    continue
print("Time 2 got")
    
time.sleep(10)

while True:
	pass
	
RESULTS:
The status_led flashes GREEN at power-up and goes dark. Expected.
The status goes RED right after "Get Time 1". Expected.
It stays RED after "Time 1 got". BLUE is expected.
Immediately after "Get Time 2", it goes BLUE!! And stays BLUE

User avatar
MakerMelissa
 
Posts: 375
Joined: Wed Jun 05, 2013 2:10 am

Re: PyPortal status LED not displaying expected color

Post by MakerMelissa »

Thanks, I just grabbed my PyPortal and reproduced the same results you had. I'm going to dig in and see why the lights are different. Most likely the library just needs a few tweaks.

User avatar
MakerMelissa
 
Posts: 375
Joined: Wed Jun 05, 2013 2:10 am

Re: PyPortal status LED not displaying expected color

Post by MakerMelissa »

Here's the colors currently in the library:

Code: Select all

STATUS_NO_CONNECTION = (100, 0, 0)  # Red
STATUS_CONNECTING = (0, 0, 100)     # Blue
STATUS_FETCHING = (200, 100, 0)     # Orange
STATUS_DOWNLOADING = (0, 100, 100)  # Cyan
STATUS_CONNECTED = (0, 100, 0)      # Green
STATUS_DATA_RECEIVED = (0, 0, 100)  # Blue
STATUS_OFF = (0, 0, 0)              # Off
It looks like they're slightly different than the documentation with Green meaning connected and Blue meaning in the process of connecting or Data Received. Fetching should probably be changed to yellow instead of orange.

User avatar
MakerMelissa
 
Posts: 375
Joined: Wed Jun 05, 2013 2:10 am

Re: PyPortal status LED not displaying expected color

Post by MakerMelissa »

I created an issue in GitHub with the issues I saw regarding the mismatch: https://github.com/adafruit/Adafruit_Ci ... /issues/83

User avatar
MakerMelissa
 
Posts: 375
Joined: Wed Jun 05, 2013 2:10 am

Re: PyPortal status LED not displaying expected color

Post by MakerMelissa »

I submitted a fix. Please note that once the fix is merged in, the frozen library inside the firmware will still need to be updated as well and it would only update on future firmware releases.

User avatar
macewmi
 
Posts: 69
Joined: Sat Feb 08, 2020 10:26 am

Re: PyPortal status LED not displaying expected color

Post by macewmi »

Thank you for fixing that.

What will I be keeping an eye out for to ensure I get the fix downloaded? Am I watching for an updated UF2 file? new library bundle?

User avatar
MakerMelissa
 
Posts: 375
Joined: Wed Jun 05, 2013 2:10 am

Re: PyPortal status LED not displaying expected color

Post by MakerMelissa »

Thanks for the reminder. I need to update my CircuitPython repo, run a script to update frozen libraries and submit a PR. Then it would be in the next release after that's merged in.

For now, you can always download the updated library and stick it in the root (top level) folder of your device, which is how I tested it. Since it's a frozen library, the built-in one will override anything in the lib folder, but not from the root.

Melissa

User avatar
MakerMelissa
 
Posts: 375
Joined: Wed Jun 05, 2013 2:10 am

Re: PyPortal status LED not displaying expected color

Post by MakerMelissa »

I submitted a PR here if you'd like to watch it: https://github.com/adafruit/circuitpython/pull/7248

User avatar
MakerMelissa
 
Posts: 375
Joined: Wed Jun 05, 2013 2:10 am

Re: PyPortal status LED not displaying expected color

Post by MakerMelissa »

Ok, apparently updating the libraries is a normal part of the release process, so it should automatically be part of the next CircuitPython 8 Beta release at least.

User avatar
macewmi
 
Posts: 69
Joined: Sat Feb 08, 2020 10:26 am

Re: PyPortal status LED not displaying expected color

Post by macewmi »

OK. Thanks. I'll keep an eye out for that.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”