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

Class for handling detailed Daikin 312-bit A/C messages. More...

#include <ir_Daikin.h>

Collaboration diagram for IRDaikin2:
Collaboration graph
[legend]

Public Member Functions

 IRDaikin2 (const uint16_t pin, const bool inverted=false, const bool use_modulation=true)
 Class constructor. More...
 
void send (const uint16_t repeat=kDaikin2DefaultRepeat)
 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 state)
 Change the power setting. More...
 
bool getPower (void) const
 Get the value of the current power setting. More...
 
void setTemp (const uint8_t temp)
 Set the temperature. More...
 
uint8_t getTemp (void) 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...
 
uint8_t getMode (void) const
 Get the operating mode setting of the A/C. More...
 
void setMode (const uint8_t mode)
 Set the operating mode of the A/C. More...
 
void setSwingVertical (const uint8_t position)
 Set the Vertical Swing mode of the A/C. More...
 
uint8_t getSwingVertical (void) const
 Get the Vertical Swing mode of the A/C. More...
 
void setSwingHorizontal (const uint8_t position)
 Set the Horizontal Swing mode of the A/C. More...
 
uint8_t getSwingHorizontal (void) const
 Get the Horizontal Swing mode of the A/C. More...
 
bool getQuiet (void) const
 Get the Quiet mode status of the A/C. More...
 
void setQuiet (const bool on)
 Set the Quiet mode of the A/C. More...
 
bool getPowerful (void) const
 Get the Powerful (Turbo) mode of the A/C. More...
 
void setPowerful (const bool on)
 Set the Powerful (Turbo) mode of the A/C. More...
 
void setEcono (const bool on)
 Set the Economy mode of the A/C. More...
 
bool getEcono (void) const
 Get the Economical mode of the A/C. More...
 
void setEye (const bool on)
 Set the Eye (Sensor) mode of the A/C. More...
 
bool getEye (void) const
 Get the Eye (Sensor) mode status of the A/C. More...
 
void setEyeAuto (const bool on)
 Set the Automatic Eye (Sensor) mode of the A/C. More...
 
bool getEyeAuto (void) const
 Get the Automaitc Eye (Sensor) mode status of the A/C. More...
 
void setPurify (const bool on)
 Set the Purify (Filter) mode of the A/C. More...
 
bool getPurify (void) const
 Get the Purify (Filter) mode status of the A/C. More...
 
void setMold (const bool on)
 Set the Mould (filter) mode of the A/C. More...
 
bool getMold (void) const
 Get the Mould (filter) mode status of the A/C. More...
 
void enableOnTimer (const uint16_t starttime)
 Set the enable status & time of the On Timer. More...
 
void disableOnTimer (void)
 Disable the On timer. More...
 
uint16_t getOnTime (void) const
 Get the On Timer time to be sent to the A/C unit. More...
 
bool getOnTimerEnabled (void) const
 Get the enable status of the On Timer. More...
 
void enableSleepTimer (const uint16_t sleeptime)
 Set the enable status & time of the Sleep Timer. More...
 
void disableSleepTimer (void)
 Disable the sleep timer. More...
 
uint16_t getSleepTime (void) const
 Get the Sleep Timer time to be sent to the A/C unit. More...
 
bool getSleepTimerEnabled (void) const
 Get the Sleep timer enabled status of the A/C. More...
 
void enableOffTimer (const uint16_t endtime)
 Set the enable status & time of the Off Timer. More...
 
void disableOffTimer (void)
 Disable the Off timer. More...
 
uint16_t getOffTime (void) const
 Get the Off Timer time to be sent to the A/C unit. More...
 
bool getOffTimerEnabled (void) const
 Get the enable status of the Off Timer. More...
 
void setCurrentTime (const uint16_t time)
 Set the clock on the A/C unit. More...
 
uint16_t getCurrentTime (void) const
 Get the clock time to be sent to the A/C unit. More...
 
void setBeep (const uint8_t beep)
 Set the Beep mode of the A/C. More...
 
uint8_t getBeep (void) const
 Get the Beep status of the A/C. More...
 
void setLight (const uint8_t light)
 Set the Light (LED) mode of the A/C. More...
 
uint8_t getLight (void) const
 Get the Light status of the A/C. More...
 
