Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ardupilot
GitHub Repository: Ardupilot/ardupilot
Path: blob/master/Tools/AP_Periph/GCS_MAVLink.cpp
9381 views
1
/*
2
This program is free software: you can redistribute it and/or modify
3
it under the terms of the GNU General Public License as published by
4
the Free Software Foundation, either version 3 of the License, or
5
(at your option) any later version.
6
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
11
12
You should have received a copy of the GNU General Public License
13
along with this program. If not, see <http://www.gnu.org/licenses/>.
14
*/
15
16
#include "GCS_MAVLink.h"
17
#include <AP_HAL/AP_HAL_Boards.h>
18
#include "AP_Periph.h"
19
#if CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
20
#include <hal.h>
21
#endif
22
23
#if HAL_GCS_ENABLED
24
25
MAV_RESULT GCS_MAVLINK_Periph::handle_preflight_reboot(const mavlink_command_int_t &packet, const mavlink_message_t &msg)
26
{
27
hal.scheduler->delay(10);
28
periph.prepare_reboot();
29
#if CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
30
NVIC_SystemReset();
31
#elif CONFIG_HAL_BOARD == HAL_BOARD_SITL
32
HAL_SITL::actually_reboot();
33
#endif
34
}
35
36
#endif // #if HAL_GCS_ENABLED
37
38