Эх сурвалжийг харах

fixed system failure for bad parse and old op location

Andrew Tridgell 3 жил өмнө
parent
commit
c6f8a5ca9c

+ 11 - 1
RemoteIDModule/RemoteIDModule.ino

@@ -245,6 +245,7 @@ void loop()
 
     bool have_location = false;
     const uint32_t last_location_ms = transport.get_last_location_ms();
+    const uint32_t last_system_ms = transport.get_last_system_ms();
 
 #if AP_BROADCAST_ON_POWER_UP
     // if we are broadcasting on powerup we always mark location valid
@@ -261,10 +262,19 @@ void loop()
 #endif
 
     if (last_location_ms == 0 ||
-            now_ms - last_location_ms > 5000) {
+        now_ms - last_location_ms > 5000) {
         UAS_data.Location.Status = ODID_STATUS_REMOTE_ID_SYSTEM_FAILURE;
     }
 
+    if (last_system_ms == 0 ||
+        now_ms - last_system_ms > 5000) {
+        UAS_data.Location.Status = ODID_STATUS_REMOTE_ID_SYSTEM_FAILURE;
+    }
+
+    if (transport.get_parse_fail() != nullptr) {
+        UAS_data.Location.Status = ODID_STATUS_REMOTE_ID_SYSTEM_FAILURE;
+    }
+    
     set_data(transport);
     last_update = now_ms;
 #if AP_WIFI_NAN_ENABLED

+ 8 - 0
RemoteIDModule/transport.h

@@ -43,10 +43,18 @@ public:
         return last_location_ms;
     }
 
+    uint32_t get_last_system_ms(void) const {
+        return last_system_ms;
+    }
+    
     void set_parse_fail(const char *msg) {
         parse_fail = msg;
     }
 
+    const char *get_parse_fail(void) {
+        return parse_fail;
+    }
+    
 protected:
     // common variables between transports. The last message of each
     // type, no matter what transport it was on, wins