mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
Added the visualization of the error in BU
the error is shown as a number of slow flashes followed by 10 fast flashes. The number of slow flashes indicate the error code: 1 - Self overwrite check failed; 2 - Board hardware revision mismatch; 3 - Flash erase failed; 4 - Flash programming failed; The error code sequence will be shown indfinitely should a error occurs.
This commit is contained in:
parent
7c85fa5885
commit
a48395c7a0
@ -34,7 +34,7 @@
|
||||
/* Prototype of PIOS_Board_Init() function */
|
||||
extern void PIOS_Board_Init(void);
|
||||
extern void FLASH_Download();
|
||||
void error(int);
|
||||
void error(int,int);
|
||||
|
||||
/* The ADDRESSES of the _binary_* symbols are the important
|
||||
* data. This is non-intuitive for _binary_size where you
|
||||
@ -58,7 +58,7 @@ int main() {
|
||||
/// Self overwrite check
|
||||
uint32_t base_address = SCB->VTOR;
|
||||
if ((0x08000000 + embedded_image_size) > base_address)
|
||||
error(PIOS_LED_HEARTBEAT);
|
||||
error(PIOS_LED_HEARTBEAT,1);
|
||||
///
|
||||
|
||||
/*
|
||||
@ -80,7 +80,7 @@ int main() {
|
||||
if ((pios_board_info_blob.magic != new_board_info_blob->magic) ||
|
||||
(pios_board_info_blob.board_type != new_board_info_blob->board_type) ||
|
||||
(pios_board_info_blob.board_rev != new_board_info_blob->board_rev)) {
|
||||
error(PIOS_LED_HEARTBEAT);
|
||||
error(PIOS_LED_HEARTBEAT,2);
|
||||
}
|
||||
|
||||
/* Embedded bootloader looks like it's the right one for this HW, proceed... */
|
||||
@ -108,7 +108,7 @@ int main() {
|
||||
}
|
||||
|
||||
if (fail == true)
|
||||
error(PIOS_LED_HEARTBEAT);
|
||||
error(PIOS_LED_HEARTBEAT,3);
|
||||
|
||||
|
||||
///
|
||||
@ -124,7 +124,7 @@ int main() {
|
||||
}
|
||||
}
|
||||
if (result == false)
|
||||
error(PIOS_LED_HEARTBEAT);
|
||||
error(PIOS_LED_HEARTBEAT,4);
|
||||
}
|
||||
///
|
||||
for (uint8_t x = 0; x < 3; ++x) {
|
||||
@ -145,11 +145,24 @@ int main() {
|
||||
|
||||
}
|
||||
|
||||
void error(int led) {
|
||||
for (;;) {
|
||||
void error(int led,int code) {
|
||||
for(;;)
|
||||
{
|
||||
PIOS_DELAY_WaitmS(1000);
|
||||
for (int x=0;x<code;x++)
|
||||
{
|
||||
PIOS_LED_On(led);
|
||||
PIOS_DELAY_WaitmS(500);
|
||||
PIOS_DELAY_WaitmS(200);
|
||||
PIOS_LED_Off(led);
|
||||
PIOS_DELAY_WaitmS(500);
|
||||
PIOS_DELAY_WaitmS(1000);
|
||||
}
|
||||
PIOS_DELAY_WaitmS(1000);
|
||||
for (int x=0;x<10;x++)
|
||||
{
|
||||
PIOS_LED_On(led);
|
||||
PIOS_DELAY_WaitmS(200);
|
||||
PIOS_LED_Off(led);
|
||||
PIOS_DELAY_WaitmS(200);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user