Increased g-code parser line buffer. Added line overflow feedback.
- Increased g-code parser line buffer from 50 to 70 characters. Should fix most all issues with long arc statements, provided that they are 8 digits(float) long only. - Added a line buffer overflow feedback error to let the user know when it encounters this problem. Resets the line whenever this occurs. (Thanks @BHSPitMonkey!)
This commit is contained in:
parent
33c6659523
commit
ca563cf423
5 changed files with 18 additions and 8 deletions
17
protocol.c
17
protocol.c
|
|
@ -37,10 +37,16 @@ static uint8_t char_counter; // Last character counter in line variable.
|
|||
static uint8_t iscomment; // Comment/block delete flag for processor to ignore comment characters.
|
||||
|
||||
|
||||
void protocol_init()
|
||||
static void protocol_reset_line_buffer()
|
||||
{
|
||||
char_counter = 0; // Reset line input
|
||||
iscomment = false;
|
||||
}
|
||||
|
||||
|
||||
void protocol_init()
|
||||
{
|
||||
protocol_reset_line_buffer();
|
||||
report_init_message(); // Welcome message
|
||||
|
||||
PINOUT_DDR &= ~(PINOUT_MASK); // Set as input pins
|
||||
|
|
@ -303,9 +309,8 @@ void protocol_process()
|
|||
// Empty or comment line. Skip block.
|
||||
report_status_message(STATUS_OK); // Send status message for syncing purposes.
|
||||
}
|
||||
char_counter = 0; // Reset line buffer index
|
||||
iscomment = false; // Reset comment flag
|
||||
|
||||
protocol_reset_line_buffer();
|
||||
|
||||
} else {
|
||||
if (iscomment) {
|
||||
// Throw away all comment characters
|
||||
|
|
@ -322,7 +327,9 @@ void protocol_process()
|
|||
// Enable comments flag and ignore all characters until ')' or EOL.
|
||||
iscomment = true;
|
||||
} else if (char_counter >= LINE_BUFFER_SIZE-1) {
|
||||
// Throw away any characters beyond the end of the line buffer
|
||||
// Report line buffer overflow and reset
|
||||
report_status_message(STATUS_OVERFLOW);
|
||||
protocol_reset_line_buffer();
|
||||
} else if (c >= 'a' && c <= 'z') { // Upcase lowercase
|
||||
line[char_counter++] = c-'a'+'A';
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue