firmware wip - add return RAW soilmoisture analog value

This commit is contained in:
Marcus 2024-05-22 01:04:42 +02:00
parent d396830026
commit fb68dee829
2 changed files with 7 additions and 1 deletions

View file

@ -162,7 +162,11 @@ int getSoilmoisture(byte moistureSensor, bool returnRAW = false) {
soilmoisture = -1;
}
return map(soilmoisture, wet, dry, 100, 0);
if(returnRAW == true) {
return soilmoisture;
} else {
return map(soilmoisture, wet, dry, 100, 0);
}
}
int getLightchirp() {

View file

@ -1015,6 +1015,7 @@ void APIgetDebug() {
// Chirp
objSensors["chirp"]["temperature"] = getTemperature(2);
objSensors["chirp"]["soilmoisture"] = getSoilmoisture(2);
objSensors["chirp"]["soilmoistureRAW"] = getSoilmoisture(2, true);
objSensors["chirp"]["light"] = getLightchirp();
// DHT11/22
@ -1023,6 +1024,7 @@ void APIgetDebug() {
// Analog
objSensors["analog"]["soilmoisture"] = getSoilmoisture(1);
objSensors["analog"]["soilmoistureRAW"] = getSoilmoisture(1, true);
objSensors["analog"]["waterlevel"] = getWaterlevel();
String body;