Add messages on failed 1wire sensors

This commit is contained in:
Ollo
2025-05-03 15:37:10 +02:00
parent cf1f631e07
commit 1190b0324e
3 changed files with 26 additions and 15 deletions
+22 -12
View File
@@ -381,7 +381,7 @@ void readPowerSwitchedSensors()
int value = analogRead(SENSOR_TANK_ANALOG);
Serial << "Round " << i << " measurement: " << value << " mV " << endl;
waterRawSensor.add(value);
delay(5);
delay(7);
}
Serial << "Analog water measurement done" << endl;
#else
@@ -1114,18 +1114,28 @@ void plantcontrol()
sensorLipo.setProperty("percent").send(String(100 * (((mBatteryVoltage - VOLT_MIN_BATT) / (VOLT_MAX_BATT - VOLT_MIN_BATT)))));
}
sensorLipo.setProperty("volt").send(String(mBatteryVoltage));
sensorLipo.setProperty("current").send(String(battery.getCurrent()));
sensorLipo.setProperty("Ah").send(String(battery.getAh()));
sensorLipo.setProperty("ICA").send(String(battery.getICA()));
sensorLipo.setProperty("DCA").send(String(battery.getDCA()));
sensorLipo.setProperty("CCA").send(String(battery.getCCA()));
if (mSolarVoltage < SOLAR_MAX_VOLTAGE_POSSIBLE) {
sensorSolar.setProperty("volt").send(String(mSolarVoltage));
if (battery.isFound()) {
sensorLipo.setProperty("volt").send(String(mBatteryVoltage));
sensorLipo.setProperty("current").send(String(battery.getCurrent()));
sensorLipo.setProperty("Ah").send(String(battery.getAh()));
sensorLipo.setProperty("ICA").send(String(battery.getICA()));
sensorLipo.setProperty("DCA").send(String(battery.getDCA()));
sensorLipo.setProperty("CCA").send(String(battery.getCCA()));
if (mSolarVoltage < SOLAR_MAX_VOLTAGE_POSSIBLE) {
sensorSolar.setProperty("volt").send(String(mSolarVoltage));
} else {
log(LOG_LEVEL_INFO, String("Ignore unrealistc sun voltage" + String(mSolarVoltage) +"V"), LOG_SOLAR_CHARGER_MISSING);
}
sensorTemp.setProperty(TEMPERATUR_SENSOR_CHIP).send(String(chipTemp));
} else {
log(LOG_LEVEL_INFO, String("Ignore unrealistc sun voltage" + String(mSolarVoltage) +"V"), LOG_SOLAR_CHARGER_MISSING);
log(LOG_LEVEL_ERROR, String("No battery or sun sensor found"), LOG_SOLAR_CHARGER_MISSING);
}
sensorTemp.setProperty(TEMPERATUR_SENSOR_CHIP).send(String(chipTemp));
/* Publish 1-wire sensor status on failure */
if (sensors.getDS18Count() <= 1) {
log(LOG_LEVEL_ERROR, String("Found " + String(sensors.getDS18Count()) + " DS18B20 sensors"), LOG_SENSOR_MISSING_ERROR_CODE);
}
}
else
{
@@ -1145,7 +1155,7 @@ bool isLowLight = (mSolarVoltage <= SOLAR_CHARGE_MIN_VOLTAGE);
#endif // TIMED_LIGHT_PIN
bool isLiquid = waterTemp > 5;
bool isLiquid = (waterTemp > 5.0f);
bool hasWater = true; // By default activate the pump
if (waterRawSensor.getCount() > 0)
{