0

pixel[0] lights after "Code done running"
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

pixel[0] lights after "Code done running"

by macewmi on Mon Aug 02, 2021 1:02 pm

Here's a minimal program to test. After the program completes, pixel[0] will periodically turn on (red) and then off. Sometimes it flashes. Sometimes it stays on for 4+/- seconds. Sometimes I've see it flash green-ish or blue-ish. Is this normal behavior?

Code: Select all | TOGGLE FULL SIZE
from adafruit_macropad import MacroPad
import time

macropad = MacroPad()

for i in range(10):
    time.sleep(0.25)



p.s. I closed down Mu, unplugged and replugged into my Mac and now it lights green.

macewmi
 
Posts: 29
Joined: Sat Feb 08, 2020 10:26 am

Re: pixel[0] lights after "Code done running"

by mikeysklar on Tue Aug 03, 2021 10:12 pm

If the goal is not to have the macopad light up at all until you are ready you could add some initializations code such as:

Code: Select all | TOGGLE FULL SIZE
MACROPAD.display.auto_refresh = False
MACROPAD.pixels.auto_write = False

mikeysklar
 
Posts: 5494
Joined: Mon Aug 01, 2016 8:10 pm

Re: pixel[0] lights after "Code done running"

by macewmi on Wed Aug 04, 2021 10:44 am

My goal is that when code.py on the MacroPad finishes and the "code done running" message is displayed on the OLED, then the MacroPad pixel[0] shouldn't randomly flash. If pixel[0] is off at the time the code finishes, then it should stay off and not blink.

