Skip to content

Commit

Permalink
fix: code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
StellaLupus committed Aug 10, 2024
1 parent 8adacd5 commit 37f68fa
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 65 deletions.
6 changes: 4 additions & 2 deletions src/IRac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ bool IRac::isProtocolSupported(const decode_type_t protocol) {
#endif
#if SEND_ELECTROLUX_AC
case decode_type_t::ELETROLUX_AC:
#endif // SEND_ELECTROLUX_AC
#endif // SEND_ELECTROLUX_AC
#if SEND_FUJITSU_AC
case decode_type_t::FUJITSU_AC:
#endif
Expand Down Expand Up @@ -3681,7 +3681,9 @@ bool IRac::sendAc(const stdAc::state_t desired, const stdAc::state_t *prev) {
case ELETROLUX_AC:
{
IRElectroluxAc ac(_pin, _inverted, _modulation);
electrolux(&ac, send.power, send.mode, send.celsius, send.degrees, send.fanspeed, send.quiet);
electrolux(&ac, send.power, send.mode,
send.celsius, send.degrees,
send.fanspeed, send.quiet);
break;
}
#endif // SEND_ELECTROLUX_AC
Expand Down
2 changes: 1 addition & 1 deletion src/IRrecv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ bool IRrecv::decode(decode_results *results, irparams_t *save,
#if DECODE_ELECTROLUX_AC
DPRINTLN("Attempting Electrolux AC decode");
if (decodeElectroluxAc(results, offset)) return true;
#endif //DECODE_ELECTROLUX_AC
#endif // DECODE_ELECTROLUX_AC
// Typically new protocols are added above this line.
}
#if DECODE_HASH
Expand Down
9 changes: 5 additions & 4 deletions src/IRrecv.h
Original file line number Diff line number Diff line change
Expand Up @@ -890,10 +890,11 @@ class IRrecv {
const bool strict = true);
#endif // DECODE_BLUESTARHEAVY
#if DECODE_ELECTROLUX_AC
bool decodeElectroluxAc(decode_results *results, uint16_t offset = kStartOffset,
const uint16_t nbits = kElectroluxAcBits,
const bool strict = true);
#endif // DECODE_ELECTROLUX_AC
bool decodeElectroluxAc(decode_results *results,
uint16_t offset = kStartOffset,
const uint16_t nbits = kElectroluxAcBits,
const bool strict = true);
#endif // DECODE_ELECTROLUX_AC
};

#endif // IRRECV_H_
116 changes: 58 additions & 58 deletions src/ir_Electrolux.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// Supports:
// Brand: Electrolux, Model: Electrolux EACM EZ/N3

#ifndef IR_ELECTROLUX_AC_H_
#define IR_ELECTROLUX_AC_H_
#ifndef IR_ELECTROLUX_H_
#define IR_ELECTROLUX_H_

#define STDC_LIMIT_MACROS
#include <cstdint>
Expand All @@ -20,22 +20,22 @@
#endif

union ElectroluxAcProtocol {
uint64_t raw; // The state of the IR remote in native IR code form.
struct {
uint8_t Sum: 4;
uint8_t : 4;
uint8_t : 5;
uint8_t TempModeFahrenheit: 1;
uint8_t : 1;
uint8_t Quiet: 1;
uint8_t Timer: 4;
uint8_t TimerEnabled: 1;
uint8_t Mode: 3;
uint8_t Temp: 5;
uint8_t Fan: 2;
uint8_t Power: 1;
uint64_t : 0;
};
uint64_t raw; // The state of the IR remote in native IR code form.
struct {
uint8_t Sum: 4;
uint8_t : 4;
uint8_t : 5;
uint8_t TempModeFahrenheit: 1;
uint8_t : 1;
uint8_t Quiet: 1;
uint8_t Timer: 4;
uint8_t TimerEnabled: 1;
uint8_t Mode: 3;
uint8_t Temp: 5;
uint8_t Fan: 2;
uint8_t Power: 1;
uint64_t : 0;
};
};

// Constants
Expand Down Expand Up @@ -63,85 +63,85 @@ const uint8_t kElectroluxModeAuto = 4; // 0b100

class IRElectroluxAc {
public:
explicit IRElectroluxAc(uint16_t pin, bool inverted = false,
bool use_modulation = true);
explicit IRElectroluxAc(uint16_t pin, bool inverted = false,
bool use_modulation = true);

void stateReset();
void stateReset();
#if SEND_ELECTROLUX_AC
void send(uint16_t repeat = kElectroluxAcDefaultRepeat);
void send(uint16_t repeat = kElectroluxAcDefaultRepeat);

/// Run the calibration to calculate uSec timing offsets for this platform.
/// @return The uSec timing offset needed per modulation of the IR Led.
/// @note This will produce a 65ms IR signal pulse at 38kHz.
/// Only ever needs to be run once per object instantiation, if at all.
int8_t calibrate() { return _irsend.calibrate(); }
/// Run the calibration to calculate uSec timing offsets for this platform.
/// @return The uSec timing offset needed per modulation of the IR Led.
/// @note This will produce a 65ms IR signal pulse at 38kHz.
/// Only ever needs to be run once per object instantiation, if at all.
int8_t calibrate() { return _irsend.calibrate(); }
#endif // SEND_ELECTROLUX_AC
void begin();
void begin();

void on();
void on();

void off();
void off();

void setPower(bool on);
void setPower(bool on);

bool getPower() const;
bool getPower() const;

void setTemp(uint8_t temp);
void setTemp(uint8_t temp);

uint8_t getTemp() const;
uint8_t getTemp() const;

void setFan(uint8_t speed);
void setFan(uint8_t speed);

uint8_t getFan() const;
uint8_t getFan() const;

void setMode(uint8_t mode);
void setMode(uint8_t mode);

uint8_t getMode() const;
uint8_t getMode() const;

void setOnOffTimer(uint16_t nr_of_mins);
void setOnOffTimer(uint16_t nr_of_mins);

uint16_t getOnOffTimer() const;
uint16_t getOnOffTimer() const;

void setQuiet(bool on);
void setQuiet(bool on);

bool getQuiet() const;
bool getQuiet() const;

void setTempModeFahrenheit(bool on);
void setTempModeFahrenheit(bool on);

bool getTempModeFahrenheit() const;
bool getTempModeFahrenheit() const;

uint64_t getRaw();
uint64_t getRaw();

void setRaw(uint64_t state);
void setRaw(uint64_t state);

static uint8_t calcChecksum(uint64_t state);
static uint8_t calcChecksum(uint64_t state);

static bool validChecksum(uint64_t state);
static bool validChecksum(uint64_t state);

static uint8_t convertMode(stdAc::opmode_t mode);
static uint8_t convertMode(stdAc::opmode_t mode);

static uint8_t convertFan(stdAc::fanspeed_t speed);
static uint8_t convertFan(stdAc::fanspeed_t speed);

static stdAc::opmode_t toCommonMode(uint8_t mode);
static stdAc::opmode_t toCommonMode(uint8_t mode);

static stdAc::fanspeed_t toCommonFanSpeed(uint8_t speed);
static stdAc::fanspeed_t toCommonFanSpeed(uint8_t speed);

stdAc::state_t toCommon(const stdAc::state_t *prev = nullptr) const;
stdAc::state_t toCommon(const stdAc::state_t *prev = nullptr) const;

String toString() const;
String toString() const;

#ifndef UNIT_TEST

private:
IRsend _irsend; ///< Instance of the IR send class
IRsend _irsend; ///< Instance of the IR send class
#else // UNIT_TEST
/// @cond IGNORE
IRsendTest _irsend; ///< Instance of the testing IR send class
/// @endcond
#endif // UNIT_TEST
ElectroluxAcProtocol _{};
ElectroluxAcProtocol _{};

void checksum();
void checksum();
};

#endif // IR_ELECTROLUX_AC_H_
#endif // IR_ELECTROLUX_H_

0 comments on commit 37f68fa

Please sign in to comment.