-
Notifications
You must be signed in to change notification settings - Fork 150
/
Copy pathGreeHeatpumpIR.h
274 lines (231 loc) · 7.85 KB
/
GreeHeatpumpIR.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
/*
Gree heatpump control (remote control P/N zzz)
*/
#ifndef GreeHeatpumpIR_h
#define GreeHeatpumpIR_h
#include <HeatpumpIR.h>
// Power state
#define GREE_AIRCON1_POWER_OFF 0x00
#define GREE_AIRCON1_POWER_ON 0x08
// Operating modes
// Gree codes
#define GREE_AIRCON1_MODE_AUTO 0x00
#define GREE_AIRCON1_MODE_COOL 0x01
#define GREE_AIRCON1_MODE_DRY 0x02
#define GREE_AIRCON1_MODE_FAN 0x03
#define GREE_AIRCON1_MODE_HEAT 0x04
// Fan speeds. Note that some heatpumps have less than 5 fan speeds
#define GREE_AIRCON1_FAN_AUTO 0x00 // Fan speed
#define GREE_AIRCON1_FAN1 0x10 // * low
#define GREE_AIRCON1_FAN2 0x20 // * med
#define GREE_AIRCON1_FAN3 0x30 // * high
#define GREE_AIRCON1_TURBO 0x80 // * turbo mode on YAN
// Only available on YAN and YT
// Vertical air directions. Note that these cannot be set on all heat pumps
#define GREE_VDIR_AUTO 0x00
#define GREE_VDIR_MANUAL 0x00
#define GREE_VDIR_SWING 0x01
#define GREE_VDIR_UP 0x02
#define GREE_VDIR_MUP 0x03
#define GREE_VDIR_MIDDLE 0x04
#define GREE_VDIR_MDOWN 0x05
#define GREE_VDIR_DOWN 0x06
// Only available on YAC
// Horizontal air directions. Note that these cannot be set on all heat pumps
#define GREE_HDIR_AUTO 0x00
#define GREE_HDIR_MANUAL 0x00
#define GREE_HDIR_SWING 0x01
#define GREE_HDIR_LEFT 0x02
#define GREE_HDIR_MLEFT 0x03
#define GREE_HDIR_MIDDLE 0x04
#define GREE_HDIR_MRIGHT 0x05
#define GREE_HDIR_RIGHT 0x06
#define GREE_IFEEL_BIT 0x08
// Only available on YAA, YAC, and YT
// byte 0
#define GREE_VSWING (1 << 6)
// byte 2
#define GREE_TURBO_BIT (1 << 4)
#define GREE_LIGHT_BIT (1 << 5)
#define GREE_HEALTH_BIT (1 << 6)
#define GREE_XFAN_BIT (1 << 7) // aka BLOW on some remotes
// Gree model codes
#define GREE_GENERIC 0
#define GREE_YAN 1
#define GREE_YAA 2
#define GREE_YAC 3
#define GREE_YT 4
class GreeHeatpumpIR : public HeatpumpIR
{
protected:
struct Timings {
int hdr_mark;
int hdr_space;
int bit_mark;
int one_space;
int zero_space;
int msg_space;
int ifeel_hdr_mark;
int ifeel_hdr_space;
int ifeel_bit_mark;
};
GreeHeatpumpIR();
virtual const Timings & getTimings() const;
virtual void generateCommand(uint8_t * buffer,
uint8_t powerMode, uint8_t operatingMode,
uint8_t fanSpeed, uint8_t temperature,
uint8_t swingV, uint8_t swingH,
bool turboMode, bool iFeelMode);
virtual void calculateChecksum(uint8_t * buffer);
virtual void sendGree(
IRSender& IR,
uint8_t powerMode, uint8_t operatingMode,
uint8_t fanSpeed, uint8_t temperature,
uint8_t swingV, uint8_t swingH,
bool turboMode, bool iFeelMode);
virtual void sendBuffer(
IRSender& IR,
const uint8_t * buffer,
size_t len = 8);
public:
void send(
IRSender& IR,
uint8_t powerModeCmd, uint8_t operatingModeCmd,
uint8_t fanSpeedCmd, uint8_t temperatureCmd,
uint8_t swingVCmd, uint8_t swingHCmd) override {
send(
IR,
powerModeCmd, operatingModeCmd,
fanSpeedCmd, temperatureCmd,
swingVCmd, swingHCmd, false);
}
virtual void send(
IRSender& IR,
uint8_t powerModeCmd, uint8_t operatingModeCmd,
uint8_t fanSpeedCmd, uint8_t temperatureCmd,
uint8_t swingVCmd, uint8_t swingHCmd,
bool turboMode, bool iFeelMode = false);
};
class GreeGenericHeatpumpIR : public GreeHeatpumpIR
{
public:
GreeGenericHeatpumpIR();
};
class GreeYANHeatpumpIR : public GreeHeatpumpIR
{
public:
GreeYANHeatpumpIR();
protected:
virtual void generateCommand(uint8_t * buffer,
uint8_t powerMode, uint8_t operatingMode,
uint8_t fanSpeed, uint8_t temperature,
uint8_t swingV, uint8_t swingH,
bool turboMode, bool iFeelMode) override;
virtual void calculateChecksum(uint8_t * buffer) override;
};
class GreeYAAHeatpumpIR : public GreeHeatpumpIR
{
public:
GreeYAAHeatpumpIR();
protected:
virtual void generateCommand(uint8_t * buffer,
uint8_t powerMode, uint8_t operatingMode,
uint8_t fanSpeed, uint8_t temperature,
uint8_t swingV, uint8_t swingH,
bool turboMode, bool iFeelMode) override;
};
class GreeiFeelHeatpumpIR : public GreeHeatpumpIR
{
public:
using GreeHeatpumpIR::send;
void send(IRSender& IR, uint8_t currentTemperature) override;
protected:
virtual void generateCommand(uint8_t * buffer,
uint8_t powerMode, uint8_t operatingMode,
uint8_t fanSpeed, uint8_t temperature,
uint8_t swingV, uint8_t swingH,
bool turboMode, bool iFeelMode) override;
};
class GreeYACHeatpumpIR : public GreeiFeelHeatpumpIR
{
public:
GreeYACHeatpumpIR();
protected:
virtual void generateCommand(uint8_t * buffer,
uint8_t powerMode, uint8_t operatingMode,
uint8_t fanSpeed, uint8_t temperature,
uint8_t swingV, uint8_t swingH,
bool turboMode, bool iFeelMode) override;
};
class GreeYTHeatpumpIR : public GreeiFeelHeatpumpIR
{
public:
GreeYTHeatpumpIR();
protected:
virtual void generateCommand(uint8_t * buffer,
uint8_t powerMode, uint8_t operatingMode,
uint8_t fanSpeed, uint8_t temperature,
uint8_t swingV, uint8_t swingH,
bool turboMode, bool iFeelMode) override;
};
class GreeYAPHeatpumpIR : public GreeiFeelHeatpumpIR
{
public:
GreeYAPHeatpumpIR();
using GreeiFeelHeatpumpIR::send;
virtual void send(
IRSender& IR,
uint8_t powerModeCmd, uint8_t operatingModeCmd,
uint8_t fanSpeedCmd, uint8_t temperatureCmd,
uint8_t swingVCmd, uint8_t swingHCmd,
bool turboMode, bool iFeelMode = false) override {
send(
IR,
powerModeCmd, operatingModeCmd,
fanSpeedCmd, temperatureCmd,
swingVCmd, swingHCmd,
turboMode, iFeelMode,
true);
}
virtual void send(
IRSender& IR,
uint8_t powerModeCmd, uint8_t operatingModeCmd,
uint8_t fanSpeedCmd, uint8_t temperatureCmd,
uint8_t swingVCmd, uint8_t swingHCmd,
bool turboMode, bool iFeelMode,
bool light, bool xfan = false,
bool health = false, bool valve = false,
bool sthtMode = false, bool enableWiFi = true);
protected:
virtual const Timings & getTimings() const override;
virtual void generateCommand(uint8_t * buffer,
uint8_t powerMode, uint8_t operatingMode,
uint8_t fanSpeed, uint8_t temperature,
uint8_t swingV, uint8_t swingH,
bool turboMode, bool iFeelMode) override;
void generateCommand(uint8_t * buffer,
uint8_t powerMode, uint8_t operatingMode,
uint8_t fanSpeed, uint8_t temperature,
uint8_t swingV, uint8_t swingH,
bool turboMode, bool iFeelMode,
bool light, bool xfan = false,
bool health = false, bool valve = false,
bool sthtMode = false, bool enableWiFi = true
);
virtual void sendGree(
IRSender& IR,
uint8_t powerMode, uint8_t operatingMode,
uint8_t fanSpeed, uint8_t temperature,
uint8_t swingV, uint8_t swingH,
bool turboMode, bool iFeelMode) override;
void sendGree(
IRSender& IR,
uint8_t powerMode, uint8_t operatingMode,
uint8_t fanSpeed, uint8_t temperature,
uint8_t swingV, uint8_t swingH,
bool turboMode, bool iFeelMode,
bool light, bool xfan = false,
bool health = false, bool valve = false,
bool sthtMode = false, bool enableWiFi = true);
};
#endif