got the output check pulse thing working (I think)
diff --git a/frc971/input/sensor_receiver.cc b/frc971/input/sensor_receiver.cc
index 2c97508..b83dc4e 100644
--- a/frc971/input/sensor_receiver.cc
+++ b/frc971/input/sensor_receiver.cc
@@ -14,6 +14,7 @@
#include "frc971/queues/to_log.q.h"
#include "frc971/control_loops/shooter/shooter.q.h"
#include "frc971/control_loops/claw/claw.q.h"
+#include "frc971/queues/output_check.q.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
@@ -178,6 +179,19 @@
LOG(WARNING, "%" PRIu8 " analog errors\n", data->analog_errors);
}
+ if (data->main.output_check_pulse_length != 0) {
+ auto message = ::frc971::output_check_received.MakeMessage();
+ message->pulse_length =
+ static_cast<double>(data->main.output_check_pulse_length) / 100.0;
+ if (message->pulse_length > 2.7) {
+ LOG(WARNING, "insane PWM pulse length %fms\n", message->pulse_length);
+ } else {
+ message->pwm_value = (message->pulse_length - 0.5) / 2.0 * 255.0 + 0.5;
+ LOG_STRUCT(DEBUG, "received", *message);
+ message.Send();
+ }
+ }
+
other_sensors.MakeWithBuilder()
.sonar_distance(sonar_translate(data->main.ultrasonic_pulse_length))
.Send();