esp-wifi: Align default settings (#2251)
* Align esp-wifi defaults with ESP-IDF * Check we assume the correct wifi-config defaults * No WIFI-CONFIG for ESP32-H2
This commit is contained in:
parent
5a993fed38
commit
18da679d8a
@ -53,7 +53,6 @@ bt-hci = { version = "0.1.0", optional = true }
|
||||
esp-config = { version = "0.1.0", path = "../esp-config" }
|
||||
|
||||
[build-dependencies]
|
||||
toml-cfg = "0.2.0"
|
||||
esp-build = { version = "0.1.0", path = "../esp-build" }
|
||||
esp-config = { version = "0.1.0", path = "../esp-config", features = ["build"] }
|
||||
esp-metadata = { version = "0.3.0", path = "../esp-metadata" }
|
||||
|
||||
@ -93,6 +93,9 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
}
|
||||
|
||||
// emit config
|
||||
//
|
||||
// keep the defaults aligned with `esp_wifi_sys::include::*` e.g.
|
||||
// `esp_wifi_sys::include::CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM`
|
||||
generate_config(
|
||||
"esp_wifi",
|
||||
&[
|
||||
@ -102,8 +105,8 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
("dynamic_rx_buf_num", Value::UnsignedInteger(32), "WiFi dynamic RX buffer number. See [ESP-IDF Programming Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_wifi.html#_CPPv418wifi_init_config_t)"),
|
||||
("static_tx_buf_num", Value::UnsignedInteger(0), "WiFi static TX buffer number. See [ESP-IDF Programming Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_wifi.html#_CPPv418wifi_init_config_t)"),
|
||||
("dynamic_tx_buf_num", Value::UnsignedInteger(32), "WiFi dynamic TX buffer number. See [ESP-IDF Programming Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_wifi.html#_CPPv418wifi_init_config_t)"),
|
||||
("ampdu_rx_enable", Value::Bool(false), "WiFi AMPDU RX feature enable flag. See [ESP-IDF Programming Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_wifi.html#_CPPv418wifi_init_config_t)"),
|
||||
("ampdu_tx_enable", Value::Bool(false), "WiFi AMPDU TX feature enable flag. See [ESP-IDF Programming Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_wifi.html#_CPPv418wifi_init_config_t)"),
|
||||
("ampdu_rx_enable", Value::Bool(true), "WiFi AMPDU RX feature enable flag. See [ESP-IDF Programming Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_wifi.html#_CPPv418wifi_init_config_t)"),
|
||||
("ampdu_tx_enable", Value::Bool(true), "WiFi AMPDU TX feature enable flag. See [ESP-IDF Programming Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_wifi.html#_CPPv418wifi_init_config_t)"),
|
||||
("amsdu_tx_enable", Value::Bool(false), "WiFi AMSDU TX feature enable flag. See [ESP-IDF Programming Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_wifi.html#_CPPv418wifi_init_config_t)"),
|
||||
("rx_ba_win", Value::UnsignedInteger(6), "WiFi Block Ack RX window size. See [ESP-IDF Programming Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_wifi.html#_CPPv418wifi_init_config_t)"),
|
||||
("max_burst_size", Value::UnsignedInteger(1), "See [smoltcp's documentation](https://docs.rs/smoltcp/0.10.0/smoltcp/phy/struct.DeviceCapabilities.html#structfield.max_burst_size)"),
|
||||
|
||||
@ -155,6 +155,22 @@ pub fn current_millis() -> u64 {
|
||||
ticks_to_millis(get_systimer_count())
|
||||
}
|
||||
|
||||
// this is just to verify that we use the correct defaults in `build.rs`
|
||||
const _: () = {
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(not(esp32h2))]{
|
||||
core::assert!(binary::include::CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM == 10);
|
||||
core::assert!(binary::include::CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM == 32);
|
||||
core::assert!(binary::include::WIFI_STATIC_TX_BUFFER_NUM == 0);
|
||||
core::assert!(binary::include::CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM == 32);
|
||||
core::assert!(binary::include::CONFIG_ESP_WIFI_AMPDU_RX_ENABLED == 1);
|
||||
core::assert!(binary::include::CONFIG_ESP_WIFI_AMPDU_TX_ENABLED == 1);
|
||||
core::assert!(binary::include::WIFI_AMSDU_TX_ENABLED == 0);
|
||||
core::assert!(binary::include::CONFIG_ESP32_WIFI_RX_BA_WIN == 6);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
/// Tunable parameters for the WiFi driver
|
||||
|
||||
@ -1234,13 +1234,13 @@ static mut G_CONFIG: wifi_init_config_t = wifi_init_config_t {
|
||||
},
|
||||
static_rx_buf_num: crate::CONFIG.static_rx_buf_num as i32,
|
||||
dynamic_rx_buf_num: crate::CONFIG.dynamic_rx_buf_num as i32,
|
||||
tx_buf_type: 1,
|
||||
tx_buf_type: esp_wifi_sys::include::CONFIG_ESP_WIFI_TX_BUFFER_TYPE as i32,
|
||||
static_tx_buf_num: crate::CONFIG.static_tx_buf_num as i32,
|
||||
dynamic_tx_buf_num: crate::CONFIG.dynamic_tx_buf_num as i32,
|
||||
rx_mgmt_buf_type: 0_i32,
|
||||
rx_mgmt_buf_num: 0_i32,
|
||||
cache_tx_buf_num: 0,
|
||||
csi_enable: 1,
|
||||
rx_mgmt_buf_type: esp_wifi_sys::include::CONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUF as i32,
|
||||
rx_mgmt_buf_num: esp_wifi_sys::include::CONFIG_ESP_WIFI_RX_MGMT_BUF_NUM_DEF as i32,
|
||||
cache_tx_buf_num: esp_wifi_sys::include::WIFI_CACHE_TX_BUFFER_NUM as i32,
|
||||
csi_enable: esp_wifi_sys::include::WIFI_CSI_ENABLED as i32,
|
||||
ampdu_rx_enable: crate::CONFIG.ampdu_rx_enable as i32,
|
||||
ampdu_tx_enable: crate::CONFIG.ampdu_tx_enable as i32,
|
||||
amsdu_tx_enable: crate::CONFIG.amsdu_tx_enable as i32,
|
||||
@ -1248,11 +1248,11 @@ static mut G_CONFIG: wifi_init_config_t = wifi_init_config_t {
|
||||
nano_enable: 0,
|
||||
rx_ba_win: crate::CONFIG.rx_ba_win as i32,
|
||||
wifi_task_core_id: 0,
|
||||
beacon_max_len: 752,
|
||||
mgmt_sbuf_num: 32,
|
||||
beacon_max_len: esp_wifi_sys::include::WIFI_SOFTAP_BEACON_MAX_LEN as i32,
|
||||
mgmt_sbuf_num: esp_wifi_sys::include::WIFI_MGMT_SBUF_NUM as i32,
|
||||
feature_caps: WIFI_FEATURE_CAPS,
|
||||
sta_disconnected_pm: false,
|
||||
espnow_max_encrypt_num: 7, // 2 for ESP32-C2
|
||||
espnow_max_encrypt_num: esp_wifi_sys::include::CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM as i32,
|
||||
magic: WIFI_INIT_CONFIG_MAGIC as i32,
|
||||
|
||||
tx_hetb_queue_num: 3,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user