Merge branch 'EdgeTX:main' into NV14-model-setup-extra-line

This commit is contained in:
eshifri
2021-08-30 22:06:08 -07:00
committed by GitHub
38 changed files with 705 additions and 478 deletions
+18 -18
View File
@@ -1,23 +1,23 @@
{ {
"targets": [ "targets": [
["TX16s", "tx16s-"], ["Flysky NV14", "nv14-"],
["QX7", "x7-"], ["Frsky Horus X10", "x10-"],
["X9D", "x9d-"], ["Frsky Horus X12s", "x12s-"],
["X9D Plus", "x9dp-"], ["Frsky QX7", "x7-"],
["X9D Plus 2019", "x9dp2019-"], ["Frsky X9D", "x9d-"],
["T-Lite", "tlite-"], ["Frsky X9D Plus", "x9dp-"],
["X-Lite", "xlite-"], ["Frsky X9D Plus 2019", "x9dp2019-"],
["X-Lite S", "xlites-"], ["Frsky X9 Lite", "x9lite-"],
["X9 Lite", "x9lite-"], ["Frsky X9 Lite S", "x9lites-"],
["X9 Lite S", "x9lites-"], ["Frsky X-Lite", "xlite-"],
["T16", "t16-"], ["Frsky X-Lite S", "xlites-"],
["T18", "t18-"], ["Jumper T8", "t8-"],
["TX12", "tx12-"], ["Jumper T12", "t12-"],
["Horus X12s", "x12s-"], ["Jumper T16", "t16-"],
["Horus X10", "x10-"], ["Jumper T18", "t18-"],
["T12", "t12-"], ["Jumper T-Lite", "tlite-"],
["T8", "t8-"], ["Radiomaster TX12", "tx12-"],
["NV14", "nv14-"] ["Radiomaster TX16s", "tx16s-"]
], ],
"changelog": "- Major initial bug fixes" "changelog": "- Major initial bug fixes"
} }
+43 -4
View File
@@ -202,16 +202,55 @@ if(NOT LUA STREQUAL NO)
if(LUA STREQUAL YES) if(LUA STREQUAL YES)
add_definitions(-DLUA_MODEL_SCRIPTS) add_definitions(-DLUA_MODEL_SCRIPTS)
endif() endif()
set(SRC ${SRC} lua/interface.cpp lua/api_general.cpp lua/api_model.cpp)
# TODO: LUA CMAKE
set(SRC ${SRC}
lua/interface.cpp
lua/api_general.cpp
lua/api_model.cpp
lua/api_filesystem.cpp
)
if(GUI_DIR STREQUAL colorlcd) if(GUI_DIR STREQUAL colorlcd)
set(SRC ${SRC} lua/api_colorlcd.cpp lua/widgets.cpp) set(SRC ${SRC} lua/api_colorlcd.cpp lua/widgets.cpp)
else() else()
set(SRC ${SRC} lua/api_stdlcd.cpp) set(SRC ${SRC} lua/api_stdlcd.cpp)
endif() endif()
set(LUA_SRC lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c lparser.c
lstate.c lstring.c ltable.c lrotable.c ltm.c lundump.c lvm.c lzio.c linit.c set(LUA_SRC
lbaselib.c lmathlib.c lbitlib.c loadlib.c lauxlib.c ltablib.c lcorolib.c liolib.c lstrlib.c lapi.c
lcode.c
lctype.c
ldebug.c
ldo.c
ldump.c
lfunc.c
lgc.c
llex.c
lmem.c
lobject.c
lopcodes.c
lparser.c
lstate.c
lstring.c
ltable.c
lrotable.c
ltm.c
lundump.c
lvm.c
lzio.c
linit.c
lbaselib.c
lmathlib.c
lbitlib.c
loadlib.c
lauxlib.c
ltablib.c
lcorolib.c
liolib.c
lstrlib.c
) )
foreach(FILE ${LUA_SRC}) foreach(FILE ${LUA_SRC})
set(SRC ${SRC} ${LUA_DIR}/${FILE}) set(SRC ${SRC} ${LUA_DIR}/${FILE})
endforeach() endforeach()
Binary file not shown.

Before

Width:  |  Height:  |  Size: 427 B

After

Width:  |  Height:  |  Size: 373 B

