Skip to content

Commit

Permalink
sensor_rpmsg.c: Fix that "stub" will be created when local core only …
Browse files Browse the repository at this point in the history
…has subscribers.

After the ap core subscribes to the 25hz batch 120ms data of the sensor core, it switches
to the cp core and subscribes to the 50hz batch 120ms sensor core data. At this time,
the data subscribed by the AP will be abnormally lost (12.5hz). Mainly because ap
subscribes to sensor core data earlier than cp. The subscription of cp will be broadcast
to the ap core at the same time, and the corresponding "path" already exists
under "/dev/uorb" of ap. Thus the ap will create a "stub".

There are some restrictions on the creation of "stub" to avoid this situation.

Signed-off-by: likun17 <likun17@xiaomi.com>
  • Loading branch information
Otpvondoiats committed Sep 19, 2024
1 parent ed57217 commit 40e81fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/sensors/sensor_rpmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ static int sensor_rpmsg_sub_handler(FAR struct rpmsg_endpoint *ept,
int ret;

dev = sensor_rpmsg_find_dev(msg->path);
if (!dev)
if (!dev || (dev->nadvertisers == 0 && !dev->lower.persist))
{
return 0;
}
Expand Down

0 comments on commit 40e81fc

Please sign in to comment.