This commit is contained in:
2021-02-01 11:39:40 +01:00
parent c235c1fceb
commit a7175989ad
2 changed files with 4 additions and 3 deletions

BIN
media/esp8266-pinout.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 KiB

View File

@@ -13,7 +13,8 @@ FanStateService::FanStateService(AsyncWebServer* server, FS* fs, SecurityManager
this, this,
fs, fs,
FAN_SETTINGS_FILE) { FAN_SETTINGS_FILE) {
pinMode(FAN_PIN, OUTPUT); // pinMode(FAN_PIN, OUTPUT);
pinMode(_state.fanGpio, OUTPUT);
// configure settings service update handler to update LED state // configure settings service update handler to update LED state
addUpdateHandler([&](const String& originId) { onConfigUpdated(); }, false); addUpdateHandler([&](const String& originId) { onConfigUpdated(); }, false);
} }
@@ -27,9 +28,9 @@ void FanStateService::begin() {
} }
void FanStateService::onConfigUpdated() { void FanStateService::onConfigUpdated() {
Serial.println(" ** Fan UPDATE to " + _state.fanMaxSpeed); Serial.println(" ** Fan UPDATE (pin " + (String)_state.fanGpio + ") to " + _state.fanMaxSpeed);
//digitalWrite(FAN_PIN, _state.fanStatus ? FAN_ON : FAN_OFF); //digitalWrite(FAN_PIN, _state.fanStatus ? FAN_ON : FAN_OFF);
analogWrite(FAN_PIN, _state.fanMaxSpeed); analogWrite(_state.fanGpio, _state.fanMaxSpeed);
} }
void FanStateService::save() { void FanStateService::save() {