diff --git a/radio/sdcard/horus/WIDGETS/BattCheck/main.lua b/radio/sdcard/horus/WIDGETS/BattCheck/main.lua index 453a2e3a1..bae83ac51 100755 --- a/radio/sdcard/horus/WIDGETS/BattCheck/main.lua +++ b/radio/sdcard/horus/WIDGETS/BattCheck/main.lua @@ -182,8 +182,8 @@ local function zoneSmall(zone) if type(mySensor) == "table" then local myString = string.format("%2.1fV", getCellSum(mySensor)).." ("..getCellCount(mySensor).."S)" local percent = getCellPercent(getCellAvg(mySensor)) - lcd.drawText(zone.zone.x + zone.zone.w, zone.zone.y + 22, myString, RIGHT + SMLSIZE + CUSTOM_COLOR) - lcd.drawText(zone.zone.x + zone.zone.w, zone.zone.y, percent.."%", RIGHT + MIDSIZE + CUSTOM_COLOR) + lcd.drawText(zone.zone.x + zone.zone.w, zone.zone.y + 22, myString, RIGHT + SMLSIZE + CUSTOM_COLOR + SHADOWED) + lcd.drawText(zone.zone.x + zone.zone.w, zone.zone.y, percent.."%", RIGHT + MIDSIZE + CUSTOM_COLOR + SHADOWED) -- fils batt lcd.setColor(CUSTOM_COLOR, getPercentColor(percent)) lcd.drawGauge(zone.zone.x+2, zone.zone.y+2, 75, zone.zone.h - 4, percent, 100, CUSTOM_COLOR) @@ -195,7 +195,7 @@ local function zoneSmall(zone) lcd.drawRectangle(zone.zone.x + myBatt.x + i, zone.zone.y + myBatt.y, myBatt.segments_w, myBatt.h, CUSTOM_COLOR, 1) end else - lcd.drawText(zone.zone.x, zone.zone.y+10, "No FLVSS sensor data", LEFT + SMLSIZE + INVERS + CUSTOM_COLOR) + lcd.drawText(zone.zone.x, zone.zone.y+10, "No FLVSS sensor data", LEFT + SMLSIZE + INVERS + CUSTOM_COLOR + SHADOWED) end return end @@ -208,7 +208,7 @@ local function zoneMedium(zone) lcd.setColor(CUSTOM_COLOR, zone.options.Color) if type(mySensor) == "table" then local percent = getCellPercent(getCellAvg(mySensor)) - lcd.drawText(zone.zone.x + zone.zone.w, zone.zone.y+5, percent.."% ", RIGHT + MIDSIZE + CUSTOM_COLOR) + lcd.drawText(zone.zone.x + zone.zone.w, zone.zone.y+5, percent.."% ", RIGHT + MIDSIZE + CUSTOM_COLOR + SHADOWED) -- fils batt lcd.setColor(CUSTOM_COLOR, getPercentColor(percent)) @@ -219,7 +219,7 @@ local function zoneMedium(zone) lcd.setColor(CUSTOM_COLOR, getRangeColor(mySensor[i], getCellMax(mySensor), getCellMax(mySensor) - 0.2)) lcd.drawFilledRectangle(zone.zone.x + pos[i].x, zone.zone.y + pos[i].y, 58, 20, CUSTOM_COLOR) lcd.setColor(CUSTOM_COLOR, WHITE) - lcd.drawText(zone.zone.x + pos[i].x+10, zone.zone.y + pos[i].y, string.format("%.2f", mySensor[i]), CUSTOM_COLOR) + lcd.drawText(zone.zone.x + pos[i].x+10, zone.zone.y + pos[i].y, string.format("%.2f", mySensor[i]), CUSTOM_COLOR + SHADOWED) lcd.drawRectangle(zone.zone.x + pos[i].x, zone.zone.y + pos[i].y, 59, 20, CUSTOM_COLOR,1) end else @@ -229,7 +229,7 @@ local function zoneMedium(zone) lcd.setColor(CUSTOM_COLOR, WHITE) lcd.drawRectangle(zone.zone.x + myBatt.x , zone.zone.y + myBatt.y, myBatt.w, myBatt.h, CUSTOM_COLOR, 2) lcd.drawFilledRectangle(zone.zone.x + myBatt.x + myBatt.w, zone.zone.y + myBatt.h/2 - myBatt.cath_h/2, myBatt.cath_w, myBatt.cath_h, CUSTOM_COLOR) - lcd.drawText(zone.zone.x + myBatt.x + 5 , zone.zone.y + myBatt.y + 5, string.format("%2.1fV", getCellSum(mySensor)), LEFT + MIDSIZE + CUSTOM_COLOR) + lcd.drawText(zone.zone.x + myBatt.x + 5 , zone.zone.y + myBatt.y + 5, string.format("%2.1fV", getCellSum(mySensor)), LEFT + MIDSIZE + CUSTOM_COLOR + SHADOWED) --for i=1, myBatt.w - myBatt.segments_w, myBatt.segments_w do -- lcd.drawRectangle(zone.zone.x + myBatt.x + i, zone.zone.y + myBatt.y, myBatt.segments_w, myBatt.h, CUSTOM_COLOR, 1) --end @@ -244,9 +244,9 @@ local function zoneLarge(zone) lcd.setColor(CUSTOM_COLOR, zone.options.Color) if type(mySensor) == "table" then local percent = getCellPercent(getCellAvg(mySensor)) - lcd.drawText(zone.zone.x+zone.zone.w, zone.zone.y+15, percent.."%", RIGHT + DBLSIZE + CUSTOM_COLOR) - lcd.drawText(zone.zone.x+zone.zone.w, zone.zone.y+44, string.format("%2.1fV", getCellSum(mySensor)), RIGHT + MIDSIZE + CUSTOM_COLOR) - lcd.drawText(zone.zone.x+zone.zone.w, zone.zone.y+65, getCellCount(mySensor).."S", RIGHT + MIDSIZE + CUSTOM_COLOR) + lcd.drawText(zone.zone.x+zone.zone.w, zone.zone.y+15, percent.."%", RIGHT + DBLSIZE + CUSTOM_COLOR + SHADOWED) + lcd.drawText(zone.zone.x+zone.zone.w, zone.zone.y+44, string.format("%2.1fV", getCellSum(mySensor)), RIGHT + MIDSIZE + CUSTOM_COLOR + SHADOWED) + lcd.drawText(zone.zone.x+zone.zone.w, zone.zone.y+65, getCellCount(mySensor).."S", RIGHT + MIDSIZE + CUSTOM_COLOR + SHADOWED) -- fils batt lcd.setColor(CUSTOM_COLOR, getPercentColor(percent)) lcd.drawFilledRectangle(zone.zone.x + myBatt.x, zone.zone.y + myBatt.y + myBatt.h + myBatt.cath_h - math.floor(percent/100 * myBatt.h), myBatt.w, math.floor(percent/100 * myBatt.h), CUSTOM_COLOR) @@ -256,11 +256,11 @@ local function zoneLarge(zone) lcd.setColor(CUSTOM_COLOR, getRangeColor(mySensor[i], getCellMax(mySensor), getCellMax(mySensor) - 0.2)) lcd.drawFilledRectangle(zone.zone.x + pos[i].x, zone.zone.y + pos[i].y, 58, 20, CUSTOM_COLOR) lcd.setColor(CUSTOM_COLOR, WHITE) - lcd.drawText(zone.zone.x + pos[i].x+10, zone.zone.y + pos[i].y, string.format("%.2f", mySensor[i]), CUSTOM_COLOR) + lcd.drawText(zone.zone.x + pos[i].x+10, zone.zone.y + pos[i].y, string.format("%.2f", mySensor[i]), CUSTOM_COLOR + SHADOWED) lcd.drawRectangle(zone.zone.x + pos[i].x, zone.zone.y + pos[i].y, 59, 20, CUSTOM_COLOR, 1) end else - lcd.drawText(zone.zone.x+5, zone.zone.y, "No FLVSS sensor data", LEFT + SMLSIZE + INVERS + CUSTOM_COLOR) + lcd.drawText(zone.zone.x+5, zone.zone.y, "No FLVSS sensor data", LEFT + SMLSIZE + INVERS + CUSTOM_COLOR + SHADOWED) end -- draws bat lcd.setColor(CUSTOM_COLOR, WHITE) @@ -285,16 +285,16 @@ local function zoneXLarge(zone) lcd.drawFilledRectangle(zone.zone.x + myBatt.x, zone.zone.y + myBatt.y + myBatt.h + myBatt.cath_h - math.floor(percent/100 * myBatt.h), myBatt.w, math.floor(percent/100 * myBatt.h), CUSTOM_COLOR) -- draw right text section lcd.setColor(CUSTOM_COLOR, zone.options.Color) - lcd.drawText(zone.zone.x+zone.zone.w, zone.zone.y + myBatt.y, percent.."%", RIGHT + DBLSIZE + CUSTOM_COLOR) - lcd.drawText(zone.zone.x+zone.zone.w, zone.zone.y + myBatt.y + 63, string.format("%2.1fV", getCellSum(mySensor)), RIGHT + MIDSIZE + CUSTOM_COLOR) - lcd.drawText(zone.zone.x+zone.zone.w, zone.zone.y + myBatt.y + 105, getCellCount(mySensor).."S", RIGHT + MIDSIZE + CUSTOM_COLOR) + lcd.drawText(zone.zone.x+zone.zone.w, zone.zone.y + myBatt.y, percent.."%", RIGHT + DBLSIZE + CUSTOM_COLOR + SHADOWED) + lcd.drawText(zone.zone.x+zone.zone.w, zone.zone.y + myBatt.y + 63, string.format("%2.1fV", getCellSum(mySensor)), RIGHT + MIDSIZE + CUSTOM_COLOR + SHADOWED) + lcd.drawText(zone.zone.x+zone.zone.w, zone.zone.y + myBatt.y + 105, getCellCount(mySensor).."S", RIGHT + MIDSIZE + CUSTOM_COLOR + SHADOWED) -- draw cells local pos = {{x=111, y=38}, {x=164, y=38}, {x=217, y=38}, {x=111, y=57}, {x=164, y=57}, {x=217, y=57}} for i=1, getCellCount(mySensor), 1 do lcd.setColor(CUSTOM_COLOR, getRangeColor(mySensor[i], getCellMax(mySensor), getCellMax(mySensor) - 0.2)) lcd.drawFilledRectangle(zone.zone.x + pos[i].x, zone.zone.y + pos[i].y, 53, 20, CUSTOM_COLOR) lcd.setColor(CUSTOM_COLOR, WHITE) - lcd.drawText(zone.zone.x + pos[i].x+10, zone.zone.y + pos[i].y, string.format("%.2f", mySensor[i]), CUSTOM_COLOR) + lcd.drawText(zone.zone.x + pos[i].x+10, zone.zone.y + pos[i].y, string.format("%.2f", mySensor[i]), CUSTOM_COLOR + SHADOWED) lcd.drawRectangle(zone.zone.x + pos[i].x, zone.zone.y + pos[i].y, 54, 20, CUSTOM_COLOR, 1) end -- draw cells for lowest cells @@ -304,7 +304,7 @@ local function zoneXLarge(zone) lcd.drawFilledRectangle(zone.zone.x + pos[i].x, zone.zone.y + pos[i].y, 53, 20, CUSTOM_COLOR) lcd.setColor(CUSTOM_COLOR, WHITE) lcd.drawRectangle(zone.zone.x + pos[i].x, zone.zone.y + pos[i].y, 54, 20, CUSTOM_COLOR, 1) - lcd.drawText(zone.zone.x + pos[i].x+10, zone.zone.y + pos[i].y, string.format("%.2f", histCellData[i]), CUSTOM_COLOR) + lcd.drawText(zone.zone.x + pos[i].x+10, zone.zone.y + pos[i].y, string.format("%.2f", histCellData[i]), CUSTOM_COLOR + SHADOWED) end else lcd.drawText(zone.zone.x+5, zone.zone.y, "No FLVSS sensor data", LEFT + SMLSIZE + INVERS + CUSTOM_COLOR) @@ -318,9 +318,9 @@ local function zoneXLarge(zone) end -- draw middle rectangles lcd.drawRectangle(zone.zone.x + 110, zone.zone.y + 38, 161, 40, CUSTOM_COLOR, 1) - lcd.drawText(zone.zone.x + 270, zone.zone.y + 21, "Live data", RIGHT + SMLSIZE + INVERS + CUSTOM_COLOR) + lcd.drawText(zone.zone.x + 270, zone.zone.y + 21, "Live data", RIGHT + SMLSIZE + INVERS + CUSTOM_COLOR + SHADOWED) lcd.drawRectangle(zone.zone.x + 110, zone.zone.y + 110, 161, 40, CUSTOM_COLOR, 1) - lcd.drawText(zone.zone.x + 270, zone.zone.y + 93, "Lowest data", RIGHT + SMLSIZE + INVERS + CUSTOM_COLOR) + lcd.drawText(zone.zone.x + 270, zone.zone.y + 93, "Lowest data", RIGHT + SMLSIZE + INVERS + CUSTOM_COLOR + SHADOWED) return end diff --git a/radio/src/gui/480x272/lcd.h b/radio/src/gui/480x272/lcd.h index 92442aa31..4b2a95a88 100644 --- a/radio/src/gui/480x272/lcd.h +++ b/radio/src/gui/480x272/lcd.h @@ -44,6 +44,7 @@ #define LEFT 0x00 /* align left */ #define CENTERED 0x04 /* align center */ #define RIGHT 0x08 /* align right */ +#define SHADOWED 0x80 /* black copy at +1 +1 */ /* drawNumber flags */ #define LEADING0 0x10 diff --git a/radio/src/lua/api_general.cpp b/radio/src/lua/api_general.cpp index 62cbf98bd..cde9efb1a 100644 --- a/radio/src/lua/api_general.cpp +++ b/radio/src/lua/api_general.cpp @@ -1238,6 +1238,7 @@ const luaR_value_entry opentxConstants[] = { { "MIXSRC_CH1", MIXSRC_CH1 }, { "SWSRC_LAST", SWSRC_LAST_LOGICAL_SWITCH }, #if defined(COLORLCD) + { "SHADOWED", SHADOWED }, { "COLOR", ZoneOption::Color }, { "CUSTOM_COLOR", CUSTOM_COLOR }, { "TEXT_COLOR", TEXT_COLOR }, diff --git a/radio/src/lua/api_lcd.cpp b/radio/src/lua/api_lcd.cpp index b23b4584c..dbd079a63 100644 --- a/radio/src/lua/api_lcd.cpp +++ b/radio/src/lua/api_lcd.cpp @@ -205,8 +205,9 @@ See the [Appendix](../appendix/fonts.md) for available characters in each font s * `SMLSIZE` small font * `INVERS` inverted display * `BLINK` blinking text + * `SHADOWED` Horus only, apply a shadow effect -@status current Introduced in 2.0.0 +@status current Introduced in 2.0.0, `SHADOWED` introduced in 2.2.1 */ static int luaLcdDrawText(lua_State *L) { @@ -215,6 +216,9 @@ static int luaLcdDrawText(lua_State *L) int y = luaL_checkinteger(L, 2); const char * s = luaL_checkstring(L, 3); unsigned int att = luaL_optunsigned(L, 4, 0); + #if defined(COLORLCD) + if ((att&SHADOWED) && !(att&INVERS)) lcdDrawText(x+1, y+1, s, att&0xFFFF); + #endif lcdDrawText(x, y, s, att); return 0; } @@ -232,8 +236,9 @@ Display a value formatted as time at (x,y) * `0 or not specified` normal representation (minutes and seconds) * `TIMEHOUR` display hours * other general LCD flag also apply + * `SHADOWED` Horus only, apply a shadow effect -@status current Introduced in 2.0.0 +@status current Introduced in 2.0.0, `SHADOWED` introduced in 2.2.1 */ static int luaLcdDrawTimer(lua_State *L) { @@ -243,6 +248,7 @@ static int luaLcdDrawTimer(lua_State *L) int seconds = luaL_checkinteger(L, 3); unsigned int att = luaL_optunsigned(L, 4, 0); #if defined(COLORLCD) + if (att&SHADOWED) drawTimer(x+1, y+1, seconds, (att&0xFFFF)|LEFT); drawTimer(x, y, seconds, att|LEFT); #else drawTimer(x, y, seconds, att|LEFT, att); @@ -264,8 +270,9 @@ Display a number at (x,y) * `PREC1` display with one decimal place (number 386 is displayed as 38.6) * `PREC2` display with tow decimal places (number 386 is displayed as 3.86) * other general LCD flag also apply + * `SHADOWED` Horus only, apply a shadow effect -@status current Introduced in 2.0.0 +@status current Introduced in 2.0.0, `SHADOWED` introduced in 2.2.1 */ static int luaLcdDrawNumber(lua_State *L) { @@ -274,6 +281,9 @@ static int luaLcdDrawNumber(lua_State *L) int y = luaL_checkinteger(L, 2); int val = luaL_checkinteger(L, 3); unsigned int att = luaL_optunsigned(L, 4, 0); + #if defined(COLORLCD) + if ((att&SHADOWED) && !(att&INVERS)) lcdDrawNumber(x, y, val, att&0xFFFF); + #endif lcdDrawNumber(x, y, val, att); return 0; }