IRremoteESP8266: src/ir_Sharp.h Source File (original) (raw)

Go to the documentation of this file.

1

2

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29 #ifndef IR_SHARP_H_

30 #define IR_SHARP_H_

31

32 #ifndef UNIT_TEST

33 #include <Arduino.h>

34 #endif

38 #ifdef UNIT_TEST

39 #include "IRsend_test.h"

40 #endif

42

46 struct {

47

49

52 uint8_t :3;

53

54 uint8_t :4;

56

58 uint8_t :1;

61 uint8_t :1;

62

64 uint8_t :2;

67

69 uint8_t :5;

70

71 uint8_t :8;

72

74

75 uint8_t :2;

77 uint8_t :1;

79 uint8_t :3;

80

81 uint8_t :4;

83 };

84 };

85

86

93

97

105

118

124

125

132

133

134

135

136

137

138

142

150

151

154 public:

155 explicit IRSharpAc(const uint16_t pin, const bool inverted = false,

156 const bool use_modulation = true);

157 #if SEND_SHARP_AC

164 #endif // SEND_SHARP_AC

165 void begin(void);

168 void on(void);

169 void off(void);

170 void setPower(const bool on, const bool prev_on = true);

173 void setTemp(const uint8_t temp, const bool save = true);

174 uint8_t getTemp(void) const;

175 void setFan(const uint8_t fan, const bool save = true);

176 uint8_t getFan(void) const;

177 void setMode(const uint8_t mode, const bool save = true);

178 uint8_t getMode(void) const;

186 void setSwingV(const uint8_t position, const bool force = false);

187 bool getIon(void) const;

196 void setTimer(bool enable, bool timer_type, uint16_t mins);

199 uint8_t* getRaw(void);

200 void setRaw(const uint8_t new_code[],

212 const uint8_t pos,

216 #ifndef UNIT_TEST

217

218 private:

220 #else // UNIT_TEST

223 #endif // UNIT_TEST

239 };

240

241 #endif // IR_SHARP_H_

bool getEconoToggle(void) const

Get the Economical mode toggle setting of the A/C.

Definition: ir_Sharp.cpp:653

const uint8_t kSharpAcSwingVLowest

Definition: ir_Sharp.h:139

const uint8_t kSharpAcHeat

Definition: ir_Sharp.h:110

const uint8_t kSharpAcSpecialTempEcono

Definition: ir_Sharp.h:145

int8_t calibrate(void)

Run the calibration to calculate uSec timing offsets for this platform.

Definition: ir_Sharp.h:163

bool getLightToggle(void) const

Get the Light toggle setting of the A/C.

Definition: ir_Sharp.cpp:668

void setTimer(bool enable, bool timer_type, uint16_t mins)

Set or cancel the timer function.

Definition: ir_Sharp.cpp:693

stdAc::state_t toCommon(const stdAc::state_t *prev=NULL) const

Convert the current internal state into its stdAc::state_t equivalent.

Definition: ir_Sharp.cpp:839

void setTemp(const uint8_t temp, const bool save=true)

Set the temperature.

Definition: ir_Sharp.cpp:428

const uint8_t kSharpAcPowerOnFromOff

Definition: ir_Sharp.h:99

uint8_t getSwingV(void) const

Get the Vertical Swing setting of the A/C.

Definition: ir_Sharp.cpp:551

swingv_t

Common A/C settings for Vertical Swing.

Definition: IRsend.h:74

void off(void)

Set the requested power state of the A/C to off.

Definition: ir_Sharp.cpp:380

const uint16_t kSharpAcOneSpace

Definition: ir_Sharp.h:91

fanspeed_t

Common A/C settings for Fan Speeds.

Definition: IRsend.h:61

uint8_t _temp

Saved copy of the desired temp.

Definition: ir_Sharp.h:226

const uint32_t kDefaultMessageGap

Definition: IRsend.h:41

static uint8_t calcChecksum(uint8_t state[], const uint16_t length=kSharpAcStateLength)

Calculate the checksum for a given state.

Definition: ir_Sharp.cpp:264

const uint8_t kSharpAcFanA705Low

Definition: ir_Sharp.h:114

stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed) const

Convert a native fan speed into its stdAc equivalent.

