Browse Source

AP_HAL_AVR: add panic method to scheduler

master
Pat Hickey 12 years ago committed by Andrew Tridgell
parent
commit
9656b0ad0e
  1. 11
      libraries/AP_HAL_AVR/Scheduler.cpp
  2. 1
      libraries/AP_HAL_AVR/Scheduler.h

11
libraries/AP_HAL_AVR/Scheduler.cpp

@ -210,6 +210,17 @@ void AVRScheduler::end_atomic() { @@ -210,6 +210,17 @@ void AVRScheduler::end_atomic() {
}
}
void AVRScheduler::panic(const prog_char_t* errormsg) {
/* Suspend timer processes. We still want the timer event to go off
* to run the _failsafe code, however. */
_timer_suspended = true;
/* Print the error message on both ports */
hal.uartA->println_P(errormsg);
hal.uartC->println_P(errormsg);
/* Spin forever. */
for(;;);
}
void AVRScheduler::reboot() {
hal.uartA->println_P(PSTR("GOING DOWN FOR A REBOOT\r\n"));
hal.scheduler->delay(100);

1
libraries/AP_HAL_AVR/Scheduler.h

@ -37,6 +37,7 @@ public: @@ -37,6 +37,7 @@ public:
void resume_timer_procs();
void begin_atomic();
void end_atomic();
void panic(const prog_char_t *errormsg);
void reboot();
private:

Loading…
Cancel
Save