Go to the documentation of this file.
27 #define __STDC_LIMIT_MACROS
35 #include "IRsend_test.h"
88 #define TOSHIBA_AC_AUTO kToshibaAcAuto
89 #define TOSHIBA_AC_COOL kToshibaAcCool
90 #define TOSHIBA_AC_DRY kToshibaAcDry
91 #define TOSHIBA_AC_HEAT kToshibaAcHeat
92 #define TOSHIBA_AC_POWER kToshibaAcPower
93 #define TOSHIBA_AC_FAN_AUTO kToshibaAcFanAuto
94 #define TOSHIBA_AC_FAN_MAX kToshibaAcFanMax
95 #define TOSHIBA_AC_MIN_TEMP kToshibaAcMinTemp
96 #define TOSHIBA_AC_MAX_TEMP kToshibaAcMaxTemp
102 explicit IRToshibaAC(
const uint16_t pin,
const bool inverted =
false,
103 const bool use_modulation =
true);
112 #endif // SEND_TOSHIBA_AC
118 void setTemp(
const uint8_t degrees);
120 void setFan(
const uint8_t speed);
126 void setMode(
const uint8_t mode);
127 uint8_t
getMode(
const bool raw =
false);
128 void setRaw(
const uint8_t newState[]);
131 const uint16_t size);
135 uint8_t
getSwing(
const bool raw =
true);
136 void setSwing(
const uint8_t setting);
165 #endif // IR_TOSHIBA_H_
void off(void)
Set the requested power state of the A/C to off.
Definition: ir_Toshiba.cpp:190
static stdAc::opmode_t toCommonMode(const uint8_t mode)
Convert a native mode into its stdAc equivilant.
Definition: ir_Toshiba.cpp:377
Class for handling detailed Toshiba A/C messages.
Definition: ir_Toshiba.h:100
uint16_t getStateLength(void)
Get the length of the current internal state per the protocol structure.
Definition: ir_Toshiba.cpp:112
const uint8_t kToshibaAcSwingSize
Mask 0b000000xx.
Definition: ir_Toshiba.h:56
void setSwing(const uint8_t setting)
Set the swing setting of the A/C.
Definition: ir_Toshiba.cpp:255
const uint8_t kToshibaAcCool
Definition: ir_Toshiba.h:69
void setTurbo(const bool on)
Set the Turbo (Powerful) setting of the A/C.
Definition: ir_Toshiba.cpp:317
static uint8_t calcChecksum(const uint8_t state[], const uint16_t length=kToshibaACStateLength)
Calculate the checksum for a given state.
Definition: ir_Toshiba.cpp:153
uint8_t _swing_mode
The saved swing state/mode/command.
Definition: ir_Toshiba.h:156
void on(void)
Set the requested power state of the A/C to on.
Definition: ir_Toshiba.cpp:187
void _backupState(void)
Make a copy of the internal code-form A/C state.
Definition: ir_Toshiba.cpp:124
uint8_t convertMode(const stdAc::opmode_t mode)
Convert a stdAc::opmode_t enum into its native mode.
Definition: ir_Toshiba.cpp:349
fanspeed_t
Common A/C settings for Fan Speeds.
Definition: IRsend.h:58
static uint16_t getInternalStateLength(const uint8_t state[], const uint16_t size)
Get the length of the supplied Toshiba state per it's protocol structure.
Definition: ir_Toshiba.cpp:103
const uint8_t kToshibaAcFanAuto
Definition: ir_Toshiba.h:76
void send(const uint16_t repeat=kToshibaACMinRepeat)
Send the current internal state as IR messages.
Definition: ir_Toshiba.cpp:83
void setEcono(const bool on)
Set the Economy mode setting of the A/C.
Definition: ir_Toshiba.cpp:337
const uint16_t kToshibaAcInvertedLength
Nr. of leading bytes in inverted pairs.
Definition: ir_Toshiba.h:49
const uint8_t kToshibaAcModeOffset
Definition: ir_Toshiba.h:66
void setFan(const uint8_t speed)
Set the speed of the fan.
Definition: ir_Toshiba.cpp:227
stdAc::state_t toCommon(void)
Convert the current internal state into its stdAc::state_t equivilant.
Definition: ir_Toshiba.cpp:404
const uint8_t kToshibaAcMinTemp
17C
Definition: ir_Toshiba.h:63
IRsend _irsend
Instance of the IR send class.
Definition: ir_Toshiba.h:146
uint8_t getSwing(const bool raw=true)
Get the swing setting of the A/C.
Definition: ir_Toshiba.cpp:248
int8_t calibrate(void)
Run the calibration to calculate uSec timing offsets for this platform.
Definition: ir_Toshiba.h:111
uint8_t * getRaw(void)
Get a PTR to the internal state/code for this protocol with all integrity checks passing.
Definition: ir_Toshiba.cpp:136
void checksum(const uint16_t length=kToshibaACStateLength)
Calculate & set the checksum for the current internal state of the remote.
Definition: ir_Toshiba.cpp:171
Class for sending all basic IR protocols.
Definition: IRsend.h:176
bool getPower(void)
Get the value of the current power setting.
Definition: ir_Toshiba.cpp:205
uint8_t getMode(const bool raw=false)
Get the operating mode setting of the A/C.
Definition: ir_Toshiba.cpp:271
int8_t calibrate(uint16_t hz=38000U)
Calculate & set any offsets to account for execution times during sending.
Definition: IRsend.cpp:207
const uint8_t kToshibaAcSwingOn
0b01
Definition: ir_Toshiba.h:58
String toString(void)
Convert the current internal state into a human readable string.
Definition: ir_Toshiba.cpp:431
void setPower(const bool on)
Change the power setting.
Definition: ir_Toshiba.cpp:194
std::string String
Definition: IRremoteESP8266.h:1128
IRToshibaAC(const uint16_t pin, const bool inverted=false, const bool use_modulation=true)
Class constructor.
Definition: ir_Toshiba.cpp:62
const uint8_t kToshibaAcSwingOff
0b10
Definition: ir_Toshiba.h:59
const uint8_t kToshibaAcFanMed
Definition: ir_Toshiba.h:78
const uint8_t kToshibaAcLongMsgBit
Mask 0b00001000.
Definition: ir_Toshiba.h:53
const uint8_t kToshibaAcEcoTurboSize
Definition: ir_Toshiba.h:82
void begin(void)
Set up hardware to be able to send a message.
Definition: ir_Toshiba.cpp:78
const uint8_t kToshibaAcMinLength
Min Nr. of bytes in a message. Known lengths are: 1 (56 bit message) 3 (72 bit message) 4 (80 bit mes...
Definition: ir_Toshiba.h:43
const uint8_t kToshibaAcSwingStep
0b00
Definition: ir_Toshiba.h:57
void stateReset(void)
Reset the state of the remote to a known good state/sequence.
Definition: ir_Toshiba.cpp:68
const uint8_t kToshibaAcTempSize
Mask 0bxxxx0000.
Definition: ir_Toshiba.h:62
void _restoreState(void)
Recover the internal code-form A/C state from the backup.
Definition: ir_Toshiba.cpp:129
uint8_t getTemp(void)
Get the current temperature setting.
Definition: ir_Toshiba.cpp:220
const uint8_t kToshibaAcFan
Definition: ir_Toshiba.h:72
static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed)
Convert a native fan speed into its stdAc equivilant.
Definition: ir_Toshiba.cpp:391
const uint8_t kToshibaAcHeat
Definition: ir_Toshiba.h:71
void setMode(const uint8_t mode)
Set the operating mode of the A/C.
Definition: ir_Toshiba.cpp:285
uint8_t prev_mode
Store of the previously set mode.
Definition: ir_Toshiba.h:154
bool getEcono(void)
Get the Economy mode setting of the A/C.
Definition: ir_Toshiba.cpp:328
const uint8_t kToshibaAcTurboOn
Definition: ir_Toshiba.h:83
const uint8_t kToshibaAcModeSize
Definition: ir_Toshiba.h:67
void setRaw(const uint8_t newState[])
Set the internal state from a valid code for this protocol.
Definition: ir_Toshiba.cpp:143
const uint8_t kToshibaAcLengthByte
Byte pos of the "length" attribute.
Definition: ir_Toshiba.h:42
const uint16_t kToshibaACMinRepeat
Definition: IRremoteESP8266.h:1030
const uint16_t kToshibaACStateLength
Definition: IRremoteESP8266.h:1028
bool _send_swing
Flag indicating if we need to send a swing message.
Definition: ir_Toshiba.h:155
const uint16_t kToshibaACStateLengthLong
Definition: IRremoteESP8266.h:1033
static bool validChecksum(const uint8_t state[], const uint16_t length=kToshibaACStateLength)
Verify the checksum is valid for a given state.
Definition: ir_Toshiba.cpp:162
const uint8_t kToshibaAcFanSize
Definition: ir_Toshiba.h:75
const uint8_t kToshibaAcFanOffset
Definition: ir_Toshiba.h:74
const uint8_t kToshibaAcDry
Definition: ir_Toshiba.h:70
uint8_t backup[kToshibaACStateLengthLong]
A backup copy of the state.
Definition: ir_Toshiba.h:153
const uint8_t kToshibaAcAuto
Definition: ir_Toshiba.h:68
const uint8_t kToshibaAcShortMsgBit
Mask 0b00x00000.
Definition: ir_Toshiba.h:52
const uint8_t kToshibaAcMaxTemp
30C
Definition: ir_Toshiba.h:64
uint8_t convertFan(const stdAc::fanspeed_t speed)
Convert a stdAc::fanspeed_t enum into it's native speed.
Definition: ir_Toshiba.cpp:363
void setTemp(const uint8_t degrees)
Set the temperature.
Definition: ir_Toshiba.cpp:211
bool getTurbo(void)
Get the Turbo (Powerful) setting of the A/C.
Definition: ir_Toshiba.cpp:308
uint8_t remote_state[kToshibaACStateLengthLong]
The state in code form.
Definition: ir_Toshiba.h:152
const uint8_t kToshibaAcEcoTurboOffset
Definition: ir_Toshiba.h:81
const uint8_t kToshibaAcTempOffset
Bit offset.
Definition: ir_Toshiba.h:61
Structure to hold a common A/C state.
Definition: IRsend.h:97
uint8_t getFan(void)
Get the current fan speed setting.
Definition: ir_Toshiba.cpp:238
const uint8_t kToshibaAcFanMax
Definition: ir_Toshiba.h:79
const uint8_t kToshibaAcSwingOffset
Bit offset.
Definition: ir_Toshiba.h:55
const uint8_t kToshibaAcEconoOn
Definition: ir_Toshiba.h:84
const uint8_t kToshibaAcFanMin
Definition: ir_Toshiba.h:77
void setStateLength(const uint16_t size)
Set the internal length of the current internal state per the protocol.
Definition: ir_Toshiba.cpp:118
const uint8_t kToshibaAcOff
Definition: ir_Toshiba.h:73
opmode_t
Common A/C settings for A/C operating modes.
Definition: IRsend.h:46