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

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

#include <ir_LG.h>

Collaboration diagram for IRLgAc:
Collaboration graph
[legend]

Public Member Functions

 IRLgAc (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...
 
bool isValidLgAc (void) const
 Check if the internal state looks like a valid LG A/C message. More...
 
void send (const uint16_t repeat=kLgDefaultRepeat)
 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)
 Change the power setting to On. More...
 
void off (void)
 Change the power setting 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...
 
bool isOffCommand (void) const
 Is the message a Power Off message? More...
 
void setTemp (const uint8_t degrees)
 Set the temperature. 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 operating mode of the A/C. More...
 
uint8_t getMode (void) const
 Get the operating mode setting of the A/C. More...
 
void setLight (const bool on)
 Change the light/led/display setting. More...
 
bool getLight (void) const
 Get the value of the current light setting. More...
 
bool isLightToggle (void) const
 Is the message a Light Toggle message? More...
 
bool isSwing (void) const
 Check if the stored code is a Swing message. More...
 
void setSwingH (const bool on)
 Set the Horizontal Swing mode of the A/C. More...
 
bool getSwingH (void) const
 Get the Horizontal Swing position setting of the A/C. More...
 
bool isSwingV (void) const
 Check if the stored code is a non-vane SwingV message. More...
 
bool isSwingVToggle (void) const
 Check if the stored code is a SwingV Toggle message. More...
 
bool isVaneSwingV (void) const
 Check if the stored code is a vane specific SwingV message. More...
 
void setSwingV (const uint32_t position)
 Set the Vertical Swing mode of the A/C. More...
 
uint32_t getSwingV (void) const
 Get the Vertical Swing position setting of the A/C. More...
 
void setVaneSwingV (const uint8_t vane, const uint8_t position)
 Set the per Vane Vertical Swing mode of the A/C. More...
 
uint8_t getVaneSwingV (const uint8_t vane) const
 Get the Vertical Swing position for the given vane of the A/C. More...
 
bool isSwingH (void) const
 Check if the stored code is a SwingH message. More...
 
void updateSwingPrev (void)
 
uint32_t getRaw (void)
 Get a copy of the internal state/code for this protocol. More...
 
void setRaw (const uint32_t new_code, const decode_type_t protocol=decode_type_t::UNKNOWN)
 Set the internal state from a valid code for this protocol. More...
 
stdAc::state_t toCommon (const stdAc::state_t *prev=NULL) 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...
 
void setModel (const lg_ac_remote_model_t model)
 Set the model of the A/C to emulate. More...
 
lg_ac_remote_model_t getModel (void) const
 Get the model of the A/C. More...
 

Static Public Member Functions

static uint8_t calcChecksum (const uint32_t state)
 Calculate the checksum for a given state. More...
 
static bool validChecksum (const uint32_t state)
 Verify the checksum is valid for a given state. More...
 
static uint32_t calcVaneSwingV (const uint8_t vane, const uint8_t position)
 Calculate the Vane specific Vertical Swing code for the A/C. More...
 
static uint8_t getVaneCode (const uint32_t raw)
 Get the vane code of a Vane Vertical Swing message. More...
 
static uint8_t convertMode (const stdAc::opmode_t mode)
 Convert a stdAc::opmode_t enum into its native mode. 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 uint32_t code)
 Convert a native Vertical Swing into its stdAc equivalent. More...
 
static stdAc::swingv_t toCommonVaneSwingV (const uint8_t pos)
 Convert a native Vane specific Vertical Swing into its stdAc equivalent. More...
 
static uint8_t convertFan (const stdAc::fanspeed_t speed)
 Convert a stdAc::fanspeed_t enum into it's native speed. More...
 
static uint32_t convertSwingV (const stdAc::swingv_t swingv)
 Convert a stdAc::swingv_t enum into it's native setting. More...
 
static uint8_t convertVaneSwingV (const stdAc::swingv_t swingv)
 Convert a stdAc::swingv_t enum into it's native setting. More...
 

Private Member Functions

void checksum (void)
 Calculate and set the checksum values for the internal state. More...
 
void _setTemp (const uint8_t value)
 Set the temperature. More...
 
bool _isAKB74955603 (void) const
 Check if the stored code must belong to a AKB74955603 model. More...
 
