@@ -26,6 +26,7 @@ ESP8266WebServer server (80);
26
26
String clockName = " " ;
27
27
String w_ssid;
28
28
String w_psk;
29
+ String httpUpdateResponse;
29
30
long timezone ;
30
31
IPAddress timeServer (129 , 6 , 15 , 28 );
31
32
time_t prevDisplay = 0 ;
@@ -41,38 +42,38 @@ void handleRoot() {
41
42
s.replace (" @@NTPINT@@" , String (syncInterval));
42
43
s.replace (" @@SYNCSTATUS@@" , timeStatus () == timeSet ? " OK" : " Overdue" );
43
44
s.replace (" @@CLOCKNAME@@" , clockName);
45
+ s.replace (" @@UPDATERESPONSE@@" , httpUpdateResponse);
46
+ httpUpdateResponse = " " ;
44
47
server.send (200 , " text/html" , s);
45
48
}
46
49
47
50
void handleForm () {
48
- String response = " The following was changed:\r\n\r\n " ;
49
51
String update_wifi = server.arg (" update_wifi" );
50
52
String t_ssid = server.arg (" ssid" );
51
53
String t_psk = server.arg (" psk" );
52
54
timeServer = parseIP (server.arg (" ntpsrv" ));
53
55
if (update_wifi == " 1" ) {
54
- response += " Wifi SSID set to: " + t_ssid + " \r\n " ;
55
- response += " Wifi PSK set to : " + t_psk + " \r\n " ;
56
56
w_ssid = t_ssid;
57
57
w_psk = t_psk;
58
58
}
59
59
String tz = server.arg (" timezone" );
60
60
61
61
if (tz.length ()) {
62
- response += " The timezone set to: " + tz + " h\r\n " ;
63
62
timezone = tz.toInt ();
64
63
}
65
- response += " The NTP server is set to: " + ipToString (timeServer) + " \r\n " ;
66
64
setTime (getNtpTime ());
67
65
68
66
String syncInt = server.arg (" ntpint" );
69
67
syncInterval = syncInt.toInt ();
70
- response += " The NTP sync interval is: " + syncInt + " s\r\n " ;
71
68
72
69
clockName = server.arg (" clockname" );
73
- response += " Clock name is: " + clockName;
74
70
75
- server.send (200 , " text/plain" , response);
71
+ httpUpdateResponse = " The configuration was updated." ;
72
+
73
+ // server.send(200, "text/plain", response);
74
+ server.sendHeader (" Location" , " /" );
75
+ server.send (302 , " text/plain" , " Moved" );
76
+ // handleRoot();
76
77
saveSettings ();
77
78
if (update_wifi == " 1" ) {
78
79
delay (500 );
0 commit comments