IRremoteESP8266: IRLgAc Class Reference (original) (raw)
Class for handling detailed LG A/C messages. More...
#include <[ir_LG.h](ir%5F%5FLG%5F8h%5Fsource.html)>
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... | |
Class for handling detailed LG A/C messages.
IRLgAc::IRLgAc ( 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? |
◆ _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] | value | The 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] | state | The 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()
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()
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()
Convert a stdAc::swingv_t enum into it's native setting.
Parameters
[in] | swingv | The enum to be converted. |
---|
Returns
The native equivalent of the enum.
◆ convertVaneSwingV()
Convert a stdAc::swingv_t enum into it's native setting.
Parameters
[in] | swingv | The 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()
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] | raw | A 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()
Change the power setting to On.
◆ send()
Send the current internal state as an IR message.
Parameters
[in] | repeat | Nr. of times the message will be repeated. |
---|
◆ setFan()
void IRLgAc::setFan | ( | const uint8_t | speed | ) |
---|
Set the speed of the fan.
Parameters
[in] | speed | The desired setting. |
---|
◆ setLight()
void IRLgAc::setLight | ( | const bool | on | ) |
---|
Change the light/led/display setting.
Parameters
[in] | on | true, 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] | mode | The desired operating mode. |
---|
◆ setModel()
Set the model of the A/C to emulate.
Parameters
[in] | model | The enum of the appropriate model. |
---|
◆ setPower()
void IRLgAc::setPower | ( | const bool | on | ) |
---|
Change the power setting.
Parameters
[in] | on | true, the setting is on. false, the setting is off. |
---|
◆ setRaw()
Set the internal state from a valid code for this protocol.
Parameters
[in] | new_code | A valid code for this protocol. |
---|---|---|
[in] | protocol | A valid decode protocol type to use. |
◆ setSwingH()
void IRLgAc::setSwingH | ( | const bool | on | ) |
---|
Set the Horizontal Swing mode of the A/C.
Parameters
[in] | on | true, 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] | position | The position/mode to set the vanes to. |
---|
◆ setTemp()
void IRLgAc::setTemp | ( | const uint8_t | degrees | ) |
---|
Set the temperature.
Parameters
[in] | degrees | The 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] | vane | The nr. of the vane to control. |
---|---|---|
[in] | position | The position/mode to set the vanes to. |
◆ stateReset()
void IRLgAc::stateReset | ( | void | ) |
---|
Reset the internals of the object to a known good state.
◆ toCommon()
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()
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()
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()
Convert a native Vertical Swing into its stdAc equivalent.
Parameters
[in] | code | The native code to be converted. |
---|
Returns
The stdAc equivalent of the native setting.
◆ toCommonVaneSwingV()
Convert a native Vane specific Vertical Swing into its stdAc equivalent.
Parameters
[in] | pos | The 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] | state | The value to verify the checksum of. |
---|
Returns
true, if the state has a valid checksum. Otherwise, false.
◆ _
◆ _irsend
Instance of the IR send class.
◆ _light
◆ _model
◆ _protocol
◆ _swingh
◆ _swingh_prev
bool IRLgAc::_swingh_prev | private |
---|
◆ _swingv
◆ _swingv_prev
uint32_t IRLgAc::_swingv_prev | private |
---|
◆ _temp
◆ _vaneswingv
◆ _vaneswingv_prev
The documentation for this class was generated from the following files: