Fixed missing colors in model menus, except from the top bar
This commit is contained in:
@@ -71,13 +71,13 @@ class CurveEditWindow : public Page
|
||||
grid.spacer(PAGE_PADDING);
|
||||
|
||||
// Name
|
||||
new StaticText(window, grid.getFieldSlot(), STR_NAME);
|
||||
new StaticText(window, grid.getFieldSlot(), STR_NAME, 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
new RadioTextEdit(window, grid.getFieldSlot(), curve.name, sizeof(curve.name));
|
||||
grid.nextLine();
|
||||
|
||||
// Type
|
||||
new StaticText(window, grid.getFieldSlot(), STR_TYPE);
|
||||
new StaticText(window, grid.getFieldSlot(), STR_TYPE, 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
new Choice(window, grid.getFieldSlot(2, 0), STR_CURVE_TYPES, 0, 1, GET_DEFAULT(g_model.curves[index].type),
|
||||
[=](int32_t newValue) {
|
||||
@@ -126,7 +126,7 @@ class CurveEditWindow : public Page
|
||||
grid.nextLine();
|
||||
|
||||
// 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),
|
||||
[=](int32_t newValue) {
|
||||
g_model.curves[index].smooth = newValue;
|
||||
@@ -154,12 +154,12 @@ class CurveEditWindow : public Page
|
||||
grid.spacer(curveEdit->height() + 15);
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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),
|
||||
[=](int32_t newValue) {
|
||||
CurveHeader &curve = g_model.curves[index];
|
||||
@@ -207,7 +207,7 @@ class CurveEditWindow : public Page
|
||||
grid.nextLine();
|
||||
|
||||
// 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),
|
||||
[=](int32_t newValue) {
|
||||
g_model.curves[index].smooth = newValue;
|
||||
@@ -248,10 +248,10 @@ class CurveButton : public Button {
|
||||
// curve characteristics
|
||||
if (isCurveUsed(index)) {
|
||||
CurveHeader &curve = g_model.curves[index];
|
||||
dc->drawNumber(130, 5, 5 + curve.points, LEFT, 0, nullptr, STR_PTS);
|
||||
dc->drawTextAtIndex(130, 25, STR_CURVE_TYPES, curve.type);
|
||||
dc->drawNumber(130, 5, 5 + curve.points, LEFT | COLOR_THEME_PRIMARY1, 0, nullptr, STR_PTS);
|
||||
dc->drawTextAtIndex(130, 25, STR_CURVE_TYPES, curve.type, COLOR_THEME_PRIMARY1);
|
||||
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
|
||||
auto txt =
|
||||
new StaticText(window, grid.getLabelSlot(), getCurveString(1 + index),
|
||||
BUTTON_BACKGROUND, CENTERED);
|
||||
BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED);
|
||||
|
||||
// Curve drawing
|
||||
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);
|
||||
} else {
|
||||
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
|
||||
txt->setTextFlags(CENTERED);
|
||||
txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
|
||||
}
|
||||
txt->invalidate();
|
||||
});
|
||||
|
||||
@@ -87,23 +87,23 @@ void ModelFlightModesPage::build(FormWindow * window)
|
||||
|
||||
char label[16];
|
||||
getFlightModeString(label, i+1);
|
||||
new Subtitle(group, grid.getLabelSlot(), label);
|
||||
new Subtitle(group, grid.getLabelSlot(), label, 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
|
||||
// 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);
|
||||
grid.nextLine();
|
||||
|
||||
// Flight mode switch
|
||||
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));
|
||||
grid.nextLine();
|
||||
}
|
||||
|
||||
// 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"
|
||||
"--"
|
||||
@@ -134,7 +134,7 @@ void ModelFlightModesPage::build(FormWindow * window)
|
||||
grid.nextLine();
|
||||
|
||||
// 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,
|
||||
GET_DEFAULT(g_model.flightModeData[i].fadeIn),
|
||||
SET_VALUE(g_model.flightModeData[i].fadeIn, newValue),
|
||||
|
||||
@@ -65,7 +65,7 @@ void GVarButton::paint(BitmapBuffer * dc)
|
||||
gvarSum = 0;
|
||||
|
||||
LcdFlags bgColor = COLOR_THEME_PRIMARY2;
|
||||
LcdFlags textColor = 0;
|
||||
LcdFlags textColor = COLOR_THEME_PRIMARY1;
|
||||
if (hasFocus()) {
|
||||
bgColor = COLOR_THEME_FOCUS;
|
||||
textColor = COLOR_THEME_PRIMARY2;
|
||||
@@ -87,7 +87,7 @@ void GVarButton::paint(BitmapBuffer * dc)
|
||||
gvar_t v = fmData->gvars[gvarIdx];
|
||||
gvarSum += v;
|
||||
|
||||
LcdFlags attr = RIGHT;
|
||||
LcdFlags attr = COLOR_THEME_PRIMARY1 | RIGHT;
|
||||
if (flightMode == currentFlightMode)
|
||||
attr |= FONT(BOLD);
|
||||
|
||||
@@ -261,12 +261,12 @@ void GVarEditWindow::buildBody(FormWindow * window)
|
||||
FormGridLayout grid;
|
||||
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);
|
||||
|
||||
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),
|
||||
[=](int16_t newValue) {
|
||||
gvar->unit = newValue;
|
||||
@@ -277,7 +277,7 @@ void GVarEditWindow::buildBody(FormWindow * window)
|
||||
|
||||
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),
|
||||
[=](int16_t newValue) {
|
||||
gvar->prec = newValue;
|
||||
@@ -288,7 +288,7 @@ void GVarEditWindow::buildBody(FormWindow * window)
|
||||
|
||||
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,
|
||||
[=] { return gvar->min + GVAR_MIN; },
|
||||
[=](int32_t newValue) {
|
||||
@@ -299,7 +299,7 @@ void GVarEditWindow::buildBody(FormWindow * window)
|
||||
);
|
||||
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,
|
||||
[=] { return GVAR_MAX - gvar->max; },
|
||||
[=](int32_t newValue) {
|
||||
@@ -321,7 +321,7 @@ void GVarEditWindow::buildBody(FormWindow * window)
|
||||
if (userNameLen > 0) {
|
||||
strcpy(flightModeName, fmData->name);
|
||||
}
|
||||
new StaticText(window, grid.getLabelSlot(), flightModeName);
|
||||
new StaticText(window, grid.getLabelSlot(), flightModeName, 0, COLOR_THEME_PRIMARY1);
|
||||
if (flightMode > 0) {
|
||||
auto cb = new CheckBox(window, grid.getFieldSlot(2, 0),
|
||||
[=] { return fmData->gvars[index] <= GVAR_MAX; }, [=](uint8_t checked) {
|
||||
|
||||
@@ -35,42 +35,42 @@ void ModelHeliPage::build(FormWindow * window)
|
||||
grid.spacer(PAGE_PADDING);
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
|
||||
grid.nextLine();
|
||||
|
||||
@@ -194,17 +194,17 @@ class InputEditWindow : public Page
|
||||
#endif
|
||||
|
||||
// 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]));
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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,
|
||||
[=]() -> int16_t {
|
||||
return 4 - line->mode;
|
||||
@@ -216,12 +216,12 @@ class InputEditWindow : public Page
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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,
|
||||
GET_DEFAULT(line->srcRaw),
|
||||
[=] (int32_t newValue) {
|
||||
@@ -241,24 +241,24 @@ class InputEditWindow : public Page
|
||||
|
||||
// Scale
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
gvar->setSuffix("%");
|
||||
grid.nextLine();
|
||||
|
||||
// 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->setSuffix("%");
|
||||
grid.nextLine();
|
||||
|
||||
// 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,
|
||||
GET_VALUE(-line->carryTrim),
|
||||
SET_VALUE(line->carryTrim, -newValue));
|
||||
@@ -268,7 +268,7 @@ class InputEditWindow : public Page
|
||||
grid.nextLine();
|
||||
|
||||
// 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,
|
||||
GET_DEFAULT(line->curve.type),
|
||||
[=](int32_t newValue) {
|
||||
@@ -282,7 +282,7 @@ class InputEditWindow : public Page
|
||||
grid.nextLine();
|
||||
|
||||
// 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++) {
|
||||
char fm[2] = { char('0' + i), '\0'};
|
||||
if (i > 0 && (i % 4) == 0)
|
||||
@@ -439,7 +439,7 @@ void ModelInputsPage::build(FormWindow *window, int8_t focusIndex)
|
||||
coord_t h = grid.getWindowHeight();
|
||||
auto txt = new StaticText(window, grid.getLabelSlot(),
|
||||
getSourceString(MIXSRC_FIRST_INPUT + input),
|
||||
BUTTON_BACKGROUND, CENTERED);
|
||||
BUTTON_BACKGROUND, CENTERED | COLOR_THEME_PRIMARY1);
|
||||
|
||||
while (inputIndex < MAX_EXPOS && line->chn == input && EXPO_VALID(line)) {
|
||||
Button *button =
|
||||
@@ -499,7 +499,7 @@ void ModelInputsPage::build(FormWindow *window, int8_t focusIndex)
|
||||
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
|
||||
} else {
|
||||
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
|
||||
txt->setTextFlags(CENTERED);
|
||||
txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
|
||||
}
|
||||
txt->invalidate();
|
||||
if (focus) button->bringToTop();
|
||||
|
||||
@@ -42,7 +42,7 @@ class ModelInputsPage: public PageTab {
|
||||
class CommonInputOrMixButton : public Button {
|
||||
public:
|
||||
CommonInputOrMixButton(FormGroup * parent, const rect_t & rect, uint8_t index):
|
||||
Button(parent, rect),
|
||||
Button(parent, rect, nullptr, 0, COLOR_THEME_PRIMARY1),
|
||||
index(index)
|
||||
{
|
||||
setFocusHandler([=](bool active) {
|
||||
|
||||
@@ -94,18 +94,18 @@ class LogicalSwitchEditPage: public Page
|
||||
uint8_t cstate = lswFamily(cs->func);
|
||||
|
||||
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));
|
||||
choice->setAvailableHandler(isSwitchAvailableInLogicalSwitches);
|
||||
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->setAvailableHandler(isSwitchAvailableInLogicalSwitches);
|
||||
grid.nextLine();
|
||||
}
|
||||
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));
|
||||
choice->setAvailableHandler(isSwitchAvailableInLogicalSwitches);
|
||||
grid.nextLine();
|
||||
@@ -133,23 +133,23 @@ class LogicalSwitchEditPage: public Page
|
||||
grid.nextLine();
|
||||
}
|
||||
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));
|
||||
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));
|
||||
grid.nextLine();
|
||||
}
|
||||
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));
|
||||
timer->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, lswTimerValue(value), flags | PREC1);
|
||||
});
|
||||
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->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, lswTimerValue(value), flags | PREC1);
|
||||
@@ -157,7 +157,7 @@ class LogicalSwitchEditPage: public Page
|
||||
grid.nextLine();
|
||||
}
|
||||
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),
|
||||
[=](int32_t newValue) {
|
||||
cs->v1 = newValue;
|
||||
@@ -173,7 +173,7 @@ class LogicalSwitchEditPage: public Page
|
||||
});
|
||||
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;
|
||||
getMixSrcRange(cs->v1, v2_min, v2_max);
|
||||
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
|
||||
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));
|
||||
choice->setAvailableHandler(isSwitchAvailableInLogicalSwitches);
|
||||
grid.nextLine();
|
||||
|
||||
// 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);
|
||||
edit->setZeroText("---");
|
||||
grid.nextLine();
|
||||
|
||||
// Delay
|
||||
new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_DELAY);
|
||||
new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_DELAY, 0, COLOR_THEME_PRIMARY1);
|
||||
if (cstate == LS_FAMILY_EDGE) {
|
||||
new StaticText(logicalSwitchOneWindow, grid.getFieldSlot(), STR_NA);
|
||||
new StaticText(logicalSwitchOneWindow, grid.getFieldSlot(), STR_NA, 0, COLOR_THEME_PRIMARY1);
|
||||
}
|
||||
else {
|
||||
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);
|
||||
|
||||
// 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));
|
||||
functionChoice->setSetValueHandler([=](int32_t newValue) {
|
||||
cs->func = newValue;
|
||||
@@ -253,7 +253,7 @@ class LogicalSwitchButton : public Button
|
||||
{
|
||||
public:
|
||||
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);
|
||||
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);
|
||||
|
||||
// CSW func
|
||||
dc->drawTextAtIndex(col1, line1, STR_VCSWFUNC, ls->func);
|
||||
dc->drawTextAtIndex(col1, line1, STR_VCSWFUNC, ls->func, COLOR_THEME_PRIMARY1);
|
||||
|
||||
// CSW params
|
||||
if (lsFamily == LS_FAMILY_BOOL || lsFamily == LS_FAMILY_STICKY) {
|
||||
drawSwitch(dc, col2, line1, ls->v1);
|
||||
drawSwitch(dc, col3, line1, ls->v2);
|
||||
drawSwitch(dc, col2, line1, ls->v1, COLOR_THEME_PRIMARY1);
|
||||
drawSwitch(dc, col3, line1, ls->v2, COLOR_THEME_PRIMARY1);
|
||||
} else if (lsFamily == LS_FAMILY_EDGE) {
|
||||
drawSwitch(dc, col1, line2, ls->v1);
|
||||
putsEdgeDelayParam(dc, col2, line2, ls);
|
||||
drawSwitch(dc, col1, line2, ls->v1, COLOR_THEME_PRIMARY1);
|
||||
putsEdgeDelayParam(dc, col2, line2, ls, COLOR_THEME_PRIMARY1);
|
||||
} else if (lsFamily == LS_FAMILY_COMP) {
|
||||
drawSource(dc, col2, line1, ls->v1, 0);
|
||||
drawSource(dc, col3, line1, ls->v2, 0);
|
||||
drawSource(dc, col2, line1, ls->v1, COLOR_THEME_PRIMARY1);
|
||||
drawSource(dc, col3, line1, ls->v2, COLOR_THEME_PRIMARY1);
|
||||
} else if (lsFamily == LS_FAMILY_TIMER) {
|
||||
dc->drawNumber(col2, line1, lswTimerValue(ls->v1), LEFT | PREC1);
|
||||
dc->drawNumber(col3, line1, lswTimerValue(ls->v2), LEFT | PREC1);
|
||||
dc->drawNumber(col2, line1, lswTimerValue(ls->v1), COLOR_THEME_PRIMARY1 | LEFT | PREC1);
|
||||
dc->drawNumber(col3, line1, lswTimerValue(ls->v2), COLOR_THEME_PRIMARY1 | LEFT | PREC1);
|
||||
} else {
|
||||
drawSource(dc, col2, line1, ls->v1, 0);
|
||||
drawSourceCustomValue(
|
||||
dc, col3, line1, ls->v1,
|
||||
(ls->v1 <= MIXSRC_LAST_CH ? calc100toRESX(ls->v2) : ls->v2), 0);
|
||||
drawSource(dc, col2, line1, ls->v1, COLOR_THEME_PRIMARY1);
|
||||
drawSourceCustomValue(dc, col3, line1, ls->v1,
|
||||
(ls->v1 <= MIXSRC_LAST_CH ? calc100toRESX(ls->v2) : ls->v2), COLOR_THEME_PRIMARY1);
|
||||
}
|
||||
|
||||
// AND switch
|
||||
drawSwitch(dc, col1, (lsFamily == LS_FAMILY_EDGE) ? line3 : line2,
|
||||
ls->andsw, 0);
|
||||
drawSwitch(dc, col1, (lsFamily == LS_FAMILY_EDGE) ? line3 : line2, ls->andsw, COLOR_THEME_PRIMARY1);
|
||||
|
||||
// CSW duration
|
||||
if (ls->duration > 0) {
|
||||
dc->drawNumber(col2, (lsFamily == LS_FAMILY_EDGE) ? line3 : line2,
|
||||
ls->duration, PREC1 | LEFT);
|
||||
dc->drawNumber(col2, (lsFamily == LS_FAMILY_EDGE) ? line3 : line2, ls->duration, COLOR_THEME_PRIMARY1 | PREC1 | LEFT);
|
||||
}
|
||||
|
||||
// CSW delay
|
||||
if (lsFamily != LS_FAMILY_EDGE && ls->delay > 0) {
|
||||
dc->drawNumber(col3, (lsFamily == LS_FAMILY_EDGE) ? line3 : line2,
|
||||
ls->delay, PREC1 | LEFT);
|
||||
dc->drawNumber(col3, (lsFamily == LS_FAMILY_EDGE) ? line3 : line2, ls->delay, COLOR_THEME_PRIMARY1 | PREC1 | LEFT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,7 +389,7 @@ void ModelLogicalSwitchesPage::build(FormWindow* window, int8_t focusIndex)
|
||||
} else {
|
||||
auto txt = new StaticText(window, grid.getLabelSlot(),
|
||||
getSwitchPositionName(SWSRC_SW1 + i),
|
||||
BUTTON_BACKGROUND, CENTERED);
|
||||
BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED);
|
||||
|
||||
auto button = new LogicalSwitchButton(window, grid.getFieldSlot(), i);
|
||||
button->setPressHandler([=]() {
|
||||
@@ -425,7 +421,7 @@ void ModelLogicalSwitchesPage::build(FormWindow* window, int8_t focusIndex)
|
||||
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
|
||||
} else {
|
||||
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
|
||||
txt->setTextFlags(CENTERED);
|
||||
txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
|
||||
}
|
||||
txt->invalidate();
|
||||
});
|
||||
|
||||
@@ -78,7 +78,7 @@ class ScriptEditWindow : public Page {
|
||||
ScriptData* sd = &(g_model.scriptsData[idx]);
|
||||
|
||||
// Filename
|
||||
new StaticText(window, grid.getLabelSlot(), STR_SCRIPT);
|
||||
new StaticText(window, grid.getLabelSlot(), STR_SCRIPT, 0, COLOR_THEME_PRIMARY1);
|
||||
auto fc = new FileChoice(
|
||||
window, grid.getFieldSlot(), SCRIPTS_MIXES_PATH, SCRIPTS_EXT,
|
||||
LEN_SCRIPT_FILENAME,
|
||||
@@ -93,7 +93,7 @@ class ScriptEditWindow : public Page {
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
@@ -111,7 +111,7 @@ class ScriptEditWindow : public Page {
|
||||
|
||||
for (int i = 0; i < sio.inputsCount; 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();
|
||||
if (si.type == INPUT_TYPE_VALUE) {
|
||||
new NumberEdit(gInputs, inputsGrid.getSlot(), si.min - si.def,
|
||||
@@ -253,7 +253,7 @@ void ModelMixerScriptsPage::build(FormWindow * window, int8_t focusIdx)
|
||||
// LUAx label
|
||||
auto txt = new StaticText(window, grid.getLabelSlot(),
|
||||
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);
|
||||
|
||||
@@ -279,7 +279,7 @@ void ModelMixerScriptsPage::build(FormWindow * window, int8_t focusIdx)
|
||||
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
|
||||
} else {
|
||||
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
|
||||
txt->setTextFlags(CENTERED);
|
||||
txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
|
||||
}
|
||||
txt->invalidate();
|
||||
});
|
||||
|
||||
@@ -88,19 +88,19 @@ class MixEditWindow : public Page
|
||||
MixData *mix = mixAddress(mixIndex);
|
||||
|
||||
// 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,
|
||||
sizeof(mix->name));
|
||||
grid.nextLine();
|
||||
|
||||
// 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,
|
||||
GET_SET_DEFAULT(mix->srcRaw));
|
||||
grid.nextLine();
|
||||
|
||||
// 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(), MIX_WEIGHT_MIN,
|
||||
MIX_WEIGHT_MAX, GET_SET_DEFAULT(mix->weight));
|
||||
@@ -108,19 +108,19 @@ class MixEditWindow : public Page
|
||||
grid.nextLine();
|
||||
|
||||
// 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,
|
||||
MIX_OFFSET_MAX, GET_SET_DEFAULT(mix->offset));
|
||||
gvar->setSuffix("%");
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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, GET_DEFAULT(mix->curve.type),
|
||||
[=](int32_t newValue) {
|
||||
@@ -135,7 +135,7 @@ class MixEditWindow : public Page
|
||||
grid.nextLine();
|
||||
|
||||
// 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++) {
|
||||
char fm[2] = {char('0' + i), '\0'};
|
||||
if (i > 0 && (i % 4) == 0) grid.nextLine();
|
||||
@@ -151,26 +151,26 @@ class MixEditWindow : public Page
|
||||
grid.nextLine();
|
||||
|
||||
// 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(mix->swtch));
|
||||
grid.nextLine();
|
||||
|
||||
// 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,
|
||||
GET_SET_DEFAULT(mix->mixWarn));
|
||||
edit->setZeroText(STR_OFF);
|
||||
grid.nextLine();
|
||||
|
||||
// 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,
|
||||
GET_SET_DEFAULT(mix->mltpx));
|
||||
grid.nextLine();
|
||||
|
||||
// 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,
|
||||
GET_DEFAULT(mix->delayUp),
|
||||
SET_VALUE(mix->delayUp, newValue), 0, PREC1);
|
||||
@@ -178,7 +178,7 @@ class MixEditWindow : public Page
|
||||
grid.nextLine();
|
||||
|
||||
// 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,
|
||||
GET_DEFAULT(mix->delayDown),
|
||||
SET_VALUE(mix->delayDown, newValue), 0, PREC1);
|
||||
@@ -186,7 +186,7 @@ class MixEditWindow : public Page
|
||||
grid.nextLine();
|
||||
|
||||
// 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,
|
||||
GET_DEFAULT(mix->speedUp),
|
||||
SET_VALUE(mix->speedUp, newValue), 0, PREC1);
|
||||
@@ -194,7 +194,7 @@ class MixEditWindow : public Page
|
||||
grid.nextLine();
|
||||
|
||||
// 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,
|
||||
GET_DEFAULT(mix->speedDown),
|
||||
SET_VALUE(mix->speedDown, newValue), 0, PREC1);
|
||||
@@ -287,7 +287,7 @@ class MixLineButton : public CommonInputOrMixButton
|
||||
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;
|
||||
if (line.speedDown || line.speedUp) delayslow = 1;
|
||||
if (line.delayUp || line.delayDown) delayslow += 2;
|
||||
@@ -379,7 +379,7 @@ void ModelMixesPage::build(FormWindow * window, int8_t focusMixIndex)
|
||||
coord_t h = grid.getWindowHeight();
|
||||
auto txt = new MixLineTitle(window, grid.getLabelSlot(),
|
||||
getSourceString(MIXSRC_CH1 + ch),
|
||||
BUTTON_BACKGROUND, CENTERED);
|
||||
BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED);
|
||||
|
||||
uint8_t count = 0;
|
||||
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);
|
||||
} else {
|
||||
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
|
||||
txt->setTextFlags(CENTERED);
|
||||
txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
|
||||
}
|
||||
txt->invalidate();
|
||||
if (focus) button->bringToTop();
|
||||
|
||||
@@ -59,17 +59,17 @@ class OutputEditWindow : public Page {
|
||||
LimitData * output = limitAddress(channel);
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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);
|
||||
grid.nextLine();
|
||||
|
||||
// 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,
|
||||
GET_VALUE(output->min - 1000),
|
||||
SET_VALUE(output->min, newValue + 1000),
|
||||
@@ -77,7 +77,7 @@ class OutputEditWindow : public Page {
|
||||
grid.nextLine();
|
||||
|
||||
// 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,
|
||||
GET_VALUE(output->max + 1000),
|
||||
SET_VALUE(output->max, newValue - 1000),
|
||||
@@ -85,12 +85,12 @@ class OutputEditWindow : public Page {
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
edit->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||
dc->drawText(2, 2, getCurveString(value));
|
||||
@@ -98,14 +98,14 @@ class OutputEditWindow : public Page {
|
||||
grid.nextLine();
|
||||
|
||||
// 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,
|
||||
GET_VALUE(output->ppmCenter + PPM_CENTER),
|
||||
SET_VALUE(output->ppmCenter, newValue - PPM_CENTER));
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
@@ -195,7 +195,7 @@ void ModelOutputsPage::build(FormWindow * window, int8_t focusChannel)
|
||||
// Channel label
|
||||
auto txt = new StaticText(window, grid.getLabelSlot(),
|
||||
getSourceString(MIXSRC_CH1 + ch),
|
||||
BUTTON_BACKGROUND, CENTERED);
|
||||
BUTTON_BACKGROUND, CENTERED | COLOR_THEME_PRIMARY1);
|
||||
|
||||
// Channel settings
|
||||
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);
|
||||
} else {
|
||||
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
|
||||
txt->setTextFlags(CENTERED);
|
||||
txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
|
||||
}
|
||||
txt->invalidate();
|
||||
});
|
||||
|
||||
@@ -108,7 +108,7 @@ class FailSafeBody : public FormGroup {
|
||||
for (int ch=0; ch < maxModuleChannels(moduleIdx); ch++) {
|
||||
// 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
|
||||
new NumberEdit(this, grid.getFieldSlot(8, 0), -lim, lim,
|
||||
@@ -167,18 +167,18 @@ class RegisterDialog: public Dialog {
|
||||
grid.spacer(PAGE_PADDING);
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// RX name
|
||||
new StaticText(form, grid.getLabelSlot(), STR_RX_NAME);
|
||||
waiting = new StaticText(form, grid.getFieldSlot(), STR_WAITING);
|
||||
new StaticText(form, grid.getLabelSlot(), STR_RX_NAME, 0, COLOR_THEME_PRIMARY1);
|
||||
waiting = new StaticText(form, grid.getFieldSlot(), STR_WAITING, 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
grid.spacer(6);
|
||||
|
||||
@@ -251,7 +251,7 @@ class BindWaitDialog: public Dialog {
|
||||
moduleIdx(moduleIdx),
|
||||
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;
|
||||
@@ -451,7 +451,7 @@ class TrainerModuleWindow : public FormGroup {
|
||||
FormGridLayout grid;
|
||||
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) {
|
||||
g_model.trainerData.mode = newValue;
|
||||
SET_DIRTY();
|
||||
@@ -462,7 +462,7 @@ class TrainerModuleWindow : public FormGroup {
|
||||
grid.nextLine();
|
||||
|
||||
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,
|
||||
MAX_OUTPUT_CHANNELS - 8 + g_model.trainerData.channelsCount + 1,
|
||||
GET_DEFAULT(1 + g_model.trainerData.channelsStart));
|
||||
@@ -489,7 +489,7 @@ class TrainerModuleWindow : public FormGroup {
|
||||
|
||||
if (g_model.trainerData.mode == TRAINER_MODE_SLAVE) {
|
||||
// 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
|
||||
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)
|
||||
{
|
||||
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,
|
||||
MAX_OUTPUT_CHANNELS - sentModuleChannels(moduleIdx) + 1,
|
||||
GET_DEFAULT(1 + g_model.moduleData[moduleIdx].channelsStart));
|
||||
@@ -576,7 +576,7 @@ class ModuleWindow : public FormGroup {
|
||||
clear();
|
||||
|
||||
// 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,
|
||||
MODULE_TYPE_NONE, MODULE_TYPE_COUNT - 1,
|
||||
GET_DEFAULT(g_model.moduleData[moduleIdx].type),
|
||||
@@ -637,7 +637,7 @@ class ModuleWindow : public FormGroup {
|
||||
else if (isModuleMultimodule(moduleIdx)) {
|
||||
Choice * mmSubProtocol = nullptr;
|
||||
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,...)
|
||||
int multiRfProto = g_model.moduleData[moduleIdx].getMultiProtocol();
|
||||
@@ -691,19 +691,19 @@ class ModuleWindow : public FormGroup {
|
||||
grid.nextLine();
|
||||
|
||||
// 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(), [=] {
|
||||
char msg[64] = "";
|
||||
getModuleStatusString(moduleIdx, msg);
|
||||
return std::string(msg);
|
||||
});
|
||||
}, COLOR_THEME_PRIMARY1);
|
||||
|
||||
// Multimodule sync
|
||||
/*if (multiSyncStatus.isValid()) {
|
||||
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);
|
||||
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();
|
||||
@@ -712,7 +712,7 @@ class ModuleWindow : public FormGroup {
|
||||
const char *title = getMultiOptionTitleStatic(moduleIdx);
|
||||
if (title != nullptr) {
|
||||
grid.nextLine();
|
||||
new StaticText(this, grid.getLabelSlot(true), title);
|
||||
new StaticText(this, grid.getLabelSlot(true), title, 0, COLOR_THEME_PRIMARY1);
|
||||
|
||||
// int optionValue =
|
||||
// g_model.moduleData[moduleIdx].multi.optionValue;
|
||||
@@ -782,7 +782,7 @@ class ModuleWindow : public FormGroup {
|
||||
|
||||
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(
|
||||
this, grid.getFieldSlot(), servoRates, 0, 1,
|
||||
[=]() {
|
||||
@@ -795,7 +795,7 @@ class ModuleWindow : public FormGroup {
|
||||
});
|
||||
} else {
|
||||
// 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(),
|
||||
GET_SET_DEFAULT(
|
||||
g_model.moduleData[moduleIdx].multi.autoBindMode));
|
||||
@@ -803,14 +803,14 @@ class ModuleWindow : public FormGroup {
|
||||
|
||||
// Low power mode
|
||||
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(
|
||||
this, grid.getFieldSlot(),
|
||||
GET_SET_DEFAULT(g_model.moduleData[moduleIdx].multi.lowPowerMode));
|
||||
|
||||
// Disable telemetry
|
||||
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(),
|
||||
GET_SET_DEFAULT(
|
||||
g_model.moduleData[moduleIdx].multi.disableTelemetry));
|
||||
@@ -818,7 +818,7 @@ class ModuleWindow : public FormGroup {
|
||||
if (MULTI_DISABLE_CHAN_MAP_ROW_STATIC(moduleIdx) != HIDDEN_ROW) {
|
||||
// Disable channel mapping
|
||||
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(),
|
||||
GET_SET_DEFAULT(g_model.moduleData[moduleIdx].multi.disableMapping));
|
||||
}
|
||||
@@ -831,13 +831,14 @@ class ModuleWindow : public FormGroup {
|
||||
|
||||
// TYPE
|
||||
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(),
|
||||
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
|
||||
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(), [=] {
|
||||
char msg[64] = "";
|
||||
getModuleStatusString(moduleIdx, msg);
|
||||
@@ -847,7 +848,7 @@ class ModuleWindow : public FormGroup {
|
||||
|
||||
// Power source
|
||||
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(), [=] {
|
||||
char msg[64] = "";
|
||||
getModuleSyncStatusString(moduleIdx, msg);
|
||||
@@ -856,7 +857,7 @@ class ModuleWindow : public FormGroup {
|
||||
|
||||
// RX Freq
|
||||
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()));
|
||||
edit->setSetValueHandler([=](int32_t newValue) {
|
||||
g_model.moduleData[EXTERNAL_MODULE].afhds3.setRxFreq((uint16_t)newValue);
|
||||
@@ -865,7 +866,7 @@ class ModuleWindow : public FormGroup {
|
||||
|
||||
// Module actual power
|
||||
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(), [=] {
|
||||
char msg[64] = "";
|
||||
getStringAtIndex(msg, STR_AFHDS3_POWERS, actualAfhdsRunPower(moduleIdx));
|
||||
@@ -874,7 +875,7 @@ class ModuleWindow : public FormGroup {
|
||||
|
||||
// Module power
|
||||
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,
|
||||
GET_SET_DEFAULT(g_model.moduleData[moduleIdx].afhds3.runPower));
|
||||
}
|
||||
@@ -890,7 +891,7 @@ class ModuleWindow : public FormGroup {
|
||||
// PPM modules
|
||||
if (isModulePPM(moduleIdx)) {
|
||||
// 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
|
||||
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
|
||||
if (!isModuleRFAccess(moduleIdx) && (isModuleModelIndexAvailable(moduleIdx)|| isModuleBindRangeAvailable(moduleIdx))) {
|
||||
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
|
||||
if (isModuleModelIndexAvailable(moduleIdx)) {
|
||||
@@ -1005,7 +1006,7 @@ class ModuleWindow : public FormGroup {
|
||||
// Failsafe
|
||||
if (isModuleFailsafeAvailable(moduleIdx)) {
|
||||
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,
|
||||
GET_DEFAULT(g_model.moduleData[moduleIdx].failsafeMode),
|
||||
[=](int32_t newValue) {
|
||||
@@ -1026,7 +1027,7 @@ class ModuleWindow : public FormGroup {
|
||||
|
||||
// Register and Range buttons
|
||||
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->setPressHandler([=]() -> uint8_t {
|
||||
new RegisterDialog(this, moduleIdx);
|
||||
@@ -1050,13 +1051,13 @@ class ModuleWindow : public FormGroup {
|
||||
|
||||
// R9M Power
|
||||
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,
|
||||
GET_SET_DEFAULT(g_model.moduleData[moduleIdx].pxx.power));
|
||||
}
|
||||
|
||||
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,
|
||||
GET_DEFAULT(min<uint8_t>(g_model.moduleData[moduleIdx].pxx.power, R9M_LBT_POWER_MAX)),
|
||||
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++) {
|
||||
char label[] = TR_RECEIVER " X";
|
||||
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);
|
||||
grid.nextLine();
|
||||
}
|
||||
@@ -1075,7 +1076,7 @@ class ModuleWindow : public FormGroup {
|
||||
|
||||
// SBUS refresh rate
|
||||
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,
|
||||
GET_DEFAULT((int16_t)g_model.moduleData[moduleIdx].ppm.frameLength*5 + 225),
|
||||
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));
|
||||
#if defined(RADIO_TX16S)
|
||||
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
|
||||
grid.nextLine();
|
||||
}
|
||||
@@ -1150,7 +1151,7 @@ void ModelSetupPage::build(FormWindow * window)
|
||||
grid.spacer(PAGE_PADDING);
|
||||
|
||||
// Model name
|
||||
new StaticText(window, grid.getLabelSlot(), STR_MODELNAME);
|
||||
new StaticText(window, grid.getLabelSlot(), STR_MODELNAME, 0, COLOR_THEME_PRIMARY1);
|
||||
auto text =
|
||||
new ModelTextEdit(window, grid.getFieldSlot(), g_model.header.name,
|
||||
sizeof(g_model.header.name), 0, MODEL_NAME_EXTRA_CHARS);
|
||||
@@ -1165,7 +1166,7 @@ void ModelSetupPage::build(FormWindow * window)
|
||||
grid.nextLine();
|
||||
|
||||
// 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),
|
||||
[=]() {
|
||||
return std::string(g_model.header.bitmap, sizeof(g_model.header.bitmap));
|
||||
@@ -1181,46 +1182,46 @@ void ModelSetupPage::build(FormWindow * window)
|
||||
|
||||
// Timer label
|
||||
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();
|
||||
|
||||
auto group = new FormGroup(window, grid.getFieldSlot(), FORM_BORDER_FOCUS_ONLY | PAINT_CHILDREN_FIRST);
|
||||
GridLayout timerGrid(group);
|
||||
|
||||
// Timer name
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_NAME);
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_NAME, 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
new RadioTextEdit(group, timerGrid.getSlot(), timer->name, LEN_TIMER_NAME);
|
||||
timerGrid.nextLine();
|
||||
|
||||
// Timer mode
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_MODE);
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_MODE, 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
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));
|
||||
timerGrid.nextLine();
|
||||
|
||||
// Timer start value
|
||||
new StaticText(window, grid.getLabelSlot(true), "Start");
|
||||
new StaticText(window, grid.getLabelSlot(true), "Start", 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
new TimeEdit(group, timerGrid.getSlot(), 0, TIMER_MAX, GET_SET_DEFAULT(timer->start));
|
||||
timerGrid.nextLine();
|
||||
|
||||
// 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();
|
||||
new CheckBox(group, timerGrid.getSlot(), GET_SET_DEFAULT(timer->minuteBeep));
|
||||
timerGrid.nextLine();
|
||||
|
||||
// Timer countdown
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_BEEPCOUNTDOWN);
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_BEEPCOUNTDOWN, 0, COLOR_THEME_PRIMARY1);
|
||||
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, 1), STR_COUNTDOWNVALUES, 0, 3, GET_SET_WITH_OFFSET(timer->countdownStart, 2));
|
||||
timerGrid.nextLine();
|
||||
|
||||
// Timer persistent
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_PERSISTENT);
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_PERSISTENT, 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
new Choice(group, timerGrid.getSlot(), STR_VPERSISTENT, 0, 2, GET_SET_DEFAULT(timer->persistent));
|
||||
timerGrid.nextLine();
|
||||
@@ -1230,12 +1231,12 @@ void ModelSetupPage::build(FormWindow * window)
|
||||
}
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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 TextButton(window, grid.getFieldSlot(2, 1), STR_RESET_BTN,
|
||||
[]() -> uint8_t {
|
||||
@@ -1249,27 +1250,27 @@ void ModelSetupPage::build(FormWindow * window)
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// Throttle parameters
|
||||
{
|
||||
new Subtitle(window, grid.getLineSlot(), STR_THROTTLE_LABEL);
|
||||
new Subtitle(window, grid.getLineSlot(), STR_THROTTLE_LABEL, 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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(
|
||||
window, grid.getFieldSlot(), 0, MIXSRC_LAST_CH,
|
||||
[=]() { return throttleSource2Source(g_model.thrTraceSrc); },
|
||||
@@ -1279,41 +1280,41 @@ void ModelSetupPage::build(FormWindow * window)
|
||||
g_model.thrTraceSrc = val;
|
||||
SET_DIRTY();
|
||||
}
|
||||
});
|
||||
}, 0, COLOR_THEME_PRIMARY1);
|
||||
sc->setAvailableHandler(isThrottleSourceAvailable);
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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(
|
||||
window, grid.getFieldSlot(), MIXSRC_FIRST_TRIM, MIXSRC_LAST_TRIM,
|
||||
[=]() { return g_model.getThrottleStickTrimSource(); },
|
||||
[=](int16_t src) { g_model.setThrottleStickTrimSource(src); });
|
||||
[=](int16_t src) { g_model.setThrottleStickTrimSource(src); }, 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
}
|
||||
|
||||
// Preflight parameters
|
||||
{
|
||||
new Subtitle(window, grid.getLineSlot(), STR_PREFLIGHT);
|
||||
new Subtitle(window, grid.getLineSlot(), STR_PREFLIGHT, 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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);
|
||||
GridLayout switchesGrid(group);
|
||||
for (int i = 0, j = 0; i < NUM_SWITCHES; i++) {
|
||||
@@ -1341,7 +1342,7 @@ void ModelSetupPage::build(FormWindow * window)
|
||||
|
||||
// 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);
|
||||
GridLayout centerGrid(group);
|
||||
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
|
||||
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));
|
||||
grid.nextLine();
|
||||
|
||||
// Internal module
|
||||
{
|
||||
new Subtitle(window, grid.getLineSlot(), TR_INTERNALRF);
|
||||
new Subtitle(window, grid.getLineSlot(), TR_INTERNALRF, 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
grid.addWindow(new ModuleWindow(window, {0, grid.getWindowHeight(), LCD_W, 0}, INTERNAL_MODULE));
|
||||
}
|
||||
|
||||
// External module
|
||||
{
|
||||
new Subtitle(window, grid.getLineSlot(), TR_EXTERNALRF);
|
||||
new Subtitle(window, grid.getLineSlot(), TR_EXTERNALRF, 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
grid.addWindow(new ModuleWindow(window, {0, grid.getWindowHeight(), LCD_W, 0}, EXTERNAL_MODULE));
|
||||
}
|
||||
|
||||
// Trainer
|
||||
{
|
||||
new Subtitle(window, grid.getLineSlot(), STR_TRAINER);
|
||||
new Subtitle(window, grid.getLineSlot(), STR_TRAINER, 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
grid.addWindow(new TrainerModuleWindow(window, {0, grid.getWindowHeight(), LCD_W, 0}));
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ class SensorEditWindow : public Page {
|
||||
|
||||
if (sensor->type == TELEM_TYPE_CALCULATED) {
|
||||
// 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),
|
||||
[=](uint8_t newValue) {
|
||||
sensor->formula = newValue;
|
||||
@@ -177,7 +177,7 @@ class SensorEditWindow : public Page {
|
||||
grid.nextLine();
|
||||
}
|
||||
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));
|
||||
hex->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||
drawHexNumber(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, 0);
|
||||
@@ -188,7 +188,7 @@ class SensorEditWindow : public Page {
|
||||
|
||||
// Unit
|
||||
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),
|
||||
[=](uint8_t newValue) {
|
||||
sensor->unit = newValue;
|
||||
@@ -204,7 +204,7 @@ class SensorEditWindow : public Page {
|
||||
|
||||
// Precision
|
||||
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),
|
||||
[=](uint8_t newValue) {
|
||||
sensor->prec = newValue;
|
||||
@@ -219,33 +219,33 @@ class SensorEditWindow : public Page {
|
||||
if (sensor->unit < UNIT_FIRST_VIRTUAL) {
|
||||
if (sensor->type == TELEM_TYPE_CALCULATED) {
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
else {
|
||||
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));
|
||||
}
|
||||
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));
|
||||
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)))) {
|
||||
if (sensor->type == TELEM_TYPE_CALCULATED) {
|
||||
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));
|
||||
}
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
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));
|
||||
}
|
||||
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),
|
||||
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)) {
|
||||
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);
|
||||
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);
|
||||
grid.nextLine();
|
||||
}
|
||||
|
||||
// Auto Offset
|
||||
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));
|
||||
grid.nextLine();
|
||||
}
|
||||
|
||||
if (sensor->isConfigurable()) {
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
}
|
||||
|
||||
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) {
|
||||
sensor->persistent = newValue;
|
||||
if (!sensor->persistent)
|
||||
@@ -321,7 +321,7 @@ class SensorEditWindow : public Page {
|
||||
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) {
|
||||
sensor->logs = newValue;
|
||||
logsClose();
|
||||
@@ -340,12 +340,12 @@ class SensorEditWindow : public Page {
|
||||
TelemetrySensor * sensor = &g_model.telemetrySensors[index];
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// 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),
|
||||
[=](uint8_t newValue) {
|
||||
sensor->type = newValue;
|
||||
@@ -411,10 +411,10 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
|
||||
this->window = window;
|
||||
|
||||
// RSSI
|
||||
new Subtitle(window, grid.getLineSlot(), getRssiLabel());
|
||||
new Subtitle(window, grid.getLineSlot(), getRssiLabel(), 0, COLOR_THEME_PRIMARY1);
|
||||
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));
|
||||
edit->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||
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);
|
||||
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->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, g_model.rssiAlarms.getCriticalRssi(), flags);
|
||||
});
|
||||
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));
|
||||
grid.nextLine();
|
||||
|
||||
// Sensors
|
||||
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
|
||||
uint8_t sensorsCount = getTelemetrySensorsCount();
|
||||
@@ -531,14 +531,14 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
|
||||
grid.setLabelWidth(PAGE_LABEL_WIDTH);
|
||||
|
||||
// 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));
|
||||
grid.nextLine();
|
||||
|
||||
// Vario
|
||||
new Subtitle(window, grid.getLineSlot(), STR_VARIO);
|
||||
new Subtitle(window, grid.getLineSlot(), STR_VARIO, 0, COLOR_THEME_PRIMARY1);
|
||||
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,
|
||||
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));
|
||||
@@ -551,7 +551,7 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
|
||||
return qr.rem == 0 && isSensorAvailable(qr.quot + 1);
|
||||
});
|
||||
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,
|
||||
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; });
|
||||
|
||||
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(
|
||||
window, grid.getFieldSlot(3, 0), -15, 15,
|
||||
|
||||
@@ -65,14 +65,11 @@ void SourceChoice::paint(BitmapBuffer * dc)
|
||||
textColor = COLOR_THEME_PRIMARY2;
|
||||
else if (hasFocus())
|
||||
textColor = COLOR_THEME_PRIMARY2;
|
||||
// else if (value == 0)
|
||||
// textColor = COLOR_THEME_DISABLED;
|
||||
else
|
||||
textColor = 0;
|
||||
textColor = COLOR_THEME_PRIMARY1;
|
||||
|
||||
drawSource(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, textColor);
|
||||
dc->drawBitmapPattern(rect.w - 20, (rect.h - 11) / 2, LBM_DROPDOWN,
|
||||
textColor);
|
||||
dc->drawBitmapPattern(rect.w - 20, (rect.h - 11) / 2, LBM_DROPDOWN, textColor);
|
||||
}
|
||||
|
||||
// defined in gui/gui_common.cpp
|
||||
|
||||
@@ -31,8 +31,9 @@ class SourceChoice : public FormField {
|
||||
template <class T> friend class MenuToolbar;
|
||||
|
||||
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):
|
||||
FormField(parent, rect),
|
||||
SourceChoice(Window * parent, const rect_t & rect, int16_t vmin, int16_t vmax, std::function<int16_t()> getValue,
|
||||
std::function<void(int16_t)> setValue, WindowFlags windowFlags = 0, LcdFlags textFlags = 0):
|
||||
FormField(parent, rect, windowFlags, textFlags),
|
||||
vmin(vmin),
|
||||
vmax(vmax),
|
||||
getValue(std::move(getValue)),
|
||||
|
||||
@@ -91,22 +91,20 @@ class SpecialFunctionEditPage : public Page
|
||||
// Func param
|
||||
switch (func) {
|
||||
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,
|
||||
MAX_OUTPUT_CHANNELS,
|
||||
GET_SET_VALUE_WITH_OFFSET(CFN_CH_INDEX(cfn), 1));
|
||||
grid.nextLine();
|
||||
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(),
|
||||
STR_VALUE);
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VALUE, 0, COLOR_THEME_PRIMARY1);
|
||||
new NumberEdit(specialFunctionOneWindow, grid.getFieldSlot(), -100, 100,
|
||||
GET_SET_DEFAULT(CFN_PARAM(cfn)));
|
||||
grid.nextLine();
|
||||
break;
|
||||
|
||||
case FUNC_TRAINER: {
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(),
|
||||
STR_VALUE);
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VALUE, 0, COLOR_THEME_PRIMARY1);
|
||||
auto choice =
|
||||
new Choice(specialFunctionOneWindow, grid.getFieldSlot(), 0,
|
||||
NUM_STICKS + 1, GET_SET_DEFAULT(CFN_CH_INDEX(cfn)));
|
||||
@@ -125,8 +123,7 @@ class SpecialFunctionEditPage : public Page
|
||||
|
||||
case FUNC_RESET:
|
||||
if (CFN_PARAM(cfn) < FUNC_RESET_PARAM_FIRST_TELEM) {
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(),
|
||||
STR_RESET);
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_RESET, 0, COLOR_THEME_PRIMARY1);
|
||||
auto choice = new Choice(
|
||||
specialFunctionOneWindow, grid.getFieldSlot(), 0,
|
||||
FUNC_RESET_PARAM_FIRST_TELEM + lastUsedTelemetryIndex(),
|
||||
@@ -146,24 +143,21 @@ class SpecialFunctionEditPage : public Page
|
||||
break;
|
||||
|
||||
case FUNC_VOLUME:
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(),
|
||||
STR_VOLUME);
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VOLUME, 0, COLOR_THEME_PRIMARY1);
|
||||
new SourceChoice(specialFunctionOneWindow, grid.getFieldSlot(), 0,
|
||||
MIXSRC_LAST_CH, GET_SET_DEFAULT(CFN_PARAM(cfn)));
|
||||
grid.nextLine();
|
||||
break;
|
||||
|
||||
case FUNC_BACKLIGHT:
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(),
|
||||
STR_VALUE);
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VALUE, 0, COLOR_THEME_PRIMARY1);
|
||||
new SourceChoice(specialFunctionOneWindow, grid.getFieldSlot(), 0,
|
||||
MIXSRC_LAST_CH, GET_SET_DEFAULT(CFN_PARAM(cfn)));
|
||||
grid.nextLine();
|
||||
break;
|
||||
|
||||
case FUNC_PLAY_SOUND:
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(),
|
||||
STR_VALUE);
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VALUE, 0, COLOR_THEME_PRIMARY1);
|
||||
new Choice(specialFunctionOneWindow, grid.getFieldSlot(),
|
||||
STR_FUNCSOUNDS, 0,
|
||||
AU_SPECIAL_SOUND_LAST - AU_SPECIAL_SOUND_FIRST - 1,
|
||||
@@ -174,8 +168,7 @@ class SpecialFunctionEditPage : public Page
|
||||
case FUNC_PLAY_TRACK:
|
||||
case FUNC_BACKGND_MUSIC:
|
||||
case FUNC_PLAY_SCRIPT:
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(),
|
||||
STR_VALUE);
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VALUE, 0, COLOR_THEME_PRIMARY1);
|
||||
new FileChoice(
|
||||
specialFunctionOneWindow, grid.getFieldSlot(),
|
||||
func == FUNC_PLAY_SCRIPT
|
||||
@@ -194,8 +187,7 @@ class SpecialFunctionEditPage : public Page
|
||||
break;
|
||||
|
||||
case FUNC_SET_TIMER: {
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(),
|
||||
STR_TIMER);
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_TIMER, 0, COLOR_THEME_PRIMARY1);
|
||||
auto timerchoice =
|
||||
new Choice(specialFunctionOneWindow, grid.getFieldSlot(), 0,
|
||||
TIMERS - 1, GET_SET_DEFAULT(CFN_TIMER_INDEX(cfn)));
|
||||
@@ -204,8 +196,7 @@ class SpecialFunctionEditPage : public Page
|
||||
});
|
||||
grid.nextLine();
|
||||
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(),
|
||||
STR_VALUE);
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VALUE, 0, COLOR_THEME_PRIMARY1);
|
||||
new TimeEdit(specialFunctionOneWindow, grid.getFieldSlot(), 0,
|
||||
9 * 60 * 60 - 1, GET_SET_DEFAULT(CFN_PARAM(cfn)));
|
||||
grid.nextLine();
|
||||
@@ -213,8 +204,7 @@ class SpecialFunctionEditPage : public Page
|
||||
}
|
||||
|
||||
case FUNC_SET_FAILSAFE:
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(),
|
||||
STR_MODULE);
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_MODULE, 0, COLOR_THEME_PRIMARY1);
|
||||
new Choice(specialFunctionOneWindow, grid.getFieldSlot(),
|
||||
"\004Int.Ext.", 0, NUM_MODULES - 1,
|
||||
GET_SET_DEFAULT(CFN_PARAM(cfn)));
|
||||
@@ -222,24 +212,21 @@ class SpecialFunctionEditPage : public Page
|
||||
break;
|
||||
|
||||
case FUNC_PLAY_VALUE:
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(),
|
||||
STR_VALUE);
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VALUE, 0, COLOR_THEME_PRIMARY1);
|
||||
new SourceChoice(specialFunctionOneWindow, grid.getFieldSlot(), 0,
|
||||
MIXSRC_LAST_TELEM, GET_SET_DEFAULT(CFN_PARAM(cfn)));
|
||||
grid.nextLine();
|
||||
break;
|
||||
|
||||
case FUNC_HAPTIC:
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(),
|
||||
STR_VALUE);
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VALUE, 0, COLOR_THEME_PRIMARY1);
|
||||
new NumberEdit(specialFunctionOneWindow, grid.getFieldSlot(), 0, 3,
|
||||
GET_SET_DEFAULT(CFN_PARAM(cfn)));
|
||||
grid.nextLine();
|
||||
break;
|
||||
|
||||
case FUNC_LOGS: {
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(),
|
||||
STR_VALUE);
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_VALUE, 0, COLOR_THEME_PRIMARY1);
|
||||
auto edit =
|
||||
new NumberEdit(specialFunctionOneWindow, grid.getFieldSlot(), 0,
|
||||
255, GET_SET_DEFAULT(CFN_PARAM(cfn)));
|
||||
@@ -253,8 +240,7 @@ class SpecialFunctionEditPage : public Page
|
||||
|
||||
case FUNC_ADJUST_GVAR: {
|
||||
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(),
|
||||
STR_GLOBALVAR);
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_GLOBALVAR, 0, COLOR_THEME_PRIMARY1);
|
||||
auto gvarchoice =
|
||||
new Choice(specialFunctionOneWindow, grid.getFieldSlot(), 0,
|
||||
MAX_GVARS - 1, GET_SET_DEFAULT(CFN_GVAR_INDEX(cfn)));
|
||||
@@ -263,8 +249,7 @@ class SpecialFunctionEditPage : public Page
|
||||
});
|
||||
grid.nextLine();
|
||||
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(),
|
||||
STR_MODE);
|
||||
new StaticText(specialFunctionOneWindow, grid.getLabelSlot(), STR_MODE, 0, COLOR_THEME_PRIMARY1);
|
||||
auto modechoice =
|
||||
new Choice(specialFunctionOneWindow, grid.getFieldSlot(),
|
||||
FUNC_ADJUST_GVAR_CONSTANT, FUNC_ADJUST_GVAR_INCDEC,
|
||||
@@ -294,7 +279,7 @@ class SpecialFunctionEditPage : public Page
|
||||
|
||||
switch (CFN_GVAR_MODE(cfn)) {
|
||||
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;
|
||||
getMixSrcRange(CFN_GVAR_INDEX(cfn) + MIXSRC_FIRST_GVAR, val_min,
|
||||
val_max);
|
||||
@@ -303,12 +288,12 @@ class SpecialFunctionEditPage : public Page
|
||||
break;
|
||||
}
|
||||
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(),
|
||||
0, MIXSRC_LAST_CH, GET_SET_DEFAULT(CFN_PARAM(cfn)));
|
||||
break;
|
||||
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 =
|
||||
new Choice(specialFunctionOneWindow, grid.getFieldSlot(), 0,
|
||||
MAX_GVARS - 1, GET_SET_DEFAULT(CFN_PARAM(cfn)));
|
||||
@@ -321,7 +306,7 @@ class SpecialFunctionEditPage : public Page
|
||||
break;
|
||||
}
|
||||
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;
|
||||
getMixSrcRange(CFN_GVAR_INDEX(cfn) + MIXSRC_FIRST_GVAR, val_min, val_max);
|
||||
getGVarIncDecRange(val_min, val_max);
|
||||
@@ -341,12 +326,12 @@ class SpecialFunctionEditPage : public Page
|
||||
}
|
||||
|
||||
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(),
|
||||
GET_SET_DEFAULT(CFN_ACTIVE(cfn)));
|
||||
grid.nextLine();
|
||||
} 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(
|
||||
specialFunctionOneWindow, grid.getFieldSlot(2, 1), -1,
|
||||
60 / CFN_PLAY_REPEAT_MUL, GET_SET_DEFAULT(CFN_PLAY_REPEAT(cfn)));
|
||||
@@ -375,7 +360,7 @@ class SpecialFunctionEditPage : public Page
|
||||
CustomFunctionData *cfn = &functions[index];
|
||||
|
||||
// Switch
|
||||
new StaticText(window, grid.getLabelSlot(), STR_SWITCH);
|
||||
new StaticText(window, grid.getLabelSlot(), STR_SWITCH, 0, COLOR_THEME_PRIMARY1);
|
||||
auto switchChoice =
|
||||
new SwitchChoice(window, grid.getFieldSlot(), SWSRC_FIRST, SWSRC_LAST,
|
||||
GET_SET_DEFAULT(CFN_SWITCH(cfn)));
|
||||
@@ -399,7 +384,7 @@ class SpecialFunctionEditPage : public Page
|
||||
}
|
||||
|
||||
// Function
|
||||
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_VFSWFUNC,
|
||||
0, FUNC_MAX - 1,
|
||||
@@ -477,18 +462,18 @@ class SpecialFunctionButton : public Button
|
||||
}
|
||||
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;
|
||||
|
||||
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_max = 255;
|
||||
|
||||
switch (func) {
|
||||
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);
|
||||
dc->drawNumber(col2, line2, CFN_PARAM(cfn));
|
||||
dc->drawNumber(col2, line2, CFN_PARAM(cfn), COLOR_THEME_PRIMARY1);
|
||||
break;
|
||||
|
||||
case FUNC_TRAINER: {
|
||||
@@ -500,80 +485,77 @@ class SpecialFunctionButton : public Button
|
||||
text = std::string(STR_CHANS);
|
||||
else
|
||||
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;
|
||||
}
|
||||
case FUNC_RESET:
|
||||
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 {
|
||||
TelemetrySensor *sensor =
|
||||
&g_model.telemetrySensors[CFN_PARAM(cfn) -
|
||||
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;
|
||||
|
||||
case FUNC_VOLUME:
|
||||
drawSource(dc, col1, line2, CFN_PARAM(cfn), 0);
|
||||
drawSource(dc, col1, line2, CFN_PARAM(cfn), COLOR_THEME_PRIMARY1);
|
||||
break;
|
||||
|
||||
case FUNC_BACKLIGHT:
|
||||
drawSource(dc, col1, line2, CFN_PARAM(cfn), 0);
|
||||
drawSource(dc, col1, line2, CFN_PARAM(cfn), COLOR_THEME_PRIMARY1);
|
||||
break;
|
||||
|
||||
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;
|
||||
|
||||
case FUNC_PLAY_TRACK:
|
||||
case FUNC_BACKGND_MUSIC:
|
||||
case FUNC_PLAY_SCRIPT:
|
||||
if (ZEXIST(cfn->play.name))
|
||||
dc->drawSizedText(col1, line2, cfn->play.name, sizeof(cfn->play.name),
|
||||
0);
|
||||
dc->drawSizedText(col1, line2, cfn->play.name, sizeof(cfn->play.name), COLOR_THEME_PRIMARY1);
|
||||
else
|
||||
dc->drawTextAtIndex(col1, line2, STR_VCSWFUNC, 0, 0);
|
||||
dc->drawTextAtIndex(col1, line2, STR_VCSWFUNC, 0, COLOR_THEME_PRIMARY1);
|
||||
break;
|
||||
|
||||
case FUNC_SET_TIMER:
|
||||
drawStringWithIndex(dc, col1, line2, STR_TIMER,
|
||||
CFN_TIMER_INDEX(cfn) + 1, 0);
|
||||
drawStringWithIndex(dc, col1, line2, STR_TIMER, CFN_TIMER_INDEX(cfn) + 1, COLOR_THEME_PRIMARY1);
|
||||
break;
|
||||
|
||||
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;
|
||||
|
||||
case FUNC_PLAY_VALUE:
|
||||
drawSource(dc, col1, line2, CFN_PARAM(cfn), 0);
|
||||
drawSource(dc, col1, line2, CFN_PARAM(cfn), COLOR_THEME_PRIMARY1);
|
||||
break;
|
||||
|
||||
case FUNC_HAPTIC:
|
||||
dc->drawNumber(col1, line2, CFN_PARAM(cfn), 0);
|
||||
dc->drawNumber(col1, line2, CFN_PARAM(cfn), COLOR_THEME_PRIMARY1);
|
||||
break;
|
||||
|
||||
case FUNC_LOGS:
|
||||
dc->drawNumber(col3, line1, CFN_PARAM(cfn), PREC1,
|
||||
sizeof(CFN_PARAM(cfn)), nullptr, "s");
|
||||
dc->drawNumber(col3, line1, CFN_PARAM(cfn), COLOR_THEME_PRIMARY1 | PREC1, sizeof(CFN_PARAM(cfn)), nullptr, "s");
|
||||
break;
|
||||
|
||||
case FUNC_ADJUST_GVAR:
|
||||
switch(CFN_GVAR_MODE(cfn)) {
|
||||
case FUNC_ADJUST_GVAR_CONSTANT:
|
||||
dc->drawNumber(col1, line2, CFN_PARAM(cfn), 0);
|
||||
dc->drawNumber(col1, line2, CFN_PARAM(cfn), COLOR_THEME_PRIMARY1);
|
||||
break;
|
||||
case FUNC_ADJUST_GVAR_SOURCE:
|
||||
drawSource(dc, col1, line2, CFN_PARAM(cfn), 0);
|
||||
drawSource(dc, col1, line2, CFN_PARAM(cfn), COLOR_THEME_PRIMARY1);
|
||||
break;
|
||||
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;
|
||||
case FUNC_ADJUST_GVAR_INCDEC: {
|
||||
int16_t value = CFN_PARAM(cfn);
|
||||
std::string text(value >= 0 ? "+= " : "-= ");
|
||||
text += std::to_string(abs(value));
|
||||
dc->drawText(col1, line2, text.c_str());
|
||||
dc->drawText(col1, line2, text.c_str(), COLOR_THEME_PRIMARY1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -582,13 +564,11 @@ class SpecialFunctionButton : public Button
|
||||
theme->drawCheckBox(dc, CFN_ACTIVE(cfn), col3, line2);
|
||||
} else if (HAS_REPEAT_PARAM(func)) {
|
||||
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) {
|
||||
dc->drawText(col3, line2, "!1x", 0);
|
||||
dc->drawText(col3, line2, "!1x", COLOR_THEME_PRIMARY1);
|
||||
} else {
|
||||
dc->drawNumber(col3 + 12, line2,
|
||||
CFN_PLAY_REPEAT(cfn) * CFN_PLAY_REPEAT_MUL, 0 | RIGHT, 0,
|
||||
nullptr, "s");
|
||||
dc->drawNumber(col3 + 12, line2, CFN_PLAY_REPEAT(cfn) * CFN_PLAY_REPEAT_MUL, COLOR_THEME_PRIMARY1 | RIGHT, 0, nullptr, "s");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -673,8 +653,7 @@ void SpecialFunctionsPage::build(FormWindow *window, int8_t focusIndex)
|
||||
});
|
||||
grid.spacer(button->height() + 5);
|
||||
} else {
|
||||
auto txt = new StaticText(window, grid.getLabelSlot(), s,
|
||||
BUTTON_BACKGROUND, CENTERED);
|
||||
auto txt = new StaticText(window, grid.getLabelSlot(), s, BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED);
|
||||
|
||||
auto button =
|
||||
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);
|
||||
} else {
|
||||
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
|
||||
txt->setTextFlags(CENTERED);
|
||||
txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
|
||||
}
|
||||
txt->invalidate();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user