Small changes to ensure that output during startup do not cause

hangs due to no client connection when native USB is default.
This commit is contained in:
Terje Io
2026-03-21 20:23:50 +01:00
parent a4dd4134c0
commit f526ec0395
3 changed files with 27 additions and 19 deletions

View File

@@ -1,5 +1,13 @@
## grblHAL changelog
<a name="20260321">Build 20260321
Core:
* Small changes to ensure that output during startup do not cause hangs due to no client connection when native USB is default.
---
<a name="20260320">Build 20260320
Core:

2
grbl.h
View File

@@ -42,7 +42,7 @@
#else
#define GRBL_VERSION "1.1f"
#endif
#define GRBL_BUILD 20260320
#define GRBL_BUILD 20260321
#define GRBL_URL "https://github.com/grblHAL"

View File

@@ -210,30 +210,28 @@ FLASHMEM void report_init (void)
// operation. Errors events can originate from the g-code parser, settings module, or asynchronously
// from a critical error, such as a triggered hard limit. Interface should always monitor for these
// responses.
FLASHMEM static status_code_t report_status_message (status_code_t status_code)
FLASHMEM static status_code_t report_status_message (status_code_t status)
{
switch(status_code) {
if(status == Status_Handled)
status = Status_OK;
case Status_Handled:
status_code = Status_OK;
// no break
case Status_OK: // STATUS_OK
if(hal.stream.is_connected()) {
if(status == Status_OK)
hal.stream.write("ok" ASCII_EOL);
break;
default:
hal.stream.write(appendbuf(3, "error:", uitoa((uint32_t)status_code), ASCII_EOL));
break;
else
hal.stream.write(appendbuf(3, "error:", uitoa((uint32_t)status), ASCII_EOL));
}
return status_code;
return status;
}
// Prints alarm messages.
FLASHMEM static alarm_code_t report_alarm_message (alarm_code_t alarm_code)
{
if(hal.stream.is_connected()) {
hal.stream.write_all(appendbuf(3, "ALARM:", uitoa((uint32_t)alarm_code), ASCII_EOL));
hal.delay_ms(100, NULL); // Force delay to ensure message clears output stream buffer.
}
return alarm_code;
}
@@ -856,11 +854,13 @@ FLASHMEM void report_startup_line (uint8_t n, char *line)
FLASHMEM void report_execute_startup_message (char *line, status_code_t status_code)
{
if(hal.stream.is_connected()) {
hal.stream.write(">");
hal.stream.write(line);
hal.stream.write(":");
grbl.report.status_message(status_code);
}
}
// Prints build info line
FLASHMEM void report_build_info (char *line, bool extended)