Introduce delayed failsafe check for multi
This commit is contained in:
@@ -869,7 +869,10 @@ static void checkRTCBattery()
|
||||
void checkFailsafe()
|
||||
{
|
||||
for (int i=0; i<NUM_MODULES; i++) {
|
||||
if (isModuleFailsafeAvailable(i)) {
|
||||
if (isModuleMultimodule(i)){
|
||||
multiModuleStatus.requiresFailsafeCheck = true;
|
||||
}
|
||||
else if (isModuleFailsafeAvailable(i)) {
|
||||
ModuleData & moduleData = g_model.moduleData[i];
|
||||
if (moduleData.failsafeMode == FAILSAFE_NOT_SET) {
|
||||
ALERT(STR_FAILSAFEWARN, STR_NO_FAILSAFE, AU_ERROR);
|
||||
|
||||
@@ -349,11 +349,6 @@ inline bool isModuleFailsafeAvailable(uint8_t idx)
|
||||
if (isModuleXJT(idx))
|
||||
return g_model.moduleData[idx].subType == MODULE_SUBTYPE_PXX1_ACCST_D16;
|
||||
|
||||
#if defined(MULTIMODULE)
|
||||
if (isModuleMultimodule(idx))
|
||||
return multiModuleStatus.isValid() && multiModuleStatus.supportsFailsafe();
|
||||
#endif
|
||||
|
||||
if (isModuleR9M(idx))
|
||||
return true;
|
||||
|
||||
|
||||
@@ -910,11 +910,7 @@
|
||||
#if defined(PCBXLITE)
|
||||
#define EXTERNAL_ANTENNA
|
||||
#endif
|
||||
#if defined(PCBXLITES) || defined(PCBX9LITE) || (defined(PCBX9DP) && PCBREV >= 2019)
|
||||
#define INTERNAL_MODULE_PXX2
|
||||
#else
|
||||
#define INTERNAL_MODULE_PXX1
|
||||
#endif
|
||||
|
||||
#if defined(PCBXLITE) || defined(PCBX9LITE)
|
||||
#define INTMODULE_RCC_APB1Periph 0
|
||||
#define INTMODULE_RCC_APB2Periph RCC_APB2Periph_USART1
|
||||
|
||||
@@ -73,6 +73,12 @@ static void processMultiStatusPacket(const uint8_t *data)
|
||||
multiModuleStatus.patch = data[4];
|
||||
multiModuleStatus.lastUpdate = get_tmr10ms();
|
||||
|
||||
if (multiModuleStatus.requiresFailsafeCheck == true) {
|
||||
multiModuleStatus.requiresFailsafeCheck = false;
|
||||
if (multiModuleStatus.supportsFailsafe() && g_model.moduleData[EXTERNAL_MODULE].failsafeMode == FAILSAFE_NOT_SET)
|
||||
POPUP_WARNING(STR_NO_FAILSAFE);
|
||||
}
|
||||
|
||||
if (wasBinding && !multiModuleStatus.isBinding() && multiBindStatus == MULTI_BIND_INITIATED)
|
||||
multiBindStatus = MULTI_BIND_FINISHED;
|
||||
}
|
||||
|
||||
@@ -118,17 +118,18 @@ struct MultiModuleStatus {
|
||||
uint8_t patch;
|
||||
|
||||
uint8_t flags;
|
||||
uint8_t requiresFailsafeCheck;
|
||||
tmr10ms_t lastUpdate;
|
||||
|
||||
void getStatusString(char* statusText);
|
||||
|
||||
inline bool isValid() { return (bool)(get_tmr10ms() - lastUpdate < 200); }
|
||||
inline bool supportsFailsafe() { return (bool) (flags & 0x20); }
|
||||
inline bool isWaitingforBind() { return (bool) (flags & 0x10); }
|
||||
inline bool isBinding() { return (bool) (flags & 0x08); }
|
||||
inline bool protocolValid() { return (bool) (flags & 0x04); }
|
||||
inline bool serialMode() { return (bool) (flags & 0x02); }
|
||||
inline bool inputDetected() { return (bool) (flags & 0x01); }
|
||||
inline bool isValid() const { return (bool)(get_tmr10ms() - lastUpdate < 200); }
|
||||
inline bool supportsFailsafe() const { return (bool) (flags & 0x20); }
|
||||
inline bool isWaitingforBind() const { return (bool) (flags & 0x10); }
|
||||
inline bool isBinding() const { return (bool) (flags & 0x08); }
|
||||
inline bool protocolValid() const { return (bool) (flags & 0x04); }
|
||||
inline bool serialMode() const { return (bool) (flags & 0x02); }
|
||||
inline bool inputDetected() const { return (bool) (flags & 0x01); }
|
||||
};
|
||||
|
||||
extern MultiModuleStatus multiModuleStatus;
|
||||
|
||||
Reference in New Issue
Block a user