fix: Quick fix to let CRSF be used with MPM wireless trainer - limiations apply (#1724)

* Let's do some dirty hack with MPM RX

Resolves #1671

* Use the right function to sync and shutdown sync on external MPM as well
This commit is contained in:
Raphael Coeffic
2022-03-25 12:04:15 +10:00
committed by GitHub
parent b359e2db71
commit 50aeb50029
6 changed files with 28 additions and 15 deletions
+10
View File
@@ -244,6 +244,16 @@ static void processMultiStatusPacket(const uint8_t * data, uint8_t module, uint8
if (wasBinding && !status.isBinding() && getMultiBindStatus(module) == MULTI_BIND_INITIATED)
setMultiBindStatus(module, MULTI_BIND_FINISHED);
// Dirty RX protocol detection
size_t proto_len = strnlen(status.protocolName, 8);
if (proto_len >= 2 &&
status.protocolName[proto_len - 2] == 'R' &&
status.protocolName[proto_len - 1] == 'X') {
status.isRXProto = true;
} else {
status.isRXProto = false;
}
// update timestamp last to avoid race conditions
status.lastUpdate = get_tmr10ms();
}
+1
View File
@@ -108,6 +108,7 @@ struct MultiModuleStatus {
uint8_t flags;
uint8_t requiresFailsafeCheck;
uint8_t failsafeChecked;
uint8_t isRXProto;
tmr10ms_t lastUpdate;
uint8_t protocolPrev = 0;
+1 -1
View File
@@ -318,7 +318,7 @@ struct ModuleSyncStatus
tmr10ms_t lastUpdate; // in 10ms
int16_t currentLag; // in us
inline bool isValid() {
inline bool isValid() const {
// 2 seconds
return (get_tmr10ms() - lastUpdate < 200);
}