bool _isAKB73757604 (void) const
 Check if the stored code must belong to a AKB73757604 model. More...
 
bool _isLG6711A20083V (void) const
 Check if the stored code must belong to a LG6711A20083V model. More...
 
bool _isNormal (void) const
 Is the current message a normal (non-special) message? More...
 

Private Attributes

IRsend _irsend
 Instance of the IR send class. More...
 
LGProtocol _
 
uint8_t _temp
 
bool _light
 
uint32_t _swingv
 
uint32_t _swingv_prev
 
uint8_t _vaneswingv [kLgAcSwingVMaxVanes]
 
uint8_t _vaneswingv_prev [kLgAcSwingVMaxVanes]
 
bool _swingh
 
bool _swingh_prev
 
decode_type_t _protocol
 Protocol version. More...
 
lg_ac_remote_model_t _model
 Model type. More...
 

Detailed Description

Class for handling detailed LG A/C messages.

Constructor & Destructor Documentation

◆ IRLgAc()

IRLgAc::IRLgAc ( const uint16_t  pin,
const bool  inverted = false,
const bool  use_modulation = true 
)
explicit

Class constructor.

Parameters
[in]pinGPIO to be used when sending.
[in]invertedIs the output signal to be inverted?
[in]use_modulationIs frequency modulation to be used?

Member Function Documentation

◆ _isAKB73757604()

bool IRLgAc::_isAKB73757604 ( void  ) const
private

Check if the stored code must belong to a AKB73757604 model.

Returns
true, if it is AKB73757604 message. Otherwise, false.
Note
Internal use only.

◆ _isAKB74955603()

bool IRLgAc::_isAKB74955603 ( void  ) const
private

Check if the stored code must belong to a AKB74955603 model.

Returns
true, if it is AKB74955603 message. Otherwise, false.
Note
Internal use only.

◆ _isLG6711A20083V()

bool IRLgAc::_isLG6711A20083V ( void  ) const
private

Check if the stored code must belong to a LG6711A20083V model.

Returns
true, if it is LG6711A20083V message. Otherwise, false.
Note
Internal use only.

◆ _isNormal()

bool IRLgAc::_isNormal ( void  ) const
private

Is the current message a normal (non-special) message?

Returns
True, if it is a normal message, False, if it is special.

◆ _setTemp()

void IRLgAc::_setTemp ( const uint8_t  value)
inlineprivate

Set the temperature.

Parameters
[in]valueThe native temperature.
Note
Internal use only.

◆ begin()

void IRLgAc::begin ( void  )

Set up hardware to be able to send a message.

◆ calcChecksum()

uint8_t IRLgAc::calcChecksum ( const uint32_t  state)
static

Calculate the checksum for a given state.

Parameters
[in]stateThe value to calc the checksum of.
Returns
The calculated checksum value.

◆ calcVaneSwingV()

uint32_t IRLgAc::calcVaneSwingV ( const uint8_t  vane,
const uint8_t  position 
)
static

Calculate the Vane specific Vertical Swing code for the A/C.

Returns
The native raw code.

◆ calibrate()

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

Calculate and set the checksum values for the internal state.

◆ convertFan()

uint8_t IRLgAc::convertFan ( const stdAc::fanspeed_t  speed)
static

Convert a stdAc::fanspeed_t enum into it's native speed.

Parameters
[in]speedThe enum to be converted.
Returns
The native equivalent of the enum.

◆ convertMode()

uint8_t IRLgAc::convertMode ( const stdAc::opmode_t  mode)
static

Convert a stdAc::opmode_t enum into its native mode.

Parameters
[in]modeThe enum to be converted.
Returns
The native equivalent of the enum.

◆ convertSwingV()

uint32_t IRLgAc::convertSwingV ( const stdAc::swingv_t  swingv)
static

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

Parameters
[in]swingvThe enum to be converted.
Returns
The native equivalent of the enum.

◆ convertVaneSwingV()

uint8_t IRLgAc::convertVaneSwingV ( const stdAc::swingv_t  swingv)
static

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

Parameters
[in]swingvThe enum to be converted.
Returns
The native equivalent of the enum.

◆ getFan()

