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:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user