Fixed some transmit type issues (for 254 255) with null event and/or inhibit time
authoretisserant
Mon, 01 Oct 2007 17:17:35 +0200
changeset 297 639e5ec5a120
parent 296 03f2b8b8cb0b
child 298 dba062c5c3c1
Fixed some transmit type issues (for 254 255) with null event and/or inhibit time
src/pdo.c
--- a/src/pdo.c	Mon Oct 01 14:43:01 2007 +0200
+++ b/src/pdo.c	Mon Oct 01 17:17:35 2007 +0200
@@ -527,17 +527,24 @@
 	}else{
 		MSG_WAR(0x306A, "Changes TPDO number : ", pdoNum);
 		/* Changes detected -> transmit message */
+        UNS16 EventTimerDuration = *(UNS16*)d->objdict[offsetObjdict].pSubindex[5].pObject;
+        UNS16 InhibitTimerDuration = *(UNS16*)d->objdict[offsetObjdict].pSubindex[3].pObject;
+        
 		status = state5;
 		
 		/* Start both event_timer and inhibit_timer*/
-		DelAlarm(d->PDO_status[pdoNum].event_timer);
-		d->PDO_status[pdoNum].event_timer = SetAlarm(d, pdoNum, &PDOEventTimerAlarm, MS_TO_TIMEVAL(*(UNS16*)d->objdict[offsetObjdict].pSubindex[5].pObject), 0);
+        if(EventTimerDuration){
+           DelAlarm(d->PDO_status[pdoNum].event_timer);
+           d->PDO_status[pdoNum].event_timer = SetAlarm(d, pdoNum, &PDOEventTimerAlarm, MS_TO_TIMEVAL(EventTimerDuration), 0);
+        }
 		
-		DelAlarm(d->PDO_status[pdoNum].inhibit_timer);
-		d->PDO_status[pdoNum].inhibit_timer = SetAlarm(d, pdoNum, &PDOInhibitTimerAlarm, US_TO_TIMEVAL(*(UNS16*)d->objdict[offsetObjdict].pSubindex[3].pObject * 100), 0);
+        if(InhibitTimerDuration){
+		   DelAlarm(d->PDO_status[pdoNum].inhibit_timer);
+		   d->PDO_status[pdoNum].inhibit_timer = SetAlarm(d, pdoNum, &PDOInhibitTimerAlarm, US_TO_TIMEVAL(InhibitTimerDuration * 100), 0);
+           /* and inhibit TPDO */
+           d->PDO_status[pdoNum].transmit_type_parameter |= PDO_INHIBITED;
+        }
 		
-		/* and inhibit TPDO */
-		d->PDO_status[pdoNum].transmit_type_parameter |= PDO_INHIBITED;
 	}
       }else{
 	MSG_WAR(0x306C, "  PDO is not on EVENT or synchro or not at this SYNC. Trans type : ", *pTransmissionType);