01234567890123456789012345678901234567890123456789012345678901234567890123456789
62296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269 | <----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), str(temperature)]) with open(TEMPERATURE_LOG, 'a') as f: f.write(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) for pin in pins: initial_state = pin[5] pin_values[pin[0]] = initial_state # Initialize state of pins <----SKIPPED LINES----> |
01234567890123456789012345678901234567890123456789012345678901234567890123456789
62296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269 | <----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), 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) for pin in pins: initial_state = pin[5] pin_values[pin[0]] = initial_state # Initialize state of pins <----SKIPPED LINES----> |