adafruit / adafruit/Adafruit_CircuitPython_MagTag

MagTag library has an incompatibility with NeoPixel library after MagTag deep sleep (result: ValueError: NEOPIXEL in use)

Open
#97 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
30
Forks
26
PR merge metrics
No merged PRs in 30d

Description

With the Adafruit example code "MagTag_Weather" (the latest using open meteo API), the code receives a failure after deep sleep. It appears that the NeoPixel is still in use when the code returns after the deep sleep, causing the failure. Results have been replicated using the Thonny app for test runs that replicate the MagTag running on its own (no need to wait until 3:15AM to monitor results:-)

Version info:

- Early Adafruit MagTag (ILI0373) with ESP32S2
- CircuitPython 10.0.3 on 2025-10-17
- CircuitPython libraries 10.x from: https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/download/20251126/adafruit-circuitpython-bundle-10.x-mpy-20251126.zip
- MagTag Daily Weather Forecast Display example code link: https://learn.adafruit.com/magtag-weather (code.py is only modified to change Latitude & Longitude data)
- Thonny Editor: 4.1.7 used for testing

Result:
```
]0;🐍192.168.1.XXX | REPL | 10.0.3\
Adafruit CircuitPython 10.0.3 on 2025-10-17; Adafruit MagTag with ESP32S2
>>> %run -c $EDITOR_CONTENT
Fetching forecast...
Connecting to AP __MySSID__
Retrieving data...Updating...
Refreshing...
Sleeping...
Sleeping for 17 hours, 13 minutes
>>> %run -c $EDITOR_CONTENT <== Re-executing here, but normally waiting until 3:15AM awake from sleep
Traceback (most recent call last):
File "", line 72, in
File "adafruit_magtag/magtag.py", line 87, in __init__
File "adafruit_magtag/peripherals.py", line 52, in __init__
File "neopixel.py", line 138, in __init__
ValueError: NEOPIXEL in use
>>>
```
, line 72 is:
`magtag = MagTag()`

It appears that there is a problem after deep sleep where MagTag re-initialization runs into the problem that NeoPixel is still in-use.

This code will only re-run with success after a total reset of the MagTag (pushing the reset button OR Thonny's STOP button).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the MagTag_Weather example and reproduce the failure after deep sleep using the reported CircuitPython and library versions. Inspect adafruit_magtag/magtag.py and adafruit_magtag/peripherals.py around MagTag initialization and NeoPixel creation. Done means the example can reinitialize MagTag after deep sleep without raising ValueError: NEOPIXEL in use.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.