IRremoteESP8266
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#ifndef UNIT_TEST
14#include <Arduino.h>
15#endif
16#include "IRremoteESP8266.h"
17#include "IRsend.h"
18#ifdef UNIT_TEST
19#include "IRsend_test.h"
20#endif
21
24 uint64_t raw;
25 struct {
26 uint8_t Mode :3;
27 uint8_t Power :1;
28 uint8_t Fan :2;
29 uint8_t Swing :1;
30 uint8_t Sleep :1;
31 uint8_t Temp :4;
32 uint8_t HalfHour :1;
33 uint8_t TensHours :2; // number of 10hours
34 uint8_t TimerOn :1;
35 uint8_t UnitHours :4; // unit, not thenth
36 uint8_t Humid :1;
37 uint8_t Light :1;
38 uint8_t :1; // "Tree with bubbles" / Filter?? (Not Implemented)
39 uint8_t Save :1;
40 uint8_t :8; // Cst 0x50
41 uint8_t :8; // Cst 0x02
42 };
43};
44
45// Constants.
46const uint8_t kTecoAuto = 0; // temp = 25C
47const uint8_t kTecoCool = 1;
48const uint8_t kTecoDry = 2; // temp = 25C, but not shown
49const uint8_t kTecoFan = 3;
50const uint8_t kTecoHeat = 4;
51const uint8_t kTecoFanAuto = 0; // 0b00
52const uint8_t kTecoFanLow = 1; // 0b01
53const uint8_t kTecoFanMed = 2; // 0b10
54const uint8_t kTecoFanHigh = 3; // 0b11
55const uint8_t kTecoMinTemp = 16; // 16C
56const uint8_t kTecoMaxTemp = 30; // 30C
57
58const uint64_t kTecoReset = 0b01001010000000000000010000000000000;
59
60// Classes
62class IRTecoAc {
63 public:
64 explicit IRTecoAc(const uint16_t pin, const bool inverted = false,
65 const bool use_modulation = true);
66 void stateReset(void);
67#if SEND_TECO
68 void send(const uint16_t repeat = kTecoDefaultRepeat);
73 int8_t calibrate(void) { return _irsend.calibrate(); }
74#endif // SEND_TECO
75 void begin(void);
76 void on(void);
77 void off(void);
78
79 void setPower(const bool on);
80 bool getPower(void) const;
81
82 void setTemp(const uint8_t temp);
83 uint8_t getTemp(void) const;
84
85 void setFan(const uint8_t fan);
86 uint8_t getFan(void) const;
87
88 void setMode(const uint8_t mode);
89 uint8_t getMode(void) const;
90
91 void setSwing(const bool on);
92 bool getSwing(void) const;
93
94 void setSleep(const bool on);
95 bool getSleep(void) const;
96
97 void setLight(const bool on);
98 bool getLight(void) const;
99
100 void setHumid(const bool on);
101 bool getHumid(void) const;
102
103 void setSave(const bool on);
104 bool getSave(void) const;
105
106 uint16_t getTimer(void) const;
107 void setTimer(const uint16_t mins);
108
109 uint64_t getRaw(void) const;
110 void setRaw(const uint64_t new_code);
111
112 static uint8_t convertMode(const stdAc::opmode_t mode);
113 static uint8_t convertFan(const stdAc::fanspeed_t speed);
114 static stdAc::opmode_t toCommonMode(const uint8_t mode);
115 static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed);
116 stdAc::state_t toCommon(void) const;
117 String toString(void) const;
118#ifndef UNIT_TEST
119
120 private:
122#else // UNIT_TEST
124 IRsendTest _irsend;
126#endif // UNIT_TEST
128 bool getTimerEnabled(void) const;
129};
130
131#endif // IR_TECO_H_
const uint16_t kTecoDefaultRepeat
Definition IRremoteESP8266.h:1426
std::string String
Definition IRremoteESP8266.h:1564
Class for handling detailed Teco A/C messages.
Definition ir_Teco.h:62
void setSave(const bool on)
Set the Save setting of the A/C.
Definition ir_Teco.cpp:202
TecoProtocol _
Definition ir_Teco.h:127
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:121
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:73
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:249
int8_t calibrate(uint16_t hz=38000U)
Calculate & set any offsets to account for execution times during sending.
Definition IRsend.cpp:209
const uint8_t kTecoFanHigh
Definition ir_Teco.h:54
const uint8_t kTecoMaxTemp
Definition ir_Teco.h:56
const uint8_t kTecoFanMed
Definition ir_Teco.h:53
const uint8_t kTecoFanAuto
Definition ir_Teco.h:51
const uint8_t kTecoMinTemp
Definition ir_Teco.h:55
const uint8_t kTecoCool
Definition ir_Teco.h:47
const uint8_t kTecoFan
Definition ir_Teco.h:49
const uint8_t kTecoAuto
Definition ir_Teco.h:46
const uint8_t kTecoHeat
Definition ir_Teco.h:50
const uint8_t kTecoFanLow
Definition ir_Teco.h:52
const uint64_t kTecoReset
Definition ir_Teco.h:58
const uint8_t kTecoDry
Definition ir_Teco.h:48
fanspeed_t
Common A/C settings for Fan Speeds.
Definition IRsend.h:61
opmode_t
Common A/C settings for A/C operating modes.
Definition IRsend.h:49
Structure to hold a common A/C state.
Definition IRsend.h:114
Native representation of a Teco A/C message.
Definition ir_Teco.h:23
uint8_t Light
Definition ir_Teco.h:37
uint8_t Sleep
Definition ir_Teco.h:30
uint8_t Humid
Definition ir_Teco.h:36
uint8_t Mode
Definition ir_Teco.h:26
uint8_t Power
Definition ir_Teco.h:27
uint8_t Swing
Definition ir_Teco.h:29
uint8_t UnitHours
Definition ir_Teco.h:35
uint8_t TensHours
Definition ir_Teco.h:33
uint8_t Fan
Definition ir_Teco.h:28
uint8_t Temp
Definition ir_Teco.h:31
uint64_t raw
The state of the IR remote in IR code form.
Definition ir_Teco.h:24
uint8_t TimerOn
Definition ir_Teco.h:34
uint8_t Save
Definition ir_Teco.h:39
uint8_t HalfHour
Definition ir_Teco.h:32