Skip to content

Commit

Permalink
GCS_MAVLink: handle battery reset as both long and int
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker authored and tridge committed Nov 8, 2023
1 parent b69879f commit 09ab14c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion libraries/GCS_MAVLink/GCS.h
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ class GCS_MAVLINK

virtual MAV_RESULT handle_command_do_set_mission_current(const mavlink_command_long_t &packet);

MAV_RESULT handle_command_battery_reset(const mavlink_command_long_t &packet);
MAV_RESULT handle_command_battery_reset(const mavlink_command_int_t &packet);
void handle_command_long(const mavlink_message_t &msg);
MAV_RESULT handle_command_accelcal_vehicle_pos(const mavlink_command_int_t &packet);

Expand Down
14 changes: 7 additions & 7 deletions libraries/GCS_MAVLink/GCS_Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4476,7 +4476,7 @@ MAV_RESULT GCS_MAVLINK::handle_command_do_set_mission_current(const mavlink_comm
}

#if AP_BATTERY_ENABLED
MAV_RESULT GCS_MAVLINK::handle_command_battery_reset(const mavlink_command_long_t &packet)
MAV_RESULT GCS_MAVLINK::handle_command_battery_reset(const mavlink_command_int_t &packet)
{
const uint16_t battery_mask = packet.param1;
const float percentage = packet.param2;
Expand Down Expand Up @@ -4744,12 +4744,6 @@ MAV_RESULT GCS_MAVLINK::handle_command_long_packet(const mavlink_command_long_t
result = handle_command_do_set_mission_current(packet);
break;

#if AP_BATTERY_ENABLED
case MAV_CMD_BATTERY_RESET:
result = handle_command_battery_reset(packet);
break;
#endif

default:
result = try_command_long_as_command_int(packet, msg);
break;
Expand Down Expand Up @@ -5016,6 +5010,12 @@ MAV_RESULT GCS_MAVLINK::handle_command_int_packet(const mavlink_command_int_t &p
case MAV_CMD_AIRFRAME_CONFIGURATION:
return handle_command_airframe_configuration(packet);
#endif

#if AP_BATTERY_ENABLED
case MAV_CMD_BATTERY_RESET:
return handle_command_battery_reset(packet);
#endif

#if HAL_CANMANAGER_ENABLED
case MAV_CMD_CAN_FORWARD:
return handle_can_forward(packet, msg);
Expand Down

0 comments on commit 09ab14c

Please sign in to comment.