diff --git a/devtimer.py b/devtimer.py index 45276ef..0b63f7c 100755 --- a/devtimer.py +++ b/devtimer.py @@ -26,7 +26,7 @@ DEBUG = True # Debugging switch BEEP = 15 # Beep interval -CALIBRATION_OFFSET = 0.002 # Compensate for program overhead in master loop +CALIBRATION_OFFSET = 0.003 # Compensate for program overhead in master loop # Profile Constants @@ -35,8 +35,12 @@ FILM = 2 -# Globals (So shoot me ...) -# These get updated by the thereads reading the switches and thermocouple +# Globals + +# These get updated by the threads that read the switches and +# thermocouple. On a slow machine like the Pi Zero, we want to avoid +# unnecessary function calls, so we make these globally RW. +# So, shoot me ... CURRENT_PROFILE = FILM CURRENT_TEMP = 20 # Stored as index relative to 60F @@ -52,7 +56,13 @@ Paper Film - Each contains entires for muliplicative corrections from 60F to 80F. + Each contains entires for multiplicative corrections from 60F to 80F. + + The profile global above selects which of these tuples to index into + - using the normalized temp global above as the index. We don't + want to use a dictionary here (with profile as the key) because of + the overhead that incurs. Straight tuple indexing should be much + quicker. WARNING: It takes about 250ms to update the display on a Pi Zero. So, if the "virtual second" falls at or below this, the