Skip to content

Commit

Permalink
Mirage: Work in Progress Detailed support
Browse files Browse the repository at this point in the history
* Add detailed support for:
  - Temp
  - Fan speed
  - Turbo
  - Clock
  - Sleep
  - Light
  - Note: Missing POWER control.
* Unit test coverage for what we have so far.
* Update `IRac` class.

For #1573
  • Loading branch information
crankyoldgit committed Sep 24, 2021
1 parent 10706fc commit b9fa921
Show file tree
Hide file tree
Showing 6 changed files with 701 additions and 9 deletions.
68 changes: 67 additions & 1 deletion src/IRac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,10 @@ bool IRac::isProtocolSupported(const decode_type_t protocol) {
#endif
#if SEND_MIDEA
case decode_type_t::MIDEA:
#endif
#endif // SEND_MIDEA
#if SEND_MIRAGE
case decode_type_t::MIRAGE:
#endif // SEND_MIRAGE
#if SEND_MITSUBISHI_AC
case decode_type_t::MITSUBISHI_AC:
#endif
Expand Down Expand Up @@ -1453,6 +1456,44 @@ void IRac::midea(IRMideaAC *ac,
}
#endif // SEND_MIDEA

#if SEND_MIRAGE
/// Send a Mirage 120-bit A/C message with the supplied settings.
/// @param[in, out] ac A Ptr to an IRMitsubishiAC object to use.
/// @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] turbo Run the device in turbo mode.
/// @param[in] light Turn on the Light/Display.
/// @param[in] sleep The time in Nr. of mins to sleep for. < 0 is ignore.
/// @note Sleep is either on or off. The time is useless.
/// @param[in] clock The time in Nr. of mins since midnight. < 0 is ignore.
void IRac::mirage(IRMirageAc *ac,
// const bool on,
const stdAc::opmode_t mode,
const float degrees,
const stdAc::fanspeed_t fan,
const bool turbo, const bool light,
const int16_t sleep, const int16_t clock) {
ac->begin();

// ac->setPower(on);
ac->setMode(ac->convertMode(mode));
ac->setTemp(degrees);
ac->setFan(ac->convertFan(fan));
// No SwingV setting available
// No SwingH setting available
ac->setTurbo(turbo);
// No Quiet setting available.
ac->setLight(light);
// No Filter setting available.
// No Clean setting available.
// No Beep setting available.
ac->setSleep(sleep >= 0);
if (clock >= 0) ac->setClock(clock * 60); // Clock is in seconds.
ac->send();
}
#endif // SEND_MIRAGE

#if SEND_MITSUBISHI_AC
/// Send a Mitsubishi A/C message with the supplied settings.
/// @param[in, out] ac A Ptr to an IRMitsubishiAC object to use.
Expand Down Expand Up @@ -2799,6 +2840,16 @@ bool IRac::sendAc(const stdAc::state_t desired, const stdAc::state_t *prev) {
break;
}
#endif // SEND_MIDEA
#if SEND_MIRAGE
case MIRAGE:
{
IRMirageAc ac(_pin, _inverted, _modulation);
mirage(&ac, /* send.power, */ send.mode, degC,
send.fanspeed, send.turbo, send.light,
send.sleep, send.clock);
break;
}
#endif // SEND_MIRAGE
#if SEND_MITSUBISHI_AC
case MITSUBISHI_AC:
{
Expand Down Expand Up @@ -3797,6 +3848,13 @@ namespace IRAcUtils {
return ac.toString();
}
#endif // DECODE_TRANSCOLD
#if DECODE_MIRAGE
case decode_type_t::MIRAGE: {
IRMirageAc ac(kGpioUnused);
ac.setRaw(result->state);
return ac.toString();
}
#endif // DECODE_MIRAGE
default:
return "";
}
Expand Down Expand Up @@ -4072,6 +4130,14 @@ namespace IRAcUtils {
break;
}
#endif // DECODE_MIDEA
#if DECODE_MIRAGE
case decode_type_t::MIRAGE: {
IRMirageAc ac(kGpioUnused);
ac.setRaw(decode->state);
*result = ac.toCommon();
break;
}
#endif // DECODE_MIRAGE
#if DECODE_MITSUBISHI_AC
case decode_type_t::MITSUBISHI_AC: {
IRMitsubishiAC ac(kGpioUnused);
Expand Down
9 changes: 9 additions & 0 deletions src/IRac.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "ir_Kelvinator.h"
#include "ir_LG.h"
#include "ir_Midea.h"
#include "ir_Mirage.h"
#include "ir_Mitsubishi.h"
#include "ir_MitsubishiHeavy.h"
#include "ir_Neoclima.h"
Expand Down Expand Up @@ -326,6 +327,14 @@ void electra(IRElectraAc *ac,
const stdAc::swingv_t swingv, const bool turbo, const bool econo,
const bool light, const int16_t sleep = -1);
#endif // SEND_MIDEA
#if SEND_MIRAGE
void mirage(IRMirageAc *ac,
// const bool on,
const stdAc::opmode_t mode,
const float degrees, const stdAc::fanspeed_t fan,
const bool turbo, const bool light,
const int16_t sleep = -1, const int16_t clock = -1);
#endif // SEND_MIRAGE
#if SEND_MITSUBISHI_AC
void mitsubishi(IRMitsubishiAC *ac,
const bool on, const stdAc::opmode_t mode,
Expand Down
Loading

0 comments on commit b9fa921

Please sign in to comment.