Definition: ir_Sharp.cpp:795

const uint8_t kSharpAcSpecialTimer

Definition: ir_Sharp.h:148

const uint8_t kSharpAcOnTimerType

Definition: ir_Sharp.h:123

const uint8_t kSharpAcCool

Definition: ir_Sharp.h:109

void setSwingV(const uint8_t position, const bool force=false)

Set the Vertical Swing setting of the A/C.

Definition: ir_Sharp.cpp:561

const uint8_t kSharpAcSwingVToggle

Definition: ir_Sharp.h:141

uint8_t Model2

Definition: ir_Sharp.h:78

const uint8_t kSharpAcSpecialFan

Definition: ir_Sharp.h:146

const uint8_t kSharpAcSpecialSwing

Definition: ir_Sharp.h:147

bool getIon(void) const

Get the Ion (Filter) setting of the A/C.

Definition: ir_Sharp.cpp:615

stdAc::swingv_t toCommonSwingV(const uint8_t pos, const stdAc::opmode_t mode=stdAc::opmode_t::kHeat) const

Convert a native vertical swing postion to it's common equivalent.

Definition: ir_Sharp.cpp:819

const uint8_t kSharpAcOffTimerType

Definition: ir_Sharp.h:122

Class for sending all basic IR protocols.

Definition: IRsend.h:237

const uint8_t kSharpAcSwingVOff

Definition: ir_Sharp.h:128

const uint8_t kSharpAcMaxTemp

Definition: ir_Sharp.h:96

void setFan(const uint8_t fan, const bool save=true)

Set the speed of the fan.

Definition: ir_Sharp.cpp:507

int8_t calibrate(uint16_t hz=38000U)

Calculate & set any offsets to account for execution times during sending.

Definition: IRsend.cpp:207

sharp_ac_remote_model_t _model

Saved copy of the model.

Definition: ir_Sharp.h:229

IRSharpAc(const uint16_t pin, const bool inverted=false, const bool use_modulation=true)

Class constructor.

Definition: ir_Sharp.cpp:245

const uint16_t kSharpAcZeroSpace

Definition: ir_Sharp.h:90

void setPower(const bool on, const bool prev_on=true)

Change the power setting, including the previous power state.

Definition: ir_Sharp.cpp:385

const uint8_t kSharpAcDry

Definition: ir_Sharp.h:108

std::string String

Definition: IRremoteESP8266.h:1521

const uint8_t kSharpAcTimerHoursMax

Definition: ir_Sharp.h:121

const uint8_t kSharpAcPowerOff

Definition: ir_Sharp.h:100

uint8_t getFan(void) const

Get the current fan speed setting.

Definition: ir_Sharp.cpp:527

Native representation of a Sharp A/C message.

Definition: ir_Sharp.h:44

const uint8_t kSharpAcTimerIncrement

Definition: ir_Sharp.h:119

const uint8_t kSharpAcPowerSetSpecialOn

Definition: ir_Sharp.h:102

static uint8_t convertMode(const stdAc::opmode_t mode)

Convert a stdAc::opmode_t enum into its native mode.

Definition: ir_Sharp.cpp:736

void setTurbo(const bool on)

Set the Turbo setting of the A/C.

Definition: ir_Sharp.cpp:543

void setModel(const sharp_ac_remote_model_t model)

Set the model of the A/C to emulate.

Definition: ir_Sharp.cpp:314

static bool validChecksum(uint8_t state[], const uint16_t length=kSharpAcStateLength)

Verify the checksum is valid for a given state.

Definition: ir_Sharp.cpp:275

const uint8_t kSharpAcSpecialTimerHalfHour

Definition: ir_Sharp.h:149

const uint8_t kSharpAcSwingVHigh

Definition: ir_Sharp.h:127

const uint8_t kSharpAcTimerHoursOff

Definition: ir_Sharp.h:120

bool getTurbo(void) const

Get the Turbo setting of the A/C.

Definition: ir_Sharp.cpp:533

const uint8_t kSharpAcSwingVLast

Definition: ir_Sharp.h:131

uint8_t Model

Definition: ir_Sharp.h:51

const uint8_t kSharpAcSwingVLow

Definition: ir_Sharp.h:130

