def check_hardware(skip_keyboard_input = False): # first the GPIO pins sound_check_passed = 'skip-gpio-test' in sys.argv; while not sound_check_passed: print 'Checking device control - you should hear both devices turn on/off or off/on...' time.sleep(1) try: chestfreezer_gpio.output_pin_for_time(configuration.heater_pin(), False, 1) time.sleep(1) chestfreezer_gpio.output_pin_for_time(configuration.freezer_pin(), False, 1) except ValueError as e: sys.exit('Pins could not be activated, reason:\n' + str(e) + '\nTerminating.') try: if skip_keyboard_input: raise termios.error # eclipse cannot handle this! sound_check_passed = do_sound_check() except termios.error: print 'You are using eclipse or some other IDE or are running tests, check passed.' sound_check_passed = True print 'GPIO pins #' + configuration.heater_pin() + ' and #' + configuration.freezer_pin() + ' connected correctly.' # then the temperature sensor(s) temperature_probes.initialize_probes() probes = temperature_probes.probe_ids if probes is None: sys.exit('No temperature probes were detected, check your wiring. Terminating.') else: print 'Found ' + str(len(probes)) + ' functional temperature sensor(s).' temperature_probes.determine_master_probe() if 'insert-test-data' in sys.argv: data_for_testing.insert_dummy_temperatures()
def checkHardware(): # first the GPIO pins import hardware.chestfreezer_gpio as gpio sound_check_passed = True; while not sound_check_passed: print 'Checking device control - you should hear four clicking noises...' time.sleep(1) try: gpio.output_pin_for_time(configuration.heater_pin(), False, 1) time.sleep(1) gpio.output_pin_for_time(configuration.freezer_pin(), False, 1) except ValueError as e: sys.exit('Pins could not be activated, reason:\n' + str(e) + '\nTerminating.') sound_check_passed = do_sound_check(gpio) print 'GPIO pins #' + configuration.heater_pin() + ' and #' + configuration.freezer_pin() + ' connected correctly.' # then the temperature sensor(s) temperature.initialize_probes() probes = temperature.probe_ids if probes is None: sys.exit('No temperature probes were detected, check your wiring. Terminating.') else: print 'Found ' + str(len(probes)) + ' functional temperature sensor(s).' temperature.determine_master_probe()
def _set_freezer(should_activate): """ sets the freezer state to on/off directly """ global freezer_state new_state = _set_device_internal('freezer', should_activate, freezer_state, configuration.freezer_pin()) freezer_state = new_state