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

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

#include <ir_Coolix.h>

Collaboration diagram for IRCoolixAC:
Collaboration graph
[legend]

Public Member Functions

 IRCoolixAC (const uint16_t pin, const bool inverted=false, const bool use_modulation=true)
 Class constructor. More...
 
void stateReset ()
 Reset the internal state to a fixed known good state. More...
 
void send (const uint16_t repeat=kCoolixDefaultRepeat)
 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 ()
 Set up hardware to be able to send a message. More...
 
void on ()
 Change the power setting to On. More...
 
void off ()
 Change the power setting to Off. More...
 
void setPower (const bool state)
 Change the power setting. More...
 
bool getPower ()
 Get the value of the current power setting. More...
 
void setTemp (const uint8_t temp)
 Set the temperature. More...
 
uint8_t getTemp ()
 Get the current temperature setting. More...
 
void setSensorTemp (const uint8_t desired)
 Set the sensor temperature. More...
 
uint8_t getSensorTemp ()
 Get the sensor temperature setting. More...
 
void clearSensorTemp ()
 Clear the Sensor Temperature setting.. More...
 
void setFan (const uint8_t speed, const bool modecheck=true)
 Set the speed of the fan. More...
 
uint8_t getFan ()
 Get the current fan speed setting. More...
 
void setMode (const uint8_t mode)
 Set the operating mode of the A/C. More...
 
uint8_t getMode ()
 Get the operating mode setting of the A/C. More...
 
void setSwing ()
 Toggle the Swing mode of the A/C. More...
 
bool getSwing ()
 Get the Swing setting of the A/C. More...
 
void setSleep ()
 Toggle the Sleep mode of the A/C. More...
 
bool getSleep ()
 Get the Sleep setting of the A/C. More...
 
void setTurbo ()
 Toggle the Turbo mode of the A/C. More...
 
bool getTurbo ()
 Get the Turbo setting of the A/C. More...
 
void setLed ()
 Toggle the Led (light) mode of the A/C. More...
 
bool getLed ()
 Get the Led (light) setting of the A/C. More...
 
void setClean ()
 Toggle the Clean mode of the A/C. More...
 
bool getClean ()
 Get the Clean setting of the A/C. More...
 
bool getZoneFollow ()
 Get the Zone Follow setting of the A/C. More...
 
uint32_t getRaw ()
 Get a copy of the internal state as a valid code for this protocol. More...
 
void setRaw (const uint32_t new_code)
 Set the internal state from a valid code for this protocol. More...
 
uint8_t convertMode (const stdAc::opmode_t mode)
 Convert a standard A/C mode 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 (const stdAc::state_t *prev=NULL)
 Convert the A/C state to it's common stdAc::state_t equivalent. More...
 
String toString ()
 Convert the internal state into a human readable string. More...
 

Static Public Member Functions

static stdAc::opmode_t toCommonMode (const uint8_t mode)
 Convert a native mode to it's common stdAc::opmode_t 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 setTempRaw (const uint8_t code)
 Set the raw (native) temperature value. More...
 
uint8_t getTempRaw ()
 Get the raw (native) temperature value. More...
 
void setSensorTempRaw (const uint8_t code)
 Set the raw (native) sensor temperature value. More...
 
void setZoneFollow (const bool on)
 Change the Zone Follow setting. More...
 
bool isSpecialState (void)
 Is the current state is a special state? More...
 
bool handleSpecialState (const uint32_t data)
 Adjust any internal settings based on the type of special state we are supplied. Does nothing if it isn't a special state. More...
 
void updateSavedState (void)
 Backup the current internal state as long as it isn't a special state. More...
 
void recoverSavedState (void)
 Restore the current internal state from backup as long as it isn't a special state. More...
 
uint32_t getNormalState (void)
 

Private Attributes

IRsend _irsend
 Instance of the IR send class. More...
 
bool powerFlag
 
bool turboFlag
 
bool ledFlag
 
bool cleanFlag
 
bool sleepFlag
 
bool zoneFollowFlag
 
bool swingFlag
 
bool swingHFlag
 
bool swingVFlag
 
uint32_t remote_state
 The state of the IR remote in IR code form. More...
 
