CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/Tools/AP_Periph/GCS_MAVLink.cpp
Views: 1798
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
static const ap_message STREAM_RAW_SENSORS_msgs[] = {
26
MSG_RAW_IMU
27
};
28
static const ap_message STREAM_EXTENDED_STATUS_msgs[] = {
29
MSG_SYS_STATUS,
30
MSG_POWER_STATUS,
31
#if HAL_WITH_MCU_MONITORING
32
MSG_MCU_STATUS,
33
#endif
34
MSG_MEMINFO,
35
#if AP_GPS_GPS_RAW_INT_SENDING_ENABLED
36
MSG_GPS_RAW,
37
#endif
38
#if AP_GPS_GPS_RTK_SENDING_ENABLED
39
MSG_GPS_RTK,
40
#endif
41
};
42
43
static const ap_message STREAM_POSITION_msgs[] = {
44
#if AP_AHRS_ENABLED
45
MSG_LOCATION,
46
MSG_LOCAL_POSITION
47
#endif
48
};
49
50
static const ap_message STREAM_PARAMS_msgs[] = {
51
MSG_NEXT_PARAM
52
};
53
54
const struct GCS_MAVLINK::stream_entries GCS_MAVLINK::all_stream_entries[] = {
55
MAV_STREAM_ENTRY(STREAM_RAW_SENSORS),
56
MAV_STREAM_ENTRY(STREAM_POSITION),
57
MAV_STREAM_ENTRY(STREAM_EXTENDED_STATUS),
58
MAV_STREAM_ENTRY(STREAM_PARAMS),
59
MAV_STREAM_TERMINATOR // must have this at end of stream_entries
60
};
61
62
const struct AP_Param::GroupInfo GCS_MAVLINK_Parameters::var_info[] = {
63
AP_GROUPEND
64
};
65
66
uint8_t GCS_MAVLINK_Periph::sysid_my_gcs() const
67
{
68
return periph.g.sysid_this_mav;
69
}
70
71
uint8_t GCS_Periph::sysid_this_mav() const
72
{
73
return periph.g.sysid_this_mav;
74
}
75
76
MAV_RESULT GCS_MAVLINK_Periph::handle_preflight_reboot(const mavlink_command_int_t &packet, const mavlink_message_t &msg)
77
{
78
hal.scheduler->delay(10);
79
periph.prepare_reboot();
80
#if CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
81
NVIC_SystemReset();
82
#elif CONFIG_HAL_BOARD == HAL_BOARD_SITL
83
HAL_SITL::actually_reboot();
84
#endif
85
}
86
87
#endif // #if HAL_GCS_ENABLED
88
89