diff --git a/radio/src/audio_arm.cpp b/radio/src/audio_arm.cpp index 24ab00b19..3e496f1a9 100644 --- a/radio/src/audio_arm.cpp +++ b/radio/src/audio_arm.cpp @@ -306,7 +306,7 @@ void getSwitchAudioFile(char * filename, swsrc_t index) strcpy(str, positions[swinfo.rem]); } 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++ = '1' + swinfo.quot; *str++ = '1' + swinfo.rem; diff --git a/radio/src/gui/212x64/lcd.cpp b/radio/src/gui/212x64/lcd.cpp index 95d78d1bc..d5a3459e8 100644 --- a/radio/src/gui/212x64/lcd.cpp +++ b/radio/src/gui/212x64/lcd.cpp @@ -532,7 +532,7 @@ void drawTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2 tme = -tme; } - qr = div(tme, 60); + qr = div((int)tme, 60); #define separator ':' if (att & TIMEHOUR) { diff --git a/radio/src/logs.cpp b/radio/src/logs.cpp index 1026bb6a8..da9fab901 100644 --- a/radio/src/logs.cpp +++ b/radio/src/logs.cpp @@ -305,9 +305,9 @@ void logsWrite() if (sensor.logs) { if (sensor.unit == UNIT_GPS) { 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)); - qr = div(telemetryItem.gps.longitude, 1000000); + qr = div((int)telemetryItem.gps.longitude, 1000000); f_printf(&g_oLogFile, "%d.%06d,", qr.quot, abs(qr.rem)); } 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); } 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, "-"); f_printf(&g_oLogFile, "%d.%02d,", abs(qr.quot), abs(qr.rem)); } 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, "-"); f_printf(&g_oLogFile, "%d.%d,", abs(qr.quot), abs(qr.rem)); } diff --git a/radio/src/strhelpers.cpp b/radio/src/strhelpers.cpp index 581e698cb..ce9044547 100644 --- a/radio/src/strhelpers.cpp +++ b/radio/src/strhelpers.cpp @@ -169,7 +169,7 @@ char * getTimerString(char * dest, putstime_t tme, uint8_t hours) *s++ = '-'; } - qr = div(tme, 60); + qr = div((int)tme, 60); if (hours) { div_t qr2 = div(qr.quot, 60); @@ -254,7 +254,7 @@ char * getSwitchString(char * dest, swsrc_t idx) #endif #if NUM_XPOTS > 0 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]; getSourceString(temp, MIXSRC_FIRST_POT+swinfo.quot); temp[LEN_ANA_NAME]= '\0'; diff --git a/radio/src/targets/common/arm/stm32/f2/system_stm32f2xx.c b/radio/src/targets/common/arm/stm32/f2/system_stm32f2xx.c index f04a7d4e7..992d3b676 100644 --- a/radio/src/targets/common/arm/stm32/f2/system_stm32f2xx.c +++ b/radio/src/targets/common/arm/stm32/f2/system_stm32f2xx.c @@ -18,439 +18,437 @@ * GNU General Public License for more details. */ -/** @addtogroup CMSIS - * @{ - */ - -/** @addtogroup stm32f2xx_system - * @{ - */ - -/** @addtogroup STM32F2xx_System_Private_Includes - * @{ - */ - -#include "stm32f2xx.h" - -/** - * @} - */ - -/** @addtogroup STM32F2xx_System_Private_TypesDefinitions - * @{ - */ - -/** - * @} - */ - -/** @addtogroup STM32F2xx_System_Private_Defines - * @{ - */ - -/*!< Uncomment the following line if you need to use external SRAM mounted - on STM322xG_EVALboard as data memory */ -/* #define DATA_IN_ExtSRAM */ - -/*!< Uncomment the following line if you need to relocate your vector Table in - Internal SRAM. */ -/* #define VECT_TAB_SRAM */ -#define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset field. - This value must be a multiple of 0x200. */ - - -/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */ -#define PLL_M 12 -#define PLL_N 240 - -/* SYSCLK = PLL_VCO / PLL_P */ -#define PLL_P 2 - -/* USB OTG FS, SDIO and RNG Clock = PLL_VCO / PLLQ */ -#define PLL_Q 5 - -/** - * @} - */ - -/** @addtogroup STM32F2xx_System_Private_Macros - * @{ - */ - -/** - * @} - */ - -/** @addtogroup STM32F2xx_System_Private_Variables - * @{ - */ - - 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}; - -/** - * @} - */ - -/** @addtogroup STM32F2xx_System_Private_FunctionPrototypes - * @{ - */ - -static void SetSysClock(void); -#ifdef DATA_IN_ExtSRAM - static void SystemInit_ExtMemCtl(void); -#endif /* DATA_IN_ExtSRAM */ - -/** - * @} - */ - -/** @addtogroup STM32F2xx_System_Private_Functions - * @{ - */ - -/** - * @brief Setup the microcontroller system - * Initialize the Embedded Flash Interface, the PLL and update the - * SystemFrequency variable. - * @param None - * @retval None - */ -void SystemInit(void) -{ - /* Reset the RCC clock configuration to the default reset state ------------*/ - /* Set HSION bit */ - RCC->CR |= (uint32_t)0x00000001; - - /* Reset CFGR register */ - RCC->CFGR = 0x00000000; - - /* Reset HSEON, CSSON and PLLON bits */ - RCC->CR &= (uint32_t)0xFEF6FFFF; - - /* Reset PLLCFGR register */ - RCC->PLLCFGR = 0x24003010; - - /* Reset HSEBYP bit */ - RCC->CR &= (uint32_t)0xFFFBFFFF; - - /* Disable all interrupts */ - RCC->CIR = 0x00000000; - -#ifdef DATA_IN_ExtSRAM - SystemInit_ExtMemCtl(); -#endif /* DATA_IN_ExtSRAM */ - - /* Configure the System clock source, PLL Multiplier and Divider factors, - AHB/APBx prescalers and Flash settings ----------------------------------*/ - SetSysClock(); - - /* Configure the Vector Table location add offset address ------------------*/ -#ifdef VECT_TAB_SRAM - SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */ -#else - extern uint32_t g_pfnVectors ; - SCB->VTOR = (uint32_t) &g_pfnVectors ; /* Vector Table Relocation in Internal FLASH */ -#endif -} - -/** - * @brief Update SystemCoreClock variable according to Clock Register Values. - * The SystemCoreClock variable contains the core clock (HCLK), it can - * be used by the user application to setup the SysTick timer or configure - * other parameters. - * - * @note Each time the core clock (HCLK) changes, this function must be called - * to update SystemCoreClock variable value. Otherwise, any configuration - * based on this variable will be incorrect. - * - * @note - The system frequency computed by this function is not the real - * frequency in the chip. It is calculated based on the predefined - * constant and the selected clock source: - * - * - 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 PLL, SystemCoreClock will contain the HSE_VALUE(**) - * or HSI_VALUE(*) multiplied/divided by the PLL factors. - * - * (*) HSI_VALUE is a constant defined in stm32f2xx.h file (default value - * 16 MHz) but the real value may vary depending on the variations - * in voltage and temperature. - * - * (**) 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 - * frequency of the crystal used. Otherwise, this function may - * have wrong result. - * - * - The result of this function could be not correct when using fractional - * value for HSE crystal. - * - * @param None - * @retval None - */ -void SystemCoreClockUpdate(void) -{ - uint32_t tmp = 0, pllvco = 0, pllp = 2, pllsource = 0, pllm = 2; - - /* Get SYSCLK source -------------------------------------------------------*/ - tmp = RCC->CFGR & RCC_CFGR_SWS; - - switch (tmp) - { - case 0x00: /* HSI used as system clock source */ - SystemCoreClock = HSI_VALUE; - break; - case 0x04: /* HSE used as system clock source */ - SystemCoreClock = HSE_VALUE; - break; - case 0x08: /* PLL used as system clock source */ - - /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N - SYSCLK = PLL_VCO / PLL_P - */ - pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) >> 22; - pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM; - - if (pllsource != 0) - { - /* HSE used as PLL clock source */ - pllvco = (HSE_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6); - } - else - { - /* HSI used as PLL clock source */ - pllvco = (HSI_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6); - } - - pllp = (((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) >>16) + 1 ) *2; - SystemCoreClock = pllvco/pllp; - break; - default: - SystemCoreClock = HSI_VALUE; - break; - } - /* Compute HCLK frequency --------------------------------------------------*/ - /* Get HCLK prescaler */ - tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)]; - /* HCLK frequency */ - SystemCoreClock >>= tmp; -} - -/** - * @brief Configures the System clock source, PLL Multiplier and Divider factors, - * AHB/APBx prescalers and Flash settings - * @Note This function should be called only once the RCC clock configuration - * is reset to the default reset state (done in SystemInit() function). - * @param None - * @retval None - */ -static void SetSysClock(void) -{ -/******************************************************************************/ -/* PLL (clocked by HSE) used as System clock source */ -/******************************************************************************/ - __IO uint32_t StartUpCounter = 0, HSEStatus = 0; - - /* Enable HSE */ - RCC->CR |= ((uint32_t)RCC_CR_HSEON); - - /* Wait till HSE is ready and if Time out is reached exit */ - do - { - HSEStatus = RCC->CR & RCC_CR_HSERDY; - StartUpCounter++; - } while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT)); - - if ((RCC->CR & RCC_CR_HSERDY) != RESET) - { - HSEStatus = (uint32_t)0x01; - } - else - { - HSEStatus = (uint32_t)0x00; - } - - if (HSEStatus == (uint32_t)0x01) - { - /* HCLK = SYSCLK / 1*/ - RCC->CFGR |= RCC_CFGR_HPRE_DIV1; - - /* PCLK2 = HCLK / 2*/ - RCC->CFGR |= RCC_CFGR_PPRE2_DIV2; - - /* PCLK1 = HCLK / 4*/ - RCC->CFGR |= RCC_CFGR_PPRE1_DIV4; - - /* Configure the main PLL */ - RCC->PLLCFGR = PLL_M | (PLL_N << 6) | (((PLL_P >> 1) -1) << 16) | - (RCC_PLLCFGR_PLLSRC_HSE) | (PLL_Q << 24); - - /* Enable the main PLL */ - RCC->CR |= RCC_CR_PLLON; - - /* Wait till the main PLL is ready */ - while((RCC->CR & RCC_CR_PLLRDY) == 0) - { - } - - /* 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; - - /* Select the main PLL as system clock source */ - RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW)); - RCC->CFGR |= RCC_CFGR_SW_PLL; - - /* Wait till the main PLL is used as system clock source */ - 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 - 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 - * @param None - * @retval None - */ -#ifdef DATA_IN_ExtSRAM -/** - * @brief Setup the external memory controller. - * Called in startup_stm32f2xx.s before jump to main. - * This function configures the external SRAM mounted on STM322xG_EVAL board - * This SRAM will be used as program data memory (including heap and stack). - * @param None - * @retval None - */ -void SystemInit_ExtMemCtl(void) -{ -/*-- GPIOs Configuration -----------------------------------------------------*/ -/* - +-------------------+--------------------+------------------+------------------+ - + 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 | - | PD4 <-> FSMC_NOE | PE7 <-> FSMC_D4 | PF2 <-> FSMC_A2 | PG2 <-> FSMC_A12 | - | PD5 <-> FSMC_NWE | PE8 <-> FSMC_D5 | PF3 <-> FSMC_A3 | PG3 <-> FSMC_A13 | - | PD8 <-> FSMC_D13 | PE9 <-> FSMC_D6 | PF4 <-> FSMC_A4 | PG4 <-> FSMC_A14 | - | PD9 <-> FSMC_D14 | PE10 <-> FSMC_D7 | PF5 <-> FSMC_A5 | PG5 <-> FSMC_A15 | - | PD10 <-> FSMC_D15 | PE11 <-> FSMC_D8 | PF12 <-> FSMC_A6 | PG9 <-> FSMC_NE2 | - | PD11 <-> FSMC_A16 | PE12 <-> FSMC_D9 | PF13 <-> FSMC_A7 |------------------+ - | PD12 <-> FSMC_A17 | PE13 <-> FSMC_D10 | PF14 <-> FSMC_A8 | - | 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; - - /* Connect PDx pins to FSMC Alternate function */ - GPIOD->AFR[0] = 0x00cc00cc; - GPIOD->AFR[1] = 0xcc0ccccc; - /* Configure PDx pins in Alternate function mode */ - GPIOD->MODER = 0xa2aa0a0a; - /* Configure PDx pins speed to 100 MHz */ - GPIOD->OSPEEDR = 0xf3ff0f0f; - /* Configure PDx pins Output type to push-pull */ - GPIOD->OTYPER = 0x00000000; - /* No pull-up, pull-down for PDx pins */ - GPIOD->PUPDR = 0x00000000; - - /* Connect PEx pins to FSMC Alternate function */ - GPIOE->AFR[0] = 0xc00000cc; - GPIOE->AFR[1] = 0xcccccccc; - /* Configure PEx pins in Alternate function mode */ - GPIOE->MODER = 0xaaaa800a; - /* Configure PEx pins speed to 100 MHz */ - GPIOE->OSPEEDR = 0xffffc00f; - /* Configure PEx pins Output type to push-pull */ - GPIOE->OTYPER = 0x00000000; - /* No pull-up, pull-down for PEx pins */ - GPIOE->PUPDR = 0x00000000; - - /* Connect PFx pins to FSMC Alternate function */ - GPIOF->AFR[0] = 0x00cccccc; - GPIOF->AFR[1] = 0xcccc0000; - /* Configure PFx pins in Alternate function mode */ - GPIOF->MODER = 0xaa000aaa; - /* Configure PFx pins speed to 100 MHz */ - GPIOF->OSPEEDR = 0xff000fff; - /* Configure PFx pins Output type to push-pull */ - GPIOF->OTYPER = 0x00000000; - /* No pull-up, pull-down for PFx pins */ - GPIOF->PUPDR = 0x00000000; - - /* Connect PGx pins to FSMC Alternate function */ - GPIOG->AFR[0] = 0x00cccccc; - GPIOG->AFR[1] = 0x000000c0; - /* Configure PGx pins in Alternate function mode */ - GPIOG->MODER = 0x00080aaa; - /* Configure PGx pins speed to 100 MHz */ - GPIOG->OSPEEDR = 0x000c0fff; - /* Configure PGx pins Output type to push-pull */ - GPIOG->OTYPER = 0x00000000; - /* No pull-up, pull-down for PGx pins */ - GPIOG->PUPDR = 0x00000000; - -/*-- FSMC Configuration ------------------------------------------------------*/ - /* Enable the FSMC interface clock */ - RCC->AHB3ENR = 0x00000001; - - /* Configure and enable Bank1_SRAM2 */ - FSMC_Bank1->BTCR[2] = 0x00001015; - FSMC_Bank1->BTCR[3] = 0x00010400; - FSMC_Bank1E->BWTR[2] = 0x0fffffff; -/* - Bank1_SRAM2 is configured as follow: - - p.FSMC_AddressSetupTime = 0; - p.FSMC_AddressHoldTime = 0; - p.FSMC_DataSetupTime = 4; - p.FSMC_BusTurnAroundDuration = 1; - p.FSMC_CLKDivision = 0; - 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_MemoryType = FSMC_MemoryType_PSRAM; - FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b; - FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable; - FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable; - FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low; - FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable; - FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState; - FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable; - FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable; - FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable; - FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable; - FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p; - FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p; -*/ - -} -#endif /* DATA_IN_ExtSRAM */ - - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ - +/** @addtogroup CMSIS + * @{ + */ + +/** @addtogroup stm32f2xx_system + * @{ + */ + +/** @addtogroup STM32F2xx_System_Private_Includes + * @{ + */ + +#include "stm32f2xx.h" + +/** + * @} + */ + +/** @addtogroup STM32F2xx_System_Private_TypesDefinitions + * @{ + */ + +/** + * @} + */ + +/** @addtogroup STM32F2xx_System_Private_Defines + * @{ + */ + +/*!< Uncomment the following line if you need to use external SRAM mounted + on STM322xG_EVALboard as data memory */ +/* #define DATA_IN_ExtSRAM */ + +/*!< Uncomment the following line if you need to relocate your vector Table in + Internal SRAM. */ +/* #define VECT_TAB_SRAM */ +#define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset field. + This value must be a multiple of 0x200. */ + + +/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */ +#define PLL_M 12 +#define PLL_N 240 + +/* SYSCLK = PLL_VCO / PLL_P */ +#define PLL_P 2 + +/* USB OTG FS, SDIO and RNG Clock = PLL_VCO / PLLQ */ +#define PLL_Q 5 + +/** + * @} + */ + +/** @addtogroup STM32F2xx_System_Private_Macros + * @{ + */ + +/** + * @} + */ + +/** @addtogroup STM32F2xx_System_Private_Variables + * @{ + */ + + 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}; + +/** + * @} + */ + +/** @addtogroup STM32F2xx_System_Private_FunctionPrototypes + * @{ + */ + +static void SetSysClock(void); +#ifdef DATA_IN_ExtSRAM + static void SystemInit_ExtMemCtl(void); +#endif /* DATA_IN_ExtSRAM */ + +/** + * @} + */ + +/** @addtogroup STM32F2xx_System_Private_Functions + * @{ + */ + +/** + * @brief Setup the microcontroller system + * Initialize the Embedded Flash Interface, the PLL and update the + * SystemFrequency variable. + * @param None + * @retval None + */ +void SystemInit(void) +{ + /* Reset the RCC clock configuration to the default reset state ------------*/ + /* Set HSION bit */ + RCC->CR |= (uint32_t)0x00000001; + + /* Reset CFGR register */ + RCC->CFGR = 0x00000000; + + /* Reset HSEON, CSSON and PLLON bits */ + RCC->CR &= (uint32_t)0xFEF6FFFF; + + /* Reset PLLCFGR register */ + RCC->PLLCFGR = 0x24003010; + + /* Reset HSEBYP bit */ + RCC->CR &= (uint32_t)0xFFFBFFFF; + + /* Disable all interrupts */ + RCC->CIR = 0x00000000; + +#ifdef DATA_IN_ExtSRAM + SystemInit_ExtMemCtl(); +#endif /* DATA_IN_ExtSRAM */ + + /* Configure the System clock source, PLL Multiplier and Divider factors, + AHB/APBx prescalers and Flash settings ----------------------------------*/ + SetSysClock(); + + /* Configure the Vector Table location add offset address ------------------*/ +#ifdef VECT_TAB_SRAM + SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */ +#else + extern uint32_t g_pfnVectors ; + SCB->VTOR = (uint32_t) &g_pfnVectors ; /* Vector Table Relocation in Internal FLASH */ +#endif +} + +/** + * @brief Update SystemCoreClock variable according to Clock Register Values. + * The SystemCoreClock variable contains the core clock (HCLK), it can + * be used by the user application to setup the SysTick timer or configure + * other parameters. + * + * @note Each time the core clock (HCLK) changes, this function must be called + * to update SystemCoreClock variable value. Otherwise, any configuration + * based on this variable will be incorrect. + * + * @note - The system frequency computed by this function is not the real + * frequency in the chip. It is calculated based on the predefined + * constant and the selected clock source: + * + * - 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 PLL, SystemCoreClock will contain the HSE_VALUE(**) + * or HSI_VALUE(*) multiplied/divided by the PLL factors. + * + * (*) HSI_VALUE is a constant defined in stm32f2xx.h file (default value + * 16 MHz) but the real value may vary depending on the variations + * in voltage and temperature. + * + * (**) 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 + * frequency of the crystal used. Otherwise, this function may + * have wrong result. + * + * - The result of this function could be not correct when using fractional + * value for HSE crystal. + * + * @param None + * @retval None + */ +void SystemCoreClockUpdate(void) +{ + uint32_t tmp = 0, pllvco = 0, pllp = 2, pllsource = 0, pllm = 2; + + /* Get SYSCLK source -------------------------------------------------------*/ + tmp = RCC->CFGR & RCC_CFGR_SWS; + + switch (tmp) + { + case 0x00: /* HSI used as system clock source */ + SystemCoreClock = HSI_VALUE; + break; + case 0x04: /* HSE used as system clock source */ + SystemCoreClock = HSE_VALUE; + break; + case 0x08: /* PLL used as system clock source */ + + /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N + SYSCLK = PLL_VCO / PLL_P + */ + pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) >> 22; + pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM; + + if (pllsource != 0) + { + /* HSE used as PLL clock source */ + pllvco = (HSE_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6); + } + else + { + /* HSI used as PLL clock source */ + pllvco = (HSI_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6); + } + + pllp = (((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) >>16) + 1 ) *2; + SystemCoreClock = pllvco/pllp; + break; + default: + SystemCoreClock = HSI_VALUE; + break; + } + /* Compute HCLK frequency --------------------------------------------------*/ + /* Get HCLK prescaler */ + tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)]; + /* HCLK frequency */ + SystemCoreClock >>= tmp; +} + +/** + * @brief Configures the System clock source, PLL Multiplier and Divider factors, + * AHB/APBx prescalers and Flash settings + * @Note This function should be called only once the RCC clock configuration + * is reset to the default reset state (done in SystemInit() function). + * @param None + * @retval None + */ +static void SetSysClock(void) +{ +/******************************************************************************/ +/* PLL (clocked by HSE) used as System clock source */ +/******************************************************************************/ + __IO uint32_t StartUpCounter = 0, HSEStatus = 0; + + /* Enable HSE */ + RCC->CR |= ((uint32_t)RCC_CR_HSEON); + + /* Wait till HSE is ready and if Time out is reached exit */ + do + { + HSEStatus = RCC->CR & RCC_CR_HSERDY; + StartUpCounter++; + } while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT)); + + if ((RCC->CR & RCC_CR_HSERDY) != RESET) + { + HSEStatus = (uint32_t)0x01; + } + else + { + HSEStatus = (uint32_t)0x00; + } + + if (HSEStatus == (uint32_t)0x01) + { + /* HCLK = SYSCLK / 1*/ + RCC->CFGR |= RCC_CFGR_HPRE_DIV1; + + /* PCLK2 = HCLK / 2*/ + RCC->CFGR |= RCC_CFGR_PPRE2_DIV2; + + /* PCLK1 = HCLK / 4*/ + RCC->CFGR |= RCC_CFGR_PPRE1_DIV4; + + /* Configure the main PLL */ + RCC->PLLCFGR = PLL_M | (PLL_N << 6) | (((PLL_P >> 1) -1) << 16) | + (RCC_PLLCFGR_PLLSRC_HSE) | (PLL_Q << 24); + + /* Enable the main PLL */ + RCC->CR |= RCC_CR_PLLON; + + /* Wait till the main PLL is ready */ + while((RCC->CR & RCC_CR_PLLRDY) == 0) + { + } + + /* 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; + + /* Select the main PLL as system clock source */ + RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW)); + RCC->CFGR |= RCC_CFGR_SW_PLL; + + /* Wait till the main PLL is used as system clock source */ + 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 + 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 + * @param None + * @retval None + */ +#ifdef DATA_IN_ExtSRAM +/** + * @brief Setup the external memory controller. + * Called in startup_stm32f2xx.s before jump to main. + * This function configures the external SRAM mounted on STM322xG_EVAL board + * This SRAM will be used as program data memory (including heap and stack). + * @param None + * @retval None + */ +void SystemInit_ExtMemCtl(void) +{ +/*-- GPIOs Configuration -----------------------------------------------------*/ +/* + +-------------------+--------------------+------------------+------------------+ + + 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 | + | PD4 <-> FSMC_NOE | PE7 <-> FSMC_D4 | PF2 <-> FSMC_A2 | PG2 <-> FSMC_A12 | + | PD5 <-> FSMC_NWE | PE8 <-> FSMC_D5 | PF3 <-> FSMC_A3 | PG3 <-> FSMC_A13 | + | PD8 <-> FSMC_D13 | PE9 <-> FSMC_D6 | PF4 <-> FSMC_A4 | PG4 <-> FSMC_A14 | + | PD9 <-> FSMC_D14 | PE10 <-> FSMC_D7 | PF5 <-> FSMC_A5 | PG5 <-> FSMC_A15 | + | PD10 <-> FSMC_D15 | PE11 <-> FSMC_D8 | PF12 <-> FSMC_A6 | PG9 <-> FSMC_NE2 | + | PD11 <-> FSMC_A16 | PE12 <-> FSMC_D9 | PF13 <-> FSMC_A7 |------------------+ + | PD12 <-> FSMC_A17 | PE13 <-> FSMC_D10 | PF14 <-> FSMC_A8 | + | 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; + + /* Connect PDx pins to FSMC Alternate function */ + GPIOD->AFR[0] = 0x00cc00cc; + GPIOD->AFR[1] = 0xcc0ccccc; + /* Configure PDx pins in Alternate function mode */ + GPIOD->MODER = 0xa2aa0a0a; + /* Configure PDx pins speed to 100 MHz */ + GPIOD->OSPEEDR = 0xf3ff0f0f; + /* Configure PDx pins Output type to push-pull */ + GPIOD->OTYPER = 0x00000000; + /* No pull-up, pull-down for PDx pins */ + GPIOD->PUPDR = 0x00000000; + + /* Connect PEx pins to FSMC Alternate function */ + GPIOE->AFR[0] = 0xc00000cc; + GPIOE->AFR[1] = 0xcccccccc; + /* Configure PEx pins in Alternate function mode */ + GPIOE->MODER = 0xaaaa800a; + /* Configure PEx pins speed to 100 MHz */ + GPIOE->OSPEEDR = 0xffffc00f; + /* Configure PEx pins Output type to push-pull */ + GPIOE->OTYPER = 0x00000000; + /* No pull-up, pull-down for PEx pins */ + GPIOE->PUPDR = 0x00000000; + + /* Connect PFx pins to FSMC Alternate function */ + GPIOF->AFR[0] = 0x00cccccc; + GPIOF->AFR[1] = 0xcccc0000; + /* Configure PFx pins in Alternate function mode */ + GPIOF->MODER = 0xaa000aaa; + /* Configure PFx pins speed to 100 MHz */ + GPIOF->OSPEEDR = 0xff000fff; + /* Configure PFx pins Output type to push-pull */ + GPIOF->OTYPER = 0x00000000; + /* No pull-up, pull-down for PFx pins */ + GPIOF->PUPDR = 0x00000000; + + /* Connect PGx pins to FSMC Alternate function */ + GPIOG->AFR[0] = 0x00cccccc; + GPIOG->AFR[1] = 0x000000c0; + /* Configure PGx pins in Alternate function mode */ + GPIOG->MODER = 0x00080aaa; + /* Configure PGx pins speed to 100 MHz */ + GPIOG->OSPEEDR = 0x000c0fff; + /* Configure PGx pins Output type to push-pull */ + GPIOG->OTYPER = 0x00000000; + /* No pull-up, pull-down for PGx pins */ + GPIOG->PUPDR = 0x00000000; + +/*-- FSMC Configuration ------------------------------------------------------*/ + /* Enable the FSMC interface clock */ + RCC->AHB3ENR = 0x00000001; + + /* Configure and enable Bank1_SRAM2 */ + FSMC_Bank1->BTCR[2] = 0x00001015; + FSMC_Bank1->BTCR[3] = 0x00010400; + FSMC_Bank1E->BWTR[2] = 0x0fffffff; +/* + Bank1_SRAM2 is configured as follow: + + p.FSMC_AddressSetupTime = 0; + p.FSMC_AddressHoldTime = 0; + p.FSMC_DataSetupTime = 4; + p.FSMC_BusTurnAroundDuration = 1; + p.FSMC_CLKDivision = 0; + 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_MemoryType = FSMC_MemoryType_PSRAM; + FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b; + FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable; + FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable; + FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low; + FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable; + FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState; + FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable; + FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable; + FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable; + FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable; + FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p; + FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p; +*/ + +} +#endif /* DATA_IN_ExtSRAM */ + + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ +/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ + diff --git a/radio/src/translations/tts_cz.cpp b/radio/src/translations/tts_cz.cpp index 073ff3983..2f3428b7e 100644 --- a/radio/src/translations/tts_cz.cpp +++ b/radio/src/translations/tts_cz.cpp @@ -1,241 +1,241 @@ -/* - * Authors (alphabetical order) - * - Bertrand Songis - * - Martin Hotar - * - * opentx is based on code named - * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, - * er9x by Erez Raviv: http://code.google.com/p/er9x/, - * and the original (and ongoing) project by - * Thomas Husterer, th9x: http://code.google.com/p/th9x/ - * - * 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 - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "opentx.h" - -enum CzechPrompts { - CZ_PROMPT_NUMBERS_BASE = 0, - CZ_PROMPT_NULA = CZ_PROMPT_NUMBERS_BASE+0, //0-99 - CZ_PROMPT_STO = CZ_PROMPT_NUMBERS_BASE+100, //100,200 .. 900 - CZ_PROMPT_TISIC = CZ_PROMPT_NUMBERS_BASE+109, //1000 - CZ_PROMPT_TISICE = CZ_PROMPT_NUMBERS_BASE+110, - CZ_PROMPT_JEDEN = CZ_PROMPT_NUMBERS_BASE+111, - CZ_PROMPT_JEDNO = CZ_PROMPT_NUMBERS_BASE+112, - CZ_PROMPT_DVE = CZ_PROMPT_NUMBERS_BASE+113, - CZ_PROMPT_CELA = CZ_PROMPT_NUMBERS_BASE+114, - CZ_PROMPT_CELE = CZ_PROMPT_NUMBERS_BASE+115, - CZ_PROMPT_CELYCH = CZ_PROMPT_NUMBERS_BASE+116, - CZ_PROMPT_MINUS = CZ_PROMPT_NUMBERS_BASE+117, - - CZ_PROMPT_UNITS_BASE = 118, //(jeden)volt,(dva)volty,(pet)voltu,(desetina)voltu - -}; - -#if defined(VOICE) - -#if defined(CPUARM) - #define CZ_PUSH_UNIT_PROMPT(p, u) cz_pushUnitPrompt((p), (u), id) -#else - #define CZ_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u)) -#endif - -#define MUZSKY 0x80 -#define ZENSKY 0x81 -#define STREDNI 0x82 - -I18N_PLAY_FUNCTION(cz, pushUnitPrompt, int16_t number, uint8_t unitprompt) -{ -#if defined(CPUARM) - if (number == 1) - PUSH_UNIT_PROMPT(unitprompt, 0); - else if (number > 1 && number < 5) - PUSH_UNIT_PROMPT(unitprompt, 1); - else - PUSH_UNIT_PROMPT(unitprompt, 2); -#else - unitprompt = CZ_PROMPT_UNITS_BASE+((unitprompt-1)*4); - if (number == 1) - PUSH_NUMBER_PROMPT(unitprompt); - else if (number > 1 && number < 5) - PUSH_NUMBER_PROMPT(unitprompt+1); - else - PUSH_NUMBER_PROMPT(unitprompt+2); -#endif -} - -I18N_PLAY_FUNCTION(cz, playNumber, getvalue_t number, uint8_t unit, uint8_t att) -{ - - if (number < 0) { - PUSH_NUMBER_PROMPT(CZ_PROMPT_MINUS); - number = -number; - } - -#if !defined(CPUARM) - if (unit) { - unit--; - convertUnit(number, unit); - if (IS_IMPERIAL_ENABLE()) { - if (unit == UNIT_DIST) { - unit = UNIT_FEET; - } - if (unit == UNIT_SPEED) { - unit = UNIT_KTS; - } - } - unit++; - } -#endif - - int8_t mode = MODE(att); - if (mode > 0) { -#if defined(CPUARM) - if (mode == 2) { - number /= 10; - } -#else - // we assume that we are PREC1 -#endif - div_t qr = div(number, 10); - if (qr.rem) { - PLAY_NUMBER(qr.quot, 0, ZENSKY); - if (qr.quot == 0) - PUSH_NUMBER_PROMPT(CZ_PROMPT_CELA); - else - CZ_PUSH_UNIT_PROMPT(qr.quot, CZ_PROMPT_CELA); - PLAY_NUMBER(qr.rem, 0, ZENSKY); - PUSH_NUMBER_PROMPT(CZ_PROMPT_UNITS_BASE+((unit-1)*4)+3); - return; - } - else - number = qr.quot; - } - - int16_t tmp = number; -#if defined(CPUARM) - switch(unit) { - case 0: - break; - case 6: - case 8: - case 10: - case 14: - case 18: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - att = ZENSKY; - break; - case 13: - case 19: - att = STREDNI; - break; - default: - att = MUZSKY; - break; - } -#else - switch(unit) { - case 0: - break; - case 4: - case 10: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - att = ZENSKY; - break; - case 8: - case 19: - att = STREDNI; - break; - default: - att = MUZSKY; - break; - } -#endif - - if ((number == 1) && (att == MUZSKY)) { - PUSH_NUMBER_PROMPT(CZ_PROMPT_JEDEN); - number = -1; - } - - if ((number == 1) && (att == STREDNI)) { - PUSH_NUMBER_PROMPT(CZ_PROMPT_JEDNO); - number = -1; - } - - if ((number == 2) && ((att == ZENSKY) || (att == STREDNI))) { - PUSH_NUMBER_PROMPT(CZ_PROMPT_DVE); - number = -1; - } - - if (number >= 1000) { - if (number >= 2000) - PLAY_NUMBER(number / 1000, 0, 0); - if (number >= 2000 && number < 5000) - PUSH_NUMBER_PROMPT(CZ_PROMPT_TISICE); - else - PUSH_NUMBER_PROMPT(CZ_PROMPT_TISIC); - number %= 1000; - if (number == 0) - number = -1; - } - if (number >= 100) { - PUSH_NUMBER_PROMPT(CZ_PROMPT_STO + (number/100)-1); - number %= 100; - if (number == 0) - number = -1; - } - - if (number >= 0) { - PUSH_NUMBER_PROMPT(CZ_PROMPT_NULA+number); - } - - if (unit) { - CZ_PUSH_UNIT_PROMPT(tmp, unit); - } -} - -I18N_PLAY_FUNCTION(cz, playDuration, int seconds PLAY_DURATION_ATT) -{ - if (seconds < 0) { - PUSH_NUMBER_PROMPT(CZ_PROMPT_MINUS); - seconds = -seconds; - } - - uint8_t tmp = seconds / 3600; - seconds %= 3600; - if (tmp > 0 || IS_PLAY_TIME()) { - PLAY_NUMBER(tmp, UNIT_HOURS, ZENSKY); - } - - tmp = seconds / 60; - seconds %= 60; - if (tmp > 0) { - PLAY_NUMBER(tmp, UNIT_MINUTES, ZENSKY); - } - - if (seconds > 0) { - PLAY_NUMBER(seconds, UNIT_SECONDS, ZENSKY); - } -} - -LANGUAGE_PACK_DECLARE(cz, "Czech"); - -#endif +/* + * Authors (alphabetical order) + * - Bertrand Songis + * - Martin Hotar + * + * opentx is based on code named + * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, + * er9x by Erez Raviv: http://code.google.com/p/er9x/, + * and the original (and ongoing) project by + * Thomas Husterer, th9x: http://code.google.com/p/th9x/ + * + * 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 + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include "opentx.h" + +enum CzechPrompts { + CZ_PROMPT_NUMBERS_BASE = 0, + CZ_PROMPT_NULA = CZ_PROMPT_NUMBERS_BASE+0, //0-99 + CZ_PROMPT_STO = CZ_PROMPT_NUMBERS_BASE+100, //100,200 .. 900 + CZ_PROMPT_TISIC = CZ_PROMPT_NUMBERS_BASE+109, //1000 + CZ_PROMPT_TISICE = CZ_PROMPT_NUMBERS_BASE+110, + CZ_PROMPT_JEDEN = CZ_PROMPT_NUMBERS_BASE+111, + CZ_PROMPT_JEDNO = CZ_PROMPT_NUMBERS_BASE+112, + CZ_PROMPT_DVE = CZ_PROMPT_NUMBERS_BASE+113, + CZ_PROMPT_CELA = CZ_PROMPT_NUMBERS_BASE+114, + CZ_PROMPT_CELE = CZ_PROMPT_NUMBERS_BASE+115, + CZ_PROMPT_CELYCH = CZ_PROMPT_NUMBERS_BASE+116, + CZ_PROMPT_MINUS = CZ_PROMPT_NUMBERS_BASE+117, + + CZ_PROMPT_UNITS_BASE = 118, //(jeden)volt,(dva)volty,(pet)voltu,(desetina)voltu + +}; + +#if defined(VOICE) + +#if defined(CPUARM) + #define CZ_PUSH_UNIT_PROMPT(p, u) cz_pushUnitPrompt((p), (u), id) +#else + #define CZ_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u)) +#endif + +#define MUZSKY 0x80 +#define ZENSKY 0x81 +#define STREDNI 0x82 + +I18N_PLAY_FUNCTION(cz, pushUnitPrompt, int16_t number, uint8_t unitprompt) +{ +#if defined(CPUARM) + if (number == 1) + PUSH_UNIT_PROMPT(unitprompt, 0); + else if (number > 1 && number < 5) + PUSH_UNIT_PROMPT(unitprompt, 1); + else + PUSH_UNIT_PROMPT(unitprompt, 2); +#else + unitprompt = CZ_PROMPT_UNITS_BASE+((unitprompt-1)*4); + if (number == 1) + PUSH_NUMBER_PROMPT(unitprompt); + else if (number > 1 && number < 5) + PUSH_NUMBER_PROMPT(unitprompt+1); + else + PUSH_NUMBER_PROMPT(unitprompt+2); +#endif +} + +I18N_PLAY_FUNCTION(cz, playNumber, getvalue_t number, uint8_t unit, uint8_t att) +{ + + if (number < 0) { + PUSH_NUMBER_PROMPT(CZ_PROMPT_MINUS); + number = -number; + } + +#if !defined(CPUARM) + if (unit) { + unit--; + convertUnit(number, unit); + if (IS_IMPERIAL_ENABLE()) { + if (unit == UNIT_DIST) { + unit = UNIT_FEET; + } + if (unit == UNIT_SPEED) { + unit = UNIT_KTS; + } + } + unit++; + } +#endif + + int8_t mode = MODE(att); + if (mode > 0) { +#if defined(CPUARM) + if (mode == 2) { + number /= 10; + } +#else + // we assume that we are PREC1 +#endif + div_t qr = div((int)number, 10); + if (qr.rem) { + PLAY_NUMBER(qr.quot, 0, ZENSKY); + if (qr.quot == 0) + PUSH_NUMBER_PROMPT(CZ_PROMPT_CELA); + else + CZ_PUSH_UNIT_PROMPT(qr.quot, CZ_PROMPT_CELA); + PLAY_NUMBER(qr.rem, 0, ZENSKY); + PUSH_NUMBER_PROMPT(CZ_PROMPT_UNITS_BASE+((unit-1)*4)+3); + return; + } + else + number = qr.quot; + } + + int16_t tmp = number; +#if defined(CPUARM) + switch(unit) { + case 0: + break; + case 6: + case 8: + case 10: + case 14: + case 18: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + att = ZENSKY; + break; + case 13: + case 19: + att = STREDNI; + break; + default: + att = MUZSKY; + break; + } +#else + switch(unit) { + case 0: + break; + case 4: + case 10: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + att = ZENSKY; + break; + case 8: + case 19: + att = STREDNI; + break; + default: + att = MUZSKY; + break; + } +#endif + + if ((number == 1) && (att == MUZSKY)) { + PUSH_NUMBER_PROMPT(CZ_PROMPT_JEDEN); + number = -1; + } + + if ((number == 1) && (att == STREDNI)) { + PUSH_NUMBER_PROMPT(CZ_PROMPT_JEDNO); + number = -1; + } + + if ((number == 2) && ((att == ZENSKY) || (att == STREDNI))) { + PUSH_NUMBER_PROMPT(CZ_PROMPT_DVE); + number = -1; + } + + if (number >= 1000) { + if (number >= 2000) + PLAY_NUMBER(number / 1000, 0, 0); + if (number >= 2000 && number < 5000) + PUSH_NUMBER_PROMPT(CZ_PROMPT_TISICE); + else + PUSH_NUMBER_PROMPT(CZ_PROMPT_TISIC); + number %= 1000; + if (number == 0) + number = -1; + } + if (number >= 100) { + PUSH_NUMBER_PROMPT(CZ_PROMPT_STO + (number/100)-1); + number %= 100; + if (number == 0) + number = -1; + } + + if (number >= 0) { + PUSH_NUMBER_PROMPT(CZ_PROMPT_NULA+number); + } + + if (unit) { + CZ_PUSH_UNIT_PROMPT(tmp, unit); + } +} + +I18N_PLAY_FUNCTION(cz, playDuration, int seconds PLAY_DURATION_ATT) +{ + if (seconds < 0) { + PUSH_NUMBER_PROMPT(CZ_PROMPT_MINUS); + seconds = -seconds; + } + + uint8_t tmp = seconds / 3600; + seconds %= 3600; + if (tmp > 0 || IS_PLAY_TIME()) { + PLAY_NUMBER(tmp, UNIT_HOURS, ZENSKY); + } + + tmp = seconds / 60; + seconds %= 60; + if (tmp > 0) { + PLAY_NUMBER(tmp, UNIT_MINUTES, ZENSKY); + } + + if (seconds > 0) { + PLAY_NUMBER(seconds, UNIT_SECONDS, ZENSKY); + } +} + +LANGUAGE_PACK_DECLARE(cz, "Czech"); + +#endif diff --git a/radio/src/translations/tts_de.cpp b/radio/src/translations/tts_de.cpp index 5db557129..d54ebe5d5 100644 --- a/radio/src/translations/tts_de.cpp +++ b/radio/src/translations/tts_de.cpp @@ -1,246 +1,246 @@ -/* - * Authors (alphabetical order) - * - Andre Bernet - * - Andreas Weitl - * - Bertrand Songis - * - Benjamin Boy - * - Thomas Husterer - * - * opentx is based on code named - * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, - * er9x by Erez Raviv: http://code.google.com/p/er9x/, - * and the original (and ongoing) project by - * Thomas Husterer, th9x: http://code.google.com/p/th9x/ - * - * 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 - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "opentx.h" - -enum GermanPrompts { - DE_PROMPT_NUMBERS_BASE = 0, - DE_PROMPT_NULL = DE_PROMPT_NUMBERS_BASE+0, - DE_PROMPT_EIN = DE_PROMPT_NUMBERS_BASE+100, - DE_PROMPT_EINE = DE_PROMPT_NUMBERS_BASE+101, - DE_PROMPT_HUNDERT = DE_PROMPT_NUMBERS_BASE+102, - DE_PROMPT_TAUSEND = DE_PROMPT_NUMBERS_BASE+103, - DE_PROMPT_COMMA = 104, - DE_PROMPT_UND, - DE_PROMPT_MINUS, - DE_PROMPT_UHR, - DE_PROMPT_MINUTE, - DE_PROMPT_MINUTEN, - DE_PROMPT_SEKUNDE, - DE_PROMPT_SEKUNDEN, - DE_PROMPT_STUNDE, - DE_PROMPT_STUNDEN, - - DE_PROMPT_UNITS_BASE = 114, - DE_PROMPT_VOLTS = DE_PROMPT_UNITS_BASE+UNIT_VOLTS, - DE_PROMPT_AMPS = DE_PROMPT_UNITS_BASE+UNIT_AMPS, - DE_PROMPT_METERS_PER_SECOND = DE_PROMPT_UNITS_BASE+UNIT_METERS_PER_SECOND, - DE_PROMPT_SPARE1 = DE_PROMPT_UNITS_BASE+UNIT_RAW, - DE_PROMPT_KMH = DE_PROMPT_UNITS_BASE+UNIT_SPEED, - DE_PROMPT_METERS = DE_PROMPT_UNITS_BASE+UNIT_DIST, - DE_PROMPT_DEGREES = DE_PROMPT_UNITS_BASE+UNIT_TEMPERATURE, - DE_PROMPT_PERCENT = DE_PROMPT_UNITS_BASE+UNIT_PERCENT, - DE_PROMPT_MILLIAMPS = DE_PROMPT_UNITS_BASE+UNIT_MILLIAMPS, - DE_PROMPT_MAH = DE_PROMPT_UNITS_BASE+UNIT_MAH, - DE_PROMPT_WATTS = DE_PROMPT_UNITS_BASE+UNIT_WATTS, - DE_PROMPT_FEET = DE_PROMPT_UNITS_BASE+UNIT_FEET, - DE_PROMPT_KTS = DE_PROMPT_UNITS_BASE+UNIT_KTS, - DE_PROMPT_HOURS = DE_PROMPT_UNITS_BASE+UNIT_HOURS, - DE_PROMPT_MINUTES = DE_PROMPT_UNITS_BASE+UNIT_MINUTES, - DE_PROMPT_SECONDS = DE_PROMPT_UNITS_BASE+UNIT_SECONDS, - DE_PROMPT_RPMS = DE_PROMPT_UNITS_BASE+UNIT_RPMS, - DE_PROMPT_G = DE_PROMPT_UNITS_BASE+UNIT_G, -#if defined(CPUARM) - DE_PROMPT_MILLILITERS = DE_PROMPT_UNITS_BASE+UNIT_MILLILITERS, - DE_PROMPT_FLOZ = DE_PROMPT_UNITS_BASE+UNIT_FLOZ, - DE_PROMPT_FEET_PER_SECOND = DE_PROMPT_UNITS_BASE+UNIT_FEET_PER_SECOND, -#endif - -}; - -#if defined(VOICE) -#if defined(CPUARM) - #define DE_PUSH_UNIT_PROMPT(u) de_pushUnitPrompt((u), id) -#else - #define DE_PUSH_UNIT_PROMPT(u) pushUnitPrompt((u)) -#endif - -I18N_PLAY_FUNCTION(de, pushUnitPrompt, uint8_t unitprompt) -{ -#if defined(CPUARM) - PUSH_UNIT_PROMPT(unitprompt, 0); -#else - unitprompt = DE_PROMPT_UNITS_BASE + unitprompt*2 - PUSH_NUMBER_PROMPT(unitprompt); -#endif -} - -I18N_PLAY_FUNCTION(de, playNumber, getvalue_t number, uint8_t unit, uint8_t att) -{ -/* if digit >= 1000000000: - temp_digit, digit = divmod(digit, 1000000000) - prompts.extend(self.getNumberPrompt(temp_digit)) - prompts.append(Prompt(GUIDE_00_BILLION, dir=2)) - if digit >= 1000000: - temp_digit, digit = divmod(digit, 1000000) - prompts.extend(self.getNumberPrompt(temp_digit)) - prompts.append(Prompt(GUIDE_00_MILLION, dir=2)) -*/ - - if (number < 0) { - PUSH_NUMBER_PROMPT(DE_PROMPT_MINUS); - number = -number; - } - -#if !defined(CPUARM) - if (unit) { - unit--; - convertUnit(number, unit); - if (IS_IMPERIAL_ENABLE()) { - if (unit == UNIT_DIST) { - unit = UNIT_FEET; - } - if (unit == UNIT_SPEED) { - unit = UNIT_KTS; - } - } - unit++; - } -#endif - - int8_t mode = MODE(att); - if (mode > 0) { -#if defined(CPUARM) - if (mode == 2) { - number /= 10; - } -#else - // we assume that we are PREC1 -#endif - div_t qr = div(number, 10); - if (qr.rem > 0) { - PUSH_NUMBER_PROMPT(qr.quot); - PUSH_NUMBER_PROMPT(DE_PROMPT_COMMA); - PUSH_NUMBER_PROMPT(qr.rem); - } - else { - if (qr.quot == 1) { - PUSH_NUMBER_PROMPT(DE_PROMPT_EIN); - } - else { - PUSH_NUMBER_PROMPT(qr.quot); - } - } - DE_PUSH_UNIT_PROMPT(unit); - return; - } - - if (number >= 2000) { - PLAY_NUMBER(number / 1000, 0, 0); - PUSH_NUMBER_PROMPT(DE_PROMPT_TAUSEND); - number %= 1000; - if (number == 0) - number = -1; - } - - if ((number >= 1000) && (number < 2000)) { - PUSH_NUMBER_PROMPT(DE_PROMPT_EIN); - PUSH_NUMBER_PROMPT(DE_PROMPT_TAUSEND); - number %= 1000; - if (number == 0) - number = -1; - } - - if ((number >= 200) && (number < 1000)) { - PUSH_NUMBER_PROMPT(DE_PROMPT_NULL + number / 100); - PUSH_NUMBER_PROMPT(DE_PROMPT_HUNDERT); - number %= 100; - if (number == 0) - number = -1; - } - - if ((number >= 100) && (number < 200)) { - PUSH_NUMBER_PROMPT(DE_PROMPT_EIN); - PUSH_NUMBER_PROMPT(DE_PROMPT_HUNDERT); - number %= 100; - if (number == 0) - number = -1; - } - - if (number >= 0) { - PUSH_NUMBER_PROMPT(DE_PROMPT_NULL + number / 1); - } - - if (unit) { - DE_PUSH_UNIT_PROMPT(unit); - } -} - -I18N_PLAY_FUNCTION(de, playDuration, int seconds PLAY_DURATION_ATT) -{ - if (seconds < 0) { - PUSH_NUMBER_PROMPT(DE_PROMPT_MINUS); - seconds = -seconds; - } - - uint8_t tmp = seconds / 3600; - seconds %= 3600; - - if (tmp > 0 || IS_PLAY_TIME()) { - if (tmp > 1) { - PLAY_NUMBER(tmp, 0, 0); - PUSH_NUMBER_PROMPT(DE_PROMPT_STUNDEN); - } - else { - PUSH_NUMBER_PROMPT(DE_PROMPT_EINE); - PUSH_NUMBER_PROMPT(DE_PROMPT_STUNDE); - } - if (seconds > 0) { - PUSH_NUMBER_PROMPT(DE_PROMPT_UND); - } - } - - tmp = seconds / 60; - seconds %= 60; - - if (tmp > 0) { - if (tmp > 1) { - PLAY_NUMBER(tmp, 0, 0); - PUSH_NUMBER_PROMPT(DE_PROMPT_MINUTEN); - } - else { - PUSH_NUMBER_PROMPT(DE_PROMPT_EINE); - PUSH_NUMBER_PROMPT(DE_PROMPT_MINUTE); - } - if (seconds > 0) { - PUSH_NUMBER_PROMPT(DE_PROMPT_UND); - } - } - - if (seconds > 1) { - PLAY_NUMBER(seconds, 0, 0); - PUSH_NUMBER_PROMPT(DE_PROMPT_SEKUNDEN); - } - else { - if (seconds == 1) { - PUSH_NUMBER_PROMPT(DE_PROMPT_EINE); - PUSH_NUMBER_PROMPT(DE_PROMPT_SEKUNDE); - } - } -} - -LANGUAGE_PACK_DECLARE(de, "Deutsch"); - -#endif +/* + * Authors (alphabetical order) + * - Andre Bernet + * - Andreas Weitl + * - Bertrand Songis + * - Benjamin Boy + * - Thomas Husterer + * + * opentx is based on code named + * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, + * er9x by Erez Raviv: http://code.google.com/p/er9x/, + * and the original (and ongoing) project by + * Thomas Husterer, th9x: http://code.google.com/p/th9x/ + * + * 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 + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include "opentx.h" + +enum GermanPrompts { + DE_PROMPT_NUMBERS_BASE = 0, + DE_PROMPT_NULL = DE_PROMPT_NUMBERS_BASE+0, + DE_PROMPT_EIN = DE_PROMPT_NUMBERS_BASE+100, + DE_PROMPT_EINE = DE_PROMPT_NUMBERS_BASE+101, + DE_PROMPT_HUNDERT = DE_PROMPT_NUMBERS_BASE+102, + DE_PROMPT_TAUSEND = DE_PROMPT_NUMBERS_BASE+103, + DE_PROMPT_COMMA = 104, + DE_PROMPT_UND, + DE_PROMPT_MINUS, + DE_PROMPT_UHR, + DE_PROMPT_MINUTE, + DE_PROMPT_MINUTEN, + DE_PROMPT_SEKUNDE, + DE_PROMPT_SEKUNDEN, + DE_PROMPT_STUNDE, + DE_PROMPT_STUNDEN, + + DE_PROMPT_UNITS_BASE = 114, + DE_PROMPT_VOLTS = DE_PROMPT_UNITS_BASE+UNIT_VOLTS, + DE_PROMPT_AMPS = DE_PROMPT_UNITS_BASE+UNIT_AMPS, + DE_PROMPT_METERS_PER_SECOND = DE_PROMPT_UNITS_BASE+UNIT_METERS_PER_SECOND, + DE_PROMPT_SPARE1 = DE_PROMPT_UNITS_BASE+UNIT_RAW, + DE_PROMPT_KMH = DE_PROMPT_UNITS_BASE+UNIT_SPEED, + DE_PROMPT_METERS = DE_PROMPT_UNITS_BASE+UNIT_DIST, + DE_PROMPT_DEGREES = DE_PROMPT_UNITS_BASE+UNIT_TEMPERATURE, + DE_PROMPT_PERCENT = DE_PROMPT_UNITS_BASE+UNIT_PERCENT, + DE_PROMPT_MILLIAMPS = DE_PROMPT_UNITS_BASE+UNIT_MILLIAMPS, + DE_PROMPT_MAH = DE_PROMPT_UNITS_BASE+UNIT_MAH, + DE_PROMPT_WATTS = DE_PROMPT_UNITS_BASE+UNIT_WATTS, + DE_PROMPT_FEET = DE_PROMPT_UNITS_BASE+UNIT_FEET, + DE_PROMPT_KTS = DE_PROMPT_UNITS_BASE+UNIT_KTS, + DE_PROMPT_HOURS = DE_PROMPT_UNITS_BASE+UNIT_HOURS, + DE_PROMPT_MINUTES = DE_PROMPT_UNITS_BASE+UNIT_MINUTES, + DE_PROMPT_SECONDS = DE_PROMPT_UNITS_BASE+UNIT_SECONDS, + DE_PROMPT_RPMS = DE_PROMPT_UNITS_BASE+UNIT_RPMS, + DE_PROMPT_G = DE_PROMPT_UNITS_BASE+UNIT_G, +#if defined(CPUARM) + DE_PROMPT_MILLILITERS = DE_PROMPT_UNITS_BASE+UNIT_MILLILITERS, + DE_PROMPT_FLOZ = DE_PROMPT_UNITS_BASE+UNIT_FLOZ, + DE_PROMPT_FEET_PER_SECOND = DE_PROMPT_UNITS_BASE+UNIT_FEET_PER_SECOND, +#endif + +}; + +#if defined(VOICE) +#if defined(CPUARM) + #define DE_PUSH_UNIT_PROMPT(u) de_pushUnitPrompt((u), id) +#else + #define DE_PUSH_UNIT_PROMPT(u) pushUnitPrompt((u)) +#endif + +I18N_PLAY_FUNCTION(de, pushUnitPrompt, uint8_t unitprompt) +{ +#if defined(CPUARM) + PUSH_UNIT_PROMPT(unitprompt, 0); +#else + unitprompt = DE_PROMPT_UNITS_BASE + unitprompt*2 + PUSH_NUMBER_PROMPT(unitprompt); +#endif +} + +I18N_PLAY_FUNCTION(de, playNumber, getvalue_t number, uint8_t unit, uint8_t att) +{ +/* if digit >= 1000000000: + temp_digit, digit = divmod(digit, 1000000000) + prompts.extend(self.getNumberPrompt(temp_digit)) + prompts.append(Prompt(GUIDE_00_BILLION, dir=2)) + if digit >= 1000000: + temp_digit, digit = divmod(digit, 1000000) + prompts.extend(self.getNumberPrompt(temp_digit)) + prompts.append(Prompt(GUIDE_00_MILLION, dir=2)) +*/ + + if (number < 0) { + PUSH_NUMBER_PROMPT(DE_PROMPT_MINUS); + number = -number; + } + +#if !defined(CPUARM) + if (unit) { + unit--; + convertUnit(number, unit); + if (IS_IMPERIAL_ENABLE()) { + if (unit == UNIT_DIST) { + unit = UNIT_FEET; + } + if (unit == UNIT_SPEED) { + unit = UNIT_KTS; + } + } + unit++; + } +#endif + + int8_t mode = MODE(att); + if (mode > 0) { +#if defined(CPUARM) + if (mode == 2) { + number /= 10; + } +#else + // we assume that we are PREC1 +#endif + div_t qr = div((int)number, 10); + if (qr.rem > 0) { + PUSH_NUMBER_PROMPT(qr.quot); + PUSH_NUMBER_PROMPT(DE_PROMPT_COMMA); + PUSH_NUMBER_PROMPT(qr.rem); + } + else { + if (qr.quot == 1) { + PUSH_NUMBER_PROMPT(DE_PROMPT_EIN); + } + else { + PUSH_NUMBER_PROMPT(qr.quot); + } + } + DE_PUSH_UNIT_PROMPT(unit); + return; + } + + if (number >= 2000) { + PLAY_NUMBER(number / 1000, 0, 0); + PUSH_NUMBER_PROMPT(DE_PROMPT_TAUSEND); + number %= 1000; + if (number == 0) + number = -1; + } + + if ((number >= 1000) && (number < 2000)) { + PUSH_NUMBER_PROMPT(DE_PROMPT_EIN); + PUSH_NUMBER_PROMPT(DE_PROMPT_TAUSEND); + number %= 1000; + if (number == 0) + number = -1; + } + + if ((number >= 200) && (number < 1000)) { + PUSH_NUMBER_PROMPT(DE_PROMPT_NULL + number / 100); + PUSH_NUMBER_PROMPT(DE_PROMPT_HUNDERT); + number %= 100; + if (number == 0) + number = -1; + } + + if ((number >= 100) && (number < 200)) { + PUSH_NUMBER_PROMPT(DE_PROMPT_EIN); + PUSH_NUMBER_PROMPT(DE_PROMPT_HUNDERT); + number %= 100; + if (number == 0) + number = -1; + } + + if (number >= 0) { + PUSH_NUMBER_PROMPT(DE_PROMPT_NULL + number / 1); + } + + if (unit) { + DE_PUSH_UNIT_PROMPT(unit); + } +} + +I18N_PLAY_FUNCTION(de, playDuration, int seconds PLAY_DURATION_ATT) +{ + if (seconds < 0) { + PUSH_NUMBER_PROMPT(DE_PROMPT_MINUS); + seconds = -seconds; + } + + uint8_t tmp = seconds / 3600; + seconds %= 3600; + + if (tmp > 0 || IS_PLAY_TIME()) { + if (tmp > 1) { + PLAY_NUMBER(tmp, 0, 0); + PUSH_NUMBER_PROMPT(DE_PROMPT_STUNDEN); + } + else { + PUSH_NUMBER_PROMPT(DE_PROMPT_EINE); + PUSH_NUMBER_PROMPT(DE_PROMPT_STUNDE); + } + if (seconds > 0) { + PUSH_NUMBER_PROMPT(DE_PROMPT_UND); + } + } + + tmp = seconds / 60; + seconds %= 60; + + if (tmp > 0) { + if (tmp > 1) { + PLAY_NUMBER(tmp, 0, 0); + PUSH_NUMBER_PROMPT(DE_PROMPT_MINUTEN); + } + else { + PUSH_NUMBER_PROMPT(DE_PROMPT_EINE); + PUSH_NUMBER_PROMPT(DE_PROMPT_MINUTE); + } + if (seconds > 0) { + PUSH_NUMBER_PROMPT(DE_PROMPT_UND); + } + } + + if (seconds > 1) { + PLAY_NUMBER(seconds, 0, 0); + PUSH_NUMBER_PROMPT(DE_PROMPT_SEKUNDEN); + } + else { + if (seconds == 1) { + PUSH_NUMBER_PROMPT(DE_PROMPT_EINE); + PUSH_NUMBER_PROMPT(DE_PROMPT_SEKUNDE); + } + } +} + +LANGUAGE_PACK_DECLARE(de, "Deutsch"); + +#endif diff --git a/radio/src/translations/tts_en.cpp b/radio/src/translations/tts_en.cpp index 3c57417a4..f52570731 100644 --- a/radio/src/translations/tts_en.cpp +++ b/radio/src/translations/tts_en.cpp @@ -1,175 +1,175 @@ -/* - * Authors (alphabetical order) - * - Andre Bernet - * - Andreas Weitl - * - Bertrand Songis - * - Bryan J. Rentoul (Gruvin) - * - Cameron Weeks - * - Erez Raviv - * - Gabriel Birkus - * - Jean-Pierre Parisy - * - Karl Szmutny - * - Michael Blandford - * - Michal Hlavinka - * - Pat Mackenzie - * - Philip Moss - * - Rob Thomson - * - Romolo Manfredini - * - Thomas Husterer - * - * opentx is based on code named - * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, - * er9x by Erez Raviv: http://code.google.com/p/er9x/, - * and the original (and ongoing) project by - * Thomas Husterer, th9x: http://code.google.com/p/th9x/ - * - * 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 - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "opentx.h" - -enum EnglishPrompts { - EN_PROMPT_NUMBERS_BASE = 0, - EN_PROMPT_ZERO = EN_PROMPT_NUMBERS_BASE+0, //02-99 - EN_PROMPT_HUNDRED = EN_PROMPT_NUMBERS_BASE+100, //100,200 .. 900 - EN_PROMPT_THOUSAND = EN_PROMPT_NUMBERS_BASE+109, //1000 - EN_PROMPT_AND = EN_PROMPT_NUMBERS_BASE+110, - EN_PROMPT_MINUS = EN_PROMPT_NUMBERS_BASE+111, - EN_PROMPT_POINT = EN_PROMPT_NUMBERS_BASE+112, - EN_PROMPT_UNITS_BASE = 113, - EN_PROMPT_POINT_BASE = 167, //.0 - .9 -}; - -#if defined(VOICE) - -#if defined(CPUARM) - #define EN_PUSH_UNIT_PROMPT(p, u) en_pushUnitPrompt((p), (u), id) -#else - #define EN_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u)) -#endif - -I18N_PLAY_FUNCTION(en, pushUnitPrompt, int16_t number, uint8_t unitprompt) -{ -#if defined(CPUARM) - if (number == 1) - PUSH_UNIT_PROMPT(unitprompt, 0); - else - PUSH_UNIT_PROMPT(unitprompt, 1); -#else - unitprompt = EN_PROMPT_UNITS_BASE + unitprompt*2; - if (number == 1) - PUSH_NUMBER_PROMPT(unitprompt); - else - PUSH_NUMBER_PROMPT(unitprompt+1); -#endif -} - -I18N_PLAY_FUNCTION(en, playNumber, getvalue_t number, uint8_t unit, uint8_t att) -{ - if (number < 0) { - PUSH_NUMBER_PROMPT(EN_PROMPT_MINUS); - number = -number; - } - -#if !defined(CPUARM) - if (unit) { - unit--; - convertUnit(number, unit); - if (IS_IMPERIAL_ENABLE()) { - if (unit == UNIT_DIST) { - unit = UNIT_FEET; - } - if (unit == UNIT_SPEED) { - unit = UNIT_KTS; - } - } - unit++; - } -#endif - - int8_t mode = MODE(att); - if (mode > 0) { -#if defined(CPUARM) - if (mode == 2) { - number /= 10; - } -#else - // we assume that we are PREC1 -#endif - div_t qr = div(number, 10); - if (qr.rem) { - PLAY_NUMBER(qr.quot, 0, 0); - PUSH_NUMBER_PROMPT(EN_PROMPT_POINT_BASE + qr.rem); - number = -1; - } - else { - number = qr.quot; - } - } - - int16_t tmp = number; - - if (number >= 1000) { - PLAY_NUMBER(number / 1000, 0, 0); - PUSH_NUMBER_PROMPT(EN_PROMPT_THOUSAND); - number %= 1000; - if (number == 0) - number = -1; - } - if (number >= 100) { - PUSH_NUMBER_PROMPT(EN_PROMPT_HUNDRED + (number/100)-1); - number %= 100; - if (number == 0) - number = -1; - } - if (number >= 0) { - PUSH_NUMBER_PROMPT(EN_PROMPT_ZERO + number); - } - - if (unit) { - EN_PUSH_UNIT_PROMPT(tmp, unit); - } -} - -I18N_PLAY_FUNCTION(en, playDuration, int seconds PLAY_DURATION_ATT) -{ - if (seconds == 0) { - PLAY_NUMBER(seconds, 0, 0); - return; - } - - if (seconds < 0) { - PUSH_NUMBER_PROMPT(EN_PROMPT_MINUS); - seconds = -seconds; - } - - uint8_t tmp = seconds / 3600; - seconds %= 3600; - if (tmp > 0 || IS_PLAY_TIME()) { - PLAY_NUMBER(tmp, UNIT_HOURS, 0); - } - - tmp = seconds / 60; - seconds %= 60; - if (tmp > 0) { - PLAY_NUMBER(tmp, UNIT_MINUTES, 0); - if (seconds > 0) - PUSH_NUMBER_PROMPT(EN_PROMPT_AND); - } - - if (seconds > 0) { - PLAY_NUMBER(seconds, UNIT_SECONDS, 0); - } -} - -LANGUAGE_PACK_DECLARE_DEFAULT(en, "English"); - -#endif +/* + * Authors (alphabetical order) + * - Andre Bernet + * - Andreas Weitl + * - Bertrand Songis + * - Bryan J. Rentoul (Gruvin) + * - Cameron Weeks + * - Erez Raviv + * - Gabriel Birkus + * - Jean-Pierre Parisy + * - Karl Szmutny + * - Michael Blandford + * - Michal Hlavinka + * - Pat Mackenzie + * - Philip Moss + * - Rob Thomson + * - Romolo Manfredini + * - Thomas Husterer + * + * opentx is based on code named + * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, + * er9x by Erez Raviv: http://code.google.com/p/er9x/, + * and the original (and ongoing) project by + * Thomas Husterer, th9x: http://code.google.com/p/th9x/ + * + * 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 + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include "opentx.h" + +enum EnglishPrompts { + EN_PROMPT_NUMBERS_BASE = 0, + EN_PROMPT_ZERO = EN_PROMPT_NUMBERS_BASE+0, //02-99 + EN_PROMPT_HUNDRED = EN_PROMPT_NUMBERS_BASE+100, //100,200 .. 900 + EN_PROMPT_THOUSAND = EN_PROMPT_NUMBERS_BASE+109, //1000 + EN_PROMPT_AND = EN_PROMPT_NUMBERS_BASE+110, + EN_PROMPT_MINUS = EN_PROMPT_NUMBERS_BASE+111, + EN_PROMPT_POINT = EN_PROMPT_NUMBERS_BASE+112, + EN_PROMPT_UNITS_BASE = 113, + EN_PROMPT_POINT_BASE = 167, //.0 - .9 +}; + +#if defined(VOICE) + +#if defined(CPUARM) + #define EN_PUSH_UNIT_PROMPT(p, u) en_pushUnitPrompt((p), (u), id) +#else + #define EN_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u)) +#endif + +I18N_PLAY_FUNCTION(en, pushUnitPrompt, int16_t number, uint8_t unitprompt) +{ +#if defined(CPUARM) + if (number == 1) + PUSH_UNIT_PROMPT(unitprompt, 0); + else + PUSH_UNIT_PROMPT(unitprompt, 1); +#else + unitprompt = EN_PROMPT_UNITS_BASE + unitprompt*2; + if (number == 1) + PUSH_NUMBER_PROMPT(unitprompt); + else + PUSH_NUMBER_PROMPT(unitprompt+1); +#endif +} + +I18N_PLAY_FUNCTION(en, playNumber, getvalue_t number, uint8_t unit, uint8_t att) +{ + if (number < 0) { + PUSH_NUMBER_PROMPT(EN_PROMPT_MINUS); + number = -number; + } + +#if !defined(CPUARM) + if (unit) { + unit--; + convertUnit(number, unit); + if (IS_IMPERIAL_ENABLE()) { + if (unit == UNIT_DIST) { + unit = UNIT_FEET; + } + if (unit == UNIT_SPEED) { + unit = UNIT_KTS; + } + } + unit++; + } +#endif + + int8_t mode = MODE(att); + if (mode > 0) { +#if defined(CPUARM) + if (mode == 2) { + number /= 10; + } +#else + // we assume that we are PREC1 +#endif + div_t qr = div((int)number, 10); + if (qr.rem) { + PLAY_NUMBER(qr.quot, 0, 0); + PUSH_NUMBER_PROMPT(EN_PROMPT_POINT_BASE + qr.rem); + number = -1; + } + else { + number = qr.quot; + } + } + + int16_t tmp = number; + + if (number >= 1000) { + PLAY_NUMBER(number / 1000, 0, 0); + PUSH_NUMBER_PROMPT(EN_PROMPT_THOUSAND); + number %= 1000; + if (number == 0) + number = -1; + } + if (number >= 100) { + PUSH_NUMBER_PROMPT(EN_PROMPT_HUNDRED + (number/100)-1); + number %= 100; + if (number == 0) + number = -1; + } + if (number >= 0) { + PUSH_NUMBER_PROMPT(EN_PROMPT_ZERO + number); + } + + if (unit) { + EN_PUSH_UNIT_PROMPT(tmp, unit); + } +} + +I18N_PLAY_FUNCTION(en, playDuration, int seconds PLAY_DURATION_ATT) +{ + if (seconds == 0) { + PLAY_NUMBER(seconds, 0, 0); + return; + } + + if (seconds < 0) { + PUSH_NUMBER_PROMPT(EN_PROMPT_MINUS); + seconds = -seconds; + } + + uint8_t tmp = seconds / 3600; + seconds %= 3600; + if (tmp > 0 || IS_PLAY_TIME()) { + PLAY_NUMBER(tmp, UNIT_HOURS, 0); + } + + tmp = seconds / 60; + seconds %= 60; + if (tmp > 0) { + PLAY_NUMBER(tmp, UNIT_MINUTES, 0); + if (seconds > 0) + PUSH_NUMBER_PROMPT(EN_PROMPT_AND); + } + + if (seconds > 0) { + PLAY_NUMBER(seconds, UNIT_SECONDS, 0); + } +} + +LANGUAGE_PACK_DECLARE_DEFAULT(en, "English"); + +#endif diff --git a/radio/src/translations/tts_es.cpp b/radio/src/translations/tts_es.cpp index 08d48fd19..1fb0bf562 100644 --- a/radio/src/translations/tts_es.cpp +++ b/radio/src/translations/tts_es.cpp @@ -1,267 +1,267 @@ -/* - * Authors (alphabetical order) - * - Andre Bernet - * - Andreas Weitl - * - Bertrand Songis - * - Bryan J. Rentoul (Gruvin) - * - Cameron Weeks - * - Erez Raviv - * - Gabriel Birkus - * - Jean-Pierre Parisy - * - Karl Szmutny - * - Michael Blandford - * - Michal Hlavinka - * - Pat Mackenzie - * - Philip Moss - * - Rob Thomson - * - Romolo Manfredini - * - Thomas Husterer - * - * opentx is based on code named - * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, - * er9x by Erez Raviv: http://code.google.com/p/er9x/, - * and the original (and ongoing) project by - * Thomas Husterer, th9x: http://code.google.com/p/th9x/ - * - * 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 - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "opentx.h" - -enum SpanishPrompts { - ES_PROMPT_NUMBERS_BASE = 0, - ES_PROMPT_ZERO = ES_PROMPT_NUMBERS_BASE+0, - ES_PROMPT_CIEN = ES_PROMPT_NUMBERS_BASE+100, - ES_PROMPT_CIENTO = ES_PROMPT_NUMBERS_BASE+101, - ES_PROMPT_DOSCIENTOS = ES_PROMPT_NUMBERS_BASE+102, - ES_PROMPT_TRESCIENTOS, - ES_PROMPT_CUATROCIENTOS, - ES_PROMPT_QUINIENTOS, - ES_PROMPT_SESCIENTOS, - ES_PROMPT_SETECIENTOS, - ES_PROMPT_OCHOCIENTOS, - ES_PROMPT_NUEVECIENTOS, - ES_PROMPT_MIL = ES_PROMPT_NUMBERS_BASE+110, - ES_PROMPT_VIRGOLA = 111, - ES_PROMPT_UN, - ES_PROMPT_UNA, - ES_PROMPT_Y, - ES_PROMPT_MENO, - ES_PROMPT_HORA, - ES_PROMPT_HORAS, - ES_PROMPT_MINUTO, - ES_PROMPT_MINUTOS, - ES_PROMPT_SEGUNDO, - ES_PROMPT_SEGUNDOS, - - ES_PROMPT_UNITS_BASE = 122, - ES_PROMPT_VOLTS = ES_PROMPT_UNITS_BASE+UNIT_VOLTS, - ES_PROMPT_AMPS = ES_PROMPT_UNITS_BASE+UNIT_AMPS, - ES_PROMPT_METERS_PER_SECOND = ES_PROMPT_UNITS_BASE+UNIT_METERS_PER_SECOND, - ES_PROMPT_SPARE1 = ES_PROMPT_UNITS_BASE+UNIT_RAW, - ES_PROMPT_KMH = ES_PROMPT_UNITS_BASE+UNIT_SPEED, - ES_PROMPT_METERS = ES_PROMPT_UNITS_BASE+UNIT_DIST, - ES_PROMPT_DEGREES = ES_PROMPT_UNITS_BASE+UNIT_TEMPERATURE, - ES_PROMPT_PERCENT = ES_PROMPT_UNITS_BASE+UNIT_PERCENT, - ES_PROMPT_MILLIAMPS = ES_PROMPT_UNITS_BASE+UNIT_MILLIAMPS, - ES_PROMPT_MAH = ES_PROMPT_UNITS_BASE+UNIT_MAH, - ES_PROMPT_WATTS = ES_PROMPT_UNITS_BASE+UNIT_WATTS, - ES_PROMPT_FEET = ES_PROMPT_UNITS_BASE+UNIT_FEET, - ES_PROMPT_KTS = ES_PROMPT_UNITS_BASE+UNIT_KTS, - ES_PROMPT_HOURS = ES_PROMPT_UNITS_BASE+UNIT_HOURS, - ES_PROMPT_MINUTES = ES_PROMPT_UNITS_BASE+UNIT_MINUTES, - ES_PROMPT_SECONDS = ES_PROMPT_UNITS_BASE+UNIT_SECONDS, - ES_PROMPT_RPMS = ES_PROMPT_UNITS_BASE+UNIT_RPMS, - ES_PROMPT_G = ES_PROMPT_UNITS_BASE+UNIT_G, -#if defined(CPUARM) - ES_PROMPT_MILLILITERS = ES_PROMPT_UNITS_BASE+UNIT_MILLILITERS, - ES_PROMPT_FLOZ = ES_PROMPT_UNITS_BASE+UNIT_FLOZ, - ES_PROMPT_FEET_PER_SECOND = ES_PROMPT_UNITS_BASE+UNIT_FEET_PER_SECOND, -#endif - -}; - -#if defined(VOICE) -#if defined(CPUARM) - #define ES_PUSH_UNIT_PROMPT(u) es_pushUnitPrompt((u), id) -#else - #define ES_PUSH_UNIT_PROMPT(u) pushUnitPrompt((u)) -#endif - -I18N_PLAY_FUNCTION(es, pushUnitPrompt, uint8_t unitprompt) -{ -#if defined(CPUARM) - PUSH_UNIT_PROMPT(unitprompt, 0); -#else - unitprompt = ES_PROMPT_UNITS_BASE + unitprompt*2; - PUSH_NUMBER_PROMPT(unitprompt); -#endif -} - -I18N_PLAY_FUNCTION(es, playNumber, getvalue_t number, uint8_t unit, uint8_t att) -{ -/* if digit >= 1000000000: - temp_digit, digit = divmod(digit, 1000000000) - prompts.extend(self.getNumberPrompt(temp_digit)) - prompts.append(Prompt(GUIDE_00_BILLION, dir=2)) - if digit >= 1000000: - temp_digit, digit = divmod(digit, 1000000) - prompts.extend(self.getNumberPrompt(temp_digit)) - prompts.append(Prompt(GUIDE_00_MILLION, dir=2)) -*/ - - if (number < 0) { - PUSH_NUMBER_PROMPT(ES_PROMPT_MENO); - number = -number; - } - -#if !defined(CPUARM) - if (unit) { - unit--; - convertUnit(number, unit); - if (IS_IMPERIAL_ENABLE()) { - if (unit == UNIT_DIST) { - unit = UNIT_FEET; - } - if (unit == UNIT_SPEED) { - unit = UNIT_KTS; - } - } - unit++; - } -#endif - - int8_t mode = MODE(att); - if (mode > 0) { -#if defined(CPUARM) - if (mode == 2) { - number /= 10; - } -#else - // we assume that we are PREC1 -#endif - div_t qr = div(number, 10); - if (qr.rem > 0) { - PLAY_NUMBER(qr.quot, 0, 0); - PUSH_NUMBER_PROMPT(ES_PROMPT_VIRGOLA); - if (mode==2 && qr.rem < 10) - PUSH_NUMBER_PROMPT(ES_PROMPT_ZERO); - PLAY_NUMBER(qr.rem, unit, 0); - } - else { - PLAY_NUMBER(qr.quot, unit, 0); - } - return; - } - - if (number >= 1000) { - if (number >= 2000) { - PLAY_NUMBER(number / 1000, 0, 0); - PUSH_NUMBER_PROMPT(ES_PROMPT_MIL); - } else { - PUSH_NUMBER_PROMPT(ES_PROMPT_MIL); - } - number %= 1000; - if (number == 0) - number = -1; - } - if (number > 100) { - PUSH_NUMBER_PROMPT(ES_PROMPT_CIENTO + (number/100) - 1); - number %= 100; - if (number == 0) - number = -1; - } - if (number == 100) { - PUSH_NUMBER_PROMPT(ES_PROMPT_CIEN); - number = -1; - } - if (number >= 0) { - PUSH_NUMBER_PROMPT(ES_PROMPT_ZERO+number); - } - - if (unit) { - ES_PUSH_UNIT_PROMPT(unit); - } -} - -I18N_PLAY_FUNCTION(es, playDuration, int seconds PLAY_DURATION_ATT) -{ - if (seconds < 0) { - PUSH_NUMBER_PROMPT(ES_PROMPT_MENO); - seconds = -seconds; - } - - uint8_t ore = 0; - uint8_t tmp = seconds / 3600; - seconds %= 3600; - if (tmp > 0 || IS_PLAY_TIME()) { - ore = tmp; - if (tmp > 1) { - PLAY_NUMBER(tmp, 0, 0); -#if defined(CPUARM) - PUSH_UNIT_PROMPT(UNIT_HOURS, 1); - } - else { - PUSH_NUMBER_PROMPT(ES_PROMPT_UNA); - PUSH_UNIT_PROMPT(UNIT_HOURS, 0); -#else - PUSH_NUMBER_PROMPT(ES_PROMPT_HORAS); - } - else { - PUSH_NUMBER_PROMPT(ES_PROMPT_UNA); - PUSH_NUMBER_PROMPT(ES_PROMPT_HORA); -#endif - } - } - - tmp = seconds / 60; - seconds %= 60; - if (tmp > 0 || ore >0) { - if (tmp != 1) { - PLAY_NUMBER(tmp, 0, 0); -#if defined(CPUARM) - PUSH_UNIT_PROMPT(UNIT_MINUTES, 1); - } - else { - PUSH_NUMBER_PROMPT(ES_PROMPT_UNA); - PUSH_UNIT_PROMPT(UNIT_MINUTES, 0); -#else - PUSH_NUMBER_PROMPT(ES_PROMPT_MINUTOS); - } - else { - PUSH_NUMBER_PROMPT(ES_PROMPT_UN); - PUSH_NUMBER_PROMPT(ES_PROMPT_MINUTO); -#endif - } - PUSH_NUMBER_PROMPT(ES_PROMPT_Y); - } - - if (seconds != 1) { - PLAY_NUMBER(seconds, 0, 0); -#if defined(CPUARM) - PUSH_UNIT_PROMPT(UNIT_SECONDS, 1); - } - else { - PUSH_NUMBER_PROMPT(ES_PROMPT_UNA); - PUSH_UNIT_PROMPT(UNIT_SECONDS, 0); -#else - PUSH_NUMBER_PROMPT(ES_PROMPT_SEGUNDOS); - } - else { - PUSH_NUMBER_PROMPT(ES_PROMPT_UN); - PUSH_NUMBER_PROMPT(ES_PROMPT_SEGUNDO); -#endif - } -} - -LANGUAGE_PACK_DECLARE(es, "Espanol"); - -#endif +/* + * Authors (alphabetical order) + * - Andre Bernet + * - Andreas Weitl + * - Bertrand Songis + * - Bryan J. Rentoul (Gruvin) + * - Cameron Weeks + * - Erez Raviv + * - Gabriel Birkus + * - Jean-Pierre Parisy + * - Karl Szmutny + * - Michael Blandford + * - Michal Hlavinka + * - Pat Mackenzie + * - Philip Moss + * - Rob Thomson + * - Romolo Manfredini + * - Thomas Husterer + * + * opentx is based on code named + * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, + * er9x by Erez Raviv: http://code.google.com/p/er9x/, + * and the original (and ongoing) project by + * Thomas Husterer, th9x: http://code.google.com/p/th9x/ + * + * 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 + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include "opentx.h" + +enum SpanishPrompts { + ES_PROMPT_NUMBERS_BASE = 0, + ES_PROMPT_ZERO = ES_PROMPT_NUMBERS_BASE+0, + ES_PROMPT_CIEN = ES_PROMPT_NUMBERS_BASE+100, + ES_PROMPT_CIENTO = ES_PROMPT_NUMBERS_BASE+101, + ES_PROMPT_DOSCIENTOS = ES_PROMPT_NUMBERS_BASE+102, + ES_PROMPT_TRESCIENTOS, + ES_PROMPT_CUATROCIENTOS, + ES_PROMPT_QUINIENTOS, + ES_PROMPT_SESCIENTOS, + ES_PROMPT_SETECIENTOS, + ES_PROMPT_OCHOCIENTOS, + ES_PROMPT_NUEVECIENTOS, + ES_PROMPT_MIL = ES_PROMPT_NUMBERS_BASE+110, + ES_PROMPT_VIRGOLA = 111, + ES_PROMPT_UN, + ES_PROMPT_UNA, + ES_PROMPT_Y, + ES_PROMPT_MENO, + ES_PROMPT_HORA, + ES_PROMPT_HORAS, + ES_PROMPT_MINUTO, + ES_PROMPT_MINUTOS, + ES_PROMPT_SEGUNDO, + ES_PROMPT_SEGUNDOS, + + ES_PROMPT_UNITS_BASE = 122, + ES_PROMPT_VOLTS = ES_PROMPT_UNITS_BASE+UNIT_VOLTS, + ES_PROMPT_AMPS = ES_PROMPT_UNITS_BASE+UNIT_AMPS, + ES_PROMPT_METERS_PER_SECOND = ES_PROMPT_UNITS_BASE+UNIT_METERS_PER_SECOND, + ES_PROMPT_SPARE1 = ES_PROMPT_UNITS_BASE+UNIT_RAW, + ES_PROMPT_KMH = ES_PROMPT_UNITS_BASE+UNIT_SPEED, + ES_PROMPT_METERS = ES_PROMPT_UNITS_BASE+UNIT_DIST, + ES_PROMPT_DEGREES = ES_PROMPT_UNITS_BASE+UNIT_TEMPERATURE, + ES_PROMPT_PERCENT = ES_PROMPT_UNITS_BASE+UNIT_PERCENT, + ES_PROMPT_MILLIAMPS = ES_PROMPT_UNITS_BASE+UNIT_MILLIAMPS, + ES_PROMPT_MAH = ES_PROMPT_UNITS_BASE+UNIT_MAH, + ES_PROMPT_WATTS = ES_PROMPT_UNITS_BASE+UNIT_WATTS, + ES_PROMPT_FEET = ES_PROMPT_UNITS_BASE+UNIT_FEET, + ES_PROMPT_KTS = ES_PROMPT_UNITS_BASE+UNIT_KTS, + ES_PROMPT_HOURS = ES_PROMPT_UNITS_BASE+UNIT_HOURS, + ES_PROMPT_MINUTES = ES_PROMPT_UNITS_BASE+UNIT_MINUTES, + ES_PROMPT_SECONDS = ES_PROMPT_UNITS_BASE+UNIT_SECONDS, + ES_PROMPT_RPMS = ES_PROMPT_UNITS_BASE+UNIT_RPMS, + ES_PROMPT_G = ES_PROMPT_UNITS_BASE+UNIT_G, +#if defined(CPUARM) + ES_PROMPT_MILLILITERS = ES_PROMPT_UNITS_BASE+UNIT_MILLILITERS, + ES_PROMPT_FLOZ = ES_PROMPT_UNITS_BASE+UNIT_FLOZ, + ES_PROMPT_FEET_PER_SECOND = ES_PROMPT_UNITS_BASE+UNIT_FEET_PER_SECOND, +#endif + +}; + +#if defined(VOICE) +#if defined(CPUARM) + #define ES_PUSH_UNIT_PROMPT(u) es_pushUnitPrompt((u), id) +#else + #define ES_PUSH_UNIT_PROMPT(u) pushUnitPrompt((u)) +#endif + +I18N_PLAY_FUNCTION(es, pushUnitPrompt, uint8_t unitprompt) +{ +#if defined(CPUARM) + PUSH_UNIT_PROMPT(unitprompt, 0); +#else + unitprompt = ES_PROMPT_UNITS_BASE + unitprompt*2; + PUSH_NUMBER_PROMPT(unitprompt); +#endif +} + +I18N_PLAY_FUNCTION(es, playNumber, getvalue_t number, uint8_t unit, uint8_t att) +{ +/* if digit >= 1000000000: + temp_digit, digit = divmod(digit, 1000000000) + prompts.extend(self.getNumberPrompt(temp_digit)) + prompts.append(Prompt(GUIDE_00_BILLION, dir=2)) + if digit >= 1000000: + temp_digit, digit = divmod(digit, 1000000) + prompts.extend(self.getNumberPrompt(temp_digit)) + prompts.append(Prompt(GUIDE_00_MILLION, dir=2)) +*/ + + if (number < 0) { + PUSH_NUMBER_PROMPT(ES_PROMPT_MENO); + number = -number; + } + +#if !defined(CPUARM) + if (unit) { + unit--; + convertUnit(number, unit); + if (IS_IMPERIAL_ENABLE()) { + if (unit == UNIT_DIST) { + unit = UNIT_FEET; + } + if (unit == UNIT_SPEED) { + unit = UNIT_KTS; + } + } + unit++; + } +#endif + + int8_t mode = MODE(att); + if (mode > 0) { +#if defined(CPUARM) + if (mode == 2) { + number /= 10; + } +#else + // we assume that we are PREC1 +#endif + div_t qr = div((int)number, 10); + if (qr.rem > 0) { + PLAY_NUMBER(qr.quot, 0, 0); + PUSH_NUMBER_PROMPT(ES_PROMPT_VIRGOLA); + if (mode==2 && qr.rem < 10) + PUSH_NUMBER_PROMPT(ES_PROMPT_ZERO); + PLAY_NUMBER(qr.rem, unit, 0); + } + else { + PLAY_NUMBER(qr.quot, unit, 0); + } + return; + } + + if (number >= 1000) { + if (number >= 2000) { + PLAY_NUMBER(number / 1000, 0, 0); + PUSH_NUMBER_PROMPT(ES_PROMPT_MIL); + } else { + PUSH_NUMBER_PROMPT(ES_PROMPT_MIL); + } + number %= 1000; + if (number == 0) + number = -1; + } + if (number > 100) { + PUSH_NUMBER_PROMPT(ES_PROMPT_CIENTO + (number/100) - 1); + number %= 100; + if (number == 0) + number = -1; + } + if (number == 100) { + PUSH_NUMBER_PROMPT(ES_PROMPT_CIEN); + number = -1; + } + if (number >= 0) { + PUSH_NUMBER_PROMPT(ES_PROMPT_ZERO+number); + } + + if (unit) { + ES_PUSH_UNIT_PROMPT(unit); + } +} + +I18N_PLAY_FUNCTION(es, playDuration, int seconds PLAY_DURATION_ATT) +{ + if (seconds < 0) { + PUSH_NUMBER_PROMPT(ES_PROMPT_MENO); + seconds = -seconds; + } + + uint8_t ore = 0; + uint8_t tmp = seconds / 3600; + seconds %= 3600; + if (tmp > 0 || IS_PLAY_TIME()) { + ore = tmp; + if (tmp > 1) { + PLAY_NUMBER(tmp, 0, 0); +#if defined(CPUARM) + PUSH_UNIT_PROMPT(UNIT_HOURS, 1); + } + else { + PUSH_NUMBER_PROMPT(ES_PROMPT_UNA); + PUSH_UNIT_PROMPT(UNIT_HOURS, 0); +#else + PUSH_NUMBER_PROMPT(ES_PROMPT_HORAS); + } + else { + PUSH_NUMBER_PROMPT(ES_PROMPT_UNA); + PUSH_NUMBER_PROMPT(ES_PROMPT_HORA); +#endif + } + } + + tmp = seconds / 60; + seconds %= 60; + if (tmp > 0 || ore >0) { + if (tmp != 1) { + PLAY_NUMBER(tmp, 0, 0); +#if defined(CPUARM) + PUSH_UNIT_PROMPT(UNIT_MINUTES, 1); + } + else { + PUSH_NUMBER_PROMPT(ES_PROMPT_UNA); + PUSH_UNIT_PROMPT(UNIT_MINUTES, 0); +#else + PUSH_NUMBER_PROMPT(ES_PROMPT_MINUTOS); + } + else { + PUSH_NUMBER_PROMPT(ES_PROMPT_UN); + PUSH_NUMBER_PROMPT(ES_PROMPT_MINUTO); +#endif + } + PUSH_NUMBER_PROMPT(ES_PROMPT_Y); + } + + if (seconds != 1) { + PLAY_NUMBER(seconds, 0, 0); +#if defined(CPUARM) + PUSH_UNIT_PROMPT(UNIT_SECONDS, 1); + } + else { + PUSH_NUMBER_PROMPT(ES_PROMPT_UNA); + PUSH_UNIT_PROMPT(UNIT_SECONDS, 0); +#else + PUSH_NUMBER_PROMPT(ES_PROMPT_SEGUNDOS); + } + else { + PUSH_NUMBER_PROMPT(ES_PROMPT_UN); + PUSH_NUMBER_PROMPT(ES_PROMPT_SEGUNDO); +#endif + } +} + +LANGUAGE_PACK_DECLARE(es, "Espanol"); + +#endif diff --git a/radio/src/translations/tts_fr.cpp b/radio/src/translations/tts_fr.cpp index 6906364c4..ee76f9235 100644 --- a/radio/src/translations/tts_fr.cpp +++ b/radio/src/translations/tts_fr.cpp @@ -114,7 +114,7 @@ I18N_PLAY_FUNCTION(fr, playNumber, getvalue_t number, uint8_t unit, uint8_t att) #else // we assume that we are PREC1 #endif - div_t qr = div(number, 10); + div_t qr = div((int)number, 10); if (qr.rem) { PLAY_NUMBER(qr.quot, 0, 0); PUSH_NUMBER_PROMPT(FR_PROMPT_VIRGULE_BASE + qr.rem); diff --git a/radio/src/translations/tts_hu.cpp b/radio/src/translations/tts_hu.cpp index 198d55a35..9d9349d8a 100644 --- a/radio/src/translations/tts_hu.cpp +++ b/radio/src/translations/tts_hu.cpp @@ -1,176 +1,176 @@ -/* - * Authors (alphabetical order) - * - Andre Bernet - * - Andreas Weitl - * - Bertrand Songis - * - Bryan J. Rentoul (Gruvin) - * - Cameron Weeks - * - Erez Raviv - * - Gabriel Birkus - * - Jean-Pierre Parisy - * - Karl Szmutny - * - Michael Blandford - * - Michal Hlavinka - * - Pat Mackenzie - * - Philip Moss - * - Rob Thomson - * - Romolo Manfredini - * - Thomas Husterer - * - * opentx is based on code named - * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, - * er9x by Erez Raviv: http://code.google.com/p/er9x/, - * and the original (and ongoing) project by - * Thomas Husterer, th9x: http://code.google.com/p/th9x/ - * - * 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 - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "opentx.h" - -enum HungarianPrompts { - HU_PROMPT_NUMBERS_BASE = 0, - HU_PROMPT_ZERO = HU_PROMPT_NUMBERS_BASE+0, //02-99 - HU_PROMPT_HUNDRED = HU_PROMPT_NUMBERS_BASE+100, //100,200 .. 900 - HU_PROMPT_THOUSAND = HU_PROMPT_NUMBERS_BASE+109, //1000 - HU_PROMPT_AND = HU_PROMPT_NUMBERS_BASE+110, - HU_PROMPT_MINUS = HU_PROMPT_NUMBERS_BASE+111, - HU_PROMPT_POINT = HU_PROMPT_NUMBERS_BASE+112, - HU_PROMPT_UNITS_BASE = 113, - HU_PROMPT_POINT_BASE = 165, //.0 - .9 -}; - -#if defined(VOICE) - -#if defined(CPUARM) - #define HU_PUSH_UNIT_PROMPT(p, u) hu_pushUnitPrompt((p), (u), id) -#else - #define HU_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u)) -#endif - -I18N_PLAY_FUNCTION(hu, pushUnitPrompt, int16_t number, uint8_t unitprompt) -{ -#if defined(CPUARM) - if (number == 1) - PUSH_UNIT_PROMPT(unitprompt, 0); - else - PUSH_UNIT_PROMPT(unitprompt, 1); -#else - unitprompt = HU_PROMPT_UNITS_BASE + unitprompt*2; - if (number == 1) - PUSH_NUMBER_PROMPT(unitprompt); - else - PUSH_NUMBER_PROMPT(unitprompt+1); -#endif -} - -I18N_PLAY_FUNCTION(hu, playNumber, getvalue_t number, uint8_t unit, uint8_t att) -{ - if (number < 0) { - PUSH_NUMBER_PROMPT(HU_PROMPT_MINUS); - number = -number; - } - -#if !defined(CPUARM) - if (unit) { - unit--; - convertUnit(number, unit); - if (IS_IMPERIAL_ENABLE()) { - if (unit == UNIT_DIST) { - unit = UNIT_FEET; - } - if (unit == UNIT_SPEED) { - unit = UNIT_KTS; - } - } - unit++; - } -#endif - - int8_t mode = MODE(att); - if (mode > 0) { -#if defined(CPUARM) - if (mode == 2) { - number /= 10; - } -#else - // we assume that we are PREC1 -#endif - div_t qr = div(number, 10); - if (qr.rem) { - PLAY_NUMBER(qr.quot, 0, 0); - PUSH_NUMBER_PROMPT(HU_PROMPT_POINT_BASE + qr.rem); - number = -1; - } - else { - number = qr.quot; - } - } - - int16_t tmp = number; - - if (number >= 1000) { - PLAY_NUMBER(number / 1000, 0, 0); - PUSH_NUMBER_PROMPT(HU_PROMPT_THOUSAND); - number %= 1000; - if (number == 0) - number = -1; - } - if (number >= 100) { - PUSH_NUMBER_PROMPT(HU_PROMPT_HUNDRED + (number/100)-1); - number %= 100; - if (number == 0) - number = -1; - } - if (number >= 0) { - PUSH_NUMBER_PROMPT(HU_PROMPT_ZERO + number); - } - - if (unit) { - HU_PUSH_UNIT_PROMPT(tmp, unit); - } -} - -I18N_PLAY_FUNCTION(hu, playDuration, int seconds PLAY_DURATION_ATT) -{ - if (seconds == 0) { - PLAY_NUMBER(seconds, 0, 0); - return; - } - - if (seconds < 0) { - PUSH_NUMBER_PROMPT(HU_PROMPT_MINUS); - seconds = -seconds; - } - - uint8_t tmp = seconds / 3600; - seconds %= 3600; - if (tmp > 0 || IS_PLAY_TIME()) { - PLAY_NUMBER(tmp, UNIT_HOURS, 0); - } - - tmp = seconds / 60; - seconds %= 60; - if (tmp > 0) { - PLAY_NUMBER(tmp, UNIT_MINUTES, 0); - // This is not necessary in the Hungarian - //if (seconds > 0) - //PUSH_NUMBER_PROMPT(HU_PROMPT_AND); - } - - if (seconds > 0) { - PLAY_NUMBER(seconds, UNIT_SECONDS, 0); - } -} - -LANGUAGE_PACK_DECLARE(hu, "Hungarian"); - -#endif +/* + * Authors (alphabetical order) + * - Andre Bernet + * - Andreas Weitl + * - Bertrand Songis + * - Bryan J. Rentoul (Gruvin) + * - Cameron Weeks + * - Erez Raviv + * - Gabriel Birkus + * - Jean-Pierre Parisy + * - Karl Szmutny + * - Michael Blandford + * - Michal Hlavinka + * - Pat Mackenzie + * - Philip Moss + * - Rob Thomson + * - Romolo Manfredini + * - Thomas Husterer + * + * opentx is based on code named + * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, + * er9x by Erez Raviv: http://code.google.com/p/er9x/, + * and the original (and ongoing) project by + * Thomas Husterer, th9x: http://code.google.com/p/th9x/ + * + * 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 + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include "opentx.h" + +enum HungarianPrompts { + HU_PROMPT_NUMBERS_BASE = 0, + HU_PROMPT_ZERO = HU_PROMPT_NUMBERS_BASE+0, //02-99 + HU_PROMPT_HUNDRED = HU_PROMPT_NUMBERS_BASE+100, //100,200 .. 900 + HU_PROMPT_THOUSAND = HU_PROMPT_NUMBERS_BASE+109, //1000 + HU_PROMPT_AND = HU_PROMPT_NUMBERS_BASE+110, + HU_PROMPT_MINUS = HU_PROMPT_NUMBERS_BASE+111, + HU_PROMPT_POINT = HU_PROMPT_NUMBERS_BASE+112, + HU_PROMPT_UNITS_BASE = 113, + HU_PROMPT_POINT_BASE = 165, //.0 - .9 +}; + +#if defined(VOICE) + +#if defined(CPUARM) + #define HU_PUSH_UNIT_PROMPT(p, u) hu_pushUnitPrompt((p), (u), id) +#else + #define HU_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u)) +#endif + +I18N_PLAY_FUNCTION(hu, pushUnitPrompt, int16_t number, uint8_t unitprompt) +{ +#if defined(CPUARM) + if (number == 1) + PUSH_UNIT_PROMPT(unitprompt, 0); + else + PUSH_UNIT_PROMPT(unitprompt, 1); +#else + unitprompt = HU_PROMPT_UNITS_BASE + unitprompt*2; + if (number == 1) + PUSH_NUMBER_PROMPT(unitprompt); + else + PUSH_NUMBER_PROMPT(unitprompt+1); +#endif +} + +I18N_PLAY_FUNCTION(hu, playNumber, getvalue_t number, uint8_t unit, uint8_t att) +{ + if (number < 0) { + PUSH_NUMBER_PROMPT(HU_PROMPT_MINUS); + number = -number; + } + +#if !defined(CPUARM) + if (unit) { + unit--; + convertUnit(number, unit); + if (IS_IMPERIAL_ENABLE()) { + if (unit == UNIT_DIST) { + unit = UNIT_FEET; + } + if (unit == UNIT_SPEED) { + unit = UNIT_KTS; + } + } + unit++; + } +#endif + + int8_t mode = MODE(att); + if (mode > 0) { +#if defined(CPUARM) + if (mode == 2) { + number /= 10; + } +#else + // we assume that we are PREC1 +#endif + div_t qr = div((int)number, 10); + if (qr.rem) { + PLAY_NUMBER(qr.quot, 0, 0); + PUSH_NUMBER_PROMPT(HU_PROMPT_POINT_BASE + qr.rem); + number = -1; + } + else { + number = qr.quot; + } + } + + int16_t tmp = number; + + if (number >= 1000) { + PLAY_NUMBER(number / 1000, 0, 0); + PUSH_NUMBER_PROMPT(HU_PROMPT_THOUSAND); + number %= 1000; + if (number == 0) + number = -1; + } + if (number >= 100) { + PUSH_NUMBER_PROMPT(HU_PROMPT_HUNDRED + (number/100)-1); + number %= 100; + if (number == 0) + number = -1; + } + if (number >= 0) { + PUSH_NUMBER_PROMPT(HU_PROMPT_ZERO + number); + } + + if (unit) { + HU_PUSH_UNIT_PROMPT(tmp, unit); + } +} + +I18N_PLAY_FUNCTION(hu, playDuration, int seconds PLAY_DURATION_ATT) +{ + if (seconds == 0) { + PLAY_NUMBER(seconds, 0, 0); + return; + } + + if (seconds < 0) { + PUSH_NUMBER_PROMPT(HU_PROMPT_MINUS); + seconds = -seconds; + } + + uint8_t tmp = seconds / 3600; + seconds %= 3600; + if (tmp > 0 || IS_PLAY_TIME()) { + PLAY_NUMBER(tmp, UNIT_HOURS, 0); + } + + tmp = seconds / 60; + seconds %= 60; + if (tmp > 0) { + PLAY_NUMBER(tmp, UNIT_MINUTES, 0); + // This is not necessary in the Hungarian + //if (seconds > 0) + //PUSH_NUMBER_PROMPT(HU_PROMPT_AND); + } + + if (seconds > 0) { + PLAY_NUMBER(seconds, UNIT_SECONDS, 0); + } +} + +LANGUAGE_PACK_DECLARE(hu, "Hungarian"); + +#endif diff --git a/radio/src/translations/tts_it.cpp b/radio/src/translations/tts_it.cpp index 1709b0771..7d5149fe1 100644 --- a/radio/src/translations/tts_it.cpp +++ b/radio/src/translations/tts_it.cpp @@ -1,244 +1,244 @@ -/* - * Authors (alphabetical order) - * - Bertrand Songis - * - Romolo Manfredini - * - * opentx is based on code named - * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, - * er9x by Erez Raviv: http://code.google.com/p/er9x/, - * and the original (and ongoing) project by - * Thomas Husterer, th9x: http://code.google.com/p/th9x/ - * - * 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 - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "opentx.h" - -enum ItalianPrompts { - IT_PROMPT_NUMBERS_BASE = 0, - IT_PROMPT_ZERO = IT_PROMPT_NUMBERS_BASE+0, - IT_PROMPT_CENT = IT_PROMPT_NUMBERS_BASE+100, - IT_PROMPT_MILA = IT_PROMPT_NUMBERS_BASE+101, - IT_PROMPT_MILLE = IT_PROMPT_NUMBERS_BASE+102, - IT_PROMPT_VIRGOLA = 103, - IT_PROMPT_UN, - IT_PROMPT_E, - IT_PROMPT_MENO, - IT_PROMPT_ORA, - IT_PROMPT_ORE, - IT_PROMPT_MINUTO, - IT_PROMPT_MINUTI, - IT_PROMPT_SECONDO, - IT_PROMPT_SECONDI, - - IT_PROMPT_UNITS_BASE = 113, - IT_PROMPT_VOLTS = IT_PROMPT_UNITS_BASE+(UNIT_VOLTS*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_SPARE1 = IT_PROMPT_UNITS_BASE+(UNIT_RAW*2), - IT_PROMPT_KMH = IT_PROMPT_UNITS_BASE+(UNIT_SPEED*2), - IT_PROMPT_METERS = IT_PROMPT_UNITS_BASE+(UNIT_DIST*2), - IT_PROMPT_DEGREES = IT_PROMPT_UNITS_BASE+(UNIT_TEMPERATURE*2), - IT_PROMPT_PERCENT = IT_PROMPT_UNITS_BASE+(UNIT_PERCENT*2), - IT_PROMPT_MILLIAMPS = IT_PROMPT_UNITS_BASE+(UNIT_MILLIAMPS*2), - IT_PROMPT_MAH = IT_PROMPT_UNITS_BASE+(UNIT_MAH*2), - IT_PROMPT_WATTS = IT_PROMPT_UNITS_BASE+(UNIT_WATTS*2), - IT_PROMPT_FEET = IT_PROMPT_UNITS_BASE+(UNIT_FEET*2), - IT_PROMPT_KTS = IT_PROMPT_UNITS_BASE+(UNIT_KTS*2), -#if defined(CPUARM) - IT_PROMPT_MILLILITERS = IT_PROMPT_UNITS_BASE+(UNIT_MILLILITERS*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), -#endif - -}; - -#if defined(VOICE) -#if defined(CPUARM) - #define IT_PUSH_UNIT_PROMPT(p, u) it_pushUnitPrompt((p), (u), id) -#else - #define IT_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u)) -#endif - -I18N_PLAY_FUNCTION(it, pushUnitPrompt, int16_t number, uint8_t unitprompt) -{ -#if defined(CPUARM) - if (number == 1) - PUSH_UNIT_PROMPT(unitprompt, 0); - else - PUSH_UNIT_PROMPT(unitprompt, 1); -#else - unitprompt = IT_PROMPT_UNITS_BASE + unitprompt*2; - if (number == 1) - PUSH_NUMBER_PROMPT(unitprompt); - else - PUSH_NUMBER_PROMPT(unitprompt+1); -#endif -} - - -I18N_PLAY_FUNCTION(it, playNumber, getvalue_t number, uint8_t unit, uint8_t att) -{ -/* if digit >= 1000000000: - temp_digit, digit = divmod(digit, 1000000000) - prompts.extend(self.getNumberPrompt(temp_digit)) - prompts.append(Prompt(GUIDE_00_BILLION, dir=2)) - if digit >= 1000000: - temp_digit, digit = divmod(digit, 1000000) - prompts.extend(self.getNumberPrompt(temp_digit)) - prompts.append(Prompt(GUIDE_00_MILLION, dir=2)) -*/ - getvalue_t orignumber; - if (number < 0) { - PUSH_NUMBER_PROMPT(IT_PROMPT_MENO); - number = -number; - } - orignumber=number; -#if !defined(CPUARM) - if (unit) { - unit--; - convertUnit(number, unit); - if (IS_IMPERIAL_ENABLE()) { - if (unit == UNIT_DIST) { - unit = UNIT_FEET; - } - if (unit == UNIT_SPEED) { - unit = UNIT_KTS; - } - } - unit++; - } -#endif - - int8_t mode = MODE(att); - if (mode > 0) { -#if defined(CPUARM) - if (mode == 2) { - number /= 10; - } -#else - // we assume that we are PREC1 -#endif - div_t qr = div(number, 10); - if (qr.rem > 0) { - PLAY_NUMBER(qr.quot, 0, 0); - PUSH_NUMBER_PROMPT(IT_PROMPT_VIRGOLA); - if (mode==2 && qr.rem < 10) - PUSH_NUMBER_PROMPT(IT_PROMPT_ZERO); - PLAY_NUMBER(qr.rem, 0, 0); - } - else { - if (qr.quot==1) { - PUSH_NUMBER_PROMPT(IT_PROMPT_UN); - if (unit) { - PUSH_NUMBER_PROMPT(IT_PROMPT_UNITS_BASE+(unit*2)); - } - return; - } else { - PLAY_NUMBER(qr.quot, 0, 0); - } - } - } else { - if (orignumber == 1 && unit) { - PUSH_NUMBER_PROMPT(IT_PROMPT_UN); - } else { - if (number >= 1000) { - if (number >= 2000) { - PLAY_NUMBER(number / 1000, 0, 0); - PUSH_NUMBER_PROMPT(IT_PROMPT_MILA); - } else { - PUSH_NUMBER_PROMPT(IT_PROMPT_MILLE); - } - number %= 1000; - if (number == 0) - number = -1; - } - if (number >= 100) { - if (number >= 200) - PUSH_NUMBER_PROMPT(IT_PROMPT_ZERO + number/100); - PUSH_NUMBER_PROMPT(IT_PROMPT_CENT); - number %= 100; - if (number == 0) - number = -1; - } - PUSH_NUMBER_PROMPT(IT_PROMPT_ZERO+number); - } - } - if (unit) { - IT_PUSH_UNIT_PROMPT(orignumber, unit); - } -} - -I18N_PLAY_FUNCTION(it, playDuration, int seconds PLAY_DURATION_ATT) -{ - if (seconds < 0) { - PUSH_NUMBER_PROMPT(IT_PROMPT_MENO); - seconds = -seconds; - } - - uint8_t ore = 0; - uint8_t tmp = seconds / 3600; - seconds %= 3600; - if (tmp > 0) { - ore=tmp; - if (tmp > 1 || IS_PLAY_TIME()) { -#if defined(CPUARM) - PLAY_NUMBER(tmp, UNIT_HOURS, 0); -#else - PLAY_NUMBER(tmp, 0, 0); - PUSH_NUMBER_PROMPT(IT_PROMPT_ORE); - } else { - PUSH_NUMBER_PROMPT(IT_PROMPT_UN); - PUSH_NUMBER_PROMPT(IT_PROMPT_ORA); -#endif - } - } - if (seconds>0) { - tmp = seconds / 60; - seconds %= 60; - if (tmp>0 && seconds==0 && ore>0) { - PUSH_NUMBER_PROMPT(IT_PROMPT_E); - } - if (tmp > 0) { - if (tmp != 1) { -#if defined(CPUARM) - PLAY_NUMBER(tmp, UNIT_MINUTES, 0); -#else - PLAY_NUMBER(tmp, 0, 0); - PUSH_NUMBER_PROMPT(IT_PROMPT_MINUTI); - } else { - PUSH_NUMBER_PROMPT(IT_PROMPT_UN); - PUSH_NUMBER_PROMPT(IT_PROMPT_MINUTO); -#endif - } - } - if ((tmp>0 || ore>0) && seconds>0) { - PUSH_NUMBER_PROMPT(IT_PROMPT_E); - } - } - if (seconds != 0 || (ore==0 && tmp==0)) { - if (seconds != 1) { -#if defined(CPUARM) - PLAY_NUMBER(tmp, UNIT_SECONDS, 0); -#else - PLAY_NUMBER(seconds, 0, 0); - PUSH_NUMBER_PROMPT(IT_PROMPT_SECONDI); - } else { - PUSH_NUMBER_PROMPT(IT_PROMPT_UN); - PUSH_NUMBER_PROMPT(IT_PROMPT_SECONDO); -#endif - } - } -} - -LANGUAGE_PACK_DECLARE(it, "Italiano"); - -#endif +/* + * Authors (alphabetical order) + * - Bertrand Songis + * - Romolo Manfredini + * + * opentx is based on code named + * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, + * er9x by Erez Raviv: http://code.google.com/p/er9x/, + * and the original (and ongoing) project by + * Thomas Husterer, th9x: http://code.google.com/p/th9x/ + * + * 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 + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include "opentx.h" + +enum ItalianPrompts { + IT_PROMPT_NUMBERS_BASE = 0, + IT_PROMPT_ZERO = IT_PROMPT_NUMBERS_BASE+0, + IT_PROMPT_CENT = IT_PROMPT_NUMBERS_BASE+100, + IT_PROMPT_MILA = IT_PROMPT_NUMBERS_BASE+101, + IT_PROMPT_MILLE = IT_PROMPT_NUMBERS_BASE+102, + IT_PROMPT_VIRGOLA = 103, + IT_PROMPT_UN, + IT_PROMPT_E, + IT_PROMPT_MENO, + IT_PROMPT_ORA, + IT_PROMPT_ORE, + IT_PROMPT_MINUTO, + IT_PROMPT_MINUTI, + IT_PROMPT_SECONDO, + IT_PROMPT_SECONDI, + + IT_PROMPT_UNITS_BASE = 113, + IT_PROMPT_VOLTS = IT_PROMPT_UNITS_BASE+(UNIT_VOLTS*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_SPARE1 = IT_PROMPT_UNITS_BASE+(UNIT_RAW*2), + IT_PROMPT_KMH = IT_PROMPT_UNITS_BASE+(UNIT_SPEED*2), + IT_PROMPT_METERS = IT_PROMPT_UNITS_BASE+(UNIT_DIST*2), + IT_PROMPT_DEGREES = IT_PROMPT_UNITS_BASE+(UNIT_TEMPERATURE*2), + IT_PROMPT_PERCENT = IT_PROMPT_UNITS_BASE+(UNIT_PERCENT*2), + IT_PROMPT_MILLIAMPS = IT_PROMPT_UNITS_BASE+(UNIT_MILLIAMPS*2), + IT_PROMPT_MAH = IT_PROMPT_UNITS_BASE+(UNIT_MAH*2), + IT_PROMPT_WATTS = IT_PROMPT_UNITS_BASE+(UNIT_WATTS*2), + IT_PROMPT_FEET = IT_PROMPT_UNITS_BASE+(UNIT_FEET*2), + IT_PROMPT_KTS = IT_PROMPT_UNITS_BASE+(UNIT_KTS*2), +#if defined(CPUARM) + IT_PROMPT_MILLILITERS = IT_PROMPT_UNITS_BASE+(UNIT_MILLILITERS*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), +#endif + +}; + +#if defined(VOICE) +#if defined(CPUARM) + #define IT_PUSH_UNIT_PROMPT(p, u) it_pushUnitPrompt((p), (u), id) +#else + #define IT_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u)) +#endif + +I18N_PLAY_FUNCTION(it, pushUnitPrompt, int16_t number, uint8_t unitprompt) +{ +#if defined(CPUARM) + if (number == 1) + PUSH_UNIT_PROMPT(unitprompt, 0); + else + PUSH_UNIT_PROMPT(unitprompt, 1); +#else + unitprompt = IT_PROMPT_UNITS_BASE + unitprompt*2; + if (number == 1) + PUSH_NUMBER_PROMPT(unitprompt); + else + PUSH_NUMBER_PROMPT(unitprompt+1); +#endif +} + + +I18N_PLAY_FUNCTION(it, playNumber, getvalue_t number, uint8_t unit, uint8_t att) +{ +/* if digit >= 1000000000: + temp_digit, digit = divmod(digit, 1000000000) + prompts.extend(self.getNumberPrompt(temp_digit)) + prompts.append(Prompt(GUIDE_00_BILLION, dir=2)) + if digit >= 1000000: + temp_digit, digit = divmod(digit, 1000000) + prompts.extend(self.getNumberPrompt(temp_digit)) + prompts.append(Prompt(GUIDE_00_MILLION, dir=2)) +*/ + getvalue_t orignumber; + if (number < 0) { + PUSH_NUMBER_PROMPT(IT_PROMPT_MENO); + number = -number; + } + orignumber=number; +#if !defined(CPUARM) + if (unit) { + unit--; + convertUnit(number, unit); + if (IS_IMPERIAL_ENABLE()) { + if (unit == UNIT_DIST) { + unit = UNIT_FEET; + } + if (unit == UNIT_SPEED) { + unit = UNIT_KTS; + } + } + unit++; + } +#endif + + int8_t mode = MODE(att); + if (mode > 0) { +#if defined(CPUARM) + if (mode == 2) { + number /= 10; + } +#else + // we assume that we are PREC1 +#endif + div_t qr = div((int)number, 10); + if (qr.rem > 0) { + PLAY_NUMBER(qr.quot, 0, 0); + PUSH_NUMBER_PROMPT(IT_PROMPT_VIRGOLA); + if (mode==2 && qr.rem < 10) + PUSH_NUMBER_PROMPT(IT_PROMPT_ZERO); + PLAY_NUMBER(qr.rem, 0, 0); + } + else { + if (qr.quot==1) { + PUSH_NUMBER_PROMPT(IT_PROMPT_UN); + if (unit) { + PUSH_NUMBER_PROMPT(IT_PROMPT_UNITS_BASE+(unit*2)); + } + return; + } else { + PLAY_NUMBER(qr.quot, 0, 0); + } + } + } else { + if (orignumber == 1 && unit) { + PUSH_NUMBER_PROMPT(IT_PROMPT_UN); + } else { + if (number >= 1000) { + if (number >= 2000) { + PLAY_NUMBER(number / 1000, 0, 0); + PUSH_NUMBER_PROMPT(IT_PROMPT_MILA); + } else { + PUSH_NUMBER_PROMPT(IT_PROMPT_MILLE); + } + number %= 1000; + if (number == 0) + number = -1; + } + if (number >= 100) { + if (number >= 200) + PUSH_NUMBER_PROMPT(IT_PROMPT_ZERO + number/100); + PUSH_NUMBER_PROMPT(IT_PROMPT_CENT); + number %= 100; + if (number == 0) + number = -1; + } + PUSH_NUMBER_PROMPT(IT_PROMPT_ZERO+number); + } + } + if (unit) { + IT_PUSH_UNIT_PROMPT(orignumber, unit); + } +} + +I18N_PLAY_FUNCTION(it, playDuration, int seconds PLAY_DURATION_ATT) +{ + if (seconds < 0) { + PUSH_NUMBER_PROMPT(IT_PROMPT_MENO); + seconds = -seconds; + } + + uint8_t ore = 0; + uint8_t tmp = seconds / 3600; + seconds %= 3600; + if (tmp > 0) { + ore=tmp; + if (tmp > 1 || IS_PLAY_TIME()) { +#if defined(CPUARM) + PLAY_NUMBER(tmp, UNIT_HOURS, 0); +#else + PLAY_NUMBER(tmp, 0, 0); + PUSH_NUMBER_PROMPT(IT_PROMPT_ORE); + } else { + PUSH_NUMBER_PROMPT(IT_PROMPT_UN); + PUSH_NUMBER_PROMPT(IT_PROMPT_ORA); +#endif + } + } + if (seconds>0) { + tmp = seconds / 60; + seconds %= 60; + if (tmp>0 && seconds==0 && ore>0) { + PUSH_NUMBER_PROMPT(IT_PROMPT_E); + } + if (tmp > 0) { + if (tmp != 1) { +#if defined(CPUARM) + PLAY_NUMBER(tmp, UNIT_MINUTES, 0); +#else + PLAY_NUMBER(tmp, 0, 0); + PUSH_NUMBER_PROMPT(IT_PROMPT_MINUTI); + } else { + PUSH_NUMBER_PROMPT(IT_PROMPT_UN); + PUSH_NUMBER_PROMPT(IT_PROMPT_MINUTO); +#endif + } + } + if ((tmp>0 || ore>0) && seconds>0) { + PUSH_NUMBER_PROMPT(IT_PROMPT_E); + } + } + if (seconds != 0 || (ore==0 && tmp==0)) { + if (seconds != 1) { +#if defined(CPUARM) + PLAY_NUMBER(tmp, UNIT_SECONDS, 0); +#else + PLAY_NUMBER(seconds, 0, 0); + PUSH_NUMBER_PROMPT(IT_PROMPT_SECONDI); + } else { + PUSH_NUMBER_PROMPT(IT_PROMPT_UN); + PUSH_NUMBER_PROMPT(IT_PROMPT_SECONDO); +#endif + } + } +} + +LANGUAGE_PACK_DECLARE(it, "Italiano"); + +#endif diff --git a/radio/src/translations/tts_pl.cpp b/radio/src/translations/tts_pl.cpp index eb0acb5b6..39ed2e93f 100644 --- a/radio/src/translations/tts_pl.cpp +++ b/radio/src/translations/tts_pl.cpp @@ -146,7 +146,7 @@ I18N_PLAY_FUNCTION(pl, playNumber, getvalue_t number, uint8_t unit, uint8_t att) #else // we assume that we are PREC1 #endif - div_t qr = div(number, 10); + div_t qr = div((int)number, 10); if (qr.rem) { PLAY_NUMBER(qr.quot, 0, ZENSKI); if (qr.quot == 0) diff --git a/radio/src/translations/tts_pt.cpp b/radio/src/translations/tts_pt.cpp index e5c9e3ed2..d55af8758 100644 --- a/radio/src/translations/tts_pt.cpp +++ b/radio/src/translations/tts_pt.cpp @@ -1,250 +1,250 @@ -/* - * Authors (alphabetical order) - * - Andre Bernet - * - Andreas Weitl - * - Bertrand Songis - * - Bryan J. Rentoul (Gruvin) - * - Cameron Weeks - * - Erez Raviv - * - Gabriel Birkus - * - Jean-Pierre Parisy - * - Karl Szmutny - * - Michael Blandford - * - Michal Hlavinka - * - Pat Mackenzie - * - Philip Moss - * - Rob Thomson - * - Romolo Manfredini - * - Thomas Husterer - * - * opentx is based on code named - * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, - * er9x by Erez Raviv: http://code.google.com/p/er9x/, - * and the original (and ongoing) project by - * Thomas Husterer, th9x: http://code.google.com/p/th9x/ - * - * 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 - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "opentx.h" - -enum PortuguesePrompts { - PT_PROMPT_NUMBERS_BASE = 0, - PT_PROMPT_ZERO = PT_PROMPT_NUMBERS_BASE+0, - PT_PROMPT_CEM = PT_PROMPT_NUMBERS_BASE+100, - PT_PROMPT_CENTO = PT_PROMPT_NUMBERS_BASE+101, - PT_PROMPT_DUZENTOS = PT_PROMPT_NUMBERS_BASE+102, - PT_PROMPT_TREZCENTOS, - PT_PROMPT_QUATROCENTOS, - PT_PROMPT_QUINHENTOS, - PT_PROMPT_SEISCENTOS, - PT_PROMPT_SETECENTOS, - PT_PROMPT_OITOCENTOS, - PT_PROMPT_NUEVECENTOS, - PT_PROMPT_MIL = PT_PROMPT_NUMBERS_BASE+110, - PT_PROMPT_VIRGULA = 111, - PT_PROMPT_UMA, - PT_PROMPT_DUAS, - PT_PROMPT_E, - PT_PROMPT_MENOS, - PT_PROMPT_HORA, - PT_PROMPT_HORAS, - PT_PROMPT_MINUTO, - PT_PROMPT_MINUTOS, - PT_PROMPT_SEGUNDO, - PT_PROMPT_SEGUNDOS, - - PT_PROMPT_UNITS_BASE = 122, - PT_PROMPT_VOLTS = PT_PROMPT_UNITS_BASE+UNIT_VOLTS, - PT_PROMPT_AMPS = PT_PROMPT_UNITS_BASE+UNIT_AMPS, - PT_PROMPT_METERS_PER_SECOND = PT_PROMPT_UNITS_BASE+UNIT_METERS_PER_SECOND, - PT_PROMPT_SPARE1 = PT_PROMPT_UNITS_BASE+UNIT_RAW, - PT_PROMPT_KMH = PT_PROMPT_UNITS_BASE+UNIT_SPEED, - PT_PROMPT_METERS = PT_PROMPT_UNITS_BASE+UNIT_DIST, - PT_PROMPT_DEGREES = PT_PROMPT_UNITS_BASE+UNIT_TEMPERATURE, - PT_PROMPT_PERCENT = PT_PROMPT_UNITS_BASE+UNIT_PERCENT, - PT_PROMPT_MILLIAMPS = PT_PROMPT_UNITS_BASE+UNIT_MILLIAMPS, - PT_PROMPT_MAH = PT_PROMPT_UNITS_BASE+UNIT_MAH, - PT_PROMPT_WATTS = PT_PROMPT_UNITS_BASE+UNIT_WATTS, - PT_PROMPT_FEET = PT_PROMPT_UNITS_BASE+UNIT_FEET, - PT_PROMPT_KTS = PT_PROMPT_UNITS_BASE+UNIT_KTS, -#if defined(CPUARM) - PT_PROMPT_MILLILITERS = PT_PROMPT_UNITS_BASE+UNIT_MILLILITERS, - PT_PROMPT_FLOZ = PT_PROMPT_UNITS_BASE+UNIT_FLOZ, - PT_PROMPT_FEET_PER_SECOND = PT_PROMPT_UNITS_BASE+UNIT_FEET_PER_SECOND, -#endif -}; - -#if defined(VOICE) - -#if defined(CPUARM) - #define PT_PUSH_UNIT_PROMPT(u) pt_pushUnitPrompt((u), id) -#else - #define PT_PUSH_UNIT_PROMPT(u) pushUnitPrompt((u)) -#endif - -I18N_PLAY_FUNCTION(pt, pushUnitPrompt, uint8_t unitprompt) -{ -#if defined(CPUARM) - PUSH_UNIT_PROMPT(unitprompt, 0); -#else - unitprompt = PT_PROMPT_UNITS_BASE + unitprompt*2; - PUSH_NUMBER_PROMPT(unitprompt); -#endif -} - -I18N_PLAY_FUNCTION(pt, playNumber, getvalue_t number, uint8_t unit, uint8_t att) -{ - if (number < 0) { - PUSH_NUMBER_PROMPT(PT_PROMPT_MENOS); - number = -number; - } - -#if !defined(CPUARM) - if (unit) { - unit--; - convertUnit(number, unit); - if (IS_IMPERIAL_ENABLE()) { - if (unit == UNIT_DIST) { - unit = UNIT_FEET; - } - if (unit == UNIT_SPEED) { - unit = UNIT_KTS; - } - } - unit++; - } -#endif - - int8_t mode = MODE(att); - if (mode > 0) { -#if defined(CPUARM) - if (mode == 2) { - number /= 10; - } -#else - // we assume that we are PREC1 -#endif - div_t qr = div(number, 10); - if (qr.rem > 0) { - PLAY_NUMBER(qr.quot, 0, 0); - PUSH_NUMBER_PROMPT(PT_PROMPT_VIRGULA); - if (mode==2 && qr.rem < 10) - PUSH_NUMBER_PROMPT(PT_PROMPT_ZERO); - PLAY_NUMBER(qr.rem, unit, 0); - } - else { - PLAY_NUMBER(qr.quot, unit, 0); - } - return; - } - - if (number >= 1000) { - if (number >= 2000) { - PLAY_NUMBER(number / 1000, 0, 0); - PUSH_NUMBER_PROMPT(PT_PROMPT_MIL); - } else { - PUSH_NUMBER_PROMPT(PT_PROMPT_MIL); - } - number %= 1000; - if (number == 0) - number = -1; - } - if (number >= 100) { - PUSH_NUMBER_PROMPT(PT_PROMPT_CENTO + number/100); - number %= 100; - if (number == 0) - number = -1; - } - PUSH_NUMBER_PROMPT(PT_PROMPT_ZERO+number); - - if (unit) { - PT_PUSH_UNIT_PROMPT(unit); - } -} - -I18N_PLAY_FUNCTION(pt, playDuration, int seconds PLAY_DURATION_ATT) -{ - if (seconds < 0) { - PUSH_NUMBER_PROMPT(PT_PROMPT_MENOS); - seconds = -seconds; - } - - uint8_t ore = 0; - uint8_t tmp = seconds / 3600; - seconds %= 3600; - if (tmp > 0 || IS_PLAY_TIME()) { - ore=tmp; - if (tmp > 2) { - PLAY_NUMBER(tmp, 0, 0); -#if defined(CPUARM) - PUSH_UNIT_PROMPT(UNIT_HOURS, 1); -#else - PUSH_NUMBER_PROMPT(PT_PROMPT_HORAS); -#endif - } else if (tmp==2) { - PUSH_NUMBER_PROMPT(PT_PROMPT_DUAS); -#if defined(CPUARM) - PUSH_UNIT_PROMPT(UNIT_HOURS, 1); -#else - PUSH_NUMBER_PROMPT(PT_PROMPT_HORAS); -#endif - } else if (tmp==1) { - PUSH_NUMBER_PROMPT(PT_PROMPT_UMA); -#if defined(CPUARM) - PUSH_UNIT_PROMPT(UNIT_HOURS, 0); -#else - PUSH_NUMBER_PROMPT(PT_PROMPT_HORAS); -#endif - } - } - - tmp = seconds / 60; - seconds %= 60; - if (tmp > 0 || ore >0) { - if (tmp != 1) { - PLAY_NUMBER(tmp, 0, 0); -#if defined(CPUARM) - PUSH_UNIT_PROMPT(UNIT_MINUTES, 1); -#else - PUSH_NUMBER_PROMPT(PT_PROMPT_MINUTOS); -#endif - } else { - PUSH_NUMBER_PROMPT(PT_PROMPT_NUMBERS_BASE+1); -#if defined(CPUARM) - PUSH_UNIT_PROMPT(UNIT_MINUTES, 0); -#else - PUSH_NUMBER_PROMPT(PT_PROMPT_MINUTO); -#endif - } - PUSH_NUMBER_PROMPT(PT_PROMPT_E); - } - - if (seconds != 1) { - PLAY_NUMBER(seconds, 0, 0); -#if defined(CPUARM) - PUSH_UNIT_PROMPT(UNIT_SECONDS, 1); -#else - PUSH_NUMBER_PROMPT(PT_PROMPT_SEGUNDOS); -#endif - } else { - PUSH_NUMBER_PROMPT(PT_PROMPT_NUMBERS_BASE+1); -#if defined(CPUARM) - PUSH_UNIT_PROMPT(UNIT_SECONDS, 0); -#else - PUSH_NUMBER_PROMPT(PT_PROMPT_SEGUNDO); -#endif - } -} - -LANGUAGE_PACK_DECLARE(pt, "Portugues"); - -#endif +/* + * Authors (alphabetical order) + * - Andre Bernet + * - Andreas Weitl + * - Bertrand Songis + * - Bryan J. Rentoul (Gruvin) + * - Cameron Weeks + * - Erez Raviv + * - Gabriel Birkus + * - Jean-Pierre Parisy + * - Karl Szmutny + * - Michael Blandford + * - Michal Hlavinka + * - Pat Mackenzie + * - Philip Moss + * - Rob Thomson + * - Romolo Manfredini + * - Thomas Husterer + * + * opentx is based on code named + * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, + * er9x by Erez Raviv: http://code.google.com/p/er9x/, + * and the original (and ongoing) project by + * Thomas Husterer, th9x: http://code.google.com/p/th9x/ + * + * 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 + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include "opentx.h" + +enum PortuguesePrompts { + PT_PROMPT_NUMBERS_BASE = 0, + PT_PROMPT_ZERO = PT_PROMPT_NUMBERS_BASE+0, + PT_PROMPT_CEM = PT_PROMPT_NUMBERS_BASE+100, + PT_PROMPT_CENTO = PT_PROMPT_NUMBERS_BASE+101, + PT_PROMPT_DUZENTOS = PT_PROMPT_NUMBERS_BASE+102, + PT_PROMPT_TREZCENTOS, + PT_PROMPT_QUATROCENTOS, + PT_PROMPT_QUINHENTOS, + PT_PROMPT_SEISCENTOS, + PT_PROMPT_SETECENTOS, + PT_PROMPT_OITOCENTOS, + PT_PROMPT_NUEVECENTOS, + PT_PROMPT_MIL = PT_PROMPT_NUMBERS_BASE+110, + PT_PROMPT_VIRGULA = 111, + PT_PROMPT_UMA, + PT_PROMPT_DUAS, + PT_PROMPT_E, + PT_PROMPT_MENOS, + PT_PROMPT_HORA, + PT_PROMPT_HORAS, + PT_PROMPT_MINUTO, + PT_PROMPT_MINUTOS, + PT_PROMPT_SEGUNDO, + PT_PROMPT_SEGUNDOS, + + PT_PROMPT_UNITS_BASE = 122, + PT_PROMPT_VOLTS = PT_PROMPT_UNITS_BASE+UNIT_VOLTS, + PT_PROMPT_AMPS = PT_PROMPT_UNITS_BASE+UNIT_AMPS, + PT_PROMPT_METERS_PER_SECOND = PT_PROMPT_UNITS_BASE+UNIT_METERS_PER_SECOND, + PT_PROMPT_SPARE1 = PT_PROMPT_UNITS_BASE+UNIT_RAW, + PT_PROMPT_KMH = PT_PROMPT_UNITS_BASE+UNIT_SPEED, + PT_PROMPT_METERS = PT_PROMPT_UNITS_BASE+UNIT_DIST, + PT_PROMPT_DEGREES = PT_PROMPT_UNITS_BASE+UNIT_TEMPERATURE, + PT_PROMPT_PERCENT = PT_PROMPT_UNITS_BASE+UNIT_PERCENT, + PT_PROMPT_MILLIAMPS = PT_PROMPT_UNITS_BASE+UNIT_MILLIAMPS, + PT_PROMPT_MAH = PT_PROMPT_UNITS_BASE+UNIT_MAH, + PT_PROMPT_WATTS = PT_PROMPT_UNITS_BASE+UNIT_WATTS, + PT_PROMPT_FEET = PT_PROMPT_UNITS_BASE+UNIT_FEET, + PT_PROMPT_KTS = PT_PROMPT_UNITS_BASE+UNIT_KTS, +#if defined(CPUARM) + PT_PROMPT_MILLILITERS = PT_PROMPT_UNITS_BASE+UNIT_MILLILITERS, + PT_PROMPT_FLOZ = PT_PROMPT_UNITS_BASE+UNIT_FLOZ, + PT_PROMPT_FEET_PER_SECOND = PT_PROMPT_UNITS_BASE+UNIT_FEET_PER_SECOND, +#endif +}; + +#if defined(VOICE) + +#if defined(CPUARM) + #define PT_PUSH_UNIT_PROMPT(u) pt_pushUnitPrompt((u), id) +#else + #define PT_PUSH_UNIT_PROMPT(u) pushUnitPrompt((u)) +#endif + +I18N_PLAY_FUNCTION(pt, pushUnitPrompt, uint8_t unitprompt) +{ +#if defined(CPUARM) + PUSH_UNIT_PROMPT(unitprompt, 0); +#else + unitprompt = PT_PROMPT_UNITS_BASE + unitprompt*2; + PUSH_NUMBER_PROMPT(unitprompt); +#endif +} + +I18N_PLAY_FUNCTION(pt, playNumber, getvalue_t number, uint8_t unit, uint8_t att) +{ + if (number < 0) { + PUSH_NUMBER_PROMPT(PT_PROMPT_MENOS); + number = -number; + } + +#if !defined(CPUARM) + if (unit) { + unit--; + convertUnit(number, unit); + if (IS_IMPERIAL_ENABLE()) { + if (unit == UNIT_DIST) { + unit = UNIT_FEET; + } + if (unit == UNIT_SPEED) { + unit = UNIT_KTS; + } + } + unit++; + } +#endif + + int8_t mode = MODE(att); + if (mode > 0) { +#if defined(CPUARM) + if (mode == 2) { + number /= 10; + } +#else + // we assume that we are PREC1 +#endif + div_t qr = div((int)number, 10); + if (qr.rem > 0) { + PLAY_NUMBER(qr.quot, 0, 0); + PUSH_NUMBER_PROMPT(PT_PROMPT_VIRGULA); + if (mode==2 && qr.rem < 10) + PUSH_NUMBER_PROMPT(PT_PROMPT_ZERO); + PLAY_NUMBER(qr.rem, unit, 0); + } + else { + PLAY_NUMBER(qr.quot, unit, 0); + } + return; + } + + if (number >= 1000) { + if (number >= 2000) { + PLAY_NUMBER(number / 1000, 0, 0); + PUSH_NUMBER_PROMPT(PT_PROMPT_MIL); + } else { + PUSH_NUMBER_PROMPT(PT_PROMPT_MIL); + } + number %= 1000; + if (number == 0) + number = -1; + } + if (number >= 100) { + PUSH_NUMBER_PROMPT(PT_PROMPT_CENTO + number/100); + number %= 100; + if (number == 0) + number = -1; + } + PUSH_NUMBER_PROMPT(PT_PROMPT_ZERO+number); + + if (unit) { + PT_PUSH_UNIT_PROMPT(unit); + } +} + +I18N_PLAY_FUNCTION(pt, playDuration, int seconds PLAY_DURATION_ATT) +{ + if (seconds < 0) { + PUSH_NUMBER_PROMPT(PT_PROMPT_MENOS); + seconds = -seconds; + } + + uint8_t ore = 0; + uint8_t tmp = seconds / 3600; + seconds %= 3600; + if (tmp > 0 || IS_PLAY_TIME()) { + ore=tmp; + if (tmp > 2) { + PLAY_NUMBER(tmp, 0, 0); +#if defined(CPUARM) + PUSH_UNIT_PROMPT(UNIT_HOURS, 1); +#else + PUSH_NUMBER_PROMPT(PT_PROMPT_HORAS); +#endif + } else if (tmp==2) { + PUSH_NUMBER_PROMPT(PT_PROMPT_DUAS); +#if defined(CPUARM) + PUSH_UNIT_PROMPT(UNIT_HOURS, 1); +#else + PUSH_NUMBER_PROMPT(PT_PROMPT_HORAS); +#endif + } else if (tmp==1) { + PUSH_NUMBER_PROMPT(PT_PROMPT_UMA); +#if defined(CPUARM) + PUSH_UNIT_PROMPT(UNIT_HOURS, 0); +#else + PUSH_NUMBER_PROMPT(PT_PROMPT_HORAS); +#endif + } + } + + tmp = seconds / 60; + seconds %= 60; + if (tmp > 0 || ore >0) { + if (tmp != 1) { + PLAY_NUMBER(tmp, 0, 0); +#if defined(CPUARM) + PUSH_UNIT_PROMPT(UNIT_MINUTES, 1); +#else + PUSH_NUMBER_PROMPT(PT_PROMPT_MINUTOS); +#endif + } else { + PUSH_NUMBER_PROMPT(PT_PROMPT_NUMBERS_BASE+1); +#if defined(CPUARM) + PUSH_UNIT_PROMPT(UNIT_MINUTES, 0); +#else + PUSH_NUMBER_PROMPT(PT_PROMPT_MINUTO); +#endif + } + PUSH_NUMBER_PROMPT(PT_PROMPT_E); + } + + if (seconds != 1) { + PLAY_NUMBER(seconds, 0, 0); +#if defined(CPUARM) + PUSH_UNIT_PROMPT(UNIT_SECONDS, 1); +#else + PUSH_NUMBER_PROMPT(PT_PROMPT_SEGUNDOS); +#endif + } else { + PUSH_NUMBER_PROMPT(PT_PROMPT_NUMBERS_BASE+1); +#if defined(CPUARM) + PUSH_UNIT_PROMPT(UNIT_SECONDS, 0); +#else + PUSH_NUMBER_PROMPT(PT_PROMPT_SEGUNDO); +#endif + } +} + +LANGUAGE_PACK_DECLARE(pt, "Portugues"); + +#endif diff --git a/radio/src/translations/tts_se.cpp b/radio/src/translations/tts_se.cpp index e49e24a00..025f529bf 100644 --- a/radio/src/translations/tts_se.cpp +++ b/radio/src/translations/tts_se.cpp @@ -1,171 +1,171 @@ -/* - * Authors (alphabetical order) - * - Andre Bernet - * - Andreas Weitl - * - Bertrand Songis - * - Bryan J. Rentoul (Gruvin) - * - Cameron Weeks - * - Erez Raviv - * - Gabriel Birkus - * - Jean-Pierre Parisy - * - Kjell Kernen - * - Karl Szmutny - * - Michael Blandford - * - Michal Hlavinka - * - Pat Mackenzie - * - Philip Moss - * - Rob Thomson - * - Romolo Manfredini - * - Thomas Husterer - * - * opentx is based on code named - * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, - * er9x by Erez Raviv: http://code.google.com/p/er9x/, - * and the original (and ongoing) project by - * Thomas Husterer, th9x: http://code.google.com/p/th9x/ - * - * 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 - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "opentx.h" - -enum SwedishPrompts { - SE_PROMPT_NUMBERS_BASE = 0, - SE_PROMPT_ZERO = SE_PROMPT_NUMBERS_BASE+0, //02-99 - SE_PROMPT_HUNDRED = SE_PROMPT_NUMBERS_BASE+100, //100,200 .. 900 - SE_PROMPT_THOUSAND = SE_PROMPT_NUMBERS_BASE+109, //1000 - SE_PROMPT_AND = SE_PROMPT_NUMBERS_BASE+110, - SE_PROMPT_MINUS = SE_PROMPT_NUMBERS_BASE+111, - SE_PROMPT_POINT = SE_PROMPT_NUMBERS_BASE+112, - SE_PROMPT_UNITS_BASE = 113, - SE_PROMPT_POINT_BASE = 165, //.0 - .9 -}; - -#if defined(VOICE) - -#if defined(CPUARM) - #define SE_PUSH_UNIT_PROMPT(p, u) se_pushUnitPrompt((p), (u), id) -#else - #define SE_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u)) -#endif - -I18N_PLAY_FUNCTION(se, pushUnitPrompt, int16_t number, uint8_t unitprompt) -{ -#if defined(CPUARM) - if (number == 1) - PUSH_UNIT_PROMPT(unitprompt, 0); - else - PUSH_UNIT_PROMPT(unitprompt, 1); -#else - unitprompt = SE_PROMPT_UNITS_BASE + unitprompt*2; - if (number == 1) - PUSH_NUMBER_PROMPT(unitprompt); - else - PUSH_NUMBER_PROMPT(unitprompt+1); -#endif -} - -I18N_PLAY_FUNCTION(se, playNumber, getvalue_t number, uint8_t unit, uint8_t att) -{ - if (number < 0) { - PUSH_NUMBER_PROMPT(SE_PROMPT_MINUS); - number = -number; - } - -#if !defined(CPUARM) - if (unit) { - unit--; - convertUnit(number, unit); - if (IS_IMPERIAL_ENABLE()) { - if (unit == UNIT_DIST) { - unit = UNIT_FEET; - } - if (unit == UNIT_SPEED) { - unit = UNIT_KTS; - } - } - unit++; - } -#endif - - int8_t mode = MODE(att); - if (mode > 0) { -#if defined(CPUARM) - if (mode == 2) { - number /= 10; - } -#else - // we assume that we are PREC1 -#endif - div_t qr = div(number, 10); - if (qr.rem) { - PLAY_NUMBER(qr.quot, 0, 0); - PUSH_NUMBER_PROMPT(SE_PROMPT_POINT_BASE + qr.rem); - number = -1; - } - else { - number = qr.quot; - } - } - - int16_t tmpNumber = number; - - if (number >= 1000) { - PLAY_NUMBER(number / 1000, 0, 0); - PUSH_NUMBER_PROMPT(SE_PROMPT_THOUSAND); - number %= 1000; - if (number == 0) - number = -1; - } - if (number >= 100) { - PUSH_NUMBER_PROMPT(SE_PROMPT_HUNDRED + (number/100)-1); - number %= 100; - if (number == 0) - number = -1; - } - if (number >= 0) { - PUSH_NUMBER_PROMPT(SE_PROMPT_ZERO + number); - } - - if (unit) { - SE_PUSH_UNIT_PROMPT(tmpNumber, unit); - } -} - -I18N_PLAY_FUNCTION(se, playDuration, int seconds PLAY_DURATION_ATT) -{ - if (seconds < 0) { - PUSH_NUMBER_PROMPT(SE_PROMPT_MINUS); - seconds = -seconds; - } - - uint8_t tmp = seconds / 3600; - seconds %= 3600; - if (tmp > 0 || IS_PLAY_TIME()) { - PLAY_NUMBER(tmp, UNIT_HOURS, 0); - } - - tmp = seconds / 60; - seconds %= 60; - if (tmp > 0) { - PLAY_NUMBER(tmp, UNIT_MINUTES, 0); - if (seconds > 0) - PUSH_NUMBER_PROMPT(SE_PROMPT_AND); - } - - if (seconds > 0) { - PLAY_NUMBER(seconds, UNIT_SECONDS, 0); - } -} - -LANGUAGE_PACK_DECLARE(se, "Swedish"); - -#endif +/* + * Authors (alphabetical order) + * - Andre Bernet + * - Andreas Weitl + * - Bertrand Songis + * - Bryan J. Rentoul (Gruvin) + * - Cameron Weeks + * - Erez Raviv + * - Gabriel Birkus + * - Jean-Pierre Parisy + * - Kjell Kernen + * - Karl Szmutny + * - Michael Blandford + * - Michal Hlavinka + * - Pat Mackenzie + * - Philip Moss + * - Rob Thomson + * - Romolo Manfredini + * - Thomas Husterer + * + * opentx is based on code named + * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, + * er9x by Erez Raviv: http://code.google.com/p/er9x/, + * and the original (and ongoing) project by + * Thomas Husterer, th9x: http://code.google.com/p/th9x/ + * + * 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 + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include "opentx.h" + +enum SwedishPrompts { + SE_PROMPT_NUMBERS_BASE = 0, + SE_PROMPT_ZERO = SE_PROMPT_NUMBERS_BASE+0, //02-99 + SE_PROMPT_HUNDRED = SE_PROMPT_NUMBERS_BASE+100, //100,200 .. 900 + SE_PROMPT_THOUSAND = SE_PROMPT_NUMBERS_BASE+109, //1000 + SE_PROMPT_AND = SE_PROMPT_NUMBERS_BASE+110, + SE_PROMPT_MINUS = SE_PROMPT_NUMBERS_BASE+111, + SE_PROMPT_POINT = SE_PROMPT_NUMBERS_BASE+112, + SE_PROMPT_UNITS_BASE = 113, + SE_PROMPT_POINT_BASE = 165, //.0 - .9 +}; + +#if defined(VOICE) + +#if defined(CPUARM) + #define SE_PUSH_UNIT_PROMPT(p, u) se_pushUnitPrompt((p), (u), id) +#else + #define SE_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u)) +#endif + +I18N_PLAY_FUNCTION(se, pushUnitPrompt, int16_t number, uint8_t unitprompt) +{ +#if defined(CPUARM) + if (number == 1) + PUSH_UNIT_PROMPT(unitprompt, 0); + else + PUSH_UNIT_PROMPT(unitprompt, 1); +#else + unitprompt = SE_PROMPT_UNITS_BASE + unitprompt*2; + if (number == 1) + PUSH_NUMBER_PROMPT(unitprompt); + else + PUSH_NUMBER_PROMPT(unitprompt+1); +#endif +} + +I18N_PLAY_FUNCTION(se, playNumber, getvalue_t number, uint8_t unit, uint8_t att) +{ + if (number < 0) { + PUSH_NUMBER_PROMPT(SE_PROMPT_MINUS); + number = -number; + } + +#if !defined(CPUARM) + if (unit) { + unit--; + convertUnit(number, unit); + if (IS_IMPERIAL_ENABLE()) { + if (unit == UNIT_DIST) { + unit = UNIT_FEET; + } + if (unit == UNIT_SPEED) { + unit = UNIT_KTS; + } + } + unit++; + } +#endif + + int8_t mode = MODE(att); + if (mode > 0) { +#if defined(CPUARM) + if (mode == 2) { + number /= 10; + } +#else + // we assume that we are PREC1 +#endif + div_t qr = div((int)number, 10); + if (qr.rem) { + PLAY_NUMBER(qr.quot, 0, 0); + PUSH_NUMBER_PROMPT(SE_PROMPT_POINT_BASE + qr.rem); + number = -1; + } + else { + number = qr.quot; + } + } + + int16_t tmpNumber = number; + + if (number >= 1000) { + PLAY_NUMBER(number / 1000, 0, 0); + PUSH_NUMBER_PROMPT(SE_PROMPT_THOUSAND); + number %= 1000; + if (number == 0) + number = -1; + } + if (number >= 100) { + PUSH_NUMBER_PROMPT(SE_PROMPT_HUNDRED + (number/100)-1); + number %= 100; + if (number == 0) + number = -1; + } + if (number >= 0) { + PUSH_NUMBER_PROMPT(SE_PROMPT_ZERO + number); + } + + if (unit) { + SE_PUSH_UNIT_PROMPT(tmpNumber, unit); + } +} + +I18N_PLAY_FUNCTION(se, playDuration, int seconds PLAY_DURATION_ATT) +{ + if (seconds < 0) { + PUSH_NUMBER_PROMPT(SE_PROMPT_MINUS); + seconds = -seconds; + } + + uint8_t tmp = seconds / 3600; + seconds %= 3600; + if (tmp > 0 || IS_PLAY_TIME()) { + PLAY_NUMBER(tmp, UNIT_HOURS, 0); + } + + tmp = seconds / 60; + seconds %= 60; + if (tmp > 0) { + PLAY_NUMBER(tmp, UNIT_MINUTES, 0); + if (seconds > 0) + PUSH_NUMBER_PROMPT(SE_PROMPT_AND); + } + + if (seconds > 0) { + PLAY_NUMBER(seconds, UNIT_SECONDS, 0); + } +} + +LANGUAGE_PACK_DECLARE(se, "Swedish"); + +#endif diff --git a/radio/src/translations/tts_sk.cpp b/radio/src/translations/tts_sk.cpp index 1952b0d04..13f04a397 100644 --- a/radio/src/translations/tts_sk.cpp +++ b/radio/src/translations/tts_sk.cpp @@ -1,257 +1,257 @@ -/* - * Authors (alphabetical order) - * - Andre Bernet - * - Andreas Weitl - * - Bertrand Songis - * - Bryan J. Rentoul (Gruvin) - * - Cameron Weeks - * - Erez Raviv - * - Gabriel Birkus - * - Jean-Pierre Parisy - * - Karl Szmutny - * - Martin Hotar - * - Michael Blandford - * - Michal Hlavinka - * - Pat Mackenzie - * - Philip Moss - * - Rob Thomson - * - Romolo Manfredini - * - Thomas Husterer - * - * opentx is based on code named - * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, - * er9x by Erez Raviv: http://code.google.com/p/er9x/, - * and the original (and ongoing) project by - * Thomas Husterer, th9x: http://code.google.com/p/th9x/ - * - * 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 - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "opentx.h" - -enum SlovakPrompts { - SK_PROMPT_NUMBERS_BASE = 0, - SK_PROMPT_NULA = SK_PROMPT_NUMBERS_BASE+0, //0-99 - SK_PROMPT_STO = SK_PROMPT_NUMBERS_BASE+100, //100,200 .. 900 - SK_PROMPT_TISIC = SK_PROMPT_NUMBERS_BASE+109, //1000 - SK_PROMPT_DVETISIC = SK_PROMPT_NUMBERS_BASE+110, - SK_PROMPT_JEDEN = SK_PROMPT_NUMBERS_BASE+111, - SK_PROMPT_JEDNO = SK_PROMPT_NUMBERS_BASE+112, - SK_PROMPT_DVE = SK_PROMPT_NUMBERS_BASE+113, - SK_PROMPT_CELA = SK_PROMPT_NUMBERS_BASE+114, - SK_PROMPT_CELE = SK_PROMPT_NUMBERS_BASE+115, - SK_PROMPT_CELYCH = SK_PROMPT_NUMBERS_BASE+116, - SK_PROMPT_MINUS = SK_PROMPT_NUMBERS_BASE+117, - - SK_PROMPT_UNITS_BASE = 118, //(jeden)volt,(dva)volty,(pet)voltu,(desetina)voltu - -}; - -#if defined(VOICE) - -#if defined(CPUARM) - #define SK_PUSH_UNIT_PROMPT(p, u) sk_pushUnitPrompt((p), (u), id) -#else - #define SK_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u)) -#endif - -#define MUZSKY 0x80 -#define ZENSKY 0x81 -#define STREDNI 0x82 - -I18N_PLAY_FUNCTION(sk, pushUnitPrompt, int16_t number, uint8_t unitprompt) -{ -#if defined(CPUARM) - if (number == 1) - PUSH_UNIT_PROMPT(unitprompt, 0); - else if (number > 1 && number < 5) - PUSH_UNIT_PROMPT(unitprompt, 1); - else - PUSH_UNIT_PROMPT(unitprompt, 2); -#else - unitprompt = SK_PROMPT_UNITS_BASE + unitprompt*4; - if (number == 1) - PUSH_NUMBER_PROMPT(unitprompt); - else if (number > 1 && number < 5) - PUSH_NUMBER_PROMPT(unitprompt+1); - else - PUSH_NUMBER_PROMPT(unitprompt+2); -#endif -} - -I18N_PLAY_FUNCTION(sk, playNumber, getvalue_t number, uint8_t unit, uint8_t att) -{ - - if (number < 0) { - PUSH_NUMBER_PROMPT(SK_PROMPT_MINUS); - number = -number; - } - -#if !defined(CPUARM) - if (unit) { - unit--; - convertUnit(number, unit); - if (IS_IMPERIAL_ENABLE()) { - if (unit == UNIT_DIST) { - unit = UNIT_FEET; - } - if (unit == UNIT_SPEED) { - unit = UNIT_KTS; - } - } - unit++; - } -#endif - - int8_t mode = MODE(att); - if (mode > 0) { -#if defined(CPUARM) - if (mode == 2) { - number /= 10; - } -#else - // we assume that we are PREC1 -#endif - div_t qr = div(number, 10); - if (qr.rem) { - PLAY_NUMBER(qr.quot, 0, ZENSKY); - if (qr.quot == 0) - PUSH_NUMBER_PROMPT(SK_PROMPT_CELA); - else - SK_PUSH_UNIT_PROMPT(qr.quot, SK_PROMPT_CELA); - PLAY_NUMBER(qr.rem, 0, ZENSKY); - PUSH_NUMBER_PROMPT(SK_PROMPT_UNITS_BASE+((unit-1)*4)+3); - return; - } - else { - number = qr.quot; - } - } - - int16_t tmp = number; - -#if defined(CPUARM) - switch(unit) { - case 0: - break; - case 6: - case 8: - case 10: - case 14: - case 17: - case 21: - case 22: - case 23: - case 24: - att = ZENSKY; - break; - case 13: - case 18: - att = STREDNI; - break; - default: - att = MUZSKY; - break; - } -#else - switch(unit) { - case 0: - break; - case 4: - case 10: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - att = ZENSKY; - break; - case 8: - case 19: - att = STREDNI; - break; - default: - att = MUZSKY; - break; - } -#endif - - if ((number == 1) && (att == MUZSKY)) { - PUSH_NUMBER_PROMPT(SK_PROMPT_JEDEN); - number = -1; - } - - if ((number == 1) && (att == STREDNI)) { - PUSH_NUMBER_PROMPT(SK_PROMPT_JEDNO); - number = -1; - } - - if ((number == 2) && ((att == ZENSKY) || (att == STREDNI))) { - PUSH_NUMBER_PROMPT(SK_PROMPT_DVE); - number = -1; - } - - if (number >= 1000) { - if (number >= 3000) - PLAY_NUMBER(number / 1000, 0, 0); - if (number >= 2000 && number < 3000) - PUSH_NUMBER_PROMPT(SK_PROMPT_DVETISIC); - else - PUSH_NUMBER_PROMPT(SK_PROMPT_TISIC); - - number %= 1000; - if (number == 0) - number = -1; - } - if (number >= 100) { - PUSH_NUMBER_PROMPT(SK_PROMPT_STO + (number/100)-1); - number %= 100; - if (number == 0) - number = -1; - } - - if (number >= 0) { - PUSH_NUMBER_PROMPT(SK_PROMPT_NULA+number); - } - - if (unit) { - SK_PUSH_UNIT_PROMPT(tmp, unit); - } -} - -I18N_PLAY_FUNCTION(sk, playDuration, int seconds PLAY_DURATION_ATT) -{ - if (seconds < 0) { - PUSH_NUMBER_PROMPT(SK_PROMPT_MINUS); - seconds = -seconds; - } - - uint8_t tmp = seconds / 3600; - seconds %= 3600; - if (tmp > 0 || IS_PLAY_TIME()) { - PLAY_NUMBER(tmp, UNIT_HOURS, ZENSKY); - } - - tmp = seconds / 60; - seconds %= 60; - if (tmp > 0) { - PLAY_NUMBER(tmp, UNIT_MINUTES, ZENSKY); - } - - if (seconds > 0) { - PLAY_NUMBER(seconds, UNIT_SECONDS, ZENSKY); - } -} - -LANGUAGE_PACK_DECLARE(sk, "Slovak"); - -#endif +/* + * Authors (alphabetical order) + * - Andre Bernet + * - Andreas Weitl + * - Bertrand Songis + * - Bryan J. Rentoul (Gruvin) + * - Cameron Weeks + * - Erez Raviv + * - Gabriel Birkus + * - Jean-Pierre Parisy + * - Karl Szmutny + * - Martin Hotar + * - Michael Blandford + * - Michal Hlavinka + * - Pat Mackenzie + * - Philip Moss + * - Rob Thomson + * - Romolo Manfredini + * - Thomas Husterer + * + * opentx is based on code named + * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, + * er9x by Erez Raviv: http://code.google.com/p/er9x/, + * and the original (and ongoing) project by + * Thomas Husterer, th9x: http://code.google.com/p/th9x/ + * + * 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 + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include "opentx.h" + +enum SlovakPrompts { + SK_PROMPT_NUMBERS_BASE = 0, + SK_PROMPT_NULA = SK_PROMPT_NUMBERS_BASE+0, //0-99 + SK_PROMPT_STO = SK_PROMPT_NUMBERS_BASE+100, //100,200 .. 900 + SK_PROMPT_TISIC = SK_PROMPT_NUMBERS_BASE+109, //1000 + SK_PROMPT_DVETISIC = SK_PROMPT_NUMBERS_BASE+110, + SK_PROMPT_JEDEN = SK_PROMPT_NUMBERS_BASE+111, + SK_PROMPT_JEDNO = SK_PROMPT_NUMBERS_BASE+112, + SK_PROMPT_DVE = SK_PROMPT_NUMBERS_BASE+113, + SK_PROMPT_CELA = SK_PROMPT_NUMBERS_BASE+114, + SK_PROMPT_CELE = SK_PROMPT_NUMBERS_BASE+115, + SK_PROMPT_CELYCH = SK_PROMPT_NUMBERS_BASE+116, + SK_PROMPT_MINUS = SK_PROMPT_NUMBERS_BASE+117, + + SK_PROMPT_UNITS_BASE = 118, //(jeden)volt,(dva)volty,(pet)voltu,(desetina)voltu + +}; + +#if defined(VOICE) + +#if defined(CPUARM) + #define SK_PUSH_UNIT_PROMPT(p, u) sk_pushUnitPrompt((p), (u), id) +#else + #define SK_PUSH_UNIT_PROMPT(p, u) pushUnitPrompt((p), (u)) +#endif + +#define MUZSKY 0x80 +#define ZENSKY 0x81 +#define STREDNI 0x82 + +I18N_PLAY_FUNCTION(sk, pushUnitPrompt, int16_t number, uint8_t unitprompt) +{ +#if defined(CPUARM) + if (number == 1) + PUSH_UNIT_PROMPT(unitprompt, 0); + else if (number > 1 && number < 5) + PUSH_UNIT_PROMPT(unitprompt, 1); + else + PUSH_UNIT_PROMPT(unitprompt, 2); +#else + unitprompt = SK_PROMPT_UNITS_BASE + unitprompt*4; + if (number == 1) + PUSH_NUMBER_PROMPT(unitprompt); + else if (number > 1 && number < 5) + PUSH_NUMBER_PROMPT(unitprompt+1); + else + PUSH_NUMBER_PROMPT(unitprompt+2); +#endif +} + +I18N_PLAY_FUNCTION(sk, playNumber, getvalue_t number, uint8_t unit, uint8_t att) +{ + + if (number < 0) { + PUSH_NUMBER_PROMPT(SK_PROMPT_MINUS); + number = -number; + } + +#if !defined(CPUARM) + if (unit) { + unit--; + convertUnit(number, unit); + if (IS_IMPERIAL_ENABLE()) { + if (unit == UNIT_DIST) { + unit = UNIT_FEET; + } + if (unit == UNIT_SPEED) { + unit = UNIT_KTS; + } + } + unit++; + } +#endif + + int8_t mode = MODE(att); + if (mode > 0) { +#if defined(CPUARM) + if (mode == 2) { + number /= 10; + } +#else + // we assume that we are PREC1 +#endif + div_t qr = div((int)number, 10); + if (qr.rem) { + PLAY_NUMBER(qr.quot, 0, ZENSKY); + if (qr.quot == 0) + PUSH_NUMBER_PROMPT(SK_PROMPT_CELA); + else + SK_PUSH_UNIT_PROMPT(qr.quot, SK_PROMPT_CELA); + PLAY_NUMBER(qr.rem, 0, ZENSKY); + PUSH_NUMBER_PROMPT(SK_PROMPT_UNITS_BASE+((unit-1)*4)+3); + return; + } + else { + number = qr.quot; + } + } + + int16_t tmp = number; + +#if defined(CPUARM) + switch(unit) { + case 0: + break; + case 6: + case 8: + case 10: + case 14: + case 17: + case 21: + case 22: + case 23: + case 24: + att = ZENSKY; + break; + case 13: + case 18: + att = STREDNI; + break; + default: + att = MUZSKY; + break; + } +#else + switch(unit) { + case 0: + break; + case 4: + case 10: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + att = ZENSKY; + break; + case 8: + case 19: + att = STREDNI; + break; + default: + att = MUZSKY; + break; + } +#endif + + if ((number == 1) && (att == MUZSKY)) { + PUSH_NUMBER_PROMPT(SK_PROMPT_JEDEN); + number = -1; + } + + if ((number == 1) && (att == STREDNI)) { + PUSH_NUMBER_PROMPT(SK_PROMPT_JEDNO); + number = -1; + } + + if ((number == 2) && ((att == ZENSKY) || (att == STREDNI))) { + PUSH_NUMBER_PROMPT(SK_PROMPT_DVE); + number = -1; + } + + if (number >= 1000) { + if (number >= 3000) + PLAY_NUMBER(number / 1000, 0, 0); + if (number >= 2000 && number < 3000) + PUSH_NUMBER_PROMPT(SK_PROMPT_DVETISIC); + else + PUSH_NUMBER_PROMPT(SK_PROMPT_TISIC); + + number %= 1000; + if (number == 0) + number = -1; + } + if (number >= 100) { + PUSH_NUMBER_PROMPT(SK_PROMPT_STO + (number/100)-1); + number %= 100; + if (number == 0) + number = -1; + } + + if (number >= 0) { + PUSH_NUMBER_PROMPT(SK_PROMPT_NULA+number); + } + + if (unit) { + SK_PUSH_UNIT_PROMPT(tmp, unit); + } +} + +I18N_PLAY_FUNCTION(sk, playDuration, int seconds PLAY_DURATION_ATT) +{ + if (seconds < 0) { + PUSH_NUMBER_PROMPT(SK_PROMPT_MINUS); + seconds = -seconds; + } + + uint8_t tmp = seconds / 3600; + seconds %= 3600; + if (tmp > 0 || IS_PLAY_TIME()) { + PLAY_NUMBER(tmp, UNIT_HOURS, ZENSKY); + } + + tmp = seconds / 60; + seconds %= 60; + if (tmp > 0) { + PLAY_NUMBER(tmp, UNIT_MINUTES, ZENSKY); + } + + if (seconds > 0) { + PLAY_NUMBER(seconds, UNIT_SECONDS, ZENSKY); + } +} + +LANGUAGE_PACK_DECLARE(sk, "Slovak"); + +#endif