mirror of https://github.com/arendst/Tasmota.git
Refactor light
This commit is contained in:
parent
39d8011c89
commit
e319f4ec40
|
@ -1612,8 +1612,8 @@ void LightPreparePower(power_t channels = 0xFFFFFFFF) { // 1 = only RGB, 2 =
|
||||||
|
|
||||||
void LightCycleColor(int8_t direction)
|
void LightCycleColor(int8_t direction)
|
||||||
{
|
{
|
||||||
|
// if (Light.strip_timer_counter % (Settings.light_speed * 2)) { return; } // Speed 1: 24sec, 2: 48sec, 3: 72sec, etc
|
||||||
if (Settings.light_speed > 3) {
|
if (Settings.light_speed > 3) {
|
||||||
// if (Light.strip_timer_counter % (Settings.light_speed * 2)) { return; }
|
|
||||||
if (Light.strip_timer_counter % (Settings.light_speed - 2)) { return; } // Speed 4: 24sec, 5: 36sec, 6: 48sec, etc
|
if (Light.strip_timer_counter % (Settings.light_speed - 2)) { return; } // Speed 4: 24sec, 5: 36sec, 6: 48sec, etc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1632,10 +1632,9 @@ void LightCycleColor(int8_t direction)
|
||||||
direction = (Light.random &0x01) ? 1 : -1;
|
direction = (Light.random &0x01) ? 1 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.light_speed < 3) { direction *= (4 - Settings.light_speed); } // Speed 1: 12/3=4sec, 2: 12/2=6sec, 3: 12sec
|
|
||||||
// if (Settings.light_speed < 3) { direction <<= (3 - Settings.light_speed); } // Speed 1: 12/4=3sec, 2: 12/2=6sec, 3: 12sec
|
// if (Settings.light_speed < 3) { direction <<= (3 - Settings.light_speed); } // Speed 1: 12/4=3sec, 2: 12/2=6sec, 3: 12sec
|
||||||
|
if (Settings.light_speed < 3) { direction *= (4 - Settings.light_speed); } // Speed 1: 12/3=4sec, 2: 12/2=6sec, 3: 12sec
|
||||||
Light.wheel += direction;
|
Light.wheel += direction;
|
||||||
|
|
||||||
uint16_t hue = changeUIntScale(Light.wheel, 0, 255, 0, 359); // Scale to hue to keep amount of steps low (max 255 instead of 359)
|
uint16_t hue = changeUIntScale(Light.wheel, 0, 255, 0, 359); // Scale to hue to keep amount of steps low (max 255 instead of 359)
|
||||||
|
|
||||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("LGT: random %d, wheel %d, hue %d"), Light.random, Light.wheel, hue);
|
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("LGT: random %d, wheel %d, hue %d"), Light.random, Light.wheel, hue);
|
||||||
|
|
Loading…
Reference in New Issue