Merge branch 'master' of https://github.com/Aircoookie/WLED into framerate

This commit is contained in:
fishbone-git 2019-12-23 23:08:25 +01:00
commit dcd8e9250f
4 changed files with 35 additions and 14 deletions

View File

@ -465,16 +465,34 @@ uint16_t WS2812FX::mode_saw(void) {
* Inspired by www.tweaking4all.com/hardware/arduino/adruino-led-strip-effects/
*/
uint16_t WS2812FX::mode_twinkle(void) {
if(SEGENV.step == 0) {
fill(SEGCOLOR(1));
SEGENV.step = map(SEGMENT.intensity, 0, 255, 1, SEGLEN); // make sure, at least one LED is on
uint32_t cycleTime = 20 + (255 - SEGMENT.speed)*5;
uint32_t it = now / cycleTime;
if (it != SEGENV.step)
{
uint16_t maxOn = map(SEGMENT.intensity, 0, 255, 1, SEGLEN); // make sure at least one LED is on
if (SEGENV.aux0 >= maxOn)
{
SEGENV.aux0 = 0;
SEGENV.aux1 = random16(); //new seed for our PRNG
}
SEGENV.aux0++;
SEGENV.step = it;
}
uint16_t i = SEGMENT.start + random16(SEGLEN);
setPixelColor(i, color_from_palette(i, true, PALETTE_SOLID_WRAP, 0));
uint16_t PRNG16 = SEGENV.aux1;
SEGENV.step--;
return 20 + (5 * (uint16_t)(255 - SEGMENT.speed));
for (uint16_t i = 0; i < SEGENV.aux0; i++)
{
PRNG16 = (uint16_t)(PRNG16 * 2053) + 13849; // next 'random' number
uint32_t p = (uint32_t)SEGLEN * (uint32_t)PRNG16;
uint16_t mapped = p >> 16;
uint16_t j = SEGMENT.start + mapped;
setPixelColor(j, color_from_palette(j, true, PALETTE_SOLID_WRAP, 0));
}
return FRAMETIME;
}
@ -596,6 +614,7 @@ uint16_t WS2812FX::mode_multi_strobe(void) {
for(uint16_t i=SEGMENT.start; i < SEGMENT.stop; i++) {
setPixelColor(i, color_from_palette(i, true, PALETTE_SOLID_WRAP, 1));
}
//blink(SEGCOLOR(0), SEGCOLOR(1), true, true);
uint16_t delay = 50 + 20*(uint16_t)(255-SEGMENT.speed);
uint16_t count = 2 * ((SEGMENT.speed / 10) + 1);
@ -1546,13 +1565,13 @@ uint16_t WS2812FX::mode_juggle(void){
CRGB fastled_col;
byte dothue = 0;
for ( byte i = 0; i < 8; i++) {
uint16_t index = SEGMENT.start + beatsin16(i + 7, 0, SEGLEN -1);
uint16_t index = SEGMENT.start + beatsin88((128 + SEGMENT.speed)*(i + 7), 0, SEGLEN -1);
fastled_col = col_to_crgb(getPixelColor(index));
fastled_col |= (SEGMENT.palette==0)?CHSV(dothue, 220, 255):ColorFromPalette(currentPalette, dothue, 255);
setPixelColor(index, fastled_col.red, fastled_col.green, fastled_col.blue);
dothue += 32;
}
return 10 + (uint16_t)(255 - SEGMENT.speed)/4;
return FRAMETIME;
}
@ -1803,8 +1822,7 @@ uint16_t WS2812FX::mode_noise16_3()
uint16_t WS2812FX::mode_noise16_4()
{
CRGB fastled_col;
SEGENV.step += SEGMENT.speed;
uint32_t stp = (now / 160) * SEGMENT.speed;
uint32_t stp = (now * SEGMENT.speed) >> 7;
for (uint16_t i = SEGMENT.start; i < SEGMENT.stop; i++) {
int16_t index = inoise16(uint32_t(i - SEGMENT.start) << 12, stp);
fastled_col = ColorFromPalette(currentPalette, index);

View File

@ -281,6 +281,7 @@ Time zone:
<option value="12">NZST/NZDT</option>
<option value="13">North Korea</option>
<option value="14">IST (India)</option>
<option value="15">CA-Saskatchewan</option>
</select><br>
UTC offset: <input name="UO" type="number" min="-65500" max="65500" required> seconds (max. 18 hours)<br>
Current local time is <span class="times">unknown</span>.

View File

@ -98,7 +98,7 @@
//version code in format yymmddb (b = daily build)
#define VERSION 1912221
#define VERSION 1912231
char versionString[] = "0.9.0-b2";

View File

@ -25,6 +25,8 @@ TimeChangeRule CDT = {Second, Sun, Mar, 2, -300 }; //Daylight time = UTC - 5
TimeChangeRule CST = {First, Sun, Nov, 2, -360 }; //Standard time = UTC - 6 hours
Timezone tzUSCentral(CDT, CST);
Timezone tzCASaskatchewan(CST, CST); //Central without DST
TimeChangeRule MDT = {Second, Sun, Mar, 2, -360 }; //Daylight time = UTC - 6 hours
TimeChangeRule MST = {First, Sun, Nov, 2, -420 }; //Standard time = UTC - 7 hours
Timezone tzUSMountain(MDT, MST);
@ -55,7 +57,7 @@ Timezone tzNK(NKST, NKST);
TimeChangeRule IST = {Last, Sun, Mar, 1, 330}; // India Standard Time = UTC + 5.5 hours
Timezone tzIndia(IST, IST);
Timezone* timezones[] = {&tzUTC, &tzUK, &tzEUCentral, &tzEUEastern, &tzUSEastern, &tzUSCentral, &tzUSMountain, &tzUSArizona, &tzUSPacific, &tzChina, &tzJapan, &tzAUEastern, &tzNZ, &tzNK, &tzIndia};
Timezone* timezones[] = {&tzUTC, &tzUK, &tzEUCentral, &tzEUEastern, &tzUSEastern, &tzUSCentral, &tzUSMountain, &tzUSArizona, &tzUSPacific, &tzChina, &tzJapan, &tzAUEastern, &tzNZ, &tzNK, &tzIndia, &tzCASaskatchewan};
void handleNetworkTime()
{