mirror of
https://github.com/usatiuk/EggbotWireless.git
synced 2025-10-26 16:57:48 +01:00
support longer gcode lines
Signed-off-by: Stepan Usatyuk <usaatyuk@ustk.me>
This commit is contained in:
@@ -4,10 +4,10 @@
|
|||||||
int bytecode[4] = {-1, -1, -1, -1};
|
int bytecode[4] = {-1, -1, -1, -1};
|
||||||
|
|
||||||
int* parseGCode(String gcode) {
|
int* parseGCode(String gcode) {
|
||||||
char commandStringIn[30];
|
char commandStringIn[50];
|
||||||
char commandString[26];
|
char commandString[50];
|
||||||
|
|
||||||
gcode.toCharArray(commandStringIn, 30);
|
gcode.toCharArray(commandStringIn, 50);
|
||||||
|
|
||||||
// Convert command to uppercase
|
// Convert command to uppercase
|
||||||
for (int i = 0; commandStringIn[i] != '\0'; i++) {
|
for (int i = 0; commandStringIn[i] != '\0'; i++) {
|
||||||
@@ -19,13 +19,13 @@ int* parseGCode(String gcode) {
|
|||||||
strncpy(command, commandString, 3);
|
strncpy(command, commandString, 3);
|
||||||
command[3] = '\0';
|
command[3] = '\0';
|
||||||
|
|
||||||
char args[22];
|
char args[45];
|
||||||
strncpy(args, &commandString[4], 22);
|
strncpy(args, &commandString[4], 45);
|
||||||
|
|
||||||
if (strcmp(command, "G01") == 0) {
|
if (strcmp(command, "G01") == 0) {
|
||||||
bytecode[0] = G01;
|
bytecode[0] = G01;
|
||||||
|
|
||||||
char split_args[3][22];
|
char split_args[3][40];
|
||||||
memset(split_args, 0, sizeof(split_args));
|
memset(split_args, 0, sizeof(split_args));
|
||||||
char* arg;
|
char* arg;
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
@@ -42,12 +42,12 @@ int* parseGCode(String gcode) {
|
|||||||
for (int i = 0; i < argc; i++) {
|
for (int i = 0; i < argc; i++) {
|
||||||
arg = split_args[i];
|
arg = split_args[i];
|
||||||
char axis[2];
|
char axis[2];
|
||||||
char value[7];
|
char value[10];
|
||||||
|
|
||||||
strncpy(axis, arg, 1);
|
strncpy(axis, arg, 1);
|
||||||
axis[1] = '\0';
|
axis[1] = '\0';
|
||||||
|
|
||||||
strncpy(value, &arg[1], 7);
|
strncpy(value, &arg[1], 10);
|
||||||
|
|
||||||
float floatValue;
|
float floatValue;
|
||||||
floatValue = atof(value);
|
floatValue = atof(value);
|
||||||
|
|||||||
Reference in New Issue
Block a user