@@ -57,22 +57,20 @@ static void write_pixel(uint8_t x, uint8_t y, uint8_t z,
57
57
#endif
58
58
}
59
59
60
- static void fill_cube (uint8_t x0 , uint8_t y0 , uint8_t z0 ,
61
- uint8_t x1 , uint8_t y1 , uint8_t z1 ,
60
+ static void fill_cube (uint8_t x , uint8_t y , uint8_t z ,
61
+ uint8_t cx , uint8_t cy , uint8_t cz ,
62
62
uint16_t color_idx , uint16_t color_ctr )
63
63
{
64
- for (uint8_t x = x0 ; x <= x1 ; x ++ ) {
65
- for (uint8_t y = y0 ; y <= y1 ; y ++ ) {
66
- for (uint8_t z = z0 ; z <= z1 ; z ++ ) {
67
- write_pixel (x , y , z , color_idx , color_ctr );
64
+ for (uint8_t i = 0 ; i < cx ; i ++ ) {
65
+ for (uint8_t j = 0 ; j < cy ; j ++ ) {
66
+ for (uint8_t k = 0 ; k < cz ; k ++ ) {
67
+ write_pixel (x + i , y + j , z + k , color_idx , color_ctr );
68
68
}
69
69
}
70
70
}
71
71
}
72
72
73
- static void write_cube_bitmap (uint8_t x0 , uint8_t y0 , uint8_t z0 ,
74
- uint8_t x1 , uint8_t y1 , uint8_t z1 ,
75
- const uint8_t * bitmap )
73
+ static void write_cube_bitmap (const uint8_t * bitmap )
76
74
{
77
75
uint8_t x = 0 ;
78
76
uint8_t y = 0 ;
@@ -230,7 +228,7 @@ static void vfx_task_handle(void *pvParameter)
230
228
color_tmp = color_idx ;
231
229
#if defined(CONFIG_VFX_OUTPUT_ST7735 )
232
230
for (uint16_t i = 0 ; i < 52 ; i ++ ) {
233
- uint16_t temp = fft_amp [i ] / 32 ;
231
+ uint16_t temp = fft_amp [i ] / 8.192 ;
234
232
uint32_t pixel_color = read_color_from_table (color_idx , color_ctr );
235
233
236
234
if (temp > 80 ) {
@@ -250,7 +248,7 @@ static void vfx_task_handle(void *pvParameter)
250
248
uint16_t fill_cy = temp ;
251
249
#else
252
250
for (uint16_t i = 0 ; i < 60 ; i ++ ) {
253
- uint16_t temp = fft_amp [i ] / 16 ;
251
+ uint16_t temp = fft_amp [i ] / 4.8 ;
254
252
uint32_t pixel_color = read_color_from_table (color_idx , color_ctr );
255
253
256
254
if (temp > 135 ) {
@@ -366,7 +364,7 @@ static void vfx_task_handle(void *pvParameter)
366
364
clear_cube ();
367
365
break ;
368
366
}
369
- fill_cube (0 , 0 , 0 , 7 , 7 , 7 , color_idx , color_ctr );
367
+ fill_cube (0 , 0 , 0 , 8 , 8 , 8 , color_idx , color_ctr );
370
368
if (++ color_idx > 511 ) {
371
369
color_idx = 0 ;
372
370
}
@@ -385,7 +383,7 @@ static void vfx_task_handle(void *pvParameter)
385
383
clear_cube ();
386
384
break ;
387
385
}
388
- fill_cube (0 , 0 , 0 , 7 , 7 , 7 , color_idx , color_ctr );
386
+ fill_cube (0 , 0 , 0 , 8 , 8 , 8 , color_idx , color_ctr );
389
387
if (ctr_dir == 0 ) { // 暗->明
390
388
if (color_ctr -- == vfx_ctr ) {
391
389
color_ctr = vfx_ctr ;
@@ -701,7 +699,7 @@ static void vfx_task_handle(void *pvParameter)
701
699
clear_cube ();
702
700
break ;
703
701
}
704
- write_cube_bitmap (0 , 0 , 0 , 7 , 7 , 7 , bitmap_wave [frame_idx ]);
702
+ write_cube_bitmap (bitmap_wave [frame_idx ]);
705
703
if (frame_idx ++ == 44 ) {
706
704
frame_idx = 8 ;
707
705
}
@@ -787,15 +785,35 @@ static void vfx_task_handle(void *pvParameter)
787
785
788
786
color_idx = 63 ;
789
787
for (uint16_t i = 0 ; i < 64 ; i ++ ) {
790
- uint16_t temp = fft_amp [i ] / 320 ;
791
- if (temp != 0 ) {
792
- fill_cube (x , 7 - y , 0 , x , 7 - y , 7 - temp , 0 , 511 );
793
- fill_cube (x , 7 - y , 7 - temp , x , 7 - y , 7 , color_idx , color_ctr );
794
- } else {
795
- fill_cube (x , 7 - y , 0 , x , 7 - y , 6 , 0 , 511 );
796
- fill_cube (x , 7 - y , 7 , x , 7 - y , 7 , color_idx , color_ctr );
788
+ uint8_t temp = fft_amp [i ] / 81.92 ;
789
+
790
+ if (temp > 8 ) {
791
+ temp = 8 ;
792
+ } else if (temp < 1 ) {
793
+ temp = 1 ;
797
794
}
798
795
796
+ uint8_t clear_x = x ;
797
+ uint8_t clear_cx = 1 ;
798
+ uint8_t clear_y = 7 - y ;
799
+ uint8_t clear_cy = 1 ;
800
+ uint8_t clear_z = 0 ;
801
+ uint8_t clear_cz = 8 - temp ;
802
+
803
+ uint8_t fill_x = x ;
804
+ uint8_t fill_cx = 1 ;
805
+ uint8_t fill_y = 7 - y ;
806
+ uint8_t fill_cy = 1 ;
807
+ uint8_t fill_z = 8 - temp ;
808
+ uint8_t fill_cz = temp ;
809
+
810
+ fill_cube (clear_x , clear_y , clear_z ,
811
+ clear_cx , clear_cy , clear_cz ,
812
+ 0 , 511 );
813
+ fill_cube (fill_x , fill_y , fill_z ,
814
+ fill_cx , fill_cy , fill_cz ,
815
+ color_idx , color_ctr );
816
+
799
817
if (y ++ == 7 ) {
800
818
y = 0 ;
801
819
if (x ++ == 7 ) {
@@ -844,15 +862,35 @@ static void vfx_task_handle(void *pvParameter)
844
862
845
863
color_idx = color_tmp ;
846
864
for (uint16_t i = 0 ; i < 64 ; i ++ ) {
847
- uint16_t temp = fft_amp [i ] / 320 ;
848
- if (temp != 0 ) {
849
- fill_cube (x , 7 - y , 0 , x , 7 - y , 7 - temp , 0 , 511 );
850
- fill_cube (x , 7 - y , 7 - temp , x , 7 - y , 7 , color_idx , color_ctr );
851
- } else {
852
- fill_cube (x , 7 - y , 0 , x , 7 - y , 6 , 0 , 511 );
853
- fill_cube (x , 7 - y , 7 , x , 7 - y , 7 , color_idx , color_ctr );
865
+ uint8_t temp = fft_amp [i ] / 81.92 ;
866
+
867
+ if (temp > 8 ) {
868
+ temp = 8 ;
869
+ } else if (temp < 1 ) {
870
+ temp = 1 ;
854
871
}
855
872
873
+ uint8_t clear_x = x ;
874
+ uint8_t clear_cx = 1 ;
875
+ uint8_t clear_y = 7 - y ;
876
+ uint8_t clear_cy = 1 ;
877
+ uint8_t clear_z = 0 ;
878
+ uint8_t clear_cz = 8 - temp ;
879
+
880
+ uint8_t fill_x = x ;
881
+ uint8_t fill_cx = 1 ;
882
+ uint8_t fill_y = 7 - y ;
883
+ uint8_t fill_cy = 1 ;
884
+ uint8_t fill_z = 8 - temp ;
885
+ uint8_t fill_cz = temp ;
886
+
887
+ fill_cube (clear_x , clear_y , clear_z ,
888
+ clear_cx , clear_cy , clear_cz ,
889
+ 0 , 511 );
890
+ fill_cube (fill_x , fill_y , fill_z ,
891
+ fill_cx , fill_cy , fill_cz ,
892
+ color_idx , color_ctr );
893
+
856
894
if (y ++ == 7 ) {
857
895
y = 0 ;
858
896
if (x ++ == 7 ) {
@@ -928,15 +966,35 @@ static void vfx_task_handle(void *pvParameter)
928
966
x = led_idx_table [0 ][i ];
929
967
y = led_idx_table [1 ][i ];
930
968
931
- uint16_t temp = fft_amp [i ] / 320 ;
932
- if (temp != 0 ) {
933
- fill_cube (x , 7 - y , 0 , x , 7 - y , 7 - temp , 0 , 511 );
934
- fill_cube (x , 7 - y , 7 - temp , x , 7 - y , 7 , color_idx [i ], color_ctr [i ]);
935
- } else {
936
- fill_cube (x , 7 - y , 0 , x , 7 - y , 6 , 0 , 511 );
937
- fill_cube (x , 7 - y , 7 , x , 7 - y , 7 , color_idx [i ], color_ctr [i ]);
969
+ uint8_t temp = fft_amp [i ] / 81.92 ;
970
+
971
+ if (temp > 8 ) {
972
+ temp = 8 ;
973
+ } else if (temp < 1 ) {
974
+ temp = 1 ;
938
975
}
939
976
977
+ uint8_t clear_x = x ;
978
+ uint8_t clear_cx = 1 ;
979
+ uint8_t clear_y = 7 - y ;
980
+ uint8_t clear_cy = 1 ;
981
+ uint8_t clear_z = 0 ;
982
+ uint8_t clear_cz = 8 - temp ;
983
+
984
+ uint8_t fill_x = x ;
985
+ uint8_t fill_cx = 1 ;
986
+ uint8_t fill_y = 7 - y ;
987
+ uint8_t fill_cy = 1 ;
988
+ uint8_t fill_z = 8 - temp ;
989
+ uint8_t fill_cz = temp ;
990
+
991
+ fill_cube (clear_x , clear_y , clear_z ,
992
+ clear_cx , clear_cy , clear_cz ,
993
+ 0 , 511 );
994
+ fill_cube (fill_x , fill_y , fill_z ,
995
+ fill_cx , fill_cy , fill_cz ,
996
+ color_idx [i ], color_ctr [i ]);
997
+
940
998
if (color_flg ) {
941
999
if (color_idx [i ]-- == 0 ) {
942
1000
color_idx [i ] = 511 ;
0 commit comments