From f1b31c68641667e3d72a4194fc8f92357b85bb61 Mon Sep 17 00:00:00 2001 From: Luc <8822552+luc-github@users.noreply.github.com> Date: Thu, 31 Dec 2020 10:32:07 +0100 Subject: [PATCH] Fix wrong detection of [ESPXXX]Command if used in macro or web command and sent to printer using M118 --- esp3d/command.cpp | 3 ++- esp3d/config.h | 2 +- esp3d/syncwebserver.cpp | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/esp3d/command.cpp b/esp3d/command.cpp index 314f3a52..7e2b8776 100644 --- a/esp3d/command.cpp +++ b/esp3d/command.cpp @@ -1828,9 +1828,10 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a String currentline = currentfile.readStringUntil('\n'); currentline.replace("\n",""); currentline.replace("\r",""); + currentline.trim(); if (currentline.length() > 0) { int ESPpos = currentline.indexOf ("[ESP"); - if (ESPpos > -1) { + if (ESPpos ==0) { //is there the second part? int ESPpos2 = currentline.indexOf ("]", ESPpos); if (ESPpos2 > -1) { diff --git a/esp3d/config.h b/esp3d/config.h index 20f62ce0..2cd7e43a 100644 --- a/esp3d/config.h +++ b/esp3d/config.h @@ -19,7 +19,7 @@ */ //version and sources location -#define FW_VERSION "2.1.1.b9" +#define FW_VERSION "2.1.1.b10" #define REPOSITORY "https://github.com/luc-github/ESP3D" //Customize ESP3D //////////////////////////////////////////////////////////////////////// diff --git a/esp3d/syncwebserver.cpp b/esp3d/syncwebserver.cpp index 3d06568e..a0fa36b1 100644 --- a/esp3d/syncwebserver.cpp +++ b/esp3d/syncwebserver.cpp @@ -948,7 +948,7 @@ void handle_web_command() //if it is for ESP module [ESPXXX] cmd.trim(); int ESPpos = cmd.indexOf("[ESP"); - if (ESPpos>-1) { + if (ESPpos==0) { //is there the second part? int ESPpos2 = cmd.indexOf("]",ESPpos); if (ESPpos2>-1) { @@ -1137,7 +1137,7 @@ void handle_web_command_silent() //if it is for ESP module [ESPXXX] cmd.trim(); int ESPpos = cmd.indexOf("[ESP"); - if (ESPpos>-1) { + if (ESPpos==0) { //is there the second part? int ESPpos2 = cmd.indexOf("]",ESPpos); if (ESPpos2>-1) {