Skip to content

Commit 4b4bf2b

Browse files
authored
Merge pull request ToniA#32 from yincrash/yincrash/olimpiastandardmaestro
Addition of the Olimpia Splendid Maestro
2 parents 5d26a75 + cba879e commit 4b4bf2b

File tree

2 files changed

+116
-2
lines changed

2 files changed

+116
-2
lines changed

rawirdecode/OlimpiaMaestro.cpp

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#include <Arduino.h>
2+
3+
// from Carrier.cpp
4+
#define BYTETOBINARYPATTERN "%d%d%d%d%d%d%d%d"
5+
#define BYTETOBINARY(byte) \
6+
(byte & 0x80 ? 1 : 0), \
7+
(byte & 0x40 ? 1 : 0), \
8+
(byte & 0x20 ? 1 : 0), \
9+
(byte & 0x10 ? 1 : 0), \
10+
(byte & 0x08 ? 1 : 0), \
11+
(byte & 0x04 ? 1 : 0), \
12+
(byte & 0x02 ? 1 : 0), \
13+
(byte & 0x01 ? 1 : 0)
14+
15+
bool decodeOlimpiaMaestro(byte *bytes, int byteCount)
16+
{
17+
// If this looks like an Olimpia code...
18+
if (byteCount == 11 && bytes[0] == 0x5A) {
19+
Serial.println(F("Looks like an Olimpia-Splendid Maestro protocol"));
20+
21+
// Determine if the unit is off or in a specific mode (bits 8–10)
22+
switch ((bytes[1] & 0x07)) {
23+
case 0b001:
24+
Serial.println(F("POWER ON"));
25+
Serial.println(F("MODE COOL"));
26+
break;
27+
case 0b010:
28+
Serial.println(F("POWER ON"));
29+
Serial.println(F("MODE HEAT"));
30+
break;
31+
case 0b011:
32+
Serial.println(F("POWER ON"));
33+
Serial.println(F("MODE DRY"));
34+
break;
35+
case 0b100:
36+
Serial.println(F("POWER ON"));
37+
Serial.println(F("MODE FAN"));
38+
break;
39+
case 0b101:
40+
Serial.println(F("POWER ON"));
41+
Serial.println(F("MODE AUTO"));
42+
break;
43+
case 0b000:
44+
Serial.println(F("POWER OFF"));
45+
break;
46+
default:
47+
Serial.println(F("MODE UNKNOWN"));
48+
}
49+
50+
// Temperature (bits 72–76)
51+
Serial.print(F("Temperature: "));
52+
if (bytes[9] & 0x20) {
53+
uint8_t encodedTemp = ((bytes[9] & 0x1F));
54+
Serial.print(((((float) encodedTemp) / 2) + 15) * (1.8) + 32);
55+
Serial.println(F("°F"));
56+
} else {
57+
uint8_t encodedTemp = ((bytes[9] & 0x1F));
58+
Serial.print((((float) encodedTemp) / 2) + 15);
59+
Serial.println(F("°C"));
60+
}
61+
62+
// Fan speed
63+
switch ((bytes[1] & 0x18) >> 3) {
64+
case 0b00:
65+
Serial.println(F("FAN: LOW"));
66+
break;
67+
case 0b01:
68+
Serial.println(F("FAN: MEDIUM"));
69+
break;
70+
case 0b10:
71+
Serial.println(F("FAN: HIGH"));
72+
break;
73+
case 0b11:
74+
Serial.println(F("FAN: AUTO"));
75+
break;
76+
}
77+
78+
// Other flags
79+
Serial.print(F("FLAGS: "));
80+
if (bytes[1] & 0x04) Serial.print(F("FLAP SWING "));
81+
if (bytes[7] & 0x04) Serial.print(F("ECONO "));
82+
if (bytes[1] & 0x02) Serial.print(F("LOW NOISE "));
83+
Serial.println();
84+
85+
// Check if the checksum matches
86+
byte checksum = 0x00;
87+
88+
for (int x = 0; x < 10; x++) {
89+
checksum += bytes[x];
90+
}
91+
92+
if ( bytes[10] == checksum ) {
93+
Serial.println(F("Checksum matches"));
94+
} else {
95+
Serial.print(F("Checksum does not match.\nCalculated | Received\n "));
96+
Serial.printf(BYTETOBINARYPATTERN, BYTETOBINARY(checksum));
97+
Serial.print(F(" | "));
98+
Serial.printf(BYTETOBINARYPATTERN, BYTETOBINARY(bytes[10]));
99+
Serial.println();
100+
}
101+
102+
return true;
103+
}
104+
105+
return false;
106+
}

rawirdecode/rawirdecode.ino

+10-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define PANASONIC_CKP
1111
#define PANASONIC_CS
1212
#define HYUNDAI
13+
#define OLIMPIA // try model choice 3
1314
#define GREE
1415
#define GREE_YAC
1516
#define FUEGO
@@ -35,6 +36,7 @@
3536
//#define PANASONIC_CKP
3637
//#define PANASONIC_CS
3738
//#define HYUNDAI
39+
//#define OLIMPIA
3840
//#define GREE
3941
//#define GREE_YAC
4042
//#define FUEGO
@@ -82,6 +84,9 @@
8284
#if defined(HYUNDAI)
8385
bool decodeHyundai(byte *bytes, int pulseCount);
8486
#endif
87+
#if defined(OLIMPIA)
88+
bool decodeOlimpiaMaestro(byte *bytes, int pulseCount);
89+
#endif
8590
#if defined(GREE) or defined(GREE_YAC)
8691
bool decodeGree(byte *bytes, int pulseCount);
8792
bool decodeGree_YAC(byte *bytes, int pulseCount);
@@ -149,7 +154,7 @@
149154
#elif defined(ESP32)
150155
#define IRpin 25 // G25 on M5STACK ATOM LITE
151156
#elif defined(ESP8266)
152-
#define IRpin 5
157+
#define IRpin 2
153158
#else
154159
#define IRpin_PIN PIND
155160
#define IRpin 2
@@ -457,7 +462,7 @@ void printPulses(void) {
457462
// Print the decoded bytes
458463
Serial.println(F("Bytes:"));
459464

460-
// Decode the string of bits to a byte array
465+
// Decode the string of bits to a byte array from LSB first to MSB last for each byte
461466
for (uint16_t i = 0; i < currentpulse; i++) {
462467

463468
if (symbols[i] == '0' || symbols[i] == '1') {
@@ -569,6 +574,9 @@ void decodeProtocols()
569574
#if defined(HYUNDAI)
570575
knownProtocol = decodeHyundai(bytes, currentpulse);
571576
#endif
577+
#if defined(OLIMPIA)
578+
knownProtocol = decodeOlimpiaMaestro(bytes, byteCount);
579+
#endif
572580
#if defined(GREE) or defined(GREE_YAC)
573581
knownProtocol = decodeGree(bytes, currentpulse) || decodeGree_YAC(bytes, currentpulse);
574582
#endif

0 commit comments

Comments
 (0)