uint8_t Clean

Definition: ir_Sharp.h:59

uint8_t TimerType

Definition: ir_Sharp.h:65

const uint8_t kSharpAcSwingVMid

Definition: ir_Sharp.h:129

void setPowerSpecial(const uint8_t value)

Set the value of the Power Special setting without any checks.

Definition: ir_Sharp.cpp:349

const uint8_t kSharpAcFanAuto

Definition: ir_Sharp.h:111

uint8_t Ion

Definition: ir_Sharp.h:76

void send(const uint16_t repeat=kSharpAcDefaultRepeat)

Send the current internal state as an IR message.

Definition: ir_Sharp.cpp:255

IRsend _irsend

Instance of the IR send class.

Definition: ir_Sharp.h:219

static uint8_t convertSwingV(const stdAc::swingv_t position)

Convert a standard A/C vertical swing into its native setting.

Definition: ir_Sharp.cpp:587

void checksum(void)

Calculate and set the checksum values for the internal state.

Definition: ir_Sharp.cpp:281

const uint8_t kSharpAcSwingVIgnore

Definition: ir_Sharp.h:126

const uint32_t kSharpAcGap

Definition: ir_Sharp.h:92

bool isPowerSpecial(void) const

Is one of the special power states in use?

Definition: ir_Sharp.cpp:367

static uint8_t convertFan(const stdAc::fanspeed_t speed, const sharp_ac_remote_model_t model=sharp_ac_remote_model_t::A907)

Convert a stdAc::fanspeed_t enum into it's native speed.

Definition: ir_Sharp.cpp:750

uint8_t * getRaw(void)

Get a PTR to the internal state/code for this protocol.

Definition: ir_Sharp.cpp:299

bool _getEconoToggle(void) const

Get the Economical mode toggle setting of the A/C.

Definition: ir_Sharp.cpp:628

uint8_t getTemp(void) const

Get the current temperature setting.

Definition: ir_Sharp.cpp:454

const uint8_t kSharpAcPowerUnknown

Definition: ir_Sharp.h:98

const uint8_t kSharpAcPowerOn

Definition: ir_Sharp.h:101

uint8_t getPowerSpecial(void) const

Get the value of the Power Special setting.

Definition: ir_Sharp.cpp:355

void _setEconoToggle(const bool on)

Set the Economical mode toggle setting of the A/C.

Definition: ir_Sharp.cpp:637

void setSpecial(const uint8_t mode)

Set the value of the Special (button/command?) setting.

Definition: ir_Sharp.cpp:405

void begin(void)

Set up hardware to be able to send a message.

Definition: ir_Sharp.cpp:250

const uint16_t kSharpAcStateLength

Definition: IRremoteESP8266.h:1377

const uint8_t kSharpAcFanMax

Definition: ir_Sharp.h:117

uint8_t _mode

Saved copy of the desired mode.

Definition: ir_Sharp.h:227

uint8_t PowerSpecial

Definition: ir_Sharp.h:55

Class for handling detailed Sharp A/C messages.

Definition: ir_Sharp.h:153

uint8_t Sum

Definition: ir_Sharp.h:82

bool getClean(void) const

Get the Clean setting of the A/C.

Definition: ir_Sharp.cpp:712

uint8_t TimerEnabled

Definition: ir_Sharp.h:66

uint8_t Swing

Definition: ir_Sharp.h:68

uint8_t Special

Definition: ir_Sharp.h:73

const uint8_t kSharpAcPowerTimerSetting

Definition: ir_Sharp.h:104

const uint8_t kSharpAcFanHigh

Definition: ir_Sharp.h:115

const uint8_t kSharpAcFanMin

Definition: ir_Sharp.h:112

void setClean(const bool on)

Set the Economical mode toggle setting of the A/C.

Definition: ir_Sharp.cpp:719

stdAc::opmode_t toCommonMode(const uint8_t mode) const

Convert a native mode into its stdAc equivalent.

Definition: ir_Sharp.cpp:777

uint8_t getMode(void) const

Get the operating mode setting of the A/C.

Definition: ir_Sharp.cpp:460

const uint8_t kSharpAcFan

Definition: ir_Sharp.h:107

const uint8_t kSharpAcFanMed

