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

Class for handling detailed Mitsubishi 144-bit A/C messages. More...

#include <ir_Mitsubishi.h>

Collaboration diagram for IRMitsubishiAC:
Collaboration graph
[legend]

Public Member Functions

 IRMitsubishiAC (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=kMitsubishiACMinRepeat)
 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)
 Set the requested power state of the A/C to on. More...
 
void off (void)
 Set the requested power state of the A/C to off. More...
 
void setPower (const bool on)
 Change the power setting. More...
 
bool getPower (void) const
 Get the value of the current power setting. More...
 
void setTemp (const float degrees)
 Set the temperature. More...
 
float getTemp (void) const
 Get the current temperature setting. More...
 
void setFan (const uint8_t speed)
 Set the speed of the fan. More...
 
uint8_t getFan (void) const
 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) const
 Get the operating mode setting of the A/C. More...
 
void setVane (const uint8_t position)
 Set the requested vane (Vertical Swing) operation mode of the a/c unit. More...
 
void setWideVane (const uint8_t position)
 Set the requested wide-vane (Horizontal Swing) operation mode of the a/c. More...
 
uint8_t getVane (void) const
 Get the Vane (Vertical Swing) mode of the A/C. More...
 
uint8_t getWideVane (void) const
 Get the Wide Vane (Horizontal Swing) mode 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 *data)
 Set the internal state from a valid code for this protocol. More...
 
uint8_t getClock (void) const
 Get the clock time of the A/C unit. More...
 
void setClock (const uint8_t clock)
 Set the clock time on the A/C unit. More...
 
uint8_t getStartClock (void) const
 Get the desired start time of the A/C unit. More...
 
void setStartClock (const uint8_t clock)
 Set the desired start time of the A/C unit. More...
 
uint8_t getStopClock (void) const
 Get the desired stop time of the A/C unit. More...
 
void setStopClock (const uint8_t clock)
 Set the desired stop time of the A/C unit. More...
 
uint8_t getTimer (void) const
 Get the timers active setting of the A/C. More...
 
void setTimer (const uint8_t timer)
 Set the timers active setting of the A/C. More...
 
bool getWeeklyTimerEnabled (void) const
 Get the value of the WeeklyTimer Enabled setting. More...
 
void setWeeklyTimerEnabled (const bool on)
 Change the Weekly Timer Enabled setting. 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 internal state into a human readable string. More...
 

Static Public Member Functions

static bool validChecksum (const uint8_t *data)
 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::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...
 

Private Member Functions

void checksum (void)
 Calculate and set the checksum values for the internal state. More...
 

Static Private Member Functions

static uint8_t calculateChecksum (const uint8_t *data)
 Calculate the checksum for a given state. More...
 

Private Attributes

IRsend _irsend
 Instance of the IR send class. More...
 
Mitsubishi144Protocol _
 

Detailed Description

Class for handling detailed Mitsubishi 144-bit A/C messages.

Note
Inspired and derived from the work done at: https://github.com/r45635/HVAC-IR-Control
Warning
Consider this very alpha code. Seems to work, but not validated.

Constructor & Destructor Documentation

◆ IRMitsubishiAC()

