Add OneBit mode to HARDWARE menu. OneBit mode can help if your radio
has a slow inverter circuit by changing the UART sampling behaviour. * It was found that the X9D+ and X7 (maybe others) have a slow inveter that messes up reception of fast (400,000baud) UART signals. On the scope the rise time of the signal is very long. * See RM0033 24.3.3 Receiver / Selecting the proper oversampling method. Page 631. Also note that reducing the pull-up resistor from 10k to 1k at R82 (X9D+) / R406 (X7) will also help with the rise times. However on the X7 changing the resistor is not enough, OneBit is needed too.
This commit is contained in:
@@ -909,6 +909,13 @@ enum BluetoothModes {
|
||||
#endif
|
||||
};
|
||||
|
||||
enum UartSampleModes {
|
||||
UART_SAMPLE_MODE_NORMAL = 0,
|
||||
UART_SAMPLE_MODE_ONEBIT,
|
||||
|
||||
UART_SAMPLE_MODE_MAX = UART_SAMPLE_MODE_ONEBIT
|
||||
};
|
||||
|
||||
// PXX2 constants
|
||||
#define PXX2_LEN_REGISTRATION_ID 8
|
||||
#define PXX2_LEN_RX_NAME 8
|
||||
|
||||
@@ -821,6 +821,7 @@ PACK(struct RadioData {
|
||||
NOBACKUP(int8_t varioPitch);
|
||||
NOBACKUP(int8_t varioRange);
|
||||
NOBACKUP(int8_t varioRepeat);
|
||||
NOBACKUP(int8_t uartSampleMode:2); // See UartSampleModes
|
||||
CustomFunctionData customFn[MAX_SPECIAL_FUNCTIONS];
|
||||
|
||||
EXTRA_GENERAL_FIELDS
|
||||
@@ -946,25 +947,25 @@ static inline void check_struct()
|
||||
CHKSIZE(TrainerData, 16);
|
||||
|
||||
#if defined(PCBXLITES)
|
||||
CHKSIZE(RadioData, 860);
|
||||
CHKSIZE(RadioData, 861);
|
||||
CHKSIZE(ModelData, 6157);
|
||||
#elif defined(PCBXLITE)
|
||||
CHKSIZE(RadioData, 858);
|
||||
CHKSIZE(RadioData, 859);
|
||||
CHKSIZE(ModelData, 6157);
|
||||
#elif defined(PCBX7)
|
||||
CHKSIZE(RadioData, 864);
|
||||
CHKSIZE(RadioData, 865);
|
||||
CHKSIZE(ModelData, 6157);
|
||||
#elif defined(PCBX9E)
|
||||
CHKSIZE(RadioData, 960);
|
||||
CHKSIZE(RadioData, 961);
|
||||
CHKSIZE(ModelData, 6614);
|
||||
#elif defined(PCBX9D) || defined(PCBX9DP)
|
||||
CHKSIZE(RadioData, 898);
|
||||
CHKSIZE(RadioData, 899);
|
||||
CHKSIZE(ModelData, 6604);
|
||||
#elif defined(PCBSKY9X)
|
||||
CHKSIZE(RadioData, 735);
|
||||
CHKSIZE(RadioData, 736);
|
||||
CHKSIZE(ModelData, 5301);
|
||||
#elif defined(PCBHORUS)
|
||||
CHKSIZE(RadioData, 881);
|
||||
CHKSIZE(RadioData, 882);
|
||||
CHKSIZE(ModelData, 9736);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -168,6 +168,8 @@ enum {
|
||||
ITEM_RADIO_HARDWARE_SERIAL_BAUDRATE,
|
||||
#endif
|
||||
|
||||
ITEM_RADIO_HARDWARE_SERIAL_SAMPLE_MODE,
|
||||
|
||||
#if defined(BLUETOOTH)
|
||||
ITEM_RADIO_HARDWARE_BLUETOOTH_MODE,
|
||||
ITEM_RADIO_HARDWARE_BLUETOOTH_PAIRING_CODE,
|
||||
@@ -290,6 +292,8 @@ enum {
|
||||
#define MAX_BAUD_ROWS
|
||||
#endif
|
||||
|
||||
#define SERIAL_SAMPLE_MODE_ROWS 0,
|
||||
|
||||
#if defined(AUX_SERIAL)
|
||||
#define AUX_SERIAL_ROWS 0,
|
||||
#else
|
||||
@@ -321,6 +325,20 @@ void onFactoryResetConfirm(const char * result)
|
||||
}
|
||||
#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 menuRadioHardware(event_t event)
|
||||
{
|
||||
MENU(STR_HARDWARE, menuTabGeneral, MENU_RADIO_HARDWARE, HEADER_LINE + ITEM_RADIO_HARDWARE_MAX, {
|
||||
@@ -337,6 +355,7 @@ void menuRadioHardware(event_t event)
|
||||
RTC_ROW
|
||||
TX_CAPACITY_MEASUREMENT_ROWS
|
||||
MAX_BAUD_ROWS
|
||||
SERIAL_SAMPLE_MODE_ROWS
|
||||
BLUETOOTH_ROWS
|
||||
EXTERNAL_ANTENNA_ROW
|
||||
AUX_SERIAL_ROWS
|
||||
@@ -549,20 +568,20 @@ void menuRadioHardware(event_t event)
|
||||
lcdDrawNumber(HW_SETTINGS_COLUMN2, y, CROSSFIRE_BAUDRATES[g_eeGeneral.telemetryBaudrate], attr|LEFT);
|
||||
if (attr) {
|
||||
g_eeGeneral.telemetryBaudrate = DIM(CROSSFIRE_BAUDRATES) - 1 - checkIncDecModel(event, DIM(CROSSFIRE_BAUDRATES) - 1 - g_eeGeneral.telemetryBaudrate, 0, DIM(CROSSFIRE_BAUDRATES) - 1);
|
||||
if (checkIncDec_Ret && IS_EXTERNAL_MODULE_ON()) {
|
||||
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();
|
||||
if (checkIncDec_Ret) {
|
||||
restartExternalModule();
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
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) {
|
||||
restartExternalModule();
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined(BLUETOOTH)
|
||||
case ITEM_RADIO_HARDWARE_BLUETOOTH_MODE:
|
||||
lcdDrawTextAlignedLeft(y, STR_BLUETOOTH);
|
||||
|
||||
@@ -77,6 +77,9 @@ void telemetryPortInit(uint32_t baudrate, uint8_t mode)
|
||||
}
|
||||
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
|
||||
USART_InitStructure.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;
|
||||
if (g_eeGeneral.uartSampleMode == UART_SAMPLE_MODE_ONEBIT) {
|
||||
USART_OneBitMethodCmd(TELEMETRY_USART, ENABLE);
|
||||
}
|
||||
USART_Init(TELEMETRY_USART, &USART_InitStructure);
|
||||
USART_Cmd(TELEMETRY_USART, ENABLE);
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ ISTR(SWTYPES);
|
||||
ISTR(POTTYPES);
|
||||
ISTR(SLIDERTYPES);
|
||||
ISTR(ANTENNA_MODES);
|
||||
ISTR(SAMPLE_MODES);
|
||||
ISTR(SPORT_UPDATE_POWER_MODES);
|
||||
ISTR(SPORT_MODES);
|
||||
|
||||
@@ -419,6 +420,7 @@ const char STR_FORMATTING[] = TR_FORMATTING;
|
||||
const char STR_TEMP_CALIB[] = TR_TEMP_CALIB;
|
||||
const char STR_TIME[] = TR_TIME;
|
||||
const char STR_MAXBAUDRATE[] = TR_MAXBAUDRATE;
|
||||
const char STR_SAMPLE_MODE[] = TR_SAMPLE_MODE;
|
||||
const char STR_BAUDRATE[] = TR_BAUDRATE;
|
||||
const char STR_SD_INFO_TITLE[] = TR_SD_INFO_TITLE;
|
||||
const char STR_SD_TYPE[] = TR_SD_TYPE;
|
||||
|
||||
@@ -647,6 +647,8 @@ extern const char STR_FORMATTING[];
|
||||
extern const char STR_TEMP_CALIB[];
|
||||
extern const char STR_TIME[];
|
||||
extern const char STR_MAXBAUDRATE[];
|
||||
extern const char STR_SAMPLE_MODE[];
|
||||
extern const char STR_SAMPLE_MODES[];
|
||||
extern const char STR_BAUDRATE[];
|
||||
extern const char STR_SD_INFO_TITLE[];
|
||||
extern const char STR_SD_TYPE[];
|
||||
|
||||
@@ -805,6 +805,10 @@
|
||||
#define TR_TEMP_CALIB " +=\006Teplota"
|
||||
#define TR_TIME "Čas"
|
||||
#define TR_MAXBAUDRATE "Max baudů"
|
||||
#define TR_SAMPLE_MODE "Sample Mode"
|
||||
|
||||
#define LEN_SAMPLE_MODES "\006"
|
||||
#define TR_SAMPLE_MODES "Normal""OneBit"
|
||||
|
||||
#define TR_BLUETOOTH "Bluetooth"
|
||||
#define TR_BLUETOOTH_DISC "Hledat"
|
||||
|
||||
@@ -807,6 +807,10 @@
|
||||
#define TR_TEMP_CALIB "Temp. abgl."
|
||||
#define TR_TIME "Uhrzeit:"
|
||||
#define TR_MAXBAUDRATE "Max Baud"
|
||||
#define TR_SAMPLE_MODE "Sample Mode"
|
||||
|
||||
#define LEN_SAMPLE_MODES "\006"
|
||||
#define TR_SAMPLE_MODES "Normal""OneBit"
|
||||
|
||||
#define TR_BLUETOOTH "Bluetooth"
|
||||
#define TR_BLUETOOTH_DISC "Discover"
|
||||
|
||||
@@ -811,6 +811,11 @@
|
||||
#define TR_TEMP_CALIB "Temp. Calib"
|
||||
#define TR_TIME "Time"
|
||||
#define TR_MAXBAUDRATE "Max bauds"
|
||||
#define TR_SAMPLE_MODE "Sample Mode"
|
||||
|
||||
#define LEN_SAMPLE_MODES "\006"
|
||||
#define TR_SAMPLE_MODES "Normal""OneBit"
|
||||
|
||||
#define TR_BLUETOOTH "Bluetooth"
|
||||
#define TR_BLUETOOTH_DISC "Discover"
|
||||
#define TR_BLUETOOTH_INIT "Init"
|
||||
|
||||
@@ -824,6 +824,10 @@
|
||||
#define TR_TEMP_CALIB "Temp. Calib"
|
||||
#define TR_TIME "Time"
|
||||
#define TR_MAXBAUDRATE "Max bauds"
|
||||
#define TR_SAMPLE_MODE "Sample Mode"
|
||||
|
||||
#define LEN_SAMPLE_MODES "\006"
|
||||
#define TR_SAMPLE_MODES "Normal""OneBit"
|
||||
|
||||
#define TR_BLUETOOTH "Bluetooth"
|
||||
#define TR_BLUETOOTH_DISC "Discover"
|
||||
|
||||
@@ -827,6 +827,11 @@
|
||||
#define TR_TEMP_CALIB "Calib. temp"
|
||||
#define TR_TIME "Heure"
|
||||
#define TR_MAXBAUDRATE "Max bauds"
|
||||
#define TR_SAMPLE_MODE "Sample Mode"
|
||||
|
||||
#define LEN_SAMPLE_MODES "\006"
|
||||
#define TR_SAMPLE_MODES "Normal""OneBit"
|
||||
|
||||
#define TR_BLUETOOTH "Bluetooth"
|
||||
#define TR_BLUETOOTH_DISC "Découvrir"
|
||||
#define TR_BLUETOOTH_INIT "Init"
|
||||
|
||||
@@ -826,6 +826,10 @@
|
||||
#define TR_TEMP_CALIB "Temp. Calib."
|
||||
#define TR_TIME "Ora"
|
||||
#define TR_MAXBAUDRATE "Max Bauds"
|
||||
#define TR_SAMPLE_MODE "Sample Mode"
|
||||
|
||||
#define LEN_SAMPLE_MODES "\006"
|
||||
#define TR_SAMPLE_MODES "Normal""OneBit"
|
||||
|
||||
#define TR_BLUETOOTH "Bluetooth"
|
||||
#define TR_BLUETOOTH_DISC "Cerca"
|
||||
|
||||
@@ -812,6 +812,10 @@
|
||||
#define TR_TEMP_CALIB "Temp. Calib."
|
||||
#define TR_TIME "Tijd:"
|
||||
#define TR_MAXBAUDRATE "Max bauds"
|
||||
#define TR_SAMPLE_MODE "Sample Mode"
|
||||
|
||||
#define LEN_SAMPLE_MODES "\006"
|
||||
#define TR_SAMPLE_MODES "Normal""OneBit"
|
||||
|
||||
#define TR_BLUETOOTH "Bluetooth"
|
||||
#define TR_BLUETOOTH_DISC "Discover"
|
||||
|
||||
@@ -825,6 +825,10 @@
|
||||
#define TR_TEMP_CALIB "Temp. kalibracji"
|
||||
#define TR_TIME "Czas"
|
||||
#define TR_MAXBAUDRATE "Max bauds"
|
||||
#define TR_SAMPLE_MODE "Sample Mode"
|
||||
|
||||
#define LEN_SAMPLE_MODES "\006"
|
||||
#define TR_SAMPLE_MODES "Normal""OneBit"
|
||||
|
||||
#define TR_BLUETOOTH "Bluetooth"
|
||||
#define TR_BLUETOOTH_DISC "Discover"
|
||||
|
||||
@@ -826,6 +826,10 @@
|
||||
#define TR_TEMP_CALIB "Temp. Calib"
|
||||
#define TR_TIME "Time"
|
||||
#define TR_MAXBAUDRATE "Max bauds"
|
||||
#define TR_SAMPLE_MODE "Sample Mode"
|
||||
|
||||
#define LEN_SAMPLE_MODES "\006"
|
||||
#define TR_SAMPLE_MODES "Normal""OneBit"
|
||||
|
||||
#define TR_BLUETOOTH "Bluetooth"
|
||||
#define TR_BLUETOOTH_DISC "Discover"
|
||||
|
||||
@@ -825,6 +825,10 @@
|
||||
#define TR_TEMP_CALIB "Temp. kalib."
|
||||
#define TR_TIME "Tid "
|
||||
#define TR_MAXBAUDRATE "Max bauds"
|
||||
#define TR_SAMPLE_MODE "Sample Mode"
|
||||
|
||||
#define LEN_SAMPLE_MODES "\006"
|
||||
#define TR_SAMPLE_MODES "Normal""OneBit"
|
||||
|
||||
#define TR_BLUETOOTH "Bluetooth"
|
||||
#define TR_BLUETOOTH_DISC "Discover"
|
||||
|
||||
Reference in New Issue
Block a user