Skip to content

Commit

Permalink
chore(memory): clarified some comments, moved relay/pid compute() cal…
Browse files Browse the repository at this point in the history
…l to a different location
  • Loading branch information
mwood77 committed Jan 25, 2022
1 parent 0f52494 commit 2bc4a1b
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions koffie/koffie.ino
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
float const PRESSURE_SENSOR_INPUT_PIN{A3};
double const RELAY_CONTROL_OUTPUT_PIN{11}; // PWM compatible output @ 498 Hz (CHECK BEFORE CHANGING)
const int PRESSURE_TRANSDUCER_MAX_PSI = 60.0; // Change this value to the maximum value your pressure sensor can read in PSI. Ex: 30 PSI sensor = 30.0
const double ATMOSPHERIC_OFFSET{0.0};
const double ATMOSPHERIC_OFFSET{0.0}; // Example offset of -0.17 (measured against physical gauge)

/*
* These values control the overall "tuning" of the PID.
Expand Down Expand Up @@ -453,19 +453,19 @@

MEASUREMENT_INPUT = convertedReading;

// COMPUTE PID LEVELS
pidControl.Compute();

// APPLY PID COMPUTE TO RELAY
relay.loop();

if (MEASUREMENT_INPUT > SETPOINT) {
relay.setDutyCyclePercent(0);
relay.setRelayPosition(relayPositionOpen); // change relayPositionOpen to relayPositionClosed if your relay is normally open
} else {
relay.setDutyCyclePercent(CONTROL_OUTPUT / 255.0); // Relay library only accepts values between 0 and 1
}

// COMPUTE PID LEVELS
pidControl.Compute();

// APPLY PID COMPUTE TO RELAY
relay.loop();

// Serial.print(F("SETPOINT: "));
// Serial.print(SETPOINT); // only displays in BAR in serial monitor
// Serial.print(F(" | MEASUREMENT_INPUT: "));
Expand Down Expand Up @@ -591,10 +591,11 @@
display.setTextColor(WHITE, BLACK);


// *************************************************************************************
// If you want to display a digital readout of the current (unfiltered) pressure,
// *********************************************************************************************************
// If you want to display a digital readout of the current (unfiltered) pressure in MANU mode,
// uncomment the lines beneath and the closing bracket at line 629.
// *************************************************************************************
// *********************************************************************************************************
//
// if (CURRENT_MODE == 25) {
// display.setCursor(70, 28);
// display.print(F("TARG "));
Expand Down

0 comments on commit 2bc4a1b

Please sign in to comment.