Skip to content

Commit fdf35b4

Browse files
Initial support for York AC protocol (#1889)
The protocol is known to almost every detail, checksum is calculated properly. Some basic tests have been added. Setting the sleep timer, scheduled power on, scheduled power off do not work since there are some flags within byte 12 which is not correctly populated ATM. Co-authored-by: David Conran <[email protected]>
1 parent e52495f commit fdf35b4

File tree

13 files changed

+649
-2
lines changed

13 files changed

+649
-2
lines changed

src/IRac.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,9 @@ bool IRac::isProtocolSupported(const decode_type_t protocol) {
362362
#endif
363363
#if SEND_VOLTAS
364364
case decode_type_t::VOLTAS:
365+
#endif
366+
#if SEND_YORK
367+
case decode_type_t::YORK:
365368
#endif
366369
case decode_type_t::WHIRLPOOL_AC:
367370
return true;
@@ -4493,6 +4496,13 @@ namespace IRAcUtils {
44934496
return ac.toString();
44944497
}
44954498
#endif // DECODE_WHIRLPOOL_AC
4499+
#if DECODE_YORK
4500+
case decode_type_t::YORK: {
4501+
IRYorkAc ac(kGpioUnused);
4502+
ac.setRaw(result->state);
4503+
return ac.toString();
4504+
}
4505+
#endif // DECODE_YORK
44964506
default:
44974507
return "";
44984508
}
@@ -5029,6 +5039,14 @@ namespace IRAcUtils {
50295039
break;
50305040
}
50315041
#endif // DECODE_WHIRLPOOL_AC
5042+
#if DECODE_YORK
5043+
case decode_type_t::YORK: {
5044+
IRYorkAc ac(kGpioUnused);
5045+
ac.setRaw(decode->state);
5046+
*result = ac.toCommon(prev);
5047+
break;
5048+
}
5049+
#endif // DECODE_YORK
50325050
default:
50335051
return false;
50345052
}

src/IRac.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include "ir_Vestel.h"
5050
#include "ir_Voltas.h"
5151
#include "ir_Whirlpool.h"
52+
#include "ir_York.h"
5253

5354
// Constants
5455
const int8_t kGpioUnused = -1; ///< A placeholder for not using an actual GPIO.

src/IRrecv.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,6 +1177,10 @@ bool IRrecv::decode(decode_results *results, irparams_t *save,
11771177
DPRINTLN("Attempting Carrier A/C 84-bit decode");
11781178
if (decodeCarrierAC84(results, offset)) return true;
11791179
#endif // DECODE_CARRIER_AC84
1180+
#if DECODE_YORK
1181+
DPRINTLN("Attempting York decode");
1182+
if (decodeYork(results, offset, kYorkBits)) return true;
1183+
#endif // DECODE_YORK
11801184
// Typically new protocols are added above this line.
11811185
}
11821186
#if DECODE_HASH

src/IRrecv.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,12 @@ class IRrecv {
877877
const uint16_t nbits = kWowweeBits,
878878
const bool strict = true);
879879
#endif // DECODE_WOWWEE
880+
#if DECODE_YORK
881+
bool decodeYork(decode_results *results,
882+
uint16_t kStartOffset,
883+
const uint16_t kYorkBits,
884+
const bool strict = true);
885+
#endif // DECODE_YORK
880886
};
881887

882888
#endif // IRRECV_H_

src/IRremoteESP8266.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,13 @@
945945
#define SEND_CARRIER_AC84 _IR_ENABLE_DEFAULT_
946946
#endif // SEND_CARRIER_AC84
947947

