mirror of
https://github.com/78/xiaozhi-esp32.git
synced 2026-07-21 02:05:52 +00:00
* feat: migrate firmware to xiaozhi-fonts 2.0.0 * fix: restart scrolling subtitles on text change * docs: add AGENTS.md for project overview, architecture, rules, and commands - Introduced AGENTS.md to document the XiaoZhi voice-assistant firmware architecture, required rules for development, board configuration process, and validation steps. - Included detailed sections on project structure, commands for building and testing, and authoritative documentation references. * feat: finalize glyph push protocol * fix: remove stale emoji font include * build: use xiaozhi-fonts 2.0.0 * fix: decouple custom fonts from glyph push * refactor: improve wake word invocation handling - Introduced BeginWakeWordInvoke method to streamline the wake word processing flow. - Updated HandleWakeWordDetectedEvent to utilize the new method, ensuring proper state transitions and scheduling. - Enhanced error handling to prevent the device from getting stuck in the connecting state. - Refactored audio channel management to improve responsiveness during wake word detection. --------- Co-authored-by: Xiaoxia <terrence.huang@tenclass.com>
61 lines
1.8 KiB
C++
61 lines
1.8 KiB
C++
#ifndef LVGL_DISPLAY_H
|
|
#define LVGL_DISPLAY_H
|
|
|
|
#include "display.h"
|
|
#include "lvgl_image.h"
|
|
|
|
#include <esp_log.h>
|
|
#include <esp_pm.h>
|
|
#include <esp_timer.h>
|
|
#include <lvgl.h>
|
|
|
|
#include <chrono>
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
class DynamicGlyphCache;
|
|
class LvglFont;
|
|
|
|
class LvglDisplay : public Display {
|
|
public:
|
|
LvglDisplay();
|
|
virtual ~LvglDisplay();
|
|
|
|
virtual void SetStatus(const char* status);
|
|
virtual void ShowNotification(const char* notification, int duration_ms = 3000);
|
|
virtual void ShowNotification(const std::string& notification, int duration_ms = 3000);
|
|
virtual void SetPreviewImage(std::unique_ptr<LvglImage> image);
|
|
virtual void UpdateStatusBar(bool update_all = false);
|
|
virtual void SetPowerSaveMode(bool on);
|
|
virtual bool SnapshotToJpeg(std::string& jpeg_data, int quality = 80);
|
|
virtual bool AddTextGlyphs(const std::vector<TextGlyph>& glyphs, uint8_t bpp) override;
|
|
virtual void ClearTextGlyphs() override;
|
|
bool SetTextFont(std::shared_ptr<LvglFont> text_font);
|
|
|
|
protected:
|
|
esp_pm_lock_handle_t pm_lock_ = nullptr;
|
|
lv_display_t* display_ = nullptr;
|
|
|
|
lv_obj_t* network_label_ = nullptr;
|
|
lv_obj_t* status_label_ = nullptr;
|
|
lv_obj_t* notification_label_ = nullptr;
|
|
lv_obj_t* mute_label_ = nullptr;
|
|
lv_obj_t* battery_label_ = nullptr;
|
|
lv_obj_t* low_battery_popup_ = nullptr;
|
|
lv_obj_t* low_battery_label_ = nullptr;
|
|
|
|
const char* battery_icon_ = nullptr;
|
|
const char* network_icon_ = nullptr;
|
|
bool muted_ = false;
|
|
|
|
std::chrono::system_clock::time_point last_status_update_time_;
|
|
esp_timer_handle_t notification_timer_ = nullptr;
|
|
std::unique_ptr<DynamicGlyphCache> dynamic_glyph_cache_;
|
|
|
|
friend class DisplayLockGuard;
|
|
virtual bool Lock(int timeout_ms = 0) = 0;
|
|
virtual void Unlock() = 0;
|
|
};
|
|
|
|
#endif
|