|
3 | 3 | // Samsung with remote ARH-465 or remote ARH-1362
|
4 | 4 |
|
5 | 5 | bool decodeSamsung(byte *bytes, int byteCount)
|
6 |
| -{ |
| 6 | +{ |
7 | 7 | // If this looks like a Samsung code...
|
8 | 8 | if (bytes[0] == 0x02
|
9 |
| - && ((byteCount == 21 && bytes[1] == 0xB2) || (byteCount == 14 && bytes[1] == 0x92)) |
| 9 | + && (byteCount == 14 && bytes[1] == 0x92) |
10 | 10 | && bytes[2] == 0x0F)
|
11 | 11 | {
|
12 | 12 | Serial.println(F("Looks like a short 14 bytes Samsung protocol"));
|
13 |
| - |
14 |
| - // Power mode |
15 |
| - if (byteCount == 21) |
16 |
| - { |
17 |
| - Serial.println(F("POWER OFF")); |
18 |
| - return true; |
19 |
| - } |
| 13 | + |
20 | 14 | Serial.println(F("POWER ON"));
|
21 | 15 |
|
22 | 16 | // Operating mode
|
@@ -121,15 +115,15 @@ bool decodeSamsung(byte *bytes, int byteCount)
|
121 | 115 | && ((byteCount == 21 && bytes[1] == 0xB2) || (byteCount == 21 && bytes[1] == 0x92))
|
122 | 116 | && bytes[2] == 0x0F)
|
123 | 117 | {
|
124 |
| - Serial.println(F("Looks like a 21 bytes long Samsung protocol specific ARH-1362 remote")); |
| 118 | + Serial.println(F("Looks like a 21 bytes long Samsung protocol")); |
125 | 119 |
|
126 | 120 | // Power mode
|
127 | 121 | if (byteCount == 21 && bytes[1] == 0xB2)
|
128 | 122 | {
|
129 | 123 | Serial.println(F("POWER OFF"));
|
130 |
| - return true; |
131 | 124 | }
|
132 |
| - Serial.println(F("POWER ON")); |
| 125 | + else |
| 126 | + Serial.println(F("POWER ON")); |
133 | 127 |
|
134 | 128 | // Operating mode | fan speed auto
|
135 | 129 | switch (bytes[19] & 0xF0) {
|
@@ -187,7 +181,7 @@ bool decodeSamsung(byte *bytes, int byteCount)
|
187 | 181 | // Transform the number of ONE bits to the actual checksum
|
188 | 182 | checksum = 28 - checksum;
|
189 | 183 | checksum <<= 4;
|
190 |
| - checksum += 0x02; |
| 184 | + checksum |= (byteCount == 21 && bytes[1] == 0xB2) ? 0x22 : 0x02; |
191 | 185 |
|
192 | 186 | Serial.print(F("Checksum '0x"));
|
193 | 187 | Serial.print(checksum, HEX);
|
|
0 commit comments