Skip to content

Commit 93c217c

Browse files
committed
[improved init]
Turn off fans and keep led mostly on Signed-off-by: Arrie Dacious <[email protected]>
1 parent 6c519c7 commit 93c217c

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

IoTServerFS.ino

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,29 +68,36 @@ ESP8266HTTPUpdateServer httpUpdater;
6868

6969
#include "HttpMethods.h"
7070

71+
#define LED 2
72+
7173
void setup(void) {
7274
DBG_OUTPUT_PORT.begin(115200);
7375
DBG_OUTPUT_PORT.print("\n");
7476
DBG_OUTPUT_PORT.print("IoTServerFS begin\n");
7577
DBG_OUTPUT_PORT.setDebugOutput(true);
7678

7779
oled();
80+
81+
// Init IO to turn off fans during WifiSetup
82+
setup_WaterCooler_IO();
7883

7984
SPIFFS.begin();
8085

8186
listFiles();
8287

83-
8488
//WIFI INIT
8589
DBG_OUTPUT_PORT.printf("Connecting to %s\n", ssid);
8690
if (String(WiFi.SSID()) != String(ssid)) {
8791
WiFi.mode(WIFI_STA);
8892
WiFi.begin(ssid, password);
8993
}
9094

95+
digitalWrite(LED, HIGH); // turn on
9196
while (WiFi.status() != WL_CONNECTED) {
97+
digitalWrite(LED, LOW); // turn off
9298
delay(500);
9399
DBG_OUTPUT_PORT.print(".");
100+
digitalWrite(LED, HIGH); // turn on
94101
}
95102
DBG_OUTPUT_PORT.println("");
96103
DBG_OUTPUT_PORT.print("Connected! IP address: ");

WaterCooler.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,14 @@ void updateProgress(size_t i, size_t j) {
206206
blinkLed();
207207
}
208208

209+
void setup_WaterCooler_IO() {
210+
// pwm freq
211+
analogWriteFreq(50);
212+
analogWrite(FAN_PWM, 0);
213+
analogWrite(PELTIER_FAN_PWM, 0);
214+
analogWrite(PUMP_PWM, 0);
215+
}
216+
209217
void setup_WaterCooler() {
210218
// initialize web sockets
211219
webSocket.begin();
@@ -218,11 +226,6 @@ void setup_WaterCooler() {
218226
blinker.attach_ms_scheduled(500, blinkLed);
219227
// broadcast status
220228
tempUpdater.attach_ms_scheduled(2000, broadcastTemp);
221-
// pwm freq
222-
analogWriteFreq(50);
223-
analogWrite(FAN_PWM, 0);
224-
analogWrite(PELTIER_FAN_PWM, 0);
225-
analogWrite(PUMP_PWM, 0);
226229
init_cycle();
227230
}
228231

WaterCooler.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ void setupPWM();
55

66
void updatePWM();
77

8+
void setup_WaterCooler_IO();
9+
810
void setup_WaterCooler();
911

1012
void loop_WaterCooler();

0 commit comments

Comments
 (0)