IRremoteESP8266
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
IRMideaAC Class Reference

Class for handling detailed Midea A/C messages. More...

#include <ir_Midea.h>

Collaboration diagram for IRMideaAC:
Collaboration graph
[legend]

Public Member Functions

 IRMideaAC (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=kMideaMinRepeat)
 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...
 
bool getUseCelsius (void) const
 Is the device currently using Celsius or the Fahrenheit temp scale? More...
 
void setUseCelsius (const bool celsius)
 Set the A/C unit to use Celsius natively. More...
 
void setTemp (const uint8_t temp, const bool useCelsius=false)
 Set the temperature. More...
 
uint8_t getTemp (const bool useCelsius=false) const
 Get the current temperature setting. More...
 
void setFan (const uint8_t fan)
 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 setRaw (const uint64_t newState)
 Set the internal state from a valid code for this protocol. More...
 
uint64_t getRaw (void)
 Get a copy of the internal state/code for this protocol. More...
 
void setSleep (const bool on)
 Set the Sleep setting of the A/C. More...
 
bool getSleep (void) const
 Get the Sleep setting of the A/C. More...
 
bool isSwingVToggle (void) const
 Is the current state a vertical swing toggle message? More...
 
void setSwingVToggle (const bool on)
 Set the A/C to toggle the vertical swing toggle for the next send. More...
 
bool getSwingVToggle (void)
 
bool isEconoToggle (void) const
 Is the current state an Econo (energy saver) toggle message? More...
 
void setEconoToggle (const bool on)
 Set the A/C to toggle the Econo (energy saver) mode for the next send. More...
 
bool getEconoToggle (void)
 
stdAc::state_t toCommon (const stdAc::state_t *prev=NULL)
 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...
 

Static Public Member Functions

static bool validChecksum (const uint64_t state)
 Verify the checksum is valid 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)
 Convert a stdAc::fanspeed_t enum into it's native speed. 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...
 

Private Member Functions

void checksum (void)
 Calculate & set the checksum for the current internal state of the remote. More...
 

Static Private Member Functions

static uint8_t calcChecksum (const uint64_t state)
 Calculate the checksum for a given state. More...
 

Private Attributes

IRsend _irsend
 Instance of the IR send class. More...
 
MideaProtocol _
 
bool _SwingVToggle
 
bool _EconoToggle
 

Detailed Description

Class for handling detailed Midea A/C messages.

Warning
Consider this very alpha code.

Constructor & Destructor Documentation

◆ IRMideaAC()

