feat(product-test): add UART automation flow

This commit is contained in:
admin
2026-04-29 23:39:43 +08:00
parent 9294d72aea
commit d735446547
14 changed files with 2091 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ idf_component_register(
"src/screen_preview.c"
"src/system_runtime.c"
"src/domain_runtime_contracts.c"
"src/product_test_service.c"
"src/voice_interaction.c"
"src/voice_interaction_common.c"
"src/voice_interaction_ws.c"

View File

@@ -177,6 +177,11 @@ typedef struct {
bool has_paper;
int8_t paper_gpio_level;
uint8_t paper_present_level;
bool battery_adc_ready;
bool ntc_adc_ready;
int battery_adc_raw;
int ntc_adc_raw;
uint16_t battery_mv;
uint8_t battery_percent;
float temperature;
uint32_t queue_depth;
@@ -257,6 +262,10 @@ esp_err_t voice_interaction_schedule_session_prewarm(void);
void voice_interaction_get_status(voice_interaction_status_t *out_status);
const char *voice_interaction_dialog_state_str(voice_dialog_state_t state);
// ---------- product_test_service ----------
esp_err_t product_test_service_start(void);
esp_err_t product_test_service_stop(uint32_t timeout_ms);
#ifdef __cplusplus
}
#endif

View File

@@ -45,6 +45,11 @@ typedef struct {
bool has_paper;
int8_t paper_gpio_level;
uint8_t paper_present_level;
bool battery_adc_ready;
bool ntc_adc_ready;
int battery_adc_raw;
int ntc_adc_raw;
uint16_t battery_mv;
uint8_t battery;
float temperature;
int64_t updated_ms;

View File

@@ -22,6 +22,11 @@ parsed_status_t s_status = {
.has_paper = true,
.paper_gpio_level = -1,
.paper_present_level = 0,
.battery_adc_ready = false,
.ntc_adc_ready = false,
.battery_adc_raw = -1,
.ntc_adc_raw = -1,
.battery_mv = 0,
.battery = 100,
.temperature = 25.0f,
.updated_ms = 0,
@@ -96,6 +101,11 @@ static void refresh_printer_status_locked(void) {
s_status.has_paper = sensors.has_paper;
s_status.paper_gpio_level = sensors.paper_gpio_level;
s_status.paper_present_level = sensors.paper_present_level;
s_status.battery_adc_ready = sensors.battery_adc_ready;
s_status.ntc_adc_ready = sensors.ntc_adc_ready;
s_status.battery_adc_raw = sensors.battery_adc_raw;
s_status.ntc_adc_raw = sensors.ntc_adc_raw;
s_status.battery_mv = sensors.battery_mv;
s_status.battery = sensors.battery_percent;
s_status.temperature = sensors.temperature_c;
s_status.updated_ms = sensors.updated_ms;
@@ -133,6 +143,11 @@ static void reset_runtime_state_locked(void) {
s_status.has_paper = true;
s_status.paper_gpio_level = -1;
s_status.paper_present_level = 0;
s_status.battery_adc_ready = false;
s_status.ntc_adc_ready = false;
s_status.battery_adc_raw = -1;
s_status.ntc_adc_raw = -1;
s_status.battery_mv = 0;
s_status.battery = 100;
s_status.temperature = 25.0f;
s_status.updated_ms = 0;
@@ -453,6 +468,11 @@ void printer_protocol_get_runtime_status(printer_runtime_status_t *out_status) {
s_status.has_paper = sensors.has_paper;
s_status.paper_gpio_level = sensors.paper_gpio_level;
s_status.paper_present_level = sensors.paper_present_level;
s_status.battery_adc_ready = sensors.battery_adc_ready;
s_status.ntc_adc_ready = sensors.ntc_adc_ready;
s_status.battery_adc_raw = sensors.battery_adc_raw;
s_status.ntc_adc_raw = sensors.ntc_adc_raw;
s_status.battery_mv = sensors.battery_mv;
s_status.battery = sensors.battery_percent;
s_status.temperature = sensors.temperature_c;
s_status.updated_ms = sensors.updated_ms;
@@ -464,6 +484,11 @@ void printer_protocol_get_runtime_status(printer_runtime_status_t *out_status) {
out_status->has_paper = s_status.has_paper;
out_status->paper_gpio_level = s_status.paper_gpio_level;
out_status->paper_present_level = s_status.paper_present_level;
out_status->battery_adc_ready = s_status.battery_adc_ready;
out_status->ntc_adc_ready = s_status.ntc_adc_ready;
out_status->battery_adc_raw = s_status.battery_adc_raw;
out_status->ntc_adc_raw = s_status.ntc_adc_raw;
out_status->battery_mv = s_status.battery_mv;
out_status->battery_percent = s_status.battery;
out_status->temperature = s_status.temperature;
out_status->last_status_ms = s_status.updated_ms;

View File

@@ -48,6 +48,9 @@ static uint16_t density_to_hot_time(const char *density) {
if (density == NULL) {
return 2000;
}
if (strcmp(density, "test") == 0) {
return 200;
}
if (strcmp(density, "较淡") == 0) {
return 1000;
}

File diff suppressed because it is too large Load Diff