diff --git a/.idea/PowerUI.iml b/.idea/PowerUI.iml
index e35e19c..485c55f 100644
--- a/.idea/PowerUI.iml
+++ b/.idea/PowerUI.iml
@@ -4,7 +4,7 @@
-
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index dc71d4a..fcb7b14 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,5 +3,5 @@
-
+
\ No newline at end of file
diff --git a/controller/controller_reifined.py b/controller/controller_reifined.py
index 4d31512..b447703 100644
--- a/controller/controller_reifined.py
+++ b/controller/controller_reifined.py
@@ -180,12 +180,15 @@ class ControllerInterface:
targets = {
"currents set": (0xBE, 0xEE),
"currents get": (0xBE, 0xEF),
- "powers set": (0xBE, 0x10),
- "powers get": (0xBE, 0x11),
- "address": (0xBF, 0x20),
- "device info": (0xBF, 0x00),
- "device mode set": (0xBF, 0x10),
- "device mode get": (0xBF, 0x11),
+ "powers": (0xBE, 0x10),
+ # "address": (0xBF, 0x20),
+ # "device info": (0xBF, 0x00),
+ # "device mode set": (0xBF, 0x10),
+ # "device mode get": (0xBF, 0x11),
+ "address": (0x00, 0xF0),
+ "device info": (0x00, 0x60),
+ "device mode set": (0x00, 0xE0),
+ "device mode get": (0x00, 0xE1),
}
# Currents #
@@ -232,9 +235,9 @@ class ControllerInterface:
return False
def readMode(self, mode_index: int) -> tuple:
- self.controller.readDop = True # READ MODE BUG FIX TODO
+ # self.controller.readDop = True # READ MODE BUG FIX TODO
data = self.sendPacketWithResponse(self.c_codes['get'], self.targets['device mode get'], [mode_index + 1])
- self.controller.readDop = False # READ MODE BUG FIX TODO
+ # self.controller.readDop = False # READ MODE BUG FIX TODO
print('Read bytes:')
for i, b in enumerate(self.controller.read_buffer):
@@ -276,10 +279,10 @@ class ControllerInterface:
# Powers #
def writePowers(self, currents: list, voltages: list, power: int, koeffs: list, a_max: int) -> bool:
data = currents + voltages + [power] + koeffs + [a_max]
- return self.sendPacket(self.c_codes['set'], self.targets['powers set'], data)
+ return self.sendPacket(self.c_codes['set'], self.targets['powers'], data)
def readPowers(self) -> list:
- return self.sendPacketWithResponse(self.c_codes['get'], self.targets['powers get'], [])
+ return self.sendPacketWithResponse(self.c_codes['get'], self.targets['powers'], [])
# source: https://stackoverflow.com/a/14224477
@staticmethod
diff --git a/interface.py b/interface.py
index 10508c7..4f87d2b 100644
--- a/interface.py
+++ b/interface.py
@@ -38,6 +38,8 @@ check = tk.IntVar()
def setStatus(new_status: str):
+ print(f'New status: {new_status}')
+
status.set(new_status)
win.update()
win.update_idletasks()
@@ -125,7 +127,7 @@ def readControllerCurrentsAndData() -> bool:
setStatus(f'Чтение адреса {controller.controller.ser.port}...')
address = controller.readAddress()
-
+ print(f'New address: {address}')
if address == -1:
dmx_address_field.configure(style='failedToRead.TEntry')
else:
@@ -133,7 +135,6 @@ def readControllerCurrentsAndData() -> bool:
dmx_address_field.delete(0, tk.END)
dmx_address_field.insert(tk.END, str(address))
- global modesself.ui.DeviceSelection.addItems(['/dev/ttyUSB0', '/dev/ttyUSB2'])
modes = []
@@ -389,7 +390,16 @@ def finish():
if __name__ == "__main__":
- controller.writePowers([100, 200, 300, 400], [300, 2000, 2341, 10], 49, [100, 240, 30, 239], 52)
+ controller.connect("/dev/ttyUSB0")
+
+ pws = controller.readPowers()
+ print(pws)
+
+ controller.writePowers([30, 47, 60, 60], [14, 45, 34, 9], 20, [10, 20, 30, 40], 10)
+ time.sleep(2)
+
+ pws = controller.readPowers()
+ print(pws)
win.configure(width=270, height=350)
win.resizable(False, False)
diff --git a/main.py b/main.py
index b88b7bd..d743a50 100644
--- a/main.py
+++ b/main.py
@@ -61,6 +61,8 @@ class Window(QtWidgets.QMainWindow):
def setStatus(self, text: str) -> None :
print(text)
+ self.ui.Status.setText(text)
+ self.repaint()
def deviceSelected(self, deviceIndex: int):
device = self.ui.DeviceSelection.itemText(deviceIndex)
diff --git a/ui/ControllerUI/ControllerUI.pyproject.user b/ui/ControllerUI/ControllerUI.pyproject.user
index 4a4fc15..1854af3 100644
--- a/ui/ControllerUI/ControllerUI.pyproject.user
+++ b/ui/ControllerUI/ControllerUI.pyproject.user
@@ -1,6 +1,6 @@
-
+
EnvironmentId
diff --git a/ui/ControllerUI/power.ui.autosave b/ui/ControllerUI/power.ui.autosave
deleted file mode 100644
index db8d171..0000000
--- a/ui/ControllerUI/power.ui.autosave
+++ /dev/null
@@ -1,418 +0,0 @@
-
-
- Controller
-
-
-
- 0
- 0
- 273
- 350
-
-
-
-
- 0
- 0
-
-
-
-
- 273
- 350
-
-
-
-
- 273
- 350
-
-
-
- Controller
-
-
-
-
-
- 0
- 0
- 284
- 251
-
-
-
-
- QFormLayout::DontWrapRows
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- 8
-
-
- 10
-
-
- 10
-
-
- 0
-
- -
-
-
-
- Ubuntu Sans
-
-
-
- COM Порт:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 110
- 16777215
-
-
-
-
- Arial
- 10
-
-
-
-
-
- /dev/ttyUSB0
-
-
-
-
- -
-
-
- DMX Адрес:
-
-
-
- -
-
-
-
- 45
- 16777215
-
-
-
- 10
-
-
- Qt::AlignCenter
-
-
- no data
-
-
-
- -
-
-
- Personality:
-
-
-
- -
-
-
- I1
-
-
-
- -
-
-
-
-
-
-
- 45
- 16777215
-
-
-
- 1000
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 16777215
- 16777215
-
-
-
- mA
-
-
-
-
-
- -
-
-
- I2
-
-
-
- -
-
-
-
-
-
-
- 45
- 16777215
-
-
-
- 450
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- mA
-
-
-
-
-
- -
-
-
- I3
-
-
-
- -
-
-
-
-
-
-
- 45
- 16777215
-
-
-
- 520
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- mA
-
-
-
-
-
- -
-
-
- I4
-
-
-
- -
-
-
-
-
-
-
- 45
- 16777215
-
-
-
- 780
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- mA
-
-
-
-
-
- -
-
-
- 0
-
-
- 0
-
-
-
-
-
-
- 131
- 32
-
-
-
-
- Arial
- 9
-
-
-
- true
-
-
-
-
- 28:CH RGB45 SLO
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 32
- 32
-
-
-
-
-
-
-
- ..
-
-
-
- 20
- 20
-
-
-
- false
-
-
-
-
-
-
-
-
-
-
- 0
- 250
- 271
- 101
-
-
-
- -
-
-
- 50
-
-
- 10
-
-
- 10
-
-
-
-
-
- Чтение
-
-
-
- -
-
-
- Запись
-
-
-
-
-
- -
-
-
- 0
-
-
-
-
-
-
- 97
- 16777215
-
-
-
- Проверить
-
-
-
-
-
- -
-
-
- Выбранный порт: /dev/ttyUSB0
-
-
- Qt::AlignCenter
-
-
-
-
-
-
-
-
-
-
diff --git a/протокол (2).xlsx b/протокол (2).xlsx
new file mode 100644
index 0000000..92d2c22
Binary files /dev/null and b/протокол (2).xlsx differ