Merged Markus Wildbolz' node-guarding and fixes
authorEdouard Tisserant
Tue, 02 Oct 2012 21:45:24 +0200
changeset 754 4715f4ed8e0c
parent 748 18ed0f3b030a (diff)
parent 753 072787c24bec (current diff)
child 755 66ceb88411ab
Merged Markus Wildbolz' node-guarding and fixes
examples/CANOpenShell/CANOpenShellMasterOD.c
examples/CANOpenShell/CANOpenShellMasterOD.h
examples/CANOpenShell/CANOpenShellSlaveOD.c
examples/CANOpenShell/CANOpenShellSlaveOD.h
examples/DS401_Master/TestMaster.c
examples/DS401_Slave_Gui/ObjDict.c
examples/TestMasterMicroMod/TestMaster.c
examples/TestMasterSlave/TestMaster.c
examples/TestMasterSlave/TestSlave.c
--- a/objdictgen/commondialogs.py	Mon Oct 01 17:19:00 2012 +0200
+++ b/objdictgen/commondialogs.py	Tue Oct 02 21:45:24 2012 +0200
@@ -1228,7 +1228,7 @@
                 message = wx.MessageDialog(self, _("Slave Node ID must be between 0 and 127!"), _("Error"), wx.OK|wx.ICON_ERROR)
                 message.ShowModal()
                 message.Destroy()
-            elif nodeid == 0 or nodeid in self.NodeList.SlaveNodes.keys():
+            elif nodeid == self.NodeList.GetMasterNodeID() or nodeid in self.NodeList.GetSlaveIDs():
                 message = wx.MessageDialog(self, _("A Node with this ID already exist in the network!"), _("Error"), wx.OK|wx.ICON_ERROR)
                 message.ShowModal()
                 message.Destroy()
--- a/objdictgen/networkedit.py	Mon Oct 01 17:19:00 2012 +0200
+++ b/objdictgen/networkedit.py	Tue Oct 02 21:45:24 2012 +0200
@@ -198,15 +198,13 @@
             self.NetworkNodes.DeleteAllPages()
         if self.NodeList:
             new_editingpanel = EditingPanel(self.NetworkNodes, self, self.Manager)
-            new_editingpanel.SetIndex(0)
+            new_editingpanel.SetIndex(self.Manager.GetCurrentNodeID())
             self.NetworkNodes.AddPage(new_editingpanel, "")
             for idx in self.NodeList.GetSlaveIDs():
                 new_editingpanel = EditingPanel(self.NetworkNodes, self, self.NodeList, False)
                 new_editingpanel.SetIndex(idx)
                 self.NetworkNodes.AddPage(new_editingpanel, "")
     
-    
-    
     def OnNodeSelectedChanged(self, event):
         if not self.Closing:
             selected = event.GetSelection()
--- a/objdictgen/nodelist.py	Mon Oct 01 17:19:00 2012 +0200
+++ b/objdictgen/nodelist.py	Tue Oct 02 21:45:24 2012 +0200
@@ -71,6 +71,9 @@
         self.Root = newrootpath
         self.Manager.SetCurrentFilePath(os.path.join(self.Root, "master.od"))
     
+    def GetMasterNodeID(self):
+        return self.Manager.GetCurrentNodeID()
+    
     def GetSlaveNumber(self):
         return len(self.SlaveNodes)
     
--- a/objdictgen/subindextable.py	Mon Oct 01 17:19:00 2012 +0200
+++ b/objdictgen/subindextable.py	Tue Oct 02 21:45:24 2012 +0200
@@ -550,7 +550,7 @@
                         typeinfos = self.Manager.GetEntryInfos(subentry_infos["type"])
                         if typeinfos:
                             bus_id = '.'.join(map(str, self.ParentWindow.GetBusId()))
-                            var_name = "master_%04x_%02x" % (index, subindex)
+                            var_name = "%s_%04x_%02x" % (self.Manager.GetCurrentNodeName(), index, subindex)
                             size = typeinfos["size"]
                             data = wx.TextDataObject(str(
                                 ("%s%s.%d.%d"%(SizeConversion[size], bus_id, index, subindex),