@@ -19,7 +19,7 @@ const uint16_t kElectroluxAcBitMark = 752;
19
19
const uint16_t kElectroluxAcHdrSpace = 2700 ;
20
20
const uint16_t kElectroluxAcOneSpace = 2149 ;
21
21
const uint16_t kElectroluxAcZeroSpace = 756 ;
22
- const uint16_t kElectroluxAcFreq = 38000 ; // Hz.
22
+ const uint16_t kElectroluxAcFreq = 38000 ;
23
23
const uint16_t kElectroluxAcOverhead = 3 ;
24
24
25
25
#if SEND_ELECTROLUX_AC
@@ -48,10 +48,12 @@ void IRsend::sendElectroluxAc(
48
48
send_data >>= 32 ;
49
49
// Footer
50
50
mark (kElectroluxAcBitMark );
51
- space (kDefaultMessageGap ); // A 100% made up guess of the gap between messages.
51
+
52
+ // A 100% made up guess of the gap between messages.
53
+ space (kDefaultMessageGap );
52
54
}
53
55
}
54
- #endif // SEND_ELECTROLUX
56
+ #endif // SEND_ELECTROLUX
55
57
56
58
#if DECODE_ELECTROLUX_AC
57
59
// Function should be safe up to 64 bits.
@@ -69,8 +71,8 @@ bool IRrecv::decodeElectroluxAc(
69
71
const uint16_t nbits,
70
72
const bool strict
71
73
) {
72
- if (results->rawlen < 2 * nbits + kElectroluxAcOverhead - offset) // rawlen = 68, nbits = 104
73
- return false ; // Too short a message to match.
74
+ if (results->rawlen < 2 * nbits + kElectroluxAcOverhead - offset)
75
+ return false ; // Too short a message to match.
74
76
if (strict && nbits != kElectroluxAcBits )
75
77
return false ;
76
78
@@ -84,13 +86,15 @@ bool IRrecv::decodeElectroluxAc(
84
86
85
87
// Data Section #1
86
88
// e.g. data_result.data = 0xED000004, nbits = 32
87
- match_result_t data_result = matchData (&(results->rawbuf [offset]), 32 ,
88
- kElectroluxAcBitMark , kElectroluxAcOneSpace ,
89
- kElectroluxAcBitMark , kElectroluxAcZeroSpace );
89
+ match_result_t data_result = matchData (
90
+ &(results->rawbuf [offset]), 32 ,
91
+ kElectroluxAcBitMark , kElectroluxAcOneSpace ,
92
+ kElectroluxAcBitMark , kElectroluxAcZeroSpace );
93
+
90
94
offset += data_result.used ;
91
95
if (data_result.success == false )
92
- return false ; // Fail
93
- data <<= 32 ; // Make room for the new bits of data.
96
+ return false ; // Fail
97
+ data <<= 32 ; // Make room for the new bits of data.
94
98
data |= data_result.data ;
95
99
96
100
// Footer
@@ -105,7 +109,7 @@ bool IRrecv::decodeElectroluxAc(
105
109
results->address = 0 ;
106
110
return true ;
107
111
}
108
- #endif // DECODE_ELECTROLUX
112
+ #endif // DECODE_ELECTROLUX
109
113
110
114
// / Class constructor
111
115
// / @param[in] pin GPIO to be used when sending.
@@ -130,7 +134,7 @@ void IRElectroluxAc::stateReset() { _.raw = 0xF3008005; }
130
134
void IRElectroluxAc::send (const uint16_t repeat) {
131
135
_irsend.sendElectroluxAc (getRaw (), kElectroluxAcBits , repeat);
132
136
}
133
- #endif // SEND_ELECTROLUX_AC
137
+ #endif // SEND_ELECTROLUX_AC
134
138
135
139
// / Set up hardware to be able to send a message.
136
140
void IRElectroluxAc::begin () { _irsend.begin (); }
@@ -145,11 +149,15 @@ bool IRElectroluxAc::getPower() const { return _.Power; }
145
149
146
150
// / Turn on/off the fahrenheit temp mode.
147
151
// / @param[in] on The desired setting state.
148
- void IRElectroluxAc::setTempModeFahrenheit (const bool on) { _.TempModeFahrenheit = on; }
152
+ void IRElectroluxAc::setTempModeFahrenheit (const bool on) {
153
+ _.TempModeFahrenheit = on;
154
+ }
149
155
150
156
// / Get the fahrenheit temp mode set from the internal state.
151
157
// / @return A boolean indicating the setting.
152
- bool IRElectroluxAc::getTempModeFahrenheit () const { return _.TempModeFahrenheit ; }
158
+ bool IRElectroluxAc::getTempModeFahrenheit () const {
159
+ return _.TempModeFahrenheit ;
160
+ }
153
161
154
162
// / Set the temperature.
155
163
// / @param[in] degrees The temperature in celsius or fahrenheit.
@@ -162,7 +170,8 @@ void IRElectroluxAc::setTemp(const uint8_t degrees) {
162
170
uint8_t temp = max (kElectroluxAcMinTemp , degrees);
163
171
temp = min (kElectroluxAcMaxTemp , temp);
164
172
#ifndef UNIT_TEST
165
- temp = map (temp, kElectroluxAcMinTemp , kElectroluxAcMaxTemp , kElectroluxAcMinFTemp , kElectroluxAcMaxFTemp );
173
+ temp = map (temp, kElectroluxAcMinTemp , kElectroluxAcMaxTemp ,
174
+ kElectroluxAcMinFTemp , kElectroluxAcMaxFTemp );
166
175
#else
167
176
temp = temp * 9 / 5 + 32 ;
168
177
#endif
@@ -177,7 +186,8 @@ uint8_t IRElectroluxAc::getTemp() const {
177
186
return _.Temp + kElectroluxAcMinFTemp ;
178
187
} else {
179
188
#ifndef UNIT_TEST
180
- uint8_t temp = map (_.Temp + kElectroluxAcMinFTemp , kElectroluxAcMinFTemp , kElectroluxAcMaxFTemp ,
189
+ uint8_t temp = map (_.Temp + kElectroluxAcMinFTemp ,
190
+ kElectroluxAcMinFTemp , kElectroluxAcMaxFTemp ,
181
191
kElectroluxAcMinTemp , kElectroluxAcMaxTemp );
182
192
#else
183
193
uint8_t temp = ((_.Temp + kElectroluxAcMinFTemp ) - 32 ) * 5 / 9 ;
@@ -225,11 +235,11 @@ uint8_t IRElectroluxAc::getMode() const { return _.Mode; }
225
235
void IRElectroluxAc::setOnOffTimer (const uint16_t nr_of_mins) {
226
236
const uint8_t hours = std::min (
227
237
static_cast <uint8_t >(nr_of_mins / 60 ),
228
- kElectroluxTimerMax
229
- );
238
+ kElectroluxTimerMax );
239
+
230
240
// The time can be changed in sleep mode, but doesn't set the flag.
231
241
_.TimerEnabled = hours > 0 ;
232
- _.Timer = std::max (kElectroluxTimerMin , hours); // Hours
242
+ _.Timer = std::max (kElectroluxTimerMin , hours); // Hours
233
243
}
234
244
235
245
// / Get the current On/Off Timer time.
@@ -250,7 +260,7 @@ bool IRElectroluxAc::getQuiet() const { return _.Quiet; }
250
260
// / Get a copy of the internal state as a valid code for this protocol.
251
261
// / @return A valid code for this protocol based on the current internal state.
252
262
uint64_t IRElectroluxAc::getRaw () {
253
- checksum (); // Ensure correct settings before sending.
263
+ checksum (); // Ensure correct settings before sending.
254
264
return _.raw ;
255
265
}
256
266
@@ -265,10 +275,10 @@ uint8_t IRElectroluxAc::calcChecksum(const uint64_t state) {
265
275
uint32_t data = GETBITS64 (
266
276
state,
267
277
kElectroluxAcChecksumSize + kElectroluxAcChecksumOffset ,
268
- kElectroluxAcBits - 4
269
- );
278
+ kElectroluxAcBits - 4 );
279
+
270
280
uint8_t result = 0 ;
271
- for (; data; data >>= 4 ) // Add each nibble together.
281
+ for (; data; data >>= 4 ) // Add each nibble together.
272
282
result += GETBITS8 (data, 0 , 4 );
273
283
return (result ^ 0xF ) & 0xF ;
274
284
}
@@ -389,45 +399,43 @@ stdAc::state_t IRElectroluxAc::toCommon(const stdAc::state_t *prev) const {
389
399
// / @return The current internal state expressed as a human readable String.
390
400
String IRElectroluxAc::toString () const {
391
401
String result = " " ;
392
- result.reserve (120 ); // Reserve some heap for the string to reduce fragging.
402
+ result.reserve (120 ); // Reserve heap for the string to reduce fragging.
403
+
393
404
result += addBoolToString (
394
405
_.Power ,
395
406
kPowerStr ,
396
- false
397
- );
407
+ false );
408
+
398
409
result += addModeToString (
399
410
_.Mode ,
400
411
kElectroluxModeAuto ,
401
412
kElectroluxModeCool ,
402
413
0xFF ,
403
414
kElectroluxModeDry ,
404
- kElectroluxModeFan
405
- );
415
+ kElectroluxModeFan );
416
+
406
417
result += addTempToString (
407
418
getTemp (),
408
- !getTempModeFahrenheit ()
409
- );
419
+ !getTempModeFahrenheit ());
420
+
410
421
result += addFanToString (
411
422
_.Fan ,
412
423
kElectroluxFanHigh ,
413
424
kElectroluxFanLow ,
414
425
kElectroluxFanAuto ,
415
426
kElectroluxFanAuto ,
416
- kElectroluxFanMedium
417
- );
427
+ kElectroluxFanMedium );
418
428
419
429
result += addBoolToString (getQuiet (), kQuietStr );
420
430
421
431
if (getPower ()) {
422
432
result += irutils::addLabeledString (
423
433
irutils::minsToString (getOnOffTimer ()),
424
- kOffTimerStr
425
- );
434
+ kOffTimerStr );
426
435
} else {
427
436
result += irutils::addLabeledString (
428
437
irutils::minsToString (getOnOffTimer ()),
429
- kOnTimerStr
430
- );
438
+ kOnTimerStr );
431
439
}
432
440
return result;
433
441
}
0 commit comments