IRMideaAC::IRMideaAC ( 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 IRMideaAC::begin ( void  )

Set up hardware to be able to send a message.

◆ calcChecksum()

uint8_t IRMideaAC::calcChecksum ( const uint64_t  state)
staticprivate

Calculate the checksum for a given state.

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

◆ calibrate()

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

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

◆ convertFan()

uint8_t IRMideaAC::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 IRMideaAC::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 equivilant of the enum.

◆ getEconoToggle()

bool IRMideaAC::getEconoToggle ( void  )
Returns
true, the setting is on. false, the setting is off.

◆ getFan()

uint8_t IRMideaAC::getFan ( void  ) const

Get the current fan speed setting.

Returns
The current fan speed.

◆ getMode()

uint8_t IRMideaAC::getMode ( void  ) const

Get the operating mode setting of the A/C.

Returns
The current operating mode setting.

◆ getPower()

bool IRMideaAC::getPower ( void  ) const

Get the value of the current power setting.

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

◆ getRaw()

uint64_t IRMideaAC::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.

◆ getSleep()

bool IRMideaAC::getSleep ( void  ) const

Get the Sleep setting of the A/C.

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

◆ getSwingVToggle()

bool IRMideaAC::getSwingVToggle ( void  )
Note
On Danby A/C units, this is associated with the Ion Filter instead.
Returns
true, the setting is on. false, the setting is off.

◆ getTemp()

uint8_t IRMideaAC::getTemp ( const bool  celsius = false) const

Get the current temperature setting.

Parameters
[in]celsiustrue, the results are in Celsius. false, in Fahrenheit.
Returns
The current setting for temp. in the requested units/scale.

◆ getUseCelsius()

bool IRMideaAC::getUseCelsius ( void  ) const

Is the device currently using Celsius or the Fahrenheit temp scale?

Returns
true, the A/C unit uses Celsius natively, false, is Fahrenheit.

◆ isEconoToggle()

bool IRMideaAC::isEconoToggle ( void  ) const

Is the current state an Econo (energy saver) toggle message?

Returns
true, it is. false, it isn't.

◆ isSwingVToggle()

bool IRMideaAC::isSwingVToggle ( void  ) const

Is the current state a vertical swing toggle message?

Note
On Danby A/C units, this is associated with the Ion Filter instead.
Returns
true, it is. false, it isn't.

◆ off()

void IRMideaAC::off ( void  )

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

◆ on()

void IRMideaAC::on ( void  )

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

◆ send()

void IRMideaAC::send ( const uint16_t  repeat = kMideaMinRepeat)

Send the current internal state as an IR message.

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

◆ setEconoToggle()

void IRMideaAC::setEconoToggle ( const bool  on)

Set the A/C to toggle the Econo (energy saver) mode for the next send.

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

◆ setFan()

void IRMideaAC::setFan ( const uint8_t  fan)

Set the speed of the fan.

Parameters
[in]fanThe desired setting. 1-3 set the speed, 0 for auto.

◆ setMode()

void IRMideaAC::setMode ( const uint8_t  mode)

Set the operating mode of the A/C.

Parameters
[in]modeThe desired operating mode.

◆ setPower()

void IRMideaAC::setPower ( const bool  on)

Change the power setting.

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

◆ setRaw()

void IRMideaAC::setRaw ( const uint64_t  newState)

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

Parameters
[in]newStateA valid code for this protocol.

◆ setSleep()

void IRMideaAC::setSleep ( const bool  on)

Set the Sleep setting of the A/C.

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

◆ setSwingVToggle()

void IRMideaAC::setSwingVToggle ( const bool  on)

Set the A/C to toggle the vertical swing toggle for the next send.

Note
On Danby A/C units, this is associated with the Ion Filter instead.
Parameters
[in]ontrue, the setting is on. false, the setting is off.

◆ setTemp()

void IRMideaAC::setTemp ( const uint8_t  temp,
const bool  useCelsius = false 
)

Set the temperature.

Parameters
[in]tempThe temperature in degrees celsius.
[in]useCelsiustrue, use the Celsius temp scale. false, is Fahrenheit

◆ setUseCelsius()

void IRMideaAC::setUseCelsius ( const bool  on)

Set the A/C unit to use Celsius natively.

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

◆ stateReset()

void IRMideaAC::stateReset ( void  )

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

◆ toCommon()

stdAc::state_t IRMideaAC::toCommon ( const stdAc::state_t prev = NULL)

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

Parameters
[in]prevA Ptr to the previous state.
Returns
The stdAc equivilant of the native settings.

◆ toCommonFanSpeed()

stdAc::fanspeed_t IRMideaAC::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 IRMideaAC::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 IRMideaAC::toString ( void  )

Convert the current internal state into a human readable string.

Returns
A human readable string.

◆ validChecksum()

bool IRMideaAC::validChecksum ( const uint64_t  state)
static

Verify the checksum is valid for a given state.

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

Member Data Documentation

◆ _

MideaProtocol IRMideaAC::_
private

◆ _EconoToggle

bool IRMideaAC::_EconoToggle
private

◆ _irsend

IRsend IRMideaAC::_irsend
private

Instance of the IR send class.

◆ _SwingVToggle

bool IRMideaAC::_SwingVToggle
private

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