mirror of
https://github.com/nodemcu/nodemcu-firmware.git
synced 2025-01-30 21:12:55 +08:00
Include the SSID in enduser_setup status message.
For more userfriendly feedback.
This commit is contained in:
parent
04889813f3
commit
a3d9d3ea47
@ -637,15 +637,14 @@ static void serve_status (struct espconn *conn)
|
|||||||
"Content-type: text/plain\r\n"
|
"Content-type: text/plain\r\n"
|
||||||
"Content-length: %d\r\n"
|
"Content-length: %d\r\n"
|
||||||
"\r\n"
|
"\r\n"
|
||||||
"%s";
|
"%s%s";
|
||||||
const char *state[] =
|
const char *state[] =
|
||||||
{
|
{
|
||||||
"Idle",
|
"Idle",
|
||||||
"Connecting...",
|
"Connecting...",
|
||||||
"Failed to connect - wrong password",
|
"Failed to connect - wrong password",
|
||||||
"Failed to connect - network not found",
|
"Failed to connect - network not found",
|
||||||
"Failed to connect",
|
"Failed to connect"
|
||||||
"WiFi successfully connected!" /* TODO: include SSID */
|
|
||||||
};
|
};
|
||||||
const size_t num_states = sizeof(state)/sizeof(state[0]);
|
const size_t num_states = sizeof(state)/sizeof(state[0]);
|
||||||
|
|
||||||
@ -655,7 +654,17 @@ static void serve_status (struct espconn *conn)
|
|||||||
const char *s = state[which];
|
const char *s = state[which];
|
||||||
int len = c_strlen (s);
|
int len = c_strlen (s);
|
||||||
char buf[sizeof (fmt) + 10 + len]; /* more than enough for the formatted */
|
char buf[sizeof (fmt) + 10 + len]; /* more than enough for the formatted */
|
||||||
len = c_sprintf (buf, fmt, len, s);
|
len = c_sprintf (buf, fmt, len, s, "");
|
||||||
|
enduser_setup_http_serve_header (conn, buf, len);
|
||||||
|
}
|
||||||
|
else if (which == num_states)
|
||||||
|
{
|
||||||
|
struct station_config cnf = { 0, };
|
||||||
|
wifi_station_get_config (&cnf);
|
||||||
|
const char successmsg[] = "WiFi successfully connected to ";
|
||||||
|
int len = LITLEN(successmsg) + c_strlen (cnf.ssid);
|
||||||
|
char buf[sizeof (fmt) + sizeof (successmsg) + 32]; // max-ssid
|
||||||
|
len = c_sprintf (buf, fmt, len, successmsg, cnf.ssid);
|
||||||
enduser_setup_http_serve_header (conn, buf, len);
|
enduser_setup_http_serve_header (conn, buf, len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user