diff --git a/Arduino/CanGrow/CanGrow.ino b/Arduino/CanGrow/CanGrow.ino index a874db7..7e8cc63 100644 --- a/Arduino/CanGrow/CanGrow.ino +++ b/Arduino/CanGrow/CanGrow.ino @@ -242,12 +242,9 @@ void setup() { // we do this here because otherwise on inverted // boards like CanGrow PCB v0.6 it would be turned on if(configured == true) { - pinMode(PinLED, OUTPUT); - pinMode(PinPUMP, OUTPUT); - pinMode(PinFAN, OUTPUT); - // set PWM frequency - analogWriteFreq(PWMFrequency); + initOutputs(); } + } diff --git a/Arduino/CanGrow/CanGrow_SysFunctions.h b/Arduino/CanGrow/CanGrow_SysFunctions.h index faf7e90..4c3f5a5 100644 --- a/Arduino/CanGrow/CanGrow_SysFunctions.h +++ b/Arduino/CanGrow/CanGrow_SysFunctions.h @@ -830,3 +830,13 @@ void controlFAN() { setOutput(4, PinFAN2PWM); } +void initOutputs() { + pinMode(PinLED, OUTPUT); + pinMode(PinPUMP, OUTPUT); + pinMode(PinFAN, OUTPUT); + // set PWM frequency + analogWriteFreq(PWMFrequency); + for(byte i = 1; i <= 4; i++) { + setOutput(i, 0); + } +} diff --git a/Arduino/CanGrow/CanGrow_WebFunctions.h b/Arduino/CanGrow/CanGrow_WebFunctions.h index 2e16cbd..e606161 100644 --- a/Arduino/CanGrow/CanGrow_WebFunctions.h +++ b/Arduino/CanGrow/CanGrow_WebFunctions.h @@ -218,26 +218,26 @@ void SysMaintenance() { if( (webserver.hasArg("DimmOn")) ) { MaintenanceMode = true; MaintenanceStarted = millis(); - body += "
⛅ Dimm LED On for "; + body += "
⛅ Dimm LED ON for "; body += MaintenanceDuration; body += "s
"; } else if( (webserver.hasArg("DimmOff")) ) { MaintenanceMode = false; - body += "
⛅ Dimm LED Off
"; + body += "
⛅ Dimm LED OFF
"; } } else { // otherwise nice error - body += "
⛅ LED setting
Use relais for LED (disable PWM)
 is set to Yes in 🔆 Grow settings
"; + body += "
⛅ Cannot dimm LED, Use relais for LED (disable PWM) is set to Yes in 🔆 Grow settings
"; } } else if(webserver.hasArg("PumpOnManual")) { - if(UsePump == true) { + if(UsePump > 0) { PumpOnManual = true; body += "
💧 Pump manual activated for "; body += PumpOnTime; body += "s
"; } else { - body += "
💧 Pump mode is set to Off in 🔆 Grow settings
"; + body += "
💧 Cannot activate, Pump mode is set to Off in 🔆 Grow settings
"; } } @@ -1036,9 +1036,7 @@ void POSTsystemSettings() { // when configured is false, set it to true and ensure outputs are set if(configured == false) { configured = true; - pinMode(PinLED, OUTPUT); - pinMode(PinPUMP, OUTPUT); - pinMode(PinFAN, OUTPUT); + initOutputs(); } // size is 1 byte