32#define __STDC_LIMIT_MACROS
40#include "IRsend_test.h"
122#define TOSHIBA_AC_AUTO kToshibaAcAuto
123#define TOSHIBA_AC_COOL kToshibaAcCool
124#define TOSHIBA_AC_DRY kToshibaAcDry
125#define TOSHIBA_AC_HEAT kToshibaAcHeat
126#define TOSHIBA_AC_POWER kToshibaAcPower
127#define TOSHIBA_AC_FAN_AUTO kToshibaAcFanAuto
128#define TOSHIBA_AC_FAN_MAX kToshibaAcFanMax
129#define TOSHIBA_AC_MIN_TEMP kToshibaAcMinTemp
130#define TOSHIBA_AC_MAX_TEMP kToshibaAcMaxTemp
136 explicit IRToshibaAC(
const uint16_t pin,
const bool inverted =
false,
137 const bool use_modulation =
true);
154 void setTemp(
const uint8_t degrees);
156 void setFan(
const uint8_t speed);
157 uint8_t
getFan(
void)
const;
164 void setMode(
const uint8_t mode);
165 uint8_t
getMode(
const bool raw =
false)
const;
166 void setRaw(
const uint8_t newState[],
170 const uint16_t size);
174 uint8_t
getSwing(
const bool raw =
true)
const;
175 void setSwing(
const uint8_t setting);
const uint16_t kToshibaACStateLengthLong
Definition IRremoteESP8266.h:1434
const uint16_t kToshibaACMinRepeat
Definition IRremoteESP8266.h:1431
const uint16_t kToshibaACStateLength
Definition IRremoteESP8266.h:1429
std::string String
Definition IRremoteESP8266.h:1564
toshiba_ac_remote_model_t
Toshiba A/C model numbers.
Definition IRsend.h:237
Class for handling detailed Toshiba A/C messages.
Definition ir_Toshiba.h:134
void setFan(const uint8_t speed)
Set the speed of the fan.
Definition ir_Toshiba.cpp:225
static uint8_t calcChecksum(const uint8_t state[], const uint16_t length=kToshibaACStateLength)
Calculate the checksum for a given state.
Definition ir_Toshiba.cpp:157
void setPower(const bool on)
Change the power setting.
Definition ir_Toshiba.cpp:196
void _backupState(void)
Make a copy of the internal code-form A/C state.
Definition ir_Toshiba.cpp:127
bool getEcono(void) const
Get the Economy mode setting of the A/C.
Definition ir_Toshiba.cpp:324
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:105
void send(const uint16_t repeat=kToshibaACMinRepeat)
Send the current internal state as IR messages.
Definition ir_Toshiba.cpp:85
uint8_t getSwing(const bool raw=true) const
Get the swing setting of the A/C.
Definition ir_Toshiba.cpp:245
static uint8_t convertMode(const stdAc::opmode_t mode)
Convert a stdAc::opmode_t enum into its native mode.
Definition ir_Toshiba.cpp:358
void _restoreState(void)
Recover the internal code-form A/C state from the backup.
Definition ir_Toshiba.cpp:132
String toString(void) const
Convert the current internal state into a human readable string.
Definition ir_Toshiba.cpp:464
uint8_t * getRaw(void)
Get a PTR to the internal state/code for this protocol with all integrity checks passing.
Definition ir_Toshiba.cpp:139
bool _send_swing
Flag indicating if we need to send a swing message.
Definition ir_Toshiba.h:194
void stateReset(void)
Reset the state of the remote to a known good state/sequence.
Definition ir_Toshiba.cpp:70
uint8_t _swing_mode
The saved swing state/mode/command.
Definition ir_Toshiba.h:195
void begin(void)
Set up hardware to be able to send a message.
Definition ir_Toshiba.cpp:80
stdAc::state_t toCommon(const stdAc::state_t *prev=NULL) const
Convert the current internal state into its stdAc::state_t equivalent.
Definition ir_Toshiba.cpp:413
void setRaw(const uint8_t newState[], const uint16_t length=kToshibaACStateLength)
Set the internal state from a valid code for this protocol.
Definition ir_Toshiba.cpp:147
void checksum(const uint16_t length=kToshibaACStateLength)
Calculate & set the checksum for the current internal state of the remote.
Definition ir_Toshiba.cpp:175
void setTurbo(const bool on)
Set the Turbo (Powerful) setting of the A/C.
Definition ir_Toshiba.cpp:313
IRsend _irsend
Instance of the IR send class.
Definition ir_Toshiba.h:185
static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed)
Convert a native fan speed into its stdAc equivalent.
Definition ir_Toshiba.cpp:400
void off(void)
Set the requested power state of the A/C to off.
Definition ir_Toshiba.cpp:192
uint8_t getMode(const bool raw=false) const
Get the operating mode setting of the A/C.
Definition ir_Toshiba.cpp:267
int8_t calibrate(void)
Run the calibration to calculate uSec timing offsets for this platform.
Definition ir_Toshiba.h:145
static stdAc::opmode_t toCommonMode(const uint8_t mode)
Convert a native mode into its stdAc equivalent.
Definition ir_Toshiba.cpp:386
void setEcono(const bool on)
Set the Economy mode setting of the A/C.
Definition ir_Toshiba.cpp:333
bool getFilter(void) const
Get the filter (Pure/Ion Filter) setting of the A/C.
Definition ir_Toshiba.cpp:344
void setTemp(const uint8_t degrees)
Set the temperature.
Definition ir_Toshiba.cpp:213
void setStateLength(const uint16_t size)
Set the internal length of the current internal state per the protocol.
Definition ir_Toshiba.cpp:121
void setMode(const uint8_t mode)
Set the operating mode of the A/C.
Definition ir_Toshiba.cpp:280
void setFilter(const bool on)
Set the filter (Pure/Ion Filter) setting of the A/C.
Definition ir_Toshiba.cpp:350
bool getPower(void) const
Get the value of the current power setting.
Definition ir_Toshiba.cpp:207
bool getTurbo(void) const
Get the Turbo (Powerful) setting of the A/C.
Definition ir_Toshiba.cpp:304
uint8_t getFan(void) const
Get the current fan speed setting.
Definition ir_Toshiba.cpp:236
void on(void)
Set the requested power state of the A/C to on.
Definition ir_Toshiba.cpp:189
void setModel(const toshiba_ac_remote_model_t model)
Set the current model for the remote.
Definition ir_Toshiba.cpp:512
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:166
uint8_t backup[kToshibaACStateLengthLong]
A backup copy of the state.
Definition ir_Toshiba.h:192
toshiba_ac_remote_model_t getModel() const
Get the model information currently known.
Definition ir_Toshiba.cpp:501
ToshibaProtocol _
Definition ir_Toshiba.h:191
void setSwing(const uint8_t setting)
Set the swing setting of the A/C.
Definition ir_Toshiba.cpp:251
uint8_t _prev_mode
Store of the previously set mode.
Definition ir_Toshiba.h:193
static uint8_t convertFan(const stdAc::fanspeed_t speed)
Convert a stdAc::fanspeed_t enum into it's native speed.
Definition ir_Toshiba.cpp:372
uint16_t getStateLength(void) const
Get the length of the current internal state per the protocol structure.
Definition ir_Toshiba.cpp:115
uint8_t getTemp(void) const
Get the current temperature setting.
Definition ir_Toshiba.cpp:221
Class for sending all basic IR protocols.
Definition IRsend.h:249
int8_t calibrate(uint16_t hz=38000U)
Calculate & set any offsets to account for execution times during sending.
Definition IRsend.cpp:209
const uint8_t kToshibaAcSwingToggle
0b100
Definition ir_Toshiba.h:99
const uint8_t kToshibaAcFanMax
Definition ir_Toshiba.h:113
const uint8_t kToshibaAcMinLength
Min Nr. of bytes in a message.
Definition ir_Toshiba.h:91
const uint8_t kToshibaAcDry
Definition ir_Toshiba.h:106
const uint8_t kToshibaAcCool
Definition ir_Toshiba.h:105
const uint8_t kToshibaAcFanMed
Definition ir_Toshiba.h:112
const uint8_t kToshibaAcAuto
Definition ir_Toshiba.h:104
const uint8_t kToshibaAcMaxTemp
30C
Definition ir_Toshiba.h:102
const uint8_t kToshibaAcLengthByte
Byte pos of the "length" attribute.
Definition ir_Toshiba.h:90
const uint8_t kToshibaAcFan
Definition ir_Toshiba.h:108
const uint8_t kToshibaAcRemoteB
Definition ir_Toshiba.h:119
const uint8_t kToshibaAcOff
Definition ir_Toshiba.h:109
const uint8_t kToshibaAcFanAuto
Definition ir_Toshiba.h:110
const uint8_t kToshibaAcRemoteA
Definition ir_Toshiba.h:118
const uint8_t kToshibaAcTurboOn
Definition ir_Toshiba.h:115
const uint8_t kToshibaAcHeat
Definition ir_Toshiba.h:107
const uint8_t kToshibaAcFanMin
Definition ir_Toshiba.h:111
const uint8_t kToshibaAcSwingOff
0b010
Definition ir_Toshiba.h:98
const uint8_t kToshibaAcEconoOn
Definition ir_Toshiba.h:116
const uint8_t kToshibaAcSwingOn
0b001
Definition ir_Toshiba.h:97
const uint8_t kToshibaAcMinTemp
17C
Definition ir_Toshiba.h:101
const uint16_t kToshibaAcInvertedLength
Nr. of leading bytes in inverted pairs.
Definition ir_Toshiba.h:93
const uint8_t kToshibaAcSwingStep
0b000
Definition ir_Toshiba.h:96
fanspeed_t
Common A/C settings for Fan Speeds.
Definition IRsend.h:61
opmode_t
Common A/C settings for A/C operating modes.
Definition IRsend.h:49
Structure to hold a common A/C state.
Definition IRsend.h:114
Native representation of a Toshiba A/C message.
Definition ir_Toshiba.h:44
uint8_t raw[kToshibaACStateLengthLong]
The state in code form.
Definition ir_Toshiba.h:45
uint8_t Model
Definition ir_Toshiba.h:60
uint8_t EcoTurbo
Definition ir_Toshiba.h:84
uint8_t Swing
Definition ir_Toshiba.h:70
uint8_t Filter
Definition ir_Toshiba.h:79
uint8_t Length
< Known lengths are: 1 (56 bit message) 3 (72 bit message) 4 (80 bit message)
Definition ir_Toshiba.h:56
uint8_t Temp
Definition ir_Toshiba.h:72
uint8_t LongMsg
Definition ir_Toshiba.h:65
uint8_t ShortMsg
Definition ir_Toshiba.h:67
uint8_t Fan
Definition ir_Toshiba.h:76
uint8_t Mode
Definition ir_Toshiba.h:74