Did a huge refactoring and outsouring for modularity and a small performance improvement
This commit is contained in:
17
programs/manual.py
Normal file
17
programs/manual.py
Normal file
@@ -0,0 +1,17 @@
|
||||
def run(config):
|
||||
config.LCD.clear()
|
||||
set_value = config.PIN_OUT_RELAIS.value()
|
||||
config.LCD.putstr(f"---- MANUAL ---- State: {set_value} ")
|
||||
while True:
|
||||
if set_value != config.PIN_IN_SWITCH.value():
|
||||
config.PIN_OUT_RELAIS.value(config.PIN_IN_SWITCH.value())
|
||||
set_value = config.PIN_OUT_RELAIS.value()
|
||||
config.LCD.putstr(f"---- MANUAL ---- State: {set_value} ")
|
||||
if config.PIN_IN_BTN_1.value() == 1 or config.PIN_IN_BTN_2.value() == 1:
|
||||
return True # exit on press of these buttons; True to disable the Quitting message from lcdMenu
|
||||
|
||||
if __name__ == "__main__":
|
||||
from utils import Config, log
|
||||
config = Config()
|
||||
btn_mapping = {"ok_btn": config.PIN_IN_BTN_1, "next_btn": config.PIN_IN_BTN_2} # the btn mapping for all lcdMenus
|
||||
run(Config(), btn_mapping, log)
|
||||
Reference in New Issue
Block a user