[Horus] Red LED on error. Blue LED otherwise
This commit is contained in:
+10
-4
@@ -1238,6 +1238,7 @@ void checkTHR()
|
||||
}
|
||||
|
||||
// first - display warning; also deletes inputs if any have been before
|
||||
LED_ERROR_BEGIN();
|
||||
MESSAGE(STR_THROTTLEWARN, STR_THROTTLENOTIDLE, STR_PRESSANYKEYTOSKIP, AU_THROTTLE_ALERT);
|
||||
|
||||
#if defined(PWR_BUTTON_DELAY)
|
||||
@@ -1281,6 +1282,8 @@ void checkTHR()
|
||||
wdt_reset();
|
||||
}
|
||||
#endif
|
||||
|
||||
LED_ERROR_END();
|
||||
}
|
||||
|
||||
void checkAlarm() // added by Gohst
|
||||
@@ -1294,19 +1297,20 @@ void checkAlarm() // added by Gohst
|
||||
}
|
||||
}
|
||||
|
||||
void alert(const pm_char * t, const pm_char *s MESSAGE_SOUND_ARG)
|
||||
void alert(const pm_char * t, const pm_char * s MESSAGE_SOUND_ARG)
|
||||
{
|
||||
LED_ERROR_BEGIN();
|
||||
|
||||
MESSAGE(t, s, STR_PRESSANYKEY, sound);
|
||||
|
||||
#if defined(PWR_BUTTON_DELAY)
|
||||
bool refresh = false;
|
||||
#endif
|
||||
|
||||
while(1)
|
||||
{
|
||||
while(1) {
|
||||
SIMU_SLEEP(1);
|
||||
|
||||
if (keyDown()) return; // wait for key release
|
||||
if (keyDown()) break; // wait for key release
|
||||
|
||||
doLoopCommonActions();
|
||||
|
||||
@@ -1330,6 +1334,8 @@ void alert(const pm_char * t, const pm_char *s MESSAGE_SOUND_ARG)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
LED_ERROR_END();
|
||||
}
|
||||
|
||||
#if defined(GVARS)
|
||||
|
||||
@@ -1492,6 +1492,14 @@ extern void checkBattery();
|
||||
extern void opentxClose();
|
||||
extern void opentxInit();
|
||||
|
||||
#if defined(PCBHORUS) && !defined(SIMU)
|
||||
#define LED_ERROR_BEGIN() ledRed()
|
||||
#define LED_ERROR_END() ledBlue()
|
||||
#else
|
||||
#define LED_ERROR_BEGIN()
|
||||
#define LED_ERROR_END()
|
||||
#endif
|
||||
|
||||
// Re-useable byte array to save having multiple buffers
|
||||
#define SD_SCREEN_FILE_LENGTH (64)
|
||||
union ReusableBuffer
|
||||
|
||||
@@ -822,9 +822,11 @@ void checkSwitches()
|
||||
startupWarningState = STARTUP_WARNING_SWITCHES+1;
|
||||
last_bad_switches = 0xff;
|
||||
#endif
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
LED_ERROR_BEGIN();
|
||||
|
||||
// first - display warning
|
||||
#if defined(PCBTARANIS) || defined(PCBFLAMENCO) || defined(PCBHORUS)
|
||||
if ((last_bad_switches != switches_states) || (last_bad_pots != bad_pots)) {
|
||||
@@ -935,7 +937,7 @@ void checkSwitches()
|
||||
last_bad_switches = 0xff;
|
||||
}
|
||||
#else
|
||||
if (pwrCheck()==e_power_off || keyDown()) return;
|
||||
if (pwrCheck()==e_power_off || keyDown()) break;
|
||||
|
||||
doLoopCommonActions();
|
||||
|
||||
@@ -943,7 +945,9 @@ void checkSwitches()
|
||||
|
||||
SIMU_SLEEP(1);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
LED_ERROR_END();
|
||||
}
|
||||
#endif // GUI
|
||||
|
||||
|
||||
@@ -99,29 +99,6 @@ extern "C" void TIM8_TRG_COM_TIM14_IRQHandler()
|
||||
interrupt5ms() ;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void pinCheck(GPIO_TypeDef * gpio, uint32_t pin, uint32_t RCC_AHB1Periph)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
|
||||
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph, ENABLE);
|
||||
|
||||
GPIO_InitStruct.GPIO_Pin = pin;
|
||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;
|
||||
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
|
||||
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
||||
GPIO_Init(gpio, &GPIO_InitStruct);
|
||||
|
||||
for (int i=0; i<10; i++) {
|
||||
GPIO_SetBits(gpio, pin);
|
||||
delay_01us(10);
|
||||
GPIO_ResetBits(gpio, pin);
|
||||
delay_01us(10);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void boardInit()
|
||||
{
|
||||
RCC_AHB1PeriphClockCmd(PWR_RCC_AHB1Periph | LCD_RCC_AHB1Periph | AUDIO_RCC_AHB1Periph | KEYS_RCC_AHB1Periph_GPIO | ADC_RCC_AHB1Periph | SERIAL_RCC_AHB1Periph | TELEMETRY_RCC_AHB1Periph | AUDIO_RCC_AHB1Periph | HAPTIC_RCC_AHB1Periph | INTMODULE_RCC_AHB1Periph | EXTMODULE_RCC_AHB1Periph, ENABLE);
|
||||
@@ -135,19 +112,11 @@ void boardInit()
|
||||
// FrSky removed the volume chip in latest board, that's why it doesn't answer!
|
||||
// i2cInit();
|
||||
|
||||
if (0) {
|
||||
// pinCheck(SERIAL_GPIO, SERIAL_GPIO_PIN_TX, SERIAL_RCC_AHB1Periph_GPIO);
|
||||
// pinCheck(EEPROM_GPIO, EEPROM_GPIO_PIN_SCK, RCC_AHB1Periph_GPIOB);
|
||||
// pinCheck(EEPROM_GPIO, EEPROM_GPIO_PIN_MISO, RCC_AHB1Periph_GPIOB);
|
||||
// pinCheck(EEPROM_GPIO, EEPROM_GPIO_PIN_MOSI, RCC_AHB1Periph_GPIOB);
|
||||
}
|
||||
|
||||
serial2Init(0, 0); // default serial mode (None if DEBUG not defined)
|
||||
|
||||
__enable_irq();
|
||||
|
||||
TRACE("Horus started :)");
|
||||
ledBlue();
|
||||
|
||||
keysInit();
|
||||
adcInit();
|
||||
@@ -158,12 +127,13 @@ void boardInit()
|
||||
usbInit();
|
||||
hapticInit();
|
||||
|
||||
// rotencInit();
|
||||
// bt_open();
|
||||
|
||||
#if defined(DEBUG)
|
||||
DBGMCU_APB1PeriphConfig(DBGMCU_IWDG_STOP|DBGMCU_TIM1_STOP|DBGMCU_TIM2_STOP|DBGMCU_TIM3_STOP|DBGMCU_TIM4_STOP|DBGMCU_TIM5_STOP|DBGMCU_TIM6_STOP|DBGMCU_TIM7_STOP|DBGMCU_TIM8_STOP|DBGMCU_TIM9_STOP|DBGMCU_TIM10_STOP|DBGMCU_TIM11_STOP|DBGMCU_TIM12_STOP|DBGMCU_TIM13_STOP|DBGMCU_TIM14_STOP, ENABLE);
|
||||
#endif
|
||||
|
||||
ledBlue();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user