refactor(printer): remove controller legacy and unify printer naming
This commit is contained in:
@@ -25,17 +25,9 @@ bool domain_policy_is_retryable_error(esp_err_t err);
|
||||
|
||||
uint32_t domain_policy_printer_stop_timeout_ms(void);
|
||||
|
||||
uint32_t domain_policy_rest_printer_connect_timeout_ms(void);
|
||||
uint32_t domain_policy_rest_printer_connect_timeout_min_ms(void);
|
||||
uint32_t domain_policy_rest_printer_connect_timeout_max_ms(void);
|
||||
|
||||
uint32_t domain_policy_rest_label_timeout_ms(void);
|
||||
uint32_t domain_policy_rest_label_timeout_min_ms(void);
|
||||
uint32_t domain_policy_rest_label_timeout_max_ms(void);
|
||||
|
||||
uint32_t domain_policy_rest_ota_timeout_ms(void);
|
||||
uint32_t domain_policy_rest_ota_timeout_min_ms(void);
|
||||
uint32_t domain_policy_rest_ota_timeout_max_ms(void);
|
||||
uint32_t domain_policy_printer_connect_timeout_ms(void);
|
||||
uint32_t domain_policy_printer_connect_timeout_min_ms(void);
|
||||
uint32_t domain_policy_printer_connect_timeout_max_ms(void);
|
||||
|
||||
uint32_t domain_policy_image_generation_timeout_default_ms(void);
|
||||
uint32_t domain_policy_image_generation_timeout_min_ms(void);
|
||||
@@ -65,8 +57,6 @@ typedef enum {
|
||||
DOMAIN_DIAG_COUNTER_IMAGE_GENERATE_SUCCESS,
|
||||
DOMAIN_DIAG_COUNTER_IMAGE_GENERATE_FAILED,
|
||||
DOMAIN_DIAG_COUNTER_IMAGE_GENERATE_TIMEOUT,
|
||||
DOMAIN_DIAG_COUNTER_REST_RESPONSES_TOTAL,
|
||||
DOMAIN_DIAG_COUNTER_REST_ERRORS_TOTAL,
|
||||
DOMAIN_DIAG_COUNTER_MAX,
|
||||
} domain_diag_counter_t;
|
||||
|
||||
@@ -201,23 +191,7 @@ typedef struct {
|
||||
} print_job_info_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t major;
|
||||
uint8_t minor;
|
||||
uint8_t patch;
|
||||
} printer_ota_version_t;
|
||||
|
||||
typedef enum {
|
||||
PRINTER_BACKEND_DIRECT = 0,
|
||||
} printer_backend_t;
|
||||
|
||||
typedef struct {
|
||||
printer_backend_t backend;
|
||||
const char *name;
|
||||
uint32_t timeout_ms;
|
||||
} printer_connect_options_t;
|
||||
|
||||
typedef struct {
|
||||
// Direct backend only: bypass paper/temp/battery precheck for this print job.
|
||||
// Printer-only option: bypass paper/temp/battery precheck for this print job.
|
||||
bool direct_ignore_precheck;
|
||||
} printer_print_options_t;
|
||||
|
||||
@@ -234,25 +208,13 @@ typedef struct {
|
||||
} printer_direct_debug_config_t;
|
||||
|
||||
typedef struct {
|
||||
bool supports_connect;
|
||||
bool supports_gap_move;
|
||||
bool supports_label_offset;
|
||||
bool supports_ota;
|
||||
} printer_capabilities_t;
|
||||
|
||||
typedef struct {
|
||||
printer_backend_t backend;
|
||||
bool connected;
|
||||
bool transport_ready;
|
||||
bool busy;
|
||||
bool has_paper;
|
||||
int8_t paper_gpio_level;
|
||||
uint8_t paper_present_level;
|
||||
uint8_t battery_percent;
|
||||
float temperature;
|
||||
bool supports_gap_move;
|
||||
bool supports_label_offset;
|
||||
bool supports_ota;
|
||||
uint32_t queue_depth;
|
||||
int64_t last_status_ms;
|
||||
} printer_runtime_status_t;
|
||||
@@ -262,13 +224,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_set_backend(printer_backend_t backend, char *err, size_t err_len);
|
||||
printer_backend_t printer_protocol_get_backend(void);
|
||||
|
||||
esp_err_t printer_protocol_connect(const char *target_name, uint32_t timeout_ms);
|
||||
esp_err_t printer_protocol_connect_ex(const printer_connect_options_t *opt, char *err, size_t err_len);
|
||||
void printer_protocol_disconnect(void);
|
||||
void printer_protocol_get_capabilities(printer_capabilities_t *out_capabilities);
|
||||
esp_err_t printer_protocol_get_direct_debug_config(printer_direct_debug_config_t *out_config,
|
||||
char *err,
|
||||
size_t err_len);
|
||||
@@ -305,23 +260,6 @@ esp_err_t printer_protocol_cancel_job(uint32_t job_id, char *err, size_t err_len
|
||||
size_t printer_protocol_cleanup_jobs(bool include_success, bool include_failed, bool include_canceled);
|
||||
|
||||
esp_err_t printer_protocol_gap_move(uint32_t timeout_ms, char *err, size_t err_len);
|
||||
esp_err_t printer_protocol_get_label_offset(uint8_t *out_offset, uint32_t timeout_ms, char *err, size_t err_len);
|
||||
esp_err_t printer_protocol_set_label_offset(uint8_t offset, uint32_t timeout_ms, char *err, size_t err_len);
|
||||
|
||||
esp_err_t printer_protocol_ota_jump_boot(uint32_t timeout_ms, char *err, size_t err_len);
|
||||
esp_err_t printer_protocol_ota_jump_app(uint32_t timeout_ms, char *err, size_t err_len);
|
||||
esp_err_t printer_protocol_ota_erase_page(uint16_t page_num, uint32_t timeout_ms, char *err, size_t err_len);
|
||||
esp_err_t printer_protocol_ota_write_frame(uint16_t packet_num,
|
||||
bool is_last_frame,
|
||||
const uint8_t *data,
|
||||
size_t data_len,
|
||||
uint32_t timeout_ms,
|
||||
char *err,
|
||||
size_t err_len);
|
||||
esp_err_t printer_protocol_ota_get_version(printer_ota_version_t *out_version,
|
||||
uint32_t timeout_ms,
|
||||
char *err,
|
||||
size_t err_len);
|
||||
|
||||
const char *printer_protocol_job_state_str(print_job_state_t state);
|
||||
|
||||
|
||||
@@ -42,10 +42,6 @@ static runtime_diag_counter_t to_platform_counter(domain_diag_counter_t counter)
|
||||
return RUNTIME_DIAG_COUNTER_IMAGE_GENERATE_FAILED;
|
||||
case DOMAIN_DIAG_COUNTER_IMAGE_GENERATE_TIMEOUT:
|
||||
return RUNTIME_DIAG_COUNTER_IMAGE_GENERATE_TIMEOUT;
|
||||
case DOMAIN_DIAG_COUNTER_REST_RESPONSES_TOTAL:
|
||||
return RUNTIME_DIAG_COUNTER_REST_RESPONSES_TOTAL;
|
||||
case DOMAIN_DIAG_COUNTER_REST_ERRORS_TOTAL:
|
||||
return RUNTIME_DIAG_COUNTER_REST_ERRORS_TOTAL;
|
||||
default:
|
||||
return RUNTIME_DIAG_COUNTER_MAX;
|
||||
}
|
||||
@@ -80,39 +76,15 @@ uint32_t domain_policy_printer_stop_timeout_ms(void) {
|
||||
return runtime_policy_printer_stop_timeout_ms();
|
||||
}
|
||||
|
||||
uint32_t domain_policy_rest_printer_connect_timeout_ms(void) {
|
||||
return runtime_policy_rest_printer_connect_timeout_ms();
|
||||
uint32_t domain_policy_printer_connect_timeout_ms(void) {
|
||||
return runtime_policy_printer_connect_timeout_ms();
|
||||
}
|
||||
|
||||
uint32_t domain_policy_rest_printer_connect_timeout_min_ms(void) {
|
||||
uint32_t domain_policy_printer_connect_timeout_min_ms(void) {
|
||||
return 1000;
|
||||
}
|
||||
|
||||
uint32_t domain_policy_rest_printer_connect_timeout_max_ms(void) {
|
||||
return 60000;
|
||||
}
|
||||
|
||||
uint32_t domain_policy_rest_label_timeout_ms(void) {
|
||||
return runtime_policy_rest_label_timeout_ms();
|
||||
}
|
||||
|
||||
uint32_t domain_policy_rest_label_timeout_min_ms(void) {
|
||||
return 500;
|
||||
}
|
||||
|
||||
uint32_t domain_policy_rest_label_timeout_max_ms(void) {
|
||||
return 30000;
|
||||
}
|
||||
|
||||
uint32_t domain_policy_rest_ota_timeout_ms(void) {
|
||||
return runtime_policy_rest_ota_timeout_ms();
|
||||
}
|
||||
|
||||
uint32_t domain_policy_rest_ota_timeout_min_ms(void) {
|
||||
return 500;
|
||||
}
|
||||
|
||||
uint32_t domain_policy_rest_ota_timeout_max_ms(void) {
|
||||
uint32_t domain_policy_printer_connect_timeout_max_ms(void) {
|
||||
return 60000;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ TaskHandle_t s_worker_task;
|
||||
TaskHandle_t s_status_poll_task_handle;
|
||||
bool s_protocol_initialized;
|
||||
bool s_protocol_stopping;
|
||||
printer_backend_t s_backend = PRINTER_BACKEND_DIRECT;
|
||||
|
||||
static const char *TAG = "printer_protocol";
|
||||
|
||||
@@ -44,25 +43,7 @@ static const char *TAG = "printer_protocol";
|
||||
#define PRINT_WORKER_CORE_ID 1
|
||||
#endif
|
||||
|
||||
static printer_backend_t default_backend_on_startup(void) {
|
||||
return PRINTER_BACKEND_DIRECT;
|
||||
}
|
||||
|
||||
static void backend_capabilities_for(printer_backend_t backend, printer_capabilities_t *out_caps) {
|
||||
if (out_caps == NULL) {
|
||||
return;
|
||||
}
|
||||
memset(out_caps, 0, sizeof(*out_caps));
|
||||
out_caps->supports_connect = (backend == PRINTER_BACKEND_DIRECT);
|
||||
out_caps->supports_gap_move = (backend == PRINTER_BACKEND_DIRECT);
|
||||
out_caps->supports_label_offset = false;
|
||||
out_caps->supports_ota = false;
|
||||
}
|
||||
|
||||
static esp_err_t ensure_backend_ready(printer_backend_t backend) {
|
||||
if (backend != PRINTER_BACKEND_DIRECT) {
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
static esp_err_t ensure_direct_backend_ready(void) {
|
||||
if (!runtime_policy_direct_printer_enabled()) {
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
@@ -361,16 +342,15 @@ esp_err_t printer_protocol_init(void) {
|
||||
runtime_diag_set_gauge(RUNTIME_DIAG_GAUGE_PRINTER_QUEUE_DEPTH, 0);
|
||||
s_protocol_initialized = true;
|
||||
s_protocol_stopping = false;
|
||||
s_backend = default_backend_on_startup();
|
||||
|
||||
esp_err_t err = ensure_backend_ready(s_backend);
|
||||
esp_err_t err = ensure_direct_backend_ready();
|
||||
if (err != ESP_OK) {
|
||||
s_protocol_initialized = false;
|
||||
destroy_runtime_objects();
|
||||
return err;
|
||||
}
|
||||
|
||||
uint32_t connect_timeout_ms = domain_policy_rest_printer_connect_timeout_ms();
|
||||
uint32_t connect_timeout_ms = domain_policy_printer_connect_timeout_ms();
|
||||
err = platform_direct_printer_connect(connect_timeout_ms);
|
||||
if (err != ESP_OK) {
|
||||
s_protocol_initialized = false;
|
||||
@@ -384,7 +364,7 @@ esp_err_t printer_protocol_init(void) {
|
||||
refresh_direct_status_locked();
|
||||
xSemaphoreGive(s_mutex);
|
||||
}
|
||||
ESP_LOGI(TAG, "direct printer auto connected at startup");
|
||||
ESP_LOGI(TAG, "printer auto connected at startup");
|
||||
|
||||
BaseType_t ok = printer_create_task_prefer_psram(printer_protocol_worker_task,
|
||||
"print_worker",
|
||||
@@ -484,7 +464,6 @@ esp_err_t printer_protocol_stop(uint32_t timeout_ms) {
|
||||
s_status_poll_task_handle = NULL;
|
||||
s_protocol_initialized = false;
|
||||
s_protocol_stopping = false;
|
||||
s_backend = default_backend_on_startup();
|
||||
|
||||
runtime_diag_set_gauge(RUNTIME_DIAG_GAUGE_STATUS_POLL_PAUSE_DEPTH, 0);
|
||||
runtime_diag_set_gauge(RUNTIME_DIAG_GAUGE_PRINTER_QUEUE_DEPTH, 0);
|
||||
@@ -495,129 +474,6 @@ esp_err_t printer_protocol_stop(uint32_t timeout_ms) {
|
||||
return (worker_done && poll_done) ? ESP_OK : ESP_ERR_TIMEOUT;
|
||||
}
|
||||
|
||||
esp_err_t printer_protocol_set_backend(printer_backend_t backend, char *err, size_t err_len) {
|
||||
if (backend != PRINTER_BACKEND_DIRECT) {
|
||||
if (err != NULL && err_len > 0) {
|
||||
snprintf(err, err_len, "only direct backend is supported");
|
||||
}
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
if (!runtime_policy_direct_printer_enabled()) {
|
||||
if (err != NULL && err_len > 0) {
|
||||
snprintf(err, err_len, "direct backend disabled");
|
||||
}
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
if (!s_protocol_initialized || s_protocol_stopping || s_mutex == NULL) {
|
||||
if (err != NULL && err_len > 0) {
|
||||
snprintf(err, err_len, "printer protocol unavailable");
|
||||
}
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (xSemaphoreTake(s_mutex, pdMS_TO_TICKS(runtime_policy_printer_control_lock_timeout_ms())) != pdTRUE) {
|
||||
if (err != NULL && err_len > 0) {
|
||||
snprintf(err, err_len, "lock timeout");
|
||||
}
|
||||
return ESP_ERR_TIMEOUT;
|
||||
}
|
||||
|
||||
if (s_busy_refcnt != 0 || (s_job_queue != NULL && uxQueueMessagesWaiting(s_job_queue) > 0)) {
|
||||
xSemaphoreGive(s_mutex);
|
||||
if (err != NULL && err_len > 0) {
|
||||
snprintf(err, err_len, "printer busy");
|
||||
}
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
s_backend = PRINTER_BACKEND_DIRECT;
|
||||
xSemaphoreGive(s_mutex);
|
||||
|
||||
esp_err_t rc = ensure_backend_ready(PRINTER_BACKEND_DIRECT);
|
||||
if (rc != ESP_OK) {
|
||||
if (err != NULL && err_len > 0) {
|
||||
snprintf(err, err_len, "direct backend unavailable");
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (xSemaphoreTake(s_mutex, pdMS_TO_TICKS(200)) == pdTRUE) {
|
||||
refresh_direct_status_locked();
|
||||
xSemaphoreGive(s_mutex);
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
printer_backend_t printer_protocol_get_backend(void) {
|
||||
if (!s_protocol_initialized || s_mutex == NULL) {
|
||||
return s_backend;
|
||||
}
|
||||
if (xSemaphoreTake(s_mutex, pdMS_TO_TICKS(100)) != pdTRUE) {
|
||||
return s_backend;
|
||||
}
|
||||
printer_backend_t backend = s_backend;
|
||||
xSemaphoreGive(s_mutex);
|
||||
return backend;
|
||||
}
|
||||
|
||||
esp_err_t printer_protocol_connect(const char *target_name, uint32_t timeout_ms) {
|
||||
printer_connect_options_t opt = {
|
||||
.backend = printer_protocol_get_backend(),
|
||||
.name = target_name,
|
||||
.timeout_ms = timeout_ms,
|
||||
};
|
||||
return printer_protocol_connect_ex(&opt, NULL, 0);
|
||||
}
|
||||
|
||||
esp_err_t printer_protocol_connect_ex(const printer_connect_options_t *opt, char *err, size_t err_len) {
|
||||
if (!s_protocol_initialized || s_protocol_stopping) {
|
||||
if (err != NULL && err_len > 0) {
|
||||
snprintf(err, err_len, "printer protocol unavailable");
|
||||
}
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
printer_backend_t backend = printer_protocol_get_backend();
|
||||
uint32_t timeout_ms = 0;
|
||||
if (opt != NULL) {
|
||||
backend = opt->backend;
|
||||
timeout_ms = opt->timeout_ms;
|
||||
}
|
||||
|
||||
esp_err_t rc = printer_protocol_set_backend(backend, err, err_len);
|
||||
if (rc != ESP_OK) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ensure_backend_ready(PRINTER_BACKEND_DIRECT);
|
||||
if (rc != ESP_OK) {
|
||||
if (err != NULL && err_len > 0) {
|
||||
snprintf(err, err_len, "direct backend unavailable");
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = platform_direct_printer_connect(timeout_ms);
|
||||
if (rc == ESP_OK && s_mutex != NULL && xSemaphoreTake(s_mutex, pdMS_TO_TICKS(200)) == pdTRUE) {
|
||||
refresh_direct_status_locked();
|
||||
xSemaphoreGive(s_mutex);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
void printer_protocol_disconnect(void) {
|
||||
platform_direct_printer_disconnect();
|
||||
}
|
||||
|
||||
void printer_protocol_get_capabilities(printer_capabilities_t *out_capabilities) {
|
||||
if (out_capabilities == NULL) {
|
||||
return;
|
||||
}
|
||||
backend_capabilities_for(printer_protocol_get_backend(), out_capabilities);
|
||||
}
|
||||
|
||||
void printer_protocol_get_runtime_status(printer_runtime_status_t *out_status) {
|
||||
if (out_status == NULL) {
|
||||
return;
|
||||
@@ -625,16 +481,8 @@ void printer_protocol_get_runtime_status(printer_runtime_status_t *out_status) {
|
||||
|
||||
memset(out_status, 0, sizeof(*out_status));
|
||||
out_status->paper_gpio_level = -1;
|
||||
out_status->backend = printer_protocol_get_backend();
|
||||
|
||||
printer_capabilities_t caps = {0};
|
||||
backend_capabilities_for(out_status->backend, &caps);
|
||||
out_status->supports_gap_move = caps.supports_gap_move;
|
||||
out_status->supports_label_offset = caps.supports_label_offset;
|
||||
out_status->supports_ota = caps.supports_ota;
|
||||
|
||||
out_status->connected = platform_direct_printer_is_connected();
|
||||
out_status->transport_ready = out_status->connected;
|
||||
|
||||
platform_printer_sensors_t sensors = {0};
|
||||
if (platform_direct_printer_get_sensors(&sensors) == ESP_OK &&
|
||||
|
||||
@@ -9,73 +9,14 @@ static void write_err(char *err, size_t err_len, const char *msg) {
|
||||
}
|
||||
}
|
||||
|
||||
static esp_err_t unsupported_operation(char *err, size_t err_len, const char *op) {
|
||||
if (err != NULL && err_len > 0) {
|
||||
snprintf(err, err_len, "%s is not supported on direct backend", op);
|
||||
}
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
esp_err_t printer_protocol_gap_move(uint32_t timeout_ms, char *err, size_t err_len) {
|
||||
if (!runtime_policy_direct_printer_enabled()) {
|
||||
write_err(err, err_len, "direct backend disabled");
|
||||
write_err(err, err_len, "printer driver disabled");
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
return platform_direct_printer_gap_move(timeout_ms, err, err_len);
|
||||
}
|
||||
|
||||
esp_err_t printer_protocol_get_label_offset(uint8_t *out_offset, uint32_t timeout_ms, char *err, size_t err_len) {
|
||||
(void)out_offset;
|
||||
(void)timeout_ms;
|
||||
return unsupported_operation(err, err_len, "label offset");
|
||||
}
|
||||
|
||||
esp_err_t printer_protocol_set_label_offset(uint8_t offset, uint32_t timeout_ms, char *err, size_t err_len) {
|
||||
(void)offset;
|
||||
(void)timeout_ms;
|
||||
return unsupported_operation(err, err_len, "label offset");
|
||||
}
|
||||
|
||||
esp_err_t printer_protocol_ota_jump_boot(uint32_t timeout_ms, char *err, size_t err_len) {
|
||||
(void)timeout_ms;
|
||||
return unsupported_operation(err, err_len, "ota jump boot");
|
||||
}
|
||||
|
||||
esp_err_t printer_protocol_ota_jump_app(uint32_t timeout_ms, char *err, size_t err_len) {
|
||||
(void)timeout_ms;
|
||||
return unsupported_operation(err, err_len, "ota jump app");
|
||||
}
|
||||
|
||||
esp_err_t printer_protocol_ota_erase_page(uint16_t page_num, uint32_t timeout_ms, char *err, size_t err_len) {
|
||||
(void)page_num;
|
||||
(void)timeout_ms;
|
||||
return unsupported_operation(err, err_len, "ota erase");
|
||||
}
|
||||
|
||||
esp_err_t printer_protocol_ota_write_frame(uint16_t packet_num,
|
||||
bool is_last_frame,
|
||||
const uint8_t *data,
|
||||
size_t data_len,
|
||||
uint32_t timeout_ms,
|
||||
char *err,
|
||||
size_t err_len) {
|
||||
(void)packet_num;
|
||||
(void)is_last_frame;
|
||||
(void)data;
|
||||
(void)data_len;
|
||||
(void)timeout_ms;
|
||||
return unsupported_operation(err, err_len, "ota write");
|
||||
}
|
||||
|
||||
esp_err_t printer_protocol_ota_get_version(printer_ota_version_t *out_version,
|
||||
uint32_t timeout_ms,
|
||||
char *err,
|
||||
size_t err_len) {
|
||||
(void)out_version;
|
||||
(void)timeout_ms;
|
||||
return unsupported_operation(err, err_len, "ota version");
|
||||
}
|
||||
|
||||
esp_err_t printer_protocol_get_direct_debug_config(printer_direct_debug_config_t *out_config,
|
||||
char *err,
|
||||
size_t err_len) {
|
||||
@@ -84,7 +25,7 @@ esp_err_t printer_protocol_get_direct_debug_config(printer_direct_debug_config_t
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
if (!runtime_policy_direct_printer_enabled()) {
|
||||
write_err(err, err_len, "direct backend disabled");
|
||||
write_err(err, err_len, "printer driver disabled");
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
@@ -98,7 +39,7 @@ esp_err_t printer_protocol_get_direct_debug_config(printer_direct_debug_config_t
|
||||
&out_config->override_motor_step_us,
|
||||
&out_config->override_steps_per_line);
|
||||
if (rc != ESP_OK) {
|
||||
write_err(err, err_len, "get direct debug config failed");
|
||||
write_err(err, err_len, "get printer debug config failed");
|
||||
return rc;
|
||||
}
|
||||
return ESP_OK;
|
||||
@@ -113,7 +54,7 @@ esp_err_t printer_protocol_set_direct_debug_config(const printer_direct_debug_co
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
if (!runtime_policy_direct_printer_enabled()) {
|
||||
write_err(err, err_len, "direct backend disabled");
|
||||
write_err(err, err_len, "printer driver disabled");
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ static bool run_print_job_direct(job_slot_t *job) {
|
||||
} else if (rc == ESP_ERR_INVALID_STATE && job->cancel_requested) {
|
||||
snprintf(job->error, sizeof(job->error), "job canceled");
|
||||
} else {
|
||||
snprintf(job->error, sizeof(job->error), "direct print failed");
|
||||
snprintf(job->error, sizeof(job->error), "printer print failed");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -118,7 +118,7 @@ static bool run_print_job_direct(job_slot_t *job) {
|
||||
|
||||
static bool run_print_job(job_slot_t *job) {
|
||||
ESP_LOGI(TAG,
|
||||
"job %u print start, backend=direct, raster_bytes=%u, size=%ux%u, density=%s, ignore_precheck=%d",
|
||||
"job %u print start, mode=printer, raster_bytes=%u, size=%ux%u, density=%s, ignore_precheck=%d",
|
||||
(unsigned)job->id,
|
||||
(unsigned)job->data_len,
|
||||
(unsigned)job->width,
|
||||
|
||||
Reference in New Issue
Block a user