--- a/plugins/canfestival/canfestival.py Wed Jun 25 17:01:07 2008 +0200
+++ b/plugins/canfestival/canfestival.py Wed Jun 25 17:09:24 2008 +0200
@@ -10,6 +10,8 @@
from objdictedit import objdictedit
import canfestival_config
from plugger import PlugTemplate
+from commondialogs import CreateNodeDialog from gnosis.xml.pickle import *
from gnosis.xml.pickle.util import setParanoia
@@ -42,15 +44,33 @@
if(os.path.isfile(odfilepath)):
self.OpenFileInCurrent(odfilepath)
- self.CreateNewNode("SlaveNode", # Name - will be changed at build time
- 0x00, # NodeID - will be changed at build time
+ dialog = CreateNodeDialog(None, wx.OK) + dialog.Type.Enable(False) + dialog.GenSYNC.Enable(False) + if dialog.ShowModal() == wx.ID_OK: + name, id, nodetype, description = dialog.GetValues() + profile, filepath = dialog.GetProfile() + NMT = dialog.GetNMTManagement() + options = dialog.GetOptions() + self.CreateNewNode(name, # Name - will be changed at build time + id, # NodeID - will be changed at build time + description,# description + filepath, # prfile filepath + self.CreateNewNode("SlaveNode", # Name - will be changed at build time + 0x00, # NodeID - will be changed at build time def _OpenView(self, logger):
@@ -160,7 +180,7 @@
logger.write_error("Error: No Master generated\n")
- new_dialog = objdictedit(None, [masterpath])
+ new_dialog = objdictedit(None, filesOpen=[masterpath]) @@ -227,7 +247,8 @@
- PlugChildsTypes = [("CanOpenNode",_NodeListPlug, "CanOpen Master"),("CanOpenSlave",_SlavePlug, "CanOpen Slave")]
+ PlugChildsTypes = [("CanOpenNode",_NodeListPlug, "CanOpen Master"), + ("CanOpenSlave",_SlavePlug, "CanOpen Slave")] def GetParamsAttributes(self, path = None):
infos = PlugTemplate.GetParamsAttributes(self, path = None)
@@ -251,7 +272,8 @@
- "nodes_proceed_sync" : ""}
+ "nodes_proceed_sync" : "", for child in self.IECSortedChilds():
childlocstr = "_".join(map(str,child.GetCurrentLocation()))
nodename = "OD_%s" % childlocstr
@@ -261,10 +283,40 @@
child_data = getattr(child, "CanFestivalNode")
if child_data.getSync_TPDOs():
format_dict["nodes_send_sync"] += 'NODE_SEND_SYNC(%s)\n '%(nodename)
format_dict["nodes_proceed_sync"] += 'NODE_PROCEED_SYNC(%s)\n '%(nodename)
+ # initialize and declare node table for post_SlaveBootup lookup + SlaveIDs = child.GetSlaveIDs() + format_dict["slavebootups"] += """ +int %s_slave_%d_booted = 0; + format_dict["slavebootups"] += """ +static void %s_post_SlaveBootup(CO_Data* d, UNS8 nodeId){ + format_dict["slavebootups"] += """ + %s_slave_%d_booted = 1; + format_dict["slavebootups"] += """ + format_dict["slavebootups"] += " && ".join(["%s_slave_%d_booted"%(nodename, id) for id in SlaveIDs]) + format_dict["slavebootups"] += """ ) + Master_post_SlaveBootup(d,nodeId); +%s_Data.post_SlaveBootup = %s_post_SlaveBootup; format_dict["nodes_includes"] += '#include "%s.h"\n'%(nodename)
format_dict["board_decls"] += 'BOARD_DECL(%s, "%s", "%s")\n'%(
--- a/plugins/canfestival/cf_runtime.c Wed Jun 25 17:01:07 2008 +0200
+++ b/plugins/canfestival/cf_runtime.c Wed Jun 25 17:09:24 2008 +0200
@@ -11,7 +11,6 @@
extern int common_ticktime__;
static void Master_post_SlaveBootup(CO_Data* d, UNS8 nodeId)
/* Put the master in operational mode */
@@ -21,6 +20,8 @@
masterSendNMTstateChange (d, 0, NMT_Start_Node);
#define NODE_INIT(nodename, nodeid) \
/* Artificially force sync state to 1 so that it is not started */\
nodename##_Data.CurrentCommunicationState.csSYNC = -1;\
@@ -65,7 +66,6 @@
#define NODE_OPEN(nodename)\
- nodename##_Data.post_SlaveBootup = Master_post_SlaveBootup;\
if(!canOpen(&nodename##Board,&nodename##_Data)){\
printf("Cannot open " #nodename " Board (%%s,%%s)\n",nodename##Board.busname, nodename##Board.baudrate);\