55 lines
1.4 KiB
C++
55 lines
1.4 KiB
C++
#pragma once
|
|
#include <Arduino.h>
|
|
|
|
typedef struct {
|
|
char *name;
|
|
int sensor_pin;
|
|
int valve_pin;
|
|
// define additional per-pot config here
|
|
} PotConfig;
|
|
|
|
/// The value sensors read when completely dry
|
|
constexpr int SENSOR_CALIBRATION_DRY = 520;
|
|
|
|
/// The value sensors read when completely wet
|
|
constexpr int SENSOR_CALIBRATION_WET = 236;
|
|
|
|
/// Pots will always be watered below this humidity
|
|
constexpr int MIN_HUMIDITY_PERCENT = 10;
|
|
|
|
/// 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 = 500;
|
|
|
|
/// the amount of time the pump needs to start/stop
|
|
constexpr int PUMP_DELAY_MS = 1000;
|
|
|
|
/// the amount of time to water the plot (valve open and pump running)
|
|
constexpr int WATER_TIME_MS = 1500;
|
|
|
|
/// how long to wait between loops
|
|
constexpr int LOOP_DELAY_MS = 1000;
|
|
|
|
/// minimum amount of time to wait between watering each pot, even when minimum wetness has been reached
|
|
constexpr int MIN_WATERING_INTERVAL_MS = 1000 * 60; // 1 min
|
|
|
|
/// 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 = 1000 * 60 * 60 * 24; // 1 day
|
|
|
|
/// Per-pot configuration
|
|
constexpr PotConfig POT_CONFIGS[] = {
|
|
{
|
|
.name = "Pflanze 1",
|
|
.sensor_pin = A0,
|
|
.valve_pin = 23, // TODO
|
|
},
|
|
{
|
|
.name = "Pflanze 2",
|
|
.sensor_pin = A1,
|
|
.valve_pin = 42, // TODO
|
|
}
|
|
};
|
|
|