Skip to content

Commit fa9b87f

Browse files
committed
Add command for SSID/PASSWORD/AP or STA/DHCP or STATIC
[ESP100]<SSID> : SSID [ESP101]<Password> : Password [ESP103]STA : Station mode [ESP103]AP : AP mode [ESP103]STATIC : IP Static [ESP103]DHCP : use DHCP
1 parent e86ea98 commit fa9b87f

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,18 @@ Currently, I tested on ESP01 using 64K SPIFFS ( please use data directory conten
105105
*from printer/host to module (not fully implemented)
106106
-request configuration/status
107107
-set AP/STATION,SSID,PASSSWORD,DHC/STATIC,IP,MASK,GW,BAUD from serial
108-
-restart module from host/printer: [ESP888]RESTART (done)
109-
-Get IP (only printer see answer): [ESP111]M117 (done)
110-
-reset EEPROM and restart: [ESP444]RESET
111-
-display EEPROM content: [ESP444]CONFIG
112-
-go to safe mode without restart: [ESP444]SAFEMODE
108+
-restart module from host/printer: [ESP888]RESTART
109+
-Get IP (only printer see answer): [ESP111]M117
110+
-reset EEPROM and restart: [ESP444]RESET
111+
-display EEPROM content: [ESP444]CONFIG
112+
-go to safe mode without restart: [ESP444]SAFEMODE
113+
-SSID: [ESP100]<SSID>
114+
-Password: [ESP101]<Password>
115+
-Station mode: [ESP103]STA
116+
-AP mode: [ESP103]AP
117+
-IP Static: [ESP103]STATIC
118+
-IP DHCP: [ESP103]DHCP
119+
113120

114121
##Front End (implemented)
115122
--Display printer status (done)

esp8266/command.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,31 @@ void COMMAND::execute_command(int cmd,String cmd_params)
3636

3737
switch(cmd)
3838
{
39+
byte mode;
3940
case 800:
4041
Serial.println("\nCommand received");
4142
break;
43+
case 100:
44+
if(!CONFIG::write_string(EP_SSID,cmd_params.c_str()))Serial.println("\nError");
45+
else Serial.println("\nOk");
46+
break;
47+
case 101:
48+
if(!CONFIG::write_string(EP_PASSWORD,cmd_params.c_str()))Serial.println("\nError");
49+
else Serial.println("\nOk");
50+
break;
51+
case 103:
52+
53+
if (cmd_params=="STA")mode = CLIENT_MODE;
54+
else mode=AP_MODE;
55+
if(!CONFIG::write_byte(EP_WIFI_MODE,mode))Serial.println("\nError");
56+
else Serial.println("\nOk");
57+
break;
58+
case 104:
59+
if (cmd_params=="STATIC")mode = STATIC_IP_MODE;
60+
else mode=DHCP_MODE;
61+
if(!CONFIG::write_byte(EP_IP_MODE,mode))Serial.println("\nError");
62+
else Serial.println("\nOk");
63+
break;
4264
case 111:
4365
{
4466
String currentIP ;

0 commit comments

Comments
 (0)