--- a/objdictgen/node.py Mon Apr 30 16:56:21 2007 +0200
+++ b/objdictgen/node.py Fri May 04 12:22:48 2007 +0200
@@ -145,7 +145,7 @@
0x1016 : {"name" : "Consumer Heartbeat Time", "struct" : rec, "need" : False, "values" :
[{"name" : "Number of Entries", "type" : 0x02, "access" : 'ro', "pdo" : False},
{"name" : "Consumer Heartbeat Time", "type" : 0x04, "access" : 'rw', "pdo" : False, "nbmax" : 0x7F}]},
- 0x1017 : {"name" : "Producer Heartbeat Time", "struct" : var, "need" : False, "values" :
+ 0x1017 : {"name" : "Producer Heartbeat Time", "struct" : var, "need" : False, "callback" : True, "values" :
[{"name" : "Producer Heartbeat Time", "type" : 0x03, "access" : 'rw', "pdo" : False}]},
0x1018 : {"name" : "Identity", "struct" : array, "need" : True, "values" :
[{"name" : "Number of Entries", "type" : 0x02, "access" : 'ro', "pdo" : False},
--- a/src/lifegrd.c Mon Apr 30 16:56:21 2007 +0200
+++ b/src/lifegrd.c Fri May 04 12:22:48 2007 +0200
@@ -27,6 +27,7 @@
/* Prototypes for internals functions */
void ConsumerHearbeatAlarm(CO_Data* d, UNS32 id);
void ProducerHearbeatAlarm(CO_Data* d, UNS32 id);
+UNS32 OnHearbeatUpdate(CO_Data* d, const indextable * unsused_indextable, UNS8 unsused_bSubindex);
/*****************************************************************************/
@@ -120,6 +121,7 @@
* (decimal) and additionaly
* the node-id of this device.
*/
+
msg.cob_id.w = *d->bDeviceNodeId + 0x700;
msg.len = (UNS8)0x01;
msg.rtr = 0;
@@ -127,18 +129,30 @@
/* send the heartbeat */
MSG_WAR(0x3130, "Producing heartbeat: ", d->nodeState);
canSend(d->canHandle,&msg );
+
}else{
d->ProducerHeartBeatTimer = DelAlarm(d->ProducerHeartBeatTimer);
}
}
/*****************************************************************************/
+/* This is called when Index 0x1017 is updated.*/
+UNS32 OnHeartbeatProducerUpdate(CO_Data* d)
+{
+ heartbeatStop(d);
+ heartbeatInit(d);
+ return 0;
+}
+/*****************************************************************************/
+
void heartbeatInit(CO_Data* d)
{
+
UNS8 index; /* Index to scan the table of heartbeat consumers */
-
+ RegisterSetODentryCallBack(d, 0x1017,0x00, &OnHeartbeatProducerUpdate);
+
d->toggle = 0;
-
+
for( index = (UNS8)0x00; index < *d->ConsumerHeartbeatCount; index++ )
{
TIMEVAL time = (UNS16) ( (d->ConsumerHeartbeatEntries[index]) & (UNS32)0x0000FFFF ) ;