Browse Source

ifan: make sure pin is initialized

mcspr-patch-1
Maxim Prokhorov 3 years ago
parent
commit
df0f1a2e19
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      code/espurna/ifan.cpp

+ 3
- 2
code/espurna/ifan.cpp View File

@ -342,10 +342,11 @@ void setup() {
auto relay_pin = gpioRegister(controlPin()); auto relay_pin = gpioRegister(controlPin());
if (relay_pin) { if (relay_pin) {
relay_pin->pinMode(OUTPUT);
auto provider = std::make_unique<FanProvider>(std::move(relay_pin), config, onSpeedUpdate); auto provider = std::make_unique<FanProvider>(std::move(relay_pin), config, onSpeedUpdate);
if (!relayAdd(std::move(provider))) { if (!relayAdd(std::move(provider))) {
DEBUG_MSG_P(PSTR("[IFAN] Could not add relay provider for GPIO%d\n"), relay_pin->pin());
gpioUnlock(relay_pin->pin());
DEBUG_MSG_P(PSTR("[IFAN] Could not add relay provider for GPIO%d\n"), controlPin());
gpioUnlock(controlPin());
} }
} }


Loading…
Cancel
Save