IRremoteESP8266
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
IRKelon168Ac Class Reference

#include <ir_Kelon.h>

Collaboration diagram for IRKelon168Ac:
Collaboration graph
[legend]

Public Member Functions

 IRKelon168Ac (uint16_t pin, bool inverted=false, bool use_modulation=true)
 Class constructor.
 
void send (const uint16_t repeat=kKelon168DefaultRepeat, const bool calcChecksum=true)
 Send the current internal state as an IR message.
 
int8_t calibrate (void)
 Run the calibration to calculate uSec timing offsets for this platform.
 
void begin (void)
 Set up hardware to be able to send a message.
 
void stateReset (void)
 Reset the state of the remote to a known good state/sequence.
 
void setPower (const bool on)
 Change the power setting.
 
bool getPower (void) const
 Get the value of the current power toggle setting.
 
void setSleep (const bool on)
 Set the Sleep setting of the A/C.
 
bool getSleep (void) const
 Get the Sleep setting of the A/C.
 
void setSuper (const bool on)
 Set the Super (Turbo/Jet) setting of the A/C.
 
bool getSuper (void) const
 Get the Super (Turbo/Jet) setting of the A/C.
 
void setTemp (const uint8_t temp)
 Set the temperature.
 
uint8_t getTemp (void) const
 Get the current temperature setting.
 
void setFan (const uint8_t speed)
 Set the speed of the fan.
 
uint8_t getFan (void) const
 Get the current fan speed setting. The encoding is distributed across two bits, middle values (2 Low & 4 High) are encoded on the Fan2 bit. Normal values (1 Minimum, 3 Medium, 5 High) are written as 3,2,1 (inverted scale)
 
void setMode (const uint8_t mode)
 Set the operating mode of the A/C.
 
uint8_t getMode (void) const
 Get the operating mode setting of the A/C.
 
void setSwing (const bool on)
 Set the (vertical) swing setting of the A/C.
 
bool getSwing (void) const
 Get the (vertical) swing setting of the A/C.
 
void setLight (const bool on)
 Set the Light (Display/LED) setting of the A/C.
 
bool getLight (void) const
 Get the Light (Display/LED) setting of the A/C.
 
uint16_t getClock (void) const
 Get the clock time in nr. of minutes past midnight.
 
void setClock (const uint16_t minsPastMidight)
 Set the clock time in nr. of minutes past midnight.
 
uint16_t getOnTimer (void) const
 Get the On Timer time..
 
void setOnTimer (const uint16_t minsPastMidight)
 Set the On Timer time.
 
void enableOnTimer (const bool on)
 Enable the On Timer.
 
bool isOnTimerEnabled (void) const
 Is the On timer enabled?
 
uint16_t getOffTimer (void) const
 Get the Off Timer time..
 
void setOffTimer (const uint16_t minsPastMidight)
 Set the Off Timer time.
 
void enableOffTimer (const bool on)
 Enable the Off Timer.
 
bool isOffTimerEnabled (void) const
 Is the Off timer enabled?
 
void setCommand (const uint8_t code)
 Set the Command (Button) setting of the A/C.
 
uint8_t getCommand (void) const
 Get the Command (Button) setting of the A/C.
 
kelon168_ac_remote_model_t getModel (void) const
 Get/Detect the model of the A/C. Actually only one remote type is supported.
 
void setModel (const kelon168_ac_remote_model_t model)
 Set the model of the A/C to emulate.
 
uint8_t * getRaw (const bool calcChecksum=true)
 Get a copy of the internal state/code for this protocol.
 
void setRaw (const uint8_t newCode[], const uint16_t length=kKelon168StateLength)
 Set the internal state from a valid code for this protocol.
 
stdAc::state_t toCommon (const stdAc::state_t *prev=NULL) const
 Convert the current internal state into its stdAc::state_t equivalent.
 
String toString (void) const
 Convert the current internal state into a human readable string.
 

Static Public Member Functions

static bool validChecksum (const uint8_t state[], const uint16_t length=kKelon168StateLength)
 Verify the checksum is valid for a given state.
 
static uint8_t convertMode (const stdAc::opmode_t mode)
 Convert a stdAc::opmode_t enum into its native mode.
 
static uint8_t convertFan (const stdAc::fanspeed_t speed)
 Convert a stdAc::fanspeed_t enum into it's native speed.
 
static stdAc::opmode_t toCommonMode (const uint8_t mode)
 Convert a native mode into its stdAc equivalent.
 
