IRremoteESP8266: IRTcl112Ac Class Reference (original) (raw)
Class for handling detailed TCL A/C messages. More...
#include <[ir_Tcl.h](ir%5F%5FTcl%5F8h%5Fsource.html)>
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 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.
IRTcl112Ac::IRTcl112Ac ( const uint16_t pin, const bool inverted = false, const bool use_modulation = true ) | explicit |
---|
Class constructor.
Parameters
[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? |
◆ begin()
void IRTcl112Ac::begin | ( | void | ) |
---|
Set up hardware to be able to send a message.
◆ calcChecksum()
uint8_t IRTcl112Ac::calcChecksum ( uint8_t _state_[], const uint16_t length = kTcl112AcStateLength ) | static |
---|
Calculate the checksum for a given state.
Parameters
[in] | state | The array to calc the checksum of. |
---|---|---|
[in] | length | The length/size of the array. |
Returns
The calculated checksum value.
◆ calibrate()
int8_t IRTcl112Ac::calibrate ( void ) | inline |
---|
Run the calibration to calculate uSec timing offsets for this platform.
Returns
The uSec timing offset needed per modulation of the IR Led.
Note
This will produce a 65ms IR signal pulse at 38kHz. Only ever needs to be run once per object instantiation, if at all.
◆ checksum()
Calculate & set the checksum for the current internal state of the remote.
Parameters
[in] | length | The length/size of the internal array to checksum. |
---|
◆ convertFan()
Convert a stdAc::fanspeed_t enum into it's native speed.
Parameters
[in] | speed | The enum to be converted. |
---|
Returns
The native equivalent of the enum.
◆ convertMode()
Convert a stdAc::opmode_t enum into its native mode.
Parameters
[in] | mode | The enum to be converted. |
---|
Returns
The native equivalent of the enum.
◆ convertSwingV()
Convert a stdAc::swingv_t enum into it's native setting.
Parameters
[in] | position | The enum to be converted. |
---|
Returns
The native equivalent of the enum.
◆ getEcono()
bool IRTcl112Ac::getEcono | ( | void | ) | const |
---|
Get the economy setting of the A/C.
Returns
true, the setting is on. false, the setting is off.
◆ getFan()
uint8_t IRTcl112Ac::getFan | ( | void | ) | const |
---|
Get the current fan speed setting.
Returns
The current fan speed/mode.
◆ getHealth()
bool IRTcl112Ac::getHealth | ( | void | ) | const |
---|
Get the Health (Filter) setting of the A/C.
Returns
true, the setting is on. false, the setting is off.
◆ getLight()
bool IRTcl112Ac::getLight | ( | void | ) | const |
---|
Get the Light (LED/Display) setting of the A/C.
Returns
true, the setting is on. false, the setting is off.
◆ getMode()
uint8_t IRTcl112Ac::getMode | ( | void | ) | const |
---|
Get the operating mode setting of the A/C.
Returns
The current operating mode setting.
◆ getModel()
Get/Detect the model of the A/C.
Returns
The enum of the compatible model.
◆ getOffTimer()
uint16_t IRTcl112Ac::getOffTimer | ( | void | ) | const |
---|
Get how long the Off Timer is set for, in minutes.
Returns
The time in nr of minutes.
◆ getOnTimer()
uint16_t IRTcl112Ac::getOnTimer | ( | void | ) | const |
---|
Get how long the On Timer is set for, in minutes.
Returns
The time in nr of minutes.
◆ getPower()
bool IRTcl112Ac::getPower | ( | void | ) | const |
---|
Get the value of the current power setting.
Returns
true, the setting is on. false, the setting is off.
◆ getQuiet()
bool IRTcl112Ac::getQuiet | ( | const bool | def = false | ) | const |
---|
Get the Quiet setting of the A/C.
Parameters
[in] | def | The default value to use if we are not sure. |
---|
Returns
true, the setting is on. false, the setting is off.
◆ getRaw()
uint8_t * IRTcl112Ac::getRaw | ( | void | ) |
---|
Get a PTR to the internal state/code for this protocol.
Returns
PTR to a code for this protocol based on the current internal state.
◆ getSwingHorizontal()
bool IRTcl112Ac::getSwingHorizontal | ( | void | ) | const |
---|
Get the horizontal swing setting of the A/C.
Returns
true, the setting is on. false, the setting is off.
◆ getSwingVertical()
uint8_t IRTcl112Ac::getSwingVertical | ( | void | ) | const |
---|
Get the vertical swing setting of the A/C.
Returns
The current setting.
◆ getTemp()
float IRTcl112Ac::getTemp | ( | void | ) | const |
---|
Get the current temperature setting.
Returns
The current setting for temp. in degrees celsius.
Note
The temperature resolution is 0.5 of a degree.
◆ getTurbo()
bool IRTcl112Ac::getTurbo | ( | void | ) | const |
---|
Get the Turbo setting of the A/C.
Returns
true, the setting is on. false, the setting is off.
◆ isTcl()
bool IRTcl112Ac::isTcl ( const uint8_t _state_[]) | static |
---|
Check the supplied state looks like a TCL112AC message.
Parameters
[in] | state | The array to verify the checksum of. |
---|
Note
Assumes the state is the correct size.
Returns
true, if the state looks like a TCL112AC message. Otherwise, false.
Warning
This is just a guess.
◆ off()
void IRTcl112Ac::off | ( | void | ) |
---|
Set the requested power state of the A/C to off.
◆ on()
void IRTcl112Ac::on | ( | void | ) |
---|
Set the requested power state of the A/C to on.
◆ send()
Send the current internal state as an IR message.
Parameters
[in] | repeat | Nr. of times the message will be repeated. |
---|
◆ setEcono()
void IRTcl112Ac::setEcono | ( | const bool | on | ) |
---|
Set the economy setting of the A/C.
Parameters
[in] | on | true, the setting is on. false, the setting is off. |
---|
◆ setFan()
void IRTcl112Ac::setFan | ( | const uint8_t | speed | ) |
---|
Set the speed of the fan.
Parameters
[in] | speed | The desired setting. |
---|
Note
Unknown speeds will default to Auto.
◆ setHealth()
void IRTcl112Ac::setHealth | ( | const bool | on | ) |
---|
Set the Health (Filter) setting of the A/C.
Parameters
[in] | on | true, the setting is on. false, the setting is off. |
---|
◆ setLight()
void IRTcl112Ac::setLight | ( | const bool | on | ) |
---|
Set the Light (LED/Display) setting of the A/C.
Parameters
[in] | on | true, the setting is on. false, the setting is off. |
---|
◆ setMode()
void IRTcl112Ac::setMode | ( | const uint8_t | mode | ) |
---|
Set the operating mode of the A/C.
Parameters
[in] | mode | The desired operating mode. |
---|
Note
Fan/Ventilation mode sets the fan speed to high. Unknown values default to Auto.
◆ setModel()
Set the model of the A/C to emulate.
Parameters
[in] | model | The enum of the appropriate model. |
---|
◆ setOffTimer()
void IRTcl112Ac::setOffTimer | ( | const uint16_t | mins | ) |
---|
Set or cancel the Off Timer function.
Parameters
[in] | mins | Nr. of minutes the timer is to be set to. |
---|
Note
Rounds down to 20 min increments. (max: 720 mins (12h), 0 is Off)
◆ setOnTimer()
void IRTcl112Ac::setOnTimer | ( | const uint16_t | mins | ) |
---|
Set or cancel the On Timer function.
Parameters
[in] | mins | Nr. of minutes the timer is to be set to. |
---|
Note
Rounds down to 20 min increments. (max: 720 mins (12h), 0 is Off)
◆ setPower()
void IRTcl112Ac::setPower | ( | const bool | on | ) |
---|
Change the power setting.
Parameters
[in] | on | true, the setting is on. false, the setting is off. |
---|
◆ setQuiet()
void IRTcl112Ac::setQuiet | ( | const bool | on | ) |
---|
Set the Quiet setting of the A/C.
Parameters
[in] | on | true, the setting is on. false, the setting is off. |
---|
◆ setRaw()
Set the internal state from a valid code for this protocol.
Parameters
[in] | new_code | A valid code for this protocol. |
---|---|---|
[in] | length | The length/size of the new_code array. |
◆ setSwingHorizontal()
void IRTcl112Ac::setSwingHorizontal | ( | const bool | on | ) |
---|
Set the horizontal swing setting of the A/C.
Parameters
[in] | on | true, the setting is on. false, the setting is off. |
---|
◆ setSwingVertical()
void IRTcl112Ac::setSwingVertical | ( | const uint8_t | setting | ) |
---|
Set the vertical swing setting of the A/C.
Parameters
[in] | setting | The value of the desired setting. |
---|
◆ setTemp()
void IRTcl112Ac::setTemp | ( | const float | celsius | ) |
---|
Set the temperature.
Parameters
[in] | celsius | The temperature in degrees celsius. |
---|
Note
The temperature resolution is 0.5 of a degree.
◆ setTurbo()
void IRTcl112Ac::setTurbo | ( | const bool | on | ) |
---|
Set the Turbo setting of the A/C.
Parameters
[in] | on | true, the setting is on. false, the setting is off. |
---|
◆ stateReset()
void IRTcl112Ac::stateReset | ( | void | ) |
---|
Reset the internal state of the emulation. (On, Cool, 24C)
◆ toCommon()
Convert the current internal state into its stdAc::state_t equivalent.
Parameters
[in] | prev | Ptr to the previous state if required. |
---|
Returns
The stdAc equivalent of the native settings.
◆ toCommonFanSpeed()
Convert a native fan speed into its stdAc equivalent.
Parameters
[in] | spd | The native setting to be converted. |
---|
Returns
The stdAc equivalent of the native setting.
◆ toCommonMode()
Convert a native mode into its stdAc equivalent.
Parameters
[in] | mode | The native setting to be converted. |
---|
Returns
The stdAc equivalent of the native setting.
◆ toCommonSwingV()
Convert a native vertical swing postion to it's common equivalent.
Parameters
[in] | setting | A native position to convert. |
---|
Returns
The common vertical swing position.
◆ toString()
String IRTcl112Ac::toString | ( | void | ) | const |
---|
Convert the current internal state into a human readable string.
Returns
A human readable string.
◆ validChecksum()
bool IRTcl112Ac::validChecksum ( uint8_t _state_[], const uint16_t length = kTcl112AcStateLength ) | static |
---|
Verify the checksum is valid for a given state.
Parameters
[in] | state | The array to verify the checksum of. |
---|---|---|
[in] | length | The length/size of the array. |
Returns
true, if the state has a valid checksum. Otherwise, false.
◆ _
◆ _irsend
Instance of the IR send class.
◆ _quiet
◆ _quiet_explictly_set
bool IRTcl112Ac::_quiet_explictly_set | private |
---|
◆ _quiet_prev
bool IRTcl112Ac::_quiet_prev | private |
---|
The documentation for this class was generated from the following files:
- src/ir_Tcl.h
- src/ir_Tcl.cpp