diff --git a/Executioner.py b/Executioner.py deleted file mode 100644 index 0687b13..0000000 --- a/Executioner.py +++ /dev/null @@ -1,50 +0,0 @@ -import sys -from time import sleep, time - -from source.IdiBus4DC import Module4DC -from source.IdiBusSerialLine import IdiBusSerialLine - - -class Executioner(): - def __init__(self, name): - self.name = name - self.port = "" - self.address = 0 - self.speed = 0 - def execute(self, command, args): - pass - # Must return string with all data in csv format. without \n or \r - def get_log_string(self): - pass -class Exec4DC(Executioner): - def __init__(self, ): - super().__init__("Module4DC") - def execute(self, command, args): - module = Module4DC(addr=self.address, line=IdiBusSerialLine(port=self.port, baudrate=self.speed)) - if command == "set-data": - module.set_channel_data(args[0], args[1], args[2]) - elif command == "set-state": - module.set_channel_state(args[0], args[1]) - else: - print("Unknown command: " + command) - def get_log_string(self): - module = Module4DC(addr=self.address, line=IdiBusSerialLine(port=self.port, baudrate=self.speed)) - str = "" - for i in range(4): - data = module.set_channel_data(i) - if data == None: - return None - else: - str += f"{data["voltage"]},{data["current"]}," -class ExecSystem(Executioner): - def __init__(self): - super().__init__("Module4DC") - def execute(self, command, args): - if command == "sleep": - sleep(args[0]) - elif command == "exit": - sys.exit(0) - else: - print("Unknown command: " + command) - def get_log_string(self): - return "System is ok. :P" \ No newline at end of file diff --git a/IdiBusMaster.py b/IdiBusMaster.py index 70c7db3..51468c9 100644 --- a/IdiBusMaster.py +++ b/IdiBusMaster.py @@ -12,7 +12,7 @@ class IdiBusModule(): raise TypeError("Line is not an IdiBusSerialLine") self.line = line def startLongOp(self): - self.line.timeout = 3 + self.line.timeout = 1 def endLongOp(self): self.line.timeout = self.line.defaultTimeout def c_Init(self): diff --git a/IdiBusParse.py b/IdiBusParse.py index d1605ae..bfb28b8 100644 --- a/IdiBusParse.py +++ b/IdiBusParse.py @@ -71,7 +71,7 @@ class IdiBusSMESParser(IdiBusMES): unpacked = struct.unpack(format_string, self.getData()) return unpacked except struct.error as e: - print(f"Parse error: {e}") + print(f"Parse error: {e}. got len {len(self.getData())}") return None except UnicodeDecodeError as e: print(f"Parse error: {e}")