Optimize switch param generation
This commit is contained in:
parent
02b6d374ef
commit
97c266f70f
|
@ -22,25 +22,13 @@ void tw7100Switch::write_state(bool state) {
|
||||||
param_char[0] = 0;
|
param_char[0] = 0;
|
||||||
|
|
||||||
if ((cmd_ == "PWR")||(cmd_ == "MUTE")||(cmd_ == "HREVERSE")||(cmd_ == "VREVERSE")) {
|
if ((cmd_ == "PWR")||(cmd_ == "MUTE")||(cmd_ == "HREVERSE")||(cmd_ == "VREVERSE")) {
|
||||||
param = state ? "ON" : "OFF";
|
param = state ? "ON" : "OFF"; // these commands require on/off strings
|
||||||
|
} else if ((cmd_ == "4KENHANCE")||(cmd_ == "BTAUDIO")||(cmd_ == "ILLUM")||(cmd_ == "STANDBYCONF")||(cmd_ == "AUTOHOME")||(cmd_ == "WLPWR")||(cmd_ == "LOGTO")) {
|
||||||
|
sprintf(param_char, "%02d", state); // all these are 00/01
|
||||||
} else if (cmd_ == "IMGPROC") {
|
} else if (cmd_ == "IMGPROC") {
|
||||||
sprintf(param_char, "%02d", ((uint8_t)state) + 1);
|
sprintf(param_char, "%02d", ((uint8_t)state) + 1); // only 01 and 02 are documented, "off" seems to relate to 01. Maybe 00 ("disabled") is undocumented
|
||||||
} else if (cmd_ == "AUDIOOUT") {
|
} else if (cmd_ == "AUDIOOUT") {
|
||||||
sprintf(param_char, "%02d", 10 + state);
|
sprintf(param_char, "%02d", 10 + state); // maybe the first "bit" does something else on other models. TW7100 only supports 10/11 per documentation
|
||||||
} else if (cmd_ == "4KENHANCE") {
|
|
||||||
sprintf(param_char, "%02d", state);
|
|
||||||
} else if (cmd_ == "BTAUDIO") {
|
|
||||||
sprintf(param_char, "%02d", state);
|
|
||||||
} else if (cmd_ == "ILLUM") {
|
|
||||||
sprintf(param_char, "%02d", state);
|
|
||||||
} else if (cmd_ == "STANDBYCONF") {
|
|
||||||
sprintf(param_char, "%02d", state);
|
|
||||||
} else if (cmd_ == "AUTOHOME") {
|
|
||||||
sprintf(param_char, "%02d", state);
|
|
||||||
} else if (cmd_ == "WLPWR") {
|
|
||||||
sprintf(param_char, "%02d", state);
|
|
||||||
} else if (cmd_ == "LOGTO") {
|
|
||||||
sprintf(param_char, "%02d", state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strlen(param_char) > 0) {
|
if(strlen(param_char) > 0) {
|
||||||
|
|
Loading…
Reference in a new issue