Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
3d5c54ce
Commit
3d5c54ce
authored
Sep 14, 2015
by
Robert Foss
Browse files
Moved all debug prints into the NODE_DEBUG macro.
parent
3a05c3e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/modules/enduser_setup.c
View file @
3d5c54ce
...
@@ -18,12 +18,6 @@
...
@@ -18,12 +18,6 @@
#define PRINT_FUNC
#define PRINT_FUNC
#endif
#endif
#define PRINT_DEBUG_ENABLE 0
#if PRINT_DEBUG_ENABLE
#define PRINT_DEBUG c_printf
#else
#define PRINT_DEBUG
#endif
/**
/**
* DNS Response Packet:
* DNS Response Packet:
...
@@ -109,7 +103,7 @@ static void enduser_setup_check_station(void)
...
@@ -109,7 +103,7 @@ static void enduser_setup_check_station(void)
wifi_station_get_config
(
&
cnf
);
wifi_station_get_config
(
&
cnf
);
uint8_t
*
ip_byte
=
(
uint8_t
*
)
&
(
ip
.
ip
);
uint8_t
*
ip_byte
=
(
uint8_t
*
)
&
(
ip
.
ip
);
c_printf
(
"Connected to
\"
%s
\"
as %u.%u.%u.%u
\n
"
,
cnf
.
ssid
,
IP2STR
(
&
ip
));
NODE_DEBUG
(
"Connected to
\"
%s
\"
as %u.%u.%u.%u
\n
"
,
cnf
.
ssid
,
IP2STR
(
&
ip
));
enduser_setup_stop
(
NULL
);
enduser_setup_stop
(
NULL
);
}
}
...
@@ -181,7 +175,7 @@ static int enduser_setup_http_load_payload(void)
...
@@ -181,7 +175,7 @@ static int enduser_setup_http_load_payload(void)
if
(
f
==
0
||
err
==
-
1
||
err2
==
-
1
)
if
(
f
==
0
||
err
==
-
1
||
err2
==
-
1
)
{
{
c_printf
(
"enduser_setup_http_load_payload unable to load file
\"
%s
\"
, loading backup HTML.
\n
"
,
http_html_filename
);
NODE_DEBUG
(
"enduser_setup_http_load_payload unable to load file
\"
%s
\"
, loading backup HTML.
\n
"
,
http_html_filename
);
int
payload_len
=
sizeof
(
http_header_200
)
+
sizeof
(
http_html_backup
);
int
payload_len
=
sizeof
(
http_header_200
)
+
sizeof
(
http_html_backup
);
http_payload
.
len
=
payload_len
;
http_payload
.
len
=
payload_len
;
...
@@ -307,36 +301,36 @@ static int enduser_setup_http_handle_credentials(char *data, unsigned short data
...
@@ -307,36 +301,36 @@ static int enduser_setup_http_handle_credentials(char *data, unsigned short data
int
err
=
wifi_set_opmode
(
STATION_MODE
|
wifi_get_opmode
());
int
err
=
wifi_set_opmode
(
STATION_MODE
|
wifi_get_opmode
());
if
(
err
==
FALSE
)
if
(
err
==
FALSE
)
{
{
c_printf
(
"enduser_setup_station_start failed. wifi_set_opmode failed.
\n
"
);
NODE_DEBUG
(
"enduser_setup_station_start failed. wifi_set_opmode failed.
\n
"
);
wifi_set_opmode
(
~
STATION_MODE
&
wifi_get_opmode
());
wifi_set_opmode
(
~
STATION_MODE
&
wifi_get_opmode
());
return
2
;
return
2
;
}
}
err
=
wifi_station_set_config
(
&
cnf
);
err
=
wifi_station_set_config
(
&
cnf
);
if
(
err
==
FALSE
)
if
(
err
==
FALSE
)
{
{
c_printf
(
"enduser_setup_station_start failed. wifi_station_set_config failed.
\n
"
);
NODE_DEBUG
(
"enduser_setup_station_start failed. wifi_station_set_config failed.
\n
"
);
wifi_set_opmode
(
~
STATION_MODE
&
wifi_get_opmode
());
wifi_set_opmode
(
~
STATION_MODE
&
wifi_get_opmode
());
return
2
;
return
2
;
}
}
err
=
wifi_station_disconnect
();
err
=
wifi_station_disconnect
();
if
(
err
==
FALSE
)
if
(
err
==
FALSE
)
{
{
c_printf
(
"enduser_setup_station_start failed. wifi_station_disconnect failed.
\n
"
);
NODE_DEBUG
(
"enduser_setup_station_start failed. wifi_station_disconnect failed.
\n
"
);
}
}
err
=
wifi_station_connect
();
err
=
wifi_station_connect
();
if
(
err
==
FALSE
)
if
(
err
==
FALSE
)
{
{
c_printf
(
"enduser_setup_station_start failed. wifi_station_connect failed.
\n
"
);
NODE_DEBUG
(
"enduser_setup_station_start failed. wifi_station_connect failed.
\n
"
);
}
}
c_printf
(
"
\n
"
);
NODE_DEBUG
(
"
\n
"
);
c_printf
(
"WiFi Credentials Stored
\n
"
);
NODE_DEBUG
(
"WiFi Credentials Stored
\n
"
);
c_printf
(
"-----------------------
\n
"
);
NODE_DEBUG
(
"-----------------------
\n
"
);
c_printf
(
"name:
\"
%s
\"\n
"
,
cnf
.
ssid
);
NODE_DEBUG
(
"name:
\"
%s
\"\n
"
,
cnf
.
ssid
);
c_printf
(
"pass:
\"
%s
\"\n
"
,
cnf
.
password
);
NODE_DEBUG
(
"pass:
\"
%s
\"\n
"
,
cnf
.
password
);
c_printf
(
"bssid_set: %u
\n
"
,
cnf
.
bssid_set
);
NODE_DEBUG
(
"bssid_set: %u
\n
"
,
cnf
.
bssid_set
);
c_printf
(
"bssid:
\"
%s
\"\n
"
,
cnf
.
bssid
);
NODE_DEBUG
(
"bssid:
\"
%s
\"\n
"
,
cnf
.
bssid
);
c_printf
(
"-----------------------
\n\n
"
);
NODE_DEBUG
(
"-----------------------
\n\n
"
);
return
0
;
return
0
;
}
}
...
@@ -354,17 +348,17 @@ static int enduser_setup_http_serve_header(struct espconn *http_client, char *he
...
@@ -354,17 +348,17 @@ static int enduser_setup_http_serve_header(struct espconn *http_client, char *he
int8_t
err
=
espconn_sent
(
http_client
,
header
,
header_len
);
int8_t
err
=
espconn_sent
(
http_client
,
header
,
header_len
);
if
(
err
==
ESPCONN_MEM
)
if
(
err
==
ESPCONN_MEM
)
{
{
c_printf
(
"enduser_setup_http_serve_header failed. espconn_send out of memory
\n
"
);
NODE_DEBUG
(
"enduser_setup_http_serve_header failed. espconn_send out of memory
\n
"
);
return
1
;
return
1
;
}
}
else
if
(
err
==
ESPCONN_ARG
)
else
if
(
err
==
ESPCONN_ARG
)
{
{
c_printf
(
"enduser_setup_http_serve_header failed. espconn_send can't find network transmission
\n
"
);
NODE_DEBUG
(
"enduser_setup_http_serve_header failed. espconn_send can't find network transmission
\n
"
);
return
1
;
return
1
;
}
}
else
if
(
err
!=
0
)
else
if
(
err
!=
0
)
{
{
c_printf
(
"enduser_setup_http_serve_header failed. espconn_send failed
\n
"
);
NODE_DEBUG
(
"enduser_setup_http_serve_header failed. espconn_send failed
\n
"
);
return
1
;
return
1
;
}
}
...
@@ -389,17 +383,17 @@ static int enduser_setup_http_serve_html(struct espconn *http_client)
...
@@ -389,17 +383,17 @@ static int enduser_setup_http_serve_html(struct espconn *http_client)
int8_t
err
=
espconn_sent
(
http_client
,
http_payload
.
data
,
http_payload
.
len
);
int8_t
err
=
espconn_sent
(
http_client
,
http_payload
.
data
,
http_payload
.
len
);
if
(
err
==
ESPCONN_MEM
)
if
(
err
==
ESPCONN_MEM
)
{
{
c_printf
(
"enduser_setup_http_serve_html failed. espconn_send out of memory
\n
"
);
NODE_DEBUG
(
"enduser_setup_http_serve_html failed. espconn_send out of memory
\n
"
);
return
1
;
return
1
;
}
}
else
if
(
err
==
ESPCONN_ARG
)
else
if
(
err
==
ESPCONN_ARG
)
{
{
c_printf
(
"enduser_setup_http_serve_html failed. espconn_send can't find network transmission
\n
"
);
NODE_DEBUG
(
"enduser_setup_http_serve_html failed. espconn_send can't find network transmission
\n
"
);
return
1
;
return
1
;
}
}
else
if
(
err
!=
0
)
else
if
(
err
!=
0
)
{
{
c_printf
(
"enduser_setup_http_serve_html failed. espconn_send failed
\n
"
);
NODE_DEBUG
(
"enduser_setup_http_serve_html failed. espconn_send failed
\n
"
);
return
1
;
return
1
;
}
}
...
@@ -440,13 +434,13 @@ static void enduser_setup_http_recvcb(void *arg, char *data, unsigned short data
...
@@ -440,13 +434,13 @@ static void enduser_setup_http_recvcb(void *arg, char *data, unsigned short data
}
}
else
if
(
retval
==
2
)
else
if
(
retval
==
2
)
{
{
c_printf
(
"enduser_setup_http_recvcb failed. Failed to handle wifi credentials.
\n
"
);
NODE_DEBUG
(
"enduser_setup_http_recvcb failed. Failed to handle wifi credentials.
\n
"
);
return
;
return
;
}
}
if
(
retval
!=
1
)
if
(
retval
!=
1
)
{
{
c_printf
(
"enduser_setup_http_recvcb failed. Unknown error code #%u.
\n
"
,
retval
);
NODE_DEBUG
(
"enduser_setup_http_recvcb failed. Unknown error code #%u.
\n
"
,
retval
);
return
;
return
;
}
}
...
@@ -462,7 +456,7 @@ static void enduser_setup_http_recvcb(void *arg, char *data, unsigned short data
...
@@ -462,7 +456,7 @@ static void enduser_setup_http_recvcb(void *arg, char *data, unsigned short data
retval
=
enduser_setup_http_serve_html
(
http_client
);
retval
=
enduser_setup_http_serve_html
(
http_client
);
if
(
retval
!=
0
)
if
(
retval
!=
0
)
{
{
c_printf
(
"enduser_setup_http_recvcb failed. Unable to send HTML.
\n
"
);
NODE_DEBUG
(
"enduser_setup_http_recvcb failed. Unable to send HTML.
\n
"
);
enduser_setup_http_disconnect
(
http_client
);
enduser_setup_http_disconnect
(
http_client
);
}
}
}
}
...
@@ -479,7 +473,7 @@ static void enduser_setup_http_connectcb(void *arg)
...
@@ -479,7 +473,7 @@ static void enduser_setup_http_connectcb(void *arg)
if
(
err
!=
0
)
if
(
err
!=
0
)
{
{
c_printf
(
"enduser_setup_http_connectcb failed. Callback registration failed.
\n
"
);
NODE_DEBUG
(
"enduser_setup_http_connectcb failed. Callback registration failed.
\n
"
);
}
}
}
}
...
@@ -490,20 +484,20 @@ static void enduser_setup_http_start(void)
...
@@ -490,20 +484,20 @@ static void enduser_setup_http_start(void)
if
(
espconn_http_tcp
!=
NULL
)
if
(
espconn_http_tcp
!=
NULL
)
{
{
c_printf
(
"enduser_setup_http_start failed. Appears to already be started (espconn_http_tcp != NULL).
\n
"
);
NODE_DEBUG
(
"enduser_setup_http_start failed. Appears to already be started (espconn_http_tcp != NULL).
\n
"
);
return
;
return
;
}
}
espconn_http_tcp
=
(
struct
espconn
*
)
c_malloc
(
sizeof
(
struct
espconn
));
espconn_http_tcp
=
(
struct
espconn
*
)
c_malloc
(
sizeof
(
struct
espconn
));
if
(
espconn_http_tcp
==
NULL
)
if
(
espconn_http_tcp
==
NULL
)
{
{
c_printf
(
"enduser_setup_http_start failed. Memory allocation failed (espconn_http_tcp == NULL).
\n
"
);
NODE_DEBUG
(
"enduser_setup_http_start failed. Memory allocation failed (espconn_http_tcp == NULL).
\n
"
);
return
;
return
;
}
}
esp_tcp
*
esp_tcp_data
=
(
esp_tcp
*
)
c_malloc
(
sizeof
(
esp_tcp
));
esp_tcp
*
esp_tcp_data
=
(
esp_tcp
*
)
c_malloc
(
sizeof
(
esp_tcp
));
if
(
esp_tcp_data
==
NULL
)
if
(
esp_tcp_data
==
NULL
)
{
{
c_printf
(
"enduser_setup_http_start failed. Memory allocation failed (esp_udp == NULL).
\n
"
);
NODE_DEBUG
(
"enduser_setup_http_start failed. Memory allocation failed (esp_udp == NULL).
\n
"
);
enduser_setup_http_free
();
enduser_setup_http_free
();
return
;
return
;
}
}
...
@@ -519,7 +513,7 @@ static void enduser_setup_http_start(void)
...
@@ -519,7 +513,7 @@ static void enduser_setup_http_start(void)
err
=
espconn_regist_connectcb
(
espconn_http_tcp
,
enduser_setup_http_connectcb
);
err
=
espconn_regist_connectcb
(
espconn_http_tcp
,
enduser_setup_http_connectcb
);
if
(
err
!=
0
)
if
(
err
!=
0
)
{
{
c_printf
(
"enduser_setup_http_start failed. Couldn't add receive callback, ERRROR #%u.
\n
"
,
err
);
NODE_DEBUG
(
"enduser_setup_http_start failed. Couldn't add receive callback, ERRROR #%u.
\n
"
,
err
);
enduser_setup_http_free
();
enduser_setup_http_free
();
return
;
return
;
}
}
...
@@ -527,25 +521,25 @@ static void enduser_setup_http_start(void)
...
@@ -527,25 +521,25 @@ static void enduser_setup_http_start(void)
err
=
espconn_accept
(
espconn_http_tcp
);
err
=
espconn_accept
(
espconn_http_tcp
);
if
(
err
==
ESPCONN_ISCONN
)
if
(
err
==
ESPCONN_ISCONN
)
{
{
c_printf
(
"enduser_setup_http_start failed. Couldn't create connection, already listening for that connection.
\n
"
);
NODE_DEBUG
(
"enduser_setup_http_start failed. Couldn't create connection, already listening for that connection.
\n
"
);
enduser_setup_http_free
();
enduser_setup_http_free
();
return
;
return
;
}
}
else
if
(
err
==
ESPCONN_MEM
)
else
if
(
err
==
ESPCONN_MEM
)
{
{
c_printf
(
"enduser_setup_http_start failed. Couldn't create connection, out of memory.
\n
"
);
NODE_DEBUG
(
"enduser_setup_http_start failed. Couldn't create connection, out of memory.
\n
"
);
enduser_setup_http_free
();
enduser_setup_http_free
();
return
;
return
;
}
}
else
if
(
err
==
ESPCONN_ARG
)
else
if
(
err
==
ESPCONN_ARG
)
{
{
c_printf
(
"enduser_setup_http_start failed. Can't find connection from espconn argument
\n
"
);
NODE_DEBUG
(
"enduser_setup_http_start failed. Can't find connection from espconn argument
\n
"
);
enduser_setup_http_free
();
enduser_setup_http_free
();
return
;
return
;
}
}
else
if
(
err
!=
0
)
else
if
(
err
!=
0
)
{
{
c_printf
(
"enduser_setup_http_start failed. ERRROR #%u
\n
"
,
err
);
NODE_DEBUG
(
"enduser_setup_http_start failed. ERRROR #%u
\n
"
,
err
);
enduser_setup_http_free
();
enduser_setup_http_free
();
return
;
return
;
}
}
...
@@ -553,7 +547,7 @@ static void enduser_setup_http_start(void)
...
@@ -553,7 +547,7 @@ static void enduser_setup_http_start(void)
err
=
espconn_regist_time
(
espconn_http_tcp
,
2
,
0
);
err
=
espconn_regist_time
(
espconn_http_tcp
,
2
,
0
);
if
(
err
==
ESPCONN_ARG
)
if
(
err
==
ESPCONN_ARG
)
{
{
c_printf
(
"enduser_setup_http_start failed. Unable to set TCP timeout.
\n
"
);
NODE_DEBUG
(
"enduser_setup_http_start failed. Unable to set TCP timeout.
\n
"
);
enduser_setup_http_free
();
enduser_setup_http_free
();
return
;
return
;
}
}
...
@@ -565,7 +559,7 @@ static void enduser_setup_http_start(void)
...
@@ -565,7 +559,7 @@ static void enduser_setup_http_start(void)
}
}
else
if
(
err
==
2
)
else
if
(
err
==
2
)
{
{
c_printf
(
"enduser_setup_http_start failed. Unable to allocate memory for HTTP payload.
\n
"
);
NODE_DEBUG
(
"enduser_setup_http_start failed. Unable to allocate memory for HTTP payload.
\n
"
);
enduser_setup_http_free
();
enduser_setup_http_free
();
return
;
return
;
}
}
...
@@ -578,18 +572,18 @@ static void enduser_setup_http_stop(void)
...
@@ -578,18 +572,18 @@ static void enduser_setup_http_stop(void)
if
(
espconn_http_tcp
==
NULL
)
if
(
espconn_http_tcp
==
NULL
)
{
{
c_printf
(
"enduser_setup_http_stop failed. enduser_setup not enabled (espconn_dns_udp == NULL).
\n
"
);
NODE_DEBUG
(
"enduser_setup_http_stop failed. enduser_setup not enabled (espconn_dns_udp == NULL).
\n
"
);
return
;
return
;
}
}
int8_t
err
=
espconn_delete
(
espconn_http_tcp
);
int8_t
err
=
espconn_delete
(
espconn_http_tcp
);
if
(
err
==
ESPCONN_ARG
)
if
(
err
==
ESPCONN_ARG
)
{
{
c_printf
(
"enduser_setup_http_stop failed. espconn_delete returned ESPCONN_ARG. Can't find network transmission described.
\n
"
);
NODE_DEBUG
(
"enduser_setup_http_stop failed. espconn_delete returned ESPCONN_ARG. Can't find network transmission described.
\n
"
);
}
}
else
if
(
err
!=
0
)
else
if
(
err
!=
0
)
{
{
c_printf
(
"enduser_setup_http_stop failed. espconn_delete returned ERROR #%u.
\n
"
,
err
);
NODE_DEBUG
(
"enduser_setup_http_stop failed. espconn_delete returned ERROR #%u.
\n
"
,
err
);
}
}
enduser_setup_http_free
();
enduser_setup_http_free
();
...
@@ -631,13 +625,13 @@ static void enduser_setup_dns_recv_callback(void *arg, char *recv_data, unsigned
...
@@ -631,13 +625,13 @@ static void enduser_setup_dns_recv_callback(void *arg, char *recv_data, unsigned
uint8_t
if_mode
=
wifi_get_opmode
();
uint8_t
if_mode
=
wifi_get_opmode
();
if
((
if_mode
&
SOFTAP_MODE
)
==
0
)
if
((
if_mode
&
SOFTAP_MODE
)
==
0
)
{
{
c_printf
(
"enduser_setup_dns_recv_callback failed. Interface mode %d not supported.
\n
"
,
if_mode
);
NODE_DEBUG
(
"enduser_setup_dns_recv_callback failed. Interface mode %d not supported.
\n
"
,
if_mode
);
return
;
return
;
}
}
uint8_t
if_index
=
(
if_mode
==
STATION_MODE
?
STATION_IF
:
SOFTAP_IF
);
uint8_t
if_index
=
(
if_mode
==
STATION_MODE
?
STATION_IF
:
SOFTAP_IF
);
if
(
wifi_get_ip_info
(
if_index
,
&
ip_info
)
==
false
)
if
(
wifi_get_ip_info
(
if_index
,
&
ip_info
)
==
false
)
{
{
c_printf
(
"enduser_setup_dns_recv_callback failed. Unable to get interface IP.
\n
"
);
NODE_DEBUG
(
"enduser_setup_dns_recv_callback failed. Unable to get interface IP.
\n
"
);
return
;
return
;
}
}
...
@@ -648,7 +642,7 @@ static void enduser_setup_dns_recv_callback(void *arg, char *recv_data, unsigned
...
@@ -648,7 +642,7 @@ static void enduser_setup_dns_recv_callback(void *arg, char *recv_data, unsigned
char
*
dns_reply
=
(
char
*
)
c_malloc
(
dns_reply_len
);
char
*
dns_reply
=
(
char
*
)
c_malloc
(
dns_reply_len
);
if
(
dns_reply
==
NULL
)
if
(
dns_reply
==
NULL
)
{
{
c_printf
(
"enduser_setup_dns_recv_callback failed. Failed to allocate memory.
\n
"
);
NODE_DEBUG
(
"enduser_setup_dns_recv_callback failed. Failed to allocate memory.
\n
"
);
return
;
return
;
}
}
...
@@ -668,17 +662,17 @@ static void enduser_setup_dns_recv_callback(void *arg, char *recv_data, unsigned
...
@@ -668,17 +662,17 @@ static void enduser_setup_dns_recv_callback(void *arg, char *recv_data, unsigned
c_free
(
dns_reply
);
c_free
(
dns_reply
);
if
(
err
==
ESPCONN_MEM
)
if
(
err
==
ESPCONN_MEM
)
{
{
c_printf
(
"enduser_setup_dns_recv_callback failed. Failed to allocate memory for send.
\n
"
);
NODE_DEBUG
(
"enduser_setup_dns_recv_callback failed. Failed to allocate memory for send.
\n
"
);
return
;
return
;
}
}
else
if
(
err
==
ESPCONN_ARG
)
else
if
(
err
==
ESPCONN_ARG
)
{
{
c_printf
(
"enduser_setup_dns_recv_callback failed. Can't execute transmission.
\n
"
);
NODE_DEBUG
(
"enduser_setup_dns_recv_callback failed. Can't execute transmission.
\n
"
);
return
;
return
;
}
}
else
if
(
err
!=
0
)
else
if
(
err
!=
0
)
{
{
c_printf
(
"enduser_setup_dns_recv_callback failed. espconn_send failed
\n
"
);
NODE_DEBUG
(
"enduser_setup_dns_recv_callback failed. espconn_send failed
\n
"
);
return
;
return
;
}
}
}
}
...
@@ -706,20 +700,20 @@ static void enduser_setup_dns_start(void)
...
@@ -706,20 +700,20 @@ static void enduser_setup_dns_start(void)
if
(
espconn_dns_udp
!=
NULL
)
if
(
espconn_dns_udp
!=
NULL
)
{
{
c_printf
(
"enduser_setup_dns_start failed. Appears to already be started (espconn_dns_udp != NULL).
\n
"
);
NODE_DEBUG
(
"enduser_setup_dns_start failed. Appears to already be started (espconn_dns_udp != NULL).
\n
"
);
return
;
return
;
}
}
espconn_dns_udp
=
(
struct
espconn
*
)
c_malloc
(
sizeof
(
struct
espconn
));
espconn_dns_udp
=
(
struct
espconn
*
)
c_malloc
(
sizeof
(
struct
espconn
));
if
(
espconn_dns_udp
==
NULL
)
if
(
espconn_dns_udp
==
NULL
)
{
{
c_printf
(
"enduser_setup_dns_start failed. Memory allocation failed (espconn_dns_udp == NULL).
\n
"
);
NODE_DEBUG
(
"enduser_setup_dns_start failed. Memory allocation failed (espconn_dns_udp == NULL).
\n
"
);
return
;
return
;
}
}
esp_udp
*
esp_udp_data
=
(
esp_udp
*
)
c_malloc
(
sizeof
(
esp_udp
));
esp_udp
*
esp_udp_data
=
(
esp_udp
*
)
c_malloc
(
sizeof
(
esp_udp
));
if
(
esp_udp_data
==
NULL
)
if
(
esp_udp_data
==
NULL
)
{
{
c_printf
(
"enduser_setup_dns_start failed. Memory allocation failed (esp_udp == NULL).
\n
"
);
NODE_DEBUG
(
"enduser_setup_dns_start failed. Memory allocation failed (esp_udp == NULL).
\n
"
);
enduser_setup_dns_free
();
enduser_setup_dns_free
();
return
;
return
;
}
}
...
@@ -735,7 +729,7 @@ static void enduser_setup_dns_start(void)
...
@@ -735,7 +729,7 @@ static void enduser_setup_dns_start(void)
err
=
espconn_regist_recvcb
(
espconn_dns_udp
,
enduser_setup_dns_recv_callback
);
err
=
espconn_regist_recvcb
(
espconn_dns_udp
,
enduser_setup_dns_recv_callback
);
if
(
err
!=
0
)
if
(
err
!=
0
)
{
{
c_printf
(
"enduser_setup_dns_start failed. Couldn't add receive callback, ERRROR #%d.
\n
"
,
err
);
NODE_DEBUG
(
"enduser_setup_dns_start failed. Couldn't add receive callback, ERRROR #%d.
\n
"
,
err
);
enduser_setup_dns_free
();
enduser_setup_dns_free
();
return
;
return
;
}
}
...
@@ -743,19 +737,19 @@ static void enduser_setup_dns_start(void)
...
@@ -743,19 +737,19 @@ static void enduser_setup_dns_start(void)
err
=
espconn_create
(
espconn_dns_udp
);
err
=
espconn_create
(
espconn_dns_udp
);
if
(
err
==
ESPCONN_ISCONN
)
if
(
err
==
ESPCONN_ISCONN
)
{
{
c_printf
(
"enduser_setup_dns_start failed. Couldn't create connection, already listening for that connection.
\n
"
);
NODE_DEBUG
(
"enduser_setup_dns_start failed. Couldn't create connection, already listening for that connection.
\n
"
);
enduser_setup_dns_free
();
enduser_setup_dns_free
();
return
;
return
;
}
}
else
if
(
err
==
ESPCONN_MEM
)
else
if
(
err
==
ESPCONN_MEM
)
{
{
c_printf
(
"enduser_setup_dns_start failed. Couldn't create connection, out of memory.
\n
"
);
NODE_DEBUG
(
"enduser_setup_dns_start failed. Couldn't create connection, out of memory.
\n
"
);
enduser_setup_dns_free
();
enduser_setup_dns_free
();
return
;
return
;
}
}
else
if
(
err
!=
0
)
else
if
(
err
!=
0
)
{
{
c_printf
(
"enduser_setup_dns_start failed. Couldn't create connection, ERROR #%d.
\n
"
,
err
);
NODE_DEBUG
(
"enduser_setup_dns_start failed. Couldn't create connection, ERROR #%d.
\n
"
,
err
);
enduser_setup_dns_free
();
enduser_setup_dns_free
();
return
;
return
;
}
}
...
@@ -768,18 +762,18 @@ static void enduser_setup_dns_stop(void)
...
@@ -768,18 +762,18 @@ static void enduser_setup_dns_stop(void)
if
(
espconn_dns_udp
==
NULL
)
if
(
espconn_dns_udp
==
NULL
)
{
{
c_printf
(
"enduser_setup_dns_stop failed. Hijacker not enabled (espconn_dns_udp == NULL).
\n
"
);
NODE_DEBUG
(
"enduser_setup_dns_stop failed. Hijacker not enabled (espconn_dns_udp == NULL).
\n
"
);
return
;
return
;
}
}
int8_t
err
=
espconn_delete
(
espconn_dns_udp
);
int8_t
err
=
espconn_delete
(
espconn_dns_udp
);
if
(
err
==
ESPCONN_ARG
)
if
(
err
==
ESPCONN_ARG
)
{
{
c_printf
(
"enduser_setup_http_stop failed. espconn_delete returned ESPCONN_ARG. Can't find network transmission described.
\n
"
);
NODE_DEBUG
(
"enduser_setup_http_stop failed. espconn_delete returned ESPCONN_ARG. Can't find network transmission described.
\n
"
);
}
}
else
if
(
err
!=
0
)
else
if
(
err
!=
0
)
{
{
c_printf
(
"enduser_setup_http_stop failed. espconn_delete returned ERROR #%u.
\n
"
,
err
);
NODE_DEBUG
(
"enduser_setup_http_stop failed. espconn_delete returned ERROR #%u.
\n
"
,
err
);
}
}
enduser_setup_dns_free
();
enduser_setup_dns_free
();
...
@@ -788,11 +782,6 @@ static void enduser_setup_dns_stop(void)
...
@@ -788,11 +782,6 @@ static void enduser_setup_dns_stop(void)
static
int
enduser_setup_start
(
lua_State
*
L
)
static
int
enduser_setup_start
(
lua_State
*
L
)
{
{
c_printf
(
"
\n
"
);
c_printf
(
"-------------------
\n
"
);
c_printf
(
"enduser_setup_start
\n
"
);
c_printf
(
"-------------------
\n\n
"
);
enduser_setup_check_station_start
();
enduser_setup_check_station_start
();
enduser_setup_ap_start
();
enduser_setup_ap_start
();
enduser_setup_dns_start
();
enduser_setup_dns_start
();
...
@@ -804,11 +793,6 @@ static int enduser_setup_start(lua_State* L)
...
@@ -804,11 +793,6 @@ static int enduser_setup_start(lua_State* L)
static
int
enduser_setup_stop
(
lua_State
*
L
)
static
int
enduser_setup_stop
(
lua_State
*
L
)
{
{
c_printf
(
"
\n
"
);
c_printf
(
"------------------
\n
"
);
c_printf
(
"enduser_setup_stop
\n
"
);
c_printf
(
"------------------
\n\n
"
);
enduser_setup_check_station_stop
();
enduser_setup_check_station_stop
();
enduser_setup_ap_stop
();
enduser_setup_ap_stop
();
enduser_setup_dns_stop
();
enduser_setup_dns_stop
();
...
...
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