From 05cedf1093fd38428504e4ee5f3426ffc71b86cd Mon Sep 17 00:00:00 2001 From: Jacob Dahl Date: Sun, 19 Apr 2026 19:27:02 -0800 Subject: [PATCH] fix(dshot): make 3D deadband inclusive on both ends Change the 3D deadband check from [L, H) to [L, H] so that setting DSHOT_3D_DEAD_L equal to DSHOT_3D_DEAD_H (both default to 1000) produces a single-point deadband at that value, matching the natural reading of "between L and H" in the param description. Clarify the DSHOT_3D_DEAD_L/H param descriptions to state the range is inclusive and note the L=H default behavior. --- src/drivers/dshot/DShot.cpp | 2 +- src/drivers/dshot/module.yaml | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/drivers/dshot/DShot.cpp b/src/drivers/dshot/DShot.cpp index 8c96c3a3ab..db649f7df8 100644 --- a/src/drivers/dshot/DShot.cpp +++ b/src/drivers/dshot/DShot.cpp @@ -741,7 +741,7 @@ uint16_t DShot::convert_output_to_3d_scaling(uint16_t output) // This is in terms of DShot values, code below is in terms of actuator_output // Direction 1) 48 is the slowest, 1047 is the fastest. // Direction 2) 1049 is the slowest, 2047 is the fastest. - if (output >= _3d_dead_l && output < _3d_dead_h) { + if (output >= _3d_dead_l && output <= _3d_dead_h) { return DSHOT_DISARM_VALUE; } diff --git a/src/drivers/dshot/module.yaml b/src/drivers/dshot/module.yaml index 3dda5f4dcf..8e317cb86e 100644 --- a/src/drivers/dshot/module.yaml +++ b/src/drivers/dshot/module.yaml @@ -56,7 +56,8 @@ parameters: description: short: DSHOT 3D deadband high long: | - When the actuator_output is between DSHOT_3D_DEAD_L and DSHOT_3D_DEAD_H, motor will not spin. + When the actuator_output is in the inclusive range [DSHOT_3D_DEAD_L, DSHOT_3D_DEAD_H], the motor will not spin. + Setting DSHOT_3D_DEAD_L equal to DSHOT_3D_DEAD_H (e.g. the default 1000) produces a single-point deadband at that value. This value is with respect to the mixer_module range (0-1999), not the DSHOT values. type: int32 min: 1000 @@ -66,7 +67,8 @@ parameters: description: short: DSHOT 3D deadband low long: | - When the actuator_output is between DSHOT_3D_DEAD_L and DSHOT_3D_DEAD_H, motor will not spin. + When the actuator_output is in the inclusive range [DSHOT_3D_DEAD_L, DSHOT_3D_DEAD_H], the motor will not spin. + Setting DSHOT_3D_DEAD_L equal to DSHOT_3D_DEAD_H (e.g. the default 1000) produces a single-point deadband at that value. This value is with respect to the mixer_module range (0-1999), not the DSHOT values. type: int32 min: 0