diff --git a/README.md b/README.md index 0fc96a6c..d58f9104 100644 --- a/README.md +++ b/README.md @@ -102,12 +102,13 @@ Additionally 404.tpl (the page not found) and restart.tpl(restart page when appl ##Direct commands: ``` - -restart module from host/printer: [ESP888]RESTART + -Restart module from host/printer: [ESP888]RESTART + -Send file line by line from SPIFFS: [ESP700] -Get IP (only printer see answer): [ESP111]M117 - -reset EEPROM and restart: [ESP444]RESET - -reset user password: [ESP555] - -display EEPROM content: [ESP444]CONFIG - -go to safe mode without restart: [ESP444]SAFEMODE + -Reset EEPROM and restart: [ESP444]RESET + -Deset user password: [ESP555] + -Display EEPROM content: [ESP444]CONFIG + -Go to safe mode without restart: [ESP444]SAFEMODE -SSID: [ESP100] -Password: [ESP101] -Station mode: [ESP103]STA diff --git a/esp3d/command.cpp b/esp3d/command.cpp index 4777ae6b..82ff991b 100644 --- a/esp3d/command.cpp +++ b/esp3d/command.cpp @@ -22,6 +22,7 @@ #include "config.h" #include "wifi.h" #include "webinterface.h" +#include String COMMAND::buffer_serial; String COMMAND::buffer_tcp; @@ -119,6 +120,32 @@ void COMMAND::execute_command(int cmd,String cmd_params) break; } #endif + case 700: //read local file + {//be sure serial is locked + if ((web_interface->blockserial)) break; + cmd_params.trim() ; + if ((cmd_params.length() > 0) && (cmd_params[0] != '/')) cmd_params = "/" + cmd_params; + File currentfile = SPIFFS.open(cmd_params, "r"); + if (currentfile) {//if file open success + //flush to be sure send buffer is empty + Serial.flush(); + //read content + String currentline = currentfile.readString(); + //until no line in file + while (currentline.length() >0) + { //send line to serial + Serial.println(currentline); + //flush to be sure send buffer is empty + delay(0); + Serial.flush(); + currentline=""; + //read next line if any + currentline = currentfile.readString(); + } + currentfile.close() +; } + break; + } case 888: if (cmd_params=="RESTART") { Serial.print("\r"); diff --git a/esp3d/config.h b/esp3d/config.h index d810ff52..0a62b111 100644 --- a/esp3d/config.h +++ b/esp3d/config.h @@ -68,7 +68,7 @@ #include #include "wifi.h" //version and sources location -#define FW_VERSION "0.7.71" +#define FW_VERSION "0.7.72" #define REPOSITORY "https://github.com/luc-github/ESP8266"