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
93140a89
Commit
93140a89
authored
Aug 24, 2021
by
Johny Mattsson
Browse files
Swap to luaL_pcallx for C module callbacks.
Bring on that stacktracey goodness!
parent
46f5079a
Changes
19
Hide whitespace changes
Inline
Side-by-side
components/modules/bthci.c
View file @
93140a89
...
...
@@ -271,7 +271,7 @@ static void invoke_cmd_q_callback (
else
lua_pushnil
(
L
);
// no error
lua_pushlstring
(
L
,
(
const
char
*
)
data
,
len
);
// extra bytes, if any
lua
_
call
(
L
,
2
,
0
);
lua
L_p
call
x
(
L
,
2
,
0
);
}
}
...
...
@@ -316,7 +316,7 @@ static void handle_hci_event (task_param_t arg, task_prio_t prio)
uint8_t
*
report
=
&
hci_event
[
5
];
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
adv_rep_cb_ref
);
lua_pushlstring
(
L
,
(
const
char
*
)
report
,
len
-
2
);
lua
_
call
(
L
,
1
,
0
);
lua
L_p
call
x
(
L
,
1
,
0
);
}
}
}
...
...
components/modules/can.c
View file @
93140a89
...
...
@@ -46,7 +46,7 @@ static void can_data_task( task_param_t param, task_prio_t prio ) {
lua_pushinteger
(
L
,
frame
->
MsgID
);
lua_pushlstring
(
L
,
(
char
*
)
frame
->
data
.
u8
,
frame
->
DLC
);
free
(
frame
);
lua
_
call
(
L
,
3
,
0
);
lua
L_p
call
x
(
L
,
3
,
0
);
}
// RTOS
...
...
components/modules/eth.c
View file @
93140a89
...
...
@@ -119,7 +119,7 @@ static void on_event(esp_event_base_t base, int32_t id, const void *data)
lua_pushstring
(
L
,
events
[
idx
].
name
);
lua_createtable
(
L
,
0
,
5
);
events
[
idx
].
fill_cb_arg
(
L
,
data
);
lua_pcall
(
L
,
2
,
0
,
0
);
lua
L
_pcall
x
(
L
,
2
,
0
);
lua_settop
(
L
,
top
);
}
...
...
components/modules/file.c
View file @
93140a89
...
...
@@ -58,7 +58,7 @@ static int32_t file_rtc_cb( vfs_time *tm )
lua_State
*
L
=
lua_getstate
();
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
rtc_cb_ref
);
lua
_
call
(
L
,
0
,
1
);
lua
L_p
call
x
(
L
,
0
,
1
);
if
(
lua_type
(
L
,
lua_gettop
(
L
)
)
==
LUA_TTABLE
)
{
table2tm
(
L
,
tm
);
...
...
components/modules/gpio.c
View file @
93140a89
...
...
@@ -235,7 +235,7 @@ static void nodemcu_gpio_callback_task (task_param_t param, task_prio_t prio)
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
gpio_cb_refs
[
gpio
]);
lua_pushinteger
(
L
,
gpio
);
lua_pushinteger
(
L
,
level
);
lua
_
call
(
L
,
2
,
0
);
lua
L_p
call
x
(
L
,
2
,
0
);
gpio_intr_enable
(
gpio
);
}
}
...
...
components/modules/http.c
View file @
93140a89
...
...
@@ -335,7 +335,7 @@ static int make_callback(lhttp_context_t *context, int id, void *data, size_t da
// Lowercase all header names
luaL_getmetafield
(
L
,
-
1
,
"lower"
);
lua_insert
(
L
,
-
2
);
lua
_
call
(
L
,
1
,
1
);
lua
L_p
call
x
(
L
,
1
,
1
);
char
*
val
=
item
->
data
+
item
->
len
+
1
;
lua_pushstring
(
L
,
val
);
lua_settable
(
L
,
-
3
);
...
...
@@ -366,7 +366,7 @@ static int make_callback(lhttp_context_t *context, int id, void *data, size_t da
if
(
id
!=
HTTP_REQUEST_COMPLETE
)
{
context_setflag
(
context
,
InCallback
);
}
int
err
=
lua_pcall
(
L
,
lua_gettop
(
L
)
-
1
,
1
,
0
);
int
err
=
lua
L
_pcall
x
(
L
,
lua_gettop
(
L
)
-
1
,
1
);
context_clearflag
(
context
,
InCallback
);
if
(
err
)
{
const
char
*
msg
=
lua_type
(
L
,
-
1
)
==
LUA_TSTRING
?
lua_tostring
(
L
,
-
1
)
:
"<?>"
;
...
...
@@ -657,7 +657,7 @@ static int http_accumulate_complete(lua_State *L)
context_setref
(
L
,
context
,
HeadersCallback
);
}
else
{
lua_rawgeti
(
L
,
cache_table
,
2
);
// headers
lua
_
call
(
L
,
3
,
0
);
lua
L_p
call
x
(
L
,
3
,
0
);
}
// unset this since it contains a reference to the context and would prevent the context to be garbage collected
context_unsetref
(
L
,
context
,
CompleteCallback
);
...
...
@@ -692,7 +692,7 @@ static int make_oneshot_request(lua_State *L, int callback_idx)
// Finally, call request
lua_pushcfunction
(
L
,
http_lapi_request
);
lua_pushvalue
(
L
,
-
2
);
// context
lua
_
call
(
L
,
1
,
0
);
lua
L_p
call
x
(
L
,
1
,
0
);
if
(
async
)
{
return
0
;
...
...
@@ -736,7 +736,7 @@ static int http_lapi_get(lua_State *L)
lua_pushinteger
(
L
,
HTTP_METHOD_GET
);
lua_pushvalue
(
L
,
2
);
// options
lua
_
call
(
L
,
3
,
1
);
// returns context
lua
L_p
call
x
(
L
,
3
,
1
);
// returns context
return
make_oneshot_request
(
L
,
3
);
}
...
...
@@ -768,12 +768,12 @@ static int http_lapi_post(lua_State *L)
lua_pushinteger
(
L
,
HTTP_METHOD_POST
);
lua_pushvalue
(
L
,
2
);
// options
lua
_
call
(
L
,
3
,
1
);
// returns context
lua
L_p
call
x
(
L
,
3
,
1
);
// returns context
lua_pushcfunction
(
L
,
http_lapi_setpostdata
);
lua_pushvalue
(
L
,
-
2
);
// context
lua_pushvalue
(
L
,
3
);
// body
lua
_
call
(
L
,
2
,
0
);
lua
L_p
call
x
(
L
,
2
,
0
);
return
make_oneshot_request
(
L
,
4
);
// 4 = callback idx
}
...
...
components/modules/i2c_hw_master.c
View file @
93140a89
...
...
@@ -111,7 +111,7 @@ static void i2c_transfer_task( task_param_t param, task_prio_t prio )
lua_pushnil
(
L
);
}
lua_pushboolean
(
L
,
job
->
err
==
ESP_OK
);
lua
_
call
(
L
,
2
,
0
);
lua
L_p
call
x
(
L
,
2
,
0
);
}
// free all memory
...
...
components/modules/i2c_hw_slave.c
View file @
93140a89
...
...
@@ -109,7 +109,7 @@ static void i2c_receive_task( task_param_t param, task_prio_t prio )
}
else
{
lua_pushnil
(
L
);
}
lua
_
call
(
L
,
2
,
0
);
lua
L_p
call
x
(
L
,
2
,
0
);
}
// free all memory
...
...
components/modules/i2s.c
View file @
93140a89
...
...
@@ -55,7 +55,7 @@ static void i2s_tx_task( task_param_t param, task_prio_t prio ) {
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
is
->
cb
);
lua_pushinteger
(
L
,
i2s_id
);
lua_pushstring
(
L
,
"tx"
);
lua
_
call
(
L
,
2
,
0
);
lua
L_p
call
x
(
L
,
2
,
0
);
}
}
...
...
@@ -68,7 +68,7 @@ static void i2s_rx_task( task_param_t param, task_prio_t prio ) {
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
is
->
cb
);
lua_pushinteger
(
L
,
i2s_id
);
lua_pushstring
(
L
,
"rx"
);
lua
_
call
(
L
,
2
,
0
);
lua
L_p
call
x
(
L
,
2
,
0
);
}
}
...
...
components/modules/mqtt.c
View file @
93140a89
...
...
@@ -119,7 +119,7 @@ static void event_connected(lua_State* L, mqtt_context_t* mqtt_context, esp_mqtt
luaX_push_weak_ref
(
L
,
mqtt_context
->
self
);
// push a reference to the client (first parameter)
ESP_LOGD
(
TAG
,
"CB:connect: calling registered one-shot connect callback"
);
int
res
=
lua_pcall
(
L
,
1
,
0
,
0
);
//call the connect callback: function(client)
int
res
=
lua
L
_pcall
x
(
L
,
1
,
0
);
//call the connect callback: function(client)
if
(
res
!=
0
)
ESP_LOGD
(
TAG
,
"CB:connect: Error when calling one-shot connect callback - (%d) %s"
,
res
,
luaL_checkstring
(
L
,
-
1
));
...
...
@@ -133,7 +133,7 @@ static void event_connected(lua_State* L, mqtt_context_t* mqtt_context, esp_mqtt
ESP_LOGD
(
TAG
,
"CB:connect: calling registered standard connect callback"
);
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
mqtt_context
->
on_connect_cb
);
// push the callback function reference to the stack
luaX_push_weak_ref
(
L
,
mqtt_context
->
self
);
// push a reference to the client (first parameter)
int
res
=
lua_pcall
(
L
,
1
,
0
,
0
);
//call the connect callback: function(client)
int
res
=
lua
L
_pcall
x
(
L
,
1
,
0
);
//call the connect callback: function(client)
if
(
res
!=
0
)
ESP_LOGD
(
TAG
,
"CB:connect: Error when calling connect callback - (%d) %s"
,
res
,
luaL_checkstring
(
L
,
-
1
));
}
...
...
@@ -156,7 +156,7 @@ static void event_disconnected(lua_State* L, mqtt_context_t* mqtt_context, esp_m
lua_pushinteger
(
L
,
-
6
);
// esp sdk mqtt lib does not provide reason codes. Push "-6" to be backward compatible with ESP8266 API
ESP_LOGD
(
TAG
,
"CB:disconnect: calling registered one-shot disconnect callback"
);
int
res
=
lua_pcall
(
L
,
2
,
0
,
0
);
//call the disconnect callback with 2 parameters: function(client, reason)
int
res
=
lua
L
_pcall
x
(
L
,
2
,
0
);
//call the disconnect callback with 2 parameters: function(client, reason)
if
(
res
!=
0
)
ESP_LOGD
(
TAG
,
"CB:disconnect: Error when calling one-shot disconnect callback - (%d) %s"
,
res
,
luaL_checkstring
(
L
,
-
1
));
...
...
@@ -170,7 +170,7 @@ static void event_disconnected(lua_State* L, mqtt_context_t* mqtt_context, esp_m
ESP_LOGD
(
TAG
,
"CB:disconnect: calling registered standard on_offline_cb callback"
);
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
mqtt_context
->
on_offline_cb
);
// push the callback function reference to the stack
luaX_push_weak_ref
(
L
,
mqtt_context
->
self
);
// push a reference to the client (first parameter)
int
res
=
lua_pcall
(
L
,
1
,
0
,
0
);
//call the offline callback: function(client)
int
res
=
lua
L
_pcall
x
(
L
,
1
,
0
);
//call the offline callback: function(client)
if
(
res
!=
0
)
ESP_LOGD
(
TAG
,
"CB:disconnect: Error when calling offline callback - (%d) %s"
,
res
,
luaL_checkstring
(
L
,
-
1
));
}
...
...
@@ -184,7 +184,7 @@ static void event_subscribed(lua_State* L, mqtt_context_t* mqtt_context, esp_mqt
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
mqtt_context
->
subscribed_ok_cb
);
// push the function reference on the stack
luaX_push_weak_ref
(
L
,
mqtt_context
->
self
);
// push the client object on the stack
luaX_unset_ref
(
L
,
&
mqtt_context
->
subscribed_ok_cb
);
// forget the callback since it is one-shot
int
res
=
lua_pcall
(
L
,
1
,
0
,
0
);
//call the connect callback with one parameter: function(client)
int
res
=
lua
L
_pcall
x
(
L
,
1
,
0
);
//call the connect callback with one parameter: function(client)
if
(
res
!=
0
)
ESP_LOGD
(
TAG
,
"CB:subscribe: Error when calling one-shot subscribe callback - (%d) %s"
,
res
,
luaL_checkstring
(
L
,
-
1
));
}
...
...
@@ -197,7 +197,7 @@ static void event_published(lua_State* L, mqtt_context_t* mqtt_context, esp_mqtt
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
mqtt_context
->
published_ok_cb
);
// push the callback function reference to the stack
luaX_push_weak_ref
(
L
,
mqtt_context
->
self
);
// push the client reference to the stack
luaX_unset_ref
(
L
,
&
mqtt_context
->
published_ok_cb
);
// forget this callback since it is one-shot
int
res
=
lua_pcall
(
L
,
1
,
0
,
0
);
//call the connect callback with 1 parameter: function(client)
int
res
=
lua
L
_pcall
x
(
L
,
1
,
0
);
//call the connect callback with 1 parameter: function(client)
if
(
res
!=
0
)
ESP_LOGD
(
TAG
,
"CB:publish: Error when calling one-shot publish callback - (%d) %s"
,
res
,
luaL_checkstring
(
L
,
-
1
));
}
...
...
@@ -210,7 +210,7 @@ static void event_unsubscribed(lua_State* L, mqtt_context_t* mqtt_context, esp_m
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
mqtt_context
->
unsubscribed_ok_cb
);
// push callback function reference on the stack
luaX_push_weak_ref
(
L
,
mqtt_context
->
self
);
// push a reference to the client
luaX_unset_ref
(
L
,
&
mqtt_context
->
unsubscribed_ok_cb
);
// forget callback as it is one-shot
int
res
=
lua_pcall
(
L
,
1
,
0
,
0
);
//call the connect callback with one parameter: function(client)
int
res
=
lua
L
_pcall
x
(
L
,
1
,
0
);
//call the connect callback with one parameter: function(client)
if
(
res
!=
0
)
ESP_LOGD
(
TAG
,
"CB:unsubscribe: Error when calling one-shot unsubscribe callback - (%d) %s"
,
res
,
luaL_checkstring
(
L
,
-
1
));
}
...
...
@@ -227,7 +227,7 @@ static void event_data_received(lua_State* L, mqtt_context_t* mqtt_context, esp_
lua_pushlstring
(
L
,
event
->
data
,
event
->
data_len
);
numArg
++
;
}
int
res
=
lua_pcall
(
L
,
numArg
,
0
,
0
);
//call the messagecallback
int
res
=
lua
L
_pcall
x
(
L
,
numArg
,
0
);
//call the messagecallback
if
(
res
!=
0
)
ESP_LOGD
(
TAG
,
"CB:data: Error when calling message callback - (%d) %s"
,
res
,
luaL_checkstring
(
L
,
-
1
));
}
...
...
components/modules/net.c
View file @
93140a89
...
...
@@ -968,7 +968,7 @@ static void ldnsfound_cb (lua_State *L, lnet_userdata *ud, ip_addr_t *addr) {
}
else
{
lua_pushnil
(
L
);
}
lua
_
call
(
L
,
2
,
0
);
lua
L_p
call
x
(
L
,
2
,
0
);
}
ud
->
client
.
wait_dns
--
;
if
(
ud
->
netconn
&&
ud
->
type
==
TYPE_TCP_CLIENT
&&
!
ud
->
client
.
connecting
)
{
...
...
@@ -997,7 +997,7 @@ static void ldnsstatic_cb (lua_State *L, int cb_ref, ip_addr_t *addr) {
}
else
{
lua_pushnil
(
L
);
}
lua
_
call
(
L
,
1
,
0
);
lua
L_p
call
x
(
L
,
1
,
0
);
}
...
...
@@ -1005,7 +1005,7 @@ static void lconnected_cb (lua_State *L, lnet_userdata *ud) {
if
(
ud
->
self_ref
!=
LUA_NOREF
&&
ud
->
client
.
cb_connect_ref
!=
LUA_NOREF
)
{
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
ud
->
client
.
cb_connect_ref
);
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
ud
->
self_ref
);
lua
_
call
(
L
,
1
,
0
);
lua
L_p
call
x
(
L
,
1
,
0
);
}
}
...
...
@@ -1041,7 +1041,7 @@ static void lrecv_cb (lua_State *L, lnet_userdata *ud) {
lua_pushinteger
(
L
,
port
);
lua_pushstring
(
L
,
iptmp
);
}
lua
_
call
(
L
,
num_args
,
0
);
lua
L_p
call
x
(
L
,
num_args
,
0
);
}
}
while
(
netbuf_next
(
p
)
!=
-
1
);
...
...
@@ -1069,7 +1069,7 @@ static void laccept_cb (lua_State *L, lnet_userdata *ud) {
nud
->
netconn
->
pcb
.
tcp
->
keep_cnt
=
1
;
}
else
luaL_error
(
L
,
"cannot accept new server socket connection"
);
lua
_
call
(
L
,
1
,
0
);
lua
L_p
call
x
(
L
,
1
,
0
);
}
...
...
@@ -1077,7 +1077,7 @@ static void lsent_cb (lua_State *L, lnet_userdata *ud) {
if
(
ud
->
client
.
cb_sent_ref
!=
LUA_NOREF
)
{
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
ud
->
client
.
cb_sent_ref
);
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
ud
->
self_ref
);
lua
_
call
(
L
,
1
,
0
);
lua
L_p
call
x
(
L
,
1
,
0
);
}
}
...
...
@@ -1094,7 +1094,7 @@ static void lerr_cb (lua_State *L, lnet_userdata *ud, err_t err)
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
ref
);
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
ud
->
self_ref
);
lua_pushinteger
(
L
,
err
);
lua
_
call
(
L
,
2
,
0
);
lua
L_p
call
x
(
L
,
2
,
0
);
}
if
(
ud
->
client
.
wait_dns
==
0
)
{
lua_gc
(
L
,
LUA_GCSTOP
,
0
);
...
...
components/modules/node.c
View file @
93140a89
...
...
@@ -379,7 +379,7 @@ ssize_t redir_write(int fd, const void *data, size_t size) {
lua_State
*
L
=
lua_getstate
();
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
output_redir
);
// push function reference
lua_pushlstring
(
L
,
(
char
*
)
data
,
size
);
// push data
lua_pcall
(
L
,
1
,
0
,
0
);
// invoke callback
lua
L
_pcall
x
(
L
,
1
,
0
);
// invoke callback
}
return
size
;
}
...
...
@@ -447,7 +447,7 @@ int redir_vprintf(const char *fmt, va_list ap)
lua_State
*
L
=
lua_getstate
();
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
os_output_redir
);
// push function reference
lua_pushlstring
(
L
,
(
char
*
)
data
,
size
);
// push data
lua_pcall
(
L
,
1
,
0
,
0
);
// invoke callback
lua
L
_pcall
x
(
L
,
1
,
0
);
// invoke callback
}
return
size
;
}
...
...
@@ -621,7 +621,7 @@ static void do_node_task (task_param_t task_fn_ref, task_prio_t prio)
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
(
int
)
task_fn_ref
);
luaL_unref
(
L
,
LUA_REGISTRYINDEX
,
(
int
)
task_fn_ref
);
lua_pushinteger
(
L
,
prio
);
lua
_
call
(
L
,
1
,
0
);
lua
L_p
call
x
(
L
,
1
,
0
);
}
// Lua: node.task.post([priority],task_cb) -- schedule a task for execution next
...
...
components/modules/pulsecnt.c
View file @
93140a89
...
...
@@ -214,7 +214,7 @@ static void pulsecnt_task(task_param_t param, task_prio_t prio)
lua_pushboolean
(
L
,
zero
);
// lua_pushinteger (L, moving_to);
// lua_pushinteger (L, status);
lua
_
call
(
L
,
6
,
0
);
lua
L_p
call
x
(
L
,
6
,
0
);
}
else
{
if
(
pc
->
is_debug
)
ESP_LOGI
(
"pulsecnt"
,
"Could not find cb for unit %d with ptr %d"
,
unit
,
pc
->
cb_ref
);
}
...
...
components/modules/sjson.c
View file @
93140a89
...
...
@@ -128,7 +128,7 @@ create_new_element(jsonsl_t jsn,
// Call with the new table and the path as arguments
lua_rawgeti
(
data
->
L
,
LUA_REGISTRYINDEX
,
state
->
lua_object_ref
);
lua_rawgeti
(
data
->
L
,
LUA_REGISTRYINDEX
,
data
->
pos_ref
);
lua
_
call
(
data
->
L
,
2
,
1
);
lua
L_p
call
x
(
data
->
L
,
2
,
1
);
want_value
=
lua_toboolean
(
data
->
L
,
-
1
);
}
lua_pop
(
data
->
L
,
2
);
// Discard the metatable and either the getfield result or retval
...
...
components/modules/tmr.c
View file @
93140a89
...
...
@@ -59,7 +59,7 @@ static void alarm_timer_task(task_param_t param, task_prio_t prio)
luaL_unref
(
L
,
LUA_REGISTRYINDEX
,
tmr
->
self_ref
);
tmr
->
self_ref
=
LUA_NOREF
;
}
lua
_
call
(
L
,
1
,
0
);
lua
L_p
call
x
(
L
,
1
,
0
);
}
static
tmr_t
tmr_get
(
lua_State
*
L
,
int
stack
)
...
...
components/modules/touch.c
View file @
93140a89
...
...
@@ -141,7 +141,7 @@ static void touch_task(task_param_t param, task_prio_t prio)
// call the cb_ref with one argument
/* do the call (1 argument, 0 results) */
if
(
lua_pcall
(
L
,
1
,
0
,
0
)
!=
0
)
{
if
(
lua
L
_pcall
x
(
L
,
1
,
0
)
!=
0
)
{
ESP_LOGI
(
TAG
,
"error running callback function `f': %s"
,
funcName
);
}
}
...
...
components/modules/uart.c
View file @
93140a89
...
...
@@ -21,7 +21,7 @@ bool uart_on_data_cb(unsigned id, const char *buf, size_t len){
int
top
=
lua_gettop
(
gL
);
lua_rawgeti
(
gL
,
LUA_REGISTRYINDEX
,
uart_status
[
id
].
receive_rf
);
lua_pushlstring
(
gL
,
buf
,
len
);
lua_pcall
(
gL
,
1
,
0
,
0
);
lua
L
_pcall
x
(
gL
,
1
,
0
);
lua_settop
(
gL
,
top
);
return
!
run_input
;
}
...
...
@@ -37,7 +37,7 @@ bool uart_on_error_cb(unsigned id, const char *buf, size_t len){
int
top
=
lua_gettop
(
gL
);
lua_rawgeti
(
gL
,
LUA_REGISTRYINDEX
,
uart_status
[
id
].
error_rf
);
lua_pushlstring
(
gL
,
buf
,
len
);
lua_pcall
(
gL
,
1
,
0
,
0
);
lua
L
_pcall
x
(
gL
,
1
,
0
);
lua_settop
(
gL
,
top
);
return
true
;
}
...
...
components/modules/wifi_ap.c
View file @
93140a89
...
...
@@ -115,7 +115,7 @@ static void on_event (esp_event_base_t base, int32_t id, const void *data)
lua_pushstring
(
L
,
events
[
idx
].
name
);
lua_createtable
(
L
,
0
,
5
);
events
[
idx
].
fill_cb_arg
(
L
,
data
);
lua
_
call
(
L
,
2
,
0
);
lua
L_p
call
x
(
L
,
2
,
0
);
}
NODEMCU_ESP_EVENT
(
WIFI_EVENT
,
WIFI_EVENT_AP_START
,
on_event
);
...
...
components/modules/wifi_sta.c
View file @
93140a89
...
...
@@ -141,7 +141,7 @@ static void on_event (esp_event_base_t base, int32_t id, const void *data)
lua_pushstring
(
L
,
events
[
idx
].
name
);
lua_createtable
(
L
,
0
,
5
);
events
[
idx
].
fill_cb_arg
(
L
,
data
);
lua
_
call
(
L
,
2
,
0
);
lua
L_p
call
x
(
L
,
2
,
0
);
}
NODEMCU_ESP_EVENT
(
WIFI_EVENT
,
WIFI_EVENT_STA_START
,
on_event
);
...
...
@@ -390,7 +390,7 @@ static void on_scan_done(esp_event_base_t base, int32_t id, const void *data)
else
lua_pushfstring
(
L
,
"failure on scan done"
);
luaM_free
(
L
,
aps
);
lua
_
call
(
L
,
nargs
,
0
);
lua
L_p
call
x
(
L
,
nargs
,
0
);
}
}
...
...
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