From e22103d86716f1d5383b688b66cf3d59508e6373 Mon Sep 17 00:00:00 2001 From: Scott Mabin Date: Thu, 10 Oct 2024 15:37:56 +0100 Subject: [PATCH] fix esp-wifi docs (#2333) --- xtask/src/lib.rs | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/xtask/src/lib.rs b/xtask/src/lib.rs index 9ef0b6c9d..1f0059df4 100644 --- a/xtask/src/lib.rs +++ b/xtask/src/lib.rs @@ -9,7 +9,7 @@ use std::{ use anyhow::{bail, Context, Result}; use cargo::CargoAction; use clap::ValueEnum; -use esp_metadata::Chip; +use esp_metadata::{Chip, Config}; use strum::{Display, EnumIter, IntoEnumIterator as _}; use self::cargo::CargoArgsBuilder; @@ -125,17 +125,26 @@ pub fn build_documentation( } } + let chip = Config::for_chip(&chip); + if matches!(package, Package::EspWifi) { - features.push("utils".to_owned()); - features.push("wifi".to_owned()); - features.push("wifi-default".to_owned()); - features.push("ble".to_owned()); - features.push("coex".to_owned()); - features.push("esp-now".to_owned()); - features.push("sniffer".to_owned()); + let wifi = chip.contains("wifi"); + let ble = chip.contains("ble"); + if wifi { + features.push("wifi".to_owned()); + features.push("wifi-default".to_owned()); + features.push("esp-now".to_owned()); + features.push("sniffer".to_owned()); + features.push("utils".to_owned()); + features.push("embassy-net".to_owned()); + } + if ble { + features.push("ble".to_owned()); + } + if wifi && ble { + features.push("coex".to_owned()); + } features.push("async".to_owned()); - features.push("embassy-net".to_owned()); - features.push("esp-hal/default".to_owned()); } // Build up an array of command-line arguments to pass to `cargo`: