1
0
Fork 0
mirror of https://github.com/EdgeTX/edgetx.git synced 2025-07-24 08:45:15 +03:00

Compilation fixes for Arch Linux

This commit is contained in:
Bertrand Songis 2017-01-07 18:42:56 +01:00
parent 91c00d0728
commit 54742fcad9
16 changed files with 2471 additions and 2473 deletions

View file

@ -306,7 +306,7 @@ void getSwitchAudioFile(char * filename, swsrc_t index)
strcpy(str, positions[swinfo.rem]); strcpy(str, positions[swinfo.rem]);
} }
else { else {
div_t swinfo = div(index - SWSRC_FIRST_MULTIPOS_SWITCH, XPOTS_MULTIPOS_COUNT); div_t swinfo = div(int(index - SWSRC_FIRST_MULTIPOS_SWITCH), XPOTS_MULTIPOS_COUNT);
*str++ = 'S'; *str++ = 'S';
*str++ = '1' + swinfo.quot; *str++ = '1' + swinfo.quot;
*str++ = '1' + swinfo.rem; *str++ = '1' + swinfo.rem;

View file

@ -532,7 +532,7 @@ void drawTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2
tme = -tme; tme = -tme;
} }
qr = div(tme, 60); qr = div((int)tme, 60);
#define separator ':' #define separator ':'
if (att & TIMEHOUR) { if (att & TIMEHOUR) {

View file

@ -305,9 +305,9 @@ void logsWrite()
if (sensor.logs) { if (sensor.logs) {
if (sensor.unit == UNIT_GPS) { if (sensor.unit == UNIT_GPS) {
if (telemetryItem.gps.longitude && telemetryItem.gps.latitude) { if (telemetryItem.gps.longitude && telemetryItem.gps.latitude) {
div_t qr = div(telemetryItem.gps.latitude, 1000000); div_t qr = div((int)telemetryItem.gps.latitude, 1000000);
f_printf(&g_oLogFile, "%d.%06d ", qr.quot, abs(qr.rem)); f_printf(&g_oLogFile, "%d.%06d ", qr.quot, abs(qr.rem));
qr = div(telemetryItem.gps.longitude, 1000000); qr = div((int)telemetryItem.gps.longitude, 1000000);
f_printf(&g_oLogFile, "%d.%06d,", qr.quot, abs(qr.rem)); f_printf(&g_oLogFile, "%d.%06d,", qr.quot, abs(qr.rem));
} }
else { else {
@ -318,12 +318,12 @@ void logsWrite()
f_printf(&g_oLogFile, "%4d-%02d-%02d %02d:%02d:%02d,", telemetryItem.datetime.year, telemetryItem.datetime.month, telemetryItem.datetime.day, telemetryItem.datetime.hour, telemetryItem.datetime.min, telemetryItem.datetime.sec); f_printf(&g_oLogFile, "%4d-%02d-%02d %02d:%02d:%02d,", telemetryItem.datetime.year, telemetryItem.datetime.month, telemetryItem.datetime.day, telemetryItem.datetime.hour, telemetryItem.datetime.min, telemetryItem.datetime.sec);
} }
else if (sensor.prec == 2) { else if (sensor.prec == 2) {
div_t qr = div(telemetryItem.value, 100); div_t qr = div((int)telemetryItem.value, 100);
if (telemetryItem.value < 0) f_printf(&g_oLogFile, "-"); if (telemetryItem.value < 0) f_printf(&g_oLogFile, "-");
f_printf(&g_oLogFile, "%d.%02d,", abs(qr.quot), abs(qr.rem)); f_printf(&g_oLogFile, "%d.%02d,", abs(qr.quot), abs(qr.rem));
} }
else if (sensor.prec == 1) { else if (sensor.prec == 1) {
div_t qr = div(telemetryItem.value, 10); div_t qr = div((int)telemetryItem.value, 10);
if (telemetryItem.value < 0) f_printf(&g_oLogFile, "-"); if (telemetryItem.value < 0) f_printf(&g_oLogFile, "-");
f_printf(&g_oLogFile, "%d.%d,", abs(qr.quot), abs(qr.rem)); f_printf(&g_oLogFile, "%d.%d,", abs(qr.quot), abs(qr.rem));
} }

View file

@ -169,7 +169,7 @@ char * getTimerString(char * dest, putstime_t tme, uint8_t hours)
*s++ = '-'; *s++ = '-';
} }
qr = div(tme, 60); qr = div((int)tme, 60);
if (hours) { if (hours) {
div_t qr2 = div(qr.quot, 60); div_t qr2 = div(qr.quot, 60);
@ -254,7 +254,7 @@ char * getSwitchString(char * dest, swsrc_t idx)
#endif #endif
#if NUM_XPOTS > 0 #if NUM_XPOTS > 0
else if (idx <= SWSRC_LAST_MULTIPOS_SWITCH) { else if (idx <= SWSRC_LAST_MULTIPOS_SWITCH) {
div_t swinfo = div(idx - SWSRC_FIRST_MULTIPOS_SWITCH, XPOTS_MULTIPOS_COUNT); div_t swinfo = div(int(idx - SWSRC_FIRST_MULTIPOS_SWITCH), XPOTS_MULTIPOS_COUNT);
char temp[LEN_ANA_NAME+1]; char temp[LEN_ANA_NAME+1];
getSourceString(temp, MIXSRC_FIRST_POT+swinfo.quot); getSourceString(temp, MIXSRC_FIRST_POT+swinfo.quot);
temp[LEN_ANA_NAME]= '\0'; temp[LEN_ANA_NAME]= '\0';

View file

@ -18,439 +18,437 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
/** @addtogroup CMSIS /** @addtogroup CMSIS
* @{ * @{
*/ */
/** @addtogroup stm32f2xx_system /** @addtogroup stm32f2xx_system
* @{ * @{
*/ */
/** @addtogroup STM32F2xx_System_Private_Includes /** @addtogroup STM32F2xx_System_Private_Includes
* @{ * @{
*/ */
#include "stm32f2xx.h" #include "stm32f2xx.h"
/** /**
* @} * @}
*/ */
/** @addtogroup STM32F2xx_System_Private_TypesDefinitions /** @addtogroup STM32F2xx_System_Private_TypesDefinitions
* @{ * @{
*/ */
/** /**
* @} * @}
*/ */
/** @addtogroup STM32F2xx_System_Private_Defines /** @addtogroup STM32F2xx_System_Private_Defines
* @{ * @{
*/ */
/*!< Uncomment the following line if you need to use external SRAM mounted /*!< Uncomment the following line if you need to use external SRAM mounted
on STM322xG_EVALboard as data memory */ on STM322xG_EVALboard as data memory */
/* #define DATA_IN_ExtSRAM */ /* #define DATA_IN_ExtSRAM */
/*!< Uncomment the following line if you need to relocate your vector Table in /*!< Uncomment the following line if you need to relocate your vector Table in
Internal SRAM. */ Internal SRAM. */
/* #define VECT_TAB_SRAM */ /* #define VECT_TAB_SRAM */
#define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset field. #define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset field.
This value must be a multiple of 0x200. */ This value must be a multiple of 0x200. */
/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */ /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */
#define PLL_M 12 #define PLL_M 12
#define PLL_N 240 #define PLL_N 240
/* SYSCLK = PLL_VCO / PLL_P */ /* SYSCLK = PLL_VCO / PLL_P */
#define PLL_P 2 #define PLL_P 2
/* USB OTG FS, SDIO and RNG Clock = PLL_VCO / PLLQ */ /* USB OTG FS, SDIO and RNG Clock = PLL_VCO / PLLQ */
#define PLL_Q 5 #define PLL_Q 5
/** /**
* @} * @}
*/ */
/** @addtogroup STM32F2xx_System_Private_Macros /** @addtogroup STM32F2xx_System_Private_Macros
* @{ * @{
*/ */
/** /**
* @} * @}
*/ */
/** @addtogroup STM32F2xx_System_Private_Variables /** @addtogroup STM32F2xx_System_Private_Variables
* @{ * @{
*/ */
uint32_t SystemCoreClock = 120000000; uint32_t SystemCoreClock = 120000000;
__I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9}; __I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
/** /**
* @} * @}
*/ */
/** @addtogroup STM32F2xx_System_Private_FunctionPrototypes /** @addtogroup STM32F2xx_System_Private_FunctionPrototypes
* @{ * @{
*/ */
static void SetSysClock(void); static void SetSysClock(void);
#ifdef DATA_IN_ExtSRAM #ifdef DATA_IN_ExtSRAM
static void SystemInit_ExtMemCtl(void); static void SystemInit_ExtMemCtl(void);
#endif /* DATA_IN_ExtSRAM */ #endif /* DATA_IN_ExtSRAM */
/** /**
* @} * @}
*/ */
/** @addtogroup STM32F2xx_System_Private_Functions /** @addtogroup STM32F2xx_System_Private_Functions
* @{ * @{
*/ */
/** /**
* @brief Setup the microcontroller system * @brief Setup the microcontroller system
* Initialize the Embedded Flash Interface, the PLL and update the * Initialize the Embedded Flash Interface, the PLL and update the
* SystemFrequency variable. * SystemFrequency variable.
* @param None * @param None
* @retval None * @retval None
*/ */
void SystemInit(void) void SystemInit(void)
{ {
/* Reset the RCC clock configuration to the default reset state ------------*/ /* Reset the RCC clock configuration to the default reset state ------------*/
/* Set HSION bit */ /* Set HSION bit */
RCC->CR |= (uint32_t)0x00000001; RCC->CR |= (uint32_t)0x00000001;
/* Reset CFGR register */ /* Reset CFGR register */
RCC->CFGR = 0x00000000; RCC->CFGR = 0x00000000;
/* Reset HSEON, CSSON and PLLON bits */ /* Reset HSEON, CSSON and PLLON bits */
RCC->CR &= (uint32_t)0xFEF6FFFF; RCC->CR &= (uint32_t)0xFEF6FFFF;
/* Reset PLLCFGR register */ /* Reset PLLCFGR register */
RCC->PLLCFGR = 0x24003010; RCC->PLLCFGR = 0x24003010;
/* Reset HSEBYP bit */ /* Reset HSEBYP bit */
RCC->CR &= (uint32_t)0xFFFBFFFF; RCC->CR &= (uint32_t)0xFFFBFFFF;
/* Disable all interrupts */ /* Disable all interrupts */
RCC->CIR = 0x00000000; RCC->CIR = 0x00000000;
#ifdef DATA_IN_ExtSRAM #ifdef DATA_IN_ExtSRAM
SystemInit_ExtMemCtl(); SystemInit_ExtMemCtl();
#endif /* DATA_IN_ExtSRAM */ #endif /* DATA_IN_ExtSRAM */
/* Configure the System clock source, PLL Multiplier and Divider factors, /* Configure the System clock source, PLL Multiplier and Divider factors,
AHB/APBx prescalers and Flash settings ----------------------------------*/ AHB/APBx prescalers and Flash settings ----------------------------------*/
SetSysClock(); SetSysClock();
/* Configure the Vector Table location add offset address ------------------*/ /* Configure the Vector Table location add offset address ------------------*/
#ifdef VECT_TAB_SRAM #ifdef VECT_TAB_SRAM
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */ SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
#else #else
extern uint32_t g_pfnVectors ; extern uint32_t g_pfnVectors ;
SCB->VTOR = (uint32_t) &g_pfnVectors ; /* Vector Table Relocation in Internal FLASH */ SCB->VTOR = (uint32_t) &g_pfnVectors ; /* Vector Table Relocation in Internal FLASH */
#endif #endif
} }
/** /**
* @brief Update SystemCoreClock variable according to Clock Register Values. * @brief Update SystemCoreClock variable according to Clock Register Values.
* The SystemCoreClock variable contains the core clock (HCLK), it can * The SystemCoreClock variable contains the core clock (HCLK), it can
* be used by the user application to setup the SysTick timer or configure * be used by the user application to setup the SysTick timer or configure
* other parameters. * other parameters.
* *
* @note Each time the core clock (HCLK) changes, this function must be called * @note Each time the core clock (HCLK) changes, this function must be called
* to update SystemCoreClock variable value. Otherwise, any configuration * to update SystemCoreClock variable value. Otherwise, any configuration
* based on this variable will be incorrect. * based on this variable will be incorrect.
* *
* @note - The system frequency computed by this function is not the real * @note - The system frequency computed by this function is not the real
* frequency in the chip. It is calculated based on the predefined * frequency in the chip. It is calculated based on the predefined
* constant and the selected clock source: * constant and the selected clock source:
* *
* - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*) * - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
* *
* - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**) * - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**)
* *
* - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**) * - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**)
* or HSI_VALUE(*) multiplied/divided by the PLL factors. * or HSI_VALUE(*) multiplied/divided by the PLL factors.
* *
* (*) HSI_VALUE is a constant defined in stm32f2xx.h file (default value * (*) HSI_VALUE is a constant defined in stm32f2xx.h file (default value
* 16 MHz) but the real value may vary depending on the variations * 16 MHz) but the real value may vary depending on the variations
* in voltage and temperature. * in voltage and temperature.
* *
* (**) HSE_VALUE is a constant defined in stm32f2xx.h file (default value * (**) HSE_VALUE is a constant defined in stm32f2xx.h file (default value
* 25 MHz), user has to ensure that HSE_VALUE is same as the real * 25 MHz), user has to ensure that HSE_VALUE is same as the real
* frequency of the crystal used. Otherwise, this function may * frequency of the crystal used. Otherwise, this function may
* have wrong result. * have wrong result.
* *
* - The result of this function could be not correct when using fractional * - The result of this function could be not correct when using fractional
* value for HSE crystal. * value for HSE crystal.
* *
* @param None * @param None
* @retval None * @retval None
*/ */
void SystemCoreClockUpdate(void) void SystemCoreClockUpdate(void)
{ {
uint32_t tmp = 0, pllvco = 0, pllp = 2, pllsource = 0, pllm = 2; uint32_t tmp = 0, pllvco = 0, pllp = 2, pllsource = 0, pllm = 2;
/* Get SYSCLK source -------------------------------------------------------*/ /* Get SYSCLK source -------------------------------------------------------*/
tmp = RCC->CFGR & RCC_CFGR_SWS; tmp = RCC->CFGR & RCC_CFGR_SWS;
switch (tmp) switch (tmp)
{ {
case 0x00: /* HSI used as system clock source */ case 0x00: /* HSI used as system clock source */
SystemCoreClock = HSI_VALUE; SystemCoreClock = HSI_VALUE;
break; break;
case 0x04: /* HSE used as system clock source */ case 0x04: /* HSE used as system clock source */
SystemCoreClock = HSE_VALUE; SystemCoreClock = HSE_VALUE;
break; break;
case 0x08: /* PLL used as system clock source */ case 0x08: /* PLL used as system clock source */
/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N
SYSCLK = PLL_VCO / PLL_P SYSCLK = PLL_VCO / PLL_P
*/ */
pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) >> 22; pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) >> 22;
pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM; pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM;
if (pllsource != 0) if (pllsource != 0)
{ {
/* HSE used as PLL clock source */ /* HSE used as PLL clock source */
pllvco = (HSE_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6); pllvco = (HSE_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);
} }
else else
{ {
/* HSI used as PLL clock source */ /* HSI used as PLL clock source */
pllvco = (HSI_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6); pllvco = (HSI_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);
} }
pllp = (((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) >>16) + 1 ) *2; pllp = (((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) >>16) + 1 ) *2;
SystemCoreClock = pllvco/pllp; SystemCoreClock = pllvco/pllp;
break; break;
default: default:
SystemCoreClock = HSI_VALUE; SystemCoreClock = HSI_VALUE;
break; break;
} }
/* Compute HCLK frequency --------------------------------------------------*/ /* Compute HCLK frequency --------------------------------------------------*/
/* Get HCLK prescaler */ /* Get HCLK prescaler */
tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)]; tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)];
/* HCLK frequency */ /* HCLK frequency */
SystemCoreClock >>= tmp; SystemCoreClock >>= tmp;
} }
/** /**
* @brief Configures the System clock source, PLL Multiplier and Divider factors, * @brief Configures the System clock source, PLL Multiplier and Divider factors,
* AHB/APBx prescalers and Flash settings * AHB/APBx prescalers and Flash settings
* @Note This function should be called only once the RCC clock configuration * @Note This function should be called only once the RCC clock configuration
* is reset to the default reset state (done in SystemInit() function). * is reset to the default reset state (done in SystemInit() function).
* @param None * @param None
* @retval None * @retval None
*/ */
static void SetSysClock(void) static void SetSysClock(void)
{ {
/******************************************************************************/ /******************************************************************************/
/* PLL (clocked by HSE) used as System clock source */ /* PLL (clocked by HSE) used as System clock source */
/******************************************************************************/ /******************************************************************************/
__IO uint32_t StartUpCounter = 0, HSEStatus = 0; __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
/* Enable HSE */ /* Enable HSE */
RCC->CR |= ((uint32_t)RCC_CR_HSEON); RCC->CR |= ((uint32_t)RCC_CR_HSEON);
/* Wait till HSE is ready and if Time out is reached exit */ /* Wait till HSE is ready and if Time out is reached exit */
do do
{ {
HSEStatus = RCC->CR & RCC_CR_HSERDY; HSEStatus = RCC->CR & RCC_CR_HSERDY;
StartUpCounter++; StartUpCounter++;
} while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT)); } while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
if ((RCC->CR & RCC_CR_HSERDY) != RESET) if ((RCC->CR & RCC_CR_HSERDY) != RESET)
{ {
HSEStatus = (uint32_t)0x01; HSEStatus = (uint32_t)0x01;
} }
else else
{ {
HSEStatus = (uint32_t)0x00; HSEStatus = (uint32_t)0x00;
} }
if (HSEStatus == (uint32_t)0x01) if (HSEStatus == (uint32_t)0x01)
{ {
/* HCLK = SYSCLK / 1*/ /* HCLK = SYSCLK / 1*/
RCC->CFGR |= RCC_CFGR_HPRE_DIV1; RCC->CFGR |= RCC_CFGR_HPRE_DIV1;
/* PCLK2 = HCLK / 2*/ /* PCLK2 = HCLK / 2*/
RCC->CFGR |= RCC_CFGR_PPRE2_DIV2; RCC->CFGR |= RCC_CFGR_PPRE2_DIV2;
/* PCLK1 = HCLK / 4*/ /* PCLK1 = HCLK / 4*/
RCC->CFGR |= RCC_CFGR_PPRE1_DIV4; RCC->CFGR |= RCC_CFGR_PPRE1_DIV4;
/* Configure the main PLL */ /* Configure the main PLL */
RCC->PLLCFGR = PLL_M | (PLL_N << 6) | (((PLL_P >> 1) -1) << 16) | RCC->PLLCFGR = PLL_M | (PLL_N << 6) | (((PLL_P >> 1) -1) << 16) |
(RCC_PLLCFGR_PLLSRC_HSE) | (PLL_Q << 24); (RCC_PLLCFGR_PLLSRC_HSE) | (PLL_Q << 24);
/* Enable the main PLL */ /* Enable the main PLL */
RCC->CR |= RCC_CR_PLLON; RCC->CR |= RCC_CR_PLLON;
/* Wait till the main PLL is ready */ /* Wait till the main PLL is ready */
while((RCC->CR & RCC_CR_PLLRDY) == 0) while((RCC->CR & RCC_CR_PLLRDY) == 0)
{ {
} }
/* Configure Flash prefetch, Instruction cache, Data cache and wait state */ /* Configure Flash prefetch, Instruction cache, Data cache and wait state */
FLASH->ACR = FLASH_ACR_PRFTEN |FLASH_ACR_ICEN |FLASH_ACR_DCEN |FLASH_ACR_LATENCY_3WS; FLASH->ACR = FLASH_ACR_PRFTEN |FLASH_ACR_ICEN |FLASH_ACR_DCEN |FLASH_ACR_LATENCY_3WS;
/* Select the main PLL as system clock source */ /* Select the main PLL as system clock source */
RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW)); RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));
RCC->CFGR |= RCC_CFGR_SW_PLL; RCC->CFGR |= RCC_CFGR_SW_PLL;
/* Wait till the main PLL is used as system clock source */ /* Wait till the main PLL is used as system clock source */
while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL); while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL);
{ }
} else
} { /* If HSE fails to start-up, the application will have wrong clock
else configuration. User can add here some code to deal with this error */
{ /* If HSE fails to start-up, the application will have wrong clock }
configuration. User can add here some code to deal with this error */
} }
} /**
* @brief Setup the external memory controller. Called in startup_stm32f2xx.s
/** * before jump to __main
* @brief Setup the external memory controller. Called in startup_stm32f2xx.s * @param None
* before jump to __main * @retval None
* @param None */
* @retval None #ifdef DATA_IN_ExtSRAM
*/ /**
#ifdef DATA_IN_ExtSRAM * @brief Setup the external memory controller.
/** * Called in startup_stm32f2xx.s before jump to main.
* @brief Setup the external memory controller. * This function configures the external SRAM mounted on STM322xG_EVAL board
* Called in startup_stm32f2xx.s before jump to main. * This SRAM will be used as program data memory (including heap and stack).
* This function configures the external SRAM mounted on STM322xG_EVAL board * @param None
* This SRAM will be used as program data memory (including heap and stack). * @retval None
* @param None */
* @retval None void SystemInit_ExtMemCtl(void)
*/ {
void SystemInit_ExtMemCtl(void) /*-- GPIOs Configuration -----------------------------------------------------*/
{ /*
/*-- GPIOs Configuration -----------------------------------------------------*/ +-------------------+--------------------+------------------+------------------+
/* + SRAM pins assignment +
+-------------------+--------------------+------------------+------------------+ +-------------------+--------------------+------------------+------------------+
+ SRAM pins assignment + | PD0 <-> FSMC_D2 | PE0 <-> FSMC_NBL0 | PF0 <-> FSMC_A0 | PG0 <-> FSMC_A10 |
+-------------------+--------------------+------------------+------------------+ | PD1 <-> FSMC_D3 | PE1 <-> FSMC_NBL1 | PF1 <-> FSMC_A1 | PG1 <-> FSMC_A11 |
| PD0 <-> FSMC_D2 | PE0 <-> FSMC_NBL0 | PF0 <-> FSMC_A0 | PG0 <-> FSMC_A10 | | PD4 <-> FSMC_NOE | PE7 <-> FSMC_D4 | PF2 <-> FSMC_A2 | PG2 <-> FSMC_A12 |
| PD1 <-> FSMC_D3 | PE1 <-> FSMC_NBL1 | PF1 <-> FSMC_A1 | PG1 <-> FSMC_A11 | | PD5 <-> FSMC_NWE | PE8 <-> FSMC_D5 | PF3 <-> FSMC_A3 | PG3 <-> FSMC_A13 |
| PD4 <-> FSMC_NOE | PE7 <-> FSMC_D4 | PF2 <-> FSMC_A2 | PG2 <-> FSMC_A12 | | PD8 <-> FSMC_D13 | PE9 <-> FSMC_D6 | PF4 <-> FSMC_A4 | PG4 <-> FSMC_A14 |
| PD5 <-> FSMC_NWE | PE8 <-> FSMC_D5 | PF3 <-> FSMC_A3 | PG3 <-> FSMC_A13 | | PD9 <-> FSMC_D14 | PE10 <-> FSMC_D7 | PF5 <-> FSMC_A5 | PG5 <-> FSMC_A15 |
| PD8 <-> FSMC_D13 | PE9 <-> FSMC_D6 | PF4 <-> FSMC_A4 | PG4 <-> FSMC_A14 | | PD10 <-> FSMC_D15 | PE11 <-> FSMC_D8 | PF12 <-> FSMC_A6 | PG9 <-> FSMC_NE2 |
| PD9 <-> FSMC_D14 | PE10 <-> FSMC_D7 | PF5 <-> FSMC_A5 | PG5 <-> FSMC_A15 | | PD11 <-> FSMC_A16 | PE12 <-> FSMC_D9 | PF13 <-> FSMC_A7 |------------------+
| PD10 <-> FSMC_D15 | PE11 <-> FSMC_D8 | PF12 <-> FSMC_A6 | PG9 <-> FSMC_NE2 | | PD12 <-> FSMC_A17 | PE13 <-> FSMC_D10 | PF14 <-> FSMC_A8 |
| PD11 <-> FSMC_A16 | PE12 <-> FSMC_D9 | PF13 <-> FSMC_A7 |------------------+ | PD14 <-> FSMC_D0 | PE14 <-> FSMC_D11 | PF15 <-> FSMC_A9 |
| PD12 <-> FSMC_A17 | PE13 <-> FSMC_D10 | PF14 <-> FSMC_A8 | | PD15 <-> FSMC_D1 | PE15 <-> FSMC_D12 |------------------+
| PD14 <-> FSMC_D0 | PE14 <-> FSMC_D11 | PF15 <-> FSMC_A9 | +-------------------+--------------------+
| PD15 <-> FSMC_D1 | PE15 <-> FSMC_D12 |------------------+ */
+-------------------+--------------------+ /* Enable GPIOD, GPIOE, GPIOF and GPIOG interface clock */
*/ RCC->AHB1ENR = 0x00000078;
/* Enable GPIOD, GPIOE, GPIOF and GPIOG interface clock */
RCC->AHB1ENR = 0x00000078; /* Connect PDx pins to FSMC Alternate function */
GPIOD->AFR[0] = 0x00cc00cc;
/* Connect PDx pins to FSMC Alternate function */ GPIOD->AFR[1] = 0xcc0ccccc;
GPIOD->AFR[0] = 0x00cc00cc; /* Configure PDx pins in Alternate function mode */
GPIOD->AFR[1] = 0xcc0ccccc; GPIOD->MODER = 0xa2aa0a0a;
/* Configure PDx pins in Alternate function mode */ /* Configure PDx pins speed to 100 MHz */
GPIOD->MODER = 0xa2aa0a0a; GPIOD->OSPEEDR = 0xf3ff0f0f;
/* Configure PDx pins speed to 100 MHz */ /* Configure PDx pins Output type to push-pull */
GPIOD->OSPEEDR = 0xf3ff0f0f; GPIOD->OTYPER = 0x00000000;
/* Configure PDx pins Output type to push-pull */ /* No pull-up, pull-down for PDx pins */
GPIOD->OTYPER = 0x00000000; GPIOD->PUPDR = 0x00000000;
/* No pull-up, pull-down for PDx pins */
GPIOD->PUPDR = 0x00000000; /* Connect PEx pins to FSMC Alternate function */
GPIOE->AFR[0] = 0xc00000cc;
/* Connect PEx pins to FSMC Alternate function */ GPIOE->AFR[1] = 0xcccccccc;
GPIOE->AFR[0] = 0xc00000cc; /* Configure PEx pins in Alternate function mode */
GPIOE->AFR[1] = 0xcccccccc; GPIOE->MODER = 0xaaaa800a;
/* Configure PEx pins in Alternate function mode */ /* Configure PEx pins speed to 100 MHz */
GPIOE->MODER = 0xaaaa800a; GPIOE->OSPEEDR = 0xffffc00f;
/* Configure PEx pins speed to 100 MHz */ /* Configure PEx pins Output type to push-pull */
GPIOE->OSPEEDR = 0xffffc00f; GPIOE->OTYPER = 0x00000000;
/* Configure PEx pins Output type to push-pull */ /* No pull-up, pull-down for PEx pins */
GPIOE->OTYPER = 0x00000000; GPIOE->PUPDR = 0x00000000;
/* No pull-up, pull-down for PEx pins */
GPIOE->PUPDR = 0x00000000; /* Connect PFx pins to FSMC Alternate function */
GPIOF->AFR[0] = 0x00cccccc;
/* Connect PFx pins to FSMC Alternate function */ GPIOF->AFR[1] = 0xcccc0000;
GPIOF->AFR[0] = 0x00cccccc; /* Configure PFx pins in Alternate function mode */
GPIOF->AFR[1] = 0xcccc0000; GPIOF->MODER = 0xaa000aaa;
/* Configure PFx pins in Alternate function mode */ /* Configure PFx pins speed to 100 MHz */
GPIOF->MODER = 0xaa000aaa; GPIOF->OSPEEDR = 0xff000fff;
/* Configure PFx pins speed to 100 MHz */ /* Configure PFx pins Output type to push-pull */
GPIOF->OSPEEDR = 0xff000fff; GPIOF->OTYPER = 0x00000000;
/* Configure PFx pins Output type to push-pull */ /* No pull-up, pull-down for PFx pins */
GPIOF->OTYPER = 0x00000000; GPIOF->PUPDR = 0x00000000;
/* No pull-up, pull-down for PFx pins */
GPIOF->PUPDR = 0x00000000; /* Connect PGx pins to FSMC Alternate function */
GPIOG->AFR[0] = 0x00cccccc;
/* Connect PGx pins to FSMC Alternate function */ GPIOG->AFR[1] = 0x000000c0;
GPIOG->AFR[0] = 0x00cccccc; /* Configure PGx pins in Alternate function mode */
GPIOG->AFR[1] = 0x000000c0; GPIOG->MODER = 0x00080aaa;
/* Configure PGx pins in Alternate function mode */ /* Configure PGx pins speed to 100 MHz */
GPIOG->MODER = 0x00080aaa; GPIOG->OSPEEDR = 0x000c0fff;
/* Configure PGx pins speed to 100 MHz */ /* Configure PGx pins Output type to push-pull */
GPIOG->OSPEEDR = 0x000c0fff; GPIOG->OTYPER = 0x00000000;
/* Configure PGx pins Output type to push-pull */ /* No pull-up, pull-down for PGx pins */
GPIOG->OTYPER = 0x00000000; GPIOG->PUPDR = 0x00000000;
/* No pull-up, pull-down for PGx pins */
GPIOG->PUPDR = 0x00000000; /*-- FSMC Configuration ------------------------------------------------------*/
/* Enable the FSMC interface clock */
/*-- FSMC Configuration ------------------------------------------------------*/ RCC->AHB3ENR = 0x00000001;
/* Enable the FSMC interface clock */
RCC->AHB3ENR = 0x00000001; /* Configure and enable Bank1_SRAM2 */
FSMC_Bank1->BTCR[2] = 0x00001015;
/* Configure and enable Bank1_SRAM2 */ FSMC_Bank1->BTCR[3] = 0x00010400;
FSMC_Bank1->BTCR[2] = 0x00001015; FSMC_Bank1E->BWTR[2] = 0x0fffffff;
FSMC_Bank1->BTCR[3] = 0x00010400; /*
FSMC_Bank1E->BWTR[2] = 0x0fffffff; Bank1_SRAM2 is configured as follow:
/*
Bank1_SRAM2 is configured as follow: p.FSMC_AddressSetupTime = 0;
p.FSMC_AddressHoldTime = 0;
p.FSMC_AddressSetupTime = 0; p.FSMC_DataSetupTime = 4;
p.FSMC_AddressHoldTime = 0; p.FSMC_BusTurnAroundDuration = 1;
p.FSMC_DataSetupTime = 4; p.FSMC_CLKDivision = 0;
p.FSMC_BusTurnAroundDuration = 1; p.FSMC_DataLatency = 0;
p.FSMC_CLKDivision = 0; p.FSMC_AccessMode = FSMC_AccessMode_A;
p.FSMC_DataLatency = 0;
p.FSMC_AccessMode = FSMC_AccessMode_A; FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM2;
FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM2; FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_PSRAM;
FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable; FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;
FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_PSRAM; FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b; FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;
FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable; FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable; FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low; FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable; FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState; FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable; FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;
FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable; FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable; FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p;
FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable; FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;
FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p; */
FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;
*/ }
#endif /* DATA_IN_ExtSRAM */
}
#endif /* DATA_IN_ExtSRAM */
/**
* @}
/** */
* @}
*/ /**
* @}
/** */
* @}
*/ /**
* @}
/** */
* @} /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
*/
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/

