# IRremoteESP8266: IRWhirlpoolAc Class Reference

IRWhirlpoolAc Class Reference

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

`#include <ir_Whirlpool.h>`

Collaboration diagram for IRWhirlpoolAc:
[legend]

## Public Member Functions

| IRWhirlpoolAc (const uint16_t pin, const bool inverted=false, const bool use_modulation=true)
| Class constructor. More...
void | stateReset (void)
| Reset the state of the remote to a known good state/sequence. More...
void | send (const uint16_t repeat=kWhirlpoolAcDefaultRepeat, const bool calcchecksum=true)
| 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 | setPowerToggle (const bool on)
| Change the power toggle setting. More...
bool | getPowerToggle (void)
| Get the value of the current power toggle setting. More...
void | setSleep (const bool on)
| Set the Sleep setting of the A/C. More...
bool | getSleep (void)
| Get the Sleep setting of the A/C. More...
void | setSuper (const bool on)
| Set the Super (Turbo/Jet) setting of the A/C. More...
bool | getSuper (void)
| Get the Super (Turbo/Jet) setting of the A/C. More...
void | setTemp (const uint8_t temp)
| Set the temperature. More...
uint8_t | getTemp (void)
| Get the current temperature setting. 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 | 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 | setSwing (const bool on)
| Set the (vertical) swing setting of the A/C. More...
bool | getSwing (void)
| Get the (vertical) swing setting of the A/C. More...
void | setLight (const bool on)
| Set the Light (Display/LED) setting of the A/C. More...
bool | getLight (void)
| Get the Light (Display/LED) setting of the A/C. More...
uint16_t | getClock (void)
| Get the clock time in nr. of minutes past midnight. More...
void | setClock (const uint16_t minspastmidnight)
| Set the clock time in nr. of minutes past midnight. More...
uint16_t | getOnTimer (void)
| Get the On Timer time.. More...
void | setOnTimer (const uint16_t minspastmidnight)
| Set the On Timer time. More...
void | enableOnTimer (const bool on)
| Enable the On Timer. More...
bool | isOnTimerEnabled (void)
| Is the On timer enabled? More...
uint16_t | getOffTimer (void)
| Get the Off Timer time.. More...
void | setOffTimer (const uint16_t minspastmidnight)
| Set the Off Timer time. More...
void | enableOffTimer (const bool on)
| Enable the Off Timer. More...
bool | isOffTimerEnabled (void)
| Is the Off timer enabled? More...
void | setCommand (const uint8_t code)
| Set the Command (Button) setting of the A/C. More...
uint8_t | getCommand (void)
| Get the Command (Button) setting of the A/C. More...
whirlpool_ac_remote_model_t | getModel (void)
| Get/Detect the model of the A/C. More...
void | setModel (const whirlpool_ac_remote_model_t model)
| Set the model of the A/C to emulate. More...
uint8_t * | getRaw (const bool calcchecksum=true)
| Get a copy of the internal state/code for this protocol. More...
void | setRaw (const uint8_t new_code[], const uint16_t length=kWhirlpoolAcStateLength)
| Set the internal state from a valid code for this protocol. More...
stdAc::state_t | toCommon (const stdAc::state_t *prev=NULL)
| 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 bool | validChecksum (const uint8_t state[], const uint16_t length=kWhirlpoolAcStateLength)
| Verify the checksum is valid for a given state. 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 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=kWhirlpoolAcStateLength)
| Calculate & set the checksum for the current internal state of the remote. More...
uint16_t | getTime (const uint16_t pos)
| Get the time in nr. of minutes past midnight. More...
void | setTime (const uint16_t pos, const uint16_t minspastmidnight)
| Set the time in nr. of minutes past midnight. More...
bool | isTimerEnabled (const uint16_t pos)
| Is the timer enabled at the given byte offset? More...
void | enableTimer (const uint16_t pos, const bool state)
| Enable the timer enabled at the given byte offset. More...
void | _setTemp (const uint8_t temp, const bool remember=true)
| Set the temperature. More...
void | _setMode (const uint8_t mode)
| Set the operating mode of the A/C. More...
int8_t | getTempOffset (void)
| Calculate the temp. offset in deg C for the current model. More...

## Private Attributes

IRsend | _irsend
| Instance of the IR send class. More...
uint8_t | remote_state [kWhirlpoolAcStateLength]
| The state in IR code form. More...
uint8_t | _desiredtemp
| The last user explicitly set temperature. More...

## Detailed Description

Class for handling detailed Whirlpool A/C messages.

## Constructor & Destructor Documentation

## IRWhirlpoolAc()

