mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-21 15:27:36 +08:00
Dataman: Some minor fixes
This commit is contained in:
@@ -33,10 +33,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
/**
|
||||
* @file navigator_main.c
|
||||
* Implementation of the main navigation state machine.
|
||||
*
|
||||
* Handles missions, geo fencing and failsafe navigation behavior.
|
||||
* @file dataman.c
|
||||
* DATAMANAGER driver.
|
||||
*/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
@@ -113,7 +111,7 @@ static unsigned g_func_counts[dm_number_of_funcs];
|
||||
static const unsigned g_per_item_max_index[DM_KEY_NUM_KEYS] = {
|
||||
DM_KEY_SAFE_POINTS_MAX,
|
||||
DM_KEY_FENCE_POINTS_MAX,
|
||||
DM_KEY_WAY_POINTS_MAX,
|
||||
DM_KEY_WAYPOINTS_MAX,
|
||||
};
|
||||
|
||||
/* Table of offset for index 0 of each item type */
|
||||
@@ -138,7 +136,7 @@ static work_q_t g_work_q;
|
||||
sem_t g_work_queued_sema;
|
||||
sem_t g_init_sema;
|
||||
|
||||
static bool g_task_should_exit; /**< if true, sensor task should exit */
|
||||
static bool g_task_should_exit; /**< if true, dataman task should exit */
|
||||
|
||||
#define DM_SECTOR_HDR_SIZE 4
|
||||
static const unsigned k_sector_size = DM_MAX_DATA_SIZE + DM_SECTOR_HDR_SIZE;
|
||||
@@ -266,11 +264,11 @@ _write(dm_item_t item, unsigned char index, dm_persitence_t persistence, const v
|
||||
/* Get the offset for this item */
|
||||
offset = calculate_offset(item, index);
|
||||
|
||||
if (offset < 0)
|
||||
if (offset < 0)
|
||||
return -1;
|
||||
|
||||
/* Make sure caller has not given us more data than we can handle */
|
||||
if (count > DM_MAX_DATA_SIZE)
|
||||
if (count > DM_MAX_DATA_SIZE)
|
||||
return -1;
|
||||
|
||||
/* Write out the data, prefixed with length and persistence level */
|
||||
@@ -456,7 +454,7 @@ dm_write(dm_item_t item, unsigned char index, dm_persitence_t persistence, const
|
||||
return -1;
|
||||
|
||||
/* Will return with queues locked */
|
||||
if ((work = create_work_item()) == NULL)
|
||||
if ((work = create_work_item()) == NULL)
|
||||
return -1; /* queues unlocked on failure */
|
||||
|
||||
work->func = dm_write_func;
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
|
||||
#include <uORB/topics/mission.h>
|
||||
#include <uORB/topics/fence.h>
|
||||
#include <mavlink/waypoints.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -51,7 +50,7 @@ extern "C" {
|
||||
typedef enum {
|
||||
DM_KEY_SAFE_POINTS = 0, /* Safe points coordinates, safe point 0 is home point */
|
||||
DM_KEY_FENCE_POINTS, /* Fence vertex coordinates */
|
||||
DM_KEY_WAY_POINTS, /* Mission way point coordinates */
|
||||
DM_KEY_WAYPOINTS, /* Mission way point coordinates */
|
||||
DM_KEY_NUM_KEYS /* Total number of item types defined */
|
||||
} dm_item_t;
|
||||
|
||||
@@ -59,7 +58,7 @@ extern "C" {
|
||||
enum {
|
||||
DM_KEY_SAFE_POINTS_MAX = 8,
|
||||
DM_KEY_FENCE_POINTS_MAX = GEOFENCE_MAX_VERTICES,
|
||||
DM_KEY_WAY_POINTS_MAX = MAVLINK_WPM_MAX_WP_COUNT,
|
||||
DM_KEY_WAYPOINTS_MAX = NUM_MISSIONS_SUPPORTED
|
||||
};
|
||||
|
||||
/* Data persistence levels */
|
||||
|
||||
Reference in New Issue
Block a user