IRremoteESP8266
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#ifndef UNIT_TEST
18#include <Arduino.h>
19#endif
20#include "IRremoteESP8266.h"
21#include "IRsend.h"
22#ifdef UNIT_TEST
23#include "IRsend_test.h"
24#endif
25
28 uint64_t raw; // The state of the IR remote in native IR code form.
29 struct {
30 uint64_t :19;
31 uint64_t Temp :4;
32 uint64_t :5;
33 uint64_t Fan :2;
34 uint64_t Mode :3;
35 uint64_t PowerToggle:1;
36 uint64_t :0;
37 };
38};
39
40// Constants
41const uint64_t kAirwellKnownGoodState = 0x140500002; // Mode Fan, Speed 1, 25C
42// Temperature
43const uint8_t kAirwellMinTemp = 16; // Celsius
44const uint8_t kAirwellMaxTemp = 30; // Celsius
45// Fan
46const uint8_t kAirwellFanLow = 0; // 0b00
47const uint8_t kAirwellFanMedium = 1; // 0b01
48const uint8_t kAirwellFanHigh = 2; // 0b10
49const uint8_t kAirwellFanAuto = 3; // 0b11
50// Modes
51const uint8_t kAirwellCool = 1; // 0b001
52const uint8_t kAirwellHeat = 2; // 0b010
53const uint8_t kAirwellAuto = 3; // 0b011
54const uint8_t kAirwellDry = 4; // 0b100
55const uint8_t kAirwellFan = 5; // 0b101
56
57
58// Classes
61 public:
62 explicit IRAirwellAc(const uint16_t pin, const bool inverted = false,
63 const bool use_modulation = true);
64 void stateReset();
65#if SEND_AIRWELL
66 void send(const uint16_t repeat = kAirwellMinRepeats);
71 int8_t calibrate(void) { return _irsend.calibrate(); }
72#endif // SEND_AIRWELL
73 void begin();
74 void setPowerToggle(const bool on);
75 bool getPowerToggle() const;
76 void setTemp(const uint8_t temp);
77 uint8_t getTemp() const;
78 void setFan(const uint8_t speed);
79 uint8_t getFan() const;
80 void setMode(const uint8_t mode);
81 uint8_t getMode() const;
82 uint64_t getRaw() const;
83 void setRaw(const uint64_t state);
84 static uint8_t convertMode(const stdAc::opmode_t mode);
85 static uint8_t convertFan(const stdAc::fanspeed_t speed);
86 static stdAc::opmode_t toCommonMode(const uint8_t mode);
87 static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed);
88 stdAc::state_t toCommon(const stdAc::state_t *prev = NULL) const;
89 String toString() const;
90#ifndef UNIT_TEST
91
92 private:
94#else
96 IRsendTest _irsend;
98#endif
100};
101#endif // IR_AIRWELL_H_
const uint16_t kAirwellMinRepeats
Definition IRremoteESP8266.h:1178
std::string String
Definition IRremoteESP8266.h:1564
Class for handling detailed Airwell A/C messages.
Definition ir_Airwell.h:60
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:93
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:71
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:99
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 kAirwellHeat
Definition ir_Airwell.h:52
const uint8_t kAirwellDry
Definition ir_Airwell.h:54
const uint8_t kAirwellFanAuto
Definition ir_Airwell.h:49
const uint8_t kAirwellAuto
Definition ir_Airwell.h:53
const uint8_t kAirwellFanLow
Definition ir_Airwell.h:46
const uint8_t kAirwellFanHigh
Definition ir_Airwell.h:48
const uint8_t kAirwellCool
Definition ir_Airwell.h:51
const uint8_t kAirwellFan
Definition ir_Airwell.h:55
const uint8_t kAirwellFanMedium
Definition ir_Airwell.h:47
const uint8_t kAirwellMinTemp
Definition ir_Airwell.h:43
const uint8_t kAirwellMaxTemp
Definition ir_Airwell.h:44
const uint64_t kAirwellKnownGoodState
Definition ir_Airwell.h:41
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 Airwell A/C message.
Definition ir_Airwell.h:27
uint64_t Mode
Definition ir_Airwell.h:34
uint64_t Temp
Definition ir_Airwell.h:31
uint64_t Fan
Definition ir_Airwell.h:33
uint64_t raw
Definition ir_Airwell.h:28
uint64_t PowerToggle
Definition ir_Airwell.h:35