Add IP query command and Module reset command

"[ESP111]<pre display>" show IP with <pre display> command
"[ESP111]" will show 192.168.x.xxx
"[ESP111]M117 " will show M117 192.168.x.xxx

"[ESP888]RESTART" will show RESTART and restart module
This commit is contained in:
luc 2015-09-30 14:50:58 +08:00
parent 10f1f9d68d
commit beca36448f

View File

@ -19,6 +19,7 @@
*/ */
#include "command.h" #include "command.h"
#include "config.h"
#include "webinterface.h" #include "webinterface.h"
extern "C" { extern "C" {
#include "user_interface.h" #include "user_interface.h"
@ -37,6 +38,26 @@ void COMMAND::execute_command(int cmd,String cmd_params)
case 800: case 800:
Serial.println("\nCommand received"); Serial.println("\nCommand received");
break; break;
case 111:
{
String currentIP ;
if (wifi_get_opmode()==WIFI_STA)currentIP=WiFi.localIP().toString();
else currentIP=WiFi.softAPIP().toString();
Serial.print("\n\r");
Serial.print(cmd_params);
Serial.println(currentIP);
Serial.print("\r\n");
}
break;
case 888:
if (cmd_params=="RESTART")
{
Serial.print("\r");
Serial.print(cmd_params);
web_interface->restartmodule=true;
Serial.print("\r\n");
}
break;
//default: //default:
} }