Various minor updates and variable definition corrections. Removed deprecated acceleration manager.
- Removed deprecated acceleration manager (non-functional since v0.7b) - Updated variable types and function headers. - Updated stepper interrupt to ISR() from SIGNAL()+sei(). - General code cleanup.
This commit is contained in:
20
protocol.c
20
protocol.c
@@ -31,10 +31,12 @@
|
||||
#include <avr/pgmspace.h>
|
||||
#define LINE_BUFFER_SIZE 50
|
||||
|
||||
static char line[LINE_BUFFER_SIZE];
|
||||
static uint8_t char_counter;
|
||||
static char line[LINE_BUFFER_SIZE]; // Line to be executed. Zero-terminated.
|
||||
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.
|
||||
|
||||
static void status_message(int status_code) {
|
||||
static void status_message(int status_code)
|
||||
{
|
||||
if (status_code == 0) {
|
||||
printPgmString(PSTR("ok\r\n"));
|
||||
} else {
|
||||
@@ -57,12 +59,15 @@ static void status_message(int status_code) {
|
||||
|
||||
void protocol_init()
|
||||
{
|
||||
char_counter = 0; // Reset line input
|
||||
iscomment = false;
|
||||
printPgmString(PSTR("\r\nGrbl " GRBL_VERSION));
|
||||
printPgmString(PSTR("\r\n"));
|
||||
}
|
||||
|
||||
// Executes one line of input according to protocol
|
||||
uint8_t protocol_execute_line(char *line) {
|
||||
uint8_t protocol_execute_line(char *line)
|
||||
{
|
||||
if(line[0] == '$') {
|
||||
return(settings_execute_line(line)); // Delegate lines starting with '$' to the settings module
|
||||
} else {
|
||||
@@ -70,15 +75,16 @@ uint8_t protocol_execute_line(char *line) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Process one line of incoming serial data. Remove unneeded characters and capitalize.
|
||||
void protocol_process()
|
||||
{
|
||||
char c;
|
||||
uint8_t iscomment = false;
|
||||
while((c = serial_read()) != SERIAL_NO_DATA)
|
||||
{
|
||||
if ((c == '\n') || (c == '\r')) { // End of block reached
|
||||
if ((c == '\n') || (c == '\r')) { // End of line reached
|
||||
if (char_counter > 0) {// Line is complete. Then execute!
|
||||
line[char_counter] = 0; // terminate string
|
||||
line[char_counter] = 0; // Terminate string
|
||||
status_message(protocol_execute_line(line));
|
||||
} else {
|
||||
// Empty or comment line. Skip block.
|
||||
|
||||
Reference in New Issue
Block a user