Minor esp32 fixes (#2837)
* Move task_post() into IRAM so it can be used by IRAM'd ISRs. * Don't leave crud on stack on pcall error.
This commit is contained in:
parent
f44e6e9639
commit
d8131bc407
|
@ -20,9 +20,11 @@ bool uart_on_data_cb(unsigned id, const char *buf, size_t len){
|
||||||
if(!gL)
|
if(!gL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
int top = lua_gettop(gL);
|
||||||
lua_rawgeti(gL, LUA_REGISTRYINDEX, uart_status[id].receive_rf);
|
lua_rawgeti(gL, LUA_REGISTRYINDEX, uart_status[id].receive_rf);
|
||||||
lua_pushlstring(gL, buf, len);
|
lua_pushlstring(gL, buf, len);
|
||||||
lua_pcall(gL, 1, 0, 0);
|
lua_pcall(gL, 1, 0, 0);
|
||||||
|
lua_settop(gL, top);
|
||||||
return !run_input;
|
return !run_input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,9 +36,11 @@ bool uart_on_error_cb(unsigned id, const char *buf, size_t len){
|
||||||
if(!gL)
|
if(!gL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
int top = lua_gettop(gL);
|
||||||
lua_rawgeti(gL, LUA_REGISTRYINDEX, uart_status[id].error_rf);
|
lua_rawgeti(gL, LUA_REGISTRYINDEX, uart_status[id].error_rf);
|
||||||
lua_pushlstring(gL, buf, len);
|
lua_pushlstring(gL, buf, len);
|
||||||
lua_pcall(gL, 1, 0, 0);
|
lua_pcall(gL, 1, 0, 0);
|
||||||
|
lua_settop(gL, top);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ task_handle_t task_get_id(task_callback_t t) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool task_post (task_prio_t priority, task_handle_t handle, task_param_t param)
|
bool IRAM_ATTR task_post (task_prio_t priority, task_handle_t handle, task_param_t param)
|
||||||
{
|
{
|
||||||
if (priority >= TASK_PRIORITY_COUNT ||
|
if (priority >= TASK_PRIORITY_COUNT ||
|
||||||
(handle & TASK_HANDLE_MASK) != TASK_HANDLE_MONIKER)
|
(handle & TASK_HANDLE_MASK) != TASK_HANDLE_MONIKER)
|
||||||
|
|
Loading…
Reference in New Issue