src/lifegrd.c
changeset 370 6fecf36df407
parent 365 9b76e0881beb
child 378 d2abf6c8c27b
equal deleted inserted replaced
369:8b67289d50b5 370:6fecf36df407
    34 
    34 
    35 #include <data.h>
    35 #include <data.h>
    36 #include "lifegrd.h"
    36 #include "lifegrd.h"
    37 #include "canfestival.h"
    37 #include "canfestival.h"
    38 #include "dcf.h"
    38 #include "dcf.h"
       
    39 #include "sysdep.h"
    39 
    40 
    40 
    41 
    41 void ConsumerHearbeatAlarm(CO_Data* d, UNS32 id);
    42 void ConsumerHearbeatAlarm(CO_Data* d, UNS32 id);
    42 
    43 
    43 
    44 
    99       ** not checked (not implemented)
   100       ** not checked (not implemented)
   100       */
   101       */
   101       if (nodeId == *d->bDeviceNodeId )
   102       if (nodeId == *d->bDeviceNodeId )
   102         {
   103         {
   103           Message msg;
   104           Message msg;
   104           msg.cob_id = *d->bDeviceNodeId + 0x700;
   105           UNS16 tmp = *d->bDeviceNodeId + 0x700;
       
   106           msg.cob_id = UNS16_LE(tmp);
   105           msg.len = (UNS8)0x01;
   107           msg.len = (UNS8)0x01;
   106           msg.rtr = 0;
   108           msg.rtr = 0;
   107           msg.data[0] = d->nodeState;
   109           msg.data[0] = d->nodeState;
   108           if (d->toggle)
   110           if (d->toggle)
   109             {
   111             {
   175       /* Time expired, the heartbeat must be sent immediately
   177       /* Time expired, the heartbeat must be sent immediately
   176       ** generate the correct node-id: this is done by the offset 1792
   178       ** generate the correct node-id: this is done by the offset 1792
   177       ** (decimal) and additionaly
   179       ** (decimal) and additionaly
   178       ** the node-id of this device.
   180       ** the node-id of this device.
   179       */
   181       */
   180 
   182       UNS16 tmp = *d->bDeviceNodeId + 0x700;
   181       msg.cob_id = *d->bDeviceNodeId + 0x700;
   183       msg.cob_id = UNS16_LE(tmp);
   182       msg.len = (UNS8)0x01;
   184       msg.len = (UNS8)0x01;
   183       msg.rtr = 0;
   185       msg.rtr = 0;
   184       msg.data[0] = d->nodeState; /* No toggle for heartbeat !*/
   186       msg.data[0] = d->nodeState; /* No toggle for heartbeat !*/
   185       /* send the heartbeat */
   187       /* send the heartbeat */
   186       MSG_WAR(0x3130, "Producing heartbeat: ", d->nodeState);
   188       MSG_WAR(0x3130, "Producing heartbeat: ", d->nodeState);