Add ESP700 command

Send file line by line from SPIFFS: [ESP700]<file name>
for macro purpose
This commit is contained in:
luc lebosse 2016-07-08 15:48:01 +02:00
parent b7afbafb52
commit 7c0afb3f0c
3 changed files with 34 additions and 6 deletions

View File

@ -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]<file name>
-Get IP (only printer see answer): [ESP111]M117
-reset EEPROM and restart: [ESP444]RESET
-reset user password: [ESP555]<admin password>
-display EEPROM content: [ESP444]CONFIG
-go to safe mode without restart: [ESP444]SAFEMODE
-Reset EEPROM and restart: [ESP444]RESET
-Deset user password: [ESP555]<admin password>
-Display EEPROM content: [ESP444]CONFIG
-Go to safe mode without restart: [ESP444]SAFEMODE
-SSID: [ESP100]<SSID>
-Password: [ESP101]<Password>
-Station mode: [ESP103]STA

View File

@ -22,6 +22,7 @@
#include "config.h"
#include "wifi.h"
#include "webinterface.h"
#include <FS.h>
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");

View File

@ -68,7 +68,7 @@
#include <Arduino.h>
#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"