claytong wrote on Friday, April 21, 2006:
I have used the Tick Hook as a means to drive a multiplexed LED display. However I soon found that it was not calling my Mux routine consistantly - it was often double or even triple calling it.
I have tracked this down to the MissedTicks processing in xTaskResumeAll (tasks.c) - this is also resulting in an vApplicationTickHook call (via vTaskIncrementTick ). So vApplicationTickHook gets called with each tick ISR (regardless of a proper tick handling or a tick miss), and then again when tick misses are handled.
The fix I have put into place is to remove the vApplicationTickHook from vTaskIncrementTick (task.c) and instead put it into the vPortYieldFromTick call (port.c) - this does however mean that all portable code needs this change - I have just changed my GCC-AVR port which this project uses.
I’m sure a better solution that does not involve portable code can be implemented in the next release - assuming of course that you agreee that the current behaviour is not correct
On further thinking maybe the current behaviour is valid if the hook is doing something based on the tick count. Maybe two hooks are needed - a ‘TickInterrupt’ hook and a ‘TickIncrement’ hook??