Skip to content

Commit 786b963

Browse files
pipiche38gizmocuz
authored andcommitted
Remove unecessary test (#2492)
* Remove unecessary test
1 parent f6fc6fe commit 786b963

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

hardware/Daikin.cpp

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -728,11 +728,9 @@ void CDaikin::InsertUpdateSwitchSelector(const unsigned char Idx, const bool bI
728728
_eSwitchType switchtype;
729729
switchtype = STYPE_Selector;
730730

731-
if (switchtype == STYPE_Selector) {
732-
xcmd.subtype = sSwitchTypeSelector;
733-
if (level > 0) {
734-
xcmd.level = level;
735-
}
731+
xcmd.subtype = sSwitchTypeSelector;
732+
if (level > 0) {
733+
xcmd.level = level;
736734
}
737735

738736
//check if this switch is already in the database
@@ -761,27 +759,22 @@ void CDaikin::InsertUpdateSwitchSelector(const unsigned char Idx, const bool bI
761759
}
762760
m_sql.safe_query("UPDATE DeviceStatus SET Name='%q', SwitchType=%d, CustomImage=%i WHERE(HardwareID == %d) AND (DeviceID == '0000000%d') AND (Unit == '%d')", defaultname.c_str(), (switchtype), customimage, m_HwdID, sID, xcmd.unitcode);
763761

764-
if (switchtype == STYPE_Selector) {
765-
result = m_sql.safe_query("SELECT ID FROM DeviceStatus WHERE (HardwareID==%d) AND (DeviceID=='0000000%d') AND (Type==%d) AND (Unit == '%d')", m_HwdID, sID, xcmd.type, xcmd.unitcode);
766-
767-
// SelectorStyle:0;LevelNames:Off|Main|Sub|Main+Sub;LevelOffHidden:true;LevelActions:00|01|02|03"
768-
769-
if (!result.empty()) {
770-
std::string Idx = result[0][0];
771-
if (defaultname == "Mode") {
772-
m_sql.SetDeviceOptions(atoi(Idx.c_str()), m_sql.BuildDeviceOptions("SelectorStyle:0;LevelNames:Off|AUTO|DEHUMDIFICATOR|COLD|HOT|FAN;LevelOffHidden:true;LevelActions:00|01|02|03|04|06", false));
773-
}
774-
else if (defaultname == "Ventillation") {
775-
//for the Gateway Audio
776-
m_sql.SetDeviceOptions(atoi(Idx.c_str()), m_sql.BuildDeviceOptions("SelectorStyle:0;LevelNames:Off|AUTO|Silence|Lev 1|Lev 2|Lev 3|Lev 4|Lev 5;LevelOffHidden:true;LevelActions:00|10|20|30|40|50|60|70", false));
777-
}
778-
else if (defaultname == "Winds") {
779-
//for the Gateway Audio
780-
m_sql.SetDeviceOptions(atoi(Idx.c_str()), m_sql.BuildDeviceOptions("SelectorStyle:0;LevelNames:Off|Stopped|Vert|Horiz|Both;LevelOffHidden:true", false));
781-
}
762+
result = m_sql.safe_query("SELECT ID FROM DeviceStatus WHERE (HardwareID==%d) AND (DeviceID=='0000000%d') AND (Type==%d) AND (Unit == '%d')", m_HwdID, sID, xcmd.type, xcmd.unitcode);
763+
// SelectorStyle:0;LevelNames:Off|Main|Sub|Main+Sub;LevelOffHidden:true;LevelActions:00|01|02|03"
764+
if (!result.empty()) {
765+
std::string Idx = result[0][0];
766+
if (defaultname == "Mode") {
767+
m_sql.SetDeviceOptions(atoi(Idx.c_str()), m_sql.BuildDeviceOptions("SelectorStyle:0;LevelNames:Off|AUTO|DEHUMDIFICATOR|COLD|HOT|FAN;LevelOffHidden:true;LevelActions:00|01|02|03|04|06", false));
768+
}
769+
else if (defaultname == "Ventillation") {
770+
//for the Fans
771+
m_sql.SetDeviceOptions(atoi(Idx.c_str()), m_sql.BuildDeviceOptions("SelectorStyle:0;LevelNames:Off|AUTO|Silence|Lev 1|Lev 2|Lev 3|Lev 4|Lev 5;LevelOffHidden:true;LevelActions:00|10|20|30|40|50|60|70", false));
772+
}
773+
else if (defaultname == "Winds") {
774+
//for the Wings
775+
m_sql.SetDeviceOptions(atoi(Idx.c_str()), m_sql.BuildDeviceOptions("SelectorStyle:0;LevelNames:Off|Stopped|Vert|Horiz|Both;LevelOffHidden:true", false));
782776
}
783777
}
784-
785778
}
786779
}
787780

0 commit comments

Comments
 (0)