Merge remote-tracking branch 'upstream/master'

This commit is contained in:
fishbone-git 2019-12-24 01:09:00 +01:00
commit a86f750473
3 changed files with 23 additions and 12 deletions

View File

@ -301,26 +301,30 @@ uint16_t WS2812FX::scan(bool dual)
uint32_t cycleTime = 750 + (255 - SEGMENT.speed)*150; uint32_t cycleTime = 750 + (255 - SEGMENT.speed)*150;
uint32_t perc = now % cycleTime; uint32_t perc = now % cycleTime;
uint16_t prog = (perc * 65535) / cycleTime; uint16_t prog = (perc * 65535) / cycleTime;
uint16_t ledIndex = (prog * ((SEGLEN * 2) - 2)) >> 16; uint16_t size = 1 + ((SEGMENT.intensity * SEGLEN) >>9);
uint16_t ledIndex = (prog * ((SEGLEN *2) - size *2)) >> 16;
fill(SEGCOLOR(1)); fill(SEGCOLOR(1));
int led_offset = ledIndex - (SEGLEN - 1); int led_offset = ledIndex - (SEGLEN - size);
led_offset = abs(led_offset); led_offset = abs(led_offset);
uint16_t i = SEGMENT.start + led_offset;
setPixelColor(i, color_from_palette(i, true, PALETTE_SOLID_WRAP, 0));
if (dual) { if (dual) {
uint16_t i2 = SEGMENT.start + SEGLEN - led_offset - 1; for (uint16_t j = led_offset; j < led_offset + size; j++) {
setPixelColor(i2, color_from_palette(i2, true, PALETTE_SOLID_WRAP, 0)); uint16_t i2 = SEGMENT.stop -1 -j;
setPixelColor(i2, color_from_palette(i2, true, PALETTE_SOLID_WRAP, (SEGCOLOR(2))? 2:0));
}
}
for (uint16_t j = led_offset; j < led_offset + size; j++) {
uint16_t i = SEGMENT.start + j;
setPixelColor(i, color_from_palette(i, true, PALETTE_SOLID_WRAP, 0));
} }
return FRAMETIME; return FRAMETIME;
} }
//NOTE: add intensity (more than 1 pixel lit)
/* /*
* Runs a single pixel back and forth. * Runs a single pixel back and forth.
*/ */
@ -994,7 +998,7 @@ uint16_t WS2812FX::larson_scanner(bool dual) {
for (uint16_t i = SEGENV.step; i < index; i++) { for (uint16_t i = SEGENV.step; i < index; i++) {
uint16_t j = (SEGENV.aux0)?i:SEGLEN-1-i; uint16_t j = (SEGENV.aux0)?i:SEGLEN-1-i;
setPixelColor(j, color_from_palette(j, true, PALETTE_SOLID_WRAP, 0)); setPixelColor(SEGMENT.start + j, color_from_palette(j, true, PALETTE_SOLID_WRAP, 0));
} }
if (dual) { if (dual) {
uint32_t c; uint32_t c;
@ -1006,7 +1010,7 @@ uint16_t WS2812FX::larson_scanner(bool dual) {
for (uint16_t i = SEGENV.step; i < index; i++) { for (uint16_t i = SEGENV.step; i < index; i++) {
uint16_t j = (SEGENV.aux0)?SEGLEN-1-i:i; uint16_t j = (SEGENV.aux0)?SEGLEN-1-i:i;
setPixelColor(j, c); setPixelColor(SEGMENT.start + j, c);
} }
} }
@ -1024,7 +1028,7 @@ uint16_t WS2812FX::mode_comet(void) {
fade_out(SEGMENT.intensity); fade_out(SEGMENT.intensity);
setPixelColor(index, color_from_palette(index, true, PALETTE_SOLID_WRAP, 0)); setPixelColor(SEGMENT.start + index, color_from_palette(index, true, PALETTE_SOLID_WRAP, 0));
return FRAMETIME; return FRAMETIME;
} }

View File

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

View File

@ -561,6 +561,7 @@ bool applyPreset(byte index, bool loadBri = true, bool loadCol = true, bool load
col[j] = EEPROM.read(i+j+2); col[j] = EEPROM.read(i+j+2);
colSec[j] = EEPROM.read(i+j+6); 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) if (loadFX)
{ {
@ -599,6 +600,12 @@ void savePreset(byte index)
EEPROM.write(i+10, effectCurrent); EEPROM.write(i+10, effectCurrent);
EEPROM.write(i+11, effectSpeed); EEPROM.write(i+11, effectSpeed);
uint32_t colTer = strip.getSegment(strip.getMainSegmentId()).colors[2];
EEPROM.write(i+12, (colTer >> 16) & 0xFF);
EEPROM.write(i+13, (colTer >> 8) & 0xFF);
EEPROM.write(i+14, (colTer >> 0) & 0xFF);
EEPROM.write(i+15, (colTer >> 24) & 0xFF);
EEPROM.write(i+16, effectIntensity); EEPROM.write(i+16, effectIntensity);
EEPROM.write(i+17, effectPalette); EEPROM.write(i+17, effectPalette);
} else { //segment 16 can save segments } else { //segment 16 can save segments