mirror of
https://github.com/opentx/opentx.git
synced 2025-07-25 17:25:13 +03:00
[Horus] Refactoring for the new fatal errors
This commit is contained in:
parent
855814655e
commit
82b9ecc155
25 changed files with 165 additions and 75 deletions
|
@ -68,6 +68,7 @@ typedef __int24 int24_t;
|
||||||
#endif
|
#endif
|
||||||
#define NOINLINE __attribute__ ((noinline))
|
#define NOINLINE __attribute__ ((noinline))
|
||||||
#define SIMU_SLEEP(x)
|
#define SIMU_SLEEP(x)
|
||||||
|
#define SIMU_SLEEP_NORET(x)
|
||||||
#define CONVERT_PTR_UINT(x) ((uint32_t)(x))
|
#define CONVERT_PTR_UINT(x) ((uint32_t)(x))
|
||||||
#define CONVERT_UINT_PTR(x) ((uint32_t *)(x))
|
#define CONVERT_UINT_PTR(x) ((uint32_t *)(x))
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -63,4 +63,30 @@ swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, event_t e
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void drawFatalErrorScreen(const char * message)
|
||||||
|
{
|
||||||
|
lcdClear();
|
||||||
|
lcdDrawText(LCD_W/2, LCD_H/2-20, message, DBLSIZE|CENTERED|TEXT_BGCOLOR);
|
||||||
|
lcdRefresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
void runFatalErrorScreen(const char * message)
|
||||||
|
{
|
||||||
|
while (1) {
|
||||||
|
drawFatalErrorScreen(message);
|
||||||
|
uint8_t refresh = false;
|
||||||
|
while (1) {
|
||||||
|
uint32_t pwr_check = pwrCheck();
|
||||||
|
if (pwr_check == e_power_off) {
|
||||||
|
boardOff();
|
||||||
|
}
|
||||||
|
else if (pwr_check == e_power_press) {
|
||||||
|
refresh = true;
|
||||||
|
}
|
||||||
|
else if (pwr_check == e_power_on && refresh) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
SIMU_SLEEP_NORET(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -105,6 +105,8 @@ void drawStringWithIndex(coord_t x, coord_t y, const char * str, int idx, LcdFla
|
||||||
int editChoice(coord_t x, coord_t y, const char * values, int value, int min, int max, LcdFlags flags, event_t event);
|
int editChoice(coord_t x, coord_t y, const char * values, int value, int min, int max, LcdFlags flags, event_t event);
|
||||||
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, LcdFlags flags, event_t event);
|
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, LcdFlags flags, event_t event);
|
||||||
swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags flags, event_t event);
|
swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags flags, event_t event);
|
||||||
|
void drawFatalErrorScreen(const char * message);
|
||||||
|
void runFatalErrorScreen(const char * message);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _GUI_COMMON_H_
|
#endif // _GUI_COMMON_H_
|
||||||
|
|
|
@ -406,7 +406,9 @@ void perMain()
|
||||||
doLoopCommonActions();
|
doLoopCommonActions();
|
||||||
#if defined(NAVIGATION_STICKS)
|
#if defined(NAVIGATION_STICKS)
|
||||||
uint8_t sticks_evt = getSticksNavigationEvent();
|
uint8_t sticks_evt = getSticksNavigationEvent();
|
||||||
if (sticks_evt) evt = sticks_evt;
|
if (sticks_evt) {
|
||||||
|
evt = sticks_evt;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(RAMBACKUP)
|
#if defined(RAMBACKUP)
|
||||||
|
@ -419,6 +421,7 @@ void perMain()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(EEPROM)
|
#if !defined(EEPROM)
|
||||||
|
// In case the SD card is removed during the session
|
||||||
if (!SD_CARD_PRESENT()) {
|
if (!SD_CARD_PRESENT()) {
|
||||||
lcd->clear();
|
lcd->clear();
|
||||||
lcdDrawText(LCD_W/2, LCD_H/2-20, STR_NO_SDCARD, DBLSIZE|CENTERED|TEXT_BGCOLOR);
|
lcdDrawText(LCD_W/2, LCD_H/2-20, STR_NO_SDCARD, DBLSIZE|CENTERED|TEXT_BGCOLOR);
|
||||||
|
|
|
@ -2706,6 +2706,18 @@ int main()
|
||||||
init_rotary_sw();
|
init_rotary_sw();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PCBHORUS)
|
||||||
|
if (!IS_FIRMWARE_COMPATIBLE_WITH_BOARD()) {
|
||||||
|
runFatalErrorScreen(STR_WRONG_PCBREV);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(EEPROM)
|
||||||
|
if (!SD_CARD_PRESENT()) {
|
||||||
|
runFatalErrorScreen(STR_NO_SDCARD);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
tasksStart();
|
tasksStart();
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -23,13 +23,24 @@
|
||||||
void backlightInit()
|
void backlightInit()
|
||||||
{
|
{
|
||||||
GPIO_InitTypeDef GPIO_InitStructure;
|
GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
GPIO_InitStructure.GPIO_Pin = BL_GPIO_PIN;
|
if (IS_HORUS_PROD()) {
|
||||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
|
GPIO_InitStructure.GPIO_Pin = PROD_BL_GPIO_PIN;
|
||||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
|
||||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||||
GPIO_Init(BL_GPIO, &GPIO_InitStructure);
|
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
||||||
GPIO_PinAFConfig(BL_GPIO, BL_GPIO_PinSource, BL_GPIO_AF);
|
GPIO_Init(BL_GPIO, &GPIO_InitStructure);
|
||||||
|
GPIO_PinAFConfig(BL_GPIO, PROD_BL_GPIO_PinSource, PROD_BL_GPIO_AF);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
GPIO_InitStructure.GPIO_Pin = BETA_BL_GPIO_PIN;
|
||||||
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
|
||||||
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||||
|
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||||
|
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
||||||
|
GPIO_Init(BL_GPIO, &GPIO_InitStructure);
|
||||||
|
GPIO_PinAFConfig(BL_GPIO, BETA_BL_GPIO_PinSource, BETA_BL_GPIO_AF);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void backlightEnable(uint8_t dutyCycle)
|
void backlightEnable(uint8_t dutyCycle)
|
||||||
|
@ -51,31 +62,36 @@ void backlightEnable(uint8_t dutyCycle)
|
||||||
TIM_TimeBaseStructure.TIM_Period = 100;
|
TIM_TimeBaseStructure.TIM_Period = 100;
|
||||||
TIM_TimeBaseStructure.TIM_ClockDivision = 0;
|
TIM_TimeBaseStructure.TIM_ClockDivision = 0;
|
||||||
TIM_TimeBaseStructure.TIM_RepetitionCounter = 0;
|
TIM_TimeBaseStructure.TIM_RepetitionCounter = 0;
|
||||||
TIM_TimeBaseInit(BL_TIMER, &TIM_TimeBaseStructure);
|
if (IS_HORUS_PROD()) {
|
||||||
|
TIM_TimeBaseInit(PROD_BL_TIMER, &TIM_TimeBaseStructure);
|
||||||
TIM_Cmd(BL_TIMER, DISABLE);
|
TIM_Cmd(PROD_BL_TIMER, DISABLE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TIM_TimeBaseInit(BETA_BL_TIMER, &TIM_TimeBaseStructure);
|
||||||
|
TIM_Cmd(BETA_BL_TIMER, DISABLE);
|
||||||
|
}
|
||||||
|
|
||||||
/* PWM mode */
|
/* PWM mode */
|
||||||
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;
|
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;
|
||||||
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
|
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
|
||||||
TIM_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Enable;
|
TIM_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Enable;
|
||||||
#if PCBREV >= 13
|
if (IS_HORUS_PROD())
|
||||||
TIM_OCInitStructure.TIM_Pulse = dutyCycle;
|
TIM_OCInitStructure.TIM_Pulse = dutyCycle;
|
||||||
#else
|
else
|
||||||
TIM_OCInitStructure.TIM_Pulse = (100 - dutyCycle);
|
TIM_OCInitStructure.TIM_Pulse = (100 - dutyCycle);
|
||||||
#endif
|
|
||||||
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
|
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
|
||||||
TIM_OCInitStructure.TIM_OCNPolarity = TIM_OCNPolarity_High;
|
TIM_OCInitStructure.TIM_OCNPolarity = TIM_OCNPolarity_High;
|
||||||
TIM_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Set;
|
TIM_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Set;
|
||||||
TIM_OCInitStructure.TIM_OCNIdleState = TIM_OCNIdleState_Set;
|
TIM_OCInitStructure.TIM_OCNIdleState = TIM_OCNIdleState_Set;
|
||||||
#if PCBREV >= 13
|
if (IS_HORUS_PROD()) {
|
||||||
TIM_OC4Init(BL_TIMER, &TIM_OCInitStructure);
|
TIM_OC4Init(PROD_BL_TIMER, &TIM_OCInitStructure);
|
||||||
#else
|
TIM_Cmd(PROD_BL_TIMER, ENABLE);
|
||||||
TIM_OC1Init(BL_TIMER, &TIM_OCInitStructure);
|
TIM_CtrlPWMOutputs(PROD_BL_TIMER, ENABLE);
|
||||||
#endif
|
}
|
||||||
|
else {
|
||||||
TIM_Cmd(BL_TIMER, ENABLE);
|
TIM_OC1Init(BETA_BL_TIMER, &TIM_OCInitStructure);
|
||||||
TIM_CtrlPWMOutputs(BL_TIMER, ENABLE);
|
TIM_Cmd(BETA_BL_TIMER, ENABLE);
|
||||||
|
TIM_CtrlPWMOutputs(BETA_BL_TIMER, ENABLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -39,20 +39,6 @@ void watchdogInit(unsigned int duration)
|
||||||
IWDG->KR = 0xCCCC; // start
|
IWDG->KR = 0xCCCC; // start
|
||||||
}
|
}
|
||||||
|
|
||||||
void getCPUUniqueID(char * s)
|
|
||||||
{
|
|
||||||
#if defined(SIMU)
|
|
||||||
uint32_t cpu_uid[3] = {0x12345678, 0x55AA55AA, 0x87654321};
|
|
||||||
#else
|
|
||||||
uint32_t * cpu_uid = (uint32_t *)0x1FFF7A10;
|
|
||||||
#endif
|
|
||||||
char * tmp = strAppendUnsigned(s, cpu_uid[0], 8, 16);
|
|
||||||
*tmp = ' ';
|
|
||||||
tmp = strAppendUnsigned(tmp+1, cpu_uid[1], 8, 16);
|
|
||||||
*tmp = ' ';
|
|
||||||
strAppendUnsigned(tmp+1, cpu_uid[2], 8, 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start TIMER7 at 2000000Hz
|
// Start TIMER7 at 2000000Hz
|
||||||
void init2MhzTimer()
|
void init2MhzTimer()
|
||||||
{
|
{
|
||||||
|
@ -116,9 +102,11 @@ void boardInit()
|
||||||
{
|
{
|
||||||
#if !defined(SIMU)
|
#if !defined(SIMU)
|
||||||
RCC_AHB1PeriphClockCmd(PWR_RCC_AHB1Periph |
|
RCC_AHB1PeriphClockCmd(PWR_RCC_AHB1Periph |
|
||||||
|
PCBREV_RCC_AHB1Periph |
|
||||||
LED_RCC_AHB1Periph |
|
LED_RCC_AHB1Periph |
|
||||||
LCD_RCC_AHB1Periph |
|
LCD_RCC_AHB1Periph |
|
||||||
BL_RCC_AHB1Periph |
|
BL_RCC_AHB1Periph |
|
||||||
|
SD_RCC_AHB1Periph |
|
||||||
AUDIO_RCC_AHB1Periph |
|
AUDIO_RCC_AHB1Periph |
|
||||||
KEYS_RCC_AHB1Periph_GPIO |
|
KEYS_RCC_AHB1Periph_GPIO |
|
||||||
ADC_RCC_AHB1Periph |
|
ADC_RCC_AHB1Periph |
|
||||||
|
@ -131,9 +119,9 @@ void boardInit()
|
||||||
EXTMODULE_RCC_AHB1Periph |
|
EXTMODULE_RCC_AHB1Periph |
|
||||||
GPS_RCC_AHB1Periph,
|
GPS_RCC_AHB1Periph,
|
||||||
ENABLE);
|
ENABLE);
|
||||||
|
|
||||||
RCC_APB1PeriphClockCmd(INTERRUPT_5MS_RCC_APB1Periph |
|
RCC_APB1PeriphClockCmd(INTERRUPT_5MS_RCC_APB1Periph |
|
||||||
TIMER_2MHz_RCC_APB1Periph |
|
TIMER_2MHz_RCC_APB1Periph |
|
||||||
BL_RCC_APB1Periph |
|
|
||||||
AUDIO_RCC_APB1Periph |
|
AUDIO_RCC_APB1Periph |
|
||||||
SERIAL_RCC_APB1Periph |
|
SERIAL_RCC_APB1Periph |
|
||||||
TELEMETRY_RCC_APB1Periph |
|
TELEMETRY_RCC_APB1Periph |
|
||||||
|
@ -144,7 +132,6 @@ void boardInit()
|
||||||
GPS_RCC_APB1Periph,
|
GPS_RCC_APB1Periph,
|
||||||
ENABLE);
|
ENABLE);
|
||||||
RCC_APB2PeriphClockCmd(LCD_RCC_APB2Periph |
|
RCC_APB2PeriphClockCmd(LCD_RCC_APB2Periph |
|
||||||
BL_RCC_APB2Periph |
|
|
||||||
ADC_RCC_APB2Periph |
|
ADC_RCC_APB2Periph |
|
||||||
HAPTIC_RCC_APB2Periph |
|
HAPTIC_RCC_APB2Periph |
|
||||||
INTMODULE_RCC_APB2Periph |
|
INTMODULE_RCC_APB2Periph |
|
||||||
|
@ -152,6 +139,13 @@ void boardInit()
|
||||||
ENABLE);
|
ENABLE);
|
||||||
|
|
||||||
pwrInit();
|
pwrInit();
|
||||||
|
|
||||||
|
// must be called after pwrInit() because the PCBREV GPIO is initialized there
|
||||||
|
if (IS_HORUS_PROD())
|
||||||
|
RCC_APB1PeriphClockCmd(PROD_BL_RCC_APB1Periph,ENABLE);
|
||||||
|
else
|
||||||
|
RCC_APB2PeriphClockCmd(BETA_BL_RCC_APB2Periph,ENABLE);
|
||||||
|
|
||||||
delaysInit();
|
delaysInit();
|
||||||
|
|
||||||
// FrSky removed the volume chip in latest board, that's why it doesn't answer!
|
// FrSky removed the volume chip in latest board, that's why it doesn't answer!
|
||||||
|
|
|
@ -95,6 +95,16 @@ void delay_ms(uint32_t ms);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// PCBREV driver
|
||||||
|
#define IS_HORUS_PROD() GPIO_ReadInputDataBit(PCBREV_GPIO, PCBREV_GPIO_PIN)
|
||||||
|
#if defined(SIMU)
|
||||||
|
#define IS_FIRMWARE_COMPATIBLE_WITH_BOARD() true
|
||||||
|
#elif PCBREV >= 13
|
||||||
|
#define IS_FIRMWARE_COMPATIBLE_WITH_BOARD() IS_HORUS_PROD()
|
||||||
|
#else
|
||||||
|
#define IS_FIRMWARE_COMPATIBLE_WITH_BOARD() (!IS_HORUS_PROD())
|
||||||
|
#endif
|
||||||
|
|
||||||
// CPU Unique ID
|
// CPU Unique ID
|
||||||
#define LEN_CPU_UID (3*8+2)
|
#define LEN_CPU_UID (3*8+2)
|
||||||
void getCPUUniqueID(char * s);
|
void getCPUUniqueID(char * s);
|
||||||
|
|
|
@ -138,6 +138,11 @@
|
||||||
#define PWR_ON_GPIO_PIN GPIO_Pin_1 // PJ.01
|
#define PWR_ON_GPIO_PIN GPIO_Pin_1 // PJ.01
|
||||||
#define PWR_SWITCH_GPIO_PIN GPIO_Pin_0 // PJ.00
|
#define PWR_SWITCH_GPIO_PIN GPIO_Pin_0 // PJ.00
|
||||||
|
|
||||||
|
// PCBREV
|
||||||
|
#define PCBREV_RCC_AHB1Periph RCC_AHB1Periph_GPIOI
|
||||||
|
#define PCBREV_GPIO GPIOI
|
||||||
|
#define PCBREV_GPIO_PIN GPIO_Pin_11 // PI.11
|
||||||
|
|
||||||
// Led
|
// Led
|
||||||
#define LED_RCC_AHB1Periph RCC_AHB1Periph_GPIOI
|
#define LED_RCC_AHB1Periph RCC_AHB1Periph_GPIOI
|
||||||
#define LED_GPIO GPIOI
|
#define LED_GPIO GPIOI
|
||||||
|
@ -201,21 +206,20 @@
|
||||||
// Backlight
|
// Backlight
|
||||||
#define BL_RCC_AHB1Periph RCC_AHB1Periph_GPIOA
|
#define BL_RCC_AHB1Periph RCC_AHB1Periph_GPIOA
|
||||||
#define BL_GPIO GPIOA
|
#define BL_GPIO GPIOA
|
||||||
#if PCBREV >= 13
|
// Production board
|
||||||
#define BL_TIMER TIM5
|
#define PROD_BL_TIMER TIM5
|
||||||
#define BL_GPIO_PIN GPIO_Pin_3 // PA.03
|
#define PROD_BL_GPIO_PIN GPIO_Pin_3 // PA.03
|
||||||
#define BL_GPIO_PinSource GPIO_PinSource3
|
#define PROD_BL_GPIO_PinSource GPIO_PinSource3
|
||||||
#define BL_RCC_APB1Periph RCC_APB1Periph_TIM5
|
#define PROD_BL_RCC_APB1Periph RCC_APB1Periph_TIM5
|
||||||
#define BL_RCC_APB2Periph 0
|
#define PROD_BL_RCC_APB2Periph 0
|
||||||
#define BL_GPIO_AF GPIO_AF_TIM5
|
#define PROD_BL_GPIO_AF GPIO_AF_TIM5
|
||||||
#else
|
// Beta board
|
||||||
#define BL_TIMER TIM8
|
#define BETA_BL_TIMER TIM8
|
||||||
#define BL_GPIO_PIN GPIO_Pin_5 // PA.05
|
#define BETA_BL_GPIO_PIN GPIO_Pin_5 // PA.05
|
||||||
#define BL_GPIO_PinSource GPIO_PinSource5
|
#define BETA_BL_GPIO_PinSource GPIO_PinSource5
|
||||||
#define BL_RCC_APB1Periph 0
|
#define BETA_BL_RCC_APB1Periph 0
|
||||||
#define BL_RCC_APB2Periph RCC_APB2Periph_TIM8
|
#define BETA_BL_RCC_APB2Periph RCC_APB2Periph_TIM8
|
||||||
#define BL_GPIO_AF GPIO_AF_TIM8
|
#define BETA_BL_GPIO_AF GPIO_AF_TIM8
|
||||||
#endif
|
|
||||||
|
|
||||||
// SD
|
// SD
|
||||||
#define SD_RCC_AHB1Periph (RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_DMA2)
|
#define SD_RCC_AHB1Periph (RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_DMA2)
|
||||||
|
|
|
@ -39,7 +39,6 @@ void pwrInit()
|
||||||
GPIO_Init(AUDIO_SHUTDOWN_GPIO, &GPIO_InitStructure);
|
GPIO_Init(AUDIO_SHUTDOWN_GPIO, &GPIO_InitStructure);
|
||||||
|
|
||||||
// Init Module PWR
|
// Init Module PWR
|
||||||
// TODO not here
|
|
||||||
GPIO_ResetBits(INTMODULE_PWR_GPIO, INTMODULE_PWR_GPIO_PIN);
|
GPIO_ResetBits(INTMODULE_PWR_GPIO, INTMODULE_PWR_GPIO_PIN);
|
||||||
GPIO_InitStructure.GPIO_Pin = INTMODULE_PWR_GPIO_PIN;
|
GPIO_InitStructure.GPIO_Pin = INTMODULE_PWR_GPIO_PIN;
|
||||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
||||||
|
@ -50,6 +49,17 @@ void pwrInit()
|
||||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
||||||
GPIO_Init(EXTMODULE_PWR_GPIO, &GPIO_InitStructure);
|
GPIO_Init(EXTMODULE_PWR_GPIO, &GPIO_InitStructure);
|
||||||
|
|
||||||
|
// Init PCBREV PIN
|
||||||
|
GPIO_ResetBits(PCBREV_GPIO, PCBREV_GPIO_PIN);
|
||||||
|
GPIO_InitStructure.GPIO_Pin = PCBREV_GPIO_PIN;
|
||||||
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
||||||
|
GPIO_Init(PCBREV_GPIO, &GPIO_InitStructure);
|
||||||
|
|
||||||
|
// Init SD-DETECT PIN
|
||||||
|
GPIO_ResetBits(SD_PRESENT_GPIO, SD_PRESENT_GPIO_PIN);
|
||||||
|
GPIO_InitStructure.GPIO_Pin = SD_PRESENT_GPIO_PIN;
|
||||||
|
GPIO_Init(SD_PRESENT_GPIO, &GPIO_InitStructure);
|
||||||
|
|
||||||
pwrOn();
|
pwrOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,8 +198,6 @@ void SD_LowLevel_Init(void)
|
||||||
{
|
{
|
||||||
GPIO_InitTypeDef GPIO_InitStructure;
|
GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
|
|
||||||
RCC_AHB1PeriphClockCmd(SD_RCC_AHB1Periph, ENABLE);
|
|
||||||
|
|
||||||
GPIO_PinAFConfig(GPIOC, GPIO_PinSource8, GPIO_AF_SDIO);
|
GPIO_PinAFConfig(GPIOC, GPIO_PinSource8, GPIO_AF_SDIO);
|
||||||
GPIO_PinAFConfig(GPIOC, GPIO_PinSource9, GPIO_AF_SDIO);
|
GPIO_PinAFConfig(GPIOC, GPIO_PinSource9, GPIO_AF_SDIO);
|
||||||
GPIO_PinAFConfig(GPIOC, GPIO_PinSource10, GPIO_AF_SDIO);
|
GPIO_PinAFConfig(GPIOC, GPIO_PinSource10, GPIO_AF_SDIO);
|
||||||
|
@ -224,11 +222,6 @@ void SD_LowLevel_Init(void)
|
||||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
||||||
GPIO_Init(GPIOC, &GPIO_InitStructure);
|
GPIO_Init(GPIOC, &GPIO_InitStructure);
|
||||||
|
|
||||||
GPIO_InitStructure.GPIO_Pin = SD_PRESENT_GPIO_PIN;
|
|
||||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
|
||||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
|
||||||
GPIO_Init(SD_PRESENT_GPIO, &GPIO_InitStructure);
|
|
||||||
|
|
||||||
/* Enable the SDIO APB2 Clock */
|
/* Enable the SDIO APB2 Clock */
|
||||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SDIO, ENABLE);
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SDIO, ENABLE);
|
||||||
|
|
||||||
|
|
|
@ -45,9 +45,7 @@ uint8_t portb, portc, porth=0, dummyport;
|
||||||
uint16_t dummyport16;
|
uint16_t dummyport16;
|
||||||
int g_snapshot_idx = 0;
|
int g_snapshot_idx = 0;
|
||||||
|
|
||||||
#if !defined(CPUARM)
|
|
||||||
pthread_t main_thread_pid;
|
pthread_t main_thread_pid;
|
||||||
#endif
|
|
||||||
uint8_t main_thread_running = 0;
|
uint8_t main_thread_running = 0;
|
||||||
char * main_thread_error = NULL;
|
char * main_thread_error = NULL;
|
||||||
|
|
||||||
|
@ -337,11 +335,7 @@ void StartSimu(bool tests)
|
||||||
try {
|
try {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CPUARM)
|
pthread_create(&main_thread_pid, NULL, &simuMain, NULL);
|
||||||
simuMain();
|
|
||||||
#else
|
|
||||||
pthread_create(&main_thread_pid, NULL, &simuMain, NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(SIMU_EXCEPTIONS)
|
#if defined(SIMU_EXCEPTIONS)
|
||||||
}
|
}
|
||||||
|
@ -357,9 +351,8 @@ void StopSimu()
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
pthread_join(mixerTaskId, NULL);
|
pthread_join(mixerTaskId, NULL);
|
||||||
pthread_join(menusTaskId, NULL);
|
pthread_join(menusTaskId, NULL);
|
||||||
#else
|
|
||||||
pthread_join(main_thread_pid, NULL);
|
|
||||||
#endif
|
#endif
|
||||||
|
pthread_join(main_thread_pid, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
|
|
|
@ -492,6 +492,8 @@ const pm_char STR_ALARMSWARN[] PROGMEM = TR_ALARMSWARN;
|
||||||
const pm_char STR_SWITCHWARN[] PROGMEM = TR_SWITCHWARN;
|
const pm_char STR_SWITCHWARN[] PROGMEM = TR_SWITCHWARN;
|
||||||
const pm_char STR_FAILSAFEWARN[] PROGMEM = TR_FAILSAFEWARN;
|
const pm_char STR_FAILSAFEWARN[] PROGMEM = TR_FAILSAFEWARN;
|
||||||
const pm_char STR_WRONG_SDCARDVERSION[] PROGMEM = TR_WRONG_SDCARDVERSION;
|
const pm_char STR_WRONG_SDCARDVERSION[] PROGMEM = TR_WRONG_SDCARDVERSION;
|
||||||
|
const pm_char STR_WRONG_PCBREV[] PROGMEM = TR_WRONG_PCBREV;
|
||||||
|
const pm_char STR_PCBREV_ERROR[] PROGMEM = TR_PCBREV_ERROR;
|
||||||
const pm_char STR_NO_FAILSAFE[] PROGMEM = TR_NO_FAILSAFE;
|
const pm_char STR_NO_FAILSAFE[] PROGMEM = TR_NO_FAILSAFE;
|
||||||
const pm_char STR_KEYSTUCK[] PROGMEM = TR_KEYSTUCK;
|
const pm_char STR_KEYSTUCK[] PROGMEM = TR_KEYSTUCK;
|
||||||
|
|
||||||
|
|
|
@ -707,6 +707,8 @@ extern const pm_char STR_ALARMSWARN[];
|
||||||
extern const pm_char STR_SWITCHWARN[];
|
extern const pm_char STR_SWITCHWARN[];
|
||||||
extern const pm_char STR_FAILSAFEWARN[];
|
extern const pm_char STR_FAILSAFEWARN[];
|
||||||
extern const pm_char STR_WRONG_SDCARDVERSION[];
|
extern const pm_char STR_WRONG_SDCARDVERSION[];
|
||||||
|
extern const pm_char STR_WRONG_PCBREV[];
|
||||||
|
extern const pm_char STR_PCBREV_ERROR[];
|
||||||
extern const pm_char STR_NO_FAILSAFE[];
|
extern const pm_char STR_NO_FAILSAFE[];
|
||||||
extern const pm_char STR_KEYSTUCK[];
|
extern const pm_char STR_KEYSTUCK[];
|
||||||
|
|
||||||
|
@ -855,7 +857,7 @@ extern const pm_char STR_BLCOLOR[];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TR_LIMITS_HEADERS { HINT(TR_LIMITS_HEADERS_NAME), HINT(TR_LIMITS_HEADERS_SUBTRIM), HINT(TR_LIMITS_HEADERS_MIN), HINT(TR_LIMITS_HEADERS_MAX), HINT(TR_LIMITS_HEADERS_DIRECTION), HINT(TR_LIMITS_HEADERS_CURVE), HINT(TR_LIMITS_HEADERS_PPMCENTER), HINT(TR_LIMITS_HEADERS_SUBTRIMMODE) }
|
#define TR_LIMITS_HEADERS { HINT(TR_LIMITS_HEADERS_NAME), HINT(TR_LIMITS_HEADERS_SUBTRIM), HINT(TR_LIMITS_HEADERS_MIN), HINT(TR_LIMITS_HEADERS_MAX), HINT(TR_LIMITS_HEADERS_DIRECTION), HINT(TR_LIMITS_HEADERS_CURVE), HINT(TR_LIMITS_HEADERS_PPMCENTER), HINT(TR_LIMITS_HEADERS_SUBTRIMMODE) }
|
||||||
#define TR_LSW_HEADERS { HINT(TR_LSW_HEADERS_FUNCTION), HINT(TR_LSW_HEADERS_V1), HINT(TR_LSW_HEADERS_V2), HINT(TR_LSW_HEADERS_V2), HINT(TR_LSW_HEADERS_ANDSW), HINT(TR_LSW_HEADERS_DURATION), HINT(TR_LSW_HEADERS_DELAY) }
|
#define TR_LSW_HEADERS { HINT(TR_LSW_HEADERS_FUNCTION), HINT(TR_LSW_HEADERS_V1), HINT(TR_LSW_HEADERS_V2), HINT(TR_LSW_HEADERS_V2), HINT(TR_LSW_HEADERS_ANDSW), HINT(TR_LSW_HEADERS_DURATION), HINT(TR_LSW_HEADERS_DELAY) }
|
||||||
|
|
||||||
#if LCD_W >= 212
|
#if LCD_W >= 212
|
||||||
extern const char * const STR_PHASES_HEADERS[];
|
extern const char * const STR_PHASES_HEADERS[];
|
||||||
|
|
|
@ -914,6 +914,8 @@
|
||||||
#define TR_SWITCHWARN "POZICE"
|
#define TR_SWITCHWARN "POZICE"
|
||||||
#define TR_FAILSAFEWARN "FAILSAFE"
|
#define TR_FAILSAFEWARN "FAILSAFE"
|
||||||
#define TR_WRONG_SDCARDVERSION "Wrong files version"
|
#define TR_WRONG_SDCARDVERSION "Wrong files version"
|
||||||
|
#define TR_WRONG_PCBREV "Wrong PCB detected"
|
||||||
|
#define TR_PCBREV_ERROR "PCB error"
|
||||||
#define TR_NO_FAILSAFE "Failsafe není nastaveno"
|
#define TR_NO_FAILSAFE "Failsafe není nastaveno"
|
||||||
#define TR_KEYSTUCK "Zaseklá klávesa"
|
#define TR_KEYSTUCK "Zaseklá klávesa"
|
||||||
#define TR_INVERT_THR "Invertovat plyn?"
|
#define TR_INVERT_THR "Invertovat plyn?"
|
||||||
|
|
|
@ -933,6 +933,8 @@
|
||||||
#define TR_SWITCHWARN "SCHALTER"
|
#define TR_SWITCHWARN "SCHALTER"
|
||||||
#define TR_FAILSAFEWARN "FAILSAFE"
|
#define TR_FAILSAFEWARN "FAILSAFE"
|
||||||
#define TR_WRONG_SDCARDVERSION "Wrong files version"
|
#define TR_WRONG_SDCARDVERSION "Wrong files version"
|
||||||
|
#define TR_WRONG_PCBREV "Wrong PCB detected"
|
||||||
|
#define TR_PCBREV_ERROR "PCB error"
|
||||||
#define TR_NO_FAILSAFE TR("Failsafe not set", "Failsafe nicht programmiert")
|
#define TR_NO_FAILSAFE TR("Failsafe not set", "Failsafe nicht programmiert")
|
||||||
#define TR_KEYSTUCK "Taste klemmt" //Key stuck=Taste klemmt
|
#define TR_KEYSTUCK "Taste klemmt" //Key stuck=Taste klemmt
|
||||||
#define TR_INVERT_THR TR("Gas umkehren?", "Vollgas hinten?") // Th9x 9XR
|
#define TR_INVERT_THR TR("Gas umkehren?", "Vollgas hinten?") // Th9x 9XR
|
||||||
|
|
|
@ -899,6 +899,8 @@
|
||||||
#define TR_SWITCHWARN TR("SWITCH", "CONTROL")
|
#define TR_SWITCHWARN TR("SWITCH", "CONTROL")
|
||||||
#define TR_FAILSAFEWARN "FAILSAFE"
|
#define TR_FAILSAFEWARN "FAILSAFE"
|
||||||
#define TR_WRONG_SDCARDVERSION "Wrong files version"
|
#define TR_WRONG_SDCARDVERSION "Wrong files version"
|
||||||
|
#define TR_WRONG_PCBREV "Wrong PCB detected"
|
||||||
|
#define TR_PCBREV_ERROR "PCB error"
|
||||||
#define TR_NO_FAILSAFE "Failsafe not set"
|
#define TR_NO_FAILSAFE "Failsafe not set"
|
||||||
#define TR_KEYSTUCK "Key stuck"
|
#define TR_KEYSTUCK "Key stuck"
|
||||||
#define TR_INVERT_THR TR("Invert thr?", "Invert throttle?")
|
#define TR_INVERT_THR TR("Invert thr?", "Invert throttle?")
|
||||||
|
|
|
@ -878,6 +878,8 @@
|
||||||
#define TR_SWITCHWARN "INTERPTOR"
|
#define TR_SWITCHWARN "INTERPTOR"
|
||||||
#define TR_FAILSAFEWARN "FAILSAFE"
|
#define TR_FAILSAFEWARN "FAILSAFE"
|
||||||
#define TR_WRONG_SDCARDVERSION "Wrong files version"
|
#define TR_WRONG_SDCARDVERSION "Wrong files version"
|
||||||
|
#define TR_WRONG_PCBREV "Wrong PCB detected"
|
||||||
|
#define TR_PCBREV_ERROR "PCB error"
|
||||||
#define TR_NO_FAILSAFE "Failsafe not set"
|
#define TR_NO_FAILSAFE "Failsafe not set"
|
||||||
#define TR_KEYSTUCK "Key stuck"
|
#define TR_KEYSTUCK "Key stuck"
|
||||||
#define TR_INVERT_THR TR("Invertir Acel?", "Invertir Acel.?")
|
#define TR_INVERT_THR TR("Invertir Acel?", "Invertir Acel.?")
|
||||||
|
|
|
@ -878,6 +878,8 @@
|
||||||
#define TR_SWITCHWARN TR("SWITCH","CONTROL")
|
#define TR_SWITCHWARN TR("SWITCH","CONTROL")
|
||||||
#define TR_FAILSAFEWARN "FAILSAFE"
|
#define TR_FAILSAFEWARN "FAILSAFE"
|
||||||
#define TR_WRONG_SDCARDVERSION "Wrong files version"
|
#define TR_WRONG_SDCARDVERSION "Wrong files version"
|
||||||
|
#define TR_WRONG_PCBREV "Wrong PCB detected"
|
||||||
|
#define TR_PCBREV_ERROR "PCB error"
|
||||||
#define TR_NO_FAILSAFE "Failsafe not set"
|
#define TR_NO_FAILSAFE "Failsafe not set"
|
||||||
#define TR_KEYSTUCK "Key stuck"
|
#define TR_KEYSTUCK "Key stuck"
|
||||||
#define TR_INVERT_THR TR("Invert Thr?","Invert Throttle?")
|
#define TR_INVERT_THR TR("Invert Thr?","Invert Throttle?")
|
||||||
|
|
|
@ -910,6 +910,8 @@
|
||||||
#define TR_SWITCHWARN TR("INTERS","CONTROLES")
|
#define TR_SWITCHWARN TR("INTERS","CONTROLES")
|
||||||
#define TR_FAILSAFEWARN "FAILSAFE"
|
#define TR_FAILSAFEWARN "FAILSAFE"
|
||||||
#define TR_WRONG_SDCARDVERSION "Version des fichiers incompatible"
|
#define TR_WRONG_SDCARDVERSION "Version des fichiers incompatible"
|
||||||
|
#define TR_WRONG_PCBREV "Wrong PCB detected"
|
||||||
|
#define TR_PCBREV_ERROR "PCB error"
|
||||||
#define TR_NO_FAILSAFE "Failsafe pas déf."
|
#define TR_NO_FAILSAFE "Failsafe pas déf."
|
||||||
#define TR_KEYSTUCK "Touche bloquée"
|
#define TR_KEYSTUCK "Touche bloquée"
|
||||||
#define TR_INVERT_THR "Inverser gaz?"
|
#define TR_INVERT_THR "Inverser gaz?"
|
||||||
|
|
|
@ -913,6 +913,8 @@
|
||||||
#define TR_SWITCHWARN "CONTROLLI"
|
#define TR_SWITCHWARN "CONTROLLI"
|
||||||
#define TR_FAILSAFEWARN "FAILSAFE"
|
#define TR_FAILSAFEWARN "FAILSAFE"
|
||||||
#define TR_WRONG_SDCARDVERSION "Wrong files version"
|
#define TR_WRONG_SDCARDVERSION "Wrong files version"
|
||||||
|
#define TR_WRONG_PCBREV "Wrong PCB detected"
|
||||||
|
#define TR_PCBREV_ERROR "PCB error"
|
||||||
#define TR_NO_FAILSAFE "Failsafe non settato"
|
#define TR_NO_FAILSAFE "Failsafe non settato"
|
||||||
#define TR_KEYSTUCK "Tasto bloccato"
|
#define TR_KEYSTUCK "Tasto bloccato"
|
||||||
#define TR_INVERT_THR "Inverti Mot?"
|
#define TR_INVERT_THR "Inverti Mot?"
|
||||||
|
|
|
@ -927,6 +927,8 @@
|
||||||
#define TR_SWITCHWARN "SCHAKELAAR"
|
#define TR_SWITCHWARN "SCHAKELAAR"
|
||||||
#define TR_FAILSAFEWARN "FAILSAFE"
|
#define TR_FAILSAFEWARN "FAILSAFE"
|
||||||
#define TR_WRONG_SDCARDVERSION "Wrong files version"
|
#define TR_WRONG_SDCARDVERSION "Wrong files version"
|
||||||
|
#define TR_WRONG_PCBREV "Wrong PCB detected"
|
||||||
|
#define TR_PCBREV_ERROR "PCB error"
|
||||||
#define TR_NO_FAILSAFE TR("Failsafe niet ing.", "Failsafe niet ingesteld")
|
#define TR_NO_FAILSAFE TR("Failsafe niet ing.", "Failsafe niet ingesteld")
|
||||||
#define TR_KEYSTUCK "Toets klemt"
|
#define TR_KEYSTUCK "Toets klemt"
|
||||||
#define TR_INVERT_THR TR("Gas omdraaien?", "Volgas achter?")
|
#define TR_INVERT_THR TR("Gas omdraaien?", "Volgas achter?")
|
||||||
|
|
|
@ -915,6 +915,8 @@
|
||||||
#define TR_SWITCHWARN TR("Przełą","Kontrola")
|
#define TR_SWITCHWARN TR("Przełą","Kontrola")
|
||||||
#define TR_FAILSAFEWARN "FAILSAFE"
|
#define TR_FAILSAFEWARN "FAILSAFE"
|
||||||
#define TR_WRONG_SDCARDVERSION "Wrong files version"
|
#define TR_WRONG_SDCARDVERSION "Wrong files version"
|
||||||
|
#define TR_WRONG_PCBREV "Wrong PCB detected"
|
||||||
|
#define TR_PCBREV_ERROR "PCB error"
|
||||||
#define TR_NO_FAILSAFE "Brak Failsafe"
|
#define TR_NO_FAILSAFE "Brak Failsafe"
|
||||||
#define TR_KEYSTUCK "Blokada klucza"
|
#define TR_KEYSTUCK "Blokada klucza"
|
||||||
#define TR_INVERT_THR TR("Odw.Gaz?","Odwróć gaz?")
|
#define TR_INVERT_THR TR("Odw.Gaz?","Odwróć gaz?")
|
||||||
|
|
|
@ -873,6 +873,8 @@
|
||||||
#define TR_SWITCHWARN "CHAVES"
|
#define TR_SWITCHWARN "CHAVES"
|
||||||
#define TR_FAILSAFEWARN "FAILSAFE"
|
#define TR_FAILSAFEWARN "FAILSAFE"
|
||||||
#define TR_WRONG_SDCARDVERSION "Wrong files version"
|
#define TR_WRONG_SDCARDVERSION "Wrong files version"
|
||||||
|
#define TR_WRONG_PCBREV "Wrong PCB detected"
|
||||||
|
#define TR_PCBREV_ERROR "PCB error"
|
||||||
#define TR_NO_FAILSAFE "Failsafe not set"
|
#define TR_NO_FAILSAFE "Failsafe not set"
|
||||||
#define TR_KEYSTUCK "Key stuck"
|
#define TR_KEYSTUCK "Key stuck"
|
||||||
#define TR_INVERT_THR "Inverte Acel?"
|
#define TR_INVERT_THR "Inverte Acel?"
|
||||||
|
|
|
@ -927,6 +927,8 @@
|
||||||
#define TR_FAILSAFEWARN "FAILSAFE"
|
#define TR_FAILSAFEWARN "FAILSAFE"
|
||||||
#define TR_SDCARDVERSIONWARN "SD Card Check"
|
#define TR_SDCARDVERSIONWARN "SD Card Check"
|
||||||
#define TR_WRONG_SDCARDVERSION "Wrong SDCARD file version"
|
#define TR_WRONG_SDCARDVERSION "Wrong SDCARD file version"
|
||||||
|
#define TR_WRONG_PCBREV "Wrong PCB detected"
|
||||||
|
#define TR_PCBREV_ERROR "PCB error"
|
||||||
#define TR_NO_FAILSAFE "Failsafe ej given"
|
#define TR_NO_FAILSAFE "Failsafe ej given"
|
||||||
#define TR_KEYSTUCK "Knapp-fel"
|
#define TR_KEYSTUCK "Knapp-fel"
|
||||||
#define TR_INVERT_THR TR("Invert.Gas?", "Invertera Gasen?")
|
#define TR_INVERT_THR TR("Invert.Gas?", "Invertera Gasen?")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue