Allow selecting higher baud rates (#640)

* higher baud rates

* Update colorlcd models to support selectable baud tp 3.75M

# Conflicts:
#	radio/src/gui/colorlcd/radio_hardware.cpp

Co-authored-by: Jye <JyeSmith@users.noreply.github.com>
Co-authored-by: Paul Kendall <pkendall64@gmail.com>
This commit is contained in:
Jye
2021-09-12 06:46:43 +10:00
committed by GitHub
co-authored by Jye Paul Kendall
parent 3778ed26dd
commit 884bcec13c
6 changed files with 43 additions and 14 deletions
+25 -2
View File
@@ -149,6 +149,21 @@ class BluetoothConfigWindow : public FormGroup
};
#endif
void restartExternalModule()
{
if (!IS_EXTERNAL_MODULE_ON()) {
return;
}
pauseMixerCalculations();
pausePulses();
EXTERNAL_MODULE_OFF();
RTOS_WAIT_MS(20); // 20ms so that the pulses interrupt will reinit the frame rate
telemetryProtocol = 255; // force telemetry port + module reinitialization
EXTERNAL_MODULE_ON();
resumePulses();
resumeMixerCalculations();
}
void RadioHardwarePage::build(FormWindow * window)
{
FormGridLayout grid;
@@ -259,10 +274,18 @@ void RadioHardwarePage::build(FormWindow * window)
new CheckBox(window, grid.getFieldSlot(1,0), GET_SET_INVERTED(g_eeGeneral.disableRtcWarning ));
grid.nextLine();
#if defined(CROSSFIRE) && SPORT_MAX_BAUDRATE < 400000
#if defined(CROSSFIRE)
// Max baud for external modules
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));
new Choice(window, grid.getFieldSlot(1,0), STR_CRSF_BAUDRATE, 0, DIM(CROSSFIRE_BAUDRATES) - 1,
[=]() -> int {
return DIM(CROSSFIRE_BAUDRATES) - 1 - g_eeGeneral.telemetryBaudrate;
},
[=](int newValue) {
g_eeGeneral.telemetryBaudrate = DIM(CROSSFIRE_BAUDRATES) - 1 - newValue;
SET_DIRTY();
restartExternalModule();
});
grid.nextLine();
#endif
@@ -165,7 +165,7 @@ enum {
ITEM_RADIO_HARDWARE_CAPACITY_CALIB,
#endif
#if (defined(CROSSFIRE) || defined(GHOST)) && SPORT_MAX_BAUDRATE < 400000
#if (defined(CROSSFIRE) || defined(GHOST))
ITEM_RADIO_HARDWARE_SERIAL_BAUDRATE,
#endif
@@ -287,7 +287,7 @@ enum {
#define TX_CAPACITY_MEASUREMENT_ROWS
#endif
#if (defined(CROSSFIRE) || defined(GHOST)) && (SPORT_MAX_BAUDRATE < 400000 || defined(DEBUG))
#if (defined(CROSSFIRE) || defined(GHOST))
#define MAX_BAUD_ROWS 0,
#else
#define MAX_BAUD_ROWS
@@ -575,7 +575,7 @@ void menuRadioHardware(event_t event)
break;
#endif
#if (defined(CROSSFIRE) || defined(GHOST)) && SPORT_MAX_BAUDRATE < 400000
#if (defined(CROSSFIRE) || defined(GHOST))
case ITEM_RADIO_HARDWARE_SERIAL_BAUDRATE:
lcdDrawTextAlignedLeft(y, STR_MAXBAUDRATE);
lcdDrawNumber(HW_SETTINGS_COLUMN2, y, CROSSFIRE_BAUDRATES[g_eeGeneral.telemetryBaudrate], attr|LEFT);