Merge pull request #13957 from gemu2015/display_update

Display update
This commit is contained in:
Theo Arends 2021-12-08 17:19:33 +01:00 committed by GitHub
commit 519ccf3b9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 13 deletions

View File

@ -76,6 +76,9 @@ uDisplay::uDisplay(char *lp) : Renderer(800, 600) {
uint8_t section = 0; uint8_t section = 0;
dsp_ncmds = 0; dsp_ncmds = 0;
lut_num = 0; lut_num = 0;
lvgl_param.data = 0;
lvgl_param.fluslines = 40;
for (uint32_t cnt = 0; cnt < 5; cnt++) { for (uint32_t cnt = 0; cnt < 5; cnt++) {
lut_cnt[cnt] = 0; lut_cnt[cnt] = 0;
lut_cmd[cnt] = 0xff; lut_cmd[cnt] = 0xff;

View File

@ -96,6 +96,11 @@ void Get_display(uint8_t index) {
} }
#endif // USE_MULTI_DISPLAY #endif // USE_MULTI_DISPLAY
#ifndef TXT_MAX_SFAC
#define TXT_MAX_SFAC 4
#endif // TXT_MAX_SFAC
const uint8_t DISPLAY_MAX_DRIVERS = 32; // Max number of display drivers/models supported by xdsp_interface.ino const uint8_t DISPLAY_MAX_DRIVERS = 32; // Max number of display drivers/models supported by xdsp_interface.ino
const uint8_t DISPLAY_MAX_COLS = 64; // Max number of columns allowed with command DisplayCols const uint8_t DISPLAY_MAX_COLS = 64; // Max number of columns allowed with command DisplayCols
const uint8_t DISPLAY_MAX_ROWS = 64; // Max number of lines allowed with command DisplayRows const uint8_t DISPLAY_MAX_ROWS = 64; // Max number of lines allowed with command DisplayRows
@ -875,9 +880,11 @@ void DisplayText(void)
break; break;
case 's': case 's':
// size sx // size sx
if (renderer) renderer->setTextSize(*cp&7); var = atoiv(cp, &temp);
if (temp > TXT_MAX_SFAC) temp = TXT_MAX_SFAC;
if (renderer) renderer->setTextSize(temp);
//else DisplaySetSize(*cp&3); //else DisplaySetSize(*cp&3);
cp += 1; cp+=var;
break; break;
case 'f': case 'f':
// font sx // font sx
@ -2011,7 +2018,7 @@ void CmndDisplayDimmer(void) {
} }
void CmndDisplaySize(void) { void CmndDisplaySize(void) {
if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload <= 4)) { if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload <= TXT_MAX_SFAC)) {
Settings->display_size = XdrvMailbox.payload; Settings->display_size = XdrvMailbox.payload;
if (renderer) renderer->setTextSize(Settings->display_size); if (renderer) renderer->setTextSize(Settings->display_size);
//else DisplaySetSize(Settings->display_size); //else DisplaySetSize(Settings->display_size);

View File

@ -55,7 +55,7 @@ void Core2DisplayDim(uint8_t dim);
#ifndef DISP_DESC_FILE #ifndef DISP_DESC_FILE
//#define DISP_DESC_FILE "/dispdesc.txt" //#define DISP_DESC_FILE "/dispdesc.txt"
#define DISP_DESC_FILE "/display.ini" #define DISP_DESC_FILE "/display.ini"
#endif #endif // DISP_DESC_FILE
/*********************************************************************************************/ /*********************************************************************************************/
#ifdef DSP_ROM_DESC #ifdef DSP_ROM_DESC
@ -95,7 +95,7 @@ int8_t cs;
AddLog(LOG_LEVEL_INFO, PSTR("DSP: File descriptor used")); AddLog(LOG_LEVEL_INFO, PSTR("DSP: File descriptor used"));
} }
} }
#endif #endif // USE_UFILESYS
#ifdef USE_SCRIPT #ifdef USE_SCRIPT
@ -212,8 +212,8 @@ int8_t cs;
replacepin(&cp, Pin(GPIO_SPI_CLK, 1)); replacepin(&cp, Pin(GPIO_SPI_CLK, 1));
replacepin(&cp, Pin(GPIO_SPI_MOSI, 1)); replacepin(&cp, Pin(GPIO_SPI_MOSI, 1));
replacepin(&cp, Pin(GPIO_SPI_DC, 1)); replacepin(&cp, Pin(GPIO_SPI_DC, 1));
replacepin(&cp, Pin(GPIO_BACKLIGHT, 1)); replacepin(&cp, Pin(GPIO_BACKLIGHT));
replacepin(&cp, Pin(GPIO_OLED_RESET, 1)); replacepin(&cp, Pin(GPIO_OLED_RESET));
replacepin(&cp, Pin(GPIO_SPI_MISO, 1)); replacepin(&cp, Pin(GPIO_SPI_MISO, 1));
} else { } else {
// soft spi pins // soft spi pins
@ -280,9 +280,9 @@ int8_t cs;
else FT5206_Touch_Init(Wire1); else FT5206_Touch_Init(Wire1);
#else #else
if (!wire_n) FT5206_Touch_Init(Wire); if (!wire_n) FT5206_Touch_Init(Wire);
#endif #endif // ESP32
} }
#endif #endif // USE_FT5206
#ifdef USE_XPT2046 #ifdef USE_XPT2046
cp = strstr(ddesc, ":TS,"); cp = strstr(ddesc, ":TS,");
@ -291,7 +291,7 @@ int8_t cs;
uint8_t touch_cs = replacepin(&cp, Pin(GPIO_XPT2046_CS)); uint8_t touch_cs = replacepin(&cp, Pin(GPIO_XPT2046_CS));
XPT2046_Touch_Init(touch_cs); XPT2046_Touch_Init(touch_cs);
} }
#endif #endif // USE_XPT2046
uint8_t inirot = Settings->display_rotate; uint8_t inirot = Settings->display_rotate;
@ -314,18 +314,18 @@ int8_t cs;
#ifdef USE_M5STACK_CORE2 #ifdef USE_M5STACK_CORE2
renderer->SetPwrCB(Core2DisplayPower); renderer->SetPwrCB(Core2DisplayPower);
renderer->SetDimCB(Core2DisplayDim); renderer->SetDimCB(Core2DisplayDim);
#endif #endif // USE_M5STACK_CORE2
renderer->DisplayInit(DISPLAY_INIT_MODE, Settings->display_size, inirot, Settings->display_font); renderer->DisplayInit(DISPLAY_INIT_MODE, Settings->display_size, inirot, Settings->display_font);
Settings->display_width = renderer->width(); Settings->display_width = renderer->width();
Settings->display_height = renderer->height(); Settings->display_height = renderer->height();
ApplyDisplayDimmer(); ApplyDisplayDimmer();
#ifdef SHOW_SPLASH #ifdef SHOW_SPLASH
renderer->Splash(); renderer->Splash();
#endif #endif // SHOW_SPLASH
udisp_init_done = true; udisp_init_done = true;
AddLog(LOG_LEVEL_INFO, PSTR("DSP: %s!"), renderer->devname()); AddLog(LOG_LEVEL_INFO, PSTR("DSP: %s!"), renderer->devname());