IRremoteESP8266
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
IRTcl112Ac Class Reference

Class for handling detailed TCL A/C messages. More...

#include <ir_Tcl.h>

Collaboration diagram for IRTcl112Ac:
Collaboration graph
[legend]

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...
 
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)
 Get the value of the current power setting. More...
 
void setTemp (const float celsius)
 Set the temperature. More...
 
float getTemp (void)
 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)
 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)
 Get the current fan speed setting. More...
 
void setEcono (const bool on)
 Set the economy setting of the A/C. More...
 
bool getEcono (void)
 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)
 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)
 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)
 Get the horizontal swing setting of the A/C. More...
 
void setSwingVertical (const bool on)
 Set the vertical swing setting of the A/C. More...
 
bool getSwingVertical (void)
 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)
 Get the Turbo setting of the A/C. More...
 
uint8_t convertMode (const stdAc::opmode_t mode)
 Convert a stdAc::opmode_t enum into its native mode. More...
 
uint8_t convertFan (const stdAc::fanspeed_t speed)
 Convert a stdAc::fanspeed_t enum into it's native speed. More...
 
stdAc::state_t toCommon (void)
 Convert the current internal state into its stdAc::state_t equivalent. More...
 
String toString (void)
 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 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...
 

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...
 
uint8_t remote_state [kTcl112AcStateLength]
 The State in IR code form. More...
 

Detailed Description

Class for handling detailed TCL A/C messages.

Constructor & Destructor Documentation

◆ IRTcl112Ac()

IRTcl112Ac::IRTcl112Ac ( const uint16_t  pin,
const bool  inverted = false,
const bool  use_modulation = true 
)
explicit

Class constructor.

Parameters
[in]pinGPIO to be used when sending.
[in]invertedIs the output signal to be inverted?
[in]use_modulationIs frequency modulation to be used?

Member Function Documentation

◆ 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]stateThe array to calc the checksum of.
[in]lengthThe 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()

void IRTcl112Ac::checksum ( const uint16_t  length = kTcl112AcStateLength)
private

Calculate & set the checksum for the current internal state of the remote.

Parameters
[in]lengthThe length/size of the internal array to checksum.

◆ convertFan()

uint8_t IRTcl112Ac::convertFan ( const stdAc::fanspeed_t  speed)

Convert a stdAc::fanspeed_t enum into it's native speed.

Parameters
[in]speedThe enum to be converted.
Returns
The native equivalent of the enum.

◆ convertMode()

uint8_t IRTcl112Ac::convertMode ( const stdAc::opmode_t  mode)

Convert a stdAc::opmode_t enum into its native mode.

Parameters
[in]modeThe enum to be converted.
Returns
The native equivalent of the enum.

◆ getEcono()

bool IRTcl112Ac::getEcono ( void  )

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  )

Get the current fan speed setting.

Returns
The current fan speed/mode.

◆ getHealth()

bool IRTcl112Ac::getHealth ( void  )

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  )

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  )

Get the operating mode setting of the A/C.

Returns
The current operating mode setting.

◆ getPower()

bool IRTcl112Ac::getPower ( void  )

Get the value of the current power setting.

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  )

Get the horizontal swing setting of the A/C.

Returns
true, the setting is on. false, the setting is off.

◆ getSwingVertical()

bool IRTcl112Ac::getSwingVertical ( void  )

Get the vertical swing setting of the A/C.

Returns
true, the setting is on. false, the setting is off.

◆ getTemp()

float IRTcl112Ac::getTemp ( void  )

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  )

Get the Turbo setting of the A/C.

Returns
true, the setting is on. false, the setting is off.

◆ 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()

void IRTcl112Ac::send ( const uint16_t  repeat = kTcl112AcDefaultRepeat)

Send the current internal state as an IR message.

Parameters
[in]repeatNr. of times the message will be repeated.

◆ setEcono()

void IRTcl112Ac::setEcono ( const bool  on)

Set the economy setting of the A/C.

Parameters
[in]ontrue, 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]speedThe 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]ontrue, 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]ontrue, 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]modeThe desired operating mode.
Note
Fan/Ventilation mode sets the fan speed to high. Unknown values default to Auto.

◆ setPower()

void IRTcl112Ac::setPower ( const bool  on)

Change the power setting.

Parameters
[in]ontrue, the setting is on. false, the setting is off.

◆ setRaw()

void IRTcl112Ac::setRaw ( const uint8_t  new_code[],
const uint16_t  length = kTcl112AcStateLength 
)

Set the internal state from a valid code for this protocol.

Parameters
[in]new_codeA valid code for this protocol.
[in]lengthThe 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]ontrue, the setting is on. false, the setting is off.

◆ setSwingVertical()

void IRTcl112Ac::setSwingVertical ( const bool  on)

Set the vertical swing setting of the A/C.

Parameters
[in]ontrue, the setting is on. false, the setting is off.

◆ setTemp()

void IRTcl112Ac::setTemp ( const float  celsius)

Set the temperature.

Parameters
[in]celsiusThe 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]ontrue, 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()

stdAc::state_t IRTcl112Ac::toCommon ( void  )

Convert the current internal state into its stdAc::state_t equivalent.

Returns
The stdAc equivalent of the native settings.

◆ toCommonFanSpeed()

stdAc::fanspeed_t IRTcl112Ac::toCommonFanSpeed ( const uint8_t  spd)
static

Convert a native fan speed into its stdAc equivalent.

Parameters
[in]spdThe native setting to be converted.
Returns
The stdAc equivalent of the native setting.

◆ toCommonMode()

stdAc::opmode_t IRTcl112Ac::toCommonMode ( const uint8_t  mode)
static

Convert a native mode into its stdAc equivalent.

Parameters
[in]modeThe native setting to be converted.
Returns
The stdAc equivalent of the native setting.

◆ toString()

String IRTcl112Ac::toString ( void  )

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]stateThe array to verify the checksum of.
[in]lengthThe length/size of the array.
Returns
true, if the state has a valid checksum. Otherwise, false.

Member Data Documentation

◆ _irsend

IRsend IRTcl112Ac::_irsend
private

Instance of the IR send class.

◆ remote_state

uint8_t IRTcl112Ac::remote_state[kTcl112AcStateLength]
private

The State in IR code form.


The documentation for this class was generated from the following files: