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

Class for handling detailed Mirage 120-bit A/C messages. More...

#include <ir_Mirage.h>

Collaboration diagram for IRMirageAc:
Collaboration graph
[legend]

Public Member Functions

 IRMirageAc (const uint16_t pin, const bool inverted=false, const bool use_modulation=true)
 Class constructor.
 
void stateReset (void)
 Reset the state of the remote to a known good state/sequence.
 
void send (const uint16_t repeat=kMirageMinRepeat)
 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 on (void)
 Set the requested power state of the A/C to on.
 
void off (void)
 Set the requested power state of the A/C to off.
 
void setPower (const bool on)
 Change the power setting.
 
bool getPower (void) const
 Get the value of the current power setting.
 
void setTemp (const uint8_t degrees)
 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.
 
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.
 
uint8_t * getRaw (void)
 Get a PTR to the internal state/code for this protocol.
 
void setRaw (const uint8_t *data)
 Set the internal state from a valid code for this protocol.
 
uint32_t getClock (void) const
 Get the clock time of the A/C unit.
 
void setClock (const uint32_t nr_of_seconds)
 Set the clock time on the A/C unit.
 
void setTurbo (const bool on)
 Change the Turbo setting.
 
bool getTurbo (void) const
 Get the value of the current Turbo setting.
 
void setLight (const bool on)
 Change the Light/Display setting.
 
bool getLight (void) const
 Get the value of the current Light/Display setting.
 
void setSleep (const bool on)
 Change the Sleep setting.
 
bool getSleep (void) const
 Get the value of the current Sleep setting.
 
void setSwingV (const uint8_t position)
 Set the Vertical Swing setting/position of the A/C.
 
uint8_t getSwingV (void) const
 Get the Vertical Swing setting/position of the A/C.
 
void setSwingH (const bool on)
 Set the Horizontal Swing setting of the A/C.
 
bool getSwingH (void) const
 Get the Horizontal Swing setting of the A/C.
 
void setQuiet (const bool on)
 Set the Quiet setting of the A/C.
 
bool getQuiet (void) const
 Get the Quiet setting of the A/C.
 
void setCleanToggle (const bool on)
 Set the CleanToggle setting of the A/C.
 
bool getCleanToggle (void) const
 Get the Clean Toggle setting of the A/C.
 
void setFilter (const bool on)
 Set the Filter setting of the A/C.
 
bool getFilter (void) const
 Get the Filter setting of the A/C.
 
void setIFeel (const bool on)
 Set the IFeel setting of the A/C.
 
bool getIFeel (void) const
 Get the IFeel setting of the A/C.
 
void setSensorTemp (const uint8_t degrees)
 Set the Sensor Temp setting of the A/C's remote.
 
uint16_t getSensorTemp (void) const
 Get the Sensor Temp setting of the A/C's remote.
 
uint16_t getOnTimer (void) const
 Get the number of minutes the On Timer is currently set for.
 
uint16_t getOffTimer (void) const
 Get the number of minutes the Off Timer is currently set for.
 
void setOnTimer (const uint16_t nr_of_mins)
 Set the number of minutes for the On Timer.
 
void setOffTimer (const uint16_t nr_of_mins)
 Set the number of minutes for the Off Timer.
 
mirage_ac_remote_model_t getModel (const bool useRaw=false) const
 Get the model code of the interal message state.
 
void setModel (const mirage_ac_remote_model_t model)
 Set the model code of the interal message state.
 
stdAc::state_t toCommon (void) const
 Convert the current internal state into its stdAc::state_t equivalent.
 
void fromCommon (const stdAc::state_t state)
 Convert & set a stdAc::state_t to its equivalent internal settings.
 
String toString (void) const
 Convert the internal state into a human readable string.
 

Static Public Member Functions

static mirage_ac_remote_model_t getModel (const uint8_t *state)
 Guess the Mirage remote model from the supplied state code.
 
static bool validChecksum (const uint8_t *data)
 Verify the checksum is valid for a given state.
 
static uint8_t calculateChecksum (const uint8_t *data)
 Calculate the checksum 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, const mirage_ac_remote_model_t model=mirage_ac_remote_model_t::KKG9AC1)
 Convert a stdAc::fanspeed_t enum into it's native speed.
 
static uint8_t convertSwingV (const stdAc::swingv_t position)
 Convert a stdAc::swingv_t enum into it's native setting.
 
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, const mirage_ac_remote_model_t model=mirage_ac_remote_model_t::KKG9AC1)
 Convert a native fan speed into its stdAc equivalent.
 
static stdAc::swingv_t toCommonSwingV (const uint8_t pos)
 Convert a native vertical swing postion to it's common equivalent.
 

Private Member Functions

void checksum (void)
 Calculate and set the checksum values for the internal state.
 

Private Attributes

IRsend _irsend
 Instance of the IR send class.
 
