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,8 +162,12 @@ int getSoilmoisture(byte moistureSensor, bool returnRAW = false) {
soilmoisture = -1; soilmoisture = -1;
} }
if(returnRAW == true) {
return soilmoisture;
} else {
return map(soilmoisture, wet, dry, 100, 0); return map(soilmoisture, wet, dry, 100, 0);
} }
}
int getLightchirp() { int getLightchirp() {
// get the "light value" from I2C chirp module // get the "light value" from I2C chirp module

View file

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