diff --git a/radio/src/gui/view_main.cpp b/radio/src/gui/view_main.cpp index 074dd54e0..315fb157f 100644 --- a/radio/src/gui/view_main.cpp +++ b/radio/src/gui/view_main.cpp @@ -340,7 +340,7 @@ void displayTimers() // Main timer if (g_model.timers[0].mode) { TimerState & timerState = timersStates[0]; - putsTimer(TIMERS_X, TIMER1_Y, timerState.val, MIDSIZE|LEFT, MIDSIZE|LEFT); + putsTimer(TIMERS_X, TIMER1_Y, timerState.val, TIMEHOUR|MIDSIZE|LEFT, TIMEHOUR|MIDSIZE|LEFT); putsTimerMode(TIMERS_X, TIMER1_Y-6, g_model.timers[0].mode, SMLSIZE); if (g_model.timers[0].persistent) lcd_putcAtt(TIMERS_R, TIMER1_Y+1, 'P', SMLSIZE); if (timerState.val < 0) { @@ -353,7 +353,7 @@ void displayTimers() // Second timer if (g_model.timers[1].mode) { TimerState & timerState = timersStates[1]; - putsTimer(TIMERS_X, TIMER2_Y, timerState.val, MIDSIZE|LEFT, MIDSIZE|LEFT); + putsTimer(TIMERS_X, TIMER2_Y, timerState.val, TIMEHOUR|MIDSIZE|LEFT, TIMEHOUR|MIDSIZE|LEFT); putsTimerMode(TIMERS_X, TIMER2_Y-6, g_model.timers[1].mode, SMLSIZE); if (g_model.timers[1].persistent) lcd_putcAtt(TIMERS_R, TIMER2_Y+1, 'P', SMLSIZE); if (timerState.val < 0) { diff --git a/radio/src/lcd.cpp b/radio/src/lcd.cpp index 665ebeda0..c09853592 100644 --- a/radio/src/lcd.cpp +++ b/radio/src/lcd.cpp @@ -552,7 +552,7 @@ void lcd_outdezNAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags flags, uint8_t } else if (midsize) { x -= 3; - xn = x+1; + xn = x; } else if (tinsize) { x--; @@ -912,7 +912,7 @@ void putsTimer(xcoord_t x, uint8_t y, putstime_t tme, LcdFlags att, LcdFlags att #if defined(PCBTARANIS) #define separator ':' - if (att & MIDSIZE) { + if (att & TIMEHOUR) { div_t qr2 = div(qr.quot, 60); lcd_outdezNAtt(x, y, qr2.quot, att|LEADING0|LEFT, 2); lcd_putcAtt(lcdLastPos, y, separator, att&att2); diff --git a/radio/src/lcd.h b/radio/src/lcd.h index a324a9ba2..cc1ea2789 100644 --- a/radio/src/lcd.h +++ b/radio/src/lcd.h @@ -113,7 +113,6 @@ #define SMLSIZE 0x0200 #define TINSIZE 0x0400 #define STREXPANDED 0x0800 - #define TIMEBLINK 0x1000 #else #define MIDSIZE DBLSIZE #define SMLSIZE 0x00 @@ -127,6 +126,11 @@ #define GREY_MASK(x) ((x) & 0xF000) #endif +#if defined(CPUARM) + #define TIMEBLINK 0x10000 + #define TIMEHOUR 0x20000 +#endif + #if defined(CPUARM) #define LcdFlags uint32_t #else diff --git a/radio/src/lua.cpp b/radio/src/lua.cpp index 9803e488c..aa4590717 100644 --- a/radio/src/lua.cpp +++ b/radio/src/lua.cpp @@ -65,8 +65,8 @@ ScriptInternalData standaloneScript = { SCRIPT_NOFILE, 0 }; uint16_t maxLuaInterval = 0; uint16_t maxLuaDuration = 0; -#define PERMANENT_SCRIPTS_MAX_INSTRUCTIONS (1000/100) -#define MANUAL_SCRIPTS_MAX_INSTRUCTIONS (10000/100) +#define PERMANENT_SCRIPTS_MAX_INSTRUCTIONS (10000/100) +#define MANUAL_SCRIPTS_MAX_INSTRUCTIONS (20000/100) #define SCRIPTS_MAX_HEAP 50 #define SET_LUA_INSTRUCTIONS_COUNT(x) (instructionsPercent=0, lua_sethook(L, hook, LUA_MASKCOUNT, x)) @@ -155,7 +155,11 @@ static int luaGetValue(lua_State *L) } else { const char *what = luaL_checkstring(L, 1); - if (!strcmp(what, "altitude")) { + if (!strcmp(what, "altitude-max")) { + lua_pushnumber(L, frskyData.hub.maxAltitude); + return 1; + } + else if (!strcmp(what, "altitude")) { lua_pushnumber(L, double(frskyData.hub.baroAltitude)/100); return 1; } @@ -250,6 +254,16 @@ static int luaLcdDrawText(lua_State *L) return 0; } +static int luaLcdDrawTimer(lua_State *L) +{ + int x = luaL_checkinteger(L, 1); + int y = luaL_checkinteger(L, 2); + int seconds = luaL_checkinteger(L, 3); + int att = luaL_checkinteger(L, 4); + putsTimer(x, y, seconds, att|LEFT, att); + return 0; +} + static int luaLcdDrawNumber(lua_State *L) { int x = luaL_checkinteger(L, 1); @@ -314,6 +328,25 @@ static int luaLcdDrawFilledRectangle(lua_State *L) return 0; } +#if 0 +static int luaLcdDrawGauge(lua_State *L) +{ + int x = luaL_checkinteger(L, 1); + int y = luaL_checkinteger(L, 2); + int w = luaL_checkinteger(L, 3); + int h = luaL_checkinteger(L, 4); + int num = luaL_checkinteger(L, 5); + int den = luaL_checkinteger(L, 6); + int flags = luaL_checkinteger(L, 7); + lcd_rect(x, y, w, h); + uint8_t len = limit((uint8_t)1, uint8_t(w*num/den), uint8_t(w)); + for (int i=1; i