TelenkovDmitry 1 anno fa
parent
commit
edc85d8821

BIN
hw_libs/__pycache__/modbus.cpython-310.pyc


BIN
hw_libs/fw.bin


+ 7 - 6
hw_libs/io_module.py

@@ -217,11 +217,12 @@ class IO_Module(Modbus):
 
 def main():
     colorama.init(autoreset=True)
-    dev = IO_Module('COM24', 115200, 14)
+    dev = IO_Module('COM22', 115200, 1)
     dev.MB_DEBUG = False
     
-    trigger = 0
-    # dev.update('fw.bin')
+    dev.update('fw.bin')
+
+    return
 
     # Запрос системных параметров, установка времени
     
@@ -238,10 +239,10 @@ def main():
     
     for i in range(1, 9):
         dev.set_input_mode(i, 1)
-        # print('Inputs mode [bit field]   :', Fore.GREEN + dev.get_inputs_mode())
+        print('Inputs mode [bit field]   :', Fore.GREEN + dev.get_inputs_mode())
 
-    # for i in range(1, 9):
-        # dev.set_debounce_channel(i, 50 + i)
+    for i in range(1, 9):
+        dev.set_debounce_channel(i, 100 + i)
         # dev.set_output(i, 1)
         # dev.set_output_mode(i, 1)
         

+ 1 - 1
hw_libs/modbus.py

@@ -99,7 +99,7 @@ class Modbus(ModbusMixin):
         crc_received = response[-2:]
         crc_calculated = self._crc(response[:-2])
         if crc_received != crc_calculated:
-            raise ChecksumError("CRC check dailed (got: 0x{}, calculated: 0x{})".format(
+            raise ChecksumError("CRC check failed (got: 0x{}, calculated: 0x{})".format(
                 b2a_hex(crc_received).decode().upper(), b2a_hex(crc_calculated).decode().upper()))
         return response