edgetx icon indicating copy to clipboard operation
edgetx copied to clipboard

LUA playNumber with PREC2 - last decimal digit missing

Open NafetsRC opened this issue 1 year ago • 5 comments

Is there an existing issue for this problem?

  • [X] I have searched the existing issues

What part of EdgeTX is the focus of this bug?

Transmitter firmware

Current Behavior

playNumber(123, 1, PREC2) says: „one point two volts“

Expected Behavior

should say: „one point two three volts“ or ‚twentythree‘

Steps To Reproduce

Put this line in a function LUA

same behavior in v2.9.4 AND v2.10.3

Version

2.10.3

Transmitter

RadioMaster TX16S / TX16SMK2

Operating System (OS)

No response

OS Version

No response

Anything else?

No response

NafetsRC avatar Aug 25 '24 15:08 NafetsRC

The TTS engine is currently only generating audio with 1 digit after the coma. That dates OpenTX, and is designed to keep a balance between accuracy and annoyance of too long audio speech.

Since you are un LUA, you can easy write a function that does what you want, without altering other users sound behavior

3djc avatar Aug 25 '24 18:08 3djc

Thanks 4 Info !

NafetsRC avatar Aug 25 '24 19:08 NafetsRC

So this is actually a bug that has been present in OTX since 2.0.0? As it doesn't match the codes own documentation ;)

https://github.com/opentx/opentx/blob/70867aaeb56c45ca2026df911d5b7434825e3888/radio/src/lua/api_general.cpp#L1111-L1124

We really should either fix that in code in our side (i.e. special handling if PREC2 param given), or remove

  • PREC2 plays a number with two decimal places (for a number 123 it plays 1.23)

from the documentation and code ;)

pfeerick avatar Aug 26 '24 00:08 pfeerick

PREC is needed to as a divider for the value, but doesn’t drive how many digits will be said. Yes it is a bug in the documentation imho.

3djc avatar Aug 26 '24 06:08 3djc

We really should either fix that in code in our side (i.e. special handling if PREC2 param given), or remove

  • PREC2 plays a number with two decimal places (for a number 123 it plays 1.23)

from the documentation and code ;)

Think, this would be really a great idea !!!

There are also some other people, who where misleaded from this…

cheers

NafetsRC avatar Aug 26 '24 14:08 NafetsRC