Merge branch '2.3' into 2.4

# Conflicts:
#	radio/src/datastructs.h
This commit is contained in:
Raphael Coeffic
2021-06-10 17:31:39 +02:00
17 changed files with 94 additions and 14 deletions
+7
View File
@@ -881,6 +881,13 @@ enum BluetoothModes {
#endif #endif
}; };
enum UartSampleModes {
UART_SAMPLE_MODE_NORMAL = 0,
UART_SAMPLE_MODE_ONEBIT,
UART_SAMPLE_MODE_MAX = UART_SAMPLE_MODE_ONEBIT
};
// PXX2 constants // PXX2 constants
#define PXX2_LEN_REGISTRATION_ID 8 #define PXX2_LEN_REGISTRATION_ID 8
#define PXX2_LEN_RX_NAME 8 #define PXX2_LEN_RX_NAME 8
+7 -5
View File
@@ -842,6 +842,8 @@ PACK(struct RadioData {
char ownerRegistrationID[PXX2_LEN_REGISTRATION_ID]; char ownerRegistrationID[PXX2_LEN_REGISTRATION_ID];
GYRO_FIELDS GYRO_FIELDS
NOBACKUP(int8_t uartSampleMode:2); // See UartSampleModes
}); });
#undef SWITCHES_WARNING_DATA #undef SWITCHES_WARNING_DATA
@@ -948,19 +950,19 @@ static inline void check_struct()
CHKSIZE(TrainerData, 16); CHKSIZE(TrainerData, 16);
#if defined(PCBXLITES) #if defined(PCBXLITES)
CHKSIZE(RadioData, 860); CHKSIZE(RadioData, 861);
CHKSIZE(ModelData, 6157); CHKSIZE(ModelData, 6157);
#elif defined(PCBXLITE) #elif defined(PCBXLITE)
CHKSIZE(RadioData, 858); CHKSIZE(RadioData, 859);
CHKSIZE(ModelData, 6157); CHKSIZE(ModelData, 6157);
#elif defined(PCBX7) #elif defined(PCBX7)
CHKSIZE(RadioData, 864); CHKSIZE(RadioData, 865);
CHKSIZE(ModelData, 6157); CHKSIZE(ModelData, 6157);
#elif defined(PCBX9E) #elif defined(PCBX9E)
CHKSIZE(RadioData, 960); CHKSIZE(RadioData, 961);
CHKSIZE(ModelData, 6614); CHKSIZE(ModelData, 6614);
#elif defined(PCBX9D) || defined(PCBX9DP) #elif defined(PCBX9D) || defined(PCBX9DP)
CHKSIZE(RadioData, 898); CHKSIZE(RadioData, 899);
CHKSIZE(ModelData, 6604); CHKSIZE(ModelData, 6604);
#elif defined(PCBHORUS) #elif defined(PCBHORUS)
CHKSIZE(RadioData, 901); CHKSIZE(RadioData, 901);
+29 -9
View File
@@ -168,6 +168,8 @@ enum {
ITEM_RADIO_HARDWARE_SERIAL_BAUDRATE, ITEM_RADIO_HARDWARE_SERIAL_BAUDRATE,
#endif #endif
ITEM_RADIO_HARDWARE_SERIAL_SAMPLE_MODE,
#if defined(BLUETOOTH) #if defined(BLUETOOTH)
ITEM_RADIO_HARDWARE_BLUETOOTH_MODE, ITEM_RADIO_HARDWARE_BLUETOOTH_MODE,
ITEM_RADIO_HARDWARE_BLUETOOTH_PAIRING_CODE, ITEM_RADIO_HARDWARE_BLUETOOTH_PAIRING_CODE,
@@ -290,6 +292,8 @@ enum {
#define MAX_BAUD_ROWS #define MAX_BAUD_ROWS
#endif #endif
#define SERIAL_SAMPLE_MODE_ROWS 0,
#if defined(AUX_SERIAL) #if defined(AUX_SERIAL)
#define AUX_SERIAL_ROWS 0, #define AUX_SERIAL_ROWS 0,
#else #else
@@ -321,6 +325,21 @@ void onFactoryResetConfirm(const char * result)
} }
#endif #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) void menuRadioHardware(event_t event)
{ {
uint8_t old_editMode = s_editMode; uint8_t old_editMode = s_editMode;
@@ -339,6 +358,7 @@ void menuRadioHardware(event_t event)
RTC_ROW RTC_ROW
TX_CAPACITY_MEASUREMENT_ROWS TX_CAPACITY_MEASUREMENT_ROWS
MAX_BAUD_ROWS MAX_BAUD_ROWS
SERIAL_SAMPLE_MODE_ROWS
BLUETOOTH_ROWS BLUETOOTH_ROWS
EXTERNAL_ANTENNA_ROW EXTERNAL_ANTENNA_ROW
AUX_SERIAL_ROWS AUX_SERIAL_ROWS
@@ -560,20 +580,20 @@ void menuRadioHardware(event_t event)
lcdDrawNumber(HW_SETTINGS_COLUMN2, y, CROSSFIRE_BAUDRATES[g_eeGeneral.telemetryBaudrate], attr|LEFT); lcdDrawNumber(HW_SETTINGS_COLUMN2, y, CROSSFIRE_BAUDRATES[g_eeGeneral.telemetryBaudrate], attr|LEFT);
if (attr) { if (attr) {
g_eeGeneral.telemetryBaudrate = DIM(CROSSFIRE_BAUDRATES) - 1 - checkIncDecModel(event, DIM(CROSSFIRE_BAUDRATES) - 1 - g_eeGeneral.telemetryBaudrate, 0, DIM(CROSSFIRE_BAUDRATES) - 1); 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()) { if (checkIncDec_Ret) {
pauseMixerCalculations(); restartExternalModule();
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();
} }
} }
break; break;
#endif #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) #if defined(BLUETOOTH)
case ITEM_RADIO_HARDWARE_BLUETOOTH_MODE: case ITEM_RADIO_HARDWARE_BLUETOOTH_MODE:
lcdDrawTextAlignedLeft(y, STR_BLUETOOTH); lcdDrawTextAlignedLeft(y, STR_BLUETOOTH);
+2
View File
@@ -580,6 +580,7 @@ bool setupPulsesInternalModule(uint8_t protocol)
void stopPulsesInternalModule() void stopPulsesInternalModule()
{ {
if (moduleState[INTERNAL_MODULE].protocol != PROTOCOL_CHANNELS_UNINITIALIZED) { if (moduleState[INTERNAL_MODULE].protocol != PROTOCOL_CHANNELS_UNINITIALIZED) {
mixerSchedulerSetPeriod(INTERNAL_MODULE, 0);
intmoduleStop(); intmoduleStop();
moduleState[INTERNAL_MODULE].protocol = PROTOCOL_CHANNELS_NONE; moduleState[INTERNAL_MODULE].protocol = PROTOCOL_CHANNELS_NONE;
} }
@@ -607,6 +608,7 @@ bool setupPulsesInternalModule()
void stopPulsesExternalModule() void stopPulsesExternalModule()
{ {
if (moduleState[EXTERNAL_MODULE].protocol != PROTOCOL_CHANNELS_UNINITIALIZED) { if (moduleState[EXTERNAL_MODULE].protocol != PROTOCOL_CHANNELS_UNINITIALIZED) {
mixerSchedulerSetPeriod(EXTERNAL_MODULE, 0);
extmoduleStop(); extmoduleStop();
moduleState[EXTERNAL_MODULE].protocol = PROTOCOL_CHANNELS_NONE; 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_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Tx | USART_Mode_Rx; 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_Init(TELEMETRY_USART, &USART_InitStructure);
USART_Cmd(TELEMETRY_USART, ENABLE); USART_Cmd(TELEMETRY_USART, ENABLE);
+2
View File
@@ -85,6 +85,7 @@ ISTR(SWTYPES);
ISTR(POTTYPES); ISTR(POTTYPES);
ISTR(SLIDERTYPES); ISTR(SLIDERTYPES);
ISTR(ANTENNA_MODES); ISTR(ANTENNA_MODES);
ISTR(SAMPLE_MODES);
ISTR(SPORT_UPDATE_POWER_MODES); ISTR(SPORT_UPDATE_POWER_MODES);
ISTR(CRSF_BAUDRATE); ISTR(CRSF_BAUDRATE);
ISTR(PPM_POL); ISTR(PPM_POL);
@@ -443,6 +444,7 @@ const char STR_FORMATTING[] = TR_FORMATTING;
const char STR_TEMP_CALIB[] = TR_TEMP_CALIB; const char STR_TEMP_CALIB[] = TR_TEMP_CALIB;
const char STR_TIME[] = TR_TIME; const char STR_TIME[] = TR_TIME;
const char STR_MAXBAUDRATE[] = TR_MAXBAUDRATE; const char STR_MAXBAUDRATE[] = TR_MAXBAUDRATE;
const char STR_SAMPLE_MODE[] = TR_SAMPLE_MODE;
const char STR_BAUDRATE[] = TR_BAUDRATE; const char STR_BAUDRATE[] = TR_BAUDRATE;
const char STR_SD_INFO_TITLE[] = TR_SD_INFO_TITLE; const char STR_SD_INFO_TITLE[] = TR_SD_INFO_TITLE;
const char STR_SD_TYPE[] = TR_SD_TYPE; const char STR_SD_TYPE[] = TR_SD_TYPE;
+2
View File
@@ -679,6 +679,8 @@ extern const char STR_FORMATTING[];
extern const char STR_TEMP_CALIB[]; extern const char STR_TEMP_CALIB[];
extern const char STR_TIME[]; extern const char STR_TIME[];
extern const char STR_MAXBAUDRATE[]; 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_BAUDRATE[];
extern const char STR_SD_INFO_TITLE[]; extern const char STR_SD_INFO_TITLE[];
extern const char STR_SD_TYPE[]; extern const char STR_SD_TYPE[];
+4
View File
@@ -837,6 +837,10 @@
#define TR_TEMP_CALIB " +=\006Teplota" #define TR_TEMP_CALIB " +=\006Teplota"
#define TR_TIME "Čas" #define TR_TIME "Čas"
#define TR_MAXBAUDRATE "Max baudů" #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 "Bluetooth"
#define TR_BLUETOOTH_DISC "Hledat" #define TR_BLUETOOTH_DISC "Hledat"
+4
View File
@@ -842,6 +842,10 @@
#define TR_TEMP_CALIB "Temp. abgl." #define TR_TEMP_CALIB "Temp. abgl."
#define TR_TIME "Uhrzeit:" #define TR_TIME "Uhrzeit:"
#define TR_MAXBAUDRATE "Max Baud" #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 "Bluetooth"
#define TR_BLUETOOTH_DISC "Discover" #define TR_BLUETOOTH_DISC "Discover"
+5
View File
@@ -846,6 +846,11 @@
#define TR_TEMP_CALIB "Temp. Calib" #define TR_TEMP_CALIB "Temp. Calib"
#define TR_TIME "Time" #define TR_TIME "Time"
#define TR_MAXBAUDRATE "Max bauds" #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 "Bluetooth"
#define TR_BLUETOOTH_DISC "Discover" #define TR_BLUETOOTH_DISC "Discover"
#define TR_BLUETOOTH_INIT "Init" #define TR_BLUETOOTH_INIT "Init"
+4
View File
@@ -858,6 +858,10 @@
#define TR_TEMP_CALIB "Temp. Calib" #define TR_TEMP_CALIB "Temp. Calib"
#define TR_TIME "Time" #define TR_TIME "Time"
#define TR_MAXBAUDRATE "Max bauds" #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 "Bluetooth"
#define TR_BLUETOOTH_DISC "Discover" #define TR_BLUETOOTH_DISC "Discover"
+5
View File
@@ -863,6 +863,11 @@
#define TR_TEMP_CALIB "Calib. temp" #define TR_TEMP_CALIB "Calib. temp"
#define TR_TIME "Heure" #define TR_TIME "Heure"
#define TR_MAXBAUDRATE "Max bauds" #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 "Bluetooth"
#define TR_BLUETOOTH_DISC "Découvrir" #define TR_BLUETOOTH_DISC "Découvrir"
#define TR_BLUETOOTH_INIT "Init" #define TR_BLUETOOTH_INIT "Init"
+4
View File
@@ -864,6 +864,10 @@
#define TR_TEMP_CALIB "Temp. Calib." #define TR_TEMP_CALIB "Temp. Calib."
#define TR_TIME "Ora" #define TR_TIME "Ora"
#define TR_MAXBAUDRATE "Max Bauds" #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 "Bluetooth"
#define TR_BLUETOOTH_DISC "Cerca" #define TR_BLUETOOTH_DISC "Cerca"
+4
View File
@@ -847,6 +847,10 @@
#define TR_TEMP_CALIB "Temp. Calib." #define TR_TEMP_CALIB "Temp. Calib."
#define TR_TIME "Tijd:" #define TR_TIME "Tijd:"
#define TR_MAXBAUDRATE "Max bauds" #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 "Bluetooth"
#define TR_BLUETOOTH_DISC "Discover" #define TR_BLUETOOTH_DISC "Discover"
+4
View File
@@ -861,6 +861,10 @@
#define TR_TEMP_CALIB "Temp. kalibracji" #define TR_TEMP_CALIB "Temp. kalibracji"
#define TR_TIME "Czas" #define TR_TIME "Czas"
#define TR_MAXBAUDRATE "Max bauds" #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 "Bluetooth"
#define TR_BLUETOOTH_DISC "Discover" #define TR_BLUETOOTH_DISC "Discover"
+4
View File
@@ -862,6 +862,10 @@
#define TR_TEMP_CALIB "Temp. Calib" #define TR_TEMP_CALIB "Temp. Calib"
#define TR_TIME "Time" #define TR_TIME "Time"
#define TR_MAXBAUDRATE "Max bauds" #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 "Bluetooth"
#define TR_BLUETOOTH_DISC "Discover" #define TR_BLUETOOTH_DISC "Discover"
+4
View File
@@ -864,6 +864,10 @@
#define TR_TEMP_CALIB "Temp. kalib." #define TR_TEMP_CALIB "Temp. kalib."
#define TR_TIME "Tid " #define TR_TIME "Tid "
#define TR_MAXBAUDRATE "Max bauds" #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 "Bluetooth"
#define TR_BLUETOOTH_DISC "Discover" #define TR_BLUETOOTH_DISC "Discover"