IRremoteESP8266
|
Class for handling detailed TCL A/C messages. More...
#include <ir_Tcl.h>
Public Member Functions | |
IRTcl112Ac (const uint16_t pin, const bool inverted=false, const bool use_modulation=true) | |
Class constructor. More... | |
void | send (const uint16_t repeat=kTcl112AcDefaultRepeat) |
Send the current internal state as an IR message. More... | |
int8_t | calibrate (void) |
Run the calibration to calculate uSec timing offsets for this platform. More... | |
void | begin (void) |
Set up hardware to be able to send a message. More... | |
void | stateReset (void) |
Reset the internal state of the emulation. (On, Cool, 24C) More... | |
uint8_t * | getRaw (void) |
Get a PTR to the internal state/code for this protocol. More... | |
void | setRaw (const uint8_t new_code[], const uint16_t length=kTcl112AcStateLength) |
Set the internal state from a valid code for this protocol. More... | |
tcl_ac_remote_model_t | getModel (void) const |
Get/Detect the model of the A/C. More... | |
void | setModel (const tcl_ac_remote_model_t model) |
Set the model of the A/C to emulate. More... | |
void | on (void) |
Set the requested power state of the A/C to on. More... | |
void | off (void) |
Set the requested power state of the A/C to off. More... | |
void | setPower (const bool on) |
Change the power setting. More... | |
bool | getPower (void) const |
Get the value of the current power setting. More... | |
void | setTemp (const float celsius) |
Set the temperature. More... | |
float | getTemp (void) const |
Get the current temperature setting. More... | |
void | setMode (const uint8_t mode) |
Set the operating mode of the A/C. More... | |
uint8_t | getMode (void) const |
Get the operating mode setting of the A/C. More... | |
void | setFan (const uint8_t speed) |
Set the speed of the fan. More... | |
uint8_t | getFan (void) const |
Get the current fan speed setting. More... | |
void | setEcono (const bool on) |
Set the economy setting of the A/C. More... | |
bool | getEcono (void) const |
Get the economy setting of the A/C. More... | |
void | setHealth (const bool on) |
Set the Health (Filter) setting of the A/C. More... | |
bool | getHealth (void) const |
Get the Health (Filter) setting of the A/C. More... | |
void | setLight (const bool on) |
Set the Light (LED/Display) setting of the A/C. More... | |
bool | getLight (void) const |
Get the Light (LED/Display) setting of the A/C. More... | |
void | setSwingHorizontal (const bool on) |
Set the horizontal swing setting of the A/C. More... | |
bool | getSwingHorizontal (void) const |
Get the horizontal swing setting of the A/C. More... | |
void | setSwingVertical (const uint8_t setting) |
Set the vertical swing setting of the A/C. More... | |
uint8_t | getSwingVertical (void) const |
Get the vertical swing setting of the A/C. More... | |
void | setTurbo (const bool on) |
Set the Turbo setting of the A/C. More... | |
bool | getTurbo (void) const |
Get the Turbo setting of the A/C. More... | |
void | setQuiet (const bool on) |
Set the Quiet setting of the A/C. More... | |
bool | getQuiet (const bool def=false) const |
Get the Quiet setting of the A/C. More... | |
uint16_t | getOnTimer (void) const |
Get how long the On Timer is set for, in minutes. More... | |
void | setOnTimer (const uint16_t mins) |
Set or cancel the On Timer function. More... | |
uint16_t | getOffTimer (void) const |
Get how long the Off Timer is set for, in minutes. More... | |
void | setOffTimer (const uint16_t mins) |
Set or cancel the Off Timer function. More... | |
stdAc::state_t | toCommon (const stdAc::state_t *prev=NULL) const |
Convert the current internal state into its stdAc::state_t equivalent. More... | |
String | toString (void) const |
Convert the current internal state into a human readable string. More... | |
Static Public Member Functions | |
static uint8_t | calcChecksum (uint8_t state[], const uint16_t length=kTcl112AcStateLength) |
Calculate the checksum for a given state. More... | |
static bool | validChecksum (uint8_t state[], const uint16_t length=kTcl112AcStateLength) |
Verify the checksum is valid for a given state. More... | |
static bool | isTcl (const uint8_t state[]) |
Check the supplied state looks like a TCL112AC message. More... | |
static uint8_t | convertMode (const stdAc::opmode_t mode) |
Convert a stdAc::opmode_t enum into its native mode. More... | |
static uint8_t | convertFan (const stdAc::fanspeed_t speed) |
Convert a stdAc::fanspeed_t enum into it's native speed. More... | |
static uint8_t | convertSwingV (const stdAc::swingv_t position) |
Convert a stdAc::swingv_t enum into it's native setting. More... | |
static stdAc::opmode_t | toCommonMode (const uint8_t mode) |
Convert a native mode into its stdAc equivalent. More... | |
static stdAc::fanspeed_t | toCommonFanSpeed (const uint8_t speed) |
Convert a native fan speed into its stdAc equivalent. More... | |
static stdAc::swingv_t | toCommonSwingV (const uint8_t setting) |
Convert a native vertical swing postion to it's common equivalent. More... | |
Private Member Functions | |
void | checksum (const uint16_t length=kTcl112AcStateLength) |
Calculate & set the checksum for the current internal state of the remote. More... | |
Private Attributes | |
IRsend | _irsend |
Instance of the IR send class. More... | |
Tcl112Protocol | _ |
bool | _quiet_prev |
bool | _quiet |
bool | _quiet_explictly_set |
Class for handling detailed TCL A/C messages.
|
explicit |
Class constructor.
[in] | pin | GPIO to be used when sending. |
[in] | inverted | Is the output signal to be inverted? |
[in] | use_modulation | Is frequency modulation to be used? |
void IRTcl112Ac::begin | ( | void | ) |
Set up hardware to be able to send a message.
|
static |
Calculate the checksum for a given state.
[in] | state | The array to calc the checksum of. |
[in] | length | The length/size of the array. |
|
inline |
Run the calibration to calculate uSec timing offsets for this platform.
|
private |
Calculate & set the checksum for the current internal state of the remote.
[in] | length | The length/size of the internal array to checksum. |
|
static |
Convert a stdAc::fanspeed_t enum into it's native speed.
[in] | speed | The enum to be converted. |
|
static |
Convert a stdAc::opmode_t enum into its native mode.
[in] | mode | The enum to be converted. |
|
static |
Convert a stdAc::swingv_t enum into it's native setting.
[in] | position | The enum to be converted. |
bool IRTcl112Ac::getEcono | ( | void | ) | const |
Get the economy setting of the A/C.
uint8_t IRTcl112Ac::getFan | ( | void | ) | const |
Get the current fan speed setting.
bool IRTcl112Ac::getHealth | ( | void | ) | const |
Get the Health (Filter) setting of the A/C.
bool IRTcl112Ac::getLight | ( | void | ) | const |
Get the Light (LED/Display) setting of the A/C.
uint8_t IRTcl112Ac::getMode | ( | void | ) | const |
Get the operating mode setting of the A/C.
tcl_ac_remote_model_t IRTcl112Ac::getModel | ( | void | ) | const |
Get/Detect the model of the A/C.
uint16_t IRTcl112Ac::getOffTimer | ( | void | ) | const |
Get how long the Off Timer is set for, in minutes.
uint16_t IRTcl112Ac::getOnTimer | ( | void | ) | const |
Get how long the On Timer is set for, in minutes.
bool IRTcl112Ac::getPower | ( | void | ) | const |
Get the value of the current power setting.
bool IRTcl112Ac::getQuiet | ( | const bool | def = false | ) | const |
Get the Quiet setting of the A/C.
[in] | def | The default value to use if we are not sure. |
uint8_t * IRTcl112Ac::getRaw | ( | void | ) |
Get a PTR to the internal state/code for this protocol.
bool IRTcl112Ac::getSwingHorizontal | ( | void | ) | const |
Get the horizontal swing setting of the A/C.
uint8_t IRTcl112Ac::getSwingVertical | ( | void | ) | const |
Get the vertical swing setting of the A/C.
float IRTcl112Ac::getTemp | ( | void | ) | const |
Get the current temperature setting.
bool IRTcl112Ac::getTurbo | ( | void | ) | const |
Get the Turbo setting of the A/C.
|
static |
Check the supplied state looks like a TCL112AC message.
[in] | state | The array to verify the checksum of. |
void IRTcl112Ac::off | ( | void | ) |
Set the requested power state of the A/C to off.
void IRTcl112Ac::on | ( | void | ) |
Set the requested power state of the A/C to on.
void IRTcl112Ac::send | ( | const uint16_t | repeat = kTcl112AcDefaultRepeat | ) |
Send the current internal state as an IR message.
[in] | repeat | Nr. of times the message will be repeated. |
void IRTcl112Ac::setEcono | ( | const bool | on | ) |
Set the economy setting of the A/C.
[in] | on | true, the setting is on. false, the setting is off. |
void IRTcl112Ac::setFan | ( | const uint8_t | speed | ) |
Set the speed of the fan.
[in] | speed | The desired setting. |
void IRTcl112Ac::setHealth | ( | const bool | on | ) |
Set the Health (Filter) setting of the A/C.
[in] | on | true, the setting is on. false, the setting is off. |
void IRTcl112Ac::setLight | ( | const bool | on | ) |
Set the Light (LED/Display) setting of the A/C.
[in] | on | true, the setting is on. false, the setting is off. |
void IRTcl112Ac::setMode | ( | const uint8_t | mode | ) |
Set the operating mode of the A/C.
[in] | mode | The desired operating mode. |
void IRTcl112Ac::setModel | ( | const tcl_ac_remote_model_t | model | ) |
Set the model of the A/C to emulate.
[in] | model | The enum of the appropriate model. |
void IRTcl112Ac::setOffTimer | ( | const uint16_t | mins | ) |
Set or cancel the Off Timer function.
[in] | mins | Nr. of minutes the timer is to be set to. |
void IRTcl112Ac::setOnTimer | ( | const uint16_t | mins | ) |
Set or cancel the On Timer function.
[in] | mins | Nr. of minutes the timer is to be set to. |
void IRTcl112Ac::setPower | ( | const bool | on | ) |
Change the power setting.
[in] | on | true, the setting is on. false, the setting is off. |
void IRTcl112Ac::setQuiet | ( | const bool | on | ) |
Set the Quiet setting of the A/C.
[in] | on | true, the setting is on. false, the setting is off. |
void IRTcl112Ac::setRaw | ( | const uint8_t | new_code[], |
const uint16_t | length = kTcl112AcStateLength |
||
) |
Set the internal state from a valid code for this protocol.
[in] | new_code | A valid code for this protocol. |
[in] | length | The length/size of the new_code array. |
void IRTcl112Ac::setSwingHorizontal | ( | const bool | on | ) |
Set the horizontal swing setting of the A/C.
[in] | on | true, the setting is on. false, the setting is off. |
void IRTcl112Ac::setSwingVertical | ( | const uint8_t | setting | ) |
Set the vertical swing setting of the A/C.
[in] | setting | The value of the desired setting. |
void IRTcl112Ac::setTemp | ( | const float | celsius | ) |
Set the temperature.
[in] | celsius | The temperature in degrees celsius. |
void IRTcl112Ac::setTurbo | ( | const bool | on | ) |
Set the Turbo setting of the A/C.
[in] | on | true, the setting is on. false, the setting is off. |
void IRTcl112Ac::stateReset | ( | void | ) |
Reset the internal state of the emulation. (On, Cool, 24C)
stdAc::state_t IRTcl112Ac::toCommon | ( | const stdAc::state_t * | prev = NULL | ) | const |
Convert the current internal state into its stdAc::state_t equivalent.
[in] | prev | Ptr to the previous state if required. |
|
static |
|
static |
|
static |
Convert a native vertical swing postion to it's common equivalent.
[in] | setting | A native position to convert. |
String IRTcl112Ac::toString | ( | void | ) | const |
Convert the current internal state into a human readable string.
|
static |
Verify the checksum is valid for a given state.
[in] | state | The array to verify the checksum of. |
[in] | length | The length/size of the array. |
|
private |
|
private |
Instance of the IR send class.
|
private |
|
private |
|
private |