fix(voice): preview generated png and recover shared spi display/print
This commit is contained in:
@@ -162,6 +162,14 @@ static esp_err_t config_input_pin(int gpio_num, bool pull_up, const char *name)
|
||||
return err;
|
||||
}
|
||||
|
||||
static esp_err_t ensure_shared_shift_pins_gpio_locked(void) {
|
||||
esp_err_t err = config_output_pin(CONFIG_TQ_SPI_SHARED_MOSI_PIN, 0, "print_mosi");
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
return config_output_pin(CONFIG_TQ_SPI_SHARED_CLK_PIN, 0, "print_clk");
|
||||
}
|
||||
|
||||
static void set_stb_level_locked(int level) {
|
||||
int out_level = level ? strobe_active_level_locked() : strobe_idle_level_locked();
|
||||
set_gpio_level_if_valid(CONFIG_TQ_PRINT_STB_12_PIN, out_level);
|
||||
@@ -507,11 +515,7 @@ esp_err_t platform_direct_printer_init(void) {
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
err = config_output_pin(CONFIG_TQ_SPI_SHARED_MOSI_PIN, 0, "print_mosi");
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
err = config_output_pin(CONFIG_TQ_SPI_SHARED_CLK_PIN, 0, "print_clk");
|
||||
err = ensure_shared_shift_pins_gpio_locked();
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
@@ -598,6 +602,11 @@ esp_err_t platform_direct_printer_connect(uint32_t timeout_ms) {
|
||||
}
|
||||
|
||||
if (!s_state.connected) {
|
||||
err = ensure_shared_shift_pins_gpio_locked();
|
||||
if (err != ESP_OK) {
|
||||
xSemaphoreGive(s_state.lock);
|
||||
return err;
|
||||
}
|
||||
set_gpio_level_if_valid(CONFIG_TQ_KEY_PRINT_PIN, boost_on_level_locked());
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
safe_drive_off_locked(true);
|
||||
@@ -837,6 +846,14 @@ esp_err_t platform_direct_printer_print(const platform_direct_print_request_t *r
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
esp_err_t rc = ensure_shared_shift_pins_gpio_locked();
|
||||
if (rc != ESP_OK) {
|
||||
safe_drive_off_locked(true);
|
||||
xSemaphoreGive(s_state.lock);
|
||||
write_err(err, err_len, "direct printer gpio setup failed");
|
||||
return rc;
|
||||
}
|
||||
|
||||
uint16_t strobe_on_us = (request->strobe_on_time_us > 0)
|
||||
? request->strobe_on_time_us
|
||||
: runtime_policy_direct_printer_strobe_on_us();
|
||||
@@ -863,7 +880,7 @@ esp_err_t platform_direct_printer_print(const platform_direct_print_request_t *r
|
||||
steps_per_line = s_state.debug.override_steps_per_line;
|
||||
}
|
||||
|
||||
esp_err_t rc = ESP_OK;
|
||||
rc = ESP_OK;
|
||||
if (!request->ignore_precheck) {
|
||||
rc = precheck_before_print_locked(err, err_len);
|
||||
if (rc != ESP_OK) {
|
||||
|
||||
Reference in New Issue
Block a user