Skip to content

Commit 630ce00

Browse files
authored
Added Daikin 312 protocol support (#2246)
Created a PR for the work done by @AntonWert to support the Daikin 312 protocol in the issue #1829 Tested on ARC466A58 * added DAIKIN312 support * added remote model ARC466A58 and issue ref
1 parent e6e1940 commit 630ce00

File tree

5 files changed

+1314
-7
lines changed

5 files changed

+1314
-7
lines changed

src/IRac.cpp

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@ bool IRac::isProtocolSupported(const decode_type_t protocol) {
233233
#if SEND_DAIKIN216
234234
case decode_type_t::DAIKIN216:
235235
#endif
236+
#if SEND_DAIKIN312
237+
case decode_type_t::DAIKIN312:
238+
#endif
236239
#if SEND_DAIKIN64
237240
case decode_type_t::DAIKIN64:
238241
#endif
@@ -1065,6 +1068,54 @@ void IRac::daikin216(IRDaikin216 *ac,
10651068
}
10661069
#endif // SEND_DAIKIN216
10671070

1071+
#if SEND_DAIKIN312
1072+
/// Send a Daikin 312-bit A/C message with the supplied settings.
1073+
/// @param[in, out] ac A Ptr to an IRDaikin312 object to use.
1074+
/// @param[in] on The power setting.
1075+
/// @param[in] mode The operation mode setting.
1076+
/// @param[in] degrees The temperature setting in degrees.
1077+
/// @param[in] fan The speed setting for the fan.
1078+
/// @param[in] swingv The vertical swing setting.
1079+
/// @param[in] swingh The horizontal swing setting.
1080+
/// @param[in] quiet Run the device in quiet/silent mode.
1081+
/// @param[in] turbo Run the device in turbo/powerful mode.
1082+
/// @param[in] light Turn on the LED/Display mode.
1083+
/// @param[in] econo Run the device in economical mode.
1084+
/// @param[in] filter Turn on the (ion/pollen/etc) filter mode.
1085+
/// @param[in] clean Turn on the self-cleaning mode. e.g. Mould, dry filters etc
1086+
/// @param[in] beep Enable/Disable beeps when receiving IR messages.
1087+
/// @param[in] sleep Nr. of minutes for sleep mode. -1 is Off, >= 0 is on.
1088+
/// @param[in] clock The time in Nr. of mins since midnight. < 0 is ignore.
1089+
void IRac::daikin312(IRDaikin312 *ac,
1090+
const bool on, const stdAc::opmode_t mode,
1091+
const float degrees, const stdAc::fanspeed_t fan,
1092+
const stdAc::swingv_t swingv,
1093+
const stdAc::swingh_t swingh,
1094+
const bool quiet, const bool turbo, const bool light,
1095+
const bool econo, const bool filter, const bool clean,
1096+
const bool beep, const int16_t sleep,
1097+
const int16_t clock) {
1098+
ac->begin();
1099+
ac->setPower(on);
1100+
ac->setMode(ac->convertMode(mode));
1101+
ac->setTemp(degrees);
1102+
ac->setFan(ac->convertFan(fan));
1103+
ac->setSwingVertical(ac->convertSwingV(swingv));
1104+
ac->setSwingHorizontal(ac->convertSwingH(swingh));
1105+
ac->setQuiet(quiet);
1106+
ac->setLight(light ? 1 : 3); // On/High is 1, Off is 3.
1107+
ac->setPowerful(turbo);
1108+
ac->setEcono(econo);
1109+
ac->setPurify(filter);
1110+
ac->setMold(clean);
1111+
ac->setClean(true); // Hardwire auto clean to be on per request (@sheppy99)
1112+
ac->setBeep(beep ? 2 : 3); // On/Loud is 2, Off is 3.
1113+
if (sleep > 0) ac->enableSleepTimer(sleep);
1114+
if (clock >= 0) ac->setCurrentTime(clock);
1115+
ac->send();
1116+
}
1117+
#endif // SEND_DAIKIN312
1118+
10681119
#if SEND_DAIKIN64
10691120
/// Send a Daikin 64-bit A/C message with the supplied settings.
10701121
/// @param[in, out] ac A Ptr to an IRDaikin64 object to use.
@@ -3233,6 +3284,16 @@ bool IRac::sendAc(const stdAc::state_t desired, const stdAc::state_t *prev) {
32333284
break;
32343285
}
32353286
#endif // SEND_DAIKIN216
3287+
#if SEND_DAIKIN312
3288+
case DAIKIN312:
3289+
{
3290+
IRDaikin312 ac(_pin, _inverted, _modulation);
3291+
daikin312(&ac, send.power, send.mode, degC, send.fanspeed, send.swingv,
3292+
send.swingh, send.quiet, send.turbo, send.light, send.econo,
3293+
send.filter, send.clean, send.beep, send.sleep, send.clock);
3294+
break;
3295+
}
3296+
#endif // SEND_DAIKIN312
32363297
#if SEND_DAIKIN64
32373298
case DAIKIN64:
32383299
{
@@ -4233,6 +4294,13 @@ String resultAcToString(const decode_results * const result) {
42334294
return ac.toString();
42344295
}
42354296
#endif // DECODE_DAIKIN216
4297+
#if DECODE_DAIKIN312
4298+
case decode_type_t::DAIKIN312: {
4299+
IRDaikin312 ac(kGpioUnused);
4300+
ac.setRaw(result->state);
4301+
return ac.toString();
4302+
}
4303+
#endif // DECODE_DAIKIN312
42364304
#if DECODE_DAIKIN64
42374305
case decode_type_t::DAIKIN64: {
42384306
IRDaikin64 ac(kGpioUnused);
@@ -4735,6 +4803,14 @@ bool decodeToState(const decode_results *decode, stdAc::state_t *result,
47354803
break;
47364804
}
47374805
#endif // DECODE_DAIKIN216
4806+
#if DECODE_DAIKIN312
4807+
case decode_type_t::DAIKIN312: {
4808+
IRDaikin312 ac(kGpioUnused);
4809+
ac.setRaw(decode->state);
4810+
*result = ac.toCommon();
4811+
break;
4812+
}
4813+
#endif // DECODE_DAIKIN312
47384814
#if DECODE_DAIKIN64
47394815
case decode_type_t::DAIKIN64: {
47404816
IRDaikin64 ac(kGpioUnused);

src/IRac.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,16 @@ void daikin216(IRDaikin216 *ac,
239239
const stdAc::swingv_t swingv, const stdAc::swingh_t swingh,
240240
const bool quiet, const bool turbo);
241241
#endif // SEND_DAIKIN216
242+
#if SEND_DAIKIN312
243+
void daikin312(IRDaikin312 *ac,
244+
const bool on, const stdAc::opmode_t mode,
245+
const float degrees, const stdAc::fanspeed_t fan,
246+
const stdAc::swingv_t swingv, const stdAc::swingh_t swingh,
247+
const bool quiet, const bool turbo, const bool light,
248+
const bool econo, const bool filter, const bool clean,
249+
const bool beep, const int16_t sleep = -1,
250+
const int16_t clock = -1);
251+
#endif // SEND_DAIKIN312
242252
#if SEND_DAIKIN64
243253
void daikin64(IRDaikin64 *ac,
244254
const bool on, const stdAc::opmode_t mode,

0 commit comments

Comments
 (0)