From d0d56c4416203a5bc7991fbe13858656cdbdf69f Mon Sep 17 00:00:00 2001 From: Def3nder Date: Sat, 29 Feb 2020 16:30:15 +0100 Subject: [PATCH 1/3] Travis.CI builds only for default_envs (#739) --- .travis.yml | 14 +++++++++++--- platformio.ini | 20 +++++++++++++++----- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5d976261..882fe54a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,18 +18,26 @@ # it (remove "# " before each line) or use own configuration according to the # Travis CI documentation (see above). # +# * Test the Travis config here: +# < https://config.travis-ci.com/explore > +# language: python python: - - "2.7" -sudo: false + # - "2.7" + - "3.5" +os: linux cache: + bundler: true + ccache: true directories: - "~/.platformio" + - "~/.buildcache" env: - PLATFORMIO_CI_SRC=wled00 install: - pip install -U platformio - platformio update script: - - platformio ci --project-conf=./platformio.ini + # - platformio ci --project-conf=./platformio.ini + - platformio run \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 9128d50e..ed95659e 100644 --- a/platformio.ini +++ b/platformio.ini @@ -5,11 +5,24 @@ src_dir = ./wled00 data_dir = ./wled00/data lib_dir = ./wled00/src +build_cache_dir = ~/.buildcache extra_configs = platformio_override.ini -; Please uncomment one of the 5 lines below to select your board -default_envs = nodemcuv2 +# ------------------------------------------------------------------------------ +# ENVIRONMENTS +# +# Please uncomment one of the lines below to select your board(s) +# ------------------------------------------------------------------------------ + +# Travis CI binaries +default_envs = d1_mini, esp01, esp01_1m, esp32dev + +# Release binaries follow +; default_envs = nodemcuv2, esp01, esp01_1m, esp32dev, custom_WS2801, custom_APA102, custom_LEDPIN_16, custom_LEDPIN_4 + +# Single binaries +; default_envs = nodemcuv2 ; default_envs = esp01 ; default_envs = esp01_1m ; default_envs = esp07 @@ -20,9 +33,6 @@ default_envs = nodemcuv2 ; default_envs = esp8285_4CH_H801 ; default_envs = esp8285_5CH_H801 -# Release binaries follow -; default_envs = nodemcuv2, esp01, esp01_1m, esp32dev, custom_WS2801, custom_APA102, custom_LEDPIN_16, custom_LEDPIN_4 - [common] # ------------------------------------------------------------------------------ # PLATFORM: From 14a5ab6740269a21986cf5971962fe65e85b107b Mon Sep 17 00:00:00 2001 From: cschwinne Date: Sat, 29 Feb 2020 18:24:51 +0100 Subject: [PATCH 2/3] Fixed Chase modes --- wled00/FX.cpp | 135 ++++++++++++++++++++++++---------------------- wled00/wled00.ino | 2 +- 2 files changed, 71 insertions(+), 66 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index eb043522..022b4b23 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -379,7 +379,7 @@ uint16_t WS2812FX::mode_rainbow_cycle(void) { /* * theater chase function */ -uint16_t WS2812FX::theater_chase(uint32_t color1, uint32_t color2, bool dopalette) { +uint16_t WS2812FX::theater_chase(uint32_t color1, uint32_t color2, bool do_palette) { byte gap = 2 + ((255 - SEGMENT.intensity) >> 5); uint32_t cycleTime = 50 + (255 - SEGMENT.speed)*2; uint32_t it = now / cycleTime; @@ -391,7 +391,7 @@ uint16_t WS2812FX::theater_chase(uint32_t color1, uint32_t color2, bool dopalett for(uint16_t i = 0; i < SEGLEN; i++) { if((i % gap) == SEGENV.aux0) { - if (dopalette) + if (do_palette) { setPixelColor(i, color_from_palette(i, true, PALETTE_SOLID_WRAP, 0)); } else { @@ -690,58 +690,68 @@ uint16_t WS2812FX::mode_android(void) { * color1 = background color * color2 and color3 = colors of two adjacent leds */ -uint16_t WS2812FX::chase(uint32_t color1, uint32_t color2, uint32_t color3, bool dopalette) { +uint16_t WS2812FX::chase(uint32_t color1, uint32_t color2, uint32_t color3, bool do_palette) { uint16_t counter = now * ((SEGMENT.speed >> 2) + 1); uint16_t a = counter * SEGLEN >> 16; + + bool chase_random = (SEGMENT.mode == FX_MODE_CHASE_RANDOM); + if (chase_random) { + if (a < SEGENV.step) //we hit the start again, choose new color for Chase random + { + SEGENV.aux1 = SEGENV.aux0; //store previous random color + SEGENV.aux0 = get_random_wheel_index(SEGENV.aux0); + } + color1 = color_wheel(SEGENV.aux0); + } SEGENV.step = a; - uint8_t size = 1 + (SEGMENT.intensity * SEGLEN >> 10); - if (SEGENV.call == 0) {SEGENV.aux0 = 0; SEGENV.aux1 = a;} + // Use intensity setting to vary chase up to 1/2 string length - uint16_t b = (a + size) % SEGLEN; - uint16_t c = (b + size) % SEGLEN; + uint8_t size = 1 + (SEGMENT.intensity * SEGLEN >> 10); - if (dopalette) color1 = color_from_palette(a, true, PALETTE_SOLID_WRAP, 1); + uint16_t b = a + size; //"trail" of chase, filled with color1 + if (b > SEGLEN) b -= SEGLEN; + uint16_t c = b + size; + if (c > SEGLEN) c -= SEGLEN; - setPixelColor(a, color1); - if (SEGENV.aux0 == 0) { // catch the first pixels after color change from "chase random" (because they have the "old" color) - for (uint16_t i = 0; i < a; i++) { - uint32_t color = getPixelColor(0); - setPixelColor(i, color1); + //background + if (do_palette) + { + for(uint16_t i = 0; i < SEGLEN; i++) { + setPixelColor(i, color_from_palette(i, true, PALETTE_SOLID_WRAP, 1)); } - SEGENV.aux0 = 1; - } - setPixelColor(b, color2); - setPixelColor(c, color3); + } else fill(color1); - if (a != SEGENV.aux1) { // when speed is too fast, this catches the gaps - if (a > SEGENV.aux1) { - for (uint16_t i = SEGENV.aux1; i <= a; i++) { // sometimes the step-length varies from one to the next call - therefor "<= a" and not "< a" - setPixelColor(i, color1); - uint16_t b1 = (i + size) % SEGLEN; - uint16_t c1 = (b1 + size) % SEGLEN; - setPixelColor(b1, color2); - setPixelColor(c1, color3); - } - } else { - for (uint16_t i = SEGENV.aux1; i <= SEGLEN; i++) { // from last position to the end - setPixelColor(i, color1); - uint16_t b1 = (i + size) % SEGLEN; - uint16_t c1 = (b1 + size) % SEGLEN; - setPixelColor(b1, color2); - setPixelColor(c1, color3); - } - for (uint16_t i = 0; i < a; i++) { // from 0 to the actual position - setPixelColor(i, color1); - uint16_t b1 = (i + size) % SEGLEN; - uint16_t c1 = (b1 + size) % SEGLEN; - setPixelColor(b1, color2); - setPixelColor(c1, color3); - } - SEGENV.step = 0; - SEGENV.aux0 = 0; - } + //if random, fill old background between a and end + if (chase_random) + { + color1 = color_wheel(SEGENV.aux1); + for (uint16_t i = a; i < SEGLEN; i++) + setPixelColor(i, color1); + } + + //fill between points a and b with color2 + if (a < b) + { + for (uint16_t i = a; i < b; i++) + setPixelColor(i, color2); + } else { + for (uint16_t i = a; i < SEGLEN; i++) //fill until end + setPixelColor(i, color2); + for (uint16_t i = 0; i < b; i++) //fill from start until b + setPixelColor(i, color2); + } + + //fill between points b and c with color2 + if (b < c) + { + for (uint16_t i = b; i < c; i++) + setPixelColor(i, color3); + } else { + for (uint16_t i = b; i < SEGLEN; i++) //fill until end + setPixelColor(i, color3); + for (uint16_t i = 0; i < c; i++) //fill from start until c + setPixelColor(i, color3); } - SEGENV.aux1 = ++a; return FRAMETIME; } @@ -751,7 +761,7 @@ uint16_t WS2812FX::chase(uint32_t color1, uint32_t color2, uint32_t color3, bool * Bicolor chase, more primary color. */ uint16_t WS2812FX::mode_chase_color(void) { - return chase(SEGCOLOR(1), SEGCOLOR(0), SEGCOLOR(0), true); + return chase(SEGCOLOR(1), (SEGCOLOR(2)) ? SEGCOLOR(2) : SEGCOLOR(0), SEGCOLOR(0), true); } @@ -759,12 +769,19 @@ uint16_t WS2812FX::mode_chase_color(void) { * Primary running followed by random color. */ uint16_t WS2812FX::mode_chase_random(void) { - if (!SEGENV.allocateData(2)) return mode_static(); //allocation failed - if (SEGENV.call == 0) SEGENV.data[0] = 0; - if (SEGENV.step == 0) { - SEGENV.data[0] = get_random_wheel_index(SEGENV.data[0]); - } - return chase(color_wheel(SEGENV.data[0]), SEGCOLOR(0), SEGCOLOR(0), false); + return chase(SEGCOLOR(1), (SEGCOLOR(2)) ? SEGCOLOR(2) : SEGCOLOR(0), SEGCOLOR(0), false); +} + + +/* + * Primary, secondary running on rainbow. + */ +uint16_t WS2812FX::mode_chase_rainbow(void) { + uint8_t color_sep = 256 / SEGLEN; + uint8_t color_index = SEGENV.call & 0xFF; + uint32_t color = color_wheel(((SEGENV.step * color_sep) + color_index) & 0xFF); + + return chase(color, SEGCOLOR(0), SEGCOLOR(1), false); } @@ -860,18 +877,6 @@ uint16_t WS2812FX::mode_traffic_light(void) { } -/* - * Primary, secondary running on rainbow. - */ -uint16_t WS2812FX::mode_chase_rainbow(void) { - uint8_t color_sep = 256 / SEGLEN; - uint8_t color_index = SEGENV.call & 0xFF; - uint32_t color = color_wheel(((SEGENV.step * color_sep) + color_index) & 0xFF); - - return chase(color, SEGCOLOR(0), SEGCOLOR(1), 0); -} - - /* * Sec flashes running on prim. */ @@ -3161,4 +3166,4 @@ uint16_t WS2812FX::mode_heartbeat(void) { } return FRAMETIME; -} \ No newline at end of file +} diff --git a/wled00/wled00.ino b/wled00/wled00.ino index f214929c..2ce923df 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -119,7 +119,7 @@ #endif //version code in format yymmddb (b = daily build) -#define VERSION 2002252 +#define VERSION 2002291 char versionString[] = "0.9.1"; From 18dad0c72cce118b96126bbf9f622d64f1c94ee0 Mon Sep 17 00:00:00 2001 From: cschwinne Date: Sat, 29 Feb 2020 18:42:55 +0100 Subject: [PATCH 3/3] Remove defunct presetApplyCol and presetApplyFx --- wled00/wled00.ino | 2 +- wled00/wled01_eeprom.ino | 34 +++++++++++++++------------------- wled00/wled03_set.ino | 10 ++-------- wled00/wled05_init.ino | 2 +- wled00/wled08_led.ino | 2 +- wled00/wled13_cronixie.ino | 12 ++++++------ 6 files changed, 26 insertions(+), 36 deletions(-) diff --git a/wled00/wled00.ino b/wled00/wled00.ino index 2ce923df..104592b0 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -390,7 +390,7 @@ bool presetCyclingEnabled = false; byte presetCycleMin = 1, presetCycleMax = 5; uint16_t presetCycleTime = 1250; unsigned long presetCycledTime = 0; byte presetCycCurr = presetCycleMin; -bool presetApplyBri = false, presetApplyCol = true, presetApplyFx = true; +bool presetApplyBri = true; bool saveCurrPresetCycConf = false; //realtime diff --git a/wled00/wled01_eeprom.ino b/wled00/wled01_eeprom.ino index 703785c1..b0da6451 100644 --- a/wled00/wled01_eeprom.ino +++ b/wled00/wled01_eeprom.ino @@ -232,8 +232,8 @@ void saveSettingsToEEPROM() EEPROM.write(2208, presetCycleMin); EEPROM.write(2209, presetCycleMax); EEPROM.write(2210, presetApplyBri); - EEPROM.write(2211, presetApplyCol); - EEPROM.write(2212, presetApplyFx); + // was EEPROM.write(2211, presetApplyCol); + // was EEPROM.write(2212, presetApplyFx); saveCurrPresetCycConf = false; } @@ -519,8 +519,8 @@ void loadSettingsFromEEPROM(bool first) presetCycleMin = EEPROM.read(2208); presetCycleMax = EEPROM.read(2209); presetApplyBri = EEPROM.read(2210); - presetApplyCol = EEPROM.read(2211); - presetApplyFx = EEPROM.read(2212); + //was presetApplyCol = EEPROM.read(2211); + //was presetApplyFx = EEPROM.read(2212); } bootPreset = EEPROM.read(389); @@ -583,7 +583,7 @@ void savedToPresets() } } -bool applyPreset(byte index, bool loadBri = true, bool loadCol = true, bool loadFX = true) +bool applyPreset(byte index, bool loadBri = true) { if (index == 255 || index == 0) { @@ -596,22 +596,18 @@ bool applyPreset(byte index, bool loadBri = true, bool loadCol = true, bool load if (EEPROM.read(i) != 1) return false; strip.applyToAllSelected = true; if (loadBri) bri = EEPROM.read(i+1); - if (loadCol) + + for (byte j=0; j<4; j++) { - for (byte j=0; j<4; j++) - { - col[j] = EEPROM.read(i+j+2); - colSec[j] = EEPROM.read(i+j+6); - } - strip.setColor(2, EEPROM.read(i+12), EEPROM.read(i+13), EEPROM.read(i+14), EEPROM.read(i+15)); //tertiary color - } - if (loadFX) - { - effectCurrent = EEPROM.read(i+10); - effectSpeed = EEPROM.read(i+11); - effectIntensity = EEPROM.read(i+16); - effectPalette = EEPROM.read(i+17); + col[j] = EEPROM.read(i+j+2); + colSec[j] = EEPROM.read(i+j+6); } + strip.setColor(2, EEPROM.read(i+12), EEPROM.read(i+13), EEPROM.read(i+14), EEPROM.read(i+15)); //tertiary color + + effectCurrent = EEPROM.read(i+10); + effectSpeed = EEPROM.read(i+11); + effectIntensity = EEPROM.read(i+16); + effectPalette = EEPROM.read(i+17); } else { if (EEPROM.read(i) != 2) return false; strip.applyToAllSelected = false; diff --git a/wled00/wled03_set.ino b/wled00/wled03_set.ino index 0f2cb9ef..69a7d9b7 100644 --- a/wled00/wled03_set.ino +++ b/wled00/wled03_set.ino @@ -460,18 +460,12 @@ bool handleSet(AsyncWebServerRequest *request, const String& req) pos = req.indexOf("PA="); //apply brightness from preset if (pos > 0) presetApplyBri = (req.charAt(pos+3) != '0'); - pos = req.indexOf("PC="); //apply color from preset - if (pos > 0) presetApplyCol = (req.charAt(pos+3) != '0'); - - pos = req.indexOf("PX="); //apply effects from preset - if (pos > 0) presetApplyFx = (req.charAt(pos+3) != '0'); - pos = req.indexOf("PS="); //saves current in preset if (pos > 0) savePreset(getNumVal(&req, pos)); //apply preset if (updateVal(&req, "PL=", &presetCycCurr, presetCycleMin, presetCycleMax)) { - applyPreset(presetCycCurr, presetApplyBri, presetApplyCol, presetApplyFx); + applyPreset(presetCycCurr, presetApplyBri); } //set brightness @@ -653,7 +647,7 @@ bool handleSet(AsyncWebServerRequest *request, const String& req) pos = req.indexOf("NB="); if (pos > 0) //sets backlight { - presetApplyFx = (req.charAt(pos+3) != '0'); + cronixieBacklight = (req.charAt(pos+3) != '0'); if (overlayCurrent == 3) strip.setCronixieBacklight(cronixieBacklight); overlayRefreshedTime = 0; } diff --git a/wled00/wled05_init.ino b/wled00/wled05_init.ino index 40e3bef6..29ae0e7a 100644 --- a/wled00/wled05_init.ino +++ b/wled00/wled05_init.ino @@ -100,7 +100,7 @@ void beginStrip() pinMode(BTNPIN, INPUT_PULLUP); #endif - if (bootPreset>0) applyPreset(bootPreset, turnOnAtBoot, true, true); + if (bootPreset > 0) applyPreset(bootPreset, turnOnAtBoot); colorUpdated(NOTIFIER_CALL_MODE_INIT); //init relay pin diff --git a/wled00/wled08_led.ino b/wled00/wled08_led.ino index 93642fc2..f6e8b4ee 100644 --- a/wled00/wled08_led.ino +++ b/wled00/wled08_led.ino @@ -251,7 +251,7 @@ void handleNightlight() //also handle preset cycle here if (presetCyclingEnabled && (millis() - presetCycledTime > presetCycleTime)) { - applyPreset(presetCycCurr,presetApplyBri,presetApplyCol,presetApplyFx); + applyPreset(presetCycCurr,presetApplyBri); presetCycCurr++; if (presetCycCurr > presetCycleMax) presetCycCurr = presetCycleMin; if (presetCycCurr > 25) presetCycCurr = 1; colorUpdated(NOTIFIER_CALL_MODE_PRESET_CYCLE); diff --git a/wled00/wled13_cronixie.ino b/wled00/wled13_cronixie.ino index de89aede..897c94f9 100644 --- a/wled00/wled13_cronixie.ino +++ b/wled00/wled13_cronixie.ino @@ -97,8 +97,8 @@ void setCronixie() case '-': dP[i] = 11; break; case 'r': dP[i] = random(1,7); break; //random btw. 1-6 case 'R': dP[i] = random(0,10); break; //random btw. 0-9 - case 't': break; //Test upw. - case 'T': break; //Test dnw. + //case 't': break; //Test upw. + //case 'T': break; //Test dnw. case 'b': dP[i] = 14 + getSameCodeLength('b',i,cronixieDisplay); i = i+dP[i]-14; break; case 'B': dP[i] = 14 + getSameCodeLength('B',i,cronixieDisplay); i = i+dP[i]-14; break; case 'h': dP[i] = 70 + getSameCodeLength('h',i,cronixieDisplay); i = i+dP[i]-70; break; @@ -113,8 +113,8 @@ void setCronixie() case 'y': dP[i] = 86 + getSameCodeLength('y',i,cronixieDisplay); i = i+dP[i]-86; break; case 'I': dP[i] = 39 + getSameCodeLength('I',i,cronixieDisplay); i = i+dP[i]-39; break; //Month. Don't ask me why month and minute both start with M. case 'i': dP[i] = 89 + getSameCodeLength('i',i,cronixieDisplay); i = i+dP[i]-89; break; - case 'W': break; - case 'w': break; + //case 'W': break; + //case 'w': break; case 'D': dP[i] = 43 + getSameCodeLength('D',i,cronixieDisplay); i = i+dP[i]-43; break; case 'd': dP[i] = 93 + getSameCodeLength('d',i,cronixieDisplay); i = i+dP[i]-93; break; case '0': dP[i] = 0; break; @@ -127,8 +127,8 @@ void setCronixie() case '7': dP[i] = 7; break; case '8': dP[i] = 8; break; case '9': dP[i] = 9; break; - case 'V': break; //user var0 - case 'v': break; //user var1 + //case 'V': break; //user var0 + //case 'v': break; //user var1 } } DEBUG_PRINT("result ");