IRremoteESP8266: IRKelvinatorAC Class Reference

IRremoteESP8266

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

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

`#include <ir_Kelvinator.h>`

Collaboration diagram for IRKelvinatorAC:
[legend]

## Public Member Functions

| IRKelvinatorAC (const uint16_t pin, const bool inverted=false, const 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=kKelvinatorDefaultRepeat)
| 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 | on (void)
| Set the internal state to have the power on. More...
void | off (void)
| Set the internal state to have the power off. More...
void | setPower (const bool on)
| Set the internal state to have the desired power. More...
bool | getPower (void) const
| Get the power setting from the internal state. 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 | setMode (const uint8_t mode)
| Set the desired operation mode. More...
uint8_t | getMode (void) const
| Get the current operation mode setting. More...
void | setSwingVertical (const bool on)
| Control the current vertical swing setting. More...
bool | getSwingVertical (void) const
| Is the vertical swing setting on? More...
void | setSwingHorizontal (const bool on)
| Control the current horizontal swing setting. More...
bool | getSwingHorizontal (void) const
| Is the horizontal swing setting on? More...
void | setQuiet (const bool on)
| Control the current Quiet setting. More...
bool | getQuiet (void) const
| Is the Quiet setting on? More...
void | setIonFilter (const bool on)
| Control the current Ion Filter setting. More...
bool | getIonFilter (void) const
| Is the Ion Filter setting on? More...
void | setLight (const bool on)
| Control the current Light setting. i.e. The LED display on the A/C unit that shows the basic settings. More...
bool | getLight (void) const
| Is the Light (Display) setting on? More...
void | setXFan (const bool on)
| Control the current XFan setting. This setting will cause the unit blow air after power off to dry out the A/C device. More...
bool | getXFan (void) const
| Is the XFan setting on? More...
void | setTurbo (const bool on)
| Control the current Turbo setting. More...
bool | getTurbo (void) const
| Is the Turbo setting on? More...
uint8_t * | getRaw (void)
| Get the raw state of the object, suitable to be sent with the appropriate IRsend object method. More...
void | setRaw (const uint8_t new_code[])
| Set the raw state of the object. More...
stdAc::state_t | toCommon (void) 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 | calcBlockChecksum (const uint8_t *block, const uint16_t length=kKelvinatorStateLength/2)
| Calculate the checksum for a given block of state. More...
static bool | validChecksum (const uint8_t state[], const uint16_t length=kKelvinatorStateLength)
| Verify the checksum is valid for a given state. More...
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 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 Member Functions

void | checksum (void)
| Calculate the checksum for the internal state. More...
void | fixup (void)
| Fix up any odd conditions for the current state. More...

## Private Attributes

IRsend | _irsend
| Instance of the IR send class. More...
KelvinatorProtocol | _

## Detailed Description

Class for handling detailed Kelvinator A/C messages.

## Constructor & Destructor Documentation

## ◆ IRKelvinatorAC()

