diff --git a/adafruit_magtag/magtag.py b/adafruit_magtag/magtag.py index b1e457a..cbc0890 100755 --- a/adafruit_magtag/magtag.py +++ b/adafruit_magtag/magtag.py @@ -29,6 +29,7 @@ import gc import time +import board from adafruit_portalbase import PortalBase from adafruit_magtag.network import Network from adafruit_magtag.graphics import Graphics @@ -75,6 +76,11 @@ def __init__( debug=False, ): + self.peripherals = Peripherals() + + if status_neopixel == board.NEOPIXEL: + status_neopixel = self.peripherals.neopixels + network = Network( status_neopixel=status_neopixel, extract_values=False, @@ -99,8 +105,6 @@ def __init__( debug=debug, ) - self.peripherals = Peripherals() - gc.collect() def exit_and_deep_sleep(self, sleep_time): diff --git a/adafruit_magtag/network.py b/adafruit_magtag/network.py index 6633516..2cf73f4 100755 --- a/adafruit_magtag/network.py +++ b/adafruit_magtag/network.py @@ -55,7 +55,10 @@ def __init__( debug=False, ): if status_neopixel: - status_led = neopixel.NeoPixel(status_neopixel, 1, brightness=0.2) + if isinstance(status_neopixel, neopixel.NeoPixel): + status_led = status_neopixel + else: + status_led = neopixel.NeoPixel(status_neopixel, 1, brightness=0.2) else: status_led = None super().__init__(