mirror of https://github.com/arendst/Tasmota.git
Add more web page sliders
Add web page sliders when ``SetOption37 128`` is active allowing control of white(s)
This commit is contained in:
parent
aa170fefd4
commit
a6e95211cc
|
@ -78,3 +78,4 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
|
||||||
- Add experimental support for NRF24L01 as BLE-bridge for Mijia Bluetooth sensors by Christian Baars (#7394)
|
- Add experimental support for NRF24L01 as BLE-bridge for Mijia Bluetooth sensors by Christian Baars (#7394)
|
||||||
- Add support to BMP driver to enter reset state (sleep enable) when deep sleep is used in Tasmota
|
- Add support to BMP driver to enter reset state (sleep enable) when deep sleep is used in Tasmota
|
||||||
- Add support for gzipped binaries
|
- Add support for gzipped binaries
|
||||||
|
- Add web page sliders when ``SetOption37 128`` is active allowing control of white(s)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
### 8.1.0.4 20200116
|
### 8.1.0.4 20200116
|
||||||
|
|
||||||
- Bump version
|
- Add web page sliders when ``SetOption37 128`` is active allowing control of white(s)
|
||||||
|
|
||||||
### 8.1.0.3 20200106
|
### 8.1.0.3 20200106
|
||||||
|
|
||||||
|
|
|
@ -984,6 +984,17 @@ void HandleWifiLogin(void)
|
||||||
WSContentStop();
|
WSContentStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebSliderColdWarm(void)
|
||||||
|
{
|
||||||
|
WSContentSend_P(HTTP_MSG_SLIDER_GRADIENT, // Cold Warm
|
||||||
|
"a", // a - Unique HTML id
|
||||||
|
"#fff", "#ff0", // White to Yellow
|
||||||
|
1, // sl1
|
||||||
|
153, 500, // Range color temperature
|
||||||
|
LightGetColorTemp(),
|
||||||
|
't', 0); // t0 - Value id releated to lc("t0", value) and WebGetArg("t0", tmp, sizeof(tmp));
|
||||||
|
}
|
||||||
|
|
||||||
void HandleRoot(void)
|
void HandleRoot(void)
|
||||||
{
|
{
|
||||||
if (CaptivePortal()) { return; } // If captive portal redirect instead of displaying the page.
|
if (CaptivePortal()) { return; } // If captive portal redirect instead of displaying the page.
|
||||||
|
@ -1033,17 +1044,13 @@ void HandleRoot(void)
|
||||||
if (light_type) {
|
if (light_type) {
|
||||||
uint8_t light_subtype = light_type &7;
|
uint8_t light_subtype = light_type &7;
|
||||||
if (!Settings.flag3.pwm_multi_channels) { // SetOption68 0 - Enable multi-channels PWM instead of Color PWM
|
if (!Settings.flag3.pwm_multi_channels) { // SetOption68 0 - Enable multi-channels PWM instead of Color PWM
|
||||||
if ((LST_COLDWARM == light_subtype) || (LST_RGBCW == light_subtype)) {
|
bool split_white = ((LST_RGBW <= light_subtype) && (devices_present > 1)); // Only on RGBW or RGBCW and SetOption37 128
|
||||||
|
|
||||||
WSContentSend_P(HTTP_MSG_SLIDER_GRADIENT, // Cold Warm
|
if ((LST_COLDWARM == light_subtype) || ((LST_RGBCW == light_subtype) && !split_white)) {
|
||||||
"a", // a - Unique HTML id
|
WebSliderColdWarm();
|
||||||
"#fff", "#ff0", // White to Yellow
|
|
||||||
1, // sl1
|
|
||||||
153, 500, // Range color temperature
|
|
||||||
LightGetColorTemp(),
|
|
||||||
't', 0); // t0 - Value id releated to lc("t0", value) and WebGetArg("t0", tmp, sizeof(tmp));
|
|
||||||
}
|
}
|
||||||
if (light_subtype > 2) {
|
|
||||||
|
if (light_subtype > 2) { // No W or CW
|
||||||
uint16_t hue;
|
uint16_t hue;
|
||||||
uint8_t sat;
|
uint8_t sat;
|
||||||
LightGetHSB(&hue, &sat, nullptr);
|
LightGetHSB(&hue, &sat, nullptr);
|
||||||
|
@ -1079,6 +1086,19 @@ void HandleRoot(void)
|
||||||
Settings.flag3.slider_dimmer_stay_on, 100, // Range 0/1 to 100%
|
Settings.flag3.slider_dimmer_stay_on, 100, // Range 0/1 to 100%
|
||||||
Settings.light_dimmer,
|
Settings.light_dimmer,
|
||||||
'd', 0); // d0 - Value id is related to lc("d0", value) and WebGetArg("d0", tmp, sizeof(tmp));
|
'd', 0); // d0 - Value id is related to lc("d0", value) and WebGetArg("d0", tmp, sizeof(tmp));
|
||||||
|
|
||||||
|
if (split_white) { // SetOption37 128
|
||||||
|
if (LST_RGBCW == light_subtype) {
|
||||||
|
WebSliderColdWarm();
|
||||||
|
}
|
||||||
|
WSContentSend_P(HTTP_MSG_SLIDER_GRADIENT, // White brightness - Black to White
|
||||||
|
"f", // f - Unique HTML id
|
||||||
|
"#000", "#fff", // Black to White
|
||||||
|
5, // sl5 - Unique range HTML id - Not used
|
||||||
|
Settings.flag3.slider_dimmer_stay_on, 100, // Range 0/1 to 100%
|
||||||
|
LightGetDimmer(2),
|
||||||
|
'w', 0); // w0 - Value id is related to lc("w0", value) and WebGetArg("w0", tmp, sizeof(tmp));
|
||||||
|
}
|
||||||
} else { // Settings.flag3.pwm_multi_channels - SetOption68 1 - Enable multi-channels PWM instead of Color PWM
|
} else { // Settings.flag3.pwm_multi_channels - SetOption68 1 - Enable multi-channels PWM instead of Color PWM
|
||||||
uint32_t pwm_channels = light_subtype > LST_MAX ? LST_MAX : light_subtype;
|
uint32_t pwm_channels = light_subtype > LST_MAX ? LST_MAX : light_subtype;
|
||||||
stemp[0] = 'e'; stemp[1] = '0'; stemp[2] = '\0'; // d0
|
stemp[0] = 'e'; stemp[1] = '0'; stemp[2] = '\0'; // d0
|
||||||
|
@ -1229,6 +1249,11 @@ bool HandleRootStatusRefresh(void)
|
||||||
snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_DIMMER " %s"), tmp);
|
snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_DIMMER " %s"), tmp);
|
||||||
ExecuteWebCommand(svalue, SRC_WEBGUI);
|
ExecuteWebCommand(svalue, SRC_WEBGUI);
|
||||||
}
|
}
|
||||||
|
WebGetArg("w0", tmp, sizeof(tmp)); // 0 - 100 White value
|
||||||
|
if (strlen(tmp)) {
|
||||||
|
snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_WHITE " %s"), tmp);
|
||||||
|
ExecuteWebCommand(svalue, SRC_WEBGUI);
|
||||||
|
}
|
||||||
uint32_t pwm_channels = (light_type & 7) > LST_MAX ? LST_MAX : (light_type & 7);
|
uint32_t pwm_channels = (light_type & 7) > LST_MAX ? LST_MAX : (light_type & 7);
|
||||||
for (uint32_t j = 1; j <= pwm_channels; j++) {
|
for (uint32_t j = 1; j <= pwm_channels; j++) {
|
||||||
snprintf_P(webindex, sizeof(webindex), PSTR("e%d"), j);
|
snprintf_P(webindex, sizeof(webindex), PSTR("e%d"), j);
|
||||||
|
|
|
@ -1336,11 +1336,15 @@ void LightUpdateColorMapping(void)
|
||||||
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("%d colors: %d %d %d %d %d") ,Settings.param[P_RGB_REMAP], Light.color_remap[0],Light.color_remap[1],Light.color_remap[2],Light.color_remap[3],Light.color_remap[4]);
|
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("%d colors: %d %d %d %d %d") ,Settings.param[P_RGB_REMAP], Light.color_remap[0],Light.color_remap[1],Light.color_remap[2],Light.color_remap[3],Light.color_remap[4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t LightGetDimmer(uint8_t dimmer) {
|
||||||
|
return light_state.getDimmer(dimmer);
|
||||||
|
}
|
||||||
|
|
||||||
void LightSetDimmer(uint8_t dimmer) {
|
void LightSetDimmer(uint8_t dimmer) {
|
||||||
light_controller.changeDimmer(dimmer);
|
light_controller.changeDimmer(dimmer);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t LightGetHSB(uint16_t *hue,uint8_t *sat, uint8_t *bri) {
|
void LightGetHSB(uint16_t *hue, uint8_t *sat, uint8_t *bri) {
|
||||||
light_state.getHSB(hue, sat, bri);
|
light_state.getHSB(hue, sat, bri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue