mirror of
https://github.com/usatiuk/EggbotWireless.git
synced 2025-10-26 16:57:48 +01:00
more efficient args parsing
This commit is contained in:
@@ -53,14 +53,19 @@ Command parseGCode(String gcode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(command, "G01") == 0 || strcmp(command, "G00") == 0) {
|
if (strcmp(command, "G01") == 0 || strcmp(command, "G00") == 0) {
|
||||||
if(argsMap.count('X') > 0) {
|
auto xIter = argsMap.find('X');
|
||||||
bufcmd.arg1 = argsMap['X'];
|
auto yIter = argsMap.find('Y');
|
||||||
|
auto zIter = argsMap.find('Z');
|
||||||
|
auto endIter = argsMap.end();
|
||||||
|
|
||||||
|
if(xIter != endIter) {
|
||||||
|
bufcmd.arg1 = xIter->second;
|
||||||
}
|
}
|
||||||
if (argsMap.count('Y') > 0) {
|
if (yIter != endIter) {
|
||||||
bufcmd.arg2 = argsMap['Y'];
|
bufcmd.arg2 = yIter->second;
|
||||||
}
|
}
|
||||||
if (argsMap.count('Z') > 0) {
|
if (zIter != endIter) {
|
||||||
bufcmd.arg3 = argsMap['Z'];
|
bufcmd.arg3 = zIter->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(command, "G00") == 0) {
|
if (strcmp(command, "G00") == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user