1
0
Fork 0
forked from nuttx/nuttx-update

sensors/fakesensor_uorb: Using different nbuffer for each topic of GNSS

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
wangjianyu3 2024-11-30 08:40:11 +08:00 committed by Xiang Xiao
parent 074c494f8f
commit 5fbf377214

View file

@ -30,6 +30,7 @@
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <sys/param.h>
#include <nuttx/fs/fs.h>
#include <nuttx/kmalloc.h>
@ -401,6 +402,14 @@ int fakesensor_init(int type, FAR const char *file_name,
FAR struct fakesensor_s *sensor;
FAR char *argv[2];
char arg1[32];
uint32_t nbuffer[] = {
[SENSOR_GNSS_IDX_GNSS] = batch_number,
[SENSOR_GNSS_IDX_GNSS_SATELLITE] = batch_number,
[SENSOR_GNSS_IDX_GNSS_MEASUREMENT] = batch_number,
[SENSOR_GNSS_IDX_GNSS_CLOCK] = batch_number,
[SENSOR_GNSS_IDX_GNSS_GEOFENCE] = batch_number,
};
int ret;
/* Alloc memory for sensor */
@ -436,7 +445,7 @@ int fakesensor_init(int type, FAR const char *file_name,
if (type == SENSOR_TYPE_GNSS || type == SENSOR_TYPE_GNSS_SATELLITE)
{
sensor->gnss.ops = &g_fakegnss_ops;
gnss_register(&sensor->gnss, devno, batch_number);
gnss_register(&sensor->gnss, devno, nbuffer, nitems(nbuffer));
}
else
{