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 -35
View File
@@ -76,34 +76,6 @@ enum PortuguesePrompts {
PT_PROMPT_WATTS = PT_PROMPT_UNITS_BASE+UNIT_WATTS,
PT_PROMPT_FEET = PT_PROMPT_UNITS_BASE+UNIT_FEET,
PT_PROMPT_KTS = PT_PROMPT_UNITS_BASE+UNIT_KTS,
PT_PROMPT_LABELS_BASE = 140,
PT_PROMPT_TIMER1 = PT_PROMPT_LABELS_BASE+TELEM_TIMER1,
PT_PROMPT_TIMER2 = PT_PROMPT_LABELS_BASE+TELEM_TIMER2,
PT_PROMPT_RSSI_TX = PT_PROMPT_LABELS_BASE+TELEM_RSSI_TX,
PT_PROMPT_RSSI_RX = PT_PROMPT_LABELS_BASE+TELEM_RSSI_RX,
PT_PROMPT_A1 = PT_PROMPT_LABELS_BASE+TELEM_A1,
PT_PROMPT_A2 = PT_PROMPT_LABELS_BASE+TELEM_A2,
PT_PROMPT_ALTITUDE = PT_PROMPT_LABELS_BASE+TELEM_ALT,
PT_PROMPT_RPM = PT_PROMPT_LABELS_BASE+TELEM_RPM,
PT_PROMPT_ESSENCE = PT_PROMPT_LABELS_BASE+TELEM_FUEL,
PT_PROMPT_T1 = PT_PROMPT_LABELS_BASE+TELEM_T1,
PT_PROMPT_T2 = PT_PROMPT_LABELS_BASE+TELEM_T2,
PT_PROMPT_VITESSE = PT_PROMPT_LABELS_BASE+TELEM_SPEED,
PT_PROMPT_DISTANCE = PT_PROMPT_LABELS_BASE+TELEM_DIST,
PT_PROMPT_GPSALTITUDE = PT_PROMPT_LABELS_BASE+TELEM_GPSALT,
PT_PROMPT_ELEMENTS_LIPO = PT_PROMPT_LABELS_BASE+TELEM_CELL,
PT_PROMPT_TOTAL_LIPO = PT_PROMPT_LABELS_BASE+TELEM_CELLS_SUM,
PT_PROMPT_VFAS = PT_PROMPT_LABELS_BASE+TELEM_VFAS,
PT_PROMPT_COURANT = PT_PROMPT_LABELS_BASE+TELEM_CURRENT,
PT_PROMPT_CONSOMMATION = PT_PROMPT_LABELS_BASE+TELEM_CONSUMPTION,
PT_PROMPT_PUISSANCE = PT_PROMPT_LABELS_BASE+TELEM_POWER,
PT_PROMPT_ACCELx = PT_PROMPT_LABELS_BASE+TELEM_ACCx,
PT_PROMPT_ACCELy = PT_PROMPT_LABELS_BASE+TELEM_ACCy,
PT_PROMPT_ACCELz = PT_PROMPT_LABELS_BASE+TELEM_ACCz,
PT_PROMPT_HDG = PT_PROMPT_LABELS_BASE+TELEM_HDG,
PT_PROMPT_VARIO = PT_PROMPT_LABELS_BASE+TELEM_VSPEED,
};
#if defined(VOICE)
@@ -115,6 +87,7 @@ I18N_PLAY_FUNCTION(pt, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
number = -number;
}
#if !defined(CPUARM)
if (unit) {
unit--;
convertUnit(number, unit);
@@ -126,18 +99,20 @@ I18N_PLAY_FUNCTION(pt, 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(PT_PROMPT_VIRGULA);