Update to 2.0.0
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
#ifndef DISPLAY_H
|
||||
#define DISPLAY_H
|
||||
|
||||
#include "emoji_collection.h"
|
||||
|
||||
#ifdef LVGL_VERSION_MAJOR
|
||||
#define HAVE_LVGL 1
|
||||
#include <lvgl.h>
|
||||
#endif
|
||||
|
||||
#include <esp_timer.h>
|
||||
#include <esp_log.h>
|
||||
#include <esp_pm.h>
|
||||
@@ -9,10 +15,14 @@
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
|
||||
struct DisplayFonts {
|
||||
const lv_font_t* text_font = nullptr;
|
||||
const lv_font_t* icon_font = nullptr;
|
||||
const lv_font_t* emoji_font = nullptr;
|
||||
class Theme {
|
||||
public:
|
||||
Theme(const std::string& name) : name_(name) {}
|
||||
virtual ~Theme() = default;
|
||||
|
||||
inline std::string name() const { return name_; }
|
||||
private:
|
||||
std::string name_;
|
||||
};
|
||||
|
||||
class Display {
|
||||
@@ -25,12 +35,10 @@ public:
|
||||
virtual void ShowNotification(const std::string ¬ification, int duration_ms = 3000);
|
||||
virtual void SetEmotion(const char* emotion);
|
||||
virtual void SetChatMessage(const char* role, const char* content);
|
||||
virtual void SetMusicInfo(const char* song_name);
|
||||
virtual void SetIcon(const char* icon);
|
||||
virtual void SetPreviewImage(const lv_img_dsc_t* image);
|
||||
virtual void SetTheme(const std::string& theme_name);
|
||||
virtual std::string GetTheme() { return current_theme_name_; }
|
||||
virtual void SetTheme(Theme* theme);
|
||||
virtual Theme* GetTheme() { return current_theme_; }
|
||||
virtual void UpdateStatusBar(bool update_all = false);
|
||||
virtual void SetMusicInfo(const char* song_name);
|
||||
virtual void SetPowerSaveMode(bool on);
|
||||
virtual void start() {}
|
||||
virtual void clearScreen() {} // 清除FFT显示,默认为空实现
|
||||
@@ -42,31 +50,14 @@ public:
|
||||
protected:
|
||||
int width_ = 0;
|
||||
int height_ = 0;
|
||||
|
||||
esp_pm_lock_handle_t pm_lock_ = nullptr;
|
||||
lv_display_t *display_ = nullptr;
|
||||
|
||||
lv_obj_t *emotion_label_ = 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* chat_message_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::string current_theme_name_;
|
||||
|
||||
std::chrono::system_clock::time_point last_status_update_time_;
|
||||
esp_timer_handle_t notification_timer_ = nullptr;
|
||||
Theme* current_theme_ = nullptr;
|
||||
|
||||
friend class DisplayLockGuard;
|
||||
virtual bool Lock(int timeout_ms = 0) = 0;
|
||||
virtual void Unlock() = 0;
|
||||
lv_obj_t* chat_message_label_ = nullptr;
|
||||
lv_obj_t *emotion_label_ = nullptr;
|
||||
};
|
||||
|
||||
|
||||
@@ -93,4 +84,4 @@ private:
|
||||
virtual void Unlock() override {}
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user