diff --git a/main.py b/main.py index 3c77709..6324750 100644 --- a/main.py +++ b/main.py @@ -106,7 +106,7 @@ def settings(): if btn_right.value() == 1: config.STARTUP_WELCOME_CYCLES = current_cycles config.LCD.move_to(0,1) # move to the second row - config.LCD.putstr(f"Now set to {current_cycles}".center(16)) # show a little info that it is now set + config.LCD.putstr(f"Saved!".center(16)) # show a little info that it is now set sleep(0.5) while btn_right.value() == 1 or btn_left.value() == 1: # wait till both btns are released pass @@ -121,7 +121,7 @@ def settings(): if btn_left.value() == 1: config.STARTUP_WELCOME_CYCLES = current_cycles config.LCD.move_to(0,1) # move to the second row - config.LCD.putstr(f"Now set to {current_cycles}".center(16)) # show a little info that it is now set + config.LCD.putstr(f"Saved!".center(16)) # show a little info that it is now set sleep(0.5) while btn_right.value() == 1 or btn_left.value() == 1: # wait till both btns are released pass @@ -166,6 +166,7 @@ def settings(): set_timer_helper(n, current_timer) config.LCD.move_to(0,1) # move to the second row config.LCD.putstr(f"Saved!".center(16)) # show a little info that it is now set + sleep(0.5) while btn_right.value() == 1 or btn_left.value() == 1: # wait till both btns are released pass return True @@ -197,6 +198,7 @@ def settings(): set_timer_helper(n, current_timer) config.LCD.move_to(0,1) # move to the second row config.LCD.putstr(f"Saved!".center(16)) # show a little info that it is now set + sleep(0.5) while btn_right.value() == 1 or btn_left.value() == 1: # wait till both btns are released pass return True @@ -222,8 +224,10 @@ def settings(): def set_log_level(): config.LCD.clear() current_level = config.LOG_LEVEL + log_levels = ["WARN", "INFO", "DEBUG"] - config.LCD.putstr(f"{'Log level'.center(16)}\nv {str(current_level).center(12)} ^") + config.LCD.putstr(f"Log level".center(16)) + config.LCD.putstr("v " + f"{log_levels[current_level]} ({current_level})".center(12) + " ^") # show the log level and it's name in the second row btn_left = config.PIN_IN_BTN_1 btn_right = config.PIN_IN_BTN_2 while True: @@ -232,7 +236,7 @@ def settings(): if btn_right.value() == 1: config.LOG_LEVEL = current_level config.LCD.move_to(0,1) # move to the second row - config.LCD.putstr(f"Now set to {current_level}".center(16)) # show a little info that it is now set + config.LCD.putstr(f"Saved!".center(16)) # show a little info that it is now set sleep(0.5) while btn_right.value() == 1 or btn_left.value() == 1: # wait till both btns are released pass @@ -240,20 +244,24 @@ def settings(): current_level -= 1 if current_level < 0: current_level = 2 - config.LCD.putstr(f"{'Log level'.center(16)}\nv {str(current_level).center(12)} ^") + config.LCD.move_to(0,0) + config.LCD.putstr(f"Log level".center(16)) + config.LCD.putstr("v " + f"{log_levels[current_level]} ({current_level})".center(12) + " ^") # show the log level and it's name in the second row if btn_right.value() == 1: sleep(0.1) if btn_left.value() == 1: config.LOG_LEVEL = current_level config.LCD.move_to(0,1) # move to the second row - config.LCD.putstr(f"Now set to {current_level}".center(16)) # show a little info that it is now set + config.LCD.putstr(f"Saved!".center(16)) # show a little info that it is now set sleep(0.5) while btn_right.value() == 1 or btn_left.value() == 1: # wait till both btns are released pass return True current_level += 1 if current_level > 2: current_level = 0 - config.LCD.putstr(f"{'Log level'.center(16)}\nv {str(current_level).center(12)} ^") + config.LCD.move_to(0,0) + config.LCD.putstr(f"Log level".center(16)) + config.LCD.putstr("v " + f"{log_levels[current_level]} ({current_level})".center(12) + " ^") # show the log level and it's name in the second row def reset(): # reset all user-settable configuration to the default values config.LCD.clear()