The two statements you gave have no effect on the blinking when those statements are included in code.py. (I wouldn't have expected them to have any effect since "code done running" suggest to me that the MacroPad should be behaving like an electric brick at that point.)

Based on those statements, I thought perhaps that the blinking was being caused by the MacroPad doing some sort of check to see if the laptop was trying to transfer new code, but the blinking still occurs when the MacroPad is plugged into a dump USB charging port on my workbench.

Any other thoughts?

macewmi
 
Posts: 29
Joined: Sat Feb 08, 2020 10:26 am

Re: pixel[0] lights after "Code done running"

by mikeysklar on Thu Aug 05, 2021 12:15 pm

Which version of CircuitPython are you running on your macropad? I think it might be worth trying the current 7.0.0-alpha5 if you are not already on it with the current 7.x libraries to see if that changes the idle behavior.

https://circuitpython.org/board/adafrui ... ad_rp2040/

mikeysklar
 
Posts: 5494
Joined: Mon Aug 01, 2016 8:10 pm

Re: pixel[0] lights after "Code done running"

by macewmi on Fri Aug 06, 2021 10:31 pm

Contents of boot_out.txt

Adafruit CircuitPython 7.0.0-alpha.5 on 2021-07-21; Adafruit Macropad RP2040 with rp2040

macewmi
 
Posts: 29
Joined: Sat Feb 08, 2020 10:26 am

Re: pixel[0] lights after "Code done running"

by mikeysklar on Mon Aug 09, 2021 12:45 pm

Great. Glad to see the CircuitPython is current. If you have not already can you replace any of the contents of /lib with the 20210806 7.x library bundle?

https://circuitpython.org/libraries
https://github.com/adafruit/Adafruit_Ci ... 210806.zip

mikeysklar
 
Posts: 5494
Joined: Mon Aug 01, 2016 8:10 pm

Re: pixel[0] lights after "Code done running"

by macewmi on Tue Aug 10, 2021 6:04 pm

The following is a listing of the files in the lib directory after having copied new versions of whatever was there already with a version from /adafruit-circuitpython-bundle-7.x-mpy-20210806.
pixel[0] still flashes, but this time, it's blue. Previously, I've seen red and green.

Code: Select all | TOGGLE FULL SIZE
Aug  6 05:10 adafruit_debouncer.mpy*
Aug  9 18:47 adafruit_display_shapes/
Aug  9 18:47 adafruit_display_text/
Aug  9 18:47 adafruit_hid/
Aug  6 05:10 adafruit_macropad.mpy*
Aug  9 18:47 adafruit_midi/
Aug  6 05:10 adafruit_pixelbuf.mpy*
Aug  6 05:10 adafruit_simple_text_display.mpy*
Aug  6 05:10 neopixel.mpy*

macewmi
 
Posts: 29
Joined: Sat Feb 08, 2020 10:26 am

Re: pixel[0] lights after "Code done running"

by mikeysklar on Wed Aug 11, 2021 2:59 pm

Okay, a change in behavior is notable.

When you look at the serial console in the mu do you see any output from the REPL besides "Code done running" or is that the same?

If you do the reverse and leave the macropad running doing nothing does this stop the random flashing? I am not suggesting this is a solution to sitting idle without blinking, but would like to know if it exhibits the correct behavior.

Code: Select all | TOGGLE FULL SIZE
 from adafruit_macropad import MacroPad
import time

macropad = MacroPad()
macropad.display.auto_refresh = False
macropad.pixels.auto_write = False

while True:
        pass

mikeysklar
 
Posts: 5494
Joined: Mon Aug 01, 2016 8:10 pm

Re: pixel[0] lights after "Code done running"

by macewmi on Wed Aug 11, 2021 6:55 pm

With the code above (while True: pass), pixels[0] does not blink.

If the while loop is removed and the code is allowed to fall through the bottom and end, then I get flashes. (It's back to red right now).

Serial monitor shows the following in response to a SAVE in the Mu IDE.
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:

Code done running.

Press any key to enter the REPL. Use CTRL-D to reload.

macewmi
 
Posts: 29
Joined: Sat Feb 08, 2020 10:26 am

Re: pixel[0] lights after "Code done running"

by mikeysklar on Thu Aug 12, 2021 12:00 pm

Would you like to open an issue on the github report for CircuitPython? This seems like the a settings that others would appreciate that the default state of the macropad be off until code is being executed. It might be declines, but seems reasonable to request.

https://github.com/adafruit/circuitpython/issues

mikeysklar
 
Posts: 5494
Joined: Mon Aug 01, 2016 8:10 pm

Re: pixel[0] lights after "Code done running"

by macewmi on Thu Aug 12, 2021 5:59 pm

I will post an issue on GitHub. Can you first confirm that the behavior that I see is what everyone sees and that it’s not a hardware/assembly issue that I’m dealing with?

macewmi
 
Posts: 29
Joined: Sat Feb 08, 2020 10:26 am

Re: pixel[0] lights after "Code done running"

by mikeysklar on Fri Aug 13, 2021 1:05 pm

I have a high confidence that the behavior you are seeing is normal, but never having used a macropad I'm not 100%. Opening an issue and letting hearing from the mainters about the design choice to have default on lillumination would be helpful and if that was not the case we will find out quickly.

mikeysklar
 
Posts: 5494
Joined: Mon Aug 01, 2016 8:10 pm

Re: pixel[0] lights after "Code done running"

by macewmi on Sun Aug 15, 2021 7:03 am

Well, apparently the flashing is desired and expected based on the Issue filed on GitHub:

The first NeoPixel is used as a status pixel, like the status NeoPixels on Feather and Metro boards. If your program starts using the NeoPixels, the status information will not be displayed. Normally your user program would run forever, but if it completes, CircuitPython restart and will again display status information.

Yes, the status RGB LED indicates various states and errors. In 6.x and earlier, it flashed more often: https://learn.adafruit.com/welcome-to-c ... 2978455-21. In 7.0.0, we are simplifying it and reducing the frequency of flashing, to save power and annoyance. The new flashing scheme hasn't been written up yet in detail.


Thanks for looking into this.

macewmi
 
Posts: 29
Joined: Sat Feb 08, 2020 10:26 am

Re: pixel[0] lights after "Code done running"

by mikeysklar on Mon Aug 16, 2021 2:50 pm

Thank you for the summary of that issue. It sounds like it will be less annoying, but still blinking status information in the future if the code completes.

mikeysklar
 
Posts: 5494
Joined: Mon Aug 01, 2016 8:10 pm

Re: pixel[0] lights after "Code done running"

by macewmi on Mon Aug 16, 2021 7:30 pm

The issue has been reopened in GitHub. It turns out this pattern of lights is not normal.

macewmi
 
Posts: 29
Joined: Sat Feb 08, 2020 10:26 am

Please be positive and constructive with your questions and comments.