IRWhirlpoolAc::IRWhirlpoolAc | ( | 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

## _setMode()

void IRWhirlpoolAc::_setMode | ( | const uint8_t | mode | ) |

private

Set the operating mode of the A/C.

Parameters

  [in] | mode | The desired operating mode.

Note
  Internal use only.

## _setTemp()

void IRWhirlpoolAc::_setTemp | ( | const uint8_t | temp,
|  | const bool | remember = `true`
| ) |  |

private

Set the temperature.

Parameters

  [in] | temp | The temperature in degrees celsius.
  [in] | remember | Do we save this temperature?

Note
  Internal use only.

## begin()

void IRWhirlpoolAc::begin | ( | void |  | ) |

Set up hardware to be able to send a message.

## calibrate()

int8_t IRWhirlpoolAc::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 IRWhirlpoolAc::checksum | ( | const uint16_t | length = `kWhirlpoolAcStateLength` | ) |

private

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

Parameters

  [in] | length | The length/size of the internal state array.

## convertFan()

uint8_t IRWhirlpoolAc::convertFan | ( | const stdAc::fanspeed_t | speed | ) |

static

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

uint8_t IRWhirlpoolAc::convertMode | ( | const stdAc::opmode_t | mode | ) |

static

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.

## enableOffTimer()

void IRWhirlpoolAc::enableOffTimer | ( | const bool | on | ) |

Enable the Off Timer.

Parameters

  [in] | on | true, the timer is enabled. false, the timer is disabled.

## enableOnTimer()

void IRWhirlpoolAc::enableOnTimer | ( | const bool | on | ) |

Enable the On Timer.

Parameters

  [in] | on | true, the timer is enabled. false, the timer is disabled.

## enableTimer()

void IRWhirlpoolAc::enableTimer | ( | const uint16_t | pos,
|  | const bool | on
| ) |  |

private

Enable the timer enabled at the given byte offset.

Parameters

  [in] | pos | The byte offset to write to.
  [in] | on | true, the timer is enabled. false, the timer is disabled.

## getClock()

uint16_t IRWhirlpoolAc::getClock | ( | void |  | ) |

Get the clock time in nr. of minutes past midnight.

Returns
  The time expressed as the Nr. of minutes past midnight.

## getCommand()

uint8_t IRWhirlpoolAc::getCommand | ( | void |  | ) |

Get the Command (Button) setting of the A/C.

Returns
  The current Command (Button) of the A/C.

## getFan()

uint8_t IRWhirlpoolAc::getFan | ( | void |  | ) |

Get the current fan speed setting.

Returns
  The current fan speed/mode.

## getLight()

bool IRWhirlpoolAc::getLight | ( | void |  | ) |

Get the Light (Display/LED) setting of the A/C.

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

## getMode()

uint8_t IRWhirlpoolAc::getMode | ( | void |  | ) |

Get the operating mode setting of the A/C.

Returns
  The current operating mode setting.

## getModel()

whirlpool_ac_remote_model_t IRWhirlpoolAc::getModel | ( | void |  | ) |

Get/Detect the model of the A/C.

Returns
  The enum of the compatible model.

## getOffTimer()

uint16_t IRWhirlpoolAc::getOffTimer | ( | void |  | ) |

Get the Off Timer time..

Returns
  The time expressed as the Nr. of minutes past midnight.

## getOnTimer()

uint16_t IRWhirlpoolAc::getOnTimer | ( | void |  | ) |

Get the On Timer time..

Returns
  The time expressed as the Nr. of minutes past midnight.

## getPowerToggle()

bool IRWhirlpoolAc::getPowerToggle | ( | void |  | ) |

Get the value of the current power toggle setting.

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

## getRaw()

uint8_t * IRWhirlpoolAc::getRaw | ( | const bool | calcchecksum = `true` | ) |

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

Parameters

  [in] | calcchecksum | Do we need to calculate the checksum?.

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

## getSleep()

bool IRWhirlpoolAc::getSleep | ( | void |  | ) |

Get the Sleep setting of the A/C.

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

## getSuper()

bool IRWhirlpoolAc::getSuper | ( | void |  | ) |

Get the Super (Turbo/Jet) setting of the A/C.

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

## getSwing()

bool IRWhirlpoolAc::getSwing | ( | void |  | ) |

Get the (vertical) swing setting of the A/C.

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

## getTemp()

uint8_t IRWhirlpoolAc::getTemp | ( | void |  | ) |

Get the current temperature setting.

Returns
  The current setting for temp. in degrees celsius.

## getTempOffset()

int8_t IRWhirlpoolAc::getTempOffset | ( | void |  | ) |

private

Calculate the temp. offset in deg C for the current model.

Returns
  The temperature offset.

## getTime()

uint16_t IRWhirlpoolAc::getTime | ( | const uint16_t | pos | ) |

private

Get the time in nr. of minutes past midnight.

Parameters

  [in] | pos | The byte offset to read from.

Returns
  The time in Nr. of minutes past midnight.

## isOffTimerEnabled()

bool IRWhirlpoolAc::isOffTimerEnabled | ( | void |  | ) |

Is the Off timer enabled?

Returns
  true, the Timer is enabled. false, the Timer is disabled.

## isOnTimerEnabled()

bool IRWhirlpoolAc::isOnTimerEnabled | ( | void |  | ) |

Is the On timer enabled?

Returns
  true, the Timer is enabled. false, the Timer is disabled.

## isTimerEnabled()

bool IRWhirlpoolAc::isTimerEnabled | ( | const uint16_t | pos | ) |

private

Is the timer enabled at the given byte offset?

Parameters

  [in] | pos | The byte offset to read from.

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

## send()

void IRWhirlpoolAc::send | ( | const uint16_t | repeat = `kWhirlpoolAcDefaultRepeat`,
|  | const bool | calcchecksum = `true`
| ) |  |

Send the current internal state as an IR message.

Parameters

  [in] | repeat | Nr. of times the message will be repeated.
  [in] | calcchecksum | Do we need to calculate the checksum?.

## setClock()

void IRWhirlpoolAc::setClock | ( | const uint16_t | minspastmidnight | ) |

Set the clock time in nr. of minutes past midnight.

Parameters

  [in] | minspastmidnight | The time expressed as minutes past midnight.

## setCommand()

void IRWhirlpoolAc::setCommand | ( | const uint8_t | code | ) |

Set the Command (Button) setting of the A/C.

Parameters

  [in] | code | The current Command (Button) of the A/C.

## setFan()

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

Set the speed of the fan.

Parameters

  [in] | speed | The desired setting.

## setLight()

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

Set the Light (Display/LED) setting of the A/C.

Parameters

  [in] | on | true, the setting is on. false, the setting is off.

## setMode()

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

Set the operating mode of the A/C.

Parameters

  [in] | mode | The desired operating mode.

## setModel()

void IRWhirlpoolAc::setModel | ( | const whirlpool_ac_remote_model_t | model | ) |

Set the model of the A/C to emulate.

Parameters

  [in] | model | The enum of the appropriate model.

## setOffTimer()

void IRWhirlpoolAc::setOffTimer | ( | const uint16_t | minspastmidnight | ) |

Set the Off Timer time.

Parameters

  [in] | minspastmidnight | The time expressed as minutes past midnight.

## setOnTimer()

void IRWhirlpoolAc::setOnTimer | ( | const uint16_t | minspastmidnight | ) |

Set the On Timer time.

Parameters

  [in] | minspastmidnight | The time expressed as minutes past midnight.

## setPowerToggle()

void IRWhirlpoolAc::setPowerToggle | ( | const bool | on | ) |

Change the power toggle setting.

Parameters

  [in] | on | true, the setting is on. false, the setting is off.

## setRaw()

void IRWhirlpoolAc::setRaw | ( | const uint8_t | new_code[],
|  | const uint16_t | length = `kWhirlpoolAcStateLength`
| ) |  |

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.

## setSleep()

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

Set the Sleep setting of the A/C.

Parameters

  [in] | on | true, the setting is on. false, the setting is off.

## setSuper()

void IRWhirlpoolAc::setSuper | ( | const bool | on | ) |

Set the Super (Turbo/Jet) setting of the A/C.

Parameters

  [in] | on | true, the setting is on. false, the setting is off.

## setSwing()

void IRWhirlpoolAc::setSwing | ( | const bool | on | ) |

Set the (vertical) swing setting of the A/C.

Parameters

  [in] | on | true, the setting is on. false, the setting is off.

## setTemp()

void IRWhirlpoolAc::setTemp | ( | const uint8_t | temp | ) |

Set the temperature.

Parameters

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

## setTime()

void IRWhirlpoolAc::setTime | ( | const uint16_t | pos,
|  | const uint16_t | minspastmidnight
| ) |  |

private

Set the time in nr. of minutes past midnight.

Parameters

  [in] | pos | The byte offset to write to.
  [in] | minspastmidnight | Nr. of minutes past midnight.

## stateReset()

void IRWhirlpoolAc::stateReset | ( | void |  | ) |

Reset the state of the remote to a known good state/sequence.

## toCommon()

stdAc::state_t IRWhirlpoolAc::toCommon | ( | const stdAc::state_t * | prev = `NULL` | ) |

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

stdAc::fanspeed_t IRWhirlpoolAc::toCommonFanSpeed | ( | const uint8_t | speed | ) |

static

Convert a native fan speed into its stdAc equivalent.

Parameters

  [in] | speed | The native setting to be converted.

Returns
  The stdAc equivalent of the native setting.

## toCommonMode()

stdAc::opmode_t IRWhirlpoolAc::toCommonMode | ( | const uint8_t | mode | ) |

static

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.

## toString()

String IRWhirlpoolAc::toString | ( | void |  | ) |

Convert the current internal state into a human readable string.

Returns
  A human readable string.

## validChecksum()

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

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.

## Member Data Documentation

## _desiredtemp

uint8_t IRWhirlpoolAc::_desiredtemp

private

The last user explicitly set temperature.

## _irsend

IRsend IRWhirlpoolAc::_irsend

private

Instance of the IR send class.

## remote_state

uint8_t IRWhirlpoolAc::remote_state[kWhirlpoolAcStateLength]

private

The state in IR code form.

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

- src/ir_Whirlpool.h
- src/ir_Whirlpool.cpp