mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Revive test_dataman.c
This commit is contained in:
parent
b2bf9e15eb
commit
bb71aa5b64
@ -34,6 +34,7 @@
|
||||
set(srcs
|
||||
test_adc.c
|
||||
test_autodeclination.cpp
|
||||
test_dataman.c
|
||||
test_hysteresis.cpp
|
||||
test_bson.c
|
||||
test_conv.cpp
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <px4_config.h>
|
||||
#include <px4_posix.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
@ -60,6 +61,8 @@
|
||||
#include "dataman/dataman.h"
|
||||
|
||||
static px4_sem_t *sems;
|
||||
int test_dataman(int argc, char *argv[]);
|
||||
|
||||
|
||||
static int
|
||||
task_main(int argc, char *argv[])
|
||||
@ -91,7 +94,7 @@ task_main(int argc, char *argv[])
|
||||
memset(buffer, my_id, sizeof(buffer));
|
||||
buffer[1] = i;
|
||||
unsigned hash = i ^ my_id;
|
||||
unsigned len = (hash & 63) + 2;
|
||||
unsigned len = (hash % (DM_MAX_DATA_SIZE / 2)) + 2;
|
||||
|
||||
int ret = dm_write(DM_KEY_WAYPOINTS_OFFBOARD_1, hash, DM_PERSIST_IN_FLIGHT_RESET, buffer, len);
|
||||
warnx("ret: %d", ret);
|
||||
@ -109,7 +112,9 @@ task_main(int argc, char *argv[])
|
||||
|
||||
for (unsigned i = 0; i < NUM_MISSIONS_SUPPORTED; i++) {
|
||||
unsigned hash = i ^ my_id;
|
||||
unsigned len2, len = (hash & 63) + 2;
|
||||
unsigned len2;
|
||||
unsigned len = (hash % (DM_MAX_DATA_SIZE / 2)) + 2;
|
||||
;
|
||||
|
||||
if ((len2 = dm_read(DM_KEY_WAYPOINTS_OFFBOARD_1, hash, buffer, sizeof(buffer))) < 2) {
|
||||
warnx("%d read failed length test, index %d", my_id, hash);
|
||||
@ -168,7 +173,7 @@ int test_dataman(int argc, char *argv[])
|
||||
px4_sem_init(sems + i, 1, 0);
|
||||
|
||||
/* start the task */
|
||||
if ((task = px4_task_spawn_cmd("dataman", SCHED_DEFAULT, SCHED_PRIORITY_MAX - 5, 2048, task_main, av)) <= 0) {
|
||||
if ((task = px4_task_spawn_cmd("dataman", SCHED_DEFAULT, SCHED_PRIORITY_MAX - 5, 2048, task_main, (void *)av)) <= 0) {
|
||||
warn("task start failed");
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,6 +101,7 @@ const struct {
|
||||
{"autodeclination", test_autodeclination, 0},
|
||||
{"bson", test_bson, 0},
|
||||
{"conv", test_conv, 0},
|
||||
{"dataman", test_dataman, 0},
|
||||
{"file", test_file, OPT_NOJIGTEST | OPT_NOALLTEST},
|
||||
{"file2", test_file2, OPT_NOJIGTEST},
|
||||
{"float", test_float, 0},
|
||||
|
||||
@ -57,6 +57,7 @@ extern int test_autodeclination(int argc, char *argv[]);
|
||||
extern int test_hysteresis(int argc, char *argv[]);
|
||||
extern int test_bson(int argc, char *argv[]);
|
||||
extern int test_conv(int argc, char *argv[]);
|
||||
extern int test_dataman(int argc, char *argv[]);
|
||||
extern int test_file(int argc, char *argv[]);
|
||||
extern int test_file2(int argc, char *argv[]);
|
||||
extern int test_float(int argc, char *argv[]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user