IRremoteIDF
Infrared send & receive for ESP-IDF
Loading...
Searching...
No Matches
ir_Teco.h
Go to the documentation of this file.
1// Copyright 2019 Fabien Valthier
2
5
6// Supports:
7// Brand: Alaska, Model: SAC9010QC A/C
8// Brand: Alaska, Model: SAC9010QC remote
9
10#ifndef IR_TECO_H_
11#define IR_TECO_H_
12
13#include "IRplatform.h"
14#include "IRremoteESP8266.h"
15#include "IRsend.h"
16#ifdef UNIT_TEST
17#include "IRsend_test.h"
18#endif
19
22 uint64_t raw;
23 struct {
24 uint8_t Mode :3;
25 uint8_t Power :1;
26 uint8_t Fan :2;
27 uint8_t Swing :1;
28 uint8_t Sleep :1;
29 uint8_t Temp :4;
30 uint8_t HalfHour :1;
31 uint8_t TensHours :2; // number of 10hours
32 uint8_t TimerOn :1;
33 uint8_t UnitHours :4; // unit, not thenth
34 uint8_t Humid :1;
35 uint8_t Light :1;
36 uint8_t :1; // "Tree with bubbles" / Filter?? (Not Implemented)
37 uint8_t Save :1;
38 uint8_t :8; // Cst 0x50
39 uint8_t :8; // Cst 0x02
40 };
41};
42
43// Constants.
44const uint8_t kTecoAuto = 0; // temp = 25C
45const uint8_t kTecoCool = 1;
46const uint8_t kTecoDry = 2; // temp = 25C, but not shown
47const uint8_t kTecoFan = 3;
48const uint8_t kTecoHeat = 4;
49const uint8_t kTecoFanAuto = 0; // 0b00
50const uint8_t kTecoFanLow = 1; // 0b01
51const uint8_t kTecoFanMed = 2; // 0b10
52const uint8_t kTecoFanHigh = 3; // 0b11
53const uint8_t kTecoMinTemp = 16; // 16C
54const uint8_t kTecoMaxTemp = 30; // 30C
55
56const uint64_t kTecoReset = 0b01001010000000000000010000000000000;
57
58// Classes
60class IRTecoAc {
61 public:
62 explicit IRTecoAc(const uint16_t pin, const bool inverted = false,
63 const bool use_modulation = true);
64 void stateReset(void);
65#if SEND_TECO
66 void send(const uint16_t repeat = kTecoDefaultRepeat);
71 int8_t calibrate(void) { return _irsend.calibrate(); }
72#endif // SEND_TECO
73 void begin(void);
74 void on(void);
75 void off(void);
76
77 void setPower(const bool on);
78 bool getPower(void) const;
79
80 void setTemp(const uint8_t temp);
81 uint8_t getTemp(void) const;
82
83 void setFan(const uint8_t fan);
84 uint8_t getFan(void) const;
85
86 void setMode(const uint8_t mode);
87 uint8_t getMode(void) const;
88
89 void setSwing(const bool on);
90 bool getSwing(void) const;
91
92 void setSleep(const bool on);
93 bool getSleep(void) const;
94
95 void setLight(const bool on);
96 bool getLight(void) const;
97
98 void setHumid(const bool on);
99 bool getHumid(void) const;
100
101 void setSave(const bool on);
102 bool getSave(void) const;
103
104 uint16_t getTimer(void) const;
105 void setTimer(const uint16_t mins);
106
107 uint64_t getRaw(void) const;
108 void setRaw(const uint64_t new_code);
109
110 static uint8_t convertMode(const stdAc::opmode_t mode);
111 static uint8_t convertFan(const stdAc::fanspeed_t speed);
112 static stdAc::opmode_t toCommonMode(const uint8_t mode);
113 static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed);
114 stdAc::state_t toCommon(void) const;
115 String toString(void) const;
116#ifndef UNIT_TEST
117
118 private:
120#else // UNIT_TEST
122 IRsendTest _irsend;
124#endif // UNIT_TEST
126 bool getTimerEnabled(void) const;
127};
128
129#endif // IR_TECO_H_
std::string String
The protocol code builds human readable output with String. On ESP-IDF that is just std::string.
Definition IRplatform.h:21
const uint16_t kTecoDefaultRepeat
Definition IRremoteESP8266.h:1425
Class for handling detailed Teco A/C messages.
Definition ir_Teco.h:60
void setSave(const bool on)
Set the Save setting of the A/C.
Definition ir_Teco.cpp:202
TecoProtocol _
Definition ir_Teco.h:125
void setSleep(const bool on)
Set the Sleep setting of the A/C.
Definition ir_Teco.cpp:166
void setRaw(const uint64_t new_code)
Set the internal state from a valid code for this protocol.
Definition ir_Teco.cpp:76
void setLight(const bool on)
Set the Light (LED/Display) setting of the A/C.
Definition ir_Teco.cpp:178
static uint8_t convertFan(const stdAc::fanspeed_t speed)
Convert a stdAc::fanspeed_t enum into it's native speed.
Definition ir_Teco.cpp:259
IRsend _irsend
Instance of the IR send class.
Definition ir_Teco.h:119
stdAc::state_t toCommon(void) const
Convert the current internal state into its stdAc::state_t equivalent.
Definition ir_Teco.cpp:297
bool getSleep(void) const
Get the Sleep setting of the A/C.
Definition ir_Teco.cpp:172
uint16_t getTimer(void) const
Get the timer time for when the A/C unit will switch power state.
Definition ir_Teco.cpp:220
void begin(void)
Set up hardware to be able to send a message.
Definition ir_Teco.cpp:54
void setTemp(const uint8_t temp)
Set the temperature.
Definition ir_Teco.cpp:98
bool getHumid(void) const
Get the Humid setting of the A/C.
Definition ir_Teco.cpp:196
void setHumid(const bool on)
Set the Humid setting of the A/C.
Definition ir_Teco.cpp:190
static uint8_t convertMode(const stdAc::opmode_t mode)
Convert a stdAc::opmode_t enum into its native mode.
Definition ir_Teco.cpp:246
bool getPower(void) const
Get the value of the current power setting.
Definition ir_Teco.cpp:92
bool getSave(void) const
Get the Save setting of the A/C.
Definition ir_Teco.cpp:208
bool getTimerEnabled(void) const
Is the timer function enabled?
Definition ir_Teco.cpp:214
void setTimer(const uint16_t mins)
Set the timer for when the A/C unit will switch power state.
Definition ir_Teco.cpp:233
bool getSwing(void) const
Get the (vertical) swing setting of the A/C.
Definition ir_Teco.cpp:160
void setPower(const bool on)
Change the power setting.
Definition ir_Teco.cpp:86
String toString(void) const
Convert the current internal state into a human readable string.
Definition ir_Teco.cpp:323
void setSwing(const bool on)
Set the (vertical) swing setting of the A/C.
Definition ir_Teco.cpp:154
bool getLight(void) const
Get the Light (LED/Display) setting of the A/C.
Definition ir_Teco.cpp:184
uint64_t getRaw(void) const
Get a copy of the internal state/code for this protocol.
Definition ir_Teco.cpp:72
void setMode(const uint8_t mode)
Set the operating mode of the A/C.
Definition ir_Teco.cpp:133
static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed)
Convert a native fan speed into its stdAc equivalent.
Definition ir_Teco.cpp:286
static stdAc::opmode_t toCommonMode(const uint8_t mode)
Convert a native mode into its stdAc equivalent.
Definition ir_Teco.cpp:273
void stateReset(void)
Reset the internal state of the emulation.
Definition ir_Teco.cpp:66
void send(const uint16_t repeat=kTecoDefaultRepeat)
Send the current internal state as an IR message.
Definition ir_Teco.cpp:59
uint8_t getMode(void) const
Get the operating mode setting of the A/C.
Definition ir_Teco.cpp:148
int8_t calibrate(void)
Run the calibration to calculate uSec timing offsets for this platform.
Definition ir_Teco.h:71
uint8_t getFan(void) const
Get the current fan speed setting.
Definition ir_Teco.cpp:127
uint8_t getTemp(void) const
Get the current temperature setting.
Definition ir_Teco.cpp:107
void off(void)
Set the requested power state of the A/C to off.
Definition ir_Teco.cpp:82
void on(void)
Set the requested power state of the A/C to on.
Definition ir_Teco.cpp:79
void setFan(const uint8_t fan)
Set the speed of the fan.
Definition ir_Teco.cpp:113
Class for sending all basic IR protocols.
Definition IRsend.h:256
int8_t calibrate(uint16_t hz=38000U)
Calculate & set any offsets to account for execution times during sending.
Definition IRsend.cpp:286
const uint8_t kTecoFanHigh
Definition ir_Teco.h:52
const uint8_t kTecoMaxTemp
Definition ir_Teco.h:54
const uint8_t kTecoFanMed
Definition ir_Teco.h:51
const uint8_t kTecoFanAuto
Definition ir_Teco.h:49
const uint8_t kTecoMinTemp
Definition ir_Teco.h:53
const uint8_t kTecoCool
Definition ir_Teco.h:45
const uint8_t kTecoFan
Definition ir_Teco.h:47
const uint8_t kTecoAuto
Definition ir_Teco.h:44
const uint8_t kTecoHeat
Definition ir_Teco.h:48
const uint8_t kTecoFanLow
Definition ir_Teco.h:50
const uint64_t kTecoReset
Definition ir_Teco.h:56
const uint8_t kTecoDry
Definition ir_Teco.h:46
fanspeed_t
Common A/C settings for Fan Speeds.
Definition IRsend.h:67
opmode_t
Common A/C settings for A/C operating modes.
Definition IRsend.h:55
Structure to hold a common A/C state.
Definition IRsend.h:120
Native representation of a Teco A/C message.
Definition ir_Teco.h:21
uint8_t Light
Definition ir_Teco.h:35
uint8_t Sleep
Definition ir_Teco.h:28
uint8_t Humid
Definition ir_Teco.h:34
uint8_t Mode
Definition ir_Teco.h:24
uint8_t Power
Definition ir_Teco.h:25
uint8_t Swing
Definition ir_Teco.h:27
uint8_t UnitHours
Definition ir_Teco.h:33
uint8_t TensHours
Definition ir_Teco.h:31
uint8_t Fan
Definition ir_Teco.h:26
uint8_t Temp
Definition ir_Teco.h:29
uint64_t raw
The state of the IR remote in IR code form.
Definition ir_Teco.h:22
uint8_t TimerOn
Definition ir_Teco.h:32
uint8_t Save
Definition ir_Teco.h:37
uint8_t HalfHour
Definition ir_Teco.h:30