gicking/LIN_slave_portable_Arduino

Slave frame timeout errors

Opened this issue · 1 comments

Hello Georg,
Today I integrated both a server (HW-Serial) and a slave (HW-Serial) on an ESP32 using the current software version. There were slave frame timeout errors. The error is generated in the file "LIN_slave_Base.cpp". However, there is a "confusion" between "micros()" and "millis()".
Line 256: if ((this->state != LIN_Slave_Base::WAIT_FOR_BREAK) && ((micros() - this->timeLastRx) > LIN_SLAVE_RX_TIMEOUT))
If you replace micros() with millis(), the slave works. This is also how it is stated in earlier versions of "LIN_slave_Base.cpp".
Ciao
Mario

Hi Mario,
I re-wrote major parts of the library for better maintenance. Can you please check again?
Regarding your above comment: I sticked with micros(), but I realized that 1B @ 19.2kBaud is already ~500µs. So the limit was set far too low. Amongst other changes, the timeout and inter-frame time limits can now be passed as arguments (see library reference linked on front page)