IRremoteESP8266: IRSanyoAc Class Reference

IRremoteESP8266

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

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

`#include <ir_Sanyo.h>`

Collaboration diagram for IRSanyoAc:
[legend]

## Public Member Functions

| IRSanyoAc (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=kNoRepeat)
| Send the current internal state as IR messages. 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 requested power state of the A/C to on. More...
void | off (void)
| Set the requested power state of the A/C to off. 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 | setTemp (const uint8_t degrees)
| Set the desired temperature. More...
uint8_t | getTemp (void) const
| Get the current desired temperature setting. More...
void | setSensorTemp (const uint8_t degrees)
| Set the sensor temperature. More...
uint8_t | getSensorTemp (void) const
| Get the current sensor 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 operating mode of the A/C. More...
uint8_t | getMode (void) const
| Get the operating mode setting of the A/C. More...
void | setSleep (const bool on)
| Set the Sleep (Night Setback) setting of the A/C. More...
bool | getSleep (void) const
| Get the Sleep (Night Setback) setting of the A/C. More...
void | setSensor (const bool location)
| Set the Sensor Location setting of the A/C. i.e. Where the ambient temperature is measured. More...
bool | getSensor (void) const
| Get the Sensor Location setting of the A/C. i.e. Where the ambient temperature is measured. More...
void | setBeep (const bool on)
| Set the Beep setting of the A/C. More...
bool | getBeep (void) const
| Get the Beep setting of the A/C. More...
void | setSwingV (const uint8_t setting)
| Set the vertical swing setting of the A/C. More...
uint8_t | getSwingV (void) const
| Get the vertical swing setting of the A/C. More...
void | setRaw (const uint8_t newState[])
| Set the internal state from a valid code for this protocol. More...
uint8_t * | getRaw (void)
| Get a PTR to the internal state/code for this protocol with all integrity checks passing. More...
uint16_t | getOffTimer (void) const
| Get the nr of minutes the Off Timer is set to. More...
void | setOffTimer (const uint16_t mins)
| Set the nr of minutes for the Off Timer. More...
stdAc::state_t | toCommon (void) const
| Convert the current internal state into its stdAc::state_t equivalent. More...
String | toString (void) const
| 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=kSanyoAcStateLength)
| 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 uint8_t | convertSwingV (const stdAc::swingv_t position)
| Convert a stdAc::swingv_t enum into it's native setting. 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...
static stdAc::swingv_t | toCommonSwingV (const uint8_t setting)
| Convert a native vertical swing postion to it's common equivalent. More...

## Private Member Functions

void | checksum (void)
| Calculate & set the checksum for the current internal state of the remote. More...

## Static Private Member Functions

static uint8_t | calcChecksum (const uint8_t state[], const uint16_t length=kSanyoAcStateLength)
| Calculate the checksum for a given state. More...

## Private Attributes

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

## Detailed Description

Class for handling detailed Sanyo A/C messages.

## Constructor & Destructor Documentation

## ◆ IRSanyoAc()

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

Set up hardware to be able to send a message.

## ◆ calcChecksum()

uint8_t IRSanyoAc::calcChecksum | ( | const uint8_t | state[],
|  | const uint16_t | length = `kSanyoAcStateLength`
| ) |  |

staticprivate

Calculate the checksum for a given state.

Parameters

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

Returns
  The calculated checksum value.

## ◆ calibrate()

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

private

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

## ◆ convertFan()

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

## ◆ convertSwingV()

uint8_t IRSanyoAc::convertSwingV | ( | const stdAc::swingv_t | position | ) |

static

Convert a stdAc::swingv_t enum into it's native setting.

Parameters

  [in] | position | The enum to be converted.

Returns
  The native equivalent of the enum.

## ◆ getBeep()

bool IRSanyoAc::getBeep | ( | void |  | ) | const

Get the Beep setting of the A/C.

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

## ◆ getFan()

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

Get the current fan speed setting.

Returns
  The current fan speed/mode.

## ◆ getMode()

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

Get the operating mode setting of the A/C.

Returns
  The current operating mode setting.

## ◆ getOffTimer()

uint16_t IRSanyoAc::getOffTimer | ( | void |  | ) | const

Get the nr of minutes the Off Timer is set to.

Returns
  The timer time expressed as the number of minutes. A value of 0 means the Off Timer is off/disabled.

Note
  The internal precission has a resolution of 1 hour.

## ◆ getPower()

