Skip to content

Commit 5f3a197

Browse files
authored
fix(radio): do not show Onebit on unsupported handsets (#6611)
1 parent c1b7e23 commit 5f3a197

File tree

10 files changed

+12
-6
lines changed

10 files changed

+12
-6
lines changed

radio/src/dataconstants.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,12 +660,14 @@ enum HatsMode {
660660
HATSMODE_GLOBAL
661661
};
662662

663+
#if defined(STM32F2) || defined(STM32F4)
663664
enum UartSampleModes {
664665
UART_SAMPLE_MODE_NORMAL = 0,
665666
UART_SAMPLE_MODE_ONEBIT,
666667

667668
UART_SAMPLE_MODE_MAX SKIP = UART_SAMPLE_MODE_ONEBIT
668669
};
670+
#endif
669671

670672
// PXX2 constants
671673
#define PXX2_LEN_REGISTRATION_ID 8

radio/src/datastructs_private.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,9 @@ PACK(struct RadioData {
10721072
CUST_ATTR(rotEncDirection, r_rotEncDirection, nullptr);
10731073
NOBACKUP(uint8_t rotEncMode:3);
10741074

1075+
#if defined(STM32F2) || defined(STM32F4)
10751076
NOBACKUP(int8_t uartSampleMode:2); // See UartSampleModes
1077+
#endif
10761078

10771079
#if defined(STICK_DEAD_ZONE)
10781080
NOBACKUP(uint8_t stickDeadZone:3);

radio/src/gui/colorlcd/radio/hw_extmodule.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#define SET_DIRTY() storageDirty(EE_GENERAL)
2727

28+
#if defined(STM32F4)
2829
ExternalModuleWindow::ExternalModuleWindow(Window *parent, FlexGridLayout& grid)
2930
{
3031
auto line = parent->newLine(grid);
@@ -39,3 +40,4 @@ ExternalModuleWindow::ExternalModuleWindow(Window *parent, FlexGridLayout& grid)
3940
restartModule(EXTERNAL_MODULE);
4041
});
4142
}
43+
#endif

radio/src/gui/colorlcd/radio/radio_hardware.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ void RadioHardwarePage::build(Window* window)
172172
new InternalModuleWindow(window, grid);
173173
#endif
174174

175-
#if defined(HARDWARE_EXTERNAL_MODULE)
175+
#if defined(HARDWARE_EXTERNAL_MODULE) && defined(STM32F4)
176176
new Subtitle(window, STR_EXTERNALRF);
177177
new ExternalModuleWindow(window, grid);
178178
#endif

radio/src/gui/common/stdlcd/radio_hardware.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ static void _init_menu_tab_array(uint8_t* tab, size_t len)
314314
memset((void*)&tab[ITEM_RADIO_HARDWARE_LABEL_INTERNAL_MODULE], HIDDEN_ROW, 3);
315315
#endif
316316

317-
#if defined(HARDWARE_EXTERNAL_MODULE)
317+
#if defined(HARDWARE_EXTERNAL_MODULE) && (defined(STM32F2) || defined(STM32F4))
318318
tab[ITEM_RADIO_HARDWARE_SERIAL_SAMPLE_MODE] = 0;
319319
#else
320320
tab[ITEM_RADIO_HARDWARE_SERIAL_SAMPLE_MODE] = HIDDEN_ROW;
@@ -502,12 +502,14 @@ void menuRadioHardware(event_t event)
502502
}
503503
break;
504504

505+
#if defined(STM32F2) || defined(STM32F4)
505506
case ITEM_RADIO_HARDWARE_SERIAL_SAMPLE_MODE:
506507
g_eeGeneral.uartSampleMode = editChoice(HW_SETTINGS_COLUMN2, y, STR_SAMPLE_MODE, STR_SAMPLE_MODES, g_eeGeneral.uartSampleMode, 0, UART_SAMPLE_MODE_MAX, attr, event);
507508
if (attr && checkIncDec_Ret) {
508509
restartModule(EXTERNAL_MODULE);
509510
}
510511
break;
512+
#endif
511513

512514
#if defined(BLUETOOTH)
513515
case ITEM_RADIO_HARDWARE_BLUETOOTH_MODE:

radio/src/hal/module_port.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,12 @@ static bool _init_serial_driver(etx_module_driver_t* d, const etx_module_port_t*
6969

7070
// S.PORT specific HW settings
7171
if (port->port == ETX_MOD_PORT_SPORT && params->baudrate >= 400000) {
72+
#if defined(STM32F2) || defined(STM32F4)
7273
// one-bit
7374
if (g_eeGeneral.uartSampleMode == UART_SAMPLE_MODE_ONEBIT) {
7475
if (drv->setHWOption) drv->setHWOption(d->ctx, ETX_HWOption_ONEBIT);
7576
}
77+
#endif
7678
}
7779

7880
// setup polarity

radio/src/storage/yaml/yaml_datastructs_pa01.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,6 @@ static const struct YamlNode struct_RadioData[] = {
407407
YAML_STRING("ownerRegistrationID", 8),
408408
YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr),
409409
YAML_UNSIGNED( "rotEncMode", 3 ),
410-
YAML_SIGNED( "uartSampleMode", 2 ),
411410
YAML_UNSIGNED( "stickDeadZone", 3 ),
412411
YAML_SIGNED( "imuMax", 8 ),
413412
YAML_SIGNED( "imuOffset", 8 ),

radio/src/storage/yaml/yaml_datastructs_st16.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,6 @@ static const struct YamlNode struct_RadioData[] = {
407407
YAML_STRING("ownerRegistrationID", 8),
408408
YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr),
409409
YAML_UNSIGNED( "rotEncMode", 3 ),
410-
YAML_SIGNED( "uartSampleMode", 2 ),
411410
YAML_UNSIGNED( "stickDeadZone", 3 ),
412411
YAML_SIGNED( "imuMax", 8 ),
413412
YAML_SIGNED( "imuOffset", 8 ),

radio/src/storage/yaml/yaml_datastructs_t15pro.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,6 @@ static const struct YamlNode struct_RadioData[] = {
407407
YAML_STRING("ownerRegistrationID", 8),
408408
YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr),
409409
YAML_UNSIGNED( "rotEncMode", 3 ),
410-
YAML_SIGNED( "uartSampleMode", 2 ),
411410
YAML_UNSIGNED( "stickDeadZone", 3 ),
412411
YAML_SIGNED( "imuMax", 8 ),
413412
YAML_SIGNED( "imuOffset", 8 ),

radio/src/storage/yaml/yaml_datastructs_tx15.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,6 @@ static const struct YamlNode struct_RadioData[] = {
407407
YAML_STRING("ownerRegistrationID", 8),
408408
YAML_CUSTOM("rotEncDirection",r_rotEncDirection,nullptr),
409409
YAML_UNSIGNED( "rotEncMode", 3 ),
410-
YAML_SIGNED( "uartSampleMode", 2 ),
411410
YAML_UNSIGNED( "stickDeadZone", 3 ),
412411
YAML_SIGNED( "imuMax", 8 ),
413412
YAML_SIGNED( "imuOffset", 8 ),

0 commit comments

Comments
 (0)