Telemetry refactoring - Fixes #1634

This commit is contained in:
bsongis
2014-11-08 12:06:42 +01:00
parent 7d8ca6931b
commit 88d9691d16
105 changed files with 5789 additions and 3449 deletions
+10 -34
View File
@@ -54,33 +54,6 @@ enum ItalianPrompts {
IT_PROMPT_FEET = IT_PROMPT_UNITS_BASE+UNIT_FEET,
IT_PROMPT_KTS = IT_PROMPT_UNITS_BASE+UNIT_KTS,
IT_PROMPT_LABELS_BASE = 131,
IT_PROMPT_TIMER1 = IT_PROMPT_LABELS_BASE+TELEM_TIMER1,
IT_PROMPT_TIMER2 = IT_PROMPT_LABELS_BASE+TELEM_TIMER2,
IT_PROMPT_RSSI_TX = IT_PROMPT_LABELS_BASE+TELEM_RSSI_TX,
IT_PROMPT_RSSI_RX = IT_PROMPT_LABELS_BASE+TELEM_RSSI_RX,
IT_PROMPT_A1 = IT_PROMPT_LABELS_BASE+TELEM_A1,
IT_PROMPT_A2 = IT_PROMPT_LABELS_BASE+TELEM_A2,
IT_PROMPT_ALTITUDE = IT_PROMPT_LABELS_BASE+TELEM_ALT,
IT_PROMPT_RPM = IT_PROMPT_LABELS_BASE+TELEM_RPM,
IT_PROMPT_ESSENCE = IT_PROMPT_LABELS_BASE+TELEM_FUEL,
IT_PROMPT_T1 = IT_PROMPT_LABELS_BASE+TELEM_T1,
IT_PROMPT_T2 = IT_PROMPT_LABELS_BASE+TELEM_T2,
IT_PROMPT_VITESSE = IT_PROMPT_LABELS_BASE+TELEM_SPEED,
IT_PROMPT_DISTANCE = IT_PROMPT_LABELS_BASE+TELEM_DIST,
IT_PROMPT_GPSALTITUDE = IT_PROMPT_LABELS_BASE+TELEM_GPSALT,
IT_PROMPT_ELEMENTS_LIPO = IT_PROMPT_LABELS_BASE+TELEM_CELL,
IT_PROMPT_TOTAL_LIPO = IT_PROMPT_LABELS_BASE+TELEM_CELLS_SUM,
IT_PROMPT_VFAS = IT_PROMPT_LABELS_BASE+TELEM_VFAS,
IT_PROMPT_COURANT = IT_PROMPT_LABELS_BASE+TELEM_CURRENT,
IT_PROMPT_CONSOMMATION = IT_PROMPT_LABELS_BASE+TELEM_CONSUMPTION,
IT_PROMPT_PUISSANCE = IT_PROMPT_LABELS_BASE+TELEM_POWER,
IT_PROMPT_ACCELx = IT_PROMPT_LABELS_BASE+TELEM_ACCx,
IT_PROMPT_ACCELy = IT_PROMPT_LABELS_BASE+TELEM_ACCy,
IT_PROMPT_ACCELz = IT_PROMPT_LABELS_BASE+TELEM_ACCz,
IT_PROMPT_HDG = IT_PROMPT_LABELS_BASE+TELEM_HDG,
IT_PROMPT_VARIO = IT_PROMPT_LABELS_BASE+TELEM_VSPEED,
};
#if defined(VOICE)
@@ -102,6 +75,7 @@ I18N_PLAY_FUNCTION(it, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
number = -number;
}
#if !defined(CPUARM)
if (unit) {
unit--;
convertUnit(number, unit);
@@ -113,18 +87,20 @@ I18N_PLAY_FUNCTION(it, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
unit = UNIT_KTS;
}
}
#if defined(CPUARM)
if ((att & PREC1) && (unit == UNIT_FEET || (unit == UNIT_DIST && number >= 100))) {
number = div10_and_round(number);
att -= PREC1;
}
#endif
unit++;
}
#endif
int8_t mode = MODE(att);
if (mode > 0) {
div_t qr = div(number, (mode == 1 ? 10 : 100));
#if defined(CPUARM)
if (mode == 2) {
number /= 10;
}
#else
// we assume that we are PREC1
#endif
div_t qr = div(number, 10);
if (qr.rem > 0) {
PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(IT_PROMPT_VIRGOLA);