If call to GetPLCstatus can't be executed in PLC, then obtained status is disconnected. Status on "None" is not relevant anymore, and is replaced by Disconnected.
--- a/ProjectController.py Thu Apr 18 14:29:55 2019 +0200
+++ b/ProjectController.py Thu Apr 18 14:32:43 2019 +0200
@@ -1446,13 +1446,13 @@
def UpdateMethodsFromPLCStatus(self):
updated = False
- status = None
+ status = PlcStatus.Disconnected
if self._connector is not None:
PLCstatus = self._connector.GetPLCstatus()
if PLCstatus is not None:
status, log_count = PLCstatus
self.UpdatePLCLog(log_count)
- if status is None:
+ if status == PlcStatus.Disconnected:
self._SetConnector(None, False)
status = PlcStatus.Disconnected
if self.previous_plcstate != status:
--- a/runtime/PLCObject.py Thu Apr 18 14:29:55 2019 +0200
+++ b/runtime/PLCObject.py Thu Apr 18 14:32:43 2019 +0200
@@ -477,8 +477,14 @@
return True
return False
- @RunInMain
def GetPLCstatus(self):
+ try:
+ return self._GetPLCstatus()
+ except EOFError:
+ return (PlcStatus.Disconnected, None)
+
+ @RunInMain
+ def _GetPLCstatus(self):
return self.PLCStatus, map(self.GetLogCount, xrange(LogLevelsCount))
@RunInMain