From ef40722152dc11ad01d9738ecc3e9357fb33c041 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Mon, 20 Mar 2023 15:59:48 +0000 Subject: [PATCH] Badger 2040W: Leaner startup for #6. --- firmware/PIMORONI_BADGER2040W/lib/badger2040.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/firmware/PIMORONI_BADGER2040W/lib/badger2040.py b/firmware/PIMORONI_BADGER2040W/lib/badger2040.py index 5765b0a..4e47107 100644 --- a/firmware/PIMORONI_BADGER2040W/lib/badger2040.py +++ b/firmware/PIMORONI_BADGER2040W/lib/badger2040.py @@ -1,12 +1,7 @@ import machine import micropython from picographics import PicoGraphics, DISPLAY_INKY_PACK -import network -from network_manager import NetworkManager -import WIFI_CONFIG -import uasyncio import time -import gc import wakeup import pcf85063a @@ -234,12 +229,20 @@ def status_handler(self, mode, status, ip): self.update() def isconnected(self): + import network return network.WLAN(network.STA_IF).isconnected() def ip_address(self): + import network return network.WLAN(network.STA_IF).ifconfig()[0] def connect(self): + import network + from network_manager import NetworkManager + import WIFI_CONFIG + import uasyncio + import gc + if WIFI_CONFIG.COUNTRY == "": raise RuntimeError("You must populate WIFI_CONFIG.py for networking.") self.display.set_update_speed(2)