mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-03 03:13:25 +02:00
Function was crashing , with ALARM:10 as overflowing array. replaced with larger array + use of snprintf to truncate rather than overflow in the future.
This commit is contained in:
@@ -123,12 +123,11 @@ void report_status_message(uint8_t status_code)
|
|||||||
// Prints alarm messages.
|
// Prints alarm messages.
|
||||||
void report_alarm_message(uint8_t alarm_code)
|
void report_alarm_message(uint8_t alarm_code)
|
||||||
{
|
{
|
||||||
char alarm[10];
|
char alarm[32];
|
||||||
|
snprintf(alarm, 32, "ALARM:%d\r\n", alarm_code);
|
||||||
sprintf(alarm, "ALARM:%d\r\n", alarm_code);
|
|
||||||
grbl_send(alarm);
|
grbl_send(alarm);
|
||||||
|
|
||||||
delay_ms(500); // Force delay to ensure message clears serial write buffer.
|
delay_ms(500); // Force delay to ensure message clears serial write buffer.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prints feedback messages. This serves as a centralized method to provide additional
|
// Prints feedback messages. This serves as a centralized method to provide additional
|
||||||
|
Reference in New Issue
Block a user