Simplification for div_and_round function

This commit is contained in:
Bertrand Songis
2016-04-16 18:26:14 +02:00
parent 740a2a71f5
commit 9c0e0a136a
5 changed files with 28 additions and 27 deletions
+4 -4
View File
@@ -973,14 +973,14 @@ void putsTelemetryChannelValue(coord_t x, coord_t y, uint8_t channel, lcdint_t v
{
lcdint_t converted_value = applyChannelRatio(channel, val);
if (ANA_CHANNEL_UNIT(channel) >= UNIT_RAW) {
converted_value = div_and_round<10>(converted_value);
converted_value = div_and_round(converted_value, 10);
}
else {
if (abs(converted_value) < 1000) {
att |= PREC2;
}
else {
converted_value = div_and_round<10>(converted_value);
converted_value = div_and_round(converted_value, 10);
att |= PREC1;
}
}
@@ -1023,7 +1023,7 @@ void putsTelemetryChannelValue(coord_t x, coord_t y, uint8_t channel, lcdint_t v
break;
case TELEM_VSPEED-1:
putsValueWithUnit(x, y, div_and_round<10>(val), UNIT_RAW, att|PREC1);
putsValueWithUnit(x, y, div_and_round(val, 10), UNIT_RAW, att|PREC1);
break;
case TELEM_ASPEED-1:
@@ -1045,7 +1045,7 @@ void putsTelemetryChannelValue(coord_t x, coord_t y, uint8_t channel, lcdint_t v
#if defined(FRSKY_SPORT)
case TELEM_ALT-1:
putsValueWithUnit(x, y, div_and_round<10>(val), UNIT_DIST, att|PREC1);
putsValueWithUnit(x, y, div_and_round(val, 10), UNIT_DIST, att|PREC1);
break;
#elif defined(WS_HOW_HIGH)
case TELEM_ALT-1: