mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 04:45:24 +03:00
Merge branch 'master' into betaflight
Conflicts: src/main/drivers/accgyro_mpu3050.c src/main/drivers/accgyro_mpu6050.c src/main/drivers/accgyro_spi_mpu6000.c src/main/drivers/accgyro_spi_mpu6500.c src/main/drivers/sensor.h
This commit is contained in:
commit
dae052632c
24 changed files with 201 additions and 92 deletions
|
@ -47,7 +47,7 @@ void registerExti15_10_CallbackHandler(extiCallbackHandler *fn)
|
|||
return;
|
||||
}
|
||||
}
|
||||
failureMode(15); // EXTI15_10_CALLBACK_HANDLER_COUNT is too low for the amount of handlers required.
|
||||
failureMode(FAILURE_DEVELOPER); // EXTI15_10_CALLBACK_HANDLER_COUNT is too low for the amount of handlers required.
|
||||
}
|
||||
|
||||
void unregisterExti15_10_CallbackHandler(extiCallbackHandler *fn)
|
||||
|
@ -193,21 +193,49 @@ void delay(uint32_t ms)
|
|||
delayMicroseconds(1000);
|
||||
}
|
||||
|
||||
// FIXME replace mode with an enum so usage can be tracked, currently mode is a magic number
|
||||
void failureMode(uint8_t mode)
|
||||
{
|
||||
uint8_t flashesRemaining = 10;
|
||||
#define SHORT_FLASH_DURATION 50
|
||||
#define CODE_FLASH_DURATION 250
|
||||
|
||||
LED1_ON;
|
||||
LED0_OFF;
|
||||
while (flashesRemaining--) {
|
||||
LED1_TOGGLE;
|
||||
LED0_TOGGLE;
|
||||
delay(475 * mode - 2);
|
||||
BEEP_ON;
|
||||
delay(25);
|
||||
BEEP_OFF;
|
||||
void failureMode(failureMode_e mode)
|
||||
{
|
||||
int codeRepeatsRemaining = 10;
|
||||
int codeFlashesRemaining;
|
||||
int shortFlashesRemaining;
|
||||
|
||||
while (codeRepeatsRemaining--) {
|
||||
LED1_ON;
|
||||
LED0_OFF;
|
||||
shortFlashesRemaining = 5;
|
||||
codeFlashesRemaining = mode + 1;
|
||||
uint8_t flashDuration = SHORT_FLASH_DURATION;
|
||||
|
||||
while (shortFlashesRemaining || codeFlashesRemaining) {
|
||||
LED1_TOGGLE;
|
||||
LED0_TOGGLE;
|
||||
BEEP_ON;
|
||||
delay(flashDuration);
|
||||
|
||||
LED1_TOGGLE;
|
||||
LED0_TOGGLE;
|
||||
BEEP_OFF;
|
||||
delay(flashDuration);
|
||||
|
||||
if (shortFlashesRemaining) {
|
||||
shortFlashesRemaining--;
|
||||
if (shortFlashesRemaining == 0) {
|
||||
delay(500);
|
||||
flashDuration = CODE_FLASH_DURATION;
|
||||
}
|
||||
} else {
|
||||
codeFlashesRemaining--;
|
||||
}
|
||||
}
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
systemReset();
|
||||
#else
|
||||
systemResetToBootloader();
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue