Skip to content

Add cmd_delay to serial connections for slow hosts#41

Open
hickey wants to merge 2 commits into
Cisien:mainfrom
hickey:serial-timeout
Open

Add cmd_delay to serial connections for slow hosts#41
hickey wants to merge 2 commits into
Cisien:mainfrom
hickey:serial-timeout

Conversation

@hickey

@hickey hickey commented Apr 7, 2026

Copy link
Copy Markdown

On older hosts, like Raspberry Pi model B, the default delay of 0.5 seconds sometimes would expire before the serial device would respond with data. This change allows the delay between issuing the command and reading the result to be increased for older hosts.

On older hosts, like Raspberry Pi model B, the default delay of
0.5 seconds sometimes would expire before the serial device
would respond with data. This change allows the delay between
issuing the command and reading the result to be increased for
older hosts.
@hickey

hickey commented Apr 7, 2026

Copy link
Copy Markdown
Author

This issue was discussed briefly in the LetsMesh forum. https://forum.letsmesh.net/t/problem-generating-tokens/622

Comment thread bridge/serial_connection.py Outdated
def _send(self, cmd: str) -> str:
"""Send command and read response under lock."""
with self._lock:
return self._send_unlocked(cmd, delay)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An AI review flagged the following issue which at a glance at least appears to be a valid problem:

PR #41 introduces a startup-breaking NameError in serial mode. In /tmp/mesh-pr41/bridge/serial_connection.py:79, the refactor removes the delay parameter but still calls _send_unlocked(cmd, delay) at /tmp/mesh-pr41/bridge/serial_connection.py:82. Any command path that uses _send() (set_time(), get_name(), get_pubkey(), etc.) will crash before the bridge can finish startup. Risk: very high, direct regression.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, it appears that I missed removing the delay parameter here. When I get on the system that has the repo, I will submit another commit to fix this and push it.

Signed-off-by: Gerard Hickey <hickey@kinetic-compute.com>
@hickey

hickey commented May 9, 2026

Copy link
Copy Markdown
Author

Sorry for the delay, I finally had more than 2 mins to get this PR updated. Should be good to go now.

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.

2 participants