Proper rounding for values that are scaled down. Displayed and spoken values affected.

Example: value 3.47V was spoken as 3.4V, new spoken value is 3.5V
This commit is contained in:
Damjan Adamic
2014-03-23 20:50:02 +01:00
parent 32090b8bbe
commit e5cbba4ee2
14 changed files with 44 additions and 18 deletions
+23
View File
@@ -36,6 +36,29 @@
#include "opentx.h"
/*
Division by 10 and rounding or fixed point arithmetic values
Examples:
value -> result
105 -> 11
104 -> 10
-205 -> -21
-204 -> -20
*/
getvalue_t div10_and_round(getvalue_t value)
{
if (value >= 0 ) {
value += 5;
}
else {
value -= 5;
}
return value/10;
}
#if defined(FRSKY)
uint16_t getChannelRatio(uint8_t channel)
{