add more logging for pneumatics stuff
Change-Id: I92f9ee0da37e75e2f141ec9800945720df9c9ee7
diff --git a/frc971/wpilib/wpilib.gyp b/frc971/wpilib/wpilib.gyp
index 0207742..3422782 100644
--- a/frc971/wpilib/wpilib.gyp
+++ b/frc971/wpilib/wpilib.gyp
@@ -31,9 +31,21 @@
'interrupt_edge_counting',
'encoder_and_potentiometer',
'<(DEPTH)/frc971/control_loops/control_loops.gyp:queues',
+ 'logging_queue',
],
},
{
+ 'target_name': 'logging_queue',
+ 'type': 'static_library',
+ 'sources': [
+ 'logging.q',
+ ],
+ 'variables': {
+ 'header_path': 'frc971/wpilib',
+ },
+ 'includes': [ '../../aos/build/queues.gypi' ],
+ },
+ {
'target_name': 'encoder_and_potentiometer',
'type': 'static_library',
'sources': [
diff --git a/frc971/wpilib/wpilib_interface.cc b/frc971/wpilib/wpilib_interface.cc
index 7364722..8f41300 100644
--- a/frc971/wpilib/wpilib_interface.cc
+++ b/frc971/wpilib/wpilib_interface.cc
@@ -32,6 +32,7 @@
#include "frc971/wpilib/dma_edge_counting.h"
#include "frc971/wpilib/interrupt_edge_counting.h"
#include "frc971/wpilib/encoder_and_potentiometer.h"
+#include "frc971/wpilib/logging.q.h"
#include "Encoder.h"
#include "Talon.h"
@@ -422,13 +423,23 @@
claw_pinchers_->Set(claw_->rollers_closed);
}
}
- if (!pressure_switch_->Get()) {
- compressor_relay_->Set(Relay::kForward);
- } else {
- compressor_relay_->Set(Relay::kOff);
- }
- pcm_->Flush();
+ {
+ PneumaticsToLog to_log;
+ {
+ const bool compressor_on = !pressure_switch_->Get();
+ to_log.compressor_on = compressor_on;
+ if (compressor_on) {
+ compressor_relay_->Set(Relay::kForward);
+ } else {
+ compressor_relay_->Set(Relay::kOff);
+ }
+ }
+
+ pcm_->Flush();
+ to_log.read_solenoids = pcm_->GetAll();
+ LOG_STRUCT(DEBUG, "pneumatics info", to_log);
+ }
}
}