@@ -1016,6 +1016,7 @@ def __init__(self, parent:QWidget, dpi:int, locale:str, aw:'ApplicationWindow')
10161016 '+MQTT 78', #204
10171017 '+MQTT 910', #205
10181018 '+MQTT 1112', #206
1019+ '+MODBUS 1112', #207
10191020 ]
10201021
10211022 # ADD DEVICE:
@@ -4492,10 +4493,9 @@ def updateLargeExtraLCDs(self, extra1:list[str|None]|None = None, extra2:list[st
44924493 _log.exception(e)
44934494
44944495
4495- # ADD DEVICE:
4496-
44974496 # returns True if the extra device n, channel c, is of type MODBUS or S7, has no factor defined, nor any math formula, and is of type int
44984497 # channel c is either 0 or 1
4498+ # ADD DEVICE:
44994499 @functools.cache # noqa: B019 # pylint: disable=W1518 # Not relevant here, as qmc is only created once: [B019] Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
45004500 def intChannel(self, n:int, c:int) -> bool:
45014501 if len(self.extradevices) > n:
@@ -4505,7 +4505,7 @@ def intChannel(self, n:int, c:int) -> bool:
45054505 if c == 1:
45064506 no_math_formula_defined = bool(self.extramathexpression2[n] == '')
45074507 # MODBUS channels
4508- for idx, dev_type in enumerate([29,33,55,109,150]): # MODBUS, MODBUS_34, MODBUS_56, MODBUS_78, MODBUS_910
4508+ for idx, dev_type in enumerate([29,33,55,109,150,207 ]): # MODBUS, MODBUS_34, MODBUS_56, MODBUS_78, MODBUS_910, MODBUS_1112
45094509 if self.extradevices[n] == dev_type:
45104510 return ((self.aw.modbus.inputFloatsAsInt[idx*2 + c] or self.aw.modbus.inputBCDsAsInt[idx*2 + c] or not self.aw.modbus.inputFloats[idx*2 + c]) and
45114511 self.aw.modbus.inputDivs[idx*2 + c] == 0 and
@@ -5531,7 +5531,7 @@ def updateLCDs(self, time:float|None, temp1:list[float], temp2:list[float], delt
55315531 if i < self.aw.nLCDS:
55325532 try:
55335533 extra1_value = resLCD
5534- if idx is not None and XTs1[i] and idx < len(XTs1[i]):
5534+ if idx is not None and i < len(XTs1) and idx < len(XTs1[i]):
55355535 fmt = lcdformat
55365536 v = float(XTs1[i][idx])
55375537 if v != -1:
@@ -5553,7 +5553,7 @@ def updateLCDs(self, time:float|None, temp1:list[float], temp2:list[float], delt
55535553 self.aw.extraLCD1[i].display(extra1_value)
55545554 try:
55555555 extra2_value = resLCD
5556- if idx is not None and XTs2[i] and idx < len(XTs2[i]):
5556+ if idx is not None and i < len(XTs2) and idx < len(XTs2[i]):
55575557 fmt = lcdformat
55585558 v = float(XTs2[i][idx])
55595559 if v != -1:
@@ -9275,9 +9275,9 @@ def redraw(self, recomputeAllDeltas:bool = True, re_smooth_foreground:bool = Tru
92759275
92769276 decay_smoothing_p = (not self.optimalSmoothing) or self.flagon
92779277
9278- scale = 1 if self.graphstyle == 1 else 0
9279- length = 700 # 100 (128 the default)
9280- randomness = 12 # 2 (16 default)
9278+ scale = 1.5 if self.graphstyle == 1 else 0
9279+ length = 800 # 100 (128 the default)
9280+ randomness = 16 # 2 (16 default)
92819281 rcParams['path.sketch'] = (scale, length, randomness)
92829282
92839283 # if no axis are set, we need to forceRenewAxis in any case
@@ -12574,7 +12574,6 @@ def changeGColor(self, color:int) -> None:
1257412574 self.EvalueColor = self.EvalueColor_default.copy()
1257512575 self.EvalueTextColor = self.EvalueTextColor_default.copy()
1257612576 self.aw.sendmessage(QApplication.translate('Message','Colors set to defaults'))
12577- # self.aw.closeEventSettings()
1257812577
1257912578 elif color == 2:
1258012579 self.aw.sendmessage(QApplication.translate('Message','Colors set to grey'))
@@ -12596,7 +12595,6 @@ def changeGColor(self, color:int) -> None:
1259612595 self.backgroundxtcolor = self.aw.convertToGreyscale(self.backgroundxtcolor)
1259712596 self.backgroundytcolor = self.aw.convertToGreyscale(self.backgroundytcolor)
1259812597 self.aw.setLCDsBW()
12599- # self.aw.closeEventSettings()
1260012598
1260112599 elif color == 3:
1260212600 from artisanlib.colors import graphColorDlg
@@ -12640,23 +12638,15 @@ def changeGColor(self, color:int) -> None:
1264012638 self.backgrounddeltabtcolor = str(dialog.bgdeltabtButton.text())
1264112639 self.backgroundxtcolor = str(dialog.bgextraButton.text())
1264212640 self.backgroundytcolor = str(dialog.bgextra2Button.text())
12643- # self.aw.closeEventSettings()
12644-
12645- # #deleteLater() will not work here as the dialog is still bound via the parent
12646- # #dialog.deleteLater() # now we explicitly allow the dialog an its widgets to be GCed
12647- # # the following will immediately release the memory despite this parent link
12648- # QApplication.processEvents() # we ensure events concerning this dialog are processed before deletion
12649- # try: # sip not supported on older PyQt versions (RPi!)
12650- # sip.delete(dialog)
12651- # #print(sip.isdeleted(dialog))
12652- # except Exception: # pylint: disable=broad-except
12653- # pass
12641+ # release the dialog
12642+ dialog.destroy()
12643+ del dialog
1265412644
1265512645 #update screen with new colors
1265612646 self.aw.updateCanvasColors()
1265712647 self.aw.applyStandardButtonVisibility()
1265812648 self.aw.update_extraeventbuttons_visibility()
12659- self.fig.canvas.draw_idle() #.redraw()
12649+ self.fig.canvas.draw_idle()
1266012650
1266112651 def clearFlavorChart(self) -> None:
1266212652 self.flavorchart_plotf = None
@@ -12950,6 +12940,7 @@ def StopAsyncSamplingAction(self) -> None:
1295012940 # indicating which curves should not be temperature converted
1295112941 # True indicates a non-temperature device (data should not be converted)
1295212942 # False indicates a temperature device (data should be converted if temperature unit changes)
12943+ # ADD DEVICE:
1295312944 def generateNoneTempHints(self) -> None:
1295412945 self.extraNoneTempHint1 = []
1295512946 self.extraNoneTempHint2 = []
@@ -12969,6 +12960,12 @@ def generateNoneTempHints(self) -> None:
1296912960 elif d == 109: # +MODBUS 78
1297012961 self.extraNoneTempHint1.append(self.aw.modbus.inputModes[6] == '')
1297112962 self.extraNoneTempHint2.append(self.aw.modbus.inputModes[7] == '')
12963+ elif d == 150: # +MODBUS 910
12964+ self.extraNoneTempHint1.append(self.aw.modbus.inputModes[8] == '')
12965+ self.extraNoneTempHint2.append(self.aw.modbus.inputModes[9] == '')
12966+ elif d == 207: # +MODBUS 1112
12967+ self.extraNoneTempHint1.append(self.aw.modbus.inputModes[10] == '')
12968+ self.extraNoneTempHint2.append(self.aw.modbus.inputModes[11] == '')
1297212969 elif d == 79: # S7
1297312970 self.extraNoneTempHint1.append(not bool(self.aw.s7.mode[0]))
1297412971 self.extraNoneTempHint2.append(not bool(self.aw.s7.mode[1]))
@@ -12999,9 +12996,6 @@ def generateNoneTempHints(self) -> None:
1299912996 elif d == 119: # +WebSocket 910
1300012997 self.extraNoneTempHint1.append(not bool(self.aw.ws.channel_modes[8]))
1300112998 self.extraNoneTempHint2.append(not bool(self.aw.ws.channel_modes[9]))
13002- elif d == 150: # +MODBUS 910
13003- self.extraNoneTempHint1.append(self.aw.modbus.inputModes[8] == '')
13004- self.extraNoneTempHint2.append(self.aw.modbus.inputModes[9] == '')
1300512999 elif d == 151: # +S7 1112
1300613000 self.extraNoneTempHint1.append(not bool(self.aw.s7.mode[10]))
1300713001 self.extraNoneTempHint2.append(not bool(self.aw.s7.mode[11]))
0 commit comments