diff --git a/libraries/AP_HAL_ChibiOS/Util.cpp b/libraries/AP_HAL_ChibiOS/Util.cpp index a96a21b055..62ea146c86 100644 --- a/libraries/AP_HAL_ChibiOS/Util.cpp +++ b/libraries/AP_HAL_ChibiOS/Util.cpp @@ -230,9 +230,12 @@ bool Util::flash_bootloader() uint32_t fw_size; const char *fw_name = "bootloader.bin"; + hal.scheduler->expect_delay_ms(5000); + uint8_t *fw = AP_ROMFS::find_decompress(fw_name, fw_size); if (!fw) { hal.console->printf("failed to find %s\n", fw_name); + hal.scheduler->expect_delay_ms(0); return false; } @@ -240,6 +243,7 @@ bool Util::flash_bootloader() if (!memcmp(fw, (const void*)addr, fw_size)) { hal.console->printf("Bootloader up-to-date\n"); free(fw); + hal.scheduler->expect_delay_ms(0); return true; } @@ -247,6 +251,7 @@ bool Util::flash_bootloader() if (!hal.flash->erasepage(0)) { hal.console->printf("Erase failed\n"); free(fw); + hal.scheduler->expect_delay_ms(0); return false; } hal.console->printf("Flashing %s @%08x\n", fw_name, (unsigned int)addr); @@ -264,11 +269,13 @@ bool Util::flash_bootloader() } hal.console->printf("Flash OK\n"); free(fw); + hal.scheduler->expect_delay_ms(0); return true; } hal.console->printf("Flash failed after %u attempts\n", max_attempts); free(fw); + hal.scheduler->expect_delay_ms(0); return false; } #endif //#ifndef HAL_NO_FLASH_SUPPORT