Merge branch '2.3' into 2.4
# Conflicts: # radio/src/datastructs.h
This commit is contained in:
@@ -881,6 +881,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
|
||||
|
||||
@@ -842,6 +842,8 @@ PACK(struct RadioData {
|
||||
char ownerRegistrationID[PXX2_LEN_REGISTRATION_ID];
|
||||
|
||||
GYRO_FIELDS
|
||||
|
||||
NOBACKUP(int8_t uartSampleMode:2); // See UartSampleModes
|
||||
});
|
||||
|
||||
#undef SWITCHES_WARNING_DATA
|
||||
@@ -948,19 +950,19 @@ 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(PCBHORUS)
|
||||
CHKSIZE(RadioData, 901);
|
||||
|
||||
@@ -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,21 @@ 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)
|
||||
{
|
||||
uint8_t old_editMode = s_editMode;
|
||||
@@ -339,6 +358,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
|
||||
@@ -560,20 +580,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);
|
||||
|
||||
@@ -580,6 +580,7 @@ bool setupPulsesInternalModule(uint8_t protocol)
|
||||
void stopPulsesInternalModule()
|
||||
{
|
||||
if (moduleState[INTERNAL_MODULE].protocol != PROTOCOL_CHANNELS_UNINITIALIZED) {
|
||||
mixerSchedulerSetPeriod(INTERNAL_MODULE, 0);
|
||||
intmoduleStop();
|
||||
moduleState[INTERNAL_MODULE].protocol = PROTOCOL_CHANNELS_NONE;
|
||||
}
|
||||
@@ -607,6 +608,7 @@ bool setupPulsesInternalModule()
|
||||
void stopPulsesExternalModule()
|
||||
{
|
||||
if (moduleState[EXTERNAL_MODULE].protocol != PROTOCOL_CHANNELS_UNINITIALIZED) {
|
||||
mixerSchedulerSetPeriod(EXTERNAL_MODULE, 0);
|
||||
extmoduleStop();
|
||||
moduleState[EXTERNAL_MODULE].protocol = PROTOCOL_CHANNELS_NONE;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ ISTR(SWTYPES);
|
||||
ISTR(POTTYPES);
|
||||
ISTR(SLIDERTYPES);
|
||||
ISTR(ANTENNA_MODES);
|
||||
ISTR(SAMPLE_MODES);
|
||||
ISTR(SPORT_UPDATE_POWER_MODES);
|
||||
ISTR(CRSF_BAUDRATE);
|
||||
ISTR(PPM_POL);
|
||||
@@ -443,6 +444,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;
|
||||
|
||||
@@ -679,6 +679,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[];
|
||||
|
||||
@@ -837,6 +837,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"
|
||||
|
||||
@@ -842,6 +842,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"
|
||||
|
||||
@@ -846,6 +846,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"
|
||||
|
||||
@@ -858,6 +858,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"
|
||||
|
||||
@@ -863,6 +863,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"
|
||||
|
||||
@@ -864,6 +864,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"
|
||||
|
||||
@@ -847,6 +847,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"
|
||||
|
||||
@@ -861,6 +861,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"
|
||||
|
||||
@@ -862,6 +862,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"
|
||||
|
||||
@@ -864,6 +864,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