Skip to content

Commit

Permalink
Add option to specify the light transition time in web UI (#739)
Browse files Browse the repository at this point in the history
  • Loading branch information
xoseperez committed Apr 3, 2018
1 parent 2b445ec commit 8a9e72e
Show file tree
Hide file tree
Showing 5 changed files with 2,517 additions and 2,503 deletions.
2 changes: 1 addition & 1 deletion code/espurna/config/general.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file modified code/espurna/data/index.html.gz
Binary file not shown.
5 changes: 4 additions & 1 deletion code/espurna/light.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();

}

Expand Down
Loading

0 comments on commit 8a9e72e

Please sign in to comment.