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. Code by crankyoldgit, Reverse engineering analysis by sheppy99. 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 ()
 Set up hardware to be able to send a message. More...
 
void on ()
 Change the power setting to On. More...
 
void off ()
 Change the power setting to Off. More...
 
void setPower (const bool state)
 Change the power setting. More...
 
bool getPower ()
 Get the value of the current power setting. More...
 
void setTemp (const uint8_t temp)
 Set the temperature. More...
 
uint8_t getTemp ()
 Get the current temperature setting. More...
 
void setFan (const uint8_t fan)
 Set the speed of the fan. More...
 
uint8_t getFan ()
 Get the current fan speed setting. More...
 
uint8_t getMode ()
 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 ()
 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 ()
 Get the Horizontal Swing mode of the A/C. More...
 
bool getQuiet ()
 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 ()
 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 ()
 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 ()
 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 ()
 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 ()
 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 ()
 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 ()
 Disable the On timer. More...
 
uint16_t getOnTime ()
 Get the On Timer time to be sent to the A/C unit. More...
 
bool getOnTimerEnabled ()
 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 ()
 Disable the sleep timer. More...
 
uint16_t getSleepTime ()
 Get the Sleep Timer time to be sent to the A/C unit. More...
 
bool getSleepTimerEnabled ()
 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 ()
 Disable the Off timer. More...
 
uint16_t getOffTime ()
 Get the Off Timer time to be sent to the A/C unit. More...
 
bool getOffTimerEnabled ()
 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 ()
 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 ()
 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 ()
 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 ()
 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 ()
 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 ()
 Get the (High) Fresh Air mode status of the A/C. More...
 
uint8_t * getRaw ()
 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)
 Convert the current internal state into its stdAc::state_t equivilant. More...
 
String toString ()
 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 ()
 Reset the internal state to a fixed known good state. More...
 
void checksum ()
 Calculate and set the checksum values for the internal state. More...
 
void clearOnTimerFlag ()
 Clear the On Timer flag. More...
 
void clearSleepTimerFlag ()
 Clear the sleep timer flag. More...
 

Private Attributes

IRsend _irsend
 instance of the IR send class More...
 
uint8_t remote_state [kDaikin2StateLength]
 The state of the IR remote. More...
 

Detailed Description

Class for handling detailed Daikin 312-bit A/C messages. 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 ( )

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 ( )
private

Calculate and set the checksum values for the internal state.

◆ clearOnTimerFlag()

void IRDaikin2::clearOnTimerFlag ( )
private

Clear the On Timer flag.

◆ clearSleepTimerFlag()

void IRDaikin2::clearSleepTimerFlag ( )
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 equivilant 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 equivilant 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 equivilant 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 equivilant of the enum.

◆ disableOffTimer()

void IRDaikin2::disableOffTimer ( )

Disable the Off timer.

◆ disableOnTimer()

void IRDaikin2::disableOnTimer ( )

Disable the On timer.

◆ disableSleepTimer()

void IRDaikin2::disableSleepTimer ( )

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 ( )

Get the Beep status of the A/C.

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

◆ getClean()

bool IRDaikin2::getClean ( )

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 ( )

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

Returns
The number of minutes past midnight.

◆ getEcono()

bool IRDaikin2::getEcono ( )

Get the Economical mode of the A/C.

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

◆ getEye()

bool IRDaikin2::getEye ( )

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 ( )

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 ( )

Get the current fan speed setting.

Returns
The current fan speed.

◆ getFreshAir()

bool IRDaikin2::getFreshAir ( )

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 ( )

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

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

◆ getLight()

uint8_t IRDaikin2::getLight ( )

Get the Light status of the A/C.

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

◆ getMode()

uint8_t IRDaikin2::getMode ( )

Get the operating mode setting of the A/C.

Returns
The current operating mode setting.

◆ getMold()

bool IRDaikin2::getMold ( )

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 ( )

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

Returns
The number of minutes past midnight.

◆ getOffTimerEnabled()

bool IRDaikin2::getOffTimerEnabled ( )

Get the enable status of the Off Timer.

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

◆ getOnTime()

uint16_t IRDaikin2::getOnTime ( )

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

Returns
The number of minutes past midnight.

◆ getOnTimerEnabled()

bool IRDaikin2::getOnTimerEnabled ( )

Get the enable status of the On Timer.

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

◆ getPower()

bool IRDaikin2::getPower ( )

Get the value of the current power setting.

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

◆ getPowerful()

bool IRDaikin2::getPowerful ( )

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

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

◆ getPurify()

bool IRDaikin2::getPurify ( )

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 ( )

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 ( )

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 ( )

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

Returns
The number of minutes past midnight.

◆ getSleepTimerEnabled()

bool IRDaikin2::getSleepTimerEnabled ( )

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 ( )

Get the Horizontal Swing mode of the A/C.

Returns
The native position/mode setting.

◆ getSwingVertical()

uint8_t IRDaikin2::getSwingVertical ( )

Get the Vertical Swing mode of the A/C.

Returns
The native position/mode setting.

◆ getTemp()

uint8_t IRDaikin2::getTemp ( )

Get the current temperature setting.

Returns
The current setting for temp. in degrees celsius.

◆ off()

void IRDaikin2::off ( )

Change the power setting to Off.

◆ on()

void IRDaikin2::on ( )

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.

◆ 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 ( )
private

Reset the internal state to a fixed known good state.

◆ toCommon()

stdAc::state_t IRDaikin2::toCommon ( void  )

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

Returns
The stdAc equivilant 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 ( )

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

◆ _irsend

IRsend IRDaikin2::_irsend
private

instance of the IR send class

◆ remote_state

uint8_t IRDaikin2::remote_state[kDaikin2StateLength]
private

The state of the IR remote.


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