Move RPDO related code from CANopen.c into PDO.c, remove additional for loop.
Introduce new optional argument bool_t* timeoutState into CO_RPDO_process().
CO_EM_RPDO_TIME_OUT is a single shared error bit for all RPDO instances.
CO_RPDO_process() called CO_errorReset() for this bit the moment any one
RPDO recovered from timeout, even if other RPDOs were still timed out.
Scenario that exposes the bug:
node-2 and node-3 are RPDO producers with deadline monitoring.
Both go pre-operational -> CO_EM_RPDO_TIME_OUT set -> error register 0x10.
node-2 comes back -> CO_RPDO_process() calls CO_errorReset() ->
CO_EM_RPDO_TIME_OUT cleared -> error register 0x00.
node-3 is still timed out: the error register is now incorrect.
Fix: remove CO_errorReset() from CO_RPDO_process(). Instead, add a
post-loop check in CO_process_RPDO() (CANopen.c) that iterates all RPDO
instances. CO_errorReset() is only called when none of them remains in
timeout (timeoutTimer > timeoutTime_us). CO_process_RPDO() has access
to the full co->RPDO[] array and is therefore the correct place to make
this cross-RPDO decision. CO_errorReset() is a no-op when the error bit
is already clear, so calling it every cycle when no timeout is active is
safe and efficient.
The command string "lss_activate_bitrate" is exactly 20 characters.
CO_fifo_readToken() is called with count=sizeof(tok)=20. When exactly
20 characters are read, tokenSize==count which triggers the overflow
guard: *err=true and the token is discarded. The command therefore
always fails with a syntax error.
The buffer needs at least 21 bytes (20 chars + null terminator) to
successfully parse this command.
Fixes#623.
In MR #585 the initialization of HBcons has been protected from dereferencing stream if it's NULL.
However, the logic is now twisted enough to provoke a maybe-uninitialized warning in GCC 13.
While this is strictly a false positive since the generated code would never dereference HBcons if stream == NULL
this patch refines the code to be easier to read for compilers and humans alike by returning early if stream == NULL.
Using a `break` after a `return` triggers warning 111 of Arm Compiler 5. To fix this warning while respecting MISRA rules, the return mechanism of OD_getSub() function was changed to only exit at the end.