forked from ToniA/Raw-IR-decoder-for-Arduino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fuego.cpp
105 lines (94 loc) · 2.28 KB
/
Fuego.cpp
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
#include <Arduino.h>
bool decodeFuego(byte *bytes, int byteCount)
{
// If this looks like a Chinese Fuego, Vivax, Classe, NEO, Galanz, Simbio, Beko code...
// Remote control GZ-1002B-E3
if ( byteCount == 14 &&
bytes[0] == 0x23 &&
bytes[1] == 0xCB &&
bytes[2] == 0x26 ) {
Serial.println(F("Looks like a Fuego etc. protocol"));
// Check if the checksum matches
byte checksum = 0;
for (int i=0; i<13; i++) {
checksum += bytes[i];
}
if (checksum == bytes[13]) {
Serial.println(F("Checksum matches"));
} else {
Serial.println(F("Checksum does not match"));
}
// Power mode
switch (bytes[5] & 0x04) {
case 0x00:
Serial.println(F("POWER OFF"));
break;
case 0x04:
Serial.println(F("POWER ON"));
break;
}
// Operating mode
switch (bytes[6] & 0x07) {
case 0x00: //???
Serial.println(F("MODE AUTO"));
break;
case 0x01:
Serial.println(F("MODE HEAT"));
break;
case 0x03:
Serial.println(F("MODE COOL"));
break;
case 0x02:
Serial.println(F("MODE DRY"));
break;
case 0x07:
Serial.println(F("MODE FAN"));
break;
}
// Temperature
Serial.print(F("Temperature: "));
Serial.println(31 - (bytes[7] & 0x0F));
// Fan speed
switch (bytes[8] & 0x07) {
case 0x00:
Serial.println(F("FAN: AUTO"));
break;
case 0x02:
Serial.println(F("FAN: 1"));
break;
case 0x03:
Serial.println(F("FAN: 2"));
break;
case 0x05:
Serial.println(F("FAN: 3"));
break;
}
// Vertical air direction
Serial.print(F("Vertical air direction: "));
switch (bytes[8] & 0x38) {
case 0x00:
Serial.println(F("AUTO"));
break;
case 0x08:
Serial.println(F("UP"));
break;
case 0x10:
Serial.println(F("MIDDLE UP"));
break;
case 0x18:
Serial.println(F("MIDDLE"));
break;
case 0x20:
Serial.println(F("MIDDLE DOWN"));
break;
case 0x28:
Serial.println(F("DOWN"));
break;
case 0x38:
Serial.println(F("SWING"));
break;
}
return true;
}
return false;
}