Pacifica better speed

This commit is contained in:
cschwinne 2020-08-25 17:23:17 +02:00
parent 33cd52cddd
commit ac9a567e1f
6 changed files with 27 additions and 5 deletions

View File

@ -2,6 +2,13 @@
### Development versions after 0.10.0 release ### Development versions after 0.10.0 release
#### Build 2008250
- Made `platformio_override.ini` example easier to use by including the `default_envs` property
- FastLED uses `now` as timer, so effects using e.g. `beatsin88()` will sync correctly
- Extended the speed range of Pacifica effect
- Fixed exception on empty MQTT payload (#1101)
#### Build 2008200 #### Build 2008200
- Added segment mirroring to web UI - Added segment mirroring to web UI

View File

@ -4,6 +4,9 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Please visit documentation: https://docs.platformio.org/page/projectconf.html # Please visit documentation: https://docs.platformio.org/page/projectconf.html
[platformio]
default_envs = esp8266_1m_custom
[env:esp8266_1m_custom] [env:esp8266_1m_custom]
board = esp01_1m board = esp01_1m
platform = ${common.arduino_core_2_4_2} platform = ${common.arduino_core_2_4_2}

View File

@ -3240,6 +3240,8 @@ uint16_t WS2812FX::mode_heartbeat(void) {
// //
uint16_t WS2812FX::mode_pacifica() uint16_t WS2812FX::mode_pacifica()
{ {
uint32_t nowOld = now;
CRGBPalette16 pacifica_palette_1 = CRGBPalette16 pacifica_palette_1 =
{ 0x000507, 0x000409, 0x00030B, 0x00030D, 0x000210, 0x000212, 0x000114, 0x000117, { 0x000507, 0x000409, 0x00030B, 0x00030D, 0x000210, 0x000212, 0x000114, 0x000117,
0x000019, 0x00001C, 0x000026, 0x000031, 0x00003B, 0x000046, 0x14554B, 0x28AA50 }; 0x000019, 0x00001C, 0x000026, 0x000031, 0x00003B, 0x000046, 0x14554B, 0x28AA50 };
@ -3260,7 +3262,10 @@ uint16_t WS2812FX::mode_pacifica()
// Each is incremented at a different speed, and the speeds vary over time. // Each is incremented at a different speed, and the speeds vary over time.
uint16_t sCIStart1 = SEGENV.aux0, sCIStart2 = SEGENV.aux1, sCIStart3 = SEGENV.step, sCIStart4 = SEGENV.step >> 16; uint16_t sCIStart1 = SEGENV.aux0, sCIStart2 = SEGENV.aux1, sCIStart3 = SEGENV.step, sCIStart4 = SEGENV.step >> 16;
//static uint16_t sCIStart1, sCIStart2, sCIStart3, sCIStart4; //static uint16_t sCIStart1, sCIStart2, sCIStart3, sCIStart4;
uint32_t deltams = 26 + (SEGMENT.speed >> 3); //uint32_t deltams = 26 + (SEGMENT.speed >> 3);
uint32_t deltams = (FRAMETIME >> 2) + ((FRAMETIME * SEGMENT.speed) >> 7);
uint64_t deltat = (now >> 2) + ((now * SEGMENT.speed) >> 7);
now = deltat;
uint16_t speedfactor1 = beatsin16(3, 179, 269); uint16_t speedfactor1 = beatsin16(3, 179, 269);
uint16_t speedfactor2 = beatsin16(4, 179, 269); uint16_t speedfactor2 = beatsin16(4, 179, 269);
@ -3306,6 +3311,7 @@ uint16_t WS2812FX::mode_pacifica()
setPixelColor(i, c.red, c.green, c.blue); setPixelColor(i, c.red, c.green, c.blue);
} }
now = nowOld;
return FRAMETIME; return FRAMETIME;
} }

View File

@ -31,6 +31,7 @@
#include "const.h" #include "const.h"
#define FASTLED_INTERNAL //remove annoying pragma messages #define FASTLED_INTERNAL //remove annoying pragma messages
#define USE_GET_MILLISECOND_TIMER
#include "FastLED.h" #include "FastLED.h"
#define DEFAULT_BRIGHTNESS (uint8_t)127 #define DEFAULT_BRIGHTNESS (uint8_t)127
@ -481,6 +482,7 @@ class WS2812FX {
triwave16(uint16_t); triwave16(uint16_t);
uint32_t uint32_t
now,
timebase, timebase,
color_wheel(uint8_t), color_wheel(uint8_t),
color_from_palette(uint16_t, bool mapping, bool wrap, uint8_t mcol, uint8_t pbri = 255), color_from_palette(uint16_t, bool mapping, bool wrap, uint8_t mcol, uint8_t pbri = 255),
@ -623,7 +625,6 @@ class WS2812FX {
CRGBPalette16 currentPalette; CRGBPalette16 currentPalette;
CRGBPalette16 targetPalette; CRGBPalette16 targetPalette;
uint32_t now;
uint16_t _length, _lengthRaw, _virtualSegmentLength; uint16_t _length, _lengthRaw, _virtualSegmentLength;
uint16_t _rand16seed; uint16_t _rand16seed;
uint8_t _brightness; uint8_t _brightness;
@ -687,7 +688,6 @@ class WS2812FX {
uint16_t realPixelIndex(uint16_t i); uint16_t realPixelIndex(uint16_t i);
}; };
//10 names per line //10 names per line
const char JSON_mode_names[] PROGMEM = R"=====([ const char JSON_mode_names[] PROGMEM = R"=====([
"Solid","Blink","Breathe","Wipe","Wipe Random","Random Colors","Sweep","Dynamic","Colorloop","Rainbow", "Solid","Blink","Breathe","Wipe","Wipe Random","Random Colors","Sweep","Dynamic","Colorloop","Rainbow",

View File

@ -299,3 +299,9 @@ void handleNightlight()
presetCycledTime = millis(); presetCycledTime = millis();
} }
} }
//utility for FastLED to use our custom timer
uint32_t get_millisecond_timer()
{
return strip.now;
}

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2008200 #define VERSION 2008250
// ESP8266-01 (blue) got too little storage space to work with all features of WLED. To use it, you must use ESP8266 Arduino Core v2.4.2 and the setting 512K(No SPIFFS). // ESP8266-01 (blue) got too little storage space to work with all features of WLED. To use it, you must use ESP8266 Arduino Core v2.4.2 and the setting 512K(No SPIFFS).