hide settings for disabled features

This is a temporary solution, similar to SRWLED 0.13.3.

It could be replaced once my PR to upstream gets accepted: https://github.com/Aircoookie/WLED/pull/2865
This commit is contained in:
Frank
2022-11-07 16:12:28 +01:00
parent 342e0058dc
commit 543a99bb24
2 changed files with 44 additions and 0 deletions

View File

@@ -11,6 +11,16 @@
{
return d.getElementById(s);
}
function hideALEXA(){gId("aleOnOff").style.display="none";}
function hideNoALEXA(){gId("aleOnOff2").style.display="none";}
function hideBLYNK(){gId("blyOnOff").style.display="none";}
function hideNoBLYNK(){gId("blyOnOff2").style.display="none";}
function hideMQTT(){gId("mqtOnOff").style.display="none";}
function hideNoMQTT(){gId("mqtOnOff2").style.display="none";}
function hideHUE(){gId("hueOnOff").style.display="none";}
function hideNoHUE(){gId("hueOnOff2").style.display="none";}
function H(){window.open("https://kno.wled.ge/interfaces/udp-notifier/");}
function B(){window.open("/settings","_self");}
function adj(){if (d.Sf.DI.value == 6454) {if (d.Sf.EU.value == 1) d.Sf.EU.value = 0;}
@@ -164,19 +174,33 @@ Force max brightness: <input type="checkbox" name="FB"><br>
Disable realtime gamma correction: <input type="checkbox" name="RG"><br>
Realtime LED offset: <input name="WO" type="number" min="-255" max="255" required>
<h3>Alexa Voice Assistant</h3>
<div id="aleOnOff2">
<em style="color:darkorange">This firmware build does not include Alexa support. <br></em>
</div>
<div id="aleOnOff">
Emulate Alexa device: <input type="checkbox" name="AL"><br>
Alexa invocation name: <input type="text" name="AI" maxlength="32"><br>
Also emulate devices to call the first <input name="AP" type="number" class="s" min="0" max="9" required> presets
</div>
<h3>Blynk</h3>
<div id="blyOnOff2">
<em style="color:darkorange">This firmware build does not include Blynk support. <br></em>
</div>
<b>Blynk, MQTT and Hue sync all connect to external hosts!<br>
This may impact the responsiveness of the ESP8266.</b><br>
For best results, only use one of these services at a time.<br>
(alternatively, connect a second ESP to them and use the UDP sync)<br><br>
<div id="blyOnOff">
Host: <input type="text" name="BH" maxlength="32">
Port: <input name="BP" type="number" min="1" max="65535" value="80" class="d5"><br>
Device Auth token: <input name="BK" maxlength="33"><br>
<i>Clear the token field to disable. </i><a href="https://kno.wled.ge/interfaces/blynk/" target="_blank">Setup info</a>
</div>
<h3>MQTT</h3>
<div id="mqtOnOff2">
<em style="color:darkorange">This firmware build does not include MQTT support. <br></em>
</div>
<div id="mqtOnOff">
Enable MQTT: <input type="checkbox" name="MQ"><br>
Broker: <input type="text" name="MS" maxlength="32">
Port: <input name="MQPORT" type="number" min="1" max="65535" class="d5"><br>
@@ -189,7 +213,12 @@ Device Topic: <input type="text" name="MD" maxlength="32"><br>
Group Topic: <input type="text" name="MG" maxlength="32"><br>
Publish on button press: <input type="checkbox" name="BM"><br>
<i>Reboot required to apply changes. </i><a href="https://kno.wled.ge/interfaces/mqtt/" target="_blank">MQTT info</a>
</div>
<h3>Philips Hue</h3>
<div id="hueOnOff2">
<em style="color:darkorange">This firmware build does not include Philips Hue support. <br></em>
</div>
<div id="hueOnOff">
<i>You can find the bridge IP and the light number in the 'About' section of the hue app.</i><br>
Poll Hue light <input name="HL" type="number" min="1" max="99" > every <input name="HI" type="number" min="100" max="65000"> ms: <input type="checkbox" name="HP"><br>
Then, receive <input type="checkbox" name="HO"> On/Off, <input type="checkbox" name="HB"> Brightness, and <input type="checkbox" name="HC"> Color<br>
@@ -200,6 +229,7 @@ Hue Bridge IP:<br>
<input name="H3" type="number" class="s" min="0" max="255" ><br>
<b>Press the pushlink button on the bridge, after that save this page!</b><br>
(when first connecting)<br>
</div>
Hue status: <span class="sip"> Disabled in this build </span>
<h3>Serial</h3>
Baud rate:

View File

@@ -510,10 +510,18 @@ void getSettingsJS(byte subPage, char* dest)
sappends('s',SET_F("AI"),alexaInvocationName);
sappend('c',SET_F("SA"),notifyAlexa);
sappend('v',SET_F("AP"),alexaNumPresets);
#ifndef WLED_DISABLE_ALEXA
oappend(SET_F("hideNoALEXA();")); // hide "not compiled in" message
#else
oappend(SET_F("hideALEXA();")); // hide Alexa settings if not compiled in
#endif
sappends('s',SET_F("BK"),(char*)((blynkEnabled)?SET_F("Hidden"):""));
#ifndef WLED_DISABLE_BLYNK
sappends('s',SET_F("BH"),blynkHost);
sappend('v',SET_F("BP"),blynkPort);
oappend(SET_F("hideNoBLYNK();")); // hide "not compiled in" message
#else
oappend(SET_F("hideBLYNK();")); // hide BLYNK settings if not compiled in
#endif
#ifdef WLED_ENABLE_MQTT
@@ -530,6 +538,9 @@ void getSettingsJS(byte subPage, char* dest)
sappends('s',"MD",mqttDeviceTopic);
sappends('s',SET_F("MG"),mqttGroupTopic);
sappend('c',SET_F("BM"),buttonPublishMqtt);
oappend(SET_F("hideNoMQTT();")); // hide "not compiled in" message
#else
oappend(SET_F("hideMQTT();")); // hide MQTT settings if not compiled in
#endif
#ifndef WLED_DISABLE_HUESYNC
@@ -557,6 +568,9 @@ void getSettingsJS(byte subPage, char* dest)
}
sappends('m',SET_F("(\"sip\")[0]"),hueErrorString);
oappend(SET_F("hideNoHUE();")); // hide "not compiled in" message
#else
oappend(SET_F("hideHUE();")); // hide Hue Sync settings if not compiled in
#endif
sappend('v',SET_F("BD"),serialBaud);
}