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

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

Before

Width:  |  Height:  |  Size: 427 B

After

Width:  |  Height:  |  Size: 373 B

+25
View File
@@ -503,3 +503,28 @@ void drawHexNumber(BitmapBuffer * dc, coord_t x, coord_t y, uint32_t val, LcdFla
x = dc->drawSizedText(x, y, &c, 1, flags);
}
}
void drawTextLines(BitmapBuffer * dc, coord_t left, coord_t top, coord_t width, coord_t height, char * str, LcdFlags flags)
{
coord_t x = left;
coord_t y = top;
coord_t line = getFontHeight(flags & 0xFFFF);
coord_t space = getTextWidth(" ", 1, flags);
coord_t word;
char * eos = str + strlen(str);
char * nxt;
while (str < eos) {
nxt = strstr(str, " ");
if (!nxt) nxt = eos;
word = getTextWidth(str, nxt - str, flags);
if (x + word > left + width && x > left) {
x = left;
y += line;
}
if (y + line > top + height) break;
dc->drawSizedText(x, y, str, nxt - str, flags);
str = nxt + 1;
x += word + space;
}
}
+1
View File
@@ -72,6 +72,7 @@ void drawGPSPosition(BitmapBuffer * dc, coord_t x, coord_t y, int32_t longitude,
void drawDate(BitmapBuffer * dc, coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags flags = 0);
void drawValueWithUnit(BitmapBuffer * dc, coord_t x, coord_t y, int val, uint8_t unit, LcdFlags flags = 0);
void drawHexNumber(BitmapBuffer * dc, coord_t x, coord_t y, uint32_t val, LcdFlags flags = 0);
void drawTextLines(BitmapBuffer * dc, coord_t left, coord_t top, coord_t width, coord_t height, char * str, LcdFlags flags);
inline void drawChn(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t idx, LcdFlags flags)
{
drawSource(dc, x, y, MIXSRC_CH1 + idx - 1, flags);
+11 -11
View File
@@ -71,13 +71,13 @@ class CurveEditWindow : public Page
grid.spacer(PAGE_PADDING);
// 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();
});
+5 -5
View File
@@ -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),
+8 -8
View File
@@ -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) {
+8 -8
View File
@@ -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();
+13 -13
View File
@@ -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();
+1 -1
View File
@@ -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();
});
+12 -17
View File
@@ -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();
@@ -101,17 +101,15 @@ class ScriptEditWindow : public Page {
ScriptInputsOutputs& sio = scriptInputsOutputs[idx];
if (sio.inputsCount > 0) {
new Subtitle(window, grid.getLineSlot(), STR_INPUTS);
new Subtitle(window, grid.getLineSlot(), STR_INPUTS, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
auto gInputs =
new FormGroup(window, grid.getFieldSlot(),
FORM_BORDER_FOCUS_ONLY | PAINT_CHILDREN_FIRST);
auto gInputs = new FormGroup(window, grid.getFieldSlot(), FORM_BORDER_FOCUS_ONLY | PAINT_CHILDREN_FIRST);
GridLayout inputsGrid(gInputs);
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,
@@ -128,7 +126,7 @@ class ScriptEditWindow : public Page {
}
if (sio.outputsCount > 0) {
new Subtitle(window, grid.getLabelSlot(), STR_OUTPUTS);
new Subtitle(window, grid.getLabelSlot(), STR_OUTPUTS, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
auto gOutputs =
@@ -140,12 +138,10 @@ class ScriptEditWindow : public Page {
ScriptOutput* so = &(sio.outputs[i]);
new DynamicText(gOutputs, outputsGrid.getLabelSlot(), [=]() {
char s[16];
getSourceString(s,
MIXSRC_FIRST_LUA + (idx * MAX_SCRIPT_OUTPUTS) + i);
getSourceString(s, MIXSRC_FIRST_LUA + (idx * MAX_SCRIPT_OUTPUTS) + i);
return std::string(s, sizeof(s) - 1);
});
new DynamicNumber<int>(gOutputs, outputsGrid.getFieldSlot(),
[=]() { return calcRESXto1000(so->value); });
}, COLOR_THEME_PRIMARY1);
new DynamicNumber<int>(gOutputs, outputsGrid.getFieldSlot(), [=]() { return calcRESXto1000(so->value); }, COLOR_THEME_PRIMARY1);
outputsGrid.nextLine();
}
@@ -200,8 +196,7 @@ class ScriptLineButton : public Button
switch (runtimeData->state) {
case SCRIPT_SYNTAX_ERROR:
dc->drawSizedText(x, y, SCRIPT_STATUS_ERROR,
sizeof(SCRIPT_STATUS_ERROR), textColor);
dc->drawSizedText(x, y, SCRIPT_STATUS_ERROR, sizeof(SCRIPT_STATUS_ERROR), textColor);
break;
default:
dc->drawNumber(x, y, runtimeData->instructions, textColor, 0, nullptr, "%");
@@ -253,7 +248,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 +274,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();
});
+17 -17
View File
@@ -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();
+10 -10
View File
@@ -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();
});
+68 -67
View File
@@ -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}));
}
+36 -36
View File
@@ -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,10 +177,10 @@ 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);
drawHexNumber(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, flags);
});
new NumberEdit(sensorParametersWindow, grid.getFieldSlot(2, 1), 0, 0xff, GET_SET_DEFAULT(sensor->instance));
grid.nextLine();
@@ -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,
+28 -30
View File
@@ -37,7 +37,7 @@
class SwitchDynamicLabel: public StaticText {
public:
SwitchDynamicLabel(Window * parent, const rect_t & rect, uint8_t index):
StaticText(parent, rect),
StaticText(parent, rect, "", 0, COLOR_THEME_PRIMARY1),
index(index)
{
update();
@@ -108,7 +108,7 @@ class BluetoothConfigWindow : public FormGroup
#endif
clear();
new StaticText(this, grid.getLabelSlot(true), STR_MODE);
new StaticText(this, grid.getLabelSlot(true), STR_MODE, 0, COLOR_THEME_PRIMARY1);
btMode = new Choice(this, grid.getFieldSlot(), STR_BLUETOOTH_MODES, BLUETOOTH_OFF, BLUETOOTH_TRAINER, GET_DEFAULT(g_eeGeneral.bluetoothMode), [=](int32_t newValue) {
g_eeGeneral.bluetoothMode = newValue;
update();
@@ -120,23 +120,23 @@ class BluetoothConfigWindow : public FormGroup
if (g_eeGeneral.bluetoothMode != BLUETOOTH_OFF) {
// Pin code (displayed for information only, not editable)
if (g_eeGeneral.bluetoothMode == BLUETOOTH_TELEMETRY) {
new StaticText(this, grid.getLabelSlot(true), STR_BLUETOOTH_PIN_CODE);
new StaticText(this, grid.getFieldSlot(), "000000");
new StaticText(this, grid.getLabelSlot(true), STR_BLUETOOTH_PIN_CODE, 0, COLOR_THEME_PRIMARY1);
new StaticText(this, grid.getFieldSlot(), "000000", 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
}
// Local MAC
new StaticText(this, grid.getLabelSlot(true), STR_BLUETOOTH_LOCAL_ADDR);
new StaticText(this, grid.getFieldSlot(), bluetooth.localAddr[0] == '\0' ? "---" : bluetooth.localAddr);
new StaticText(this, grid.getLabelSlot(true), STR_BLUETOOTH_LOCAL_ADDR, 0, COLOR_THEME_PRIMARY1);
new StaticText(this, grid.getFieldSlot(), bluetooth.localAddr[0] == '\0' ? "---" : bluetooth.localAddr, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
// Remote MAC
new StaticText(this, grid.getLabelSlot(true), STR_BLUETOOTH_DIST_ADDR);
new StaticText(this, grid.getFieldSlot(), bluetooth.distantAddr[0] == '\0' ? "---" : bluetooth.distantAddr);
new StaticText(this, grid.getLabelSlot(true), STR_BLUETOOTH_DIST_ADDR, 0, COLOR_THEME_PRIMARY1);
new StaticText(this, grid.getFieldSlot(), bluetooth.distantAddr[0] == '\0' ? "---" : bluetooth.distantAddr, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
// BT radio name
new StaticText(this, grid.getLabelSlot(true), STR_NAME);
new StaticText(this, grid.getLabelSlot(true), STR_NAME, 0, COLOR_THEME_PRIMARY1);
new RadioTextEdit(this, grid.getFieldSlot(), g_eeGeneral.bluetoothName, LEN_BLUETOOTH_NAME);
grid.nextLine();
}
@@ -160,7 +160,7 @@ void RadioHardwarePage::build(FormWindow * window)
grid.spacer(PAGE_PADDING);
// Calibration
new StaticText(window, grid.getLabelSlot(), STR_INPUTS, 0, FONT(BOLD));
new StaticText(window, grid.getLabelSlot(), STR_INPUTS, 0, COLOR_THEME_PRIMARY1 | FONT(BOLD));
auto calib = new TextButton(window, grid.getFieldSlot(), STR_CALIBRATION);
calib->setPressHandler([=]() -> uint8_t {
auto calibrationPage = new RadioCalibrationPage();
@@ -172,19 +172,19 @@ void RadioHardwarePage::build(FormWindow * window)
grid.nextLine();
// Sticks
new Subtitle(window, grid.getLineSlot(), STR_STICKS);
new Subtitle(window, grid.getLineSlot(), STR_STICKS, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
for (int i = 0; i < NUM_STICKS; i++) {
new StaticText(window, grid.getLabelSlot(true), TEXT_AT_INDEX(STR_VSRCRAW, (i + 1)));
new StaticText(window, grid.getLabelSlot(true), TEXT_AT_INDEX(STR_VSRCRAW, (i + 1)), 0, COLOR_THEME_PRIMARY1);
new RadioTextEdit(window, grid.getFieldSlot(2,0), g_eeGeneral.anaNames[i], LEN_ANA_NAME);
grid.nextLine();
}
// Pots
new Subtitle(window, grid.getLineSlot(), STR_POTS);
new Subtitle(window, grid.getLineSlot(), STR_POTS, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
for (int i = 0; i < NUM_POTS; i++) {
new StaticText(window, grid.getLabelSlot(true), TEXT_AT_INDEX(STR_VSRCRAW, (i + NUM_STICKS + 1)));
new StaticText(window, grid.getLabelSlot(true), TEXT_AT_INDEX(STR_VSRCRAW, (i + NUM_STICKS + 1)), 0, COLOR_THEME_PRIMARY1);
new RadioTextEdit(window, grid.getFieldSlot(2,0), g_eeGeneral.anaNames[i + NUM_STICKS], LEN_ANA_NAME);
new Choice(window, grid.getFieldSlot(2,1), STR_POTTYPES, POT_NONE, POT_WITHOUT_DETENT,
[=]() -> int {
@@ -198,14 +198,12 @@ void RadioHardwarePage::build(FormWindow * window)
}
// Sliders
new Subtitle(window, grid.getLineSlot(), STR_SLIDERS);
new Subtitle(window, grid.getLineSlot(), STR_SLIDERS, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
for (int i = 0; i < NUM_SLIDERS; i++) {
const int idx = i + NUM_STICKS + NUM_POTS;
new StaticText(window, grid.getLabelSlot(true),
TEXT_AT_INDEX(STR_VSRCRAW, idx + 1));
new RadioTextEdit(window, grid.getFieldSlot(2, 0),
g_eeGeneral.anaNames[idx], LEN_ANA_NAME);
new StaticText(window, grid.getLabelSlot(true), TEXT_AT_INDEX(STR_VSRCRAW, idx + 1), 0, COLOR_THEME_PRIMARY1);
new RadioTextEdit(window, grid.getFieldSlot(2, 0), g_eeGeneral.anaNames[idx], LEN_ANA_NAME);
new Choice(
window, grid.getFieldSlot(2, 1), STR_SLIDERTYPES, SLIDER_NONE,
SLIDER_WITH_DETENT,
@@ -223,7 +221,7 @@ void RadioHardwarePage::build(FormWindow * window)
}
// Switches
new Subtitle(window, grid.getLineSlot(), STR_SWITCHES);
new Subtitle(window, grid.getLineSlot(), STR_SWITCHES, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
for (int i = 0; i < NUM_SWITCHES; i++) {
new SwitchDynamicLabel(window, grid.getLabelSlot(true), i);
@@ -241,7 +239,7 @@ void RadioHardwarePage::build(FormWindow * window)
}
// Bat calibration
new StaticText(window, grid.getLabelSlot(), STR_BATT_CALIB);
new StaticText(window, grid.getLabelSlot(), STR_BATT_CALIB, 0, COLOR_THEME_PRIMARY1);
auto batCal = new NumberEdit(window, grid.getFieldSlot(1,0), -127, 127, GET_SET_DEFAULT(g_eeGeneral.txVoltageCalibration));
batCal->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, getBatteryVoltage(), flags | PREC2, 0, nullptr, "V");
@@ -250,20 +248,20 @@ void RadioHardwarePage::build(FormWindow * window)
grid.nextLine();
// RTC Batt display
new StaticText(window, grid.getLabelSlot(), STR_RTC_BATT);
new StaticText(window, grid.getLabelSlot(), STR_RTC_BATT, 0, COLOR_THEME_PRIMARY1);
new DynamicNumber<uint16_t>(window, grid.getFieldSlot(1,0), [] {
return getRTCBatteryVoltage();
}, PREC2, nullptr, "V");
}, COLOR_THEME_PRIMARY1 | PREC2, nullptr, "V");
grid.nextLine();
// RTC Batt check enable
new StaticText(window, grid.getLabelSlot(), STR_RTC_CHECK);
new StaticText(window, grid.getLabelSlot(), STR_RTC_CHECK, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(1,0), GET_SET_INVERTED(g_eeGeneral.disableRtcWarning ));
grid.nextLine();
#if defined(CROSSFIRE) && SPORT_MAX_BAUDRATE < 400000
// Max baud for external modules
new StaticText(window, grid.getLabelSlot(), STR_MAXBAUDRATE);
new StaticText(window, grid.getLabelSlot(), STR_MAXBAUDRATE, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(1,0), STR_CRSF_BAUDRATE, 0, 1, GET_SET_DEFAULT(g_eeGeneral.telemetryBaudrate));
grid.nextLine();
#endif
@@ -271,14 +269,14 @@ void RadioHardwarePage::build(FormWindow * window)
#if defined(BLUETOOTH)
// Bluetooth mode
{
new Subtitle(window, grid.getLineSlot(), STR_BLUETOOTH);
new Subtitle(window, grid.getLineSlot(), STR_BLUETOOTH, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
grid.addWindow(new BluetoothConfigWindow(window, {0, grid.getWindowHeight(), LCD_W, 0}));
}
#endif
#if defined(AUX_SERIAL)
new StaticText(window, grid.getLabelSlot(), STR_AUX_SERIAL_MODE);
new StaticText(window, grid.getLabelSlot(), STR_AUX_SERIAL_MODE, 0, COLOR_THEME_PRIMARY1);
auto aux =
new Choice(window, grid.getFieldSlot(1, 0), STR_AUX_SERIAL_MODES, 0,
UART_MODE_MAX, GET_DEFAULT(g_eeGeneral.auxSerialMode),
@@ -292,7 +290,7 @@ void RadioHardwarePage::build(FormWindow * window)
#endif
#if defined(AUX2_SERIAL)
new StaticText(window, grid.getLabelSlot(), STR_AUX2_SERIAL_MODE);
new StaticText(window, grid.getLabelSlot(), STR_AUX2_SERIAL_MODE, 0, COLOR_THEME_PRIMARY1);
auto aux2 =
new Choice(window, grid.getFieldSlot(1, 0), STR_AUX_SERIAL_MODES, 0,
UART_MODE_MAX, GET_DEFAULT(g_eeGeneral.aux2SerialMode),
@@ -311,12 +309,12 @@ void RadioHardwarePage::build(FormWindow * window)
#endif
// ADC filter
new StaticText(window, grid.getLabelSlot(), STR_JITTER_FILTER);
new StaticText(window, grid.getLabelSlot(), STR_JITTER_FILTER, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(1,0), GET_SET_INVERTED(g_eeGeneral.jitterFilter));
grid.nextLine();
// Debugs
new StaticText(window, grid.getLabelSlot(), STR_DEBUG, 0, FONT(BOLD));
new StaticText(window, grid.getLabelSlot(), STR_DEBUG, 0, COLOR_THEME_PRIMARY1 | FONT(BOLD));
auto debugAnas = new TextButton(window, grid.getFieldSlot(2, 0), STR_ANALOGS_BTN);
debugAnas->setPressHandler([=]() -> uint8_t {
auto debugAnalogsPage = new RadioAnalogsDiagsPage();
+44 -44
View File
@@ -52,7 +52,7 @@ class DateTimeWindow : public FormGroup {
FormGridLayout grid;
// Date
new StaticText(this, grid.getLabelSlot(), STR_DATE);
new StaticText(this, grid.getLabelSlot(), STR_DATE, 0, COLOR_THEME_PRIMARY1);
new NumberEdit(this, grid.getFieldSlot(3, 0), 2018, 2100,
[=]() -> int32_t {
struct gtm t;
@@ -105,7 +105,7 @@ class DateTimeWindow : public FormGroup {
grid.nextLine();
// Time
new StaticText(this, grid.getLabelSlot(), STR_TIME);
new StaticText(this, grid.getLabelSlot(), STR_TIME, 0, COLOR_THEME_PRIMARY1);
auto hour = new NumberEdit(this, grid.getFieldSlot(3, 0), 0, 24,
[=]() -> int32_t {
struct gtm t;
@@ -171,7 +171,7 @@ void RadioSetupPage::build(FormWindow * window)
grid.addWindow(timeWindow);
// Batt meter range - Range 3.0v to 16v
new StaticText(window, grid.getLabelSlot(), STR_BATTERY_RANGE);
new StaticText(window, grid.getLabelSlot(), STR_BATTERY_RANGE, 0, COLOR_THEME_PRIMARY1);
auto batMinEdit = new NumberEdit(window, grid.getFieldSlot(2, 0), -60 + 90, g_eeGeneral.vBatMax + 29 + 90, GET_SET_WITH_OFFSET(g_eeGeneral.vBatMin, 90), 0, PREC1);
batMinEdit->setSuffix("V");
auto batMaxEdit = new NumberEdit(window, grid.getFieldSlot(2, 1), g_eeGeneral.vBatMin - 29 + 120, 40 + 120, GET_SET_WITH_OFFSET(g_eeGeneral.vBatMax, 120), 0, PREC1);
@@ -190,31 +190,31 @@ void RadioSetupPage::build(FormWindow * window)
});
grid.nextLine();
new Subtitle(window, grid.getLabelSlot(), STR_SOUND_LABEL);
new Subtitle(window, grid.getLabelSlot(), STR_SOUND_LABEL, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
// Beeps mode
new StaticText(window, grid.getLabelSlot(true), STR_SPEAKER);
new StaticText(window, grid.getLabelSlot(true), STR_SPEAKER, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), STR_VBEEPMODE, -2, 1, GET_SET_DEFAULT(g_eeGeneral.beepMode));
grid.nextLine();
// Main volume
new StaticText(window, grid.getLabelSlot(true), STR_VOLUME);
new StaticText(window, grid.getLabelSlot(true), STR_VOLUME, 0, COLOR_THEME_PRIMARY1);
new Slider(window, grid.getFieldSlot(), -VOLUME_LEVEL_DEF, VOLUME_LEVEL_MAX-VOLUME_LEVEL_DEF, GET_SET_DEFAULT(g_eeGeneral.speakerVolume));
grid.nextLine();
// Beeps volume
new StaticText(window, grid.getLabelSlot(true), STR_BEEP_VOLUME);
new StaticText(window, grid.getLabelSlot(true), STR_BEEP_VOLUME, 0, COLOR_THEME_PRIMARY1);
new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.beepVolume));
grid.nextLine();
// Beeps length
new StaticText(window, grid.getLabelSlot(true), STR_BEEP_LENGTH);
new StaticText(window, grid.getLabelSlot(true), STR_BEEP_LENGTH, 0, COLOR_THEME_PRIMARY1);
new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.beepLength));
grid.nextLine();
// Beeps pitch
new StaticText(window, grid.getLabelSlot(true), STR_BEEP_PITCH);
new StaticText(window, grid.getLabelSlot(true), STR_BEEP_PITCH, 0, COLOR_THEME_PRIMARY1);
auto edit = new NumberEdit(window, grid.getFieldSlot(), 0, 300,
GET_DEFAULT(15 * g_eeGeneral.speakerPitch),
[=](int32_t newValue) {
@@ -227,26 +227,26 @@ void RadioSetupPage::build(FormWindow * window)
grid.nextLine();
// Wav volume
new StaticText(window, grid.getLabelSlot(true), STR_WAV_VOLUME);
new StaticText(window, grid.getLabelSlot(true), STR_WAV_VOLUME, 0, COLOR_THEME_PRIMARY1);
new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.wavVolume));
grid.nextLine();
// Background volume
new StaticText(window, grid.getLabelSlot(true), STR_BG_VOLUME);
new StaticText(window, grid.getLabelSlot(true), STR_BG_VOLUME, 0, COLOR_THEME_PRIMARY1);
new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.backgroundVolume));
grid.nextLine();
#if defined(VARIO)
{
new Subtitle(window, grid.getLabelSlot(), STR_VARIO);
new Subtitle(window, grid.getLabelSlot(), STR_VARIO, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
// Vario volume
new StaticText(window, grid.getLabelSlot(true), TR_VOLUME);
new StaticText(window, grid.getLabelSlot(true), TR_VOLUME, 0, COLOR_THEME_PRIMARY1);
new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.varioVolume));
grid.nextLine();
new StaticText(window, grid.getLabelSlot(true), STR_PITCH_AT_ZERO);
new StaticText(window, grid.getLabelSlot(true), STR_PITCH_AT_ZERO, 0, COLOR_THEME_PRIMARY1);
edit = new NumberEdit(window, grid.getFieldSlot(), VARIO_FREQUENCY_ZERO - 400, VARIO_FREQUENCY_ZERO + 400,
GET_DEFAULT(VARIO_FREQUENCY_ZERO + (g_eeGeneral.varioPitch * 10)),
SET_VALUE(g_eeGeneral.varioPitch, (newValue - VARIO_FREQUENCY_ZERO) / 10));
@@ -254,7 +254,7 @@ void RadioSetupPage::build(FormWindow * window)
edit->setSuffix("Hz");
grid.nextLine();
new StaticText(window, grid.getLabelSlot(true), STR_PITCH_AT_MAX);
new StaticText(window, grid.getLabelSlot(true), STR_PITCH_AT_MAX, 0, COLOR_THEME_PRIMARY1);
edit = new NumberEdit(window, grid.getFieldSlot(), 900, 2500,
GET_DEFAULT(VARIO_FREQUENCY_ZERO + (g_eeGeneral.varioPitch * 10) + VARIO_FREQUENCY_RANGE + (g_eeGeneral.varioRange * 10)),
SET_VALUE(g_eeGeneral.varioRange, (newValue - VARIO_FREQUENCY_ZERO - VARIO_FREQUENCY_RANGE) / 10 - g_eeGeneral.varioPitch ));
@@ -262,7 +262,7 @@ void RadioSetupPage::build(FormWindow * window)
edit->setSuffix("Hz");
grid.nextLine();
new StaticText(window, grid.getLabelSlot(true), STR_REPEAT_AT_ZERO);
new StaticText(window, grid.getLabelSlot(true), STR_REPEAT_AT_ZERO, 0, COLOR_THEME_PRIMARY1);
edit = new NumberEdit(window, grid.getFieldSlot(), 200, 1000,
GET_DEFAULT(VARIO_REPEAT_ZERO + (g_eeGeneral.varioRepeat * 10)),
SET_VALUE(g_eeGeneral.varioRepeat, (newValue - VARIO_REPEAT_ZERO) / 10));
@@ -274,21 +274,21 @@ void RadioSetupPage::build(FormWindow * window)
#if defined(HAPTIC)
{
new Subtitle(window, grid.getLabelSlot(), STR_HAPTIC_LABEL);
new Subtitle(window, grid.getLabelSlot(), STR_HAPTIC_LABEL, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
// Haptic mode
new StaticText(window, grid.getLabelSlot(true), STR_MODE);
new StaticText(window, grid.getLabelSlot(true), STR_MODE, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), STR_VBEEPMODE, -2, 1, GET_SET_DEFAULT(g_eeGeneral.hapticMode));
grid.nextLine();
// Haptic duration
new StaticText(window, grid.getLabelSlot(true), STR_LENGTH);
new StaticText(window, grid.getLabelSlot(true), STR_LENGTH, 0, COLOR_THEME_PRIMARY1);
new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.hapticLength));
grid.nextLine();
// Haptic strength
new StaticText(window, grid.getLabelSlot(true), STR_STRENGTH);
new StaticText(window, grid.getLabelSlot(true), STR_STRENGTH, 0, COLOR_THEME_PRIMARY1);
new Slider(window, grid.getFieldSlot(), -2, +2, GET_SET_DEFAULT(g_eeGeneral.hapticStrength));
grid.nextLine();
}
@@ -296,39 +296,39 @@ void RadioSetupPage::build(FormWindow * window)
// Alarms
{
new Subtitle(window, grid.getLabelSlot(), STR_ALARMS_LABEL);
new Subtitle(window, grid.getLabelSlot(), STR_ALARMS_LABEL, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
// Battery warning
new StaticText(window, grid.getLabelSlot(true), STR_BATTERYWARNING);
new StaticText(window, grid.getLabelSlot(true), STR_BATTERYWARNING, 0, COLOR_THEME_PRIMARY1);
edit = new NumberEdit(window, grid.getFieldSlot(), 30, 120, GET_SET_DEFAULT(g_eeGeneral.vBatWarn), 0, PREC1);
edit->setSuffix("V");
grid.nextLine();
// Inactivity alarm
new StaticText(window, grid.getLabelSlot(true), STR_INACTIVITYALARM);
new StaticText(window, grid.getLabelSlot(true), STR_INACTIVITYALARM, 0, COLOR_THEME_PRIMARY1);
edit = new NumberEdit(window, grid.getFieldSlot(), 0, 250, GET_SET_DEFAULT(g_eeGeneral.inactivityTimer));
edit->setSuffix("minutes");
grid.nextLine();
// Alarms warning
new StaticText(window, grid.getLabelSlot(true), STR_ALARMWARNING);
new StaticText(window, grid.getLabelSlot(true), STR_ALARMWARNING, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(), GET_SET_INVERTED(g_eeGeneral.disableAlarmWarning));
grid.nextLine();
// RSSI shutdown alarm
new StaticText(window, grid.getLabelSlot(true), STR_RSSI_SHUTDOWN_ALARM);
new StaticText(window, grid.getLabelSlot(true), STR_RSSI_SHUTDOWN_ALARM, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(), GET_SET_INVERTED(g_eeGeneral.disableRssiPoweroffAlarm));
grid.nextLine();
}
// Backlight
{
new Subtitle(window, grid.getLabelSlot(), STR_BACKLIGHT_LABEL);
new Subtitle(window, grid.getLabelSlot(), STR_BACKLIGHT_LABEL, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
// Backlight mode
new StaticText(window, grid.getLabelSlot(true), STR_MODE);
new StaticText(window, grid.getLabelSlot(true), STR_MODE, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(2,0), STR_VBLMODE, e_backlight_mode_off, e_backlight_mode_on, GET_SET_DEFAULT(g_eeGeneral.backlightMode));
//grid.nextLine();
@@ -341,7 +341,7 @@ void RadioSetupPage::build(FormWindow * window)
grid.nextLine();
// Backlight ON bright
new StaticText(window, grid.getLabelSlot(true), STR_BLONBRIGHTNESS);
new StaticText(window, grid.getLabelSlot(true), STR_BLONBRIGHTNESS, 0, COLOR_THEME_PRIMARY1);
new Slider(window, grid.getFieldSlot(), BACKLIGHT_LEVEL_MIN, BACKLIGHT_LEVEL_MAX,
[=]() -> int32_t {
return BACKLIGHT_LEVEL_MAX - g_eeGeneral.backlightBright;
@@ -352,19 +352,19 @@ void RadioSetupPage::build(FormWindow * window)
grid.nextLine();
// Backlight OFF bright
new StaticText(window, grid.getLabelSlot(true), STR_BLOFFBRIGHTNESS);
new StaticText(window, grid.getLabelSlot(true), STR_BLOFFBRIGHTNESS, 0, COLOR_THEME_PRIMARY1);
new Slider(window, grid.getFieldSlot(), BACKLIGHT_LEVEL_MIN, BACKLIGHT_LEVEL_MAX, GET_SET_DEFAULT(g_eeGeneral.blOffBright));
grid.nextLine();
#if defined(KEYS_BACKLIGHT_GPIO)
// Keys backlight
new StaticText(window, grid.getLabelSlot(true), STR_KEYS_BACKLIGHT);
new StaticText(window, grid.getLabelSlot(true), STR_KEYS_BACKLIGHT, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_eeGeneral.keysBacklight));
grid.nextLine();
#endif
// Flash beep
new StaticText(window, grid.getLabelSlot(true), STR_ALARM);
new StaticText(window, grid.getLabelSlot(true), STR_ALARM, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_eeGeneral.alarmsFlash));
grid.nextLine();
}
@@ -372,7 +372,7 @@ void RadioSetupPage::build(FormWindow * window)
#if defined(PWR_BUTTON_PRESS)
// Pwr Off Delay
{
new StaticText(window, grid.getLabelSlot(), STR_PWR_OFF_DELAY);
new StaticText(window, grid.getLabelSlot(), STR_PWR_OFF_DELAY, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), STR_PWR_OFF_DELAYS, 0, 3,
[=]() -> int32_t {
return 2 - g_eeGeneral.pwrOffSpeed;
@@ -388,21 +388,21 @@ void RadioSetupPage::build(FormWindow * window)
#if defined(INTERNAL_GPS)
// GPS
{
new Subtitle(window, grid.getLabelSlot(), STR_GPS);
new Subtitle(window, grid.getLabelSlot(), STR_GPS, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
// Timezone
new StaticText(window, grid.getLabelSlot(true), STR_TIMEZONE);
new StaticText(window, grid.getLabelSlot(true), STR_TIMEZONE, 0, COLOR_THEME_PRIMARY1);
new NumberEdit(window, grid.getFieldSlot(), -12, 12, GET_SET_DEFAULT(g_eeGeneral.timezone));
grid.nextLine();
// Adjust RTC (from telemetry)
new StaticText(window, grid.getLabelSlot(true), STR_ADJUST_RTC);
new StaticText(window, grid.getLabelSlot(true), STR_ADJUST_RTC, 0, COLOR_THEME_PRIMARY1);
new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_eeGeneral.adjustRTC));
grid.nextLine();
// GPS format
new StaticText(window, grid.getLabelSlot(true), STR_GPS_COORDS_FORMAT);
new StaticText(window, grid.getLabelSlot(true), STR_GPS_COORDS_FORMAT, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), STR_GPSFORMAT, 0, 1, GET_SET_DEFAULT(g_eeGeneral.gpsFormat));
grid.nextLine();
}
@@ -410,18 +410,18 @@ void RadioSetupPage::build(FormWindow * window)
#if defined(PXX2)
// Owner ID
new StaticText(window, grid.getLabelSlot(), STR_OWNER_ID);
new StaticText(window, grid.getLabelSlot(), STR_OWNER_ID, 0, COLOR_THEME_PRIMARY1);
new RadioTextEdit(window, grid.getFieldSlot(), g_eeGeneral.ownerRegistrationID, PXX2_LEN_REGISTRATION_ID);
grid.nextLine();
#endif
// Country code
new StaticText(window, grid.getLabelSlot(), STR_COUNTRY_CODE);
new StaticText(window, grid.getLabelSlot(), STR_COUNTRY_CODE, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), STR_COUNTRY_CODES, 0, 2, GET_SET_DEFAULT(g_eeGeneral.countryCode));
grid.nextLine();
// Audio language
new StaticText(window, grid.getLabelSlot(), STR_VOICE_LANGUAGE);
new StaticText(window, grid.getLabelSlot(), STR_VOICE_LANGUAGE, 0, COLOR_THEME_PRIMARY1);
auto choice = new Choice(window, grid.getFieldSlot(), 0, DIM(languagePacks) - 2, GET_VALUE(currentLanguagePackIdx),
[](uint8_t newValue) {
currentLanguagePackIdx = newValue;
@@ -434,7 +434,7 @@ void RadioSetupPage::build(FormWindow * window)
grid.nextLine();
// Imperial units
new StaticText(window, grid.getLabelSlot(), STR_UNITS_SYSTEM);
new StaticText(window, grid.getLabelSlot(), STR_UNITS_SYSTEM, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), STR_VUNITSSYSTEM, 0, 1, GET_SET_DEFAULT(g_eeGeneral.imperial));
grid.nextLine();
@@ -455,18 +455,18 @@ void RadioSetupPage::build(FormWindow * window)
#endif
// Switches delay
new StaticText(window, grid.getLabelSlot(), STR_SWITCHES_DELAY);
new StaticText(window, grid.getLabelSlot(), STR_SWITCHES_DELAY, 0, COLOR_THEME_PRIMARY1);
edit = new NumberEdit(window, grid.getFieldSlot(2, 0), -15, 100 - 15, GET_SET_VALUE_WITH_OFFSET(g_eeGeneral.switchesDelay, 15));
edit->setSuffix(std::string("0") + STR_MS);
grid.nextLine();
// USB mode
new StaticText(window, grid.getLabelSlot(), STR_USBMODE);
new StaticText(window, grid.getLabelSlot(), STR_USBMODE, 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(), STR_USBMODES, USB_UNSELECTED_MODE, USB_MAX_MODE, GET_SET_DEFAULT(g_eeGeneral.USBMode));
grid.nextLine();
// RX channel order
new StaticText(window, grid.getLabelSlot(), STR_RXCHANNELORD); // RAET->AETR
new StaticText(window, grid.getLabelSlot(), STR_RXCHANNELORD, 0, COLOR_THEME_PRIMARY1); // RAET->AETR
choice = new Choice(window, grid.getFieldSlot(), 0, 4*3*2 - 1, GET_SET_DEFAULT(g_eeGeneral.templateSetup));
choice->setTextHandler([](uint8_t value) {
char s[5];
@@ -479,7 +479,7 @@ void RadioSetupPage::build(FormWindow * window)
grid.nextLine();
// Stick mode
new StaticText(window, grid.getLabelSlot(), STR_MODE);
new StaticText(window, grid.getLabelSlot(), STR_MODE, 0, COLOR_THEME_PRIMARY1);
choice = new Choice(window, grid.getFieldSlot(), 0, 3, GET_DEFAULT(g_eeGeneral.stickMode),
[=](uint8_t newValue) {
pausePulses();
+6 -6
View File
@@ -113,7 +113,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
label = getBasename(path);
}
auto txt = new StaticText(window, grid.getLabelSlot(), "lua",
BUTTON_BACKGROUND, CENTERED);
BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED);
std::string path_str(path);
auto b = new TextButton(
@@ -137,7 +137,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else {
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED);
txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
}
txt->invalidate();
});
@@ -181,7 +181,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
.information.modelID,
MODULE_OPTION_POWER_METER)) {
auto txt = new StaticText(window, grid.getLabelSlot(), "access",
BUTTON_BACKGROUND, CENTERED);
BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED);
auto b = new TextButton(
window, grid.getFieldSlot(1), STR_POWER_METER_INT,
[=]() -> uint8_t {
@@ -196,7 +196,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else {
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED);
txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
}
txt->invalidate();
});
@@ -206,7 +206,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
#if defined(INTERNAL_MODULE_MULTI)
{
auto txt = new StaticText(window, grid.getLabelSlot(), "multi",
BUTTON_BACKGROUND, CENTERED);
BUTTON_BACKGROUND, COLOR_THEME_PRIMARY1 | CENTERED);
auto b = new TextButton(
window, grid.getFieldSlot(1), STR_SPECTRUM_ANALYSER_INT,
[=]() -> uint8_t {
@@ -221,7 +221,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
txt->setTextFlags(COLOR_THEME_PRIMARY2 | CENTERED);
} else {
txt->setBackgroundColor(COLOR_THEME_SECONDARY2);
txt->setTextFlags(CENTERED);
txt->setTextFlags(COLOR_THEME_PRIMARY1 | CENTERED);
}
txt->invalidate();
});
+3 -3
View File
@@ -43,7 +43,7 @@ void RadioTrainerPage::build(FormWindow * window)
for (uint8_t i=0; i<NUM_STICKS; i++) {
uint8_t chan = channelOrder(i+1);
TrainerMix * td = &g_eeGeneral.trainer.mix[chan-1];
new StaticText(window, grid.getLabelSlot(), TEXT_AT_INDEX(STR_VSRCRAW, (i + 1)));
new StaticText(window, grid.getLabelSlot(), TEXT_AT_INDEX(STR_VSRCRAW, (i + 1)), 0, COLOR_THEME_PRIMARY1);
new Choice(window, grid.getFieldSlot(3,0), STR_TRNMODE, 0, 2, GET_SET_DEFAULT(td->mode));
auto weight = new NumberEdit(window, grid.getFieldSlot(3, 1), -125, 125, GET_SET_DEFAULT(td->studWeight));
weight->setSuffix("%");
@@ -53,7 +53,7 @@ void RadioTrainerPage::build(FormWindow * window)
grid.nextLine();
// Trainer multiplier
new StaticText(window, grid.getLabelSlot(), STR_MULTIPLIER);
new StaticText(window, grid.getLabelSlot(), STR_MULTIPLIER, 0, COLOR_THEME_PRIMARY1);
auto multiplier = new NumberEdit(window, grid.getFieldSlot(3, 0), -10, 40, GET_SET_DEFAULT(g_eeGeneral.PPM_Multiplier));
multiplier->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value+10, flags | PREC1, 0);
@@ -62,7 +62,7 @@ void RadioTrainerPage::build(FormWindow * window)
grid.nextLine();
// Trainer calibration
new StaticText(window, grid.getLabelSlot(), STR_CAL);
new StaticText(window, grid.getLabelSlot(), STR_CAL, 0, COLOR_THEME_PRIMARY1);
for (int i = 0; i < NUM_STICKS; i++) {
#if defined (PPM_UNIT_PERCENT_PREC1)
auto calib = new NumberEdit(window, grid.getFieldSlot(4, i), 0 , 0, [=]() { return (ppmInput[i]-g_eeGeneral.trainer.calib[i]) * 2; }, nullptr, 0, LEFT | PREC1);
+27 -27
View File
@@ -91,36 +91,36 @@ class versionDialog: public Dialog
// Module
if (module == INTERNAL_MODULE)
new StaticText(form, grid->getLineSlot(), STR_INTERNAL_MODULE);
new StaticText(form, grid->getLineSlot(), STR_INTERNAL_MODULE, 0, COLOR_THEME_PRIMARY1);
else
new StaticText(form, grid->getLineSlot(), STR_EXTERNAL_MODULE);
new StaticText(form, grid->getLineSlot(), STR_EXTERNAL_MODULE, 0, COLOR_THEME_PRIMARY1);
grid->nextLine();
new StaticText(form, grid->getLabelSlot(true), STR_MODULE);
new StaticText(form, grid->getLabelSlot(true), STR_MODULE, 0, COLOR_THEME_PRIMARY1);
if (g_model.moduleData[module].type == MODULE_TYPE_NONE) {
new StaticText(form, grid->getFieldSlot(1, 0), STR_OFF);
new StaticText(form, grid->getFieldSlot(1, 0), STR_OFF, 0, COLOR_THEME_PRIMARY1);
}
#if defined(HARDWARE_EXTERNAL_ACCESS_MOD)
else if (isModuleMultimodule(module)) {
char statusText[64];
new StaticText(form, grid->getFieldSlot(2, 0), "Multimodule");
new StaticText(form, grid->getFieldSlot(2, 0), "Multimodule", 0, COLOR_THEME_PRIMARY1);
getMultiModuleStatus(module).getStatusString(statusText);
new StaticText(form, grid->getFieldSlot(2, 1), statusText);
new StaticText(form, grid->getFieldSlot(2, 1), statusText, 0, COLOR_THEME_PRIMARY1);
}
#endif
else if (!isModulePXX2(module)) {
new StaticText(form, grid->getFieldSlot(1, 0), STR_NO_INFORMATION);
new StaticText(form, grid->getFieldSlot(1, 0), STR_NO_INFORMATION, 0, COLOR_THEME_PRIMARY1);
}
else {
// PXX2 Module
new StaticText(form, grid->getFieldSlot(4, 0), getPXX2ModuleName(reusableBuffer.hardwareAndSettings.modules[module].information.modelID));
new StaticText(form, grid->getFieldSlot(4, 0), getPXX2ModuleName(reusableBuffer.hardwareAndSettings.modules[module].information.modelID), 0, COLOR_THEME_PRIMARY1);
if (reusableBuffer.hardwareAndSettings.modules[module].information.modelID) {
new StaticText(form, grid->getFieldSlot(4, 1), getVersion(tmp, reusableBuffer.hardwareAndSettings.modules[module].information.hwVersion));
new StaticText(form, grid->getFieldSlot(4, 2), getVersion(tmp, reusableBuffer.hardwareAndSettings.modules[module].information.swVersion));
new StaticText(form, grid->getFieldSlot(4, 1), getVersion(tmp, reusableBuffer.hardwareAndSettings.modules[module].information.hwVersion), 0, COLOR_THEME_PRIMARY1);
new StaticText(form, grid->getFieldSlot(4, 2), getVersion(tmp, reusableBuffer.hardwareAndSettings.modules[module].information.swVersion), 0, COLOR_THEME_PRIMARY1);
static const char * variants[] = {"FCC", "EU", "FLEX"};
uint8_t variant = reusableBuffer.hardwareAndSettings.modules[module].information.variant - 1;
if (variant < DIM(variants)) {
new StaticText(form, grid->getFieldSlot(4, 3), variants[variant]);
new StaticText(form, grid->getFieldSlot(4, 3), variants[variant], 0, COLOR_THEME_PRIMARY1);
}
}
grid->nextLine();
@@ -129,13 +129,13 @@ class versionDialog: public Dialog
for (uint8_t receiver=0; receiver<PXX2_MAX_RECEIVERS_PER_MODULE; receiver++) {
if (reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.modelID) {
// Receiver model
new StaticText(form, grid->getLabelSlot(true), STR_RECEIVER);
new StaticText(form, grid->getLabelSlot(true), STR_RECEIVER, 0, COLOR_THEME_PRIMARY1);
uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.modelID;
new StaticText(form, grid->getFieldSlot(4, 0), getPXX2ReceiverName(modelId));
new StaticText(form, grid->getFieldSlot(4, 0), getPXX2ReceiverName(modelId), 0, COLOR_THEME_PRIMARY1);
// Receiver version
new StaticText(form, grid->getFieldSlot(4, 1), getVersion(tmp, reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.hwVersion));
new StaticText(form, grid->getFieldSlot(4, 2), getVersion(tmp, reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.swVersion));
new StaticText(form, grid->getFieldSlot(4, 1), getVersion(tmp, reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.hwVersion), 0, COLOR_THEME_PRIMARY1);
new StaticText(form, grid->getFieldSlot(4, 2), getVersion(tmp, reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.swVersion), 0, COLOR_THEME_PRIMARY1);
grid->nextLine();
}
}
@@ -168,7 +168,7 @@ class versionDialog: public Dialog
class OptionsText: public StaticText {
public:
OptionsText(Window * parent, const rect_t &rect) :
StaticText(parent, rect)
StaticText(parent, rect, "", 0, COLOR_THEME_PRIMARY1)
{
coord_t optionWidth = 0;
for (uint8_t i = 0; options[i]; i++) {
@@ -189,13 +189,13 @@ class OptionsText: public StaticText {
const char * option = options[i];
coord_t optionWidth = getTextWidth(option);
if (x + 5 + optionWidth > width()) {
dc->drawText(x, y, ",");
dc->drawText(x, y, ",", COLOR_THEME_PRIMARY1);
x = 0;
y += FH;
}
if (i > 0 && x != 0)
x = dc->drawText(x, y, ", ");
x = dc->drawText(x, y, option);
x = dc->drawText(x, y, ", ", COLOR_THEME_PRIMARY1);
x = dc->drawText(x, y, option, COLOR_THEME_PRIMARY1);
}
}
};
@@ -212,34 +212,34 @@ void RadioVersionPage::build(FormWindow * window)
grid.spacer(PAGE_PADDING);
// Radio type
new StaticText(window, grid.getLineSlot(), fw_stamp);
new StaticText(window, grid.getLineSlot(), fw_stamp, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
#if LCD_W > LCD_H
new StaticText(window, grid.getLineSlot(), vers_stamp);
new StaticText(window, grid.getLineSlot(), vers_stamp, 0, COLOR_THEME_PRIMARY1);
#else
memcpy(reusableBuffer.version.id, vers_stamp, strcspn(vers_stamp, " "));
new StaticText(window, grid.getFieldSlot(), reusableBuffer.version.id);
new StaticText(window, grid.getFieldSlot(), reusableBuffer.version.id, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
strAppend(reusableBuffer.version.id, strpbrk(vers_stamp, " "));
new StaticText(window, grid.getFieldSlot(), reusableBuffer.version.id);
new StaticText(window, grid.getFieldSlot(), reusableBuffer.version.id, 0, COLOR_THEME_PRIMARY1);
#endif
grid.nextLine();
// Firmware date
new StaticText(window, grid.getLineSlot(), date_stamp);
new StaticText(window, grid.getLineSlot(), date_stamp, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
// Firmware time
new StaticText(window, grid.getLineSlot(), time_stamp);
new StaticText(window, grid.getLineSlot(), time_stamp, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
// EEprom version
new StaticText(window, grid.getLineSlot(), eeprom_stamp);
new StaticText(window, grid.getLineSlot(), eeprom_stamp, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
// Firmware options
new StaticText(window, grid.getLabelSlot(), "OPTS:");
new StaticText(window, grid.getLabelSlot(), "OPTS:", 0, COLOR_THEME_PRIMARY1);
auto options = new OptionsText(window, grid.getFieldSlot(1,0));
grid.nextLine(options->height() + 4);
+2 -5
View File
@@ -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
+3 -2
View File
@@ -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)),
+50 -71
View File
@@ -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();
});
@@ -282,27 +282,6 @@ class Theme480: public OpenTxTheme
void update() const override
{
TRACE("TODO THEME::UPDATE()");
#if 0
uint32_t color = g_eeGeneral.themeData.options[1].value.unsignedValue;
uint32_t bg_color = UNEXPECTED_SHUTDOWN() ? WHITE : g_eeGeneral.themeData.options[0].value.unsignedValue;
lcdColorTable[COLOR_THEME_SECONDARY3_INDEX] = bg_color;
lcdColorTable[COLOR_THEME_FOCUS_INDEX] = color;
lcdColorTable[COLOR_THEME_FOCUS_INDEX] = color;
lcdColorTable[COLOR_THEME_PRIMARY3_INDEX] = color;
lcdColorTable[COLOR_THEME_SECONDARY1_INDEX] = color;
lcdColorTable[COLOR_THEME_WARNING_INDEX] = color;
lcdColorTable[COLOR_THEME_SECONDARY1_INDEX] = color;
lcdColorTable[COLOR_THEME_PRIMARY3_INDEX] =
RGB(GET_RED(color)>>1, GET_GREEN(color)>>1, GET_BLUE(color)>>1);
lcdColorTable[COLOR_THEME_FOCUS_INDEX] = color;
lcdColorTable[COLOR_THEME_SECONDARY1_INDEX] = color;
#define DARKER(x) ((x * 70) / 100)
lcdColorTable[COLOR_THEME_PRIMARY2_INDEX] = RGB(DARKER(GET_RED(color)), DARKER(GET_GREEN(color)), DARKER(GET_BLUE(color)));
lcdColorTable[COLOR_THEME_SECONDARY1_INDEX] = color;
lcdColorTable[COLOR_THEME_FOCUS_INDEX] = color;
#endif
loadIcons();
loadThemeBitmaps();
}
@@ -330,6 +330,6 @@ void ViewMainDecoration::createFlightMode()
return g_model.flightModeData[mixerCurrentFlightMode].name;
};
flightMode = new DynamicText(this, r, getFM, CENTERED);
flightMode = new DynamicText(this, r, getFM, CENTERED | COLOR_THEME_SECONDARY1);
}
+1 -3
View File
@@ -298,6 +298,7 @@ bool isLogicalSwitchAvailable(int index)
bool isSwitchAvailable(int swtch, SwitchContext context)
{
bool negative = false;
(void)negative;
if (swtch < 0) {
if (swtch == -SWSRC_ON || swtch == -SWSRC_ONE) {
@@ -319,9 +320,6 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
return false;
}
if (!IS_CONFIG_3POS(swinfo.quot)) {
if (negative) {
return false;
}
if (swinfo.rem == 1) {
// mid position not available for 2POS switches
return false;
+4 -2
View File
@@ -50,7 +50,9 @@ const char * logsOpen()
{
// Determine and set log file filename
FRESULT result;
char filename[sizeof(LOGS_PATH) + LEN_MODEL_NAME + 16]; // /LOGS/modelnamexxxxxx_2013-01-01.log
// /LOGS/modelnamexxxxxx_YYYY-MM-DD-HHMMSS.log
char filename[sizeof(LOGS_PATH) + LEN_MODEL_NAME + 18 + 4 + 1];
if (!sdMounted())
return STR_NO_SDCARD;
@@ -97,7 +99,7 @@ const char * logsOpen()
char * tmp = &filename[len];
#if defined(RTCLOCK)
tmp = strAppendDate(&filename[len]);
tmp = strAppendDate(tmp, true);
#endif
strcpy(tmp, STR_LOGS_EXT);
+3 -3
View File
@@ -21,7 +21,6 @@
#include <cctype>
#include <cstdio>
#include "opentx.h"
#include "lua_api.h"
#include "libopenui.h"
#include "api_colorlcd.h"
@@ -729,9 +728,10 @@ static int luaLcdSetColor(lua_State *L)
unsigned int index = COLOR_VAL(luaL_checkunsigned(L, 1));
LcdFlags flags = luaL_checkunsigned(L, 2);
if (index < LCD_COLOR_COUNT)
if (index < LCD_COLOR_COUNT) {
lcdColorTable[index] = COLOR_VAL(flagsRGB(flags));
OpenTxTheme::instance()->update();
}
return 0;
}
+163
View File
@@ -0,0 +1,163 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <cstdio>
#include "lua_api.h"
#include "api_filesystem.h"
// garbage collector for luaDir
static int dir_gc(lua_State* L)
{
DIR* dir = (DIR*)lua_touserdata(L, 1);
if (dir) f_closedir(dir);
return 0;
}
void registerDirIter(lua_State* L)
{
luaL_newmetatable(L, DIR_METATABLE);
/* set the garbage colector field */
lua_pushstring(L, "__gc");
lua_pushcfunction(L, dir_gc);
lua_settable(L, -3);
lua_pop(L, 1);
}
static int dir_iter(lua_State* L)
{
DIR* dir = (DIR*)lua_touserdata(L, lua_upvalueindex(1));
FILINFO info;
FRESULT res = f_readdir(dir, &info);
if (res != FR_OK || info.fname[0] == 0) { /* Break on error or end of dir */
return 0;
}
lua_pushstring(L, info.fname);
return 1;
}
/*luadoc
@function dir(directory)
Return an iterator listing all the files and directories name in a directory
@param directory (string) Working directory
@status current Introduced in 2.5.0
### Example
```lua
for fname in dir(".") do
print(fname)
end
*/
int luaDir(lua_State* L)
{
const char* path = luaL_optstring(L, 1, nullptr);
DIR* dir = (DIR*)lua_newuserdata(L, sizeof(DIR));
luaL_getmetatable(L, DIR_METATABLE);
lua_setmetatable(L, -2);
FRESULT res = f_opendir(dir, path);
if (res != FR_OK) {
printf("luaDir cannot open %s\n", path);
}
lua_pushcclosure(L, dir_iter, 1);
return 1;
}
/*luadoc
@function fstat(path)
Checks the existence of file or directory.
If not exist, return nil.
If exist, return the object information.
@param path (string) path to the object
@retval table object info, table elements:
* 'size' (number) file size
* 'attrib' (number) file attribute flags
* 'time' (table) table with last time modified date and times, table elements:
* `year` (number) year
* `mon` (number) month
* `day` (number) day of month
* `hour` (number) hours
* `hour12` (number) hours in US format
* `min` (number) minutes
* `sec` (number) seconds
* `suffix` (text) am or pm
### Example
```lua
info = fstat("radio")
if info ~= nil then
if (info.attrib == AM_DIR) then
print("is a directory")
end
size = info.size
time = info.time
end
@status current Introduced in 2.5.0
*/
int luaFstat(lua_State* L)
{
const char * path = luaL_optstring(L, 1, nullptr);
FRESULT res;
FILINFO info;
res = f_stat(path, &info);
if (res != FR_OK) {
printf("luaFstat cannot open %s\n", path);
return 0;
}
lua_newtable(L);
lua_pushtableinteger(L, "size", info.fsize);
lua_pushtableinteger(L, "attrib", info.fattrib);
uint32_t year = (info.fdate >> 9) + 1980;
uint32_t month = info.fdate >> 5 & 15;
uint32_t day = info.fdate & 31;
uint32_t hour = info.ftime >> 11;
uint32_t mn = info.ftime >> 5 & 63;
uint32_t sec = (info.ftime & 31) * 2;
lua_pushstring(L, "time");
luaPushDateTime(L, year, month, day, hour, mn, sec);
lua_settable(L, -3);
return 1;
}
+26
View File
@@ -0,0 +1,26 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#define DIR_METATABLE "directory metatable"
void registerDirIter(lua_State* L);
int luaDir(lua_State* L);
int luaFstat(lua_State* L);
+10 -1
View File
@@ -23,6 +23,7 @@
#include "opentx.h"
#include "stamp.h"
#include "lua_api.h"
#include "api_filesystem.h"
#include "telemetry/frsky.h"
#include "telemetry/multi.h"
@@ -165,7 +166,7 @@ static int luaGetTime(lua_State * L)
return 1;
}
static void luaPushDateTime(lua_State * L, uint32_t year, uint32_t mon, uint32_t day,
void luaPushDateTime(lua_State * L, uint32_t year, uint32_t mon, uint32_t day,
uint32_t hour, uint32_t min, uint32_t sec)
{
uint32_t hour12 = hour;
@@ -1816,6 +1817,8 @@ const luaL_Reg opentxLib[] = {
{ "defaultChannel", luaDefaultChannel },
{ "getRSSI", luaGetRSSI },
{ "killEvents", luaKillEvents },
{ "dir", luaDir },
{ "fstat", luaFstat },
{ "chdir", luaChdir },
{ "loadScript", luaLoadScript },
{ "getUsage", luaGetUsage },
@@ -2175,5 +2178,11 @@ const luaR_value_entry opentxConstants[] = {
{"UNIT_BITFIELD", UNIT_BITFIELD},
{"UNIT_TEXT", UNIT_TEXT},
{"AM_RDO", AM_RDO},
{"AM_HID", AM_HID},
{"AM_SYS", AM_SYS},
{"AM_DIR", AM_DIR},
{"AM_ARC", AM_ARC},
{ nullptr, 0 } /* sentinel */
};
+3
View File
@@ -27,6 +27,7 @@
#include "bin_allocator.h"
#include "lua_api.h"
#include "sdcard.h"
#include "api_filesystem.h"
#if defined(LIBOPENUI)
#include "api_colorlcd.h"
@@ -257,6 +258,8 @@ void luaClose(lua_State ** L)
void luaRegisterLibraries(lua_State * L)
{
luaL_openlibs(L);
registerDirIter(L);
#if defined(COLORLCD)
registerBitmapClass(L);
#endif
+8
View File
@@ -23,6 +23,9 @@
#if defined(LUA)
// prevent C++ code to be included from lua.h
#include "rtos.h"
extern "C" {
#include <lua.h>
#include <lauxlib.h>
@@ -31,6 +34,9 @@ extern "C" {
#include <lgc.h>
}
#include "dataconstants.h"
#include "opentx_types.h"
#ifndef LUA_SCRIPT_LOAD_MODE
// Can force loading of binary (.luac) or plain-text (.lua) versions of scripts specifically, and control
// compilation options. See interface.cpp:luaLoadScriptFileToState() <mode> parameter description for details.
@@ -209,6 +215,8 @@ void luaRegisterLibraries(lua_State * L);
void registerBitmapClass(lua_State * L);
void luaSetInstructionsLimit(lua_State* L, int count);
int luaLoadScriptFileToState(lua_State * L, const char * filename, const char * mode);
void luaPushDateTime(lua_State * L, uint32_t year, uint32_t mon, uint32_t day,
uint32_t hour, uint32_t min, uint32_t sec);
// Unregister LUA widget factories
void luaUnregisterWidgets();
+10 -6
View File
@@ -358,7 +358,11 @@ class LuaWidgetFactory: public WidgetFactory
lua_newtable(lsWidgets);
int i = 0;
for (const ZoneOption * option = options; option->name; option++, i++) {
l_pushtableint(option->name, persistentData->options[i].value.signedValue);
int32_t value = persistentData->options[i].value.signedValue;
if (option->type == ZoneOption::Color)
l_pushtableint(option->name, COLOR2FLAGS(value) | RGB_FLAG);
else
l_pushtableint(option->name, value);
}
if (lua_pcall(lsWidgets, 2, 1, 0) != 0) {
@@ -438,10 +442,11 @@ void LuaWidget::setErrorMessage(const char * funcName)
{
TRACE("Error in widget %s %s function: %s", factory->getName(), funcName, lua_tostring(lsWidgets, -1));
TRACE("Widget disabled");
size_t needed = snprintf(NULL, 0, "%s: %s", funcName, lua_tostring(lsWidgets, -1)) + 1;
errorMessage = (char *)malloc(needed);
size_t needed = snprintf(NULL, 0, "ERROR in %s: %s", funcName, lua_tostring(lsWidgets, -1)) + 1;
errorMessage = (char *)malloc(needed + 1);
if (errorMessage) {
snprintf(errorMessage, needed, "%s: %s", funcName, lua_tostring(lsWidgets, -1));
snprintf(errorMessage, needed, "ERROR in %s: %s", funcName, lua_tostring(lsWidgets, -1));
errorMessage[needed] = '\0';
}
}
@@ -455,8 +460,7 @@ void LuaWidget::refresh(BitmapBuffer* dc)
if (lsWidgets == 0) return;
if (errorMessage) {
lcdSetColor(RED);
dc->drawText(0, 0, "Disabled", FONT(XS) | CUSTOM_COLOR);
drawTextLines(dc, 0, 0, fullscreen ? LCD_W : rect.w, fullscreen ? LCD_H : rect.h, errorMessage, FONT(XS) | COLOR_THEME_WARNING);
return;
}
+3
View File
@@ -157,6 +157,9 @@ set(RADIO_DEPENDENCIES
truetype_fonts
)
set(HARDWARE_TOUCH ON)
set(SOFTWARE_KEYBOARD ON)
set(FIRMWARE_DEPENDENCIES datacopy)
add_definitions(-DPCBHORUS -DSTM32F429_439xx -DSDRAM -DCCMRAM -DCOLORLCD -DHARDWARE_KEYS)