static stdAc::fanspeed_t toCommonFanSpeed (const uint8_t speed)
 Convert a native fan speed into its stdAc equivalent.
 

Private Member Functions

void checksum (const uint16_t length=kWhirlpoolAcStateLength)
 Calculate & set the checksum for the current internal state of the remote.
 
void _setTemp (const uint8_t temp, const bool remember=true)
 Set the temperature.
 
void _setMode (const uint8_t mode)
 Set the operating mode of the A/C.
 
int8_t getTempOffset (void) const
 Calculate the temp. offset in deg C for the current model. Actually not used, but left for eventual support.
 

Private Attributes

IRsend _irsend
 Instance of the IR send class.
 
Kelon168Protocol _
 
uint8_t _desiredtemp
 The last user explicitly set temperature.
 

Constructor & Destructor Documentation

◆ IRKelon168Ac()

IRKelon168Ac::IRKelon168Ac ( uint16_t  pin,
bool  inverted = false,
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

◆ _setMode()

void IRKelon168Ac::_setMode ( const uint8_t  mode)
private

Set the operating mode of the A/C.

Parameters
[in]modeThe desired operating mode.
Note
Internal use only.

◆ _setTemp()

void IRKelon168Ac::_setTemp ( const uint8_t  temp,
const bool  remember = true 
)
private

Set the temperature.

Parameters
[in]tempThe temperature in degrees celsius.
[in]rememberDo we save this temperature?
Note
Internal use only.

◆ begin()

void IRKelon168Ac::begin ( void  )

Set up hardware to be able to send a message.

◆ calibrate()

int8_t IRKelon168Ac::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 IRKelon168Ac::checksum ( const uint16_t  length = kWhirlpoolAcStateLength)
private

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

Parameters
[in]lengthThe length/size of the internal state array.

◆ convertFan()

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

◆ enableOffTimer()

void IRKelon168Ac::enableOffTimer ( const bool  on)

Enable the Off Timer.

Parameters
[in]ontrue, the timer is enabled. false, the timer is disabled.

◆ enableOnTimer()

void IRKelon168Ac::enableOnTimer ( const bool  on)

Enable the On Timer.

Parameters
[in]ontrue, the timer is enabled. false, the timer is disabled.

◆ getClock()

uint16_t IRKelon168Ac::getClock ( void  ) const

Get the clock time in nr. of minutes past midnight.

Returns
The time expressed as the Nr. of minutes past midnight.

◆ getCommand()

uint8_t IRKelon168Ac::getCommand ( void  ) const

Get the Command (Button) setting of the A/C.

Returns
The current Command (Button) of the A/C.

◆ getFan()

uint8_t IRKelon168Ac::getFan ( void  ) const

Get the current fan speed setting. The encoding is distributed across two bits, middle values (2 Low & 4 High) are encoded on the Fan2 bit. Normal values (1 Minimum, 3 Medium, 5 High) are written as 3,2,1 (inverted scale)

Returns
The current fan speed/mode.

◆ getLight()

bool IRKelon168Ac::getLight ( void  ) const

Get the Light (Display/LED) setting of the A/C.

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

◆ getMode()

uint8_t IRKelon168Ac::getMode ( void  ) const

Get the operating mode setting of the A/C.

Returns
The current operating mode setting.

◆ getModel()

kelon168_ac_remote_model_t IRKelon168Ac::getModel ( void  ) const

Get/Detect the model of the A/C. Actually only one remote type is supported.

Returns
The enum of the compatible model.

◆ getOffTimer()

uint16_t IRKelon168Ac::getOffTimer ( void  ) const

Get the Off Timer time..

Returns
The time expressed as the Nr. of minutes past midnight.

◆ getOnTimer()

uint16_t IRKelon168Ac::getOnTimer ( void  ) const

Get the On Timer time..

Returns
The time expressed as the Nr. of minutes past midnight.

◆ getPower()

bool IRKelon168Ac::getPower ( void  ) const

Get the value of the current power toggle setting.

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

◆ getRaw()

uint8_t * IRKelon168Ac::getRaw ( const bool  calcChecksum = true)

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

Parameters
[in]calcChecksumDo we need to calculate the checksum?.
Returns
A code for this protocol based on the current internal state.

◆ getSleep()

bool IRKelon168Ac::getSleep ( void  ) const

Get the Sleep setting of the A/C.

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

◆ getSuper()

bool IRKelon168Ac::getSuper ( void  ) const

Get the Super (Turbo/Jet) setting of the A/C.

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

◆ getSwing()

bool IRKelon168Ac::getSwing ( 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 IRKelon168Ac::getTemp ( void  ) const

Get the current temperature setting.

Returns
The current setting for temp. in degrees celsius.

◆ getTempOffset()

int8_t IRKelon168Ac::getTempOffset ( void  ) const
private

Calculate the temp. offset in deg C for the current model. Actually not used, but left for eventual support.

Returns
The temperature offset.

◆ isOffTimerEnabled()

bool IRKelon168Ac::isOffTimerEnabled ( void  ) const

Is the Off timer enabled?

Returns
true, the Timer is enabled. false, the Timer is disabled.

◆ isOnTimerEnabled()

bool IRKelon168Ac::isOnTimerEnabled ( void  ) const

Is the On timer enabled?

Returns
true, the Timer is enabled. false, the Timer is disabled.

◆ send()

void IRKelon168Ac::send ( const uint16_t  repeat = kKelon168DefaultRepeat,
const bool  calcChecksum = true 
)

Send the current internal state as an IR message.

Parameters
[in]repeatNr. of times the message will be repeated.
[in]calcChecksumDo we need to calculate the checksum?.

◆ setClock()

void IRKelon168Ac::setClock ( const uint16_t  minsPastMidnight)

Set the clock time in nr. of minutes past midnight.

Parameters
[in]minsPastMidnightThe time expressed as minutes past midnight.

◆ setCommand()

void IRKelon168Ac::setCommand ( const uint8_t  code)

Set the Command (Button) setting of the A/C.

Parameters
[in]codeThe current Command (Button) of the A/C.

◆ setFan()

void IRKelon168Ac::setFan ( const uint8_t  speed)

Set the speed of the fan.

Parameters
[in]speedThe desired setting.

◆ setLight()

void IRKelon168Ac::setLight ( const bool  on)

Set the Light (Display/LED) setting of the A/C.

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

◆ setMode()

void IRKelon168Ac::setMode ( const uint8_t  mode)

Set the operating mode of the A/C.

Parameters
[in]modeThe desired operating mode.

◆ setModel()

void IRKelon168Ac::setModel ( const kelon168_ac_remote_model_t  model)

Set the model of the A/C to emulate.

Parameters
[in]modelThe enum of the appropriate model.

◆ setOffTimer()

void IRKelon168Ac::setOffTimer ( const uint16_t  minsPastMidnight)

Set the Off Timer time.

Parameters
[in]minsPastMidnightThe time expressed as minutes past midnight.

◆ setOnTimer()

void IRKelon168Ac::setOnTimer ( const uint16_t  minsPastMidnight)

Set the On Timer time.

Parameters
[in]minsPastMidnightThe time expressed as minutes past midnight.

◆ setPower()

void IRKelon168Ac::setPower ( const bool  on)

Change the power setting.

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

◆ setRaw()

void IRKelon168Ac::setRaw ( const uint8_t  newCode[],
const uint16_t  length = kKelon168StateLength 
)

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

Parameters
[in]newCodeA valid code for this protocol.
[in]lengthThe length/size of the newCode array.

◆ setSleep()

void IRKelon168Ac::setSleep ( const bool  on)

Set the Sleep setting of the A/C.

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

◆ setSuper()

void IRKelon168Ac::setSuper ( const bool  on)

Set the Super (Turbo/Jet) setting of the A/C.

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

◆ setSwing()

void IRKelon168Ac::setSwing ( const bool  on)

Set the (vertical) swing setting of the A/C.

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

◆ setTemp()

void IRKelon168Ac::setTemp ( const uint8_t  temp)

Set the temperature.

Parameters
[in]tempThe temperature in degrees celsius.

◆ stateReset()

void IRKelon168Ac::stateReset ( void  )

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

◆ toCommon()

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

◆ toString()

String IRKelon168Ac::toString ( void  ) const

Convert the current internal state into a human readable string.

Returns
A human readable string.

◆ validChecksum()

bool IRKelon168Ac::validChecksum ( const uint8_t  state[],
const uint16_t  length = kKelon168StateLength 
)
static

Verify the checksum is valid for a given state.

Parameters
[in]stateThe array to verify the checksum of.
[in]lengthThe length/size of the array.
Returns
true, if the state has a valid checksum. Otherwise, false.

Member Data Documentation

◆ _

Kelon168Protocol IRKelon168Ac::_
private

◆ _desiredtemp

uint8_t IRKelon168Ac::_desiredtemp
private

The last user explicitly set temperature.

◆ _irsend

IRsend IRKelon168Ac::_irsend
private

Instance of the IR send class.


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