diff --git a/esp8266/command.cpp b/esp8266/command.cpp index e9d36b3a..ed5d7fe6 100644 --- a/esp8266/command.cpp +++ b/esp8266/command.cpp @@ -131,6 +131,7 @@ void COMMAND::execute_command(int cmd,String cmd_params) void COMMAND::check_command(String buffer) { static bool bfileslist=false; + String buffer2; static uint32_t start_list=0; if (!bfileslist) { int filesstart = buffer.indexOf("Begin file list"); @@ -144,11 +145,20 @@ void COMMAND::check_command(String buffer) int Xpos = buffer.indexOf("X:"); int Ypos = buffer.indexOf("Y:"); int Zpos = buffer.indexOf("Z:"); - int Speedpos = buffer.indexOf("SpeedMultiply:"); +#if FIRMWARE_TARGET == SMOOTHIEWARE + int Speedpos = buffer.indexOf("Speed factor at "); + int Flowpos = buffer.indexOf("Flow rate at "); + int Errorpos= buffer.indexOf("error:"); + int Infopos= buffer.indexOf("info:"); + int Statuspos= buffer.indexOf("warning:"); +#else + int Speedpos = buffer.indexOf("SpeedMultiply:"); int Flowpos = buffer.indexOf("FlowMultiply:"); int Errorpos= buffer.indexOf("Error:"); int Infopos= buffer.indexOf("Info:"); int Statuspos= buffer.indexOf("Status:"); +#endif + #ifdef SERIAL_COMMAND_FEATURE String ESP_Command; int ESPpos = buffer.indexOf("[ESP"); @@ -188,11 +198,28 @@ void COMMAND::check_command(String buffer) } //Speed if (Speedpos>-1) { - web_interface->answer4M220=buffer.substring(Speedpos+14); + //get just the value + +#if FIRMWARE_TARGET == SMOOTHIEWARE + buffer2 =buffer.substring(Speedpos+16); + int p2 = buffer2.indexOf("."); + web_interface->answer4M220=buffer2.substring(0,p2); +#else + web_interface->answer4M220=buffer.substring(Speedpos+14); +#endif + } //Flow if (Flowpos>-1) { - web_interface->answer4M221=buffer.substring(Flowpos+13); + //get just the value + +#if FIRMWARE_TARGET == SMOOTHIEWARE + buffer2 =buffer.substring(Flowpos+13); + int p2 = buffer2.indexOf("."); + web_interface->answer4M221=buffer2.substring(0,p2); +#else + web_interface->answer4M221=buffer.substring(Flowpos+13); +#endif } //Error if (Errorpos>-1 && !(buffer.indexOf("Format error")!=-1 || buffer.indexOf("wait")==Errorpos+6) ) { @@ -204,7 +231,11 @@ void COMMAND::check_command(String buffer) } //Status if (Statuspos>-1) { - (web_interface->status_msg).add(buffer.substring(Statuspos+7).c_str()); +#if FIRMWARE_TARGET == SMOOTHIEWARE + (web_interface->status_msg).add(buffer.substring(Statuspos+8).c_str()); +#else + (web_interface->status_msg).add(buffer.substring(Statuspos+7).c_str()); +#endif } } else { if ((system_get_time()-start_list)>30000000) { //timeout in case of problem diff --git a/esp8266/config.cpp b/esp8266/config.cpp index 0e5d9680..c19ae6cf 100644 --- a/esp8266/config.cpp +++ b/esp8266/config.cpp @@ -456,4 +456,18 @@ void CONFIG::print_config() #else Serial.println(F("Disabled")); #endif + Serial.print(F("Target Firmware: ")); +#if FIRMWARE_TARGET == REPETIER + Serial.println(F("Repetier")); +#elif FIRMWARE_TARGET == REPETIER4DV + Serial.println(F("Repetier for DaVinci")); +#elif FIRMWARE_TARGET == MALRLIN + Serial.println(F("Marlin")); +#elif FIRMWARE_TARGET == SMOOTHIEWARE + Serial.println(F("Smoothieware")); +#else + Serial.println(F("???")); +#endif + + } diff --git a/esp8266/config.h b/esp8266/config.h index 7237de75..d9241985 100644 --- a/esp8266/config.h +++ b/esp8266/config.h @@ -18,6 +18,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +//definition +#define REPETIER 0 +#define REPETIER4DV 1 +#define MARLIN 2 +#define SMOOTHIEWARE 3 + //comment to disable //MDNS_FEATURE: this feature allow type the name defined //in web browser by default: http:\\esp8266.local and connect @@ -44,6 +50,10 @@ //RECOVERY_FEATURE: allow to use GPIO2 pin as hardware reset for EEPROM, add 8s to boot time to let user to jump GPIO2 to GND #define RECOVERY_FEATURE +//FIRMWARE_TARGET: the targeted FW, can be REPETIER (Original Repetier)/ REPETIER4DV (Repetier for Davinci) / MARLIN (Marlin)/ SMOOTHIEWARE (Smoothieware) +#define FIRMWARE_TARGET REPETIER4DV + + #ifndef CONFIG_h #define CONFIG_h