Lazy load theta module. Also change wifi mode only if necessary.
This commit is contained in:
parent
af3f61fff7
commit
f74fede517
4
main.py
4
main.py
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
from machine import Pin
|
from machine import Pin
|
||||||
import time
|
import time
|
||||||
import theta
|
|
||||||
|
|
||||||
led = Pin("GP16", Pin.OUT)
|
led = Pin("GP16", Pin.OUT)
|
||||||
|
|
||||||
@ -20,10 +19,13 @@ btn.irq(trigger=Pin.IRQ_FALLING, handler=btnPressed)
|
|||||||
|
|
||||||
def home():
|
def home():
|
||||||
global wifi
|
global wifi
|
||||||
|
if wifi.mode() != WLAN.STA:
|
||||||
|
wifi.mode(WLAN.STA)
|
||||||
wifi.connect(config.HOME_SSID, auth=(WLAN.WPA, config.HOME_PASSWORD))
|
wifi.connect(config.HOME_SSID, auth=(WLAN.WPA, config.HOME_PASSWORD))
|
||||||
|
|
||||||
def tc():
|
def tc():
|
||||||
global t, p
|
global t, p
|
||||||
|
import theta
|
||||||
t = theta.Theta()
|
t = theta.Theta()
|
||||||
p = t.connect()
|
p = t.connect()
|
||||||
if not p:
|
if not p:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user