mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-04 18:30:37 +08:00
Merge pull request #483 from luc-github/2.1-devt
Fix typo for [ESP110] parameters thanks @Patronics for pointing it Fix stings with ' not handled properly and corrupt JSON files in [ESP400]
This commit is contained in:
commit
bb1007c4c4
@ -58,6 +58,14 @@ String COMMAND::buffer_tcp;
|
|||||||
extern uint8_t Checksum(const char * line, uint16_t lineSize);
|
extern uint8_t Checksum(const char * line, uint16_t lineSize);
|
||||||
extern bool sendLine2Serial (String & line, int32_t linenb, int32_t* newlinenb);
|
extern bool sendLine2Serial (String & line, int32_t linenb, int32_t* newlinenb);
|
||||||
|
|
||||||
|
const char * encodeString(const char * s){
|
||||||
|
static String tmp;
|
||||||
|
tmp = s;
|
||||||
|
while(tmp.indexOf("'")!=-1)tmp.replace("'", "'");
|
||||||
|
while(tmp.indexOf("\"")!=-1)tmp.replace("\"", """);
|
||||||
|
if (tmp =="") tmp=" ";
|
||||||
|
return tmp.c_str();
|
||||||
|
}
|
||||||
String COMMAND::get_param (String & cmd_params, const char * id, bool withspace)
|
String COMMAND::get_param (String & cmd_params, const char * id, bool withspace)
|
||||||
{
|
{
|
||||||
static String parameter;
|
static String parameter;
|
||||||
@ -356,11 +364,11 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
|
|||||||
//[ESP110]<state>[pwd=<admin password>]
|
//[ESP110]<state>[pwd=<admin password>]
|
||||||
case 110:
|
case 110:
|
||||||
parameter = get_param (cmd_params, "", true);
|
parameter = get_param (cmd_params, "", true);
|
||||||
if (parameter == "on") {
|
if (parameter == "ON") {
|
||||||
mode = 1;
|
mode = 1;
|
||||||
} else if (parameter == "off") {
|
} else if (parameter == "OFF") {
|
||||||
mode = 0;
|
mode = 0;
|
||||||
} else if (parameter == "restart") {
|
} else if (parameter == "RESTART") {
|
||||||
mode = 2;
|
mode = 2;
|
||||||
} else {
|
} else {
|
||||||
ESPCOM::println (INCORRECT_CMD_MSG, output, espresponse);
|
ESPCOM::println (INCORRECT_CMD_MSG, output, espresponse);
|
||||||
@ -845,7 +853,7 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
|
|||||||
if (!CONFIG::read_string (EP_HOSTNAME, sbuf, MAX_HOSTNAME_LENGTH) ) {
|
if (!CONFIG::read_string (EP_HOSTNAME, sbuf, MAX_HOSTNAME_LENGTH) ) {
|
||||||
ESPCOM::print ("???", output, espresponse);
|
ESPCOM::print ("???", output, espresponse);
|
||||||
} else {
|
} else {
|
||||||
ESPCOM::print (sbuf, output, espresponse);
|
ESPCOM::print (encodeString(sbuf), output, espresponse);
|
||||||
}
|
}
|
||||||
ESPCOM::print (F ("\",\"H\":\"Hostname\" ,\"S\":\""), output, espresponse);
|
ESPCOM::print (F ("\",\"H\":\"Hostname\" ,\"S\":\""), output, espresponse);
|
||||||
ESPCOM::print ( (const char *) CONFIG::intTostr (MAX_HOSTNAME_LENGTH), output, espresponse);
|
ESPCOM::print ( (const char *) CONFIG::intTostr (MAX_HOSTNAME_LENGTH), output, espresponse);
|
||||||
@ -873,7 +881,7 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
|
|||||||
if (!CONFIG::read_string (EP_STA_SSID, sbuf, MAX_SSID_LENGTH) ) {
|
if (!CONFIG::read_string (EP_STA_SSID, sbuf, MAX_SSID_LENGTH) ) {
|
||||||
ESPCOM::print ("???", output, espresponse);
|
ESPCOM::print ("???", output, espresponse);
|
||||||
} else {
|
} else {
|
||||||
ESPCOM::print (sbuf, output, espresponse);
|
ESPCOM::print (encodeString(sbuf), output, espresponse);
|
||||||
}
|
}
|
||||||
ESPCOM::print (F ("\",\"S\":\""), output, espresponse);
|
ESPCOM::print (F ("\",\"S\":\""), output, espresponse);
|
||||||
ESPCOM::print ( (const char *) CONFIG::intTostr (MAX_SSID_LENGTH), output, espresponse);
|
ESPCOM::print ( (const char *) CONFIG::intTostr (MAX_SSID_LENGTH), output, espresponse);
|
||||||
@ -971,7 +979,7 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
|
|||||||
if (!CONFIG::read_string (EP_AP_SSID, sbuf, MAX_SSID_LENGTH) ) {
|
if (!CONFIG::read_string (EP_AP_SSID, sbuf, MAX_SSID_LENGTH) ) {
|
||||||
ESPCOM::print ("???", output, espresponse);
|
ESPCOM::print ("???", output, espresponse);
|
||||||
} else {
|
} else {
|
||||||
ESPCOM::print (sbuf, output, espresponse);
|
ESPCOM::print (encodeString(sbuf), output, espresponse);
|
||||||
}
|
}
|
||||||
ESPCOM::print (F ("\",\"S\":\""), output, espresponse);
|
ESPCOM::print (F ("\",\"S\":\""), output, espresponse);
|
||||||
ESPCOM::print ( (const char *) CONFIG::intTostr (MAX_SSID_LENGTH), output, espresponse);
|
ESPCOM::print ( (const char *) CONFIG::intTostr (MAX_SSID_LENGTH), output, espresponse);
|
||||||
@ -1157,7 +1165,7 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
|
|||||||
if (!CONFIG::read_string (EP_TIME_SERVER1, sbuf, MAX_DATA_LENGTH) ) {
|
if (!CONFIG::read_string (EP_TIME_SERVER1, sbuf, MAX_DATA_LENGTH) ) {
|
||||||
ESPCOM::print ("???", output, espresponse);
|
ESPCOM::print ("???", output, espresponse);
|
||||||
} else {
|
} else {
|
||||||
ESPCOM::print (sbuf, output, espresponse);
|
ESPCOM::print (encodeString(sbuf), output, espresponse);
|
||||||
}
|
}
|
||||||
ESPCOM::print (F ("\",\"S\":\""), output, espresponse);
|
ESPCOM::print (F ("\",\"S\":\""), output, espresponse);
|
||||||
ESPCOM::print ( (const char *) CONFIG::intTostr (MAX_DATA_LENGTH), output, espresponse);
|
ESPCOM::print ( (const char *) CONFIG::intTostr (MAX_DATA_LENGTH), output, espresponse);
|
||||||
@ -1173,7 +1181,7 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
|
|||||||
if (!CONFIG::read_string (EP_TIME_SERVER2, sbuf, MAX_DATA_LENGTH) ) {
|
if (!CONFIG::read_string (EP_TIME_SERVER2, sbuf, MAX_DATA_LENGTH) ) {
|
||||||
ESPCOM::print ("???", output, espresponse);
|
ESPCOM::print ("???", output, espresponse);
|
||||||
} else {
|
} else {
|
||||||
ESPCOM::print (sbuf, output, espresponse);
|
ESPCOM::print (encodeString(sbuf), output, espresponse);
|
||||||
}
|
}
|
||||||
ESPCOM::print (F ("\",\"S\":\""), output, espresponse);
|
ESPCOM::print (F ("\",\"S\":\""), output, espresponse);
|
||||||
ESPCOM::print ( (const char *) CONFIG::intTostr (MAX_DATA_LENGTH), output, espresponse);
|
ESPCOM::print ( (const char *) CONFIG::intTostr (MAX_DATA_LENGTH), output, espresponse);
|
||||||
@ -1189,7 +1197,7 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
|
|||||||
if (!CONFIG::read_string (EP_TIME_SERVER3, sbuf, MAX_DATA_LENGTH) ) {
|
if (!CONFIG::read_string (EP_TIME_SERVER3, sbuf, MAX_DATA_LENGTH) ) {
|
||||||
ESPCOM::print ("???", output, espresponse);
|
ESPCOM::print ("???", output, espresponse);
|
||||||
} else {
|
} else {
|
||||||
ESPCOM::print (sbuf, output, espresponse);
|
ESPCOM::print (encodeString(sbuf), output, espresponse);
|
||||||
}
|
}
|
||||||
ESPCOM::print (F ("\",\"S\":\""), output, espresponse);
|
ESPCOM::print (F ("\",\"S\":\""), output, espresponse);
|
||||||
ESPCOM::print ( (const char *) CONFIG::intTostr (MAX_DATA_LENGTH), output, espresponse);
|
ESPCOM::print ( (const char *) CONFIG::intTostr (MAX_DATA_LENGTH), output, espresponse);
|
||||||
@ -1254,7 +1262,7 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
|
|||||||
if (!CONFIG::read_string (ESP_NOTIFICATION_SETTINGS, sbuf, MAX_NOTIFICATION_TOKEN_LENGTH) ) {
|
if (!CONFIG::read_string (ESP_NOTIFICATION_SETTINGS, sbuf, MAX_NOTIFICATION_TOKEN_LENGTH) ) {
|
||||||
ESPCOM::print ("???", output, espresponse);
|
ESPCOM::print ("???", output, espresponse);
|
||||||
} else {
|
} else {
|
||||||
ESPCOM::print (sbuf, output, espresponse);
|
ESPCOM::print (encodeString(sbuf), output, espresponse);
|
||||||
}
|
}
|
||||||
ESPCOM::print ( F("\",\"S\":\""), output, espresponse);
|
ESPCOM::print ( F("\",\"S\":\""), output, espresponse);
|
||||||
ESPCOM::print ( (const char *) CONFIG::intTostr (MAX_NOTIFICATION_SETTINGS_LENGTH), output, espresponse);
|
ESPCOM::print ( (const char *) CONFIG::intTostr (MAX_NOTIFICATION_SETTINGS_LENGTH), output, espresponse);
|
||||||
@ -1513,8 +1521,8 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
|
|||||||
}
|
}
|
||||||
if (!plain) {
|
if (!plain) {
|
||||||
ESPCOM::print (F ("{\"SSID\":\""), output, espresponse);
|
ESPCOM::print (F ("{\"SSID\":\""), output, espresponse);
|
||||||
}
|
ESPCOM::print (encodeString(WiFi.SSID (i).c_str()), output, espresponse);
|
||||||
ESPCOM::print (WiFi.SSID (i).c_str(), output, espresponse);
|
} else ESPCOM::print (WiFi.SSID (i).c_str(), output, espresponse);
|
||||||
if (!plain) {
|
if (!plain) {
|
||||||
ESPCOM::print (F ("\",\"SIGNAL\":\""), output, espresponse);
|
ESPCOM::print (F ("\",\"SIGNAL\":\""), output, espresponse);
|
||||||
} else {
|
} else {
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//version and sources location
|
//version and sources location
|
||||||
#define FW_VERSION "2.1.1.b7"
|
#define FW_VERSION "2.1.1.b8"
|
||||||
#define REPOSITORY "https://github.com/luc-github/ESP3D"
|
#define REPOSITORY "https://github.com/luc-github/ESP3D"
|
||||||
|
|
||||||
//Customize ESP3D ////////////////////////////////////////////////////////////////////////
|
//Customize ESP3D ////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user