948+
#ifndef DECODE_YORK
949+
#define DECODE_YORK _IR_ENABLE_DEFAULT_
950+
#endif // DECODE_YORK
951+
#ifndef SEND_YORK
952+
#define SEND_YORK _IR_ENABLE_DEFAULT_
953+
#endif // SEND_YORK
954+
948955
#if (DECODE_ARGO || DECODE_DAIKIN || DECODE_FUJITSU_AC || DECODE_GREE || \
949956
DECODE_KELVINATOR || DECODE_MITSUBISHI_AC || DECODE_TOSHIBA_AC || \
950957
DECODE_TROTEC || DECODE_HAIER_AC || DECODE_HITACHI_AC || \
@@ -963,7 +970,7 @@
963970
DECODE_KELON168 || DECODE_HITACHI_AC296 || DECODE_CARRIER_AC128 || \
964971
DECODE_DAIKIN200 || DECODE_HAIER_AC160 || DECODE_TCL96AC || \
965972
DECODE_BOSCH144 || DECODE_SANYO_AC152 || DECODE_DAIKIN312 || \
966-
DECODE_CARRIER_AC84 || \
973+
DECODE_CARRIER_AC84 || DECODE_YORK || \
967974
false)
968975
// Add any DECODE to the above if it uses result->state (see kStateSizeMax)
969976
// you might also want to add the protocol to hasACState function
@@ -1129,8 +1136,9 @@ enum decode_type_t {
11291136
GORENJE,
11301137
WOWWEE,
11311138
CARRIER_AC84, // 125
1139+
YORK,
11321140
// Add new entries before this one, and update it to point to the last entry.
1133-
kLastDecodeType = CARRIER_AC84,
1141+
kLastDecodeType = YORK,
11341142
};
11351143

11361144
// Message lengths & required repeat values
@@ -1423,6 +1431,8 @@ const uint16_t kRhossStateLength = 12;
14231431
const uint16_t kRhossBits = kRhossStateLength * 8;
14241432
const uint16_t kRhossDefaultRepeat = 0;
14251433
const uint16_t kClimaButlerBits = 52;
1434+
const uint16_t kYorkBits = 136;
1435+
const uint16_t kYorkStateLength = 17;
14261436

14271437

14281438
// Legacy defines. (Deprecated)

src/IRsend.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,8 @@ uint16_t IRsend::defaultBits(const decode_type_t protocol) {
796796
return kWhirlpoolAcBits;
797797
case XMP:
798798
return kXmpBits;
799+
case YORK:
800+
return kYorkBits;
799801
// No default amount of bits.
800802
case FUJITSU_AC:
801803
case MWM:
@@ -1427,6 +1429,11 @@ bool IRsend::send(const decode_type_t type, const uint8_t *state,
14271429
sendWhirlpoolAC(state, nbytes);
14281430
break;
14291431
#endif // SEND_WHIRLPOOL_AC
1432+
#if SEND_YORK
1433+
case YORK:
1434+
sendYork(state, nbytes);
1435+
break;
1436+
#endif // SEND_YORK
14301437
default:
14311438
return false;
14321439
}

src/IRsend.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,11 @@ class IRsend {
879879
void sendWowwee(const uint64_t data, const uint16_t nbits = kWowweeBits,
880880
const uint16_t repeat = kWowweeDefaultRepeat);
881881
#endif // SEND_WOWWEE
882+
#if SEND_YORK
883+
void sendYork(const unsigned char data[],
884+
const uint16_t nbytes = kYorkStateLength,
885+
const uint16_t repeat = kNoRepeat);
886+
#endif // SEND_YORK
882887

883888
protected:
884889
#ifdef UNIT_TEST

src/IRtext.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,8 @@ IRTEXT_CONST_BLOB_DECL(kAllProtocolNamesStr) {
553553
D_STR_WOWWEE, D_STR_UNSUPPORTED) "\x0"
554554
COND(DECODE_CARRIER_AC84 || SEND_CARRIER_AC84,
555555
D_STR_CARRIER_AC84, D_STR_UNSUPPORTED) "\x0"
556+
COND(DECODE_YORK || SEND_YORK,
557+
D_STR_YORK, D_STR_UNSUPPORTED) "\x0"
556558
///< New protocol (macro) strings should be added just above this line.
557559
"\x0" ///< This string requires double null termination.
558560
};

src/IRutils.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ bool hasACState(const decode_type_t protocol) {
226226
case TROTEC_3550:
227227
case VOLTAS:
228228
case WHIRLPOOL_AC:
229+
case YORK:
229230
return true;
230231
default:
231232
return false;

0 commit comments

Comments
 (0)