Go to the documentation of this file.
18 #define __STDC_LIMIT_MACROS
26 #include "IRsend_test.h"
54 #define MIDEA_AC_COOL kMideaACCool
55 #define MIDEA_AC_DRY kMideaACDry
56 #define MIDEA_AC_AUTO kMideaACAuto
57 #define MIDEA_AC_HEAT kMideaACHeat
58 #define MIDEA_AC_FAN kMideaACFan
59 #define MIDEA_AC_FAN_AUTO kMideaACFanAuto
60 #define MIDEA_AC_FAN_LOW kMideaACFanLow
61 #define MIDEA_AC_FAN_MED kMideaACFanMed
62 #define MIDEA_AC_FAN_HI kMideaACFanHigh
63 #define MIDEA_AC_POWER kMideaACPower
64 #define MIDEA_AC_SLEEP kMideaACSleep
65 #define MIDEA_AC_MIN_TEMP_F kMideaACMinTempF
66 #define MIDEA_AC_MAX_TEMP_F kMideaACMaxTempF
67 #define MIDEA_AC_MIN_TEMP_C kMideaACMinTempC
68 #define MIDEA_AC_MAX_TEMP_C kMideaACMaxTempC
75 explicit IRMideaAC(
const uint16_t pin,
const bool inverted =
false,
76 const bool use_modulation =
true);
93 void setTemp(
const uint8_t temp,
const bool useCelsius =
false);
94 uint8_t
getTemp(
const bool useCelsius =
false);
95 void setFan(
const uint8_t fan);
97 void setMode(
const uint8_t mode);
99 void setRaw(
const uint64_t newState);
128 #endif // IR_MIDEA_H_
const uint8_t kMideaACMinTempF
Definition: ir_Midea.h:32
void begin(void)
Set up hardware to be able to send a message.
Definition: ir_Midea.cpp:105
static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed)
Convert a native fan speed into its stdAc equivilant.
Definition: ir_Midea.cpp:336
void setSleep(const bool on)
Set the Sleep setting of the A/C.
Definition: ir_Midea.cpp:238
void on(void)
Set the requested power state of the A/C to on.
Definition: ir_Midea.cpp:133
void setUseCelsius(const bool celsius)
Set the A/C unit to use Celsius natively.
Definition: ir_Midea.cpp:158
const uint16_t kMideaMinRepeat
Definition: IRremoteESP8266.h:923
void setTemp(const uint8_t temp, const bool useCelsius=false)
Set the temperature.
Definition: ir_Midea.cpp:169
int8_t calibrate(void)
Run the calibration to calculate uSec timing offsets for this platform.
Definition: ir_Midea.h:84
const uint8_t kMideaACTempOffset
Definition: ir_Midea.h:30
const uint8_t kMideaACFanSize
Definition: ir_Midea.h:44
fanspeed_t
Common A/C settings for Fan Speeds.
Definition: IRsend.h:58
uint8_t getFan(void)
Get the current fan speed setting.
Definition: ir_Midea.cpp:210
bool _SwingVToggle
Definition: ir_Midea.h:123
const uint8_t kMideaACAuto
Definition: ir_Midea.h:40
void checksum(void)
Calculate & set the checksum for the current internal state of the remote.
Definition: ir_Midea.cpp:288
IRMideaAC(const uint16_t pin, const bool inverted=false, const bool use_modulation=true)
Class constructor.
Definition: ir_Midea.cpp:93
const uint8_t kMideaACFan
Definition: ir_Midea.h:42
void send(const uint16_t repeat=kMideaMinRepeat)
Send the current internal state as an IR message.
Definition: ir_Midea.cpp:110
const uint8_t kMideaACModeOffset
Definition: ir_Midea.h:37
bool isSwingVToggle(void)
Is the current state a vertical swing toggle message?
Definition: ir_Midea.cpp:254
bool getSleep(void)
Get the Sleep setting of the A/C.
Definition: ir_Midea.cpp:244
const uint8_t kMideaACMaxTempF
Definition: ir_Midea.h:33
const uint8_t kMideaACCelsiusOffset
Definition: ir_Midea.h:36
Class for sending all basic IR protocols.
Definition: IRsend.h:170
int8_t calibrate(uint16_t hz=38000U)
Calculate & set any offsets to account for execution times during sending.
Definition: IRsend.cpp:207
void setSwingVToggle(const bool on)
Set the A/C to toggle the vertical swing toggle for the next send.
Definition: ir_Midea.cpp:250
std::string String
Definition: IRremoteESP8266.h:1093
bool getSwingVToggle(void)
Definition: ir_Midea.cpp:260
void off(void)
Set the requested power state of the A/C to off.
Definition: ir_Midea.cpp:136
const uint8_t kMideaACHeat
Definition: ir_Midea.h:41
bool getPower(void)
Get the value of the current power setting.
Definition: ir_Midea.cpp:146
uint8_t getMode(void)
Get the operating mode setting of the A/C.
Definition: ir_Midea.cpp:216
bool getUseCelsius(void)
Is the device currently using Celsius or the Fahrenheit temp scale?
Definition: ir_Midea.cpp:152
uint8_t getTemp(const bool useCelsius=false)
Get the current temperature setting.
Definition: ir_Midea.cpp:190
static stdAc::opmode_t toCommonMode(const uint8_t mode)
Convert a native mode into its stdAc equivilant.
Definition: ir_Midea.cpp:323
const uint8_t kMideaACFanAuto
Definition: ir_Midea.h:45
const uint64_t kMideaACToggleSwingV
Definition: ir_Midea.h:51
IRsend _irsend
Instance of the IR send class.
Definition: ir_Midea.h:116
Class for handling detailed Midea A/C messages.
Definition: ir_Midea.h:73
void setRaw(const uint64_t newState)
Set the internal state from a valid code for this protocol.
Definition: ir_Midea.cpp:130
void setMode(const uint8_t mode)
Set the operating mode of the A/C.
Definition: ir_Midea.cpp:222
static uint8_t calcChecksum(const uint64_t state)
Calculate the checksum for a given state.
Definition: ir_Midea.cpp:268
const uint8_t kMideaACTempSize
Definition: ir_Midea.h:31
uint8_t convertFan(const stdAc::fanspeed_t speed)
Convert a stdAc::fanspeed_t enum into it's native speed.
Definition: ir_Midea.cpp:309
const uint8_t kMideaACSleepOffset
Definition: ir_Midea.h:49
const uint8_t kMideaACFanMed
Definition: ir_Midea.h:47
uint64_t getRaw(void)
Get a copy of the internal state/code for this protocol.
Definition: ir_Midea.cpp:123
const uint8_t kMideaACMinTempC
Definition: ir_Midea.h:34
uint8_t convertMode(const stdAc::opmode_t mode)
Convert a stdAc::opmode_t enum into its native mode.
Definition: ir_Midea.cpp:296
uint64_t remote_state
The state of the IR remote in IR code form.
Definition: ir_Midea.h:122
const uint8_t kMideaACPowerOffset
Definition: ir_Midea.h:50
const uint8_t kMideaACFanHigh
Definition: ir_Midea.h:48
const uint8_t kMideaACMaxTempC
Definition: ir_Midea.h:35
stdAc::state_t toCommon(const stdAc::state_t *prev=NULL)
Convert the current internal state into its stdAc::state_t equivilant.
Definition: ir_Midea.cpp:348
const uint8_t kMideaACDry
Definition: ir_Midea.h:39
String toString(void)
Convert the current internal state into a human readable string.
Definition: ir_Midea.cpp:384
static bool validChecksum(const uint64_t state)
Verify the checksum is valid for a given state.
Definition: ir_Midea.cpp:283
const uint8_t kMideaACFanOffset
Definition: ir_Midea.h:43
const uint8_t kMideaACCool
Definition: ir_Midea.h:38
void setPower(const bool on)
Change the power setting.
Definition: ir_Midea.cpp:140
void stateReset(void)
Reset the state of the remote to a known good state/sequence.
Definition: ir_Midea.cpp:98
Structure to hold a common A/C state.
Definition: IRsend.h:97
const uint8_t kMideaACFanLow
Definition: ir_Midea.h:46
void setFan(const uint8_t fan)
Set the speed of the fan.
Definition: ir_Midea.cpp:203
opmode_t
Common A/C settings for A/C operating modes.
Definition: IRsend.h:46