svghmi/svghmi.py
branchsvghmi
changeset 2768 31785529a657
parent 2767 302347f48193
child 2771 361366b891ca
equal deleted inserted replaced
2767:302347f48193 2768:31785529a657
   179                         "IN":  "_P_ENUM",
   179                         "IN":  "_P_ENUM",
   180                         "MEM": "_O_ENUM",
   180                         "MEM": "_O_ENUM",
   181                         "OUT": "_O_ENUM",
   181                         "OUT": "_O_ENUM",
   182                         "VAR": "_ENUM"
   182                         "VAR": "_ENUM"
   183                     }[node.vartype] + ", " +
   183                     }[node.vartype] + ", " +
   184                     str(buf_index) + ", 0}"]
   184                     str(buf_index) + ", 0, }"]
   185                 buf_index += sz
   185                 buf_index += sz
   186                 if len(node.path) == 1:
   186                 if len(node.path) == 1:
   187                     extern_variables_declarations += [
   187                     extern_variables_declarations += [
   188                         "extern __IEC_" + node.iectype + "_" +
   188                         "extern __IEC_" + node.iectype + "_" +
   189                         "t" if node.vartype is "VAR" else "p"
   189                         "t" if node.vartype is "VAR" else "p"
   206         svghmi_c_file.close()
   206         svghmi_c_file.close()
   207         svghmi_c_code = svghmi_c_code % { 
   207         svghmi_c_code = svghmi_c_code % { 
   208             "variable_decl_array": ",\n".join(variable_decl_array),
   208             "variable_decl_array": ",\n".join(variable_decl_array),
   209             "extern_variables_declarations": "\n".join(extern_variables_declarations),
   209             "extern_variables_declarations": "\n".join(extern_variables_declarations),
   210             "buffer_size": buf_index,
   210             "buffer_size": buf_index,
   211             "var_access_code": targets.GetCode("var_access.c")
   211             "var_access_code": targets.GetCode("var_access.c"),
       
   212             "PLC_ticktime": self.GetCTRoot().GetTicktime()
   212             }
   213             }
   213 
   214 
   214         gen_svghmi_c_path = os.path.join(buildpath, "svghmi.c")
   215         gen_svghmi_c_path = os.path.join(buildpath, "svghmi.c")
   215         gen_svghmi_c = open(gen_svghmi_c_path, 'w')
   216         gen_svghmi_c = open(gen_svghmi_c_path, 'w')
   216         gen_svghmi_c.write(svghmi_c_code)
   217         gen_svghmi_c.write(svghmi_c_code)