void setClean (const bool on)
 Set the Auto clean mode of the A/C. More...
 
bool getClean (void) const
 Get the Auto Clean mode status of the A/C. More...
 
void setFreshAir (const bool on)
 Set the Fresh Air mode of the A/C. More...
 
bool getFreshAir (void) const
 Get the Fresh Air mode status of the A/C. More...
 
void setFreshAirHigh (const bool on)
 Set the (High) Fresh Air mode of the A/C. More...
 
bool getFreshAirHigh (void) const
 Get the (High) Fresh Air mode status of the A/C. More...
 
uint8_t getHumidity (void) const
 Get the Humidity percentage setting of the A/C. More...
 
void setHumidity (const uint8_t percent)
 Set the Humidity percentage 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 new_code[])
 Set the internal state from a valid code for this protocol. More...
 
stdAc::state_t toCommon (void) 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...
 

Static Public Member Functions

static bool validChecksum (uint8_t state[], const uint16_t length=kDaikin2StateLength)
 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 uint8_t convertSwingV (const stdAc::swingv_t position)
 Convert a stdAc::swingv_t enum into it's native setting. More...
 
static uint8_t convertSwingH (const stdAc::swingh_t position)
 Convert a stdAc::swingh_t enum into it's native setting. More...
 
static stdAc::swingv_t toCommonSwingV (const uint8_t setting)
 Convert a native vertical swing postion to it's common equivalent. More...
 
static stdAc::swingh_t toCommonSwingH (const uint8_t setting)
 Convert a native horizontal swing postion to it's common equivalent. More...
 

Private Member Functions

void stateReset (void)
 Reset the internal state to a fixed known good state. More...
 
void checksum (void)
 Calculate and set the checksum values for the internal state. More...
 
void clearOnTimerFlag (void)
 Clear the On Timer flag. More...
 
void clearSleepTimerFlag (void)
 Clear the sleep timer flag. More...
 

Private Attributes

IRsend _irsend
 instance of the IR send class More...
 
Daikin2Protocol _
 

Detailed Description

Class for handling detailed Daikin 312-bit A/C messages.

Note
Code by crankyoldgit, Reverse engineering analysis by sheppy99

Constructor & Destructor Documentation

◆ IRDaikin2()

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

Set up hardware to be able to send a message.

◆ calibrate()

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

Calculate and set the checksum values for the internal state.

◆ clearOnTimerFlag()

void IRDaikin2::clearOnTimerFlag ( void  )
private

Clear the On Timer flag.

◆ clearSleepTimerFlag()

void IRDaikin2::clearSleepTimerFlag ( void  )
private

Clear the sleep timer flag.

◆ convertFan()

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

◆ convertSwingH()

uint8_t IRDaikin2::convertSwingH ( const stdAc::swingh_t  position)
static

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

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

◆ convertSwingV()

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

◆ disableOffTimer()

void IRDaikin2::disableOffTimer ( void  )

Disable the Off timer.

◆ disableOnTimer()

void IRDaikin2::disableOnTimer ( void  )

Disable the On timer.

◆ disableSleepTimer()

void IRDaikin2::disableSleepTimer ( void  )

Disable the sleep timer.

◆ enableOffTimer()

void IRDaikin2::enableOffTimer ( const uint16_t  endtime)

Set the enable status & time of the Off Timer.

Parameters
[in]endtimeThe number of minutes past midnight.

◆ enableOnTimer()

void IRDaikin2::enableOnTimer ( const uint16_t  starttime)

Set the enable status & time of the On Timer.

Parameters
[in]starttimeThe number of minutes past midnight.
Note
Timer location is shared with sleep timer.

◆ enableSleepTimer()

void IRDaikin2::enableSleepTimer ( const uint16_t  sleeptime)

Set the enable status & time of the Sleep Timer.

Parameters
[in]sleeptimeThe number of minutes past midnight.
Note
The Timer location is shared with On Timer.

◆ getBeep()

uint8_t IRDaikin2::getBeep ( void  ) const

Get the Beep status of the A/C.

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

◆ getClean()

bool IRDaikin2::getClean ( void  ) const

Get the Auto Clean mode status of the A/C.

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

◆ getCurrentTime()

uint16_t IRDaikin2::getCurrentTime ( void  ) const

Get the clock time to be sent to the A/C unit.

