IRremoteESP8266

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

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

`#include <ir_Voltas.h>`

Collaboration diagram for IRVoltas:
[legend]

## Public Member Functions
| IRVoltas (const uint16_t pin, const bool inverted=false, const bool use_modulation=true)
| Class constructor. More...
void | stateReset ()
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 | begin ()
| Set up hardware to be able to send a message. More...
void | setModel (const voltas_ac_remote_model_t model)
| Set the current model for the remote. More...
voltas_ac_remote_model_t | getModel (const bool raw=false) const
| Get the model information currently known. More...
void | setPower (const bool on)
| Change the power setting. More...
bool | getPower (void) const
| Get the value of the current power setting. More...
void | on (void)
| Change the power setting to On. More...
void | off (void)
| Change the power setting to Off. More...
void | setWifi (const bool on)
| Change the Wifi setting. More...
bool | getWifi (void) const
| Get the value of the current Wifi setting. 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 | setSwingH (const bool on)
| Set the Horizontal Swing setting of the A/C. More...
bool | getSwingH (void) const
| Get the Horizontal Swing setting of the A/C. More...
void | setSwingHChange (const bool on)
| Set the bits for changing the Horizontal Swing setting of the A/C. More...
bool | getSwingHChange (void) const
| Are the Horizontal Swing change bits set in the message? More...
void | setSwingV (const bool on)
| Set the Vertical Swing setting of the A/C. More...
bool | getSwingV (void) const
| Get the Vertical Swing setting of the A/C. More...
void | setEcono (const bool on)
| Change the Economy setting. More...
bool | getEcono (void) const
| Get the value of the current Econo setting. More...
void | setLight (const bool on)
| Change the Light setting. More...
bool | getLight (void) const
| Get the value of the current Light setting. More...
void | setTurbo (const bool on)
| Change the Turbo setting. More...
bool | getTurbo (void) const
| Get the value of the current Turbo setting. More...
void | setSleep (const bool on)
| Change the Sleep setting. More...
bool | getSleep (void) const
| Get the value of the current Sleep setting. More...
uint16_t | getOnTime (void) const
| Get the value of the On Timer time. More...
void | setOnTime (const uint16_t nr_of_mins)
| Set the value of the On Timer time. More...
uint16_t | getOffTime (void) const
| Get the value of the On Timer time. More...
void | setOffTime (const uint16_t nr_of_mins)
| Set the value of the Off Timer time. More...
uint8_t * | getRaw (void)
| Get a PTR to the internal state/code for this protocol. More...
void | setRaw (const uint8_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 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 (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=kVoltasStateLength)
| 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 (void)
| Calculate and set the checksum values for the internal state. More...

## Static Private Member Functions
static uint8_t | calcChecksum (const uint8_t state[], const uint16_t length=kVoltasStateLength)
| Calculate the checksum is valid for a given state. More...

## Private Attributes
IRsend | _irsend
| Instance of the IR send class. More...
VoltasProtocol | _
| The state of the IR remote. More...
voltas_ac_remote_model_t | _model
| Model type. More...

## Detailed Description

Class for handling detailed Voltas A/C messages.

## Constructor & Destructor Documentation

## ◆ IRVoltas()

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

Set up hardware to be able to send a message.

## ◆ calcChecksum()

uint8_t IRVoltas::calcChecksum | ( | const uint8_t | state[],
|  | const uint16_t | length = `kVoltasStateLength`
| ) |  |
| staticprivate

Calculate the checksum is valid for a given state.

Parameters

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

Returns
  The valid checksum value for the state.

## ◆ calibrate()

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

Calculate and set the checksum values for the internal state.

## ◆ convertFan()

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

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

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.

## ◆ getEcono()

bool IRVoltas::getEcono | ( | void |  | ) | const

Get the value of the current Econo setting.

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

## ◆ getFan()

uint8_t IRVoltas::getFan | ( | void |  | ) |

Get the current fan speed setting.

Returns
  The current fan speed/mode.

## ◆ getLight()

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

Get the value of the current Light setting.

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

## ◆ getMode()

uint8_t IRVoltas::getMode | ( | void |  | ) |

Get the operating mode setting of the A/C.

Returns
  The current operating mode setting.

## ◆ getModel()

voltas_ac_remote_model_t IRVoltas::getModel | ( | const bool | raw = `false` | ) | const

Get the model information currently known.

Parameters

  [in] | raw | Work out the model info from the current raw state.

Returns
  The known model number.

## ◆ getOffTime()

uint16_t IRVoltas::getOffTime | ( | void |  | ) | const

Get the value of the On Timer time.

Returns
  Number of minutes before the timer activates.

## ◆ getOnTime()

uint16_t IRVoltas::getOnTime | ( | void |  | ) | const

Get the value of the On Timer time.

Returns
  Number of minutes before the timer activates.

## ◆ getPower()

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

Get the value of the current power setting.

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

## ◆ getRaw()

uint8_t * IRVoltas::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.

## ◆ getSleep()

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

Get the value of the current Sleep setting.

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

## ◆ getSwingH()

bool IRVoltas::getSwingH | ( | void |  | ) | const

Get the Horizontal Swing setting of the A/C.

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

## ◆ getSwingHChange()

bool IRVoltas::getSwingHChange | ( | void |  | ) | const

Are the Horizontal Swing change bits set in the message?

Returns
  true, the correct bits are set. false, the correct bits are not set.

## ◆ getSwingV()

bool IRVoltas::getSwingV | ( | void |  | ) | const

Get the Vertical Swing setting of the A/C.

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

## ◆ getTemp()

uint8_t IRVoltas::getTemp | ( | void |  | ) |

Get the current temperature setting.

Returns
  The current setting for temp. in degrees celsius.

## ◆ getTurbo()

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

Get the value of the current Turbo setting.

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

## ◆ getWifi()

bool IRVoltas::getWifi | ( | void |  | ) | const

Get the value of the current Wifi setting.

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

## ◆ off()

void IRVoltas::off | ( | void |  | ) |

Change the power setting to Off.

## ◆ on()

void IRVoltas::on | ( | void |  | ) |

Change the power setting to On.

## ◆ send()

void IRVoltas::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.

## ◆ setEcono()

void IRVoltas::setEcono | ( | const bool | on | ) |

Change the Economy setting.

Parameters

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

Note
  The Economy setting is only available in Cool mode.

## ◆ setFan()

void IRVoltas::setFan | ( | const uint8_t | fan | ) |

Set the speed of the fan.

Parameters

  [in] | fan | The desired setting.

## ◆ setLight()

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

Change the Light setting.

Parameters

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

## ◆ setMode()

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

Set the operating mode of the A/C.

Parameters

  [in] | mode | The desired operating mode.

Note
  If we get an unexpected mode, default to AUTO.

## ◆ setModel()

void IRVoltas::setModel | ( | const voltas_ac_remote_model_t | model | ) |

Set the current model for the remote.

Parameters

  [in] | model | The model number.

## ◆ setOffTime()

void IRVoltas::setOffTime | ( | const uint16_t | nr_of_mins | ) |

Set the value of the Off Timer time.

Parameters

  [in] | nr_of_mins | Number of minutes before the timer activates. 0 disables the timer. Max is 23 hrs & 59 mins (1439 mins)

## ◆ setOnTime()

void IRVoltas::setOnTime | ( | const uint16_t | nr_of_mins | ) |

Set the value of the On Timer time.

Parameters

  [in] | nr_of_mins | Number of minutes before the timer activates. 0 disables the timer. Max is 23 hrs & 59 mins (1439 mins)

## ◆ setPower()

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

Change the power setting.

Parameters

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

## ◆ setRaw()

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

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

Parameters

  [in] | new_code | A valid code for this protocol.

## ◆ setSleep()

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

Change the Sleep setting.

Parameters

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

Note
  The Sleep setting is only available in Cool mode.

## ◆ setSwingH()

void IRVoltas::setSwingH | ( | const bool | on | ) |

Set the Horizontal Swing setting of the A/C.

Parameters

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

## ◆ setSwingHChange()

void IRVoltas::setSwingHChange | ( | const bool | on | ) |

Set the bits for changing the Horizontal Swing setting of the A/C.

Parameters

  [in] | on | true, the change bits are set. false, the "no change" bits are set.

## ◆ setSwingV()

void IRVoltas::setSwingV | ( | 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 IRVoltas::setTemp | ( | const uint8_t | temp | ) |

Set the temperature.

Parameters

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

## ◆ setTurbo()

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

Change the Turbo setting.

Parameters

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

Note
  The Turbo setting is only available in Cool mode.

## ◆ setWifi()

void IRVoltas::setWifi | ( | const bool | on | ) |

Change the Wifi setting.

Parameters

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

## ◆ stateReset()

void IRVoltas::stateReset | ( |  | ) |

## ◆ toCommon()

stdAc::state_t IRVoltas::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 available.

Returns
  The stdAc equivalent of the native settings.

## ◆ toCommonFanSpeed()

stdAc::fanspeed_t IRVoltas::toCommonFanSpeed | ( | const uint8_t | spd | ) |
| static

Convert a native fan speed into its stdAc equivalent.

Parameters

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

Returns
  The stdAc equivalent of the native setting.

## ◆ toCommonMode()

stdAc::opmode_t IRVoltas::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 IRVoltas::toString | ( | void |  | ) |

Convert the current internal state into a human readable string.

Returns
  A human readable string.

## ◆ validChecksum()

bool IRVoltas::validChecksum | ( | const uint8_t | state[],
|  | const uint16_t | length = `kVoltasStateLength`
| ) |  |
| static

Verify the checksum is valid for a given state.

Parameters

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

Returns
  true, if the state has a valid checksum. Otherwise, false.

## Member Data Documentation

## ◆ _

VoltasProtocol IRVoltas::_
| private

The state of the IR remote.

## ◆ _irsend

IRsend IRVoltas::_irsend
| private

Instance of the IR send class.

## ◆ _model

voltas_ac_remote_model_t IRVoltas::_model
| private

Model type.

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

- src/ir_Voltas.h
- src/ir_Voltas.cpp