01234567890123456789012345678901234567890123456789012345678901234567890123456789
62306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270 | <----SKIPPED LINES----> Args: configuration: dictionary of configuration settings. last_logged: epoch at which temperature was last logged. Returns: Epoch at which temperature was last logged. """ if RASPBERRY_PI: temperature = gpiozero.CPUTemperature().temperature if temperature > TEMP_FAN_TURN_ON_CELSIUS: UpdateStatusLight(GPIO_FAN, True, 'Temperature: %.1f' % temperature) elif temperature < TEMP_FAN_TURN_OFF_CELSIUS: UpdateStatusLight(GPIO_FAN, False) now = time.time() if (configuration.get('log_temperature') and now - last_logged > TEMPERATURE_LOG_FREQUENCY_SECONDS): line = ','.join([ str(now), EpochDisplayTime(now, '%Y-%m-%d'), EpochDisplayTime(now, '%H:%M:%S%z'), str(temperature)]) with open(TEMPERATURE_LOG, 'a') as f: f.write('%s\n' % line) last_logged = now return last_logged pin_values = {} # caches last set value def SetPinMode(): """Initialize output GPIO pins for output on Raspberry Pi.""" global pin_values if RASPBERRY_PI: RPi.GPIO.setmode(RPi.GPIO.BCM) pins = ( GPIO_ERROR_VESTABOARD_CONNECTION, GPIO_ERROR_FLIGHT_AWARE_CONNECTION, GPIO_ERROR_ARDUINO_SERVO_CONNECTION, GPIO_ERROR_ARDUINO_REMOTE_CONNECTION, GPIO_ERROR_BATTERY_CHARGE, GPIO_FAN, GPIO_UNUSED_1, GPIO_UNUSED_2) <----SKIPPED LINES----> |
01234567890123456789012345678901234567890123456789012345678901234567890123456789
62306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270 | <----SKIPPED LINES----> Args: configuration: dictionary of configuration settings. last_logged: epoch at which temperature was last logged. Returns: Epoch at which temperature was last logged. """ if RASPBERRY_PI: temperature = gpiozero.CPUTemperature().temperature if temperature > TEMP_FAN_TURN_ON_CELSIUS: UpdateStatusLight(GPIO_FAN, True, 'Temperature: %.1f' % temperature) elif temperature < TEMP_FAN_TURN_OFF_CELSIUS: UpdateStatusLight(GPIO_FAN, False) now = time.time() if (configuration.get('log_temperature') and now - last_logged > TEMPERATURE_LOG_FREQUENCY_SECONDS): line = ','.join([ str(now), EpochDisplayTime(now, '%Y-%m-%d'), EpochDisplayTime(now, '%H:%M:%S'), str(temperature)]) with open(TEMPERATURE_LOG, 'a') as f: f.write('%s\n' % line) last_logged = now return last_logged pin_values = {} # caches last set value def SetPinMode(): """Initialize output GPIO pins for output on Raspberry Pi.""" global pin_values if RASPBERRY_PI: RPi.GPIO.setmode(RPi.GPIO.BCM) pins = ( GPIO_ERROR_VESTABOARD_CONNECTION, GPIO_ERROR_FLIGHT_AWARE_CONNECTION, GPIO_ERROR_ARDUINO_SERVO_CONNECTION, GPIO_ERROR_ARDUINO_REMOTE_CONNECTION, GPIO_ERROR_BATTERY_CHARGE, GPIO_FAN, GPIO_UNUSED_1, GPIO_UNUSED_2) <----SKIPPED LINES----> |