From 3df40c89cd68b2a0785bc5763d45a6cf54f34a85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB=20=D0=A1=D0=BE=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=D1=8C=D0=B5=D0=B2?= Date: Sat, 30 Mar 2024 16:42:34 +0300 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=BC=D0=B5=D1=82=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BA=D0=BE=D1=81=D1=8F=D0=BA-=20=D0=B8=D1=81=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=B8=D0=BB=20=D0=BA=D0=BE=D1=81=D1=8F=D0=BA.=20?= =?UTF-8?q?=D0=9F=D0=BB=D1=8E=D1=81=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BD=D0=B5=D0=BC=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=9E?= =?UTF-8?q?=D0=9A=D0=A0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/tclac/tclac.h | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/components/tclac/tclac.h b/components/tclac/tclac.h index 921545e..26d7593 100644 --- a/components/tclac/tclac.h +++ b/components/tclac/tclac.h @@ -9,9 +9,8 @@ #include "esphome.h" #include "esphome/core/defines.h" -#include "esphome/components/climate/climate.h" #include "esphome/components/uart/uart.h" -#include "esphome/components/display/display.h" +#include "esphome/components/climate/climate.h" namespace esphome { namespace tclac { @@ -49,18 +48,28 @@ namespace tclac { #define SWING_BOTH 0b01100000 #define SWING_MODE_MASK 0b01100000 - +#define STEP_TEMPERATURE 1 #define MIN_SET_TEMPERATURE 16 #define MAX_SET_TEMPERATURE 31 -#define STEP_TEMPERATURE 1 using climate::ClimateCall; +using climate::ClimateMode; using climate::ClimatePreset; using climate::ClimateTraits; -using climate::ClimateMode; -using climate::ClimateSwingMode; using climate::ClimateFanMode; +using climate::ClimateSwingMode; +enum class VerticalSwingDirection : uint8_t { + UP_DOWN = 0, + UPSIDE = 1, + DOWNSIDE = 2, +}; +enum class HorizontalSwingDirection : uint8_t { + LEFT_RIGHT = 0, + LEFTSIDE = 1, + CENTER = 2, + RIGHTSIDE = 3, +}; enum class AirflowVerticalDirection : uint8_t { LAST = 0, MAX_UP = 1, @@ -77,17 +86,6 @@ enum class AirflowHorizontalDirection : uint8_t { RIGHT = 4, MAX_RIGHT = 5, }; -enum class VerticalSwingDirection : uint8_t { - UP_DOWN = 0, - UPSIDE = 1, - DOWNSIDE = 2, -}; -enum class HorizontalSwingDirection : uint8_t { - LEFT_RIGHT = 0, - LEFTSIDE = 1, - CENTER = 2, - RIGHTSIDE = 3, -}; class tclacClimate : public climate::Climate, public esphome::uart::UARTDevice, public PollingComponent { @@ -114,11 +112,11 @@ class tclacClimate : public climate::Climate, public esphome::uart::UARTDevice, void loop() override; void update() override; void readData(); - void control(const ClimateCall &call) override; // Climate control + void dataShow(bool flow, bool shine); void sendData(byte * message, byte size); static String getHex(byte *message, byte size); static byte getChecksum(const byte * message, size_t size); - void dataShow(bool flow, bool shine); + void control(const ClimateCall &call) override; // Climate control // Заготовки функций запроса состояния, может пригодиться в будущем, если делать обратную связь. Очень не хочется, будет очень костыльно.