EdgeTX / edgetx

EdgeTX is the cutting edge open source firmware for your R/C radio
https://edgetx.org
GNU General Public License v2.0
1.58k stars 335 forks source link

feat(telemetry): Edit Sensors: display the percentage (%) equivalent to ratio when scaling a sensor value #4648

Closed frankiearzu closed 4 months ago

frankiearzu commented 7 months ago

Is there an existing issue for this feature request?

Is your feature request related to a problem?

Not a bug, just enhancement.

The original ratio was design to correct for ADC Voltages to display the correct voltage.

Some people who knows how to compute a voltage divider knows what number to type if they know the electrical schematics of the RX voltage input.

For a big majority, they really don't know where to start unless is documented in the RX manual (or somewhere else). They just start changing the number until they get the voltage they see in a multimeter.

A "ratio" of 0 (display as "-") mean bypass the scaling logic, so it give the raw value coming from the telemetry screen. A "ratio" of 25.5 will give you the original sensor value (or 100%).
Could be helpful to display the percentage on the side of the ratio, so if a user needs to scale up, they know to go to a value higher than 100%,

Some people are using "ratio" for sensors who are not voltages. For example, If you have a Current (A) reading, you could compute a new sensor for consumption by adding this current periodically. Then adjust "ratio" +/- until you get a consumption closer to reality at the end of the flight.

Describe the solution you'd like

Display the equivalent percentage on the side of the "ratio" field.

Example: image

Describe alternatives you've considered

No response

Additional context

No response

silicongarage commented 7 months ago

Hi Frankie,
I haven't followed the Sensor Scaling saga lately since my model usage is working correctly. Seems this whole scaling scheme is getting more and more confusing.

Is there any underlying code issue that would prevent just having a decimal value used to multiply the sensor input?
Maybe a value range of 99.99 to 0.01 (or other reasonable decimal precision range)? The default scaling could be the legacy 255 ratio system, with maybe a toggle option to enable a straight forward decimal value multiply?

frankiearzu commented 7 months ago

@silicongarage The scaling problems are solved by now (crossing my fingers :-).

Internally as you saw the code is all done by the formula new_value = (old_value *ratio) / 255. The original purpose of the code is to adjust Voltages, and there is a formula to compute the ratio depending on RX electronics (resistors used for voltage divider). There are multiple places documenting what value of "ratio" should be used for different brands of RX (multi-module documentation).

So changing to a totally new formula might affect people who use it, as well as is a deep change in both firmware and companion. A good trade off is to show the equivalent in percentage for the non electronic inclined users :-) At least gives you an idea if you are adjusting up or down, and for how much.

silicongarage commented 7 months ago

Just out of curiosity, what file is the ratio formula for calculating a voltage divider value with ratio being used in?