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 | setModel (const sharp_ac_remote_model_t model) |
Set the model of the A/C to emulate. More... | |
sharp_ac_remote_model_t | getModel (const bool raw=false) const |
Get/Detect the model of the A/C. 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) const |
Get the value of the current power setting. More... | |
bool | isPowerSpecial (void) const |
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) const |
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) const |
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) const |
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) const |
Get the value of the Special (button/command?) setting. More... | |
bool | getTurbo (void) const |
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) const |
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... | |
uint8_t | getSwingV (void) const |
Get the Vertical Swing setting of the A/C. More... | |
void | setSwingV (const uint8_t position, const bool force=false) |
Set the Vertical Swing setting of the A/C. More... | |
bool | getIon (void) const |
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) const |
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... | |
bool | getLightToggle (void) const |
Get the Light toggle setting of the A/C. More... | |
void | setLightToggle (const bool on) |
Set the Light mode toggle setting of the A/C. More... | |
uint16_t | getTimerTime (void) const |
Get how long the timer is set for, in minutes. More... | |
bool | getTimerEnabled (void) const |
Is the Timer enabled? More... | |
bool | getTimerType (void) const |
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) const |
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::opmode_t | toCommonMode (const uint8_t mode) const |
Convert a native mode into its stdAc equivalent. More... | |
stdAc::fanspeed_t | toCommonFanSpeed (const uint8_t speed) const |
Convert a native fan speed into its stdAc equivalent. More... | |
stdAc::swingv_t | toCommonSwingV (const uint8_t pos, const stdAc::opmode_t mode=stdAc::opmode_t::kHeat) const |
Convert a native vertical swing postion to it's common equivalent. More... | |
stdAc::state_t | toCommon (const stdAc::state_t *prev=NULL) const |
Convert the current internal state into its stdAc::state_t equivalent. More... | |
String | toString (void) const |
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, const sharp_ac_remote_model_t model=sharp_ac_remote_model_t::A907) |
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... | |
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) const |
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... | |
bool | _getEconoToggle (void) const |
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... | |
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... | |
SharpProtocol | _ |
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... | |
sharp_ac_remote_model_t | _model |
Saved copy of the model. 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? |
|
private |
Get the Economical mode toggle setting of the A/C.
|
private |
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::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. |
[in] | model | The enum of the appropriate model. |
|
static |
Convert a stdAc::opmode_t enum into its native mode.
[in] | mode | The enum to be converted. |
|
static |
Convert a standard A/C vertical swing into its native setting.
[in] | position | A stdAc::swingv_t position to convert. |
bool IRSharpAc::getClean | ( | void | ) | const |
Get the Clean setting of the A/C.
bool IRSharpAc::getEconoToggle | ( | void | ) | const |
Get the Economical mode toggle setting of the A/C.
uint8_t IRSharpAc::getFan | ( | void | ) | const |
Get the current fan speed setting.
bool IRSharpAc::getIon | ( | void | ) | const |
Get the Ion (Filter) setting of the A/C.
bool IRSharpAc::getLightToggle | ( | void | ) | const |
Get the Light toggle setting of the A/C.
uint8_t IRSharpAc::getMode | ( | void | ) | const |
Get the operating mode setting of the A/C.
sharp_ac_remote_model_t IRSharpAc::getModel | ( | const bool | raw = false | ) | const |
Get/Detect the model of the A/C.
[in] | raw | Try to determine the model from the raw code only. |
bool IRSharpAc::getPower | ( | void | ) | const |
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 | ) | const |
Get the value of the Special (button/command?) setting.
bool IRSharpAc::getSwingToggle | ( | void | ) | const |
Get the (vertical) Swing Toggle setting of the A/C.
uint8_t IRSharpAc::getSwingV | ( | void | ) | const |
Get the Vertical Swing setting of the A/C.
uint8_t IRSharpAc::getTemp | ( | void | ) | const |
Get the current temperature setting.
bool IRSharpAc::getTimerEnabled | ( | void | ) | const |
Is the Timer enabled?
uint16_t IRSharpAc::getTimerTime | ( | void | ) | const |
Get how long the timer is set for, in minutes.
bool IRSharpAc::getTimerType | ( | void | ) | const |
Get the current timer type.
bool IRSharpAc::getTurbo | ( | void | ) | const |
Get the Turbo setting of the A/C.
bool IRSharpAc::isPowerSpecial | ( | void | ) | const |
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::setLightToggle | ( | const bool | on | ) |
Set the Light mode toggle setting of the A/C.
[in] | on | true, the setting is on. false, the setting is off. |
setTurbo()
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::setModel | ( | const sharp_ac_remote_model_t | model | ) |
Set the model of the A/C to emulate.
[in] | model | The enum of the appropriate model. |
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. |
|
inlineprivate |
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::setSwingV | ( | const uint8_t | position, |
const bool | force = false |
||
) |
Set the Vertical Swing setting of the A/C.
[in] | position | The desired position/setting. |
setSwingV(kSharpAcSwingVLowest)
will only allow the Lowest setting in Heat mode, it will default to kSharpAcSwingVLow
otherwise. If you want to set this value in other modes e.g. Cool, you must use setSwingV
s optional force
parameter. [in] | force | Do we override the safety checks and just do it? |
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 | ( | const stdAc::state_t * | prev = NULL | ) | const |
Convert the current internal state into its stdAc::state_t equivalent.
[in] | prev | Ptr to the previous state if required. |
stdAc::fanspeed_t IRSharpAc::toCommonFanSpeed | ( | const uint8_t | speed | ) | const |
stdAc::opmode_t IRSharpAc::toCommonMode | ( | const uint8_t | mode | ) | const |
stdAc::swingv_t IRSharpAc::toCommonSwingV | ( | const uint8_t | pos, |
const stdAc::opmode_t | mode = stdAc::opmode_t::kHeat |
||
) | const |
Convert a native vertical swing postion to it's common equivalent.
[in] | pos | A native position to convert. |
[in] | mode | What operating mode are we in? |
String IRSharpAc::toString | ( | void | ) | const |
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 |
|
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 model.
|
private |
Saved copy of the desired temp.