HAPSRG / Mbed 2 deprecated HAPStail

Dependencies:   mbed MatrixMath LPS25HB_I2C LSM9DS1 Matrix2 PIDcontroller LoopTicker SBUS_without_mainfile UsaPack solaESKF_wind Vector3 CalibrateMagneto FastPWM

Revision:
63:851e96f54a86
Parent:
61:c05353850017
Child:
66:a210d7130a44
diff -r ef10fd919f7b -r 851e96f54a86 run.cpp
--- a/run.cpp	Wed Jun 09 07:50:18 2021 +0000
+++ b/run.cpp	Tue Jun 22 07:01:20 2021 +0000
@@ -59,13 +59,14 @@
     {
         if (i == pos_tail)
         {
-            break;
+            continue;
         }
         else
         {
             tail.Subscribe(tail_address[i], &(posValues[i]));
         }
     }
+    tail.Subscribe(time_address, &broadcast_time);
     
     LoopTicker PIDtick;
     PIDtick.attach(calcServoOut,PID_dt);
@@ -81,6 +82,12 @@
         ekf.updateBetweenMeasures(gyro, att_dt);
         ekf.computeAngles(rpy, rpy_g, rpy_align);
         PIDtick.loop(); 
+        if (broadcast_time.ms != system_time.ms)
+        {
+            system_time = broadcast_time;
+            system_dt.reset();
+            system_dt.start();
+        }
         
         float tend = _t.read();
         att_dt = (tend-tstart);