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)
 Check if the internal state looks like a valud 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)
 Get the value of the current power setting. More...
 
void setTemp (const uint8_t degrees)
 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...
 
uint32_t getRaw (void)
 Get a copy of the internal state/code for this protocol. More...
 
void setRaw (const uint32_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...
 
stdAc::state_t toCommon (void)
 Convert the current internal state into its stdAc::state_t equivilant. More...
 
String toString (void)
 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)
 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 stdAc::opmode_t toCommonMode (const uint8_t mode)
 Convert a native mode into its stdAc equivilant. More...
 
static stdAc::fanspeed_t toCommonFanSpeed (const uint8_t speed)
 Convert a native fan speed into its stdAc equivilant. More...
 
static uint8_t convertFan (const stdAc::fanspeed_t speed)
 Convert a stdAc::fanspeed_t enum into it's native speed. 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...
 

Private Attributes

IRsend _irsend
 Instance of the IR send class. More...
 
uint32_t remote_state
 The state of the IR remote in IR code form. More...
 
uint8_t _temp
 
decode_type_t _protocol
 

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

◆ _setTemp()

void IRLgAc::_setTemp ( const uint8_t  value)
private

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.

◆ 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 equivilant of the enum.

◆ convertMode()

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

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

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

◆ getFan()

uint8_t IRLgAc::getFan ( void  )

Get the current fan speed setting.

Returns
The current fan speed.

◆ getMode()

uint8_t IRLgAc::getMode ( void  )

Get the operating mode setting of the A/C.

Returns
The current operating mode setting.

◆ getModel()

lg_ac_remote_model_t IRLgAc::getModel ( void  )

Get the model of the A/C.

Returns
The enum of the compatible model.

◆ getPower()

bool IRLgAc::getPower ( void  )

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.

◆ getTemp()

uint8_t IRLgAc::getTemp ( void  )

Get the current temperature setting.

Returns
The current setting for temp. in degrees celsius.

◆ isValidLgAc()

bool IRLgAc::isValidLgAc ( void  )

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

Returns
true, the internal state is a valid LG A/C mesg. 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.

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

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

Parameters
[in]new_codeA valid code for this protocol.

◆ setTemp()

void IRLgAc::setTemp ( const uint8_t  degrees)

Set the temperature.

Parameters
[in]degreesThe temperature in degrees celsius.

◆ stateReset()

void IRLgAc::stateReset ( void  )

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

◆ toCommon()

stdAc::state_t IRLgAc::toCommon ( void  )

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

Returns
The stdAc equivilant of the native settings.

◆ toCommonFanSpeed()

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

Convert a native fan speed into its stdAc equivilant.

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

◆ toCommonMode()

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

Convert a native mode into its stdAc equivilant.

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

◆ toString()

String IRLgAc::toString ( void  )

Convert the current internal state into a human readable string.

Returns
A human readable string.

◆ 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

◆ _irsend

IRsend IRLgAc::_irsend
private

Instance of the IR send class.

◆ _protocol

decode_type_t IRLgAc::_protocol
private

◆ _temp

uint8_t IRLgAc::_temp
private

◆ remote_state

uint32_t IRLgAc::remote_state
private

The state of the IR remote in IR code form.


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