diff --git a/radio/src/gui/colorlcd/hw_intmodule.cpp b/radio/src/gui/colorlcd/hw_intmodule.cpp index b5ca63166..46246012a 100644 --- a/radio/src/gui/colorlcd/hw_intmodule.cpp +++ b/radio/src/gui/colorlcd/hw_intmodule.cpp @@ -24,8 +24,8 @@ #define SET_DIRTY() storageDirty(EE_GENERAL) -static const lv_coord_t col_two_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(2), - LV_GRID_TEMPLATE_LAST}; +static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(3), + LV_GRID_TEMPLATE_LAST}; static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST}; @@ -34,13 +34,17 @@ InternalModuleWindow::InternalModuleWindow(Window *parent, const rect_t &rect) : lastModule(g_eeGeneral.internalModule) { setFlexLayout(); - FlexGridLayout grid(col_two_dsc, row_dsc, 2); - lv_obj_set_style_pad_left(lvobj, lv_dpx(8), 0); + FlexGridLayout grid(col_dsc, row_dsc, 2); auto line = newLine(&grid); - new StaticText(line, rect_t{}, TR_INTERNAL_MODULE, 0, COLOR_THEME_PRIMARY1); + + new StaticText(line, rect_t{}, STR_MODE, 0, COLOR_THEME_PRIMARY1); + + auto box = new FormGroup(line, rect_t{}); + box->setFlexLayout(LV_FLEX_FLOW_ROW, lv_dpx(8)); + auto internalModule = new Choice( - line, rect_t{}, STR_INTERNAL_MODULE_PROTOCOLS, MODULE_TYPE_NONE, + box, rect_t{}, STR_INTERNAL_MODULE_PROTOCOLS, MODULE_TYPE_NONE, MODULE_TYPE_COUNT - 1, GET_DEFAULT(g_eeGeneral.internalModule), [=](int type) { return setModuleType(type); }); @@ -48,11 +52,14 @@ InternalModuleWindow::InternalModuleWindow(Window *parent, const rect_t &rect) : [](int module) { return isInternalModuleSupported(module); }); #if defined(CROSSFIRE) - line = newLine(&grid); - br_line = line->getLvObj(); + box = new FormGroup(box, rect_t{}); + box->setFlexLayout(LV_FLEX_FLOW_ROW, lv_dpx(8)); - new StaticText(line, rect_t{}, STR_BAUDRATE, 0, COLOR_THEME_PRIMARY1); - new Choice(line, rect_t{}, STR_CRSF_BAUDRATE, 0, + br_box = box->getLvObj(); + lv_obj_set_style_flex_cross_place(br_box, LV_FLEX_ALIGN_CENTER, 0); + + new StaticText(box, rect_t{}, STR_BAUDRATE, 0, COLOR_THEME_PRIMARY1); + new Choice(box, rect_t{}, STR_CRSF_BAUDRATE, 0, CROSSFIRE_MAX_INTERNAL_BAUDRATE, getBaudrate, setBaudrate); updateBaudrateLine(); @@ -86,9 +93,9 @@ void InternalModuleWindow::updateBaudrateLine() { #if defined(CROSSFIRE) if (isInternalModuleCrossfire()) { - lv_obj_clear_flag(br_line, LV_OBJ_FLAG_HIDDEN); + lv_obj_clear_flag(br_box, LV_OBJ_FLAG_HIDDEN); } else { - lv_obj_add_flag(br_line, LV_OBJ_FLAG_HIDDEN); + lv_obj_add_flag(br_box, LV_OBJ_FLAG_HIDDEN); } #endif } diff --git a/radio/src/gui/colorlcd/hw_intmodule.h b/radio/src/gui/colorlcd/hw_intmodule.h index b7075287b..843c50b34 100644 --- a/radio/src/gui/colorlcd/hw_intmodule.h +++ b/radio/src/gui/colorlcd/hw_intmodule.h @@ -30,7 +30,7 @@ class InternalModuleWindow : public FormGroup protected: uint8_t lastModule = 0; - lv_obj_t* br_line = nullptr; + lv_obj_t* br_box = nullptr; static int getBaudrate(); static void setBaudrate(int val); diff --git a/radio/src/gui/colorlcd/hw_serial.cpp b/radio/src/gui/colorlcd/hw_serial.cpp index cb73ac6e6..b80bae4c7 100644 --- a/radio/src/gui/colorlcd/hw_serial.cpp +++ b/radio/src/gui/colorlcd/hw_serial.cpp @@ -24,7 +24,7 @@ #define SET_DIRTY() storageDirty(EE_GENERAL) -static const lv_coord_t col_two_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(2), +static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(3), LV_GRID_TEMPLATE_LAST}; static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST}; @@ -33,19 +33,24 @@ SerialConfigWindow::SerialConfigWindow(Window *parent, const rect_t &rect) : FormGroup(parent, rect, FORWARD_SCROLL) { setFlexLayout(); - FlexGridLayout grid(col_two_dsc, row_dsc, 2); - lv_obj_set_style_pad_left(lvobj, lv_dpx(8), 0); + FlexGridLayout grid(col_dsc, row_dsc, 2); 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; + if (port_nr != SP_VCP) display_ttl_warning = true; + auto line = newLine(&grid); new StaticText(line, rect_t{}, port->name, 0, COLOR_THEME_PRIMARY1); + + auto box = new FormGroup(line, rect_t{}); + box->setFlexLayout(LV_FLEX_FLOW_ROW, lv_dpx(8)); + lv_obj_set_style_flex_cross_place(box->getLvObj(), LV_FLEX_ALIGN_CENTER, 0); + auto aux = new Choice( - line, rect_t{}, STR_AUX_SERIAL_MODES, 0, UART_MODE_MAX, + box, rect_t{}, STR_AUX_SERIAL_MODES, 0, UART_MODE_MAX, [=]() { return serialGetMode(port_nr); }, [=](int value) { serialSetMode(port_nr, value); @@ -55,19 +60,16 @@ SerialConfigWindow::SerialConfigWindow(Window *parent, const rect_t &rect) : aux->setAvailableHandler( [=](int value) { return isSerialModeAvailable(port_nr, value); }); -#if defined(SWSERIALPOWER) - if (port_nr < SP_VCP) { - line = newLine(&grid); - new StaticText(line, rect_t{}, STR_AUX_SERIAL_PORT_POWER, 0, + if (port->set_pwr != nullptr) { + new StaticText(box, rect_t{}, STR_AUX_SERIAL_PORT_POWER, 0, COLOR_THEME_PRIMARY1); new CheckBox( - line, rect_t{}, [=] { return serialGetPower(port_nr); }, + box, rect_t{}, [=] { return serialGetPower(port_nr); }, [=](int8_t newValue) { serialSetPower(port_nr, (bool)newValue); SET_DIRTY(); }); } -#endif } if (display_ttl_warning) { diff --git a/radio/src/gui/colorlcd/radio_hardware.cpp b/radio/src/gui/colorlcd/radio_hardware.cpp index 80b105a50..536c11f15 100644 --- a/radio/src/gui/colorlcd/radio_hardware.cpp +++ b/radio/src/gui/colorlcd/radio_hardware.cpp @@ -33,7 +33,7 @@ #define SET_DIRTY() storageDirty(EE_GENERAL) -static const lv_coord_t col_three_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_FR(1), +static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(2), LV_GRID_TEMPLATE_LAST}; static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST}; @@ -91,7 +91,7 @@ class BluetoothConfigWindow : public FormGroup clear(); setFlexLayout(); - FlexGridLayout grid(col_three_dsc, row_dsc, 2); + FlexGridLayout grid(col_dsc, row_dsc, 2); lv_obj_set_style_pad_left(lvobj, lv_dpx(8), 0); auto line = newLine(&grid); @@ -109,18 +109,18 @@ class BluetoothConfigWindow : public FormGroup }, &modechoiceopen); - line = newLine(&grid); if (g_eeGeneral.bluetoothMode != BLUETOOTH_OFF) { // Pin code (displayed for information only, not editable) if (g_eeGeneral.bluetoothMode == BLUETOOTH_TELEMETRY) { + line = newLine(&grid); 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 + line = newLine(&grid); 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); @@ -128,9 +128,9 @@ class BluetoothConfigWindow : public FormGroup line, rect_t{}, bluetooth.localAddr[0] == '\0' ? "---" : bluetooth.localAddr, 0, COLOR_THEME_PRIMARY1); - line = newLine(&grid); // Remote MAC + line = newLine(&grid); 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); @@ -138,14 +138,13 @@ class BluetoothConfigWindow : public FormGroup line, rect_t{}, bluetooth.distantAddr[0] == '\0' ? "---" : bluetooth.distantAddr, 0, COLOR_THEME_PRIMARY1); - line = newLine(&grid); // BT radio name + line = newLine(&grid); 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); } } @@ -162,7 +161,7 @@ class BluetoothConfigWindow : public FormGroup void RadioHardwarePage::build(FormWindow * window) { window->setFlexLayout(); - FlexGridLayout grid(col_three_dsc, row_dsc, 2); + FlexGridLayout grid(col_dsc, row_dsc, 2); lv_obj_set_style_pad_all(window->getLvObj(), lv_dpx(8), 0); // TODO: sub-title? @@ -209,21 +208,30 @@ void RadioHardwarePage::build(FormWindow * window) }); batCal->setWindowFlags(REFRESH_ALWAYS); - // RTC Batt display - line = window->newLine(&grid); - new StaticText(line, rect_t{}, STR_RTC_BATT, 0, COLOR_THEME_PRIMARY1); - new DynamicNumber(line, rect_t{}, [] { - return getRTCBatteryVoltage(); - }, COLOR_THEME_PRIMARY1 | PREC2, nullptr, "V"); - // RTC Batt check enable line = window->newLine(&grid); new StaticText(line, rect_t{}, STR_RTC_CHECK, 0, COLOR_THEME_PRIMARY1); - new CheckBox(line, rect_t{}, GET_SET_INVERTED(g_eeGeneral.disableRtcWarning )); + + box = new FormGroup(line, rect_t{}); + box->setFlexLayout(LV_FLEX_FLOW_ROW, lv_dpx(8)); + lv_obj_set_style_flex_cross_place(box->getLvObj(), LV_FLEX_ALIGN_CENTER, 0); + new CheckBox(box, rect_t{}, GET_SET_INVERTED(g_eeGeneral.disableRtcWarning )); + + // RTC Batt display + new StaticText(box, rect_t{}, STR_VALUE, 0, COLOR_THEME_PRIMARY1); + new DynamicNumber(box, rect_t{}, [] { + return getRTCBatteryVoltage(); + }, COLOR_THEME_PRIMARY1 | PREC2, nullptr, "V"); + + // ADC filter + line = window->newLine(&grid); + new StaticText(line, rect_t{}, STR_JITTER_FILTER, 0, COLOR_THEME_PRIMARY1); + new CheckBox(line, rect_t{}, GET_SET_INVERTED(g_eeGeneral.noJitterFilter)); #if defined(HARDWARE_INTERNAL_MODULE) new Subtitle(window, rect_t{}, TR_INTERNALRF, 0, COLOR_THEME_PRIMARY1); - new InternalModuleWindow(window, rect_t{}); + auto mod = new InternalModuleWindow(window, rect_t{}); + mod->padLeft(lv_dpx(8)); #endif #if defined(BLUETOOTH) @@ -232,12 +240,8 @@ void RadioHardwarePage::build(FormWindow * window) #endif new Subtitle(window, rect_t{}, STR_AUX_SERIAL_MODE, 0, COLOR_THEME_PRIMARY1); - new SerialConfigWindow(window, rect_t{}); - - // ADC filter - line = window->newLine(&grid); - new StaticText(line, rect_t{}, STR_JITTER_FILTER, 0, COLOR_THEME_PRIMARY1); - new CheckBox(line, rect_t{}, GET_SET_INVERTED(g_eeGeneral.noJitterFilter)); + auto serial = new SerialConfigWindow(window, rect_t{}); + serial->padLeft(lv_dpx(8)); // Calibration new Subtitle(window, rect_t{}, STR_INPUTS, 0, COLOR_THEME_PRIMARY1); diff --git a/radio/src/targets/simu/simpgmspace.cpp b/radio/src/targets/simu/simpgmspace.cpp index 7247f6196..37900a968 100644 --- a/radio/src/targets/simu/simpgmspace.cpp +++ b/radio/src/targets/simu/simpgmspace.cpp @@ -759,14 +759,26 @@ const etx_serial_port_t UsbSerialPort = { "USB-VCP", nullptr, nullptr }; #endif #if defined(AUX_SERIAL) -const etx_serial_port_t auxSerialPort = { "AUX1", nullptr, nullptr }; +#if defined(AUX_SERIAL_PWR_GPIO) + static void _fake_pwr_aux(uint8_t) {} + #define AUX_SERIAL_PWR _fake_pwr_aux +#else + #define AUX_SERIAL_PWR nullptr +#endif +const etx_serial_port_t auxSerialPort = { "AUX1", nullptr, AUX_SERIAL_PWR }; #define AUX_SERIAL_PORT &auxSerialPort #else #define AUX_SERIAL_PORT nullptr #endif #if defined(AUX2_SERIAL) -const etx_serial_port_t aux2SerialPort = { "AUX2", nullptr, nullptr }; +#if defined(AUX_SERIAL_PWR_GPIO) + static void _fake_pwr_aux2(uint8_t) {} + #define AUX2_SERIAL_PWR _fake_pwr_aux2 +#else + #define AUX2_SERIAL_PWR nullptr +#endif +const etx_serial_port_t aux2SerialPort = { "AUX2", nullptr, AUX2_SERIAL_PWR }; #define AUX2_SERIAL_PORT &aux2SerialPort #else #define AUX2_SERIAL_PORT nullptr