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

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

#include <ir_Panasonic.h>

Collaboration diagram for IRPanasonicAc:
Collaboration graph
[legend]

Public Member Functions

 IRPanasonicAc (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=kPanasonicAcDefaultRepeat)
 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 on)
 Control the power state of the A/C unit. More...
 
bool getPower (void)
 Get the A/C power state of the remote. More...
 
void setTemp (const uint8_t temp, const bool remember=true)
 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...
 
void setMode (const uint8_t mode)
 Set the operating mode of the A/C. More...
 
uint8_t getMode (void)
 Get the operating mode setting of the A/C. More...
 
void setRaw (const uint8_t state[])
 Set the internal state from a valid code for this protocol. More...
 
uint8_t * getRaw (void)
 Get a PTR to the internal state/code for this protocol. More...
 
void setQuiet (const bool on)
 Set the Quiet setting of the A/C. More...
 
bool getQuiet (void)
 Get the Quiet setting of the A/C. More...
 
void setPowerful (const bool on)
 Set the Powerful (Turbo) setting of the A/C. More...
 
bool getPowerful (void)
 Get the Powerful (Turbo) setting of the A/C. More...
 
void setIon (const bool on)
 Set the Ion (filter) setting of the A/C. More...
 
bool getIon (void)
 Get the Ion (filter) setting of the A/C. More...
 
void setModel (const panasonic_ac_remote_model_t model)
 Set the model of the A/C to emulate. More...
 
panasonic_ac_remote_model_t getModel (void)
 Get/Detect the model of the A/C. More...
 
void setSwingVertical (const uint8_t elevation)
 Control the vertical swing setting. More...
 
uint8_t getSwingVertical (void)
 Get the current vertical swing setting. More...
 
void setSwingHorizontal (const uint8_t direction)
 Control the horizontal swing setting. More...
 
uint8_t getSwingHorizontal (void)
 Get the current horizontal swing setting. More...
 
uint16_t getClock (void)
 Get the current clock time value. More...
 
void setClock (const uint16_t mins_since_midnight)
 Set the current clock time value. More...
 
uint16_t getOnTimer (void)
 Get the On Timer time value. More...
 
void setOnTimer (const uint16_t mins_since_midnight, const bool enable=true)
 Set/Enable the On Timer. More...
 
void cancelOnTimer (void)
 Cancel the On Timer. More...
 
bool isOnTimerEnabled (void)
 Check if the On Timer is Enabled. More...
 
uint16_t getOffTimer (void)
 Get the Off Timer time value. More...
 
void setOffTimer (const uint16_t mins_since_midnight, const bool enable=true)
 Set/Enable the Off Timer. More...
 
void cancelOffTimer (void)
 Cancel the Off Timer. More...
 
bool isOffTimerEnabled (void)
 Check if the Off Timer is Enabled. More...
 
stdAc::state_t toCommon (void)
 Convert the current internal state into its stdAc::state_t equivilant. More...
 
String toString (void)
 Convert the internal state into a human readable string. More...
 

Static Public Member Functions

static bool validChecksum (const uint8_t *state, const uint16_t length=kPanasonicAcStateLength)
 Verify the checksum is valid for a given state. More...
 
static uint8_t calcChecksum (const uint8_t *state, const uint16_t length=kPanasonicAcStateLength)
 Calculate the checksum for a given state. More...
 
static uint16_t encodeTime (const uint8_t hours, const uint8_t mins)
 Convert standard (military/24hr) time to nr. of minutes since midnight. 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 standard A/C vertical swing into its native setting. More...
 
static uint8_t convertSwingH (const stdAc::swingh_t position)
 Convert a standard A/C horizontal swing into its native setting. 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...
 
static stdAc::swingv_t toCommonSwingV (const uint8_t pos)
 Convert a native vertical swing postion to it's common equivalent. More...
 
static stdAc::swingh_t toCommonSwingH (const uint8_t pos)
 Convert a native horizontal swing postion to it's common equivalent. More...
 

Private Member Functions

void fixChecksum (const uint16_t length=kPanasonicAcStateLength)
 Calculate and set the checksum values for the internal state. More...
 

Static Private Member Functions

static uint16_t _getTime (const uint8_t ptr[])
 Get the time from a given pointer location. More...
 
static void _setTime (uint8_t *const ptr, const uint16_t mins_since_midnight, const bool round_down)
 Set the time at a given pointer location. More...
 

Private Attributes

IRsend _irsend
 Instance of the IR send class. More...
 
uint8_t remote_state [kPanasonicAcStateLength]
 The state in code form. More...
 
uint8_t _swingh
 
uint8_t _temp
 

Detailed Description

Class for handling detailed Panasonic A/C messages.

Constructor & Destructor Documentation

◆ IRPanasonicAc()

IRPanasonicAc::IRPanasonicAc ( 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

◆ _getTime()

uint16_t IRPanasonicAc::_getTime ( const uint8_t  ptr[])
staticprivate

Get the time from a given pointer location.

Parameters
[in]ptrA pointer to a time location in a state.
Returns
The time expressed as nr. of minutes past midnight.
Note
Internal use only.

◆ _setTime()

void IRPanasonicAc::_setTime ( uint8_t *const  ptr,
const uint16_t  mins_since_midnight,
const bool  round_down 
)
staticprivate

Set the time at a given pointer location.

Parameters
[in,out]ptrA pointer to a time location in a state.
[in]mins_since_midnightThe time as nr. of minutes past midnight.
[in]round_downDo we round to the nearest 10 minute mark?
Note
Internal use only.

◆ begin()

void IRPanasonicAc::begin ( void  )

Set up hardware to be able to send a message.

◆ calcChecksum()

uint8_t IRPanasonicAc::calcChecksum ( const uint8_t *  state,
const uint16_t  length = kPanasonicAcStateLength 
)
static

Calculate the checksum for a given state.

Parameters
[in]stateThe value to calc the checksum of.
[in]lengthThe size/length of the state.
Returns
The calculated checksum value.

◆ calibrate()

int8_t IRPanasonicAc::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.

◆ cancelOffTimer()

void IRPanasonicAc::cancelOffTimer ( void  )

Cancel the Off Timer.

◆ cancelOnTimer()

void IRPanasonicAc::cancelOnTimer ( void  )

Cancel the On Timer.

◆ convertFan()

uint8_t IRPanasonicAc::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 IRPanasonicAc::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 IRPanasonicAc::convertSwingH ( const stdAc::swingh_t  position)
static

Convert a standard A/C horizontal swing into its native setting.

Parameters
[in]positionA stdAc::swingh_t position to convert.
Returns
The equivilent native horizontal swing position.

◆ convertSwingV()

uint8_t IRPanasonicAc::convertSwingV ( const stdAc::swingv_t  position)
static

Convert a standard A/C vertical swing into its native setting.

Parameters
[in]positionA stdAc::swingv_t position to convert.
Returns
The equivilent native horizontal swing position.

◆ encodeTime()

uint16_t IRPanasonicAc::encodeTime ( const uint8_t  hours,
const uint8_t  mins 
)
static

Convert standard (military/24hr) time to nr. of minutes since midnight.

Parameters
[in]hoursThe hours component of the time.
[in]minsThe minutes component of the time.
Returns
The nr of minutes since midnight.

◆ fixChecksum()

void IRPanasonicAc::fixChecksum ( const uint16_t  length = kPanasonicAcStateLength)
private

Calculate and set the checksum values for the internal state.

Parameters
[in]lengthThe size/length of the state.

◆ getClock()

uint16_t IRPanasonicAc::getClock ( void  )

Get the current clock time value.

Returns
The time expressed as nr. of minutes past midnight.

◆ getFan()

uint8_t IRPanasonicAc::getFan ( void  )

Get the current fan speed setting.

Returns
The current fan speed.

◆ getIon()

bool IRPanasonicAc::getIon ( void  )

Get the Ion (filter) setting of the A/C.

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

◆ getMode()

uint8_t IRPanasonicAc::getMode ( void  )

Get the operating mode setting of the A/C.

Returns
The current operating mode setting.

◆ getModel()

panasonic_ac_remote_model_t IRPanasonicAc::getModel ( void  )

Get/Detect the model of the A/C.

Returns
The enum of the compatible model.

◆ getOffTimer()

uint16_t IRPanasonicAc::getOffTimer ( void  )

Get the Off Timer time value.

Returns
The time expressed as nr. of minutes past midnight.

◆ getOnTimer()

uint16_t IRPanasonicAc::getOnTimer ( void  )

Get the On Timer time value.

Returns
The time expressed as nr. of minutes past midnight.

◆ getPower()

bool IRPanasonicAc::getPower ( void  )

Get the A/C power state of the remote.

Returns
true, the setting is on. false, the setting is off.
Warning
Except for CKP models, where it returns if the power state will be toggled on the A/C unit when the next message is sent.

◆ getPowerful()

bool IRPanasonicAc::getPowerful ( void  )

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

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

◆ getQuiet()

bool IRPanasonicAc::getQuiet ( void  )

Get the Quiet setting of the A/C.

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

◆ getRaw()

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

◆ getSwingHorizontal()

uint8_t IRPanasonicAc::getSwingHorizontal ( void  )

Get the current horizontal swing setting.

Returns
The current position it is set to.

◆ getSwingVertical()

uint8_t IRPanasonicAc::getSwingVertical ( void  )

Get the current vertical swing setting.

Returns
The current position it is set to.

◆ getTemp()

uint8_t IRPanasonicAc::getTemp ( void  )

Get the current temperature setting.

Returns
The current setting for temp. in degrees celsius.

◆ isOffTimerEnabled()

bool IRPanasonicAc::isOffTimerEnabled ( void  )

Check if the Off Timer is Enabled.

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

◆ isOnTimerEnabled()

bool IRPanasonicAc::isOnTimerEnabled ( void  )

Check if the On Timer is Enabled.

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

◆ off()

void IRPanasonicAc::off ( void  )

Change the power setting to Off.

◆ on()

void IRPanasonicAc::on ( void  )

Change the power setting to On.

◆ send()

void IRPanasonicAc::send ( const uint16_t  repeat = kPanasonicAcDefaultRepeat)

Send the current internal state as an IR message.

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

◆ setClock()

void IRPanasonicAc::setClock ( const uint16_t  mins_since_midnight)

Set the current clock time value.

Parameters
[in]mins_since_midnightThe time as nr. of minutes past midnight.

◆ setFan()

void IRPanasonicAc::setFan ( const uint8_t  speed)

Set the speed of the fan.

Parameters
[in]speedThe desired setting.

◆ setIon()

void IRPanasonicAc::setIon ( const bool  on)

Set the Ion (filter) setting of the A/C.

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

◆ setMode()

void IRPanasonicAc::setMode ( const uint8_t  desired)

Set the operating mode of the A/C.

Parameters
[in]desiredThe desired operating mode.

◆ setModel()

void IRPanasonicAc::setModel ( const panasonic_ac_remote_model_t  model)

Set the model of the A/C to emulate.

Parameters
[in]modelThe enum of the appropriate model.

◆ setOffTimer()

void IRPanasonicAc::setOffTimer ( const uint16_t  mins_since_midnight,
const bool  enable = true 
)

Set/Enable the Off Timer.

Parameters
[in]mins_since_midnightThe time as nr. of minutes past midnight.
[in]enableDo we enable the timer or not?

◆ setOnTimer()

void IRPanasonicAc::setOnTimer ( const uint16_t  mins_since_midnight,
const bool  enable = true 
)

Set/Enable the On Timer.

Parameters
[in]mins_since_midnightThe time as nr. of minutes past midnight.
[in]enableDo we enable the timer or not?

◆ setPower()

void IRPanasonicAc::setPower ( const bool  on)

Control the power state of the A/C unit.

Parameters
[in]ontrue, the setting is on. false, the setting is off.
Warning
For CKP models, the remote has no memory of the power state the A/C unit should be in. For those models setting this on/true will toggle the power state of the Panasonic A/C unit with the next meessage. e.g. If the A/C unit is already on, setPower(true) will turn it off. If the A/C unit is already off, setPower(true) will turn it on. setPower(false) will leave the A/C power state as it was. For all other models, setPower(true) should set the internal state to turn it on, and setPower(false) should turn it off.

◆ setPowerful()

void IRPanasonicAc::setPowerful ( const bool  on)

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

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

◆ setQuiet()

void IRPanasonicAc::setQuiet ( const bool  on)

Set the Quiet setting of the A/C.

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

◆ setRaw()

void IRPanasonicAc::setRaw ( const uint8_t  state[])

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

Parameters
[in]stateA valid code for this protocol.

◆ setSwingHorizontal()

void IRPanasonicAc::setSwingHorizontal ( const uint8_t  desired_direction)

Control the horizontal swing setting.

Parameters
[in]desired_directionThe position to set the horizontal swing to.

◆ setSwingVertical()

void IRPanasonicAc::setSwingVertical ( const uint8_t  desired_elevation)

Control the vertical swing setting.

Parameters
[in]desired_elevationThe position to set the vertical swing to.

◆ setTemp()

void IRPanasonicAc::setTemp ( const uint8_t  celsius,
const bool  remember = true 
)

Set the temperature.

Parameters
[in]celsiusThe temperature in degrees celsius.
[in]rememberA flag for the class to remember the temperature.
Note
Automatically safely limits the temp to the operating range supported.

◆ stateReset()

void IRPanasonicAc::stateReset ( void  )

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

◆ toCommon()

stdAc::state_t IRPanasonicAc::toCommon ( void  )

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

Returns
The stdAc equivilant of the native settings.

◆ toCommonFanSpeed()

stdAc::fanspeed_t IRPanasonicAc::toCommonFanSpeed ( const uint8_t  spd)
static

Convert a native fan speed into its stdAc equivilant.

Parameters
[in]spdThe native setting to be converted.
Returns
The stdAc equivilant of the native setting.

◆ toCommonMode()

stdAc::opmode_t IRPanasonicAc::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.

◆ toCommonSwingH()

stdAc::swingh_t IRPanasonicAc::toCommonSwingH ( const uint8_t  pos)
static

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

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

◆ toCommonSwingV()

stdAc::swingv_t IRPanasonicAc::toCommonSwingV ( const uint8_t  pos)
static

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

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

◆ toString()

String IRPanasonicAc::toString ( void  )

Convert the internal state into a human readable string.

Returns
A string containing the settings in human-readable form.

◆ validChecksum()

bool IRPanasonicAc::validChecksum ( const uint8_t *  state,
const uint16_t  length = kPanasonicAcStateLength 
)
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 IRPanasonicAc::_irsend
private

Instance of the IR send class.

◆ _swingh

uint8_t IRPanasonicAc::_swingh
private

◆ _temp

uint8_t IRPanasonicAc::_temp
private

◆ remote_state

uint8_t IRPanasonicAc::remote_state[kPanasonicAcStateLength]
private

The state in code form.


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