diff --git a/TODO b/TODO index 0cbd1b6..5862964 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,12 @@ +- Cleanups: + + - Collect globals into a more coherent centralized namespace + - Cleanup debug handling using that centralized state info + - Cleanup timer run code into separate thread that gets started/stopped instead of always running with 0 displayed + +- Pull globals into a single coherent namespace - Autodetect temp probe device - Generate compensation tables at startup based on low/hi range - perhaps limited by times <400ms -- Detect profile selection switch: Make sure it sets dimming properly - Add code repo to comments header - Speed up boot time by removing all unneeded boot activity - Write docs: diff --git a/devtimer.py b/devtimer.py index c228251..4912d41 100755 --- a/devtimer.py +++ b/devtimer.py @@ -187,6 +187,14 @@ sleep(1) +# Read the profile switch selector regularly + +def monitor_profile_sw(): + + while True: + Thread(name="GetProfile", target=read_profile_switch).start() + sleep(1) + # Display current temperature # Negative temps are 2 digits, positive temps are 3 digits. @@ -262,11 +270,6 @@ beep(3, 0.1) # Let user know we're starting/stopping - # If we are about to start running, determine selected profile - - if not RUNNING: - read_profile_switch() - # Reflect changed state and current time RUNNING = not RUNNING @@ -369,9 +372,10 @@ time_led = TM1637(TIME_CLK, TIME_DIO, DEFAULT_BRIGHTNESS - DIM_BY) temp_led = TM1637(TEMP_CLK, TEMP_DIO, DEFAULT_BRIGHTNESS - DIM_BY) - # Get initial profile in case we need to dim + # Start monitoring the profile selection switch. + # This allows the user to changes profiles during timer runs. - read_profile_switch() + Thread(name="MonitorProfileSW", target=monitor_profile_sw).start() # Get segment pattern for "F" - only need to do this once, not on every update FARENHEIGHT = temp_led.digit_to_segment[0x0f]