-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Servo stretch feature for wider range servo PWM pulses #2773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Servo stretch feature for wider range servo PWM pulses #2773
Conversation
|
This feature is super useful for a lot of servos that use extended range PWM. |
Camo55
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no downsides I can see with this.
|
This has a lot of things that needs fixing, mainly the config struct can't just be changed like that, and the way this is calculated loses even more source resolution. I don't have time to get into it now though. To work around the former, does anyone actually use that 750us mode? Is that even a thing? I added it because when I wrote all the PWM stuff one person said to me "Can you make it so the pulses are half as long?" and I had never heard of that but I threw it in because everything was new then so it was easier than it would have been to add it later. If 750us isn't a thing, then we could just use that bit for this and save a lot of headache/code. Does anyone know if that can be removed? |
Actually I made it so that anybody else migrating from the old struct will still have their settings be effective until the next time they use the web interface to configure. I also have never heard of a practical use for 750us mode and would agree to simply turning it into a stretched mode. But how do we make sure
I can easily change this such that the calculation happens in the same place where |
|
Yes its useful for plane pilots who are switching to ELRS |
I mostly fly LOS fixed wing and heli, and I don't think 750us is really a thing outside of yaw servos for RC helicopters (which generally use a flight controller anyway), and probably some specialized cases that I can't think of. I'm not aware of any other radio system in the hobby with a PWM receiver that can support the 750us servo operating range. I'm sure one person will be upset if it gets removed though, haha! |
|
It's also useful for Drag Racing and similar folks who like to turn their rates up to 125% to "Get a little extra power and speed" out of their systems supposedly. |
|
if narrow mode is 500-1000 anyways, and the new stretched mode is 500-2500, can we assume that anybody who used to use 500-1000 can simply edit their mixer since those ranges overlap? as far as I can tell, the resolution will be similar and it's not like using 500-1000 increases the update rate anyways, the PWM generator's frequency never changes. |
|
The goal is to help people save money, save space, and save weight, by avoiding products such as this servo stretcher, or this (example 2), or this (example 3), or this (example 4), or this (example 4). These products exist because of the limitations of older receivers and old standards, while EdgeTX itself is not to blame, this is going to provide an option to mitigate that old constraint. The last commit I just did replaced the narrow flag with the stretch flag, and I think it could work as an implementation that satisfies everybody, even people who were previously using the narrow flag. I have also resolved the resolution issue and now it should have as much resolution preserved as possible. Please review, thanks! |
|
Then why not add standard 150% 732us-2268us. |
|
This is a great feature to add. With more adoption of ELRS in planes, combat robotics, rc cars/trucks/crawlers since the RM MT12 was released, this is the time to get this added. We need to get this reviewed please! |
|
I could really need this as well. I'm would really love using the full range of my servo. |
|
seems to work from my initial testing, the servo does indeed go twice as far, to the full 270 degrees |
|
Found this PR while looking for how to enable double pulse width that's already mentioned in the docs. Tested the PR and it does indeed work. |
|
I agree with all of your comments, A standard 150% 732us-2268us travel is needed for steering servo to have the full steering angle without using longer servo arms (rc car racing) |
|
Will the feature ever be merged? |
|
Alright so looking through the comments on this PR and our existing system it seems like this could have a dose of scope creep. We seem to have a desire for:
Is 150% needed? I bring it up because if we just do 200% then we're scaling up our 10-bit value so each bit is 2us, then the user might adjust their range down in EdgeTX which throws away part of the 10-bit range and make it even more chunky. Am I overthinking this? |
|
I vote for only having 100% original and then a 200% mode. Anything in between can be done by adjusting EdgeTX parameters, as you said. |
|
Thanks for weighing in @frank26080115 we're looking to move on this as I have time this week or next. Two things I can see that need to be addressed, but I can handle them when I review:
|
|
I would've liked Ncerzzk's implementation so that you wouldn't have to second guess what the users would want. It's like setting subtrim and extents on the aircraft so that you can make full use of the 10-bit resolution. I'm in the 150% camp because of the micro servos I'm using (200% hits the hard stops), but I don't know how common that is. |
|
Instead of adding different scaling options; how about a travel scale value for PWM channels that defaults to 100% but allows scaling up to 200% ? |
The problem with just accepting any endpoints is that they're locked in once the configuration defaults are set, which means everyone gets 988-2012 regardless of if they are using a normal or fullres packet mode (which supports 120% range). There's just too many things to set and it is way too cumbersome and not at all obvious to users, who will think that no matter what they do they can't get anything but 988-2012 out of the system unless they go into the webui. As it is currently, just changing the packet mode to fullres gives you the larger range with no other faffing about with the ExpressLRS config. The stretch mode will just map whatever the input range is to the 474-2526 endpoints. I find all of this to be a complete mess because no matter what, a decent percentage of users are going to be confused at the behavior regardless of what system we use 😅 There's just too many layers each of which is configured from a different area Sticks -> Inputs -> Mixers -> Outputs -> ELRS Packet Mode -> Endpoint Stretch... |
|
Certainly fair. I wondered why the "full" switch modes would change the PWM scale on the receiver: it's 10 bits either way, so it felt like it should be a receiver setting regardless of switch mode. However, ELRS is now popular enough that rocking the boat can get pretty ugly for the "turn-key" end users. As a software engineer, I understand the pain of living with a design decision made years ago that can no longer be undone. Stick with the 100%, 200%. I don't "need" 150%, and if I get desperate enough I can always implement it in a private build. No point adding complexity to this feature until a decent number of people demand it. |
|
Just an update that this hasn't fallen off the radar. It's been a busy week but our internal plan has this on it and the merge deadline is Nov 16, although I will work to have this approved sooner than that. |
… range cutoffs in webui
|
I've merged master back into this and brought it up to date with the v11 RX config changes. Changed a many other things as well
|
CapnBry
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with Betafpv SuperP in both 250Hz and 333Hz Full modes in stretch / nostretch
Note that I have uncovered an issue that will be addressed separately, which is that if the servo is all the way at the min stretched value (500us) the failsafe position won't be saved. Nor will this servo operate if the input channel value indicates its output should be 500us, due to our internal channel representation indicating "no value here"
pkendall64
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works fine on SuperP
pkendall64
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works fine on SuperP


There are some servos that require PWM pulses about 500us to 2500us to get their full range of motion
There are some people who purchase "servo stretcher" devices to translate pulses from 1000-2000us to 500-2500us just to use these servos. However, this obviously costs money, space, and weight. So why not just add this feature to ELRS?!
Previously, there was a "narrow" flag for the pulses that made them half as long. My code addition converts this to both a "half" mode and a "stretched" mode. The checkbox in the web-ui has changed into a drop-down.
I have tested this and observed the signals on a logic analyzer to confirm the pulse widths. I have also checked that loading and saving from the web-ui works as expected.