uint32_t saved_state
 Copy of the state if we required a special mode. More...
 

Detailed Description

Class for handling detailed Coolix A/C messages.

See also
https://github.com/crankyoldgit/IRremoteESP8266/issues/484

Constructor & Destructor Documentation

◆ IRCoolixAC()

IRCoolixAC::IRCoolixAC ( 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 IRCoolixAC::begin ( )

Set up hardware to be able to send a message.

◆ calibrate()

int8_t IRCoolixAC::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.

◆ clearSensorTemp()

void IRCoolixAC::clearSensorTemp ( )

Clear the Sensor Temperature setting..

◆ convertFan()

uint8_t IRCoolixAC::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 IRCoolixAC::convertMode ( const stdAc::opmode_t  mode)

Convert a standard A/C mode into its native mode.

Parameters
[in]modeA stdAc::opmode_t to be converted to it's native equivalent.
Returns
The corresponding native mode.

◆ getClean()

bool IRCoolixAC::getClean ( )

Get the Clean setting of the A/C.

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

◆ getFan()

uint8_t IRCoolixAC::getFan ( )

Get the current fan speed setting.

Returns
The current fan speed.

◆ getLed()

bool IRCoolixAC::getLed ( )

Get the Led (light) setting of the A/C.

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

◆ getMode()

uint8_t IRCoolixAC::getMode ( )

Get the operating mode setting of the A/C.

Returns
The current operating mode setting.

◆ getNormalState()

uint32_t IRCoolixAC::getNormalState ( void  )
private

◆ getPower()

bool IRCoolixAC::getPower ( )

Get the value of the current power setting.

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

◆ getRaw()

uint32_t IRCoolixAC::getRaw ( )

Get a copy of the internal state as a valid code for this protocol.

Returns
A valid code for this protocol based on the current internal state.

◆ getSensorTemp()

uint8_t IRCoolixAC::getSensorTemp ( )

Get the sensor temperature setting.

Returns
The current setting for sensor temp. in degrees celsius.

◆ getSleep()

bool IRCoolixAC::getSleep ( )

Get the Sleep setting of the A/C.

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

◆ getSwing()

bool IRCoolixAC::getSwing ( )

Get the Swing setting of the A/C.

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

◆ getTemp()

uint8_t IRCoolixAC::getTemp ( )

Get the current temperature setting.

Returns
The current setting for temp. in degrees celsius.

◆ getTempRaw()

uint8_t IRCoolixAC::getTempRaw ( )
private

Get the raw (native) temperature value.

Returns
The native temperature value.

◆ getTurbo()

bool IRCoolixAC::getTurbo ( )

Get the Turbo setting of the A/C.

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

◆ getZoneFollow()

bool IRCoolixAC::getZoneFollow ( )

Get the Zone Follow setting of the A/C.

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

◆ handleSpecialState()

bool IRCoolixAC::handleSpecialState ( const uint32_t  data)
private

Adjust any internal settings based on the type of special state we are supplied. Does nothing if it isn't a special state.

Parameters
[in]dataThe state we need to act upon.
Note
Special state means commands that are not affecting Temperature/Mode/Fan
Returns
true, if it is a special state. false if it isn't.

◆ isSpecialState()

bool IRCoolixAC::isSpecialState ( void  )
private

Is the current state is a special state?

Returns
true, if it is. false if it isn't.

◆ off()

void IRCoolixAC::off ( )

Change the power setting to Off.

◆ on()

void IRCoolixAC::on ( )

Change the power setting to On.

◆ recoverSavedState()

void IRCoolixAC::recoverSavedState ( void  )
private

Restore the current internal state from backup as long as it isn't a special state.

◆ send()

void IRCoolixAC::send ( const uint16_t  repeat = kCoolixDefaultRepeat)

Send the current internal state as an IR message.

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

◆ setClean()

void IRCoolixAC::setClean ( )

Toggle the Clean mode of the A/C.

◆ setFan()

void IRCoolixAC::setFan ( const uint8_t  speed,
const bool  modecheck = true 
)

Set the speed of the fan.

Parameters
[in]speedThe desired setting.
[in]modecheckDo we enforce any mode limitations before setting?

◆ setLed()

void IRCoolixAC::setLed ( )

Toggle the Led (light) mode of the A/C.

◆ setMode()

void IRCoolixAC::setMode ( const uint8_t  mode)

Set the operating mode of the A/C.

Parameters
[in]modeThe desired operating mode.

◆ setPower()

void IRCoolixAC::setPower ( const bool  on)

Change the power setting.

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

◆ setRaw()

void IRCoolixAC::setRaw ( const uint32_t  new_code)

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

Parameters
[in]new_codeA valid code for this protocol.

◆ setSensorTemp()

void IRCoolixAC::setSensorTemp ( const uint8_t  desired)

Set the sensor temperature.

Parameters
[in]desiredThe temperature in degrees celsius.

◆ setSensorTempRaw()

void IRCoolixAC::setSensorTempRaw ( const uint8_t  code)
private

Set the raw (native) sensor temperature value.

Note
Bypasses any checks or additional actions.
Parameters
[in]codeThe desired native sensor temperature.

◆ setSleep()

void IRCoolixAC::setSleep ( )

Toggle the Sleep mode of the A/C.

◆ setSwing()

void IRCoolixAC::setSwing ( )

Toggle the Swing mode of the A/C.

◆ setTemp()

void IRCoolixAC::setTemp ( const uint8_t  desired)

Set the temperature.

Parameters
[in]desiredThe temperature in degrees celsius.

◆ setTempRaw()

void IRCoolixAC::setTempRaw ( const uint8_t  code)
private

Set the raw (native) temperature value.

Note
Bypasses any checks.
Parameters
[in]codeThe desired native temperature.

◆ setTurbo()

void IRCoolixAC::setTurbo ( )

Toggle the Turbo mode of the A/C.

◆ setZoneFollow()

void IRCoolixAC::setZoneFollow ( const bool  on)
private

Change the Zone Follow setting.

Note
Internal use only.
Parameters
[in]ontrue, the setting is on. false, the setting is off.

◆ stateReset()

void IRCoolixAC::stateReset ( )

Reset the internal state to a fixed known good state.

◆ toCommon()

stdAc::state_t IRCoolixAC::toCommon ( const stdAc::state_t prev = NULL)

Convert the A/C state to it's common stdAc::state_t equivalent.

Parameters
[in]prevPtr to the previous state if required.
Returns
A stdAc::state_t state.

◆ toCommonFanSpeed()

stdAc::fanspeed_t IRCoolixAC::toCommonFanSpeed ( const uint8_t  speed)
static

Convert a native fan speed into its stdAc equivalent.

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

◆ toCommonMode()

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

Convert a native mode to it's common stdAc::opmode_t equivalent.

Parameters
[in]modeA native operation mode to be converted.
Returns
The corresponding common stdAc::opmode_t mode.

◆ toString()

String IRCoolixAC::toString ( )

Convert the internal state into a human readable string.

Returns
The current internal state expressed as a human readable String.

◆ updateSavedState()

void IRCoolixAC::updateSavedState ( void  )
private

Backup the current internal state as long as it isn't a special state.

Note
: Must be called before every special state to make sure the remote_state is safe

Member Data Documentation

◆ _irsend

IRsend IRCoolixAC::_irsend
private

Instance of the IR send class.

◆ cleanFlag

bool IRCoolixAC::cleanFlag
private

◆ ledFlag

bool IRCoolixAC::ledFlag
private

◆ powerFlag

bool IRCoolixAC::powerFlag
private

◆ remote_state

uint32_t IRCoolixAC::remote_state
private

The state of the IR remote in IR code form.

◆ saved_state

uint32_t IRCoolixAC::saved_state
private

Copy of the state if we required a special mode.

◆ sleepFlag

bool IRCoolixAC::sleepFlag
private

◆ swingFlag

bool IRCoolixAC::swingFlag
private

◆ swingHFlag

bool IRCoolixAC::swingHFlag
private

◆ swingVFlag

bool IRCoolixAC::swingVFlag
private

◆ turboFlag

bool IRCoolixAC::turboFlag
private

◆ zoneFollowFlag

bool IRCoolixAC::zoneFollowFlag
private

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