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

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

#include <ir_Toshiba.h>

Collaboration diagram for IRToshibaAC:
Collaboration graph
[legend]

Public Member Functions

 IRToshibaAC (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=kToshibaACMinRepeat)
 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)
 Get the value of the current power setting. More...
 
void setTemp (const uint8_t degrees)
 Set the temperature. More...
 
uint8_t getTemp (void)
 Get the current temperature setting. More...
 
void setFan (const uint8_t speed)
 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 (const bool useRaw=false)
 Get the operating mode setting of the A/C. More...
 
void setRaw (const uint8_t newState[])
 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...
 
uint8_t convertMode (const stdAc::opmode_t mode)
 Convert a stdAc::opmode_t enum into its native mode. More...
 
uint8_t convertFan (const stdAc::fanspeed_t speed)
 Convert a stdAc::fanspeed_t enum into it's native speed. More...
 
stdAc::state_t toCommon (void)
 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 (const uint8_t state[], const uint16_t length=kToshibaACStateLength)
 Verify the checksum is valid for a given state. 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 checksum (const uint16_t length=kToshibaACStateLength)
 Calculate & set the checksum for the current internal state of the remote. More...
 

Static Private Member Functions

static uint8_t calcChecksum (const uint8_t state[], const uint16_t length=kToshibaACStateLength)
 Calculate the checksum for a given state. More...
 

Private Attributes

IRsend _irsend
 Instance of the IR send class. More...
 
uint8_t remote_state [kToshibaACStateLength]
 The state in IR code form. More...
 
uint8_t mode_state
 

Detailed Description

Class for handling detailed Toshiba A/C messages.

Constructor & Destructor Documentation

◆ IRToshibaAC()

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

Set up hardware to be able to send a message.

◆ calcChecksum()

uint8_t IRToshibaAC::calcChecksum ( const uint8_t  state[],
const uint16_t  length = kToshibaACStateLength 
)
staticprivate

Calculate the checksum for a given state.

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

◆ calibrate()

int8_t IRToshibaAC::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 IRToshibaAC::checksum ( const uint16_t  length = kToshibaACStateLength)
private

Calculate & set the checksum for the current internal state of the remote.

Parameters
[in]lengthThe length/size of the internal array to checksum.

◆ convertFan()

uint8_t IRToshibaAC::convertFan ( const stdAc::fanspeed_t  speed)

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 IRToshibaAC::convertMode ( const stdAc::opmode_t  mode)

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

Parameters
[in]modeThe enum to be converted.
Returns
The native equivilant of the enum.

◆ getFan()

uint8_t IRToshibaAC::getFan ( void  )

Get the current fan speed setting.

Returns
The current fan speed/mode.

◆ getMode()

uint8_t IRToshibaAC::getMode ( const bool  useRaw = false)

Get the operating mode setting of the A/C.

Parameters
[in]useRawIndicate to get the mode from the internal state array.
Returns
The current operating mode setting.

◆ getPower()

bool IRToshibaAC::getPower ( void  )

Get the value of the current power setting.

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

◆ getRaw()

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

◆ getTemp()

uint8_t IRToshibaAC::getTemp ( void  )

Get the current temperature setting.

Returns
The current setting for temp. in degrees celsius.

◆ off()

void IRToshibaAC::off ( void  )

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

◆ on()

void IRToshibaAC::on ( void  )

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

◆ send()

void IRToshibaAC::send ( const uint16_t  repeat = kToshibaACMinRepeat)

Send the current internal state as an IR message.

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

◆ setFan()

void IRToshibaAC::setFan ( const uint8_t  speed)

Set the speed of the fan.

Parameters
[in]speedThe desired setting (0 is Auto, 1-5 is the speed, 5 is Max)

◆ setMode()

void IRToshibaAC::setMode ( const uint8_t  mode)

Set the operating mode of the A/C.

Parameters
[in]modeThe desired operating mode.
Note
If we get an unexpected mode, default to AUTO.

◆ setPower()

void IRToshibaAC::setPower ( const bool  on)

Change the power setting.

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

◆ setRaw()

void IRToshibaAC::setRaw ( const uint8_t  newState[])

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

Parameters
[in]newStateA valid code for this protocol.

◆ setTemp()

void IRToshibaAC::setTemp ( const uint8_t  degrees)

Set the temperature.

Parameters
[in]degreesThe temperature in degrees celsius.

◆ stateReset()

void IRToshibaAC::stateReset ( void  )

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

See also
https://github.com/r45635/HVAC-IR-Control/blob/master/HVAC_ESP8266/HVAC_ESP8266T.ino#L103

◆ toCommon()

stdAc::state_t IRToshibaAC::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 IRToshibaAC::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 IRToshibaAC::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 IRToshibaAC::toString ( void  )

Convert the current internal state into a human readable string.

Returns
A human readable string.

◆ validChecksum()

bool IRToshibaAC::validChecksum ( const uint8_t  state[],
const uint16_t  length = kToshibaACStateLength 
)
static

Verify the checksum is valid for a given state.

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

Member Data Documentation

◆ _irsend

IRsend IRToshibaAC::_irsend
private

Instance of the IR send class.

◆ mode_state

uint8_t IRToshibaAC::mode_state
private

◆ remote_state

uint8_t IRToshibaAC::remote_state[kToshibaACStateLength]
private

The state in IR code form.


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