Improved the welcome screen enable/disable dialog
This commit is contained in:
parent
e1075f8d84
commit
72bc662cb8
28
main.py
28
main.py
@ -83,15 +83,25 @@ def timer():
|
|||||||
return True # disable the "Quitting" message from lcdMenu
|
return True # disable the "Quitting" message from lcdMenu
|
||||||
def settings():
|
def settings():
|
||||||
settings_menu = lcdMenu(config.LCD, btn_mapping, scroll_direction=True, cycle=True, hide_menu_name=False, name="SETTINGS")
|
settings_menu = lcdMenu(config.LCD, btn_mapping, scroll_direction=True, cycle=True, hide_menu_name=False, name="SETTINGS")
|
||||||
def swap_welcome():
|
def toggle_show_welcome():
|
||||||
config.STARTUP_WELCOME_SHOW = not config.STARTUP_WELCOME_SHOW
|
current_value = config.STARTUP_WELCOME_SHOW
|
||||||
config.LCD.clear()
|
config.LCD.clear()
|
||||||
config.LCD.putstr(f" Welcome Screen ")
|
config.LCD.putstr(f"Currently {'on' if current_value else 'off'}".center(16))
|
||||||
if config.STARTUP_WELCOME_SHOW:
|
config.LCD.putstr("< keep change >")
|
||||||
config.LCD.putstr("--- Enabled! ---")
|
keep_btn = config.PIN_IN_BTN_1
|
||||||
else:
|
change_btn = config.PIN_IN_BTN_2
|
||||||
config.LCD.putstr("--- Disabled ---")
|
while True:
|
||||||
sleep(1)
|
if keep_btn.value() == 1:
|
||||||
|
config.LCD.move_to(0,1) # move to the second row
|
||||||
|
config.LCD.putstr(f"Stay {'on' if current_value else 'off'}!".center(16))
|
||||||
|
sleep(0.5)
|
||||||
|
return True
|
||||||
|
if change_btn.value() == 1:
|
||||||
|
config.STARTUP_WELCOME_SHOW = not current_value
|
||||||
|
config.LCD.move_to(0,1) # move to the second row
|
||||||
|
config.LCD.putstr(f"Turned {'on' if not current_value else 'off'}!".center(16))
|
||||||
|
sleep(0.5)
|
||||||
|
return True
|
||||||
def welcome_cycles():
|
def welcome_cycles():
|
||||||
config.LCD.clear()
|
config.LCD.clear()
|
||||||
current_cycles = config.STARTUP_WELCOME_CYCLES
|
current_cycles = config.STARTUP_WELCOME_CYCLES
|
||||||
@ -290,7 +300,7 @@ def settings():
|
|||||||
sleep(0.5)
|
sleep(0.5)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
settings_programs = [("Show welcome", swap_welcome),
|
settings_programs = [("Show welcome", toggle_show_welcome),
|
||||||
("Welcome cycles", welcome_cycles),
|
("Welcome cycles", welcome_cycles),
|
||||||
("Timer 1", lambda: set_n_timer(0)),
|
("Timer 1", lambda: set_n_timer(0)),
|
||||||
("Timer 2", lambda: set_n_timer(1)),
|
("Timer 2", lambda: set_n_timer(1)),
|
||||||
|
Loading…
Reference in New Issue
Block a user