formating only

This commit is contained in:
Empire 2022-04-29 10:47:54 +02:00
parent 15e96a4990
commit 5dedc76727

View File

@ -40,7 +40,6 @@
#include "ulp-pwm.h" #include "ulp-pwm.h"
#endif #endif
/****************************************************************************** /******************************************************************************
* DEFINES * DEFINES
******************************************************************************/ ******************************************************************************/
@ -316,16 +315,18 @@ void readPowerSwitchedSensors()
Plant plant = mPlants[i]; Plant plant = mPlants[i];
switch (plant.getSensorMode()) switch (plant.getSensorMode())
{ {
case CAPACITIVE_FREQUENCY: { case CAPACITIVE_FREQUENCY:
{
Serial << "Plant " << i << " measurement: " << mPlants[i].getCurrentMoistureRaw() << " hz " << mPlants[i].getCurrentMoisturePCT() << "%" << endl; Serial << "Plant " << i << " measurement: " << mPlants[i].getCurrentMoistureRaw() << " hz " << mPlants[i].getCurrentMoisturePCT() << "%" << endl;
break; break;
} }
case ANALOG_RESISTANCE_PROBE : { case ANALOG_RESISTANCE_PROBE:
{
Serial << "Plant " << i << " measurement: " << mPlants[i].getCurrentMoistureRaw() << " mV " << mPlants[i].getCurrentMoisturePCT() << "%" << endl; Serial << "Plant " << i << " measurement: " << mPlants[i].getCurrentMoistureRaw() << " mV " << mPlants[i].getCurrentMoisturePCT() << "%" << endl;
break; break;
} }
case NONE : { case NONE:
{
} }
} }
} }
@ -486,12 +487,14 @@ int determineNextPump(bool isLowLight)
} }
else else
{ {
if(mDownloadMode){ if (mDownloadMode)
{
plant.publishState("active+supressed"); plant.publishState("active+supressed");
}else { }
else
{
plant.publishState("active"); plant.publishState("active");
} }
} }
if (!plant.isHydroponic()) if (!plant.isHydroponic())
@ -636,7 +639,6 @@ void initPumpLogic()
log(LOG_LEVEL_INFO, "Starting pump " + String(pumpToRun) + " for " + String(mPlants[pumpToRun].getPumpDuration()) + "s", LOG_PUMP_STARTED_CODE); log(LOG_LEVEL_INFO, "Starting pump " + String(pumpToRun) + " for " + String(mPlants[pumpToRun].getPumpDuration()) + "s", LOG_PUMP_STARTED_CODE);
#endif #endif
// enable power // enable power
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);
digitalWrite(OUTPUT_ENABLE_PUMP, HIGH); digitalWrite(OUTPUT_ENABLE_PUMP, HIGH);
@ -674,7 +676,6 @@ long duration = millis() - pumpStartTime;
log(LOG_LEVEL_ERROR, LOG_HARDWARECOUNTER_ERROR_MESSAGE, LOG_HARDWARECOUNTER_ERROR_CODE); log(LOG_LEVEL_ERROR, LOG_HARDWARECOUNTER_ERROR_MESSAGE, LOG_HARDWARECOUNTER_ERROR_CODE);
targetReached = true; targetReached = true;
log(LOG_LEVEL_INFO, "Reached pump target ml " + String(pumpToRun), LOG_PUMP_STARTED_CODE); log(LOG_LEVEL_INFO, "Reached pump target ml " + String(pumpToRun), LOG_PUMP_STARTED_CODE);
} }
else else
{ {
@ -695,7 +696,6 @@ long duration = millis() - pumpStartTime;
} }
#endif #endif
if (millis() > pumpTarget) if (millis() > pumpTarget)
{ {
mPlants[pumpToRun].setProperty("watertime").send(String(duration)); mPlants[pumpToRun].setProperty("watertime").send(String(duration));
@ -809,14 +809,12 @@ void safeSetup()
} }
readPowerSwitchedSensors(); readPowerSwitchedSensors();
Homie.setup(); Homie.setup();
Wire = TwoWire(0); Wire = TwoWire(0);
Wire.setPins(SENSOR_TANK_SDA, SENSOR_TANK_SCL); Wire.setPins(SENSOR_TANK_SDA, SENSOR_TANK_SCL);
Wire.begin(); Wire.begin();
/************************* Start One-Wire bus ***************/ /************************* Start One-Wire bus ***************/
int tempInitStartTime = millis(); int tempInitStartTime = millis();
uint8_t sensorCount = 0U; uint8_t sensorCount = 0U;
@ -1077,9 +1075,12 @@ void plantcontrol()
#if defined(TIMED_LIGHT_PIN) #if defined(TIMED_LIGHT_PIN)
bool isLowLight = mSolarVoltage <= 9; bool isLowLight = mSolarVoltage <= 9;
bool shouldLight = determineTimedLightState(isLowLight); bool shouldLight = determineTimedLightState(isLowLight);
if(shouldLight){ if (shouldLight)
{
ulp_pwm_set_level(timedLightPowerLevel.get()); ulp_pwm_set_level(timedLightPowerLevel.get());
}else { }
else
{
ulp_pwm_set_level(0); ulp_pwm_set_level(0);
} }