# HG changeset patch
# User laurent
# Date 1332324947 -3600
# Node ID 27d4cb689a79650a161057e71db3271bcadbcf61
# Parent 563ccc918ded1509cf17d1ff5b81e4842c940f78
Adding plugin icons and replacing reference to DS402 by CIA402
diff -r 563ccc918ded -r 27d4cb689a79 ethercat_tests/wago_sanyo/ethercat@etherlab/master@EthercatNode/sanyo@EthercatCIA402Slave/baseplugin.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ethercat_tests/wago_sanyo/ethercat@etherlab/master@EthercatNode/sanyo@EthercatCIA402Slave/baseplugin.xml Wed Mar 21 11:15:47 2012 +0100
@@ -0,0 +1,2 @@
+
+
diff -r 563ccc918ded -r 27d4cb689a79 ethercat_tests/wago_sanyo/ethercat@etherlab/master@EthercatNode/sanyo@EthercatCIA402Slave/plugin.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ethercat_tests/wago_sanyo/ethercat@etherlab/master@EthercatNode/sanyo@EthercatCIA402Slave/plugin.xml Wed Mar 21 11:15:47 2012 +0100
@@ -0,0 +1,2 @@
+
+
diff -r 563ccc918ded -r 27d4cb689a79 ethercat_tests/wago_sanyo/ethercat@etherlab/master@EthercatNode/sanyo@EthercatDS402Slave/baseplugin.xml
--- a/ethercat_tests/wago_sanyo/ethercat@etherlab/master@EthercatNode/sanyo@EthercatDS402Slave/baseplugin.xml Mon Mar 19 00:45:19 2012 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-
-
diff -r 563ccc918ded -r 27d4cb689a79 ethercat_tests/wago_sanyo/ethercat@etherlab/master@EthercatNode/sanyo@EthercatDS402Slave/plugin.xml
--- a/ethercat_tests/wago_sanyo/ethercat@etherlab/master@EthercatNode/sanyo@EthercatDS402Slave/plugin.xml Mon Mar 19 00:45:19 2012 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-
-
diff -r 563ccc918ded -r 27d4cb689a79 etherlab/ConfigEditor.py
--- a/etherlab/ConfigEditor.py Mon Mar 19 00:45:19 2012 +0100
+++ b/etherlab/ConfigEditor.py Wed Mar 21 11:15:47 2012 +0100
@@ -161,7 +161,7 @@
self.VariablesGrid.AddColumn(colname, colsize, colalign)
self.VariablesGrid.SetMainColumn(1)
- img = wx.Bitmap(self.Controler.GetIconPath("Cfile.png"), wx.BITMAP_TYPE_PNG).ConvertToImage()
+ img = wx.Bitmap(self.Controler.GetIconPath("Slave.png"), wx.BITMAP_TYPE_PNG).ConvertToImage()
self.SetIcon(wx.BitmapFromImage(img.Rescale(16, 16)))
def __del__(self):
@@ -259,4 +259,10 @@
event.Skip()
-DS402NodeEditor = NodeEditor
+class CIA402NodeEditor(NodeEditor):
+
+ def __init__(self, parent, controler, window):
+ NodeEditor.__init__(self, parent, controler, window)
+
+ img = wx.Bitmap(self.Controler.GetIconPath("CIA402Slave.png"), wx.BITMAP_TYPE_PNG).ConvertToImage()
+ self.SetIcon(wx.BitmapFromImage(img.Rescale(16, 16)))
diff -r 563ccc918ded -r 27d4cb689a79 etherlab/etherlab.py
--- a/etherlab/etherlab.py Mon Mar 19 00:45:19 2012 +0100
+++ b/etherlab/etherlab.py Wed Mar 21 11:15:47 2012 +0100
@@ -7,7 +7,7 @@
from xmlclass import *
from plugger import PlugTemplate
from PLCControler import UndoBuffer, LOCATION_PLUGIN, LOCATION_MODULE, LOCATION_GROUP, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY
-from ConfigEditor import NodeEditor, DS402NodeEditor, ETHERCAT_VENDOR, ETHERCAT_GROUP, ETHERCAT_DEVICE
+from ConfigEditor import NodeEditor, CIA402NodeEditor, ETHERCAT_VENDOR, ETHERCAT_GROUP, ETHERCAT_DEVICE
try:
from plugins.motion import Headers, AxisXSD
@@ -15,6 +15,7 @@
except:
HAS_MCL = False
+PLUGINFOLDER = os.path.split(os.path.realpath(__file__))[0]
TYPECONVERSION = {"BOOL" : "X", "SINT" : "B", "INT" : "W", "DINT" : "D", "LINT" : "L",
"USINT" : "B", "UINT" : "W", "UDINT" : "D", "ULINT" : "L",
@@ -65,6 +66,9 @@
NODE_PROFILE = None
EditorType = NodeEditor
+ def GetIconPath(self, icon):
+ return os.path.join(PLUGINFOLDER, "images", icon)
+
def ExtractHexDecValue(self, value):
return ExtractHexDecValue(value)
@@ -132,9 +136,9 @@
}
PluginMethods = [
- {"bitmap" : os.path.join("images", "EditCfile"),
- "name" : _("Edit Node"),
- "tooltip" : _("Edit Node"),
+ {"bitmap" : os.path.join(PLUGINFOLDER, "images", "editSlave"),
+ "name" : _("Edit Slave"),
+ "tooltip" : _("Edit Slave"),
"method" : "_OpenView"},
]
@@ -154,7 +158,7 @@
return [],"",False
#--------------------------------------------------
-# Ethercat DS402 Node
+# Ethercat CIA402 Node
#--------------------------------------------------
if HAS_MCL:
@@ -168,10 +172,10 @@
("ErrorCode", 0x603f, 0x00, "UINT", "I"),
]
- class _EthercatDS402SlavePlug(_EthercatSlavePlug):
+ class _EthercatCIA402SlavePlug(_EthercatSlavePlug):
XSD = """
-
+
%s
@@ -180,7 +184,14 @@
""" % AxisXSD
NODE_PROFILE = 402
- EditorType = DS402NodeEditor
+ EditorType = CIA402NodeEditor
+
+ PluginMethods = [
+ {"bitmap" : os.path.join(PLUGINFOLDER, "images", "editCIA402Slave"),
+ "name" : _("Edit CIA402 Slave"),
+ "tooltip" : _("Edit CIA402 Slave"),
+ "method" : "_OpenView"},
+ ]
def PlugGenerate_C(self, buildpath, locations):
"""
@@ -224,7 +235,7 @@
str_completion["entry_variables"].append(
" IEC_%(var_type)s *%(name)s;" % var_infos)
str_completion["init_entry_variables"].append(
- " __DS402Node_%(location)s.%(name)s = %(var_name)s;" % var_infos)
+ " __CIA402Node_%(location)s.%(name)s = %(var_name)s;" % var_infos)
self.PlugParent.FileGenerator.DeclareVariable(
self.GetSlavePos(), var_infos["index"], var_infos["subindex"],
@@ -242,7 +253,7 @@
else:
param_infos["param_value"] = str(param["value"])
str_completion["init_axis_params"].append(
- " __DS402Node_%(location)s.axis->%(param_name)s = %(param_value)s;" % param_infos)
+ " __CIA402Node_%(location)s.axis->%(param_name)s = %(param_value)s;" % param_infos)
for element in ["extern_located_variables_declaration",
"entry_variables",
@@ -250,12 +261,12 @@
"init_entry_variables"]:
str_completion[element] = "\n".join(str_completion[element])
- Gen_DS402Nodefile_path = os.path.join(buildpath, "ds402node_%s.c"%location_str)
- ds402nodefile = open(Gen_DS402Nodefile_path, 'w')
+ Gen_CIA402Nodefile_path = os.path.join(buildpath, "ds402node_%s.c"%location_str)
+ ds402nodefile = open(Gen_CIA402Nodefile_path, 'w')
ds402nodefile.write(plc_ds402node_code % str_completion)
ds402nodefile.close()
- return [(Gen_DS402Nodefile_path, '"-I%s"'%os.path.abspath(self.GetPlugRoot().GetIECLibPath()))],"",True
+ return [(Gen_CIA402Nodefile_path, '"-I%s"'%os.path.abspath(self.GetPlugRoot().GetIECLibPath()))],"",True
#--------------------------------------------------
# Ethercat MASTER
@@ -314,7 +325,7 @@
PlugChildsTypes = [("EthercatSlave", _EthercatSlavePlug, "Ethercat Slave")]
if HAS_MCL:
- PlugChildsTypes.append(("EthercatDS402Slave", _EthercatDS402SlavePlug, "Ethercat DS402 Slave"))
+ PlugChildsTypes.append(("EthercatCIA402Slave", _EthercatCIA402SlavePlug, "Ethercat CIA402 Slave"))
def __init__(self):
filepath = self.ConfigFileName()
@@ -386,8 +397,8 @@
}
device = self.GetModuleInfos(type_infos)
if device is not None:
- if HAS_MCL and _EthercatDS402SlavePlug.NODE_PROFILE in device.GetProfileNumbers():
- PlugType = "EthercatDS402Slave"
+ if HAS_MCL and _EthercatCIA402SlavePlug.NODE_PROFILE in device.GetProfileNumbers():
+ PlugType = "EthercatCIA402Slave"
else:
PlugType = "EthercatSlave"
self.PlugAddChild("slave%s" % slave["idx"], PlugType, slave["idx"])
@@ -577,7 +588,7 @@
return LocationCFilesAndCFLAGS, LDFLAGS, extra_files
PluginMethods = [
- {"bitmap" : os.path.join("images", "Compiler"),
+ {"bitmap" : os.path.join(PLUGINFOLDER, "images", "ScanNetwork"),
"name" : _("Scan Network"),
"tooltip" : _("Scan Network"),
"method" : "_ScanNetwork"},
@@ -1316,7 +1327,7 @@
dialog.Destroy()
PluginMethods = [
- {"bitmap" : os.path.join("images", "ImportDEF"),
+ {"bitmap" : os.path.join(PLUGINFOLDER, "images", "ImportESI"),
"name" : _("Import module library"),
"tooltip" : _("Import module library"),
"method" : "_ImportModuleLibrary"},
diff -r 563ccc918ded -r 27d4cb689a79 etherlab/images/ImportESI.png
Binary file etherlab/images/ImportESI.png has changed
diff -r 563ccc918ded -r 27d4cb689a79 etherlab/images/ScanNetwork.png
Binary file etherlab/images/ScanNetwork.png has changed
diff -r 563ccc918ded -r 27d4cb689a79 etherlab/images/editCIA402Slave.png
Binary file etherlab/images/editCIA402Slave.png has changed
diff -r 563ccc918ded -r 27d4cb689a79 etherlab/images/editSlave.png
Binary file etherlab/images/editSlave.png has changed
diff -r 563ccc918ded -r 27d4cb689a79 etherlab/images/genicons.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/etherlab/images/genicons.sh Wed Mar 21 11:15:47 2012 +0100
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+INKSCAPE=inkscape
+
+for i in `cat icons.svg |grep -o -e '%%[^%]*%%'|sed 's/%//g'`
+do
+ if [ $i.png -nt icons.svg ]; then
+ echo "Skip $i"
+ else
+ rm -f $i.png
+ echo "$INKSCAPE" icons.svg -z -e $i.png -i $i
+ "$INKSCAPE" icons.svg -z -e $i.png -i $i
+ fi
+done
+
diff -r 563ccc918ded -r 27d4cb689a79 etherlab/images/icons.svg
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/etherlab/images/icons.svg Wed Mar 21 11:15:47 2012 +0100
@@ -0,0 +1,61001 @@
+
+
+
+
diff -r 563ccc918ded -r 27d4cb689a79 etherlab/plc_cia402node.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/etherlab/plc_cia402node.c Wed Mar 21 11:15:47 2012 +0100
@@ -0,0 +1,146 @@
+/*
+ * Ethercat CIA402 node execution code
+ *
+ * */
+
+#include "ecrt.h"
+
+#ifdef _WINDOWS_H
+ #include "iec_types.h"
+#else
+ #include "iec_std_lib.h"
+#endif
+
+IEC_INT beremiz__IW%(location)s_0;
+IEC_INT *__IW%(location)s_0 = &beremiz__IW%(location)s_0;
+
+%(MCL_headers)s
+
+IEC_UINT __InactiveMask = 0x4f;
+IEC_UINT __ActiveMask = 0x6f;
+IEC_UINT __PowerMask = 0x10;
+IEC_BOOL __FirstTick = 1;
+
+typedef enum {
+ __Unknown,
+ __NotReadyToSwitchOn,
+ __SwitchOnDisabled,
+ __ReadyToSwitchOn,
+ __SwitchedOn,
+ __OperationEnabled,
+ __QuickStopActive,
+ __FaultReactionActive,
+ __Fault,
+} __CIA402NodeState;
+
+typedef struct {
+%(entry_variables)s
+ __CIA402NodeState state;
+ axis_s* axis;
+} __CIA402Node;
+
+static __CIA402Node __CIA402Node_%(location)s;
+
+%(extern_located_variables_declaration)s
+
+int __init_%(location)s()
+{
+%(init_entry_variables)s
+ *__IW%(location)s_0 = __MK_AllocAxis(&(__CIA402Node_%(location)s.axis));
+ return 0;
+}
+
+void __cleanup_%(location)s()
+{
+}
+
+void __retrieve_%(location)s()
+{
+ IEC_UINT statusword_inactive = *(__CIA402Node_%(location)s.StatusWord) & __InactiveMask;
+ IEC_UINT statusword_active = *(__CIA402Node_%(location)s.StatusWord) & __ActiveMask;
+
+ if (__FirstTick) {
+%(init_axis_params)s
+ _FirstTick = 0;
+ }
+
+ // CIA402 node state computation
+ __CIA402Node_%(location)s.state = __Unknown;
+ switch (statusword_inactive) {
+ case 0x00:
+ __CIA402Node_%(location)s.state = __NotReadyToSwitchOn;
+ break;
+ case 0x40:
+ __CIA402Node_%(location)s.state = __SwitchOnDisabled;
+ break;
+ case 0x0f:
+ __CIA402Node_%(location)s.state = __FaultReactionActive;
+ break;
+ case 0x08:
+ __CIA402Node_%(location)s.state = __Fault;
+ break;
+ default:
+ break;
+ }
+ switch (statusword_active) {
+ case 0x21:
+ __CIA402Node_%(location)s.state = __ReadyToSwitchOn;
+ break;
+ case 0x23:
+ __CIA402Node_%(location)s.state = __SwitchedOn;
+ break;
+ case 0x27:
+ __CIA402Node_%(location)s.state = __OperationEnabled;
+ break;
+ case 0x07:
+ __CIA402Node_%(location)s.state = __QuickStopActive;
+ break;
+ default:
+ break;
+ }
+ if (__CIA402Node_%(location)s.state == __Unknown) {
+ return;
+ }
+
+ __CIA402Node_%(location)s.axis->PowerFeedback = __CIA402Node_%(location)s.state == __OperationEnabled;
+ __CIA402Node_%(location)s.axis->ActualPosition = (IEC_REAL)(*(__CIA402Node_%(location)s.ActualPosition)) * __CIA402Node_%(location)s.axis->RatioDenominator / __CIA402Node_%(location)s.axis->RatioNumerator;
+
+ __MK_UpdateAxis(*__IW%(location)s_0);
+}
+
+void __publish_%(location)s()
+{
+ __MK_ComputeAxis(*__IW%(location)s_0);
+
+ IEC_BOOL power = ((*(__CIA402Node_%(location)s.StatusWord) & __PowerMask) > 0) && __CIA402Node_%(location)s.axis->Power;
+
+ // CIA402 node state transition computation
+ switch (__CIA402Node_%(location)s.state) {
+ case __SwitchOnDisabled:
+ *(__CIA402Node_%(location)s.ControlWord) = (*(__CIA402Node_%(location)s.ControlWord) & ~0x87) | 0x06;
+ break;
+ case __ReadyToSwitchOn:
+ case __OperationEnabled:
+ if (!power) {
+ *(__CIA402Node_%(location)s.ControlWord) = (*(__CIA402Node_%(location)s.ControlWord) & ~0x8f) | 0x07;
+ break;
+ }
+ case __SwitchedOn:
+ if (power) {
+ *(__CIA402Node_%(location)s.ControlWord) = (*(__CIA402Node_%(location)s.ControlWord) & ~0x8f) | 0x0f;
+ }
+ break;
+ case __Fault:
+ *(__CIA402Node_%(location)s.ControlWord) = (*(__CIA402Node_%(location)s.ControlWord) & ~0x8f) | 0x80;
+ break;
+ default:
+ break;
+ }
+
+ if (__CIA402Node_%(location)s.axis->CSP && *(__CIA402Node_%(location)s.ModesOfOperationDisplay) == 0x08) {
+ *(__CIA402Node_%(location)s.TargetPosition) = (IEC_DINT)(__CIA402Node_%(location)s.axis->PositionSetPoint * __CIA402Node_%(location)s.axis->RatioNumerator / __CIA402Node_%(location)s.axis->RatioDenominator);
+ }
+ else {
+ *(__CIA402Node_%(location)s.TargetPosition) = *(__CIA402Node_%(location)s.ActualPosition);
+ }
+}
diff -r 563ccc918ded -r 27d4cb689a79 etherlab/plc_ds402node.c
--- a/etherlab/plc_ds402node.c Mon Mar 19 00:45:19 2012 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-/*
- * Ethercat DS402 node execution code
- *
- * */
-
-#include "ecrt.h"
-
-#ifdef _WINDOWS_H
- #include "iec_types.h"
-#else
- #include "iec_std_lib.h"
-#endif
-
-IEC_INT beremiz__IW%(location)s_0;
-IEC_INT *__IW%(location)s_0 = &beremiz__IW%(location)s_0;
-
-%(MCL_headers)s
-
-IEC_UINT __InactiveMask = 0x4f;
-IEC_UINT __ActiveMask = 0x6f;
-IEC_UINT __PowerMask = 0x10;
-IEC_BOOL __FirstTick = 1;
-
-typedef enum {
- __Unknown,
- __NotReadyToSwitchOn,
- __SwitchOnDisabled,
- __ReadyToSwitchOn,
- __SwitchedOn,
- __OperationEnabled,
- __QuickStopActive,
- __FaultReactionActive,
- __Fault,
-} __DS402NodeState;
-
-typedef struct {
-%(entry_variables)s
- __DS402NodeState state;
- axis_s* axis;
-} __DS402Node;
-
-static __DS402Node __DS402Node_%(location)s;
-
-%(extern_located_variables_declaration)s
-
-int __init_%(location)s()
-{
-%(init_entry_variables)s
- *__IW%(location)s_0 = __MK_AllocAxis(&(__DS402Node_%(location)s.axis));
- return 0;
-}
-
-void __cleanup_%(location)s()
-{
-}
-
-void __retrieve_%(location)s()
-{
- IEC_UINT statusword_inactive = *(__DS402Node_%(location)s.StatusWord) & __InactiveMask;
- IEC_UINT statusword_active = *(__DS402Node_%(location)s.StatusWord) & __ActiveMask;
-
- if (__FirstTick) {
-%(init_axis_params)s
- _FirstTick = 0;
- }
-
- // DS402 node state computation
- __DS402Node_%(location)s.state = __Unknown;
- switch (statusword_inactive) {
- case 0x00:
- __DS402Node_%(location)s.state = __NotReadyToSwitchOn;
- break;
- case 0x40:
- __DS402Node_%(location)s.state = __SwitchOnDisabled;
- break;
- case 0x0f:
- __DS402Node_%(location)s.state = __FaultReactionActive;
- break;
- case 0x08:
- __DS402Node_%(location)s.state = __Fault;
- break;
- default:
- break;
- }
- switch (statusword_active) {
- case 0x21:
- __DS402Node_%(location)s.state = __ReadyToSwitchOn;
- break;
- case 0x23:
- __DS402Node_%(location)s.state = __SwitchedOn;
- break;
- case 0x27:
- __DS402Node_%(location)s.state = __OperationEnabled;
- break;
- case 0x07:
- __DS402Node_%(location)s.state = __QuickStopActive;
- break;
- default:
- break;
- }
- if (__DS402Node_%(location)s.state == __Unknown) {
- return;
- }
-
- __DS402Node_%(location)s.axis->PowerFeedback = __DS402Node_%(location)s.state == __OperationEnabled;
- __DS402Node_%(location)s.axis->ActualPosition = (IEC_REAL)(*(__DS402Node_%(location)s.ActualPosition)) * __DS402Node_%(location)s.axis->RatioDenominator / __DS402Node_%(location)s.axis->RatioNumerator;
-
- __MK_UpdateAxis(*__IW%(location)s_0);
-}
-
-void __publish_%(location)s()
-{
- __MK_ComputeAxis(*__IW%(location)s_0);
-
- IEC_BOOL power = ((*(__DS402Node_%(location)s.StatusWord) & __PowerMask) > 0) && __DS402Node_%(location)s.axis->Power;
-
- // DS402 node state transition computation
- switch (__DS402Node_%(location)s.state) {
- case __SwitchOnDisabled:
- *(__DS402Node_%(location)s.ControlWord) = (*(__DS402Node_%(location)s.ControlWord) & ~0x87) | 0x06;
- break;
- case __ReadyToSwitchOn:
- case __OperationEnabled:
- if (!power) {
- *(__DS402Node_%(location)s.ControlWord) = (*(__DS402Node_%(location)s.ControlWord) & ~0x8f) | 0x07;
- break;
- }
- case __SwitchedOn:
- if (power) {
- *(__DS402Node_%(location)s.ControlWord) = (*(__DS402Node_%(location)s.ControlWord) & ~0x8f) | 0x0f;
- }
- break;
- case __Fault:
- *(__DS402Node_%(location)s.ControlWord) = (*(__DS402Node_%(location)s.ControlWord) & ~0x8f) | 0x80;
- break;
- default:
- break;
- }
-
- if (__DS402Node_%(location)s.axis->CSP && *(__DS402Node_%(location)s.ModesOfOperationDisplay) == 0x08) {
- *(__DS402Node_%(location)s.TargetPosition) = (IEC_DINT)(__DS402Node_%(location)s.axis->PositionSetPoint * __DS402Node_%(location)s.axis->RatioNumerator / __DS402Node_%(location)s.axis->RatioDenominator);
- }
- else {
- *(__DS402Node_%(location)s.TargetPosition) = *(__DS402Node_%(location)s.ActualPosition);
- }
-}