View file

@ -1,241 +1,241 @@
/* /*
* Authors (alphabetical order) * Authors (alphabetical order)
* - Bertrand Songis <bsongis@gmail.com> * - Bertrand Songis <bsongis@gmail.com>
* - Martin Hotar <mhotar@gmail.com> * - Martin Hotar <mhotar@gmail.com>
* *
* opentx is based on code named * opentx is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/, * er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by * and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/ * Thomas Husterer, th9x: http://code.google.com/p/th9x/
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
*/ */
#include "opentx.h" #include "opentx.h"
enum CzechPrompts { enum CzechPrompts {
CZ_PROMPT_NUMBERS_BASE = 0, CZ_PROMPT_NUMBERS_BASE = 0,
CZ_PROMPT_NULA = CZ_PROMPT_NUMBERS_BASE+0, //0-99 CZ_PROMPT_NULA = CZ_PROMPT_NUMBERS_BASE+0, //0-99
CZ_PROMPT_STO = CZ_PROMPT_NUMBERS_BASE+100, //100,200 .. 900 CZ_PROMPT_STO = CZ_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
CZ_PROMPT_TISIC = CZ_PROMPT_NUMBERS_BASE+109, //1000 CZ_PROMPT_TISIC = CZ_PROMPT_NUMBERS_BASE+109, //1000
CZ_PROMPT_TISICE = CZ_PROMPT_NUMBERS_BASE+110, CZ_PROMPT_TISICE = CZ_PROMPT_NUMBERS_BASE+110,
CZ_PROMPT_JEDEN = CZ_PROMPT_NUMBERS_BASE+111, CZ_PROMPT_JEDEN = CZ_PROMPT_NUMBERS_BASE+111,
CZ_PROMPT_JEDNO = CZ_PROMPT_NUMBERS_BASE+112, CZ_PROMPT_JEDNO = CZ_PROMPT_NUMBERS_BASE+112,
CZ_PROMPT_DVE = CZ_PROMPT_NUMBERS_BASE+113, CZ_PROMPT_DVE = CZ_PROMPT_NUMBERS_BASE+113,
CZ_PROMPT_CELA = CZ_PROMPT_NUMBERS_BASE+114, CZ_PROMPT_CELA = CZ_PROMPT_NUMBERS_BASE+114,
CZ_PROMPT_CELE = CZ_PROMPT_NUMBERS_BASE+115, CZ_PROMPT_CELE = CZ_PROMPT_NUMBERS_BASE+115,
CZ_PROMPT_CELYCH = CZ_PROMPT_NUMBERS_BASE+116, CZ_PROMPT_CELYCH = CZ_PROMPT_NUMBERS_BASE+116,
CZ_PROMPT_MINUS = CZ_PROMPT_NUMBERS_BASE+117, CZ_PROMPT_MINUS = CZ_PROMPT_NUMBERS_BASE+117,
CZ_PROMPT_UNITS_BASE = 118, //(jeden)volt,(dva)volty,(pet)voltu,(desetina)voltu CZ_PROMPT_UNITS_BASE = 118, //(jeden)volt,(dva)volty,(pet)voltu,(desetina)voltu
}; };
#if defined(VOICE) #if defined(VOICE)
#if defined(CPUARM) #if defined(CPUARM)
#define CZ_PUSH_UNIT_PROMPT(p, u) cz_pushUnitPrompt((p), (u), id) #define CZ_PUSH_UNIT_PROMPT(p, u) cz_pushUnitPrompt((p), (u), id)
#else #else
#define CZ_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u)) #define CZ_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u))
#endif #endif
#define MUZSKY 0x80 #define MUZSKY 0x80
#define ZENSKY 0x81 #define ZENSKY 0x81
#define STREDNI 0x82 #define STREDNI 0x82
I18N_PLAY_FUNCTION(cz, pushUnitPrompt, int16_t number, uint8_t unitprompt) I18N_PLAY_FUNCTION(cz, pushUnitPrompt, int16_t number, uint8_t unitprompt)
{ {
#if defined(CPUARM) #if defined(CPUARM)
if (number == 1) if (number == 1)
PUSH_UNIT_PROMPT(unitprompt, 0); PUSH_UNIT_PROMPT(unitprompt, 0);
else if (number > 1 && number < 5) else if (number > 1 && number < 5)
PUSH_UNIT_PROMPT(unitprompt, 1); PUSH_UNIT_PROMPT(unitprompt, 1);
else else
PUSH_UNIT_PROMPT(unitprompt, 2); PUSH_UNIT_PROMPT(unitprompt, 2);
#else #else
unitprompt = CZ_PROMPT_UNITS_BASE+((unitprompt-1)*4); unitprompt = CZ_PROMPT_UNITS_BASE+((unitprompt-1)*4);
if (number == 1) if (number == 1)
PUSH_NUMBER_PROMPT(unitprompt); PUSH_NUMBER_PROMPT(unitprompt);
else if (number > 1 && number < 5) else if (number > 1 && number < 5)
PUSH_NUMBER_PROMPT(unitprompt+1); PUSH_NUMBER_PROMPT(unitprompt+1);
else else
PUSH_NUMBER_PROMPT(unitprompt+2); PUSH_NUMBER_PROMPT(unitprompt+2);
#endif #endif
} }
I18N_PLAY_FUNCTION(cz, playNumber, getvalue_t number, uint8_t unit, uint8_t att) I18N_PLAY_FUNCTION(cz, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{ {
if (number < 0) { if (number < 0) {
PUSH_NUMBER_PROMPT(CZ_PROMPT_MINUS); PUSH_NUMBER_PROMPT(CZ_PROMPT_MINUS);
number = -number; number = -number;
} }
#if !defined(CPUARM) #if !defined(CPUARM)
if (unit) { if (unit) {
unit--; unit--;
convertUnit(number, unit); convertUnit(number, unit);
if (IS_IMPERIAL_ENABLE()) { if (IS_IMPERIAL_ENABLE()) {
if (unit == UNIT_DIST) { if (unit == UNIT_DIST) {
unit = UNIT_FEET; unit = UNIT_FEET;
} }
if (unit == UNIT_SPEED) { if (unit == UNIT_SPEED) {
unit = UNIT_KTS; unit = UNIT_KTS;
} }
} }
unit++; unit++;
} }
#endif #endif
int8_t mode = MODE(att); int8_t mode = MODE(att);
if (mode > 0) { if (mode > 0) {
#if defined(CPUARM) #if defined(CPUARM)
if (mode == 2) { if (mode == 2) {
number /= 10; number /= 10;
} }
#else #else
// we assume that we are PREC1 // we assume that we are PREC1
#endif #endif
div_t qr = div(number, 10); div_t qr = div((int)number, 10);
if (qr.rem) { if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, ZENSKY); PLAY_NUMBER(qr.quot, 0, ZENSKY);
if (qr.quot == 0) if (qr.quot == 0)
PUSH_NUMBER_PROMPT(CZ_PROMPT_CELA); PUSH_NUMBER_PROMPT(CZ_PROMPT_CELA);
else else
CZ_PUSH_UNIT_PROMPT(qr.quot, CZ_PROMPT_CELA); CZ_PUSH_UNIT_PROMPT(qr.quot, CZ_PROMPT_CELA);
PLAY_NUMBER(qr.rem, 0, ZENSKY); PLAY_NUMBER(qr.rem, 0, ZENSKY);
PUSH_NUMBER_PROMPT(CZ_PROMPT_UNITS_BASE+((unit-1)*4)+3); PUSH_NUMBER_PROMPT(CZ_PROMPT_UNITS_BASE+((unit-1)*4)+3);
return; return;
} }
else else
number = qr.quot; number = qr.quot;
} }
int16_t tmp = number; int16_t tmp = number;
#if defined(CPUARM) #if defined(CPUARM)
switch(unit) { switch(unit) {
case 0: case 0:
break; break;
case 6: case 6:
case 8: case 8:
case 10: case 10:
case 14: case 14:
case 18: case 18:
case 21: case 21:
case 22: case 22:
case 23: case 23:
case 24: case 24:
case 25: case 25:
case 26: case 26:
att = ZENSKY; att = ZENSKY;
break; break;
case 13: case 13:
case 19: case 19:
att = STREDNI; att = STREDNI;
break; break;
default: default:
att = MUZSKY; att = MUZSKY;
break; break;
} }
#else #else
switch(unit) { switch(unit) {
case 0: case 0:
break; break;
case 4: case 4:
case 10: case 10:
case 13: case 13:
case 14: case 14:
case 15: case 15:
case 16: case 16:
case 17: case 17:
case 18: case 18:
att = ZENSKY; att = ZENSKY;
break; break;
case 8: case 8:
case 19: case 19:
att = STREDNI; att = STREDNI;
break; break;
default: default:
att = MUZSKY; att = MUZSKY;
break; break;
} }
#endif #endif
if ((number == 1) && (att == MUZSKY)) { if ((number == 1) && (att == MUZSKY)) {
PUSH_NUMBER_PROMPT(CZ_PROMPT_JEDEN); PUSH_NUMBER_PROMPT(CZ_PROMPT_JEDEN);
number = -1; number = -1;
} }
if ((number == 1) && (att == STREDNI)) { if ((number == 1) && (att == STREDNI)) {
PUSH_NUMBER_PROMPT(CZ_PROMPT_JEDNO); PUSH_NUMBER_PROMPT(CZ_PROMPT_JEDNO);
number = -1; number = -1;
} }
if ((number == 2) && ((att == ZENSKY) || (att == STREDNI))) { if ((number == 2) && ((att == ZENSKY) || (att == STREDNI))) {
PUSH_NUMBER_PROMPT(CZ_PROMPT_DVE); PUSH_NUMBER_PROMPT(CZ_PROMPT_DVE);
number = -1; number = -1;
} }
if (number >= 1000) { if (number >= 1000) {
if (number >= 2000) if (number >= 2000)
PLAY_NUMBER(number / 1000, 0, 0); PLAY_NUMBER(number / 1000, 0, 0);
if (number >= 2000 && number < 5000) if (number >= 2000 && number < 5000)
PUSH_NUMBER_PROMPT(CZ_PROMPT_TISICE); PUSH_NUMBER_PROMPT(CZ_PROMPT_TISICE);
else else
PUSH_NUMBER_PROMPT(CZ_PROMPT_TISIC); PUSH_NUMBER_PROMPT(CZ_PROMPT_TISIC);
number %= 1000; number %= 1000;
if (number == 0) if (number == 0)
number = -1; number = -1;
} }
if (number >= 100) { if (number >= 100) {
PUSH_NUMBER_PROMPT(CZ_PROMPT_STO + (number/100)-1); PUSH_NUMBER_PROMPT(CZ_PROMPT_STO + (number/100)-1);
number %= 100; number %= 100;
if (number == 0) if (number == 0)
number = -1; number = -1;
} }
if (number >= 0) { if (number >= 0) {
PUSH_NUMBER_PROMPT(CZ_PROMPT_NULA+number); PUSH_NUMBER_PROMPT(CZ_PROMPT_NULA+number);
} }
if (unit) { if (unit) {
CZ_PUSH_UNIT_PROMPT(tmp, unit); CZ_PUSH_UNIT_PROMPT(tmp, unit);
} }
} }
I18N_PLAY_FUNCTION(cz, playDuration, int seconds PLAY_DURATION_ATT) I18N_PLAY_FUNCTION(cz, playDuration, int seconds PLAY_DURATION_ATT)
{ {
if (seconds < 0) { if (seconds < 0) {
PUSH_NUMBER_PROMPT(CZ_PROMPT_MINUS); PUSH_NUMBER_PROMPT(CZ_PROMPT_MINUS);
seconds = -seconds; seconds = -seconds;
} }
uint8_t tmp = seconds / 3600; uint8_t tmp = seconds / 3600;
seconds %= 3600; seconds %= 3600;
if (tmp > 0 || IS_PLAY_TIME()) { if (tmp > 0 || IS_PLAY_TIME()) {
PLAY_NUMBER(tmp, UNIT_HOURS, ZENSKY); PLAY_NUMBER(tmp, UNIT_HOURS, ZENSKY);
} }
tmp = seconds / 60; tmp = seconds / 60;
seconds %= 60; seconds %= 60;
if (tmp > 0) { if (tmp > 0) {
PLAY_NUMBER(tmp, UNIT_MINUTES, ZENSKY); PLAY_NUMBER(tmp, UNIT_MINUTES, ZENSKY);
} }
if (seconds > 0) { if (seconds > 0) {
PLAY_NUMBER(seconds, UNIT_SECONDS, ZENSKY); PLAY_NUMBER(seconds, UNIT_SECONDS, ZENSKY);
} }
} }
LANGUAGE_PACK_DECLARE(cz, "Czech"); LANGUAGE_PACK_DECLARE(cz, "Czech");
#endif #endif

