Improve docs and logging

This commit is contained in:
Tanner Collin 2023-02-15 17:45:02 -07:00
parent ba96c67893
commit e29aac17ca
2 changed files with 27 additions and 18 deletions

View File

@ -4,7 +4,7 @@
#include "hardware.h" #include "hardware.h"
#include "XGZP.h" #include "XGZP.h"
bool simulating = false; bool simulating = true;
double simulatedPressure = 0.0; double simulatedPressure = 0.0;
double inflatePSIPerSecond = 0.0; double inflatePSIPerSecond = 0.0;
double deflatePSIPerSecond = 0.0; double deflatePSIPerSecond = 0.0;

View File

@ -1,11 +1,20 @@
// Tire Inflation Firmware
//
// Board: Adafruit Feather nRF52832
// Setup: https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide/arduino-bsp-setup
#include <Wire.h> #include <Wire.h>
#include <Adafruit_GFX.h> #include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h> #include <Adafruit_SSD1306.h>
#include <Adafruit_FeatherOLED.h> #include <Adafruit_FeatherOLED.h> // make sure to add:
// #define VBATPIN 0
// #define VBAT_MULTIPLIER 0
// to Adafruit_FeatherOLED.cpp
// or Adafruit_FeatherOLED_SH110X.cpp
#include "hardware.h" #include "hardware.h"
//#define SIMULATE 1 #define SIMULATE 1
#define DEBUG 0 #define DEBUG 0
#define TIMEOUT_TIME 7000 #define TIMEOUT_TIME 7000
@ -130,8 +139,8 @@ void logData() {
static unsigned long lastLogTime = millis(); static unsigned long lastLogTime = millis();
if (millis() > lastLogTime + 100) { if (millis() > lastLogTime + 100) {
Serial.print("millis: "); //Serial.print("millis: ");
Serial.print(millis()); //Serial.print(millis());
Serial.print(", pressure: "); Serial.print(", pressure: ");
Serial.print(pressureValue); Serial.print(pressureValue);
#ifdef SIMULATE #ifdef SIMULATE
@ -140,8 +149,8 @@ void logData() {
#endif #endif
Serial.print(", sampled: "); Serial.print(", sampled: ");
Serial.print(sampledPressure); Serial.print(sampledPressure);
Serial.print(", rate (inv): "); //Serial.print(", rate (inv): ");
Serial.print(runningRateInv); //Serial.print(runningRateInv);
Serial.print(", setpoint: "); Serial.print(", setpoint: ");
Serial.print(pressureSetPoint); Serial.print(pressureSetPoint);
Serial.print(", state: "); Serial.print(", state: ");
@ -309,17 +318,17 @@ void runStateMachine() {
runningRateInv = (stopTime - startTime) / (sampledPressure - initialPressure); runningRateInv = (stopTime - startTime) / (sampledPressure - initialPressure);
Serial.print("stopTime: "); //Serial.print("stopTime: ");
Serial.print(stopTime); //Serial.print(stopTime);
Serial.print(", startTime: "); //Serial.print(", startTime: ");
Serial.print(startTime); //Serial.print(startTime);
Serial.print(", sampledPressure: "); //Serial.print(", sampledPressure: ");
Serial.print(sampledPressure); //Serial.print(sampledPressure);
Serial.print(", initialPressure: "); //Serial.print(", initialPressure: ");
Serial.print(initialPressure); //Serial.print(initialPressure);
Serial.print(", rate: "); //Serial.print(", rate: ");
Serial.print(runningRateInv); //Serial.print(runningRateInv);
Serial.println(""); //Serial.println("");
initialPressure = sampledPressure; initialPressure = sampledPressure;