Skip to content

Allow DShot to send zero value to allow for AM32 initialization - #3126

Merged
mha1 merged 1 commit into
ExpressLRS:masterfrom
ot0tot:Fix-DShot
Feb 4, 2025
Merged

mha1 merged 1 commit into
ExpressLRS:masterfrom
ot0tot:Fix-DShot

Conversation

@ot0tot

@ot0tot ot0tot commented Feb 3, 2025

Copy link
Copy Markdown
Contributor

Some ESC firmware implementations require an initial DShot command of 0 (disarmed) before allowing arming.

devServoOutput.cpp sent a DShot value of 0 during start:

dshotInstances[ch]->send_dshot_value(0); // Set throttle low so the ESC can continue initialsation

But this value was being overwritten by DSHOT_THROTTLE_MIN in DShotRMT.cpp. This adds an additional check to see if throttle_value = 0 and prevents it from being overwritten with DSHOT_THROTTLE_MIN.

@mha1
mha1 merged commit 3127e91 into ExpressLRS:master Feb 4, 2025
@ot0tot
ot0tot deleted the Fix-DShot branch February 4, 2025 19:08
@pitts-mo

pitts-mo commented Feb 4, 2025 •

Copy link
Copy Markdown
Contributor

Wow, This is dangerous! Thank goodness I did not have a prop on. But I did learn a lot :-)
-DSHOT ESCs have been primarily used by FC or other controller that can control arming safety.
-Traditional ESC protocols waited for TX throttle input low or centered to verify user was ready to arm.

However, this current code is repossessing arming safety from the TX and apparently we also have DSHOT ESCs out there that will not play safely with this type of manual control from the TX.

Suggested short term solution:
Never pre-arm dshot by sending 0000 command, instead wait for the channel signal from TX and then setup a dead band section at low throttle to send dshot 0000 command and then scale the remainder of travel to 0048-2047 (or DSHOT3D 1047-0048(inverted), 0000 deadband at center, 1048-2047).

Suggested long term solution is to create arming safety modes for use with DSHOT:
Always - never output to any DSHOT channels on ARM unless ALL DSHOT channels are already receiving 0000 range from TX.
First arm - like above for first arm but bypass checking DSHOT inputs for 0000 on additional arm attempts
pass-through - RX never blocks output to DSHOT channels, only outputs signals as received (same as short term suggestion above).

I have not had a chance to look at @frank26080115 DSHOT handling fixes yet.
frank26080115@c33bb2f
frank26080115@c41837b

@hyp0dermik-code

Copy link
Copy Markdown

AM32 ESCs also have different behaviour between Dshot 0 and Dshot 48 IIRC. - Dshot 0 freewheels, Dshot 48 brakes.

If my recollection is right, this could lead to undesired lack of braking at 0% throttle inputs on AM32 ESCs

Valtor5321 pushed a commit to Valtor5321/ExpressLRS that referenced this pull request Feb 16, 2025
@pitts-mo

Copy link
Copy Markdown
Contributor

Please consider review of #3139 as it appears to be a good place to include both AM32 DSHOT support and arming safety fix. Thank you, -p

more detail:
PR #3126 does allow arming of AM32 DSHOT but has removed general DSHOT arming safety from user control. An additional fix will be required to restore user arming safety to dshot ESCs prior to the next ELRS release.

Arming safety can be restored to user control by removing this line:

dshotInstances[ch]->send_dshot_value(0); // Set throttle low so the ESC can continue initialsation

However, removing this line from master will restore arming safety for some ESCs but will just disable DSHOT arming of AM32 ESCs again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants