Merge pull request #6829 from opentx/3djc/fix-6826

3djc/fix 6826
This commit is contained in:
3djc
2019-09-27 13:50:32 +02:00
committed by GitHub
3 changed files with 18 additions and 8 deletions
+4 -1
View File
@@ -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);
+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;