Definition: ir_Sharp.h:113

const uint16_t kSharpAcDefaultRepeat

Definition: IRremoteESP8266.h:1379

sharp_ac_remote_model_t getModel(const bool raw=false) const

Get/Detect the model of the A/C.

Definition: ir_Sharp.cpp:333

uint8_t getSpecial(void) const

Get the value of the Special (button/command?) setting.

Definition: ir_Sharp.cpp:423

bool getTimerEnabled(void) const

Is the Timer enabled?

Definition: ir_Sharp.cpp:682

bool getTimerType(void) const

Get the current timer type.

Definition: ir_Sharp.cpp:686

const uint8_t kSharpAcFanA705Med

Definition: ir_Sharp.h:116

uint8_t _fan

Saved copy of the desired fan speed.

Definition: ir_Sharp.h:228

void setEconoToggle(const bool on)

Set the Economical mode toggle setting of the A/C.

Definition: ir_Sharp.cpp:646

uint8_t Mode

Definition: ir_Sharp.h:57

uint8_t TimerHours

Definition: ir_Sharp.h:63

uint16_t getTimerTime(void) const

Get how long the timer is set for, in minutes.

Definition: ir_Sharp.cpp:674

const uint16_t kSharpAcHdrSpace

Definition: ir_Sharp.h:88

const uint8_t kSharpAcAuto

Definition: ir_Sharp.h:106

SharpProtocol _

Definition: ir_Sharp.h:225

const uint8_t kSharpAcSwingVCoanda

Definition: ir_Sharp.h:140

void setLightToggle(const bool on)

Set the Light mode toggle setting of the A/C.

Definition: ir_Sharp.cpp:661

void setSwingToggle(const bool on)

Set the (vertical) Swing Toggle setting of the A/C.

Definition: ir_Sharp.cpp:608

uint8_t Fan

Definition: ir_Sharp.h:60

const uint8_t kSharpAcPowerSetSpecialOff

Definition: ir_Sharp.h:103

void on(void)

Set the requested power state of the A/C to on.

Definition: ir_Sharp.cpp:377

bool getSwingToggle(void) const

Get the (vertical) Swing Toggle setting of the A/C.

Definition: ir_Sharp.cpp:602

void setMode(const uint8_t mode, const bool save=true)

Set the operating mode of the A/C.

Definition: ir_Sharp.cpp:467

bool getPower(void) const

Get the value of the current power setting.

Definition: ir_Sharp.cpp:395

@ A907

Definition: IRsend.h:193

const uint16_t kSharpAcBitMark

Definition: ir_Sharp.h:89

uint8_t raw[kSharpAcStateLength]

State of the remote in IR code form.

Definition: ir_Sharp.h:45

const uint8_t kSharpAcMinTemp

Definition: ir_Sharp.h:95

uint8_t Temp

Definition: ir_Sharp.h:50

const uint8_t kSharpAcSpecialTurbo

Definition: ir_Sharp.h:144

void stateReset(void)

Reset the state of the remote to a known good state/sequence.

Definition: ir_Sharp.cpp:286

const uint8_t kSharpAcByteTemp

Definition: ir_Sharp.h:94

void setIon(const bool on)

Set the Ion (Filter) setting of the A/C.

Definition: ir_Sharp.cpp:619

Structure to hold a common A/C state.

Definition: IRsend.h:114

void clearPowerSpecial(void)

Clear the "special"/non-normal bits in the power section. e.g. for normal/common command modes.

Definition: ir_Sharp.cpp:361

const uint16_t kSharpAcHdrMark

Definition: ir_Sharp.h:87

void setRaw(const uint8_t new_code[], const uint16_t length=kSharpAcStateLength)

Set the internal state from a valid code for this protocol.

Definition: ir_Sharp.cpp:307

const uint8_t kSharpAcSpecialPower

Definition: ir_Sharp.h:143

uint8_t pad[4]

Definition: ir_Sharp.h:48

sharp_ac_remote_model_t

Sharp A/C model numbers.

Definition: IRsend.h:192

String toString(void) const

Convert the current internal state into a human readable string.

Definition: ir_Sharp.cpp:868

opmode_t

Common A/C settings for A/C operating modes.

Definition: IRsend.h:49