Skip to content

Commit

Permalink
SamsungAc: Change clean setting to a toggle. (#1677)
Browse files Browse the repository at this point in the history
Fixes #1676
crankyoldgit authored Nov 18, 2021

Verified

This commit was signed with the committer’s verified signature. The key has expired.
renovate-bot Mend Renovate
1 parent 38408c5 commit 0f49566
Showing 5 changed files with 55 additions and 54 deletions.
5 changes: 3 additions & 2 deletions src/IRac.cpp
Original file line number Diff line number Diff line change
@@ -1824,7 +1824,7 @@ void IRac::panasonic32(IRPanasonicAc32 *ac,
/// @param[in] econo Run the device in economical mode.
/// @param[in] light Turn on the LED/Display mode.
/// @param[in] filter Turn on the (ion/pollen/etc) filter mode.
/// @param[in] clean Turn on the self-cleaning mode. e.g. Mould, dry filters etc
/// @param[in] clean Toggle the self-cleaning mode. e.g. Mould, dry filters etc
/// @param[in] beep Toggle beep setting for receiving IR messages.
/// @param[in] sleep Nr. of minutes for sleep mode. <= 0 is Off, > 0 is on.
/// @param[in] prevpower The power setting from the previous A/C state.
@@ -1854,7 +1854,7 @@ void IRac::samsung(IRSamsungAc *ac,
ac->setDisplay(light);
ac->setEcono(econo);
ac->setIon(filter);
ac->setClean(clean);
ac->setClean(clean); // Toggle
ac->setBeep(beep); // Toggle
ac->setSleepTimer((sleep <= 0) ? 0 : sleep);
// No Clock setting available.
@@ -2529,6 +2529,7 @@ stdAc::state_t IRac::handleToggles(const stdAc::state_t desired,
break;
case decode_type_t::SAMSUNG_AC:
result.beep = desired.beep ^ prev->beep;
result.clean = desired.clean ^ prev->clean;
break;
default:
{};
12 changes: 6 additions & 6 deletions src/ir_Samsung.cpp
Original file line number Diff line number Diff line change
@@ -599,17 +599,17 @@ bool IRSamsungAc::getBeep(void) const { return _.BeepToggle; }
/// @param[in] on true, the setting is on. false, the setting is off.
void IRSamsungAc::setBeep(const bool on) { _.BeepToggle = on; }

/// Get the Clean setting of the A/C.
/// Get the Clean toggle setting of the A/C.
/// @return true, the setting is on. false, the setting is off.
bool IRSamsungAc::getClean(void) const {
return _.Clean10 && _.Clean11;
return _.CleanToggle10 && _.CleanToggle11;
}

/// Set the Clean setting of the A/C.
/// Set the Clean toggle setting of the A/C.
/// @param[in] on true, the setting is on. false, the setting is off.
void IRSamsungAc::setClean(const bool on) {
_.Clean10 = on;
_.Clean11 = on;
_.CleanToggle10 = on;
_.CleanToggle11 = on;
}

/// Get the Quiet setting of the A/C.
@@ -926,7 +926,7 @@ String IRSamsungAc::toString(void) const {
result += addBoolToString(getSwing(), kSwingVStr);
result += addBoolToString(getSwingH(), kSwingHStr);
result += addToggleToString(_.BeepToggle, kBeepStr);
result += addBoolToString(getClean(), kCleanStr);
result += addToggleToString(getClean(), kCleanStr);
result += addBoolToString(getQuiet(), kQuietStr);
result += addBoolToString(getPowerful(), kPowerfulStr);
result += addBoolToString(getEcono(), kEconoStr);
18 changes: 9 additions & 9 deletions src/ir_Samsung.h
Original file line number Diff line number Diff line change
@@ -76,16 +76,16 @@ union SamsungProtocol{
uint8_t Swing :3;
uint8_t :1;
// Byte 10
uint8_t :1;
uint8_t FanSpecial :3; // Powerful, Breeze/WindFree, Econo
uint8_t Display :1;
uint8_t :2;
uint8_t Clean10 :1;
uint8_t :1;
uint8_t FanSpecial :3; // Powerful, Breeze/WindFree, Econo
uint8_t Display :1;
uint8_t :2;
uint8_t CleanToggle10 :1;
// Byte 11
uint8_t Ion :1;
uint8_t Clean11 :1;
uint8_t :2;
uint8_t Temp :4;
uint8_t Ion :1;
uint8_t CleanToggle11 :1;
uint8_t :2;
uint8_t Temp :4;
// Byte 12
uint8_t :1;
uint8_t Fan :3;
12 changes: 6 additions & 6 deletions test/IRac_test.cpp
Original file line number Diff line number Diff line change
@@ -1654,7 +1654,7 @@ TEST(TestIRac, Samsung) {
const char expected[] =
"Power: On, Mode: 0 (Auto), Temp: 28C, Fan: 6 (Auto), "
"Swing(V): On, Swing(H): On, Beep: Toggle, "
"Clean: On, Quiet: On, Powerful: Off, ""Econo: Off, Breeze: Off, "
"Clean: Toggle, Quiet: On, Powerful: Off, ""Econo: Off, Breeze: Off, "
"Light: On, Ion: Off";

ac.begin();
@@ -1670,7 +1670,7 @@ TEST(TestIRac, Samsung) {
false, // Econo
true, // Light (Display)
false, // Filter (Ion)
true, // Clean
true, // Clean (Toggle)
true, // Beep
-1, // Sleep
true, // Previous power state
@@ -1698,7 +1698,7 @@ TEST(TestIRac, Samsung) {
false, // Econo
true, // Light (Display)
false, // Filter (Ion)
true, // Clean
true, // Clean (Toggle)
true, // Beep
-1, // Sleep
true, // Previous power state
@@ -1716,8 +1716,8 @@ TEST(TestIRac, Samsung) {
ac._irsend.reset();
const char sleep[] =
"Power: On, Mode: 0 (Auto), Temp: 28C, Fan: 6 (Auto), "
"Swing(V): On, Swing(H): Off, "
"Beep: -, Clean: On, Quiet: On, Powerful: Off, Econo: Off, Breeze: Off, "
"Swing(V): On, Swing(H): Off, Beep: -, Clean: Toggle, "
"Quiet: On, Powerful: Off, Econo: Off, Breeze: Off, "
"Light: On, Ion: Off, Sleep Timer: 08:00";
irac.samsung(&ac,
true, // Power
@@ -1731,7 +1731,7 @@ TEST(TestIRac, Samsung) {
false, // Econo
true, // Light (Display)
false, // Filter (Ion)
true, // Clean
true, // Clean (Toggle)
false, // Beep
8 * 60, // Sleep
true, // Previous power state
Loading

0 comments on commit 0f49566

Please sign in to comment.