Introduce delayed failsafe check for multi

This commit is contained in:
3djc
2019-09-25 13:43:18 +02:00
parent 53d36cdbf4
commit e3a9c1ddb6
5 changed files with 19 additions and 18 deletions
+6
View File
@@ -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;
}
+8 -7
View File
@@ -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;