diff --git a/main.py b/main.py index 6324750..2fa4953 100644 --- a/main.py +++ b/main.py @@ -83,15 +83,25 @@ def timer(): return True # disable the "Quitting" message from lcdMenu def settings(): settings_menu = lcdMenu(config.LCD, btn_mapping, scroll_direction=True, cycle=True, hide_menu_name=False, name="SETTINGS") - def swap_welcome(): - config.STARTUP_WELCOME_SHOW = not config.STARTUP_WELCOME_SHOW + def toggle_show_welcome(): + current_value = config.STARTUP_WELCOME_SHOW config.LCD.clear() - config.LCD.putstr(f" Welcome Screen ") - if config.STARTUP_WELCOME_SHOW: - config.LCD.putstr("--- Enabled! ---") - else: - config.LCD.putstr("--- Disabled ---") - sleep(1) + config.LCD.putstr(f"Currently {'on' if current_value else 'off'}".center(16)) + config.LCD.putstr("< keep change >") + keep_btn = config.PIN_IN_BTN_1 + change_btn = config.PIN_IN_BTN_2 + while True: + 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(): config.LCD.clear() current_cycles = config.STARTUP_WELCOME_CYCLES @@ -290,7 +300,7 @@ def settings(): sleep(0.5) return True - settings_programs = [("Show welcome", swap_welcome), + settings_programs = [("Show welcome", toggle_show_welcome), ("Welcome cycles", welcome_cycles), ("Timer 1", lambda: set_n_timer(0)), ("Timer 2", lambda: set_n_timer(1)),