IRremoteIDF
Infrared send & receive for ESP-IDF
Loading...
Searching...
No Matches
ir_Airwell.h
Go to the documentation of this file.
1// Copyright 2020 David Conran
2
6
7// Supports:
8// Brand: Airwell, Model: RC08W remote
9// Brand: Airwell, Model: RC04 remote
10// Brand: Airwell, Model: DLS 21 DCI R410 AW A/C
11
12#ifndef IR_AIRWELL_H_
13#define IR_AIRWELL_H_
14
15#define __STDC_LIMIT_MACROS
16#include <stdint.h>
17#include "IRplatform.h"
18#include "IRremoteESP8266.h"
19#include "IRsend.h"
20#ifdef UNIT_TEST
21#include "IRsend_test.h"
22#endif
23
26 uint64_t raw; // The state of the IR remote in native IR code form.
27 struct {
28 uint64_t :19;
29 uint64_t Temp :4;
30 uint64_t :5;
31 uint64_t Fan :2;
32 uint64_t Mode :3;
33 uint64_t PowerToggle:1;
34 uint64_t :0;
35 };
36};
37
38// Constants
39const uint64_t kAirwellKnownGoodState = 0x140500002; // Mode Fan, Speed 1, 25C
40// Temperature
41const uint8_t kAirwellMinTemp = 16; // Celsius
42const uint8_t kAirwellMaxTemp = 30; // Celsius
43// Fan
44const uint8_t kAirwellFanLow = 0; // 0b00
45const uint8_t kAirwellFanMedium = 1; // 0b01
46const uint8_t kAirwellFanHigh = 2; // 0b10
47const uint8_t kAirwellFanAuto = 3; // 0b11
48// Modes
49const uint8_t kAirwellCool = 1; // 0b001
50const uint8_t kAirwellHeat = 2; // 0b010
51const uint8_t kAirwellAuto = 3; // 0b011
52const uint8_t kAirwellDry = 4; // 0b100
53const uint8_t kAirwellFan = 5; // 0b101
54
55
56// Classes
59 public:
60 explicit IRAirwellAc(const uint16_t pin, const bool inverted = false,
61 const bool use_modulation = true);
62 void stateReset();
63#if SEND_AIRWELL
64 void send(const uint16_t repeat = kAirwellMinRepeats);
69 int8_t calibrate(void) { return _irsend.calibrate(); }
70#endif // SEND_AIRWELL
71 void begin();
72 void setPowerToggle(const bool on);
73 bool getPowerToggle() const;
74 void setTemp(const uint8_t temp);
75 uint8_t getTemp() const;
76 void setFan(const uint8_t speed);
77 uint8_t getFan() const;
78 void setMode(const uint8_t mode);
79 uint8_t getMode() const;
80 uint64_t getRaw() const;
81 void setRaw(const uint64_t state);
82 static uint8_t convertMode(const stdAc::opmode_t mode);
83 static uint8_t convertFan(const stdAc::fanspeed_t speed);
84 static stdAc::opmode_t toCommonMode(const uint8_t mode);
85 static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed);
86 stdAc::state_t toCommon(const stdAc::state_t *prev = NULL) const;
87 String toString() const;
88#ifndef UNIT_TEST
89
90 private:
92#else
94 IRsendTest _irsend;
96#endif
98};
99#endif // IR_AIRWELL_H_
std::string String
The protocol code builds human readable output with String. On ESP-IDF that is just std::string.
Definition IRplatform.h:21
const uint16_t kAirwellMinRepeats
Definition IRremoteESP8266.h:1177
Class for handling detailed Airwell A/C messages.
Definition ir_Airwell.h:58
void begin()
Set up hardware to be able to send a message.
Definition ir_Airwell.cpp:90
void setPowerToggle(const bool on)
Turn on/off the Power Airwell setting.
Definition ir_Airwell.cpp:120
static uint8_t convertMode(const stdAc::opmode_t mode)
Convert a stdAc::opmode_t enum into its native mode.
Definition ir_Airwell.cpp:156
stdAc::state_t toCommon(const stdAc::state_t *prev=NULL) const
Convert the current internal state into its stdAc::state_t equivalent.
Definition ir_Airwell.cpp:240
void setTemp(const uint8_t temp)
Set the temperature.
Definition ir_Airwell.cpp:225
static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed)
Convert a native fan speed into its stdAc equivalent.
Definition ir_Airwell.cpp:214
void setFan(const uint8_t speed)
Set the speed of the fan.
Definition ir_Airwell.cpp:182
void setMode(const uint8_t mode)
Set the desired operation mode.
Definition ir_Airwell.cpp:138
static uint8_t convertFan(const stdAc::fanspeed_t speed)
Convert a stdAc::fanspeed_t enum into it's native speed.
Definition ir_Airwell.cpp:196
void send(const uint16_t repeat=kAirwellMinRepeats)
Send the current internal state as an IR message.
Definition ir_Airwell.cpp:108
void setRaw(const uint64_t state)
Set the raw state of the object.
Definition ir_Airwell.cpp:101
IRsend _irsend
Instance of the IR send class.
Definition ir_Airwell.h:91
bool getPowerToggle() const
Get the power toggle setting from the internal state.
Definition ir_Airwell.cpp:126
void stateReset()
Reset the internals of the object to a known good state.
Definition ir_Airwell.cpp:114
uint8_t getMode() const
Get the current operation mode setting.
Definition ir_Airwell.cpp:132
uint8_t getFan() const
Get the current fan speed setting.
Definition ir_Airwell.cpp:189
String toString() const
Convert the current internal state into a human readable string.
Definition ir_Airwell.cpp:275
static stdAc::opmode_t toCommonMode(const uint8_t mode)
Convert a native mode into its stdAc equivalent.
Definition ir_Airwell.cpp:169
int8_t calibrate(void)
Run the calibration to calculate uSec timing offsets for this platform.
Definition ir_Airwell.h:69
uint64_t getRaw() const
Get the raw state of the object, suitable to be sent with the appropriate IRsend object method.
Definition ir_Airwell.cpp:95
uint8_t getTemp() const
Get the current temperature setting.
Definition ir_Airwell.cpp:233
AirwellProtocol _
Definition ir_Airwell.h:97
Class for sending all basic IR protocols.
Definition IRsend.h:256
int8_t calibrate(uint16_t hz=38000U)
Calculate & set any offsets to account for execution times during sending.
Definition IRsend.cpp:286
const uint8_t kAirwellHeat
Definition ir_Airwell.h:50
const uint8_t kAirwellDry
Definition ir_Airwell.h:52
const uint8_t kAirwellFanAuto
Definition ir_Airwell.h:47
const uint8_t kAirwellAuto
Definition ir_Airwell.h:51
const uint8_t kAirwellFanLow
Definition ir_Airwell.h:44
const uint8_t kAirwellFanHigh
Definition ir_Airwell.h:46
const uint8_t kAirwellCool
Definition ir_Airwell.h:49
const uint8_t kAirwellFan
Definition ir_Airwell.h:53
const uint8_t kAirwellFanMedium
Definition ir_Airwell.h:45
const uint8_t kAirwellMinTemp
Definition ir_Airwell.h:41
const uint8_t kAirwellMaxTemp
Definition ir_Airwell.h:42
const uint64_t kAirwellKnownGoodState
Definition ir_Airwell.h:39
fanspeed_t
Common A/C settings for Fan Speeds.
Definition IRsend.h:67
opmode_t
Common A/C settings for A/C operating modes.
Definition IRsend.h:55
Structure to hold a common A/C state.
Definition IRsend.h:120
Native representation of a Airwell A/C message.
Definition ir_Airwell.h:25
uint64_t Mode
Definition ir_Airwell.h:32
uint64_t Temp
Definition ir_Airwell.h:29
uint64_t Fan
Definition ir_Airwell.h:31
uint64_t raw
Definition ir_Airwell.h:26
uint64_t PowerToggle
Definition ir_Airwell.h:33