Make monotonic_now a required parameter to PhasedLoop
This prepares us much better for mocking out time as part of the event
loop conversion.
Change-Id: I57560b97b265ddd41fe7a4e9f74d7b1324d15955
diff --git a/y2019/actors/autonomous_actor.cc b/y2019/actors/autonomous_actor.cc
index ee7f492..c933181 100644
--- a/y2019/actors/autonomous_actor.cc
+++ b/y2019/actors/autonomous_actor.cc
@@ -30,6 +30,7 @@
bool AutonomousActor::WaitForDriveXGreater(double x) {
LOG(INFO, "Waiting until x > %f\n", x);
::aos::time::PhasedLoop phased_loop(::std::chrono::milliseconds(5),
+ event_loop()->monotonic_now(),
::std::chrono::milliseconds(5) / 2);
while (true) {
@@ -48,6 +49,7 @@
bool AutonomousActor::WaitForDriveYCloseToZero(double y) {
LOG(INFO, "Waiting until |y| < %f\n", y);
::aos::time::PhasedLoop phased_loop(::std::chrono::milliseconds(5),
+ event_loop()->monotonic_now(),
::std::chrono::milliseconds(5) / 2);
while (true) {
diff --git a/y2019/actors/autonomous_actor.h b/y2019/actors/autonomous_actor.h
index 864a328..13b336d 100644
--- a/y2019/actors/autonomous_actor.h
+++ b/y2019/actors/autonomous_actor.h
@@ -110,6 +110,7 @@
bool WaitForGamePiece() {
::aos::time::PhasedLoop phased_loop(::std::chrono::milliseconds(5),
+ event_loop()->monotonic_now(),
::std::chrono::milliseconds(5) / 2);
while (true) {
@@ -161,6 +162,7 @@
bool WaitForSuperstructureDone() {
::aos::time::PhasedLoop phased_loop(::std::chrono::milliseconds(5),
+ event_loop()->monotonic_now(),
::std::chrono::milliseconds(5) / 2);
while (true) {
diff --git a/y2019/wpilib_interface.cc b/y2019/wpilib_interface.cc
index e6dbb1f..16487b9 100644
--- a/y2019/wpilib_interface.cc
+++ b/y2019/wpilib_interface.cc
@@ -564,6 +564,7 @@
::aos::SetCurrentThreadRealtimePriority(27);
::aos::time::PhasedLoop phased_loop(::std::chrono::milliseconds(20),
+ ::aos::monotonic_clock::now(),
::std::chrono::milliseconds(1));
while (run_) {