i keep forgetting how class declarations work in python
This commit is contained in:
parent
ad1e7cc95f
commit
b19a681565
|
@ -1,16 +1,17 @@
|
||||||
def __init__(self, hw):
|
class PrintHWInfo:
|
||||||
#Basic script to print module family, variant, and IP address
|
def __init__(self, hw):
|
||||||
from network import WLAN as wlan, STA_IF as staif
|
#Basic script to print module family, variant, and IP address
|
||||||
from time import sleep_ms
|
from network import WLAN as wlan, STA_IF as staif
|
||||||
if hw.features.display.oled:
|
from time import sleep_ms
|
||||||
oled = hw.oled.handle
|
if hw.features.display.oled:
|
||||||
oled.text("uPyConfig!",0,0)
|
oled = hw.oled.handle
|
||||||
oled.text(hw.family,0,8)
|
oled.text("uPyConfig!",0,0)
|
||||||
oled.text(hw.variant,0,16)
|
oled.text(hw.family,0,8)
|
||||||
oled.text(wlan(staif).ifconfig()[0],0,24)
|
oled.text(hw.variant,0,16)
|
||||||
oled.show()
|
oled.text(wlan(staif).ifconfig()[0],0,24)
|
||||||
else:
|
oled.show()
|
||||||
print(hw.family)
|
else:
|
||||||
print(hw.variant)
|
print(hw.family)
|
||||||
print(wlan(staif).ifconfig()[0])
|
print(hw.variant)
|
||||||
sleep_ms(1000)
|
print(wlan(staif).ifconfig()[0])
|
||||||
|
sleep_ms(1000)
|
||||||
|
|
2
main.py
2
main.py
|
@ -3,6 +3,6 @@ import uPyConfig
|
||||||
hw = uPyConfig.esp32(variant='wemos-lolin32')
|
hw = uPyConfig.esp32(variant='wemos-lolin32')
|
||||||
#print family, variant and IP address (using oled, if available on-board)
|
#print family, variant and IP address (using oled, if available on-board)
|
||||||
import init_sample
|
import init_sample
|
||||||
init_sample(hw)
|
init_sample.PrintHWInfo(hw)
|
||||||
|
|
||||||
# Main app
|
# Main app
|
||||||
|
|
Loading…
Reference in New Issue