uint8_t IRLgAc::getFan ( void  ) const

Get the current fan speed setting.

Returns
The current fan speed.

◆ getLight()

bool IRLgAc::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 IRLgAc::getMode ( void  ) const

Get the operating mode setting of the A/C.

Returns
The current operating mode setting.

◆ getModel()

lg_ac_remote_model_t IRLgAc::getModel ( void  ) const

Get the model of the A/C.

Returns
The enum of the compatible model.

◆ getPower()

bool IRLgAc::getPower ( void  ) const

Get the value of the current power setting.

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

◆ getRaw()

uint32_t IRLgAc::getRaw ( void  )

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

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

◆ getSwingH()

bool IRLgAc::getSwingH ( void  ) const

Get the Horizontal Swing position setting of the A/C.

Returns
true, if it is. Otherwise, false.

◆ getSwingV()

uint32_t IRLgAc::getSwingV ( void  ) const

Get the Vertical Swing position setting of the A/C.

Returns
The native position/mode.

◆ getTemp()

uint8_t IRLgAc::getTemp ( void  ) const

Get the current temperature setting.

Returns
The current setting for temp. in degrees celsius.

◆ getVaneCode()

uint8_t IRLgAc::getVaneCode ( const uint32_t  raw)
static

Get the vane code of a Vane Vertical Swing message.

Parameters
[in]rawA raw number representing a native LG message.
Returns
A number containing just the vane nr, and the position.

◆ getVaneSwingV()

uint8_t IRLgAc::getVaneSwingV ( const uint8_t  vane) const

Get the Vertical Swing position for the given vane of the A/C.

Returns
The native position/mode.

◆ isLightToggle()

bool IRLgAc::isLightToggle ( void  ) const

Is the message a Light Toggle message?

Returns
true, if it is. false, if not.

◆ isOffCommand()

bool IRLgAc::isOffCommand ( void  ) const

Is the message a Power Off message?

Returns
true, if it is. false, if not.

◆ isSwing()

bool IRLgAc::isSwing ( void  ) const

Check if the stored code is a Swing message.

Returns
true, if it is. Otherwise, false.

◆ isSwingH()

bool IRLgAc::isSwingH ( void  ) const

Check if the stored code is a SwingH message.

Returns
true, if it is. Otherwise, false.

◆ isSwingV()

bool IRLgAc::isSwingV ( void  ) const

Check if the stored code is a non-vane SwingV message.

Returns
true, if it is. Otherwise, false.

◆ isSwingVToggle()

bool IRLgAc::isSwingVToggle ( void  ) const

Check if the stored code is a SwingV Toggle message.

Returns
true, if it is. Otherwise, false.

◆ isValidLgAc()

bool IRLgAc::isValidLgAc ( void  ) const

Check if the internal state looks like a valid LG A/C message.

Returns
true, the internal state is a valid LG A/C mesg. Otherwise, false.

◆ isVaneSwingV()

bool IRLgAc::isVaneSwingV ( void  ) const

Check if the stored code is a vane specific SwingV message.

Returns
true, if it is. Otherwise, false.

◆ off()

void IRLgAc::off ( void  )

Change the power setting to Off.

◆ on()

void IRLgAc::on ( void  )

Change the power setting to On.

◆ send()

void IRLgAc::send ( const uint16_t  repeat = kLgDefaultRepeat)

Send the current internal state as an IR message.

Parameters
[in]repeatNr. of times the message will be repeated.

◆ setFan()

void IRLgAc::setFan ( const uint8_t  speed)

Set the speed of the fan.

Parameters
[in]speedThe desired setting.

◆ setLight()

void IRLgAc::setLight ( const bool  on)

Change the light/led/display setting.

Parameters
[in]ontrue, the setting is on. false, the setting is off.

◆ setMode()

void IRLgAc::setMode ( const uint8_t  mode)

Set the operating mode of the A/C.

Parameters
[in]modeThe desired operating mode.

◆ setModel()

void IRLgAc::setModel ( const lg_ac_remote_model_t  model)

Set the model of the A/C to emulate.

Parameters
[in]modelThe enum of the appropriate model.

◆ setPower()

void IRLgAc::setPower ( const bool  on)

Change the power setting.

