-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only skip DEBUG_STREAM when it is not default_stream #664
Conversation
There is a bug in serial_available() that will make the system ignore any incoming bytes from default_stream. With UART as default_stream, the system will not be able to communicate with a sender software on a host machine. To repro: 1. enable DEBUG_STREAM (mapped to default_stream) 2. register multiple serial streams 3. build and flash 4. connect system to a sender, and verify the two can communicate 5. send data via any stream that is not default_stream (i.e. not UART) 6. sender can no longer communicate with the system This diff fixes the bug by skipping DEBUG_STREAM only when it is not default_stream.
That is intentional.
So lets say your board has UART and USB available (making UART your default stream) and you ENABLE_DEBUG_STREAM but you want to use USB as your debug stream. You can modify that by also setting debug stream like this. // note that this take the pointer to the stream while the serial_available is checking the available streams for available characters it can skip the usb stream (that is not the default stream). Note that other types of streams can be used as a debug stream. Like for example a custom stream to an SD card and create some sort of data logger as well. |
the point I was trying to make is that the "default setting" (i.e. mapping My suggestions:
|
When you only have on single stream (default_stream) stream multiplexing does not happen and you can use default stream as usual (that is the standard protocol plus the debug prints). But I understand what you are saying. I could still allow the debug stream accept commands like any regular stream leaving the open possibility to send some sort of command back via this stream. Removing this port exclusively to debug print could be exerted by also enabling the DETACH_FROM_MAIN_PROTOCOL option (this will also make it stop printing broadcast messages). |
uCNC/uCNC/src/modules/system_menu.h Lines 191 to 192 in 377703d
anyhow I don't think there's a right vs wrong discussion. all I wished was to remove confusion. if it is by design then I'd suggest to "enforce that |
That is an excellent point. Agree. |
There is a bug in serial_available() that will make the system ignore any incoming bytes from default_stream. With UART as default_stream, the system will stop talking to a sender software on a host machine.
To repro:
This diff fixes the bug by skipping DEBUG_STREAM only when it is not default_stream.
TBH I am not sure why we want to skip DEBUG_STREAM in serial_available().
serial_available() checks number of bytes in the RX buffer.
In almost all scenarios DEBUG_STREAM is used to send debug messages out; RX buffer isn't that useful.
We might as well just remove the check