ok
This commit is contained in:
BIN
media/esp8266-pinout.png
Normal file
BIN
media/esp8266-pinout.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 617 KiB |
@@ -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() {
|
||||||
|
|||||||
Reference in New Issue
Block a user