Parameters
[in]ontrue, the setting is on. false, the setting is off.

◆ setRaw()

void IRLgAc::setRaw ( const uint32_t  new_code,
const decode_type_t  protocol = decode_type_t::UNKNOWN 
)

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

Parameters
[in]new_codeA valid code for this protocol.
[in]protocolA valid decode protocol type to use.

◆ setSwingH()

void IRLgAc::setSwingH ( const bool  on)

Set the Horizontal Swing mode of the A/C.

Parameters
[in]ontrue, the setting is on. false, the setting is off.

◆ setSwingV()

void IRLgAc::setSwingV ( const uint32_t  position)

Set the Vertical Swing mode of the A/C.

Parameters
[in]positionThe position/mode to set the vanes to.

◆ setTemp()

void IRLgAc::setTemp ( const uint8_t  degrees)

Set the temperature.

Parameters
[in]degreesThe temperature in degrees celsius.

◆ setVaneSwingV()

void IRLgAc::setVaneSwingV ( const uint8_t  vane,
const uint8_t  position 
)

Set the per Vane Vertical Swing mode of the A/C.

Parameters
[in]vaneThe nr. of the vane to control.
[in]positionThe position/mode to set the vanes to.

◆ stateReset()

void IRLgAc::stateReset ( void  )

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

◆ toCommon()

stdAc::state_t IRLgAc::toCommon ( const stdAc::state_t prev = NULL) const

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

Parameters
[in]prevPtr to the previous state if required.
Returns
The stdAc equivalent of the native settings.

◆ toCommonFanSpeed()

stdAc::fanspeed_t IRLgAc::toCommonFanSpeed ( const uint8_t  speed)
static

Convert a native fan speed into its stdAc equivalent.

Parameters
[in]speedThe native setting to be converted.
Returns
The stdAc equivalent of the native setting.

◆ toCommonMode()

stdAc::opmode_t IRLgAc::toCommonMode ( const uint8_t  mode)
static

Convert a native mode into its stdAc equivalent.

Parameters
[in]modeThe native setting to be converted.
Returns
The stdAc equivalent of the native setting.

◆ toCommonSwingV()

stdAc::swingv_t IRLgAc::toCommonSwingV ( const uint32_t  code)
static

Convert a native Vertical Swing into its stdAc equivalent.

Parameters
[in]codeThe native code to be converted.
Returns
The stdAc equivalent of the native setting.

◆ toCommonVaneSwingV()

stdAc::swingv_t IRLgAc::toCommonVaneSwingV ( const uint8_t  pos)
static

Convert a native Vane specific Vertical Swing into its stdAc equivalent.

Parameters
[in]posThe native position to be converted.
Returns
The stdAc equivalent of the native setting.

◆ toString()

String IRLgAc::toString ( void  ) const

Convert the current internal state into a human readable string.

Returns
A human readable string.

◆ updateSwingPrev()

void IRLgAc::updateSwingPrev ( void  )

◆ validChecksum()

bool IRLgAc::validChecksum ( const uint32_t  state)
static

Verify the checksum is valid for a given state.

Parameters
[in]stateThe value to verify the checksum of.
Returns
true, if the state has a valid checksum. Otherwise, false.

Member Data Documentation

◆ _

LGProtocol IRLgAc::_
private

◆ _irsend

IRsend IRLgAc::_irsend
private

Instance of the IR send class.

◆ _light

bool IRLgAc::_light
private

◆ _model

lg_ac_remote_model_t IRLgAc::_model
private

Model type.

◆ _protocol

decode_type_t IRLgAc::_protocol
private

Protocol version.

◆ _swingh

bool IRLgAc::_swingh
private

◆ _swingh_prev

bool IRLgAc::_swingh_prev
private

◆ _swingv

uint32_t IRLgAc::_swingv
private

◆ _swingv_prev

uint32_t IRLgAc::_swingv_prev
private

◆ _temp

uint8_t IRLgAc::_temp
private

◆ _vaneswingv

uint8_t IRLgAc::_vaneswingv[kLgAcSwingVMaxVanes]
private

◆ _vaneswingv_prev

uint8_t IRLgAc::_vaneswingv_prev[kLgAcSwingVMaxVanes]
private

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