mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-01 09:01:37 +08:00
MAVLink parameters: Send all updated parameters asynchronously
Parameters can change not just based on GCS request, but also due to internal code or requests by a different valid connected control authority such a cloud service. This change ensures that all connected systems get updated via MAVLink asynchronously.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2012-2015 PX4 Development Team. All rights reserved.
|
||||
* Copyright (c) 2012-2018 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -37,6 +37,7 @@
|
||||
*
|
||||
* @author Anton Babushkin <anton.babushkin@me.com>
|
||||
* @author Lorenz Meier <lorenz@px4.io>
|
||||
* @author Beat Kueng <beat@px4.io>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -47,6 +48,7 @@
|
||||
#include <uORB/uORB.h>
|
||||
#include <uORB/topics/rc_parameter_map.h>
|
||||
#include <uORB/topics/uavcan_parameter_request.h>
|
||||
#include <uORB/topics/parameter_update.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
|
||||
class Mavlink;
|
||||
@@ -79,6 +81,21 @@ protected:
|
||||
/// @return true if a parameter was sent
|
||||
bool send_one();
|
||||
|
||||
/**
|
||||
* Handle any open param send transfer
|
||||
*/
|
||||
bool send_params();
|
||||
|
||||
/**
|
||||
* Send UAVCAN params
|
||||
*/
|
||||
bool send_uavcan();
|
||||
|
||||
/**
|
||||
* Send untransmitted params
|
||||
*/
|
||||
bool send_untransmitted();
|
||||
|
||||
int send_param(param_t param, int component_id = -1);
|
||||
|
||||
// Item of a single-linked list to store requested uavcan parameters
|
||||
@@ -87,22 +104,33 @@ protected:
|
||||
struct _uavcan_open_request_list_item *next;
|
||||
};
|
||||
|
||||
// Request the next uavcan parameter
|
||||
/**
|
||||
* Request the next uavcan parameter
|
||||
*/
|
||||
void request_next_uavcan_parameter();
|
||||
// Enque one uavcan parameter reqest. We store 10 at max.
|
||||
|
||||
/**
|
||||
* Enqueue one uavcan parameter reqest. We store 10 at max.
|
||||
*/
|
||||
void enque_uavcan_request(uavcan_parameter_request_s *req);
|
||||
// Drop the first reqest from the list
|
||||
|
||||
/**
|
||||
* Drop the first reqest from the list
|
||||
*/
|
||||
void dequeue_uavcan_request();
|
||||
|
||||
_uavcan_open_request_list_item *_uavcan_open_request_list; // Pointer to the first item in the linked list
|
||||
bool _uavcan_waiting_for_request_response; // We have reqested a parameter and wait for the response
|
||||
uint16_t _uavcan_queued_request_items; // Number of stored parameter requests currently in the list
|
||||
_uavcan_open_request_list_item *_uavcan_open_request_list; ///< Pointer to the first item in the linked list
|
||||
bool _uavcan_waiting_for_request_response; ///< We have reqested a parameter and wait for the response
|
||||
uint16_t _uavcan_queued_request_items; ///< Number of stored parameter requests currently in the list
|
||||
|
||||
orb_advert_t _rc_param_map_pub;
|
||||
struct rc_parameter_map_s _rc_param_map;
|
||||
|
||||
orb_advert_t _uavcan_parameter_request_pub;
|
||||
int _uavcan_parameter_value_sub;
|
||||
int _mavlink_parameter_sub;
|
||||
hrt_abstime _param_update_time;
|
||||
int _param_update_index;
|
||||
|
||||
Mavlink *_mavlink;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user