mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-21 01:12:11 +00:00
Commander: add const qualifiers for clarity
This commit is contained in:
@@ -213,7 +213,7 @@ static int power_button_state_notification_cb(board_power_button_state_notificat
|
|||||||
// on the main thread of commander.
|
// on the main thread of commander.
|
||||||
power_button_state_s button_state{};
|
power_button_state_s button_state{};
|
||||||
button_state.timestamp = hrt_absolute_time();
|
button_state.timestamp = hrt_absolute_time();
|
||||||
int ret = PWR_BUTTON_RESPONSE_SHUT_DOWN_PENDING;
|
const int ret = PWR_BUTTON_RESPONSE_SHUT_DOWN_PENDING;
|
||||||
|
|
||||||
switch (request) {
|
switch (request) {
|
||||||
case PWR_BUTTON_IDEL:
|
case PWR_BUTTON_IDEL:
|
||||||
@@ -430,10 +430,10 @@ int commander_main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (!strcmp(argv[1], "transition")) {
|
if (!strcmp(argv[1], "transition")) {
|
||||||
|
|
||||||
bool ret = send_vehicle_command(vehicle_command_s::VEHICLE_CMD_DO_VTOL_TRANSITION,
|
const bool ret = send_vehicle_command(vehicle_command_s::VEHICLE_CMD_DO_VTOL_TRANSITION,
|
||||||
(float)(status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING ?
|
(float)(status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING ?
|
||||||
vtol_vehicle_status_s::VEHICLE_VTOL_STATE_FW :
|
vtol_vehicle_status_s::VEHICLE_VTOL_STATE_FW :
|
||||||
vtol_vehicle_status_s::VEHICLE_VTOL_STATE_MC));
|
vtol_vehicle_status_s::VEHICLE_VTOL_STATE_MC));
|
||||||
|
|
||||||
return (ret ? 0 : 1);
|
return (ret ? 0 : 1);
|
||||||
}
|
}
|
||||||
@@ -2639,8 +2639,7 @@ Commander::set_main_state(const vehicle_status_s &status_local, bool *changed)
|
|||||||
transition_result_t
|
transition_result_t
|
||||||
Commander::set_main_state_override_on(const vehicle_status_s &status_local, bool *changed)
|
Commander::set_main_state_override_on(const vehicle_status_s &status_local, bool *changed)
|
||||||
{
|
{
|
||||||
transition_result_t res = main_state_transition(status_local, commander_state_s::MAIN_STATE_MANUAL, status_flags,
|
const transition_result_t res = main_state_transition(status_local, commander_state_s::MAIN_STATE_MANUAL, status_flags, &internal_state);
|
||||||
&internal_state);
|
|
||||||
*changed = (res == TRANSITION_CHANGED);
|
*changed = (res == TRANSITION_CHANGED);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
@@ -3703,7 +3702,7 @@ bool Commander::preflight_check(bool report)
|
|||||||
{
|
{
|
||||||
const bool checkGNSS = (arm_requirements & ARM_REQ_GPS_BIT);
|
const bool checkGNSS = (arm_requirements & ARM_REQ_GPS_BIT);
|
||||||
|
|
||||||
bool success = Preflight::preflightCheck(&mavlink_log_pub, status, status_flags, checkGNSS, report, false,
|
const bool success = Preflight::preflightCheck(&mavlink_log_pub, status, status_flags, checkGNSS, report, false,
|
||||||
hrt_elapsed_time(&commander_boot_timestamp));
|
hrt_elapsed_time(&commander_boot_timestamp));
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
|
|||||||
Reference in New Issue
Block a user