work for CSI on S3 dev kit

This commit is contained in:
Bob 2025-11-21 09:55:33 -08:00
parent dc63a992f3
commit e7c2349c6d
1 changed files with 29 additions and 7 deletions

View File

@ -141,19 +141,41 @@ static void csi_cb(void *ctx, wifi_csi_info_t *info)
csi_log_append_record(info);
}
static void wifi_enable_csi_once(void)
{
static void wifi_enable_csi_once(void) {
if (s_csi_enabled) {
return;
}
// On your C5 + IDF, wifi_csi_config_t only has `.enable`
wifi_csi_config_t csi_cfg = {
.enable = true,
};
esp_err_t err;
wifi_csi_config_t csi_cfg;
#if CONFIG_IDF_TARGET_ESP32C5
/* -------------------------
* ESP32-C5 (Wi-Fi 6) CSI API
* Only supports .enable
* ------------------------- */
memset(&csi_cfg, 0, sizeof(csi_cfg));
csi_cfg.enable = true;
#elif CONFIG_IDF_TARGET_ESP32S3
/* -------------------------
* ESP32-S3 CSI API (legacy)
* ------------------------- */
memset(&csi_cfg, 0, sizeof(csi_cfg));
csi_cfg.lltf_en = true;
csi_cfg.htltf_en = true;
csi_cfg.stbc_htltf2_en = true;
csi_cfg.ltf_merge_en = true;
csi_cfg.channel_filter_en = true;
csi_cfg.manu_scale = false;
csi_cfg.shift = 0;
#else
#warning "CSI not supported for this target; building without CSI"
return;
#endif
err = esp_wifi_set_csi_config(&csi_cfg);
if (err != ESP_OK) {
ESP_LOGW("CSI", "esp_wifi_set_csi_config failed: %s", esp_err_to_name(err));