# IRremoteESP8266: src/ir_Airwell.h Source File

ir_Airwell.h
Go to the documentation of this file.
// Copyright 2020 David Conran
// Supports:
// Brand: Airwell, Model: RC08W remote
// Brand: Airwell, Model: RC04 remote
// Brand: Airwell, Model: DLS 21 DCI R410 AW A/C
#ifndef IR_AIRWELL_H_
#define IR_AIRWELL_H_
#define __STDC_LIMIT_MACROS
#include <stdint.h>
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include "IRremoteESP8266.h"
#include "IRsend.h"
#ifdef UNIT_TEST
#include "IRsend_test.h"
#endif
union AirwellProtocol{
uint64_t raw; // The state of the IR remote in native IR code form.
struct {
uint64_t :19;
uint64_t Temp :4;
uint64_t :5;
uint64_t Fan :2;
uint64_t Mode :3;
uint64_t PowerToggle:1;
uint64_t :0;
};
};
// Constants
const uint64_t kAirwellKnownGoodState = 0x140500002; // Mode Fan, Speed 1, 25C
// Temperature
const uint8_t kAirwellMinTemp = 16; // Celsius
const uint8_t kAirwellMaxTemp = 30; // Celsius
// Fan
const uint8_t kAirwellFanLow = 0; // 0b00
const uint8_t kAirwellFanMedium = 1; // 0b01
const uint8_t kAirwellFanHigh = 2; // 0b10
const uint8_t kAirwellFanAuto = 3; // 0b11
// Modes
const uint8_t kAirwellCool = 1; // 0b001
const uint8_t kAirwellHeat = 2; // 0b010
const uint8_t kAirwellAuto = 3; // 0b011
const uint8_t kAirwellDry = 4; // 0b100
const uint8_t kAirwellFan = 5; // 0b101
// Classes
class IRAirwellAc {
public:
explicit IRAirwellAc(const uint16_t pin, const bool inverted = false,
const bool use_modulation = true);
void stateReset();
#if SEND_AIRWELL
void send(const uint16_t repeat = kAirwellMinRepeats);
int8_t calibrate(void) { return _irsend.calibrate(); }
#endif // SEND_AIRWELL
void begin();
void setPowerToggle(const bool on);
bool getPowerToggle() const;
void setTemp(const uint8_t temp);
uint8_t getTemp() const;
void setFan(const uint8_t speed);
uint8_t getFan() const;
void setMode(const uint8_t mode);
uint8_t getMode() const;
uint64_t getRaw() const;
void setRaw(const uint64_t state);
static uint8_t convertMode(const stdAc::opmode_t mode);
static uint8_t convertFan(const stdAc::fanspeed_t speed);
static stdAc::opmode_t toCommonMode(const uint8_t mode);
static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed);
stdAc::state_t toCommon(const stdAc::state_t *prev = NULL) const;
String toString() const;
#ifndef UNIT_TEST
private:
IRsend _irsend;
#else
IRsendTest _irsend;
#endif
AirwellProtocol _;
};
#endif // IR_AIRWELL_H_
kAirwellMinRepeats
const uint16_t kAirwellMinRepeats
Definition: IRremoteESP8266.h:879
kAirwellFanHigh
const uint8_t kAirwellFanHigh
Definition: ir_Airwell.h:48
AirwellProtocol::Temp
uint64_t Temp
Definition: ir_Airwell.h:31
IRAirwellAc::send
void send(const uint16_t repeat=kAirwellMinRepeats)
Send the current internal state as an IR message.
Definition: ir_Airwell.cpp:108
AirwellProtocol::PowerToggle
uint64_t PowerToggle
Definition: ir_Airwell.h:35
IRAirwellAc::setTemp
void setTemp(const uint8_t temp)
Set the temperature.
Definition: ir_Airwell.cpp:225
IRAirwellAc::_irsend
IRsend _irsend
Instance of the IR send class.
Definition: ir_Airwell.h:93
AirwellProtocol
Native representation of a Airwell A/C message.
Definition: ir_Airwell.h:27
stdAc::fanspeed_t
fanspeed_t
Common A/C settings for Fan Speeds.
Definition: IRsend.h:58
kAirwellCool
const uint8_t kAirwellCool
Definition: ir_Airwell.h:51
IRAirwellAc::IRAirwellAc
IRAirwellAc(const uint16_t pin, const bool inverted=false, const bool use_modulation=true)
Class constructor.
Definition: ir_Airwell.cpp:85
IRAirwellAc::toCommon
stdAc::state_t toCommon(const stdAc::state_t *prev=NULL) const
Convert the current internal state into its stdAc::state_t equivalent.
Definition: ir_Airwell.cpp:240
kAirwellHeat
const uint8_t kAirwellHeat
Definition: ir_Airwell.h:52
IRAirwellAc::setMode
void setMode(const uint8_t mode)
Set the desired operation mode.
Definition: ir_Airwell.cpp:138
IRsend.h
kAirwellMinTemp
const uint8_t kAirwellMinTemp
Definition: ir_Airwell.h:43
IRsend
Class for sending all basic IR protocols.
Definition: IRsend.h:182
kAirwellFanAuto
const uint8_t kAirwellFanAuto
Definition: ir_Airwell.h:49
IRsend::calibrate
int8_t calibrate(uint16_t hz=38000U)
Calculate & set any offsets to account for execution times during sending.
Definition: IRsend.cpp:207
AirwellProtocol::raw
uint64_t raw
Definition: ir_Airwell.h:28
kAirwellFan
const uint8_t kAirwellFan
Definition: ir_Airwell.h:55
IRAirwellAc::getTemp
uint8_t getTemp() const
Get the current temperature setting.
Definition: ir_Airwell.cpp:233
String
std::string String
Definition: IRremoteESP8266.h:1178
IRAirwellAc::getRaw
uint64_t getRaw() const
Get the raw state of the object, suitable to be sent with the appropriate IRsend object method.
Definition: ir_Airwell.cpp:95
IRremoteESP8266.h
kAirwellFanLow
const uint8_t kAirwellFanLow
Definition: ir_Airwell.h:46
kAirwellAuto
const uint8_t kAirwellAuto
Definition: ir_Airwell.h:53
IRAirwellAc::calibrate
int8_t calibrate(void)
Run the calibration to calculate uSec timing offsets for this platform.
Definition: ir_Airwell.h:71
IRAirwellAc::getFan
uint8_t getFan() const
Get the current fan speed setting.
Definition: ir_Airwell.cpp:189
IRAirwellAc::stateReset
void stateReset()
Reset the internals of the object to a known good state.
Definition: ir_Airwell.cpp:114
IRAirwellAc::_
AirwellProtocol _
Definition: ir_Airwell.h:99
IRAirwellAc::setFan
void setFan(const uint8_t speed)
Set the speed of the fan.
Definition: ir_Airwell.cpp:182
IRAirwellAc::convertMode
static uint8_t convertMode(const stdAc::opmode_t mode)
Convert a stdAc::opmode_t enum into its native mode.
Definition: ir_Airwell.cpp:156
kAirwellMaxTemp
const uint8_t kAirwellMaxTemp
Definition: ir_Airwell.h:44
IRAirwellAc::toCommonMode
static stdAc::opmode_t toCommonMode(const uint8_t mode)
Convert a native mode into its stdAc equivalent.
Definition: ir_Airwell.cpp:169
IRAirwellAc
Class for handling detailed Airwell A/C messages.
Definition: ir_Airwell.h:60
kAirwellKnownGoodState
const uint64_t kAirwellKnownGoodState
Definition: ir_Airwell.h:41
IRAirwellAc::getMode
uint8_t getMode() const
Get the current operation mode setting.
Definition: ir_Airwell.cpp:132
IRAirwellAc::toCommonFanSpeed
static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed)
Convert a native fan speed into its stdAc equivalent.
Definition: ir_Airwell.cpp:214
IRAirwellAc::convertFan
static uint8_t convertFan(const stdAc::fanspeed_t speed)
Convert a stdAc::fanspeed_t enum into it's native speed.
Definition: ir_Airwell.cpp:196
IRAirwellAc::setPowerToggle
void setPowerToggle(const bool on)
Turn on/off the Power Airwell setting.
Definition: ir_Airwell.cpp:120
IRAirwellAc::begin
void begin()
Set up hardware to be able to send a message.
Definition: ir_Airwell.cpp:90
AirwellProtocol::Fan
uint64_t Fan
Definition: ir_Airwell.h:33
kAirwellFanMedium
const uint8_t kAirwellFanMedium
Definition: ir_Airwell.h:47
AirwellProtocol::Mode
uint64_t Mode
Definition: ir_Airwell.h:34
IRAirwellAc::toString
String toString() const
Convert the current internal state into a human readable string.
Definition: ir_Airwell.cpp:275
stdAc::state_t
Structure to hold a common A/C state.
Definition: IRsend.h:97
IRAirwellAc::getPowerToggle
bool getPowerToggle() const
Get the power toggle setting from the internal state.
Definition: ir_Airwell.cpp:126
kAirwellDry
const uint8_t kAirwellDry
Definition: ir_Airwell.h:54
IRAirwellAc::setRaw
void setRaw(const uint64_t state)
Set the raw state of the object.
Definition: ir_Airwell.cpp:101
stdAc::opmode_t
opmode_t
Common A/C settings for A/C operating modes.
Definition: IRsend.h:46