adafruit / Adafruit_CircuitPython_MagTag

Helper library for the Adafruit MagTag
MIT License
29 stars 24 forks source link

MAGTAG NEOPIXEL fails with 7.0 #62

Closed jerryneedell closed 3 years ago

jerryneedell commented 3 years ago

With the current tip of main I get an error trying to use the magtag library h was trying to run the "vaccine example" https://learn.adafruit.com/adafruit-magtag-covid-vaccination-percent-tracker/code-the-vaccination-tracker

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

Adafruit CircuitPython 7.0.0-alpha.2-736-gb49ee62af on 2021-06-02; Adafruit MagTag with ESP32S2
>>> import vaccine
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "vaccine.py", line 9, in <module>
  File "adafruit_magtag/magtag.py", line 102, in __init__
  File "adafruit_magtag/peripherals.py", line 47, in __init__
ValueError: NEOPIXEL_POWER_INVERTED in use
>>> 

It runs fine on 6.3.0

evaherrada commented 3 years ago

possibly (but probably not) related https://forums.adafruit.com/viewtopic.php?f=60&t=179248&p=872565#p872565

tannewt commented 3 years ago

This might be related to the internal status LED rework. I looked in the code and it works OK though. Does the sample code work ok as code.py?

jerryneedell commented 3 years ago

This might be related to the internal status LED rework. I looked in the code and it works OK though. Does the sample code work ok as code.py?

No -same failure

jerryneedell commented 3 years ago

It appears to be getting set here in neopixel.py https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel/blob/a8e9975b3f06d454f8951254d96f99755b11d962/neopixel.py#L115 in CP 7 Is there a conflict in peripherals.py because it initializes the neopixel on line 46 then disables the power on line 47 -- is the pin claimed in the init? https://github.com/adafruit/Adafruit_CircuitPython_MagTag/blob/main/adafruit_magtag/peripherals.py#L46

makermelissa commented 3 years ago

Line 47 is just initializing the the pin to enable/disable the neopixels. This is used for power savings by allowing the users' code to disable the neopixels. It's possible this is due to the internal status rework if the NEOPIXEL_POWER pin is in use. Also, did it get renamed to NEOPIXEL_POWER_INVERTED in CP7?

jerryneedell commented 3 years ago

in neopixel.py for CP 7 it configures the power pin -- so I think lines 47-47 of peripherals ar no longer needed (with CP 7) and _neipixel_disable should now be ._power , I think

makermelissa commented 3 years ago

Ok yeah, maybe we can detect something and only run this on pre-7 versions.

pjockey commented 3 years ago

Inquiring whether there has been any update on this thread?

makermelissa commented 3 years ago

Not as far as I know, unless something was fixed in the core. Do you want to give it a try with the latest CircuitPython 7? Otherwise, I can probably get to this soon.

dglaude commented 3 years ago

I can confirm the error with the latest library bundle from 20210716 and latest core: Adafruit CircuitPython 7.0.0-alpha.4-67-ge3bc800bb on 2021-07-14; Adafruit MagTag with ESP32S2

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable. code.py output: Traceback (most recent call last): File "code.py", line 10, in File "adafruit_magtag/magtag.py", line 102, in init File "adafruit_magtag/peripherals.py", line 47, in init ValueError: NEOPIXEL_POWER_INVERTED in use

makermelissa commented 3 years ago

Thank you :)

pjockey commented 3 years ago

Thanks. Getting the exact same error. CP 6.3 works great.

dglaude commented 3 years ago

I took my attempt from 3 days ago , and replaced the magtag library with adafruit-circuitpython-magtag-7.x-mpy-2.1.1.zip from #63

But now my MagTag is rebooting in loop somewhere in magtag.network.connect()

The only thing it say (except for print("**") deis

Connecting to AP NEO

Where NEO is my SSID.

I will try to investigate further. But any news of someone making COVID percentage demo work (or failing like for me) would be welcomed.