Go to the documentation of this file.
31 #ifndef IR_PANASONIC_H_
32 #define IR_PANASONIC_H_
34 #define __STDC_LIMIT_MACROS
42 #include "IRsend_test.h"
99 0x02, 0x20, 0xE0, 0x04, 0x00, 0x00, 0x00, 0x06, 0x02,
100 0x20, 0xE0, 0x04, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
101 0x00, 0x0E, 0xE0, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00};
106 explicit IRPanasonicAc(
const uint16_t pin,
const bool inverted =
false,
107 const bool use_modulation =
true);
109 #if SEND_PANASONIC_AC
116 #endif // SEND_PANASONIC_AC
122 void setTemp(
const uint8_t temp,
const bool remember =
true);
124 void setFan(
const uint8_t fan);
126 void setMode(
const uint8_t mode);
128 void setRaw(
const uint8_t state[]);
146 static uint16_t
encodeTime(
const uint8_t hours,
const uint8_t mins);
148 void setClock(
const uint16_t mins_since_midnight);
150 void setOnTimer(
const uint16_t mins_since_midnight,
const bool enable =
true);
154 void setOffTimer(
const uint16_t mins_since_midnight,
155 const bool enable =
true);
181 static uint16_t
_getTime(
const uint8_t ptr[]);
182 static void _setTime(uint8_t *
const ptr,
const uint16_t mins_since_midnight,
183 const bool round_down);
225 explicit IRPanasonicAc32(
const uint16_t pin,
const bool inverted =
false,
226 const bool use_modulation =
true);
228 #if SEND_PANASONIC_AC32
235 #endif // SEND_PANASONIC_AC32
239 void setTemp(
const uint8_t temp);
241 void setFan(
const uint8_t fan);
242 uint8_t
getFan(
void)
const;
243 void setMode(
const uint8_t mode);
245 void setRaw(
const uint32_t state);
246 uint32_t
getRaw(
void)
const;
271 #endif // IR_PANASONIC_H_
const uint8_t kPanasonicAcFanAuto
Definition: ir_Panasonic.h:61
static uint16_t _getTime(const uint8_t ptr[])
Get the time from a given pointer location.
Definition: ir_Panasonic.cpp:549
Class for handling detailed Panasonic A/C messages.
Definition: ir_Panasonic.h:104
static uint8_t convertSwingV(const stdAc::swingv_t position)
Convert a standard A/C vertical swing into its native setting.
Definition: ir_Panasonic.cpp:1273
uint8_t getTemp(void)
Get the current temperature setting.
Definition: ir_Panasonic.cpp:392
const uint8_t kPanasonicAcIonFilterOffset
Definition: ir_Panasonic.h:96
const uint8_t kPanasonicAcAuto
Definition: ir_Panasonic.h:51
const uint8_t kPanasonicAcTimeSize
Definition: ir_Panasonic.h:90
void setTemp(const uint8_t temp)
Set the desired temperature.
Definition: ir_Panasonic.cpp:1134
void setRaw(const uint8_t state[])
Set the internal state from a valid code for this protocol.
Definition: ir_Panasonic.cpp:329
int8_t calibrate(void)
Run the calibration to calculate uSec timing offsets for this platform.
Definition: ir_Panasonic.h:234
Native representation of a Panasonic 32-bit A/C message.
Definition: ir_Panasonic.h:187
void setMode(const uint8_t mode)
Set the operating mode of the A/C.
Definition: ir_Panasonic.cpp:1153
const uint8_t kPanasonicAcSwingHRight
Definition: ir_Panasonic.h:84
swingv_t
Common A/C settings for Vertical Swing.
Definition: IRsend.h:74
const uint8_t kPanasonicAc32FanMin
Definition: ir_Panasonic.h:213
const uint8_t kPanasonicAcFanMin
Definition: ir_Panasonic.h:56
uint16_t getOffTimer(void)
Get the Off Timer time value.
Definition: ir_Panasonic.cpp:610
const uint8_t kPanasonicAcQuietOffset
Definition: ir_Panasonic.h:69
const uint8_t kPanasonicAc32FanHigh
Definition: ir_Panasonic.h:216
const uint8_t kPanasonicAcOffTimerOffset
Definition: ir_Panasonic.h:89
const uint8_t kPanasonicAc32FanMed
Definition: ir_Panasonic.h:215
const uint16_t kPanasonicAcTolerance
Definition: ir_Panasonic.h:49
const uint8_t kPanasonicAc32FanAuto
Definition: ir_Panasonic.h:218
fanspeed_t
Common A/C settings for Fan Speeds.
Definition: IRsend.h:61
const uint16_t kPanasonicAcExcess
Definition: ir_Panasonic.h:47
uint8_t _swingh
Definition: ir_Panasonic.h:178
uint8_t SwingV
Definition: ir_Panasonic.h:193
static uint8_t convertSwingV(const stdAc::swingv_t position)
Convert a standard A/C vertical swing into its native setting.
Definition: ir_Panasonic.cpp:693
String toString(void) const
Convert the current internal state into a human readable string.
Definition: ir_Panasonic.cpp:1286
const uint8_t kPanasonicAcPowerfulOffset
Definition: ir_Panasonic.h:70
static uint8_t convertFan(const stdAc::fanspeed_t speed)
Convert a stdAc::fanspeed_t enum into it's native speed.
Definition: ir_Panasonic.cpp:1229
stdAc::state_t toCommon(const stdAc::state_t *prev=NULL) const
Convert the current internal state into its stdAc::state_t equivalent.
Definition: ir_Panasonic.cpp:1318
static uint16_t encodeTime(const uint8_t hours, const uint8_t mins)
Convert standard (military/24hr) time to nr. of minutes since midnight.
Definition: ir_Panasonic.cpp:541
const uint8_t kPanasonicAcTimeOverflowSize
Definition: ir_Panasonic.h:91
const uint8_t kPanasonicAcFanMed
Definition: ir_Panasonic.h:58
void setFan(const uint8_t fan)
Set the speed of the fan.
Definition: ir_Panasonic.cpp:464
uint8_t getFan(void)
Get the current fan speed setting.
Definition: ir_Panasonic.cpp:481
void setQuiet(const bool on)
Set the Quiet setting of the A/C.
Definition: ir_Panasonic.cpp:500
const uint8_t kPanasonicAc32Heat
Definition: ir_Panasonic.h:210
uint8_t _temp
Definition: ir_Panasonic.h:179
void setRaw(const uint32_t state)
Set the internal state from a valid code for this protocol.
Definition: ir_Panasonic.cpp:1119
Class for sending all basic IR protocols.
Definition: IRsend.h:237
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 kPanasonicAc32SwingVAuto
Definition: ir_Panasonic.h:219
uint8_t PowerToggle
Definition: ir_Panasonic.h:202
void setPowerToggle(const bool on)
Set the Power Toggle setting of the A/C.
Definition: ir_Panasonic.cpp:1126
void setSwingVertical(const uint8_t elevation)
Control the vertical swing setting.
Definition: ir_Panasonic.cpp:418
std::string String
Definition: IRremoteESP8266.h:1521
static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed)
Convert a native fan speed into its stdAc equivalent.
Definition: ir_Panasonic.cpp:734
const uint8_t kPanasonicAcFanLow
Definition: ir_Panasonic.h:57
void setIon(const bool on)
Set the Ion (filter) setting of the A/C.
Definition: ir_Panasonic.cpp:657
const uint8_t kPanasonicAcPowerfulCkpOffset
Definition: ir_Panasonic.h:73
const uint8_t kPanasonicAcSwingHAuto
Definition: ir_Panasonic.h:86
const uint8_t kPanasonicAc32FanLow
Definition: ir_Panasonic.h:214
const uint8_t kPanasonicAcMinTemp
Definition: ir_Panasonic.h:66
void setSwingHorizontal(const bool on)
Control the horizontal swing setting.
Definition: ir_Panasonic.cpp:1246
const uint8_t kPanasonicAcPowerOffset
Definition: ir_Panasonic.h:63
const uint8_t kPanasonicAcHeat
Definition: ir_Panasonic.h:54
void send(const uint16_t repeat=kPanasonicAcDefaultRepeat)
Send the current internal state as an IR message.
Definition: ir_Panasonic.cpp:246
bool getSwingHorizontal(void) const
Get the current horizontal swing setting.
Definition: ir_Panasonic.cpp:1242
uint8_t Fan
Definition: ir_Panasonic.h:199
uint16_t getClock(void)
Get the current clock time value.
Definition: ir_Panasonic.cpp:559
bool getPower(void)
Get the A/C power state of the remote.
Definition: ir_Panasonic.cpp:351
bool getQuiet(void)
Get the Quiet setting of the A/C.
Definition: ir_Panasonic.cpp:488
const uint32_t kPanasonicAc32KnownGood
Cool, Auto, 16C.
Definition: ir_Panasonic.h:220
static stdAc::opmode_t toCommonMode(const uint8_t mode)
Convert a native mode into its stdAc equivalent.
Definition: ir_Panasonic.cpp:1182
panasonic_ac_remote_model_t
Panasonic A/C model numbers.
Definition: IRsend.h:181
swingh_t
Common A/C settings for Horizontal Swing.
Definition: IRsend.h:100
void setOffTimer(const uint16_t mins_since_midnight, const bool enable=true)
Set/Enable the Off Timer.
Definition: ir_Panasonic.cpp:620
stdAc::state_t toCommon(void)
Convert the current internal state into its stdAc::state_t equivalent.
Definition: ir_Panasonic.cpp:771
static uint8_t calcChecksum(const uint8_t *state, const uint16_t length=kPanasonicAcStateLength)
Calculate the checksum for a given state.
Definition: ir_Panasonic.cpp:232
static uint8_t convertMode(const stdAc::opmode_t mode)
Convert a stdAc::opmode_t enum into its native mode.
Definition: ir_Panasonic.cpp:666
const uint8_t kPanasonicAcChecksumInit
Definition: ir_Panasonic.h:87
static void _setTime(uint8_t *const ptr, const uint16_t mins_since_midnight, const bool round_down)
Set the time at a given pointer location.
Definition: ir_Panasonic.cpp:566
uint8_t getSwingVertical(void)
Get the current vertical swing setting.
Definition: ir_Panasonic.cpp:412
const uint16_t kPanasonicAcDefaultRepeat
Definition: IRremoteESP8266.h:1344
uint8_t Temp
Definition: ir_Panasonic.h:198
const uint8_t kPanasonicAcSwingHFullRight
Definition: ir_Panasonic.h:85
const uint8_t kPanasonicAc32Auto
Definition: ir_Panasonic.h:211
const uint8_t kPanasonicAcSwingHLeft
Definition: ir_Panasonic.h:83
bool getPowerful(void)
Get the Powerful (Turbo) setting of the A/C.
Definition: ir_Panasonic.cpp:513
void setSwingHorizontal(const uint8_t direction)
Control the horizontal swing setting.
Definition: ir_Panasonic.cpp:435
uint8_t * getRaw(void)
Get a PTR to the internal state/code for this protocol.
Definition: ir_Panasonic.cpp:322
PanasonicAc32Protocol _
The state in code form.
Definition: ir_Panasonic.h:268
const uint16_t kPanasonicAcStateLength
Definition: IRremoteESP8266.h:1340
uint8_t getTemp(void) const
Get the current desired temperature setting.
Definition: ir_Panasonic.cpp:1142
const uint8_t kPanasonicAcSwingHMiddle
Definition: ir_Panasonic.h:81
static uint8_t convertMode(const stdAc::opmode_t mode)
Convert a stdAc::opmode_t enum into its native mode.
Definition: ir_Panasonic.cpp:1169
const uint8_t kPanasonicAcCool
Definition: ir_Panasonic.h:53
uint8_t getSwingVertical(void) const
Get the current vertical swing setting.
Definition: ir_Panasonic.cpp:1250
IRPanasonicAc32(const uint16_t pin, const bool inverted=false, const bool use_modulation=true)
Class constructor.
Definition: ir_Panasonic.cpp:1098
const uint16_t kPanasonicFreq
Definition: ir_Panasonic.h:46
IRsend _irsend
Instance of the IR send class.
Definition: ir_Panasonic.h:262
static stdAc::swingh_t toCommonSwingH(const uint8_t pos)
Convert a native horizontal swing postion to it's common equivalent.
Definition: ir_Panasonic.cpp:748
const uint8_t kPanasonicAc32Fan
Definition: ir_Panasonic.h:207
IRsend _irsend
Instance of the IR send class.
Definition: ir_Panasonic.h:171
void setSwingVertical(const uint8_t pos)
Control the vertical swing setting.
Definition: ir_Panasonic.cpp:1254
void setOnTimer(const uint16_t mins_since_midnight, const bool enable=true)
Set/Enable the On Timer.
Definition: ir_Panasonic.cpp:591
void on(void)
Change the power setting to On.
Definition: ir_Panasonic.cpp:356
IRPanasonicAc(const uint16_t pin, const bool inverted=false, const bool use_modulation=true)
Class constructor.
Definition: ir_Panasonic.cpp:204
String toString(void)
Convert the internal state into a human readable string.
Definition: ir_Panasonic.cpp:797
uint8_t Mode
Definition: ir_Panasonic.h:201
const uint8_t kPanasonicAc32FanMax
Definition: ir_Panasonic.h:217
const uint8_t kPanasonicAcQuietCkpOffset
Definition: ir_Panasonic.h:72
const uint8_t kPanasonicKnownGoodState[kPanasonicAcStateLength]
Definition: ir_Panasonic.h:98
const uint8_t kPanasonicAcFanHigh
Definition: ir_Panasonic.h:59
const uint8_t kPanasonicAcSwingVAuto
Definition: ir_Panasonic.h:79
void send(const uint16_t repeat=kPanasonicAcDefaultRepeat)
Send the current internal state as IR messages.
Definition: ir_Panasonic.cpp:1105
const uint8_t kPanasonicAcSwingVHigh
Definition: ir_Panasonic.h:75
bool isOnTimerEnabled(void)
Check if the On Timer is Enabled.
Definition: ir_Panasonic.cpp:604
void begin(void)
Set up hardware to be able to send a message.
Definition: ir_Panasonic.cpp:216
const uint8_t kPanasonicAc32Dry
Definition: ir_Panasonic.h:209
void fixChecksum(const uint16_t length=kPanasonicAcStateLength)
Calculate and set the checksum values for the internal state.
Definition: ir_Panasonic.cpp:239
void setFan(const uint8_t fan)
Set the speed of the fan.
Definition: ir_Panasonic.cpp:1194
int8_t calibrate(void)
Run the calibration to calculate uSec timing offsets for this platform.
Definition: ir_Panasonic.h:115
void setPower(const bool on)
Control the power state of the A/C unit.
Definition: ir_Panasonic.cpp:343
void begin(void)
Set up hardware to be able to send a message.
Definition: ir_Panasonic.cpp:1111
const uint8_t kPanasonicAcTempOffset
Definition: ir_Panasonic.h:64
void setClock(const uint16_t mins_since_midnight)
Set the current clock time value.
Definition: ir_Panasonic.cpp:580
const uint16_t kPanasonicAcTimeSpecial
Definition: ir_Panasonic.h:93
void setMode(const uint8_t mode)
Set the operating mode of the A/C.
Definition: ir_Panasonic.cpp:369
static stdAc::swingv_t toCommonSwingV(const uint8_t pos)
Convert a native vertical swing postion to it's common equivalent.
Definition: ir_Panasonic.cpp:1266
const uint8_t kPanasonicAcSwingVLow
Definition: ir_Panasonic.h:77
void cancelOnTimer(void)
Cancel the On Timer.
Definition: ir_Panasonic.cpp:600
static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed)
Convert a native fan speed into its stdAc equivalent.
Definition: ir_Panasonic.cpp:1215
uint8_t getSwingHorizontal(void)
Get the current horizontal swing setting.
Definition: ir_Panasonic.cpp:429
const uint8_t kPanasonicAcFan
Definition: ir_Panasonic.h:55
void off(void)
Change the power setting to Off.
Definition: ir_Panasonic.cpp:359
const uint8_t kPanasonicAcDry
Definition: ir_Panasonic.h:52
Class for handling detailed Panasonic 32bit A/C messages.
Definition: ir_Panasonic.h:223
uint8_t remote_state[kPanasonicAcStateLength]
The state in code form.
Definition: ir_Panasonic.h:177
void cancelOffTimer(void)
Cancel the Off Timer.
Definition: ir_Panasonic.cpp:635
const uint8_t kPanasonicAcIonFilterByte
Definition: ir_Panasonic.h:95
static uint8_t convertFan(const stdAc::fanspeed_t speed)
Convert a stdAc::fanspeed_t enum into it's native speed.
Definition: ir_Panasonic.cpp:679
const uint8_t kPanasonicAcSwingVMiddle
Definition: ir_Panasonic.h:76
static bool validChecksum(const uint8_t *state, const uint16_t length=kPanasonicAcStateLength)
Verify the checksum is valid for a given state.
Definition: ir_Panasonic.cpp:222
const uint8_t kPanasonicAcFanDelta
Definition: ir_Panasonic.h:62
const uint8_t kPanasonicAcSwingVHighest
Definition: ir_Panasonic.h:74
const uint8_t kPanasonicAc32Cool
Definition: ir_Panasonic.h:208
void stateReset(void)
Reset the state of the remote to a known good state/sequence.
Definition: ir_Panasonic.cpp:209
const uint8_t kPanasonicAcTempSize
Definition: ir_Panasonic.h:65
uint8_t getMode(void)
Get the operating mode setting of the A/C.
Definition: ir_Panasonic.cpp:363
void setPowerful(const bool on)
Set the Powerful (Turbo) setting of the A/C.
Definition: ir_Panasonic.cpp:525
const uint8_t kPanasonicAcFanModeTemp
Definition: ir_Panasonic.h:68
bool getPowerToggle(void) const
Get the Power Toggle setting of the A/C.
Definition: ir_Panasonic.cpp:1130
const uint8_t kPanasonicAcFanMax
Definition: ir_Panasonic.h:60
static stdAc::opmode_t toCommonMode(const uint8_t mode)
Convert a native mode into its stdAc equivalent.
Definition: ir_Panasonic.cpp:721
uint32_t getRaw(void) const
Get a copy of the internal state/code for this protocol.
Definition: ir_Panasonic.cpp:1115
bool isOffTimerEnabled(void)
Check if the Off Timer is Enabled.
Definition: ir_Panasonic.cpp:639
const uint16_t kPanasonicAcTimeMax
Definition: ir_Panasonic.h:92
const uint8_t kPanasonicAcSwingHFullLeft
Definition: ir_Panasonic.h:82
panasonic_ac_remote_model_t getModel(void)
Get/Detect the model of the A/C.
Definition: ir_Panasonic.cpp:303
bool getIon(void)
Get the Ion (filter) setting of the A/C.
Definition: ir_Panasonic.cpp:645
uint32_t raw
The state in IR code form.
Definition: ir_Panasonic.h:188
void stateReset(void)
Reset the state of the remote to a known good state/sequence.
Definition: ir_Panasonic.cpp:1122
uint16_t getOnTimer(void)
Get the On Timer time value.
Definition: ir_Panasonic.cpp:586
Structure to hold a common A/C state.
Definition: IRsend.h:114
void setModel(const panasonic_ac_remote_model_t model)
Set the model of the A/C to emulate.
Definition: ir_Panasonic.cpp:253
uint8_t SwingH
Definition: ir_Panasonic.h:192
uint8_t getMode(void) const
Get the operating mode setting of the A/C.
Definition: ir_Panasonic.cpp:1148
const uint8_t kPanasonicAcMaxTemp
Definition: ir_Panasonic.h:67
static uint8_t convertSwingH(const stdAc::swingh_t position)
Convert a standard A/C horizontal swing into its native setting.
Definition: ir_Panasonic.cpp:707
void setTemp(const uint8_t temp, const bool remember=true)
Set the temperature.
Definition: ir_Panasonic.cpp:401
const uint8_t kPanasonicAcSwingVLowest
Definition: ir_Panasonic.h:78
const uint8_t kPanasonicAcOnTimerOffset
Definition: ir_Panasonic.h:88
static stdAc::swingv_t toCommonSwingV(const uint8_t pos)
Convert a native vertical swing postion to it's common equivalent.
Definition: ir_Panasonic.cpp:762
uint8_t getFan(void) const
Get the current fan speed setting.
Definition: ir_Panasonic.cpp:1210
opmode_t
Common A/C settings for A/C operating modes.
Definition: IRsend.h:49