IDE+Runtime: fix exception when reconnecting with non-empty trace/force list.
Sometimes, remote call to SetTraceVariableList returned None just after reconnecting:
- changed caller to accept None (in case of connection problem)
- changer SetTraceVariable list to return 4 (DEBUG_SUSPENDED) if debug is suspended
--- a/ProjectController.py Fri Jul 22 12:14:52 2022 +0200
+++ b/ProjectController.py Tue Aug 02 11:50:54 2022 +0200
@@ -1577,12 +1577,16 @@
return debug_status, ticks, buffers
RegisterDebugVariableErrorCodes = {
+ # Connector only can return None
+ None : _("Debug: connection problem.\n"),
# TRACE_LIST_OVERFLOW
1 : _("Debug: Too many variables traced. Max 1024.\n"),
# FORCE_LIST_OVERFLOW
2 : _("Debug: Too many variables forced. Max 256.\n"),
# FORCE_BUFFER_OVERFLOW
- 3 : _("Debug: Cumulated forced variables size too large. Max 1KB.\n")
+ 3 : _("Debug: Cumulated forced variables size too large. Max 1KB.\n"),
+ # DEBUG_SUSPENDED
+ 4 : _("Debug: suspended.\n")
}
def RegisterDebugVarToConnector(self):
@@ -1625,7 +1629,8 @@
self.DebugToken = None
self.logger.write_warning(
self.RegisterDebugVariableErrorCodes.get(
- -res, _("Debug: Unknown error")))
+ -res if res is not None else None,
+ _("Debug: Unknown error")))
else:
self.TracedIECPath = []
self._connector.SetTraceVariablesList([])
--- a/runtime/PLCObject.py Fri Jul 22 12:14:52 2022 +0200
+++ b/runtime/PLCObject.py Tue Aug 02 11:50:54 2022 +0200
@@ -730,7 +730,7 @@
return self.DebugToken
else:
self._suspendDebug(True)
- return None
+ return 4 # DEBUG_SUSPENDED
def _TracesSwap(self):
self.LastSwapTrace = time()
--- a/svghmi/widget_jump.ysl2 Fri Jul 22 12:14:52 2022 +0200
+++ b/svghmi/widget_jump.ysl2 Tue Aug 02 11:50:54 2022 +0200
@@ -84,6 +84,9 @@
dispatch(value) {
this.disabled = !Number(value);
+
+ // TODO : use RequestAnimate and animate()
+
this.update_state();
}
||
@@ -142,6 +145,7 @@
}
}
+/* TODO: move to detachable pages ysl2 */
emit "cssdefs:jump"
||
.fade-out-page {
--- a/svghmi/widget_multistate.ysl2 Fri Jul 22 12:14:52 2022 +0200
+++ b/svghmi/widget_multistate.ysl2 Tue Aug 02 11:50:54 2022 +0200
@@ -36,6 +36,7 @@
choice.elt.setAttribute("style", choice.style);
}
}
+ // TODO : use RequestAnimate and animate()
}
on_click(evt) {
--- a/tests/projects/svghmi/plc.xml Fri Jul 22 12:14:52 2022 +0200
+++ b/tests/projects/svghmi/plc.xml Tue Aug 02 11:50:54 2022 +0200
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<project xmlns:ns1="http://www.plcopen.org/xml/tc6_0201" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.plcopen.org/xml/tc6_0201">
<fileHeader companyName="Unknown" productName="Unnamed" productVersion="1" creationDateTime="2019-08-06T14:23:42"/>
- <contentHeader name="Unnamed" modificationDateTime="2022-01-18T11:38:21">
+ <contentHeader name="Unnamed" modificationDateTime="2022-07-21T11:39:43">
<coordinateInfo>
<fbd>
<scaling x="5" y="5"/>
@@ -25,11 +25,20 @@
<derived name="HMI_INT"/>
</type>
</variable>
+ </localVars>
+ <localVars retain="true">
<variable name="selection">
<type>
<derived name="HMI_INT"/>
</type>
</variable>
+ <variable name="selection0">
+ <type>
+ <INT/>
+ </type>
+ </variable>
+ </localVars>
+ <localVars>
<variable name="Pump0">
<type>
<derived name="PumpControl"/>