99static const uint32_t screenWidth = WIDTH;
1010static const uint32_t screenHeight = HEIGHT;
1111
12- const unsigned int lvBufferSize = screenWidth * 30 ;
12+ const unsigned int lvBufferSize = screenWidth * screenHeight ;
1313uint8_t lvBuffer[2 ][lvBufferSize];
1414
1515static lv_display_t *lvDisplay;
@@ -75,12 +75,14 @@ void hal_setup(void)
7575{
7676 Serial.println (" Starting LVGL setup..." );
7777 Serial.printf (" LV definition: LV LOG level=%d, LV_USE_LOG=%d\n " , LV_LOG_LEVEL, LV_USE_LOG);
78-
78+ lv_init ();
7979 /* Initialize the display drivers */
8080 tft.init ();
81+ tft.setBrightness (0 );
8182 tft.initDMA ();
82- tft.startWrite ();
83- tft.fillScreen (TFT_BLACK);
83+ // tft.startWrite();
84+
85+ // tft.fillScreen(TFT_BLACK);
8486
8587 /* Set display rotation to landscape */
8688 // tft.setRotation(1);
@@ -103,16 +105,20 @@ void hal_setup(void)
103105 lv_indev_set_type (lvInput, LV_INDEV_TYPE_POINTER);
104106 lv_indev_set_read_cb (lvInput, my_touchpad_read);
105107
106- // Test PSRAM
107- #if 0
108+ // Test PSRAM
109+ #if 0
108110 LV_LOG_USER("befor:ESP.getFreeHeap():%d,PSRAM=%d,Free_PSRAM=%d", ESP.getFreeHeap(), ESP.getPsramSize(), ESP.getFreePsram());
109111
110112 ext_color_buf = (uint8_t *)heap_caps_malloc(1024, MALLOC_CAP_SPIRAM);
111113 ext_color_buf2 = (uint8_t *)heap_caps_malloc(1024, MALLOC_CAP_SPIRAM);
112114
113115 LV_LOG_USER("ext_color_buf:%d,ext_color_buf2=%d", ext_color_buf, ext_color_buf2);
114116 LV_LOG_USER("after malloc:ESP.getFreeHeap():%d,PSRAM=%d,Free_PSRAM=%d", ESP.getFreeHeap(), ESP.getPsramSize(), ESP.getFreePsram());
115- #endif
117+ #endif
118+
119+ lv_timer_handler ();
120+ delay (100 ); // Give some time for the display to initialize
121+ tft.setBrightness (255 );
116122}
117123
118124void hal_loop (void )
0 commit comments