Skip to content

Conversation

@JensOgorek
Copy link
Contributor

@JensOgorek JensOgorek commented Nov 21, 2025

This PR adds a SerialBus module so multiple ESP32-based Lizard nodes can share one UART link with a single coordinator that orchestrates traffic round-robin style.

Commands:

  • bus.send(receiver, payload) – enqueue a point-to-point frame (payload must fit in 256 bytes, no newlines).
  • bus.configure(receiver, script) – wraps the script in !- / !+line / !. framing and finishes with core.restart() so the peer boots with the new config.
  • bus.set_coordinator(peer_ids...) – marks this node as coordinator and loads the peer poll order.

Properties:

  • bus.is_coordinator – true when this node currently manages the bus.
  • bus.peer_count – number of peers in the coordinator’s poll list.
  • bus.last_message_age – milliseconds since the last frame was received (helps spot link stalls).

How it works:
Each instance runs a background FreeRTOS task that reads $$sender:receiver$$payload frames from UART, parses control words (__POLL__, __DONE__, __BUS_RESPONSE__), and either executes remote commands or enqueues outbound traffic. Coordinators open transmit windows for their peers in turn and enforce timeouts; non-coordinators only transmit while polled, then reply with __DONE__ once their queue is flushed.

@JensOgorek JensOgorek changed the title Add Serial Bus Module to handle multiple ESPs Serial Bus: Add Serial Bus Module to handle multiple ESPs Nov 21, 2025
@JensOgorek JensOgorek changed the title Serial Bus: Add Serial Bus Module to handle multiple ESPs Serial Bus #1: Add Serial Bus Module to handle multiple ESPs Nov 21, 2025
@JensOgorek JensOgorek marked this pull request as ready for review November 28, 2025 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants