forked from ToniA/Raw-IR-decoder-for-Arduino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Ballu.cpp
55 lines (47 loc) · 1.11 KB
/
Ballu.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
#include <Arduino.h>
bool decodeBallu(byte *bytes, int byteCount)
{
// If this looks like a Ballu code...
if ( byteCount == 21 && bytes[0] == 0x83 && bytes[1] == 0x06 ) {
Serial.println(F("Looks like a Ballu protocol"));
// Power mode
// TBD
// Operating mode
switch (bytes[3] & 0x07) {
case 0x00:
Serial.println(F("MODE HEAT"));
break;
case 0x02:
Serial.println(F("MODE COOL"));
break;
case 0x03:
Serial.println(F("MODE DRY"));
break;
case 0x04:
Serial.println(F("MODE FAN"));
break;
}
// Temperature
Serial.print(F("Temperature: "));
Serial.println((bytes[3] >> 4) + 16);
// Fan speed
switch (bytes[02] & 0x03) {
case 0xA0:
Serial.println(F("FAN: AUTO"));
break;
case 0x01:
Serial.println(F("FAN: 1"));
break;
case 0x02:
Serial.println(F("FAN: 2"));
break;
case 0x03:
Serial.println(F("FAN: 3"));
break;
}
// Check if the checksum matches
// TBD
return true;
}
return false;
}