Skip to content

Commit

Permalink
DelonghiAc: Add detailed support.
Browse files Browse the repository at this point in the history
* Add power, mode, temp, temp unit, fan speed, turbo(boost) & sleep setting control.
* Implement mode/fan/temp restrictions.
* Add common A/C api support.
* Unit tests for the above.
* Enfore checksum matching in decoder.

Fixes #1096
  • Loading branch information
crankyoldgit committed May 2, 2020
1 parent 200ad4d commit 87c658b
Show file tree
Hide file tree
Showing 6 changed files with 605 additions and 10 deletions.
45 changes: 44 additions & 1 deletion src/IRac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ bool IRac::isProtocolSupported(const decode_type_t protocol) {
#if SEND_DAIKIN64
case decode_type_t::DAIKIN64:
#endif
#if SEND_DELONGHI_AC
case decode_type_t::DELONGHI_AC:
#endif
#if SEND_ELECTRA_AC
case decode_type_t::ELECTRA_AC:
#endif
Expand Down Expand Up @@ -488,6 +491,22 @@ void IRac::daikin64(IRDaikin64 *ac,
}
#endif // SEND_DAIKIN64

#if SEND_DELONGHI_AC
void IRac::delonghiac(IRDelonghiAc *ac,
const bool on, const stdAc::opmode_t mode, const bool celsius,
const float degrees, const stdAc::fanspeed_t fan,
const bool turbo, const int16_t sleep) {
ac->begin();
ac->setPower(on);
ac->setMode(ac->convertMode(mode));
ac->setTemp(degrees, !celsius);
ac->setFan(ac->convertFan(fan));
ac->setBoost(turbo);
ac->setSleep(sleep >= 0);
ac->send();
}
#endif // SEND_DELONGHI_AC

#if SEND_ELECTRA_AC
void IRac::electra(IRElectraAc *ac,
const bool on, const stdAc::opmode_t mode,
Expand Down Expand Up @@ -1459,6 +1478,15 @@ bool IRac::sendAc(const stdAc::state_t desired, const stdAc::state_t *prev) {
break;
}
#endif // SEND_DAIKIN64
#if SEND_DELONGHI_AC
case DELONGHI_AC:
{
IRDelonghiAc ac(_pin, _inverted, _modulation);
delonghiac(&ac, send.power, send.mode, send.celsius, degC, send.fanspeed,
send.turbo, send.sleep);
break;
}
#endif // SEND_DELONGHI_AC
#if SEND_ELECTRA_AC
case ELECTRA_AC:
{
Expand Down Expand Up @@ -2107,7 +2135,14 @@ namespace IRAcUtils {
ac.setRaw(result->value); // Daikin64 uses value instead of state.
return ac.toString();
}
#endif // DECODE_DAIKIN216
#endif // DECODE_DAIKIN64
#if DECODE_DELONGHI_AC
case decode_type_t::DELONGHI_AC: {
IRDelonghiAc ac(kGpioUnused);
ac.setRaw(result->value); // DelonghiAc uses value instead of state.
return ac.toString();
}
#endif // DECODE_DELONGHI_AC
#if DECODE_ELECTRA_AC
case decode_type_t::ELECTRA_AC: {
IRElectraAc ac(0);
Expand Down Expand Up @@ -2420,6 +2455,14 @@ namespace IRAcUtils {
break;
}
#endif // DECODE_DAIKIN64
#if DECODE_DELONGHI_AC
case decode_type_t::DELONGHI_AC: {
IRDelonghiAc ac(kGpioUnused);
ac.setRaw(decode->value); // Uses value instead of state.
*result = ac.toCommon();
break;
}
#endif // DECODE_DELONGHI_AC
#if DECODE_ELECTRA_AC
case decode_type_t::ELECTRA_AC: {
IRElectraAc ac(kGpioUnused);
Expand Down
6 changes: 6 additions & 0 deletions src/IRac.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ void daikin216(IRDaikin216 *ac,
const bool quiet, const bool turbo,
const int16_t sleep = -1, const int16_t clock = -1);
#endif // SEND_DAIKIN64
#if SEND_DELONGHI_AC
void delonghiac(IRDelonghiAc *ac,
const bool on, const stdAc::opmode_t mode, const bool celsius,
const float degrees, const stdAc::fanspeed_t fan,
const bool turbo, const int16_t sleep = -1);
#endif // SEND_DELONGHI_AC
#if SEND_ELECTRA_AC
void electra(IRElectraAc *ac,
const bool on, const stdAc::opmode_t mode,
Expand Down
Loading

0 comments on commit 87c658b

Please sign in to comment.