@@ -6668,7 +6668,13 @@ uint16_t mode_2Ddriftrose(void) {
66686668
66696669 const float CX = (cols-cols%2 )/2 .f - .5f ;
66706670 const float CY = (rows-rows%2 )/2 .f - .5f ;
6671- const float L = min (cols, rows) / 2 .f ;
6671+
6672+ unsigned L2 = SEGENV.check3 ? max (cols, rows) : min (cols, rows); // WLEDMM we use "max" to use the complete segment
6673+ if (SEGENV.check3 && (abs (int (cols) - int (rows)) < 4 )) L2 = L2 * 1 .4142f ; // WLEDMM make "expand" look a bit bigger on square panels
6674+ const float L = L2 / 2 .f ;
6675+ // WLEDMM pre-calculate some values
6676+ const uint32_t wu_cols = SEGMENT.virtualWidth () * 256 ;
6677+ const uint32_t wu_rows = SEGMENT.virtualHeight () * 256 ;
66726678
66736679 if (SEGENV.call == 0 ) {
66746680 SEGMENT.setUpLeds ();
@@ -6677,15 +6683,16 @@ uint16_t mode_2Ddriftrose(void) {
66776683
66786684 SEGMENT.fadeToBlackBy (32 +(SEGMENT.speed >>3 ));
66796685 for (size_t i = 1 ; i < 37 ; i++) {
6680- uint32_t x = (CX + (sinf (radians (i * 10 )) * (beatsin8 (i, 0 , L*2 )-L))) * 255 .f ;
6681- uint32_t y = (CY + (cosf (radians (i * 10 )) * (beatsin8 (i, 0 , L*2 )-L))) * 255 .f ;
6682- SEGMENT.wu_pixel (x, y, CHSV (i * 10 , 255 , 255 ));
6686+ float angle = float (DEG_TO_RAD) * i * 10 ;
6687+ uint32_t x = int ((CX + (sinf (angle) * (beatsin8 (i, 0 , L2)-L))) * 255 .f );
6688+ uint32_t y = int ((CY + (cosf (angle) * (beatsin8 (i, 0 , L2)-L))) * 255 .f );
6689+ if ((x < wu_cols) && (y < wu_rows)) SEGMENT.wu_pixel (x, y, CHSV (i * 10 , 255 , 255 ));
66836690 }
66846691 SEGMENT.blur ((SEGMENT.intensity >>4 )+1 );
66856692
66866693 return FRAMETIME;
66876694}
6688- static const char _data_FX_MODE_2DDRIFTROSE[] PROGMEM = " Drift Rose@Fade,Blur;;;2" ;
6695+ static const char _data_FX_MODE_2DDRIFTROSE[] PROGMEM = " Drift Rose@Fade,Blur,,,,,,Full Expand ☾ ;;;2" ;
66896696
66906697#endif // WLED_DISABLE_2D
66916698
0 commit comments