Commander: add const qualifiers for clarity

This commit is contained in:
Matthias Grob 2019-10-08 16:07:29 +02:00 committed by Beat Küng
parent 63f2c009c7
commit c1faea8d32
1 changed files with 7 additions and 8 deletions

View File

@ -213,7 +213,7 @@ static int power_button_state_notification_cb(board_power_button_state_notificat
// on the main thread of commander.
power_button_state_s button_state{};
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) {
case PWR_BUTTON_IDEL:
@ -430,10 +430,10 @@ int commander_main(int argc, char *argv[])
if (!strcmp(argv[1], "transition")) {
bool ret = send_vehicle_command(vehicle_command_s::VEHICLE_CMD_DO_VTOL_TRANSITION,
(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_MC));
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 ?
vtol_vehicle_status_s::VEHICLE_VTOL_STATE_FW :
vtol_vehicle_status_s::VEHICLE_VTOL_STATE_MC));
return (ret ? 0 : 1);
}
@ -2639,8 +2639,7 @@ Commander::set_main_state(const vehicle_status_s &status_local, bool *changed)
transition_result_t
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,
&internal_state);
const transition_result_t res = main_state_transition(status_local, commander_state_s::MAIN_STATE_MANUAL, status_flags, &internal_state);
*changed = (res == TRANSITION_CHANGED);
return res;
@ -3703,7 +3702,7 @@ bool Commander::preflight_check(bool report)
{
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));
if (success) {