grbllib: flush the output stream buffer on reset, not just the input buffer#988
Open
stevenrwood wants to merge 1 commit into
Open
grbllib: flush the output stream buffer on reset, not just the input buffer#988stevenrwood wants to merge 1 commit into
stevenrwood wants to merge 1 commit into
Conversation
…buffer hal.stream.reset_read_buffer() is called on every reboot to clear pending input, but there was no equivalent call for the output side. reset_write_ buffer is defined in the HAL stream interface (optional, documented for Modbus/RS-485 support) and at least one driver (Plugin_networking's telnetd.c) already implements it - but nothing in the core reboot sequence ever called it, on any transport. Consequence: a stale, partially-transmitted TX message left in a driver's output buffer across a reset can leak out merged with the reboot's own output, with no separator - observed as a garbled/concatenated ALARM message (e.g. "Alarm:-1" instead of a clean "Alarm:3 - ...") immediately following a Reset-during-motion repro, reproduced identically on both Serial and Telnet on a Teensy 4.1 (iMXRT1062 driver). Fix: call hal.stream.reset_write_buffer() (guarded, since it's optional) right alongside the existing reset_read_buffer() call in the reboot sequence.
Contributor
|
The output buffer is not flushed to avoid garbled output so I need to be able to reproduce this myself. |
Contributor
Author
|
I am using my own veraion of ioAwnswe (C2.01) which has diverged quite a bit from your version. I you sre interested in the details, this file lays out all the changes.
From: Terje Io ***@***.***>
Sent: Saturday, July 18, 2026 2:00 PM
To: grblHAL/core ***@***.***>
Cc: Steven Wood ***@***.***>; Author ***@***.***>
Subject: Re: [grblHAL/core] grbllib: flush the output stream buffer on reset, not just the input buffer (PR #988)
[https://avatars.githubusercontent.com/u/20260062?s=20&v=4]terjeio left a comment (grblHAL/core#988)<#988 (comment)>
The output buffer is not flushed to avoid garbled output so I need to be able to reproduce this myself.
BTW do you use ioSender and if so which version? Asking since it might be an issue with the sender.
-
Reply to this email directly, view it on GitHub<#988?email_source=notifications&email_token=AL6EPDF5LXBYLXEZN2D3VK35FPQMBA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBRGI4TAMRYGI32M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-5012902827>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AL6EPDCWU23RGN3VYVSFZP35FPQMBAVCNFSNUABFKJSXA33TNF2G64TZHMZTIMBQGI2TQNJYHNEXG43VMU5TIOBYGA4DIOBTGY2KC5QC>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
Contributor
Author
|
Might help to include the link: ioSender/Overview.pdf at integration * stevenrwood/ioSender<https://github.com/stevenrwood/ioSender/blob/integration/Overview.pdf>
It represents over 50,000 lines of new code written over the last 6 weeks. Interestingly, I didn't write or read a single line of code. Claude Code did all the work. I just described how I wanted to look and function.
I am a CNC notice, so lot of my changes wee to make it easier for a novice to get up to speed. Still have to finish the user manual with embedded videos showing how to use various features. If you want to take a look, feedback welcome.
Steve
From: Steve Wood
Sent: Saturday, July 18, 2026 7:10 PM
To: grblHAL/core ***@***.***>
Subject: RE: [grblHAL/core] grbllib: flush the output stream buffer on reset, not just the input buffer (PR #988)
I am using my own veraion of ioAwnswe (C2.01) which has diverged quite a bit from your version. I you sre interested in the details, this file lays out all the changes.
From: Terje Io ***@***.******@***.***>>
Sent: Saturday, July 18, 2026 2:00 PM
To: grblHAL/core ***@***.******@***.***>>
Cc: Steven Wood ***@***.******@***.***>>; Author ***@***.******@***.***>>
Subject: Re: [grblHAL/core] grbllib: flush the output stream buffer on reset, not just the input buffer (PR #988)
[https://avatars.githubusercontent.com/u/20260062?s=20&v=4]terjeio left a comment (grblHAL/core#988)<#988 (comment)>
The output buffer is not flushed to avoid garbled output so I need to be able to reproduce this myself.
BTW do you use ioSender and if so which version? Asking since it might be an issue with the sender.
-
Reply to this email directly, view it on GitHub<#988?email_source=notifications&email_token=AL6EPDF5LXBYLXEZN2D3VK35FPQMBA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBRGI4TAMRYGI32M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-5012902827>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AL6EPDCWU23RGN3VYVSFZP35FPQMBAVCNFSNUABFKJSXA33TNF2G64TZHMZTIMBQGI2TQNJYHNEXG43VMU5TIOBYGA4DIOBTGY2KC5QC>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
hal.stream.reset_read_buffer()is called on every reboot to clear pending input, but there was no equivalent call for the output side.reset_write_bufferis defined in the HAL stream interface (optional, documented for Modbus/RS-485 support) and at least one driver (Plugin_networking'stelnetd.c) already implements it - but nothing in the core reboot sequence ever called it, on any transport.Consequence: a stale, partially-transmitted TX message left in a driver's output buffer across a reset can leak out merged with the reboot's own output, with no separator - observed as a garbled/concatenated ALARM message (e.g.
Alarm:-1instead of a cleanAlarm:3 - Reset/E-stop while in motion...) immediately following a Reset-during-motion repro.Repro / verification
Reproduced identically on both Serial and Telnet on a Teensy 4.1 (iMXRT1062 driver) during a Reset-during-motion repro. After the fix, the
ALARM:line prints cleanly on every repro attempt.Fix
Call
hal.stream.reset_write_buffer()(guarded, since it's optional per the HAL interface) right alongside the existingreset_read_buffer()call in the reboot sequence.Test plan