IRKelvinatorAC::IRKelvinatorAC | ( | 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?

## Member Function Documentation

## ◆ begin()

void IRKelvinatorAC::begin | ( | void |  | ) |

Set up hardware to be able to send a message.

## ◆ calcBlockChecksum()

uint8_t IRKelvinatorAC::calcBlockChecksum | ( | const uint8_t * | block,
|  | const uint16_t | length = `kKelvinatorStateLength / 2`
| ) |  |

static

Calculate the checksum for a given block of state.

Parameters

  [in] | block | A pointer to a block to calc the checksum of.
  [in] | length | Length of the block array to checksum.

Returns
  The calculated checksum value.

Note
  Many Bothans died to bring us this information.

## ◆ calibrate()

int8_t IRKelvinatorAC::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 IRKelvinatorAC::checksum | ( | void |  | ) |

private

Calculate the checksum for the internal state.

## ◆ convertMode()

uint8_t IRKelvinatorAC::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.

## ◆ fixup()

void IRKelvinatorAC::fixup | ( | void |  | ) |

private

Fix up any odd conditions for the current state.

## ◆ getFan()

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

Get the current fan speed setting.

Returns
  The current fan speed.

## ◆ getIonFilter()

bool IRKelvinatorAC::getIonFilter | ( | void |  | ) | const

Is the Ion Filter setting on?

Returns
  The current value.

## ◆ getLight()

bool IRKelvinatorAC::getLight | ( | void |  | ) | const

Is the Light (Display) setting on?

Returns
  The current value.

## ◆ getMode()

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

Get the current operation mode setting.

Returns
  The current operation mode.

## ◆ getPower()

bool IRKelvinatorAC::getPower | ( | void |  | ) | const

Get the power setting from the internal state.

Returns
  A boolean indicating if the power setting.

## ◆ getQuiet()

bool IRKelvinatorAC::getQuiet | ( | void |  | ) | const

Is the Quiet setting on?

Returns
  The current value.

## ◆ getRaw()

uint8_t * IRKelvinatorAC::getRaw | ( | void |  | ) |

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

Returns
  A PTR to the internal state.

## ◆ getSwingHorizontal()

bool IRKelvinatorAC::getSwingHorizontal | ( | void |  | ) | const

Is the horizontal swing setting on?

Returns
  The current value.

## ◆ getSwingVertical()

bool IRKelvinatorAC::getSwingVertical | ( | void |  | ) | const

Is the vertical swing setting on?

Returns
  The current value.

## ◆ getTemp()

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

Get the current temperature setting.

Returns
  Get current setting for temp. in degrees celsius.

## ◆ getTurbo()

bool IRKelvinatorAC::getTurbo | ( | void |  | ) | const

Is the Turbo setting on?

Returns
  The current value.

## ◆ getXFan()

bool IRKelvinatorAC::getXFan | ( | void |  | ) | const

Is the XFan setting on?

Returns
  The current value.

## ◆ off()

void IRKelvinatorAC::off | ( | void |  | ) |

Set the internal state to have the power off.

## ◆ on()

void IRKelvinatorAC::on | ( | void |  | ) |

Set the internal state to have the power on.

## ◆ send()

void IRKelvinatorAC::send | ( | const uint16_t | repeat = `kKelvinatorDefaultRepeat` | ) |

Send the current internal state as an IR message.

Parameters

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

## ◆ setFan()

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

Set the speed of the fan.

Parameters

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

## ◆ setIonFilter()

void IRKelvinatorAC::setIonFilter | ( | const bool | on | ) |

Control the current Ion Filter setting.

Parameters

  [in] | on | The desired setting.

## ◆ setLight()

void IRKelvinatorAC::setLight | ( | const bool | on | ) |

Control the current Light setting. i.e. The LED display on the A/C unit that shows the basic settings.

Parameters

  [in] | on | The desired setting.

## ◆ setMode()

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

Set the desired operation mode.

Parameters

  [in] | mode | The desired operation mode.

## ◆ setPower()

void IRKelvinatorAC::setPower | ( | const bool | on | ) |

Set the internal state to have the desired power.

Parameters

  [in] | on | The desired power state.

## ◆ setQuiet()

void IRKelvinatorAC::setQuiet | ( | const bool | on | ) |

Control the current Quiet setting.

Parameters

  [in] | on | The desired setting.

## ◆ setRaw()

void IRKelvinatorAC::setRaw | ( | const uint8_t | new_code[] | ) |

Set the raw state of the object.

Parameters

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

## ◆ setSwingHorizontal()

void IRKelvinatorAC::setSwingHorizontal | ( | const bool | on | ) |

Control the current horizontal swing setting.

Parameters

  [in] | on | The desired setting.

## ◆ setSwingVertical()

void IRKelvinatorAC::setSwingVertical | ( | const bool | on | ) |

Control the current vertical swing setting.

Parameters

  [in] | on | The desired setting.

## ◆ setTemp()

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

Set the temperature setting.

Parameters

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

## ◆ setTurbo()

void IRKelvinatorAC::setTurbo | ( | const bool | on | ) |

Control the current Turbo setting.

Note
  Turbo mode is turned off if the fan speed is changed.

Parameters

  [in] | on | The desired setting.

## ◆ setXFan()

void IRKelvinatorAC::setXFan | ( | const bool | on | ) |

Control the current XFan setting. This setting will cause the unit blow air after power off to dry out the A/C device.

Note
  XFan mode is only valid in Cool or Dry mode.

Parameters

  [in] | on | The desired setting.

## ◆ stateReset()

void IRKelvinatorAC::stateReset | ( | void |  | ) |

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

## ◆ toCommon()

stdAc::state_t IRKelvinatorAC::toCommon | ( | void |  | ) | 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 IRKelvinatorAC::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 IRKelvinatorAC::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 IRKelvinatorAC::toString | ( | void |  | ) | const

Convert the internal settings into a human readable string.

Returns
  A String.

## ◆ validChecksum()

bool IRKelvinatorAC::validChecksum | ( | const uint8_t | state[],
|  | const uint16_t | length = `kKelvinatorStateLength`
| ) |  |

static

Verify the checksum is valid for a given state.

Parameters

  [in] | state | The array to verify the checksum of.
  [in] | length | The size of the state.

Returns
  A boolean indicating if it is valid.

## Member Data Documentation

## ◆ _

KelvinatorProtocol IRKelvinatorAC::_

private

## ◆ _irsend

IRsend IRKelvinatorAC::_irsend

private

Instance of the IR send class.

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

- src/ir_Kelvinator.h
- src/ir_Kelvinator.cpp