Modbus plugin web configuration: fix comments, and delete un-used code
authorMario de Sousa <msousa@fe.up.pt>
Sat, 06 Jun 2020 07:34:02 +0100
changeset 2658 fdca999c0c1a
parent 2657 41c34e7d196d
child 2659 09bac1f52b1e
child 2660 ddbf029f5682
Modbus plugin web configuration: fix comments, and delete un-used code
runtime/Modbus_config.py
--- a/runtime/Modbus_config.py	Sat Jun 06 07:24:42 2020 +0100
+++ b/runtime/Modbus_config.py	Sat Jun 06 07:34:02 2020 +0100
@@ -130,6 +130,10 @@
 
 # Parameters we will need to get from the C code, but that will not be shown
 # on the web interface. Common to all modbus entry types (client/server, tcp/rtu/ascii)
+#
+# The annotate type entry is basically useless and is completely ignored.
+# We kee that entry so that this list can later be correctly merged with the
+# following lists...
 General_parameters = [
     #    param. name       label                        ctype type         annotate type
     # (C code var name)   (used on web interface)      (C data type)       (web data type)
@@ -210,51 +214,6 @@
 
 
 
-#def _CheckPortnumber(port_number):
-#    """ check validity of the port number """
-#    try:
-#        portnum = int(port_number)
-#        if (portnum < 0) or (portnum > 65535):
-#           raise Exception
-#    except Exception:    
-#        return False
-#        
-#    return True
-
-
-
-
-#def _CheckConfiguration(BACnetConfig):
-#    res = True    
-#    res = res and _CheckPortnumber(BACnetConfig["port_number"])
-#    res = res and _CheckDeviceID  (BACnetConfig["device_id"])
-#    return res
-
-
-
-#def _CheckWebConfiguration(BACnetConfig):
-#    res = True
-#    
-#    # check the port number
-#    if not _CheckPortnumber(BACnetConfig["port_number"]):
-#        raise annotate.ValidateError(
-#            {"port_number": "Invalid port number: " + str(BACnetConfig["port_number"])},
-#            _("Modbus configuration error:"))
-#        res = False
-#    
-#    if not _CheckDeviceID(BACnetConfig["device_id"]):
-#        raise annotate.ValidateError(
-#            {"device_id": "Invalid device ID: " + str(BACnetConfig["device_id"])},
-#            _("Modbus configuration error:"))
-#        res = False
-#        
-#    return res
-
-
-
-
-
-
 def _SetSavedConfiguration(WebNode_id, newConfig):
     """ Stores a dictionary in a persistant file containing the Modbus parameter configuration """
     
@@ -421,10 +380,11 @@
     _WebNodeList[WebNode_id]["WebviewConfiguration"] = newConfig
     
     # First check if configuration is OK.
-    ## TODO...
+    # Note that this is not currently required, as we use drop down choice menus
+    # for baud, parity and sop bits, so the values should always be correct!
     #if not _CheckWebConfiguration(newConfig):
     #    return
-
+    
     # store to file the new configuration so that 
     # we can recoup the configuration the next time the PLC
     # has a cold start (i.e. when Beremiz_service.py is retarted)