From b059ce9445bff9709bc6377d6449c9469114bca2 Mon Sep 17 00:00:00 2001 From: Max Prokhorov Date: Mon, 9 Dec 2019 07:28:03 +0300 Subject: [PATCH] domoticz: proper datastructure for mask (#2049) --- code/espurna/domoticz.ino | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/code/espurna/domoticz.ino b/code/espurna/domoticz.ino index 2f516479..8e716dd9 100644 --- a/code/espurna/domoticz.ino +++ b/code/espurna/domoticz.ino @@ -11,10 +11,11 @@ Copyright (C) 2016-2019 by Xose PĂ©rez #include "relay.h" #include "broker.h" +#include #include bool _dcz_enabled = false; -std::vector _dcz_relay_state; +std::bitset _dcz_relay_state; //------------------------------------------------------------------------------ // Private methods @@ -41,12 +42,10 @@ void _domoticzMqttSubscribe(bool value) { } bool _domoticzStatus(unsigned char id) { - if (id >= _dcz_relay_state.size()) return false; return _dcz_relay_state[id]; } void _domoticzStatus(unsigned char id, bool status) { - if (id >= _dcz_relay_state.size()) return; _dcz_relay_state[id] = status; relayStatus(id, status); } @@ -220,7 +219,6 @@ void _domoticzWebSocketOnConnected(JsonObject& root) { #endif // WEB_SUPPORT void _domoticzRelayConfigure(size_t size) { - _dcz_relay_state.reserve(size); for (size_t n = 0; n < size; ++n) { _dcz_relay_state[n] = relayStatus(n); }