|
|
@ -921,19 +921,14 @@ void getMoisture() {
|
|
|
|
float t1 = soil1.getTemp();
|
|
|
|
float t1 = soil1.getTemp();
|
|
|
|
int sm1 = map(soil1.touchRead(0), 0, 1023, 0, 100);
|
|
|
|
int sm1 = map(soil1.touchRead(0), 0, 1023, 0, 100);
|
|
|
|
if(sm1 > 6000 && t1 < 1) {
|
|
|
|
if(sm1 > 6000 && t1 < 1) {
|
|
|
|
if (!soil1.begin(0x36)) {
|
|
|
|
|
|
|
|
s1 = false;
|
|
|
|
s1 = false;
|
|
|
|
printConsoleText("[ INFO ] Soil sensor 1 unplugged.");
|
|
|
|
printConsoleText("[ INFO ] Soil sensor 1 unplugged.");
|
|
|
|
} else {
|
|
|
|
|
|
|
|
t1 = soil1.getTemp();
|
|
|
|
|
|
|
|
sm1 = map(soil1.touchRead(0), 0, 1023, 0, 100);
|
|
|
|
|
|
|
|
printS1(t1, sm1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
printS1(t1, sm1);
|
|
|
|
printS1(t1, sm1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (!s1) {
|
|
|
|
} else if (!s1) {
|
|
|
|
if (soil1.begin(0x36)) {
|
|
|
|
if (soil1.begin(0x36)) {
|
|
|
|
|
|
|
|
clearLog();
|
|
|
|
s1 = true;
|
|
|
|
s1 = true;
|
|
|
|
printConsoleText("[ INFO ] Soil sensor 1 connected.");
|
|
|
|
printConsoleText("[ INFO ] Soil sensor 1 connected.");
|
|
|
|
float t1 = soil1.getTemp();
|
|
|
|
float t1 = soil1.getTemp();
|
|
|
@ -946,19 +941,14 @@ void getMoisture() {
|
|
|
|
float t2 = soil2.getTemp();
|
|
|
|
float t2 = soil2.getTemp();
|
|
|
|
int sm2 = map(soil2.touchRead(0), 0, 1023, 0, 100);
|
|
|
|
int sm2 = map(soil2.touchRead(0), 0, 1023, 0, 100);
|
|
|
|
if(sm2 > 6000 && t2 < 1) {
|
|
|
|
if(sm2 > 6000 && t2 < 1) {
|
|
|
|
if (!soil2.begin(0x37)) {
|
|
|
|
|
|
|
|
s2 = false;
|
|
|
|
s2 = false;
|
|
|
|
printConsoleText("[ INFO ] Soil sensor 2 unplugged.");
|
|
|
|
printConsoleText("[ INFO ] Soil sensor 2 unplugged.");
|
|
|
|
} else {
|
|
|
|
|
|
|
|
t2 = soil2.getTemp();
|
|
|
|
|
|
|
|
sm2 = map(soil2.touchRead(0), 0, 1023, 0, 100);
|
|
|
|
|
|
|
|
printS1(t2, sm2);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
printS2(t2, sm2);
|
|
|
|
printS2(t2, sm2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (!s2) {
|
|
|
|
} else if (!s2) {
|
|
|
|
if (soil2.begin(0x37)) {
|
|
|
|
if (soil2.begin(0x37)) {
|
|
|
|
|
|
|
|
clearLog();
|
|
|
|
s2 = true;
|
|
|
|
s2 = true;
|
|
|
|
printConsoleText("[ INFO ] Soil sensor 2 connected.");
|
|
|
|
printConsoleText("[ INFO ] Soil sensor 2 connected.");
|
|
|
|
float t2 = soil2.getTemp();
|
|
|
|
float t2 = soil2.getTemp();
|
|
|
@ -971,19 +961,14 @@ void getMoisture() {
|
|
|
|
float t3 = soil3.getTemp();
|
|
|
|
float t3 = soil3.getTemp();
|
|
|
|
int sm3 = map(soil3.touchRead(0), 0, 1023, 0, 100);
|
|
|
|
int sm3 = map(soil3.touchRead(0), 0, 1023, 0, 100);
|
|
|
|
if(sm3 > 6000 && t3 < 1) {
|
|
|
|
if(sm3 > 6000 && t3 < 1) {
|
|
|
|
if (!soil1.begin(0x38)) {
|
|
|
|
|
|
|
|
s3 = false;
|
|
|
|
s3 = false;
|
|
|
|
printConsoleText("[ INFO ] Soil sensor 3 unplugged.");
|
|
|
|
printConsoleText("[ INFO ] Soil sensor 3 unplugged.");
|
|
|
|
} else {
|
|
|
|
|
|
|
|
t3 = soil3.getTemp();
|
|
|
|
|
|
|
|
sm3 = map(soil3.touchRead(0), 0, 1023, 0, 100);
|
|
|
|
|
|
|
|
printS3(t3, sm3);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
printS3(t3, sm3);
|
|
|
|
printS3(t3, sm3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (!s3) {
|
|
|
|
} else if (!s3) {
|
|
|
|
if (soil3.begin(0x38)) {
|
|
|
|
if (soil3.begin(0x38)) {
|
|
|
|
|
|
|
|
clearLog();
|
|
|
|
s3 = true;
|
|
|
|
s3 = true;
|
|
|
|
printConsoleText("[ INFO ] Soil sensor 3 connected.");
|
|
|
|
printConsoleText("[ INFO ] Soil sensor 3 connected.");
|
|
|
|
float t3 = soil3.getTemp();
|
|
|
|
float t3 = soil3.getTemp();
|
|
|
@ -996,19 +981,14 @@ void getMoisture() {
|
|
|
|
float t4 = soil4.getTemp();
|
|
|
|
float t4 = soil4.getTemp();
|
|
|
|
int sm4 = map(soil4.touchRead(0), 0, 1023, 0, 100);
|
|
|
|
int sm4 = map(soil4.touchRead(0), 0, 1023, 0, 100);
|
|
|
|
if(sm4 > 6000 && t4 < 1) {
|
|
|
|
if(sm4 > 6000 && t4 < 1) {
|
|
|
|
if (!soil1.begin(0x39)) {
|
|
|
|
|
|
|
|
s4 = false;
|
|
|
|
s4 = false;
|
|
|
|
printConsoleText("[ INFO ] Soil sensor 4 unplugged.");
|
|
|
|
printConsoleText("[ INFO ] Soil sensor 4 unplugged.");
|
|
|
|
} else {
|
|
|
|
|
|
|
|
t4 = soil4.getTemp();
|
|
|
|
|
|
|
|
sm4 = map(soil4.touchRead(0), 0, 1023, 0, 100);
|
|
|
|
|
|
|
|
printS4(t4, sm4);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
printS4(t4, sm4);
|
|
|
|
printS4(t4, sm4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (!s4) {
|
|
|
|
} else if (!s4) {
|
|
|
|
if (soil1.begin(0x39)) {
|
|
|
|
if (soil4.begin(0x39)) {
|
|
|
|
|
|
|
|
clearLog();
|
|
|
|
s4 = true;
|
|
|
|
s4 = true;
|
|
|
|
printConsoleText("[ INFO ] Soil sensor 4 connected.");
|
|
|
|
printConsoleText("[ INFO ] Soil sensor 4 connected.");
|
|
|
|
float t4 = soil4.getTemp();
|
|
|
|
float t4 = soil4.getTemp();
|
|
|
|