Switch to new PhasedLoop
Things (bad flash drive) were causing the loop to skip cycles, and it
wasn't logging anything which was annoying.
Change-Id: I90abff6977f6d8303004faba7cda738bcbc94c00
diff --git a/y2014/wpilib/wpilib_interface.cc b/y2014/wpilib/wpilib_interface.cc
index 0278ebc..f0e76af 100644
--- a/y2014/wpilib/wpilib_interface.cc
+++ b/y2014/wpilib/wpilib_interface.cc
@@ -261,9 +261,17 @@
bottom_reader_.Start();
dma_synchronizer_->Start();
+ ::aos::time::PhasedLoop phased_loop(::aos::time::Time::InMS(5),
+ ::aos::time::Time::InMS(4));
+
::aos::SetCurrentThreadRealtimePriority(kPriority);
while (run_) {
- ::aos::time::PhasedLoopXMS(5, 4000);
+ {
+ const int iterations = phased_loop.SleepUntilNext();
+ if (iterations != 1) {
+ LOG(WARNING, "SensorReader skipped %d iterations\n", iterations - 1);
+ }
+ }
RunIteration();
}