1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-09-02 10:53:01 +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:
Dave
2018-09-03 19:27:46 +01:00
parent e65ba3c91f
commit cfa529e9e7

View File

@@ -123,12 +123,11 @@ void report_status_message(uint8_t status_code)
// Prints alarm messages.
void report_alarm_message(uint8_t alarm_code)
{
char alarm[10];
sprintf(alarm, "ALARM:%d\r\n", alarm_code);
char alarm[32];
snprintf(alarm, 32, "ALARM:%d\r\n", alarm_code);
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