From 74da73e37d7d8891dc3d31364fefbd7382dd429a Mon Sep 17 00:00:00 2001 From: Jacob Dahl Date: Thu, 20 Nov 2025 22:08:34 -0900 Subject: [PATCH] fix frame quantization --- platforms/nuttx/src/px4/stm/stm32_common/dshot/dshot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platforms/nuttx/src/px4/stm/stm32_common/dshot/dshot.c b/platforms/nuttx/src/px4/stm/stm32_common/dshot/dshot.c index f295d7a5cb..36000a04b5 100644 --- a/platforms/nuttx/src/px4/stm/stm32_common/dshot/dshot.c +++ b/platforms/nuttx/src/px4/stm/stm32_common/dshot/dshot.c @@ -766,7 +766,7 @@ uint32_t convert_edge_intervals_to_bitstream(uint8_t channel_index) // This seemss to work with dshot 150, 300, 600, 1200 // The values were found by trial and error to get the quantization just right. - const uint32_t bits = (dshot_capture_buffer[channel_index][i] - previous + 5) / 20; + const uint32_t bits = (dshot_capture_buffer[channel_index][i] - previous + 5) / 21; // Convert GCR encoded pulse train into value for (unsigned bit = 0; bit < bits; ++bit) {