Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
a3d9d3ea
Commit
a3d9d3ea
authored
Mar 01, 2016
by
Johny Mattsson
Browse files
Include the SSID in enduser_setup status message.
For more userfriendly feedback.
parent
04889813
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/modules/enduser_setup.c
View file @
a3d9d3ea
...
@@ -637,15 +637,14 @@ static void serve_status (struct espconn *conn)
...
@@ -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)
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment