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
|
// we do this here because otherwise on inverted
|
||||||
// boards like CanGrow PCB v0.6 it would be turned on
|
// boards like CanGrow PCB v0.6 it would be turned on
|
||||||
if(configured == true) {
|
if(configured == true) {
|
||||||
pinMode(PinLED, OUTPUT);
|
initOutputs();
|
||||||
pinMode(PinPUMP, OUTPUT);
|
|
||||||
pinMode(PinFAN, OUTPUT);
|
|
||||||
// set PWM frequency
|
|
||||||
analogWriteFreq(PWMFrequency);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -830,3 +830,13 @@ void controlFAN() {
|
||||||
setOutput(4, PinFAN2PWM);
|
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")) ) {
|
if( (webserver.hasArg("DimmOn")) ) {
|
||||||
MaintenanceMode = true;
|
MaintenanceMode = true;
|
||||||
MaintenanceStarted = millis();
|
MaintenanceStarted = millis();
|
||||||
body += "<div class='infomsg'>⛅ Dimm LED On for ";
|
body += "<div class='infomsg'>⛅ Dimm LED ON for ";
|
||||||
body += MaintenanceDuration;
|
body += MaintenanceDuration;
|
||||||
body += "s</div>";
|
body += "s</div>";
|
||||||
} else if( (webserver.hasArg("DimmOff")) ) {
|
} else if( (webserver.hasArg("DimmOff")) ) {
|
||||||
MaintenanceMode = false;
|
MaintenanceMode = false;
|
||||||
body += "<div class='infomsg'>⛅ Dimm LED Off</div>";
|
body += "<div class='infomsg'>⛅ Dimm LED OFF</div>";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// otherwise nice error
|
// 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")) {
|
} else if(webserver.hasArg("PumpOnManual")) {
|
||||||
if(UsePump == true) {
|
if(UsePump > 0) {
|
||||||
PumpOnManual = true;
|
PumpOnManual = true;
|
||||||
body += "<div class='infomsg'>💧 Pump manual activated for ";
|
body += "<div class='infomsg'>💧 Pump manual activated for ";
|
||||||
body += PumpOnTime;
|
body += PumpOnTime;
|
||||||
body += "s</div>";
|
body += "s</div>";
|
||||||
} else {
|
} 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
|
// when configured is false, set it to true and ensure outputs are set
|
||||||
if(configured == false) {
|
if(configured == false) {
|
||||||
configured = true;
|
configured = true;
|
||||||
pinMode(PinLED, OUTPUT);
|
initOutputs();
|
||||||
pinMode(PinPUMP, OUTPUT);
|
|
||||||
pinMode(PinFAN, OUTPUT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// size is 1 byte
|
// size is 1 byte
|
||||||
|
|
Loading…
Reference in a new issue