add support for testing sensor resets
Change-Id: I469609445904d8eca1d11ee756998ba8801465ea
diff --git a/aos/common/controls/control_loop_test.cc b/aos/common/controls/control_loop_test.cc
index 40357b2..fd461b6 100644
--- a/aos/common/controls/control_loop_test.cc
+++ b/aos/common/controls/control_loop_test.cc
@@ -40,7 +40,7 @@
{
auto new_state = ::aos::robot_state.MakeMessage();
- new_state->reader_pid = 971;
+ new_state->reader_pid = reader_pid_;
new_state->outputs_enabled = enabled;
new_state->browned_out = false;
diff --git a/aos/common/controls/control_loop_test.h b/aos/common/controls/control_loop_test.h
index a1165a9..4fd13a3 100644
--- a/aos/common/controls/control_loop_test.h
+++ b/aos/common/controls/control_loop_test.h
@@ -35,12 +35,19 @@
TickTime();
}
+ // Simulate a reset of the process reading sensors, which tells loops that all
+ // index counts etc will be reset.
+ void SimulateSensorReset() {
+ ++reader_pid_;
+ }
+
private:
static constexpr ::aos::time::Time kTimeTick = ::aos::time::Time::InUS(5000);
static constexpr ::aos::time::Time kDSPacketTime =
::aos::time::Time::InMS(20);
uint16_t team_id_ = 971;
+ int32_t reader_pid_ = 1;
::aos::time::Time last_ds_time_ = ::aos::time::Time::InSeconds(0);
::aos::time::Time current_time_ = ::aos::time::Time::InSeconds(0);