IRremoteESP8266

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

`#include <ir_Kelon.h>`

Collaboration diagram for IRKelonAc:
[legend]

## Public Member Functions
| IRKelonAc (uint16_t pin, bool inverted=false, bool use_modulation=true)
| Class constructor. More...
void | stateReset (void)
| Reset the internals of the object to a known good state. More...
void | send (const uint16_t repeat=kNoRepeat)
| 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 | ensurePower (const bool on)
| Since the AC does not support actually setting the power state to a known value, this utility allow ensuring the AC is on or off by exploiting the fact that the AC, according to the user manual, will always turn on when setting it to "smart" or "super" mode. More...
void | begin (void)
| Set up hardware to be able to send a message. More...
void | setTogglePower (const bool toggle)
| Request toggling power - will be reset to false after sending. More...
bool | getTogglePower (void) const
| Get whether toggling power will be requested. More...
void | setTemp (const uint8_t degrees)
| Set the temperature setting. More...
uint8_t | getTemp (void) const
| Get the current temperature setting. 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 | setDryGrade (const int8_t grade)
| Set the dehumidification intensity. More...
int8_t | getDryGrade (void) const
| Get the current dehumidification intensity setting. In smart mode, this controls the temperature adjustment. More...
void | setMode (const uint8_t mode)
| Set the desired operation mode. More...
uint8_t | getMode (void) const
| Get the current operation mode setting. More...
void | setToggleSwingVertical (const bool toggle)
| Request toggling the vertical swing - will be reset to false after sending. More...
bool | getToggleSwingVertical (void) const
| Get whether the swing mode is set to be toggled. More...
void | setSleep (const bool on)
| Control the current sleep (quiet) setting. More...
bool | getSleep (void) const
| Is the sleep setting on? More...
void | setSupercool (const bool on)
| Control the current super cool mode setting. More...
bool | getSupercool (void) const
| Is the super cool mode setting on? More...
void | setTimer (const uint16_t mins)
| Set the timer time and enable it. Timer is an off timer if the unit is on, it is an on timer if the unit is off. Only multiples of 30m are supported for < 10h, then only multiples of 60m. More...
uint16_t | getTimer (void) const
| Get the set timer. Timer set time is deleted once the command is sent, so calling this after send() will return 0. The AC unit will continue keeping track of the remaining time unless it is later disabled. More...
void | setTimerEnabled (const bool on)
| Enable or disable the timer. Note that in order to enable the timer the minutes must be set with setTimer(). More...
bool | getTimerEnabled (void) const
| Get the current timer status. More...
uint64_t | getRaw (void) const
| Get the raw state of the object, suitable to be sent with the appropriate IRsend object method. More...
void | setRaw (const uint64_t new_code)
| Set the raw state of the object. More...
stdAc::state_t | toCommon (const stdAc::state_t *prev=nullptr) const
| Convert the internal A/C object state to it's stdAc::state_t equivalent. More...
String | toString (void) const
| Convert the internal settings into a human readable string. More...

## Static Public Member Functions
static uint8_t | convertMode (const stdAc::opmode_t mode)
| Convert a standard A/C mode (stdAc::opmode_t) into it a native mode. More...
static uint8_t | convertFan (const stdAc::fanspeed_t fan)
| Convert a standard A/C fan speed (stdAc::fanspeed_t) into it a native speed. More...
static stdAc::opmode_t | toCommonMode (const uint8_t mode)
| Convert a native mode to it's stdAc::opmode_t equivalent. More...
static stdAc::fanspeed_t | toCommonFanSpeed (const uint8_t speed)
| Convert a native fan speed to it's stdAc::fanspeed_t equivalent. More...

## Private Attributes
IRsend | _irsend
| Instance of the IR send class. More...
KelonProtocol | _
uint8_t | _previousMode = 0
uint8_t | _previousTemp = kKelonMinTemp
uint8_t | _previousFan = kKelonFanAuto

## Constructor & Destructor Documentation

## ◆ IRKelonAc()

