From beca36448fef4fc7f6e5a01c21f647b3f8db7324 Mon Sep 17 00:00:00 2001 From: luc Date: Wed, 30 Sep 2015 14:50:58 +0800 Subject: [PATCH] Add IP query command and Module reset command "[ESP111]
" show IP with 
 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
---
 esp8266/command.cpp | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/esp8266/command.cpp b/esp8266/command.cpp
index 4addc0c4..3aeae033 100644
--- a/esp8266/command.cpp
+++ b/esp8266/command.cpp
@@ -19,6 +19,7 @@
 */
 
 #include "command.h"
+#include "config.h"
 #include "webinterface.h"
 extern "C" {
 #include "user_interface.h"
@@ -37,6 +38,26 @@ void COMMAND::execute_command(int cmd,String cmd_params)
 		case 800:
 			Serial.println("\nCommand received");
 		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:
 
 	}