Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HAIER_AC176: Add experimental detailed support #1571

Merged
merged 4 commits into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions src/IRac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ bool IRac::isProtocolSupported(const decode_type_t protocol) {
#if SEND_HAIER_AC
case decode_type_t::HAIER_AC:
#endif
#if SEND_HAIER_AC176
case decode_type_t::HAIER_AC176:
#endif // SEND_HAIER_AC176
#if SEND_HAIER_AC_YRW02
case decode_type_t::HAIER_AC_YRW02:
#endif
Expand Down Expand Up @@ -1083,6 +1086,40 @@ void IRac::haier(IRHaierAC *ac,
}
#endif // SEND_HAIER_AC

#if SEND_HAIER_AC176
/// Send a Haier 176 bit A/C message with the supplied settings.
/// @param[in, out] ac A Ptr to an IRHaierAC176 object to use.
/// @param[in] on The power setting.
/// @param[in] mode The operation mode setting.
/// @param[in] degrees The temperature setting in degrees.
/// @param[in] fan The speed setting for the fan.
/// @param[in] swingv The vertical swing setting.
/// @param[in] turbo Run the device in turbo/powerful mode.
/// @param[in] filter Turn on the (ion/pollen/etc) filter mode.
/// @param[in] sleep Nr. of minutes for sleep mode. -1 is Off, >= 0 is on.
void IRac::haier176(IRHaierAC176 *ac,
const bool on, const stdAc::opmode_t mode,
const float degrees, const stdAc::fanspeed_t fan,
const stdAc::swingv_t swingv, const bool turbo,
const bool filter, const int16_t sleep) {
ac->begin();
ac->setMode(ac->convertMode(mode));
ac->setTemp(degrees);
ac->setFan(ac->convertFan(fan));
ac->setSwing(ac->convertSwingV(swingv));
// No Horizontal Swing setting available.
// No Quiet setting available.
ac->setTurbo(turbo);
// No Light setting available.
ac->setHealth(filter);
// No Clean setting available.
// No Beep setting available.
ac->setSleep(sleep >= 0); // Sleep on this A/C is either on or off.
ac->setPower(on);
ac->send();
}
#endif // SEND_HAIER_AC176

#if SEND_HAIER_AC_YRW02
/// Send a Haier YRWO2 A/C message with the supplied settings.
/// @param[in, out] ac A Ptr to an IRHaierACYRW02 object to use.
Expand Down Expand Up @@ -2655,6 +2692,15 @@ bool IRac::sendAc(const stdAc::state_t desired, const stdAc::state_t *prev) {
break;
}
#endif // SEND_HAIER_AC
#if SEND_HAIER_AC176
case HAIER_AC176:
{
IRHaierAC176 ac(_pin, _inverted, _modulation);
haier176(&ac, send.power, send.mode, degC, send.fanspeed, send.swingv,
send.turbo, send.filter, send.sleep);
break;
}
#endif // SEND_HAIER_AC176
#if SEND_HAIER_AC_YRW02
case HAIER_AC_YRW02:
{
Expand Down Expand Up @@ -3558,6 +3604,13 @@ namespace IRAcUtils {
return ac.toString();
}
#endif // DECODE_HAIER_AC
#if DECODE_HAIER_AC176
case decode_type_t::HAIER_AC176: {
IRHaierAC176 ac(kGpioUnused);
ac.setRaw(result->state);
return ac.toString();
}
#endif // DECODE_HAIER_AC176
#if DECODE_HAIER_AC_YRW02
case decode_type_t::HAIER_AC_YRW02: {
IRHaierACYRW02 ac(kGpioUnused);
Expand Down Expand Up @@ -3907,6 +3960,14 @@ namespace IRAcUtils {
break;
}
#endif // DECODE_HAIER_AC
#if DECODE_HAIER_AC176
case decode_type_t::HAIER_AC176: {
IRHaierAC176 ac(kGpioUnused);
ac.setRaw(decode->state);
*result = ac.toCommon();
break;
}
#endif // DECODE_HAIER_AC176
#if DECODE_HAIER_AC_YRW02
case decode_type_t::HAIER_AC_YRW02: {
IRHaierACYRW02 ac(kGpioUnused);
Expand Down
8 changes: 8 additions & 0 deletions src/IRac.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,14 @@ void electra(IRElectraAc *ac,
const bool filter, const int16_t sleep = -1,
const int16_t clock = -1);
#endif // SEND_HAIER_AC
#if SEND_HAIER_AC176
void haier176(IRHaierAC176 *ac,
const bool on, const stdAc::opmode_t mode,
const float degrees, const stdAc::fanspeed_t fan,
const stdAc::swingv_t swingv,
const bool turbo, const bool filter,
const int16_t sleep = -1);
#endif // SEND_HAIER_AC176
#if SEND_HAIER_AC_YRW02
void haierYrwo2(IRHaierACYRW02 *ac,
const bool on, const stdAc::opmode_t mode,
Expand Down
5 changes: 3 additions & 2 deletions src/IRtext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ const PROGMEM char* kMouldStr = D_STR_MOULD; ///< "Mould"
const PROGMEM char* kCleanStr = D_STR_CLEAN; ///< "Clean"
const PROGMEM char* kPurifyStr = D_STR_PURIFY; ///< "Purify"
const PROGMEM char* kTimerStr = D_STR_TIMER; ///< "Timer"
const PROGMEM char* kOnTimerStr = D_STR_ONTIMER; ///< "OnTimer"
const PROGMEM char* kOffTimerStr = D_STR_OFFTIMER; ///< "OffTimer"
const PROGMEM char* kOnTimerStr = D_STR_ONTIMER; ///< "On Timer"
const PROGMEM char* kOffTimerStr = D_STR_OFFTIMER; ///< "Off Timer"
const PROGMEM char* kTimerModeStr = D_STR_TIMERMODE; ///< "Timer Mode"
const PROGMEM char* kClockStr = D_STR_CLOCK; ///< "Clock"
const PROGMEM char* kCommandStr = D_STR_COMMAND; ///< "Command"
const PROGMEM char* kXFanStr = D_STR_XFAN; ///< "XFan"
Expand Down
1 change: 1 addition & 0 deletions src/IRtext.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ extern const char* kTempDownStr;
extern const char* kTempStr;
extern const char* kTempUpStr;
extern const char* kThreeLetterDayOfWeekStr;
extern const char* kTimerModeStr;
extern const char* kTimerStr;
extern const char* kToggleStr;
extern const char* kTopStr;
Expand Down
Loading