From 8e659c94867bc41473ccbc45ff269f63fbd36721 Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Sun, 17 Jan 2021 12:11:31 +0300 Subject: [PATCH] relay: type is always valid resolve #2416 --- code/espurna/relay.cpp | 11 ++--------- code/espurna/relay.h | 1 - 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/code/espurna/relay.cpp b/code/espurna/relay.cpp index 4e9ae84a..558de7cd 100644 --- a/code/espurna/relay.cpp +++ b/code/espurna/relay.cpp @@ -118,7 +118,6 @@ template <> RelayType convert(const String& value) { auto type = static_cast(value.toInt()); switch (type) { - case RelayType::None: case RelayType::Normal: case RelayType::Inverse: case RelayType::Latched: @@ -126,7 +125,7 @@ RelayType convert(const String& value) { return type; } - return RelayType::None; + return RelayType::Normal; } template <> @@ -278,10 +277,6 @@ struct GpioProvider : public RelayProviderBase { } bool setup() override { - if (_type == RelayType::None) { - return false; - } - if (!_pin) { return false; } @@ -300,8 +295,6 @@ struct GpioProvider : public RelayProviderBase { void change(bool status) override { switch (_type) { - case RelayType::None: - break; case RelayType::Normal: _pin->digitalWrite(status); break; @@ -333,7 +326,7 @@ struct GpioProvider : public RelayProviderBase { private: unsigned char _id { RELAY_NONE }; - RelayType _type { RelayType::None }; + RelayType _type { RelayType::Normal }; std::unique_ptr _pin; std::unique_ptr _reset_pin; }; diff --git a/code/espurna/relay.h b/code/espurna/relay.h index b717eec7..ecd0dc76 100644 --- a/code/espurna/relay.h +++ b/code/espurna/relay.h @@ -14,7 +14,6 @@ Copyright (C) 2016-2019 by Xose PĂ©rez constexpr size_t RelaysMax = 32; enum class RelayType : int { - None, Normal, Inverse, Latched,