HAL_F4light: fixed 'instant reboot' modes

This commit is contained in:
night-ghost 2018-03-19 15:38:39 +05:00 committed by Andrew Tridgell
parent a3ebb5c069
commit 04dedd77d7
1 changed files with 4 additions and 1 deletions

View File

@ -330,6 +330,7 @@ void HAL_F4Light::lateInit() {
if( (sig & ~CONSOLE_PORT_MASK) == CONSOLE_PORT_SIGNATURE) {
if(port != (sig & CONSOLE_PORT_MASK)) { // wrong console - reboot needed
board_set_rtc_register(CONSOLE_PORT_SIGNATURE | (port & CONSOLE_PORT_MASK), RTC_CONSOLE_REG);
board_set_rtc_register(FORCE_APP_RTC_SIGNATURE, RTC_SIGNATURE_REG); // force bootloader to not wait
Scheduler::_reboot(false);
}
} else { // no signature - set and check console
@ -337,7 +338,7 @@ void HAL_F4Light::lateInit() {
AP_HAL::UARTDriver** up = uarts[port];
if(up && *up != console) {
board_set_rtc_register(FORCE_APP_RTC_SIGNATURE, RTC_SIGNATURE_REG); // force bootloader to not wait
Scheduler::_reboot(false);
}
}
@ -358,6 +359,7 @@ void HAL_F4Light::lateInit() {
if((sig & ~OVERCLOCK_SIG_MASK ) == OVERCLOCK_SIGNATURE ) { // if correct signature
board_set_rtc_register(OVERCLOCK_SIGNATURE | oc, RTC_OVERCLOCK_REG); // set required clock in any case
if((sig & OVERCLOCK_SIG_MASK) != oc) { // if wrong clock
board_set_rtc_register(FORCE_APP_RTC_SIGNATURE, RTC_SIGNATURE_REG); // force bootloader to not wait
Scheduler::_reboot(false); // then reboot required
}
} else { // no signature, write only if needed
@ -391,6 +393,7 @@ void HAL_F4Light::lateInit() {
hal_param_helper->_usb_storage.save();
board_set_rtc_register(MASS_STORAGE_SIGNATURE, RTC_MASS_STORAGE_REG);
board_set_rtc_register(FORCE_APP_RTC_SIGNATURE, RTC_SIGNATURE_REG); // force bootloader to not wait
Scheduler::_reboot(false);
}
}