diff --git a/README.md b/README.md index d5b0fb9..169d810 100644 --- a/README.md +++ b/README.md @@ -149,23 +149,29 @@ remains displayed), it means that something is wrong with the temperature measurement hardware. +* If the timer detects an error reading the probe - for example, if + the probe is defective or the wiring is compromised - the + temperature will display 998F to let you know. If you are in a film + or paper correction profile, the timer will blink the display and + also sound an audible alert (see below) to remind you that it cannot + correct for temperature. Both the blinking and the audible alerting + take place whether the timer is actually running or not. This is + intentional to make you take action. + + * Pressing the momentary contact footswith start/resets the timer. * The SPDT switch selects Film correction, Paper correction, or realtime (no correction). You can change this while the timer runs. -* When the film profile is selected, the displays are dimmed on the - assumption that film is panchromatic (it can "see" red) and far more - sensitive to light than paper. - * If you are in a film or paper correction profile, and the temperature is beyond the range of the timer to correct, the temperature display will blink. This lets you know the timer is not capable of correcting for temperatures in that range. This does not happen in the realtime profile. There is also an audible alert (see below.) Both the blinking and the audible alerting - take place whether the timer is actually running- or not. This + take place whether the timer is actually running or not. This is intentional to make you take action. If you want to do compensating timing, you have to get the temperature back in range. If not - say, you just want to measure temperature - @@ -185,6 +191,9 @@ is beyond the range of the timer to correct, you will hear 5 short beeps repeated. +* In film or paper correction profiles, if the temperature cannot be + read from the probe, you will hear 5 short beeps repeated. + ## Calibration And Tuning The timer should pretty much be ready to run "out of the box". But, diff --git a/devtimer.py b/devtimer.py index ab46cab..b65e5b2 100755 --- a/devtimer.py +++ b/devtimer.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # devtimer.py - Temperature Controlled Photographic Darkroom Timer # Targeted for RaspberryPi -# Copyright (c) 2018-2021 TundraWare Inc. +# Copyright (c) 2018-2023 TundraWare Inc. # Permission Hereby Granted For Unrestricted Personal Or Commercial Use # Code Repo Here: https://gitbucket.tundraware.com/tundra/devtimer @@ -57,6 +57,11 @@ DEBOUNCE_TIME = 1.5 # In seconds MINUS = 16 # Index of minus segment table lookup +# Error Codes + +PROBEERR = 998 # Indicates probe read error +SENTINEL = 999 # Initial temp display + # Range of compensated timing TEMP_LOW=55 @@ -136,12 +141,14 @@ def monitor_temps(): while True: + try: + probe = open("/opt/devtimer/temp_probe/w1_slave") + temp = float(probe.readlines()[-1].split()[-1].split("=")[-1])/1000 # Parse probe output + temp = int(round((temp * 9/5) +32)) # Convert C-F and round into an integer + probe.close() - probe = open("/opt/devtimer/temp_probe/w1_slave") - temp = float(probe.readlines()[-1].split()[-1].split("=")[-1])/1000 # Parse probe output - temp = int(round((temp * 9/5) +32)) # Convert C-F and round into an integer - - + except: + temp = PROBEERR # 1-wire interfaces (like the DS18B20 uses) can occasionally # return wildly wrong results. For this reason, we throw away @@ -156,13 +163,12 @@ if monitor_temps.CURRENT_TEMP == monitor_temps.SENTINEL: monitor_temps.CURRENT_TEMP = temp - elif abs(temp - monitor_temps.CURRENT_TEMP) <= 20: + elif abs(temp - monitor_temps.CURRENT_TEMP) <= 20 or temp == PROBERR: monitor_temps.CURRENT_TEMP = temp - probe.close() - Thread(name="Temp", target=show_temp, args=[show_temp.LED, monitor_temps.CURRENT_TEMP]).start() - sleep(1) + + sleep(2) ##### @@ -300,7 +306,7 @@ sleep(0.3) # If we're in a compensating profile and out of - # temperature range, blink the time display + # temperature range, blink the temp display if show_temp.OUTOFRANGE: led.brightness=0 @@ -420,7 +426,7 @@ # Show the initial temp sentinel show_temp.OUTOFRANGE = False # Flag for compensating profiles when temp is out of range - monitor_temps.SENTINEL = monitor_temps.CURRENT_TEMP = 999 + monitor_temps.SENTINEL = monitor_temps.CURRENT_TEMP = SENTINEL show_temp(show_temp.LED, monitor_temps.CURRENT_TEMP) # Start measuring temperature