This commit is contained in:
e2002
2022-08-22 11:50:48 +03:00
parent 8fa32f1587
commit 223bae1923
39 changed files with 644 additions and 380 deletions

View File

@@ -1,9 +1,10 @@
#ifndef display_vu_h
#define display_vu_h
#include "player.h"
#include "network.h"
#ifdef VU_PARAMS2
enum : uint16_t VU_PARAMS2;
#ifdef VU_PARAMS3
enum : uint16_t VU_PARAMS3;
#else
/*
* vu left - left position
@@ -22,26 +23,26 @@ enum : uint16_t VU_PARAMS2;
/**********************************************************************************************************************************************************************************/
#if DSP_MODEL==DSP_ST7735 && DTYPE==INITR_BLACKTAB /* ST7735 160x128 */
enum : uint16_t { VU_X = 4, VU_Y = 50, VU_BW = 10, VU_BH = 44, VU_BS = 2, VU_NB = 8, VU_FS = 2, VU_HOR = 0, VU_COLOR_MAX = TFT_LOGO, VU_COLOR_MIN = GRAY };
enum : uint16_t { VU_X = 4, VU_Y = 50, VU_BW = 10, VU_BH = 44, VU_BS = 2, VU_NB = 8, VU_FS = 3, VU_HOR = 0 };
#elif DSP_MODEL==DSP_ST7735 && DTYPE==INITR_144GREENTAB /* ST7735 128x128 */
enum : uint16_t { VU_X = 4, VU_Y = 97, VU_BW = 60, VU_BH = 8, VU_BS = 0, VU_NB = 10, VU_FS = 2, VU_HOR = 1, VU_COLOR_MAX = TFT_LOGO, VU_COLOR_MIN = DARK_GRAY };
enum : uint16_t { VU_X = 4, VU_Y = 97, VU_BW = 60, VU_BH = 8, VU_BS = 0, VU_NB = 10, VU_FS = 3, VU_HOR = 1 };
#define GREENTAB128
#elif DSP_MODEL==DSP_ILI9341 /* ILI9341 320x240 */
enum : uint16_t { VU_X = 4, VU_Y = 116, VU_BW = 24, VU_BH = 80, VU_BS = 4, VU_NB = 8, VU_FS = 5, VU_HOR = 0, VU_COLOR_MAX = TFT_LOGO, VU_COLOR_MIN = GRAY };
enum : uint16_t { VU_X = 4, VU_Y = 116, VU_BW = 24, VU_BH = 80, VU_BS = 4, VU_NB = 8, VU_FS = 5, VU_HOR = 0 };
#elif DSP_MODEL==DSP_ST7789 /* ST7789 320x240 */
enum : uint16_t { VU_X = 4, VU_Y = 116, VU_BW = 24, VU_BH = 80, VU_BS = 4, VU_NB = 8, VU_FS = 5, VU_HOR = 0, VU_COLOR_MAX = TFT_LOGO, VU_COLOR_MIN = GRAY };
enum : uint16_t { VU_X = 4, VU_Y = 116, VU_BW = 24, VU_BH = 80, VU_BS = 4, VU_NB = 8, VU_FS = 5, VU_HOR = 0 };
#elif DSP_MODEL==DSP_ST7789_240 /* ST7789 240x240 */
enum : uint16_t { VU_X = 4, VU_Y = 90, VU_BW = 120, VU_BH = 20, VU_BS = 0, VU_NB = 12, VU_FS = 3, VU_HOR = 1, VU_COLOR_MAX = TFT_LOGO, VU_COLOR_MIN = GRAY };
enum : uint16_t { VU_X = 4, VU_Y = 90, VU_BW = 120, VU_BH = 20, VU_BS = 0, VU_NB = 12, VU_FS = 3, VU_HOR = 1 };
#elif DSP_MODEL==DSP_ILI9225 /* ILI9225 220x176 */
enum : uint16_t { VU_X = 4, VU_Y = 80, VU_BW = 13, VU_BH = 56, VU_BS = 2, VU_NB = 8, VU_FS = 4, VU_HOR = 0, VU_COLOR_MAX = TFT_LOGO, VU_COLOR_MIN = GRAY };
enum : uint16_t { VU_X = 4, VU_Y = 80, VU_BW = 13, VU_BH = 56, VU_BS = 2, VU_NB = 8, VU_FS = 4, VU_HOR = 0 };
#elif (DSP_MODEL==DSP_ST7735 && DTYPE==INITR_MINI160x80) || (DSP_MODEL==DSP_GC9106) /* ST7735 160x80, GC9106 160x80 */
enum : uint16_t { VU_X = 1, VU_Y = 30, VU_BW = 12, VU_BH = 36, VU_BS = 4, VU_NB = 8, VU_FS = 2, VU_HOR = 0, VU_COLOR_MAX = TFT_LOGO, VU_COLOR_MIN = GRAY };
enum : uint16_t { VU_X = 1, VU_Y = 30, VU_BW = 12, VU_BH = 36, VU_BS = 4, VU_NB = 8, VU_FS = 3, VU_HOR = 0 };
#endif
#endif //VU_PARAMS
@@ -52,7 +53,7 @@ void drawVU(DspCore *dsp);
GFXcanvas16 gfxc(VU_BW*2+VU_BS,VU_BH);
void drawVU(DspCore *dsp){
if(!config.store.vumeter) return;
if(!config.store.vumeter || network.status!=CONNECTED) return;
if(display.mode!=PLAYER && display.mode!=VOL) return;
#ifdef GREENTAB128
if(display.mode==VOL) return;
@@ -75,21 +76,22 @@ void drawVU(DspCore *dsp){
if(measL>dimension) measL=dimension;
if(measR>dimension) measR=dimension;
uint8_t h=(dimension/VU_NB)-2;
gfxc.fillRect(0,0,VU_BW*2+VU_BS,VU_BH, config.theme.background);
for(int i=0; i<dimension; i++){
if(i%(dimension/VU_NB)==0){
if(VU_HOR){
#ifndef BOOMBOX_STYLE
bandColor = (i>VU_BW-(VU_BW/VU_NB)*4)?VU_COLOR_MAX:VU_COLOR_MIN;
bandColor = (i>VU_BW-(VU_BW/VU_NB)*4)?config.theme.vumax:config.theme.vumin;
gfxc.fillRect(i, 0, h, VU_BH, bandColor);
gfxc.fillRect(i+VU_BW+VU_BS, 0, h, VU_BH, bandColor);
#else
bandColor = (i>(VU_BW/VU_NB))?VU_COLOR_MIN:VU_COLOR_MAX;
bandColor = (i>(VU_BW/VU_NB))?VU_COLOR_MIN:config.theme.vumax;
gfxc.fillRect(i, 0, h, VU_BH, bandColor);
bandColor = (i>VU_BW-(VU_BW/VU_NB)*3)?VU_COLOR_MAX:VU_COLOR_MIN;
bandColor = (i>VU_BW-(VU_BW/VU_NB)*3)?config.theme.vumax:config.theme.vumin;
gfxc.fillRect(i+VU_BW+VU_BS, 0, h, VU_BH, bandColor);
#endif
}else{
bandColor = (i<(VU_BH/VU_NB)*3)?VU_COLOR_MAX:VU_COLOR_MIN;
bandColor = (i<(VU_BH/VU_NB)*3)?config.theme.vumax:config.theme.vumin;
gfxc.fillRect(0, i, VU_BW, h, bandColor);
gfxc.fillRect(VU_BW+VU_BS, i, VU_BW, h, bandColor);
}
@@ -97,17 +99,17 @@ void drawVU(DspCore *dsp){
}
if(VU_HOR){
#ifndef BOOMBOX_STYLE
gfxc.fillRect(VU_BW-measL, 0, measL, VU_BW, TFT_BG);
gfxc.fillRect(VU_BW*2+VU_BS-measR, 0, measR, VU_BW, TFT_BG);
gfxc.fillRect(VU_BW-measL, 0, measL, VU_BW, config.theme.background);
gfxc.fillRect(VU_BW*2+VU_BS-measR, 0, measR, VU_BW, config.theme.background);
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);
#else
gfxc.fillRect(0, 0, VU_BW-(VU_BW-measL), VU_BW, TFT_BG);
gfxc.fillRect(VU_BW*2+VU_BS-measR, 0, measR, VU_BW, TFT_BG);
gfxc.fillRect(0, 0, VU_BW-(VU_BW-measL), VU_BW, config.theme.background);
gfxc.fillRect(VU_BW*2+VU_BS-measR, 0, measR, VU_BW, config.theme.background);
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);
#endif
}else{
gfxc.fillRect(0, 0, VU_BW, measL, TFT_BG);
gfxc.fillRect(VU_BW+VU_BS, 0, VU_BW, measR, TFT_BG);
gfxc.fillRect(0, 0, VU_BW, measL, config.theme.background);
gfxc.fillRect(VU_BW+VU_BS, 0, VU_BW, measR, config.theme.background);
dsp->drawRGBBitmap(VU_X, VU_Y, gfxc.getBuffer(), VU_BW*2+VU_BS, VU_BH);
}
}