IRMitsubishiAC::IRMitsubishiAC ( 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?
Warning
Consider this very alpha code. Seems to work, but not validated.

Member Function Documentation

◆ begin()

void IRMitsubishiAC::begin ( void  )

Set up hardware to be able to send a message.

◆ calculateChecksum()

uint8_t IRMitsubishiAC::calculateChecksum ( const uint8_t *  data)
staticprivate

Calculate the checksum for a given state.

Parameters
[in]dataThe value to calc the checksum of.
Returns
The calculated checksum value.

◆ calibrate()

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

Calculate and set the checksum values for the internal state.

◆ convertFan()

uint8_t IRMitsubishiAC::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 IRMitsubishiAC::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 IRMitsubishiAC::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 IRMitsubishiAC::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.
See also
https://github.com/crankyoldgit/IRremoteESP8266/issues/1399
https://github.com/crankyoldgit/IRremoteESP8266/pull/1401

◆ getClock()

uint8_t IRMitsubishiAC::getClock ( void  ) const

Get the clock time of the A/C unit.

Returns
Nr. of 10 minute increments past midnight.
Note
1 = 1/6 hour (10 minutes). e.g. 4pm = 48.

◆ getFan()

uint8_t IRMitsubishiAC::getFan ( void  ) const

Get the current fan speed setting.

Returns
The current fan speed/mode.

◆ getMode()

uint8_t IRMitsubishiAC::getMode ( void  ) const

Get the operating mode setting of the A/C.

Returns
The current operating mode setting.

◆ getPower()

bool IRMitsubishiAC::getPower ( void  ) const

Get the value of the current power setting.

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

◆ getRaw()

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

◆ getStartClock()

uint8_t IRMitsubishiAC::getStartClock ( void  ) const

Get the desired start time of the A/C unit.

Returns
Nr. of 10 minute increments past midnight.
Note
1 = 1/6 hour (10 minutes). e.g. 4pm = 48.

◆ getStopClock()

uint8_t IRMitsubishiAC::getStopClock ( void  ) const

Get the desired stop time of the A/C unit.

Returns
Nr. of 10 minute increments past midnight.
Note
1 = 1/6 hour (10 minutes). e.g. 10pm = 132.

◆ getTemp()

float IRMitsubishiAC::getTemp ( void  ) const

Get the current temperature setting.

Returns
The current setting for temp. in degrees celsius.
Note
The temperature resolution is 0.5 of a degree.

◆ getTimer()

uint8_t IRMitsubishiAC::getTimer ( void  ) const

Get the timers active setting of the A/C.

Returns
The current timers enabled.
Note
Possible values: kMitsubishiAcNoTimer, kMitsubishiAcStartTimer, kMitsubishiAcStopTimer, kMitsubishiAcStartStopTimer

◆ getVane()

uint8_t IRMitsubishiAC::getVane ( void  ) const

Get the Vane (Vertical Swing) mode of the A/C.

Returns
The native position/mode setting.

◆ getWeeklyTimerEnabled()

bool IRMitsubishiAC::getWeeklyTimerEnabled ( void  ) const

Get the value of the WeeklyTimer Enabled setting.

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

◆ getWideVane()

uint8_t IRMitsubishiAC::getWideVane ( void  ) const

Get the Wide Vane (Horizontal Swing) mode of the A/C.

Returns
The native position/mode setting.

◆ off()

void IRMitsubishiAC::off ( void  )

Set the requested power state of the A/C to off.

◆ on()

void IRMitsubishiAC::on ( void  )

Set the requested power state of the A/C to on.

◆ send()

void IRMitsubishiAC::send ( const uint16_t  repeat = kMitsubishiACMinRepeat)

Send the current internal state as an IR message.

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

◆ setClock()

void IRMitsubishiAC::setClock ( const uint8_t  clock)

Set the clock time on the A/C unit.

Parameters
[in]clockNr. of 10 minute increments past midnight.
Note
1 = 1/6 hour (10 minutes). e.g. 6am = 36.

◆ setFan()

void IRMitsubishiAC::setFan ( const uint8_t  speed)

Set the speed of the fan.

Parameters
[in]speedThe desired setting. 0 is auto, 1-5 is speed, 6 is silent.

◆ setMode()

void IRMitsubishiAC::setMode ( const uint8_t  mode)

Set the operating mode of the A/C.

Parameters
[in]modeThe desired operating mode.

◆ setPower()

void IRMitsubishiAC::setPower ( const bool  on)

Change the power setting.

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

◆ setRaw()

void IRMitsubishiAC::setRaw ( const uint8_t *  data)

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

Parameters
[in]dataA valid code for this protocol.

◆ setStartClock()

void IRMitsubishiAC::setStartClock ( const uint8_t  clock)

Set the desired start time of the A/C unit.

Parameters
[in]clockNr. of 10 minute increments past midnight.
Note
1 = 1/6 hour (10 minutes). e.g. 8pm = 120.

◆ setStopClock()

void IRMitsubishiAC::setStopClock ( const uint8_t  clock)

Set the desired stop time of the A/C unit.

Parameters
[in]clockNr. of 10 minute increments past midnight.
Note
1 = 1/6 hour (10 minutes). e.g. 10pm = 132.

◆ setTemp()

void IRMitsubishiAC::setTemp ( const float  degrees)

Set the temperature.

Parameters
[in]degreesThe temperature in degrees celsius.
Note
The temperature resolution is 0.5 of a degree.

◆ setTimer()

void IRMitsubishiAC::setTimer ( const uint8_t  timer)

Set the timers active setting of the A/C.

Parameters
[in]timerThe timer code indicating which ones are active.
Note
Possible values: kMitsubishiAcNoTimer, kMitsubishiAcStartTimer, kMitsubishiAcStopTimer, kMitsubishiAcStartStopTimer

◆ setVane()

void IRMitsubishiAC::setVane ( const uint8_t  position)

Set the requested vane (Vertical Swing) operation mode of the a/c unit.

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

◆ setWeeklyTimerEnabled()

void IRMitsubishiAC::setWeeklyTimerEnabled ( const bool  on)

Change the Weekly Timer Enabled setting.

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

◆ setWideVane()

void IRMitsubishiAC::setWideVane ( const uint8_t  position)

Set the requested wide-vane (Horizontal Swing) operation mode of the a/c.

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

◆ stateReset()

void IRMitsubishiAC::stateReset ( void  )

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

◆ toCommon()

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

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

Returns
The stdAc equivalent of the native settings.

◆ toCommonFanSpeed()

stdAc::fanspeed_t IRMitsubishiAC::toCommonFanSpeed ( const uint8_t  speed)
static

Convert a native fan speed into its stdAc equivalent.

Parameters
[in]speedThe native setting to be converted.
Returns
The stdAc equivalent of the native setting.

◆ toCommonMode()

stdAc::opmode_t IRMitsubishiAC::toCommonMode ( const uint8_t  mode)
static

Convert a native mode into its stdAc equivalent.

Parameters
[in]modeThe native setting to be converted.
Returns
The stdAc equivalent of the native setting.

◆ toCommonSwingH()

stdAc::swingh_t IRMitsubishiAC::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 IRMitsubishiAC::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.
See also
https://github.com/crankyoldgit/IRremoteESP8266/issues/1399
https://github.com/crankyoldgit/IRremoteESP8266/pull/1401

◆ toString()

String IRMitsubishiAC::toString ( void  ) const

Convert the internal state into a human readable string.

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

◆ validChecksum()

bool IRMitsubishiAC::validChecksum ( const uint8_t *  data)
static

Verify the checksum is valid for a given state.

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

Member Data Documentation

◆ _

Mitsubishi144Protocol IRMitsubishiAC::_
private

◆ _irsend

IRsend IRMitsubishiAC::_irsend
private

Instance of the IR send class.


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