Fixed missing colors in model menus, except from the top bar

This commit is contained in:
jfrickmann
2021-08-26 09:23:00 -04:00
parent 8becbfcb49
commit 16d2df6a44
15 changed files with 268 additions and 294 deletions
+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();
}); });
@@ -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();
@@ -111,7 +111,7 @@ class ScriptEditWindow : public Page {
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,
@@ -253,7 +253,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 +279,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}));
} }
+35 -35
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,7 +177,7 @@ 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, 0);
@@ -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,
+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();
}); });