Init (I) messages are not consumed by _decode(), leaving payload bytes in the serial buffer where they can corrupt the next frame.
Sketches also need a way to react to the configuration data (NDP, transmit delay, options) that JMRI sends at startup.
Goals:
- Route INIT packets through the data decoder so the payload is properly consumed (with DLE un-escaping) instead of discarded
- Return the actual packet type (
INIT vs SET) from _decode() so the caller can distinguish them
- Provide an optional callback via
set_init_handler() so sketches can inspect NDP, delay, and option bytes without manual polling
- Include an example showing how to use the callback
Init (
I) messages are not consumed by_decode(), leaving payload bytes in the serial buffer where they can corrupt the next frame.Sketches also need a way to react to the configuration data (NDP, transmit delay, options) that JMRI sends at startup.
Goals:
INITvsSET) from_decode()so the caller can distinguish themset_init_handler()so sketches can inspect NDP, delay, and option bytes without manual polling