View file

@ -1,246 +1,246 @@
/* /*
* Authors (alphabetical order) * Authors (alphabetical order)
* - Andre Bernet <bernet.andre@gmail.com> * - Andre Bernet <bernet.andre@gmail.com>
* - Andreas Weitl <andreas.weitl@gmx.de> * - Andreas Weitl <andreas.weitl@gmx.de>
* - Bertrand Songis <bsongis@gmail.com> * - Bertrand Songis <bsongis@gmail.com>
* - Benjamin Boy <rcbebo82@googlemail.com> * - Benjamin Boy <rcbebo82@googlemail.com>
* - Thomas Husterer * - Thomas Husterer
* *
* opentx is based on code named * opentx is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/, * er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by * and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/ * Thomas Husterer, th9x: http://code.google.com/p/th9x/
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
*/ */
#include "opentx.h" #include "opentx.h"
enum GermanPrompts { enum GermanPrompts {
DE_PROMPT_NUMBERS_BASE = 0, DE_PROMPT_NUMBERS_BASE = 0,
DE_PROMPT_NULL = DE_PROMPT_NUMBERS_BASE+0, DE_PROMPT_NULL = DE_PROMPT_NUMBERS_BASE+0,
DE_PROMPT_EIN = DE_PROMPT_NUMBERS_BASE+100, DE_PROMPT_EIN = DE_PROMPT_NUMBERS_BASE+100,
DE_PROMPT_EINE = DE_PROMPT_NUMBERS_BASE+101, DE_PROMPT_EINE = DE_PROMPT_NUMBERS_BASE+101,
DE_PROMPT_HUNDERT = DE_PROMPT_NUMBERS_BASE+102, DE_PROMPT_HUNDERT = DE_PROMPT_NUMBERS_BASE+102,
DE_PROMPT_TAUSEND = DE_PROMPT_NUMBERS_BASE+103, DE_PROMPT_TAUSEND = DE_PROMPT_NUMBERS_BASE+103,
DE_PROMPT_COMMA = 104, DE_PROMPT_COMMA = 104,
DE_PROMPT_UND, DE_PROMPT_UND,
DE_PROMPT_MINUS, DE_PROMPT_MINUS,
DE_PROMPT_UHR, DE_PROMPT_UHR,
DE_PROMPT_MINUTE, DE_PROMPT_MINUTE,
DE_PROMPT_MINUTEN, DE_PROMPT_MINUTEN,
DE_PROMPT_SEKUNDE, DE_PROMPT_SEKUNDE,
DE_PROMPT_SEKUNDEN, DE_PROMPT_SEKUNDEN,
DE_PROMPT_STUNDE, DE_PROMPT_STUNDE,
DE_PROMPT_STUNDEN, DE_PROMPT_STUNDEN,
DE_PROMPT_UNITS_BASE = 114, DE_PROMPT_UNITS_BASE = 114,
DE_PROMPT_VOLTS = DE_PROMPT_UNITS_BASE+UNIT_VOLTS, DE_PROMPT_VOLTS = DE_PROMPT_UNITS_BASE+UNIT_VOLTS,
DE_PROMPT_AMPS = DE_PROMPT_UNITS_BASE+UNIT_AMPS, DE_PROMPT_AMPS = DE_PROMPT_UNITS_BASE+UNIT_AMPS,
DE_PROMPT_METERS_PER_SECOND = DE_PROMPT_UNITS_BASE+UNIT_METERS_PER_SECOND, DE_PROMPT_METERS_PER_SECOND = DE_PROMPT_UNITS_BASE+UNIT_METERS_PER_SECOND,
DE_PROMPT_SPARE1 = DE_PROMPT_UNITS_BASE+UNIT_RAW, DE_PROMPT_SPARE1 = DE_PROMPT_UNITS_BASE+UNIT_RAW,
DE_PROMPT_KMH = DE_PROMPT_UNITS_BASE+UNIT_SPEED, DE_PROMPT_KMH = DE_PROMPT_UNITS_BASE+UNIT_SPEED,
DE_PROMPT_METERS = DE_PROMPT_UNITS_BASE+UNIT_DIST, DE_PROMPT_METERS = DE_PROMPT_UNITS_BASE+UNIT_DIST,
DE_PROMPT_DEGREES = DE_PROMPT_UNITS_BASE+UNIT_TEMPERATURE, DE_PROMPT_DEGREES = DE_PROMPT_UNITS_BASE+UNIT_TEMPERATURE,
DE_PROMPT_PERCENT = DE_PROMPT_UNITS_BASE+UNIT_PERCENT, DE_PROMPT_PERCENT = DE_PROMPT_UNITS_BASE+UNIT_PERCENT,
DE_PROMPT_MILLIAMPS = DE_PROMPT_UNITS_BASE+UNIT_MILLIAMPS, DE_PROMPT_MILLIAMPS = DE_PROMPT_UNITS_BASE+UNIT_MILLIAMPS,
DE_PROMPT_MAH = DE_PROMPT_UNITS_BASE+UNIT_MAH, DE_PROMPT_MAH = DE_PROMPT_UNITS_BASE+UNIT_MAH,
DE_PROMPT_WATTS = DE_PROMPT_UNITS_BASE+UNIT_WATTS, DE_PROMPT_WATTS = DE_PROMPT_UNITS_BASE+UNIT_WATTS,
DE_PROMPT_FEET = DE_PROMPT_UNITS_BASE+UNIT_FEET, DE_PROMPT_FEET = DE_PROMPT_UNITS_BASE+UNIT_FEET,
DE_PROMPT_KTS = DE_PROMPT_UNITS_BASE+UNIT_KTS, DE_PROMPT_KTS = DE_PROMPT_UNITS_BASE+UNIT_KTS,
DE_PROMPT_HOURS = DE_PROMPT_UNITS_BASE+UNIT_HOURS, DE_PROMPT_HOURS = DE_PROMPT_UNITS_BASE+UNIT_HOURS,
DE_PROMPT_MINUTES = DE_PROMPT_UNITS_BASE+UNIT_MINUTES, DE_PROMPT_MINUTES = DE_PROMPT_UNITS_BASE+UNIT_MINUTES,
DE_PROMPT_SECONDS = DE_PROMPT_UNITS_BASE+UNIT_SECONDS, DE_PROMPT_SECONDS = DE_PROMPT_UNITS_BASE+UNIT_SECONDS,
DE_PROMPT_RPMS = DE_PROMPT_UNITS_BASE+UNIT_RPMS, DE_PROMPT_RPMS = DE_PROMPT_UNITS_BASE+UNIT_RPMS,
DE_PROMPT_G = DE_PROMPT_UNITS_BASE+UNIT_G, DE_PROMPT_G = DE_PROMPT_UNITS_BASE+UNIT_G,
#if defined(CPUARM) #if defined(CPUARM)
DE_PROMPT_MILLILITERS = DE_PROMPT_UNITS_BASE+UNIT_MILLILITERS, DE_PROMPT_MILLILITERS = DE_PROMPT_UNITS_BASE+UNIT_MILLILITERS,
DE_PROMPT_FLOZ = DE_PROMPT_UNITS_BASE+UNIT_FLOZ, DE_PROMPT_FLOZ = DE_PROMPT_UNITS_BASE+UNIT_FLOZ,
DE_PROMPT_FEET_PER_SECOND = DE_PROMPT_UNITS_BASE+UNIT_FEET_PER_SECOND, DE_PROMPT_FEET_PER_SECOND = DE_PROMPT_UNITS_BASE+UNIT_FEET_PER_SECOND,
#endif #endif
}; };
#if defined(VOICE) #if defined(VOICE)
#if defined(CPUARM) #if defined(CPUARM)
#define DE_PUSH_UNIT_PROMPT(u) de_pushUnitPrompt((u), id) #define DE_PUSH_UNIT_PROMPT(u) de_pushUnitPrompt((u), id)
#else #else
#define DE_PUSH_UNIT_PROMPT(u) pushUnitPrompt((u)) #define DE_PUSH_UNIT_PROMPT(u) pushUnitPrompt((u))
#endif #endif
I18N_PLAY_FUNCTION(de, pushUnitPrompt, uint8_t unitprompt) I18N_PLAY_FUNCTION(de, pushUnitPrompt, uint8_t unitprompt)
{ {
#if defined(CPUARM) #if defined(CPUARM)
PUSH_UNIT_PROMPT(unitprompt, 0); PUSH_UNIT_PROMPT(unitprompt, 0);
#else #else
unitprompt = DE_PROMPT_UNITS_BASE + unitprompt*2 unitprompt = DE_PROMPT_UNITS_BASE + unitprompt*2
PUSH_NUMBER_PROMPT(unitprompt); PUSH_NUMBER_PROMPT(unitprompt);
#endif #endif
} }
I18N_PLAY_FUNCTION(de, playNumber, getvalue_t number, uint8_t unit, uint8_t att) I18N_PLAY_FUNCTION(de, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{ {
/* if digit >= 1000000000: /* if digit >= 1000000000:
temp_digit, digit = divmod(digit, 1000000000) temp_digit, digit = divmod(digit, 1000000000)
prompts.extend(self.getNumberPrompt(temp_digit)) prompts.extend(self.getNumberPrompt(temp_digit))
prompts.append(Prompt(GUIDE_00_BILLION, dir=2)) prompts.append(Prompt(GUIDE_00_BILLION, dir=2))
if digit >= 1000000: if digit >= 1000000:
temp_digit, digit = divmod(digit, 1000000) temp_digit, digit = divmod(digit, 1000000)
prompts.extend(self.getNumberPrompt(temp_digit)) prompts.extend(self.getNumberPrompt(temp_digit))
prompts.append(Prompt(GUIDE_00_MILLION, dir=2)) prompts.append(Prompt(GUIDE_00_MILLION, dir=2))
*/ */
if (number < 0) { if (number < 0) {
PUSH_NUMBER_PROMPT(DE_PROMPT_MINUS); PUSH_NUMBER_PROMPT(DE_PROMPT_MINUS);
number = -number; number = -number;
} }
#if !defined(CPUARM) #if !defined(CPUARM)
if (unit) { if (unit) {
unit--; unit--;
convertUnit(number, unit); convertUnit(number, unit);
if (IS_IMPERIAL_ENABLE()) { if (IS_IMPERIAL_ENABLE()) {
if (unit == UNIT_DIST) { if (unit == UNIT_DIST) {
unit = UNIT_FEET; unit = UNIT_FEET;
} }
if (unit == UNIT_SPEED) { if (unit == UNIT_SPEED) {
unit = UNIT_KTS; unit = UNIT_KTS;
} }
} }
unit++; unit++;
} }
#endif #endif
int8_t mode = MODE(att); int8_t mode = MODE(att);
if (mode > 0) { if (mode > 0) {
#if defined(CPUARM) #if defined(CPUARM)
if (mode == 2) { if (mode == 2) {
number /= 10; number /= 10;
} }
#else #else
// we assume that we are PREC1 // we assume that we are PREC1
#endif #endif
div_t qr = div(number, 10); div_t qr = div((int)number, 10);
if (qr.rem > 0) { if (qr.rem > 0) {
PUSH_NUMBER_PROMPT(qr.quot); PUSH_NUMBER_PROMPT(qr.quot);
PUSH_NUMBER_PROMPT(DE_PROMPT_COMMA); PUSH_NUMBER_PROMPT(DE_PROMPT_COMMA);
PUSH_NUMBER_PROMPT(qr.rem); PUSH_NUMBER_PROMPT(qr.rem);
} }
else { else {
if (qr.quot == 1) { if (qr.quot == 1) {
PUSH_NUMBER_PROMPT(DE_PROMPT_EIN); PUSH_NUMBER_PROMPT(DE_PROMPT_EIN);
} }
else { else {
PUSH_NUMBER_PROMPT(qr.quot); PUSH_NUMBER_PROMPT(qr.quot);
} }
} }
DE_PUSH_UNIT_PROMPT(unit); DE_PUSH_UNIT_PROMPT(unit);
return; return;
} }
if (number >= 2000) { if (number >= 2000) {
PLAY_NUMBER(number / 1000, 0, 0); PLAY_NUMBER(number / 1000, 0, 0);
PUSH_NUMBER_PROMPT(DE_PROMPT_TAUSEND); PUSH_NUMBER_PROMPT(DE_PROMPT_TAUSEND);
number %= 1000; number %= 1000;
if (number == 0) if (number == 0)
number = -1; number = -1;
} }
if ((number >= 1000) && (number < 2000)) { if ((number >= 1000) && (number < 2000)) {
PUSH_NUMBER_PROMPT(DE_PROMPT_EIN); PUSH_NUMBER_PROMPT(DE_PROMPT_EIN);
PUSH_NUMBER_PROMPT(DE_PROMPT_TAUSEND); PUSH_NUMBER_PROMPT(DE_PROMPT_TAUSEND);
number %= 1000; number %= 1000;
if (number == 0) if (number == 0)
number = -1; number = -1;
} }
if ((number >= 200) && (number < 1000)) { if ((number >= 200) && (number < 1000)) {
PUSH_NUMBER_PROMPT(DE_PROMPT_NULL + number / 100); PUSH_NUMBER_PROMPT(DE_PROMPT_NULL + number / 100);
PUSH_NUMBER_PROMPT(DE_PROMPT_HUNDERT); PUSH_NUMBER_PROMPT(DE_PROMPT_HUNDERT);
number %= 100; number %= 100;
if (number == 0) if (number == 0)
number = -1; number = -1;
} }
if ((number >= 100) && (number < 200)) { if ((number >= 100) && (number < 200)) {
PUSH_NUMBER_PROMPT(DE_PROMPT_EIN); PUSH_NUMBER_PROMPT(DE_PROMPT_EIN);
PUSH_NUMBER_PROMPT(DE_PROMPT_HUNDERT); PUSH_NUMBER_PROMPT(DE_PROMPT_HUNDERT);
number %= 100; number %= 100;
if (number == 0) if (number == 0)
number = -1; number = -1;
} }
if (number >= 0) { if (number >= 0) {
PUSH_NUMBER_PROMPT(DE_PROMPT_NULL + number / 1); PUSH_NUMBER_PROMPT(DE_PROMPT_NULL + number / 1);
} }
if (unit) { if (unit) {
DE_PUSH_UNIT_PROMPT(unit); DE_PUSH_UNIT_PROMPT(unit);
} }
} }
I18N_PLAY_FUNCTION(de, playDuration, int seconds PLAY_DURATION_ATT) I18N_PLAY_FUNCTION(de, playDuration, int seconds PLAY_DURATION_ATT)
{ {
if (seconds < 0) { if (seconds < 0) {
PUSH_NUMBER_PROMPT(DE_PROMPT_MINUS); PUSH_NUMBER_PROMPT(DE_PROMPT_MINUS);
seconds = -seconds; seconds = -seconds;
} }
uint8_t tmp = seconds / 3600; uint8_t tmp = seconds / 3600;
seconds %= 3600; seconds %= 3600;
if (tmp > 0 || IS_PLAY_TIME()) { if (tmp > 0 || IS_PLAY_TIME()) {
if (tmp > 1) { if (tmp > 1) {
PLAY_NUMBER(tmp, 0, 0); PLAY_NUMBER(tmp, 0, 0);
PUSH_NUMBER_PROMPT(DE_PROMPT_STUNDEN); PUSH_NUMBER_PROMPT(DE_PROMPT_STUNDEN);
} }
else { else {
PUSH_NUMBER_PROMPT(DE_PROMPT_EINE); PUSH_NUMBER_PROMPT(DE_PROMPT_EINE);
PUSH_NUMBER_PROMPT(DE_PROMPT_STUNDE); PUSH_NUMBER_PROMPT(DE_PROMPT_STUNDE);
} }
if (seconds > 0) { if (seconds > 0) {
PUSH_NUMBER_PROMPT(DE_PROMPT_UND); PUSH_NUMBER_PROMPT(DE_PROMPT_UND);
} }
} }
tmp = seconds / 60; tmp = seconds / 60;
seconds %= 60; seconds %= 60;
if (tmp > 0) { if (tmp > 0) {
if (tmp > 1) { if (tmp > 1) {
PLAY_NUMBER(tmp, 0, 0); PLAY_NUMBER(tmp, 0, 0);
PUSH_NUMBER_PROMPT(DE_PROMPT_MINUTEN); PUSH_NUMBER_PROMPT(DE_PROMPT_MINUTEN);
} }
else { else {
PUSH_NUMBER_PROMPT(DE_PROMPT_EINE); PUSH_NUMBER_PROMPT(DE_PROMPT_EINE);
PUSH_NUMBER_PROMPT(DE_PROMPT_MINUTE); PUSH_NUMBER_PROMPT(DE_PROMPT_MINUTE);
} }
if (seconds > 0) { if (seconds > 0) {
PUSH_NUMBER_PROMPT(DE_PROMPT_UND); PUSH_NUMBER_PROMPT(DE_PROMPT_UND);
} }
} }
if (seconds > 1) { if (seconds > 1) {
PLAY_NUMBER(seconds, 0, 0); PLAY_NUMBER(seconds, 0, 0);
PUSH_NUMBER_PROMPT(DE_PROMPT_SEKUNDEN); PUSH_NUMBER_PROMPT(DE_PROMPT_SEKUNDEN);
} }
else { else {
if (seconds == 1) { if (seconds == 1) {
PUSH_NUMBER_PROMPT(DE_PROMPT_EINE); PUSH_NUMBER_PROMPT(DE_PROMPT_EINE);
PUSH_NUMBER_PROMPT(DE_PROMPT_SEKUNDE); PUSH_NUMBER_PROMPT(DE_PROMPT_SEKUNDE);
} }
} }
} }
LANGUAGE_PACK_DECLARE(de, "Deutsch"); LANGUAGE_PACK_DECLARE(de, "Deutsch");
#endif #endif

View file

@ -1,175 +1,175 @@
/* /*
* Authors (alphabetical order) * Authors (alphabetical order)
* - Andre Bernet <bernet.andre@gmail.com> * - Andre Bernet <bernet.andre@gmail.com>
* - Andreas Weitl * - Andreas Weitl
* - Bertrand Songis <bsongis@gmail.com> * - Bertrand Songis <bsongis@gmail.com>
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com> * - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
* - Cameron Weeks <th9xer@gmail.com> * - Cameron Weeks <th9xer@gmail.com>
* - Erez Raviv * - Erez Raviv
* - Gabriel Birkus * - Gabriel Birkus
* - Jean-Pierre Parisy * - Jean-Pierre Parisy
* - Karl Szmutny * - Karl Szmutny
* - Michael Blandford * - Michael Blandford
* - Michal Hlavinka * - Michal Hlavinka
* - Pat Mackenzie * - Pat Mackenzie
* - Philip Moss * - Philip Moss
* - Rob Thomson * - Rob Thomson
* - Romolo Manfredini <romolo.manfredini@gmail.com> * - Romolo Manfredini <romolo.manfredini@gmail.com>
* - Thomas Husterer * - Thomas Husterer
* *
* opentx is based on code named * opentx is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/, * er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by * and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/ * Thomas Husterer, th9x: http://code.google.com/p/th9x/
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
*/ */
#include "opentx.h" #include "opentx.h"
enum EnglishPrompts { enum EnglishPrompts {
EN_PROMPT_NUMBERS_BASE = 0, EN_PROMPT_NUMBERS_BASE = 0,
EN_PROMPT_ZERO = EN_PROMPT_NUMBERS_BASE+0, //02-99 EN_PROMPT_ZERO = EN_PROMPT_NUMBERS_BASE+0, //02-99
EN_PROMPT_HUNDRED = EN_PROMPT_NUMBERS_BASE+100, //100,200 .. 900 EN_PROMPT_HUNDRED = EN_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
EN_PROMPT_THOUSAND = EN_PROMPT_NUMBERS_BASE+109, //1000 EN_PROMPT_THOUSAND = EN_PROMPT_NUMBERS_BASE+109, //1000
EN_PROMPT_AND = EN_PROMPT_NUMBERS_BASE+110, EN_PROMPT_AND = EN_PROMPT_NUMBERS_BASE+110,
EN_PROMPT_MINUS = EN_PROMPT_NUMBERS_BASE+111, EN_PROMPT_MINUS = EN_PROMPT_NUMBERS_BASE+111,
EN_PROMPT_POINT = EN_PROMPT_NUMBERS_BASE+112, EN_PROMPT_POINT = EN_PROMPT_NUMBERS_BASE+112,
EN_PROMPT_UNITS_BASE = 113, EN_PROMPT_UNITS_BASE = 113,
EN_PROMPT_POINT_BASE = 167, //.0 - .9 EN_PROMPT_POINT_BASE = 167, //.0 - .9
}; };
#if defined(VOICE) #if defined(VOICE)
#if defined(CPUARM) #if defined(CPUARM)
#define EN_PUSH_UNIT_PROMPT(p, u) en_pushUnitPrompt((p), (u), id) #define EN_PUSH_UNIT_PROMPT(p, u) en_pushUnitPrompt((p), (u), id)
#else #else
#define EN_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u)) #define EN_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u))
#endif #endif
I18N_PLAY_FUNCTION(en, pushUnitPrompt, int16_t number, uint8_t unitprompt) I18N_PLAY_FUNCTION(en, pushUnitPrompt, int16_t number, uint8_t unitprompt)
{ {
#if defined(CPUARM) #if defined(CPUARM)
if (number == 1) if (number == 1)
PUSH_UNIT_PROMPT(unitprompt, 0); PUSH_UNIT_PROMPT(unitprompt, 0);
else else
PUSH_UNIT_PROMPT(unitprompt, 1); PUSH_UNIT_PROMPT(unitprompt, 1);
#else #else
unitprompt = EN_PROMPT_UNITS_BASE + unitprompt*2; unitprompt = EN_PROMPT_UNITS_BASE + unitprompt*2;
if (number == 1) if (number == 1)
PUSH_NUMBER_PROMPT(unitprompt); PUSH_NUMBER_PROMPT(unitprompt);
else else
PUSH_NUMBER_PROMPT(unitprompt+1); PUSH_NUMBER_PROMPT(unitprompt+1);
#endif #endif
} }
I18N_PLAY_FUNCTION(en, playNumber, getvalue_t number, uint8_t unit, uint8_t att) I18N_PLAY_FUNCTION(en, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{ {
if (number < 0) { if (number < 0) {
PUSH_NUMBER_PROMPT(EN_PROMPT_MINUS); PUSH_NUMBER_PROMPT(EN_PROMPT_MINUS);
number = -number; number = -number;
} }
#if !defined(CPUARM) #if !defined(CPUARM)
if (unit) { if (unit) {
unit--; unit--;
convertUnit(number, unit); convertUnit(number, unit);
if (IS_IMPERIAL_ENABLE()) { if (IS_IMPERIAL_ENABLE()) {
if (unit == UNIT_DIST) { if (unit == UNIT_DIST) {
unit = UNIT_FEET; unit = UNIT_FEET;
} }
if (unit == UNIT_SPEED) { if (unit == UNIT_SPEED) {
unit = UNIT_KTS; unit = UNIT_KTS;
} }
} }
unit++; unit++;
} }
#endif #endif
int8_t mode = MODE(att); int8_t mode = MODE(att);
if (mode > 0) { if (mode > 0) {
#if defined(CPUARM) #if defined(CPUARM)
if (mode == 2) { if (mode == 2) {
number /= 10; number /= 10;
} }
#else #else
// we assume that we are PREC1 // we assume that we are PREC1
#endif #endif
div_t qr = div(number, 10); div_t qr = div((int)number, 10);
if (qr.rem) { if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, 0); PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(EN_PROMPT_POINT_BASE + qr.rem); PUSH_NUMBER_PROMPT(EN_PROMPT_POINT_BASE + qr.rem);
number = -1; number = -1;
} }
else { else {
number = qr.quot; number = qr.quot;
} }
} }
int16_t tmp = number; int16_t tmp = number;
if (number >= 1000) { if (number >= 1000) {
PLAY_NUMBER(number / 1000, 0, 0); PLAY_NUMBER(number / 1000, 0, 0);
PUSH_NUMBER_PROMPT(EN_PROMPT_THOUSAND); PUSH_NUMBER_PROMPT(EN_PROMPT_THOUSAND);
number %= 1000; number %= 1000;
if (number == 0) if (number == 0)
number = -1; number = -1;
} }
if (number >= 100) { if (number >= 100) {
PUSH_NUMBER_PROMPT(EN_PROMPT_HUNDRED + (number/100)-1); PUSH_NUMBER_PROMPT(EN_PROMPT_HUNDRED + (number/100)-1);
number %= 100; number %= 100;
if (number == 0) if (number == 0)
number = -1; number = -1;
} }
if (number >= 0) { if (number >= 0) {
PUSH_NUMBER_PROMPT(EN_PROMPT_ZERO + number); PUSH_NUMBER_PROMPT(EN_PROMPT_ZERO + number);
} }
if (unit) { if (unit) {
EN_PUSH_UNIT_PROMPT(tmp, unit); EN_PUSH_UNIT_PROMPT(tmp, unit);
} }
} }
I18N_PLAY_FUNCTION(en, playDuration, int seconds PLAY_DURATION_ATT) I18N_PLAY_FUNCTION(en, playDuration, int seconds PLAY_DURATION_ATT)
{ {
if (seconds == 0) { if (seconds == 0) {
PLAY_NUMBER(seconds, 0, 0); PLAY_NUMBER(seconds, 0, 0);
return; return;
} }
if (seconds < 0) { if (seconds < 0) {
PUSH_NUMBER_PROMPT(EN_PROMPT_MINUS); PUSH_NUMBER_PROMPT(EN_PROMPT_MINUS);
seconds = -seconds; seconds = -seconds;
} }
uint8_t tmp = seconds / 3600; uint8_t tmp = seconds / 3600;
seconds %= 3600; seconds %= 3600;
if (tmp > 0 || IS_PLAY_TIME()) { if (tmp > 0 || IS_PLAY_TIME()) {
PLAY_NUMBER(tmp, UNIT_HOURS, 0); PLAY_NUMBER(tmp, UNIT_HOURS, 0);
} }
tmp = seconds / 60; tmp = seconds / 60;
seconds %= 60; seconds %= 60;
if (tmp > 0) { if (tmp > 0) {
PLAY_NUMBER(tmp, UNIT_MINUTES, 0); PLAY_NUMBER(tmp, UNIT_MINUTES, 0);
if (seconds > 0) if (seconds > 0)
PUSH_NUMBER_PROMPT(EN_PROMPT_AND); PUSH_NUMBER_PROMPT(EN_PROMPT_AND);
} }
if (seconds > 0) { if (seconds > 0) {
PLAY_NUMBER(seconds, UNIT_SECONDS, 0); PLAY_NUMBER(seconds, UNIT_SECONDS, 0);
} }
} }
LANGUAGE_PACK_DECLARE_DEFAULT(en, "English"); LANGUAGE_PACK_DECLARE_DEFAULT(en, "English");
#endif #endif

