refactor(logging): remove remote logging subsystem
This commit is contained in:
@@ -17,7 +17,6 @@ idf_component_register(
|
||||
"src/runtime/control_plane_network_feedback.c"
|
||||
"src/runtime/control_plane_key_input.c"
|
||||
"src/runtime/control_plane_reset_service.c"
|
||||
"src/runtime/control_plane_remote_log_service.c"
|
||||
"src/runtime/control_plane_runtime_workers.c"
|
||||
"src/runtime/control_plane_ota.c"
|
||||
"src/runtime/control_plane_factory_cli.c"
|
||||
|
||||
@@ -187,10 +187,3 @@ esp_err_t control_plane_schedule_websocket_wait_task(void);
|
||||
void control_plane_set_ptt_active(bool active);
|
||||
void control_plane_set_ptt_active_from_local_wake(void);
|
||||
esp_err_t control_plane_enter_mini_program_reprovisioning(const char *reason);
|
||||
|
||||
esp_err_t control_plane_remote_log_start(void);
|
||||
void control_plane_remote_log_stop(int timeout_ms);
|
||||
void control_plane_remote_log_set_light_standby(bool standby);
|
||||
esp_err_t control_plane_remote_log_flush_now(void);
|
||||
esp_err_t control_plane_remote_log_clear(void);
|
||||
esp_err_t control_plane_remote_log_format_status(char *out, size_t out_len);
|
||||
|
||||
@@ -561,41 +561,6 @@ static void handle_prepare_rotate(uint32_t key_version)
|
||||
cli_write_ok();
|
||||
}
|
||||
|
||||
static void handle_log_command(size_t argc, char *argv[])
|
||||
{
|
||||
if (argc < 2 || is_text_empty(argv[1])) {
|
||||
cli_write_error("missing_log_command");
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "status") == 0) {
|
||||
char json[FACTORY_CLI_JSON_MAX_LEN] = {0};
|
||||
esp_err_t err = control_plane_remote_log_format_status(json, sizeof(json));
|
||||
if (err != ESP_OK) {
|
||||
cli_write_error("log_status_failed");
|
||||
return;
|
||||
}
|
||||
cli_write_line(json);
|
||||
cli_write_ok();
|
||||
} else if (strcmp(argv[1], "flush") == 0) {
|
||||
esp_err_t err = control_plane_remote_log_flush_now();
|
||||
if (err != ESP_OK) {
|
||||
cli_write_error("log_flush_failed");
|
||||
return;
|
||||
}
|
||||
cli_write_ok();
|
||||
} else if (strcmp(argv[1], "clear") == 0) {
|
||||
esp_err_t err = control_plane_remote_log_clear();
|
||||
if (err != ESP_OK) {
|
||||
cli_write_error("log_clear_failed");
|
||||
return;
|
||||
}
|
||||
cli_write_ok();
|
||||
} else {
|
||||
cli_write_error("unknown_log_command");
|
||||
}
|
||||
}
|
||||
|
||||
static void handle_lcd_test(void)
|
||||
{
|
||||
const domain_expression_request_t request = {
|
||||
@@ -692,8 +657,6 @@ static void handle_command_line(char *line)
|
||||
return;
|
||||
}
|
||||
handle_prepare_rotate(key_version);
|
||||
} else if (strcmp(cmd, "log") == 0) {
|
||||
handle_log_command(argc, argv);
|
||||
} else if (strcmp(cmd, "lcd_test") == 0) {
|
||||
handle_lcd_test();
|
||||
} else {
|
||||
|
||||
@@ -67,10 +67,6 @@
|
||||
#define CONFIG_TQ_LIGHT_STANDBY_WIFI_POWER_SAVE 0
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_TQ_LIGHT_STANDBY_PAUSE_REMOTE_LOG_UPLOAD
|
||||
#define CONFIG_TQ_LIGHT_STANDBY_PAUSE_REMOTE_LOG_UPLOAD 0
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_TQ_LIGHT_STANDBY_BATTERY_INTERVAL_SEC
|
||||
#define CONFIG_TQ_LIGHT_STANDBY_BATTERY_INTERVAL_SEC 300
|
||||
#endif
|
||||
@@ -214,9 +210,6 @@ static void control_plane_light_standby_unlock_transition(void)
|
||||
|
||||
static esp_err_t control_plane_light_standby_apply_runtime_policy(bool standby)
|
||||
{
|
||||
#if CONFIG_TQ_LIGHT_STANDBY_PAUSE_REMOTE_LOG_UPLOAD
|
||||
control_plane_remote_log_set_light_standby(standby);
|
||||
#endif
|
||||
#if CONFIG_TQ_BATTERY_ENABLE
|
||||
control_plane_battery_service_set_light_standby(standby);
|
||||
#endif
|
||||
@@ -233,9 +226,6 @@ static esp_err_t control_plane_light_standby_apply_runtime_policy(bool standby)
|
||||
standby ? 1 : 0,
|
||||
esp_err_to_name(wifi_err));
|
||||
if (standby) {
|
||||
#if CONFIG_TQ_LIGHT_STANDBY_PAUSE_REMOTE_LOG_UPLOAD
|
||||
control_plane_remote_log_set_light_standby(false);
|
||||
#endif
|
||||
#if CONFIG_TQ_BATTERY_ENABLE
|
||||
control_plane_battery_service_set_light_standby(false);
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -36,7 +36,6 @@
|
||||
#define CONTROL_PLANE_TASK_MONITOR_TASK_STACK_SIZE (1024 * 4)
|
||||
#define CONTROL_PLANE_TASK_MONITOR_STACK_WARN_BYTES 1024U
|
||||
#define CONTROL_PLANE_TASK_MONITOR_FULL_REPORT_PERIOD 5U
|
||||
#define CONTROL_PLANE_REMOTE_LOG_STOP_WAIT_MS 1500
|
||||
#define CONTROL_PLANE_MODEL_CMD_QUEUE_LEN 4
|
||||
#define CONTROL_PLANE_MODEL_CMD_RECV_TIMEOUT_MS 200
|
||||
#define CONTROL_PLANE_TASK_STOP_WAIT_MS 1500
|
||||
@@ -2750,11 +2749,6 @@ esp_err_t control_plane_start_runtime_workers(void)
|
||||
ESP_LOGI(TAG, "Local wake startup deferred for OTA HTTPS window");
|
||||
}
|
||||
|
||||
esp_err_t remote_log_err = control_plane_remote_log_start();
|
||||
if (remote_log_err != ESP_OK && remote_log_err != ESP_ERR_NOT_SUPPORTED) {
|
||||
ESP_LOGW(TAG, "Remote log start failed: %s", esp_err_to_name(remote_log_err));
|
||||
}
|
||||
|
||||
#if CONFIG_FORTUNE_ENABLE
|
||||
if (control_plane_get_task_handle(&s_daily_fortune_task) == NULL) {
|
||||
control_plane_request_fortune_refresh();
|
||||
@@ -2808,7 +2802,6 @@ void control_plane_stop_event_observer_runtime(void)
|
||||
control_plane_set_runtime_stop_requested(true);
|
||||
control_plane_stop_key_input_task();
|
||||
control_plane_stop_system_event_task();
|
||||
control_plane_remote_log_stop(CONTROL_PLANE_REMOTE_LOG_STOP_WAIT_MS);
|
||||
control_plane_set_runtime_stop_requested(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -337,7 +337,6 @@ bool domain_runtime_slot_feature_switch_is_active(void);
|
||||
|
||||
esp_err_t domain_runtime_prepare_storage(void);
|
||||
esp_err_t domain_runtime_mount_littlefs(void);
|
||||
esp_err_t domain_runtime_mount_logfs(void);
|
||||
void domain_runtime_read_device_identity(char *device_id,
|
||||
size_t device_id_len,
|
||||
char *serial_number,
|
||||
|
||||
@@ -910,11 +910,6 @@ esp_err_t domain_runtime_mount_littlefs(void)
|
||||
return platform_mount_littlefs();
|
||||
}
|
||||
|
||||
esp_err_t domain_runtime_mount_logfs(void)
|
||||
{
|
||||
return platform_mount_logfs();
|
||||
}
|
||||
|
||||
void domain_runtime_read_device_identity(char *device_id,
|
||||
size_t device_id_len,
|
||||
char *serial_number,
|
||||
|
||||
@@ -222,7 +222,6 @@ esp_err_t platform_init(void);
|
||||
esp_err_t platform_prepare_storage(void);
|
||||
bool platform_storage_is_ready(void);
|
||||
esp_err_t platform_mount_littlefs(void);
|
||||
esp_err_t platform_mount_logfs(void);
|
||||
void platform_read_device_identity(char *device_id,
|
||||
size_t device_id_len,
|
||||
char *serial_number,
|
||||
|
||||
@@ -30,12 +30,10 @@
|
||||
#error "CONFIG_TQ_POWER_HOLD_ACTIVE_LEVEL must be defined in Kconfig"
|
||||
#endif
|
||||
|
||||
/* 提示音和运行日志使用独立分区/挂载点,避免日志写入影响只读媒体资源。 */
|
||||
/* 提示音从 gifpack LittleFS 分区读取。 */
|
||||
#define VOICE_PROMPT_DEFAULT_BASE_PATH "/littlefs/audio_prompts"
|
||||
#define VOICE_PROMPT_LITTLEFS_BASE_PATH "/littlefs"
|
||||
#define VOICE_PROMPT_LITTLEFS_PARTITION "gifpack"
|
||||
#define PLATFORM_LOGFS_BASE_PATH "/logfs"
|
||||
#define PLATFORM_LOGFS_PARTITION "logfs"
|
||||
/*
|
||||
* 提示音文件由4字节小端包长头和对应 raw-Opus payload 重复组成;单包上限2KB
|
||||
* 防止损坏文件触发异常分配。帧时长按60ms估算播放总时长,并额外留3秒用于队列
|
||||
@@ -51,8 +49,6 @@ static const char *VOICE_TAG = "voice_prompt";
|
||||
static bool s_power_hold_configured;
|
||||
static bool s_voice_prompt_littlefs_mount_attempted;
|
||||
static esp_err_t s_voice_prompt_littlefs_mount_result = ESP_ERR_INVALID_STATE;
|
||||
static bool s_logfs_mount_attempted;
|
||||
static esp_err_t s_logfs_mount_result = ESP_ERR_INVALID_STATE;
|
||||
|
||||
/* GPIO 掩码集中构造,负数配置代表该板型不使用电源保持引脚。 */
|
||||
static uint64_t power_manager_gpio_bit_mask(int gpio_num)
|
||||
@@ -168,50 +164,6 @@ esp_err_t platform_mount_littlefs(void)
|
||||
return err;
|
||||
}
|
||||
|
||||
esp_err_t platform_mount_logfs(void)
|
||||
{
|
||||
/* 日志分区与提示音分区独立挂载,任一失败不会覆盖另一分区状态。 */
|
||||
if (s_logfs_mount_attempted) {
|
||||
return s_logfs_mount_result;
|
||||
}
|
||||
|
||||
esp_vfs_littlefs_conf_t conf = {
|
||||
.base_path = PLATFORM_LOGFS_BASE_PATH,
|
||||
.partition_label = PLATFORM_LOGFS_PARTITION,
|
||||
.partition = NULL,
|
||||
.format_if_mount_failed = true,
|
||||
.dont_mount = false,
|
||||
};
|
||||
|
||||
esp_err_t err = esp_vfs_littlefs_register(&conf);
|
||||
if (err == ESP_ERR_INVALID_STATE &&
|
||||
esp_littlefs_mounted(PLATFORM_LOGFS_PARTITION)) {
|
||||
err = ESP_OK;
|
||||
}
|
||||
if (err == ESP_OK) {
|
||||
size_t total_bytes = 0;
|
||||
size_t used_bytes = 0;
|
||||
esp_err_t info_err = esp_littlefs_info(PLATFORM_LOGFS_PARTITION,
|
||||
&total_bytes,
|
||||
&used_bytes);
|
||||
if (info_err == ESP_OK) {
|
||||
ESP_LOGI(VOICE_TAG,
|
||||
"LogFS mounted at %s, used=%u total=%u",
|
||||
PLATFORM_LOGFS_BASE_PATH,
|
||||
(unsigned)used_bytes,
|
||||
(unsigned)total_bytes);
|
||||
}
|
||||
} else {
|
||||
ESP_LOGW(VOICE_TAG,
|
||||
"Mount LogFS failed: %s",
|
||||
esp_err_to_name(err));
|
||||
}
|
||||
|
||||
s_logfs_mount_attempted = true;
|
||||
s_logfs_mount_result = err;
|
||||
return err;
|
||||
}
|
||||
|
||||
esp_err_t voice_prompt_play_file(const char *path)
|
||||
{
|
||||
/* 文件采用“长度头 + Opus 数据”帧格式,逐帧送入统一的下行播放管线。 */
|
||||
|
||||
Reference in New Issue
Block a user