IRremoteESP8266: IRPanasonicAc Class Reference (original) (raw)

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

#include <[ir_Panasonic.h](ir%5F%5FPanasonic%5F8h%5Fsource.html)>

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 equivalent. 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 equivalent. More...
static stdAc::fanspeed_t toCommonFanSpeed (const uint8_t speed)
Convert a native fan speed into its stdAc equivalent. 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...
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

Class for handling detailed Panasonic A/C messages.

IRPanasonicAc::IRPanasonicAc ( const uint16_t pin, const bool inverted = false, const bool use_modulation = true ) explicit

Class constructor.

Parameters

[in] pin GPIO to be used when sending.
[in] inverted Is the output signal to be inverted?
[in] use_modulation Is frequency modulation to be used?

_getTime()

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

Get the time from a given pointer location.

Parameters

[in] ptr A 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] ptr A pointer to a time location in a state.
[in] mins_since_midnight The time as nr. of minutes past midnight.
[in] round_down Do 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] state The value to calc the checksum of.
[in] length The 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()

Convert a stdAc::fanspeed_t enum into it's native speed.

Parameters

[in] speed The enum to be converted.

Returns

The native equivalent of the enum.

convertMode()

Convert a stdAc::opmode_t enum into its native mode.

Parameters

[in] mode The enum to be converted.

Returns

The native equivalent 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

Returns

The equivalent 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

Returns

The equivalent 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] hours The hours component of the time.
[in] mins The minutes component of the time.

Returns

The nr of minutes since midnight.

fixChecksum()

Calculate and set the checksum values for the internal state.

Parameters

[in] length The 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()

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

Send the current internal state as an IR message.

Parameters

[in] repeat Nr. 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_midnight The time as nr. of minutes past midnight.

setFan()

void IRPanasonicAc::setFan ( const uint8_t speed )

Set the speed of the fan.

Parameters

[in] speed The desired setting.

setIon()

void IRPanasonicAc::setIon ( const bool on )

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

Parameters

[in] on true, 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] desired The desired operating mode.

setModel()

Set the model of the A/C to emulate.

Parameters

[in] model The 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_midnight The time as nr. of minutes past midnight.
[in] enable Do 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_midnight The time as nr. of minutes past midnight.
[in] enable Do we enable the timer or not?

setPower()

void IRPanasonicAc::setPower ( const bool on )

Control the power state of the A/C unit.

Parameters

[in] on true, 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 message. 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] on true, 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] on true, 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] state A valid code for this protocol.

setSwingHorizontal()

void IRPanasonicAc::setSwingHorizontal ( const uint8_t desired_direction )

Control the horizontal swing setting.

Parameters

[in] desired_direction The position to set the horizontal swing to.

setSwingVertical()

void IRPanasonicAc::setSwingVertical ( const uint8_t desired_elevation )

Control the vertical swing setting.

Parameters

[in] desired_elevation The position to set the vertical swing to.

setTemp()

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

Set the temperature.

Parameters

[in] celsius The temperature in degrees celsius.
[in] remember A 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()

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

Returns

The stdAc equivalent of the native settings.

toCommonFanSpeed()

Convert a native fan speed into its stdAc equivalent.

Parameters

[in] spd The native setting to be converted.

Returns

The stdAc equivalent of the native setting.

toCommonMode()

Convert a native mode into its stdAc equivalent.

Parameters

[in] mode The native setting to be converted.

Returns

The stdAc equivalent of the native setting.

toCommonSwingH()

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

Parameters

[in] pos A native position to convert.

Returns

The common horizontal swing position.

toCommonSwingV()

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

Parameters

[in] pos A 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] state The array to verify the checksum of.
[in] length The length of the state array.

Returns

true, if the state has a valid checksum. Otherwise, false.

_irsend

Instance of the IR send class.

_swingh

uint8_t IRPanasonicAc::_swingh private

_temp

uint8_t IRPanasonicAc::_temp private

remote_state


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