From ff045f149cbc2e31c8512169c1455578b8bf405e Mon Sep 17 00:00:00 2001 From: zpin Date: Sun, 21 Aug 2022 11:37:53 +0200 Subject: [PATCH] Argo sendSensorTemp (#1858) When using the iFeel functionality the remote regularly sends silent (i.e. no beep) messages to the Argo unit to update the current temperature. This function adds the ability to send such messages. On a side note, to capture normal Argo IR messages using IRrecv::decodeArgo I had to reduce kArgoBits and disable the checksum, likely because the message wasn't fully recorded. To capture these temperature messages I had to use nbits = 32. X-Ref: #1859 --- src/ir_Argo.cpp | 22 ++++++++++++++++++++++ src/ir_Argo.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/src/ir_Argo.cpp b/src/ir_Argo.cpp index 04cde67ed..680178ceb 100644 --- a/src/ir_Argo.cpp +++ b/src/ir_Argo.cpp @@ -63,6 +63,28 @@ void IRArgoAC::begin(void) { _irsend.begin(); } void IRArgoAC::send(const uint16_t repeat) { _irsend.sendArgo(getRaw(), kArgoStateLength, repeat); } + +/// Send current room temperature for the iFeel feature as a silent IR +/// message (no acknowledgement from the device). +/// @param[in] temp The temperature in degrees celsius. +/// @param[in] repeat Nr. of times the message will be repeated. +void IRArgoAC::sendSensorTemp(const uint8_t temp, const uint16_t repeat) { + uint8_t tempc = temp - kArgoTempDelta; + uint8_t check = 52 + tempc; + uint8_t end = 0b011; + + ArgoProtocol data; + data.raw[0] = 0b10101100; + data.raw[1] = 0b11110101; + data.raw[2] = (tempc << 3) | (check >> 5); + data.raw[3] = (check << 3) | end; + for (uint8_t i = 4; i < kArgoStateLength; i++) data.raw[i] = 0x0; + uint8_t sum = IRArgoAC::calcChecksum(data.raw, kArgoStateLength); + data.raw[10] = 0b00000010; + data.Sum = sum; + + _irsend.sendArgo(data.raw, kArgoStateLength, repeat); +} #endif // SEND_ARGO /// Verify the checksum is valid for a given state. diff --git a/src/ir_Argo.h b/src/ir_Argo.h index 6ceb58e42..8ef7bb386 100644 --- a/src/ir_Argo.h +++ b/src/ir_Argo.h @@ -131,6 +131,8 @@ class IRArgoAC { #if SEND_ARGO void send(const uint16_t repeat = kArgoDefaultRepeat); + void sendSensorTemp(const uint8_t temp, + const uint16_t repeat = kArgoDefaultRepeat); /// Run the calibration to calculate uSec timing offsets for this platform. /// @return The uSec timing offset needed per modulation of the IR Led. /// @note This will produce a 65ms IR signal pulse at 38kHz.