Continue testing timers module. Still a work in progress.
diff --git a/Source/timers.c b/Source/timers.c
index 8593c72..ed710bd 100644
--- a/Source/timers.c
+++ b/Source/timers.c
@@ -243,8 +243,7 @@
xReturn = xQueueSendToBackFromISR( xTimerQueue, &xMessage, pxHigherPriorityTaskWoken );
}
}
-
- configASSERT( xReturn );
+
return xReturn;
}
/*-----------------------------------------------------------*/
@@ -268,7 +267,16 @@
the time this task thinks it is now, even if a command to
switch lists due to a tick count overflow is already waiting in
the timer queue. */
- prvInsertTimerInActiveList( pxTimer, ( xNextExpireTime + pxTimer->xTimerPeriodInTicks ), xTimeNow, xNextExpireTime );
+ if( prvInsertTimerInActiveList( pxTimer, ( xNextExpireTime + pxTimer->xTimerPeriodInTicks ), xTimeNow, xNextExpireTime ) == pdTRUE )
+ {
+ /* The timer expired before it was added to the active timer
+ list. Reload it now. The callback will get executed before
+ this function exits. */
+ if( pxTimer->uxAutoReload == pdTRUE )
+ {
+ xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xNextExpireTime, NULL, tmrNO_DELAY ); /* Should it be xNextExpireTime or ( xNextExpireTime + pxTimer->xTimerPeriodInTicks )? I think the former. */
+ }
+ }
}
/* Call the timer callback. */
@@ -403,7 +411,7 @@
{
/* Has the expiry time elapsed between the command to start/reset a
timer was issued, and the time the command was processed? */
- if( ( xTimeNow - xCommandTime ) >= pxTimer->xTimerPeriodInTicks )
+ if( ( ( portTickType ) ( xTimeNow - xCommandTime ) ) >= pxTimer->xTimerPeriodInTicks )
{
/* The time between a command being issued and the command being
processed actually exceeds the timers period. */
@@ -468,7 +476,6 @@
{
/* The timer expired before it was added to the active timer
list. Process it now. */
- /* Call the timer callback. */
pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer );
if( pxTimer->uxAutoReload == pdTRUE )