Browse Source

relay: don't init RelaysMax relays when using rfbridge provider

mcspr-patch-1
Maxim Prokhorov 4 years ago
parent
commit
5e5d0d0dd7
1 changed files with 4 additions and 6 deletions
  1. +4
    -6
      code/espurna/relay.cpp

+ 4
- 6
code/espurna/relay.cpp View File

@ -1473,15 +1473,13 @@ void _relaySetupAdhoc() {
for (unsigned char id = 0; id < RelaysMax; ++id) { for (unsigned char id = 0; id < RelaysMax; ++id) {
const auto pin = _relayPin(id); const auto pin = _relayPin(id);
#if (RELAY_PROVIDER == RELAY_PROVIDER_RELAY) || (RELAY_PROVIDER == RELAY_PROVIDER_LIGHT)
if (!gpioValid(pin)) {
break;
}
#elif (RELAY_PROVIDER == RELAY_PROVIDER_MCP23S08)
#if (RELAY_PROVIDER == RELAY_PROVIDER_MCP23S08)
if (!mcpGpioValid(pin)) { if (!mcpGpioValid(pin)) {
#else
if (!gpioValid(pin)) {
#endif
break; break;
} }
#endif
_relays.emplace_back( _relays.emplace_back(
std::make_unique<gpio_type>(_relayPin(id)), std::make_unique<gpio_type>(_relayPin(id)),


Loading…
Cancel
Save