mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
MAVLink app: Send newest param hash for every param change to notify GCS about change
This should help keeping the GCS up to date about asynchronous changes on the autopilot.
This commit is contained in:
parent
ca0267b4e9
commit
fba592b5fc
@ -2190,9 +2190,23 @@ Mavlink::task_main(int argc, char *argv[])
|
||||
|
||||
update_rate_mult();
|
||||
|
||||
if (param_sub->update(¶m_time, nullptr)) {
|
||||
/* param update backoff: update only after 50 ms after the last change */
|
||||
param_sub->update(¶m_time, nullptr);
|
||||
|
||||
if (param_time + 100 * 1000 > hrt_absolute_time()) {
|
||||
/* parameters updated */
|
||||
mavlink_update_system();
|
||||
/* send out param cache value */
|
||||
uint32_t hash = param_hash_check();
|
||||
|
||||
/* build the one-off response message */
|
||||
mavlink_param_value_t param_value;
|
||||
param_value.param_count = param_count_used();
|
||||
param_value.param_index = -1;
|
||||
strncpy(param_value.param_id, HASH_PARAM, MAVLINK_MSG_PARAM_VALUE_FIELD_PARAM_ID_LEN);
|
||||
param_value.param_type = MAV_PARAM_TYPE_UINT32;
|
||||
memcpy(¶m_value.param_value, &hash, sizeof(hash));
|
||||
mavlink_msg_param_value_send_struct(get_channel(), ¶m_value);
|
||||
}
|
||||
|
||||
check_radio_config();
|
||||
|
||||
@ -77,6 +77,8 @@ enum Protocol {
|
||||
TCP,
|
||||
};
|
||||
|
||||
#define HASH_PARAM "_HASH_CHECK"
|
||||
|
||||
class Mavlink
|
||||
{
|
||||
|
||||
|
||||
@ -47,8 +47,6 @@
|
||||
#include "mavlink_parameters.h"
|
||||
#include "mavlink_main.h"
|
||||
|
||||
#define HASH_PARAM "_HASH_CHECK"
|
||||
|
||||
MavlinkParametersManager::MavlinkParametersManager(Mavlink *mavlink) :
|
||||
_send_all_index(-1),
|
||||
_uavcan_open_request_list(nullptr),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user