IRremoteIDF
Infrared send & receive for ESP-IDF
Loading...
Searching...
No Matches
ir_Airton.h
Go to the documentation of this file.
1// Copyright 2021 David Conran (crankyoldgit)
5
6// Supports:
7// Brand: Airton, Model: SMVH09B-2A2A3NH ref. 409730 A/C
8// Brand: Airton, Model: RD1A1 remote
9
10#ifndef IR_AIRTON_H_
11#define IR_AIRTON_H_
12
13#define __STDC_LIMIT_MACROS
14#include <stdint.h>
15#include "IRplatform.h"
16#include "IRremoteESP8266.h"
17#include "IRsend.h"
18#ifdef UNIT_TEST
19#include "IRsend_test.h"
20#endif
21
25 uint64_t raw;
26 struct { // Common
27 // Byte 1 & 0 (LSB)
28 uint16_t Header :16; // Header. (0x11D3)
29 // Byte 2
30 uint8_t Mode :3; // Operating Mode
31 uint8_t Power :1; // Power Control
32 uint8_t Fan :3;
33 uint8_t Turbo :1;
34 // Byte 3
35 uint8_t Temp :4; // Degrees Celsius (+16 offset)
36 uint8_t :4; // Unknown / Unused.
37 // Byte 4
38 uint8_t SwingV :1;
39 uint8_t :7; // Unknown / Unused.
40 // Byte 5
41 uint8_t Econo :1;
42 uint8_t Sleep :1;
43 uint8_t NotAutoOn :1;
44 uint8_t :1; // Unknown / Unused.
45 uint8_t HeatOn :1;
46 uint8_t :1; // Unknown / Unused.
47 uint8_t Health :1;
48 uint8_t Light :1;
49 // Byte 6
50 uint8_t Sum :8; // Sepecial checksum value
51 };
52};
53
54// Constants
55const uint8_t kAirtonAuto = 0b000; // 0
56const uint8_t kAirtonCool = 0b001; // 1
57const uint8_t kAirtonDry = 0b010; // 2
58const uint8_t kAirtonFan = 0b011; // 3
59const uint8_t kAirtonHeat = 0b100; // 4
60
61const uint8_t kAirtonFanAuto = 0b000; // 0
62const uint8_t kAirtonFanMin = 0b001; // 1
63const uint8_t kAirtonFanLow = 0b010; // 2
64const uint8_t kAirtonFanMed = 0b011; // 3
65const uint8_t kAirtonFanHigh = 0b100; // 4
66const uint8_t kAirtonFanMax = 0b101; // 5
67
68const uint8_t kAirtonMinTemp = 16; // 16C
69const uint8_t kAirtonMaxTemp = 31; // 31C
70
71
74 public:
75 explicit IRAirtonAc(const uint16_t pin, const bool inverted = false,
76 const bool use_modulation = true);
77 void stateReset(void);
78#if SEND_AIRTON
79 void send(const uint16_t repeat = kAirtonDefaultRepeat);
84 int8_t calibrate(void) { return _irsend.calibrate(); }
85#endif // SEND_AIRTON
86 void begin(void);
87 void on(void);
88 void off(void);
89 void setPower(const bool on);
90 bool getPower(void) const;
91 void setTemp(const uint8_t degrees);
92 uint8_t getTemp(void) const;
93 void setFan(const uint8_t speed);
94 uint8_t getFan(void) const;
95 void setMode(const uint8_t mode);
96 uint8_t getMode(void) const;
97 uint64_t getRaw(void);
98 void setRaw(const uint64_t data);
99 void setLight(const bool on);
100 bool getLight(void) const;
101 void setEcono(const bool on);
102 bool getEcono(void) const;
103 void setTurbo(const bool on);
104 bool getTurbo(void) const;
105 void setHealth(const bool on);
106 bool getHealth(void) const;
107 void setSleep(const bool on);
108 bool getSleep(void) const;
109 void setSwingV(const bool on);
110 bool getSwingV(void) const;
111 static bool validChecksum(const uint64_t data);
112 static uint8_t calcChecksum(const uint64_t data);
113 static uint8_t convertMode(const stdAc::opmode_t mode);
114 static uint8_t convertFan(const stdAc::fanspeed_t speed);
115 static uint8_t convertSwingV(const stdAc::swingv_t position);
116 static stdAc::opmode_t toCommonMode(const uint8_t mode);
117 static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed);
118 stdAc::state_t toCommon(void) const;
119 String toString(void) const;
120#ifndef UNIT_TEST
121
122 private:
124#else // UNIT_TEST
126 IRsendTest _irsend;
128#endif // UNIT_TEST
130 void checksum(void);
131};
132#endif // IR_AIRTON_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 kAirtonDefaultRepeat
Definition IRremoteESP8266.h:1175
Class for handling detailed Airton 56-bit A/C messages.
Definition ir_Airton.h:73
static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed)
Convert a native fan speed into its stdAc equivalent.
Definition ir_Airton.cpp:244
AirtonProtocol _
Definition ir_Airton.h:129
void setTemp(const uint8_t degrees)
Set the temperature.
Definition ir_Airton.cpp:205
void setPower(const bool on)
Set the internal state to have the desired power.
Definition ir_Airton.cpp:140
static uint8_t convertFan(const stdAc::fanspeed_t speed)
Convert a stdAc::fanspeed_t enum into it's native speed.
Definition ir_Airton.cpp:230
uint64_t getRaw(void)
Get the raw state of the object, suitable to be sent with the appropriate IRsend object method.
Definition ir_Airton.cpp:122
bool getLight(void) const
Get the Light/LED/Display setting of the A/C.
Definition ir_Airton.cpp:269
static bool validChecksum(const uint64_t data)
Verify the checksum is valid for a given state.
Definition ir_Airton.cpp:107
static stdAc::opmode_t toCommonMode(const uint8_t mode)
Convert a native mode into its stdAc equivalent.
Definition ir_Airton.cpp:193
void off(void)
Set the internal state to have the power off.
Definition ir_Airton.cpp:136
void setFan(const uint8_t speed)
Set the speed of the fan.
Definition ir_Airton.cpp:219
stdAc::state_t toCommon(void) const
Convert the current internal state into its stdAc::state_t equivalent.
Definition ir_Airton.cpp:319
bool getTurbo(void) const
Get the Turbo setting of the A/C.
Definition ir_Airton.cpp:292
bool getSwingV(void) const
Get the Vertical Swing setting of the A/C.
Definition ir_Airton.cpp:261
bool getSleep(void) const
Get the Sleep setting of the A/C.
Definition ir_Airton.cpp:307
void setSleep(const bool on)
Set the Sleep setting of the A/C.
Definition ir_Airton.cpp:297
void on(void)
Set the internal state to have the power on.
Definition ir_Airton.cpp:133
void setHealth(const bool on)
Set the Health/Filter setting of the A/C.
Definition ir_Airton.cpp:311
void setEcono(const bool on)
Set the Economy setting of the A/C.
Definition ir_Airton.cpp:274
uint8_t getTemp(void) const
Get the current temperature setting.
Definition ir_Airton.cpp:214
uint8_t getMode(void) const
Get the current operation mode setting.
Definition ir_Airton.cpp:151
void stateReset(void)
Reset the internals of the object to a known good state.
Definition ir_Airton.cpp:117
void checksum(void)
Update the checksum value for the internal state.
Definition ir_Airton.cpp:114
bool getPower(void) const
Get the power setting from the internal state.
Definition ir_Airton.cpp:147
void setMode(const uint8_t mode)
Set the desired operation mode.
Definition ir_Airton.cpp:155
static uint8_t convertMode(const stdAc::opmode_t mode)
Convert a stdAc::opmode_t enum into its native mode.
Definition ir_Airton.cpp:180
bool getEcono(void) const
Get the Economy setting of the A/C.
Definition ir_Airton.cpp:280
void send(const uint16_t repeat=kAirtonDefaultRepeat)
Send the current internal state as an IR message.
Definition ir_Airton.cpp:92
static uint8_t convertSwingV(const stdAc::swingv_t position)
bool getHealth(void) const
Get the Health/Filter setting of the A/C.
Definition ir_Airton.cpp:315
uint8_t getFan(void) const
Get the current fan speed setting.
Definition ir_Airton.cpp:225
void setLight(const bool on)
Set the Light/LED/Display setting of the A/C.
Definition ir_Airton.cpp:265
void setTurbo(const bool on)
Set the Turbo setting of the A/C.
Definition ir_Airton.cpp:284
int8_t calibrate(void)
Run the calibration to calculate uSec timing offsets for this platform.
Definition ir_Airton.h:84
void setSwingV(const bool on)
Set the Vertical Swing setting of the A/C.
Definition ir_Airton.cpp:257
IRsend _irsend
Instance of the IR send class.
Definition ir_Airton.h:123
String toString(void) const
Convert the current internal state into a human readable string.
Definition ir_Airton.cpp:345
void begin(void)
Set up hardware to be able to send a message.
Definition ir_Airton.cpp:87
static uint8_t calcChecksum(const uint64_t data)
Calculate the checksum for the supplied state.
Definition ir_Airton.cpp:100
void setRaw(const uint64_t data)
Set the raw state of the object.
Definition ir_Airton.cpp:129
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 kAirtonFan
Definition ir_Airton.h:58
const uint8_t kAirtonMinTemp
Definition ir_Airton.h:68
const uint8_t kAirtonFanAuto
Definition ir_Airton.h:61
const uint8_t kAirtonFanMax
Definition ir_Airton.h:66
const uint8_t kAirtonFanMed
Definition ir_Airton.h:64
const uint8_t kAirtonFanLow
Definition ir_Airton.h:63
const uint8_t kAirtonMaxTemp
Definition ir_Airton.h:69
const uint8_t kAirtonFanHigh
Definition ir_Airton.h:65
const uint8_t kAirtonCool
Definition ir_Airton.h:56
const uint8_t kAirtonFanMin
Definition ir_Airton.h:62
const uint8_t kAirtonAuto
Definition ir_Airton.h:55
const uint8_t kAirtonHeat
Definition ir_Airton.h:59
const uint8_t kAirtonDry
Definition ir_Airton.h:57
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
swingv_t
Common A/C settings for Vertical Swing.
Definition IRsend.h:80
Structure to hold a common A/C state.
Definition IRsend.h:120
Native representation of a Airton 56 A/C message.
Definition ir_Airton.h:24
uint8_t Health
Definition ir_Airton.h:47
uint8_t SwingV
Definition ir_Airton.h:38
uint8_t Light
Definition ir_Airton.h:48
uint8_t Sum
Definition ir_Airton.h:50
uint8_t Temp
Definition ir_Airton.h:35
uint16_t Header
Definition ir_Airton.h:28
uint64_t raw
The state in code form.
Definition ir_Airton.h:25
uint8_t Mode
Definition ir_Airton.h:30
uint8_t NotAutoOn
Definition ir_Airton.h:43
uint8_t Fan
Definition ir_Airton.h:32
uint8_t Power
Definition ir_Airton.h:31
uint8_t Turbo
Definition ir_Airton.h:33
uint8_t Sleep
Definition ir_Airton.h:42
uint8_t Econo
Definition ir_Airton.h:41
uint8_t HeatOn
Definition ir_Airton.h:45