Skip to content

Commit 49d62e0

Browse files
authored
Merge pull request #78 from VPTechOps/VPTechOps
Correct use of board.NEOPIXEL as status_neopixel parameter
2 parents 2f1fc23 + 0c95256 commit 49d62e0

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

adafruit_magtag/magtag.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
import gc
3131
import time
32+
import board
3233
from adafruit_portalbase import PortalBase
3334
from adafruit_magtag.network import Network
3435
from adafruit_magtag.graphics import Graphics
@@ -75,6 +76,11 @@ def __init__(
7576
debug=False,
7677
):
7778

79+
self.peripherals = Peripherals()
80+
81+
if status_neopixel == board.NEOPIXEL:
82+
status_neopixel = self.peripherals.neopixels
83+
7884
network = Network(
7985
status_neopixel=status_neopixel,
8086
extract_values=False,
@@ -99,8 +105,6 @@ def __init__(
99105
debug=debug,
100106
)
101107

102-
self.peripherals = Peripherals()
103-
104108
gc.collect()
105109

106110
def exit_and_deep_sleep(self, sleep_time):

adafruit_magtag/network.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ def __init__(
5555
debug=False,
5656
):
5757
if status_neopixel:
58-
status_led = neopixel.NeoPixel(status_neopixel, 1, brightness=0.2)
58+
if isinstance(status_neopixel, neopixel.NeoPixel):
59+
status_led = status_neopixel
60+
else:
61+
status_led = neopixel.NeoPixel(status_neopixel, 1, brightness=0.2)
5962
else:
6063
status_led = None
6164
super().__init__(

0 commit comments

Comments
 (0)