Mirage120Protocol _
 
mirage_ac_remote_model_t _model
 

Detailed Description

Class for handling detailed Mirage 120-bit A/C messages.

Note
Inspired and derived from the work done at: https://github.com/r45635/HVAC-IR-Control
Warning
Consider this very alpha code. Seems to work, but not validated.

Constructor & Destructor Documentation

◆ IRMirageAc()

IRMirageAc::IRMirageAc ( 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

◆ begin()

void IRMirageAc::begin ( void  )

Set up hardware to be able to send a message.

◆ calculateChecksum()

uint8_t IRMirageAc::calculateChecksum ( const uint8_t *  data)
static

Calculate the checksum for a given state.

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

◆ calibrate()

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

Calculate and set the checksum values for the internal state.

◆ convertFan()

uint8_t IRMirageAc::convertFan ( const stdAc::fanspeed_t  speed,
const mirage_ac_remote_model_t  model = mirage_ac_remote_model_t::KKG9AC1 
)
static

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

Parameters
[in]speedThe enum to be converted.
[in]modelThe model type to use to influence the conversion.
Returns
The native equivalent of the enum.

◆ convertMode()

uint8_t IRMirageAc::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()

uint8_t IRMirageAc::convertSwingV ( const stdAc::swingv_t  position)
static

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

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

◆ fromCommon()

void IRMirageAc::fromCommon ( const stdAc::state_t  state)

Convert & set a stdAc::state_t to its equivalent internal settings.

Parameters
[in]stateThe desired state in stdAc::state_t form.

◆ getCleanToggle()

bool IRMirageAc::getCleanToggle ( void  ) const

Get the Clean Toggle setting of the A/C.

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

◆ getClock()

uint32_t IRMirageAc::getClock ( void  ) const

Get the clock time of the A/C unit.

Returns
Nr. of seconds past midnight.

◆ getFan()

uint8_t IRMirageAc::getFan ( void  ) const

Get the current fan speed setting.

Returns
The current fan speed/mode.

◆ getFilter()

bool IRMirageAc::getFilter ( void  ) const

Get the Filter setting of the A/C.

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

◆ getIFeel()

bool IRMirageAc::getIFeel ( void  ) const

Get the IFeel setting of the A/C.

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

◆ getLight()

bool IRMirageAc::getLight ( void  ) const

Get the value of the current Light/Display setting.

Returns
true, the setting is on. false, the setting is off.
Note
Light is a toggle on the KKG29AC1 model.

◆ getMode()

uint8_t IRMirageAc::getMode ( void  ) const

Get the operating mode setting of the A/C.

Returns
The current operating mode setting.

◆ getModel() [1/2]

mirage_ac_remote_model_t IRMirageAc::getModel ( const bool  useRaw = false) const

Get the model code of the interal message state.

Parameters
[in]useRawIf set, we try to get the model info from just the state.
Returns
The model code.

◆ getModel() [2/2]

mirage_ac_remote_model_t IRMirageAc::getModel ( const uint8_t *  state)
static

Guess the Mirage remote model from the supplied state code.

Parameters
[in]stateA valid state code for this protocol.
Returns
The model code.
Note
This result isn't perfect. Both protocols can look the same but have wildly different settings.

◆ getOffTimer()

uint16_t IRMirageAc::getOffTimer ( void  ) const

Get the number of minutes the Off Timer is currently set for.

Returns
Nr. of Minutes the timer is set for. 0, is the timer is not in use.

◆ getOnTimer()

uint16_t IRMirageAc::getOnTimer ( void  ) const

Get the number of minutes the On Timer is currently set for.

Returns
Nr. of Minutes the timer is set for. 0, is the timer is not in use.

◆ getPower()

bool IRMirageAc::getPower ( void  ) const

Get the value of the current power setting.

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

◆ getQuiet()

bool IRMirageAc::getQuiet ( void  ) const

Get the Quiet setting of the A/C.

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

◆ getRaw()

uint8_t * IRMirageAc::getRaw ( void  )

Get a PTR to the internal state/code for this protocol.

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

◆ getSensorTemp()

uint16_t IRMirageAc::getSensorTemp ( void  ) const

Get the Sensor Temp setting of the A/C's remote.

Returns
The current setting for the sensor temp. in degrees celsius.

◆ getSleep()

bool IRMirageAc::getSleep ( void  ) const

Get the value of the current Sleep setting.

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

◆ getSwingH()

bool IRMirageAc::getSwingH ( void  ) const

Get the Horizontal Swing setting of the A/C.

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

◆ getSwingV()

uint8_t IRMirageAc::getSwingV ( void  ) const

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

Returns
The desired Vertical Swing setting/position.

◆ getTemp()

uint8_t IRMirageAc::getTemp ( void  ) const

Get the current temperature setting.

Returns
The current setting for temp. in degrees celsius.

◆ getTurbo()

bool IRMirageAc::getTurbo ( void  ) const

Get the value of the current Turbo setting.

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

◆ off()

void IRMirageAc::off ( void  )

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

◆ on()

void IRMirageAc::on ( void  )

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

◆ send()

void IRMirageAc::send ( const uint16_t  repeat = kMirageMinRepeat)

Send the current internal state as an IR message.

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

◆ setCleanToggle()

void IRMirageAc::setCleanToggle ( const bool  on)

Set the CleanToggle setting of the A/C.

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

◆ setClock()

void IRMirageAc::setClock ( const uint32_t  nr_of_seconds)

Set the clock time on the A/C unit.

Parameters
[in]nr_of_secondsNr. of seconds past midnight.

◆ setFan()

void IRMirageAc::setFan ( const uint8_t  speed)

Set the speed of the fan.

Parameters
[in]speedThe desired setting.

◆ setFilter()

void IRMirageAc::setFilter ( const bool  on)

Set the Filter setting of the A/C.

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

◆ setIFeel()

void IRMirageAc::setIFeel ( const bool  on)

Set the IFeel setting of the A/C.

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

◆ setLight()

void IRMirageAc::setLight ( const bool  on)

Change the Light/Display setting.

Parameters
[in]ontrue, the setting is on. false, the setting is off.
Note
Light is a toggle on the KKG29AC1 model.

◆ setMode()

void IRMirageAc::setMode ( const uint8_t  mode)

Set the operating mode of the A/C.

Parameters
[in]modeThe desired operating mode.

◆ setModel()

void IRMirageAc::setModel ( const mirage_ac_remote_model_t  model)

Set the model code of the interal message state.

Parameters
[in]modelThe desired model to use for the settings.

◆ setOffTimer()

void IRMirageAc::setOffTimer ( const uint16_t  nr_of_mins)

Set the number of minutes for the Off Timer.

Parameters
[in]nr_of_minsHow long to set the timer for. 0 disables the timer.

◆ setOnTimer()

void IRMirageAc::setOnTimer ( const uint16_t  nr_of_mins)

Set the number of minutes for the On Timer.

Parameters
[in]nr_of_minsHow long to set the timer for. 0 disables the timer.

◆ setPower()

void IRMirageAc::setPower ( const bool  on)

Change the power setting.

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

◆ setQuiet()

void IRMirageAc::setQuiet ( const bool  on)

Set the Quiet setting of the A/C.

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

◆ setRaw()

void IRMirageAc::setRaw ( const uint8_t *  data)

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

Parameters
[in]dataA valid code for this protocol.

◆ setSensorTemp()

void IRMirageAc::setSensorTemp ( const uint8_t  degrees)

Set the Sensor Temp setting of the A/C's remote.

Parameters
[in]degreesThe desired sensor temp. in degrees celsius.

◆ setSleep()

void IRMirageAc::setSleep ( const bool  on)

Change the Sleep setting.

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

◆ setSwingH()

void IRMirageAc::setSwingH ( const bool  on)

Set the Horizontal Swing setting of the A/C.

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

◆ setSwingV()

void IRMirageAc::setSwingV ( const uint8_t  position)

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

Parameters
[in]positionThe desired swing setting.

◆ setTemp()

void IRMirageAc::setTemp ( const uint8_t  degrees)

Set the temperature.

Parameters
[in]degreesThe temperature in degrees celsius.

◆ setTurbo()

void IRMirageAc::setTurbo ( const bool  on)

Change the Turbo setting.

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

◆ stateReset()

void IRMirageAc::stateReset ( void  )

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

◆ toCommon()

stdAc::state_t IRMirageAc::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 IRMirageAc::toCommonFanSpeed ( const uint8_t  speed,
const mirage_ac_remote_model_t  model = mirage_ac_remote_model_t::KKG9AC1 
)
static

Convert a native fan speed into its stdAc equivalent.

Parameters
[in]speedThe native setting to be converted.
[in]modelThe model type to use to influence the conversion.
Returns
The stdAc equivalent of the native setting.

◆ toCommonMode()

stdAc::opmode_t IRMirageAc::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 IRMirageAc::toCommonSwingV ( const uint8_t  pos)
static

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

Parameters
[in]posA native position to convert.
Returns
The common vertical swing position.

◆ toString()

String IRMirageAc::toString ( void  ) const

Convert the internal state into a human readable string.

Returns
A string containing the settings in human-readable form.

◆ validChecksum()

bool IRMirageAc::validChecksum ( const uint8_t *  data)
static

Verify the checksum is valid for a given state.

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

Member Data Documentation

◆ _

Mirage120Protocol IRMirageAc::_
private

◆ _irsend

IRsend IRMirageAc::_irsend
private

Instance of the IR send class.

◆ _model

mirage_ac_remote_model_t IRMirageAc::_model
private

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