Re-add accidentally reverted Frametime fixes

This commit is contained in:
cschwinne 2020-01-06 01:06:02 +01:00
parent ef4ec16860
commit 318ffc821c
2 changed files with 23 additions and 8 deletions

View File

@ -962,6 +962,10 @@ uint16_t WS2812FX::mode_halloween(void) {
* Random colored pixels running.
*/
uint16_t WS2812FX::mode_running_random(void) {
uint32_t cycleTime = 25 + (3 * (uint32_t)(255 - SEGMENT.speed));
uint32_t it = now / cycleTime;
if (SEGENV.aux1 == it) return FRAMETIME;
for(uint16_t i=SEGLEN-1; i > 0; i--) {
setPixelColor(SEGMENT.start + i, getPixelColor(SEGMENT.start + i - 1));
}
@ -976,7 +980,9 @@ uint16_t WS2812FX::mode_running_random(void) {
{
SEGENV.step = 0;
}
return SPEED_FORMULA_L;
SEGENV.aux1 = it;
return FRAMETIME;
}
@ -1092,6 +1098,10 @@ uint16_t WS2812FX::mode_rain()
* Fire flicker function
*/
uint16_t WS2812FX::mode_fire_flicker(void) {
uint32_t cycleTime = 40 + (255 - SEGMENT.speed);
uint32_t it = now / cycleTime;
if (SEGENV.step == it) return FRAMETIME;
byte w = (SEGCOLOR(0) >> 24) & 0xFF;
byte r = (SEGCOLOR(0) >> 16) & 0xFF;
byte g = (SEGCOLOR(0) >> 8) & 0xFF;
@ -1106,7 +1116,9 @@ uint16_t WS2812FX::mode_fire_flicker(void) {
setPixelColor(i, color_from_palette(i, true, PALETTE_SOLID_WRAP, 0, 255 - flicker));
}
}
return 20 + random((255 - SEGMENT.speed),(2 * (uint16_t)(255 - SEGMENT.speed)));
SEGENV.step = it;
return FRAMETIME;
}
@ -1370,10 +1382,7 @@ uint16_t WS2812FX::mode_tricolor_fade(void)
setPixelColor(i, color);
}
SEGENV.step += 4;
if(SEGENV.step >= 768) SEGENV.step = 0;
return 5 + ((uint32_t)(255 - SEGMENT.speed) / 10);
return FRAMETIME;
}
@ -1383,6 +1392,10 @@ uint16_t WS2812FX::mode_tricolor_fade(void)
*/
uint16_t WS2812FX::mode_multi_comet(void)
{
uint32_t cycleTime = 20 + (2 * (uint32_t)(255 - SEGMENT.speed));
uint32_t it = now / cycleTime;
if (SEGENV.step == it) return FRAMETIME;
fade_out(SEGMENT.intensity);
static uint16_t comets[] = {UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX};
@ -1404,7 +1417,9 @@ uint16_t WS2812FX::mode_multi_comet(void)
}
}
}
return SPEED_FORMULA_L;
SEGENV.step = it;
return FRAMETIME;
}

View File

@ -259,7 +259,7 @@ void serializeInfo(JsonObject root)
wifi_info["bssid"] = WiFi.BSSIDstr();
int qrssi = WiFi.RSSI();
wifi_info["rssi"] = qrssi;
wifi_info["signal"] = getSignalQuality(WiFi.RSSI());
wifi_info["signal"] = getSignalQuality(qrssi);
wifi_info["channel"] = WiFi.channel();
#ifdef ARDUINO_ARCH_ESP32