Prevent UART input race without extra lua_started flag

This commit is contained in:
TerryE 2016-03-11 00:41:40 +00:00
parent cf05c9cd08
commit 76ff541244
2 changed files with 2 additions and 5 deletions

View File

@ -468,7 +468,7 @@ int lua_main (int argc, char **argv) {
void lua_handle_input (bool force) void lua_handle_input (bool force)
{ {
if (force || readline (&gLoad)) if (gLoad.L && (force || readline (&gLoad)))
dojob (&gLoad); dojob (&gLoad);
} }

View File

@ -80,19 +80,16 @@ void TEXT_SECTION_ATTR user_start_trampoline (void)
call_user_start (); call_user_start ();
} }
static bool lua_started=false;
// +================== New task interface ==================+ // +================== New task interface ==================+
static void start_lua(task_param_t param, uint8 priority) { static void start_lua(task_param_t param, uint8 priority) {
char* lua_argv[] = { (char *)"lua", (char *)"-i", NULL }; char* lua_argv[] = { (char *)"lua", (char *)"-i", NULL };
NODE_DBG("Task task_lua started.\n"); NODE_DBG("Task task_lua started.\n");
lua_main( 2, lua_argv ); lua_main( 2, lua_argv );
lua_started=true;
} }
static void handle_input(task_param_t flag, uint8 priority) { static void handle_input(task_param_t flag, uint8 priority) {
// c_printf("HANDLE_INPUT: %u %u\n", flag, priority); REMOVE // c_printf("HANDLE_INPUT: %u %u\n", flag, priority); REMOVE
if (lua_started) lua_handle_input (flag);
lua_handle_input (flag);
} }
static task_handle_t input_sig; static task_handle_t input_sig;