#ifndef __LVGL_INIT_H__ #define __LVGL_INIT_H__ #include "config.h" #define extraflash_flag (1 << 0) #define NOTIFY_EXIT_ALL_MODES 0xFFFE /* 下载成功后按路径播放:request_play_lottie_path 写入路径,change_task 收到 0xFFFF 时从此缓冲区取路径播放 */ #define NOTIFY_PLAY_BY_PATH 0xFFFF /* 动画完成回调中不能持锁切换,由 change_task 延迟执行 */ #define NOTIFY_RESUME_MUSIC_LOOP 0xFFFC #define NOTIFY_MUSIC_INTRO_DONE 0xFFFB #define NOTIFY_SENTINEL_DO_SWITCH 0xFFFA #define NOTIFY_SWITCH_BY_QUEUE 0xFFF9 #define NOTIFY_MUSIC_LISTEN_ANOTHER_PASS 0xFFF8 #define NOTIFY_MUSIC_REPLAY_INTRO 0xFFF7 #define NOTIFY_ACTION_QUEUE_READY 0xFFF6 #define NOTIFY_RESUME_CALLING_LOOP 0xFFF5 /* 通话中插播表情时收到挂断:等插播播完后由 completed_cb 通知,再回默认 */ #define NOTIFY_DEFERRED_HANGUP 0xFFF4 #define NOTIFY_START_AI_RESPOND_LOOP 0xFFF3 #define NOTIFY_RESUME_AI_RESPOND_LOOP 0xFFF2 #define LOTTIE_BUF_SIZE (LOTTIE_ANIM_WIDTH * LOTTIE_ANIM_HEIGHT * 4) extern char *lottie_file_path; extern int lottie_id; extern int last_lottie_id; /* 系统主初始化流程完成标志:true 后才允许处理 BLE 业务指令 */ extern volatile bool g_system_init_done; /** BLE play_sticker 正在展示表情时置 true,回到默认等场景清 false;IMU 幸运表情需检查此标志 */ extern volatile bool g_ble_play_sticker_active; /* BLE play_sticker 单槽覆盖队列:播放中收到新指令时,仅保留最后一条,待当前动画播完后切换 */ extern volatile bool g_ble_play_sticker_pending_valid; extern volatile uint16_t g_ble_play_sticker_pending_action_id; extern volatile uint8_t g_ble_play_sticker_pending_direction; /* KTV 持续循环播放态标志(用于 BLE 直通插播判断) */ extern volatile bool g_is_ktv_playing; extern bool back2default; extern bool first_display; extern StackType_t *main_task_stack; extern StaticTask_t main_task_tcb; extern _lock_t lvgl_api_lock; extern esp_lcd_panel_handle_t panel_handle; extern esp_lcd_panel_io_handle_t io_handle; extern const qspi_amoled_lcd_init_cmd_t lcd_init_cmds[9]; extern volatile char g_target_path[32]; extern TaskHandle_t change_task_handle; /** 当前任务是否为 LVGL port 任务(该任务上调用 LVGL API 时通常已持有 lvgl_api_lock) */ bool lvgl_port_task_is_current(void); extern esp_lcd_panel_handle_t panel_handle; extern const char *lottie_files[]; extern int64_t last_activity_timestamp; extern bool block_auto_sleep; /** 表情包下载流程进行中:收到新的下载指令时应忽略(避免并发) */ extern volatile bool g_emoji_download_in_progress; /** 刷新自动休眠空闲时间戳(触摸、BLE 指令等) */ void system_keep_alive(void); /** 设置是否阻止自动休眠(OTA / 配网等场景使用) */ void set_block_auto_sleep(bool block); typedef struct { wakenet_state_t wakenet_mode; esp_mn_state_t state; int command_id; } sr_result_t; void set_lottie_id(int id); void lottie_init(void); esp_err_t app_sr_init(void); esp_err_t app_lcd_init(void); esp_err_t app_lvgl_init(void); esp_err_t app_change_init(void); esp_err_t BMI_init(void); void switch_lottie_animation(int anim_index); void load_brightness_from_nvs(void); /** 将设置页亮度滑条与 get_system_brightness_percent() 对齐;可从任意任务调用,内部经 lv_async_call 投递到 LVGL 线程 */ void request_brightness_slider_sync(void); esp_err_t app_touch_init(void); void switch_lottie_animation_cross_path(const char *emoji_path); void random_emoji(uint16_t n); void request_play_lottie_path(const char *path); void set_current_lottie_range_ratio(float start_ratio, float end_ratio); void lvgl_deinit_for_wifi(void); /* 向 change_task 投递 BLE 动作指令(队列化,避免与音乐内部通知互相覆盖) */ bool change_task_post_action(uint16_t action_id); /** 获取当前正在展示的 Lottie 路径(升级快照等场景使用) */ const char *lvgl_get_current_lottie_path(void); /** 清空当前路径缓存(用于强制重播同一路径) */ void lvgl_clear_current_lottie_path(void); void lottie_anim_completed_cb(lv_anim_t *anim); bool example_notify_lvgl_flush_ready(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx); #endif