feat(perf): accelerate image download and raster conversion

This commit is contained in:
admin
2026-02-25 16:14:04 +08:00
parent 7965818d13
commit 528f901fb5
6 changed files with 430 additions and 49 deletions

View File

@@ -20,6 +20,30 @@ static int s_retry_num;
static bool s_ready;
static esp_netif_t *s_sta_netif;
static void wifi_manager_apply_sta_throughput_profile(void) {
const uint8_t protocol = WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N;
esp_err_t proto_rc = esp_wifi_set_protocol(WIFI_IF_STA, protocol);
if (proto_rc != ESP_OK) {
ESP_LOGW(TAG, "failed to set 11bgn protocol mask, rc=0x%x", (unsigned)proto_rc);
} else {
ESP_LOGI(TAG, "Wi-Fi protocol mask set to 11b/11g/11n");
}
esp_err_t bw_rc = esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT40);
if (bw_rc == ESP_OK) {
ESP_LOGI(TAG, "Wi-Fi bandwidth set to HT40");
return;
}
ESP_LOGW(TAG, "failed to set HT40, fallback to HT20, rc=0x%x", (unsigned)bw_rc);
bw_rc = esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT20);
if (bw_rc != ESP_OK) {
ESP_LOGW(TAG, "failed to set HT20 fallback, rc=0x%x", (unsigned)bw_rc);
} else {
ESP_LOGI(TAG, "Wi-Fi bandwidth set to HT20");
}
}
static void wifi_event_handler(void *arg,
esp_event_base_t event_base,
int32_t event_id,
@@ -78,6 +102,13 @@ static esp_err_t start_sta_mode(void) {
if (bits & WIFI_CONNECTED_BIT) {
ESP_LOGI(TAG, "connected to AP SSID:%s", CONFIG_TQ_WIFI_SSID);
wifi_manager_apply_sta_throughput_profile();
esp_err_t ps_rc = esp_wifi_set_ps(WIFI_PS_NONE);
if (ps_rc == ESP_OK) {
ESP_LOGI(TAG, "Wi-Fi power save disabled (WIFI_PS_NONE)");
} else {
ESP_LOGW(TAG, "failed to set WIFI_PS_NONE, rc=0x%x", (unsigned)ps_rc);
}
s_ready = true;
return ESP_OK;
}