From cbdcf9f0f7f739ac522f62fce233691f999d5f43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Sat, 2 Dec 2017 15:46:48 +0100 Subject: [PATCH] Fix mask to send to the F330 in the DUAL --- code/espurna/relay.ino | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/code/espurna/relay.ino b/code/espurna/relay.ino index 54345fb5..ff19c098 100644 --- a/code/espurna/relay.ino +++ b/code/espurna/relay.ino @@ -65,13 +65,12 @@ void _relayProviderStatus(unsigned char id, bool status) { #if RELAY_PROVIDER == RELAY_PROVIDER_DUAL // Calculate mask - unsigned char mask = 0; - for (unsigned char i=_relays.size()-1; i>=0; i-- ) { - mask <<= 1; - if (_relays[i].current_status) mask++; + unsigned char mask=0; + for (unsigned char i=0; i<_relays.size(); i++) { + if (_relays[i].current_status) mask = mask + (1 << i); } - // Send it to EFM88 + // Send it to F330 Serial.flush(); Serial.write(0xA0); Serial.write(0x04);