diff --git a/code/boot.py b/code/boot.py index 61030cd..1ebe6cc 100644 --- a/code/boot.py +++ b/code/boot.py @@ -6,7 +6,7 @@ import gc import time import network import webrepl -from config import known_wifi_ap +from config import KNOWN_WIFI_AP # Connect to one of the known wifi AP WLAN = network.WLAN(network.STA_IF) @@ -18,10 +18,10 @@ for ap in AP_LIST: break ap_ssid = ap[0].decode("utf-8") - if ap_ssid in known_wifi_ap.keys(): + if ap_ssid in KNOWN_WIFI_AP.keys(): print("Known wifi network found : {}".format(ap_ssid)) print("Try to connect...") - WLAN.connect(ap_ssid, known_wifi_ap[ap_ssid]) + WLAN.connect(ap_ssid, KNOWN_WIFI_AP[ap_ssid]) DELAY = 0 diff --git a/code/lib/light_modes.py b/code/lib/light_modes.py index da59d6b..6b9d0d3 100644 --- a/code/lib/light_modes.py +++ b/code/lib/light_modes.py @@ -55,7 +55,8 @@ def fill_white(np_strp, col=(255, 255, 255)): :param np_strp : NeoPixel object :param col : color [R, G, B] (ignored, default=(255, 255, 255)) """ - np_strp.fill((255, 255, 255)) + col = (255, 255, 255) + np_strp.fill(col) def sparkles(np_strp, col): @@ -67,11 +68,10 @@ def sparkles(np_strp, col): np_strp[pix] = col -def christmas(np_strp, col): - """Shine like christmas tree °<:oD - TODO !!! - """ - pass +# def christmas(np_strp, col): +# """Shine like christmas tree °<:oD +# TODO !!! +# """ MODES_LST = (fill_usr, fill_white, sparkles) diff --git a/code/main.py b/code/main.py index 6e92692..82f8579 100644 --- a/code/main.py +++ b/code/main.py @@ -21,7 +21,6 @@ __version__ = 0.3 # Imports import time -import sys import machine import esp import neopixel @@ -123,8 +122,6 @@ def MqttMultiPublish(payload, sleep=0): def power_cycle(): """ON/OFF function""" - global PWR - global BRIGHTN PWR = not PWR print("Power :", PWR) @@ -185,9 +182,8 @@ def update_button_c(button, button_state, pwr, mode): def update_wifi_led(): """Refresh Wifi status LED""" - global WIFI_LED - global WLAN - WIFI_LED = WLAN.isconnected() + + WIFI_LED.value = not WLAN.isconnected() #####################