diff --git a/devtimer.py b/devtimer.py index a2a2022..c228251 100755 --- a/devtimer.py +++ b/devtimer.py @@ -197,7 +197,6 @@ global OUTOFRANGE minus = hun = ten = one = 0 # Tells display to show nothing - temp_led.brightness=DEFAULT_BRIGHTNESS - DIM_BY if temp < 0: # The leading digit is a minus sign minus = temp_led.digit_to_segment[MINUS] @@ -302,7 +301,7 @@ def read_profile_switch(): - global CURRENT_PROFILE, DIM_BY + global CURRENT_PROFILE, DIM_BY, temp_led, time_led if not wiringpi.digitalRead(PROFILE_SW_FILM): CURRENT_PROFILE = FILM @@ -319,6 +318,8 @@ if CURRENT_PROFILE == FILM: DIM_BY = 2 + temp_led.brightness=DEFAULT_BRIGHTNESS - DIM_BY + time_led.brightness=DEFAULT_BRIGHTNESS - DIM_BY if DEBUG: @@ -365,13 +366,13 @@ wiringpi.pinMode(PROFILE_SW_FILM, wiringpi.GPIO.PUD_UP) wiringpi.pinMode(PROFILE_SW_PAPER, wiringpi.GPIO.PUD_UP) + 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 read_profile_switch() - time_led = TM1637(TIME_CLK, TIME_DIO, DEFAULT_BRIGHTNESS - DIM_BY) - temp_led = TM1637(TEMP_CLK, TEMP_DIO, DEFAULT_BRIGHTNESS - DIM_BY) - # Get segment pattern for "F" - only need to do this once, not on every update FARENHEIGHT = temp_led.digit_to_segment[0x0f]