def __init__(self, *args, **kwargs): super(Machineroom, self).__init__('MR', *args, **kwargs) self.log("Machineroom starting") self._rudder_channel = 1 self._machine_channel = 2 self._pump_channel = 3 # TODO: Make this a dedicated singleton call? # e.g. pumpon/pumpoff.. not so generic self._serial_open = False if self.config.serialfile != '': try: self.serial = Serial(self.config.serialfile, self.config.baudrate, self.config.buffersize, timeout=5, channel="port").register(self) except Exception as e: self.log("Problem with serial port: ", e, type(e), lvl=critical) else: self.log("No serial port configured!", lvl=warn) self.log("Running")
def __init__(self, *args, **kwargs): super(Machineroom, self).__init__('MR', *args, **kwargs) self.log("Machineroom starting") self.maestro = True self.targets = { 'machine': 1, 'rudder': 0, 'pump': 2 } self.controller_mapping = { 'axes': { 1: { 'name': 'machine', 'flags': ['inverted'], }, 2: { 'name': 'rudder' } }, 'buttons': { 3: { 'name': 'pump' } } } self._rudder_channel = 0 self._machine_channel = 1 self._pump_channel = 2 # TODO: Make this a dedicated singleton call? # e.g. pumpon/pumpoff.. not so generic self._values = {} for item in self.targets.values(): self._values[item] = 0 self._serial_open = False if self.config.serialfile != '': try: self.serial = Serial(self.config.serialfile, self.config.baudrate, self.config.buffersize, timeout=5, channel="port").register(self) # Workaround for https://github.com/circuits/circuits/issues/252 # self.serial._encoding = 'ascii' except Exception as e: self.log("Problem with serial port: ", e, type(e), lvl=critical) else: self.log("No serial port configured!", lvl=warn) self.log("Running")
def __init__(self, port="/dev/ttyUSB0", baudrate=9600, buffersize=4096, *args): super(Machineroom, self).__init__(args) hfoslog("[MR] Machineroom starting") self._rudderchannel = 1 self._machinechannel = 1 self._pumpchannel = 3 # TODO: Make this a dedicated singleton call? e.g. pumpon/pumpoff.. not so generic Serial(port, baudrate, buffersize, timeout=5, channel="port").register(self) hfoslog("[MR] Running")
def init(self, port): Serial(port).register(self)
def __init__(self, port='/dev/ttyACM0', baudrate=115200, bufsize=1, timeout=0, channel=channel): log("RaspuinoDartMiniBoard::__init__({})".format(port)) super(RaspuinoDartMiniBoard, self).__init__(channel=channel) if serial is None: log("no USB connection") else: Serial(port, baudrate, bufsize, timeout).register(self) self.serial_matrix = { 51: 'D20', 67: 'o20', 83: 'T20', 99: 'i20', 50: 'D01', 66: 'o01', 82: 'T01', 98: 'i01', 49: 'D18', 65: 'o18', 81: 'T18', 33: 'i18', 48: 'D04', 64: 'o04', 96: 'T04', 16: 'i04', 68: 'D13', 80: 'o13', 32: 'T13', 0: 'i13', 84: 'D06', 97: 'o06', 17: 'T06', 1: 'i06', 100: 'D10', 34: 'o10', 18: 'T10', 2: 'i10', 36: 'D15', 35: 'o15', 19: 'T15', 3: 'i15', 38: 'D02', 39: 'o02', 7: 'T02', 23: 'i02', 102: 'D17', 40: 'o17', 8: 'T17', 24: 'i17', 86: 'D03', 41: 'o03', 9: 'T03', 25: 'i03', 70: 'D19', 106: 'o19', 10: 'T19', 26: 'i19', 54: 'D07', 91: 'o07', 43: 'T07', 27: 'i07', 59: 'D16', 75: 'o16', 107: 'T16', 11: 'i16', 58: 'D08', 74: 'o08', 90: 'T08', 42: 'i08', 57: 'D11', 73: 'o11', 89: 'T11', 105: 'i11', 56: 'D14', 72: 'o14', 88: 'T14', 104: 'i14', 55: 'D09', 71: 'o09', 87: 'T09', 103: 'i09', 53: 'D12', 69: 'o12', 101: 'T12', 5: 'i12', 52: 'D05', 85: 'o05', 37: 'T05', 21: 'i05', 4: 'DBE', 6: 'BE' }