|
177 | 177 | from artisanlib.bluedot import BlueDOT # pylint: disable=unused-import |
178 | 178 | from artisanlib.mugma import Mugma # pylint: disable=unused-import |
179 | 179 | from artisanlib.kaleido import KaleidoPort # pylint: disable=unused-import |
| 180 | + from artisanlib.orbiter import Orbiter # pylint: disable=unused-import |
180 | 181 | from artisanlib.phases_canvas import tphasescanvas # pylint: disable=unused-import |
181 | 182 | try: |
182 | 183 | from artisanlib.ikawa import IKAWA_BLE # pylint: disable=unused-import |
@@ -1428,6 +1429,7 @@ class ApplicationWindow(QMainWindow): |
1428 | 1429 | santokerSendMessageSignal = pyqtSignal(bytes,int) |
1429 | 1430 | kaleidoSendMessageSignal = pyqtSignal(str,str) |
1430 | 1431 | kaleidoSendMessageAwaitSignal = pyqtSignal(str,str,int,int) |
| 1432 | + orbiterSendMessageSignal = pyqtSignal(bytes,bytes,bytes) |
1431 | 1433 | addEventSignal = pyqtSignal(int,int,bool,bool,bool) |
1432 | 1434 | addRawEventSignal = pyqtSignal(int,float,int,bool,bool,bool) |
1433 | 1435 | updateMessageLogSignal = pyqtSignal() |
@@ -1840,6 +1842,9 @@ def __init__(self, parent:QWidget|None = None, *, locale:str, WebEngineSupport:b |
1840 | 1842 | self.kaleido:KaleidoPort|None = None # holds the Kaleido instance created on connect; reset to None on disconnect |
1841 | 1843 | self.kaleidoEventFlags:list[bool] = [False, False, False, False, False, False, False ] # CHARGE, DRY, FCs, FCe, SCs, SCe, DROP |
1842 | 1844 |
|
| 1845 | + # Orbiter |
| 1846 | + self.orbiter:Orbiter|None = None # holds the Orbiter instance created on connect; reset to None on disconnect |
| 1847 | + |
1843 | 1848 | # Ikawa BLE |
1844 | 1849 | self.ikawa:'IKAWA_BLE|None' = None # noqa: UP037 |
1845 | 1850 |
|
@@ -4277,6 +4282,7 @@ def __init__(self, parent:QWidget|None = None, *, locale:str, WebEngineSupport:b |
4277 | 4282 | self.santokerSendMessageSignal.connect(self.santokerSendMessage) |
4278 | 4283 | self.kaleidoSendMessageSignal.connect(self.kaleidoSendMessage) |
4279 | 4284 | self.kaleidoSendMessageAwaitSignal.connect(self.kaleidoSendMessageAwait) |
| 4285 | + self.orbiterSendMessageSignal.connect(self.orbiterSendMessage) |
4280 | 4286 | self.addEventSignal.connect(self.addEventSlot, type=Qt.ConnectionType.QueuedConnection) # type: ignore[call-arg] |
4281 | 4287 | self.addRawEventSignal.connect(self.addRawEventSlot, type=Qt.ConnectionType.QueuedConnection) # type: ignore[call-arg] |
4282 | 4288 | # by default the connection type is AutoConnection (If the emitter & receiver are in the same thread, a DirectConnection is used. Otherwise, a QueuedConnection is used.) |
@@ -5945,7 +5951,7 @@ def openMachineSettings(self, _checked:bool = False) -> None: |
5945 | 5951 | self.mugmaHost = host |
5946 | 5952 | else: |
5947 | 5953 | res = False |
5948 | | - elif (self.qmc.device in {0, 9, 19, 53, 101, 115, 126} or ((self.qmc.device == 29 or 29 in self.qmc.extradevices) and self.modbus.type in {0, 1, 2}) or |
| 5954 | + elif (self.qmc.device in {0, 9, 19, 53, 101, 115, 126, 196} or ((self.qmc.device == 29 or 29 in self.qmc.extradevices) and self.modbus.type in {0, 1, 2}) or |
5949 | 5955 | (self.qmc.device == 134 and self.santokerSerial and not self.santokerBLE) or |
5950 | 5956 | (self.qmc.device == 138 and self.kaleidoSerial)): # Fuji, Center301, TC4, Hottop, Behmor or MODBUS serial, HB/ARC |
5951 | 5957 | select_device_name = None |
@@ -9551,6 +9557,30 @@ def eventaction_internal(self, action:int, cmd:str, eventtype:int|None) -> None: |
9551 | 9557 | # send message, await new value and create an event with the new value |
9552 | 9558 | self.kaleidoSendMessageAwaitSignal.emit(target, vs, eventtype, lastbuttonpressed) |
9553 | 9559 |
|
| 9560 | + |
| 9561 | + ## orbiter(<cmd>[,<value>[,<param>]]) : <cmd>: command (1 byte in hex syntax), optional: <value> a 16bit positive number, <param> a number 0-255 |
| 9562 | + # ex: orbiter(0D,7) => set heater power to 7 |
| 9563 | + elif c.startswith('orbiter'): |
| 9564 | + if self.orbiter is not None: |
| 9565 | + args = c[len('orbiter'):] |
| 9566 | + if args.startswith('(') and args.endswith(')'): |
| 9567 | + parts = args[1:-1].split(',') |
| 9568 | + try: |
| 9569 | + if len(parts) > 0: |
| 9570 | + orbiter_cmd:bytes = bytes.fromhex(parts[0]) |
| 9571 | + orbiter_data:bytes |
| 9572 | + if len(parts) > 2: |
| 9573 | + orbiter_param = min(255, max(0, int(round(float(parts[2]))))).to_bytes(1, 'little') |
| 9574 | + else: |
| 9575 | + orbiter_param = b'\x00' |
| 9576 | + if len(parts) > 1: |
| 9577 | + orbiter_data = min(65535, max(0, int(round(float(parts[1]))))).to_bytes(2, 'little') |
| 9578 | + else: |
| 9579 | + orbiter_data = b'\x00\x00' |
| 9580 | + self.orbiterSendMessageSignal.emit(orbiter_cmd, orbiter_data, orbiter_param) |
| 9581 | + except Exception as e: # pylint: disable=broad-except |
| 9582 | + _log.error(e) |
| 9583 | + |
9554 | 9584 | ## shellyrelay(n,b) : switches Shelly plug number <n> ON if b is true or 1, and OFF otherwise |
9555 | 9585 | elif c.startswith('shellyrelay'): |
9556 | 9586 | cs_a = re.findall(r'[0-9a-zA-Z-.:]+', c) |
@@ -17798,6 +17828,12 @@ def kaleidoSendMessage(self, target:str, value:str) -> None: |
17798 | 17828 | if self.kaleido is not None: |
17799 | 17829 | self.kaleido.send_msg(target, value) |
17800 | 17830 |
|
| 17831 | + # orbiterSendMessage() just sends out the message to the machine without waiting for a response |
| 17832 | + @pyqtSlot(bytes,bytes,bytes) |
| 17833 | + def orbiterSendMessage(self, cmd:bytes, data:bytes, param:bytes) -> None: |
| 17834 | + if self.orbiter is not None: |
| 17835 | + self.orbiter.send_msg(cmd, data, param) |
| 17836 | + |
17801 | 17837 | # if record is True, an event is added during recording, otherwise only the slider is moved |
17802 | 17838 | # if fire_slider_action is True, the slider action is fired |
17803 | 17839 | # if force is True, process even if value is equal to the events lastvalue resp. the current slider value |
|
0 commit comments