From 5fc972c2b952ef9d1ce168021186c4fa5941302f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 2 Jun 2026 14:56:21 +0000 Subject: [PATCH 1/2] Initial plan From 8f89fac52044e52a745246f05c52d2fd0073b05a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 2 Jun 2026 15:00:09 +0000 Subject: [PATCH 2/2] Replace Thread.Sleep(1) in Nrf24l01.Send with short DelayHelper delays --- src/devices/Nrf24l01/Nrf24l01.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/devices/Nrf24l01/Nrf24l01.cs b/src/devices/Nrf24l01/Nrf24l01.cs index 10068c9e91..857411ce5d 100644 --- a/src/devices/Nrf24l01/Nrf24l01.cs +++ b/src/devices/Nrf24l01/Nrf24l01.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Device; using System.Device.Gpio; using System.Device.Spi; using System.Threading; @@ -180,18 +181,22 @@ public void Send(byte[] data) { // Details in the Datasheet P65 SetWorkingMode(WorkingMode.Transmit); - // wait for some time so that it doesn't go too fast - Thread.Sleep(1); + // Wait for the device to settle into transmit standby mode (Tstby2a = 130us). + DelayHelper.DelayMicroseconds(130, allowThreadYield: false); Write(Command.NRF_W_TX_PAYLOAD, Register.NRF_NOOP, data); + // A high pulse on CE of at least 10us (Thce) starts the transmission. + // 15us is used to keep some margin above the 10us minimum. _gpio.Write(_ce, PinValue.High); - Thread.Sleep(1); + DelayHelper.DelayMicroseconds(15, allowThreadYield: false); _gpio.Write(_ce, PinValue.Low); - Thread.Sleep(1); + // Wait for the device to settle before switching mode (Tstby2a = 130us). + DelayHelper.DelayMicroseconds(130, allowThreadYield: false); SetWorkingMode(WorkingMode.Receive); - Thread.Sleep(1); + // Wait for the device to settle back into receive mode (Tstby2a = 130us). + DelayHelper.DelayMicroseconds(130, allowThreadYield: false); } ///