-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Update OSD throttle options #8806
Conversation
Pre-INAV 3.0 there were two working throttle display elements. A PR in 2.7 made a change that meant both OSD throttle elements showed the same data. This is pretty pointless. The previous method allowed the display of the throttle in a non-scaled view, which made choosing navigational throttles easier. This PR allows the pilot to see scaled throttle, unscaled, or both. Both throttles work for manual and auto throttle.
src/main/flight/mixer.c
Outdated
int16_t thr = constrain(rcCommand[THROTTLE], PWM_RANGE_MIN, PWM_RANGE_MAX); | ||
|
||
if (useScaled) { | ||
thr = (thr - getThrottleIdleValue()) * 100 / (motorConfig()->maxthrottle - getThrottleIdleValue()); |
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.
getThrottleIdleValue
should be assigned to a const
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.
True. No point in multiple calls.
src/main/flight/mixer.c
Outdated
if (useScaled) { | ||
thr = (thr - getThrottleIdleValue()) * 100 / (motorConfig()->maxthrottle - getThrottleIdleValue()); | ||
} else { | ||
thr = (thr - 100) / 10; |
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.
1000 surely ?
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.
thr = (thr - PWM_RANGE_MIN) * 100 / (PWM_RANGE_MAX - PWM_RANGE_MIN);
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.
@breadoven Yes, should be -1000, typo.
@tiriad Actually, this would be better, as it is based on PWM_RANGE_MIN and PWM_RANGE_MAX.
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.
Yes, I only suggested it to follow the style of other variables and the code prior to the modification assuming it was correct.
Line 879 in 5510259
thr = (constrain(rcCommand[THROTTLE], PWM_RANGE_MIN, PWM_RANGE_MAX) - PWM_RANGE_MIN) * 100 / (PWM_RANGE_MAX - PWM_RANGE_MIN); |
what do you think if you add in addition a field with the raw value |
That is effectively what the unscaled throttle percentage is. I think showing the PWM value would be a step backwards. Plus, that could probably be done now using logic conditions and a Gvar. |
I have already managed to obtain the PWM value. A curious case here is that this value is already a % in the PWM range. inav/src/main/programming/logic_condition.c Lines 690 to 692 in b355551
|
It is also not scaled. |
Rather than having a `*` prefix to indicate the PWM throttle. I'm now using the scale symbol (also used in the map) to prefix the scaled throttle. This makes a lot more sense.
Fixes #8801
Pre-INAV 3.0 there were two working throttle display elements. A PR in 2.7 (#6510) made a change that meant both OSD throttle elements showed the same data. This is pretty pointless. The previous method allowed the display of the throttle in a non-scaled view, which made selecting navigational throttles easier. This PR allows the pilot to see scaled throttle, unscaled, or both. Both throttles work for manual and auto throttle.
Configurator iNavFlight/inav-configurator#1725