66#ifdef VU_PARAMS
77enum : uint16_t VU_PARAMS ;
88#else
9- /*****************************************************************************************************************************************************************************/
10- /* vu left | vu top | band width | band height | band space |num of bands |max samples | horisontal | Max Bands Color | Min Bands Color */
11- /*****************************************************************************************************************************************************************************/
9+ /*
10+ * vu left - left position
11+ * vu top - top position
12+ * band width - width of band
13+ * band height - height of band
14+ * band space - space between bands
15+ * num of bands - num of bands
16+ * max samples - for i2s dac: count of measurements before fixing the value
17+ * horisontal - bands orientation
18+ * Max/Min Bands Color - color of bands
19+ */
20+
21+ /**********************************************************************************************************************************************************************************/
22+ /* vu left | vu top | band width | band height | band space | num of bands | max samples | horisontal | Max Bands Color | Min Bands Color */
23+ /**********************************************************************************************************************************************************************************/
1224#if DSP_MODEL == DSP_ST7735 && DTYPE == INITR_BLACKTAB /* ST7735 160x128 */
13- enum : uint16_t { VU_X = 4 , VU_Y = 50 , VU_BW = 10 , VU_BH = 44 , VU_BS = 2 , VU_NB = 8 , VU_BMS = 2 , VU_HOR = 0 , VU_COLOR_MAX = TFT_LOGO , VU_COLOR_MIN = SILVER };
25+ enum : uint16_t { VU_X = 4 , VU_Y = 50 , VU_BW = 10 , VU_BH = 44 , VU_BS = 2 , VU_NB = 8 , VU_BMS = 2 , VU_HOR = 0 , VU_COLOR_MAX = TFT_LOGO , VU_COLOR_MIN = SILVER };
1426#elif DSP_MODEL==DSP_ST7735 && DTYPE==INITR_144GREENTAB /* ST7735 128x128 */
15- enum : uint16_t { VU_X = 4 , VU_Y = 45 , VU_BW = 60 , VU_BH = 8 , VU_BS = 0 , VU_NB = 10 , VU_BMS = 3 , VU_HOR = 1 , VU_COLOR_MAX = TFT_LOGO , VU_COLOR_MIN = GRAY };
27+ enum : uint16_t { VU_X = 4 , VU_Y = 45 , VU_BW = 60 , VU_BH = 8 , VU_BS = 0 , VU_NB = 10 , VU_BMS = 3 , VU_HOR = 1 , VU_COLOR_MAX = TFT_LOGO , VU_COLOR_MIN = SILVER };
28+ #define GREENTAB128
1629#elif DSP_MODEL==DSP_ILI9341 /* ILI9341 320x240 */
17- enum : uint16_t { VU_X = 4 , VU_Y = 100 , VU_BW = 20 , VU_BH = 86 , VU_BS = 4 , VU_NB = 10 , VU_BMS = 2 , VU_HOR = 0 , VU_COLOR_MAX = TFT_LOGO , VU_COLOR_MIN = GRAY };
30+ enum : uint16_t { VU_X = 4 , VU_Y = 100 , VU_BW = 20 , VU_BH = 86 , VU_BS = 4 , VU_NB = 10 , VU_BMS = 2 , VU_HOR = 0 , VU_COLOR_MAX = TFT_LOGO , VU_COLOR_MIN = GRAY };
1831#elif DSP_MODEL==DSP_ST7789 /* ST7789 320x240 */
19- enum : uint16_t { VU_X = 4 , VU_Y = 100 , VU_BW = 20 , VU_BH = 86 , VU_BS = 4 , VU_NB = 10 , VU_BMS = 3 , VU_HOR = 0 , VU_COLOR_MAX = TFT_LOGO , VU_COLOR_MIN = GRAY };
32+ enum : uint16_t { VU_X = 4 , VU_Y = 100 , VU_BW = 20 , VU_BH = 86 , VU_BS = 4 , VU_NB = 10 , VU_BMS = 3 , VU_HOR = 0 , VU_COLOR_MAX = TFT_LOGO , VU_COLOR_MIN = GRAY };
33+ #elif DSP_MODEL==DSP_ST7789_240 /* ST7789 240x240 */
34+ enum : uint16_t { VU_X = 4 , VU_Y = 90 , VU_BW = 120 , VU_BH = 20 , VU_BS = 0 , VU_NB = 12 , VU_BMS = 3 , VU_HOR = 1 , VU_COLOR_MAX = TFT_LOGO , VU_COLOR_MIN = GRAY };
35+ #elif DSP_MODEL==DSP_ILI9225 /* ILI9225 220x176 */
36+ enum : uint16_t { VU_X = 4 , VU_Y = 74 , VU_BW = 13 , VU_BH = 60 , VU_BS = 2 , VU_NB = 10 , VU_BMS = 2 , VU_HOR = 0 , VU_COLOR_MAX = TFT_LOGO , VU_COLOR_MIN = GRAY };
37+ #elif (DSP_MODEL==DSP_ST7735 && DTYPE==INITR_MINI160x80) || (DSP_MODEL==DSP_GC9106) /* ST7735 160x80, GC9106 160x80 */
38+ enum : uint16_t { VU_X = 1 , VU_Y = 30 , VU_BW = 12 , VU_BH = 36 , VU_BS = 4 , VU_NB = 8 , VU_BMS = 2 , VU_HOR = 0 , VU_COLOR_MAX = TFT_LOGO , VU_COLOR_MIN = GRAY };
2039#else
2140#error YOUR DISPLAY DOES NOT SUPPORT ENABLE_VU_METER FEATURE YET
2241#endif
2342#endif //VU_PARAMS
24-
25- /*****************************************************************************************************************************************************************************/
43+ /**********************************************************************************************************************************************************************************/
2644
2745void drawVU (DspCore * dsp );
2846
2947GFXcanvas16 gfxc (VU_BW * 2 + VU_BS ,VU_BH );
3048
3149void drawVU (DspCore * dsp ){
32- if ((display .mode != PLAYER && display .mode != VOL )) return ;
50+ if (display .mode != PLAYER && display .mode != VOL ) return ;
51+ #ifdef GREENTAB128
52+ if (display .mode == VOL ) return ;
53+ #endif
3354 player .getVUlevel ();
3455 static uint16_t samples_cnt , measL , measR ;
56+ uint16_t bandColor ;
3557 samples_cnt ++ ;
3658 uint16_t dimension = VU_HOR ?VU_BW :VU_BH ;
3759 uint8_t L = map ((VS1053_CS != 255 )?player .vuLeft :log (player .vuLeft )* 38 + 45 , 255 , 0 , 0 , dimension );
@@ -40,8 +62,8 @@ void drawVU(DspCore *dsp){
4062 if (L > measL ) measL = L ;
4163 if (R > measR ) measR = R ;
4264 }else {
43- if (measL < 255 ) measL += 2 ;
44- if (measR < 255 ) measR += 2 ;
65+ if (measL < dimension ) measL += 2 ;
66+ if (measR < dimension ) measR += 2 ;
4567 }
4668#if VS1053_CS == 255
4769 if (samples_cnt < VU_BMS ) return ;
@@ -51,11 +73,11 @@ void drawVU(DspCore *dsp){
5173 for (int i = 0 ; i < dimension ; i ++ ){
5274 if (i %(dimension /VU_NB )== 0 ){
5375 if (VU_HOR ){
54- uint16_t bandColor = (i > VU_BW - (VU_BW /VU_NB )* 4 )?VU_COLOR_MAX :VU_COLOR_MIN ;
76+ bandColor = (i > VU_BW - (VU_BW /VU_NB )* 4 )?VU_COLOR_MAX :VU_COLOR_MIN ;
5577 gfxc .fillRect (i , 0 , h , VU_BH , bandColor );
5678 gfxc .fillRect (i + VU_BW + VU_BS , 0 , h , VU_BH , bandColor );
5779 }else {
58- uint16_t bandColor = (i < (VU_BH /VU_NB )* 3 )?VU_COLOR_MAX :VU_COLOR_MIN ;
80+ bandColor = (i < (VU_BH /VU_NB )* 3 )?VU_COLOR_MAX :VU_COLOR_MIN ;
5981 gfxc .fillRect (0 , i , VU_BW , h , bandColor );
6082 gfxc .fillRect (VU_BW + VU_BS , i , VU_BW , h , bandColor );
6183 }
@@ -64,11 +86,11 @@ void drawVU(DspCore *dsp){
6486 if (VU_HOR ){
6587 gfxc .fillRect (VU_BW - measL , 0 , measL , VU_BW , TFT_BG );
6688 gfxc .fillRect (VU_BW * 2 + VU_BS - measR , 0 , measR , VU_BW , TFT_BG );
67- dsp -> drawRGBBitmap (VU_X , VU_Y , gfxc .getBuffer (), 120 , VU_BH );
89+ dsp -> drawRGBBitmap (VU_X , ( display . mode == VOL && DSP_MODEL == DSP_ST7789_240 )? VU_Y - 40 : VU_Y , gfxc .getBuffer (), VU_BW * 2 + VU_BS , VU_BH );
6890 }else {
6991 gfxc .fillRect (0 , 0 , VU_BW , measL , TFT_BG );
7092 gfxc .fillRect (VU_BW + VU_BS , 0 , VU_BW , measR , TFT_BG );
71- dsp -> drawRGBBitmap (VU_X , VU_Y , gfxc .getBuffer (), VU_BW * 2 + VU_BS , VU_BH );
93+ dsp -> drawRGBBitmap (VU_X , VU_Y , gfxc .getBuffer (), VU_BW * 2 + VU_BS , VU_BH );
7294 }
7395 if (player .isRunning ()){
7496 measL = 0 ;
0 commit comments