Set all custom failsafe channels at once (#5834)
[opentx.git] / radio / src / translations / tts_hu.cpp
blobecf0549cced9a872d31ddf950989a5f648b47b28
1 /*
2 * Authors (alphabetical order)
3 * - Andre Bernet <bernet.andre@gmail.com>
4 * - Andreas Weitl
5 * - Bertrand Songis <bsongis@gmail.com>
6 * - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
7 * - Cameron Weeks <th9xer@gmail.com>
8 * - Erez Raviv
9 * - Gabriel Birkus
10 * - Jean-Pierre Parisy
11 * - Karl Szmutny
12 * - Michael Blandford
13 * - Michal Hlavinka
14 * - Pat Mackenzie
15 * - Philip Moss
16 * - Rob Thomson
17 * - Romolo Manfredini <romolo.manfredini@gmail.com>
18 * - Thomas Husterer
20 * opentx is based on code named
21 * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
22 * er9x by Erez Raviv: http://code.google.com/p/er9x/,
23 * and the original (and ongoing) project by
24 * Thomas Husterer, th9x: http://code.google.com/p/th9x/
26 * This program is free software; you can redistribute it and/or modify
27 * it under the terms of the GNU General Public License version 2 as
28 * published by the Free Software Foundation.
30 * This program is distributed in the hope that it will be useful,
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * GNU General Public License for more details.
37 #include "opentx.h"
39 enum HungarianPrompts {
40 HU_PROMPT_NUMBERS_BASE = 0,
41 HU_PROMPT_ZERO = HU_PROMPT_NUMBERS_BASE+0, //02-99
42 HU_PROMPT_HUNDRED = HU_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
43 HU_PROMPT_THOUSAND = HU_PROMPT_NUMBERS_BASE+109, //1000
44 HU_PROMPT_AND = HU_PROMPT_NUMBERS_BASE+110,
45 HU_PROMPT_MINUS = HU_PROMPT_NUMBERS_BASE+111,
46 HU_PROMPT_POINT = HU_PROMPT_NUMBERS_BASE+112,
47 HU_PROMPT_UNITS_BASE = 113,
48 HU_PROMPT_POINT_BASE = 165, //.0 - .9
51 #if defined(VOICE)
53 #if defined(CPUARM)
54 #define HU_PUSH_UNIT_PROMPT(u, p) hu_pushUnitPrompt((u), (p), id)
55 #else
56 #define HU_PUSH_UNIT_PROMPT(u, p) pushUnitPrompt((u), (p))
57 #endif
59 I18N_PLAY_FUNCTION(hu, pushUnitPrompt, uint8_t unitprompt, int16_t number)
61 #if defined(CPUARM)
62 if (number == 1)
63 PUSH_UNIT_PROMPT(unitprompt, 0);
64 else
65 PUSH_UNIT_PROMPT(unitprompt, 1);
66 #else
67 unitprompt = HU_PROMPT_UNITS_BASE + unitprompt*2;
68 if (number == 1)
69 PUSH_NUMBER_PROMPT(unitprompt);
70 else
71 PUSH_NUMBER_PROMPT(unitprompt+1);
72 #endif
75 I18N_PLAY_FUNCTION(hu, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
77 if (number < 0) {
78 PUSH_NUMBER_PROMPT(HU_PROMPT_MINUS);
79 number = -number;
82 #if !defined(CPUARM)
83 if (unit) {
84 unit--;
85 convertUnit(number, unit);
86 if (IS_IMPERIAL_ENABLE()) {
87 if (unit == UNIT_DIST) {
88 unit = UNIT_FEET;
90 if (unit == UNIT_SPEED) {
91 unit = UNIT_KTS;
94 unit++;
96 #endif
98 int8_t mode = MODE(att);
99 if (mode > 0) {
100 #if defined(CPUARM)
101 if (mode == 2) {
102 number /= 10;
104 #else
105 // we assume that we are PREC1
106 #endif
107 div_t qr = div((int)number, 10);
108 if (qr.rem) {
109 PLAY_NUMBER(qr.quot, 0, 0);
110 PUSH_NUMBER_PROMPT(HU_PROMPT_POINT_BASE + qr.rem);
111 number = -1;
113 else {
114 number = qr.quot;
118 int16_t tmp = number;
120 if (number >= 1000) {
121 PLAY_NUMBER(number / 1000, 0, 0);
122 PUSH_NUMBER_PROMPT(HU_PROMPT_THOUSAND);
123 number %= 1000;
124 if (number == 0)
125 number = -1;
127 if (number >= 100) {
128 PUSH_NUMBER_PROMPT(HU_PROMPT_HUNDRED + (number/100)-1);
129 number %= 100;
130 if (number == 0)
131 number = -1;
133 if (number >= 0) {
134 PUSH_NUMBER_PROMPT(HU_PROMPT_ZERO + number);
137 if (unit) {
138 HU_PUSH_UNIT_PROMPT(unit, tmp);
142 I18N_PLAY_FUNCTION(hu, playDuration, int seconds PLAY_DURATION_ATT)
144 if (seconds == 0) {
145 PLAY_NUMBER(seconds, 0, 0);
146 return;
149 if (seconds < 0) {
150 PUSH_NUMBER_PROMPT(HU_PROMPT_MINUS);
151 seconds = -seconds;
154 uint8_t tmp = seconds / 3600;
155 seconds %= 3600;
156 if (tmp > 0 || IS_PLAY_TIME()) {
157 PLAY_NUMBER(tmp, UNIT_HOURS, 0);
160 tmp = seconds / 60;
161 seconds %= 60;
162 if (tmp > 0) {
163 PLAY_NUMBER(tmp, UNIT_MINUTES, 0);
164 // This is not necessary in the Hungarian
165 //if (seconds > 0)
166 //PUSH_NUMBER_PROMPT(HU_PROMPT_AND);
169 if (seconds > 0) {
170 PLAY_NUMBER(seconds, UNIT_SECONDS, 0);
174 LANGUAGE_PACK_DECLARE(hu, "Hungarian");
176 #endif