From b9735a26ff875c73d68874cba2eda9f5f348b2c9 Mon Sep 17 00:00:00 2001 From: almirus Date: Thu, 29 Aug 2024 22:35:56 +0300 Subject: [PATCH] added support "I FEEL" button and sensor temperature for AC Royal Clima fresh (TCL based) --- src/ir_Tcl.cpp | 24 ++++++++++++++++++++++++ src/ir_Tcl.h | 9 +++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/ir_Tcl.cpp b/src/ir_Tcl.cpp index 45e210f2b..dad1905d7 100644 --- a/src/ir_Tcl.cpp +++ b/src/ir_Tcl.cpp @@ -35,6 +35,7 @@ using irutils::addModeToString; using irutils::addModelToString; using irutils::addSwingVToString; using irutils::addTempFloatToString; +using irutils::addTempToString; using irutils::minsToString; #if SEND_TCL112AC @@ -372,6 +373,26 @@ void IRTcl112Ac::setOffTimer(const uint16_t mins) { _.TimerIndicator = _.OnTimerEnabled || _.OffTimerEnabled; } +void IRTcl112Ac::setIFeel(const bool on) +{ + _.IFeel = on; +} + +bool IRTcl112Ac::getIFeel(void) const +{ + return _.IFeel; +} + +void IRTcl112Ac::setSensorTemp(const uint8_t celsius) +{ + _.CurrentTemp = celsius; +} + +uint8_t IRTcl112Ac::getSensorTemp(void) const +{ + return _.CurrentTemp; +} + /// Convert a stdAc::opmode_t enum into its native mode. /// @param[in] mode The enum to be converted. /// @return The native equivalent of the enum. @@ -515,6 +536,9 @@ String IRTcl112Ac::toString(void) const { result += addBoolToString(_.Health, kHealthStr); result += addBoolToString(_.Turbo, kTurboStr); result += addBoolToString(getLight(), kLightStr); + result += addBoolToString(_.IFeel, kIFeelStr); + if (_.IFeel) + result += addTempToString(getSensorTemp(), true, true, true); } result += addLabeledString( _.OnTimerEnabled ? minsToString(getOnTimer()) : kOffStr, diff --git a/src/ir_Tcl.h b/src/ir_Tcl.h index da80efbac..582e11975 100644 --- a/src/ir_Tcl.h +++ b/src/ir_Tcl.h @@ -51,7 +51,8 @@ union Tcl112Protocol{ uint8_t Mode :4; uint8_t Health :1; uint8_t Turbo :1; - uint8_t :2; + uint8_t :1; + uint8_t IFeel :1; // Byte 7 uint8_t Temp :4; uint8_t :4; @@ -69,7 +70,7 @@ union Tcl112Protocol{ uint8_t OnTimer :6; uint8_t :1; // 0 // Byte 11 - uint8_t :8; // 00000000 + uint8_t CurrentTemp :8; // IFEEL function // Byte 12 uint8_t :3; uint8_t SwingH :1; @@ -174,6 +175,10 @@ class IRTcl112Ac { void setOnTimer(const uint16_t mins); uint16_t getOffTimer(void) const; void setOffTimer(const uint16_t mins); + void setIFeel(const bool on); + bool getIFeel(void) const; + void setSensorTemp(const uint8_t celsius); + uint8_t getSensorTemp(void) const; static bool isTcl(const uint8_t state[]); static uint8_t convertMode(const stdAc::opmode_t mode); static uint8_t convertFan(const stdAc::fanspeed_t speed);