def __init__(self, *args, **kwargs): super(rt_testcase, self).__init__(*args, **kwargs) self.testname = '' # This should be the testcase class self.arduino_path = "/fi/hacklab/ardubus/ruuvitracker_tester" self.loop = gobject.MainLoop() self.bus = dbus.SessionBus() # Make sure the HP is powered dbus_call_cached(self.arduino_path, 'set_alias', 'hp_power', True) self.hp6632b = hp6632b.rs232(self.get_serialport_tty(HP_SERIALPORT_DEVICEID)) self.usb_device_present_timeout = 10.0 # Currently our only input is the pulse so the method name is apt even though we trap all alias signals (also dio_change:s) self.bus.add_signal_receiver(self.pulse_received, dbus_interface = "fi.hacklab.ardubus", signal_name = "alias_change", path=self.arduino_path) self.pulse_trains = [] self._active_pulse_train = False self.logger = None self.log_handle = None self.log_timer = None self._tick_count = 0 # How many ticks this test has been running, ticks are seconds self._tick_limit = -1 # infinite self._tick_timer = None # This will be set later self._cleanup_files = [] self._min_servo_step_time = 50 # ms # Some defaults self.default_voltage = 4100 # millivolts self.default_current = 50 # milliamps self.default_pan = 10 self.default_tilt = 62 # note if you change these in setup() make sure theyre suitable self.bootloader_voltage = 4100 # millivolts self.bootloader_current = 50 # milliamps # Testcase should define their defaults here self.defaults_setup() # Finish by restoring a known state self.set_defaut_state()
#!/usr/bin/env python3 """Example/test script for using the HP 6632B power supply via serial interface""" import atexit import os import sys from scpi.devices import hp6632b from scpi.wrapper import AIOWrapper if __name__ == "__main__": if len(sys.argv) < 2: print("run with python -i hp6632b.py /dev/ttyUSB0") sys.exit(1) # Then put to interactive mode os.environ["PYTHONINSPECT"] = "1" aiodev = hp6632b.rs232(sys.argv[1], rtscts=True) dev = AIOWrapper(aiodev) atexit.register(dev.quit) print(dev.identify())
#!/usr/bin/env python3 """Example/test script for using the HP 6632B power supply via serial interface""" import atexit import os import sys from scpi.devices import hp6632b from scpi.wrapper import AIOWrapper if __name__ == '__main__': if len(sys.argv) < 2: print("run with python -i hp6632b.py /dev/ttyUSB0") sys.exit(1) # Then put to interactive mode os.environ['PYTHONINSPECT'] = '1' aiodev = hp6632b.rs232(sys.argv[1], rtscts=True) dev = AIOWrapper(aiodev) atexit.register(dev.quit) print(dev.identify())
#!/usr/bin/env python3 """Example/test script for using the HP 6632B power supply via serial interface""" import atexit import os import sys from scpi.devices import hp6632b from scpi.wrapper import AIOWrapper if __name__ == "__main__": if len(sys.argv) < 2: print(f"run with python -i {__file__} /dev/ttyUSB0") sys.exit(1) # Then put to interactive mode os.environ["PYTHONINSPECT"] = "1" aiodev = hp6632b.rs232(sys.argv[1], rtscts=True, baudrate=9600) dev = AIOWrapper(aiodev) atexit.register(dev.quit) print(dev.identify())