Returns
The number of minutes past midnight.

◆ getEcono()

bool IRDaikin2::getEcono ( void  ) const

Get the Economical mode of the A/C.

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

◆ getEye()

bool IRDaikin2::getEye ( void  ) const

Get the Eye (Sensor) mode status of the A/C.

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

◆ getEyeAuto()

bool IRDaikin2::getEyeAuto ( void  ) const

Get the Automaitc Eye (Sensor) mode status of the A/C.

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

◆ getFan()

uint8_t IRDaikin2::getFan ( void  ) const

Get the current fan speed setting.

Returns
The current fan speed.

◆ getFreshAir()

bool IRDaikin2::getFreshAir ( void  ) const

Get the Fresh Air mode status of the A/C.

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

◆ getFreshAirHigh()

bool IRDaikin2::getFreshAirHigh ( void  ) const

Get the (High) Fresh Air mode status of the A/C.

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

◆ getHumidity()

uint8_t IRDaikin2::getHumidity ( void  ) const

Get the Humidity percentage setting of the A/C.

Returns
The setting percentage. 255 is Automatic. 0 is Off.

◆ getLight()

uint8_t IRDaikin2::getLight ( void  ) const

Get the Light status of the A/C.

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

◆ getMode()

uint8_t IRDaikin2::getMode ( void  ) const

Get the operating mode setting of the A/C.

Returns
The current operating mode setting.

◆ getMold()

bool IRDaikin2::getMold ( void  ) const

Get the Mould (filter) mode status of the A/C.

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

◆ getOffTime()

uint16_t IRDaikin2::getOffTime ( void  ) const

Get the Off Timer time to be sent to the A/C unit.

Returns
The number of minutes past midnight.

◆ getOffTimerEnabled()

bool IRDaikin2::getOffTimerEnabled ( void  ) const

Get the enable status of the Off Timer.

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

◆ getOnTime()

uint16_t IRDaikin2::getOnTime ( void  ) const

Get the On Timer time to be sent to the A/C unit.

Returns
The number of minutes past midnight.

◆ getOnTimerEnabled()

bool IRDaikin2::getOnTimerEnabled ( void  ) const

Get the enable status of the On Timer.

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

◆ getPower()

bool IRDaikin2::getPower ( void  ) const

Get the value of the current power setting.

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

◆ getPowerful()

bool IRDaikin2::getPowerful ( void  ) const

Get the Powerful (Turbo) mode of the A/C.

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

◆ getPurify()

bool IRDaikin2::getPurify ( void  ) const

Get the Purify (Filter) mode status of the A/C.

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

◆ getQuiet()

bool IRDaikin2::getQuiet ( void  ) const

Get the Quiet mode status of the A/C.

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

◆ getRaw()

uint8_t * IRDaikin2::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.

◆ getSleepTime()

uint16_t IRDaikin2::getSleepTime ( void  ) const

Get the Sleep Timer time to be sent to the A/C unit.

Returns
The number of minutes past midnight.

◆ getSleepTimerEnabled()

bool IRDaikin2::getSleepTimerEnabled ( void  ) const

Get the Sleep timer enabled status of the A/C.

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

◆ getSwingHorizontal()

uint8_t IRDaikin2::getSwingHorizontal ( void  ) const

Get the Horizontal Swing mode of the A/C.

Returns
The native position/mode setting.

◆ getSwingVertical()

uint8_t IRDaikin2::getSwingVertical ( void  ) const

Get the Vertical Swing mode of the A/C.

Returns
The native position/mode setting.

◆ getTemp()

uint8_t IRDaikin2::getTemp ( void  ) const

Get the current temperature setting.

Returns
The current setting for temp. in degrees celsius.

◆ off()

void IRDaikin2::off ( void  )

Change the power setting to Off.

◆ on()

void IRDaikin2::on ( void  )

Change the power setting to On.

◆ send()

void IRDaikin2::send ( const uint16_t  repeat = kDaikin2DefaultRepeat)

Send the current internal state as an IR message.

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

◆ setBeep()

void IRDaikin2::setBeep ( const uint8_t  beep)

Set the Beep mode of the A/C.

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

◆ setClean()

void IRDaikin2::setClean ( const bool  on)

Set the Auto clean mode of the A/C.

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

◆ setCurrentTime()

