feat(color): add 'Last channel' option to 'Outputs' widget (#7098)

This commit is contained in:
philmoz
2026-02-16 11:22:27 +10:00
committed by GitHub
parent f29997b86c
commit 1c53af1bb7
22 changed files with 35 additions and 10 deletions
+14 -10
View File
@@ -182,11 +182,11 @@ class OutputsWidget : public Widget
{
auto widgetData = getPersistentData();
// get background color from options[2]
etx_bg_color_from_flags(lvobj, widgetData->options[2].value.unsignedValue);
// get background color from options[3]
etx_bg_color_from_flags(lvobj, widgetData->options[3].value.unsignedValue);
// Set background opacity from options[1]
if (widgetData->options[1].value.boolValue)
// Set background opacity from options[2]
if (widgetData->options[2].value.boolValue)
lv_obj_add_state(lvobj, ETX_STATE_BG_FILL);
else
lv_obj_clear_state(lvobj, ETX_STATE_BG_FILL);
@@ -197,14 +197,16 @@ class OutputsWidget : public Widget
bool changed = false;
// Colors
LcdFlags f = widgetData->options[3].value.unsignedValue;
LcdFlags f = widgetData->options[4].value.unsignedValue;
if (f != txtColor) { txtColor = f; changed = true; }
f = widgetData->options[4].value.unsignedValue;
f = widgetData->options[5].value.unsignedValue;
if (f != barColor) { barColor = f; changed = true; }
// Setup channels
uint8_t chan = widgetData->options[0].value.unsignedValue;
if (chan != firstChan) { firstChan= chan; changed = true; }
if (chan != firstChan) { firstChan = chan; changed = true; }
chan = widgetData->options[1].value.unsignedValue;
if (chan != lastChan) { lastChan = chan; changed = true; }
// Get size
if (width() != lastWidth) { lastWidth = width(); changed = true; }
@@ -218,8 +220,8 @@ class OutputsWidget : public Widget
clear();
coord_t colWidth = lastWidth / cols;
uint8_t chan = firstChan;
for (uint8_t c = 0; c < cols && chan <= MAX_OUTPUT_CHANNELS; c += 1) {
for (uint8_t r = 0; r < rows && chan <= MAX_OUTPUT_CHANNELS;
for (uint8_t c = 0; c < cols && chan <= lastChan; c += 1) {
for (uint8_t r = 0; r < rows && chan <= lastChan;
r += 1, chan += 1) {
new ChannelValue(this, c, r, colWidth, chan - 1, txtColor, barColor);
}
@@ -238,6 +240,7 @@ class OutputsWidget : public Widget
coord_t lastWidth = -1;
coord_t lastHeight = -1;
uint8_t firstChan = 255;
uint8_t lastChan = 255;
uint8_t cols = 0;
uint8_t rows = 0;
LcdFlags txtColor = 0;
@@ -250,7 +253,8 @@ class OutputsWidget : public Widget
};
const WidgetOption OutputsWidget::options[] = {
{STR_FIRST_CHANNEL, WidgetOption::Integer, {1}, {1}, {32}},
{STR_FIRST_CHANNEL, WidgetOption::Integer, {1}, {1}, {MAX_OUTPUT_CHANNELS}},
{STR_LAST_CHANNEL, WidgetOption::Integer, {MAX_OUTPUT_CHANNELS}, {1}, {MAX_OUTPUT_CHANNELS}},
{STR_FILL_BACKGROUND, WidgetOption::Bool, false},
{STR_BG_COLOR, WidgetOption::Color, COLOR2FLAGS(COLOR_THEME_SECONDARY3_INDEX)},
{STR_TEXT_COLOR, WidgetOption::Color, COLOR2FLAGS(COLOR_THEME_PRIMARY1_INDEX)},
+1
View File
@@ -1135,6 +1135,7 @@
// Horus layouts and widgets
#define TR_FIRST_CHANNEL "起始通道"
#define TR_LAST_CHANNEL "Last channel"
#define TR_FILL_BACKGROUND "是否填充背景?"
#define TR_BG_COLOR "背景颜色"
#define TR_SLIDERS_TRIMS "滑块和微调"
+1
View File
@@ -1138,6 +1138,7 @@
// Horus layouts and widgets
#define TR_FIRST_CHANNEL "První kanál"
#define TR_LAST_CHANNEL "Last channel"
#define TR_FILL_BACKGROUND "Vyplnit pozadí?"
#define TR_BG_COLOR "Barva pozadí"
#define TR_SLIDERS_TRIMS "Slidery+Trimy"
+1
View File
@@ -1140,6 +1140,7 @@
// Horus layouts and widgets
#define TR_FIRST_CHANNEL "Første kanal"
#define TR_LAST_CHANNEL "Last channel"
#define TR_FILL_BACKGROUND "Udfyld baggrund?"
#define TR_BG_COLOR "BG farve"
#define TR_SLIDERS_TRIMS "Skyder+Trim"
+1
View File
@@ -1125,6 +1125,7 @@
// Horus layouts and widgets
#define TR_FIRST_CHANNEL "Erster Kanal"
#define TR_LAST_CHANNEL "Last channel"
#define TR_FILL_BACKGROUND "Hintergrund füllen?"
#define TR_BG_COLOR "Hintergrundfarbe"
#define TR_SLIDERS_TRIMS "Schieber+Trim"
+1
View File
@@ -1136,6 +1136,7 @@
// Horus layouts and widgets
#define TR_FIRST_CHANNEL "First channel"
#define TR_LAST_CHANNEL "Last channel"
#define TR_FILL_BACKGROUND "Fill background?"
#define TR_BG_COLOR "BG Color"
#define TR_SLIDERS_TRIMS "Sliders+Trims"
+1
View File
@@ -1136,6 +1136,7 @@
// Horus layouts and widgets
#define TR_FIRST_CHANNEL "Primer canal"
#define TR_LAST_CHANNEL "Last channel"
#define TR_FILL_BACKGROUND "Rellenar fondo"
#define TR_BG_COLOR "Color BG"
#define TR_SLIDERS_TRIMS "Sliders+Trims"
+1
View File
@@ -1135,6 +1135,7 @@
// Horus layouts and widgets
#define TR_FIRST_CHANNEL "First channel"
#define TR_LAST_CHANNEL "Last channel"
#define TR_FILL_BACKGROUND "Fill background?"
#define TR_BG_COLOR "BG Color"
#define TR_SLIDERS_TRIMS "Sliders+Trims"
+1
View File
@@ -1138,6 +1138,7 @@
// Horus layouts and widgets
#define TR_FIRST_CHANNEL "Premier Canal"
#define TR_LAST_CHANNEL "Last channel"
#define TR_FILL_BACKGROUND "Remplir arrière-plan?"
#define TR_BG_COLOR "BG Color"
#define TR_SLIDERS_TRIMS "Curseurs+Trims"
+1
View File
@@ -1138,6 +1138,7 @@
// Horus layouts and widgets
#define TR_FIRST_CHANNEL "ערוץ ראשון"
#define TR_LAST_CHANNEL "Last channel"
#define TR_FILL_BACKGROUND "מילוי רקע?"
#define TR_BG_COLOR "BG צבעי"
#define TR_SLIDERS_TRIMS "Sliders+Trims"
+1
View File
@@ -1135,6 +1135,7 @@
// Horus layouts and widgets
#define TR_FIRST_CHANNEL "Primo canale"
#define TR_LAST_CHANNEL "Last channel"
#define TR_FILL_BACKGROUND "Riempi lo sfondo?"
#define TR_BG_COLOR "Colore sfondo"
#define TR_SLIDERS_TRIMS "Sliders+Trims"
+1
View File
@@ -1134,6 +1134,7 @@
// Horus layouts and widgets
#define TR_FIRST_CHANNEL "第1チャンネル"
#define TR_LAST_CHANNEL "Last channel"
#define TR_FILL_BACKGROUND "背景を塗り潰しますか?"
#define TR_BG_COLOR "背景カラー"
#define TR_SLIDERS_TRIMS "スライダー+トリム"
+1
View File
@@ -1186,6 +1186,7 @@
// Horus layouts and widgets
#define TR_FIRST_CHANNEL "첫 번째 채널"
#define TR_LAST_CHANNEL "Last channel"
#define TR_FILL_BACKGROUND "배경 채우기?"
#define TR_BG_COLOR "배경 색상"
#define TR_SLIDERS_TRIMS "슬라이더 + 트림"
+1
View File
@@ -1136,6 +1136,7 @@
// Horus layouts and widgets
#define TR_FIRST_CHANNEL "First channel"
#define TR_LAST_CHANNEL "Last channel"
#define TR_FILL_BACKGROUND "Fill background?"
#define TR_BG_COLOR "BG Color"
#define TR_SLIDERS_TRIMS "Sliders+Trims"
+1
View File
@@ -1133,6 +1133,7 @@
// Horus layouts and widgets
#define TR_FIRST_CHANNEL "Pierwszy kanał"
#define TR_LAST_CHANNEL "Last channel"
#define TR_FILL_BACKGROUND "Wypełnić tło?"
#define TR_BG_COLOR "BG Color"
#define TR_SLIDERS_TRIMS "Sliders+Trims"
+1
View File
@@ -1136,6 +1136,7 @@
// Horus layouts and widgets
#define TR_FIRST_CHANNEL "First channel"
#define TR_LAST_CHANNEL "Last channel"
#define TR_FILL_BACKGROUND "Fill background?"
#define TR_BG_COLOR "BG Color"
#define TR_SLIDERS_TRIMS "Sliders+Trims"
+1
View File
@@ -1137,6 +1137,7 @@
// Horus layouts and widgets
#define TR_FIRST_CHANNEL "Первый канал"
#define TR_LAST_CHANNEL "Last channel"
#define TR_FILL_BACKGROUND "Заполнить фон?"
#define TR_BG_COLOR "Цвет фона"
#define TR_SLIDERS_TRIMS "Тумблеры+Трим"
+1
View File
@@ -1146,6 +1146,7 @@
// Horus layouts and widgets
#define TR_FIRST_CHANNEL "Första kanal"
#define TR_LAST_CHANNEL "Last channel"
#define TR_FILL_BACKGROUND "Fyll bakgrund?"
#define TR_BG_COLOR "Bakgrundsfärg"
#define TR_SLIDERS_TRIMS "Reglage+Trimmar"
+1
View File
@@ -1133,6 +1133,7 @@
// Horus layouts and widgets
#define TR_FIRST_CHANNEL "起始通道"
#define TR_LAST_CHANNEL "Last channel"
#define TR_FILL_BACKGROUND "是否填充背景?"
#define TR_BG_COLOR "背景顏色"
#define TR_SLIDERS_TRIMS "滑塊和微調"
+1
View File
@@ -1136,6 +1136,7 @@
// Horus layouts and widgets
#define TR_FIRST_CHANNEL "Перший канал"
#define TR_LAST_CHANNEL "Last channel"
#define TR_FILL_BACKGROUND "Заповнити фон?"
#define TR_BG_COLOR "Колір фону"
#define TR_SLIDERS_TRIMS "Повзунки+трими"
+1
View File
@@ -76,6 +76,7 @@
#define STR_FILE_SIZE currentLangStrings->STR_FILE_SIZE
#define STR_FILL_BACKGROUND currentLangStrings->STR_FILL_BACKGROUND
#define STR_FIRST_CHANNEL currentLangStrings->STR_FIRST_CHANNEL
#define STR_LAST_CHANNEL currentLangStrings->STR_LAST_CHANNEL
#define STR_FIXED currentLangStrings->STR_FIXED
#define STR_FLASH_DEVICE currentLangStrings->STR_FLASH_DEVICE
#define STR_FLIGHT_MODE currentLangStrings->STR_FLIGHT_MODE
+1
View File
@@ -75,6 +75,7 @@ STR(FILE_OPEN)
STR(FILE_SIZE)
STR(FILL_BACKGROUND)
STR(FIRST_CHANNEL)
STR(LAST_CHANNEL)
STR(FIXED)
STR(FLASH_DEVICE)
STR(FLIGHT_MODE)