fix(radio): do not show Onebit on unsupported handsets (#6611)
This commit is contained in:
@@ -660,12 +660,14 @@ enum HatsMode {
|
||||
HATSMODE_GLOBAL
|
||||
};
|
||||
|
||||
#if defined(STM32F2) || defined(STM32F4)
|
||||
enum UartSampleModes {
|
||||
UART_SAMPLE_MODE_NORMAL = 0,
|
||||
UART_SAMPLE_MODE_ONEBIT,
|
||||
|
||||
UART_SAMPLE_MODE_MAX SKIP = UART_SAMPLE_MODE_ONEBIT
|
||||
};
|
||||
#endif
|
||||
|
||||
// PXX2 constants
|
||||
#define PXX2_LEN_REGISTRATION_ID 8
|
||||
|
||||
@@ -1072,7 +1072,9 @@ PACK(struct RadioData {
|
||||
CUST_ATTR(rotEncDirection, r_rotEncDirection, nullptr);
|
||||
NOBACKUP(uint8_t rotEncMode:3);
|
||||
|
||||
#if defined(STM32F2) || defined(STM32F4)
|
||||
NOBACKUP(int8_t uartSampleMode:2); // See UartSampleModes
|
||||
#endif
|
||||
|
||||
#if defined(STICK_DEAD_ZONE)
|
||||
NOBACKUP(uint8_t stickDeadZone:3);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_GENERAL)
|
||||
|
||||
#if defined(STM32F4)
|
||||
ExternalModuleWindow::ExternalModuleWindow(Window *parent, FlexGridLayout& grid)
|
||||
{
|
||||
auto line = parent->newLine(grid);
|
||||
@@ -39,3 +40,4 @@ ExternalModuleWindow::ExternalModuleWindow(Window *parent, FlexGridLayout& grid)
|
||||
restartModule(EXTERNAL_MODULE);
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -172,7 +172,7 @@ void RadioHardwarePage::build(Window* window)
|
||||
new InternalModuleWindow(window, grid);
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_EXTERNAL_MODULE)
|
||||
#if defined(HARDWARE_EXTERNAL_MODULE) && defined(STM32F4)
|
||||
new Subtitle(window, STR_EXTERNALRF);
|
||||
new ExternalModuleWindow(window, grid);
|
||||
#endif
|
||||
|
||||
@@ -314,7 +314,7 @@ static void _init_menu_tab_array(uint8_t* tab, size_t len)
|
||||
memset((void*)&tab[ITEM_RADIO_HARDWARE_LABEL_INTERNAL_MODULE], HIDDEN_ROW, 3);
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_EXTERNAL_MODULE)
|
||||
#if defined(HARDWARE_EXTERNAL_MODULE) && (defined(STM32F2) || defined(STM32F4))
|
||||
tab[ITEM_RADIO_HARDWARE_SERIAL_SAMPLE_MODE] = 0;
|
||||
#else
|
||||
tab[ITEM_RADIO_HARDWARE_SERIAL_SAMPLE_MODE] = HIDDEN_ROW;
|
||||
@@ -502,12 +502,14 @@ void menuRadioHardware(event_t event)
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined(STM32F2) || defined(STM32F4)
|
||||
case ITEM_RADIO_HARDWARE_SERIAL_SAMPLE_MODE:
|
||||
g_eeGeneral.uartSampleMode = editChoice(HW_SETTINGS_COLUMN2, y, STR_SAMPLE_MODE, STR_SAMPLE_MODES, g_eeGeneral.uartSampleMode, 0, UART_SAMPLE_MODE_MAX, attr, event);
|
||||
if (attr && checkIncDec_Ret) {
|
||||
restartModule(EXTERNAL_MODULE);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(BLUETOOTH)
|
||||
case ITEM_RADIO_HARDWARE_BLUETOOTH_MODE:
|
||||
|
||||
@@ -69,10 +69,12 @@ static bool _init_serial_driver(etx_module_driver_t* d, const etx_module_port_t*
|
||||
|
||||
// S.PORT specific HW settings
|
||||
if (port->port == ETX_MOD_PORT_SPORT && params->baudrate >= 400000) {
|
||||
#if defined(STM32F2) || defined(STM32F4)
|
||||
// one-bit
|
||||
if (g_eeGeneral.uartSampleMode == UART_SAMPLE_MODE_ONEBIT) {
|
||||
if (drv->setHWOption) drv->setHWOption(d->ctx, ETX_HWOption_ONEBIT);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// setup polarity
|
||||
|
||||
@@ -407,7 +407,6 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr),
|
||||
YAML_UNSIGNED( "rotEncMode", 3 ),
|
||||
YAML_SIGNED( "uartSampleMode", 2 ),
|
||||
YAML_UNSIGNED( "stickDeadZone", 3 ),
|
||||
YAML_SIGNED( "imuMax", 8 ),
|
||||
YAML_SIGNED( "imuOffset", 8 ),
|
||||
|
||||
@@ -407,7 +407,6 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr),
|
||||
YAML_UNSIGNED( "rotEncMode", 3 ),
|
||||
YAML_SIGNED( "uartSampleMode", 2 ),
|
||||
YAML_UNSIGNED( "stickDeadZone", 3 ),
|
||||
YAML_SIGNED( "imuMax", 8 ),
|
||||
YAML_SIGNED( "imuOffset", 8 ),
|
||||
|
||||
@@ -407,7 +407,6 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr),
|
||||
YAML_UNSIGNED( "rotEncMode", 3 ),
|
||||
YAML_SIGNED( "uartSampleMode", 2 ),
|
||||
YAML_UNSIGNED( "stickDeadZone", 3 ),
|
||||
YAML_SIGNED( "imuMax", 8 ),
|
||||
YAML_SIGNED( "imuOffset", 8 ),
|
||||
|
||||
@@ -407,7 +407,6 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr),
|
||||
YAML_UNSIGNED( "rotEncMode", 3 ),
|
||||
YAML_SIGNED( "uartSampleMode", 2 ),
|
||||
YAML_UNSIGNED( "stickDeadZone", 3 ),
|
||||
YAML_SIGNED( "imuMax", 8 ),
|
||||
YAML_SIGNED( "imuOffset", 8 ),
|
||||
|
||||
Reference in New Issue
Block a user