switch radio hardware page to flex layout
This commit is contained in:
committed by
Raphael Coeffic
parent
c80b040b1e
commit
5fe7de17bb
@@ -30,6 +30,13 @@
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_GENERAL)
|
||||
|
||||
static const lv_coord_t col_two_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1),
|
||||
LV_GRID_TEMPLATE_LAST};
|
||||
static const lv_coord_t col_three_dsc[] = {LV_GRID_FR(2), LV_GRID_FR(1), LV_GRID_FR(1),
|
||||
LV_GRID_TEMPLATE_LAST};
|
||||
static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_CONTENT,
|
||||
LV_GRID_TEMPLATE_LAST};
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
#define SWITCH_TYPE_MAX(sw) ((MIXSRC_SF-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SH-MIXSRC_FIRST_SWITCH == sw) ? SWITCH_2POS : SWITCH_3POS)
|
||||
#else
|
||||
@@ -95,7 +102,7 @@ RadioHardwarePage::RadioHardwarePage():
|
||||
class ModeChoice : public Choice
|
||||
{
|
||||
public:
|
||||
ModeChoice(FormGroup *parent, const rect_t &rect, const char **values,
|
||||
ModeChoice(Window *parent, const rect_t &rect, const char **values,
|
||||
int vmin, int vmax, std::function<int()> getValue,
|
||||
std::function<void(int)> setValue = nullptr,
|
||||
bool *menuOpen = nullptr) :
|
||||
@@ -118,7 +125,7 @@ class ModeChoice : public Choice
|
||||
class BluetoothConfigWindow : public FormGroup
|
||||
{
|
||||
public:
|
||||
BluetoothConfigWindow(FormWindow * parent, const rect_t &rect) :
|
||||
BluetoothConfigWindow(Window * parent, const rect_t &rect) :
|
||||
FormGroup(parent, rect, FORWARD_SCROLL // | FORM_FORWARD_FOCUS
|
||||
)
|
||||
{
|
||||
@@ -137,19 +144,19 @@ class BluetoothConfigWindow : public FormGroup
|
||||
|
||||
void update()
|
||||
{
|
||||
FormGridLayout grid;
|
||||
#if LCD_W > LCD_H
|
||||
grid.setLabelWidth(180);
|
||||
#else
|
||||
grid.setLabelWidth(130);
|
||||
#endif
|
||||
clear();
|
||||
|
||||
new StaticText(this, grid.getLabelSlot(true), STR_MODE, 0,
|
||||
setFlexLayout();
|
||||
FlexGridLayout grid(col_three_dsc, row_dsc, 2);
|
||||
|
||||
auto line = newLine(&grid);
|
||||
|
||||
auto label = new StaticText(line, rect_t{}, STR_MODE, 0,
|
||||
COLOR_THEME_PRIMARY1);
|
||||
lv_obj_set_style_pad_left(label->getLvObj(), lv_dpx(8), LV_PART_MAIN);
|
||||
modechoiceopen = false;
|
||||
btMode = new ModeChoice(
|
||||
this, grid.getFieldSlot(), STR_BLUETOOTH_MODES, BLUETOOTH_OFF,
|
||||
line, rect_t{}, STR_BLUETOOTH_MODES, BLUETOOTH_OFF,
|
||||
BLUETOOTH_TRAINER, GET_DEFAULT(g_eeGeneral.bluetoothMode),
|
||||
[=](int32_t newValue) {
|
||||
g_eeGeneral.bluetoothMode = newValue;
|
||||
@@ -159,30 +166,34 @@ class BluetoothConfigWindow : public FormGroup
|
||||
modechoiceopen = false;
|
||||
},
|
||||
&modechoiceopen);
|
||||
grid.nextLine();
|
||||
line = newLine(&grid);
|
||||
|
||||
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, 0, COLOR_THEME_PRIMARY1);
|
||||
new StaticText(this, grid.getFieldSlot(), "000000", 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
label = new StaticText(line, rect_t{}, STR_BLUETOOTH_PIN_CODE, 0, COLOR_THEME_PRIMARY1);
|
||||
lv_obj_set_style_pad_left(label->getLvObj(), lv_dpx(8), LV_PART_MAIN);
|
||||
new StaticText(line, rect_t{}, "000000", 0, COLOR_THEME_PRIMARY1);
|
||||
line = newLine(&grid);
|
||||
}
|
||||
|
||||
// Local MAC
|
||||
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();
|
||||
label = new StaticText(line, rect_t{}, STR_BLUETOOTH_LOCAL_ADDR, 0, COLOR_THEME_PRIMARY1);
|
||||
lv_obj_set_style_pad_left(label->getLvObj(), lv_dpx(8), LV_PART_MAIN);
|
||||
new StaticText(line, rect_t{}, bluetooth.localAddr[0] == '\0' ? "---" : bluetooth.localAddr, 0, COLOR_THEME_PRIMARY1);
|
||||
line = newLine(&grid);
|
||||
|
||||
// Remote MAC
|
||||
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();
|
||||
label = new StaticText(line, rect_t{}, STR_BLUETOOTH_DIST_ADDR, 0, COLOR_THEME_PRIMARY1);
|
||||
lv_obj_set_style_pad_left(label->getLvObj(), lv_dpx(8), LV_PART_MAIN);
|
||||
new StaticText(line, rect_t{}, bluetooth.distantAddr[0] == '\0' ? "---" : bluetooth.distantAddr, 0, COLOR_THEME_PRIMARY1);
|
||||
line = newLine(&grid);
|
||||
|
||||
// BT radio name
|
||||
new StaticText(this, grid.getLabelSlot(true), STR_NAME, 0, COLOR_THEME_PRIMARY1);
|
||||
rte = new RadioTextEdit(this, grid.getFieldSlot(), g_eeGeneral.bluetoothName, LEN_BLUETOOTH_NAME);
|
||||
grid.nextLine();
|
||||
label = new StaticText(line, rect_t{}, STR_NAME, 0, COLOR_THEME_PRIMARY1);
|
||||
lv_obj_set_style_pad_left(label->getLvObj(), lv_dpx(8), LV_PART_MAIN);
|
||||
rte = new RadioTextEdit(line, rect_t{}, g_eeGeneral.bluetoothName, LEN_BLUETOOTH_NAME);
|
||||
line = newLine(&grid);
|
||||
}
|
||||
|
||||
getParent()->moveWindowsTop(top() + 1, adjustHeight());
|
||||
@@ -201,7 +212,7 @@ class BluetoothConfigWindow : public FormGroup
|
||||
class SerialConfigWindow : public FormGroup
|
||||
{
|
||||
public:
|
||||
SerialConfigWindow(FormWindow *parent, const rect_t &rect) :
|
||||
SerialConfigWindow(Window *parent, const rect_t &rect) :
|
||||
FormGroup(parent, rect, FORWARD_SCROLL // | FORM_FORWARD_FOCUS
|
||||
)
|
||||
{
|
||||
@@ -210,24 +221,24 @@ class SerialConfigWindow : public FormGroup
|
||||
|
||||
void update()
|
||||
{
|
||||
FormGridLayout grid;
|
||||
#if LCD_W > LCD_H
|
||||
grid.setLabelWidth(180);
|
||||
#else
|
||||
grid.setLabelWidth(130);
|
||||
#endif
|
||||
clear();
|
||||
|
||||
setFlexLayout();
|
||||
FlexGridLayout grid(col_two_dsc, row_dsc, 2);
|
||||
|
||||
auto line = newLine(&grid);
|
||||
|
||||
bool display_ttl_warning = false;
|
||||
for (uint8_t port_nr = 0; port_nr < MAX_SERIAL_PORTS; port_nr++) {
|
||||
auto port = serialGetPort(port_nr);
|
||||
if (!port || !port->name) continue;
|
||||
|
||||
display_ttl_warning = true;
|
||||
new StaticText(this, grid.getLabelSlot(true), port->name, 0,
|
||||
auto label = new StaticText(line, rect_t{}, port->name, 0,
|
||||
COLOR_THEME_PRIMARY1);
|
||||
lv_obj_set_style_pad_left(label->getLvObj(), lv_dpx(8), LV_PART_MAIN);
|
||||
auto aux = new Choice(
|
||||
this, grid.getFieldSlot(), STR_AUX_SERIAL_MODES, 0,
|
||||
line, rect_t{}, STR_AUX_SERIAL_MODES, 0,
|
||||
UART_MODE_MAX, [=]() { return serialGetMode(port_nr); },
|
||||
[=](int value) {
|
||||
serialSetMode(port_nr, value);
|
||||
@@ -236,29 +247,33 @@ class SerialConfigWindow : public FormGroup
|
||||
});
|
||||
aux->setAvailableHandler(
|
||||
[=](int value) { return isSerialModeAvailable(port_nr, value); });
|
||||
grid.nextLine();
|
||||
line = newLine(&grid);
|
||||
|
||||
#if defined(SWSERIALPOWER)
|
||||
if (port_nr < SP_VCP)
|
||||
{
|
||||
new StaticText(this, grid.getLabelSlot(true), STR_AUX_SERIAL_PORT_POWER, 0, COLOR_THEME_PRIMARY1);
|
||||
auto label = new StaticText(line, rect_t{}, STR_AUX_SERIAL_PORT_POWER, 0, COLOR_THEME_PRIMARY1);
|
||||
lv_obj_set_style_pad_left(label->getLvObj(), lv_dpx(8), LV_PART_MAIN);
|
||||
new CheckBox(
|
||||
this, grid.getFieldSlot(1, 0),
|
||||
line, rect_t{},
|
||||
[=] { return serialGetPower(port_nr); },
|
||||
[=](int8_t newValue) {
|
||||
serialSetPower(port_nr, (bool)newValue);
|
||||
SET_DIRTY();
|
||||
}
|
||||
);
|
||||
grid.nextLine();
|
||||
line = newLine(&grid);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (display_ttl_warning) {
|
||||
new StaticText(this, grid.getFieldSlot(), STR_TTL_WARNING, 0,
|
||||
grid.setColSpan(2);
|
||||
auto label = new StaticText(line, rect_t{}, STR_TTL_WARNING, 0,
|
||||
COLOR_THEME_WARNING);
|
||||
grid.nextLine();
|
||||
lv_obj_set_style_pad_left(label->getLvObj(), lv_dpx(8), LV_PART_MAIN);
|
||||
grid.setColSpan(1);
|
||||
line = newLine(&grid);
|
||||
}
|
||||
|
||||
getParent()->moveWindowsTop(top() + 1, adjustHeight());
|
||||
@@ -267,7 +282,7 @@ class SerialConfigWindow : public FormGroup
|
||||
|
||||
class InternalModuleWindow : public FormGroup {
|
||||
public:
|
||||
InternalModuleWindow(FormWindow *parent, const rect_t &rect) :
|
||||
InternalModuleWindow(Window *parent, const rect_t &rect) :
|
||||
FormGroup(parent, rect, FORWARD_SCROLL),
|
||||
lastModule(g_eeGeneral.internalModule)
|
||||
{
|
||||
@@ -276,17 +291,17 @@ class InternalModuleWindow : public FormGroup {
|
||||
|
||||
void update()
|
||||
{
|
||||
FormGridLayout grid;
|
||||
#if LCD_W > LCD_H
|
||||
grid.setLabelWidth(180);
|
||||
#else
|
||||
grid.setLabelWidth(130);
|
||||
#endif
|
||||
clear();
|
||||
|
||||
new StaticText(this, grid.getLabelSlot(true), TR_INTERNAL_MODULE, 0,
|
||||
setFlexLayout();
|
||||
FlexGridLayout grid(col_two_dsc, row_dsc, 2);
|
||||
|
||||
auto line = newLine(&grid);
|
||||
|
||||
auto label = new StaticText(line, rect_t{}, TR_INTERNAL_MODULE, 0,
|
||||
COLOR_THEME_PRIMARY1);
|
||||
auto internalModule = new Choice(this, grid.getFieldSlot(),STR_INTERNAL_MODULE_PROTOCOLS, MODULE_TYPE_NONE, MODULE_TYPE_COUNT - 1,
|
||||
lv_obj_set_style_pad_left(label->getLvObj(), lv_dpx(8), LV_PART_MAIN);
|
||||
auto internalModule = new Choice(line, rect_t{},STR_INTERNAL_MODULE_PROTOCOLS, MODULE_TYPE_NONE, MODULE_TYPE_COUNT - 1,
|
||||
GET_DEFAULT(g_eeGeneral.internalModule),
|
||||
[=](int moduleType) {
|
||||
if (g_model.moduleData[INTERNAL_MODULE].type != moduleType) {
|
||||
@@ -300,12 +315,13 @@ class InternalModuleWindow : public FormGroup {
|
||||
internalModule->setAvailableHandler([](int module){
|
||||
return isInternalModuleSupported(module);
|
||||
});
|
||||
grid.nextLine();
|
||||
line = newLine(&grid);
|
||||
|
||||
#if defined(CROSSFIRE)
|
||||
if (isInternalModuleCrossfire()) {
|
||||
new StaticText(this, grid.getLabelSlot(true), STR_BAUDRATE, 0,COLOR_THEME_PRIMARY1);
|
||||
new Choice(this, grid.getFieldSlot(), STR_CRSF_BAUDRATE, 0,CROSSFIRE_MAX_INTERNAL_BAUDRATE,
|
||||
auto label = new StaticText(line, rect_t{}, STR_BAUDRATE, 0,COLOR_THEME_PRIMARY1);
|
||||
lv_obj_set_style_pad_left(label->getLvObj(), lv_dpx(8), LV_PART_MAIN);
|
||||
new Choice(line, rect_t{}, STR_CRSF_BAUDRATE, 0,CROSSFIRE_MAX_INTERNAL_BAUDRATE,
|
||||
[=]() -> int {
|
||||
return CROSSFIRE_STORE_TO_INDEX(g_eeGeneral.internalModuleBaudrate);
|
||||
},
|
||||
@@ -314,12 +330,7 @@ class InternalModuleWindow : public FormGroup {
|
||||
SET_DIRTY();
|
||||
restartModule(INTERNAL_MODULE);
|
||||
});
|
||||
grid.nextLine();
|
||||
#if defined(USB_SERIAL)
|
||||
// If USB-VCP was off, set it to CLI to enable passthrough flashing
|
||||
if (serialGetMode(SP_VCP) == UART_MODE_NONE)
|
||||
serialSetMode(SP_VCP, UART_MODE_CLI);
|
||||
#endif
|
||||
line = newLine(&grid);
|
||||
}
|
||||
#endif
|
||||
getParent()->moveWindowsTop(top() + 1, adjustHeight());
|
||||
@@ -341,17 +352,14 @@ class InternalModuleWindow : public FormGroup {
|
||||
|
||||
void RadioHardwarePage::build(FormWindow * window)
|
||||
{
|
||||
FormGridLayout grid;
|
||||
#if LCD_W > LCD_H
|
||||
grid.setLabelWidth(180);
|
||||
#else
|
||||
grid.setLabelWidth(130);
|
||||
#endif
|
||||
grid.spacer(PAGE_PADDING);
|
||||
window->setFlexLayout();
|
||||
FlexGridLayout grid(col_three_dsc, row_dsc, 2);
|
||||
|
||||
auto line = window->newLine(&grid);
|
||||
|
||||
// Calibration
|
||||
new StaticText(window, grid.getLabelSlot(), STR_INPUTS, 0, COLOR_THEME_PRIMARY1 | FONT(BOLD));
|
||||
auto calib = new TextButton(window, grid.getFieldSlot(), STR_CALIBRATION);
|
||||
new StaticText(line, rect_t{}, STR_INPUTS, 0, COLOR_THEME_PRIMARY1 | FONT(BOLD));
|
||||
auto calib = new TextButton(line, rect_t{}, STR_CALIBRATION);
|
||||
calib->setPressHandler([=]() -> uint8_t {
|
||||
// auto calibrationPage =
|
||||
new RadioCalibrationPage();
|
||||
@@ -360,21 +368,24 @@ void RadioHardwarePage::build(FormWindow * window)
|
||||
// });
|
||||
return 0;
|
||||
});
|
||||
grid.nextLine();
|
||||
line = window->newLine(&grid);
|
||||
|
||||
// Sticks
|
||||
new Subtitle(window, grid.getLineSlot(), STR_STICKS, 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
new Subtitle(line, rect_t{}, STR_STICKS, 0, COLOR_THEME_PRIMARY1);
|
||||
line = window->newLine(&grid);
|
||||
for (int i = 0; i < NUM_STICKS; i++) {
|
||||
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();
|
||||
auto label = new StaticText(line, rect_t{}, TEXT_AT_INDEX(STR_VSRCRAW, (i + 1)), 0, COLOR_THEME_PRIMARY1);
|
||||
lv_obj_set_style_pad_left(label->getLvObj(), lv_dpx(8), LV_PART_MAIN);
|
||||
auto textEdit = new RadioTextEdit(line, rect_t{}, g_eeGeneral.anaNames[i], LEN_ANA_NAME);
|
||||
lv_obj_set_style_grid_cell_x_align(textEdit->getLvObj(), LV_GRID_ALIGN_STRETCH, 0);
|
||||
line = window->newLine(&grid);
|
||||
}
|
||||
|
||||
#if defined(STICK_DEAD_ZONE)
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_DEAD_ZONE);
|
||||
auto text = new StaticText(line, rect_t{}, STR_DEAD_ZONE);
|
||||
lv_obj_set_style_pad_left(text->getLvObj(), lv_dpx(8), LV_PART_MAIN);
|
||||
auto choice =
|
||||
new Choice(window, grid.getFieldSlot(2,0), 0, 7,
|
||||
new Choice(line, rect_t{}, 0, 7,
|
||||
GET_DEFAULT(g_eeGeneral.stickDeadZone), [=](uint8_t newValue) {
|
||||
g_eeGeneral.stickDeadZone = newValue;
|
||||
SET_DIRTY();
|
||||
@@ -382,12 +393,12 @@ void RadioHardwarePage::build(FormWindow * window)
|
||||
choice->setTextHandler([](uint8_t value) {
|
||||
return std::to_string(value ? 2 << (value - 1) : 0);
|
||||
});
|
||||
grid.nextLine();
|
||||
line = window->newLine(&grid);
|
||||
#endif
|
||||
|
||||
// Pots
|
||||
new Subtitle(window, grid.getLineSlot(), STR_POTS, 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
new Subtitle(line, rect_t{}, STR_POTS, 0, COLOR_THEME_PRIMARY1);
|
||||
line = window->newLine(&grid);
|
||||
for (int i = 0; i < NUM_POTS; i++) {
|
||||
// Display EX3 & EX4 (= last two pots) only when FlySky gimbals are present
|
||||
#if !defined(SIMU) && defined(RADIO_FAMILY_T16)
|
||||
@@ -395,9 +406,12 @@ void RadioHardwarePage::build(FormWindow * window)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
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,
|
||||
auto label = new StaticText(line, rect_t{}, TEXT_AT_INDEX(STR_VSRCRAW, (i + NUM_STICKS + 1)), 0, COLOR_THEME_PRIMARY1);
|
||||
lv_obj_set_style_pad_left(label->getLvObj(), lv_dpx(8), LV_PART_MAIN);
|
||||
|
||||
auto textEdit = new RadioTextEdit(line, rect_t{}, g_eeGeneral.anaNames[i + NUM_STICKS], LEN_ANA_NAME);
|
||||
lv_obj_set_style_grid_cell_x_align(textEdit->getLvObj(), LV_GRID_ALIGN_STRETCH, 0);
|
||||
new Choice(line, rect_t{}, STR_POTTYPES, POT_NONE, POT_WITHOUT_DETENT,
|
||||
[=]() -> int {
|
||||
return bfGet<uint32_t>(g_eeGeneral.potsConfig, 2*i, 2);
|
||||
},
|
||||
@@ -405,18 +419,21 @@ void RadioHardwarePage::build(FormWindow * window)
|
||||
g_eeGeneral.potsConfig = bfSet<uint32_t>(g_eeGeneral.potsConfig, newValue, 2*i, 2);
|
||||
SET_DIRTY();
|
||||
});
|
||||
grid.nextLine();
|
||||
line = window->newLine(&grid);
|
||||
}
|
||||
|
||||
// Sliders
|
||||
new Subtitle(window, grid.getLineSlot(), STR_SLIDERS, 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
#if (NUM_SLIDERS > 0)
|
||||
new Subtitle(line, rect_t{}, STR_SLIDERS, 0, COLOR_THEME_PRIMARY1);
|
||||
line = window->newLine(&grid);
|
||||
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), 0, COLOR_THEME_PRIMARY1);
|
||||
new RadioTextEdit(window, grid.getFieldSlot(2, 0), g_eeGeneral.anaNames[idx], LEN_ANA_NAME);
|
||||
auto label = new StaticText(line, rect_t{}, TEXT_AT_INDEX(STR_VSRCRAW, idx + 1), 0, COLOR_THEME_PRIMARY1);
|
||||
lv_obj_set_style_pad_left(label->getLvObj(), lv_dpx(8), LV_PART_MAIN);
|
||||
auto textEdit = new RadioTextEdit(line, rect_t{}, g_eeGeneral.anaNames[idx], LEN_ANA_NAME);
|
||||
lv_obj_set_style_grid_cell_x_align(textEdit->getLvObj(), LV_GRID_ALIGN_STRETCH, 0);
|
||||
new Choice(
|
||||
window, grid.getFieldSlot(2, 1), STR_SLIDERTYPES, SLIDER_NONE,
|
||||
window, rect_t{}, STR_SLIDERTYPES, SLIDER_NONE,
|
||||
SLIDER_WITH_DETENT,
|
||||
[=]() -> int {
|
||||
uint8_t mask = (0x01 << i);
|
||||
@@ -428,16 +445,19 @@ void RadioHardwarePage::build(FormWindow * window)
|
||||
g_eeGeneral.slidersConfig |= (newValue << i);
|
||||
SET_DIRTY();
|
||||
});
|
||||
grid.nextLine();
|
||||
line = window->newLine(&grid);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Switches
|
||||
new Subtitle(window, grid.getLineSlot(), STR_SWITCHES, 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
new Subtitle(line, rect_t{}, STR_SWITCHES, 0, COLOR_THEME_PRIMARY1);
|
||||
line = window->newLine(&grid);
|
||||
for (int i = 0; i < NUM_SWITCHES; i++) {
|
||||
new SwitchDynamicLabel(window, grid.getLabelSlot(true), i);
|
||||
new RadioTextEdit(window, grid.getFieldSlot(2, 0), g_eeGeneral.switchNames[i], LEN_SWITCH_NAME);
|
||||
new Choice(window, grid.getFieldSlot(2, 1), STR_SWTYPES, SWITCH_NONE, SWITCH_TYPE_MAX(i),
|
||||
auto label = new SwitchDynamicLabel(line, rect_t{}, i);
|
||||
lv_obj_set_style_pad_left(label->getLvObj(), lv_dpx(8), LV_PART_MAIN);
|
||||
auto textEdit = new RadioTextEdit(line, rect_t{}, g_eeGeneral.switchNames[i], LEN_SWITCH_NAME);
|
||||
lv_obj_set_style_grid_cell_x_align(textEdit->getLvObj(), LV_GRID_ALIGN_STRETCH, 0);
|
||||
new Choice(line, rect_t{}, STR_SWTYPES, SWITCH_NONE, SWITCH_TYPE_MAX(i),
|
||||
[=]() -> int {
|
||||
return SWITCH_CONFIG(i);
|
||||
},
|
||||
@@ -446,58 +466,74 @@ void RadioHardwarePage::build(FormWindow * window)
|
||||
g_eeGeneral.switchConfig = (g_eeGeneral.switchConfig & ~mask) | ((swconfig_t(newValue) & 0x03) << (2 * i));
|
||||
SET_DIRTY();
|
||||
});
|
||||
grid.nextLine();
|
||||
line = window->newLine(&grid);
|
||||
}
|
||||
|
||||
// Bat calibration
|
||||
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));
|
||||
new StaticText(line, rect_t{}, STR_BATT_CALIB, 0, COLOR_THEME_PRIMARY1);
|
||||
auto batCal = new NumberEdit(line, rect_t{}, -127, 127, GET_SET_DEFAULT(g_eeGeneral.txVoltageCalibration));
|
||||
batCal->setDisplayHandler([](int32_t value) {
|
||||
return formatNumberAsString(getBatteryVoltage(), PREC2, 0, nullptr, "V");
|
||||
});
|
||||
batCal->setWindowFlags(REFRESH_ALWAYS);
|
||||
grid.nextLine();
|
||||
line = window->newLine(&grid);
|
||||
|
||||
// RTC Batt display
|
||||
new StaticText(window, grid.getLabelSlot(), STR_RTC_BATT, 0, COLOR_THEME_PRIMARY1);
|
||||
new DynamicNumber<uint16_t>(window, grid.getFieldSlot(1,0), [] {
|
||||
new StaticText(line, rect_t{}, STR_RTC_BATT, 0, COLOR_THEME_PRIMARY1);
|
||||
new DynamicNumber<uint16_t>(line, rect_t{}, [] {
|
||||
return getRTCBatteryVoltage();
|
||||
}, COLOR_THEME_PRIMARY1 | PREC2, nullptr, "V");
|
||||
grid.nextLine();
|
||||
line = window->newLine(&grid);
|
||||
|
||||
// RTC Batt check enable
|
||||
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();
|
||||
new StaticText(line, rect_t{}, STR_RTC_CHECK, 0, COLOR_THEME_PRIMARY1);
|
||||
new CheckBox(line, rect_t{}, GET_SET_INVERTED(g_eeGeneral.disableRtcWarning ));
|
||||
line = window->newLine(&grid);
|
||||
|
||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||
new Subtitle(window, grid.getLineSlot(), TR_INTERNALRF, 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
grid.addWindow(new InternalModuleWindow(window, {0, grid.getWindowHeight(), LCD_W, 0}));
|
||||
new Subtitle(line, rect_t{}, TR_INTERNALRF, 0, COLOR_THEME_PRIMARY1);
|
||||
line = window->newLine(&grid);
|
||||
lv_obj_set_style_pad_left(line->getLvObj(), 0, LV_PART_MAIN);
|
||||
lv_obj_set_style_pad_right(line->getLvObj(), 0, LV_PART_MAIN);
|
||||
// Date and Time
|
||||
grid.setColSpan(2);
|
||||
new InternalModuleWindow(line, rect_t{});
|
||||
grid.setColSpan(1);
|
||||
line = window->newLine(&grid);
|
||||
#endif
|
||||
|
||||
#if defined(BLUETOOTH)
|
||||
// Bluetooth mode
|
||||
{
|
||||
new Subtitle(window, grid.getLineSlot(), STR_BLUETOOTH, 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
grid.addWindow(new BluetoothConfigWindow(window, {0, grid.getWindowHeight(), LCD_W, 0}));
|
||||
new Subtitle(line, rect_t{}, STR_BLUETOOTH, 0, COLOR_THEME_PRIMARY1);
|
||||
line = window->newLine(&grid);
|
||||
lv_obj_set_style_pad_left(line->getLvObj(), 0, LV_PART_MAIN);
|
||||
lv_obj_set_style_pad_right(line->getLvObj(), 0, LV_PART_MAIN);
|
||||
grid.setColSpan(2);
|
||||
new BluetoothConfigWindow(line, rect_t{});
|
||||
grid.setColSpan(1);
|
||||
line = window->newLine(&grid);
|
||||
}
|
||||
#endif
|
||||
|
||||
new Subtitle(window, grid.getLineSlot(), STR_AUX_SERIAL_MODE, 0,
|
||||
new Subtitle(line, rect_t{}, STR_AUX_SERIAL_MODE, 0,
|
||||
COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
grid.addWindow(new SerialConfigWindow(window, {0, grid.getWindowHeight(), LCD_W, 0}));
|
||||
line = window->newLine(&grid);
|
||||
lv_obj_set_style_pad_left(line->getLvObj(), 0, LV_PART_MAIN);
|
||||
lv_obj_set_style_pad_right(line->getLvObj(), 0, LV_PART_MAIN);
|
||||
grid.setColSpan(2);
|
||||
new SerialConfigWindow(line, rect_t{});
|
||||
grid.setColSpan(1);
|
||||
line = window->newLine(&grid);
|
||||
|
||||
// ADC 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.noJitterFilter));
|
||||
grid.nextLine();
|
||||
new StaticText(line, rect_t{}, STR_JITTER_FILTER, 0, COLOR_THEME_PRIMARY1);
|
||||
new CheckBox(line, rect_t{}, GET_SET_INVERTED(g_eeGeneral.noJitterFilter));
|
||||
line = window->newLine(&grid);
|
||||
|
||||
// Debugs
|
||||
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);
|
||||
new StaticText(line, rect_t{}, STR_DEBUG, 0, COLOR_THEME_PRIMARY1 | FONT(BOLD));
|
||||
auto debugAnas = new TextButton(line, rect_t{}, STR_ANALOGS_BTN);
|
||||
debugAnas->setPressHandler([=]() -> uint8_t {
|
||||
// auto debugAnalogsPage =
|
||||
new RadioAnalogsDiagsViewPageGroup();
|
||||
@@ -507,7 +543,7 @@ void RadioHardwarePage::build(FormWindow * window)
|
||||
return 0;
|
||||
});
|
||||
|
||||
auto debugKeys = new TextButton(window, grid.getFieldSlot(2, 1), STR_KEYS_BTN);
|
||||
auto debugKeys = new TextButton(line, rect_t{}, STR_KEYS_BTN);
|
||||
debugKeys->setPressHandler([=]() -> uint8_t {
|
||||
// auto debugKeysPage =
|
||||
new RadioKeyDiagsPage();
|
||||
@@ -516,11 +552,11 @@ void RadioHardwarePage::build(FormWindow * window)
|
||||
// });
|
||||
return 0;
|
||||
});
|
||||
grid.nextLine();
|
||||
line = window->newLine(&grid);
|
||||
|
||||
// extra bottom padding if touchscreen
|
||||
#if defined HARDWARE_TOUCH
|
||||
new StaticText(window, grid.getLabelSlot());
|
||||
new StaticText(line, rect_t{});
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user