void IRDaikin2::setCurrentTime ( const uint16_t  numMins)

Set the clock on the A/C unit.

Parameters
[in]numMinsNr. of minutes past midnight.

◆ setEcono()

void IRDaikin2::setEcono ( const bool  on)

Set the Economy mode of the A/C.

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

◆ setEye()

void IRDaikin2::setEye ( const bool  on)

Set the Eye (Sensor) mode of the A/C.

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

◆ setEyeAuto()

void IRDaikin2::setEyeAuto ( const bool  on)

Set the Automatic Eye (Sensor) mode of the A/C.

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

◆ setFan()

void IRDaikin2::setFan ( const uint8_t  fan)

Set the speed of the fan.

Parameters
[in]fanThe desired setting.
Note
1-5 or kDaikinFanAuto or kDaikinFanQuiet

◆ setFreshAir()

void IRDaikin2::setFreshAir ( const bool  on)

Set the Fresh Air mode of the A/C.

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

◆ setFreshAirHigh()

void IRDaikin2::setFreshAirHigh ( const bool  on)

Set the (High) Fresh Air mode of the A/C.

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

◆ setHumidity()

void IRDaikin2::setHumidity ( const uint8_t  percent)

Set the Humidity percentage setting of the A/C.

Parameters
[in]percentPercentage humidty. 255 is Auto. 0 is Off.
Note
Only available in Dry & Heat modes, otherwise it is Off.

◆ setLight()

void IRDaikin2::setLight ( const uint8_t  light)

Set the Light (LED) mode of the A/C.

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

◆ setMode()

void IRDaikin2::setMode ( const uint8_t  desired_mode)

Set the operating mode of the A/C.

Parameters
[in]desired_modeThe desired operating mode.

◆ setMold()

void IRDaikin2::setMold ( const bool  on)

Set the Mould (filter) mode of the A/C.

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

◆ setPower()

void IRDaikin2::setPower ( const bool  on)

Change the power setting.

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

◆ setPowerful()

void IRDaikin2::setPowerful ( const bool  on)

Set the Powerful (Turbo) mode of the A/C.

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

◆ setPurify()

void IRDaikin2::setPurify ( const bool  on)

Set the Purify (Filter) mode of the A/C.

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

◆ setQuiet()

void IRDaikin2::setQuiet ( const bool  on)

Set the Quiet mode of the A/C.

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

◆ setRaw()

void IRDaikin2::setRaw ( const uint8_t  new_code[])

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

Parameters
[in]new_codeA valid code for this protocol.

◆ setSwingHorizontal()

void IRDaikin2::setSwingHorizontal ( const uint8_t  position)

Set the Horizontal Swing mode of the A/C.

Parameters
[in]positionThe position/mode to set the swing to.

◆ setSwingVertical()

void IRDaikin2::setSwingVertical ( const uint8_t  position)

Set the Vertical Swing mode of the A/C.

Parameters
[in]positionThe position/mode to set the swing to.

◆ setTemp()

void IRDaikin2::setTemp ( const uint8_t  desired)

Set the temperature.

Parameters
[in]desiredThe temperature in degrees celsius.

◆ stateReset()

void IRDaikin2::stateReset ( void  )
private

Reset the internal state to a fixed known good state.

◆ toCommon()

stdAc::state_t IRDaikin2::toCommon ( void  ) const

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

Returns
The stdAc equivalent of the native settings.

◆ toCommonSwingH()

stdAc::swingh_t IRDaikin2::toCommonSwingH ( const uint8_t  setting)
static

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

Parameters
[in]settingA native position to convert.
Returns
The common horizontal swing position.

◆ toCommonSwingV()

stdAc::swingv_t IRDaikin2::toCommonSwingV ( const uint8_t  setting)
static

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

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

◆ toString()

String IRDaikin2::toString ( void  ) const

Convert the current internal state into a human readable string.

Returns
A human readable string.

◆ validChecksum()

bool IRDaikin2::validChecksum ( uint8_t  state[],
const uint16_t  length = kDaikin2StateLength 
)
static

Verify the checksum is valid for a given state.

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

Member Data Documentation

◆ _

Daikin2Protocol IRDaikin2::_
private

◆ _irsend

IRsend IRDaikin2::_irsend
private

instance of the IR send class


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