diff --git a/firmware/Cargo.lock b/firmware/Cargo.lock
index 72079af..7efafc2 100644
--- a/firmware/Cargo.lock
+++ b/firmware/Cargo.lock
@@ -2149,7 +2149,9 @@ name = "esp-hal-bounce-buffers"
version = "0.1.0"
dependencies = [
"document-features",
+ "embassy-sync 0.7.2",
"esp-hal",
+ "log",
"ouroboros",
]
diff --git a/firmware/acid-firmware/Cargo.toml b/firmware/acid-firmware/Cargo.toml
index aed0cb7..426252c 100644
--- a/firmware/acid-firmware/Cargo.toml
+++ b/firmware/acid-firmware/Cargo.toml
@@ -30,6 +30,8 @@ develop-usb = ["limit-fps", "usb-log", "no-usb", "ble"]
probe = ["limit-fps", "rtt-log", "no-usb", "ble"]
# Formats the EKV database on boot.
format-db = []
+# Avoid entering the critical section for the whole duration of printing a message to console.
+racy-logging = []
[dependencies]
rmk = { version = "0.8.2", git = "https://github.com/Limeth/rmk", rev = "1661c55f5c21e7d80ea3f93255df483302c74b84", default-features = false, features = [
@@ -87,7 +89,7 @@ esp-metadata-generated = { version = "0.3.0", features = ["esp32s3"] }
hex = { version = "0.4.3", default-features = false, features = ["alloc"] }
indoc = "2.0.7"
ouroboros = "0.18.5"
-esp-hal-bounce-buffers = { git = "https://forgejo.limeth.cz/limeth/esp-hal-bounce-buffers", features = ["esp32s3"] }
+esp-hal-bounce-buffers = { git = "https://forgejo.limeth.cz/limeth/esp-hal-bounce-buffers", rev = "8d3763a190368f476aed6d98777264c959bfdc2d", features = ["esp32s3", "log"] }
# A fork of slint with patches for `allocator_api` support.
# Don't forget to change `slint-build` in build dependencies, if this is changed.
diff --git a/firmware/acid-firmware/src/logging.rs b/firmware/acid-firmware/src/logging.rs
index 36fd092..028816b 100644
--- a/firmware/acid-firmware/src/logging.rs
+++ b/firmware/acid-firmware/src/logging.rs
@@ -69,21 +69,29 @@ pub mod usb {
#[cfg(feature = "alt-log")]
#[macro_use]
pub mod uart {
- use crate::util::MutexExt;
-
use super::*;
use core::{cell::RefCell, fmt::Write};
- use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, mutex::Mutex};
+ use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
use esp_hal::{Blocking, uart::UartTx};
use log::{Log, info};
- static ALT_LOGGER_UART: Mutex<
+ #[cfg(feature = "racy-logging")]
+ static ALT_LOGGER_UART: embassy_sync::mutex::Mutex<
CriticalSectionRawMutex,
RefCell