From ddf4ff7e9d0af9307d5a543d5b18fc6f044e25de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Quentin?= Date: Mon, 9 Sep 2024 18:40:30 +0200 Subject: [PATCH] Make sure we can compile with `defmt` (#2126) * Set DEFMT_LOG in CI * Set DEFMT_LOG in CI * Set DEFMT_LOG in CI * Fix BLE vs DEFMT issue * Fix ESP32 defmt problems in psram.rs * Use `defmt` feature on `bt-hci` --- .github/workflows/ci.yml | 1 + .github/workflows/ci_nightly.yml | 1 + esp-hal/src/soc/esp32/psram.rs | 2 ++ esp-wifi/Cargo.toml | 2 +- esp-wifi/src/ble/controller/mod.rs | 1 + 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 683e4ceeb..df98d99a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,7 @@ env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} MSRV: "1.77.0" RUSTDOCFLAGS: -Dwarnings + DEFMT_LOG: trace # Cancel any currently running workflows from the same PR, branch, or # tag when a new workflow is triggered. diff --git a/.github/workflows/ci_nightly.yml b/.github/workflows/ci_nightly.yml index ed51fe192..2d66cde2f 100644 --- a/.github/workflows/ci_nightly.yml +++ b/.github/workflows/ci_nightly.yml @@ -9,6 +9,7 @@ env: CARGO_TERM_COLOR: always GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} RUSTDOCFLAGS: -Dwarnings + DEFMT_LOG: trace jobs: diff --git a/esp-hal/src/soc/esp32/psram.rs b/esp-hal/src/soc/esp32/psram.rs index 0ad252163..4f1631ad0 100644 --- a/esp-hal/src/soc/esp32/psram.rs +++ b/esp-hal/src/soc/esp32/psram.rs @@ -199,6 +199,7 @@ pub(crate) mod utils { } #[derive(PartialEq, Eq, Clone, Copy, Debug)] + #[cfg_attr(feature = "defmt", derive(defmt::Format))] #[allow(unused)] enum PsramCacheSpeed { PsramCacheF80mS40m = 0, @@ -220,6 +221,7 @@ pub(crate) mod utils { } #[derive(PartialEq, Eq, Copy, Clone, Debug)] + #[cfg_attr(feature = "defmt", derive(defmt::Format))] enum PsramClkMode { PsramClkModeNorm = 0, // Normal SPI mode PsramClkModeDclk = 1, // Two extra clock cycles after CS is set high level diff --git a/esp-wifi/Cargo.toml b/esp-wifi/Cargo.toml index 8082e54c9..ca531fb3b 100644 --- a/esp-wifi/Cargo.toml +++ b/esp-wifi/Cargo.toml @@ -189,7 +189,7 @@ dhcpv4 = ["wifi", "utils", "smoltcp?/proto-dhcpv4", "smoltcp?/socket-dhcpv4"] wifi-default = ["ipv4", "tcp", "udp", "icmp", "igmp", "dns", "dhcpv4"] ## Enable support for `defmt` -defmt = ["dep:defmt", "smoltcp?/defmt", "esp-hal/defmt"] +defmt = ["dep:defmt", "smoltcp?/defmt", "esp-hal/defmt", "bt-hci?/defmt"] ## Enable support for the `log` crate log = ["dep:log", "esp-hal/log"] diff --git a/esp-wifi/src/ble/controller/mod.rs b/esp-wifi/src/ble/controller/mod.rs index 45eb991e3..9ca3cc761 100644 --- a/esp-wifi/src/ble/controller/mod.rs +++ b/esp-wifi/src/ble/controller/mod.rs @@ -205,6 +205,7 @@ pub mod asynch { } } warn!("[hci] error parsing packet: {:?}", e); + Err(BleConnectorError::Unknown) } }