Commit d8131bc4 authored by Johny Mattsson's avatar Johny Mattsson Committed by Arnim Läuger
Browse files

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.
parent f44e6e96
...@@ -20,9 +20,11 @@ bool uart_on_data_cb(unsigned id, const char *buf, size_t len){ ...@@ -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){ ...@@ -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) { ...@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment