|
16 | 16 | #include "IRremoteESP8266.h" |
17 | 17 | #include "IRtext.h" |
18 | 18 | #include "IRutils.h" |
| 19 | +#include "ir_Airton.h" |
19 | 20 | #include "ir_Airwell.h" |
20 | 21 | #include "ir_Amcor.h" |
21 | 22 | #include "ir_Argo.h" |
@@ -152,9 +153,12 @@ stdAc::state_t IRac::getStatePrev(void) { return _prev; } |
152 | 153 | /// @return true if the protocol is supported by this class, otherwise false. |
153 | 154 | bool IRac::isProtocolSupported(const decode_type_t protocol) { |
154 | 155 | switch (protocol) { |
| 156 | +#if SEND_AIRTON |
| 157 | + case decode_type_t::AIRTON: |
| 158 | +#endif // SEND_AIRTON |
155 | 159 | #if SEND_AIRWELL |
156 | 160 | case decode_type_t::AIRWELL: |
157 | | -#endif |
| 161 | +#endif // SEND_AIRWELL |
158 | 162 | #if SEND_AMCOR |
159 | 163 | case decode_type_t::AMCOR: |
160 | 164 | #endif |
@@ -326,6 +330,44 @@ bool IRac::isProtocolSupported(const decode_type_t protocol) { |
326 | 330 | } |
327 | 331 | } |
328 | 332 |
|
| 333 | +#if SEND_AIRTON |
| 334 | +/// Send an Airton 56-bit A/C message with the supplied settings. |
| 335 | +/// @param[in, out] ac A Ptr to an IRAirtonAc object to use. |
| 336 | +/// @param[in] on The power setting. |
| 337 | +/// @param[in] mode The operation mode setting. |
| 338 | +/// @param[in] degrees The temperature setting in degrees. |
| 339 | +/// @param[in] fan The speed setting for the fan. |
| 340 | +/// @param[in] swingv The vertical swing setting. |
| 341 | +/// @param[in] turbo Run the device in turbo/powerful mode. |
| 342 | +/// @param[in] light Turn on the LED/Display mode. |
| 343 | +/// @param[in] econo Run the device in economical mode. |
| 344 | +/// @param[in] filter Turn on the (ion/pollen/health/etc) filter mode. |
| 345 | +/// @param[in] sleep Nr. of minutes for sleep mode. |
| 346 | +/// @note -1 is Off, >= 0 is on. |
| 347 | +void IRac::airton(IRAirtonAc *ac, |
| 348 | + const bool on, const stdAc::opmode_t mode, |
| 349 | + const float degrees, const stdAc::fanspeed_t fan, |
| 350 | + const stdAc::swingv_t swingv, const bool turbo, |
| 351 | + const bool light, const bool econo, const bool filter, |
| 352 | + const int16_t sleep) { |
| 353 | + ac->begin(); |
| 354 | + ac->setPower(on); |
| 355 | + ac->setMode(ac->convertMode(mode)); |
| 356 | + ac->setTemp(degrees); |
| 357 | + ac->setFan(ac->convertFan(fan)); |
| 358 | + ac->setSwingV(swingv != stdAc::swingv_t::kOff); |
| 359 | + // No Quiet setting available. |
| 360 | + ac->setLight(light); |
| 361 | + ac->setHealth(filter); |
| 362 | + ac->setTurbo(turbo); |
| 363 | + ac->setEcono(econo); |
| 364 | + // No Clean setting available. |
| 365 | + // No Beep setting available. |
| 366 | + ac->setSleep(sleep >= 0); // Convert to a boolean. |
| 367 | + ac->send(); |
| 368 | +} |
| 369 | +#endif // SEND_AIRTON |
| 370 | + |
329 | 371 | #if SEND_AIRWELL |
330 | 372 | /// Send an Airwell A/C message with the supplied settings. |
331 | 373 | /// @param[in, out] ac A Ptr to an IRAirwellAc object to use. |
@@ -2603,6 +2645,16 @@ bool IRac::sendAc(const stdAc::state_t desired, const stdAc::state_t *prev) { |
2603 | 2645 | #endif // (SEND_LG || SEND_SHARP_AC) |
2604 | 2646 | // Per vendor settings & setup. |
2605 | 2647 | switch (send.protocol) { |
| 2648 | +#if SEND_AIRTON |
| 2649 | + case AIRTON: |
| 2650 | + { |
| 2651 | + IRAirtonAc ac(_pin, _inverted, _modulation); |
| 2652 | + airton(&ac, send.power, send.mode, degC, send.fanspeed, |
| 2653 | + send.swingv, send.turbo, send.light, send.econo, send.filter, |
| 2654 | + send.sleep); |
| 2655 | + break; |
| 2656 | + } |
| 2657 | +#endif // SEND_AIRTON |
2606 | 2658 | #if SEND_AIRWELL |
2607 | 2659 | case AIRWELL: |
2608 | 2660 | { |
@@ -3507,6 +3559,13 @@ namespace IRAcUtils { |
3507 | 3559 | /// An empty string if we can't. |
3508 | 3560 | String resultAcToString(const decode_results * const result) { |
3509 | 3561 | switch (result->decode_type) { |
| 3562 | +#if DECODE_AIRTON |
| 3563 | + case decode_type_t::AIRTON: { |
| 3564 | + IRAirtonAc ac(kGpioUnused); |
| 3565 | + ac.setRaw(result->value); // AIRTON uses value instead of state. |
| 3566 | + return ac.toString(); |
| 3567 | + } |
| 3568 | +#endif // DECODE_AIRTON |
3510 | 3569 | #if DECODE_AIRWELL |
3511 | 3570 | case decode_type_t::AIRWELL: { |
3512 | 3571 | IRAirwellAc ac(kGpioUnused); |
@@ -3931,6 +3990,14 @@ namespace IRAcUtils { |
3931 | 3990 | ) { |
3932 | 3991 | if (decode == NULL || result == NULL) return false; // Safety check. |
3933 | 3992 | switch (decode->decode_type) { |
| 3993 | +#if DECODE_AIRTON |
| 3994 | + case decode_type_t::AIRTON: { |
| 3995 | + IRAirtonAc ac(kGpioUnused); |
| 3996 | + ac.setRaw(decode->value); // Uses value instead of state. |
| 3997 | + *result = ac.toCommon(); |
| 3998 | + break; |
| 3999 | + } |
| 4000 | +#endif // DECODE_AIRTON |
3934 | 4001 | #if DECODE_AIRWELL |
3935 | 4002 | case decode_type_t::AIRWELL: { |
3936 | 4003 | IRAirwellAc ac(kGpioUnused); |
|
0 commit comments