+25
View File
@@ -503,3 +503,28 @@ void drawHexNumber(BitmapBuffer * dc, coord_t x, coord_t y, uint32_t val, LcdFla
x = dc->drawSizedText(x, y, &c, 1, flags); x = dc->drawSizedText(x, y, &c, 1, flags);
} }
} }
void drawTextLines(BitmapBuffer * dc, coord_t left, coord_t top, coord_t width, coord_t height, char * str, LcdFlags flags)
{
coord_t x = left;
coord_t y = top;
coord_t line = getFontHeight(flags & 0xFFFF);
coord_t space = getTextWidth(" ", 1, flags);
coord_t word;
char * eos = str + strlen(str);
char * nxt;
while (str < eos) {
nxt = strstr(str, " ");
if (!nxt) nxt = eos;
word = getTextWidth(str, nxt - str, flags);
if (x + word > left + width && x > left) {
x = left;
y += line;
}
if (y + line > top + height) break;
dc->drawSizedText(x, y, str, nxt - str, flags);
str = nxt + 1;
x += word + space;
}
}
+1
View File
@@ -72,6 +72,7 @@ void drawGPSPosition(BitmapBuffer * dc, coord_t x, coord_t y, int32_t longitude,
void drawDate(BitmapBuffer * dc, coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags flags = 0); void drawDate(BitmapBuffer * dc, coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags flags = 0);
void drawValueWithUnit(BitmapBuffer * dc, coord_t x, coord_t y, int val, uint8_t unit, LcdFlags flags = 0); void drawValueWithUnit(BitmapBuffer * dc, coord_t x, coord_t y, int val, uint8_t unit, LcdFlags flags = 0);
void drawHexNumber(BitmapBuffer * dc, coord_t x, coord_t y, uint32_t val, LcdFlags flags = 0); void drawHexNumber(BitmapBuffer * dc, coord_t x, coord_t y, uint32_t val, LcdFlags flags = 0);
void drawTextLines(BitmapBuffer * dc, coord_t left, coord_t top, coord_t width, coord_t height, char * str, LcdFlags flags);
inline void drawChn(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t idx, LcdFlags flags) inline void drawChn(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t idx, LcdFlags flags)
{ {
drawSource(dc, x, y, MIXSRC_CH1 + idx - 1, flags); drawSource(dc, x, y, MIXSRC_CH1 + idx - 1, flags);
+11 -11
View File
@@ -71,13 +71,13 @@ class CurveEditWindow : public Page
grid.spacer(PAGE_PADDING); grid.spacer(PAGE_PADDING);
// Name // Name
new StaticText(window, grid.getFieldSlot(), STR_NAME); new StaticText(window, grid.getFieldSlot(), STR_NAME, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
new RadioTextEdit(window, grid.getFieldSlot(), curve.name, sizeof(curve.name)); new RadioTextEdit(window, grid.getFieldSlot(), curve.name, sizeof(curve.name));
grid.nextLine(); grid.nextLine();
// Type // Type
new StaticText(window, grid.getFieldSlot(), STR_TYPE); new StaticText(window, grid.getFieldSlot(), STR_TYPE, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
new Choice(window, grid.getFieldSlot(2, 0), STR_CURVE_TYPES, 0, 1, GET_DEFAULT(g_model.curves[index].type), new Choice(window, grid.getFieldSlot(2, 0), STR_CURVE_TYPES, 0, 1, GET_DEFAULT(g_model.curves[index].type),
[=](int32_t newValue) { [=](int32_t newValue) {
@@ -126,7 +126,7 @@ class CurveEditWindow : public Page
grid.nextLine(); grid.nextLine();
// Smooth // Smooth
new StaticText(window, grid.getFieldSlot(2, 0), STR_SMOOTH); new StaticText(window, grid.getFieldSlot(2, 0), STR_SMOOTH, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(2, 1), GET_DEFAULT(g_model.curves[index].smooth), new CheckBox(window, grid.getFieldSlot(2, 1), GET_DEFAULT(g_model.curves[index].smooth),
[=](int32_t newValue) { [=](int32_t newValue) {
g_model.curves[index].smooth = newValue; g_model.curves[index].smooth = newValue;
@@ -154,12 +154,12 @@ class CurveEditWindow : public Page
grid.spacer(curveEdit->height() + 15); grid.spacer(curveEdit->height() + 15);
// Name // Name
new StaticText(window, grid.getLabelSlot(), STR_NAME); new StaticText(window, grid.getLabelSlot(), STR_NAME, 0, COLOR_THEME_PRIMARY1);
new RadioTextEdit(window, grid.getFieldSlot(), curve.name, sizeof(curve.name)); new RadioTextEdit(window, grid.getFieldSlot(), curve.name, sizeof(curve.name));
grid.nextLine(); grid.nextLine();
// Type // Type
new StaticText(window, grid.getLabelSlot(), STR_TYPE); new StaticText(window, grid.getLabelSlot(), STR_TYPE, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(2, 0), STR_CURVE_TYPES, 0, 1, GET_DEFAULT(g_model.curves[index].type), new Choice(window, grid.getFieldSlot(2, 0), STR_CURVE_TYPES, 0, 1, GET_DEFAULT(g_model.curves[index].type),
[=](int32_t newValue) { [=](int32_t newValue) {
CurveHeader &curve = g_model.curves[index]; CurveHeader &curve = g_model.curves[index];
@@ -207,7 +207,7 @@ class CurveEditWindow : public Page
grid.nextLine(); grid.nextLine();
// Smooth // Smooth
new StaticText(window, grid.getLabelSlot(), STR_SMOOTH); new StaticText(window, grid.getLabelSlot(), STR_SMOOTH, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(), GET_DEFAULT(g_model.curves[index].smooth), new CheckBox(window, grid.getFieldSlot(), GET_DEFAULT(g_model.curves[index].smooth),
[=](int32_t newValue) { [=](int32_t newValue) {
g_model.curves[index].smooth = newValue; g_model.curves[index].smooth = newValue;
@@ -248,10 +248,10 @@ class CurveButton : public Button {
// curve characteristics // curve characteristics
if (isCurveUsed(index)) { if (isCurveUsed(index)) {
CurveHeader &curve = g_model.curves[index]; CurveHeader &curve = g_model.curves[index];
dc->drawNumber(130, 5, 5 + curve.points, LEFT, 0, nullptr, STR_PTS); dc->drawNumber(130, 5, 5 + curve.points, LEFT | COLOR_THEME_PRIMARY1, 0, nullptr, STR_PTS);
dc->drawTextAtIndex(130, 25, STR_CURVE_TYPES, curve.type); dc->drawTextAtIndex(130, 25, STR_CURVE_TYPES, curve.type, COLOR_THEME_PRIMARY1);
if (curve.smooth) if (curve.smooth)
dc->drawText(130, 45, STR_SMOOTH); dc->drawText(130, 45, STR_SMOOTH, COLOR_THEME_PRIMARY1);
} }
} }
@@ -315,7 +315,7 @@ void ModelCurvesPage::build(FormWindow * window, int8_t focusIndex)
// Curve label // Curve label
auto txt = auto txt =
new StaticText(window, grid.getLabelSlot(), getCurveString(1 + index), new StaticText(window, grid.getLabelSlot(), getCurveString(1 + index),
BUTTON_BACKGROUND, CENTERED); BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED);
// Curve drawing // Curve drawing
Button * button = new CurveButton(window, grid.getFieldSlot(), index); Button * button = new CurveButton(window, grid.getFieldSlot(), index);
@@ -343,7 +343,7 @@ void ModelCurvesPage::build(FormWindow * window, int8_t focusIndex)
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(COLOR_THEME_SECONDARY2); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
} }
txt->invalidate(); txt->invalidate();
}); });
+5 -5
View File
@@ -87,23 +87,23 @@ void ModelFlightModesPage::build(FormWindow * window)
char label[16]; char label[16];
getFlightModeString(label, i+1); getFlightModeString(label, i+1);
new Subtitle(group, grid.getLabelSlot(), label); new Subtitle(group, grid.getLabelSlot(), label, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
// Flight mode name // Flight mode name
new StaticText(group, grid.getLabelSlot(true), STR_NAME); new StaticText(group, grid.getLabelSlot(true), STR_NAME, 0, COLOR_THEME_PRIMARY1);
new ModelTextEdit(group, grid.getFieldSlot(), g_model.flightModeData[i].name, LEN_FLIGHT_MODE_NAME); new ModelTextEdit(group, grid.getFieldSlot(), g_model.flightModeData[i].name, LEN_FLIGHT_MODE_NAME);
grid.nextLine(); grid.nextLine();
// Flight mode switch // Flight mode switch
if (i > 0) { if (i > 0) {
new StaticText(group, grid.getLabelSlot(true), STR_SWITCH); new StaticText(group, grid.getLabelSlot(true), STR_SWITCH, 0, COLOR_THEME_PRIMARY1);
new SwitchChoice(group, grid.getFieldSlot(), SWSRC_FIRST_IN_MIXES, SWSRC_LAST_IN_MIXES, GET_SET_DEFAULT(g_model.flightModeData[i].swtch)); new SwitchChoice(group, grid.getFieldSlot(), SWSRC_FIRST_IN_MIXES, SWSRC_LAST_IN_MIXES, GET_SET_DEFAULT(g_model.flightModeData[i].swtch));
grid.nextLine(); grid.nextLine();
} }
// Flight mode trims // Flight mode trims
new StaticText(group, grid.getLabelSlot(true), STR_TRIMS); new StaticText(group, grid.getLabelSlot(true), STR_TRIMS, 0, COLOR_THEME_PRIMARY1);
const char * STR_VTRIMS_MODES = "\002" const char * STR_VTRIMS_MODES = "\002"
"--" "--"
@@ -134,7 +134,7 @@ void ModelFlightModesPage::build(FormWindow * window)
grid.nextLine(); grid.nextLine();
// Flight mode fade in / out // Flight mode fade in / out
new StaticText(group, grid.getLabelSlot(true), "Fade in/out"); new StaticText(group, grid.getLabelSlot(true), "Fade in/out", 0, COLOR_THEME_PRIMARY1);
new NumberEdit(group, grid.getFieldSlot(2, 0), 0, DELAY_MAX, new NumberEdit(group, grid.getFieldSlot(2, 0), 0, DELAY_MAX,
GET_DEFAULT(g_model.flightModeData[i].fadeIn), GET_DEFAULT(g_model.flightModeData[i].fadeIn),
SET_VALUE(g_model.flightModeData[i].fadeIn, newValue), SET_VALUE(g_model.flightModeData[i].fadeIn, newValue),
+8 -8
View File
@@ -65,7 +65,7 @@ void GVarButton::paint(BitmapBuffer * dc)
gvarSum = 0; gvarSum = 0;
LcdFlags bgColor = COLOR_THEME_PRIMARY2; LcdFlags bgColor = COLOR_THEME_PRIMARY2;
LcdFlags textColor = 0; LcdFlags textColor = COLOR_THEME_PRIMARY1;
if (hasFocus()) { if (hasFocus()) {
bgColor = COLOR_THEME_FOCUS; bgColor = COLOR_THEME_FOCUS;
textColor = COLOR_THEME_PRIMARY2; textColor = COLOR_THEME_PRIMARY2;
@@ -87,7 +87,7 @@ void GVarButton::paint(BitmapBuffer * dc)
gvar_t v = fmData->gvars[gvarIdx]; gvar_t v = fmData->gvars[gvarIdx];
gvarSum += v; gvarSum += v;
LcdFlags attr = RIGHT; LcdFlags attr = COLOR_THEME_PRIMARY1 | RIGHT;
if (flightMode == currentFlightMode) if (flightMode == currentFlightMode)
attr |= FONT(BOLD); attr |= FONT(BOLD);
@@ -261,12 +261,12 @@ void GVarEditWindow::buildBody(FormWindow * window)
FormGridLayout grid; FormGridLayout grid;
grid.spacer(8); grid.spacer(8);
new StaticText(window, grid.getLabelSlot(), STR_NAME); new StaticText(window, grid.getLabelSlot(), STR_NAME, 0, COLOR_THEME_PRIMARY1);
new RadioTextEdit(window, grid.getFieldSlot(), gvar->name, LEN_GVAR_NAME); new RadioTextEdit(window, grid.getFieldSlot(), gvar->name, LEN_GVAR_NAME);
grid.nextLine(); grid.nextLine();
new StaticText(window, grid.getLabelSlot(), STR_UNIT); new StaticText(window, grid.getLabelSlot(), STR_UNIT, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), "\001-%", 0, 1, GET_DEFAULT(gvar->unit), new Choice(window, grid.getFieldSlot(), "\001-%", 0, 1, GET_DEFAULT(gvar->unit),
[=](int16_t newValue) { [=](int16_t newValue) {
gvar->unit = newValue; gvar->unit = newValue;
@@ -277,7 +277,7 @@ void GVarEditWindow::buildBody(FormWindow * window)
grid.nextLine(); grid.nextLine();
new StaticText(window, grid.getLabelSlot(), STR_PRECISION); new StaticText(window, grid.getLabelSlot(), STR_PRECISION, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), STR_VPREC, 0, 1, GET_DEFAULT(gvar->prec), new Choice(window, grid.getFieldSlot(), STR_VPREC, 0, 1, GET_DEFAULT(gvar->prec),
[=](int16_t newValue) { [=](int16_t newValue) {
gvar->prec = newValue; gvar->prec = newValue;
@@ -288,7 +288,7 @@ void GVarEditWindow::buildBody(FormWindow * window)
grid.nextLine(); grid.nextLine();
new StaticText(window, grid.getLabelSlot(), STR_MIN); new StaticText(window, grid.getLabelSlot(), STR_MIN, 0, COLOR_THEME_PRIMARY1);
min = new NumberEdit(window, grid.getFieldSlot(), GVAR_MIN, GVAR_MAX - gvar->max, min = new NumberEdit(window, grid.getFieldSlot(), GVAR_MIN, GVAR_MAX - gvar->max,
[=] { return gvar->min + GVAR_MIN; }, [=] { return gvar->min + GVAR_MIN; },
[=](int32_t newValue) { [=](int32_t newValue) {
@@ -299,7 +299,7 @@ void GVarEditWindow::buildBody(FormWindow * window)
); );
grid.nextLine(); grid.nextLine();
new StaticText(window, grid.getLabelSlot(), STR_MAX); new StaticText(window, grid.getLabelSlot(), STR_MAX, 0, COLOR_THEME_PRIMARY1);
max = new NumberEdit(window, grid.getFieldSlot(), GVAR_MIN + gvar->min, GVAR_MAX, max = new NumberEdit(window, grid.getFieldSlot(), GVAR_MIN + gvar->min, GVAR_MAX,
[=] { return GVAR_MAX - gvar->max; }, [=] { return GVAR_MAX - gvar->max; },
[=](int32_t newValue) { [=](int32_t newValue) {
@@ -321,7 +321,7 @@ void GVarEditWindow::buildBody(FormWindow * window)
if (userNameLen > 0) { if (userNameLen > 0) {
strcpy(flightModeName, fmData->name); strcpy(flightModeName, fmData->name);
} }
new StaticText(window, grid.getLabelSlot(), flightModeName); new StaticText(window, grid.getLabelSlot(), flightModeName, 0, COLOR_THEME_PRIMARY1);
if (flightMode > 0) { if (flightMode > 0) {
auto cb = new CheckBox(window, grid.getFieldSlot(2, 0), auto cb = new CheckBox(window, grid.getFieldSlot(2, 0),
[=] { return fmData->gvars[index] <= GVAR_MAX; }, [=](uint8_t checked) { [=] { return fmData->gvars[index] <= GVAR_MAX; }, [=](uint8_t checked) {
+8 -8
View File
@@ -35,42 +35,42 @@ void ModelHeliPage::build(FormWindow * window)
grid.spacer(PAGE_PADDING); grid.spacer(PAGE_PADDING);
// Swash type // Swash type
new StaticText(window, grid.getLabelSlot(), STR_SWASHTYPE); new StaticText(window, grid.getLabelSlot(), STR_SWASHTYPE, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), STR_VSWASHTYPE, 0, SWASH_TYPE_MAX, GET_SET_DEFAULT(g_model.swashR.type)); new Choice(window, grid.getFieldSlot(), STR_VSWASHTYPE, 0, SWASH_TYPE_MAX, GET_SET_DEFAULT(g_model.swashR.type));
grid.nextLine(); grid.nextLine();
// Swash ring // Swash ring
new StaticText(window, grid.getLabelSlot(), STR_SWASHRING); new StaticText(window, grid.getLabelSlot(), STR_SWASHRING, 0, COLOR_THEME_PRIMARY1);
new NumberEdit(window, grid.getFieldSlot(), 0, 100, GET_SET_DEFAULT(g_model.swashR.value)); new NumberEdit(window, grid.getFieldSlot(), 0, 100, GET_SET_DEFAULT(g_model.swashR.value));
grid.nextLine(); grid.nextLine();
// Elevator source // Elevator source
new StaticText(window, grid.getLabelSlot(), STR_ELEVATOR); new StaticText(window, grid.getLabelSlot(), STR_ELEVATOR, 0, COLOR_THEME_PRIMARY1);
new SourceChoice(window, grid.getFieldSlot(), 0, MIXSRC_LAST_CH, GET_SET_DEFAULT(g_model.swashR.elevatorSource)); new SourceChoice(window, grid.getFieldSlot(), 0, MIXSRC_LAST_CH, GET_SET_DEFAULT(g_model.swashR.elevatorSource));
grid.nextLine(); grid.nextLine();
// Elevator weight // Elevator weight
new StaticText(window, grid.getLabelSlot(), STR_WEIGHT); new StaticText(window, grid.getLabelSlot(), STR_WEIGHT, 0, COLOR_THEME_PRIMARY1);
new NumberEdit(window, grid.getFieldSlot(), -100, 100, GET_SET_DEFAULT(g_model.swashR.elevatorWeight)); new NumberEdit(window, grid.getFieldSlot(), -100, 100, GET_SET_DEFAULT(g_model.swashR.elevatorWeight));
grid.nextLine(); grid.nextLine();
// Aileron source // Aileron source
new StaticText(window, grid.getLabelSlot(), STR_AILERON); new StaticText(window, grid.getLabelSlot(), STR_AILERON, 0, COLOR_THEME_PRIMARY1);
new SourceChoice(window, grid.getFieldSlot(), 0, MIXSRC_LAST_CH, GET_SET_DEFAULT(g_model.swashR.aileronSource)); new SourceChoice(window, grid.getFieldSlot(), 0, MIXSRC_LAST_CH, GET_SET_DEFAULT(g_model.swashR.aileronSource));
grid.nextLine(); grid.nextLine();
// Aileron weight // Aileron weight
new StaticText(window, grid.getLabelSlot(), STR_WEIGHT); new StaticText(window, grid.getLabelSlot(), STR_WEIGHT, 0, COLOR_THEME_PRIMARY1);
new NumberEdit(window, grid.getFieldSlot(), -100, 100, GET_SET_DEFAULT(g_model.swashR.aileronWeight)); new NumberEdit(window, grid.getFieldSlot(), -100, 100, GET_SET_DEFAULT(g_model.swashR.aileronWeight));
grid.nextLine(); grid.nextLine();
// Collective source // Collective source
new StaticText(window, grid.getLabelSlot(), STR_COLLECTIVE); new StaticText(window, grid.getLabelSlot(), STR_COLLECTIVE, 0, COLOR_THEME_PRIMARY1);
new SourceChoice(window, grid.getFieldSlot(), 0, MIXSRC_LAST_CH, GET_SET_DEFAULT(g_model.swashR.collectiveSource)); new SourceChoice(window, grid.getFieldSlot(), 0, MIXSRC_LAST_CH, GET_SET_DEFAULT(g_model.swashR.collectiveSource));
grid.nextLine(); grid.nextLine();
// Collective weight // Collective weight
new StaticText(window, grid.getLabelSlot(), STR_WEIGHT); new StaticText(window, grid.getLabelSlot(), STR_WEIGHT, 0, COLOR_THEME_PRIMARY1);
new NumberEdit(window, grid.getFieldSlot(), -100, 100, GET_SET_DEFAULT(g_model.swashR.collectiveWeight)); new NumberEdit(window, grid.getFieldSlot(), -100, 100, GET_SET_DEFAULT(g_model.swashR.collectiveWeight));
grid.nextLine(); grid.nextLine();
+13 -13
View File
@@ -194,17 +194,17 @@ class InputEditWindow : public Page
#endif #endif
// Input Name // Input Name
new StaticText(window, grid.getLabelSlot(), STR_INPUTNAME); new StaticText(window, grid.getLabelSlot(), STR_INPUTNAME, 0, COLOR_THEME_PRIMARY1);
new ModelTextEdit(window, grid.getFieldSlot(), g_model.inputNames[line->chn], sizeof(g_model.inputNames[line->chn])); new ModelTextEdit(window, grid.getFieldSlot(), g_model.inputNames[line->chn], sizeof(g_model.inputNames[line->chn]));
grid.nextLine(); grid.nextLine();
// Switch // Switch
new StaticText(window, grid.getLabelSlot(), STR_SWITCH); new StaticText(window, grid.getLabelSlot(), STR_SWITCH, 0, COLOR_THEME_PRIMARY1);
new SwitchChoice(window, grid.getFieldSlot(), SWSRC_FIRST_IN_MIXES, SWSRC_LAST_IN_MIXES, GET_SET_DEFAULT(line->swtch)); new SwitchChoice(window, grid.getFieldSlot(), SWSRC_FIRST_IN_MIXES, SWSRC_LAST_IN_MIXES, GET_SET_DEFAULT(line->swtch));
grid.nextLine(); grid.nextLine();
// Side // Side
new StaticText(window, grid.getLabelSlot(), STR_SIDE); new StaticText(window, grid.getLabelSlot(), STR_SIDE, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), STR_VCURVEFUNC, 1, 3, new Choice(window, grid.getFieldSlot(), STR_VCURVEFUNC, 1, 3,
[=]() -> int16_t { [=]() -> int16_t {
return 4 - line->mode; return 4 - line->mode;
@@ -216,12 +216,12 @@ class InputEditWindow : public Page
grid.nextLine(); grid.nextLine();
// Name // Name
new StaticText(window, grid.getLabelSlot(), STR_EXPONAME); new StaticText(window, grid.getLabelSlot(), STR_EXPONAME, 0, COLOR_THEME_PRIMARY1);
new ModelTextEdit(window, grid.getFieldSlot(), line->name, sizeof(line->name)); new ModelTextEdit(window, grid.getFieldSlot(), line->name, sizeof(line->name));
grid.nextLine(); grid.nextLine();
// Source // Source
new StaticText(window, grid.getLabelSlot(), STR_SOURCE); new StaticText(window, grid.getLabelSlot(), STR_SOURCE, 0, COLOR_THEME_PRIMARY1);
new SourceChoice(window, grid.getFieldSlot(), INPUTSRC_FIRST, INPUTSRC_LAST, new SourceChoice(window, grid.getFieldSlot(), INPUTSRC_FIRST, INPUTSRC_LAST,
GET_DEFAULT(line->srcRaw), GET_DEFAULT(line->srcRaw),
[=] (int32_t newValue) { [=] (int32_t newValue) {
@@ -241,24 +241,24 @@ class InputEditWindow : public Page
// Scale // Scale
// TODO only displayed when source is telemetry + unfinished // TODO only displayed when source is telemetry + unfinished
new StaticText(window, grid.getLabelSlot(), STR_SCALE); new StaticText(window, grid.getLabelSlot(), STR_SCALE, 0, COLOR_THEME_PRIMARY1);
new NumberEdit(window, grid.getFieldSlot(), -100, 100, GET_SET_DEFAULT(line->scale)); new NumberEdit(window, grid.getFieldSlot(), -100, 100, GET_SET_DEFAULT(line->scale));
grid.nextLine(); grid.nextLine();
// Weight // Weight
new StaticText(window, grid.getLabelSlot(), STR_WEIGHT); new StaticText(window, grid.getLabelSlot(), STR_WEIGHT, 0, COLOR_THEME_PRIMARY1);
auto gvar = new GVarNumberEdit(window, grid.getFieldSlot(), -100, 100, GET_SET_DEFAULT(line->weight)); auto gvar = new GVarNumberEdit(window, grid.getFieldSlot(), -100, 100, GET_SET_DEFAULT(line->weight));
gvar->setSuffix("%"); gvar->setSuffix("%");
grid.nextLine(); grid.nextLine();
// Offset // Offset
new StaticText(window, grid.getLabelSlot(), STR_OFFSET); new StaticText(window, grid.getLabelSlot(), STR_OFFSET, 0, COLOR_THEME_PRIMARY1);
gvar = new GVarNumberEdit(window, grid.getFieldSlot(), -100, 100, GET_SET_DEFAULT(line->offset)); gvar = new GVarNumberEdit(window, grid.getFieldSlot(), -100, 100, GET_SET_DEFAULT(line->offset));
gvar->setSuffix("%"); gvar->setSuffix("%");
grid.nextLine(); grid.nextLine();
// Trim // Trim
new StaticText(window, grid.getLabelSlot(), STR_TRIM); new StaticText(window, grid.getLabelSlot(), STR_TRIM, 0, COLOR_THEME_PRIMARY1);
trimChoice = new Choice(window, grid.getFieldSlot(), STR_VMIXTRIMS, -TRIM_OFF, -TRIM_LAST, trimChoice = new Choice(window, grid.getFieldSlot(), STR_VMIXTRIMS, -TRIM_OFF, -TRIM_LAST,
GET_VALUE(-line->carryTrim), GET_VALUE(-line->carryTrim),
SET_VALUE(line->carryTrim, -newValue)); SET_VALUE(line->carryTrim, -newValue));
@@ -268,7 +268,7 @@ class InputEditWindow : public Page
grid.nextLine(); grid.nextLine();
// Curve // Curve
new StaticText(&body, grid.getLabelSlot(), STR_CURVE); new StaticText(&body, grid.getLabelSlot(), STR_CURVE, 0, COLOR_THEME_PRIMARY1);
new Choice(&body, grid.getFieldSlot(2, 0), "\004DiffExpoFuncCstm", 0, CURVE_REF_CUSTOM, new Choice(&body, grid.getFieldSlot(2, 0), "\004DiffExpoFuncCstm", 0, CURVE_REF_CUSTOM,
GET_DEFAULT(line->curve.type), GET_DEFAULT(line->curve.type),
[=](int32_t newValue) { [=](int32_t newValue) {
@@ -282,7 +282,7 @@ class InputEditWindow : public Page
grid.nextLine(); grid.nextLine();
// Flight modes // Flight modes
new StaticText(window, grid.getLabelSlot(), STR_FLMODE); new StaticText(window, grid.getLabelSlot(), STR_FLMODE, 0, COLOR_THEME_PRIMARY1);
for (uint32_t i=0; i<MAX_FLIGHT_MODES; i++) { for (uint32_t i=0; i<MAX_FLIGHT_MODES; i++) {
char fm[2] = { char('0' + i), '\0'}; char fm[2] = { char('0' + i), '\0'};
if (i > 0 && (i % 4) == 0) if (i > 0 && (i % 4) == 0)
@@ -439,7 +439,7 @@ void ModelInputsPage::build(FormWindow *window, int8_t focusIndex)
coord_t h = grid.getWindowHeight(); coord_t h = grid.getWindowHeight();
auto txt = new StaticText(window, grid.getLabelSlot(), auto txt = new StaticText(window, grid.getLabelSlot(),
getSourceString(MIXSRC_FIRST_INPUT + input), getSourceString(MIXSRC_FIRST_INPUT + input),
BUTTON_BACKGROUND, CENTERED); BUTTON_BACKGROUND, CENTERED | COLOR_THEME_PRIMARY1);
while (inputIndex < MAX_EXPOS && line->chn == input && EXPO_VALID(line)) { while (inputIndex < MAX_EXPOS && line->chn == input && EXPO_VALID(line)) {
Button *button = Button *button =
@@ -499,7 +499,7 @@ void ModelInputsPage::build(FormWindow *window, int8_t focusIndex)
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(COLOR_THEME_SECONDARY2); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
} }
txt->invalidate(); txt->invalidate();
if (focus) button->bringToTop(); if (focus) button->bringToTop();
+1 -1
View File
@@ -42,7 +42,7 @@ class ModelInputsPage: public PageTab {
class CommonInputOrMixButton : public Button { class CommonInputOrMixButton : public Button {
public: public:
CommonInputOrMixButton(FormGroup * parent, const rect_t & rect, uint8_t index): CommonInputOrMixButton(FormGroup * parent, const rect_t & rect, uint8_t index):
Button(parent, rect), Button(parent, rect, nullptr, 0, COLOR_THEME_PRIMARY1),
index(index) index(index)
{ {
setFocusHandler([=](bool active) { setFocusHandler([=](bool active) {
@@ -94,18 +94,18 @@ class LogicalSwitchEditPage: public Page
uint8_t cstate = lswFamily(cs->func); uint8_t cstate = lswFamily(cs->func);
if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) { if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) {
new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V1); new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V1, 0, COLOR_THEME_PRIMARY1);
auto choice = new SwitchChoice(logicalSwitchOneWindow, grid.getFieldSlot(), SWSRC_FIRST_IN_LOGICAL_SWITCHES, SWSRC_LAST_IN_LOGICAL_SWITCHES, GET_SET_DEFAULT(cs->v1)); auto choice = new SwitchChoice(logicalSwitchOneWindow, grid.getFieldSlot(), SWSRC_FIRST_IN_LOGICAL_SWITCHES, SWSRC_LAST_IN_LOGICAL_SWITCHES, GET_SET_DEFAULT(cs->v1));
choice->setAvailableHandler(isSwitchAvailableInLogicalSwitches); choice->setAvailableHandler(isSwitchAvailableInLogicalSwitches);
grid.nextLine(); grid.nextLine();
new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V2); new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V2, 0, COLOR_THEME_PRIMARY1);
choice = new SwitchChoice(logicalSwitchOneWindow, grid.getFieldSlot(), SWSRC_FIRST_IN_LOGICAL_SWITCHES, SWSRC_LAST_IN_LOGICAL_SWITCHES, GET_SET_DEFAULT(cs->v2)); choice = new SwitchChoice(logicalSwitchOneWindow, grid.getFieldSlot(), SWSRC_FIRST_IN_LOGICAL_SWITCHES, SWSRC_LAST_IN_LOGICAL_SWITCHES, GET_SET_DEFAULT(cs->v2));
choice->setAvailableHandler(isSwitchAvailableInLogicalSwitches); choice->setAvailableHandler(isSwitchAvailableInLogicalSwitches);
grid.nextLine(); grid.nextLine();
} }
else if (cstate == LS_FAMILY_EDGE) { else if (cstate == LS_FAMILY_EDGE) {
new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V1); new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V1, 0, COLOR_THEME_PRIMARY1);
auto choice = new SwitchChoice(logicalSwitchOneWindow, grid.getFieldSlot(), SWSRC_FIRST_IN_LOGICAL_SWITCHES, SWSRC_LAST_IN_LOGICAL_SWITCHES, GET_SET_DEFAULT(cs->v1)); auto choice = new SwitchChoice(logicalSwitchOneWindow, grid.getFieldSlot(), SWSRC_FIRST_IN_LOGICAL_SWITCHES, SWSRC_LAST_IN_LOGICAL_SWITCHES, GET_SET_DEFAULT(cs->v1));
choice->setAvailableHandler(isSwitchAvailableInLogicalSwitches); choice->setAvailableHandler(isSwitchAvailableInLogicalSwitches);
grid.nextLine(); grid.nextLine();
@@ -133,23 +133,23 @@ class LogicalSwitchEditPage: public Page
grid.nextLine(); grid.nextLine();
} }
else if (cstate == LS_FAMILY_COMP) { else if (cstate == LS_FAMILY_COMP) {
new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V1); new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V1, 0, COLOR_THEME_PRIMARY1);
new SourceChoice(logicalSwitchOneWindow, grid.getFieldSlot(), 0, MIXSRC_LAST_TELEM, GET_SET_DEFAULT(cs->v1)); new SourceChoice(logicalSwitchOneWindow, grid.getFieldSlot(), 0, MIXSRC_LAST_TELEM, GET_SET_DEFAULT(cs->v1));
grid.nextLine(); grid.nextLine();
new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V2); new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V2, 0, COLOR_THEME_PRIMARY1);
new SourceChoice(logicalSwitchOneWindow, grid.getFieldSlot(), 0, MIXSRC_LAST_TELEM, GET_SET_DEFAULT(cs->v2)); new SourceChoice(logicalSwitchOneWindow, grid.getFieldSlot(), 0, MIXSRC_LAST_TELEM, GET_SET_DEFAULT(cs->v2));
grid.nextLine(); grid.nextLine();
} }
else if (cstate == LS_FAMILY_TIMER) { else if (cstate == LS_FAMILY_TIMER) {
new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V1); new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V1, 0, COLOR_THEME_PRIMARY1);
auto timer = new NumberEdit(logicalSwitchOneWindow, grid.getFieldSlot(), -128, 122, GET_SET_DEFAULT(cs->v1)); auto timer = new NumberEdit(logicalSwitchOneWindow, grid.getFieldSlot(), -128, 122, GET_SET_DEFAULT(cs->v1));
timer->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) { timer->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, lswTimerValue(value), flags | PREC1); dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, lswTimerValue(value), flags | PREC1);
}); });
grid.nextLine(); grid.nextLine();
new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V2); new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V2, 0, COLOR_THEME_PRIMARY1);
timer = new NumberEdit(logicalSwitchOneWindow, grid.getFieldSlot(), -128, 122, GET_SET_DEFAULT(cs->v2)); timer = new NumberEdit(logicalSwitchOneWindow, grid.getFieldSlot(), -128, 122, GET_SET_DEFAULT(cs->v2));
timer->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) { timer->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, lswTimerValue(value), flags | PREC1); dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, lswTimerValue(value), flags | PREC1);
@@ -157,7 +157,7 @@ class LogicalSwitchEditPage: public Page
grid.nextLine(); grid.nextLine();
} }
else { else {
new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V1); new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V1, 0, COLOR_THEME_PRIMARY1);
new SourceChoice(logicalSwitchOneWindow, grid.getFieldSlot(), 0, MIXSRC_LAST_TELEM, GET_DEFAULT(cs->v1), new SourceChoice(logicalSwitchOneWindow, grid.getFieldSlot(), 0, MIXSRC_LAST_TELEM, GET_DEFAULT(cs->v1),
[=](int32_t newValue) { [=](int32_t newValue) {
cs->v1 = newValue; cs->v1 = newValue;
@@ -173,7 +173,7 @@ class LogicalSwitchEditPage: public Page
}); });
grid.nextLine(); grid.nextLine();
new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V2); new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V2, 0, COLOR_THEME_PRIMARY1);
int16_t v2_min = 0, v2_max = 0; int16_t v2_min = 0, v2_max = 0;
getMixSrcRange(cs->v1, v2_min, v2_max); getMixSrcRange(cs->v1, v2_min, v2_max);
v2Edit = new NumberEdit(logicalSwitchOneWindow, grid.getFieldSlot(), v2_min, v2_max, GET_SET_DEFAULT(cs->v2)); v2Edit = new NumberEdit(logicalSwitchOneWindow, grid.getFieldSlot(), v2_min, v2_max, GET_SET_DEFAULT(cs->v2));
@@ -184,21 +184,21 @@ class LogicalSwitchEditPage: public Page
} }
// AND switch // AND switch
new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_AND_SWITCH); new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_AND_SWITCH, 0, COLOR_THEME_PRIMARY1);
auto choice = new SwitchChoice(logicalSwitchOneWindow, grid.getFieldSlot(), -MAX_LS_ANDSW, MAX_LS_ANDSW, GET_SET_DEFAULT(cs->andsw)); auto choice = new SwitchChoice(logicalSwitchOneWindow, grid.getFieldSlot(), -MAX_LS_ANDSW, MAX_LS_ANDSW, GET_SET_DEFAULT(cs->andsw));
choice->setAvailableHandler(isSwitchAvailableInLogicalSwitches); choice->setAvailableHandler(isSwitchAvailableInLogicalSwitches);
grid.nextLine(); grid.nextLine();
// Duration // Duration
new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_DURATION); new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_DURATION, 0, COLOR_THEME_PRIMARY1);
auto edit = new NumberEdit(logicalSwitchOneWindow, grid.getFieldSlot(), 0, MAX_LS_DURATION, GET_SET_DEFAULT(cs->duration), 0, PREC1); auto edit = new NumberEdit(logicalSwitchOneWindow, grid.getFieldSlot(), 0, MAX_LS_DURATION, GET_SET_DEFAULT(cs->duration), 0, PREC1);
edit->setZeroText("---"); edit->setZeroText("---");
grid.nextLine(); grid.nextLine();
// Delay // Delay
new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_DELAY); new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_DELAY, 0, COLOR_THEME_PRIMARY1);
if (cstate == LS_FAMILY_EDGE) { if (cstate == LS_FAMILY_EDGE) {
new StaticText(logicalSwitchOneWindow, grid.getFieldSlot(), STR_NA); new StaticText(logicalSwitchOneWindow, grid.getFieldSlot(), STR_NA, 0, COLOR_THEME_PRIMARY1);
} }
else { else {
auto edit = new NumberEdit(logicalSwitchOneWindow, grid.getFieldSlot(), 0, MAX_LS_DELAY, GET_SET_DEFAULT(cs->delay), 0, PREC1); auto edit = new NumberEdit(logicalSwitchOneWindow, grid.getFieldSlot(), 0, MAX_LS_DELAY, GET_SET_DEFAULT(cs->delay), 0, PREC1);
@@ -215,7 +215,7 @@ class LogicalSwitchEditPage: public Page
LogicalSwitchData * cs = lswAddress(index); LogicalSwitchData * cs = lswAddress(index);
// LS Func // LS Func
new StaticText(window, grid.getLabelSlot(), STR_FUNC); new StaticText(window, grid.getLabelSlot(), STR_FUNC, 0, COLOR_THEME_PRIMARY1);
auto functionChoice = new Choice(window, grid.getFieldSlot(), STR_VCSWFUNC, 0, LS_FUNC_MAX, GET_DEFAULT(cs->func)); auto functionChoice = new Choice(window, grid.getFieldSlot(), STR_VCSWFUNC, 0, LS_FUNC_MAX, GET_DEFAULT(cs->func));
functionChoice->setSetValueHandler([=](int32_t newValue) { functionChoice->setSetValueHandler([=](int32_t newValue) {
cs->func = newValue; cs->func = newValue;
@@ -253,7 +253,7 @@ class LogicalSwitchButton : public Button
{ {
public: public:
LogicalSwitchButton(FormGroup* parent, const rect_t& rect, int lsIndex) : LogicalSwitchButton(FormGroup* parent, const rect_t& rect, int lsIndex) :
Button(parent, rect), lsIndex(lsIndex), active(isActive()) Button(parent, rect, nullptr, 0, COLOR_THEME_PRIMARY1), lsIndex(lsIndex), active(isActive())
{ {
LogicalSwitchData* ls = lswAddress(lsIndex); LogicalSwitchData* ls = lswAddress(lsIndex);
if (ls->andsw != SWSRC_NONE || ls->duration != 0 || ls->delay != 0) if (ls->andsw != SWSRC_NONE || ls->duration != 0 || ls->delay != 0)
@@ -282,42 +282,38 @@ class LogicalSwitchButton : public Button
uint8_t lsFamily = lswFamily(ls->func); uint8_t lsFamily = lswFamily(ls->func);
// CSW func // CSW func
dc->drawTextAtIndex(col1, line1, STR_VCSWFUNC, ls->func); dc->drawTextAtIndex(col1, line1, STR_VCSWFUNC, ls->func, COLOR_THEME_PRIMARY1);
// CSW params // CSW params
if (lsFamily == LS_FAMILY_BOOL || lsFamily == LS_FAMILY_STICKY) { if (lsFamily == LS_FAMILY_BOOL || lsFamily == LS_FAMILY_STICKY) {
drawSwitch(dc, col2, line1, ls->v1); drawSwitch(dc, col2, line1, ls->v1, COLOR_THEME_PRIMARY1);
drawSwitch(dc, col3, line1, ls->v2); drawSwitch(dc, col3, line1, ls->v2, COLOR_THEME_PRIMARY1);
} else if (lsFamily == LS_FAMILY_EDGE) { } else if (lsFamily == LS_FAMILY_EDGE) {
drawSwitch(dc, col1, line2, ls->v1); drawSwitch(dc, col1, line2, ls->v1, COLOR_THEME_PRIMARY1);
putsEdgeDelayParam(dc, col2, line2, ls); putsEdgeDelayParam(dc, col2, line2, ls, COLOR_THEME_PRIMARY1);
} else if (lsFamily == LS_FAMILY_COMP) { } else if (lsFamily == LS_FAMILY_COMP) {
drawSource(dc, col2, line1, ls->v1, 0); drawSource(dc, col2, line1, ls->v1, COLOR_THEME_PRIMARY1);
drawSource(dc, col3, line1, ls->v2, 0); drawSource(dc, col3, line1, ls->v2, COLOR_THEME_PRIMARY1);
} else if (lsFamily == LS_FAMILY_TIMER) { } else if (lsFamily == LS_FAMILY_TIMER) {
dc->drawNumber(col2, line1, lswTimerValue(ls->v1), LEFT | PREC1); dc->drawNumber(col2, line1, lswTimerValue(ls->v1), COLOR_THEME_PRIMARY1 | LEFT | PREC1);
dc->drawNumber(col3, line1, lswTimerValue(ls->v2), LEFT | PREC1); dc->drawNumber(col3, line1, lswTimerValue(ls->v2), COLOR_THEME_PRIMARY1 | LEFT | PREC1);
} else { } else {
drawSource(dc, col2, line1, ls->v1, 0); drawSource(dc, col2, line1, ls->v1, COLOR_THEME_PRIMARY1);
drawSourceCustomValue( drawSourceCustomValue(dc, col3, line1, ls->v1,
dc, col3, line1, ls->v1, (ls->v1 <= MIXSRC_LAST_CH ? calc100toRESX(ls->v2) : ls->v2), COLOR_THEME_PRIMARY1);
(ls->v1 <= MIXSRC_LAST_CH ? calc100toRESX(ls->v2) : ls->v2), 0);
} }
// AND switch // AND switch
drawSwitch(dc, col1, (lsFamily == LS_FAMILY_EDGE) ? line3 : line2, drawSwitch(dc, col1, (lsFamily == LS_FAMILY_EDGE) ? line3 : line2, ls->andsw, COLOR_THEME_PRIMARY1);
ls->andsw, 0);
// CSW duration // CSW duration
if (ls->duration > 0) { if (ls->duration > 0) {
dc->drawNumber(col2, (lsFamily == LS_FAMILY_EDGE) ? line3 : line2, dc->drawNumber(col2, (lsFamily == LS_FAMILY_EDGE) ? line3 : line2, ls->duration, COLOR_THEME_PRIMARY1 | PREC1 | LEFT);
ls->duration, PREC1 | LEFT);
} }
// CSW delay // CSW delay
if (lsFamily != LS_FAMILY_EDGE && ls->delay > 0) { if (lsFamily != LS_FAMILY_EDGE && ls->delay > 0) {
dc->drawNumber(col3, (lsFamily == LS_FAMILY_EDGE) ? line3 : line2, dc->drawNumber(col3, (lsFamily == LS_FAMILY_EDGE) ? line3 : line2, ls->delay, COLOR_THEME_PRIMARY1 | PREC1 | LEFT);
ls->delay, PREC1 | LEFT);
} }
} }
@@ -393,7 +389,7 @@ void ModelLogicalSwitchesPage::build(FormWindow* window, int8_t focusIndex)
} else { } else {
auto txt = new StaticText(window, grid.getLabelSlot(), auto txt = new StaticText(window, grid.getLabelSlot(),
getSwitchPositionName(SWSRC_SW1 + i), getSwitchPositionName(SWSRC_SW1 + i),
BUTTON_BACKGROUND, CENTERED); BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED);
auto button = new LogicalSwitchButton(window, grid.getFieldSlot(), i); auto button = new LogicalSwitchButton(window, grid.getFieldSlot(), i);
button->setPressHandler([=]() { button->setPressHandler([=]() {
@@ -425,7 +421,7 @@ void ModelLogicalSwitchesPage::build(FormWindow* window, int8_t focusIndex)
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(COLOR_THEME_SECONDARY2); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
} }
txt->invalidate(); txt->invalidate();
}); });
+12 -17
View File
@@ -78,7 +78,7 @@ class ScriptEditWindow : public Page {
ScriptData* sd = &(g_model.scriptsData[idx]); ScriptData* sd = &(g_model.scriptsData[idx]);
// Filename // Filename
new StaticText(window, grid.getLabelSlot(), STR_SCRIPT); new StaticText(window, grid.getLabelSlot(), STR_SCRIPT, 0, COLOR_THEME_PRIMARY1);
auto fc = new FileChoice( auto fc = new FileChoice(
window, grid.getFieldSlot(), SCRIPTS_MIXES_PATH, SCRIPTS_EXT, window, grid.getFieldSlot(), SCRIPTS_MIXES_PATH, SCRIPTS_EXT,
LEN_SCRIPT_FILENAME, LEN_SCRIPT_FILENAME,
@@ -93,7 +93,7 @@ class ScriptEditWindow : public Page {
grid.nextLine(); grid.nextLine();
// Custom name // Custom name
new StaticText(window, grid.getLabelSlot(), STR_NAME); new StaticText(window, grid.getLabelSlot(), STR_NAME, 0, COLOR_THEME_PRIMARY1);
new ModelTextEdit(window, grid.getFieldSlot(), sd->name, sizeof(sd->name)); new ModelTextEdit(window, grid.getFieldSlot(), sd->name, sizeof(sd->name));
grid.nextLine(); grid.nextLine();
@@ -101,17 +101,15 @@ class ScriptEditWindow : public Page {
ScriptInputsOutputs& sio = scriptInputsOutputs[idx]; ScriptInputsOutputs& sio = scriptInputsOutputs[idx];
if (sio.inputsCount > 0) { if (sio.inputsCount > 0) {
new Subtitle(window, grid.getLineSlot(), STR_INPUTS); new Subtitle(window, grid.getLineSlot(), STR_INPUTS, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
auto gInputs = auto gInputs = new FormGroup(window, grid.getFieldSlot(), FORM_BORDER_FOCUS_ONLY | PAINT_CHILDREN_FIRST);
new FormGroup(window, grid.getFieldSlot(),
FORM_BORDER_FOCUS_ONLY | PAINT_CHILDREN_FIRST);
GridLayout inputsGrid(gInputs); GridLayout inputsGrid(gInputs);
for (int i = 0; i < sio.inputsCount; i++) { for (int i = 0; i < sio.inputsCount; i++) {
ScriptInput& si = sio.inputs[i]; ScriptInput& si = sio.inputs[i];
new StaticText(window, grid.getLabelSlot(true), si.name); new StaticText(window, grid.getLabelSlot(true), si.name, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
if (si.type == INPUT_TYPE_VALUE) { if (si.type == INPUT_TYPE_VALUE) {
new NumberEdit(gInputs, inputsGrid.getSlot(), si.min - si.def, new NumberEdit(gInputs, inputsGrid.getSlot(), si.min - si.def,
@@ -128,7 +126,7 @@ class ScriptEditWindow : public Page {
} }
if (sio.outputsCount > 0) { if (sio.outputsCount > 0) {
new Subtitle(window, grid.getLabelSlot(), STR_OUTPUTS); new Subtitle(window, grid.getLabelSlot(), STR_OUTPUTS, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
auto gOutputs = auto gOutputs =
@@ -140,12 +138,10 @@ class ScriptEditWindow : public Page {
ScriptOutput* so = &(sio.outputs[i]); ScriptOutput* so = &(sio.outputs[i]);
new DynamicText(gOutputs, outputsGrid.getLabelSlot(), [=]() { new DynamicText(gOutputs, outputsGrid.getLabelSlot(), [=]() {
char s[16]; char s[16];
getSourceString(s, getSourceString(s, MIXSRC_FIRST_LUA + (idx * MAX_SCRIPT_OUTPUTS) + i);
MIXSRC_FIRST_LUA + (idx * MAX_SCRIPT_OUTPUTS) + i);
return std::string(s, sizeof(s) - 1); return std::string(s, sizeof(s) - 1);
}); }, COLOR_THEME_PRIMARY1);
new DynamicNumber<int>(gOutputs, outputsGrid.getFieldSlot(), new DynamicNumber<int>(gOutputs, outputsGrid.getFieldSlot(), [=]() { return calcRESXto1000(so->value); }, COLOR_THEME_PRIMARY1);
[=]() { return calcRESXto1000(so->value); });
outputsGrid.nextLine(); outputsGrid.nextLine();
} }
@@ -200,8 +196,7 @@ class ScriptLineButton : public Button
switch (runtimeData->state) { switch (runtimeData->state) {
case SCRIPT_SYNTAX_ERROR: case SCRIPT_SYNTAX_ERROR:
dc->drawSizedText(x, y, SCRIPT_STATUS_ERROR, dc->drawSizedText(x, y, SCRIPT_STATUS_ERROR, sizeof(SCRIPT_STATUS_ERROR), textColor);
sizeof(SCRIPT_STATUS_ERROR), textColor);
break; break;
default: default:
dc->drawNumber(x, y, runtimeData->instructions, textColor, 0, nullptr, "%"); dc->drawNumber(x, y, runtimeData->instructions, textColor, 0, nullptr, "%");
@@ -253,7 +248,7 @@ void ModelMixerScriptsPage::build(FormWindow * window, int8_t focusIdx)
// LUAx label // LUAx label
auto txt = new StaticText(window, grid.getLabelSlot(), auto txt = new StaticText(window, grid.getLabelSlot(),
std::string("LUA") + std::to_string(idx + 1), std::string("LUA") + std::to_string(idx + 1),
BUTTON_BACKGROUND, CENTERED); BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED);
Button* button = new ScriptLineButton(window, grid.getFieldSlot(), sd, runtimeData); Button* button = new ScriptLineButton(window, grid.getFieldSlot(), sd, runtimeData);
@@ -279,7 +274,7 @@ void ModelMixerScriptsPage::build(FormWindow * window, int8_t focusIdx)
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(COLOR_THEME_SECONDARY2); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
} }
txt->invalidate(); txt->invalidate();
}); });
+17 -17
View File
@@ -88,19 +88,19 @@ class MixEditWindow : public Page
MixData *mix = mixAddress(mixIndex); MixData *mix = mixAddress(mixIndex);
// Mix name // Mix name
new StaticText(window, grid.getLabelSlot(), STR_MIXNAME); new StaticText(window, grid.getLabelSlot(), STR_MIXNAME, 0, COLOR_THEME_PRIMARY1);
new ModelTextEdit(window, grid.getFieldSlot(), mix->name, new ModelTextEdit(window, grid.getFieldSlot(), mix->name,
sizeof(mix->name)); sizeof(mix->name));
grid.nextLine(); grid.nextLine();
// Source // Source
new StaticText(window, grid.getLabelSlot(), STR_SOURCE); new StaticText(window, grid.getLabelSlot(), STR_SOURCE, 0, COLOR_THEME_PRIMARY1);
new SourceChoice(window, grid.getFieldSlot(), 0, MIXSRC_LAST, new SourceChoice(window, grid.getFieldSlot(), 0, MIXSRC_LAST,
GET_SET_DEFAULT(mix->srcRaw)); GET_SET_DEFAULT(mix->srcRaw));
grid.nextLine(); grid.nextLine();
// Weight // Weight
new StaticText(window, grid.getLabelSlot(), STR_WEIGHT); new StaticText(window, grid.getLabelSlot(), STR_WEIGHT, 0, COLOR_THEME_PRIMARY1);
auto gvar = auto gvar =
new GVarNumberEdit(window, grid.getFieldSlot(), MIX_WEIGHT_MIN, new GVarNumberEdit(window, grid.getFieldSlot(), MIX_WEIGHT_MIN,
MIX_WEIGHT_MAX, GET_SET_DEFAULT(mix->weight)); MIX_WEIGHT_MAX, GET_SET_DEFAULT(mix->weight));
@@ -108,19 +108,19 @@ class MixEditWindow : public Page
grid.nextLine(); grid.nextLine();
// Offset // Offset
new StaticText(window, grid.getLabelSlot(), STR_OFFSET); new StaticText(window, grid.getLabelSlot(), STR_OFFSET, 0, COLOR_THEME_PRIMARY1);
gvar = new GVarNumberEdit(window, grid.getFieldSlot(), MIX_OFFSET_MIN, gvar = new GVarNumberEdit(window, grid.getFieldSlot(), MIX_OFFSET_MIN,
MIX_OFFSET_MAX, GET_SET_DEFAULT(mix->offset)); MIX_OFFSET_MAX, GET_SET_DEFAULT(mix->offset));
gvar->setSuffix("%"); gvar->setSuffix("%");
grid.nextLine(); grid.nextLine();
// Trim // Trim
new StaticText(window, grid.getLabelSlot(), STR_TRIM); new StaticText(window, grid.getLabelSlot(), STR_TRIM, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(), GET_SET_INVERTED(mix->carryTrim)); new CheckBox(window, grid.getFieldSlot(), GET_SET_INVERTED(mix->carryTrim));
grid.nextLine(); grid.nextLine();
// Curve // Curve
new StaticText(&body, grid.getLabelSlot(), STR_CURVE); new StaticText(&body, grid.getLabelSlot(), STR_CURVE, 0, COLOR_THEME_PRIMARY1);
new Choice(&body, grid.getFieldSlot(2, 0), "\004DiffExpoFuncCstm", 0, new Choice(&body, grid.getFieldSlot(2, 0), "\004DiffExpoFuncCstm", 0,
CURVE_REF_CUSTOM, GET_DEFAULT(mix->curve.type), CURVE_REF_CUSTOM, GET_DEFAULT(mix->curve.type),
[=](int32_t newValue) { [=](int32_t newValue) {
@@ -135,7 +135,7 @@ class MixEditWindow : public Page
grid.nextLine(); grid.nextLine();
// Flight modes // Flight modes
new StaticText(window, grid.getLabelSlot(), STR_FLMODE); new StaticText(window, grid.getLabelSlot(), STR_FLMODE, 0, COLOR_THEME_PRIMARY1);
for (uint32_t i = 0; i < MAX_FLIGHT_MODES; i++) { for (uint32_t i = 0; i < MAX_FLIGHT_MODES; i++) {
char fm[2] = {char('0' + i), '\0'}; char fm[2] = {char('0' + i), '\0'};
if (i > 0 && (i % 4) == 0) grid.nextLine(); if (i > 0 && (i % 4) == 0) grid.nextLine();
@@ -151,26 +151,26 @@ class MixEditWindow : public Page
grid.nextLine(); grid.nextLine();
// Switch // Switch
new StaticText(window, grid.getLabelSlot(), STR_SWITCH); new StaticText(window, grid.getLabelSlot(), STR_SWITCH, 0, COLOR_THEME_PRIMARY1);
new SwitchChoice(window, grid.getFieldSlot(), SWSRC_FIRST_IN_MIXES, new SwitchChoice(window, grid.getFieldSlot(), SWSRC_FIRST_IN_MIXES,
SWSRC_LAST_IN_MIXES, GET_SET_DEFAULT(mix->swtch)); SWSRC_LAST_IN_MIXES, GET_SET_DEFAULT(mix->swtch));
grid.nextLine(); grid.nextLine();
// Warning // Warning
new StaticText(window, grid.getLabelSlot(), STR_MIXWARNING); new StaticText(window, grid.getLabelSlot(), STR_MIXWARNING, 0, COLOR_THEME_PRIMARY1);
auto edit = new NumberEdit(window, grid.getFieldSlot(2, 0), 0, 3, auto edit = new NumberEdit(window, grid.getFieldSlot(2, 0), 0, 3,
GET_SET_DEFAULT(mix->mixWarn)); GET_SET_DEFAULT(mix->mixWarn));
edit->setZeroText(STR_OFF); edit->setZeroText(STR_OFF);
grid.nextLine(); grid.nextLine();
// Multiplex // Multiplex
new StaticText(window, grid.getLabelSlot(), STR_MULTPX); new StaticText(window, grid.getLabelSlot(), STR_MULTPX, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), STR_VMLTPX, 0, 2, new Choice(window, grid.getFieldSlot(), STR_VMLTPX, 0, 2,
GET_SET_DEFAULT(mix->mltpx)); GET_SET_DEFAULT(mix->mltpx));
grid.nextLine(); grid.nextLine();
// Delay up // Delay up
new StaticText(window, grid.getLabelSlot(), STR_DELAYUP); new StaticText(window, grid.getLabelSlot(), STR_DELAYUP, 0, COLOR_THEME_PRIMARY1);
edit = new NumberEdit(window, grid.getFieldSlot(2, 0), 0, DELAY_MAX, edit = new NumberEdit(window, grid.getFieldSlot(2, 0), 0, DELAY_MAX,
GET_DEFAULT(mix->delayUp), GET_DEFAULT(mix->delayUp),
SET_VALUE(mix->delayUp, newValue), 0, PREC1); SET_VALUE(mix->delayUp, newValue), 0, PREC1);
@@ -178,7 +178,7 @@ class MixEditWindow : public Page
grid.nextLine(); grid.nextLine();
// Delay down // Delay down
new StaticText(window, grid.getLabelSlot(), STR_DELAYDOWN); new StaticText(window, grid.getLabelSlot(), STR_DELAYDOWN, 0, COLOR_THEME_PRIMARY1);
edit = new NumberEdit(window, grid.getFieldSlot(2, 0), 0, DELAY_MAX, edit = new NumberEdit(window, grid.getFieldSlot(2, 0), 0, DELAY_MAX,
GET_DEFAULT(mix->delayDown), GET_DEFAULT(mix->delayDown),
SET_VALUE(mix->delayDown, newValue), 0, PREC1); SET_VALUE(mix->delayDown, newValue), 0, PREC1);
@@ -186,7 +186,7 @@ class MixEditWindow : public Page
grid.nextLine(); grid.nextLine();
// Slow up // Slow up
new StaticText(window, grid.getLabelSlot(), STR_SLOWUP); new StaticText(window, grid.getLabelSlot(), STR_SLOWUP, 0, COLOR_THEME_PRIMARY1);
edit = new NumberEdit(window, grid.getFieldSlot(2, 0), 0, DELAY_MAX, edit = new NumberEdit(window, grid.getFieldSlot(2, 0), 0, DELAY_MAX,
GET_DEFAULT(mix->speedUp), GET_DEFAULT(mix->speedUp),
SET_VALUE(mix->speedUp, newValue), 0, PREC1); SET_VALUE(mix->speedUp, newValue), 0, PREC1);
@@ -194,7 +194,7 @@ class MixEditWindow : public Page
grid.nextLine(); grid.nextLine();
// Slow down // Slow down
new StaticText(window, grid.getLabelSlot(), STR_SLOWDOWN); new StaticText(window, grid.getLabelSlot(), STR_SLOWDOWN, 0, COLOR_THEME_PRIMARY1);
edit = new NumberEdit(window, grid.getFieldSlot(2, 0), 0, DELAY_MAX, edit = new NumberEdit(window, grid.getFieldSlot(2, 0), 0, DELAY_MAX,
GET_DEFAULT(mix->speedDown), GET_DEFAULT(mix->speedDown),
SET_VALUE(mix->speedDown, newValue), 0, PREC1); SET_VALUE(mix->speedDown, newValue), 0, PREC1);
@@ -287,7 +287,7 @@ class MixLineButton : public CommonInputOrMixButton
drawFlightModes(dc, line.flightModes, textColor); drawFlightModes(dc, line.flightModes, textColor);
} }
// Put this icon on the first line, since we jave more space there // Put this icon on the first line, since we have more space there
uint8_t delayslow = 0; uint8_t delayslow = 0;
if (line.speedDown || line.speedUp) delayslow = 1; if (line.speedDown || line.speedUp) delayslow = 1;
if (line.delayUp || line.delayDown) delayslow += 2; if (line.delayUp || line.delayDown) delayslow += 2;
@@ -379,7 +379,7 @@ void ModelMixesPage::build(FormWindow * window, int8_t focusMixIndex)
coord_t h = grid.getWindowHeight(); coord_t h = grid.getWindowHeight();
auto txt = new MixLineTitle(window, grid.getLabelSlot(), auto txt = new MixLineTitle(window, grid.getLabelSlot(),
getSourceString(MIXSRC_CH1 + ch), getSourceString(MIXSRC_CH1 + ch),
BUTTON_BACKGROUND, CENTERED); BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED);
uint8_t count = 0; uint8_t count = 0;
while (mixIndex < MAX_MIXERS && mix->srcRaw > 0 && mix->destCh == ch) { while (mixIndex < MAX_MIXERS && mix->srcRaw > 0 && mix->destCh == ch) {
@@ -448,7 +448,7 @@ void ModelMixesPage::build(FormWindow * window, int8_t focusMixIndex)
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(COLOR_THEME_SECONDARY2); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
} }
txt->invalidate(); txt->invalidate();
if (focus) button->bringToTop(); if (focus) button->bringToTop();
+10 -10
View File
@@ -59,17 +59,17 @@ class OutputEditWindow : public Page {
LimitData * output = limitAddress(channel); LimitData * output = limitAddress(channel);
// Name // Name
new StaticText(window, grid.getLabelSlot(), STR_NAME); new StaticText(window, grid.getLabelSlot(), STR_NAME, 0, COLOR_THEME_PRIMARY1);
new ModelTextEdit(window, grid.getFieldSlot(), output->name, sizeof(output->name)); new ModelTextEdit(window, grid.getFieldSlot(), output->name, sizeof(output->name));
grid.nextLine(); grid.nextLine();
// Offset // Offset
new StaticText(window, grid.getLabelSlot(), TR_LIMITS_HEADERS_SUBTRIM); new StaticText(window, grid.getLabelSlot(), TR_LIMITS_HEADERS_SUBTRIM, 0, COLOR_THEME_PRIMARY1);
new NumberEdit(window, grid.getFieldSlot(), -1000, +1000, GET_SET_DEFAULT(output->offset), 0, PREC1); new NumberEdit(window, grid.getFieldSlot(), -1000, +1000, GET_SET_DEFAULT(output->offset), 0, PREC1);
grid.nextLine(); grid.nextLine();
// Min // Min
new StaticText(window, grid.getLabelSlot(), TR_MIN); new StaticText(window, grid.getLabelSlot(), TR_MIN, 0, COLOR_THEME_PRIMARY1);
new NumberEdit(window, grid.getFieldSlot(), -limit, 0, new NumberEdit(window, grid.getFieldSlot(), -limit, 0,
GET_VALUE(output->min - 1000), GET_VALUE(output->min - 1000),
SET_VALUE(output->min, newValue + 1000), SET_VALUE(output->min, newValue + 1000),
@@ -77,7 +77,7 @@ class OutputEditWindow : public Page {
grid.nextLine(); grid.nextLine();
// Max // Max
new StaticText(window, grid.getLabelSlot(), TR_MAX); new StaticText(window, grid.getLabelSlot(), TR_MAX, 0, COLOR_THEME_PRIMARY1);
new NumberEdit(window, grid.getFieldSlot(), 0, +limit, new NumberEdit(window, grid.getFieldSlot(), 0, +limit,
GET_VALUE(output->max + 1000), GET_VALUE(output->max + 1000),
SET_VALUE(output->max, newValue - 1000), SET_VALUE(output->max, newValue - 1000),
@@ -85,12 +85,12 @@ class OutputEditWindow : public Page {
grid.nextLine(); grid.nextLine();
// Direction // Direction
new StaticText(window, grid.getLabelSlot(), STR_INVERTED); new StaticText(window, grid.getLabelSlot(), STR_INVERTED, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(output->revert)); new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(output->revert));
grid.nextLine(); grid.nextLine();
// Curve // Curve
new StaticText(window, grid.getLabelSlot(), TR_CURVE); new StaticText(window, grid.getLabelSlot(), TR_CURVE, 0, COLOR_THEME_PRIMARY1);
auto edit = new NumberEdit(window, grid.getFieldSlot(), -MAX_CURVES, +MAX_CURVES, GET_SET_DEFAULT(output->curve)); auto edit = new NumberEdit(window, grid.getFieldSlot(), -MAX_CURVES, +MAX_CURVES, GET_SET_DEFAULT(output->curve));
edit->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) { edit->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
dc->drawText(2, 2, getCurveString(value)); dc->drawText(2, 2, getCurveString(value));
@@ -98,14 +98,14 @@ class OutputEditWindow : public Page {
grid.nextLine(); grid.nextLine();
// PPM center // PPM center
new StaticText(window, grid.getLabelSlot(), TR_LIMITS_HEADERS_PPMCENTER); new StaticText(window, grid.getLabelSlot(), TR_LIMITS_HEADERS_PPMCENTER, 0, COLOR_THEME_PRIMARY1);
new NumberEdit(window, grid.getFieldSlot(), PPM_CENTER - PPM_CENTER_MAX, PPM_CENTER + PPM_CENTER_MAX, new NumberEdit(window, grid.getFieldSlot(), PPM_CENTER - PPM_CENTER_MAX, PPM_CENTER + PPM_CENTER_MAX,
GET_VALUE(output->ppmCenter + PPM_CENTER), GET_VALUE(output->ppmCenter + PPM_CENTER),
SET_VALUE(output->ppmCenter, newValue - PPM_CENTER)); SET_VALUE(output->ppmCenter, newValue - PPM_CENTER));
grid.nextLine(); grid.nextLine();
// Subtrims mode // Subtrims mode
new StaticText(window, grid.getLabelSlot(), TR_LIMITS_HEADERS_SUBTRIMMODE); new StaticText(window, grid.getLabelSlot(), TR_LIMITS_HEADERS_SUBTRIMMODE, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), STR_SUBTRIMMODES, 0, 1, GET_SET_DEFAULT(output->symetrical)); new Choice(window, grid.getFieldSlot(), STR_SUBTRIMMODES, 0, 1, GET_SET_DEFAULT(output->symetrical));
grid.nextLine(); grid.nextLine();
@@ -195,7 +195,7 @@ void ModelOutputsPage::build(FormWindow * window, int8_t focusChannel)
// Channel label // Channel label
auto txt = new StaticText(window, grid.getLabelSlot(), auto txt = new StaticText(window, grid.getLabelSlot(),
getSourceString(MIXSRC_CH1 + ch), getSourceString(MIXSRC_CH1 + ch),
BUTTON_BACKGROUND, CENTERED); BUTTON_BACKGROUND, CENTERED | COLOR_THEME_PRIMARY1);
// Channel settings // Channel settings
Button * button = new OutputLineButton(window, grid.getFieldSlot(), output); Button * button = new OutputLineButton(window, grid.getFieldSlot(), output);
@@ -233,7 +233,7 @@ void ModelOutputsPage::build(FormWindow * window, int8_t focusChannel)
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(COLOR_THEME_SECONDARY2); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
} }
txt->invalidate(); txt->invalidate();
}); });
+68 -67
View File
@@ -108,7 +108,7 @@ class FailSafeBody : public FormGroup {
for (int ch=0; ch < maxModuleChannels(moduleIdx); ch++) { for (int ch=0; ch < maxModuleChannels(moduleIdx); ch++) {
// Channel name // Channel name
// TODO if (g_model.limitData[ch].name[0] != '\0') { <= add channel name // TODO if (g_model.limitData[ch].name[0] != '\0') { <= add channel name
new StaticText(this, grid.getLabelSlot(), getSourceString(MIXSRC_CH1 + ch)); new StaticText(this, grid.getLabelSlot(), getSourceString(MIXSRC_CH1 + ch), 0, COLOR_THEME_PRIMARY1);
// Channel numeric value // Channel numeric value
new NumberEdit(this, grid.getFieldSlot(8, 0), -lim, lim, new NumberEdit(this, grid.getFieldSlot(8, 0), -lim, lim,
@@ -167,18 +167,18 @@ class RegisterDialog: public Dialog {
grid.spacer(PAGE_PADDING); grid.spacer(PAGE_PADDING);
// Register ID // Register ID
new StaticText(form, grid.getLabelSlot(), STR_REG_ID); new StaticText(form, grid.getLabelSlot(), STR_REG_ID, 0, COLOR_THEME_PRIMARY1);
auto edit = new RadioTextEdit(form, grid.getFieldSlot(), g_model.modelRegistrationID, sizeof(g_model.modelRegistrationID)); auto edit = new RadioTextEdit(form, grid.getFieldSlot(), g_model.modelRegistrationID, sizeof(g_model.modelRegistrationID));
grid.nextLine(); grid.nextLine();
// UID // UID
new StaticText(form, grid.getLabelSlot(), "UID"); new StaticText(form, grid.getLabelSlot(), "UID", 0, COLOR_THEME_PRIMARY1);
uid = new NumberEdit(form, grid.getFieldSlot(), 0, 2, GET_SET_DEFAULT(reusableBuffer.moduleSetup.pxx2.registerLoopIndex)); uid = new NumberEdit(form, grid.getFieldSlot(), 0, 2, GET_SET_DEFAULT(reusableBuffer.moduleSetup.pxx2.registerLoopIndex));
grid.nextLine(); grid.nextLine();
// RX name // RX name
new StaticText(form, grid.getLabelSlot(), STR_RX_NAME); new StaticText(form, grid.getLabelSlot(), STR_RX_NAME, 0, COLOR_THEME_PRIMARY1);
waiting = new StaticText(form, grid.getFieldSlot(), STR_WAITING); waiting = new StaticText(form, grid.getFieldSlot(), STR_WAITING, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
grid.spacer(6); grid.spacer(6);
@@ -251,7 +251,7 @@ class BindWaitDialog: public Dialog {
moduleIdx(moduleIdx), moduleIdx(moduleIdx),
receiverIdx(receiverIdx) receiverIdx(receiverIdx)
{ {
new StaticText(&content->form, {0, height() / 2, width(), PAGE_LINE_HEIGHT}, STR_WAITING_FOR_RX, CENTERED); new StaticText(&content->form, {0, height() / 2, width(), PAGE_LINE_HEIGHT}, STR_WAITING_FOR_RX, 0, CENTERED | COLOR_THEME_PRIMARY1);
} }
void checkEvents() override; void checkEvents() override;
@@ -451,7 +451,7 @@ class TrainerModuleWindow : public FormGroup {
FormGridLayout grid; FormGridLayout grid;
clear(); clear();
new StaticText(this, grid.getLabelSlot(true), STR_MODE); new StaticText(this, grid.getLabelSlot(true), STR_MODE, 0, COLOR_THEME_PRIMARY1);
trainerChoice = new Choice(this, grid.getFieldSlot(), STR_VTRAINERMODES, 0, TRAINER_MODE_MAX(), GET_DEFAULT(g_model.trainerData.mode), [=](int32_t newValue) { trainerChoice = new Choice(this, grid.getFieldSlot(), STR_VTRAINERMODES, 0, TRAINER_MODE_MAX(), GET_DEFAULT(g_model.trainerData.mode), [=](int32_t newValue) {
g_model.trainerData.mode = newValue; g_model.trainerData.mode = newValue;
SET_DIRTY(); SET_DIRTY();
@@ -462,7 +462,7 @@ class TrainerModuleWindow : public FormGroup {
grid.nextLine(); grid.nextLine();
if (g_model.isTrainerTraineeEnable()) { if (g_model.isTrainerTraineeEnable()) {
new StaticText(this, grid.getLabelSlot(true), STR_CHANNELRANGE); new StaticText(this, grid.getLabelSlot(true), STR_CHANNELRANGE, 0, COLOR_THEME_PRIMARY1);
channelStart = new NumberEdit(this, grid.getFieldSlot(2, 0), 1, channelStart = new NumberEdit(this, grid.getFieldSlot(2, 0), 1,
MAX_OUTPUT_CHANNELS - 8 + g_model.trainerData.channelsCount + 1, MAX_OUTPUT_CHANNELS - 8 + g_model.trainerData.channelsCount + 1,
GET_DEFAULT(1 + g_model.trainerData.channelsStart)); GET_DEFAULT(1 + g_model.trainerData.channelsStart));
@@ -489,7 +489,7 @@ class TrainerModuleWindow : public FormGroup {
if (g_model.trainerData.mode == TRAINER_MODE_SLAVE) { if (g_model.trainerData.mode == TRAINER_MODE_SLAVE) {
// PPM frame // PPM frame
new StaticText(this, grid.getLabelSlot(true), STR_PPMFRAME); new StaticText(this, grid.getLabelSlot(true), STR_PPMFRAME, 0, COLOR_THEME_PRIMARY1);
// PPM frame length // PPM frame length
auto edit = new NumberEdit(this, grid.getFieldSlot(3, 0), 125, 35 * 5 + 225, auto edit = new NumberEdit(this, grid.getFieldSlot(3, 0), 125, 35 * 5 + 225,
@@ -539,7 +539,7 @@ class ModuleWindow : public FormGroup {
void addChannelRange(FormGridLayout &grid) void addChannelRange(FormGridLayout &grid)
{ {
new StaticText(this, grid.getLabelSlot(true), STR_CHANNELRANGE); new StaticText(this, grid.getLabelSlot(true), STR_CHANNELRANGE, 0, COLOR_THEME_PRIMARY1);
auto channelStart = new NumberEdit(this, grid.getFieldSlot(2, 0), 1, auto channelStart = new NumberEdit(this, grid.getFieldSlot(2, 0), 1,
MAX_OUTPUT_CHANNELS - sentModuleChannels(moduleIdx) + 1, MAX_OUTPUT_CHANNELS - sentModuleChannels(moduleIdx) + 1,
GET_DEFAULT(1 + g_model.moduleData[moduleIdx].channelsStart)); GET_DEFAULT(1 + g_model.moduleData[moduleIdx].channelsStart));
@@ -576,7 +576,7 @@ class ModuleWindow : public FormGroup {
clear(); clear();
// Module Type // Module Type
new StaticText(this, grid.getLabelSlot(true), STR_MODE); new StaticText(this, grid.getLabelSlot(true), STR_MODE, 0, COLOR_THEME_PRIMARY1);
moduleChoice = new Choice(this, grid.getFieldSlot(2, 0), STR_INTERNAL_MODULE_PROTOCOLS, moduleChoice = new Choice(this, grid.getFieldSlot(2, 0), STR_INTERNAL_MODULE_PROTOCOLS,
MODULE_TYPE_NONE, MODULE_TYPE_COUNT - 1, MODULE_TYPE_NONE, MODULE_TYPE_COUNT - 1,
GET_DEFAULT(g_model.moduleData[moduleIdx].type), GET_DEFAULT(g_model.moduleData[moduleIdx].type),
@@ -637,7 +637,7 @@ class ModuleWindow : public FormGroup {
else if (isModuleMultimodule(moduleIdx)) { else if (isModuleMultimodule(moduleIdx)) {
Choice * mmSubProtocol = nullptr; Choice * mmSubProtocol = nullptr;
grid.nextLine(); grid.nextLine();
new StaticText(this, grid.getLabelSlot(true), STR_RF_PROTOCOL); new StaticText(this, grid.getLabelSlot(true), STR_RF_PROTOCOL, 0, COLOR_THEME_PRIMARY1);
// Multi type (CUSTOM, brand A, brand B,...) // Multi type (CUSTOM, brand A, brand B,...)
int multiRfProto = g_model.moduleData[moduleIdx].getMultiProtocol(); int multiRfProto = g_model.moduleData[moduleIdx].getMultiProtocol();
@@ -691,19 +691,19 @@ class ModuleWindow : public FormGroup {
grid.nextLine(); grid.nextLine();
// Multimodule status // Multimodule status
new StaticText(this, grid.getLabelSlot(true), STR_MODULE_STATUS); new StaticText(this, grid.getLabelSlot(true), STR_MODULE_STATUS, 0, COLOR_THEME_PRIMARY1);
new DynamicText(this, grid.getFieldSlot(), [=] { new DynamicText(this, grid.getFieldSlot(), [=] {
char msg[64] = ""; char msg[64] = "";
getModuleStatusString(moduleIdx, msg); getModuleStatusString(moduleIdx, msg);
return std::string(msg); return std::string(msg);
}); }, COLOR_THEME_PRIMARY1);
// Multimodule sync // Multimodule sync
/*if (multiSyncStatus.isValid()) { /*if (multiSyncStatus.isValid()) {
grid.nextLine(); grid.nextLine();
new StaticText(this, grid.getLabelSlot(true), STR_MODULE_SYNC); new StaticText(this, grid.getLabelSlot(true), STR_MODULE_SYNC, 0, COLOR_THEME_PRIMARY1);
multiSyncStatus.getRefreshString(statusText); multiSyncStatus.getRefreshString(statusText);
new StaticText(this, grid.getFieldSlot(), statusText); new StaticText(this, grid.getFieldSlot(), statusText, 0, COLOR_THEME_PRIMARY1);
}*/ }*/
const uint8_t multi_proto = g_model.moduleData[moduleIdx].getMultiProtocol(); const uint8_t multi_proto = g_model.moduleData[moduleIdx].getMultiProtocol();
@@ -712,7 +712,7 @@ class ModuleWindow : public FormGroup {
const char *title = getMultiOptionTitleStatic(moduleIdx); const char *title = getMultiOptionTitleStatic(moduleIdx);
if (title != nullptr) { if (title != nullptr) {
grid.nextLine(); grid.nextLine();
new StaticText(this, grid.getLabelSlot(true), title); new StaticText(this, grid.getLabelSlot(true), title, 0, COLOR_THEME_PRIMARY1);
// int optionValue = // int optionValue =
// g_model.moduleData[moduleIdx].multi.optionValue; // g_model.moduleData[moduleIdx].multi.optionValue;
@@ -782,7 +782,7 @@ class ModuleWindow : public FormGroup {
const char* servoRates[] = { "22ms", "11ms" }; const char* servoRates[] = { "22ms", "11ms" };
new StaticText(this, grid.getLabelSlot(true), STR_MULTI_SERVOFREQ); new StaticText(this, grid.getLabelSlot(true), STR_MULTI_SERVOFREQ, 0, COLOR_THEME_PRIMARY1);
new Choice( new Choice(
this, grid.getFieldSlot(), servoRates, 0, 1, this, grid.getFieldSlot(), servoRates, 0, 1,
[=]() { [=]() {
@@ -795,7 +795,7 @@ class ModuleWindow : public FormGroup {
}); });
} else { } else {
// Bind on power up // Bind on power up
new StaticText(this, grid.getLabelSlot(true), STR_MULTI_AUTOBIND); new StaticText(this, grid.getLabelSlot(true), STR_MULTI_AUTOBIND, 0, COLOR_THEME_PRIMARY1);
new CheckBox(this, grid.getFieldSlot(), new CheckBox(this, grid.getFieldSlot(),
GET_SET_DEFAULT( GET_SET_DEFAULT(
g_model.moduleData[moduleIdx].multi.autoBindMode)); g_model.moduleData[moduleIdx].multi.autoBindMode));
@@ -803,14 +803,14 @@ class ModuleWindow : public FormGroup {
// Low power mode // Low power mode
grid.nextLine(); grid.nextLine();
new StaticText(this, grid.getLabelSlot(true), STR_MULTI_LOWPOWER); new StaticText(this, grid.getLabelSlot(true), STR_MULTI_LOWPOWER, 0, COLOR_THEME_PRIMARY1);
new CheckBox( new CheckBox(
this, grid.getFieldSlot(), this, grid.getFieldSlot(),
GET_SET_DEFAULT(g_model.moduleData[moduleIdx].multi.lowPowerMode)); GET_SET_DEFAULT(g_model.moduleData[moduleIdx].multi.lowPowerMode));
// Disable telemetry // Disable telemetry
grid.nextLine(); grid.nextLine();
new StaticText(this, grid.getLabelSlot(true), STR_DISABLE_TELEM); new StaticText(this, grid.getLabelSlot(true), STR_DISABLE_TELEM, 0, COLOR_THEME_PRIMARY1);
new CheckBox(this, grid.getFieldSlot(), new CheckBox(this, grid.getFieldSlot(),
GET_SET_DEFAULT( GET_SET_DEFAULT(
g_model.moduleData[moduleIdx].multi.disableTelemetry)); g_model.moduleData[moduleIdx].multi.disableTelemetry));
@@ -818,7 +818,7 @@ class ModuleWindow : public FormGroup {
if (MULTI_DISABLE_CHAN_MAP_ROW_STATIC(moduleIdx) != HIDDEN_ROW) { if (MULTI_DISABLE_CHAN_MAP_ROW_STATIC(moduleIdx) != HIDDEN_ROW) {
// Disable channel mapping // Disable channel mapping
grid.nextLine(); grid.nextLine();
new StaticText(this, grid.getLabelSlot(true), STR_DISABLE_CH_MAP); new StaticText(this, grid.getLabelSlot(true), STR_DISABLE_CH_MAP, 0, COLOR_THEME_PRIMARY1);
new CheckBox(this, grid.getFieldSlot(), new CheckBox(this, grid.getFieldSlot(),
GET_SET_DEFAULT(g_model.moduleData[moduleIdx].multi.disableMapping)); GET_SET_DEFAULT(g_model.moduleData[moduleIdx].multi.disableMapping));
} }
@@ -831,13 +831,14 @@ class ModuleWindow : public FormGroup {
// TYPE // TYPE
grid.nextLine(); grid.nextLine();
new StaticText(this, grid.getLabelSlot(true), STR_TYPE); new StaticText(this, grid.getLabelSlot(true), STR_TYPE, 0, COLOR_THEME_PRIMARY1);
new StaticText(this, grid.getFieldSlot(), new StaticText(this, grid.getFieldSlot(),
g_model.moduleData[EXTERNAL_MODULE].afhds3.telemetry ? STR_AFHDS3_ONE_TO_ONE_TELEMETRY : TR_AFHDS3_ONE_TO_MANY); g_model.moduleData[EXTERNAL_MODULE].afhds3.telemetry ? STR_AFHDS3_ONE_TO_ONE_TELEMETRY : TR_AFHDS3_ONE_TO_MANY,
0, COLOR_THEME_PRIMARY1);
// Status // Status
grid.nextLine(); grid.nextLine();
new StaticText(this, grid.getLabelSlot(true), STR_MODULE_STATUS); new StaticText(this, grid.getLabelSlot(true), STR_MODULE_STATUS, 0, COLOR_THEME_PRIMARY1);
new DynamicText(this, grid.getFieldSlot(), [=] { new DynamicText(this, grid.getFieldSlot(), [=] {
char msg[64] = ""; char msg[64] = "";
getModuleStatusString(moduleIdx, msg); getModuleStatusString(moduleIdx, msg);
@@ -847,7 +848,7 @@ class ModuleWindow : public FormGroup {
// Power source // Power source
grid.nextLine(); grid.nextLine();
new StaticText(this, grid.getLabelSlot(true), STR_AFHDS3_POWER_SOURCE); new StaticText(this, grid.getLabelSlot(true), STR_AFHDS3_POWER_SOURCE, 0, COLOR_THEME_PRIMARY1);
new DynamicText(this, grid.getFieldSlot(), [=] { new DynamicText(this, grid.getFieldSlot(), [=] {
char msg[64] = ""; char msg[64] = "";
getModuleSyncStatusString(moduleIdx, msg); getModuleSyncStatusString(moduleIdx, msg);
@@ -856,7 +857,7 @@ class ModuleWindow : public FormGroup {
// RX Freq // RX Freq
grid.nextLine(); grid.nextLine();
new StaticText(this, grid.getLabelSlot(true), STR_AFHDS3_RX_FREQ); new StaticText(this, grid.getLabelSlot(true), STR_AFHDS3_RX_FREQ, 0, COLOR_THEME_PRIMARY1);
auto edit = new NumberEdit(this, grid.getFieldSlot(2,0), MIN_FREQ, MAX_FREQ, GET_DEFAULT(g_model.moduleData[moduleIdx].afhds3.rxFreq())); auto edit = new NumberEdit(this, grid.getFieldSlot(2,0), MIN_FREQ, MAX_FREQ, GET_DEFAULT(g_model.moduleData[moduleIdx].afhds3.rxFreq()));
edit->setSetValueHandler([=](int32_t newValue) { edit->setSetValueHandler([=](int32_t newValue) {
g_model.moduleData[EXTERNAL_MODULE].afhds3.setRxFreq((uint16_t)newValue); g_model.moduleData[EXTERNAL_MODULE].afhds3.setRxFreq((uint16_t)newValue);
@@ -865,7 +866,7 @@ class ModuleWindow : public FormGroup {
// Module actual power // Module actual power
grid.nextLine(); grid.nextLine();
new StaticText(this, grid.getLabelSlot(true), STR_AFHDS3_ACTUAL_POWER); new StaticText(this, grid.getLabelSlot(true), STR_AFHDS3_ACTUAL_POWER, 0, COLOR_THEME_PRIMARY1);
new DynamicText(this, grid.getFieldSlot(), [=] { new DynamicText(this, grid.getFieldSlot(), [=] {
char msg[64] = ""; char msg[64] = "";
getStringAtIndex(msg, STR_AFHDS3_POWERS, actualAfhdsRunPower(moduleIdx)); getStringAtIndex(msg, STR_AFHDS3_POWERS, actualAfhdsRunPower(moduleIdx));
@@ -874,7 +875,7 @@ class ModuleWindow : public FormGroup {
// Module power // Module power
grid.nextLine(); grid.nextLine();
new StaticText(this, grid.getLabelSlot(true), STR_RF_POWER); new StaticText(this, grid.getLabelSlot(true), STR_RF_POWER, 0, COLOR_THEME_PRIMARY1);
new Choice(this, grid.getFieldSlot(2, 0), STR_AFHDS3_POWERS, afhds3::RUN_POWER::RUN_POWER_FIRST, afhds3::RUN_POWER::RUN_POWER_LAST, new Choice(this, grid.getFieldSlot(2, 0), STR_AFHDS3_POWERS, afhds3::RUN_POWER::RUN_POWER_FIRST, afhds3::RUN_POWER::RUN_POWER_LAST,
GET_SET_DEFAULT(g_model.moduleData[moduleIdx].afhds3.runPower)); GET_SET_DEFAULT(g_model.moduleData[moduleIdx].afhds3.runPower));
} }
@@ -890,7 +891,7 @@ class ModuleWindow : public FormGroup {
// PPM modules // PPM modules
if (isModulePPM(moduleIdx)) { if (isModulePPM(moduleIdx)) {
// PPM frame // PPM frame
new StaticText(this, grid.getLabelSlot(true), STR_PPMFRAME); new StaticText(this, grid.getLabelSlot(true), STR_PPMFRAME, 0, COLOR_THEME_PRIMARY1);
// PPM frame length // PPM frame length
auto edit = new NumberEdit(this, grid.getFieldSlot(3, 0), 125, 35 * 5 + 225, auto edit = new NumberEdit(this, grid.getFieldSlot(3, 0), 125, 35 * 5 + 225,
@@ -917,7 +918,7 @@ class ModuleWindow : public FormGroup {
// Bind and Range buttons // Bind and Range buttons
if (!isModuleRFAccess(moduleIdx) && (isModuleModelIndexAvailable(moduleIdx)|| isModuleBindRangeAvailable(moduleIdx))) { if (!isModuleRFAccess(moduleIdx) && (isModuleModelIndexAvailable(moduleIdx)|| isModuleBindRangeAvailable(moduleIdx))) {
uint8_t thirdColumn = 0; uint8_t thirdColumn = 0;
new StaticText(this, grid.getLabelSlot(true), STR_RECEIVER); new StaticText(this, grid.getLabelSlot(true), STR_RECEIVER, 0, COLOR_THEME_PRIMARY1);
// Model index // Model index
if (isModuleModelIndexAvailable(moduleIdx)) { if (isModuleModelIndexAvailable(moduleIdx)) {
@@ -1005,7 +1006,7 @@ class ModuleWindow : public FormGroup {
// Failsafe // Failsafe
if (isModuleFailsafeAvailable(moduleIdx)) { if (isModuleFailsafeAvailable(moduleIdx)) {
hasFailsafe = true; hasFailsafe = true;
new StaticText(this, grid.getLabelSlot(true), STR_FAILSAFE); new StaticText(this, grid.getLabelSlot(true), STR_FAILSAFE, 0, COLOR_THEME_PRIMARY1);
failSafeChoice = new Choice(this, grid.getFieldSlot(2, 0), STR_VFAILSAFE, 0, FAILSAFE_LAST, failSafeChoice = new Choice(this, grid.getFieldSlot(2, 0), STR_VFAILSAFE, 0, FAILSAFE_LAST,
GET_DEFAULT(g_model.moduleData[moduleIdx].failsafeMode), GET_DEFAULT(g_model.moduleData[moduleIdx].failsafeMode),
[=](int32_t newValue) { [=](int32_t newValue) {
@@ -1026,7 +1027,7 @@ class ModuleWindow : public FormGroup {
// Register and Range buttons // Register and Range buttons
if (isModuleRFAccess(moduleIdx)) { if (isModuleRFAccess(moduleIdx)) {
new StaticText(this, grid.getLabelSlot(true), STR_MODULE); new StaticText(this, grid.getLabelSlot(true), STR_MODULE, 0, COLOR_THEME_PRIMARY1);
registerButton = new TextButton(this, grid.getFieldSlot(2, 0), STR_REGISTER); registerButton = new TextButton(this, grid.getFieldSlot(2, 0), STR_REGISTER);
registerButton->setPressHandler([=]() -> uint8_t { registerButton->setPressHandler([=]() -> uint8_t {
new RegisterDialog(this, moduleIdx); new RegisterDialog(this, moduleIdx);
@@ -1050,13 +1051,13 @@ class ModuleWindow : public FormGroup {
// R9M Power // R9M Power
if (isModuleR9M_FCC(moduleIdx)) { if (isModuleR9M_FCC(moduleIdx)) {
new StaticText(this, grid.getLabelSlot(true), STR_RF_POWER); new StaticText(this, grid.getLabelSlot(true), STR_RF_POWER, 0, COLOR_THEME_PRIMARY1);
new Choice(this, grid.getFieldSlot(), STR_R9M_FCC_POWER_VALUES, 0, R9M_FCC_POWER_MAX, new Choice(this, grid.getFieldSlot(), STR_R9M_FCC_POWER_VALUES, 0, R9M_FCC_POWER_MAX,
GET_SET_DEFAULT(g_model.moduleData[moduleIdx].pxx.power)); GET_SET_DEFAULT(g_model.moduleData[moduleIdx].pxx.power));
} }
if (isModuleR9M_LBT(moduleIdx)) { if (isModuleR9M_LBT(moduleIdx)) {
new StaticText(this, grid.getLabelSlot(true), STR_RF_POWER); new StaticText(this, grid.getLabelSlot(true), STR_RF_POWER, 0, COLOR_THEME_PRIMARY1);
new Choice(this, grid.getFieldSlot(), STR_R9M_LBT_POWER_VALUES, 0, R9M_LBT_POWER_MAX, new Choice(this, grid.getFieldSlot(), STR_R9M_LBT_POWER_VALUES, 0, R9M_LBT_POWER_MAX,
GET_DEFAULT(min<uint8_t>(g_model.moduleData[moduleIdx].pxx.power, R9M_LBT_POWER_MAX)), GET_DEFAULT(min<uint8_t>(g_model.moduleData[moduleIdx].pxx.power, R9M_LBT_POWER_MAX)),
SET_DEFAULT(g_model.moduleData[moduleIdx].pxx.power)); SET_DEFAULT(g_model.moduleData[moduleIdx].pxx.power));
@@ -1067,7 +1068,7 @@ class ModuleWindow : public FormGroup {
for (uint8_t receiverIdx = 0; receiverIdx < PXX2_MAX_RECEIVERS_PER_MODULE; receiverIdx++) { for (uint8_t receiverIdx = 0; receiverIdx < PXX2_MAX_RECEIVERS_PER_MODULE; receiverIdx++) {
char label[] = TR_RECEIVER " X"; char label[] = TR_RECEIVER " X";
label[sizeof(label) - 2] = '1' + receiverIdx; label[sizeof(label) - 2] = '1' + receiverIdx;
new StaticText(this, grid.getLabelSlot(true), label); new StaticText(this, grid.getLabelSlot(true), label, 0, COLOR_THEME_PRIMARY1);
new ReceiverButton(this, grid.getFieldSlot(2, 0), moduleIdx, receiverIdx); new ReceiverButton(this, grid.getFieldSlot(2, 0), moduleIdx, receiverIdx);
grid.nextLine(); grid.nextLine();
} }
@@ -1075,7 +1076,7 @@ class ModuleWindow : public FormGroup {
// SBUS refresh rate // SBUS refresh rate
if (isModuleSBUS(moduleIdx)) { if (isModuleSBUS(moduleIdx)) {
new StaticText(this, grid.getLabelSlot(true), STR_REFRESHRATE); new StaticText(this, grid.getLabelSlot(true), STR_REFRESHRATE, 0, COLOR_THEME_PRIMARY1);
auto edit = new NumberEdit(this, grid.getFieldSlot(2, 0), 60, 400, auto edit = new NumberEdit(this, grid.getFieldSlot(2, 0), 60, 400,
GET_DEFAULT((int16_t)g_model.moduleData[moduleIdx].ppm.frameLength*5 + 225), GET_DEFAULT((int16_t)g_model.moduleData[moduleIdx].ppm.frameLength*5 + 225),
SET_VALUE(g_model.moduleData[moduleIdx].ppm.frameLength, (newValue - 225)/5), SET_VALUE(g_model.moduleData[moduleIdx].ppm.frameLength, (newValue - 225)/5),
@@ -1084,7 +1085,7 @@ class ModuleWindow : public FormGroup {
new Choice(this, grid.getFieldSlot(2, 1), STR_SBUS_INVERSION_VALUES, 0, 1, GET_SET_DEFAULT(g_model.moduleData[moduleIdx].sbus.noninverted)); new Choice(this, grid.getFieldSlot(2, 1), STR_SBUS_INVERSION_VALUES, 0, 1, GET_SET_DEFAULT(g_model.moduleData[moduleIdx].sbus.noninverted));
#if defined(RADIO_TX16S) #if defined(RADIO_TX16S)
grid.nextLine(); grid.nextLine();
new StaticText(this, grid.getFieldSlot(1, 0), STR_WARN_5VOLTS); new StaticText(this, grid.getFieldSlot(1, 0), STR_WARN_5VOLTS, 0, COLOR_THEME_PRIMARY1);
#endif #endif
grid.nextLine(); grid.nextLine();
} }
@@ -1150,7 +1151,7 @@ void ModelSetupPage::build(FormWindow * window)
grid.spacer(PAGE_PADDING); grid.spacer(PAGE_PADDING);
// Model name // Model name
new StaticText(window, grid.getLabelSlot(), STR_MODELNAME); new StaticText(window, grid.getLabelSlot(), STR_MODELNAME, 0, COLOR_THEME_PRIMARY1);
auto text = auto text =
new ModelTextEdit(window, grid.getFieldSlot(), g_model.header.name, new ModelTextEdit(window, grid.getFieldSlot(), g_model.header.name,
sizeof(g_model.header.name), 0, MODEL_NAME_EXTRA_CHARS); sizeof(g_model.header.name), 0, MODEL_NAME_EXTRA_CHARS);
@@ -1165,7 +1166,7 @@ void ModelSetupPage::build(FormWindow * window)
grid.nextLine(); grid.nextLine();
// Bitmap // Bitmap
new StaticText(window, grid.getLabelSlot(), STR_BITMAP); new StaticText(window, grid.getLabelSlot(), STR_BITMAP, 0, COLOR_THEME_PRIMARY1);
new FileChoice(window, grid.getFieldSlot(), BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.header.bitmap), new FileChoice(window, grid.getFieldSlot(), BITMAPS_PATH, BITMAPS_EXT, sizeof(g_model.header.bitmap),
[=]() { [=]() {
return std::string(g_model.header.bitmap, sizeof(g_model.header.bitmap)); return std::string(g_model.header.bitmap, sizeof(g_model.header.bitmap));
@@ -1181,46 +1182,46 @@ void ModelSetupPage::build(FormWindow * window)
// Timer label // Timer label
strAppendStringWithIndex(reusableBuffer.moduleSetup.msg, STR_TIMER, i + 1); strAppendStringWithIndex(reusableBuffer.moduleSetup.msg, STR_TIMER, i + 1);
new Subtitle(window, grid.getLineSlot(), reusableBuffer.moduleSetup.msg); new Subtitle(window, grid.getLineSlot(), reusableBuffer.moduleSetup.msg, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
auto group = new FormGroup(window, grid.getFieldSlot(), FORM_BORDER_FOCUS_ONLY | PAINT_CHILDREN_FIRST); auto group = new FormGroup(window, grid.getFieldSlot(), FORM_BORDER_FOCUS_ONLY | PAINT_CHILDREN_FIRST);
GridLayout timerGrid(group); GridLayout timerGrid(group);
// Timer name // Timer name
new StaticText(window, grid.getLabelSlot(true), STR_NAME); new StaticText(window, grid.getLabelSlot(true), STR_NAME, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
new RadioTextEdit(group, timerGrid.getSlot(), timer->name, LEN_TIMER_NAME); new RadioTextEdit(group, timerGrid.getSlot(), timer->name, LEN_TIMER_NAME);
timerGrid.nextLine(); timerGrid.nextLine();
// Timer mode // Timer mode
new StaticText(window, grid.getLabelSlot(true), STR_MODE); new StaticText(window, grid.getLabelSlot(true), STR_MODE, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
new Choice(group, timerGrid.getSlot(2, 0), STR_TIMER_MODES, 0, TMRMODE_MAX, GET_SET_DEFAULT(timer->mode)); new Choice(group, timerGrid.getSlot(2, 0), STR_TIMER_MODES, 0, TMRMODE_MAX, GET_SET_DEFAULT(timer->mode));
new SwitchChoice(group, timerGrid.getSlot(2, 1), SWSRC_FIRST, SWSRC_LAST, GET_SET_DEFAULT(timer->swtch)); new SwitchChoice(group, timerGrid.getSlot(2, 1), SWSRC_FIRST, SWSRC_LAST, GET_SET_DEFAULT(timer->swtch));
timerGrid.nextLine(); timerGrid.nextLine();
// Timer start value // Timer start value
new StaticText(window, grid.getLabelSlot(true), "Start"); new StaticText(window, grid.getLabelSlot(true), "Start", 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
new TimeEdit(group, timerGrid.getSlot(), 0, TIMER_MAX, GET_SET_DEFAULT(timer->start)); new TimeEdit(group, timerGrid.getSlot(), 0, TIMER_MAX, GET_SET_DEFAULT(timer->start));
timerGrid.nextLine(); timerGrid.nextLine();
// Timer minute beep // Timer minute beep
new StaticText(window, grid.getLabelSlot(true), STR_MINUTEBEEP); new StaticText(window, grid.getLabelSlot(true), STR_MINUTEBEEP, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
new CheckBox(group, timerGrid.getSlot(), GET_SET_DEFAULT(timer->minuteBeep)); new CheckBox(group, timerGrid.getSlot(), GET_SET_DEFAULT(timer->minuteBeep));
timerGrid.nextLine(); timerGrid.nextLine();
// Timer countdown // Timer countdown
new StaticText(window, grid.getLabelSlot(true), STR_BEEPCOUNTDOWN); new StaticText(window, grid.getLabelSlot(true), STR_BEEPCOUNTDOWN, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
new Choice(group, timerGrid.getSlot(2, 0), STR_VBEEPCOUNTDOWN, COUNTDOWN_SILENT, COUNTDOWN_COUNT - 1, GET_SET_DEFAULT(timer->countdownBeep)); new Choice(group, timerGrid.getSlot(2, 0), STR_VBEEPCOUNTDOWN, COUNTDOWN_SILENT, COUNTDOWN_COUNT - 1, GET_SET_DEFAULT(timer->countdownBeep));
new Choice(group, timerGrid.getSlot(2, 1), STR_COUNTDOWNVALUES, 0, 3, GET_SET_WITH_OFFSET(timer->countdownStart, 2)); new Choice(group, timerGrid.getSlot(2, 1), STR_COUNTDOWNVALUES, 0, 3, GET_SET_WITH_OFFSET(timer->countdownStart, 2));
timerGrid.nextLine(); timerGrid.nextLine();
// Timer persistent // Timer persistent
new StaticText(window, grid.getLabelSlot(true), STR_PERSISTENT); new StaticText(window, grid.getLabelSlot(true), STR_PERSISTENT, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
new Choice(group, timerGrid.getSlot(), STR_VPERSISTENT, 0, 2, GET_SET_DEFAULT(timer->persistent)); new Choice(group, timerGrid.getSlot(), STR_VPERSISTENT, 0, 2, GET_SET_DEFAULT(timer->persistent));
timerGrid.nextLine(); timerGrid.nextLine();
@@ -1230,12 +1231,12 @@ void ModelSetupPage::build(FormWindow * window)
} }
// Extended limits // Extended limits
new StaticText(window, grid.getLabelSlot(), STR_ELIMITS); new StaticText(window, grid.getLabelSlot(), STR_ELIMITS, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_model.extendedLimits)); new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_model.extendedLimits));
grid.nextLine(); grid.nextLine();
// Extended trims // Extended trims
new StaticText(window, grid.getLabelSlot(), STR_ETRIMS); new StaticText(window, grid.getLabelSlot(), STR_ETRIMS, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(2, 0), GET_SET_DEFAULT(g_model.extendedTrims)); new CheckBox(window, grid.getFieldSlot(2, 0), GET_SET_DEFAULT(g_model.extendedTrims));
new TextButton(window, grid.getFieldSlot(2, 1), STR_RESET_BTN, new TextButton(window, grid.getFieldSlot(2, 1), STR_RESET_BTN,
[]() -> uint8_t { []() -> uint8_t {
@@ -1249,27 +1250,27 @@ void ModelSetupPage::build(FormWindow * window)
grid.nextLine(); grid.nextLine();
// Display trims // Display trims
new StaticText(window, grid.getLabelSlot(), STR_DISPLAY_TRIMS); new StaticText(window, grid.getLabelSlot(), STR_DISPLAY_TRIMS, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), "\006No\0 ChangeYes", 0, 2, GET_SET_DEFAULT(g_model.displayTrims)); new Choice(window, grid.getFieldSlot(), "\006No\0 ChangeYes", 0, 2, GET_SET_DEFAULT(g_model.displayTrims));
grid.nextLine(); grid.nextLine();
// Trim step // Trim step
new StaticText(window, grid.getLabelSlot(), STR_TRIMINC); new StaticText(window, grid.getLabelSlot(), STR_TRIMINC, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), STR_VTRIMINC, -2, 2, GET_SET_DEFAULT(g_model.trimInc)); new Choice(window, grid.getFieldSlot(), STR_VTRIMINC, -2, 2, GET_SET_DEFAULT(g_model.trimInc));
grid.nextLine(); grid.nextLine();
// Throttle parameters // Throttle parameters
{ {
new Subtitle(window, grid.getLineSlot(), STR_THROTTLE_LABEL); new Subtitle(window, grid.getLineSlot(), STR_THROTTLE_LABEL, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
// Throttle reversed // Throttle reversed
new StaticText(window, grid.getLabelSlot(true), STR_THROTTLEREVERSE); new StaticText(window, grid.getLabelSlot(true), STR_THROTTLEREVERSE, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_model.throttleReversed)); new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_model.throttleReversed));
grid.nextLine(); grid.nextLine();
// Throttle source // Throttle source
new StaticText(window, grid.getLabelSlot(true), STR_TTRACE); new StaticText(window, grid.getLabelSlot(true), STR_TTRACE, 0, COLOR_THEME_PRIMARY1);
auto sc = new SourceChoice( auto sc = new SourceChoice(
window, grid.getFieldSlot(), 0, MIXSRC_LAST_CH, window, grid.getFieldSlot(), 0, MIXSRC_LAST_CH,
[=]() { return throttleSource2Source(g_model.thrTraceSrc); }, [=]() { return throttleSource2Source(g_model.thrTraceSrc); },
@@ -1279,41 +1280,41 @@ void ModelSetupPage::build(FormWindow * window)
g_model.thrTraceSrc = val; g_model.thrTraceSrc = val;
SET_DIRTY(); SET_DIRTY();
} }
}); }, 0, COLOR_THEME_PRIMARY1);
sc->setAvailableHandler(isThrottleSourceAvailable); sc->setAvailableHandler(isThrottleSourceAvailable);
grid.nextLine(); grid.nextLine();
// Throttle trim // Throttle trim
new StaticText(window, grid.getLabelSlot(true), STR_TTRIM); new StaticText(window, grid.getLabelSlot(true), STR_TTRIM, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_model.thrTrim)); new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_model.thrTrim));
grid.nextLine(); grid.nextLine();
// Throttle trim source // Throttle trim source
new StaticText(window, grid.getLabelSlot(true), STR_TTRIM_SW); new StaticText(window, grid.getLabelSlot(true), STR_TTRIM_SW, 0, COLOR_THEME_PRIMARY1);
new SourceChoice( new SourceChoice(
window, grid.getFieldSlot(), MIXSRC_FIRST_TRIM, MIXSRC_LAST_TRIM, window, grid.getFieldSlot(), MIXSRC_FIRST_TRIM, MIXSRC_LAST_TRIM,
[=]() { return g_model.getThrottleStickTrimSource(); }, [=]() { return g_model.getThrottleStickTrimSource(); },
[=](int16_t src) { g_model.setThrottleStickTrimSource(src); }); [=](int16_t src) { g_model.setThrottleStickTrimSource(src); }, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
} }
// Preflight parameters // Preflight parameters
{ {
new Subtitle(window, grid.getLineSlot(), STR_PREFLIGHT); new Subtitle(window, grid.getLineSlot(), STR_PREFLIGHT, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
// Display checklist // Display checklist
new StaticText(window, grid.getLabelSlot(true), STR_CHECKLIST); new StaticText(window, grid.getLabelSlot(true), STR_CHECKLIST, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_model.displayChecklist)); new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_model.displayChecklist));
grid.nextLine(); grid.nextLine();
// Throttle warning // Throttle warning
new StaticText(window, grid.getLabelSlot(true), STR_THROTTLE_WARNING); new StaticText(window, grid.getLabelSlot(true), STR_THROTTLE_WARNING, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(), GET_SET_INVERTED(g_model.disableThrottleWarning)); new CheckBox(window, grid.getFieldSlot(), GET_SET_INVERTED(g_model.disableThrottleWarning));
grid.nextLine(); grid.nextLine();
// Switches warning // Switches warning
new StaticText(window, grid.getLabelSlot(true), STR_SWITCHWARNING); new StaticText(window, grid.getLabelSlot(true), STR_SWITCHWARNING, 0, COLOR_THEME_PRIMARY1);
auto group = new FormGroup(window, grid.getFieldSlot(), FORM_BORDER_FOCUS_ONLY | PAINT_CHILDREN_FIRST); auto group = new FormGroup(window, grid.getFieldSlot(), FORM_BORDER_FOCUS_ONLY | PAINT_CHILDREN_FIRST);
GridLayout switchesGrid(group); GridLayout switchesGrid(group);
for (int i = 0, j = 0; i < NUM_SWITCHES; i++) { for (int i = 0, j = 0; i < NUM_SWITCHES; i++) {
@@ -1341,7 +1342,7 @@ void ModelSetupPage::build(FormWindow * window)
// Center beeps // Center beeps
{ {
new StaticText(window, grid.getLabelSlot(false), STR_BEEPCTR); new StaticText(window, grid.getLabelSlot(false), STR_BEEPCTR, 0, COLOR_THEME_PRIMARY1);
auto group = new FormGroup(window, grid.getFieldSlot(), FORM_BORDER_FOCUS_ONLY | PAINT_CHILDREN_FIRST); auto group = new FormGroup(window, grid.getFieldSlot(), FORM_BORDER_FOCUS_ONLY | PAINT_CHILDREN_FIRST);
GridLayout centerGrid(group); GridLayout centerGrid(group);
for (int i = 0, j = 0; i < NUM_STICKS + NUM_POTS + NUM_SLIDERS; i++) { for (int i = 0, j = 0; i < NUM_STICKS + NUM_POTS + NUM_SLIDERS; i++) {
@@ -1364,27 +1365,27 @@ void ModelSetupPage::build(FormWindow * window)
} }
// Global functions // Global functions
new StaticText(window, grid.getLabelSlot(), STR_USE_GLOBAL_FUNCS); new StaticText(window, grid.getLabelSlot(), STR_USE_GLOBAL_FUNCS, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(), GET_SET_INVERTED(g_model.noGlobalFunctions)); new CheckBox(window, grid.getFieldSlot(), GET_SET_INVERTED(g_model.noGlobalFunctions));
grid.nextLine(); grid.nextLine();
// Internal module // Internal module
{ {
new Subtitle(window, grid.getLineSlot(), TR_INTERNALRF); new Subtitle(window, grid.getLineSlot(), TR_INTERNALRF, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
grid.addWindow(new ModuleWindow(window, {0, grid.getWindowHeight(), LCD_W, 0}, INTERNAL_MODULE)); grid.addWindow(new ModuleWindow(window, {0, grid.getWindowHeight(), LCD_W, 0}, INTERNAL_MODULE));
} }
// External module // External module
{ {
new Subtitle(window, grid.getLineSlot(), TR_EXTERNALRF); new Subtitle(window, grid.getLineSlot(), TR_EXTERNALRF, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
grid.addWindow(new ModuleWindow(window, {0, grid.getWindowHeight(), LCD_W, 0}, EXTERNAL_MODULE)); grid.addWindow(new ModuleWindow(window, {0, grid.getWindowHeight(), LCD_W, 0}, EXTERNAL_MODULE));
} }
// Trainer // Trainer
{ {
new Subtitle(window, grid.getLineSlot(), STR_TRAINER); new Subtitle(window, grid.getLineSlot(), STR_TRAINER, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
grid.addWindow(new TrainerModuleWindow(window, {0, grid.getWindowHeight(), LCD_W, 0})); grid.addWindow(new TrainerModuleWindow(window, {0, grid.getWindowHeight(), LCD_W, 0}));
} }
+36 -36
View File
@@ -153,7 +153,7 @@ class SensorEditWindow : public Page {
if (sensor->type == TELEM_TYPE_CALCULATED) { if (sensor->type == TELEM_TYPE_CALCULATED) {
// Formula // Formula
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_FORMULA); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_FORMULA, 0, COLOR_THEME_PRIMARY1);
new Choice(sensorParametersWindow, grid.getFieldSlot(), STR_VFORMULAS, 0, TELEM_FORMULA_LAST, GET_DEFAULT(sensor->formula), new Choice(sensorParametersWindow, grid.getFieldSlot(), STR_VFORMULAS, 0, TELEM_FORMULA_LAST, GET_DEFAULT(sensor->formula),
[=](uint8_t newValue) { [=](uint8_t newValue) {
sensor->formula = newValue; sensor->formula = newValue;
@@ -177,10 +177,10 @@ class SensorEditWindow : public Page {
grid.nextLine(); grid.nextLine();
} }
else { else {
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_ID); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_ID, 0, COLOR_THEME_PRIMARY1);
auto hex = new NumberEdit(sensorParametersWindow, grid.getFieldSlot(2, 0), 0, 0xFFFF, GET_SET_DEFAULT(sensor->id)); auto hex = new NumberEdit(sensorParametersWindow, grid.getFieldSlot(2, 0), 0, 0xFFFF, GET_SET_DEFAULT(sensor->id));
hex->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) { hex->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
drawHexNumber(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, 0); drawHexNumber(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, flags);
}); });
new NumberEdit(sensorParametersWindow, grid.getFieldSlot(2, 1), 0, 0xff, GET_SET_DEFAULT(sensor->instance)); new NumberEdit(sensorParametersWindow, grid.getFieldSlot(2, 1), 0, 0xff, GET_SET_DEFAULT(sensor->instance));
grid.nextLine(); grid.nextLine();
@@ -188,7 +188,7 @@ class SensorEditWindow : public Page {
// Unit // Unit
if ((sensor->type == TELEM_TYPE_CALCULATED && (sensor->formula == TELEM_FORMULA_DIST)) || sensor->isConfigurable()) { if ((sensor->type == TELEM_TYPE_CALCULATED && (sensor->formula == TELEM_FORMULA_DIST)) || sensor->isConfigurable()) {
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_UNIT); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_UNIT, 0, COLOR_THEME_PRIMARY1);
new Choice(sensorParametersWindow, grid.getFieldSlot(), STR_VTELEMUNIT, 0, UNIT_MAX, GET_DEFAULT(sensor->unit), new Choice(sensorParametersWindow, grid.getFieldSlot(), STR_VTELEMUNIT, 0, UNIT_MAX, GET_DEFAULT(sensor->unit),
[=](uint8_t newValue) { [=](uint8_t newValue) {
sensor->unit = newValue; sensor->unit = newValue;
@@ -204,7 +204,7 @@ class SensorEditWindow : public Page {
// Precision // Precision
if (sensor->isPrecConfigurable() && sensor->unit != UNIT_FAHRENHEIT) { if (sensor->isPrecConfigurable() && sensor->unit != UNIT_FAHRENHEIT) {
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_PRECISION); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_PRECISION, 0, COLOR_THEME_PRIMARY1);
new Choice(sensorParametersWindow, grid.getFieldSlot(), STR_VPREC, 0, 2, GET_DEFAULT(sensor->prec), new Choice(sensorParametersWindow, grid.getFieldSlot(), STR_VPREC, 0, 2, GET_DEFAULT(sensor->prec),
[=](uint8_t newValue) { [=](uint8_t newValue) {
sensor->prec = newValue; sensor->prec = newValue;
@@ -219,33 +219,33 @@ class SensorEditWindow : public Page {
if (sensor->unit < UNIT_FIRST_VIRTUAL) { if (sensor->unit < UNIT_FIRST_VIRTUAL) {
if (sensor->type == TELEM_TYPE_CALCULATED) { if (sensor->type == TELEM_TYPE_CALCULATED) {
if (sensor->formula == TELEM_FORMULA_CELL) { if (sensor->formula == TELEM_FORMULA_CELL) {
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_CELLSENSOR); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_CELLSENSOR, 0, COLOR_THEME_PRIMARY1);
new SensorSourceChoice(sensorParametersWindow, grid.getFieldSlot(), &sensor->cell.source, isCellsSensor); new SensorSourceChoice(sensorParametersWindow, grid.getFieldSlot(), &sensor->cell.source, isCellsSensor);
} }
else if (sensor->formula == TELEM_FORMULA_DIST) { else if (sensor->formula == TELEM_FORMULA_DIST) {
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_GPSSENSOR); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_GPSSENSOR, 0, COLOR_THEME_PRIMARY1);
new SensorSourceChoice(sensorParametersWindow, grid.getFieldSlot(), &sensor->dist.gps, isGPSSensor); new SensorSourceChoice(sensorParametersWindow, grid.getFieldSlot(), &sensor->dist.gps, isGPSSensor);
} }
else if (sensor->formula == TELEM_FORMULA_CONSUMPTION) { else if (sensor->formula == TELEM_FORMULA_CONSUMPTION) {
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_CURRENTSENSOR); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_CURRENTSENSOR, 0, COLOR_THEME_PRIMARY1);
new SensorSourceChoice(sensorParametersWindow, grid.getFieldSlot(), &sensor->consumption.source, isSensorAvailable); new SensorSourceChoice(sensorParametersWindow, grid.getFieldSlot(), &sensor->consumption.source, isSensorAvailable);
} }
else if (sensor->formula == TELEM_FORMULA_TOTALIZE) { else if (sensor->formula == TELEM_FORMULA_TOTALIZE) {
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_SOURCE); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_SOURCE, 0, COLOR_THEME_PRIMARY1);
new SensorSourceChoice(sensorParametersWindow, grid.getFieldSlot(), &sensor->consumption.source, isSensorAvailable); new SensorSourceChoice(sensorParametersWindow, grid.getFieldSlot(), &sensor->consumption.source, isSensorAvailable);
} }
else { else {
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_SOURCE + std::to_string(1)); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_SOURCE + std::to_string(1), 0, COLOR_THEME_PRIMARY1);
new SensorSourceChoice(sensorParametersWindow, grid.getFieldSlot(), (uint8_t *) &sensor->calc.sources[0], isSensorAvailable); new SensorSourceChoice(sensorParametersWindow, grid.getFieldSlot(), (uint8_t *) &sensor->calc.sources[0], isSensorAvailable);
} }
} }
else { else {
if (sensor->unit == UNIT_RPMS) { if (sensor->unit == UNIT_RPMS) {
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_BLADES); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_BLADES, 0, COLOR_THEME_PRIMARY1);
new NumberEdit(sensorParametersWindow, grid.getFieldSlot(), 1, 30000, GET_SET_DEFAULT(sensor->custom.ratio)); new NumberEdit(sensorParametersWindow, grid.getFieldSlot(), 1, 30000, GET_SET_DEFAULT(sensor->custom.ratio));
} }
else { else {
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_RATIO); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_RATIO, 0, COLOR_THEME_PRIMARY1);
auto edit = new NumberEdit(sensorParametersWindow, grid.getFieldSlot(), 0, 30000, GET_SET_DEFAULT(sensor->custom.ratio)); auto edit = new NumberEdit(sensorParametersWindow, grid.getFieldSlot(), 0, 30000, GET_SET_DEFAULT(sensor->custom.ratio));
edit->setZeroText("-"); edit->setZeroText("-");
} }
@@ -257,24 +257,24 @@ class SensorEditWindow : public Page {
(sensor->type == TELEM_TYPE_CALCULATED && (sensor->formula == TELEM_FORMULA_CONSUMPTION || sensor->formula == TELEM_FORMULA_TOTALIZE)))) { (sensor->type == TELEM_TYPE_CALCULATED && (sensor->formula == TELEM_FORMULA_CONSUMPTION || sensor->formula == TELEM_FORMULA_TOTALIZE)))) {
if (sensor->type == TELEM_TYPE_CALCULATED) { if (sensor->type == TELEM_TYPE_CALCULATED) {
if (sensor->formula == TELEM_FORMULA_CELL) { if (sensor->formula == TELEM_FORMULA_CELL) {
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_CELLINDEX); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_CELLINDEX, 0, COLOR_THEME_PRIMARY1);
new Choice(sensorParametersWindow, grid.getFieldSlot(), STR_VCELLINDEX, 0, 8, GET_SET_DEFAULT(sensor->cell.index)); new Choice(sensorParametersWindow, grid.getFieldSlot(), STR_VCELLINDEX, 0, 8, GET_SET_DEFAULT(sensor->cell.index));
} }
else if (sensor->formula == TELEM_FORMULA_DIST) { else if (sensor->formula == TELEM_FORMULA_DIST) {
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_ALTSENSOR); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_ALTSENSOR, 0, COLOR_THEME_PRIMARY1);
new SensorSourceChoice(sensorParametersWindow, grid.getFieldSlot(), &sensor->dist.alt, isAltSensor); new SensorSourceChoice(sensorParametersWindow, grid.getFieldSlot(), &sensor->dist.alt, isAltSensor);
} }
else { else {
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_SOURCE + std::to_string(2)); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_SOURCE + std::to_string(2), 0, COLOR_THEME_PRIMARY1);
new SensorSourceChoice(sensorParametersWindow, grid.getFieldSlot(), (uint8_t *) &sensor->calc.sources[1], isSensorAvailable); new SensorSourceChoice(sensorParametersWindow, grid.getFieldSlot(), (uint8_t *) &sensor->calc.sources[1], isSensorAvailable);
} }
} }
else if (sensor->unit == UNIT_RPMS) { else if (sensor->unit == UNIT_RPMS) {
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_MULTIPLIER); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_MULTIPLIER, 0, COLOR_THEME_PRIMARY1);
new NumberEdit(sensorParametersWindow, grid.getFieldSlot(), 1, 30000, GET_SET_DEFAULT(sensor->custom.offset)); new NumberEdit(sensorParametersWindow, grid.getFieldSlot(), 1, 30000, GET_SET_DEFAULT(sensor->custom.offset));
} }
else { else {
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_OFFSET); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_OFFSET, 0, COLOR_THEME_PRIMARY1);
new NumberEdit(sensorParametersWindow, grid.getFieldSlot(), -30000, 30000, GET_SET_DEFAULT(sensor->custom.offset), new NumberEdit(sensorParametersWindow, grid.getFieldSlot(), -30000, 30000, GET_SET_DEFAULT(sensor->custom.offset),
0, (sensor->prec > 0) ? (sensor->prec == 2 ? PREC2 : PREC1) : 0); 0, (sensor->prec > 0) ? (sensor->prec == 2 ? PREC2 : PREC1) : 0);
} }
@@ -282,36 +282,36 @@ class SensorEditWindow : public Page {
} }
if ((sensor->type == TELEM_TYPE_CALCULATED && sensor->formula < TELEM_FORMULA_MULTIPLY)) { if ((sensor->type == TELEM_TYPE_CALCULATED && sensor->formula < TELEM_FORMULA_MULTIPLY)) {
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_SOURCE + std::to_string(3)); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_SOURCE + std::to_string(3), 0, COLOR_THEME_PRIMARY1);
new SensorSourceChoice(sensorParametersWindow, grid.getFieldSlot(), (uint8_t *) &sensor->calc.sources[2], isSensorAvailable); new SensorSourceChoice(sensorParametersWindow, grid.getFieldSlot(), (uint8_t *) &sensor->calc.sources[2], isSensorAvailable);
grid.nextLine(); grid.nextLine();
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_SOURCE + std::to_string(4)); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_SOURCE + std::to_string(4), 0, COLOR_THEME_PRIMARY1);
new SensorSourceChoice(sensorParametersWindow, grid.getFieldSlot(), (uint8_t *) &sensor->calc.sources[3], isSensorAvailable); new SensorSourceChoice(sensorParametersWindow, grid.getFieldSlot(), (uint8_t *) &sensor->calc.sources[3], isSensorAvailable);
grid.nextLine(); grid.nextLine();
} }
// Auto Offset // Auto Offset
if (sensor->unit != UNIT_RPMS && sensor->isConfigurable()) { if (sensor->unit != UNIT_RPMS && sensor->isConfigurable()) {
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_AUTOOFFSET); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_AUTOOFFSET, 0, COLOR_THEME_PRIMARY1);
new CheckBox(sensorParametersWindow, grid.getFieldSlot(), GET_SET_DEFAULT(sensor->autoOffset)); new CheckBox(sensorParametersWindow, grid.getFieldSlot(), GET_SET_DEFAULT(sensor->autoOffset));
grid.nextLine(); grid.nextLine();
} }
if (sensor->isConfigurable()) { if (sensor->isConfigurable()) {
// Only positive // Only positive
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_ONLYPOSITIVE); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_ONLYPOSITIVE, 0, COLOR_THEME_PRIMARY1);
new CheckBox(sensorParametersWindow, grid.getFieldSlot(), GET_SET_DEFAULT(sensor->onlyPositive)); new CheckBox(sensorParametersWindow, grid.getFieldSlot(), GET_SET_DEFAULT(sensor->onlyPositive));
grid.nextLine(); grid.nextLine();
// Filter // Filter
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_FILTER); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_FILTER, 0, COLOR_THEME_PRIMARY1);
new CheckBox(sensorParametersWindow, grid.getFieldSlot(), GET_SET_DEFAULT(sensor->filter)); new CheckBox(sensorParametersWindow, grid.getFieldSlot(), GET_SET_DEFAULT(sensor->filter));
grid.nextLine(); grid.nextLine();
} }
if (sensor->type == TELEM_TYPE_CALCULATED) { if (sensor->type == TELEM_TYPE_CALCULATED) {
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_PERSISTENT); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_PERSISTENT, 0, COLOR_THEME_PRIMARY1);
new CheckBox(sensorParametersWindow, grid.getFieldSlot(), GET_DEFAULT(sensor->persistent), [=](int32_t newValue) { new CheckBox(sensorParametersWindow, grid.getFieldSlot(), GET_DEFAULT(sensor->persistent), [=](int32_t newValue) {
sensor->persistent = newValue; sensor->persistent = newValue;
if (!sensor->persistent) if (!sensor->persistent)
@@ -321,7 +321,7 @@ class SensorEditWindow : public Page {
grid.nextLine(); grid.nextLine();
} }
new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_LOGS); new StaticText(sensorParametersWindow, grid.getLabelSlot(), STR_LOGS, 0, COLOR_THEME_PRIMARY1);
new CheckBox(sensorParametersWindow, grid.getFieldSlot(), GET_DEFAULT(sensor->logs), [=](int32_t newValue) { new CheckBox(sensorParametersWindow, grid.getFieldSlot(), GET_DEFAULT(sensor->logs), [=](int32_t newValue) {
sensor->logs = newValue; sensor->logs = newValue;
logsClose(); logsClose();
@@ -340,12 +340,12 @@ class SensorEditWindow : public Page {
TelemetrySensor * sensor = &g_model.telemetrySensors[index]; TelemetrySensor * sensor = &g_model.telemetrySensors[index];
// Sensor name // Sensor name
new StaticText(window, grid.getLabelSlot(), STR_NAME); new StaticText(window, grid.getLabelSlot(), STR_NAME, 0, COLOR_THEME_PRIMARY1);
new RadioTextEdit(window, grid.getFieldSlot(), sensor->label, sizeof(sensor->label)); new RadioTextEdit(window, grid.getFieldSlot(), sensor->label, sizeof(sensor->label));
grid.nextLine(); grid.nextLine();
// Type // Type
new StaticText(window, grid.getLabelSlot(), STR_TYPE); new StaticText(window, grid.getLabelSlot(), STR_TYPE, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), STR_VSENSORTYPES, 0, 1, GET_DEFAULT(sensor->type), new Choice(window, grid.getFieldSlot(), STR_VSENSORTYPES, 0, 1, GET_DEFAULT(sensor->type),
[=](uint8_t newValue) { [=](uint8_t newValue) {
sensor->type = newValue; sensor->type = newValue;
@@ -411,10 +411,10 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
this->window = window; this->window = window;
// RSSI // RSSI
new Subtitle(window, grid.getLineSlot(), getRssiLabel()); new Subtitle(window, grid.getLineSlot(), getRssiLabel(), 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
new StaticText(window, grid.getLabelSlot(true), STR_LOWALARM); new StaticText(window, grid.getLabelSlot(true), STR_LOWALARM, 0, COLOR_THEME_PRIMARY1);
auto edit = new NumberEdit(window, grid.getFieldSlot(), -30, 30, GET_SET_DEFAULT(g_model.rssiAlarms.warning)); auto edit = new NumberEdit(window, grid.getFieldSlot(), -30, 30, GET_SET_DEFAULT(g_model.rssiAlarms.warning));
edit->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) { edit->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, g_model.rssiAlarms.getWarningRssi(), flags); dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, g_model.rssiAlarms.getWarningRssi(), flags);
@@ -422,20 +422,20 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
// window->setFirstField(edit); // window->setFirstField(edit);
grid.nextLine(); grid.nextLine();
new StaticText(window, grid.getLabelSlot(true), STR_CRITICALALARM); new StaticText(window, grid.getLabelSlot(true), STR_CRITICALALARM, 0, COLOR_THEME_PRIMARY1);
edit = new NumberEdit(window, grid.getFieldSlot(), -30, 30, GET_SET_DEFAULT(g_model.rssiAlarms.critical)); edit = new NumberEdit(window, grid.getFieldSlot(), -30, 30, GET_SET_DEFAULT(g_model.rssiAlarms.critical));
edit->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) { edit->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, g_model.rssiAlarms.getCriticalRssi(), flags); dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, g_model.rssiAlarms.getCriticalRssi(), flags);
}); });
grid.nextLine(); grid.nextLine();
new StaticText(window, grid.getLabelSlot(true), STR_DISABLE_ALARM); new StaticText(window, grid.getLabelSlot(true), STR_DISABLE_ALARM, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_model.rssiAlarms.disabled)); new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_model.rssiAlarms.disabled));
grid.nextLine(); grid.nextLine();
// Sensors // Sensors
grid.setLabelWidth(140); grid.setLabelWidth(140);
new Subtitle(window, grid.getLineSlot(), STR_TELEMETRY_SENSORS); new Subtitle(window, grid.getLineSlot(), STR_TELEMETRY_SENSORS, 0, COLOR_THEME_PRIMARY1);
// Sensors columns titles // Sensors columns titles
uint8_t sensorsCount = getTelemetrySensorsCount(); uint8_t sensorsCount = getTelemetrySensorsCount();
@@ -531,14 +531,14 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
grid.setLabelWidth(PAGE_LABEL_WIDTH); grid.setLabelWidth(PAGE_LABEL_WIDTH);
// Ignore instance button // Ignore instance button
new StaticText(window, grid.getLabelSlot(true), STR_IGNORE_INSTANCE); new StaticText(window, grid.getLabelSlot(true), STR_IGNORE_INSTANCE, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_model.ignoreSensorIds)); new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_model.ignoreSensorIds));
grid.nextLine(); grid.nextLine();
// Vario // Vario
new Subtitle(window, grid.getLineSlot(), STR_VARIO); new Subtitle(window, grid.getLineSlot(), STR_VARIO, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
new StaticText(window, grid.getLabelSlot(true), STR_SOURCE); new StaticText(window, grid.getLabelSlot(true), STR_SOURCE, 0, COLOR_THEME_PRIMARY1);
auto choice = new SourceChoice(window, grid.getFieldSlot(), MIXSRC_NONE, MIXSRC_LAST_TELEM, auto choice = new SourceChoice(window, grid.getFieldSlot(), MIXSRC_NONE, MIXSRC_LAST_TELEM,
GET_DEFAULT(g_model.varioData.source ? MIXSRC_FIRST_TELEM + 3 * (g_model.varioData.source - 1) : MIXSRC_NONE), GET_DEFAULT(g_model.varioData.source ? MIXSRC_FIRST_TELEM + 3 * (g_model.varioData.source - 1) : MIXSRC_NONE),
SET_VALUE(g_model.varioData.source, newValue == MIXSRC_NONE ? 0 : (newValue - MIXSRC_FIRST_TELEM) / 3 + 1)); SET_VALUE(g_model.varioData.source, newValue == MIXSRC_NONE ? 0 : (newValue - MIXSRC_FIRST_TELEM) / 3 + 1));
@@ -551,7 +551,7 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
return qr.rem == 0 && isSensorAvailable(qr.quot + 1); return qr.rem == 0 && isSensorAvailable(qr.quot + 1);
}); });
grid.nextLine(); grid.nextLine();
new StaticText(window, grid.getLabelSlot(true), STR_RANGE); new StaticText(window, grid.getLabelSlot(true), STR_RANGE, 0, COLOR_THEME_PRIMARY1);
auto vMin = new NumberEdit(window, grid.getFieldSlot(2, 0), -17, 17, auto vMin = new NumberEdit(window, grid.getFieldSlot(2, 0), -17, 17,
GET_SET_WITH_OFFSET(g_model.varioData.min, -10)); GET_SET_WITH_OFFSET(g_model.varioData.min, -10));
@@ -564,7 +564,7 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
[](int val) { return g_model.varioData.min - 10 < val; }); [](int val) { return g_model.varioData.min - 10 < val; });
grid.nextLine(); grid.nextLine();
new StaticText(window, grid.getLabelSlot(true), STR_CENTER); new StaticText(window, grid.getLabelSlot(true), STR_CENTER, 0, COLOR_THEME_PRIMARY1);
auto cMin = new NumberEdit( auto cMin = new NumberEdit(
window, grid.getFieldSlot(3, 0), -15, 15, window, grid.getFieldSlot(3, 0), -15, 15,
+28 -30
View File
@@ -37,7 +37,7 @@
class SwitchDynamicLabel: public StaticText { class SwitchDynamicLabel: public StaticText {
public: public:
SwitchDynamicLabel(Window * parent, const rect_t & rect, uint8_t index): SwitchDynamicLabel(Window * parent, const rect_t & rect, uint8_t index):
StaticText(parent, rect), StaticText(parent, rect, "", 0, COLOR_THEME_PRIMARY1),
index(index) index(index)
{ {
update(); update();
@@ -108,7 +108,7 @@ class BluetoothConfigWindow : public FormGroup
#endif #endif
clear(); clear();
new StaticText(this, grid.getLabelSlot(true), STR_MODE); new StaticText(this, grid.getLabelSlot(true), STR_MODE, 0, COLOR_THEME_PRIMARY1);
btMode = new Choice(this, grid.getFieldSlot(), STR_BLUETOOTH_MODES, BLUETOOTH_OFF, BLUETOOTH_TRAINER, GET_DEFAULT(g_eeGeneral.bluetoothMode), [=](int32_t newValue) { btMode = new Choice(this, grid.getFieldSlot(), STR_BLUETOOTH_MODES, BLUETOOTH_OFF, BLUETOOTH_TRAINER, GET_DEFAULT(g_eeGeneral.bluetoothMode), [=](int32_t newValue) {
g_eeGeneral.bluetoothMode = newValue; g_eeGeneral.bluetoothMode = newValue;
update(); update();
@@ -120,23 +120,23 @@ class BluetoothConfigWindow : public FormGroup
if (g_eeGeneral.bluetoothMode != BLUETOOTH_OFF) { if (g_eeGeneral.bluetoothMode != BLUETOOTH_OFF) {
// Pin code (displayed for information only, not editable) // Pin code (displayed for information only, not editable)
if (g_eeGeneral.bluetoothMode == BLUETOOTH_TELEMETRY) { if (g_eeGeneral.bluetoothMode == BLUETOOTH_TELEMETRY) {
new StaticText(this, grid.getLabelSlot(true), STR_BLUETOOTH_PIN_CODE); new StaticText(this, grid.getLabelSlot(true), STR_BLUETOOTH_PIN_CODE, 0, COLOR_THEME_PRIMARY1);
new StaticText(this, grid.getFieldSlot(), "000000"); new StaticText(this, grid.getFieldSlot(), "000000", 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
} }
// Local MAC // Local MAC
new StaticText(this, grid.getLabelSlot(true), STR_BLUETOOTH_LOCAL_ADDR); new StaticText(this, grid.getLabelSlot(true), STR_BLUETOOTH_LOCAL_ADDR, 0, COLOR_THEME_PRIMARY1);
new StaticText(this, grid.getFieldSlot(), bluetooth.localAddr[0] == '\0' ? "---" : bluetooth.localAddr); new StaticText(this, grid.getFieldSlot(), bluetooth.localAddr[0] == '\0' ? "---" : bluetooth.localAddr, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
// Remote MAC // Remote MAC
new StaticText(this, grid.getLabelSlot(true), STR_BLUETOOTH_DIST_ADDR); new StaticText(this, grid.getLabelSlot(true), STR_BLUETOOTH_DIST_ADDR, 0, COLOR_THEME_PRIMARY1);
new StaticText(this, grid.getFieldSlot(), bluetooth.distantAddr[0] == '\0' ? "---" : bluetooth.distantAddr); new StaticText(this, grid.getFieldSlot(), bluetooth.distantAddr[0] == '\0' ? "---" : bluetooth.distantAddr, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
// BT radio name // BT radio name
new StaticText(this, grid.getLabelSlot(true), STR_NAME); new StaticText(this, grid.getLabelSlot(true), STR_NAME, 0, COLOR_THEME_PRIMARY1);
new RadioTextEdit(this, grid.getFieldSlot(), g_eeGeneral.bluetoothName, LEN_BLUETOOTH_NAME); new RadioTextEdit(this, grid.getFieldSlot(), g_eeGeneral.bluetoothName, LEN_BLUETOOTH_NAME);
grid.nextLine(); grid.nextLine();
} }
@@ -160,7 +160,7 @@ void RadioHardwarePage::build(FormWindow * window)
grid.spacer(PAGE_PADDING); grid.spacer(PAGE_PADDING);
// Calibration // Calibration
new StaticText(window, grid.getLabelSlot(), STR_INPUTS, 0, FONT(BOLD)); new StaticText(window, grid.getLabelSlot(), STR_INPUTS, 0, COLOR_THEME_PRIMARY1 | FONT(BOLD));
auto calib = new TextButton(window, grid.getFieldSlot(), STR_CALIBRATION); auto calib = new TextButton(window, grid.getFieldSlot(), STR_CALIBRATION);
calib->setPressHandler([=]() -> uint8_t { calib->setPressHandler([=]() -> uint8_t {
auto calibrationPage = new RadioCalibrationPage(); auto calibrationPage = new RadioCalibrationPage();
@@ -172,19 +172,19 @@ void RadioHardwarePage::build(FormWindow * window)
grid.nextLine(); grid.nextLine();
// Sticks // Sticks
new Subtitle(window, grid.getLineSlot(), STR_STICKS); new Subtitle(window, grid.getLineSlot(), STR_STICKS, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
for (int i = 0; i < NUM_STICKS; i++) { for (int i = 0; i < NUM_STICKS; i++) {
new StaticText(window, grid.getLabelSlot(true), TEXT_AT_INDEX(STR_VSRCRAW, (i + 1))); new StaticText(window, grid.getLabelSlot(true), TEXT_AT_INDEX(STR_VSRCRAW, (i + 1)), 0, COLOR_THEME_PRIMARY1);
new RadioTextEdit(window, grid.getFieldSlot(2,0), g_eeGeneral.anaNames[i], LEN_ANA_NAME); new RadioTextEdit(window, grid.getFieldSlot(2,0), g_eeGeneral.anaNames[i], LEN_ANA_NAME);
grid.nextLine(); grid.nextLine();
} }
// Pots // Pots
new Subtitle(window, grid.getLineSlot(), STR_POTS); new Subtitle(window, grid.getLineSlot(), STR_POTS, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
for (int i = 0; i < NUM_POTS; i++) { for (int i = 0; i < NUM_POTS; i++) {
new StaticText(window, grid.getLabelSlot(true), TEXT_AT_INDEX(STR_VSRCRAW, (i + NUM_STICKS + 1))); new StaticText(window, grid.getLabelSlot(true), TEXT_AT_INDEX(STR_VSRCRAW, (i + NUM_STICKS + 1)), 0, COLOR_THEME_PRIMARY1);
new RadioTextEdit(window, grid.getFieldSlot(2,0), g_eeGeneral.anaNames[i + NUM_STICKS], LEN_ANA_NAME); new RadioTextEdit(window, grid.getFieldSlot(2,0), g_eeGeneral.anaNames[i + NUM_STICKS], LEN_ANA_NAME);
new Choice(window, grid.getFieldSlot(2,1), STR_POTTYPES, POT_NONE, POT_WITHOUT_DETENT, new Choice(window, grid.getFieldSlot(2,1), STR_POTTYPES, POT_NONE, POT_WITHOUT_DETENT,
[=]() -> int { [=]() -> int {
@@ -198,14 +198,12 @@ void RadioHardwarePage::build(FormWindow * window)
} }
// Sliders // Sliders
new Subtitle(window, grid.getLineSlot(), STR_SLIDERS); new Subtitle(window, grid.getLineSlot(), STR_SLIDERS, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
for (int i = 0; i < NUM_SLIDERS; i++) { for (int i = 0; i < NUM_SLIDERS; i++) {
const int idx = i + NUM_STICKS + NUM_POTS; const int idx = i + NUM_STICKS + NUM_POTS;
new StaticText(window, grid.getLabelSlot(true), new StaticText(window, grid.getLabelSlot(true), TEXT_AT_INDEX(STR_VSRCRAW, idx + 1), 0, COLOR_THEME_PRIMARY1);
TEXT_AT_INDEX(STR_VSRCRAW, idx + 1)); new RadioTextEdit(window, grid.getFieldSlot(2, 0), g_eeGeneral.anaNames[idx], LEN_ANA_NAME);
new RadioTextEdit(window, grid.getFieldSlot(2, 0),
g_eeGeneral.anaNames[idx], LEN_ANA_NAME);
new Choice( new Choice(
window, grid.getFieldSlot(2, 1), STR_SLIDERTYPES, SLIDER_NONE, window, grid.getFieldSlot(2, 1), STR_SLIDERTYPES, SLIDER_NONE,
SLIDER_WITH_DETENT, SLIDER_WITH_DETENT,
@@ -223,7 +221,7 @@ void RadioHardwarePage::build(FormWindow * window)
} }
// Switches // Switches
new Subtitle(window, grid.getLineSlot(), STR_SWITCHES); new Subtitle(window, grid.getLineSlot(), STR_SWITCHES, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
for (int i = 0; i < NUM_SWITCHES; i++) { for (int i = 0; i < NUM_SWITCHES; i++) {
new SwitchDynamicLabel(window, grid.getLabelSlot(true), i); new SwitchDynamicLabel(window, grid.getLabelSlot(true), i);
@@ -241,7 +239,7 @@ void RadioHardwarePage::build(FormWindow * window)
} }
// Bat calibration // Bat calibration
new StaticText(window, grid.getLabelSlot(), STR_BATT_CALIB); new StaticText(window, grid.getLabelSlot(), STR_BATT_CALIB, 0, COLOR_THEME_PRIMARY1);
auto batCal = new NumberEdit(window, grid.getFieldSlot(1,0), -127, 127, GET_SET_DEFAULT(g_eeGeneral.txVoltageCalibration)); auto batCal = new NumberEdit(window, grid.getFieldSlot(1,0), -127, 127, GET_SET_DEFAULT(g_eeGeneral.txVoltageCalibration));
batCal->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) { batCal->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, getBatteryVoltage(), flags | PREC2, 0, nullptr, "V"); dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, getBatteryVoltage(), flags | PREC2, 0, nullptr, "V");
@@ -250,20 +248,20 @@ void RadioHardwarePage::build(FormWindow * window)
grid.nextLine(); grid.nextLine();
// RTC Batt display // RTC Batt display
new StaticText(window, grid.getLabelSlot(), STR_RTC_BATT); new StaticText(window, grid.getLabelSlot(), STR_RTC_BATT, 0, COLOR_THEME_PRIMARY1);
new DynamicNumber<uint16_t>(window, grid.getFieldSlot(1,0), [] { new DynamicNumber<uint16_t>(window, grid.getFieldSlot(1,0), [] {
return getRTCBatteryVoltage(); return getRTCBatteryVoltage();
}, PREC2, nullptr, "V"); }, COLOR_THEME_PRIMARY1 | PREC2, nullptr, "V");
grid.nextLine(); grid.nextLine();
// RTC Batt check enable // RTC Batt check enable
new StaticText(window, grid.getLabelSlot(), STR_RTC_CHECK); new StaticText(window, grid.getLabelSlot(), STR_RTC_CHECK, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(1,0), GET_SET_INVERTED(g_eeGeneral.disableRtcWarning )); new CheckBox(window, grid.getFieldSlot(1,0), GET_SET_INVERTED(g_eeGeneral.disableRtcWarning ));
grid.nextLine(); grid.nextLine();
#if defined(CROSSFIRE) && SPORT_MAX_BAUDRATE < 400000 #if defined(CROSSFIRE) && SPORT_MAX_BAUDRATE < 400000
// Max baud for external modules // Max baud for external modules
new StaticText(window, grid.getLabelSlot(), STR_MAXBAUDRATE); new StaticText(window, grid.getLabelSlot(), STR_MAXBAUDRATE, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(1,0), STR_CRSF_BAUDRATE, 0, 1, GET_SET_DEFAULT(g_eeGeneral.telemetryBaudrate)); new Choice(window, grid.getFieldSlot(1,0), STR_CRSF_BAUDRATE, 0, 1, GET_SET_DEFAULT(g_eeGeneral.telemetryBaudrate));
grid.nextLine(); grid.nextLine();
#endif #endif
@@ -271,14 +269,14 @@ void RadioHardwarePage::build(FormWindow * window)
#if defined(BLUETOOTH) #if defined(BLUETOOTH)
// Bluetooth mode // Bluetooth mode
{ {
new Subtitle(window, grid.getLineSlot(), STR_BLUETOOTH); new Subtitle(window, grid.getLineSlot(), STR_BLUETOOTH, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
grid.addWindow(new BluetoothConfigWindow(window, {0, grid.getWindowHeight(), LCD_W, 0})); grid.addWindow(new BluetoothConfigWindow(window, {0, grid.getWindowHeight(), LCD_W, 0}));
} }
#endif #endif
#if defined(AUX_SERIAL) #if defined(AUX_SERIAL)
new StaticText(window, grid.getLabelSlot(), STR_AUX_SERIAL_MODE); new StaticText(window, grid.getLabelSlot(), STR_AUX_SERIAL_MODE, 0, COLOR_THEME_PRIMARY1);
auto aux = auto aux =
new Choice(window, grid.getFieldSlot(1, 0), STR_AUX_SERIAL_MODES, 0, new Choice(window, grid.getFieldSlot(1, 0), STR_AUX_SERIAL_MODES, 0,
UART_MODE_MAX, GET_DEFAULT(g_eeGeneral.auxSerialMode), UART_MODE_MAX, GET_DEFAULT(g_eeGeneral.auxSerialMode),
@@ -292,7 +290,7 @@ void RadioHardwarePage::build(FormWindow * window)
#endif #endif
#if defined(AUX2_SERIAL) #if defined(AUX2_SERIAL)
new StaticText(window, grid.getLabelSlot(), STR_AUX2_SERIAL_MODE); new StaticText(window, grid.getLabelSlot(), STR_AUX2_SERIAL_MODE, 0, COLOR_THEME_PRIMARY1);
auto aux2 = auto aux2 =
new Choice(window, grid.getFieldSlot(1, 0), STR_AUX_SERIAL_MODES, 0, new Choice(window, grid.getFieldSlot(1, 0), STR_AUX_SERIAL_MODES, 0,
UART_MODE_MAX, GET_DEFAULT(g_eeGeneral.aux2SerialMode), UART_MODE_MAX, GET_DEFAULT(g_eeGeneral.aux2SerialMode),
@@ -311,12 +309,12 @@ void RadioHardwarePage::build(FormWindow * window)
#endif #endif
// ADC filter // ADC filter
new StaticText(window, grid.getLabelSlot(), STR_JITTER_FILTER); new StaticText(window, grid.getLabelSlot(), STR_JITTER_FILTER, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(1,0), GET_SET_INVERTED(g_eeGeneral.jitterFilter)); new CheckBox(window, grid.getFieldSlot(1,0), GET_SET_INVERTED(g_eeGeneral.jitterFilter));
grid.nextLine(); grid.nextLine();
// Debugs // Debugs
new StaticText(window, grid.getLabelSlot(), STR_DEBUG, 0, FONT(BOLD)); new StaticText(window, grid.getLabelSlot(), STR_DEBUG, 0, COLOR_THEME_PRIMARY1 | FONT(BOLD));
auto debugAnas = new TextButton(window, grid.getFieldSlot(2, 0), STR_ANALOGS_BTN); auto debugAnas = new TextButton(window, grid.getFieldSlot(2, 0), STR_ANALOGS_BTN);
debugAnas->setPressHandler([=]() -> uint8_t { debugAnas->setPressHandler([=]() -> uint8_t {
auto debugAnalogsPage = new RadioAnalogsDiagsPage(); auto debugAnalogsPage = new RadioAnalogsDiagsPage();
+44 -44
View File
@@ -52,7 +52,7 @@ class DateTimeWindow : public FormGroup {
FormGridLayout grid; FormGridLayout grid;
// Date // Date
new StaticText(this, grid.getLabelSlot(), STR_DATE); new StaticText(this, grid.getLabelSlot(), STR_DATE, 0, COLOR_THEME_PRIMARY1);
new NumberEdit(this, grid.getFieldSlot(3, 0), 2018, 2100, new NumberEdit(this, grid.getFieldSlot(3, 0), 2018, 2100,
[=]() -> int32_t { [=]() -> int32_t {
struct gtm t; struct gtm t;
@@ -105,7 +105,7 @@ class DateTimeWindow : public FormGroup {
grid.nextLine(); grid.nextLine();
// Time // Time
new StaticText(this, grid.getLabelSlot(), STR_TIME); new StaticText(this, grid.getLabelSlot(), STR_TIME, 0, COLOR_THEME_PRIMARY1);
auto hour = new NumberEdit(this, grid.getFieldSlot(3, 0), 0, 24, auto hour = new NumberEdit(this, grid.getFieldSlot(3, 0), 0, 24,
[=]() -> int32_t { [=]() -> int32_t {
struct gtm t; struct gtm t;
@@ -171,7 +171,7 @@ void RadioSetupPage::build(FormWindow * window)
grid.addWindow(timeWindow); grid.addWindow(timeWindow);
// Batt meter range - Range 3.0v to 16v // Batt meter range - Range 3.0v to 16v
new StaticText(window, grid.getLabelSlot(), STR_BATTERY_RANGE); new StaticText(window, grid.getLabelSlot(), STR_BATTERY_RANGE, 0, COLOR_THEME_PRIMARY1);
auto batMinEdit = new NumberEdit(window, grid.getFieldSlot(2, 0), -60 + 90, g_eeGeneral.vBatMax + 29 + 90, GET_SET_WITH_OFFSET(g_eeGeneral.vBatMin, 90), 0, PREC1); auto batMinEdit = new NumberEdit(window, grid.getFieldSlot(2, 0), -60 + 90, g_eeGeneral.vBatMax + 29 + 90, GET_SET_WITH_OFFSET(g_eeGeneral.vBatMin, 90), 0, PREC1);
batMinEdit->setSuffix("V"); batMinEdit->setSuffix("V");
auto batMaxEdit = new NumberEdit(window, grid.getFieldSlot(2, 1), g_eeGeneral.vBatMin - 29 + 120, 40 + 120, GET_SET_WITH_OFFSET(g_eeGeneral.vBatMax, 120), 0, PREC1); auto batMaxEdit = new NumberEdit(window, grid.getFieldSlot(2, 1), g_eeGeneral.vBatMin - 29 + 120, 40 + 120, GET_SET_WITH_OFFSET(g_eeGeneral.vBatMax, 120), 0, PREC1);
@@ -190,31 +190,31 @@ void RadioSetupPage::build(FormWindow * window)
}); });
grid.nextLine(); grid.nextLine();
new Subtitle(window, grid.getLabelSlot(), STR_SOUND_LABEL); new Subtitle(window, grid.getLabelSlot(), STR_SOUND_LABEL, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
// Beeps mode // Beeps mode
new StaticText(window, grid.getLabelSlot(true), STR_SPEAKER); new StaticText(window, grid.getLabelSlot(true), STR_SPEAKER, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), STR_VBEEPMODE, -2, 1, GET_SET_DEFAULT(g_eeGeneral.beepMode)); new Choice(window, grid.getFieldSlot(), STR_VBEEPMODE, -2, 1, GET_SET_DEFAULT(g_eeGeneral.beepMode));
grid.nextLine(); grid.nextLine();
// Main volume // Main volume
new StaticText(window, grid.getLabelSlot(true), STR_VOLUME); new StaticText(window, grid.getLabelSlot(true), STR_VOLUME, 0, COLOR_THEME_PRIMARY1);
new Slider(window, grid.getFieldSlot(), -VOLUME_LEVEL_DEF, VOLUME_LEVEL_MAX-VOLUME_LEVEL_DEF, GET_SET_DEFAULT(g_eeGeneral.speakerVolume)); new Slider(window, grid.getFieldSlot(), -VOLUME_LEVEL_DEF, VOLUME_LEVEL_MAX-VOLUME_LEVEL_DEF, GET_SET_DEFAULT(g_eeGeneral.speakerVolume));
grid.nextLine(); grid.nextLine();
// Beeps volume // Beeps volume
new StaticText(window, grid.getLabelSlot(true), STR_BEEP_VOLUME); new StaticText(window, grid.getLabelSlot(true), STR_BEEP_VOLUME, 0, COLOR_THEME_PRIMARY1);
new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.beepVolume)); new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.beepVolume));
grid.nextLine(); grid.nextLine();
// Beeps length // Beeps length
new StaticText(window, grid.getLabelSlot(true), STR_BEEP_LENGTH); new StaticText(window, grid.getLabelSlot(true), STR_BEEP_LENGTH, 0, COLOR_THEME_PRIMARY1);
new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.beepLength)); new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.beepLength));
grid.nextLine(); grid.nextLine();
// Beeps pitch // Beeps pitch
new StaticText(window, grid.getLabelSlot(true), STR_BEEP_PITCH); new StaticText(window, grid.getLabelSlot(true), STR_BEEP_PITCH, 0, COLOR_THEME_PRIMARY1);
auto edit = new NumberEdit(window, grid.getFieldSlot(), 0, 300, auto edit = new NumberEdit(window, grid.getFieldSlot(), 0, 300,
GET_DEFAULT(15 * g_eeGeneral.speakerPitch), GET_DEFAULT(15 * g_eeGeneral.speakerPitch),
[=](int32_t newValue) { [=](int32_t newValue) {
@@ -227,26 +227,26 @@ void RadioSetupPage::build(FormWindow * window)
grid.nextLine(); grid.nextLine();
// Wav volume // Wav volume
new StaticText(window, grid.getLabelSlot(true), STR_WAV_VOLUME); new StaticText(window, grid.getLabelSlot(true), STR_WAV_VOLUME, 0, COLOR_THEME_PRIMARY1);
new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.wavVolume)); new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.wavVolume));
grid.nextLine(); grid.nextLine();
// Background volume // Background volume
new StaticText(window, grid.getLabelSlot(true), STR_BG_VOLUME); new StaticText(window, grid.getLabelSlot(true), STR_BG_VOLUME, 0, COLOR_THEME_PRIMARY1);
new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.backgroundVolume)); new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.backgroundVolume));
grid.nextLine(); grid.nextLine();
#if defined(VARIO) #if defined(VARIO)
{ {
new Subtitle(window, grid.getLabelSlot(), STR_VARIO); new Subtitle(window, grid.getLabelSlot(), STR_VARIO, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
// Vario volume // Vario volume
new StaticText(window, grid.getLabelSlot(true), TR_VOLUME); new StaticText(window, grid.getLabelSlot(true), TR_VOLUME, 0, COLOR_THEME_PRIMARY1);
new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.varioVolume)); new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.varioVolume));
grid.nextLine(); grid.nextLine();
new StaticText(window, grid.getLabelSlot(true), STR_PITCH_AT_ZERO); new StaticText(window, grid.getLabelSlot(true), STR_PITCH_AT_ZERO, 0, COLOR_THEME_PRIMARY1);
edit = new NumberEdit(window, grid.getFieldSlot(), VARIO_FREQUENCY_ZERO - 400, VARIO_FREQUENCY_ZERO + 400, edit = new NumberEdit(window, grid.getFieldSlot(), VARIO_FREQUENCY_ZERO - 400, VARIO_FREQUENCY_ZERO + 400,
GET_DEFAULT(VARIO_FREQUENCY_ZERO + (g_eeGeneral.varioPitch * 10)), GET_DEFAULT(VARIO_FREQUENCY_ZERO + (g_eeGeneral.varioPitch * 10)),
SET_VALUE(g_eeGeneral.varioPitch, (newValue - VARIO_FREQUENCY_ZERO) / 10)); SET_VALUE(g_eeGeneral.varioPitch, (newValue - VARIO_FREQUENCY_ZERO) / 10));
@@ -254,7 +254,7 @@ void RadioSetupPage::build(FormWindow * window)
edit->setSuffix("Hz"); edit->setSuffix("Hz");
grid.nextLine(); grid.nextLine();
new StaticText(window, grid.getLabelSlot(true), STR_PITCH_AT_MAX); new StaticText(window, grid.getLabelSlot(true), STR_PITCH_AT_MAX, 0, COLOR_THEME_PRIMARY1);
edit = new NumberEdit(window, grid.getFieldSlot(), 900, 2500, edit = new NumberEdit(window, grid.getFieldSlot(), 900, 2500,
GET_DEFAULT(VARIO_FREQUENCY_ZERO + (g_eeGeneral.varioPitch * 10) + VARIO_FREQUENCY_RANGE + (g_eeGeneral.varioRange * 10)), GET_DEFAULT(VARIO_FREQUENCY_ZERO + (g_eeGeneral.varioPitch * 10) + VARIO_FREQUENCY_RANGE + (g_eeGeneral.varioRange * 10)),
SET_VALUE(g_eeGeneral.varioRange, (newValue - VARIO_FREQUENCY_ZERO - VARIO_FREQUENCY_RANGE) / 10 - g_eeGeneral.varioPitch )); SET_VALUE(g_eeGeneral.varioRange, (newValue - VARIO_FREQUENCY_ZERO - VARIO_FREQUENCY_RANGE) / 10 - g_eeGeneral.varioPitch ));
@@ -262,7 +262,7 @@ void RadioSetupPage::build(FormWindow * window)
edit->setSuffix("Hz"); edit->setSuffix("Hz");
grid.nextLine(); grid.nextLine();
new StaticText(window, grid.getLabelSlot(true), STR_REPEAT_AT_ZERO); new StaticText(window, grid.getLabelSlot(true), STR_REPEAT_AT_ZERO, 0, COLOR_THEME_PRIMARY1);
edit = new NumberEdit(window, grid.getFieldSlot(), 200, 1000, edit = new NumberEdit(window, grid.getFieldSlot(), 200, 1000,
GET_DEFAULT(VARIO_REPEAT_ZERO + (g_eeGeneral.varioRepeat * 10)), GET_DEFAULT(VARIO_REPEAT_ZERO + (g_eeGeneral.varioRepeat * 10)),
SET_VALUE(g_eeGeneral.varioRepeat, (newValue - VARIO_REPEAT_ZERO) / 10)); SET_VALUE(g_eeGeneral.varioRepeat, (newValue - VARIO_REPEAT_ZERO) / 10));
@@ -274,21 +274,21 @@ void RadioSetupPage::build(FormWindow * window)
#if defined(HAPTIC) #if defined(HAPTIC)
{ {
new Subtitle(window, grid.getLabelSlot(), STR_HAPTIC_LABEL); new Subtitle(window, grid.getLabelSlot(), STR_HAPTIC_LABEL, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
// Haptic mode // Haptic mode
new StaticText(window, grid.getLabelSlot(true), STR_MODE); new StaticText(window, grid.getLabelSlot(true), STR_MODE, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), STR_VBEEPMODE, -2, 1, GET_SET_DEFAULT(g_eeGeneral.hapticMode)); new Choice(window, grid.getFieldSlot(), STR_VBEEPMODE, -2, 1, GET_SET_DEFAULT(g_eeGeneral.hapticMode));
grid.nextLine(); grid.nextLine();
// Haptic duration // Haptic duration
new StaticText(window, grid.getLabelSlot(true), STR_LENGTH); new StaticText(window, grid.getLabelSlot(true), STR_LENGTH, 0, COLOR_THEME_PRIMARY1);
new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.hapticLength)); new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.hapticLength));
grid.nextLine(); grid.nextLine();
// Haptic strength // Haptic strength
new StaticText(window, grid.getLabelSlot(true), STR_STRENGTH); new StaticText(window, grid.getLabelSlot(true), STR_STRENGTH, 0, COLOR_THEME_PRIMARY1);
new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.hapticStrength)); new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.hapticStrength));
grid.nextLine(); grid.nextLine();
} }
@@ -296,39 +296,39 @@ void RadioSetupPage::build(FormWindow * window)
// Alarms // Alarms
{ {
new Subtitle(window, grid.getLabelSlot(), STR_ALARMS_LABEL); new Subtitle(window, grid.getLabelSlot(), STR_ALARMS_LABEL, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
// Battery warning // Battery warning
new StaticText(window, grid.getLabelSlot(true), STR_BATTERYWARNING); new StaticText(window, grid.getLabelSlot(true), STR_BATTERYWARNING, 0, COLOR_THEME_PRIMARY1);
edit = new NumberEdit(window, grid.getFieldSlot(), 30, 120, GET_SET_DEFAULT(g_eeGeneral.vBatWarn), 0, PREC1); edit = new NumberEdit(window, grid.getFieldSlot(), 30, 120, GET_SET_DEFAULT(g_eeGeneral.vBatWarn), 0, PREC1);
edit->setSuffix("V"); edit->setSuffix("V");
grid.nextLine(); grid.nextLine();
// Inactivity alarm // Inactivity alarm
new StaticText(window, grid.getLabelSlot(true), STR_INACTIVITYALARM); new StaticText(window, grid.getLabelSlot(true), STR_INACTIVITYALARM, 0, COLOR_THEME_PRIMARY1);
edit = new NumberEdit(window, grid.getFieldSlot(), 0, 250, GET_SET_DEFAULT(g_eeGeneral.inactivityTimer)); edit = new NumberEdit(window, grid.getFieldSlot(), 0, 250, GET_SET_DEFAULT(g_eeGeneral.inactivityTimer));
edit->setSuffix("minutes"); edit->setSuffix("minutes");
grid.nextLine(); grid.nextLine();
// Alarms warning // Alarms warning
new StaticText(window, grid.getLabelSlot(true), STR_ALARMWARNING); new StaticText(window, grid.getLabelSlot(true), STR_ALARMWARNING, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(), GET_SET_INVERTED(g_eeGeneral.disableAlarmWarning)); new CheckBox(window, grid.getFieldSlot(), GET_SET_INVERTED(g_eeGeneral.disableAlarmWarning));
grid.nextLine(); grid.nextLine();
// RSSI shutdown alarm // RSSI shutdown alarm
new StaticText(window, grid.getLabelSlot(true), STR_RSSI_SHUTDOWN_ALARM); new StaticText(window, grid.getLabelSlot(true), STR_RSSI_SHUTDOWN_ALARM, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(), GET_SET_INVERTED(g_eeGeneral.disableRssiPoweroffAlarm)); new CheckBox(window, grid.getFieldSlot(), GET_SET_INVERTED(g_eeGeneral.disableRssiPoweroffAlarm));
grid.nextLine(); grid.nextLine();
} }
// Backlight // Backlight
{ {
new Subtitle(window, grid.getLabelSlot(), STR_BACKLIGHT_LABEL); new Subtitle(window, grid.getLabelSlot(), STR_BACKLIGHT_LABEL, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
// Backlight mode // Backlight mode
new StaticText(window, grid.getLabelSlot(true), STR_MODE); new StaticText(window, grid.getLabelSlot(true), STR_MODE, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(2,0), STR_VBLMODE, e_backlight_mode_off, e_backlight_mode_on, GET_SET_DEFAULT(g_eeGeneral.backlightMode)); new Choice(window, grid.getFieldSlot(2,0), STR_VBLMODE, e_backlight_mode_off, e_backlight_mode_on, GET_SET_DEFAULT(g_eeGeneral.backlightMode));
//grid.nextLine(); //grid.nextLine();
@@ -341,7 +341,7 @@ void RadioSetupPage::build(FormWindow * window)
grid.nextLine(); grid.nextLine();
// Backlight ON bright // Backlight ON bright
new StaticText(window, grid.getLabelSlot(true), STR_BLONBRIGHTNESS); new StaticText(window, grid.getLabelSlot(true), STR_BLONBRIGHTNESS, 0, COLOR_THEME_PRIMARY1);
new Slider(window, grid.getFieldSlot(), BACKLIGHT_LEVEL_MIN, BACKLIGHT_LEVEL_MAX, new Slider(window, grid.getFieldSlot(), BACKLIGHT_LEVEL_MIN, BACKLIGHT_LEVEL_MAX,
[=]() -> int32_t { [=]() -> int32_t {
return BACKLIGHT_LEVEL_MAX - g_eeGeneral.backlightBright; return BACKLIGHT_LEVEL_MAX - g_eeGeneral.backlightBright;
@@ -352,19 +352,19 @@ void RadioSetupPage::build(FormWindow * window)
grid.nextLine(); grid.nextLine();
// Backlight OFF bright // Backlight OFF bright
new StaticText(window, grid.getLabelSlot(true), STR_BLOFFBRIGHTNESS); new StaticText(window, grid.getLabelSlot(true), STR_BLOFFBRIGHTNESS, 0, COLOR_THEME_PRIMARY1);
new Slider(window, grid.getFieldSlot(), BACKLIGHT_LEVEL_MIN, BACKLIGHT_LEVEL_MAX, GET_SET_DEFAULT(g_eeGeneral.blOffBright)); new Slider(window, grid.getFieldSlot(), BACKLIGHT_LEVEL_MIN, BACKLIGHT_LEVEL_MAX, GET_SET_DEFAULT(g_eeGeneral.blOffBright));
grid.nextLine(); grid.nextLine();
#if defined(KEYS_BACKLIGHT_GPIO) #if defined(KEYS_BACKLIGHT_GPIO)
// Keys backlight // Keys backlight
new StaticText(window, grid.getLabelSlot(true), STR_KEYS_BACKLIGHT); new StaticText(window, grid.getLabelSlot(true), STR_KEYS_BACKLIGHT, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_eeGeneral.keysBacklight)); new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_eeGeneral.keysBacklight));
grid.nextLine(); grid.nextLine();
#endif #endif
// Flash beep // Flash beep
new StaticText(window, grid.getLabelSlot(true), STR_ALARM); new StaticText(window, grid.getLabelSlot(true), STR_ALARM, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_eeGeneral.alarmsFlash)); new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_eeGeneral.alarmsFlash));
grid.nextLine(); grid.nextLine();
} }
@@ -372,7 +372,7 @@ void RadioSetupPage::build(FormWindow * window)
#if defined(PWR_BUTTON_PRESS) #if defined(PWR_BUTTON_PRESS)
// Pwr Off Delay // Pwr Off Delay
{ {
new StaticText(window, grid.getLabelSlot(), STR_PWR_OFF_DELAY); new StaticText(window, grid.getLabelSlot(), STR_PWR_OFF_DELAY, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), STR_PWR_OFF_DELAYS, 0, 3, new Choice(window, grid.getFieldSlot(), STR_PWR_OFF_DELAYS, 0, 3,
[=]() -> int32_t { [=]() -> int32_t {
return 2 - g_eeGeneral.pwrOffSpeed; return 2 - g_eeGeneral.pwrOffSpeed;
@@ -388,21 +388,21 @@ void RadioSetupPage::build(FormWindow * window)
#if defined(INTERNAL_GPS) #if defined(INTERNAL_GPS)
// GPS // GPS
{ {
new Subtitle(window, grid.getLabelSlot(), STR_GPS); new Subtitle(window, grid.getLabelSlot(), STR_GPS, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
// Timezone // Timezone
new StaticText(window, grid.getLabelSlot(true), STR_TIMEZONE); new StaticText(window, grid.getLabelSlot(true), STR_TIMEZONE, 0, COLOR_THEME_PRIMARY1);
new NumberEdit(window, grid.getFieldSlot(), -12, 12, GET_SET_DEFAULT(g_eeGeneral.timezone)); new NumberEdit(window, grid.getFieldSlot(), -12, 12, GET_SET_DEFAULT(g_eeGeneral.timezone));
grid.nextLine(); grid.nextLine();
// Adjust RTC (from telemetry) // Adjust RTC (from telemetry)
new StaticText(window, grid.getLabelSlot(true), STR_ADJUST_RTC); new StaticText(window, grid.getLabelSlot(true), STR_ADJUST_RTC, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_eeGeneral.adjustRTC)); new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_eeGeneral.adjustRTC));
grid.nextLine(); grid.nextLine();
// GPS format // GPS format
new StaticText(window, grid.getLabelSlot(true), STR_GPS_COORDS_FORMAT); new StaticText(window, grid.getLabelSlot(true), STR_GPS_COORDS_FORMAT, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), STR_GPSFORMAT, 0, 1, GET_SET_DEFAULT(g_eeGeneral.gpsFormat)); new Choice(window, grid.getFieldSlot(), STR_GPSFORMAT, 0, 1, GET_SET_DEFAULT(g_eeGeneral.gpsFormat));
grid.nextLine(); grid.nextLine();
} }
@@ -410,18 +410,18 @@ void RadioSetupPage::build(FormWindow * window)
#if defined(PXX2) #if defined(PXX2)
// Owner ID // Owner ID
new StaticText(window, grid.getLabelSlot(), STR_OWNER_ID); new StaticText(window, grid.getLabelSlot(), STR_OWNER_ID, 0, COLOR_THEME_PRIMARY1);
new RadioTextEdit(window, grid.getFieldSlot(), g_eeGeneral.ownerRegistrationID, PXX2_LEN_REGISTRATION_ID); new RadioTextEdit(window, grid.getFieldSlot(), g_eeGeneral.ownerRegistrationID, PXX2_LEN_REGISTRATION_ID);
grid.nextLine(); grid.nextLine();
#endif #endif
// Country code // Country code
new StaticText(window, grid.getLabelSlot(), STR_COUNTRY_CODE); new StaticText(window, grid.getLabelSlot(), STR_COUNTRY_CODE, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), STR_COUNTRY_CODES, 0, 2, GET_SET_DEFAULT(g_eeGeneral.countryCode)); new Choice(window, grid.getFieldSlot(), STR_COUNTRY_CODES, 0, 2, GET_SET_DEFAULT(g_eeGeneral.countryCode));
grid.nextLine(); grid.nextLine();
// Audio language // Audio language
new StaticText(window, grid.getLabelSlot(), STR_VOICE_LANGUAGE); new StaticText(window, grid.getLabelSlot(), STR_VOICE_LANGUAGE, 0, COLOR_THEME_PRIMARY1);
auto choice = new Choice(window, grid.getFieldSlot(), 0, DIM(languagePacks) - 2, GET_VALUE(currentLanguagePackIdx), auto choice = new Choice(window, grid.getFieldSlot(), 0, DIM(languagePacks) - 2, GET_VALUE(currentLanguagePackIdx),
[](uint8_t newValue) { [](uint8_t newValue) {
currentLanguagePackIdx = newValue; currentLanguagePackIdx = newValue;
@@ -434,7 +434,7 @@ void RadioSetupPage::build(FormWindow * window)
grid.nextLine(); grid.nextLine();
// Imperial units // Imperial units
new StaticText(window, grid.getLabelSlot(), STR_UNITS_SYSTEM); new StaticText(window, grid.getLabelSlot(), STR_UNITS_SYSTEM, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), STR_VUNITSSYSTEM, 0, 1, GET_SET_DEFAULT(g_eeGeneral.imperial)); new Choice(window, grid.getFieldSlot(), STR_VUNITSSYSTEM, 0, 1, GET_SET_DEFAULT(g_eeGeneral.imperial));
grid.nextLine(); grid.nextLine();
@@ -455,18 +455,18 @@ void RadioSetupPage::build(FormWindow * window)
#endif #endif
// Switches delay // Switches delay
new StaticText(window, grid.getLabelSlot(), STR_SWITCHES_DELAY); new StaticText(window, grid.getLabelSlot(), STR_SWITCHES_DELAY, 0, COLOR_THEME_PRIMARY1);
edit = new NumberEdit(window, grid.getFieldSlot(2, 0), -15, 100 - 15, GET_SET_VALUE_WITH_OFFSET(g_eeGeneral.switchesDelay, 15)); edit = new NumberEdit(window, grid.getFieldSlot(2, 0), -15, 100 - 15, GET_SET_VALUE_WITH_OFFSET(g_eeGeneral.switchesDelay, 15));
edit->setSuffix(std::string("0") + STR_MS); edit->setSuffix(std::string("0") + STR_MS);
grid.nextLine(); grid.nextLine();
// USB mode // USB mode
new StaticText(window, grid.getLabelSlot(), STR_USBMODE); new StaticText(window, grid.getLabelSlot(), STR_USBMODE, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), STR_USBMODES, USB_UNSELECTED_MODE, USB_MAX_MODE, GET_SET_DEFAULT(g_eeGeneral.USBMode)); new Choice(window, grid.getFieldSlot(), STR_USBMODES, USB_UNSELECTED_MODE, USB_MAX_MODE, GET_SET_DEFAULT(g_eeGeneral.USBMode));
grid.nextLine(); grid.nextLine();
// RX channel order // RX channel order
new StaticText(window, grid.getLabelSlot(), STR_RXCHANNELORD); // RAET->AETR new StaticText(window, grid.getLabelSlot(), STR_RXCHANNELORD, 0, COLOR_THEME_PRIMARY1); // RAET->AETR
choice = new Choice(window, grid.getFieldSlot(), 0, 4*3*2 - 1, GET_SET_DEFAULT(g_eeGeneral.templateSetup)); choice = new Choice(window, grid.getFieldSlot(), 0, 4*3*2 - 1, GET_SET_DEFAULT(g_eeGeneral.templateSetup));
choice->setTextHandler([](uint8_t value) { choice->setTextHandler([](uint8_t value) {
char s[5]; char s[5];
@@ -479,7 +479,7 @@ void RadioSetupPage::build(FormWindow * window)
grid.nextLine(); grid.nextLine();
// Stick mode // Stick mode
new StaticText(window, grid.getLabelSlot(), STR_MODE); new StaticText(window, grid.getLabelSlot(), STR_MODE, 0, COLOR_THEME_PRIMARY1);
choice = new Choice(window, grid.getFieldSlot(), 0, 3, GET_DEFAULT(g_eeGeneral.stickMode), choice = new Choice(window, grid.getFieldSlot(), 0, 3, GET_DEFAULT(g_eeGeneral.stickMode),
[=](uint8_t newValue) { [=](uint8_t newValue) {
pausePulses(); pausePulses();
+6 -6
View File
@@ -113,7 +113,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
label = getBasename(path); label = getBasename(path);
} }
auto txt = new StaticText(window, grid.getLabelSlot(), "lua", auto txt = new StaticText(window, grid.getLabelSlot(), "lua",
BUTTON_BACKGROUND, CENTERED); BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED);
std::string path_str(path); std::string path_str(path);
auto b = new TextButton( auto b = new TextButton(
@@ -137,7 +137,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(COLOR_THEME_SECONDARY2); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
} }
txt->invalidate(); txt->invalidate();
}); });
@@ -181,7 +181,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
.information.modelID, .information.modelID,
MODULE_OPTION_POWER_METER)) { MODULE_OPTION_POWER_METER)) {
auto txt = new StaticText(window, grid.getLabelSlot(), "access", auto txt = new StaticText(window, grid.getLabelSlot(), "access",
BUTTON_BACKGROUND, CENTERED); BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED);
auto b = new TextButton( auto b = new TextButton(
window, grid.getFieldSlot(1), STR_POWER_METER_INT, window, grid.getFieldSlot(1), STR_POWER_METER_INT,
[=]() -> uint8_t { [=]() -> uint8_t {
@@ -196,7 +196,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(COLOR_THEME_SECONDARY2); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
} }
txt->invalidate(); txt->invalidate();
}); });
@@ -206,7 +206,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
#if defined(INTERNAL_MODULE_MULTI) #if defined(INTERNAL_MODULE_MULTI)
{ {
auto txt = new StaticText(window, grid.getLabelSlot(), "multi", auto txt = new StaticText(window, grid.getLabelSlot(), "multi",
BUTTON_BACKGROUND, CENTERED); BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED);
auto b = new TextButton( auto b = new TextButton(
window, grid.getFieldSlot(1), STR_SPECTRUM_ANALYSER_INT, window, grid.getFieldSlot(1), STR_SPECTRUM_ANALYSER_INT,
[=]() -> uint8_t { [=]() -> uint8_t {
@@ -221,7 +221,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(COLOR_THEME_SECONDARY2); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
} }
txt->invalidate(); txt->invalidate();
}); });
+3 -3
View File
@@ -43,7 +43,7 @@ void RadioTrainerPage::build(FormWindow * window)
for (uint8_t i=0; i<NUM_STICKS; i++) { for (uint8_t i=0; i<NUM_STICKS; i++) {
uint8_t chan = channelOrder(i+1); uint8_t chan = channelOrder(i+1);
TrainerMix * td = &g_eeGeneral.trainer.mix[chan-1]; TrainerMix * td = &g_eeGeneral.trainer.mix[chan-1];
new StaticText(window, grid.getLabelSlot(), TEXT_AT_INDEX(STR_VSRCRAW, (i + 1))); new StaticText(window, grid.getLabelSlot(), TEXT_AT_INDEX(STR_VSRCRAW, (i + 1)), 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(3,0), STR_TRNMODE, 0, 2, GET_SET_DEFAULT(td->mode)); new Choice(window, grid.getFieldSlot(3,0), STR_TRNMODE, 0, 2, GET_SET_DEFAULT(td->mode));
auto weight = new NumberEdit(window, grid.getFieldSlot(3, 1), -125, 125, GET_SET_DEFAULT(td->studWeight)); auto weight = new NumberEdit(window, grid.getFieldSlot(3, 1), -125, 125, GET_SET_DEFAULT(td->studWeight));
weight->setSuffix("%"); weight->setSuffix("%");
@@ -53,7 +53,7 @@ void RadioTrainerPage::build(FormWindow * window)
grid.nextLine(); grid.nextLine();
// Trainer multiplier // Trainer multiplier
new StaticText(window, grid.getLabelSlot(), STR_MULTIPLIER); new StaticText(window, grid.getLabelSlot(), STR_MULTIPLIER, 0, COLOR_THEME_PRIMARY1);
auto multiplier = new NumberEdit(window, grid.getFieldSlot(3, 0), -10, 40, GET_SET_DEFAULT(g_eeGeneral.PPM_Multiplier)); auto multiplier = new NumberEdit(window, grid.getFieldSlot(3, 0), -10, 40, GET_SET_DEFAULT(g_eeGeneral.PPM_Multiplier));
multiplier->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) { multiplier->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value+10, flags | PREC1, 0); dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value+10, flags | PREC1, 0);
@@ -62,7 +62,7 @@ void RadioTrainerPage::build(FormWindow * window)
grid.nextLine(); grid.nextLine();
// Trainer calibration // Trainer calibration
new StaticText(window, grid.getLabelSlot(), STR_CAL); new StaticText(window, grid.getLabelSlot(), STR_CAL, 0, COLOR_THEME_PRIMARY1);
for (int i = 0; i < NUM_STICKS; i++) { for (int i = 0; i < NUM_STICKS; i++) {
#if defined (PPM_UNIT_PERCENT_PREC1) #if defined (PPM_UNIT_PERCENT_PREC1)
auto calib = new NumberEdit(window, grid.getFieldSlot(4, i), 0 , 0, [=]() { return (ppmInput[i]-g_eeGeneral.trainer.calib[i]) * 2; }, nullptr, 0, LEFT | PREC1); auto calib = new NumberEdit(window, grid.getFieldSlot(4, i), 0 , 0, [=]() { return (ppmInput[i]-g_eeGeneral.trainer.calib[i]) * 2; }, nullptr, 0, LEFT | PREC1);
+27 -27
View File
@@ -91,36 +91,36 @@ class versionDialog: public Dialog
// Module // Module
if (module == INTERNAL_MODULE) if (module == INTERNAL_MODULE)
new StaticText(form, grid->getLineSlot(), STR_INTERNAL_MODULE); new StaticText(form, grid->getLineSlot(), STR_INTERNAL_MODULE, 0, COLOR_THEME_PRIMARY1);
else else
new StaticText(form, grid->getLineSlot(), STR_EXTERNAL_MODULE); new StaticText(form, grid->getLineSlot(), STR_EXTERNAL_MODULE, 0, COLOR_THEME_PRIMARY1);
grid->nextLine(); grid->nextLine();
new StaticText(form, grid->getLabelSlot(true), STR_MODULE); new StaticText(form, grid->getLabelSlot(true), STR_MODULE, 0, COLOR_THEME_PRIMARY1);
if (g_model.moduleData[module].type == MODULE_TYPE_NONE) { if (g_model.moduleData[module].type == MODULE_TYPE_NONE) {
new StaticText(form, grid->getFieldSlot(1, 0), STR_OFF); new StaticText(form, grid->getFieldSlot(1, 0), STR_OFF, 0, COLOR_THEME_PRIMARY1);
} }
#if defined(HARDWARE_EXTERNAL_ACCESS_MOD) #if defined(HARDWARE_EXTERNAL_ACCESS_MOD)
else if (isModuleMultimodule(module)) { else if (isModuleMultimodule(module)) {
char statusText[64]; char statusText[64];
new StaticText(form, grid->getFieldSlot(2, 0), "Multimodule"); new StaticText(form, grid->getFieldSlot(2, 0), "Multimodule", 0, COLOR_THEME_PRIMARY1);
getMultiModuleStatus(module).getStatusString(statusText); getMultiModuleStatus(module).getStatusString(statusText);
new StaticText(form, grid->getFieldSlot(2, 1), statusText); new StaticText(form, grid->getFieldSlot(2, 1), statusText, 0, COLOR_THEME_PRIMARY1);
} }
#endif #endif
else if (!isModulePXX2(module)) { else if (!isModulePXX2(module)) {
new StaticText(form, grid->getFieldSlot(1, 0), STR_NO_INFORMATION); new StaticText(form, grid->getFieldSlot(1, 0), STR_NO_INFORMATION, 0, COLOR_THEME_PRIMARY1);
} }
else { else {
// PXX2 Module // PXX2 Module
new StaticText(form, grid->getFieldSlot(4, 0), getPXX2ModuleName(reusableBuffer.hardwareAndSettings.modules[module].information.modelID)); new StaticText(form, grid->getFieldSlot(4, 0), getPXX2ModuleName(reusableBuffer.hardwareAndSettings.modules[module].information.modelID), 0, COLOR_THEME_PRIMARY1);
if (reusableBuffer.hardwareAndSettings.modules[module].information.modelID) { if (reusableBuffer.hardwareAndSettings.modules[module].information.modelID) {
new StaticText(form, grid->getFieldSlot(4, 1), getVersion(tmp, reusableBuffer.hardwareAndSettings.modules[module].information.hwVersion)); new StaticText(form, grid->getFieldSlot(4, 1), getVersion(tmp, reusableBuffer.hardwareAndSettings.modules[module].information.hwVersion), 0, COLOR_THEME_PRIMARY1);
new StaticText(form, grid->getFieldSlot(4, 2), getVersion(tmp, reusableBuffer.hardwareAndSettings.modules[module].information.swVersion)); new StaticText(form, grid->getFieldSlot(4, 2), getVersion(tmp, reusableBuffer.hardwareAndSettings.modules[module].information.swVersion), 0, COLOR_THEME_PRIMARY1);
static const char * variants[] = {"FCC", "EU", "FLEX"}; static const char * variants[] = {"FCC", "EU", "FLEX"};
uint8_t variant = reusableBuffer.hardwareAndSettings.modules[module].information.variant - 1; uint8_t variant = reusableBuffer.hardwareAndSettings.modules[module].information.variant - 1;
if (variant < DIM(variants)) { if (variant < DIM(variants)) {
new StaticText(form, grid->getFieldSlot(4, 3), variants[variant]); new StaticText(form, grid->getFieldSlot(4, 3), variants[variant], 0, COLOR_THEME_PRIMARY1);
} }
} }
grid->nextLine(); grid->nextLine();
@@ -129,13 +129,13 @@ class versionDialog: public Dialog
for (uint8_t receiver=0; receiver<PXX2_MAX_RECEIVERS_PER_MODULE; receiver++) { for (uint8_t receiver=0; receiver<PXX2_MAX_RECEIVERS_PER_MODULE; receiver++) {
if (reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.modelID) { if (reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.modelID) {
// Receiver model // Receiver model
new StaticText(form, grid->getLabelSlot(true), STR_RECEIVER); new StaticText(form, grid->getLabelSlot(true), STR_RECEIVER, 0, COLOR_THEME_PRIMARY1);
uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.modelID; uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.modelID;
new StaticText(form, grid->getFieldSlot(4, 0), getPXX2ReceiverName(modelId)); new StaticText(form, grid->getFieldSlot(4, 0), getPXX2ReceiverName(modelId), 0, COLOR_THEME_PRIMARY1);
// Receiver version // Receiver version
new StaticText(form, grid->getFieldSlot(4, 1), getVersion(tmp, reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.hwVersion)); new StaticText(form, grid->getFieldSlot(4, 1), getVersion(tmp, reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.hwVersion), 0, COLOR_THEME_PRIMARY1);
new StaticText(form, grid->getFieldSlot(4, 2), getVersion(tmp, reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.swVersion)); new StaticText(form, grid->getFieldSlot(4, 2), getVersion(tmp, reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.swVersion), 0, COLOR_THEME_PRIMARY1);
grid->nextLine(); grid->nextLine();
} }
} }
@@ -168,7 +168,7 @@ class versionDialog: public Dialog
class OptionsText: public StaticText { class OptionsText: public StaticText {
public: public:
OptionsText(Window * parent, const rect_t &rect) : OptionsText(Window * parent, const rect_t &rect) :
StaticText(parent, rect) StaticText(parent, rect, "", 0, COLOR_THEME_PRIMARY1)
{ {
coord_t optionWidth = 0; coord_t optionWidth = 0;
for (uint8_t i = 0; options[i]; i++) { for (uint8_t i = 0; options[i]; i++) {
@@ -189,13 +189,13 @@ class OptionsText: public StaticText {
const char * option = options[i]; const char * option = options[i];
coord_t optionWidth = getTextWidth(option); coord_t optionWidth = getTextWidth(option);
if (x + 5 + optionWidth > width()) { if (x + 5 + optionWidth > width()) {
dc->drawText(x, y, ","); dc->drawText(x, y, ",", COLOR_THEME_PRIMARY1);
x = 0; x = 0;
y += FH; y += FH;
} }
if (i > 0 && x != 0) if (i > 0 && x != 0)
x = dc->drawText(x, y, ", "); x = dc->drawText(x, y, ", ", COLOR_THEME_PRIMARY1);
x = dc->drawText(x, y, option); x = dc->drawText(x, y, option, COLOR_THEME_PRIMARY1);
} }
} }
}; };
@@ -212,34 +212,34 @@ void RadioVersionPage::build(FormWindow * window)
grid.spacer(PAGE_PADDING); grid.spacer(PAGE_PADDING);
// Radio type // Radio type
new StaticText(window, grid.getLineSlot(), fw_stamp); new StaticText(window, grid.getLineSlot(), fw_stamp, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
#if LCD_W > LCD_H #if LCD_W > LCD_H
new StaticText(window, grid.getLineSlot(), vers_stamp); new StaticText(window, grid.getLineSlot(), vers_stamp, 0, COLOR_THEME_PRIMARY1);
#else #else
memcpy(reusableBuffer.version.id, vers_stamp, strcspn(vers_stamp, " ")); memcpy(reusableBuffer.version.id, vers_stamp, strcspn(vers_stamp, " "));
new StaticText(window, grid.getFieldSlot(), reusableBuffer.version.id); new StaticText(window, grid.getFieldSlot(), reusableBuffer.version.id, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
strAppend(reusableBuffer.version.id, strpbrk(vers_stamp, " ")); strAppend(reusableBuffer.version.id, strpbrk(vers_stamp, " "));
new StaticText(window, grid.getFieldSlot(), reusableBuffer.version.id); new StaticText(window, grid.getFieldSlot(), reusableBuffer.version.id, 0, COLOR_THEME_PRIMARY1);
#endif #endif
grid.nextLine(); grid.nextLine();
// Firmware date // Firmware date
new StaticText(window, grid.getLineSlot(), date_stamp); new StaticText(window, grid.getLineSlot(), date_stamp, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
// Firmware time // Firmware time
new StaticText(window, grid.getLineSlot(), time_stamp); new StaticText(window, grid.getLineSlot(), time_stamp, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
// EEprom version // EEprom version
new StaticText(window, grid.getLineSlot(), eeprom_stamp); new StaticText(window, grid.getLineSlot(), eeprom_stamp, 0, COLOR_THEME_PRIMARY1);
grid.nextLine(); grid.nextLine();
// Firmware options // Firmware options
new StaticText(window, grid.getLabelSlot(), "OPTS:"); new StaticText(window, grid.getLabelSlot(), "OPTS:", 0, COLOR_THEME_PRIMARY1);
auto options = new OptionsText(window, grid.getFieldSlot(1,0)); auto options = new OptionsText(window, grid.getFieldSlot(1,0));
grid.nextLine(options->height() + 4); grid.nextLine(options->height() + 4);
+2 -5
View File
@@ -65,14 +65,11 @@ void SourceChoice::paint(BitmapBuffer * dc)
textColor = COLOR_THEME_PRIMARY2; textColor = COLOR_THEME_PRIMARY2;
else if (hasFocus()) else if (hasFocus())
textColor = COLOR_THEME_PRIMARY2; textColor = COLOR_THEME_PRIMARY2;
// else if (value == 0)
// textColor = COLOR_THEME_DISABLED;
else else
textColor = 0; textColor = COLOR_THEME_PRIMARY1;
drawSource(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, textColor); drawSource(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, textColor);
dc->drawBitmapPattern(rect.w - 20, (rect.h - 11) / 2, LBM_DROPDOWN, dc->drawBitmapPattern(rect.w - 20, (rect.h - 11) / 2, LBM_DROPDOWN, textColor);
textColor);
} }
// defined in gui/gui_common.cpp // defined in gui/gui_common.cpp
+3 -2
View File
@@ -31,8 +31,9 @@ class SourceChoice : public FormField {
template <class T> friend class MenuToolbar; template <class T> friend class MenuToolbar;
public: public:
SourceChoice(Window * parent, const rect_t & rect, int16_t vmin, int16_t vmax, std::function<int16_t()> getValue, std::function<void(int16_t)> setValue): SourceChoice(Window * parent, const rect_t & rect, int16_t vmin, int16_t vmax, std::function<int16_t()> getValue,
FormField(parent, rect), std::function<void(int16_t)> setValue, WindowFlags windowFlags = 0, LcdFlags textFlags = 0):
FormField(parent, rect, windowFlags, textFlags),
vmin(vmin), vmin(vmin),
vmax(vmax), vmax(vmax),
getValue(std::move(getValue)), getValue(std::move(getValue)),
+50 -71
View File
@@ -91,22 +91,20 @@ class SpecialFunctionEditPage : public Page
// Func param // Func param
switch (func) { switch (func) {
case FUNC_OVERRIDE_CHANNEL: case FUNC_OVERRIDE_CHANNEL:
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_CH); new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_CH, 0, COLOR_THEME_PRIMARY1);
new NumberEdit(specialFunctionOneWindow, grid.getFieldSlot(), 1, new NumberEdit(specialFunctionOneWindow, grid.getFieldSlot(), 1,
MAX_OUTPUT_CHANNELS, MAX_OUTPUT_CHANNELS,
GET_SET_VALUE_WITH_OFFSET(CFN_CH_INDEX(cfn), 1)); GET_SET_VALUE_WITH_OFFSET(CFN_CH_INDEX(cfn), 1));
grid.nextLine(); grid.nextLine();
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VALUE, 0, COLOR_THEME_PRIMARY1);
STR_VALUE);
new NumberEdit(specialFunctionOneWindow, grid.getFieldSlot(), -100, 100, new NumberEdit(specialFunctionOneWindow, grid.getFieldSlot(), -100, 100,
GET_SET_DEFAULT(CFN_PARAM(cfn))); GET_SET_DEFAULT(CFN_PARAM(cfn)));
grid.nextLine(); grid.nextLine();
break; break;
case FUNC_TRAINER: { case FUNC_TRAINER: {
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VALUE, 0, COLOR_THEME_PRIMARY1);
STR_VALUE);
auto choice = auto choice =
new Choice(specialFunctionOneWindow, grid.getFieldSlot(), 0, new Choice(specialFunctionOneWindow, grid.getFieldSlot(), 0,
NUM_STICKS + 1, GET_SET_DEFAULT(CFN_CH_INDEX(cfn))); NUM_STICKS + 1, GET_SET_DEFAULT(CFN_CH_INDEX(cfn)));
@@ -125,8 +123,7 @@ class SpecialFunctionEditPage : public Page
case FUNC_RESET: case FUNC_RESET:
if (CFN_PARAM(cfn) < FUNC_RESET_PARAM_FIRST_TELEM) { if (CFN_PARAM(cfn) < FUNC_RESET_PARAM_FIRST_TELEM) {
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_RESET, 0, COLOR_THEME_PRIMARY1);
STR_RESET);
auto choice = new Choice( auto choice = new Choice(
specialFunctionOneWindow, grid.getFieldSlot(), 0, specialFunctionOneWindow, grid.getFieldSlot(), 0,
FUNC_RESET_PARAM_FIRST_TELEM + lastUsedTelemetryIndex(), FUNC_RESET_PARAM_FIRST_TELEM + lastUsedTelemetryIndex(),
@@ -146,24 +143,21 @@ class SpecialFunctionEditPage : public Page
break; break;
case FUNC_VOLUME: case FUNC_VOLUME:
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VOLUME, 0, COLOR_THEME_PRIMARY1);
STR_VOLUME);
new SourceChoice(specialFunctionOneWindow, grid.getFieldSlot(), 0, new SourceChoice(specialFunctionOneWindow, grid.getFieldSlot(), 0,
MIXSRC_LAST_CH, GET_SET_DEFAULT(CFN_PARAM(cfn))); MIXSRC_LAST_CH, GET_SET_DEFAULT(CFN_PARAM(cfn)));
grid.nextLine(); grid.nextLine();
break; break;
case FUNC_BACKLIGHT: case FUNC_BACKLIGHT:
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VALUE, 0, COLOR_THEME_PRIMARY1);
STR_VALUE);
new SourceChoice(specialFunctionOneWindow, grid.getFieldSlot(), 0, new SourceChoice(specialFunctionOneWindow, grid.getFieldSlot(), 0,
MIXSRC_LAST_CH, GET_SET_DEFAULT(CFN_PARAM(cfn))); MIXSRC_LAST_CH, GET_SET_DEFAULT(CFN_PARAM(cfn)));
grid.nextLine(); grid.nextLine();
break; break;
case FUNC_PLAY_SOUND: case FUNC_PLAY_SOUND:
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VALUE, 0, COLOR_THEME_PRIMARY1);
STR_VALUE);
new Choice(specialFunctionOneWindow, grid.getFieldSlot(), new Choice(specialFunctionOneWindow, grid.getFieldSlot(),
STR_FUNCSOUNDS, 0, STR_FUNCSOUNDS, 0,
AU_SPECIAL_SOUND_LAST - AU_SPECIAL_SOUND_FIRST - 1, AU_SPECIAL_SOUND_LAST - AU_SPECIAL_SOUND_FIRST - 1,
@@ -174,8 +168,7 @@ class SpecialFunctionEditPage : public Page
case FUNC_PLAY_TRACK: case FUNC_PLAY_TRACK:
case FUNC_BACKGND_MUSIC: case FUNC_BACKGND_MUSIC:
case FUNC_PLAY_SCRIPT: case FUNC_PLAY_SCRIPT:
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VALUE, 0, COLOR_THEME_PRIMARY1);
STR_VALUE);
new FileChoice( new FileChoice(
specialFunctionOneWindow, grid.getFieldSlot(), specialFunctionOneWindow, grid.getFieldSlot(),
func == FUNC_PLAY_SCRIPT func == FUNC_PLAY_SCRIPT
@@ -194,8 +187,7 @@ class SpecialFunctionEditPage : public Page
break; break;
case FUNC_SET_TIMER: { case FUNC_SET_TIMER: {
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_TIMER, 0, COLOR_THEME_PRIMARY1);
STR_TIMER);
auto timerchoice = auto timerchoice =
new Choice(specialFunctionOneWindow, grid.getFieldSlot(), 0, new Choice(specialFunctionOneWindow, grid.getFieldSlot(), 0,
TIMERS - 1, GET_SET_DEFAULT(CFN_TIMER_INDEX(cfn))); TIMERS - 1, GET_SET_DEFAULT(CFN_TIMER_INDEX(cfn)));
@@ -204,8 +196,7 @@ class SpecialFunctionEditPage : public Page
}); });
grid.nextLine(); grid.nextLine();
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VALUE, 0, COLOR_THEME_PRIMARY1);
STR_VALUE);
new TimeEdit(specialFunctionOneWindow, grid.getFieldSlot(), 0, new TimeEdit(specialFunctionOneWindow, grid.getFieldSlot(), 0,
9 * 60 * 60 - 1, GET_SET_DEFAULT(CFN_PARAM(cfn))); 9 * 60 * 60 - 1, GET_SET_DEFAULT(CFN_PARAM(cfn)));
grid.nextLine(); grid.nextLine();
@@ -213,8 +204,7 @@ class SpecialFunctionEditPage : public Page
} }
case FUNC_SET_FAILSAFE: case FUNC_SET_FAILSAFE:
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_MODULE, 0, COLOR_THEME_PRIMARY1);
STR_MODULE);
new Choice(specialFunctionOneWindow, grid.getFieldSlot(), new Choice(specialFunctionOneWindow, grid.getFieldSlot(),
"\004Int.Ext.", 0, NUM_MODULES - 1, "\004Int.Ext.", 0, NUM_MODULES - 1,
GET_SET_DEFAULT(CFN_PARAM(cfn))); GET_SET_DEFAULT(CFN_PARAM(cfn)));
@@ -222,24 +212,21 @@ class SpecialFunctionEditPage : public Page
break; break;
case FUNC_PLAY_VALUE: case FUNC_PLAY_VALUE:
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VALUE, 0, COLOR_THEME_PRIMARY1);
STR_VALUE);
new SourceChoice(specialFunctionOneWindow, grid.getFieldSlot(), 0, new SourceChoice(specialFunctionOneWindow, grid.getFieldSlot(), 0,
MIXSRC_LAST_TELEM, GET_SET_DEFAULT(CFN_PARAM(cfn))); MIXSRC_LAST_TELEM, GET_SET_DEFAULT(CFN_PARAM(cfn)));
grid.nextLine(); grid.nextLine();
break; break;
case FUNC_HAPTIC: case FUNC_HAPTIC:
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VALUE, 0, COLOR_THEME_PRIMARY1);
STR_VALUE);
new NumberEdit(specialFunctionOneWindow, grid.getFieldSlot(), 0, 3, new NumberEdit(specialFunctionOneWindow, grid.getFieldSlot(), 0, 3,
GET_SET_DEFAULT(CFN_PARAM(cfn))); GET_SET_DEFAULT(CFN_PARAM(cfn)));
grid.nextLine(); grid.nextLine();
break; break;
case FUNC_LOGS: { case FUNC_LOGS: {
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VALUE, 0, COLOR_THEME_PRIMARY1);
STR_VALUE);
auto edit = auto edit =
new NumberEdit(specialFunctionOneWindow, grid.getFieldSlot(), 0, new NumberEdit(specialFunctionOneWindow, grid.getFieldSlot(), 0,
255, GET_SET_DEFAULT(CFN_PARAM(cfn))); 255, GET_SET_DEFAULT(CFN_PARAM(cfn)));
@@ -253,8 +240,7 @@ class SpecialFunctionEditPage : public Page
case FUNC_ADJUST_GVAR: { case FUNC_ADJUST_GVAR: {
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_GLOBALVAR, 0, COLOR_THEME_PRIMARY1);
STR_GLOBALVAR);
auto gvarchoice = auto gvarchoice =
new Choice(specialFunctionOneWindow, grid.getFieldSlot(), 0, new Choice(specialFunctionOneWindow, grid.getFieldSlot(), 0,
MAX_GVARS - 1, GET_SET_DEFAULT(CFN_GVAR_INDEX(cfn))); MAX_GVARS - 1, GET_SET_DEFAULT(CFN_GVAR_INDEX(cfn)));
@@ -263,8 +249,7 @@ class SpecialFunctionEditPage : public Page
}); });
grid.nextLine(); grid.nextLine();
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_MODE, 0, COLOR_THEME_PRIMARY1);
STR_MODE);
auto modechoice = auto modechoice =
new Choice(specialFunctionOneWindow, grid.getFieldSlot(), new Choice(specialFunctionOneWindow, grid.getFieldSlot(),
FUNC_ADJUST_GVAR_CONSTANT, FUNC_ADJUST_GVAR_INCDEC, FUNC_ADJUST_GVAR_CONSTANT, FUNC_ADJUST_GVAR_INCDEC,
@@ -294,7 +279,7 @@ class SpecialFunctionEditPage : public Page
switch (CFN_GVAR_MODE(cfn)) { switch (CFN_GVAR_MODE(cfn)) {
case FUNC_ADJUST_GVAR_CONSTANT: { case FUNC_ADJUST_GVAR_CONSTANT: {
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_CONSTANT); new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_CONSTANT, 0, COLOR_THEME_PRIMARY1);
int16_t val_min, val_max; int16_t val_min, val_max;
getMixSrcRange(CFN_GVAR_INDEX(cfn) + MIXSRC_FIRST_GVAR, val_min, getMixSrcRange(CFN_GVAR_INDEX(cfn) + MIXSRC_FIRST_GVAR, val_min,
val_max); val_max);
@@ -303,12 +288,12 @@ class SpecialFunctionEditPage : public Page
break; break;
} }
case FUNC_ADJUST_GVAR_SOURCE: case FUNC_ADJUST_GVAR_SOURCE:
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_MIXSOURCE); new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_MIXSOURCE, 0, COLOR_THEME_PRIMARY1);
new SourceChoice(specialFunctionOneWindow, grid.getFieldSlot(), new SourceChoice(specialFunctionOneWindow, grid.getFieldSlot(),
0, MIXSRC_LAST_CH, GET_SET_DEFAULT(CFN_PARAM(cfn))); 0, MIXSRC_LAST_CH, GET_SET_DEFAULT(CFN_PARAM(cfn)));
break; break;
case FUNC_ADJUST_GVAR_GVAR: { case FUNC_ADJUST_GVAR_GVAR: {
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_GLOBALVAR); new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_GLOBALVAR, 0, COLOR_THEME_PRIMARY1);
auto gvarchoice = auto gvarchoice =
new Choice(specialFunctionOneWindow, grid.getFieldSlot(), 0, new Choice(specialFunctionOneWindow, grid.getFieldSlot(), 0,
MAX_GVARS - 1, GET_SET_DEFAULT(CFN_PARAM(cfn))); MAX_GVARS - 1, GET_SET_DEFAULT(CFN_PARAM(cfn)));
@@ -321,7 +306,7 @@ class SpecialFunctionEditPage : public Page
break; break;
} }
case FUNC_ADJUST_GVAR_INCDEC: { case FUNC_ADJUST_GVAR_INCDEC: {
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_INCDEC); new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_INCDEC, 0, COLOR_THEME_PRIMARY1);
int16_t val_min, val_max; int16_t val_min, val_max;
getMixSrcRange(CFN_GVAR_INDEX(cfn) + MIXSRC_FIRST_GVAR, val_min, val_max); getMixSrcRange(CFN_GVAR_INDEX(cfn) + MIXSRC_FIRST_GVAR, val_min, val_max);
getGVarIncDecRange(val_min, val_max); getGVarIncDecRange(val_min, val_max);
@@ -341,12 +326,12 @@ class SpecialFunctionEditPage : public Page
} }
if (HAS_ENABLE_PARAM(func)) { if (HAS_ENABLE_PARAM(func)) {
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_ENABLE); new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_ENABLE, 0, COLOR_THEME_PRIMARY1);
new CheckBox(specialFunctionOneWindow, grid.getFieldSlot(), new CheckBox(specialFunctionOneWindow, grid.getFieldSlot(),
GET_SET_DEFAULT(CFN_ACTIVE(cfn))); GET_SET_DEFAULT(CFN_ACTIVE(cfn)));
grid.nextLine(); grid.nextLine();
} else if (HAS_REPEAT_PARAM(func)) { // !1x 1x 1s 2s 3s ... } else if (HAS_REPEAT_PARAM(func)) { // !1x 1x 1s 2s 3s ...
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_REPEAT); new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_REPEAT, 0, COLOR_THEME_PRIMARY1);
auto repeat = new NumberEdit( auto repeat = new NumberEdit(
specialFunctionOneWindow, grid.getFieldSlot(2, 1), -1, specialFunctionOneWindow, grid.getFieldSlot(2, 1), -1,
60 / CFN_PLAY_REPEAT_MUL, GET_SET_DEFAULT(CFN_PLAY_REPEAT(cfn))); 60 / CFN_PLAY_REPEAT_MUL, GET_SET_DEFAULT(CFN_PLAY_REPEAT(cfn)));
@@ -375,7 +360,7 @@ class SpecialFunctionEditPage : public Page
CustomFunctionData *cfn = &functions[index]; CustomFunctionData *cfn = &functions[index];
// Switch // Switch
new StaticText(window, grid.getLabelSlot(), STR_SWITCH); new StaticText(window, grid.getLabelSlot(), STR_SWITCH, 0, COLOR_THEME_PRIMARY1);
auto switchChoice = auto switchChoice =
new SwitchChoice(window, grid.getFieldSlot(), SWSRC_FIRST, SWSRC_LAST, new SwitchChoice(window, grid.getFieldSlot(), SWSRC_FIRST, SWSRC_LAST,
GET_SET_DEFAULT(CFN_SWITCH(cfn))); GET_SET_DEFAULT(CFN_SWITCH(cfn)));
@@ -399,7 +384,7 @@ class SpecialFunctionEditPage : public Page
} }
// Function // Function
new StaticText(window, grid.getLabelSlot(), STR_FUNC); new StaticText(window, grid.getLabelSlot(), STR_FUNC, 0, COLOR_THEME_PRIMARY1);
auto functionChoice = auto functionChoice =
new Choice(window, grid.getFieldSlot(), STR_VFSWFUNC, new Choice(window, grid.getFieldSlot(), STR_VFSWFUNC,
0, FUNC_MAX - 1, 0, FUNC_MAX - 1,
@@ -477,18 +462,18 @@ class SpecialFunctionButton : public Button
} }
uint8_t func = CFN_FUNC(cfn); uint8_t func = CFN_FUNC(cfn);
drawSwitch(dc, col1, line1, CFN_SWITCH(cfn), 0); drawSwitch(dc, col1, line1, CFN_SWITCH(cfn), COLOR_THEME_PRIMARY1);
if (cfn->isEmpty()) return; if (cfn->isEmpty()) return;
dc->drawTextAtIndex(col2, line1, STR_VFSWFUNC, func, 0); dc->drawTextAtIndex(col2, line1, STR_VFSWFUNC, func, COLOR_THEME_PRIMARY1);
int16_t val_min = 0; int16_t val_min = 0;
int16_t val_max = 255; int16_t val_max = 255;
switch (func) { switch (func) {
case FUNC_OVERRIDE_CHANNEL: case FUNC_OVERRIDE_CHANNEL:
drawChn(dc, col1, line2, CFN_CH_INDEX(cfn) + 1, 0); drawChn(dc, col1, line2, CFN_CH_INDEX(cfn) + 1, COLOR_THEME_PRIMARY1);
getMixSrcRange(MIXSRC_FIRST_CH, val_min, val_max); getMixSrcRange(MIXSRC_FIRST_CH, val_min, val_max);
dc->drawNumber(col2, line2, CFN_PARAM(cfn)); dc->drawNumber(col2, line2, CFN_PARAM(cfn), COLOR_THEME_PRIMARY1);
break; break;
case FUNC_TRAINER: { case FUNC_TRAINER: {
@@ -500,80 +485,77 @@ class SpecialFunctionButton : public Button
text = std::string(STR_CHANS); text = std::string(STR_CHANS);
else else
text = TEXT_AT_INDEX(STR_VSRCRAW, value); text = TEXT_AT_INDEX(STR_VSRCRAW, value);
dc->drawText(col1, line2, text.c_str(), 0); dc->drawText(col1, line2, text.c_str(), COLOR_THEME_PRIMARY1);
break; break;
} }
case FUNC_RESET: case FUNC_RESET:
if (CFN_PARAM(cfn) < FUNC_RESET_PARAM_FIRST_TELEM) { if (CFN_PARAM(cfn) < FUNC_RESET_PARAM_FIRST_TELEM) {
dc->drawTextAtIndex(col1, line2, STR_VFSWRESET, CFN_PARAM(cfn)); dc->drawTextAtIndex(col1, line2, STR_VFSWRESET, CFN_PARAM(cfn), COLOR_THEME_PRIMARY1);
} else { } else {
TelemetrySensor *sensor = TelemetrySensor *sensor =
&g_model.telemetrySensors[CFN_PARAM(cfn) - &g_model.telemetrySensors[CFN_PARAM(cfn) -
FUNC_RESET_PARAM_FIRST_TELEM]; FUNC_RESET_PARAM_FIRST_TELEM];
dc->drawSizedText(col1, line2, sensor->label, TELEM_LABEL_LEN); dc->drawSizedText(col1, line2, sensor->label, TELEM_LABEL_LEN, COLOR_THEME_PRIMARY1);
} }
break; break;
case FUNC_VOLUME: case FUNC_VOLUME:
drawSource(dc, col1, line2, CFN_PARAM(cfn), 0); drawSource(dc, col1, line2, CFN_PARAM(cfn), COLOR_THEME_PRIMARY1);
break; break;
case FUNC_BACKLIGHT: case FUNC_BACKLIGHT:
drawSource(dc, col1, line2, CFN_PARAM(cfn), 0); drawSource(dc, col1, line2, CFN_PARAM(cfn), COLOR_THEME_PRIMARY1);
break; break;
case FUNC_PLAY_SOUND: case FUNC_PLAY_SOUND:
dc->drawTextAtIndex(col1, line2, STR_FUNCSOUNDS, CFN_PARAM(cfn)); dc->drawTextAtIndex(col1, line2, STR_FUNCSOUNDS, CFN_PARAM(cfn), COLOR_THEME_PRIMARY1);
break; break;
case FUNC_PLAY_TRACK: case FUNC_PLAY_TRACK:
case FUNC_BACKGND_MUSIC: case FUNC_BACKGND_MUSIC:
case FUNC_PLAY_SCRIPT: case FUNC_PLAY_SCRIPT:
if (ZEXIST(cfn->play.name)) if (ZEXIST(cfn->play.name))
dc->drawSizedText(col1, line2, cfn->play.name, sizeof(cfn->play.name), dc->drawSizedText(col1, line2, cfn->play.name, sizeof(cfn->play.name), COLOR_THEME_PRIMARY1);
0);
else else
dc->drawTextAtIndex(col1, line2, STR_VCSWFUNC, 0, 0); dc->drawTextAtIndex(col1, line2, STR_VCSWFUNC, 0, COLOR_THEME_PRIMARY1);
break; break;
case FUNC_SET_TIMER: case FUNC_SET_TIMER:
drawStringWithIndex(dc, col1, line2, STR_TIMER, drawStringWithIndex(dc, col1, line2, STR_TIMER, CFN_TIMER_INDEX(cfn) + 1, COLOR_THEME_PRIMARY1);
CFN_TIMER_INDEX(cfn) + 1, 0);
break; break;
case FUNC_SET_FAILSAFE: case FUNC_SET_FAILSAFE:
dc->drawTextAtIndex(col1, line2, "\004Int.Ext.", CFN_PARAM(cfn), 0); dc->drawTextAtIndex(col1, line2, "\004Int.Ext.", CFN_PARAM(cfn), COLOR_THEME_PRIMARY1);
break; break;
case FUNC_PLAY_VALUE: case FUNC_PLAY_VALUE:
drawSource(dc, col1, line2, CFN_PARAM(cfn), 0); drawSource(dc, col1, line2, CFN_PARAM(cfn), COLOR_THEME_PRIMARY1);
break; break;
case FUNC_HAPTIC: case FUNC_HAPTIC:
dc->drawNumber(col1, line2, CFN_PARAM(cfn), 0); dc->drawNumber(col1, line2, CFN_PARAM(cfn), COLOR_THEME_PRIMARY1);
break; break;
case FUNC_LOGS: case FUNC_LOGS:
dc->drawNumber(col3, line1, CFN_PARAM(cfn), PREC1, dc->drawNumber(col3, line1, CFN_PARAM(cfn), COLOR_THEME_PRIMARY1 | PREC1, sizeof(CFN_PARAM(cfn)), nullptr, "s");
sizeof(CFN_PARAM(cfn)), nullptr, "s");
break; break;
case FUNC_ADJUST_GVAR: case FUNC_ADJUST_GVAR:
switch(CFN_GVAR_MODE(cfn)) { switch(CFN_GVAR_MODE(cfn)) {
case FUNC_ADJUST_GVAR_CONSTANT: case FUNC_ADJUST_GVAR_CONSTANT:
dc->drawNumber(col1, line2, CFN_PARAM(cfn), 0); dc->drawNumber(col1, line2, CFN_PARAM(cfn), COLOR_THEME_PRIMARY1);
break; break;
case FUNC_ADJUST_GVAR_SOURCE: case FUNC_ADJUST_GVAR_SOURCE:
drawSource(dc, col1, line2, CFN_PARAM(cfn), 0); drawSource(dc, col1, line2, CFN_PARAM(cfn), COLOR_THEME_PRIMARY1);
break; break;
case FUNC_ADJUST_GVAR_GVAR: case FUNC_ADJUST_GVAR_GVAR:
drawSource(dc, col1, line2, CFN_PARAM(cfn) + MIXSRC_FIRST_GVAR, 0); drawSource(dc, col1, line2, CFN_PARAM(cfn) + MIXSRC_FIRST_GVAR, COLOR_THEME_PRIMARY1);
break; break;
case FUNC_ADJUST_GVAR_INCDEC: { case FUNC_ADJUST_GVAR_INCDEC: {
int16_t value = CFN_PARAM(cfn); int16_t value = CFN_PARAM(cfn);
std::string text(value >= 0 ? "+= " : "-= "); std::string text(value >= 0 ? "+= " : "-= ");
text += std::to_string(abs(value)); text += std::to_string(abs(value));
dc->drawText(col1, line2, text.c_str()); dc->drawText(col1, line2, text.c_str(), COLOR_THEME_PRIMARY1);
break; break;
} }
} }
@@ -582,13 +564,11 @@ class SpecialFunctionButton : public Button
theme->drawCheckBox(dc, CFN_ACTIVE(cfn), col3, line2); theme->drawCheckBox(dc, CFN_ACTIVE(cfn), col3, line2);
} else if (HAS_REPEAT_PARAM(func)) { } else if (HAS_REPEAT_PARAM(func)) {
if (CFN_PLAY_REPEAT(cfn) == 0) { if (CFN_PLAY_REPEAT(cfn) == 0) {
dc->drawText(col3, line2, "1x", 0); dc->drawText(col3, line2, "1x", COLOR_THEME_PRIMARY1);
} else if (CFN_PLAY_REPEAT(cfn) == CFN_PLAY_REPEAT_NOSTART) { } else if (CFN_PLAY_REPEAT(cfn) == CFN_PLAY_REPEAT_NOSTART) {
dc->drawText(col3, line2, "!1x", 0); dc->drawText(col3, line2, "!1x", COLOR_THEME_PRIMARY1);
} else { } else {
dc->drawNumber(col3 + 12, line2, dc->drawNumber(col3 + 12, line2, CFN_PLAY_REPEAT(cfn) * CFN_PLAY_REPEAT_MUL, COLOR_THEME_PRIMARY1 | RIGHT, 0, nullptr, "s");
CFN_PLAY_REPEAT(cfn) * CFN_PLAY_REPEAT_MUL, 0 | RIGHT, 0,
nullptr, "s");
} }
} }
} }
@@ -673,8 +653,7 @@ void SpecialFunctionsPage::build(FormWindow *window, int8_t focusIndex)
}); });
grid.spacer(button->height() + 5); grid.spacer(button->height() + 5);
} else { } else {
auto txt = new StaticText(window, grid.getLabelSlot(), s, auto txt = new StaticText(window, grid.getLabelSlot(), s, BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED);
BUTTON_BACKGROUND, CENTERED);
auto button = auto button =
new SpecialFunctionButton(window, grid.getFieldSlot(), functions, i); new SpecialFunctionButton(window, grid.getFieldSlot(), functions, i);
@@ -729,7 +708,7 @@ void SpecialFunctionsPage::build(FormWindow *window, int8_t focusIndex)
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else { } else {
txt->setBackgroundColor(COLOR_THEME_SECONDARY2); txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED); txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
} }
txt->invalidate(); txt->invalidate();
}); });
@@ -282,27 +282,6 @@ class Theme480: public OpenTxTheme
void update() const override void update() const override
{ {
TRACE("TODO THEME::UPDATE()");
#if 0
uint32_t color = g_eeGeneral.themeData.options[1].value.unsignedValue;
uint32_t bg_color = UNEXPECTED_SHUTDOWN() ? WHITE : g_eeGeneral.themeData.options[0].value.unsignedValue;
lcdColorTable[COLOR_THEME_SECONDARY3_INDEX] = bg_color;
lcdColorTable[COLOR_THEME_FOCUS_INDEX] = color;
lcdColorTable[COLOR_THEME_FOCUS_INDEX] = color;
lcdColorTable[COLOR_THEME_PRIMARY3_INDEX] = color;
lcdColorTable[COLOR_THEME_SECONDARY1_INDEX] = color;
lcdColorTable[COLOR_THEME_WARNING_INDEX] = color;
lcdColorTable[COLOR_THEME_SECONDARY1_INDEX] = color;
lcdColorTable[COLOR_THEME_PRIMARY3_INDEX] =
RGB(GET_RED(color)>>1, GET_GREEN(color)>>1, GET_BLUE(color)>>1);
lcdColorTable[COLOR_THEME_FOCUS_INDEX] = color;
lcdColorTable[COLOR_THEME_SECONDARY1_INDEX] = color;
#define DARKER(x) ((x * 70) / 100)
lcdColorTable[COLOR_THEME_PRIMARY2_INDEX] = RGB(DARKER(GET_RED(color)), DARKER(GET_GREEN(color)), DARKER(GET_BLUE(color)));
lcdColorTable[COLOR_THEME_SECONDARY1_INDEX] = color;
lcdColorTable[COLOR_THEME_FOCUS_INDEX] = color;
#endif
loadIcons(); loadIcons();
loadThemeBitmaps(); loadThemeBitmaps();
} }
@@ -330,6 +330,6 @@ void ViewMainDecoration::createFlightMode()
return g_model.flightModeData[mixerCurrentFlightMode].name; return g_model.flightModeData[mixerCurrentFlightMode].name;
}; };
flightMode = new DynamicText(this, r, getFM, CENTERED); flightMode = new DynamicText(this, r, getFM, CENTERED | COLOR_THEME_SECONDARY1);
} }
+1 -3
View File
@@ -298,6 +298,7 @@ bool isLogicalSwitchAvailable(int index)
bool isSwitchAvailable(int swtch, SwitchContext context) bool isSwitchAvailable(int swtch, SwitchContext context)
{ {
bool negative = false; bool negative = false;
(void)negative;
if (swtch < 0) { if (swtch < 0) {
if (swtch == -SWSRC_ON || swtch == -SWSRC_ONE) { if (swtch == -SWSRC_ON || swtch == -SWSRC_ONE) {
@@ -319,9 +320,6 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
return false; return false;
} }
if (!IS_CONFIG_3POS(swinfo.quot)) { if (!IS_CONFIG_3POS(swinfo.quot)) {
if (negative) {
return false;
}
if (swinfo.rem == 1) { if (swinfo.rem == 1) {
// mid position not available for 2POS switches // mid position not available for 2POS switches
return false; return false;
+4 -2
View File
@@ -50,7 +50,9 @@ const char * logsOpen()
{ {
// Determine and set log file filename // Determine and set log file filename
FRESULT result; FRESULT result;
char filename[sizeof(LOGS_PATH) + LEN_MODEL_NAME + 16]; // /LOGS/modelnamexxxxxx_2013-01-01.log
// /LOGS/modelnamexxxxxx_YYYY-MM-DD-HHMMSS.log
char filename[sizeof(LOGS_PATH) + LEN_MODEL_NAME + 18 + 4 + 1];
if (!sdMounted()) if (!sdMounted())
return STR_NO_SDCARD; return STR_NO_SDCARD;
@@ -97,7 +99,7 @@ const char * logsOpen()
char * tmp = &filename[len]; char * tmp = &filename[len];
#if defined(RTCLOCK) #if defined(RTCLOCK)
tmp = strAppendDate(&filename[len]); tmp = strAppendDate(tmp, true);
#endif #endif
strcpy(tmp, STR_LOGS_EXT); strcpy(tmp, STR_LOGS_EXT);
+3 -3
View File
@@ -21,7 +21,6 @@
#include <cctype> #include <cctype>
#include <cstdio> #include <cstdio>
#include "opentx.h" #include "opentx.h"
#include "lua_api.h"
#include "libopenui.h" #include "libopenui.h"
#include "api_colorlcd.h" #include "api_colorlcd.h"
@@ -729,9 +728,10 @@ static int luaLcdSetColor(lua_State *L)
unsigned int index = COLOR_VAL(luaL_checkunsigned(L, 1)); unsigned int index = COLOR_VAL(luaL_checkunsigned(L, 1));
LcdFlags flags = luaL_checkunsigned(L, 2); LcdFlags flags = luaL_checkunsigned(L, 2);
if (index < LCD_COLOR_COUNT) if (index < LCD_COLOR_COUNT) {
lcdColorTable[index] = COLOR_VAL(flagsRGB(flags)); lcdColorTable[index] = COLOR_VAL(flagsRGB(flags));
OpenTxTheme::instance()->update();
}
return 0; return 0;
} }
+163
View File
@@ -0,0 +1,163 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <cstdio>
#include "lua_api.h"
#include "api_filesystem.h"
// garbage collector for luaDir
static int dir_gc(lua_State* L)
{
DIR* dir = (DIR*)lua_touserdata(L, 1);
if (dir) f_closedir(dir);
return 0;
}
void registerDirIter(lua_State* L)
{
luaL_newmetatable(L, DIR_METATABLE);
/* set the garbage colector field */
lua_pushstring(L, "__gc");
lua_pushcfunction(L, dir_gc);
lua_settable(L, -3);
lua_pop(L, 1);
}
static int dir_iter(lua_State* L)
{
DIR* dir = (DIR*)lua_touserdata(L, lua_upvalueindex(1));
FILINFO info;
FRESULT res = f_readdir(dir, &info);
if (res != FR_OK || info.fname[0] == 0) { /* Break on error or end of dir */
return 0;
}
lua_pushstring(L, info.fname);
return 1;
}
/*luadoc
@function dir(directory)
Return an iterator listing all the files and directories name in a directory
@param directory (string) Working directory
@status current Introduced in 2.5.0
### Example
```lua
for fname in dir(".") do
print(fname)
end
*/
int luaDir(lua_State* L)
{
const char* path = luaL_optstring(L, 1, nullptr);
DIR* dir = (DIR*)lua_newuserdata(L, sizeof(DIR));
luaL_getmetatable(L, DIR_METATABLE);
lua_setmetatable(L, -2);
FRESULT res = f_opendir(dir, path);
if (res != FR_OK) {
printf("luaDir cannot open %s\n", path);
}
lua_pushcclosure(L, dir_iter, 1);
return 1;
}
/*luadoc
@function fstat(path)
Checks the existence of file or directory.
If not exist, return nil.
If exist, return the object information.
@param path (string) path to the object
@retval table object info, table elements:
* 'size' (number) file size
* 'attrib' (number) file attribute flags
* 'time' (table) table with last time modified date and times, table elements:
* `year` (number) year
* `mon` (number) month
* `day` (number) day of month
* `hour` (number) hours
* `hour12` (number) hours in US format
* `min` (number) minutes
* `sec` (number) seconds
* `suffix` (text) am or pm
### Example
```lua
info = fstat("radio")
if info ~= nil then
if (info.attrib == AM_DIR) then
print("is a directory")
end
size = info.size
time = info.time
end
@status current Introduced in 2.5.0
*/
int luaFstat(lua_State* L)
{
const char * path = luaL_optstring(L, 1, nullptr);
FRESULT res;
FILINFO info;
res = f_stat(path, &info);
if (res != FR_OK) {
printf("luaFstat cannot open %s\n", path);
return 0;
}
lua_newtable(L);
lua_pushtableinteger(L, "size", info.fsize);
lua_pushtableinteger(L, "attrib", info.fattrib);
uint32_t year = (info.fdate >> 9) + 1980;
uint32_t month = info.fdate >> 5 & 15;
uint32_t day = info.fdate & 31;
uint32_t hour = info.ftime >> 11;
uint32_t mn = info.ftime >> 5 & 63;
uint32_t sec = (info.ftime & 31) * 2;
lua_pushstring(L, "time");
luaPushDateTime(L, year, month, day, hour, mn, sec);
lua_settable(L, -3);
return 1;
}
+26
View File
@@ -0,0 +1,26 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#define DIR_METATABLE "directory metatable"
void registerDirIter(lua_State* L);
int luaDir(lua_State* L);
int luaFstat(lua_State* L);
+10 -1
View File
@@ -23,6 +23,7 @@
#include "opentx.h" #include "opentx.h"
#include "stamp.h" #include "stamp.h"
#include "lua_api.h" #include "lua_api.h"
#include "api_filesystem.h"
#include "telemetry/frsky.h" #include "telemetry/frsky.h"
#include "telemetry/multi.h" #include "telemetry/multi.h"
@@ -165,7 +166,7 @@ static int luaGetTime(lua_State * L)
return 1; return 1;
} }
static void luaPushDateTime(lua_State * L, uint32_t year, uint32_t mon, uint32_t day, void luaPushDateTime(lua_State * L, uint32_t year, uint32_t mon, uint32_t day,
uint32_t hour, uint32_t min, uint32_t sec) uint32_t hour, uint32_t min, uint32_t sec)
{ {
uint32_t hour12 = hour; uint32_t hour12 = hour;
@@ -1816,6 +1817,8 @@ const luaL_Reg opentxLib[] = {
{ "defaultChannel", luaDefaultChannel }, { "defaultChannel", luaDefaultChannel },
{ "getRSSI", luaGetRSSI }, { "getRSSI", luaGetRSSI },
{ "killEvents", luaKillEvents }, { "killEvents", luaKillEvents },
{ "dir", luaDir },
{ "fstat", luaFstat },
{ "chdir", luaChdir }, { "chdir", luaChdir },
{ "loadScript", luaLoadScript }, { "loadScript", luaLoadScript },
{ "getUsage", luaGetUsage }, { "getUsage", luaGetUsage },
@@ -2175,5 +2178,11 @@ const luaR_value_entry opentxConstants[] = {
{"UNIT_BITFIELD", UNIT_BITFIELD}, {"UNIT_BITFIELD", UNIT_BITFIELD},
{"UNIT_TEXT", UNIT_TEXT}, {"UNIT_TEXT", UNIT_TEXT},
{"AM_RDO", AM_RDO},
{"AM_HID", AM_HID},
{"AM_SYS", AM_SYS},
{"AM_DIR", AM_DIR},
{"AM_ARC", AM_ARC},
{ nullptr, 0 } /* sentinel */ { nullptr, 0 } /* sentinel */
}; };
+3
View File
@@ -27,6 +27,7 @@
#include "bin_allocator.h" #include "bin_allocator.h"
#include "lua_api.h" #include "lua_api.h"
#include "sdcard.h" #include "sdcard.h"
#include "api_filesystem.h"
#if defined(LIBOPENUI) #if defined(LIBOPENUI)
#include "api_colorlcd.h" #include "api_colorlcd.h"
@@ -257,6 +258,8 @@ void luaClose(lua_State ** L)
void luaRegisterLibraries(lua_State * L) void luaRegisterLibraries(lua_State * L)
{ {
luaL_openlibs(L); luaL_openlibs(L);
registerDirIter(L);
#if defined(COLORLCD) #if defined(COLORLCD)
registerBitmapClass(L); registerBitmapClass(L);
#endif #endif
+8
View File
@@ -23,6 +23,9 @@
#if defined(LUA) #if defined(LUA)
// prevent C++ code to be included from lua.h
#include "rtos.h"
extern "C" { extern "C" {
#include <lua.h> #include <lua.h>
#include <lauxlib.h> #include <lauxlib.h>
@@ -31,6 +34,9 @@ extern "C" {
#include <lgc.h> #include <lgc.h>
} }
#include "dataconstants.h"
#include "opentx_types.h"
#ifndef LUA_SCRIPT_LOAD_MODE #ifndef LUA_SCRIPT_LOAD_MODE
// Can force loading of binary (.luac) or plain-text (.lua) versions of scripts specifically, and control // Can force loading of binary (.luac) or plain-text (.lua) versions of scripts specifically, and control
// compilation options. See interface.cpp:luaLoadScriptFileToState() <mode> parameter description for details. // compilation options. See interface.cpp:luaLoadScriptFileToState() <mode> parameter description for details.
@@ -209,6 +215,8 @@ void luaRegisterLibraries(lua_State * L);
void registerBitmapClass(lua_State * L); void registerBitmapClass(lua_State * L);
void luaSetInstructionsLimit(lua_State* L, int count); void luaSetInstructionsLimit(lua_State* L, int count);
int luaLoadScriptFileToState(lua_State * L, const char * filename, const char * mode); int luaLoadScriptFileToState(lua_State * L, const char * filename, const char * mode);
void luaPushDateTime(lua_State * L, uint32_t year, uint32_t mon, uint32_t day,
uint32_t hour, uint32_t min, uint32_t sec);
// Unregister LUA widget factories // Unregister LUA widget factories
void luaUnregisterWidgets(); void luaUnregisterWidgets();
+10 -6
View File
@@ -358,7 +358,11 @@ class LuaWidgetFactory: public WidgetFactory
lua_newtable(lsWidgets); lua_newtable(lsWidgets);
int i = 0; int i = 0;
for (const ZoneOption * option = options; option->name; option++, i++) { for (const ZoneOption * option = options; option->name; option++, i++) {
l_pushtableint(option->name, persistentData->options[i].value.signedValue); int32_t value = persistentData->options[i].value.signedValue;
if (option->type == ZoneOption::Color)
l_pushtableint(option->name, COLOR2FLAGS(value) | RGB_FLAG);
else
l_pushtableint(option->name, value);
} }
if (lua_pcall(lsWidgets, 2, 1, 0) != 0) { if (lua_pcall(lsWidgets, 2, 1, 0) != 0) {
@@ -438,10 +442,11 @@ void LuaWidget::setErrorMessage(const char * funcName)
{ {
TRACE("Error in widget %s %s function: %s", factory->getName(), funcName, lua_tostring(lsWidgets, -1)); TRACE("Error in widget %s %s function: %s", factory->getName(), funcName, lua_tostring(lsWidgets, -1));
TRACE("Widget disabled"); TRACE("Widget disabled");
size_t needed = snprintf(NULL, 0, "%s: %s", funcName, lua_tostring(lsWidgets, -1)) + 1; size_t needed = snprintf(NULL, 0, "ERROR in %s: %s", funcName, lua_tostring(lsWidgets, -1)) + 1;
errorMessage = (char *)malloc(needed); errorMessage = (char *)malloc(needed + 1);
if (errorMessage) { if (errorMessage) {
snprintf(errorMessage, needed, "%s: %s", funcName, lua_tostring(lsWidgets, -1)); snprintf(errorMessage, needed, "ERROR in %s: %s", funcName, lua_tostring(lsWidgets, -1));
errorMessage[needed] = '\0';
} }
} }
@@ -455,8 +460,7 @@ void LuaWidget::refresh(BitmapBuffer* dc)
if (lsWidgets == 0) return; if (lsWidgets == 0) return;
if (errorMessage) { if (errorMessage) {
lcdSetColor(RED); drawTextLines(dc, 0, 0, fullscreen ? LCD_W : rect.w, fullscreen ? LCD_H : rect.h, errorMessage, FONT(XS) | COLOR_THEME_WARNING);
dc->drawText(0, 0, "Disabled", FONT(XS) | CUSTOM_COLOR);
return; return;
} }
+3
View File
@@ -157,6 +157,9 @@ set(RADIO_DEPENDENCIES
truetype_fonts truetype_fonts
) )
set(HARDWARE_TOUCH ON)
set(SOFTWARE_KEYBOARD ON)
set(FIRMWARE_DEPENDENCIES datacopy) set(FIRMWARE_DEPENDENCIES datacopy)
add_definitions(-DPCBHORUS -DSTM32F429_439xx -DSDRAM -DCCMRAM -DCOLORLCD -DHARDWARE_KEYS) add_definitions(-DPCBHORUS -DSTM32F429_439xx -DSDRAM -DCCMRAM -DCOLORLCD -DHARDWARE_KEYS)