Skip to content

Commit 413cee3

Browse files
author
MOK
committed
code clean and filter the noise while LCD start up.
1 parent af42e3b commit 413cee3

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

lib/hal/app_hal.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
static const uint32_t screenWidth = WIDTH;
1010
static const uint32_t screenHeight = HEIGHT;
1111

12-
const unsigned int lvBufferSize = screenWidth * 30;
12+
const unsigned int lvBufferSize = screenWidth * screenHeight;
1313
uint8_t lvBuffer[2][lvBufferSize];
1414

1515
static 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

118124
void hal_loop(void)

src/main.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,10 @@
77
* @brief Default main function.
88
******************************************************************************
99
*/
10-
11-
#include "lvgl.h"
10+
#include <Arduino.h>
1211
#include "app_hal.h"
13-
14-
#include "demos/lv_demos.h"
1512
#include "stock_price_gui.h"
16-
17-
#include <Arduino.h>
1813
#include <appController.h>
19-
#include <test.h>
2014
#include <storage.h>
2115

2216

@@ -25,7 +19,7 @@ void setup()
2519
storage_init(); // Initialize storage for persistent data
2620
Serial.begin(115200);
2721

28-
lv_init();
22+
2923
hal_setup();
3024
gui_code_init();
3125
app_controller_init();

0 commit comments

Comments
 (0)