Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quiet/Silent Mode for Electra_AC #1990

Merged
merged 6 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/IRac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,7 @@ void IRac::ecoclim(IREcoclimAc *ac,
/// @param[in] swingv The vertical swing setting.
/// @param[in] swingh The horizontal swing setting.
/// @param[in] iFeel Whether to enable iFeel (remote temp) mode on the A/C unit.
/// @param[in] quiet Run the device in quiet/silent mode.
/// @param[in] turbo Run the device in turbo/powerful mode.
/// @param[in] lighttoggle Should we toggle the LED/Display?
/// @param[in] clean Turn on the self-cleaning mode. e.g. Mould, dry filters etc
Expand All @@ -1175,7 +1176,8 @@ void IRac::electra(IRElectraAc *ac,
const float degrees, const float sensorTemp,
const stdAc::fanspeed_t fan, const stdAc::swingv_t swingv,
const stdAc::swingh_t swingh, const bool iFeel,
const bool turbo, const bool lighttoggle, const bool clean) {
const bool quiet, const bool turbo, const bool lighttoggle,
const bool clean) {
ac->begin();
ac->setPower(on);
ac->setMode(ac->convertMode(mode));
Expand All @@ -1186,7 +1188,7 @@ void IRac::electra(IRElectraAc *ac,
ac->setFan(ac->convertFan(fan));
ac->setSwingV(swingv != stdAc::swingv_t::kOff);
ac->setSwingH(swingh != stdAc::swingh_t::kOff);
// No Quiet setting available.
ac->setQuiet(quiet);
ac->setTurbo(turbo);
ac->setLightToggle(lighttoggle);
// No Econo setting available.
Expand Down Expand Up @@ -3223,8 +3225,8 @@ bool IRac::sendAc(const stdAc::state_t desired, const stdAc::state_t *prev) {
{
IRElectraAc ac(_pin, _inverted, _modulation);
electra(&ac, send.power, send.mode, degC, sensorTempC, send.fanspeed,
send.swingv, send.swingh, send.iFeel, send.turbo, send.light,
send.clean);
send.swingv, send.swingh, send.iFeel, send.quiet, send.turbo,
send.light, send.clean);
break;
}
#endif // SEND_ELECTRA_AC
Expand Down
4 changes: 2 additions & 2 deletions src/IRac.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ void electra(IRElectraAc *ac,
const bool on, const stdAc::opmode_t mode,
const float degrees, const float sensorTemp,
const stdAc::fanspeed_t fan, const stdAc::swingv_t swingv,
const stdAc::swingh_t swingh, const bool iFeel, const bool turbo,
const bool lighttoggle, const bool clean);
const stdAc::swingh_t swingh, const bool iFeel, const bool quiet,
const bool turbo, const bool lighttoggle, const bool clean);
#endif // SEND_ELECTRA_AC
#if SEND_FUJITSU_AC
void fujitsu(IRFujitsuAC *ac, const fujitsu_ac_remote_model_t model,
Expand Down
15 changes: 14 additions & 1 deletion src/ir_Electra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,18 @@ bool IRElectraAc::getTurbo(void) const {
return _.Turbo;
}

/// Set the Quiet/Silent'mode of the A/C.
/// @param[in] on true, the setting is on. false, the setting is off.
void IRElectraAc::setQuiet(const bool on) {
_.Quiet = on;
}

/// Get the Quiet/Silent mode of the A/C.
/// @return true, the setting is on. false, the setting is off.
bool IRElectraAc::getQuiet(void) const {
return _.Quiet;
}

/// Get the IFeel mode of the A/C.
/// @return true, the setting is on. false, the setting is off.
bool IRElectraAc::getIFeel(void) const { return _.IFeel; }
Expand Down Expand Up @@ -373,11 +385,11 @@ stdAc::state_t IRElectraAc::toCommon(void) const {
: stdAc::swingh_t::kOff;
result.light = getLightToggle();
result.turbo = _.Turbo;
result.quiet = _.Quiet;
result.clean = _.Clean;
result.iFeel = getIFeel();
// Not supported.
result.model = -1; // No models used.
result.quiet = false;
result.econo = false;
result.filter = false;
result.beep = false;
Expand All @@ -404,6 +416,7 @@ String IRElectraAc::toString(void) const {
result += addToggleToString(getLightToggle(), kLightStr);
result += addBoolToString(_.Clean, kCleanStr);
result += addBoolToString(_.Turbo, kTurboStr);
result += addBoolToString(_.Quiet, kQuietStr);
result += addBoolToString(_.IFeel, kIFeelStr);
}
if (_.IFeel || _.SensorUpdate) {
Expand Down
5 changes: 4 additions & 1 deletion src/ir_Electra.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// Brand: Centek, Model: YKR-P/002E remote
// Brand: AEG, Model: Chillflex Pro AXP26U338CW A/C
// Brand: Electrolux, Model: YKR-H/531E A/C
// Brand: Delonghi, Modell: PAC EM90

#ifndef IR_ELECTRA_H_
#define IR_ELECTRA_H_
Expand Down Expand Up @@ -52,7 +53,7 @@ union ElectraProtocol {
// Byte 5
uint8_t :6;
uint8_t Turbo :1;
uint8_t :1;
uint8_t Quiet :1;
// Byte 6
uint8_t :3;
uint8_t IFeel :1;
Expand Down Expand Up @@ -145,6 +146,8 @@ class IRElectraAc {
bool getLightToggle(void) const;
void setTurbo(const bool on);
bool getTurbo(void) const;
void setQuiet(const bool on);
bool getQuiet(void) const;
void setIFeel(const bool on);
bool getIFeel(void) const;
void setSensorUpdate(const bool on);
Expand Down
3 changes: 2 additions & 1 deletion test/IRac_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ TEST(TestIRac, Electra) {
char expected[] =
"Power: On, Mode: 6 (Fan), Temp: 26C, Fan: 1 (High), "
"Swing(V): On, Swing(H): On, Light: Toggle, Clean: On, Turbo: On, "
"IFeel: Off";
"Quiet: On, IFeel: Off";

ac.begin();
irac.electra(&ac,
Expand All @@ -625,6 +625,7 @@ TEST(TestIRac, Electra) {
stdAc::swingv_t::kAuto, // Vertical swing
stdAc::swingh_t::kLeft, // Horizontal swing
false, // iFeel
true, // Quiet
true, // Turbo
true, // Light (toggle)
true); // Clean
Expand Down
20 changes: 10 additions & 10 deletions test/ir_Electra_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ TEST(TestDecodeElectraAC, RealExampleDecode) {
EXPECT_EQ(
"Power: On, Mode: 1 (Cool), Temp: 24C, Fan: 3 (Low), "
"Swing(V): Off, Swing(H): Off, Light: -, Clean: Off, Turbo: Off, "
"IFeel: Off",
"Quiet: Off, IFeel: Off",
IRAcUtils::resultAcToString(&irsend.capture));
stdAc::state_t r, p;
ASSERT_TRUE(IRAcUtils::decodeToState(&irsend.capture, &r, &p));
Expand Down Expand Up @@ -237,7 +237,7 @@ TEST(TestIRElectraAcClass, HumanReadable) {
EXPECT_EQ(
"Power: On, Mode: 1 (Cool), Temp: 32C, Fan: 5 (Auto), "
"Swing(V): Off, Swing(H): Off, Light: -, Clean: Off, Turbo: Off, "
"IFeel: Off",
"Quiet: Off, IFeel: Off",
ac.toString());
uint8_t on_cool_16C_auto_voff[13] = {
0xC3, 0x47, 0xE0, 0x00, 0xA0, 0x00, 0x20,
Expand All @@ -246,7 +246,7 @@ TEST(TestIRElectraAcClass, HumanReadable) {
EXPECT_EQ(
"Power: On, Mode: 1 (Cool), Temp: 16C, Fan: 5 (Auto), "
"Swing(V): Off, Swing(H): Off, Light: -, Clean: Off, Turbo: Off, "
"IFeel: Off",
"Quiet: Off, IFeel: Off",
ac.toString());
uint8_t on_cool_16C_low_voff[13] = {
0xC3, 0x47, 0xE0, 0x00, 0x60, 0x00, 0x20,
Expand All @@ -255,7 +255,7 @@ TEST(TestIRElectraAcClass, HumanReadable) {
EXPECT_EQ(
"Power: On, Mode: 1 (Cool), Temp: 16C, Fan: 3 (Low), "
"Swing(V): Off, Swing(H): Off, Light: -, Clean: Off, Turbo: Off, "
"IFeel: Off",
"Quiet: Off, IFeel: Off",
ac.toString());
}

Expand All @@ -280,7 +280,7 @@ TEST(TestIRElectraAcClass, Clean) {
EXPECT_EQ(
"Power: On, Mode: 1 (Cool), Temp: 24C, Fan: 3 (Low), "
"Swing(V): Off, Swing(H): Off, Light: Toggle, Clean: On, Turbo: Off, "
"IFeel: Off",
"Quiet: Off, IFeel: Off",
ac.toString());
}

Expand All @@ -307,7 +307,7 @@ TEST(TestIRElectraAcClass, Turbo) {
EXPECT_EQ(
"Power: On, Mode: 1 (Cool), Temp: 24C, Fan: 3 (Low), "
"Swing(V): Off, Swing(H): Off, Light: -, Clean: Off, Turbo: On, "
"IFeel: Off",
"Quiet: Off, IFeel: Off",
ac.toString());
}

Expand All @@ -332,7 +332,7 @@ TEST(TestIRElectraAcClass, LightToggle) {
EXPECT_EQ(
"Power: On, Mode: 1 (Cool), Temp: 24C, Fan: 3 (Low), "
"Swing(V): Off, Swing(H): Off, Light: Toggle, Clean: On, Turbo: Off, "
"IFeel: Off",
"Quiet: Off, IFeel: Off",
ac.toString());
}

Expand Down Expand Up @@ -360,7 +360,7 @@ TEST(TestIRElectraAcClass, ConstructKnownState) {
EXPECT_EQ(
"Power: On, Mode: 1 (Cool), Temp: 24C, Fan: 3 (Low), "
"Swing(V): Off, Swing(H): Off, Light: Toggle, Clean: On, Turbo: Off, "
"IFeel: Off",
"Quiet: Off, IFeel: Off",
ac.toString());
EXPECT_STATE_EQ(on_cool_24C_fan1_swing_off_turbo_off_clean_on,
ac.getRaw(), kElectraAcBits);
Expand All @@ -379,7 +379,7 @@ TEST(TestIRElectraAcClass, IFeelAndSensor) {
EXPECT_EQ(
"Power: On, Mode: 1 (Cool), Temp: 21C, Fan: 5 (Auto), "
"Swing(V): Off, Swing(H): Off, Light: -, Clean: Off, Turbo: Off, "
"IFeel: On, Sensor Temp: 26C",
"Quiet: Off, IFeel: On, Sensor Temp: 26C",
ac.toString());

ac.stateReset();
Expand Down Expand Up @@ -429,6 +429,6 @@ TEST(TestIRElectraAcClass, IFeelAndSensor) {
EXPECT_EQ(
"Power: On, Mode: 4 (Heat), Temp: 27C, Fan: 5 (Auto), "
"Swing(V): Off, Swing(H): Off, Light: -, Clean: Off, Turbo: Off, "
"IFeel: On, Sensor Temp: 28C",
"Quiet: Off, IFeel: On, Sensor Temp: 28C",
ac.toString());
}
Loading