Skip to content

Commit

Permalink
Commander: add const qualifiers for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
MaEtUgR authored and bkueng committed Oct 9, 2019
1 parent 63f2c00 commit c1faea8
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/modules/commander/Commander.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit c1faea8

Please sign in to comment.