Browse Source

Add option to specify the light transition time in web UI (#739)

rfm69
Xose Pérez 6 years ago
parent
commit
8a9e72e4be
5 changed files with 2517 additions and 2503 deletions
  1. +1
    -1
      code/espurna/config/general.h
  2. BIN
      code/espurna/data/index.html.gz
  3. +4
    -1
      code/espurna/light.ino
  4. +2503
    -2500
      code/espurna/static/index.html.gz.h
  5. +9
    -1
      code/html/index.html

+ 1
- 1
code/espurna/config/general.h View File

@ -726,7 +726,7 @@ PROGMEM const char* const custom_reset_string[] = {
#define LIGHT_USE_TRANSITIONS 1 // Transitions between colors
#define LIGHT_TRANSITION_STEP 10 // Time in millis between each transtion step
#define LIGHT_TRANSITION_STEPS 50 // Number of steps to acomplish transition
#define LIGHT_TRANSITION_TIME 500 // Time in millis from color to color
// -----------------------------------------------------------------------------
// DOMOTICZ


BIN
code/espurna/data/index.html.gz View File


+ 4
- 1
code/espurna/light.ino View File

@ -36,6 +36,7 @@ std::vector<channel_t> _light_channel;
bool _light_state = false;
bool _light_use_transitions = false;
unsigned int _light_transition_time = LIGHT_TRANSITION_TIME;
bool _light_has_color = false;
bool _light_use_white = false;
bool _light_use_gamma = false;
@ -624,7 +625,7 @@ unsigned char lightWhiteChannels() {
void lightUpdate(bool save, bool forward, bool group_forward) {
// Configure color transition
_light_steps_left = _light_use_transitions ? LIGHT_TRANSITION_STEPS : 1;
_light_steps_left = _light_use_transitions ? _light_transition_time / LIGHT_TRANSITION_STEP : 1;
_light_transition_ticker.attach_ms(LIGHT_TRANSITION_STEP, _lightProviderUpdate);
// Report channels to local broker
@ -745,6 +746,7 @@ void _lightWebSocketOnSend(JsonObject& root) {
root["useWhite"] = _light_use_white;
root["useGamma"] = _light_use_gamma;
root["useTransitions"] = _light_use_transitions;
root["lightTime"] = _light_transition_time;
root["useCSS"] = getSetting("useCSS", LIGHT_USE_CSS).toInt() == 1;
bool useRGB = getSetting("useRGB", LIGHT_USE_RGB).toInt() == 1;
root["useRGB"] = useRGB;
@ -987,6 +989,7 @@ void _lightConfigure() {
_light_use_gamma = getSetting("useGamma", LIGHT_USE_GAMMA).toInt() == 1;
_light_use_transitions = getSetting("useTransitions", LIGHT_USE_TRANSITIONS).toInt() == 1;
_light_transition_time = getSetting("lightTime", LIGHT_TRANSITION_TIME).toInt();
}


+ 2503
- 2500
code/espurna/static/index.html.gz.h
File diff suppressed because it is too large
View File


+ 9
- 1
code/html/index.html View File

@ -435,9 +435,17 @@
<div class="pure-u-1 pure-u-lg-3-4 hint">If enabled color changes will be smoothed.</div>
</div>
<div class="pure-g">
<label class="pure-u-1 pure-u-lg-1-4">Transition time</label>
<div class="pure-u-1 pure-u-lg-1-4"><input class="pure-u-1" type="number" name="lightTime" min="10" max="5000" tabindex="13" /></div>
<div class="pure-u-0 pure-u-lg-1-2"></div>
<div class="pure-u-0 pure-u-lg-1-4"></div>
<div class="pure-u-1 pure-u-lg-3-4 hint">Time in millisecons to transition from one color to another.</div>
</div>
<div class="pure-g">
<div class="pure-u-1 pure-u-lg-1-4"><label>MQTT group</label></div>
<div class="pure-u-1 pure-u-lg-3-4"><input name="mqttGroupColor" class="pure-u-1" tabindex="13" action="reconnect" /></div>
<div class="pure-u-1 pure-u-lg-3-4"><input name="mqttGroupColor" class="pure-u-1" tabindex="14" action="reconnect" /></div>
<div class="pure-u-0 pure-u-lg-1-4"></div>
<div class="pure-u-1 pure-u-lg-3-4 hint">Sync color between different lights.</div>
</div>


Loading…
Cancel
Save