mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-28 05:06:32 +00:00
remove some #ifdef stuff
This commit is contained in:
parent
9bba95a7cc
commit
51f6b211cb
@ -16,7 +16,7 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#define USE_COLORPICKER
|
|
||||||
#ifdef USE_WEBSERVER
|
#ifdef USE_WEBSERVER
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
* Web server and WiFi Manager
|
* Web server and WiFi Manager
|
||||||
@ -161,13 +161,11 @@ const char HTTP_SCRIPT_ROOT[] PROGMEM =
|
|||||||
"}"
|
"}"
|
||||||
"function lc(v,i,p){"
|
"function lc(v,i,p){"
|
||||||
"la('&'+v+i+'='+p);"
|
"la('&'+v+i+'='+p);"
|
||||||
"}"
|
"}"
|
||||||
#ifdef USE_COLORPICKER
|
"function ld(v,p){"
|
||||||
"function ld(v,p){" //
|
|
||||||
"eb('s').style.backgroundImage='linear-gradient(to right,grey,hsl('+p+',100%%,50%%))';"
|
"eb('s').style.backgroundImage='linear-gradient(to right,grey,hsl('+p+',100%%,50%%))';"
|
||||||
"la('&'+v+'='+p);"
|
"la('&'+v+'='+p);"
|
||||||
"}"
|
"}"
|
||||||
#endif //USE_COLORPICKER
|
|
||||||
#endif // USE_JAVASCRIPT_ES6
|
#endif // USE_JAVASCRIPT_ES6
|
||||||
|
|
||||||
"wl(la);";
|
"wl(la);";
|
||||||
@ -384,12 +382,10 @@ const char HTTP_MSG_SLIDER1[] PROGMEM =
|
|||||||
const char HTTP_MSG_SLIDER2[] PROGMEM =
|
const char HTTP_MSG_SLIDER2[] PROGMEM =
|
||||||
"<div><span class='p'>%s</span><span class='q'>%s</span></div>"
|
"<div><span class='p'>%s</span><span class='q'>%s</span></div>"
|
||||||
"<div><input type='range' min='%d' max='%d' value='%d' onchange='lc(\"%c\", %d, value)'></div>";
|
"<div><input type='range' min='%d' max='%d' value='%d' onchange='lc(\"%c\", %d, value)'></div>";
|
||||||
#ifdef USE_COLORPICKER
|
|
||||||
const char HTTP_MSG_SLIDER3[] PROGMEM = // HUE
|
const char HTTP_MSG_SLIDER3[] PROGMEM = // HUE
|
||||||
"<br><div style='background-image:linear-gradient(to right, %s'><input type='range' min='%d' max='%d' value='%d' onchange='ld(\"%c\", value)'></div><br>";
|
"<br><div style='background-image:linear-gradient(to right, %s'><input type='range' min='%d' max='%d' value='%d' onchange='ld(\"%c\", value)'></div><br>";
|
||||||
const char HTTP_MSG_SLIDER4[] PROGMEM = // SATURATION
|
const char HTTP_MSG_SLIDER4[] PROGMEM = // SATURATION
|
||||||
"<br><div id='s' style='background-image:linear-gradient(to right, %s'><input type='range' min='%d' max='%d' value='%d' onchange='lb(\"%c\", value)'></div><br>";
|
"<br><div id='s' style='background-image:linear-gradient(to right, %s'><input type='range' min='%d' max='%d' value='%d' onchange='lb(\"%c\", value)'></div><br>";
|
||||||
#endif // USE_COLORPICKER
|
|
||||||
const char HTTP_MSG_RSTRT[] PROGMEM =
|
const char HTTP_MSG_RSTRT[] PROGMEM =
|
||||||
"<br><div style='text-align:center;'>" D_DEVICE_WILL_RESTART "</div><br>";
|
"<br><div style='text-align:center;'>" D_DEVICE_WILL_RESTART "</div><br>";
|
||||||
|
|
||||||
@ -1026,8 +1022,7 @@ void HandleRoot(void)
|
|||||||
changeUIntScale(Settings.light_color[i], 0, 255, 0, 100), 'd', i+1);
|
changeUIntScale(Settings.light_color[i], 0, 255, 0, 100), 'd', i+1);
|
||||||
}
|
}
|
||||||
} // Settings.flag3.pwm_multi_channels
|
} // Settings.flag3.pwm_multi_channels
|
||||||
#ifdef USE_COLORPICKER
|
if (light_type > 3) {
|
||||||
if (light_type > 3) { // TODO: check if this is the right way
|
|
||||||
char hexColor[65];
|
char hexColor[65];
|
||||||
snprintf_P(hexColor, sizeof(hexColor), PSTR("grey,#%02X%02X%02X );border-radius:0.3em;"), Settings.light_color[0],Settings.light_color[1],Settings.light_color[2]);
|
snprintf_P(hexColor, sizeof(hexColor), PSTR("grey,#%02X%02X%02X );border-radius:0.3em;"), Settings.light_color[0],Settings.light_color[1],Settings.light_color[2]);
|
||||||
uint16_t hue;
|
uint16_t hue;
|
||||||
@ -1038,7 +1033,6 @@ void HandleRoot(void)
|
|||||||
WSContentSend_P(HTTP_MSG_SLIDER3, F("red,orange,yellow,green,blue,indigo,violet,red);border-radius:0.3em;"), 1, 359, hue, 'u'); // hue
|
WSContentSend_P(HTTP_MSG_SLIDER3, F("red,orange,yellow,green,blue,indigo,violet,red);border-radius:0.3em;"), 1, 359, hue, 'u'); // hue
|
||||||
WSContentSend_P(HTTP_MSG_SLIDER4, hexColor, 1, 100, changeUIntScale(sat, 0, 255, 0, 100), 'n'); // saturation
|
WSContentSend_P(HTTP_MSG_SLIDER4, hexColor, 1, 100, changeUIntScale(sat, 0, 255, 0, 100), 'n'); // saturation
|
||||||
}
|
}
|
||||||
#endif // USE_COLORPICKER
|
|
||||||
}
|
}
|
||||||
#endif // USE_LIGHT
|
#endif // USE_LIGHT
|
||||||
#ifdef USE_SHUTTER
|
#ifdef USE_SHUTTER
|
||||||
@ -1161,7 +1155,6 @@ bool HandleRootStatusRefresh(void)
|
|||||||
snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_COLORTEMPERATURE " %s"), tmp);
|
snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_COLORTEMPERATURE " %s"), tmp);
|
||||||
ExecuteWebCommand(svalue, SRC_WEBGUI);
|
ExecuteWebCommand(svalue, SRC_WEBGUI);
|
||||||
}
|
}
|
||||||
#ifdef USE_COLORPICKER
|
|
||||||
WebGetArg("u", tmp, sizeof(tmp)); // 0 - 359 Hue value
|
WebGetArg("u", tmp, sizeof(tmp)); // 0 - 359 Hue value
|
||||||
if (strlen(tmp)) {
|
if (strlen(tmp)) {
|
||||||
snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_HSBCOLOR "1 %s"), tmp);
|
snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_HSBCOLOR "1 %s"), tmp);
|
||||||
@ -1172,7 +1165,6 @@ bool HandleRootStatusRefresh(void)
|
|||||||
snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_HSBCOLOR "2 %s"), tmp);
|
snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_HSBCOLOR "2 %s"), tmp);
|
||||||
ExecuteWebCommand(svalue, SRC_WEBGUI);
|
ExecuteWebCommand(svalue, SRC_WEBGUI);
|
||||||
}
|
}
|
||||||
#endif //USE_COLORPICKER
|
|
||||||
#ifdef USE_SHUTTER
|
#ifdef USE_SHUTTER
|
||||||
for (uint32_t j = 1; j <= shutters_present; j++) {
|
for (uint32_t j = 1; j <= shutters_present; j++) {
|
||||||
snprintf_P(webindex, sizeof(webindex), PSTR("u%d"), j);
|
snprintf_P(webindex, sizeof(webindex), PSTR("u%d"), j);
|
||||||
|
@ -1240,11 +1240,10 @@ void LightUpdateColorMapping(void)
|
|||||||
void LightSetDimmer(uint8_t dimmer) {
|
void LightSetDimmer(uint8_t dimmer) {
|
||||||
light_controller.changeDimmer(dimmer);
|
light_controller.changeDimmer(dimmer);
|
||||||
}
|
}
|
||||||
#ifdef USE_COLORPICKER
|
|
||||||
uint32_t LightGetHSB(uint16_t *hue,uint8_t *sat, uint8_t *bri) {
|
uint32_t LightGetHSB(uint16_t *hue,uint8_t *sat, uint8_t *bri) {
|
||||||
light_state.getHSB(hue, sat, bri);
|
light_state.getHSB(hue, sat, bri);
|
||||||
}
|
}
|
||||||
#endif // USE_COLORPICKER
|
|
||||||
|
|
||||||
// If SetOption68 is set, get the brightness for a specific device
|
// If SetOption68 is set, get the brightness for a specific device
|
||||||
uint8_t LightGetBri(uint8_t device) {
|
uint8_t LightGetBri(uint8_t device) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user