hw+sw works, now comes the hard part

This commit is contained in:
Vinzenz Schroeter 2025-04-22 12:44:53 +02:00
commit 06efe8bb02

View file

@ -20,54 +20,56 @@ constexpr unsigned int SECOND = 1000;
constexpr unsigned int MINUTE = SECOND * 60;
constexpr unsigned int HOUR = MINUTE * 60;
constexpr unsigned int MEASUREMENT_COUNT = 1;
constexpr int MEASUREMENT_DELAY = 10;
constexpr unsigned int MEASUREMENT_COUNT = 3;
constexpr int MEASUREMENT_DELAY = 100;
/// Pots will always be watered below this humidity
constexpr int MIN_HUMIDITY_PERCENT = 10;
constexpr int MIN_HUMIDITY_PERCENT = 30;
/// Pots will never be watered above this humidity
constexpr int MAX_HUMIDITY_PERCENT = 70;
/// the amount of time a valve needs to open/close
constexpr int VALVE_DELAY_MS = 1 * SECOND;
constexpr int VALVE_DELAY_MS = 1 * SECOND / 4;
/// the amount of time the pump needs to start/stop
constexpr int PUMP_DELAY_MS = 1 * SECOND;
constexpr int PUMP_DELAY_MS = 1 * SECOND / 4;
/// the amount of time to water the plot (valve open and pump running)
constexpr int WATER_TIME_MS = 3 * SECOND;
constexpr int WATER_TIME_MS = 1 * SECOND;
/// how long to wait between loops
constexpr int LOOP_DELAY_MS = 1 * SECOND; // TODO set higher once it is working
/// minimum amount of time to wait between watering each pot, even when minimum wetness has been reached
constexpr int MIN_WATERING_INTERVAL_MS = 1 * SECOND; // TODO set higher once it is working
constexpr int MIN_WATERING_INTERVAL_MS = 10 * SECOND; // TODO set higher once it is working
/// maximum amount of time to wait between watering each pot, as long as maximum wetness has not been reaached
constexpr int MAX_WATERING_INTERVAL_MS = 24 * HOUR;
constexpr uint8_t PUMP_PIN = 22;
constexpr uint8_t PUMP_LED_PIN = 23;
constexpr uint8_t PUMP_PIN = 7;
constexpr uint8_t PUMP_LED_PIN = 3;
constexpr uint8_t OK_LED_PIN = 2;
/// Per-pot configuration
constexpr PotConfig POT_CONFIGS[] = {
{
.valve_pin = 2,
.led_pin = 42,
.valve_pin = 23,
.led_pin = 22,
.sensor = {
.pin = A0,
.calibration_dry = 520,
.calibration_wet = 236,
.calibration_dry = 540,
.calibration_wet = 250,
}
},
{
.valve_pin = 3,
.led_pin = 43,
.valve_pin = 25,
.led_pin = 24,
.sensor = {
.pin = A1,
.calibration_dry = 520,
.calibration_wet = 236,
.calibration_wet = 100,
}
},
};