feat: LVGL 9.5 upgrade, FTP server, premium AMOLED UI
- Upgraded LVGL from 8.4 to 9.5.0 (new display/input API) - Rewrote DisplayManager for LVGL 9 (lv_display_create, tick callback) - New lv_conf.h for v9.5 with optimized widget selection - Premium dark AMOLED UI with gradient panels, status dots, storage bar - Backend: Wi-Fi from SD JSON, NTP Vienna, SimpleFTPServer on SD_MMC - Removed 6 unused sensor libs, added ArduinoJson + SimpleFTPServer - Build: 19% RAM, 4.6% Flash — verified compilation success
This commit is contained in:
@@ -7,72 +7,37 @@
|
||||
#include <bb_captouch.h>
|
||||
|
||||
/**
|
||||
* @brief High-level manager that initializes and wires up the display, LVGL, and touch input.
|
||||
*
|
||||
* Responsibilities:
|
||||
* - Bring up the panel using Arduino_GFX
|
||||
* - Allocate LVGL draw buffers (prefer PSRAM, fallback to SRAM)
|
||||
* - Register LVGL display and input drivers
|
||||
* - Provide simple helpers for brightness and touch reading
|
||||
* @brief High-level manager for display, LVGL 9 and touch on Kode Dot.
|
||||
*/
|
||||
class DisplayManager {
|
||||
private:
|
||||
// Hardware interfaces
|
||||
Arduino_DataBus *bus;
|
||||
Arduino_CO5300 *gfx;
|
||||
BBCapTouch bbct;
|
||||
|
||||
// LVGL draw buffer and driver handles
|
||||
lv_disp_draw_buf_t draw_buf;
|
||||
lv_color_t *buf;
|
||||
lv_color_t *buf2;
|
||||
lv_disp_drv_t disp_drv;
|
||||
|
||||
// Static callbacks required by LVGL
|
||||
static void disp_flush_callback(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p);
|
||||
static void touchpad_read_callback(lv_indev_drv_t *indev_drv, lv_indev_data_t *data);
|
||||
|
||||
// Singleton-like back-reference used by static callbacks
|
||||
static DisplayManager* instance;
|
||||
Arduino_CO5300 *gfx;
|
||||
BBCapTouch bbct;
|
||||
|
||||
// LVGL 9 handles
|
||||
lv_display_t *lv_disp;
|
||||
lv_indev_t *lv_touch;
|
||||
uint8_t *buf1;
|
||||
uint8_t *buf2;
|
||||
|
||||
// Static callbacks
|
||||
static void disp_flush_cb(lv_display_t *disp, const lv_area_t *area, uint8_t *px_map);
|
||||
static void touch_read_cb(lv_indev_t *indev, lv_indev_data_t *data);
|
||||
|
||||
static DisplayManager *instance;
|
||||
|
||||
public:
|
||||
DisplayManager();
|
||||
~DisplayManager();
|
||||
|
||||
/**
|
||||
* @brief Fully initialize display, LVGL, and touch.
|
||||
* @return true on success, false otherwise
|
||||
*/
|
||||
|
||||
bool init();
|
||||
|
||||
/**
|
||||
* @brief Get the underlying Arduino_GFX panel instance.
|
||||
*/
|
||||
Arduino_CO5300* getGfx() { return gfx; }
|
||||
|
||||
/**
|
||||
* @brief Get the touch controller instance.
|
||||
*/
|
||||
BBCapTouch* getTouch() { return &bbct; }
|
||||
|
||||
/**
|
||||
* @brief Pump LVGL timers and tick. Call frequently in loop().
|
||||
*/
|
||||
void update();
|
||||
|
||||
/**
|
||||
* @brief Set backlight brightness.
|
||||
* @param brightness Range 0-255
|
||||
*/
|
||||
void setBrightness(uint8_t brightness);
|
||||
|
||||
/**
|
||||
* @brief Read current touch coordinates.
|
||||
* @param x Output X coordinate
|
||||
* @param y Output Y coordinate
|
||||
* @return true if there is an active touch
|
||||
*/
|
||||
bool getTouchCoordinates(int16_t &x, int16_t &y);
|
||||
|
||||
Arduino_CO5300 *getGfx() { return gfx; }
|
||||
BBCapTouch *getTouch() { return &bbct; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user