|
64 | 64 | #endif // ESP8266 |
65 | 65 | #endif // STRCASECMP |
66 | 66 |
|
| 67 | +#ifndef UNIT_TEST |
| 68 | +#define OUTPUT_DECODE_RESULTS_FOR_UT(ac) |
| 69 | +#else |
| 70 | +/* NOTE: THIS IS NOT A DOXYGEN COMMENT (would require ENABLE_PREPROCESSING-YES) |
| 71 | +/// If compiling for UT *and* a test receiver @c IRrecv is provided via the |
| 72 | +/// @c _utReceived param, this injects an "output" gadget @c _lastDecodeResults |
| 73 | +/// into the @c IRAc::sendAc method, so that the UT code may parse the "sent" |
| 74 | +/// value and drive further assertions |
| 75 | +/// |
| 76 | +/// @note The @c decode_results "returned" is a shallow copy (empty rawbuf), |
| 77 | +/// mostly b/c the class does not have a custom/deep copy c-tor |
| 78 | +/// and defining it would be an overkill for this purpose |
| 79 | +/// @note For future maintainers: If @c IRAc class is ever refactored to use |
| 80 | +/// polymorphism (static or dynamic)... this macro should be removed |
| 81 | +/// and replaced with proper GMock injection. |
| 82 | +*/ |
| 83 | +#define OUTPUT_DECODE_RESULTS_FOR_UT(ac) \ |
| 84 | + { \ |
| 85 | + if (_utReceiver) { \ |
| 86 | + _lastDecodeResults = nullptr; \ |
| 87 | + (ac)._irsend.makeDecodeResult(); \ |
| 88 | + if (_utReceiver->decode(&(ac)._irsend.capture)) { \ |
| 89 | + _lastDecodeResults = std::unique_ptr<decode_results>( \ |
| 90 | + new decode_results((ac)._irsend.capture)); \ |
| 91 | + _lastDecodeResults->rawbuf = nullptr; \ |
| 92 | + } \ |
| 93 | + } \ |
| 94 | + } |
| 95 | +#endif // UNIT_TEST |
| 96 | + |
67 | 97 | /// Class constructor |
68 | 98 | /// @param[in] pin Gpio pin to use when transmitting IR messages. |
69 | 99 | /// @param[in] inverted true, gpio output defaults to high. false, to low. |
@@ -464,6 +494,41 @@ void IRac::argo(IRArgoAC *ac, |
464 | 494 | ac->setNight(sleep >= 0); // Convert to a boolean. |
465 | 495 | ac->send(); |
466 | 496 | } |
| 497 | + |
| 498 | +/// Send an Argo A/C WREM-3 AC **control** message with the supplied settings. |
| 499 | +/// @param[in, out] ac A Ptr to an IRArgoAC_WREM3 object to use. |
| 500 | +/// @param[in] on The power setting. |
| 501 | +/// @param[in] mode The operation mode setting. |
| 502 | +/// @param[in] degrees The set temperature setting in degrees Celsius. |
| 503 | +/// @param[in] fan The speed setting for the fan. |
| 504 | +/// @param[in] swingv The vertical swing setting. |
| 505 | +/// @param[in] night Enable night mode (raises temp by +1*C after 1h). |
| 506 | +/// @param[in] econo Enable eco mode (limits power consumed). |
| 507 | +/// @param[in] turbo Run the device in turbo/powerful mode. |
| 508 | +/// @param[in] filter Enable filter mode |
| 509 | +/// @param[in] light Enable device display/LEDs |
| 510 | +void IRac::argoWrem3_ACCommand(IRArgoAC_WREM3 *ac, const bool on, |
| 511 | + const stdAc::opmode_t mode, const float degrees, |
| 512 | + const stdAc::fanspeed_t fan, const stdAc::swingv_t swingv, |
| 513 | + const bool night, const bool econo, const bool turbo, const bool filter, |
| 514 | + const bool light) { |
| 515 | + ac->begin(); |
| 516 | + ac->setMessageType(argoIrMessageType_t::AC_CONTROL); |
| 517 | + ac->setPower(on); |
| 518 | + ac->setMode(ac->convertMode(mode)); |
| 519 | + ac->setTemp(degrees); |
| 520 | + ac->setFan(ac->convertFan(fan)); |
| 521 | + ac->setFlap(ac->convertSwingV(swingv)); |
| 522 | + ac->setNight(night); |
| 523 | + ac->setEco(econo); |
| 524 | + ac->setMax(turbo); |
| 525 | + ac->setFilter(filter); |
| 526 | + ac->setLight(light); |
| 527 | + // No "sensorTemp" mode/value support in common (yet) |
| 528 | + // No Clean setting available. |
| 529 | + // No Beep setting available - always beeps in this mode :) |
| 530 | + ac->send(); |
| 531 | +} |
467 | 532 | #endif // SEND_ARGO |
468 | 533 |
|
469 | 534 | #if SEND_BOSCH144 |
@@ -2850,9 +2915,18 @@ bool IRac::sendAc(const stdAc::state_t desired, const stdAc::state_t *prev) { |
2850 | 2915 | #if SEND_ARGO |
2851 | 2916 | case ARGO: |
2852 | 2917 | { |
2853 | | - IRArgoAC ac(_pin, _inverted, _modulation); |
2854 | | - argo(&ac, send.power, send.mode, degC, send.fanspeed, send.swingv, |
2855 | | - send.turbo, send.sleep); |
| 2918 | + if (send.model == argo_ac_remote_model_t::SAC_WREM3) { |
| 2919 | + IRArgoAC_WREM3 ac(_pin, _inverted, _modulation); |
| 2920 | + argoWrem3_ACCommand(&ac, send.power, send.mode, send.degrees, |
| 2921 | + send.fanspeed, send.swingv, send.quiet, send.econo, send.turbo, |
| 2922 | + send.filter, send.light); |
| 2923 | + OUTPUT_DECODE_RESULTS_FOR_UT(ac); |
| 2924 | + } else { |
| 2925 | + IRArgoAC ac(_pin, _inverted, _modulation); |
| 2926 | + argo(&ac, send.power, send.mode, degC, send.fanspeed, send.swingv, |
| 2927 | + send.turbo, send.sleep); |
| 2928 | + OUTPUT_DECODE_RESULTS_FOR_UT(ac); |
| 2929 | + } |
2856 | 2930 | break; |
2857 | 2931 | } |
2858 | 2932 | #endif // SEND_ARGO |
@@ -3666,6 +3740,11 @@ int16_t IRac::strToModel(const char *str, const int16_t def) { |
3666 | 3740 | return whirlpool_ac_remote_model_t::DG11J13A; |
3667 | 3741 | } else if (!STRCASECMP(str, kDg11j191Str)) { |
3668 | 3742 | return whirlpool_ac_remote_model_t::DG11J191; |
| 3743 | + // Argo A/C models |
| 3744 | + } else if (!STRCASECMP(str, kArgoWrem2Str)) { |
| 3745 | + return argo_ac_remote_model_t::SAC_WREM2; |
| 3746 | + } else if (!STRCASECMP(str, kArgoWrem3Str)) { |
| 3747 | + return argo_ac_remote_model_t::SAC_WREM3; |
3669 | 3748 | } else { |
3670 | 3749 | int16_t number = atoi(str); |
3671 | 3750 | if (number > 0) |
@@ -3796,6 +3875,12 @@ namespace IRAcUtils { |
3796 | 3875 | #endif // DECODE_AMCOR |
3797 | 3876 | #if DECODE_ARGO |
3798 | 3877 | case decode_type_t::ARGO: { |
| 3878 | + if (IRArgoAC_WREM3::isValidWrem3Message(result->state, result->bits, |
| 3879 | + true)) { |
| 3880 | + IRArgoAC_WREM3 ac(kGpioUnused); |
| 3881 | + ac.setRaw(result->state, result->bits / 8); |
| 3882 | + return ac.toString(); |
| 3883 | + } |
3799 | 3884 | IRArgoAC ac(kGpioUnused); |
3800 | 3885 | ac.setRaw(result->state, result->bits / 8); |
3801 | 3886 | return ac.toString(); |
@@ -4258,15 +4343,23 @@ namespace IRAcUtils { |
4258 | 4343 | #endif // DECODE_AMCOR |
4259 | 4344 | #if DECODE_ARGO |
4260 | 4345 | case decode_type_t::ARGO: { |
4261 | | - IRArgoAC ac(kGpioUnused); |
4262 | 4346 | const uint16_t length = decode->bits / 8; |
4263 | | - switch (length) { |
4264 | | - case kArgoStateLength: |
4265 | | - ac.setRaw(decode->state, length); |
4266 | | - *result = ac.toCommon(); |
4267 | | - break; |
4268 | | - default: |
4269 | | - return false; |
| 4347 | + if (IRArgoAC_WREM3::isValidWrem3Message(decode->state, |
| 4348 | + decode->bits, true)) { |
| 4349 | + IRArgoAC_WREM3 ac(kGpioUnused); |
| 4350 | + ac.setRaw(decode->state, length); |
| 4351 | + *result = ac.toCommon(); |
| 4352 | + } else { |
| 4353 | + IRArgoAC ac(kGpioUnused); |
| 4354 | + switch (length) { |
| 4355 | + case kArgoStateLength: |
| 4356 | + case kArgoShortStateLength: |
| 4357 | + ac.setRaw(decode->state, length); |
| 4358 | + *result = ac.toCommon(); |
| 4359 | + break; |
| 4360 | + default: |
| 4361 | + return false; |
| 4362 | + } |
4270 | 4363 | } |
4271 | 4364 | break; |
4272 | 4365 | } |
|
0 commit comments