refactor(platform): remove printer debug path and fix boot logo behavior

This commit is contained in:
admin
2026-03-01 15:42:17 +08:00
parent 4f574fb65c
commit 809fcf6548
15 changed files with 39 additions and 328 deletions

View File

@@ -191,18 +191,6 @@ typedef struct {
bool ignore_precheck;
} printer_print_options_t;
typedef struct {
uint16_t shift_clock_high_us;
uint16_t shift_clock_low_us;
uint16_t latch_pulse_us;
bool strobe_active_high;
bool boost_active_high;
uint16_t override_strobe_on_us;
uint16_t override_strobe_interval_us;
uint16_t override_motor_step_us;
uint8_t override_steps_per_line;
} printer_debug_config_t;
typedef struct {
bool busy;
bool has_paper;
@@ -219,14 +207,6 @@ typedef uint32_t printer_status_poll_pause_token_t;
esp_err_t printer_protocol_init(void);
esp_err_t printer_protocol_stop(uint32_t timeout_ms);
esp_err_t printer_protocol_get_debug_config(printer_debug_config_t *out_config,
char *err,
size_t err_len);
esp_err_t printer_protocol_set_debug_config(const printer_debug_config_t *config,
bool reset_defaults,
char *err,
size_t err_len);
void printer_protocol_get_runtime_status(printer_runtime_status_t *out_status);
printer_status_poll_pause_token_t printer_protocol_status_poll_pause_acquire(void);
void printer_protocol_status_poll_pause_release(printer_status_poll_pause_token_t *token);

View File

@@ -115,8 +115,7 @@ static BaseType_t printer_create_task_prefer_psram(TaskFunction_t task_fn,
uint32_t stack_size,
UBaseType_t priority,
TaskHandle_t *out_task) {
#if defined(CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY) && \
defined(CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM) && \
#if defined(CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM) && \
(configSUPPORT_STATIC_ALLOCATION == 1)
BaseType_t rc = xTaskCreatePinnedToCoreWithCaps(task_fn,
name,

View File

@@ -1,66 +1,10 @@
#include "domain.h"
#include "printer_protocol_internal.h"
#include <stdio.h>
static void write_err(char *err, size_t err_len, const char *msg) {
if (err != NULL && err_len > 0) {
snprintf(err, err_len, "%s", msg);
}
}
esp_err_t printer_protocol_gap_move(uint32_t timeout_ms, char *err, size_t err_len) {
return platform_printer_gap_move(timeout_ms, err, err_len);
}
esp_err_t printer_protocol_get_debug_config(printer_debug_config_t *out_config,
char *err,
size_t err_len) {
if (out_config == NULL) {
write_err(err, err_len, "invalid args");
return ESP_ERR_INVALID_ARG;
}
esp_err_t rc = platform_printer_get_debug_config(&out_config->shift_clock_high_us,
&out_config->shift_clock_low_us,
&out_config->latch_pulse_us,
&out_config->strobe_active_high,
&out_config->boost_active_high,
&out_config->override_strobe_on_us,
&out_config->override_strobe_interval_us,
&out_config->override_motor_step_us,
&out_config->override_steps_per_line);
if (rc != ESP_OK) {
write_err(err, err_len, "get printer debug config failed");
return rc;
}
return ESP_OK;
}
esp_err_t printer_protocol_set_debug_config(const printer_debug_config_t *config,
bool reset_defaults,
char *err,
size_t err_len) {
if (config == NULL && !reset_defaults) {
write_err(err, err_len, "invalid args");
return ESP_ERR_INVALID_ARG;
}
return platform_printer_set_debug_config(config != NULL,
config != NULL ? config->shift_clock_high_us : 0,
config != NULL ? config->shift_clock_low_us : 0,
config != NULL ? config->latch_pulse_us : 0,
config != NULL ? config->strobe_active_high : false,
config != NULL ? config->boost_active_high : false,
config != NULL ? config->override_strobe_on_us : 0,
config != NULL ? config->override_strobe_interval_us : 0,
config != NULL ? config->override_motor_step_us : 0,
config != NULL ? config->override_steps_per_line : 0,
reset_defaults,
err,
err_len);
}
const char *printer_protocol_job_state_str(print_job_state_t state) {
switch (state) {
case PRINT_JOB_STATE_NONE:

View File

@@ -191,8 +191,7 @@ BaseType_t voice_create_task_prefer_psram(TaskFunction_t task_fn,
BaseType_t rc = pdFAIL;
#if defined(CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY) && \
defined(CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM) && \
#if defined(CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM) && \
(configSUPPORT_STATIC_ALLOCATION == 1)
rc = xTaskCreatePinnedToCoreWithCaps(task_fn,
name,