17 lines
854 B
Python
17 lines
854 B
Python
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) |