diff --git a/radio/src/lcd_common.cpp b/radio/src/lcd_common.cpp index c03f0ccd3..c0639df80 100644 --- a/radio/src/lcd_common.cpp +++ b/radio/src/lcd_common.cpp @@ -38,11 +38,11 @@ #if defined(PCBTARANIS) && defined(REVPLUS) && defined(LCD_DUAL_BUFFER) -display_t displayBuf1[DISPLAY_BUF_SIZE]; -display_t displayBuf2[DISPLAY_BUF_SIZE]; -display_t * displayBuf = displayBuf1; + display_t displayBuf1[DISPLAY_BUF_SIZE]; + display_t displayBuf2[DISPLAY_BUF_SIZE]; + display_t * displayBuf = displayBuf1; #else -display_t displayBuf[DISPLAY_BUF_SIZE]; + display_t displayBuf[DISPLAY_BUF_SIZE]; #endif void lcd_clear() diff --git a/radio/src/lua_api.cpp b/radio/src/lua_api.cpp index 3a267e03a..07483b2e3 100644 --- a/radio/src/lua_api.cpp +++ b/radio/src/lua_api.cpp @@ -355,7 +355,7 @@ static int luaLcdClear(lua_State *L) static int luaLcdDrawPoint(lua_State *L) { - if (! luaLcdAllowed) return 0; + if (!luaLcdAllowed) return 0; int x = luaL_checkinteger(L, 1); int y = luaL_checkinteger(L, 2); lcd_plot(x, y); @@ -364,7 +364,7 @@ static int luaLcdDrawPoint(lua_State *L) static int luaLcdDrawLine(lua_State *L) { - if (! luaLcdAllowed) return 0; + if (!luaLcdAllowed) return 0; int x1 = luaL_checkinteger(L, 1); int y1 = luaL_checkinteger(L, 2); int x2 = luaL_checkinteger(L, 3); @@ -383,7 +383,7 @@ static int luaLcdGetLastPos(lua_State *L) static int luaLcdDrawText(lua_State *L) { - if (! luaLcdAllowed) return 0; + if (!luaLcdAllowed) return 0; int x = luaL_checkinteger(L, 1); int y = luaL_checkinteger(L, 2); const char * s = luaL_checkstring(L, 3); @@ -394,7 +394,7 @@ static int luaLcdDrawText(lua_State *L) static int luaLcdDrawTimer(lua_State *L) { - if (! luaLcdAllowed) return 0; + if (!luaLcdAllowed) return 0; int x = luaL_checkinteger(L, 1); int y = luaL_checkinteger(L, 2); int seconds = luaL_checkinteger(L, 3); @@ -405,7 +405,7 @@ static int luaLcdDrawTimer(lua_State *L) static int luaLcdDrawNumber(lua_State *L) { - if (! luaLcdAllowed) return 0; + if (!luaLcdAllowed) return 0; int x = luaL_checkinteger(L, 1); int y = luaL_checkinteger(L, 2); int n = luaL_checkinteger(L, 3); @@ -416,7 +416,7 @@ static int luaLcdDrawNumber(lua_State *L) static int luaLcdDrawChannel(lua_State *L) { - if (! luaLcdAllowed) return 0; + if (!luaLcdAllowed) return 0; int x = luaL_checkinteger(L, 1); int y = luaL_checkinteger(L, 2); int channel = -1; @@ -439,7 +439,7 @@ static int luaLcdDrawChannel(lua_State *L) static int luaLcdDrawSwitch(lua_State *L) { - if (! luaLcdAllowed) return 0; + if (!luaLcdAllowed) return 0; int x = luaL_checkinteger(L, 1); int y = luaL_checkinteger(L, 2); int s = luaL_checkinteger(L, 3); @@ -450,7 +450,7 @@ static int luaLcdDrawSwitch(lua_State *L) static int luaLcdDrawSource(lua_State *L) { - if (! luaLcdAllowed) return 0; + if (!luaLcdAllowed) return 0; int x = luaL_checkinteger(L, 1); int y = luaL_checkinteger(L, 2); int s = luaL_checkinteger(L, 3); @@ -461,7 +461,7 @@ static int luaLcdDrawSource(lua_State *L) static int luaLcdDrawPixmap(lua_State *L) { - if (! luaLcdAllowed) return 0; + if (!luaLcdAllowed) return 0; int x = luaL_checkinteger(L, 1); int y = luaL_checkinteger(L, 2); const char * filename = luaL_checkstring(L, 3); @@ -475,7 +475,7 @@ static int luaLcdDrawPixmap(lua_State *L) static int luaLcdDrawRectangle(lua_State *L) { - if (! luaLcdAllowed) return 0; + if (!luaLcdAllowed) return 0; int x = luaL_checkinteger(L, 1); int y = luaL_checkinteger(L, 2); int w = luaL_checkinteger(L, 3); @@ -486,7 +486,7 @@ static int luaLcdDrawRectangle(lua_State *L) static int luaLcdDrawFilledRectangle(lua_State *L) { - if (! luaLcdAllowed) return 0; + if (!luaLcdAllowed) return 0; int x = luaL_checkinteger(L, 1); int y = luaL_checkinteger(L, 2); int w = luaL_checkinteger(L, 3); @@ -498,7 +498,7 @@ static int luaLcdDrawFilledRectangle(lua_State *L) static int luaLcdDrawGauge(lua_State *L) { - if (! luaLcdAllowed) return 0; + if (!luaLcdAllowed) return 0; int x = luaL_checkinteger(L, 1); int y = luaL_checkinteger(L, 2); int w = luaL_checkinteger(L, 3); @@ -516,7 +516,7 @@ static int luaLcdDrawGauge(lua_State *L) static int luaLcdDrawScreenTitle(lua_State *L) { - if (! luaLcdAllowed) return 0; + if (!luaLcdAllowed) return 0; const char * str = luaL_checkstring(L, 1); int idx = luaL_checkinteger(L, 2); int cnt = luaL_checkinteger(L, 3); @@ -530,7 +530,7 @@ static int luaLcdDrawScreenTitle(lua_State *L) static int luaLcdDrawCombobox(lua_State *L) { - if (! luaLcdAllowed) return 0; + if (!luaLcdAllowed) return 0; int x = luaL_checkinteger(L, 1); int y = luaL_checkinteger(L, 2); int w = luaL_checkinteger(L, 3); @@ -1990,7 +1990,8 @@ void luaRunNonGuiScripts() lastRunTime = get_tmr10ms() - t0; } -bool luaRunGuiScripts(uint8_t evt){ +bool luaRunGuiScripts(uint8_t evt) +{ //execute one cycle of Lua scripts that use LCD //either stand-alone or other (telemetry scripts) diff --git a/radio/src/tasks_arm.cpp b/radio/src/tasks_arm.cpp index 613ac08da..48b931ac8 100644 --- a/radio/src/tasks_arm.cpp +++ b/radio/src/tasks_arm.cpp @@ -288,11 +288,10 @@ void menusTask(void * pdata) perMainArm(); // TODO remove completely massstorage from sky9x firmware U32 runtime = (U32)(CoGetOSTime() - start); - if (runtime >= MENU_TASK_PERIOD_TICKS) { - //no delay - } - else { - CoTickDelay(MENU_TASK_PERIOD_TICKS - runtime); // 5*2ms for now + // deduct the thread run-time from the wait, if run-time was more than + // desired period, then skip the wait all together + if (runtime < MENU_TASK_PERIOD_TICKS) { + CoTickDelay(MENU_TASK_PERIOD_TICKS - runtime); } }