View file

@ -1,267 +1,267 @@
/* /*
* Authors (alphabetical order) * Authors (alphabetical order)
* - Andre Bernet <bernet.andre@gmail.com> * - Andre Bernet <bernet.andre@gmail.com>
* - Andreas Weitl * - Andreas Weitl
* - Bertrand Songis <bsongis@gmail.com> * - Bertrand Songis <bsongis@gmail.com>
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com> * - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
* - Cameron Weeks <th9xer@gmail.com> * - Cameron Weeks <th9xer@gmail.com>
* - Erez Raviv * - Erez Raviv
* - Gabriel Birkus * - Gabriel Birkus
* - Jean-Pierre Parisy * - Jean-Pierre Parisy
* - Karl Szmutny * - Karl Szmutny
* - Michael Blandford * - Michael Blandford
* - Michal Hlavinka * - Michal Hlavinka
* - Pat Mackenzie * - Pat Mackenzie
* - Philip Moss * - Philip Moss
* - Rob Thomson * - Rob Thomson
* - Romolo Manfredini <romolo.manfredini@gmail.com> * - Romolo Manfredini <romolo.manfredini@gmail.com>
* - Thomas Husterer * - Thomas Husterer
* *
* opentx is based on code named * opentx is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/, * er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by * and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/ * Thomas Husterer, th9x: http://code.google.com/p/th9x/
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
*/ */
#include "opentx.h" #include "opentx.h"
enum SpanishPrompts { enum SpanishPrompts {
ES_PROMPT_NUMBERS_BASE = 0, ES_PROMPT_NUMBERS_BASE = 0,
ES_PROMPT_ZERO = ES_PROMPT_NUMBERS_BASE+0, ES_PROMPT_ZERO = ES_PROMPT_NUMBERS_BASE+0,
ES_PROMPT_CIEN = ES_PROMPT_NUMBERS_BASE+100, ES_PROMPT_CIEN = ES_PROMPT_NUMBERS_BASE+100,
ES_PROMPT_CIENTO = ES_PROMPT_NUMBERS_BASE+101, ES_PROMPT_CIENTO = ES_PROMPT_NUMBERS_BASE+101,
ES_PROMPT_DOSCIENTOS = ES_PROMPT_NUMBERS_BASE+102, ES_PROMPT_DOSCIENTOS = ES_PROMPT_NUMBERS_BASE+102,
ES_PROMPT_TRESCIENTOS, ES_PROMPT_TRESCIENTOS,
ES_PROMPT_CUATROCIENTOS, ES_PROMPT_CUATROCIENTOS,
ES_PROMPT_QUINIENTOS, ES_PROMPT_QUINIENTOS,
ES_PROMPT_SESCIENTOS, ES_PROMPT_SESCIENTOS,
ES_PROMPT_SETECIENTOS, ES_PROMPT_SETECIENTOS,
ES_PROMPT_OCHOCIENTOS, ES_PROMPT_OCHOCIENTOS,
ES_PROMPT_NUEVECIENTOS, ES_PROMPT_NUEVECIENTOS,
ES_PROMPT_MIL = ES_PROMPT_NUMBERS_BASE+110, ES_PROMPT_MIL = ES_PROMPT_NUMBERS_BASE+110,
ES_PROMPT_VIRGOLA = 111, ES_PROMPT_VIRGOLA = 111,
ES_PROMPT_UN, ES_PROMPT_UN,
ES_PROMPT_UNA, ES_PROMPT_UNA,
ES_PROMPT_Y, ES_PROMPT_Y,
ES_PROMPT_MENO, ES_PROMPT_MENO,
ES_PROMPT_HORA, ES_PROMPT_HORA,
ES_PROMPT_HORAS, ES_PROMPT_HORAS,
ES_PROMPT_MINUTO, ES_PROMPT_MINUTO,
ES_PROMPT_MINUTOS, ES_PROMPT_MINUTOS,
ES_PROMPT_SEGUNDO, ES_PROMPT_SEGUNDO,
ES_PROMPT_SEGUNDOS, ES_PROMPT_SEGUNDOS,
ES_PROMPT_UNITS_BASE = 122, ES_PROMPT_UNITS_BASE = 122,
ES_PROMPT_VOLTS = ES_PROMPT_UNITS_BASE+UNIT_VOLTS, ES_PROMPT_VOLTS = ES_PROMPT_UNITS_BASE+UNIT_VOLTS,
ES_PROMPT_AMPS = ES_PROMPT_UNITS_BASE+UNIT_AMPS, ES_PROMPT_AMPS = ES_PROMPT_UNITS_BASE+UNIT_AMPS,
ES_PROMPT_METERS_PER_SECOND = ES_PROMPT_UNITS_BASE+UNIT_METERS_PER_SECOND, ES_PROMPT_METERS_PER_SECOND = ES_PROMPT_UNITS_BASE+UNIT_METERS_PER_SECOND,
ES_PROMPT_SPARE1 = ES_PROMPT_UNITS_BASE+UNIT_RAW, ES_PROMPT_SPARE1 = ES_PROMPT_UNITS_BASE+UNIT_RAW,
ES_PROMPT_KMH = ES_PROMPT_UNITS_BASE+UNIT_SPEED, ES_PROMPT_KMH = ES_PROMPT_UNITS_BASE+UNIT_SPEED,
ES_PROMPT_METERS = ES_PROMPT_UNITS_BASE+UNIT_DIST, ES_PROMPT_METERS = ES_PROMPT_UNITS_BASE+UNIT_DIST,
ES_PROMPT_DEGREES = ES_PROMPT_UNITS_BASE+UNIT_TEMPERATURE, ES_PROMPT_DEGREES = ES_PROMPT_UNITS_BASE+UNIT_TEMPERATURE,
ES_PROMPT_PERCENT = ES_PROMPT_UNITS_BASE+UNIT_PERCENT, ES_PROMPT_PERCENT = ES_PROMPT_UNITS_BASE+UNIT_PERCENT,
ES_PROMPT_MILLIAMPS = ES_PROMPT_UNITS_BASE+UNIT_MILLIAMPS, ES_PROMPT_MILLIAMPS = ES_PROMPT_UNITS_BASE+UNIT_MILLIAMPS,
ES_PROMPT_MAH = ES_PROMPT_UNITS_BASE+UNIT_MAH, ES_PROMPT_MAH = ES_PROMPT_UNITS_BASE+UNIT_MAH,
ES_PROMPT_WATTS = ES_PROMPT_UNITS_BASE+UNIT_WATTS, ES_PROMPT_WATTS = ES_PROMPT_UNITS_BASE+UNIT_WATTS,
ES_PROMPT_FEET = ES_PROMPT_UNITS_BASE+UNIT_FEET, ES_PROMPT_FEET = ES_PROMPT_UNITS_BASE+UNIT_FEET,
ES_PROMPT_KTS = ES_PROMPT_UNITS_BASE+UNIT_KTS, ES_PROMPT_KTS = ES_PROMPT_UNITS_BASE+UNIT_KTS,
ES_PROMPT_HOURS = ES_PROMPT_UNITS_BASE+UNIT_HOURS, ES_PROMPT_HOURS = ES_PROMPT_UNITS_BASE+UNIT_HOURS,
ES_PROMPT_MINUTES = ES_PROMPT_UNITS_BASE+UNIT_MINUTES, ES_PROMPT_MINUTES = ES_PROMPT_UNITS_BASE+UNIT_MINUTES,
ES_PROMPT_SECONDS = ES_PROMPT_UNITS_BASE+UNIT_SECONDS, ES_PROMPT_SECONDS = ES_PROMPT_UNITS_BASE+UNIT_SECONDS,
ES_PROMPT_RPMS = ES_PROMPT_UNITS_BASE+UNIT_RPMS, ES_PROMPT_RPMS = ES_PROMPT_UNITS_BASE+UNIT_RPMS,
ES_PROMPT_G = ES_PROMPT_UNITS_BASE+UNIT_G, ES_PROMPT_G = ES_PROMPT_UNITS_BASE+UNIT_G,
#if defined(CPUARM) #if defined(CPUARM)
ES_PROMPT_MILLILITERS = ES_PROMPT_UNITS_BASE+UNIT_MILLILITERS, ES_PROMPT_MILLILITERS = ES_PROMPT_UNITS_BASE+UNIT_MILLILITERS,
ES_PROMPT_FLOZ = ES_PROMPT_UNITS_BASE+UNIT_FLOZ, ES_PROMPT_FLOZ = ES_PROMPT_UNITS_BASE+UNIT_FLOZ,
ES_PROMPT_FEET_PER_SECOND = ES_PROMPT_UNITS_BASE+UNIT_FEET_PER_SECOND, ES_PROMPT_FEET_PER_SECOND = ES_PROMPT_UNITS_BASE+UNIT_FEET_PER_SECOND,
#endif #endif
}; };
#if defined(VOICE) #if defined(VOICE)
#if defined(CPUARM) #if defined(CPUARM)
#define ES_PUSH_UNIT_PROMPT(u) es_pushUnitPrompt((u), id) #define ES_PUSH_UNIT_PROMPT(u) es_pushUnitPrompt((u), id)
#else #else
#define ES_PUSH_UNIT_PROMPT(u) pushUnitPrompt((u)) #define ES_PUSH_UNIT_PROMPT(u) pushUnitPrompt((u))
#endif #endif
I18N_PLAY_FUNCTION(es, pushUnitPrompt, uint8_t unitprompt) I18N_PLAY_FUNCTION(es, pushUnitPrompt, uint8_t unitprompt)
{ {
#if defined(CPUARM) #if defined(CPUARM)
PUSH_UNIT_PROMPT(unitprompt, 0); PUSH_UNIT_PROMPT(unitprompt, 0);
#else #else
unitprompt = ES_PROMPT_UNITS_BASE + unitprompt*2; unitprompt = ES_PROMPT_UNITS_BASE + unitprompt*2;
PUSH_NUMBER_PROMPT(unitprompt); PUSH_NUMBER_PROMPT(unitprompt);
#endif #endif
} }
I18N_PLAY_FUNCTION(es, playNumber, getvalue_t number, uint8_t unit, uint8_t att) I18N_PLAY_FUNCTION(es, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{ {
/* if digit >= 1000000000: /* if digit >= 1000000000:
temp_digit, digit = divmod(digit, 1000000000) temp_digit, digit = divmod(digit, 1000000000)
prompts.extend(self.getNumberPrompt(temp_digit)) prompts.extend(self.getNumberPrompt(temp_digit))
prompts.append(Prompt(GUIDE_00_BILLION, dir=2)) prompts.append(Prompt(GUIDE_00_BILLION, dir=2))
if digit >= 1000000: if digit >= 1000000:
temp_digit, digit = divmod(digit, 1000000) temp_digit, digit = divmod(digit, 1000000)
prompts.extend(self.getNumberPrompt(temp_digit)) prompts.extend(self.getNumberPrompt(temp_digit))
prompts.append(Prompt(GUIDE_00_MILLION, dir=2)) prompts.append(Prompt(GUIDE_00_MILLION, dir=2))
*/ */
if (number < 0) { if (number < 0) {
PUSH_NUMBER_PROMPT(ES_PROMPT_MENO); PUSH_NUMBER_PROMPT(ES_PROMPT_MENO);
number = -number; number = -number;
} }
#if !defined(CPUARM) #if !defined(CPUARM)
if (unit) { if (unit) {
unit--; unit--;
convertUnit(number, unit); convertUnit(number, unit);
if (IS_IMPERIAL_ENABLE()) { if (IS_IMPERIAL_ENABLE()) {
if (unit == UNIT_DIST) { if (unit == UNIT_DIST) {
unit = UNIT_FEET; unit = UNIT_FEET;
} }
if (unit == UNIT_SPEED) { if (unit == UNIT_SPEED) {
unit = UNIT_KTS; unit = UNIT_KTS;
} }
} }
unit++; unit++;
} }
#endif #endif
int8_t mode = MODE(att); int8_t mode = MODE(att);
if (mode > 0) { if (mode > 0) {
#if defined(CPUARM) #if defined(CPUARM)
if (mode == 2) { if (mode == 2) {
number /= 10; number /= 10;
} }
#else #else
// we assume that we are PREC1 // we assume that we are PREC1
#endif #endif
div_t qr = div(number, 10); div_t qr = div((int)number, 10);
if (qr.rem > 0) { if (qr.rem > 0) {
PLAY_NUMBER(qr.quot, 0, 0); PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(ES_PROMPT_VIRGOLA); PUSH_NUMBER_PROMPT(ES_PROMPT_VIRGOLA);
if (mode==2 && qr.rem < 10) if (mode==2 && qr.rem < 10)
PUSH_NUMBER_PROMPT(ES_PROMPT_ZERO); PUSH_NUMBER_PROMPT(ES_PROMPT_ZERO);
PLAY_NUMBER(qr.rem, unit, 0); PLAY_NUMBER(qr.rem, unit, 0);
} }
else { else {
PLAY_NUMBER(qr.quot, unit, 0); PLAY_NUMBER(qr.quot, unit, 0);
} }
return; return;
} }
if (number >= 1000) { if (number >= 1000) {
if (number >= 2000) { if (number >= 2000) {
PLAY_NUMBER(number / 1000, 0, 0); PLAY_NUMBER(number / 1000, 0, 0);
PUSH_NUMBER_PROMPT(ES_PROMPT_MIL); PUSH_NUMBER_PROMPT(ES_PROMPT_MIL);
} else { } else {
PUSH_NUMBER_PROMPT(ES_PROMPT_MIL); PUSH_NUMBER_PROMPT(ES_PROMPT_MIL);
} }
number %= 1000; number %= 1000;
if (number == 0) if (number == 0)
number = -1; number = -1;
} }
if (number > 100) { if (number > 100) {
PUSH_NUMBER_PROMPT(ES_PROMPT_CIENTO + (number/100) - 1); PUSH_NUMBER_PROMPT(ES_PROMPT_CIENTO + (number/100) - 1);
number %= 100; number %= 100;
if (number == 0) if (number == 0)
number = -1; number = -1;
} }
if (number == 100) { if (number == 100) {
PUSH_NUMBER_PROMPT(ES_PROMPT_CIEN); PUSH_NUMBER_PROMPT(ES_PROMPT_CIEN);
number = -1; number = -1;
} }
if (number >= 0) { if (number >= 0) {
PUSH_NUMBER_PROMPT(ES_PROMPT_ZERO+number); PUSH_NUMBER_PROMPT(ES_PROMPT_ZERO+number);
} }
if (unit) { if (unit) {
ES_PUSH_UNIT_PROMPT(unit); ES_PUSH_UNIT_PROMPT(unit);
} }
} }
I18N_PLAY_FUNCTION(es, playDuration, int seconds PLAY_DURATION_ATT) I18N_PLAY_FUNCTION(es, playDuration, int seconds PLAY_DURATION_ATT)
{ {
if (seconds < 0) { if (seconds < 0) {
PUSH_NUMBER_PROMPT(ES_PROMPT_MENO); PUSH_NUMBER_PROMPT(ES_PROMPT_MENO);
seconds = -seconds; seconds = -seconds;
} }
uint8_t ore = 0; uint8_t ore = 0;
uint8_t tmp = seconds / 3600; uint8_t tmp = seconds / 3600;
seconds %= 3600; seconds %= 3600;
if (tmp > 0 || IS_PLAY_TIME()) { if (tmp > 0 || IS_PLAY_TIME()) {
ore = tmp; ore = tmp;
if (tmp > 1) { if (tmp > 1) {
PLAY_NUMBER(tmp, 0, 0); PLAY_NUMBER(tmp, 0, 0);
#if defined(CPUARM) #if defined(CPUARM)
PUSH_UNIT_PROMPT(UNIT_HOURS, 1); PUSH_UNIT_PROMPT(UNIT_HOURS, 1);
} }
else { else {
PUSH_NUMBER_PROMPT(ES_PROMPT_UNA); PUSH_NUMBER_PROMPT(ES_PROMPT_UNA);
PUSH_UNIT_PROMPT(UNIT_HOURS, 0); PUSH_UNIT_PROMPT(UNIT_HOURS, 0);
#else #else
PUSH_NUMBER_PROMPT(ES_PROMPT_HORAS); PUSH_NUMBER_PROMPT(ES_PROMPT_HORAS);
} }
else { else {
PUSH_NUMBER_PROMPT(ES_PROMPT_UNA); PUSH_NUMBER_PROMPT(ES_PROMPT_UNA);
PUSH_NUMBER_PROMPT(ES_PROMPT_HORA); PUSH_NUMBER_PROMPT(ES_PROMPT_HORA);
#endif #endif
} }
} }
tmp = seconds / 60; tmp = seconds / 60;
seconds %= 60; seconds %= 60;
if (tmp > 0 || ore >0) { if (tmp > 0 || ore >0) {
if (tmp != 1) { if (tmp != 1) {
PLAY_NUMBER(tmp, 0, 0); PLAY_NUMBER(tmp, 0, 0);
#if defined(CPUARM) #if defined(CPUARM)
PUSH_UNIT_PROMPT(UNIT_MINUTES, 1); PUSH_UNIT_PROMPT(UNIT_MINUTES, 1);
} }
else { else {
PUSH_NUMBER_PROMPT(ES_PROMPT_UNA); PUSH_NUMBER_PROMPT(ES_PROMPT_UNA);
PUSH_UNIT_PROMPT(UNIT_MINUTES, 0); PUSH_UNIT_PROMPT(UNIT_MINUTES, 0);
#else #else
PUSH_NUMBER_PROMPT(ES_PROMPT_MINUTOS); PUSH_NUMBER_PROMPT(ES_PROMPT_MINUTOS);
} }
else { else {
PUSH_NUMBER_PROMPT(ES_PROMPT_UN); PUSH_NUMBER_PROMPT(ES_PROMPT_UN);
PUSH_NUMBER_PROMPT(ES_PROMPT_MINUTO); PUSH_NUMBER_PROMPT(ES_PROMPT_MINUTO);
#endif #endif
} }
PUSH_NUMBER_PROMPT(ES_PROMPT_Y); PUSH_NUMBER_PROMPT(ES_PROMPT_Y);
} }
if (seconds != 1) { if (seconds != 1) {
PLAY_NUMBER(seconds, 0, 0); PLAY_NUMBER(seconds, 0, 0);
#if defined(CPUARM) #if defined(CPUARM)
PUSH_UNIT_PROMPT(UNIT_SECONDS, 1); PUSH_UNIT_PROMPT(UNIT_SECONDS, 1);
} }
else { else {
PUSH_NUMBER_PROMPT(ES_PROMPT_UNA); PUSH_NUMBER_PROMPT(ES_PROMPT_UNA);
PUSH_UNIT_PROMPT(UNIT_SECONDS, 0); PUSH_UNIT_PROMPT(UNIT_SECONDS, 0);
#else #else
PUSH_NUMBER_PROMPT(ES_PROMPT_SEGUNDOS); PUSH_NUMBER_PROMPT(ES_PROMPT_SEGUNDOS);
} }
else { else {
PUSH_NUMBER_PROMPT(ES_PROMPT_UN); PUSH_NUMBER_PROMPT(ES_PROMPT_UN);
PUSH_NUMBER_PROMPT(ES_PROMPT_SEGUNDO); PUSH_NUMBER_PROMPT(ES_PROMPT_SEGUNDO);
#endif #endif
} }
} }
LANGUAGE_PACK_DECLARE(es, "Espanol"); LANGUAGE_PACK_DECLARE(es, "Espanol");
#endif #endif

View file

@ -114,7 +114,7 @@ I18N_PLAY_FUNCTION(fr, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
#else #else
// we assume that we are PREC1 // we assume that we are PREC1
#endif #endif
div_t qr = div(number, 10); div_t qr = div((int)number, 10);
if (qr.rem) { if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, 0); PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(FR_PROMPT_VIRGULE_BASE + qr.rem); PUSH_NUMBER_PROMPT(FR_PROMPT_VIRGULE_BASE + qr.rem);

View file

@ -1,176 +1,176 @@
/* /*
* Authors (alphabetical order) * Authors (alphabetical order)
* - Andre Bernet <bernet.andre@gmail.com> * - Andre Bernet <bernet.andre@gmail.com>
* - Andreas Weitl * - Andreas Weitl
* - Bertrand Songis <bsongis@gmail.com> * - Bertrand Songis <bsongis@gmail.com>
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com> * - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
* - Cameron Weeks <th9xer@gmail.com> * - Cameron Weeks <th9xer@gmail.com>
* - Erez Raviv * - Erez Raviv
* - Gabriel Birkus * - Gabriel Birkus
* - Jean-Pierre Parisy * - Jean-Pierre Parisy
* - Karl Szmutny * - Karl Szmutny
* - Michael Blandford * - Michael Blandford
* - Michal Hlavinka * - Michal Hlavinka
* - Pat Mackenzie * - Pat Mackenzie
* - Philip Moss * - Philip Moss
* - Rob Thomson * - Rob Thomson
* - Romolo Manfredini <romolo.manfredini@gmail.com> * - Romolo Manfredini <romolo.manfredini@gmail.com>
* - Thomas Husterer * - Thomas Husterer
* *
* opentx is based on code named * opentx is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/, * er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by * and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/ * Thomas Husterer, th9x: http://code.google.com/p/th9x/
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
*/ */
#include "opentx.h" #include "opentx.h"
enum HungarianPrompts { enum HungarianPrompts {
HU_PROMPT_NUMBERS_BASE = 0, HU_PROMPT_NUMBERS_BASE = 0,
HU_PROMPT_ZERO = HU_PROMPT_NUMBERS_BASE+0, //02-99 HU_PROMPT_ZERO = HU_PROMPT_NUMBERS_BASE+0, //02-99
HU_PROMPT_HUNDRED = HU_PROMPT_NUMBERS_BASE+100, //100,200 .. 900 HU_PROMPT_HUNDRED = HU_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
HU_PROMPT_THOUSAND = HU_PROMPT_NUMBERS_BASE+109, //1000 HU_PROMPT_THOUSAND = HU_PROMPT_NUMBERS_BASE+109, //1000
HU_PROMPT_AND = HU_PROMPT_NUMBERS_BASE+110, HU_PROMPT_AND = HU_PROMPT_NUMBERS_BASE+110,
HU_PROMPT_MINUS = HU_PROMPT_NUMBERS_BASE+111, HU_PROMPT_MINUS = HU_PROMPT_NUMBERS_BASE+111,
HU_PROMPT_POINT = HU_PROMPT_NUMBERS_BASE+112, HU_PROMPT_POINT = HU_PROMPT_NUMBERS_BASE+112,
HU_PROMPT_UNITS_BASE = 113, HU_PROMPT_UNITS_BASE = 113,
HU_PROMPT_POINT_BASE = 165, //.0 - .9 HU_PROMPT_POINT_BASE = 165, //.0 - .9
}; };
#if defined(VOICE) #if defined(VOICE)
#if defined(CPUARM) #if defined(CPUARM)
#define HU_PUSH_UNIT_PROMPT(p, u) hu_pushUnitPrompt((p), (u), id) #define HU_PUSH_UNIT_PROMPT(p, u) hu_pushUnitPrompt((p), (u), id)
#else #else
#define HU_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u)) #define HU_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u))
#endif #endif
I18N_PLAY_FUNCTION(hu, pushUnitPrompt, int16_t number, uint8_t unitprompt) I18N_PLAY_FUNCTION(hu, pushUnitPrompt, int16_t number, uint8_t unitprompt)
{ {
#if defined(CPUARM) #if defined(CPUARM)
if (number == 1) if (number == 1)
PUSH_UNIT_PROMPT(unitprompt, 0); PUSH_UNIT_PROMPT(unitprompt, 0);
else else
PUSH_UNIT_PROMPT(unitprompt, 1); PUSH_UNIT_PROMPT(unitprompt, 1);
#else #else
unitprompt = HU_PROMPT_UNITS_BASE + unitprompt*2; unitprompt = HU_PROMPT_UNITS_BASE + unitprompt*2;
if (number == 1) if (number == 1)
PUSH_NUMBER_PROMPT(unitprompt); PUSH_NUMBER_PROMPT(unitprompt);
else else
PUSH_NUMBER_PROMPT(unitprompt+1); PUSH_NUMBER_PROMPT(unitprompt+1);
#endif #endif
} }
I18N_PLAY_FUNCTION(hu, playNumber, getvalue_t number, uint8_t unit, uint8_t att) I18N_PLAY_FUNCTION(hu, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{ {
if (number < 0) { if (number < 0) {
PUSH_NUMBER_PROMPT(HU_PROMPT_MINUS); PUSH_NUMBER_PROMPT(HU_PROMPT_MINUS);
number = -number; number = -number;
} }
#if !defined(CPUARM) #if !defined(CPUARM)
if (unit) { if (unit) {
unit--; unit--;
convertUnit(number, unit); convertUnit(number, unit);
if (IS_IMPERIAL_ENABLE()) { if (IS_IMPERIAL_ENABLE()) {
if (unit == UNIT_DIST) { if (unit == UNIT_DIST) {
unit = UNIT_FEET; unit = UNIT_FEET;
} }
if (unit == UNIT_SPEED) { if (unit == UNIT_SPEED) {
unit = UNIT_KTS; unit = UNIT_KTS;
} }
} }
unit++; unit++;
} }
#endif #endif
int8_t mode = MODE(att); int8_t mode = MODE(att);
if (mode > 0) { if (mode > 0) {
#if defined(CPUARM) #if defined(CPUARM)
if (mode == 2) { if (mode == 2) {
number /= 10; number /= 10;
} }
#else #else
// we assume that we are PREC1 // we assume that we are PREC1
#endif #endif
div_t qr = div(number, 10); div_t qr = div((int)number, 10);
if (qr.rem) { if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, 0); PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(HU_PROMPT_POINT_BASE + qr.rem); PUSH_NUMBER_PROMPT(HU_PROMPT_POINT_BASE + qr.rem);
number = -1; number = -1;
} }
else { else {
number = qr.quot; number = qr.quot;
} }
} }
int16_t tmp = number; int16_t tmp = number;
if (number >= 1000) { if (number >= 1000) {
PLAY_NUMBER(number / 1000, 0, 0); PLAY_NUMBER(number / 1000, 0, 0);
PUSH_NUMBER_PROMPT(HU_PROMPT_THOUSAND); PUSH_NUMBER_PROMPT(HU_PROMPT_THOUSAND);
number %= 1000; number %= 1000;
if (number == 0) if (number == 0)
number = -1; number = -1;
} }
if (number >= 100) { if (number >= 100) {
PUSH_NUMBER_PROMPT(HU_PROMPT_HUNDRED + (number/100)-1); PUSH_NUMBER_PROMPT(HU_PROMPT_HUNDRED + (number/100)-1);
number %= 100; number %= 100;
if (number == 0) if (number == 0)
number = -1; number = -1;
} }
if (number >= 0) { if (number >= 0) {
PUSH_NUMBER_PROMPT(HU_PROMPT_ZERO + number); PUSH_NUMBER_PROMPT(HU_PROMPT_ZERO + number);
} }
if (unit) { if (unit) {
HU_PUSH_UNIT_PROMPT(tmp, unit); HU_PUSH_UNIT_PROMPT(tmp, unit);
} }
} }
I18N_PLAY_FUNCTION(hu, playDuration, int seconds PLAY_DURATION_ATT) I18N_PLAY_FUNCTION(hu, playDuration, int seconds PLAY_DURATION_ATT)
{ {
if (seconds == 0) { if (seconds == 0) {
PLAY_NUMBER(seconds, 0, 0); PLAY_NUMBER(seconds, 0, 0);
return; return;
} }
if (seconds < 0) { if (seconds < 0) {
PUSH_NUMBER_PROMPT(HU_PROMPT_MINUS); PUSH_NUMBER_PROMPT(HU_PROMPT_MINUS);
seconds = -seconds; seconds = -seconds;
} }
uint8_t tmp = seconds / 3600; uint8_t tmp = seconds / 3600;
seconds %= 3600; seconds %= 3600;
if (tmp > 0 || IS_PLAY_TIME()) { if (tmp > 0 || IS_PLAY_TIME()) {
PLAY_NUMBER(tmp, UNIT_HOURS, 0); PLAY_NUMBER(tmp, UNIT_HOURS, 0);
} }
tmp = seconds / 60; tmp = seconds / 60;
seconds %= 60; seconds %= 60;
if (tmp > 0) { if (tmp > 0) {
PLAY_NUMBER(tmp, UNIT_MINUTES, 0); PLAY_NUMBER(tmp, UNIT_MINUTES, 0);
// This is not necessary in the Hungarian // This is not necessary in the Hungarian
//if (seconds > 0) //if (seconds > 0)
//PUSH_NUMBER_PROMPT(HU_PROMPT_AND); //PUSH_NUMBER_PROMPT(HU_PROMPT_AND);
} }
if (seconds > 0) { if (seconds > 0) {
PLAY_NUMBER(seconds, UNIT_SECONDS, 0); PLAY_NUMBER(seconds, UNIT_SECONDS, 0);
} }
} }
LANGUAGE_PACK_DECLARE(hu, "Hungarian"); LANGUAGE_PACK_DECLARE(hu, "Hungarian");
#endif #endif

View file

@ -1,244 +1,244 @@
/* /*
* Authors (alphabetical order) * Authors (alphabetical order)
* - Bertrand Songis <bsongis@gmail.com> * - Bertrand Songis <bsongis@gmail.com>
* - Romolo Manfredini <romolo.manfredini@gmail.com> * - Romolo Manfredini <romolo.manfredini@gmail.com>
* *
* opentx is based on code named * opentx is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/, * er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by * and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/ * Thomas Husterer, th9x: http://code.google.com/p/th9x/
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
*/ */
#include "opentx.h" #include "opentx.h"
enum ItalianPrompts { enum ItalianPrompts {
IT_PROMPT_NUMBERS_BASE = 0, IT_PROMPT_NUMBERS_BASE = 0,
IT_PROMPT_ZERO = IT_PROMPT_NUMBERS_BASE+0, IT_PROMPT_ZERO = IT_PROMPT_NUMBERS_BASE+0,
IT_PROMPT_CENT = IT_PROMPT_NUMBERS_BASE+100, IT_PROMPT_CENT = IT_PROMPT_NUMBERS_BASE+100,
IT_PROMPT_MILA = IT_PROMPT_NUMBERS_BASE+101, IT_PROMPT_MILA = IT_PROMPT_NUMBERS_BASE+101,
IT_PROMPT_MILLE = IT_PROMPT_NUMBERS_BASE+102, IT_PROMPT_MILLE = IT_PROMPT_NUMBERS_BASE+102,
IT_PROMPT_VIRGOLA = 103, IT_PROMPT_VIRGOLA = 103,
IT_PROMPT_UN, IT_PROMPT_UN,
IT_PROMPT_E, IT_PROMPT_E,
IT_PROMPT_MENO, IT_PROMPT_MENO,
IT_PROMPT_ORA, IT_PROMPT_ORA,
IT_PROMPT_ORE, IT_PROMPT_ORE,
IT_PROMPT_MINUTO, IT_PROMPT_MINUTO,
IT_PROMPT_MINUTI, IT_PROMPT_MINUTI,
IT_PROMPT_SECONDO, IT_PROMPT_SECONDO,
IT_PROMPT_SECONDI, IT_PROMPT_SECONDI,
IT_PROMPT_UNITS_BASE = 113, IT_PROMPT_UNITS_BASE = 113,
IT_PROMPT_VOLTS = IT_PROMPT_UNITS_BASE+(UNIT_VOLTS*2), IT_PROMPT_VOLTS = IT_PROMPT_UNITS_BASE+(UNIT_VOLTS*2),
IT_PROMPT_AMPS = IT_PROMPT_UNITS_BASE+(UNIT_AMPS*2), IT_PROMPT_AMPS = IT_PROMPT_UNITS_BASE+(UNIT_AMPS*2),
IT_PROMPT_METERS_PER_SECOND = IT_PROMPT_UNITS_BASE+(UNIT_METERS_PER_SECOND*2), IT_PROMPT_METERS_PER_SECOND = IT_PROMPT_UNITS_BASE+(UNIT_METERS_PER_SECOND*2),
IT_PROMPT_SPARE1 = IT_PROMPT_UNITS_BASE+(UNIT_RAW*2), IT_PROMPT_SPARE1 = IT_PROMPT_UNITS_BASE+(UNIT_RAW*2),
IT_PROMPT_KMH = IT_PROMPT_UNITS_BASE+(UNIT_SPEED*2), IT_PROMPT_KMH = IT_PROMPT_UNITS_BASE+(UNIT_SPEED*2),
IT_PROMPT_METERS = IT_PROMPT_UNITS_BASE+(UNIT_DIST*2), IT_PROMPT_METERS = IT_PROMPT_UNITS_BASE+(UNIT_DIST*2),
IT_PROMPT_DEGREES = IT_PROMPT_UNITS_BASE+(UNIT_TEMPERATURE*2), IT_PROMPT_DEGREES = IT_PROMPT_UNITS_BASE+(UNIT_TEMPERATURE*2),
IT_PROMPT_PERCENT = IT_PROMPT_UNITS_BASE+(UNIT_PERCENT*2), IT_PROMPT_PERCENT = IT_PROMPT_UNITS_BASE+(UNIT_PERCENT*2),
IT_PROMPT_MILLIAMPS = IT_PROMPT_UNITS_BASE+(UNIT_MILLIAMPS*2), IT_PROMPT_MILLIAMPS = IT_PROMPT_UNITS_BASE+(UNIT_MILLIAMPS*2),
IT_PROMPT_MAH = IT_PROMPT_UNITS_BASE+(UNIT_MAH*2), IT_PROMPT_MAH = IT_PROMPT_UNITS_BASE+(UNIT_MAH*2),
IT_PROMPT_WATTS = IT_PROMPT_UNITS_BASE+(UNIT_WATTS*2), IT_PROMPT_WATTS = IT_PROMPT_UNITS_BASE+(UNIT_WATTS*2),
IT_PROMPT_FEET = IT_PROMPT_UNITS_BASE+(UNIT_FEET*2), IT_PROMPT_FEET = IT_PROMPT_UNITS_BASE+(UNIT_FEET*2),
IT_PROMPT_KTS = IT_PROMPT_UNITS_BASE+(UNIT_KTS*2), IT_PROMPT_KTS = IT_PROMPT_UNITS_BASE+(UNIT_KTS*2),
#if defined(CPUARM) #if defined(CPUARM)
IT_PROMPT_MILLILITERS = IT_PROMPT_UNITS_BASE+(UNIT_MILLILITERS*2), IT_PROMPT_MILLILITERS = IT_PROMPT_UNITS_BASE+(UNIT_MILLILITERS*2),
IT_PROMPT_FLOZ = IT_PROMPT_UNITS_BASE+(UNIT_FLOZ*2), IT_PROMPT_FLOZ = IT_PROMPT_UNITS_BASE+(UNIT_FLOZ*2),
IT_PROMPT_FEET_PER_SECOND = IT_PROMPT_UNITS_BASE+(UNIT_FEET_PER_SECOND*2), IT_PROMPT_FEET_PER_SECOND = IT_PROMPT_UNITS_BASE+(UNIT_FEET_PER_SECOND*2),
#endif #endif
}; };
#if defined(VOICE) #if defined(VOICE)
#if defined(CPUARM) #if defined(CPUARM)
#define IT_PUSH_UNIT_PROMPT(p, u) it_pushUnitPrompt((p), (u), id) #define IT_PUSH_UNIT_PROMPT(p, u) it_pushUnitPrompt((p), (u), id)
#else #else
#define IT_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u)) #define IT_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u))
#endif #endif
I18N_PLAY_FUNCTION(it, pushUnitPrompt, int16_t number, uint8_t unitprompt) I18N_PLAY_FUNCTION(it, pushUnitPrompt, int16_t number, uint8_t unitprompt)
{ {
#if defined(CPUARM) #if defined(CPUARM)
if (number == 1) if (number == 1)
PUSH_UNIT_PROMPT(unitprompt, 0); PUSH_UNIT_PROMPT(unitprompt, 0);
else else
PUSH_UNIT_PROMPT(unitprompt, 1); PUSH_UNIT_PROMPT(unitprompt, 1);
#else #else
unitprompt = IT_PROMPT_UNITS_BASE + unitprompt*2; unitprompt = IT_PROMPT_UNITS_BASE + unitprompt*2;
if (number == 1) if (number == 1)
PUSH_NUMBER_PROMPT(unitprompt); PUSH_NUMBER_PROMPT(unitprompt);
else else
PUSH_NUMBER_PROMPT(unitprompt+1); PUSH_NUMBER_PROMPT(unitprompt+1);
#endif #endif
} }
I18N_PLAY_FUNCTION(it, playNumber, getvalue_t number, uint8_t unit, uint8_t att) I18N_PLAY_FUNCTION(it, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{ {
/* if digit >= 1000000000: /* if digit >= 1000000000:
temp_digit, digit = divmod(digit, 1000000000) temp_digit, digit = divmod(digit, 1000000000)
prompts.extend(self.getNumberPrompt(temp_digit)) prompts.extend(self.getNumberPrompt(temp_digit))
prompts.append(Prompt(GUIDE_00_BILLION, dir=2)) prompts.append(Prompt(GUIDE_00_BILLION, dir=2))
if digit >= 1000000: if digit >= 1000000:
temp_digit, digit = divmod(digit, 1000000) temp_digit, digit = divmod(digit, 1000000)
prompts.extend(self.getNumberPrompt(temp_digit)) prompts.extend(self.getNumberPrompt(temp_digit))
prompts.append(Prompt(GUIDE_00_MILLION, dir=2)) prompts.append(Prompt(GUIDE_00_MILLION, dir=2))
*/ */
getvalue_t orignumber; getvalue_t orignumber;
if (number < 0) { if (number < 0) {
PUSH_NUMBER_PROMPT(IT_PROMPT_MENO); PUSH_NUMBER_PROMPT(IT_PROMPT_MENO);
number = -number; number = -number;
} }
orignumber=number; orignumber=number;
#if !defined(CPUARM) #if !defined(CPUARM)
if (unit) { if (unit) {
unit--; unit--;
convertUnit(number, unit); convertUnit(number, unit);
if (IS_IMPERIAL_ENABLE()) { if (IS_IMPERIAL_ENABLE()) {
if (unit == UNIT_DIST) { if (unit == UNIT_DIST) {
unit = UNIT_FEET; unit = UNIT_FEET;
} }
if (unit == UNIT_SPEED) { if (unit == UNIT_SPEED) {
unit = UNIT_KTS; unit = UNIT_KTS;
} }
} }
unit++; unit++;
} }
#endif #endif
int8_t mode = MODE(att); int8_t mode = MODE(att);
if (mode > 0) { if (mode > 0) {
#if defined(CPUARM) #if defined(CPUARM)
if (mode == 2) { if (mode == 2) {
number /= 10; number /= 10;
} }
#else #else
// we assume that we are PREC1 // we assume that we are PREC1
#endif #endif
div_t qr = div(number, 10); div_t qr = div((int)number, 10);
if (qr.rem > 0) { if (qr.rem > 0) {
PLAY_NUMBER(qr.quot, 0, 0); PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(IT_PROMPT_VIRGOLA); PUSH_NUMBER_PROMPT(IT_PROMPT_VIRGOLA);
if (mode==2 && qr.rem < 10) if (mode==2 && qr.rem < 10)
PUSH_NUMBER_PROMPT(IT_PROMPT_ZERO); PUSH_NUMBER_PROMPT(IT_PROMPT_ZERO);
PLAY_NUMBER(qr.rem, 0, 0); PLAY_NUMBER(qr.rem, 0, 0);
} }
else { else {
if (qr.quot==1) { if (qr.quot==1) {
PUSH_NUMBER_PROMPT(IT_PROMPT_UN); PUSH_NUMBER_PROMPT(IT_PROMPT_UN);
if (unit) { if (unit) {
PUSH_NUMBER_PROMPT(IT_PROMPT_UNITS_BASE+(unit*2)); PUSH_NUMBER_PROMPT(IT_PROMPT_UNITS_BASE+(unit*2));
} }
return; return;
} else { } else {
PLAY_NUMBER(qr.quot, 0, 0); PLAY_NUMBER(qr.quot, 0, 0);
} }
} }
} else { } else {
if (orignumber == 1 && unit) { if (orignumber == 1 && unit) {
PUSH_NUMBER_PROMPT(IT_PROMPT_UN); PUSH_NUMBER_PROMPT(IT_PROMPT_UN);
} else { } else {
if (number >= 1000) { if (number >= 1000) {
if (number >= 2000) { if (number >= 2000) {
PLAY_NUMBER(number / 1000, 0, 0); PLAY_NUMBER(number / 1000, 0, 0);
PUSH_NUMBER_PROMPT(IT_PROMPT_MILA); PUSH_NUMBER_PROMPT(IT_PROMPT_MILA);
} else { } else {
PUSH_NUMBER_PROMPT(IT_PROMPT_MILLE); PUSH_NUMBER_PROMPT(IT_PROMPT_MILLE);
} }
number %= 1000; number %= 1000;
if (number == 0) if (number == 0)
number = -1; number = -1;
} }
if (number >= 100) { if (number >= 100) {
if (number >= 200) if (number >= 200)
PUSH_NUMBER_PROMPT(IT_PROMPT_ZERO + number/100); PUSH_NUMBER_PROMPT(IT_PROMPT_ZERO + number/100);
PUSH_NUMBER_PROMPT(IT_PROMPT_CENT); PUSH_NUMBER_PROMPT(IT_PROMPT_CENT);
number %= 100; number %= 100;
if (number == 0) if (number == 0)
number = -1; number = -1;
} }
PUSH_NUMBER_PROMPT(IT_PROMPT_ZERO+number); PUSH_NUMBER_PROMPT(IT_PROMPT_ZERO+number);
} }
} }
if (unit) { if (unit) {
IT_PUSH_UNIT_PROMPT(orignumber, unit); IT_PUSH_UNIT_PROMPT(orignumber, unit);
} }
} }
I18N_PLAY_FUNCTION(it, playDuration, int seconds PLAY_DURATION_ATT) I18N_PLAY_FUNCTION(it, playDuration, int seconds PLAY_DURATION_ATT)
{ {
if (seconds < 0) { if (seconds < 0) {
PUSH_NUMBER_PROMPT(IT_PROMPT_MENO); PUSH_NUMBER_PROMPT(IT_PROMPT_MENO);
seconds = -seconds; seconds = -seconds;
} }
uint8_t ore = 0; uint8_t ore = 0;
uint8_t tmp = seconds / 3600; uint8_t tmp = seconds / 3600;
seconds %= 3600; seconds %= 3600;
if (tmp > 0) { if (tmp > 0) {
ore=tmp; ore=tmp;
if (tmp > 1 || IS_PLAY_TIME()) { if (tmp > 1 || IS_PLAY_TIME()) {
#if defined(CPUARM) #if defined(CPUARM)
PLAY_NUMBER(tmp, UNIT_HOURS, 0); PLAY_NUMBER(tmp, UNIT_HOURS, 0);
#else #else
PLAY_NUMBER(tmp, 0, 0); PLAY_NUMBER(tmp, 0, 0);
PUSH_NUMBER_PROMPT(IT_PROMPT_ORE); PUSH_NUMBER_PROMPT(IT_PROMPT_ORE);
} else { } else {
PUSH_NUMBER_PROMPT(IT_PROMPT_UN); PUSH_NUMBER_PROMPT(IT_PROMPT_UN);
PUSH_NUMBER_PROMPT(IT_PROMPT_ORA); PUSH_NUMBER_PROMPT(IT_PROMPT_ORA);
#endif #endif
} }
} }
if (seconds>0) { if (seconds>0) {
tmp = seconds / 60; tmp = seconds / 60;
seconds %= 60; seconds %= 60;
if (tmp>0 && seconds==0 && ore>0) { if (tmp>0 && seconds==0 && ore>0) {
PUSH_NUMBER_PROMPT(IT_PROMPT_E); PUSH_NUMBER_PROMPT(IT_PROMPT_E);
} }
if (tmp > 0) { if (tmp > 0) {
if (tmp != 1) { if (tmp != 1) {
#if defined(CPUARM) #if defined(CPUARM)
PLAY_NUMBER(tmp, UNIT_MINUTES, 0); PLAY_NUMBER(tmp, UNIT_MINUTES, 0);
#else #else
PLAY_NUMBER(tmp, 0, 0); PLAY_NUMBER(tmp, 0, 0);
PUSH_NUMBER_PROMPT(IT_PROMPT_MINUTI); PUSH_NUMBER_PROMPT(IT_PROMPT_MINUTI);
} else { } else {
PUSH_NUMBER_PROMPT(IT_PROMPT_UN); PUSH_NUMBER_PROMPT(IT_PROMPT_UN);
PUSH_NUMBER_PROMPT(IT_PROMPT_MINUTO); PUSH_NUMBER_PROMPT(IT_PROMPT_MINUTO);
#endif #endif
} }
} }
if ((tmp>0 || ore>0) && seconds>0) { if ((tmp>0 || ore>0) && seconds>0) {
PUSH_NUMBER_PROMPT(IT_PROMPT_E); PUSH_NUMBER_PROMPT(IT_PROMPT_E);
} }
} }
if (seconds != 0 || (ore==0 && tmp==0)) { if (seconds != 0 || (ore==0 && tmp==0)) {
if (seconds != 1) { if (seconds != 1) {
#if defined(CPUARM) #if defined(CPUARM)
PLAY_NUMBER(tmp, UNIT_SECONDS, 0); PLAY_NUMBER(tmp, UNIT_SECONDS, 0);
#else #else
PLAY_NUMBER(seconds, 0, 0); PLAY_NUMBER(seconds, 0, 0);
PUSH_NUMBER_PROMPT(IT_PROMPT_SECONDI); PUSH_NUMBER_PROMPT(IT_PROMPT_SECONDI);
} else { } else {
PUSH_NUMBER_PROMPT(IT_PROMPT_UN); PUSH_NUMBER_PROMPT(IT_PROMPT_UN);
PUSH_NUMBER_PROMPT(IT_PROMPT_SECONDO); PUSH_NUMBER_PROMPT(IT_PROMPT_SECONDO);
#endif #endif
} }
} }
} }
LANGUAGE_PACK_DECLARE(it, "Italiano"); LANGUAGE_PACK_DECLARE(it, "Italiano");
#endif #endif

View file

@ -146,7 +146,7 @@ I18N_PLAY_FUNCTION(pl, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
#else #else
// we assume that we are PREC1 // we assume that we are PREC1
#endif #endif
div_t qr = div(number, 10); div_t qr = div((int)number, 10);
if (qr.rem) { if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, ZENSKI); PLAY_NUMBER(qr.quot, 0, ZENSKI);
if (qr.quot == 0) if (qr.quot == 0)

View file

@ -1,250 +1,250 @@
/* /*
* Authors (alphabetical order) * Authors (alphabetical order)
* - Andre Bernet <bernet.andre@gmail.com> * - Andre Bernet <bernet.andre@gmail.com>
* - Andreas Weitl * - Andreas Weitl
* - Bertrand Songis <bsongis@gmail.com> * - Bertrand Songis <bsongis@gmail.com>
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com> * - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
* - Cameron Weeks <th9xer@gmail.com> * - Cameron Weeks <th9xer@gmail.com>
* - Erez Raviv * - Erez Raviv
* - Gabriel Birkus * - Gabriel Birkus
* - Jean-Pierre Parisy * - Jean-Pierre Parisy
* - Karl Szmutny * - Karl Szmutny
* - Michael Blandford * - Michael Blandford
* - Michal Hlavinka * - Michal Hlavinka
* - Pat Mackenzie * - Pat Mackenzie
* - Philip Moss * - Philip Moss
* - Rob Thomson * - Rob Thomson
* - Romolo Manfredini <romolo.manfredini@gmail.com> * - Romolo Manfredini <romolo.manfredini@gmail.com>
* - Thomas Husterer * - Thomas Husterer
* *
* opentx is based on code named * opentx is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/, * er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by * and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/ * Thomas Husterer, th9x: http://code.google.com/p/th9x/
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
*/ */
#include "opentx.h" #include "opentx.h"
enum PortuguesePrompts { enum PortuguesePrompts {
PT_PROMPT_NUMBERS_BASE = 0, PT_PROMPT_NUMBERS_BASE = 0,
PT_PROMPT_ZERO = PT_PROMPT_NUMBERS_BASE+0, PT_PROMPT_ZERO = PT_PROMPT_NUMBERS_BASE+0,
PT_PROMPT_CEM = PT_PROMPT_NUMBERS_BASE+100, PT_PROMPT_CEM = PT_PROMPT_NUMBERS_BASE+100,
PT_PROMPT_CENTO = PT_PROMPT_NUMBERS_BASE+101, PT_PROMPT_CENTO = PT_PROMPT_NUMBERS_BASE+101,
PT_PROMPT_DUZENTOS = PT_PROMPT_NUMBERS_BASE+102, PT_PROMPT_DUZENTOS = PT_PROMPT_NUMBERS_BASE+102,
PT_PROMPT_TREZCENTOS, PT_PROMPT_TREZCENTOS,
PT_PROMPT_QUATROCENTOS, PT_PROMPT_QUATROCENTOS,
PT_PROMPT_QUINHENTOS, PT_PROMPT_QUINHENTOS,
PT_PROMPT_SEISCENTOS, PT_PROMPT_SEISCENTOS,
PT_PROMPT_SETECENTOS, PT_PROMPT_SETECENTOS,
PT_PROMPT_OITOCENTOS, PT_PROMPT_OITOCENTOS,
PT_PROMPT_NUEVECENTOS, PT_PROMPT_NUEVECENTOS,
PT_PROMPT_MIL = PT_PROMPT_NUMBERS_BASE+110, PT_PROMPT_MIL = PT_PROMPT_NUMBERS_BASE+110,
PT_PROMPT_VIRGULA = 111, PT_PROMPT_VIRGULA = 111,
PT_PROMPT_UMA, PT_PROMPT_UMA,
PT_PROMPT_DUAS, PT_PROMPT_DUAS,
PT_PROMPT_E, PT_PROMPT_E,
PT_PROMPT_MENOS, PT_PROMPT_MENOS,
PT_PROMPT_HORA, PT_PROMPT_HORA,
PT_PROMPT_HORAS, PT_PROMPT_HORAS,
PT_PROMPT_MINUTO, PT_PROMPT_MINUTO,
PT_PROMPT_MINUTOS, PT_PROMPT_MINUTOS,
PT_PROMPT_SEGUNDO, PT_PROMPT_SEGUNDO,
PT_PROMPT_SEGUNDOS, PT_PROMPT_SEGUNDOS,
PT_PROMPT_UNITS_BASE = 122, PT_PROMPT_UNITS_BASE = 122,
PT_PROMPT_VOLTS = PT_PROMPT_UNITS_BASE+UNIT_VOLTS, PT_PROMPT_VOLTS = PT_PROMPT_UNITS_BASE+UNIT_VOLTS,
PT_PROMPT_AMPS = PT_PROMPT_UNITS_BASE+UNIT_AMPS, PT_PROMPT_AMPS = PT_PROMPT_UNITS_BASE+UNIT_AMPS,
PT_PROMPT_METERS_PER_SECOND = PT_PROMPT_UNITS_BASE+UNIT_METERS_PER_SECOND, PT_PROMPT_METERS_PER_SECOND = PT_PROMPT_UNITS_BASE+UNIT_METERS_PER_SECOND,
PT_PROMPT_SPARE1 = PT_PROMPT_UNITS_BASE+UNIT_RAW, PT_PROMPT_SPARE1 = PT_PROMPT_UNITS_BASE+UNIT_RAW,
PT_PROMPT_KMH = PT_PROMPT_UNITS_BASE+UNIT_SPEED, PT_PROMPT_KMH = PT_PROMPT_UNITS_BASE+UNIT_SPEED,
PT_PROMPT_METERS = PT_PROMPT_UNITS_BASE+UNIT_DIST, PT_PROMPT_METERS = PT_PROMPT_UNITS_BASE+UNIT_DIST,
PT_PROMPT_DEGREES = PT_PROMPT_UNITS_BASE+UNIT_TEMPERATURE, PT_PROMPT_DEGREES = PT_PROMPT_UNITS_BASE+UNIT_TEMPERATURE,
PT_PROMPT_PERCENT = PT_PROMPT_UNITS_BASE+UNIT_PERCENT, PT_PROMPT_PERCENT = PT_PROMPT_UNITS_BASE+UNIT_PERCENT,
PT_PROMPT_MILLIAMPS = PT_PROMPT_UNITS_BASE+UNIT_MILLIAMPS, PT_PROMPT_MILLIAMPS = PT_PROMPT_UNITS_BASE+UNIT_MILLIAMPS,
PT_PROMPT_MAH = PT_PROMPT_UNITS_BASE+UNIT_MAH, PT_PROMPT_MAH = PT_PROMPT_UNITS_BASE+UNIT_MAH,
PT_PROMPT_WATTS = PT_PROMPT_UNITS_BASE+UNIT_WATTS, PT_PROMPT_WATTS = PT_PROMPT_UNITS_BASE+UNIT_WATTS,
PT_PROMPT_FEET = PT_PROMPT_UNITS_BASE+UNIT_FEET, PT_PROMPT_FEET = PT_PROMPT_UNITS_BASE+UNIT_FEET,
PT_PROMPT_KTS = PT_PROMPT_UNITS_BASE+UNIT_KTS, PT_PROMPT_KTS = PT_PROMPT_UNITS_BASE+UNIT_KTS,
#if defined(CPUARM) #if defined(CPUARM)
PT_PROMPT_MILLILITERS = PT_PROMPT_UNITS_BASE+UNIT_MILLILITERS, PT_PROMPT_MILLILITERS = PT_PROMPT_UNITS_BASE+UNIT_MILLILITERS,
PT_PROMPT_FLOZ = PT_PROMPT_UNITS_BASE+UNIT_FLOZ, PT_PROMPT_FLOZ = PT_PROMPT_UNITS_BASE+UNIT_FLOZ,
PT_PROMPT_FEET_PER_SECOND = PT_PROMPT_UNITS_BASE+UNIT_FEET_PER_SECOND, PT_PROMPT_FEET_PER_SECOND = PT_PROMPT_UNITS_BASE+UNIT_FEET_PER_SECOND,
#endif #endif
}; };
#if defined(VOICE) #if defined(VOICE)
#if defined(CPUARM) #if defined(CPUARM)
#define PT_PUSH_UNIT_PROMPT(u) pt_pushUnitPrompt((u), id) #define PT_PUSH_UNIT_PROMPT(u) pt_pushUnitPrompt((u), id)
#else #else
#define PT_PUSH_UNIT_PROMPT(u) pushUnitPrompt((u)) #define PT_PUSH_UNIT_PROMPT(u) pushUnitPrompt((u))
#endif #endif
I18N_PLAY_FUNCTION(pt, pushUnitPrompt, uint8_t unitprompt) I18N_PLAY_FUNCTION(pt, pushUnitPrompt, uint8_t unitprompt)
{ {
#if defined(CPUARM) #if defined(CPUARM)
PUSH_UNIT_PROMPT(unitprompt, 0); PUSH_UNIT_PROMPT(unitprompt, 0);
#else #else
unitprompt = PT_PROMPT_UNITS_BASE + unitprompt*2; unitprompt = PT_PROMPT_UNITS_BASE + unitprompt*2;
PUSH_NUMBER_PROMPT(unitprompt); PUSH_NUMBER_PROMPT(unitprompt);
#endif #endif
} }
I18N_PLAY_FUNCTION(pt, playNumber, getvalue_t number, uint8_t unit, uint8_t att) I18N_PLAY_FUNCTION(pt, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{ {
if (number < 0) { if (number < 0) {
PUSH_NUMBER_PROMPT(PT_PROMPT_MENOS); PUSH_NUMBER_PROMPT(PT_PROMPT_MENOS);
number = -number; number = -number;
} }
#if !defined(CPUARM) #if !defined(CPUARM)
if (unit) { if (unit) {
unit--; unit--;
convertUnit(number, unit); convertUnit(number, unit);
if (IS_IMPERIAL_ENABLE()) { if (IS_IMPERIAL_ENABLE()) {
if (unit == UNIT_DIST) { if (unit == UNIT_DIST) {
unit = UNIT_FEET; unit = UNIT_FEET;
} }
if (unit == UNIT_SPEED) { if (unit == UNIT_SPEED) {
unit = UNIT_KTS; unit = UNIT_KTS;
} }
} }
unit++; unit++;
} }
#endif #endif
int8_t mode = MODE(att); int8_t mode = MODE(att);
if (mode > 0) { if (mode > 0) {
#if defined(CPUARM) #if defined(CPUARM)
if (mode == 2) { if (mode == 2) {
number /= 10; number /= 10;
} }
#else #else
// we assume that we are PREC1 // we assume that we are PREC1
#endif #endif
div_t qr = div(number, 10); div_t qr = div((int)number, 10);
if (qr.rem > 0) { if (qr.rem > 0) {
PLAY_NUMBER(qr.quot, 0, 0); PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(PT_PROMPT_VIRGULA); PUSH_NUMBER_PROMPT(PT_PROMPT_VIRGULA);
if (mode==2 && qr.rem < 10) if (mode==2 && qr.rem < 10)
PUSH_NUMBER_PROMPT(PT_PROMPT_ZERO); PUSH_NUMBER_PROMPT(PT_PROMPT_ZERO);
PLAY_NUMBER(qr.rem, unit, 0); PLAY_NUMBER(qr.rem, unit, 0);
} }
else { else {
PLAY_NUMBER(qr.quot, unit, 0); PLAY_NUMBER(qr.quot, unit, 0);
} }
return; return;
} }
if (number >= 1000) { if (number >= 1000) {
if (number >= 2000) { if (number >= 2000) {
PLAY_NUMBER(number / 1000, 0, 0); PLAY_NUMBER(number / 1000, 0, 0);
PUSH_NUMBER_PROMPT(PT_PROMPT_MIL); PUSH_NUMBER_PROMPT(PT_PROMPT_MIL);
} else { } else {
PUSH_NUMBER_PROMPT(PT_PROMPT_MIL); PUSH_NUMBER_PROMPT(PT_PROMPT_MIL);
} }
number %= 1000; number %= 1000;
if (number == 0) if (number == 0)
number = -1; number = -1;
} }
if (number >= 100) { if (number >= 100) {
PUSH_NUMBER_PROMPT(PT_PROMPT_CENTO + number/100); PUSH_NUMBER_PROMPT(PT_PROMPT_CENTO + number/100);
number %= 100; number %= 100;
if (number == 0) if (number == 0)
number = -1; number = -1;
} }
PUSH_NUMBER_PROMPT(PT_PROMPT_ZERO+number); PUSH_NUMBER_PROMPT(PT_PROMPT_ZERO+number);
if (unit) { if (unit) {
PT_PUSH_UNIT_PROMPT(unit); PT_PUSH_UNIT_PROMPT(unit);
} }
} }
I18N_PLAY_FUNCTION(pt, playDuration, int seconds PLAY_DURATION_ATT) I18N_PLAY_FUNCTION(pt, playDuration, int seconds PLAY_DURATION_ATT)
{ {
if (seconds < 0) { if (seconds < 0) {
PUSH_NUMBER_PROMPT(PT_PROMPT_MENOS); PUSH_NUMBER_PROMPT(PT_PROMPT_MENOS);
seconds = -seconds; seconds = -seconds;
} }
uint8_t ore = 0; uint8_t ore = 0;
uint8_t tmp = seconds / 3600; uint8_t tmp = seconds / 3600;
seconds %= 3600; seconds %= 3600;
if (tmp > 0 || IS_PLAY_TIME()) { if (tmp > 0 || IS_PLAY_TIME()) {
ore=tmp; ore=tmp;
if (tmp > 2) { if (tmp > 2) {
PLAY_NUMBER(tmp, 0, 0); PLAY_NUMBER(tmp, 0, 0);
#if defined(CPUARM) #if defined(CPUARM)
PUSH_UNIT_PROMPT(UNIT_HOURS, 1); PUSH_UNIT_PROMPT(UNIT_HOURS, 1);
#else #else
PUSH_NUMBER_PROMPT(PT_PROMPT_HORAS); PUSH_NUMBER_PROMPT(PT_PROMPT_HORAS);
#endif #endif
} else if (tmp==2) { } else if (tmp==2) {
PUSH_NUMBER_PROMPT(PT_PROMPT_DUAS); PUSH_NUMBER_PROMPT(PT_PROMPT_DUAS);
#if defined(CPUARM) #if defined(CPUARM)
PUSH_UNIT_PROMPT(UNIT_HOURS, 1); PUSH_UNIT_PROMPT(UNIT_HOURS, 1);
#else #else
PUSH_NUMBER_PROMPT(PT_PROMPT_HORAS); PUSH_NUMBER_PROMPT(PT_PROMPT_HORAS);
#endif #endif
} else if (tmp==1) { } else if (tmp==1) {
PUSH_NUMBER_PROMPT(PT_PROMPT_UMA); PUSH_NUMBER_PROMPT(PT_PROMPT_UMA);
#if defined(CPUARM) #if defined(CPUARM)
PUSH_UNIT_PROMPT(UNIT_HOURS, 0); PUSH_UNIT_PROMPT(UNIT_HOURS, 0);
#else #else
PUSH_NUMBER_PROMPT(PT_PROMPT_HORAS); PUSH_NUMBER_PROMPT(PT_PROMPT_HORAS);
#endif #endif
} }
} }
tmp = seconds / 60; tmp = seconds / 60;
seconds %= 60; seconds %= 60;
if (tmp > 0 || ore >0) { if (tmp > 0 || ore >0) {
if (tmp != 1) { if (tmp != 1) {
PLAY_NUMBER(tmp, 0, 0); PLAY_NUMBER(tmp, 0, 0);
#if defined(CPUARM) #if defined(CPUARM)
PUSH_UNIT_PROMPT(UNIT_MINUTES, 1); PUSH_UNIT_PROMPT(UNIT_MINUTES, 1);
#else #else
PUSH_NUMBER_PROMPT(PT_PROMPT_MINUTOS); PUSH_NUMBER_PROMPT(PT_PROMPT_MINUTOS);
#endif #endif
} else { } else {
PUSH_NUMBER_PROMPT(PT_PROMPT_NUMBERS_BASE+1); PUSH_NUMBER_PROMPT(PT_PROMPT_NUMBERS_BASE+1);
#if defined(CPUARM) #if defined(CPUARM)
PUSH_UNIT_PROMPT(UNIT_MINUTES, 0); PUSH_UNIT_PROMPT(UNIT_MINUTES, 0);
#else #else
PUSH_NUMBER_PROMPT(PT_PROMPT_MINUTO); PUSH_NUMBER_PROMPT(PT_PROMPT_MINUTO);
#endif #endif
} }
PUSH_NUMBER_PROMPT(PT_PROMPT_E); PUSH_NUMBER_PROMPT(PT_PROMPT_E);
} }
if (seconds != 1) { if (seconds != 1) {
PLAY_NUMBER(seconds, 0, 0); PLAY_NUMBER(seconds, 0, 0);
#if defined(CPUARM) #if defined(CPUARM)
PUSH_UNIT_PROMPT(UNIT_SECONDS, 1); PUSH_UNIT_PROMPT(UNIT_SECONDS, 1);
#else #else
PUSH_NUMBER_PROMPT(PT_PROMPT_SEGUNDOS); PUSH_NUMBER_PROMPT(PT_PROMPT_SEGUNDOS);
#endif #endif
} else { } else {
PUSH_NUMBER_PROMPT(PT_PROMPT_NUMBERS_BASE+1); PUSH_NUMBER_PROMPT(PT_PROMPT_NUMBERS_BASE+1);
#if defined(CPUARM) #if defined(CPUARM)
PUSH_UNIT_PROMPT(UNIT_SECONDS, 0); PUSH_UNIT_PROMPT(UNIT_SECONDS, 0);
#else #else
PUSH_NUMBER_PROMPT(PT_PROMPT_SEGUNDO); PUSH_NUMBER_PROMPT(PT_PROMPT_SEGUNDO);
#endif #endif
} }
} }
LANGUAGE_PACK_DECLARE(pt, "Portugues"); LANGUAGE_PACK_DECLARE(pt, "Portugues");
#endif #endif

View file

@ -1,171 +1,171 @@
/* /*
* Authors (alphabetical order) * Authors (alphabetical order)
* - Andre Bernet <bernet.andre@gmail.com> * - Andre Bernet <bernet.andre@gmail.com>
* - Andreas Weitl * - Andreas Weitl
* - Bertrand Songis <bsongis@gmail.com> * - Bertrand Songis <bsongis@gmail.com>
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com> * - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
* - Cameron Weeks <th9xer@gmail.com> * - Cameron Weeks <th9xer@gmail.com>
* - Erez Raviv * - Erez Raviv
* - Gabriel Birkus * - Gabriel Birkus
* - Jean-Pierre Parisy * - Jean-Pierre Parisy
* - Kjell Kernen * - Kjell Kernen
* - Karl Szmutny * - Karl Szmutny
* - Michael Blandford * - Michael Blandford
* - Michal Hlavinka * - Michal Hlavinka
* - Pat Mackenzie * - Pat Mackenzie
* - Philip Moss * - Philip Moss
* - Rob Thomson * - Rob Thomson
* - Romolo Manfredini <romolo.manfredini@gmail.com> * - Romolo Manfredini <romolo.manfredini@gmail.com>
* - Thomas Husterer * - Thomas Husterer
* *
* opentx is based on code named * opentx is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/, * er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by * and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/ * Thomas Husterer, th9x: http://code.google.com/p/th9x/
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
*/ */
#include "opentx.h" #include "opentx.h"
enum SwedishPrompts { enum SwedishPrompts {
SE_PROMPT_NUMBERS_BASE = 0, SE_PROMPT_NUMBERS_BASE = 0,
SE_PROMPT_ZERO = SE_PROMPT_NUMBERS_BASE+0, //02-99 SE_PROMPT_ZERO = SE_PROMPT_NUMBERS_BASE+0, //02-99
SE_PROMPT_HUNDRED = SE_PROMPT_NUMBERS_BASE+100, //100,200 .. 900 SE_PROMPT_HUNDRED = SE_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
SE_PROMPT_THOUSAND = SE_PROMPT_NUMBERS_BASE+109, //1000 SE_PROMPT_THOUSAND = SE_PROMPT_NUMBERS_BASE+109, //1000
SE_PROMPT_AND = SE_PROMPT_NUMBERS_BASE+110, SE_PROMPT_AND = SE_PROMPT_NUMBERS_BASE+110,
SE_PROMPT_MINUS = SE_PROMPT_NUMBERS_BASE+111, SE_PROMPT_MINUS = SE_PROMPT_NUMBERS_BASE+111,
SE_PROMPT_POINT = SE_PROMPT_NUMBERS_BASE+112, SE_PROMPT_POINT = SE_PROMPT_NUMBERS_BASE+112,
SE_PROMPT_UNITS_BASE = 113, SE_PROMPT_UNITS_BASE = 113,
SE_PROMPT_POINT_BASE = 165, //.0 - .9 SE_PROMPT_POINT_BASE = 165, //.0 - .9
}; };
#if defined(VOICE) #if defined(VOICE)
#if defined(CPUARM) #if defined(CPUARM)
#define SE_PUSH_UNIT_PROMPT(p, u) se_pushUnitPrompt((p), (u), id) #define SE_PUSH_UNIT_PROMPT(p, u) se_pushUnitPrompt((p), (u), id)
#else #else
#define SE_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u)) #define SE_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u))
#endif #endif
I18N_PLAY_FUNCTION(se, pushUnitPrompt, int16_t number, uint8_t unitprompt) I18N_PLAY_FUNCTION(se, pushUnitPrompt, int16_t number, uint8_t unitprompt)
{ {
#if defined(CPUARM) #if defined(CPUARM)
if (number == 1) if (number == 1)
PUSH_UNIT_PROMPT(unitprompt, 0); PUSH_UNIT_PROMPT(unitprompt, 0);
else else
PUSH_UNIT_PROMPT(unitprompt, 1); PUSH_UNIT_PROMPT(unitprompt, 1);
#else #else
unitprompt = SE_PROMPT_UNITS_BASE + unitprompt*2; unitprompt = SE_PROMPT_UNITS_BASE + unitprompt*2;
if (number == 1) if (number == 1)
PUSH_NUMBER_PROMPT(unitprompt); PUSH_NUMBER_PROMPT(unitprompt);
else else
PUSH_NUMBER_PROMPT(unitprompt+1); PUSH_NUMBER_PROMPT(unitprompt+1);
#endif #endif
} }
I18N_PLAY_FUNCTION(se, playNumber, getvalue_t number, uint8_t unit, uint8_t att) I18N_PLAY_FUNCTION(se, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{ {
if (number < 0) { if (number < 0) {
PUSH_NUMBER_PROMPT(SE_PROMPT_MINUS); PUSH_NUMBER_PROMPT(SE_PROMPT_MINUS);
number = -number; number = -number;
} }
#if !defined(CPUARM) #if !defined(CPUARM)
if (unit) { if (unit) {
unit--; unit--;
convertUnit(number, unit); convertUnit(number, unit);
if (IS_IMPERIAL_ENABLE()) { if (IS_IMPERIAL_ENABLE()) {
if (unit == UNIT_DIST) { if (unit == UNIT_DIST) {
unit = UNIT_FEET; unit = UNIT_FEET;
} }
if (unit == UNIT_SPEED) { if (unit == UNIT_SPEED) {
unit = UNIT_KTS; unit = UNIT_KTS;
} }
} }
unit++; unit++;
} }
#endif #endif
int8_t mode = MODE(att); int8_t mode = MODE(att);
if (mode > 0) { if (mode > 0) {
#if defined(CPUARM) #if defined(CPUARM)
if (mode == 2) { if (mode == 2) {
number /= 10; number /= 10;
} }
#else #else
// we assume that we are PREC1 // we assume that we are PREC1
#endif #endif
div_t qr = div(number, 10); div_t qr = div((int)number, 10);
if (qr.rem) { if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, 0); PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(SE_PROMPT_POINT_BASE + qr.rem); PUSH_NUMBER_PROMPT(SE_PROMPT_POINT_BASE + qr.rem);
number = -1; number = -1;
} }
else { else {
number = qr.quot; number = qr.quot;
} }
} }
int16_t tmpNumber = number; int16_t tmpNumber = number;
if (number >= 1000) { if (number >= 1000) {
PLAY_NUMBER(number / 1000, 0, 0); PLAY_NUMBER(number / 1000, 0, 0);
PUSH_NUMBER_PROMPT(SE_PROMPT_THOUSAND); PUSH_NUMBER_PROMPT(SE_PROMPT_THOUSAND);
number %= 1000; number %= 1000;
if (number == 0) if (number == 0)
number = -1; number = -1;
} }
if (number >= 100) { if (number >= 100) {
PUSH_NUMBER_PROMPT(SE_PROMPT_HUNDRED + (number/100)-1); PUSH_NUMBER_PROMPT(SE_PROMPT_HUNDRED + (number/100)-1);
number %= 100; number %= 100;
if (number == 0) if (number == 0)
number = -1; number = -1;
} }
if (number >= 0) { if (number >= 0) {
PUSH_NUMBER_PROMPT(SE_PROMPT_ZERO + number); PUSH_NUMBER_PROMPT(SE_PROMPT_ZERO + number);
} }
if (unit) { if (unit) {
SE_PUSH_UNIT_PROMPT(tmpNumber, unit); SE_PUSH_UNIT_PROMPT(tmpNumber, unit);
} }
} }
I18N_PLAY_FUNCTION(se, playDuration, int seconds PLAY_DURATION_ATT) I18N_PLAY_FUNCTION(se, playDuration, int seconds PLAY_DURATION_ATT)
{ {
if (seconds < 0) { if (seconds < 0) {
PUSH_NUMBER_PROMPT(SE_PROMPT_MINUS); PUSH_NUMBER_PROMPT(SE_PROMPT_MINUS);
seconds = -seconds; seconds = -seconds;
} }
uint8_t tmp = seconds / 3600; uint8_t tmp = seconds / 3600;
seconds %= 3600; seconds %= 3600;
if (tmp > 0 || IS_PLAY_TIME()) { if (tmp > 0 || IS_PLAY_TIME()) {
PLAY_NUMBER(tmp, UNIT_HOURS, 0); PLAY_NUMBER(tmp, UNIT_HOURS, 0);
} }
tmp = seconds / 60; tmp = seconds / 60;
seconds %= 60; seconds %= 60;
if (tmp > 0) { if (tmp > 0) {
PLAY_NUMBER(tmp, UNIT_MINUTES, 0); PLAY_NUMBER(tmp, UNIT_MINUTES, 0);
if (seconds > 0) if (seconds > 0)
PUSH_NUMBER_PROMPT(SE_PROMPT_AND); PUSH_NUMBER_PROMPT(SE_PROMPT_AND);
} }
if (seconds > 0) { if (seconds > 0) {
PLAY_NUMBER(seconds, UNIT_SECONDS, 0); PLAY_NUMBER(seconds, UNIT_SECONDS, 0);
} }
} }
LANGUAGE_PACK_DECLARE(se, "Swedish"); LANGUAGE_PACK_DECLARE(se, "Swedish");
#endif #endif

View file

@ -1,257 +1,257 @@
/* /*
* Authors (alphabetical order) * Authors (alphabetical order)
* - Andre Bernet <bernet.andre@gmail.com> * - Andre Bernet <bernet.andre@gmail.com>
* - Andreas Weitl * - Andreas Weitl
* - Bertrand Songis <bsongis@gmail.com> * - Bertrand Songis <bsongis@gmail.com>
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com> * - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
* - Cameron Weeks <th9xer@gmail.com> * - Cameron Weeks <th9xer@gmail.com>
* - Erez Raviv * - Erez Raviv
* - Gabriel Birkus * - Gabriel Birkus
* - Jean-Pierre Parisy * - Jean-Pierre Parisy
* - Karl Szmutny * - Karl Szmutny
* - Martin Hotar * - Martin Hotar
* - Michael Blandford * - Michael Blandford
* - Michal Hlavinka * - Michal Hlavinka
* - Pat Mackenzie * - Pat Mackenzie
* - Philip Moss * - Philip Moss
* - Rob Thomson * - Rob Thomson
* - Romolo Manfredini <romolo.manfredini@gmail.com> * - Romolo Manfredini <romolo.manfredini@gmail.com>
* - Thomas Husterer * - Thomas Husterer
* *
* opentx is based on code named * opentx is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/, * er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by * and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/ * Thomas Husterer, th9x: http://code.google.com/p/th9x/
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
*/ */
#include "opentx.h" #include "opentx.h"
enum SlovakPrompts { enum SlovakPrompts {
SK_PROMPT_NUMBERS_BASE = 0, SK_PROMPT_NUMBERS_BASE = 0,
SK_PROMPT_NULA = SK_PROMPT_NUMBERS_BASE+0, //0-99 SK_PROMPT_NULA = SK_PROMPT_NUMBERS_BASE+0, //0-99
SK_PROMPT_STO = SK_PROMPT_NUMBERS_BASE+100, //100,200 .. 900 SK_PROMPT_STO = SK_PROMPT_NUMBERS_BASE+100, //100,200 .. 900
SK_PROMPT_TISIC = SK_PROMPT_NUMBERS_BASE+109, //1000 SK_PROMPT_TISIC = SK_PROMPT_NUMBERS_BASE+109, //1000
SK_PROMPT_DVETISIC = SK_PROMPT_NUMBERS_BASE+110, SK_PROMPT_DVETISIC = SK_PROMPT_NUMBERS_BASE+110,
SK_PROMPT_JEDEN = SK_PROMPT_NUMBERS_BASE+111, SK_PROMPT_JEDEN = SK_PROMPT_NUMBERS_BASE+111,
SK_PROMPT_JEDNO = SK_PROMPT_NUMBERS_BASE+112, SK_PROMPT_JEDNO = SK_PROMPT_NUMBERS_BASE+112,
SK_PROMPT_DVE = SK_PROMPT_NUMBERS_BASE+113, SK_PROMPT_DVE = SK_PROMPT_NUMBERS_BASE+113,
SK_PROMPT_CELA = SK_PROMPT_NUMBERS_BASE+114, SK_PROMPT_CELA = SK_PROMPT_NUMBERS_BASE+114,
SK_PROMPT_CELE = SK_PROMPT_NUMBERS_BASE+115, SK_PROMPT_CELE = SK_PROMPT_NUMBERS_BASE+115,
SK_PROMPT_CELYCH = SK_PROMPT_NUMBERS_BASE+116, SK_PROMPT_CELYCH = SK_PROMPT_NUMBERS_BASE+116,
SK_PROMPT_MINUS = SK_PROMPT_NUMBERS_BASE+117, SK_PROMPT_MINUS = SK_PROMPT_NUMBERS_BASE+117,
SK_PROMPT_UNITS_BASE = 118, //(jeden)volt,(dva)volty,(pet)voltu,(desetina)voltu SK_PROMPT_UNITS_BASE = 118, //(jeden)volt,(dva)volty,(pet)voltu,(desetina)voltu
}; };
#if defined(VOICE) #if defined(VOICE)
#if defined(CPUARM) #if defined(CPUARM)
#define SK_PUSH_UNIT_PROMPT(p, u) sk_pushUnitPrompt((p), (u), id) #define SK_PUSH_UNIT_PROMPT(p, u) sk_pushUnitPrompt((p), (u), id)
#else #else
#define SK_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u)) #define SK_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u))
#endif #endif
#define MUZSKY 0x80 #define MUZSKY 0x80
#define ZENSKY 0x81 #define ZENSKY 0x81
#define STREDNI 0x82 #define STREDNI 0x82
I18N_PLAY_FUNCTION(sk, pushUnitPrompt, int16_t number, uint8_t unitprompt) I18N_PLAY_FUNCTION(sk, pushUnitPrompt, int16_t number, uint8_t unitprompt)
{ {
#if defined(CPUARM) #if defined(CPUARM)
if (number == 1) if (number == 1)
PUSH_UNIT_PROMPT(unitprompt, 0); PUSH_UNIT_PROMPT(unitprompt, 0);
else if (number > 1 && number < 5) else if (number > 1 && number < 5)
PUSH_UNIT_PROMPT(unitprompt, 1); PUSH_UNIT_PROMPT(unitprompt, 1);
else else
PUSH_UNIT_PROMPT(unitprompt, 2); PUSH_UNIT_PROMPT(unitprompt, 2);
#else #else
unitprompt = SK_PROMPT_UNITS_BASE + unitprompt*4; unitprompt = SK_PROMPT_UNITS_BASE + unitprompt*4;
if (number == 1) if (number == 1)
PUSH_NUMBER_PROMPT(unitprompt); PUSH_NUMBER_PROMPT(unitprompt);
else if (number > 1 && number < 5) else if (number > 1 && number < 5)
PUSH_NUMBER_PROMPT(unitprompt+1); PUSH_NUMBER_PROMPT(unitprompt+1);
else else
PUSH_NUMBER_PROMPT(unitprompt+2); PUSH_NUMBER_PROMPT(unitprompt+2);
#endif #endif
} }
I18N_PLAY_FUNCTION(sk, playNumber, getvalue_t number, uint8_t unit, uint8_t att) I18N_PLAY_FUNCTION(sk, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
{ {
if (number < 0) { if (number < 0) {
PUSH_NUMBER_PROMPT(SK_PROMPT_MINUS); PUSH_NUMBER_PROMPT(SK_PROMPT_MINUS);
number = -number; number = -number;
} }
#if !defined(CPUARM) #if !defined(CPUARM)
if (unit) { if (unit) {
unit--; unit--;
convertUnit(number, unit); convertUnit(number, unit);
if (IS_IMPERIAL_ENABLE()) { if (IS_IMPERIAL_ENABLE()) {
if (unit == UNIT_DIST) { if (unit == UNIT_DIST) {
unit = UNIT_FEET; unit = UNIT_FEET;
} }
if (unit == UNIT_SPEED) { if (unit == UNIT_SPEED) {
unit = UNIT_KTS; unit = UNIT_KTS;
} }
} }
unit++; unit++;
} }
#endif #endif
int8_t mode = MODE(att); int8_t mode = MODE(att);
if (mode > 0) { if (mode > 0) {
#if defined(CPUARM) #if defined(CPUARM)
if (mode == 2) { if (mode == 2) {
number /= 10; number /= 10;
} }
#else #else
// we assume that we are PREC1 // we assume that we are PREC1
#endif #endif
div_t qr = div(number, 10); div_t qr = div((int)number, 10);
if (qr.rem) { if (qr.rem) {
PLAY_NUMBER(qr.quot, 0, ZENSKY); PLAY_NUMBER(qr.quot, 0, ZENSKY);
if (qr.quot == 0) if (qr.quot == 0)
PUSH_NUMBER_PROMPT(SK_PROMPT_CELA); PUSH_NUMBER_PROMPT(SK_PROMPT_CELA);
else else
SK_PUSH_UNIT_PROMPT(qr.quot, SK_PROMPT_CELA); SK_PUSH_UNIT_PROMPT(qr.quot, SK_PROMPT_CELA);
PLAY_NUMBER(qr.rem, 0, ZENSKY); PLAY_NUMBER(qr.rem, 0, ZENSKY);
PUSH_NUMBER_PROMPT(SK_PROMPT_UNITS_BASE+((unit-1)*4)+3); PUSH_NUMBER_PROMPT(SK_PROMPT_UNITS_BASE+((unit-1)*4)+3);
return; return;
} }
else { else {
number = qr.quot; number = qr.quot;
} }
} }
int16_t tmp = number; int16_t tmp = number;
#if defined(CPUARM) #if defined(CPUARM)
switch(unit) { switch(unit) {
case 0: case 0:
break; break;
case 6: case 6:
case 8: case 8:
case 10: case 10:
case 14: case 14:
case 17: case 17:
case 21: case 21:
case 22: case 22:
case 23: case 23:
case 24: case 24:
att = ZENSKY; att = ZENSKY;
break; break;
case 13: case 13:
case 18: case 18:
att = STREDNI; att = STREDNI;
break; break;
default: default:
att = MUZSKY; att = MUZSKY;
break; break;
} }
#else #else
switch(unit) { switch(unit) {
case 0: case 0:
break; break;
case 4: case 4:
case 10: case 10:
case 13: case 13:
case 14: case 14:
case 15: case 15:
case 16: case 16:
case 17: case 17:
case 18: case 18:
att = ZENSKY; att = ZENSKY;
break; break;
case 8: case 8:
case 19: case 19:
att = STREDNI; att = STREDNI;
break; break;
default: default:
att = MUZSKY; att = MUZSKY;
break; break;
} }
#endif #endif
if ((number == 1) && (att == MUZSKY)) { if ((number == 1) && (att == MUZSKY)) {
PUSH_NUMBER_PROMPT(SK_PROMPT_JEDEN); PUSH_NUMBER_PROMPT(SK_PROMPT_JEDEN);
number = -1; number = -1;
} }
if ((number == 1) && (att == STREDNI)) { if ((number == 1) && (att == STREDNI)) {
PUSH_NUMBER_PROMPT(SK_PROMPT_JEDNO); PUSH_NUMBER_PROMPT(SK_PROMPT_JEDNO);
number = -1; number = -1;
} }
if ((number == 2) && ((att == ZENSKY) || (att == STREDNI))) { if ((number == 2) && ((att == ZENSKY) || (att == STREDNI))) {
PUSH_NUMBER_PROMPT(SK_PROMPT_DVE); PUSH_NUMBER_PROMPT(SK_PROMPT_DVE);
number = -1; number = -1;
} }
if (number >= 1000) { if (number >= 1000) {
if (number >= 3000) if (number >= 3000)
PLAY_NUMBER(number / 1000, 0, 0); PLAY_NUMBER(number / 1000, 0, 0);
if (number >= 2000 && number < 3000) if (number >= 2000 && number < 3000)
PUSH_NUMBER_PROMPT(SK_PROMPT_DVETISIC); PUSH_NUMBER_PROMPT(SK_PROMPT_DVETISIC);
else else
PUSH_NUMBER_PROMPT(SK_PROMPT_TISIC); PUSH_NUMBER_PROMPT(SK_PROMPT_TISIC);
number %= 1000; number %= 1000;
if (number == 0) if (number == 0)
number = -1; number = -1;
} }
if (number >= 100) { if (number >= 100) {
PUSH_NUMBER_PROMPT(SK_PROMPT_STO + (number/100)-1); PUSH_NUMBER_PROMPT(SK_PROMPT_STO + (number/100)-1);
number %= 100; number %= 100;
if (number == 0) if (number == 0)
number = -1; number = -1;
} }
if (number >= 0) { if (number >= 0) {
PUSH_NUMBER_PROMPT(SK_PROMPT_NULA+number); PUSH_NUMBER_PROMPT(SK_PROMPT_NULA+number);
} }
if (unit) { if (unit) {
SK_PUSH_UNIT_PROMPT(tmp, unit); SK_PUSH_UNIT_PROMPT(tmp, unit);
} }
} }
I18N_PLAY_FUNCTION(sk, playDuration, int seconds PLAY_DURATION_ATT) I18N_PLAY_FUNCTION(sk, playDuration, int seconds PLAY_DURATION_ATT)
{ {
if (seconds < 0) { if (seconds < 0) {
PUSH_NUMBER_PROMPT(SK_PROMPT_MINUS); PUSH_NUMBER_PROMPT(SK_PROMPT_MINUS);
seconds = -seconds; seconds = -seconds;
} }
uint8_t tmp = seconds / 3600; uint8_t tmp = seconds / 3600;
seconds %= 3600; seconds %= 3600;
if (tmp > 0 || IS_PLAY_TIME()) { if (tmp > 0 || IS_PLAY_TIME()) {
PLAY_NUMBER(tmp, UNIT_HOURS, ZENSKY); PLAY_NUMBER(tmp, UNIT_HOURS, ZENSKY);
} }
tmp = seconds / 60; tmp = seconds / 60;
seconds %= 60; seconds %= 60;
if (tmp > 0) { if (tmp > 0) {
PLAY_NUMBER(tmp, UNIT_MINUTES, ZENSKY); PLAY_NUMBER(tmp, UNIT_MINUTES, ZENSKY);
} }
if (seconds > 0) { if (seconds > 0) {
PLAY_NUMBER(seconds, UNIT_SECONDS, ZENSKY); PLAY_NUMBER(seconds, UNIT_SECONDS, ZENSKY);
} }
} }
LANGUAGE_PACK_DECLARE(sk, "Slovak"); LANGUAGE_PACK_DECLARE(sk, "Slovak");
#endif #endif