diff --git a/TODO b/TODO index 85e51a6..d9ec33b 100644 --- a/TODO +++ b/TODO @@ -1,9 +1,7 @@ - Cleanups: - Check to make sure out of range temps still handled properly - - 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 + - Improve out of range notification - Autodetect temp probe device - Generate compensation tables at startup based on low/hi range - perhaps limited by times <400ms diff --git a/devtimer.py b/devtimer.py index 8949f6d..e25b42a 100755 --- a/devtimer.py +++ b/devtimer.py @@ -153,12 +153,7 @@ probe.close() - Thread(name="Temp", target=show_temp, args=[show_temp.LED, monitor_temps.CURRENT_TEMP]).start() - - if DEBUG: - sys.stdout.write("Temp: %sF\n" % monitor_temps.CURRENT_TEMP) - sleep(1) @@ -193,9 +188,6 @@ show_temp.LED.brightness=DEFAULT_BRIGHTNESS - monitor_profile_sw.DIM_BY show_time.LED.brightness=DEFAULT_BRIGHTNESS - monitor_profile_sw.DIM_BY - if DEBUG: - print("Selected Profile: %s" % monitor_profile_sw.CURRENT_PROFILE) - sleep(1) @@ -218,10 +210,6 @@ run_timer.RUNNING = not run_timer.RUNNING footsw_pressed.lastISR = time() - if DEBUG: - print("Running State: %s" % run_timer.RUNNING) - - # Check to see if footswitch got pressed def footsw_monitor(): @@ -254,9 +242,6 @@ wiringpi.digitalWrite(BEEPER, 0) sleep(delay) - if DEBUG: - print("Beep!") - # Update the display with elapsed time @@ -324,6 +309,7 @@ elapsed_time = 0 compensation_factor = 1 + last_update = time() while True: @@ -332,9 +318,6 @@ if run_timer.RUNNING and not elapsed_time % BEEP_INTERVAL: Thread(name="Beep", target=beep, args=[1, 0.8]).start() - if DEBUG: - last = time() - # If we're not running, don't update elapsed time if not run_timer.RUNNING: @@ -359,14 +342,22 @@ else: show_temp.OUTOFRANGE = True + if DEBUG: + print("Running: %s Elapsed: %s Current Temp: %s Profile: %s Factor: %s Inter-update Time: %s" % \ + (run_timer.RUNNING, + elapsed_time, + monitor_temps.CURRENT_TEMP, + monitor_profile_sw.CURRENT_PROFILE, + compensation_factor, + str(time() - last_update) + ) + ) + last_update = time() + sleep(compensation_factor - CALIBRATION_OFFSET) elapsed_time += 1 elapsed_time %= 6000 - if DEBUG: - print("Elapsed Time: %s Current Temp: %s Factor: %s Inter-update Time: %s" % (elapsed_time, monitor_temps.CURRENT_TEMP, compensation_factor, str(time()-last))) - - ##### # Program entry point #####