Added some comments
This commit is contained in:
parent
dd2a831ade
commit
68d45f6363
@ -39,22 +39,22 @@ void setValueNM(int NM) {
|
||||
|
||||
// Logic to set color array pointer
|
||||
void getColorBasedOnValueNM(int valueNM) {
|
||||
if (valueNM <= 420) { //Purple
|
||||
if (valueNM <= 420) { // Purple
|
||||
colorCounter = 0;
|
||||
}
|
||||
else if (valueNM <= 490) { //Blue
|
||||
else if (valueNM <= 490) { // Blue
|
||||
colorCounter = 1;
|
||||
}
|
||||
else if (valueNM <= 575) { //Green
|
||||
else if (valueNM <= 575) { // Green
|
||||
colorCounter = 2;
|
||||
}
|
||||
else if (valueNM <= 585) { //Yellow
|
||||
else if (valueNM <= 585) { // Yellow
|
||||
colorCounter = 3;
|
||||
}
|
||||
else if (valueNM <= 650) { //Orange
|
||||
else if (valueNM <= 650) { // Orange
|
||||
colorCounter = 4;
|
||||
}
|
||||
else if (valueNM > 650) { // 650 to 750 is red
|
||||
else if (valueNM > 650) { // 650 to 750 is Red
|
||||
colorCounter = 5;
|
||||
}
|
||||
Serial.println("New color set based on: ");
|
||||
|
||||
@ -32,12 +32,12 @@ void setup() {
|
||||
Serial.println("Setup complete...");
|
||||
Serial.println();
|
||||
Serial.println();
|
||||
// first read without delay
|
||||
// First read without delay
|
||||
readSensors();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// main loop: read sensors
|
||||
// Main loop: read sensors
|
||||
if (millis() - sensorReadTimer >= FREQUENCY) {
|
||||
readSensors();
|
||||
sensorReadTimer = millis();
|
||||
|
||||
@ -4,18 +4,18 @@
|
||||
#include <lightChecker.h>
|
||||
#include <store.h>
|
||||
|
||||
// Feldkapazität des Bodens in Prozent: Standard ist Humus
|
||||
// Fieldcapacity of the Ground in Percentage: Standard is Humus
|
||||
int fieldCapacity = 44;
|
||||
// PWP des Bodens in Prozent: Standard ist Humus
|
||||
// PWP of the Ground in Percentage: Standard is Humus
|
||||
int permanentWiltingPoint = 25;
|
||||
// Boden vollständig gesättigt bei (Prozent): Standard ist Humus
|
||||
// Ground completely saturated by (Percentage): Standard is Humus
|
||||
int soilSaturation = 69;
|
||||
// Helligkeitswert der mindestens vorhanden sein muss
|
||||
// Minimum light value before light turns on
|
||||
int minimumLightValueLX = 50;
|
||||
// switches for automatic light and irrigation control
|
||||
// Switches for automatic light and irrigation control
|
||||
bool automaticLight = true;
|
||||
bool automaticIrrigation = true;
|
||||
// make sure device irrigates until fieldcapacity is reached
|
||||
// Make sure device irrigates until fieldcapacity is reached
|
||||
bool irrigateUntilFC = false;
|
||||
|
||||
void persistSoilProps(int FC, int PWP, int SAT) {
|
||||
@ -75,6 +75,7 @@ void setSoilProperties(int FC, int PWP, int SAT) {
|
||||
Serial.println(soilSaturation);
|
||||
}
|
||||
|
||||
// Method to persist save the given lightning properties to NVS
|
||||
void persistLightProps(int NM, int minLX) {
|
||||
Serial.println("persistLightProps");
|
||||
bool n = NVS.setInt("nanoMeter", NM);
|
||||
@ -88,6 +89,7 @@ void persistLightProps(int NM, int minLX) {
|
||||
}
|
||||
}
|
||||
|
||||
// Method to restore light properties from Non-Volatile Storage (NVS)
|
||||
void restoreLightProps() {
|
||||
Serial.println("restoreLightProps");
|
||||
int nm = NVS.getInt("nanoMeter");
|
||||
@ -101,6 +103,7 @@ void restoreLightProps() {
|
||||
Serial.println(minimumLightValueLX);
|
||||
}
|
||||
|
||||
// Method to set given light properties
|
||||
void setLightProperties(int NM, int minLX) {
|
||||
setValueNM(NM);
|
||||
minimumLightValueLX = minLX;
|
||||
@ -111,7 +114,7 @@ void setLightProperties(int NM, int minLX) {
|
||||
|
||||
void persistAutoProps(bool light, bool irrigation) {
|
||||
Serial.println("persistAutoProps");
|
||||
// saved in NVS as Integer: 1 = true, 2 = false, 0 = not persisted, use standard settings
|
||||
// Saved in NVS as Integer: 1 = true, 2 = false, 0 = not persisted, use standard settings
|
||||
bool n = NVS.setInt("automaticLight", (light ? 1 : 2));
|
||||
bool m = NVS.setInt("automaticIrrigation", (irrigation ? 1 : 2));
|
||||
if (n && m) {
|
||||
@ -158,6 +161,7 @@ void initDeviceID() {
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the device ID
|
||||
String getDeviceID() {
|
||||
return DEVICE_ID;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user