firmware - improve output init, fix typos
This commit is contained in:
parent
d0ea1588b5
commit
35ed7ba616
3 changed files with 18 additions and 13 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -218,26 +218,26 @@ void SysMaintenance() {
|
|||
if( (webserver.hasArg("DimmOn")) ) {
|
||||
MaintenanceMode = true;
|
||||
MaintenanceStarted = millis();
|
||||
body += "<div class='infomsg'>⛅ Dimm LED On for ";
|
||||
body += "<div class='infomsg'>⛅ Dimm LED ON for ";
|
||||
body += MaintenanceDuration;
|
||||
body += "s</div>";
|
||||
} else if( (webserver.hasArg("DimmOff")) ) {
|
||||
MaintenanceMode = false;
|
||||
body += "<div class='infomsg'>⛅ Dimm LED Off</div>";
|
||||
body += "<div class='infomsg'>⛅ Dimm LED OFF</div>";
|
||||
}
|
||||
} else {
|
||||
// otherwise nice error
|
||||
body += "<div class='warnmsg'>⛅ LED setting <pre>Use relais for LED (disable PWM)<pre> is set to <b>Yes</b> in 🔆 Grow settings</div>";
|
||||
body += "<div class='warnmsg'>⛅ Cannot dimm LED, <i>Use relais for LED (disable PWM)</i> is set to <i>Yes</i> in 🔆 Grow settings</div>";
|
||||
|
||||
}
|
||||
} else if(webserver.hasArg("PumpOnManual")) {
|
||||
if(UsePump == true) {
|
||||
if(UsePump > 0) {
|
||||
PumpOnManual = true;
|
||||
body += "<div class='infomsg'>💧 Pump manual activated for ";
|
||||
body += PumpOnTime;
|
||||
body += "s</div>";
|
||||
} else {
|
||||
body += "<div class='warnmsg'>💧 Pump mode is set to <b>Off</b> in 🔆 Grow settings</div>";
|
||||
body += "<div class='warnmsg'>💧 Cannot activate, <i>Pump mode</i> is set to <i>Off</i> in 🔆 Grow settings</div>";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue