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:
@@ -123,9 +123,8 @@ 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.
|
||||||
|
Reference in New Issue
Block a user