Skip to content

Handle INIT messages and add set_init_handler() callback #20

@brocci

Description

@brocci

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:

  1. Route INIT packets through the data decoder so the payload is properly consumed (with DLE un-escaping) instead of discarded
  2. Return the actual packet type (INIT vs SET) from _decode() so the caller can distinguish them
  3. Provide an optional callback via set_init_handler() so sketches can inspect NDP, delay, and option bytes without manual polling
  4. Include an example showing how to use the callback

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions