IRremoteESP8266: IRMirageAc Class Reference (original) (raw)

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

#include <[ir_Mirage.h](ir%5F%5FMirage%5F8h%5Fsource.html)>

Public Member Functions
IRMirageAc (const uint16_t pin, const bool inverted=false, const bool use_modulation=true)
Class constructor. More...
void stateReset (void)
Reset the state of the remote to a known good state/sequence. More...
void send (const uint16_t repeat=kMirageMinRepeat)
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)
Set the requested power state of the A/C to on. More...
void off (void)
Set the requested power state of the A/C 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...
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...
uint8_t * getRaw (void)
Get a PTR to the internal state/code for this protocol. More...
void setRaw (const uint8_t *data)
Set the internal state from a valid code for this protocol. More...
uint32_t getClock (void) const
Get the clock time of the A/C unit. More...
void setClock (const uint32_t nr_of_seconds)
Set the clock time on the A/C unit. More...
void setTurbo (const bool on)
Change the Turbo setting. More...
bool getTurbo (void) const
Get the value of the current Turbo setting. More...
void setLight (const bool on)
Change the Light/Display setting. More...
bool getLight (void) const
Get the value of the current Light/Display setting. More...
void setSleep (const bool on)
Change the Sleep setting. More...
bool getSleep (void) const
Get the value of the current Sleep setting. More...
void setSwingV (const uint8_t position)
Set the Vertical Swing setting/position of the A/C. More...
uint8_t getSwingV (void) const
Get the Vertical Swing setting/position of the A/C. More...
void setSwingH (const bool on)
Set the Horizontal Swing setting of the A/C. More...
bool getSwingH (void) const
Get the Horizontal Swing setting of the A/C. More...
void setQuiet (const bool on)
Set the Quiet setting of the A/C. More...
bool getQuiet (void) const
Get the Quiet setting of the A/C. More...
void setCleanToggle (const bool on)
Set the CleanToggle setting of the A/C. More...
bool getCleanToggle (void) const
Get the Clean Toggle setting of the A/C. More...
void setFilter (const bool on)
Set the Filter setting of the A/C. More...
bool getFilter (void) const
Get the Filter setting of the A/C. More...
void setIFeel (const bool on)
Set the IFeel setting of the A/C. More...
bool getIFeel (void) const
Get the IFeel setting of the A/C. More...
void setSensorTemp (const uint8_t degrees)
Set the Sensor Temp setting of the A/C's remote. More...
uint16_t getSensorTemp (void) const
Get the Sensor Temp setting of the A/C's remote. More...
uint16_t getOnTimer (void) const
Get the number of minutes the On Timer is currently set for. More...
uint16_t getOffTimer (void) const
Get the number of minutes the Off Timer is currently set for. More...
void setOnTimer (const uint16_t nr_of_mins)
Set the number of minutes for the On Timer. More...
void setOffTimer (const uint16_t nr_of_mins)
Set the number of minutes for the Off Timer. More...
mirage_ac_remote_model_t getModel (const bool useRaw=false) const
Get the model code of the interal message state. More...
void setModel (const mirage_ac_remote_model_t model)
Set the model code of the interal message state. More...
stdAc::state_t toCommon (void) const
Convert the current internal state into its stdAc::state_t equivalent. More...
void fromCommon (const stdAc::state_t state)
Convert & set a stdAc::state_t to its equivalent internal settings. More...
String toString (void) const
Convert the internal state into a human readable string. More...
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. More...
static bool validChecksum (const uint8_t *data)
Verify the checksum is valid for a given state. More...
static uint8_t calculateChecksum (const uint8_t *data)
Calculate the checksum for a given state. More...
static uint8_t convertMode (const stdAc::opmode_t mode)
Convert a stdAc::opmode_t enum into its native mode. More...
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. More...
static uint8_t convertSwingV (const stdAc::swingv_t position)
Convert a stdAc::swingv_t enum into it's native setting. 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, const mirage_ac_remote_model_t model=mirage_ac_remote_model_t::KKG9AC1)
Convert a native fan speed into its stdAc equivalent. More...
static stdAc::swingv_t toCommonSwingV (const uint8_t pos)
Convert a native vertical swing postion to it's common equivalent. More...
Private Member Functions
void checksum (void)
Calculate and set the checksum values for the internal state. More...
Private Attributes
IRsend _irsend
Instance of the IR send class. More...
Mirage120Protocol _
mirage_ac_remote_model_t _model

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.

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

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] data The 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()

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

Parameters

[in] speed The enum to be converted.
[in] model The model type to use to influence the conversion.

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] position The enum to be converted.

Returns

The native equivalent of the enum.

fromCommon()

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

Parameters

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]

Get the model code of the interal message state.

Parameters

[in] useRaw If set, we try to get the model info from just the state.

Returns

The model code.

getModel() [2/2]

Guess the Mirage remote model from the supplied state code.

Parameters

[in] state A 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()

Send the current internal state as an IR message.

Parameters

[in] repeat Nr. of times the message will be repeated.

setCleanToggle()

void IRMirageAc::setCleanToggle ( const bool on )

Set the CleanToggle setting of the A/C.

Parameters

[in] on true, 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_seconds Nr. of seconds past midnight.

setFan()

void IRMirageAc::setFan ( const uint8_t speed )

Set the speed of the fan.

Parameters

[in] speed The desired setting.

setFilter()

void IRMirageAc::setFilter ( const bool on )

Set the Filter setting of the A/C.

Parameters

[in] on true, 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] on true, the setting is on. false, the setting is off.

setLight()

void IRMirageAc::setLight ( const bool on )

Change the Light/Display setting.

Parameters

[in] on true, 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] mode The desired operating mode.

setModel()

Set the model code of the interal message state.

Parameters

[in] model The 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_mins How 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_mins How long to set the timer for. 0 disables the timer.

setPower()

void IRMirageAc::setPower ( const bool on )

Change the power setting.

Parameters

[in] on true, 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] on true, 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] data A 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] degrees The desired sensor temp. in degrees celsius.

setSleep()

void IRMirageAc::setSleep ( const bool on )

Change the Sleep setting.

Parameters

[in] on true, 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] on true, 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] position The desired swing setting.

setTemp()

void IRMirageAc::setTemp ( const uint8_t degrees )

Set the temperature.

Parameters

[in] degrees The temperature in degrees celsius.

setTurbo()

void IRMirageAc::setTurbo ( const bool on )

Change the Turbo setting.

Parameters

[in] on true, 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()

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

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.
[in] model The model type to use to influence the conversion.

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 postion to it's common equivalent.

Parameters

[in] pos A 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] data The array to verify the checksum of.

Returns

true, if the state has a valid checksum. Otherwise, false.

_

_irsend

Instance of the IR send class.

_model


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