@@ -15,13 +15,15 @@ MavlinkParameterClient::MavlinkParameterClient(
15
15
MavlinkMessageHandler& message_handler,
16
16
TimeoutHandler& timeout_handler,
17
17
TimeoutSCallback timeout_s_callback,
18
+ AutopilotCallback autopilot_callback,
18
19
uint8_t target_system_id,
19
20
uint8_t target_component_id,
20
21
bool use_extended) :
21
22
_sender (sender),
22
23
_message_handler (message_handler),
23
24
_timeout_handler (timeout_handler),
24
25
_timeout_s_callback (std::move(timeout_s_callback)),
26
+ _autopilot_callback (std::move(autopilot_callback)),
25
27
_target_system_id (target_system_id),
26
28
_target_component_id (target_component_id),
27
29
_use_extended (use_extended)
@@ -115,7 +117,7 @@ void MavlinkParameterClient::set_param_int_async(
115
117
116
118
// PX4 only uses int32_t, so we can be sure and don't need to check the exact type first
117
119
// by getting the param, or checking the cache.
118
- if (_sender. autopilot () == Autopilot::Px4) {
120
+ if (_autopilot_callback () == Autopilot::Px4) {
119
121
ParamValue value_to_set;
120
122
value_to_set.set (static_cast <int32_t >(value));
121
123
set_param_async (name, value_to_set, callback, cookie);
@@ -499,7 +501,7 @@ bool MavlinkParameterClient::send_set_param_message(WorkItemSet& work_item)
499
501
return message;
500
502
});
501
503
} else {
502
- const float value_set = (_sender. autopilot () == Autopilot::ArduPilot) ?
504
+ const float value_set = (_autopilot_callback () == Autopilot::ArduPilot) ?
503
505
work_item.param_value .get_4_float_bytes_cast () :
504
506
work_item.param_value .get_4_float_bytes_bytewise ();
505
507
@@ -632,8 +634,8 @@ void MavlinkParameterClient::process_param_value(const mavlink_message_t& messag
632
634
ParamValue received_value;
633
635
const bool set_value_success = received_value.set_from_mavlink_param_value (
634
636
param_value,
635
- (_sender. autopilot () == Autopilot::ArduPilot) ? ParamValue::Conversion::Cast :
636
- ParamValue::Conversion::Bitwise);
637
+ (_autopilot_callback () == Autopilot::ArduPilot) ? ParamValue::Conversion::Cast :
638
+ ParamValue::Conversion::Bitwise);
637
639
if (!set_value_success) {
638
640
LogWarn () << " Got ill-formed param_ext_value message (param_type unknown)" ;
639
641
return ;
0 commit comments