bool IRSanyoAc::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 * IRSanyoAc::getRaw | ( | void |  | ) |

Get a PTR to the internal state/code for this protocol with all integrity checks passing.

Returns
  PTR to a code for this protocol based on the current internal state.

## ◆ getSensor()

bool IRSanyoAc::getSensor | ( | void |  | ) | const

Get the Sensor Location setting of the A/C. i.e. Where the ambient temperature is measured.

Returns
  true is Unit/Wall, false is Remote/Room.

## ◆ getSensorTemp()

uint8_t IRSanyoAc::getSensorTemp | ( | void |  | ) | const

Get the current sensor temperature setting.

Returns
  The current setting for temp. in degrees celsius.

## ◆ getSleep()

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

Get the Sleep (Night Setback) setting of the A/C.

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

## ◆ getSwingV()

uint8_t IRSanyoAc::getSwingV | ( | void |  | ) | const

Get the vertical swing setting of the A/C.

Returns
  The current swing mode setting.

## ◆ getTemp()

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

Get the current desired temperature setting.

Returns
  The current setting for temp. in degrees celsius.

## ◆ off()

void IRSanyoAc::off | ( | void |  | ) |

Set the requested power state of the A/C to off.

## ◆ on()

void IRSanyoAc::on | ( | void |  | ) |

Set the requested power state of the A/C to on.

## ◆ send()

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

Send the current internal state as IR messages.

Parameters

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

## ◆ setBeep()

void IRSanyoAc::setBeep | ( | const bool | on | ) |

Set the Beep setting of the A/C.

Parameters

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

## ◆ setFan()

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

Set the speed of the fan.

Parameters

  [in] | speed | The desired setting.

## ◆ setMode()

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

## ◆ setOffTimer()

void IRSanyoAc::setOffTimer | ( | const uint16_t | mins | ) |

Set the nr of minutes for the Off Timer.

Parameters

  [in] | mins | The timer time expressed as nr. of minutes. A value of 0 means the Off Timer is off/disabled.

Note
  The internal precission has a resolution of 1 hour.

## ◆ setPower()

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

Change the power setting.

Parameters

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

## ◆ setRaw()

void IRSanyoAc::setRaw | ( | const uint8_t | newState[] | ) |

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

Parameters

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

## ◆ setSensor()

void IRSanyoAc::setSensor | ( | const bool | location | ) |

Set the Sensor Location setting of the A/C. i.e. Where the ambient temperature is measured.

Parameters

  [in] | location | true is Unit/Wall, false is Remote/Room.

## ◆ setSensorTemp()

void IRSanyoAc::setSensorTemp | ( | const uint8_t | degrees | ) |

Set the sensor temperature.

Parameters

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

## ◆ setSleep()

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

Set the Sleep (Night Setback) setting of the A/C.

Parameters

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

## ◆ setSwingV()

void IRSanyoAc::setSwingV | ( | const uint8_t | setting | ) |

Set the vertical swing setting of the A/C.

Parameters

  [in] | setting | The value of the desired setting.

## ◆ setTemp()

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

Set the desired temperature.

Parameters

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

## ◆ stateReset()

void IRSanyoAc::stateReset | ( | void |  | ) |

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

See also
  https://docs.google.com/spreadsheets/d/1dYfLsnYvpjV-SgO8pdinpfuBIpSzm8Q1R5SabrLeskw/edit?ts=5f0190a5#gid=1050142776&range=A2:B2

## ◆ toCommon()

stdAc::state_t IRSanyoAc::toCommon | ( | void |  | ) | const

Convert the current internal state into its stdAc::state_t equivalent.

Returns
  The stdAc equivalent of the native settings.

## ◆ toCommonFanSpeed()

stdAc::fanspeed_t IRSanyoAc::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 IRSanyoAc::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.

## ◆ toCommonSwingV()

stdAc::swingv_t IRSanyoAc::toCommonSwingV | ( | const uint8_t | setting | ) |

static

Convert a native vertical swing postion to it's common equivalent.

Parameters

  [in] | setting | A native position to convert.

Returns
  The common vertical swing position.

## ◆ toString()

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

Convert the current internal state into a human readable string.

Returns
  A human readable string.

## ◆ validChecksum()

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

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

## ◆ _

SanyoProtocol IRSanyoAc::_

private

## ◆ _irsend

IRsend IRSanyoAc::_irsend

private

Instance of the IR send class.

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

- src/ir_Sanyo.h
- src/ir_Sanyo.cpp