IRKelonAc::IRKelonAc | ( | uint16_t | pin,
|  | bool | inverted = `false`,
|  | 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?

## Member Function Documentation

## ◆ begin()

void IRKelonAc::begin | ( | void |  | ) |

Set up hardware to be able to send a message.

## ◆ calibrate()

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

## ◆ convertFan()

uint8_t IRKelonAc::convertFan | ( | const stdAc::fanspeed_t | fan | ) |
| static

Convert a standard A/C fan speed (stdAc::fanspeed_t) into it a native speed.

Parameters

  [in] | fan | A stdAc::fanspeed_t fan speed

Returns
  The native speed equivalent.

## ◆ convertMode()

uint8_t IRKelonAc::convertMode | ( | const stdAc::opmode_t | mode | ) |
| static

Convert a standard A/C mode (stdAc::opmode_t) into it a native mode.

Parameters

  [in] | mode | A stdAc::opmode_t operation mode.

Returns
  The native mode equivalent.

## ◆ ensurePower()

void IRKelonAc::ensurePower | ( | const bool | on | ) |

Since the AC does not support actually setting the power state to a known value, this utility allow ensuring the AC is on or off by exploiting the fact that the AC, according to the user manual, will always turn on when setting it to "smart" or "super" mode.

Ensures the AC is on or off by exploiting the fact that setting it to "smart" will always turn it on if it's off. This method will send 2 commands to the AC to do the trick.

Parameters

  [in] | on | Whether to ensure the AC is on or off

## ◆ getDryGrade()

int8_t IRKelonAc::getDryGrade | ( | void |  | ) | const

Get the current dehumidification intensity setting. In smart mode, this controls the temperature adjustment.

Returns
  The current dehumidification intensity.

## ◆ getFan()

uint8_t IRKelonAc::getFan | ( | void |  | ) | const

Get the current fan speed setting.

Returns
  The current fan speed.

## ◆ getMode()

uint8_t IRKelonAc::getMode | ( | void |  | ) | const

Get the current operation mode setting.

Returns
  The current operation mode.

## ◆ getRaw()

uint64_t IRKelonAc::getRaw | ( | void |  | ) | const

Get the raw state of the object, suitable to be sent with the appropriate IRsend object method.

Returns
  A PTR to the internal state.

## ◆ getSleep()

bool IRKelonAc::getSleep | ( | void |  | ) | const

Is the sleep setting on?

Returns
  The current value.

## ◆ getSupercool()

bool IRKelonAc::getSupercool | ( | void |  | ) | const

Is the super cool mode setting on?

Returns
  The current value.

## ◆ getTemp()

uint8_t IRKelonAc::getTemp | ( | void |  | ) | const

Get the current temperature setting.

Returns
  Get current setting for temp. in degrees celsius.

## ◆ getTimer()

uint16_t IRKelonAc::getTimer | ( | void |  | ) | const

Get the set timer. Timer set time is deleted once the command is sent, so calling this after send() will return 0. The AC unit will continue keeping track of the remaining time unless it is later disabled.

Returns
  The timer set minutes

## ◆ getTimerEnabled()

bool IRKelonAc::getTimerEnabled | ( | void |  | ) | const

Get the current timer status.

Returns
  Whether the timer is enabled.

## ◆ getTogglePower()

bool IRKelonAc::getTogglePower | ( | void |  | ) | const

Get whether toggling power will be requested.

Returns
  The power toggle state

## ◆ getToggleSwingVertical()

bool IRKelonAc::getToggleSwingVertical | ( | void |  | ) | const

Get whether the swing mode is set to be toggled.

Returns
  Whether the toggle bit is set

## ◆ send()

void IRKelonAc::send | ( | const uint16_t | repeat = `kNoRepeat` | ) |

Send the current internal state as an IR message.

Parameters

  [in] | repeat | Nr. of times the message will be repeated.

## ◆ setDryGrade()

void IRKelonAc::setDryGrade | ( | const int8_t | grade | ) |

Set the dehumidification intensity.

Parameters

  [in] | grade | has to be in the range [-2 : +2]

## ◆ setFan()

void IRKelonAc::setFan | ( | const uint8_t | speed | ) |

Set the speed of the fan.

Parameters

  [in] | speed | 0 is auto, 1-5 is the speed

## ◆ setMode()

void IRKelonAc::setMode | ( | const uint8_t | mode | ) |

Set the desired operation mode.

Parameters

  [in] | mode | The desired operation mode.

## ◆ setRaw()

void IRKelonAc::setRaw | ( | const uint64_t | new_code | ) |

Set the raw state of the object.

Parameters

  [in] | new_code | The raw state from the native IR message.

## ◆ setSleep()

void IRKelonAc::setSleep | ( | const bool | on | ) |

Control the current sleep (quiet) setting.

Parameters

  [in] | on | The desired setting.

## ◆ setSupercool()

void IRKelonAc::setSupercool | ( | const bool | on | ) |

Control the current super cool mode setting.

Parameters

  [in] | on | The desired setting.

## ◆ setTemp()

void IRKelonAc::setTemp | ( | const uint8_t | degrees | ) |

Set the temperature setting.

Parameters

  [in] | degrees | The temperature in degrees celsius.

## ◆ setTimer()

void IRKelonAc::setTimer | ( | const uint16_t | mins | ) |

Set the timer time and enable it. Timer is an off timer if the unit is on, it is an on timer if the unit is off. Only multiples of 30m are supported for < 10h, then only multiples of 60m.

Parameters

  [in] | mins | Nr. of minutes

## ◆ setTimerEnabled()

void IRKelonAc::setTimerEnabled | ( | const bool | on | ) |

Enable or disable the timer. Note that in order to enable the timer the minutes must be set with setTimer().

Parameters

  [in] | on | Whether to enable or disable the timer

## ◆ setTogglePower()

void IRKelonAc::setTogglePower | ( | const bool | toggle | ) |

Request toggling power - will be reset to false after sending.

Parameters

  [in] | toggle | Whether to toggle the power state

## ◆ setToggleSwingVertical()

void IRKelonAc::setToggleSwingVertical | ( | const bool | toggle | ) |

Request toggling the vertical swing - will be reset to false after sending.

Parameters

  [in] | toggle | If true, the swing mode will be toggled when sent.

## ◆ stateReset()

void IRKelonAc::stateReset | ( | void |  | ) |

Reset the internals of the object to a known good state.

## ◆ toCommon()

stdAc::state_t IRKelonAc::toCommon | ( | const stdAc::state_t * | prev = `nullptr` | ) | const

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

Returns
  A stdAc::state_t containing the current settings.

## ◆ toCommonFanSpeed()

stdAc::fanspeed_t IRKelonAc::toCommonFanSpeed | ( | const uint8_t | speed | ) |
| static

Convert a native fan speed to it's stdAc::fanspeed_t equivalent.

Parameters

  [in] | speed | A native fan speed value.

Returns
  The stdAc::fanspeed_t equivalent.

## ◆ toCommonMode()

stdAc::opmode_t IRKelonAc::toCommonMode | ( | const uint8_t | mode | ) |
| static

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

Parameters

  [in] | mode | A native operating mode value.

Returns
  The stdAc::opmode_t equivalent.

## ◆ toString()

String IRKelonAc::toString | ( | void |  | ) | const

Convert the internal settings into a human readable string.

Returns
  A String.

## Member Data Documentation

## ◆ _

KelonProtocol IRKelonAc::_
| private

## ◆ _irsend

IRsend IRKelonAc::_irsend
| private

Instance of the IR send class.

## ◆ _previousFan

uint8_t IRKelonAc::_previousFan = kKelonFanAuto
| private

## ◆ _previousMode

uint8_t IRKelonAc::_previousMode = 0
| private

## ◆ _previousTemp

uint8_t IRKelonAc::_previousTemp = kKelonMinTemp
| private

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

- src/ir_Kelon.h
- src/ir_Kelon.cpp