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

Class for handling detailed Daikin 128-bit A/C messages. Code by crankyoldgit. Analysis by Daniel Vena. More...

#include <ir_Daikin.h>

Collaboration diagram for IRDaikin128:
Collaboration graph
[legend]

Public Member Functions

 IRDaikin128 (const uint16_t pin, const bool inverted=false, const bool use_modulation=true)
 Class constructor. More...
 
void send (const uint16_t repeat=kDaikin128DefaultRepeat)
 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 setPowerToggle (const bool toggle)
 Set the Power toggle setting of the A/C. More...
 
bool getPowerToggle (void)
 Get the Power toggle setting of the A/C. More...
 
void setTemp (const uint8_t temp)
 Set the temperature. More...
 
uint8_t getTemp (void)
 Get the current temperature setting. More...
 
void setFan (const uint8_t fan)
 Set the speed of the fan. More...
 
uint8_t getFan (void)
 Get the current fan speed setting. More...
 
uint8_t getMode (void)
 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 bool on)
 Set the Vertical Swing mode of the A/C. More...
 
bool getSwingVertical ()
 Get the Vertical Swing mode of the A/C. More...
 
bool getSleep (void)
 Get the Sleep mode of the A/C. More...
 
void setSleep (const bool on)
 Set the Sleep mode of the A/C. More...
 
bool getQuiet (void)
 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)
 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)
 Get the Economical mode of the A/C. More...
 
void setOnTimer (const uint16_t mins_since_midnight)
 Set the On Timer time for the A/C unit. More...
 
uint16_t getOnTimer (void)
 Get the On Timer time to be sent to the A/C unit. More...
 
bool getOnTimerEnabled (void)
 Get the enable status of the On Timer. More...
 
void setOnTimerEnabled (const bool on)
 Set the enable status of the On Timer. More...
 
void setOffTimer (const uint16_t mins_since_midnight)
 Set the Off Timer time for the A/C unit. More...
 
uint16_t getOffTimer (void)
 Get the Off Timer time to be sent to the A/C unit. More...
 
bool getOffTimerEnabled (void)
 Get the enable status of the Off Timer. More...
 
void setOffTimerEnabled (const bool on)
 Set the enable status of the Off Timer. More...
 
void setClock (const uint16_t mins_since_midnight)
 Set the clock on the A/C unit. More...
 
uint16_t getClock (void)
 Get the clock time to be sent to the A/C unit. More...
 
void setLightToggle (const uint8_t unit_type)
 Set the Light toggle setting of the A/C. More...
 
