IRremoteESP8266
|
Class for handling detailed Sharp A/C messages. More...
#include <ir_Sharp.h>
Public Member Functions | |
IRSharpAc (const uint16_t pin, const bool inverted=false, const bool use_modulation=true) | |
Class constructor. More... | |
void | send (const uint16_t repeat=kSharpAcDefaultRepeat) |
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, const bool prev_on=true) |
Change the power setting, including the previous power state. More... | |
bool | getPower (void) |
Get the value of the current power setting. More... | |
bool | isPowerSpecial (void) |
Is one of the special power states in use? More... | |
void | setTemp (const uint8_t temp, const bool save=true) |
Set the temperature. More... | |
uint8_t | getTemp (void) |
Get the current temperature setting. More... | |
void | setFan (const uint8_t fan, const bool save=true) |
Set the speed of the fan. More... | |
uint8_t | getFan (void) |
Get the current fan speed setting. More... | |
void | setMode (const uint8_t mode, const bool save=true) |
Set the operating mode of the A/C. More... | |
uint8_t | getMode (void) |
Get the operating mode setting of the A/C. More... | |
void | setSpecial (const uint8_t mode) |
Set the value of the Special (button/command?) setting. More... | |
uint8_t | getSpecial (void) |
Get the value of the Special (button/command?) setting. More... | |
bool | getTurbo (void) |
Get the Turbo setting of the A/C. More... | |
void | setTurbo (const bool on) |
Set the Turbo setting of the A/C. More... | |
bool | getSwingToggle (void) |
Get the (vertical) Swing Toggle setting of the A/C. More... | |
void | setSwingToggle (const bool on) |
Set the (vertical) Swing Toggle setting of the A/C. More... | |
bool | getIon (void) |
Get the Ion (Filter) setting of the A/C. More... | |
void | setIon (const bool on) |
Set the Ion (Filter) setting of the A/C. More... | |
bool | getEconoToggle (void) |
Get the Economical mode toggle setting of the A/C. More... | |
void | setEconoToggle (const bool on) |
Set the Economical mode toggle setting of the A/C. More... | |
uint16_t | getTimerTime (void) |
Get how long the timer is set for, in minutes. More... | |
bool | getTimerEnabled (void) |
Is the Timer enabled? More... | |
bool | getTimerType (void) |
Get the current timer type. More... | |
void | setTimer (bool enable, bool timer_type, uint16_t mins) |
Set or cancel the timer function. More... | |
bool | getClean (void) |
Get the Clean setting of the A/C. More... | |
void | setClean (const bool on) |
Set the Economical mode 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[], const uint16_t length=kSharpAcStateLength) |
Set the internal state from a valid code for this protocol. 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 (uint8_t state[], const uint16_t length=kSharpAcStateLength) |
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 state of the remote to a known good state/sequence. More... | |
void | checksum (void) |
Calculate and set the checksum values for the internal state. More... | |
void | setPowerSpecial (const uint8_t value) |
Set the value of the Power Special setting without any checks. More... | |
uint8_t | getPowerSpecial (void) |
Get the value of the Power Special setting. More... | |
void | clearPowerSpecial (void) |
Clear the "special"/non-normal bits in the power section. e.g. for normal/common command modes. More... | |
Static Private Member Functions | |
static uint8_t | calcChecksum (uint8_t state[], const uint16_t length=kSharpAcStateLength) |
Calculate the checksum for a given state. More... | |
Private Attributes | |
IRsend | _irsend |
Instance of the IR send class. More... | |
uint8_t | remote [kSharpAcStateLength] |
State of the remote in IR code form. More... | |
uint8_t | _temp |
Saved copy of the desired temp. More... | |
uint8_t | _mode |
Saved copy of the desired mode. More... | |
uint8_t | _fan |
Saved copy of the desired fan speed. More... | |
Class for handling detailed Sharp A/C messages.
|
explicit |
Class constructor.
[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? |
void IRSharpAc::begin | ( | void | ) |
Set up hardware to be able to send a message.
|
staticprivate |
Calculate the checksum for a given state.
[in] | state | The array to calc the checksum of. |
[in] | length | The length/size of the array. |
|
inline |
Run the calibration to calculate uSec timing offsets for this platform.
|
private |
Calculate and set the checksum values for the internal state.
|
private |
Clear the "special"/non-normal bits in the power section. e.g. for normal/common command modes.
|
static |
Convert a stdAc::fanspeed_t enum into it's native speed.
[in] | speed | The enum to be converted. |
|
static |
Convert a stdAc::opmode_t enum into its native mode.
[in] | mode | The enum to be converted. |
bool IRSharpAc::getClean | ( | void | ) |
Get the Clean setting of the A/C.
bool IRSharpAc::getEconoToggle | ( | void | ) |
Get the Economical mode toggle setting of the A/C.
uint8_t IRSharpAc::getFan | ( | void | ) |
Get the current fan speed setting.
bool IRSharpAc::getIon | ( | void | ) |
Get the Ion (Filter) setting of the A/C.
uint8_t IRSharpAc::getMode | ( | void | ) |
Get the operating mode setting of the A/C.
bool IRSharpAc::getPower | ( | void | ) |
Get the value of the current power setting.
|
private |
Get the value of the Power Special setting.
uint8_t * IRSharpAc::getRaw | ( | void | ) |
Get a PTR to the internal state/code for this protocol.
uint8_t IRSharpAc::getSpecial | ( | void | ) |
Get the value of the Special (button/command?) setting.
bool IRSharpAc::getSwingToggle | ( | void | ) |
Get the (vertical) Swing Toggle setting of the A/C.
uint8_t IRSharpAc::getTemp | ( | void | ) |
Get the current temperature setting.
bool IRSharpAc::getTimerEnabled | ( | void | ) |
Is the Timer enabled?
uint16_t IRSharpAc::getTimerTime | ( | void | ) |
Get how long the timer is set for, in minutes.
bool IRSharpAc::getTimerType | ( | void | ) |
Get the current timer type.
bool IRSharpAc::getTurbo | ( | void | ) |
Get the Turbo setting of the A/C.
bool IRSharpAc::isPowerSpecial | ( | void | ) |
Is one of the special power states in use?
void IRSharpAc::off | ( | void | ) |
Set the requested power state of the A/C to off.
void IRSharpAc::on | ( | void | ) |
Set the requested power state of the A/C to on.
void IRSharpAc::send | ( | const uint16_t | repeat = kSharpAcDefaultRepeat | ) |
Send the current internal state as an IR message.
[in] | repeat | Nr. of times the message will be repeated. |
void IRSharpAc::setClean | ( | const bool | on | ) |
Set the Economical mode toggle setting of the A/C.
[in] | on | true, the setting is on. false, the setting is off. |
void IRSharpAc::setEconoToggle | ( | const bool | on | ) |
Set the Economical mode toggle setting of the A/C.
[in] | on | true, the setting is on. false, the setting is off. |
setTurbo()
void IRSharpAc::setFan | ( | const uint8_t | speed, |
const bool | save = true |
||
) |
Set the speed of the fan.
[in] | speed | The desired setting. |
[in] | save | Do we save this setting as a user set one? |
void IRSharpAc::setIon | ( | const bool | on | ) |
Set the Ion (Filter) setting of the A/C.
[in] | on | true, the setting is on. false, the setting is off. |
void IRSharpAc::setMode | ( | const uint8_t | mode, |
const bool | save = true |
||
) |
Set the operating mode of the A/C.
[in] | mode | The desired operating mode. |
[in] | save | Do we save this setting as a user set one? |
void IRSharpAc::setPower | ( | const bool | on, |
const bool | prev_on = true |
||
) |
Change the power setting, including the previous power state.
[in] | on | true, the setting is on. false, the setting is off. |
[in] | prev_on | true, the setting is on. false, the setting is off. |
|
private |
Set the value of the Power Special setting without any checks.
[in] | value | The value to set Power Special to. |
void IRSharpAc::setRaw | ( | const uint8_t | new_code[], |
const uint16_t | length = kSharpAcStateLength |
||
) |
Set the internal state from a valid code for this protocol.
[in] | new_code | A valid code for this protocol. |
[in] | length | The length/size of the new_code array. |
void IRSharpAc::setSpecial | ( | const uint8_t | mode | ) |
Set the value of the Special (button/command?) setting.
[in] | mode | The value to set Special to. |
void IRSharpAc::setSwingToggle | ( | const bool | on | ) |
Set the (vertical) Swing Toggle setting of the A/C.
[in] | on | true, the setting is on. false, the setting is off. |
void IRSharpAc::setTemp | ( | const uint8_t | temp, |
const bool | save = true |
||
) |
Set the temperature.
[in] | temp | The temperature in degrees celsius. |
[in] | save | Do we save this setting as a user set one? |
void IRSharpAc::setTimer | ( | bool | enable, |
bool | timer_type, | ||
uint16_t | mins | ||
) |
Set or cancel the timer function.
[in] | enable | Is the timer to be enabled (true) or canceled(false)? |
[in] | timer_type | An On (true) or an Off (false). Ignored if canceled. |
[in] | mins | Nr. of minutes the timer is to be set to. |
void IRSharpAc::setTurbo | ( | const bool | on | ) |
Set the Turbo setting of the A/C.
[in] | on | true, the setting is on. false, the setting is off. |
|
private |
Reset the state of the remote to a known good state/sequence.
stdAc::state_t IRSharpAc::toCommon | ( | void | ) |
Convert the current internal state into its stdAc::state_t equivilant.
|
static |
|
static |
String IRSharpAc::toString | ( | void | ) |
Convert the current internal state into a human readable string.
|
static |
Verify the checksum is valid for a given state.
[in] | state | The array to verify the checksum of. |
[in] | length | The length/size of the array. |
|
private |
Saved copy of the desired fan speed.
|
private |
Instance of the IR send class.
|
private |
Saved copy of the desired mode.
|
private |
Saved copy of the desired temp.
|
private |
State of the remote in IR code form.