@@ -3696,16 +3696,17 @@ uint16_t mode_drip(void)
36963696 if (!SEGENV.allocateData (dataSize * strips)) return mode_static (); // allocation failed
36973697 Spark* drops = reinterpret_cast <Spark*>(SEGENV.data );
36983698
3699+ if (SEGENV.call == 0 ) SEGMENT.fill (BLACK); // WLEDMM clear LEDs at startup
36993700 if (!SEGMENT.check2 ) SEGMENT.fill (SEGCOLOR (1 ));
37003701
37013702 struct virtualStrip {
37023703 static void runStrip (uint16_t stripNr, Spark* drops) {
37033704
37043705 uint8_t numDrops = 1 + (SEGMENT.intensity >> 6 ); // 255>>6 = 3
37053706
3706- float gravity = -0.0005 - (SEGMENT.speed / 25000.0 ); // increased gravity (50000 to 25000 )
3707- gravity *= max (1 , SEGLEN-1 );
3708- int sourcedrop = 12 ;
3707+ float gravity = -0 .0005f - (float ( SEGMENT.speed )/ 35000 . 0f ); // increased gravity (50000 to 35000 )
3708+ gravity *= min ( max (1 , SEGLEN-1 ), 255 ); // WLEDMM speed limit 255
3709+ const int sourcedrop = 12 ;
37093710
37103711 for (int j=0 ;j<numDrops;j++) {
37113712 if (drops[j].colIndex == 0 ) { // init
@@ -3724,24 +3725,26 @@ uint16_t mode_drip(void)
37243725
37253726 drops[j].col += map (SEGMENT.custom1 , 0 , 255 , 1 , 6 ); // swelling
37263727
3727- if (random16 () <= drops[j].col * SEGMENT.custom1 * SEGMENT.custom1 / 10 / 128 ) { // random drop
3728+ uint32_t fallrate = (drops[j].col * (1 + SEGMENT.custom1 * SEGMENT.custom1 )) / 192 ; // WLEDMM specific
3729+ if (random16 () <= (fallrate / 10 )) { // random drop => 1% ... 20% probalibity
37283730 drops[j].colIndex =2 ; // fall
37293731 drops[j].col =255 ;
37303732 }
37313733 }
37323734 if (drops[j].colIndex > 1 ) { // falling
3733- if (drops[j].pos > 0 ) { // fall until end of segment
3735+ if (drops[j].pos > 0 . 01f ) { // fall until end of segment
37343736 drops[j].pos += drops[j].vel ;
37353737 if (drops[j].pos < 0 ) drops[j].pos = 0 ;
37363738 drops[j].vel += gravity; // gravity is negative
37373739
37383740 for (int i=1 ;i<7 -drops[j].colIndex ;i++) { // some minor math so we don't expand bouncing droplets
3739- uint16_t pos = constrain (uint16_t (drops[j].pos ) +i, 0 , SEGLEN-1 ); // this is BAD, returns a pos >= SEGLEN occasionally
3741+ int intPos = roundf (drops[j].pos ) +i; // WLEDMM round it first
3742+ uint16_t pos = constrain (intPos, 0 , SEGLEN-1 ); // this is BAD, returns a pos >= SEGLEN occasionally // WLEDMM bad cast to uint16_t removed
37403743 SEGMENT.setPixelColor (indexToVStrip (pos, stripNr), color_blend (BLACK,dropColor,drops[j].col /i)); // spread pixel with fade while falling
37413744 }
37423745
37433746 if (drops[j].colIndex > 2 ) { // during bounce, some water is on the floor
3744- SEGMENT.setPixelColor (indexToVStrip (0 , stripNr), color_blend (dropColor,BLACK,drops[j].col ));
3747+ SEGMENT.setPixelColor (indexToVStrip (0 , stripNr), color_blend (dropColor,BLACK, ( 2 * drops[j].col )/ 3 )); // WLEDMM reduced brightness
37453748 }
37463749 } else { // we hit bottom
37473750 if (drops[j].colIndex > 2 ) { // already hit once, so back to forming
@@ -3768,7 +3771,7 @@ uint16_t mode_drip(void)
37683771
37693772 return FRAMETIME;
37703773}
3771- static const char _data_FX_MODE_DRIP[] PROGMEM = " Drip@Gravity,# of drips,,,,,Overlay;!,!;!;1.5d;m12=1" ; // bar WLEDMM 1.5d
3774+ static const char _data_FX_MODE_DRIP[] PROGMEM = " Drip@Gravity,# of drips,Fall ratio ,,,,Overlay;!,!;!;1.5d;c1=127, m12=1" ; // bar WLEDMM 1.5d
37723775
37733776
37743777/*
0 commit comments