uint8_t getLightToggle (void)
 Get the Light toggle 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 (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 (uint8_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 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)
 
void clearSleepTimerFlag (void)
 

Static Private Member Functions

static uint8_t calcFirstChecksum (const uint8_t state[])
 
static uint8_t calcSecondChecksum (const uint8_t state[])
 
static void setTimer (uint8_t *ptr, const uint16_t mins_since_midnight)
 Set the time for a timer at the given location. More...
 
static uint16_t getTimer (const uint8_t *ptr)
 Get the time for a timer at the given location. More...
 

Private Attributes

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

Detailed Description

Class for handling detailed Daikin 128-bit A/C messages. Code by crankyoldgit. Analysis by Daniel Vena.

Constructor & Destructor Documentation

◆ IRDaikin128()

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

Set up hardware to be able to send a message.

◆ calcFirstChecksum()

uint8_t IRDaikin128::calcFirstChecksum ( const uint8_t  state[])
staticprivate

◆ calcSecondChecksum()

uint8_t IRDaikin128::calcSecondChecksum ( const uint8_t  state[])
staticprivate

◆ calibrate()

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

Calculate and set the checksum values for the internal state.

◆ clearOnTimerFlag()

void IRDaikin128::clearOnTimerFlag ( void  )
private

◆ clearSleepTimerFlag()

void IRDaikin128::clearSleepTimerFlag ( void  )
private

◆ convertFan()

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

◆ getClock()

uint16_t IRDaikin128::getClock ( void  )

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

Returns
The number of minutes past midnight.

◆ getEcono()

bool IRDaikin128::getEcono ( void  )

Get the Economical mode of the A/C.

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

◆ getFan()

uint8_t IRDaikin128::getFan ( void  )

Get the current fan speed setting.

Returns
The current fan speed.

◆ getLightToggle()

uint8_t IRDaikin128::getLightToggle ( void  )

Get the Light toggle setting of the A/C.

Returns
The current operating mode setting.

◆ getMode()

uint8_t IRDaikin128::getMode ( void  )

Get the operating mode setting of the A/C.

Returns
The current operating mode setting.

◆ getOffTimer()

uint16_t IRDaikin128::getOffTimer ( void  )

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

Returns
The number of minutes past midnight.

◆ getOffTimerEnabled()

bool IRDaikin128::getOffTimerEnabled ( void  )

Get the enable status of the Off Timer.

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

◆ getOnTimer()

uint16_t IRDaikin128::getOnTimer ( void  )

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

Returns
The number of minutes past midnight.

◆ getOnTimerEnabled()

bool IRDaikin128::getOnTimerEnabled ( void  )

Get the enable status of the On Timer.

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

◆ getPowerful()

bool IRDaikin128::getPowerful ( void  )

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

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

◆ getPowerToggle()

bool IRDaikin128::getPowerToggle ( void  )

Get the Power toggle setting of the A/C.

Returns
The current operating mode setting.

◆ getQuiet()

bool IRDaikin128::getQuiet ( void  )

Get the Quiet mode status of the A/C.

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

◆ getRaw()

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

◆ getSleep()

bool IRDaikin128::getSleep ( void  )

Get the Sleep mode of the A/C.

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

◆ getSwingVertical()

bool IRDaikin128::getSwingVertical ( )

Get the Vertical Swing mode of the A/C.

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

◆ getTemp()

uint8_t IRDaikin128::getTemp ( void  )

Get the current temperature setting.

Returns
The current setting for temp. in degrees celsius.

◆ getTimer()

uint16_t IRDaikin128::getTimer ( const uint8_t *  ptr)
staticprivate

Get the time for a timer at the given location.

Parameters
[in]ptrA Ptr to the byte containing the Timer value.
Returns
The number of minutes since midnight that the timer is set to.
Note
Timer is stored in nr. of half hours internally.

◆ send()

void IRDaikin128::send ( const uint16_t  repeat = kDaikin128DefaultRepeat)

Send the current internal state as an IR message.

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

◆ setClock()

void IRDaikin128::setClock ( const uint16_t  mins_since_midnight)

Set the clock on the A/C unit.

Parameters
[in]mins_since_midnightNr. of minutes past midnight.

◆ setEcono()

void IRDaikin128::setEcono ( const bool  on)

Set the Economy mode of the A/C.

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

◆ setFan()

void IRDaikin128::setFan ( const uint8_t  speed)

Set the speed of the fan.

Parameters
[in]speedThe desired setting.

◆ setLightToggle()

void IRDaikin128::setLightToggle ( const uint8_t  unit)

Set the Light toggle setting of the A/C.

Parameters
[in]unitDevice to show the LED (Light) Display info about.
Note
0 is off.

◆ setMode()

void IRDaikin128::setMode ( const uint8_t  mode)

Set the operating mode of the A/C.

Parameters
[in]modeThe desired operating mode.

◆ setOffTimer()

void IRDaikin128::setOffTimer ( const uint16_t  mins_since_midnight)

Set the Off Timer time for the A/C unit.

Parameters
[in]mins_since_midnightNr. of minutes past midnight.

◆ setOffTimerEnabled()

void IRDaikin128::setOffTimerEnabled ( const bool  on)

Set the enable status of the Off Timer.

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

◆ setOnTimer()

void IRDaikin128::setOnTimer ( const uint16_t  mins_since_midnight)

Set the On Timer time for the A/C unit.

Parameters
[in]mins_since_midnightNr. of minutes past midnight.

◆ setOnTimerEnabled()

void IRDaikin128::setOnTimerEnabled ( const bool  on)

Set the enable status of the On Timer.

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

◆ setPowerful()

void IRDaikin128::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.

◆ setPowerToggle()

void IRDaikin128::setPowerToggle ( const bool  toggle)

Set the Power toggle setting of the A/C.

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

◆ setQuiet()

void IRDaikin128::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 IRDaikin128::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.

◆ setSleep()

void IRDaikin128::setSleep ( const bool  on)

Set the Sleep mode of the A/C.

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

◆ setSwingVertical()

void IRDaikin128::setSwingVertical ( const bool  on)

Set the Vertical Swing mode of the A/C.

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

◆ setTemp()

void IRDaikin128::setTemp ( const uint8_t  temp)

Set the temperature.

Parameters
[in]tempThe temperature in degrees celsius.

◆ setTimer()

void IRDaikin128::setTimer ( uint8_t *  ptr,
const uint16_t  mins_since_midnight 
)
staticprivate

Set the time for a timer at the given location.

Parameters
[in,out]ptrPtr to the byte containing the Timer value to be updated.
[in]mins_since_midnightThe number of minutes the new timer should be set to.
Note
Timer is rounds down to the nearest half hour.

◆ stateReset()

void IRDaikin128::stateReset ( void  )
private

Reset the internal state to a fixed known good state.

◆ toCommon()

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

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

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

◆ toCommonFanSpeed()

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

Convert the current internal state into a human readable string.

Returns
A human readable string.

◆ validChecksum()

bool IRDaikin128::validChecksum ( uint8_t  state[])
static

Verify the checksum is valid for a given state.

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

Member Data Documentation

◆ _irsend

IRsend IRDaikin128::_irsend
private

instance of the IR send class

◆ remote_state

uint8_t IRDaikin128::remote_state[kDaikin128StateLength]
private

The state of the IR remote.


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