2 * Authors (alphabetical order)
3 * - Bertrand Songis <bsongis@gmail.com>
4 * - Romolo Manfredini <romolo.manfredini@gmail.com>
6 * opentx is based on code named
7 * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
8 * er9x by Erez Raviv: http://code.google.com/p/er9x/,
9 * and the original (and ongoing) project by
10 * Thomas Husterer, th9x: http://code.google.com/p/th9x/
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
26 IT_PROMPT_NUMBERS_BASE
= 0,
27 IT_PROMPT_ZERO
= IT_PROMPT_NUMBERS_BASE
+0,
28 IT_PROMPT_CENT
= IT_PROMPT_NUMBERS_BASE
+100,
29 IT_PROMPT_MILA
= IT_PROMPT_NUMBERS_BASE
+101,
30 IT_PROMPT_MILLE
= IT_PROMPT_NUMBERS_BASE
+102,
31 IT_PROMPT_VIRGOLA
= 103,
42 IT_PROMPT_UNITS_BASE
= 113,
43 IT_PROMPT_VOLTS
= IT_PROMPT_UNITS_BASE
+(UNIT_VOLTS
*2),
44 IT_PROMPT_AMPS
= IT_PROMPT_UNITS_BASE
+(UNIT_AMPS
*2),
45 IT_PROMPT_METERS_PER_SECOND
= IT_PROMPT_UNITS_BASE
+(UNIT_METERS_PER_SECOND
*2),
46 IT_PROMPT_SPARE1
= IT_PROMPT_UNITS_BASE
+(UNIT_RAW
*2),
47 IT_PROMPT_KMH
= IT_PROMPT_UNITS_BASE
+(UNIT_SPEED
*2),
48 IT_PROMPT_METERS
= IT_PROMPT_UNITS_BASE
+(UNIT_DIST
*2),
49 IT_PROMPT_DEGREES
= IT_PROMPT_UNITS_BASE
+(UNIT_TEMPERATURE
*2),
50 IT_PROMPT_PERCENT
= IT_PROMPT_UNITS_BASE
+(UNIT_PERCENT
*2),
51 IT_PROMPT_MILLIAMPS
= IT_PROMPT_UNITS_BASE
+(UNIT_MILLIAMPS
*2),
52 IT_PROMPT_MAH
= IT_PROMPT_UNITS_BASE
+(UNIT_MAH
*2),
53 IT_PROMPT_WATTS
= IT_PROMPT_UNITS_BASE
+(UNIT_WATTS
*2),
54 IT_PROMPT_FEET
= IT_PROMPT_UNITS_BASE
+(UNIT_FEET
*2),
55 IT_PROMPT_KTS
= IT_PROMPT_UNITS_BASE
+(UNIT_KTS
*2),
56 IT_PROMPT_MILLILITERS
= IT_PROMPT_UNITS_BASE
+(UNIT_MILLILITERS
*2),
57 IT_PROMPT_FLOZ
= IT_PROMPT_UNITS_BASE
+(UNIT_FLOZ
*2),
58 IT_PROMPT_FEET_PER_SECOND
= IT_PROMPT_UNITS_BASE
+(UNIT_FEET_PER_SECOND
*2),
62 #define IT_PUSH_UNIT_PROMPT(u, p) it_pushUnitPrompt((u), (p), id)
64 I18N_PLAY_FUNCTION(it
, pushUnitPrompt
, uint8_t unitprompt
, int16_t number
)
67 PUSH_UNIT_PROMPT(unitprompt
, 0);
69 PUSH_UNIT_PROMPT(unitprompt
, 1);
73 I18N_PLAY_FUNCTION(it
, playNumber
, getvalue_t number
, uint8_t unit
, uint8_t att
)
75 /* if digit >= 1000000000:
76 temp_digit, digit = divmod(digit, 1000000000)
77 prompts.extend(self.getNumberPrompt(temp_digit))
78 prompts.append(Prompt(GUIDE_00_BILLION, dir=2))
80 temp_digit, digit = divmod(digit, 1000000)
81 prompts.extend(self.getNumberPrompt(temp_digit))
82 prompts.append(Prompt(GUIDE_00_MILLION, dir=2))
84 getvalue_t orignumber
;
86 PUSH_NUMBER_PROMPT(IT_PROMPT_MENO
);
91 int8_t mode
= MODE(att
);
96 div_t qr
= div((int)number
, 10);
98 PLAY_NUMBER(qr
.quot
, 0, 0);
99 PUSH_NUMBER_PROMPT(IT_PROMPT_VIRGOLA
);
100 if (mode
==2 && qr
.rem
< 10)
101 PUSH_NUMBER_PROMPT(IT_PROMPT_ZERO
);
102 PLAY_NUMBER(qr
.rem
, 0, 0);
106 PUSH_NUMBER_PROMPT(IT_PROMPT_UN
);
108 PUSH_NUMBER_PROMPT(IT_PROMPT_UNITS_BASE
+(unit
*2));
112 PLAY_NUMBER(qr
.quot
, 0, 0);
116 if (orignumber
== 1 && unit
) {
117 PUSH_NUMBER_PROMPT(IT_PROMPT_UN
);
119 if (number
>= 1000) {
120 if (number
>= 2000) {
121 PLAY_NUMBER(number
/ 1000, 0, 0);
122 PUSH_NUMBER_PROMPT(IT_PROMPT_MILA
);
124 PUSH_NUMBER_PROMPT(IT_PROMPT_MILLE
);
132 PUSH_NUMBER_PROMPT(IT_PROMPT_ZERO
+ number
/100);
133 PUSH_NUMBER_PROMPT(IT_PROMPT_CENT
);
138 PUSH_NUMBER_PROMPT(IT_PROMPT_ZERO
+number
);
142 IT_PUSH_UNIT_PROMPT(unit
, orignumber
);
146 I18N_PLAY_FUNCTION(it
, playDuration
, int seconds PLAY_DURATION_ATT
)
149 PLAY_NUMBER(seconds
, 0, 0);
154 PUSH_NUMBER_PROMPT(IT_PROMPT_MENO
);
158 uint8_t tmp
= seconds
/ 3600;
160 if (tmp
> 0 || IS_PLAY_TIME()) {
161 PLAY_NUMBER(tmp
, UNIT_HOURS
, 0);
167 PLAY_NUMBER(tmp
, UNIT_MINUTES
, 0);
169 PUSH_NUMBER_PROMPT(IT_PROMPT_E
);
173 PLAY_NUMBER(seconds
, UNIT_SECONDS
, 0);
177 LANGUAGE_PACK_DECLARE(it
, "Italiano");