Commit Graph

39 Commits

Author SHA1 Message Date
Xiang Xiao
054cf3b1cb Change all sizeof(arr)/sizeof(arr[0]) to nitems
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-08-17 22:51:51 +03:00
jinxudong
6bea926ef2 sensor: add force sensor
A sensor of this type measures the force on it, and additionally
compares the force with one or more specified thresholds. The sensor
can output the force value directly. Moreover, it's usually applied
as a press key. In that case, when it detects a force greater than
some given threshold, a corresponding event is reported.

Signed-off-by: jinxudong <jinxudong@xiaomi.com>
2023-08-10 03:33:22 +08:00
haopengxiang
bdedf648c5 uorb/topics: update delicated match of listener topics
bug: if user input obr_topic is sensor_gps_sate(wrong topic, which does not exist), the using of `strncmp` will assign idx=8 (as sesnor_gps) in the first.

However, there is no match in the `g_sensor_list`, hence idx=8 will give  out value of `sensor_gps` as output(wrong).

Change: This update aims to match the whole value of sensor name in `g_sensor_list`, while keeping `sensor_name+number` match in this condition.

Signed-off-by: haopengxiang <haopengxiang@xiaomi.com>
2023-08-10 02:01:09 +08:00
haopengxiang
6b5038ef7a uorb/sensor/gps: fix uorinfo_raw print error
[   15.979300] [24] [  INFO] [ap] sensor_gps_satellite: timestamp: 15979200 (100 us ago)
[   15.979400] [24] [  INFO] [ap] sensor_gps_satellite: number:0 svid: 13elevation: 54azimuth: 253 snr: 0
[   15.979600] [24] [  INFO] [ap] sensor_gps_satellite: number:1 svid: 21elevation: 43azimuth: 77 snr: 0
[   15.979700] [24] [  INFO] [ap] sensor_gps_satellite: number:2 svid: 22elevation: 9azimuth: 35 snr: 0
[   15.979800] [24] [  INFO] [ap] sensor_gps_satellite: number:3 svid: 23elevation: 23azimuth: 268 snr: 0

Signed-off-by: haopengxiang <haopengxiang@xiaomi.com>
2023-08-10 02:01:09 +08:00
dongjiuzhu1
718fcfac1e system/uorb: Solve the problem of wrong use of return value
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-28 21:51:10 -07:00
zhangyuan21
7277a48482 uorb: Avoiding GCC VCVT Issue When MVE is Enabled
https: //sourceware.org/git/?p=binutils-gdb.git;a=commit;h=656412a7a4da0aef43ead1ea976ba0235a7ec30a

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-07-28 21:49:58 -07:00
dongjiuzhu1
78590a55ea system/uorb: Support frequency less than 1hz
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-28 21:49:58 -07:00
Petro Karashchenko
c9c4cc13e6 apps: correct print specifiers to fix compilation warnings
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-06-23 12:05:54 +08:00
Xiang Xiao
7032c72f2f Indent the define statement by two spaces
follow the code style convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-21 07:39:53 +03:00
Xiang Xiao
7c37421266 Replace all sprintf with snprintf
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-08 21:35:16 +03:00
simbit18
d325cf048a apps/system/uorb/Makefile: Fix mistakes in comments
Fix mistakes in comments
2023-03-07 21:45:12 +02:00
Gustavo Henrique Nihei
f500c64962 Include missing headers throughout the repository
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-03-07 09:58:13 +08:00
Xiang Xiao
a29d9ea9da fsutils/examples: Include unistd.h explicitly
to get the prototypes or macros are defined in it

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-05 08:46:59 +02:00
liucheng5
bf140bcaae fix: sensor: support ECG event lead info
Lead info is added into sensor_ecg event struct. Uorb and sensortest shall be modified.

Signed-off-by: liucheng5 <liucheng5@xiaomi.com>
2023-02-02 22:49:22 +08:00
jinxudong
57af6174f0 fix: sensor: update hall data type
update hall data type to int32_t

Signed-off-by: jinxudong <jinxudong@xiaomi.com>
2023-02-02 22:49:22 +08:00
yinshengkai
ee4d8b738f Makefile: replace INCDIR to INCDIR_PREFIX
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-10 02:38:58 +08:00
yinshengkai
2c3c2edcb7 Makefile: Remove INCDIROPT
This option, which resolves to -w when CONFIG_CYGWIN_WINTOOL is
configured, is now appended to INCDIR in tools/Config.mk.

See git commit # 5eae32577e5d5226e5d3027c169eeb369f83f77d in the main
2022-10-25 13:48:16 +08:00
Xiang Xiao
de26582775 system/uorb: Pass NULL to task_create directly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-08-16 09:47:17 +03:00
Jiuzhu Dong
e04333c986 driver/sensor: rename /dev/sensor -> /dev/uorb
because this directory contains all topics by uorb using, not just sensors.

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-08 23:11:37 +08:00
jihandong
74af9a8065 app/system/uorb: fix error, memset() wrong size.
Signed-off-by: jihandong <jihandong@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
131e4dc69d system/uorb: simply orb_check by SNIOC_UPDATED
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
jihandong
3f865c4f9e uorb/listener: ignore first get_state failed.
Signed-off-by: jihandong <jihandong@xiaomi.com>
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
jihandong
2b8bfc5be7 app/system/uorb: modify unit test to support data persist
Signed-off-by: jihandong <jihandong@xiaomi.com>
2022-07-23 16:57:58 -03:00
jihandong
874ed7654d app/system/uorb: fix listener run_once not work.
And remove dead code.

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
f02c5a5d7e system/uorb: support new api
orb_advertise_multi_queue_persist

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
ligd
37f1e453b1 uorb: use another writing method to avoid compiler bug
int func(int b)
{
    int a;

    while (1) {
        ...;

        if (b != 0)
            a = 1000 / b;

        ...;
    }
}

if b == 0, then system crash in Xtensa arch, clang compiler

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
8558e63772 uorb_listener: support set batch latency
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
3a8f4b53fc apps/uorb: fix compile break
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
jihandong
384c05beb2 app/system/uorb: alloc on heap instead of stack.
Signed-off-by: jihandong <jihandong@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
e97b1a79d6 uorb_listener: support subscribe physical sensor before node register
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
5bb4e14aad system/uorb: always let orb_advertise, orb_advertise_queue for instance 0
1.orb_advertise, orb_advertise_queue for instance 0
2.orb_advertise_multi, orb_advertise__multi_queue for specified instance
3.If orb_advertise_multi_queue with instance is NULL, auto increase
instance from existing base.

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
53ee04ba3c uorb/listener: add new api: orb_open and orb_close
don't using subscriber to get state to avoid rpmsg access

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
d44dd1c426 uorb_unit_test: optimize stack used
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
6fceb913a2 system/uorb: optimize stack used
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
jihandong
9f6d322186 system/uorb: listener, has 'top' command.
Listener can scan device under ORB_SENSOR_PATH, subscribe them and
cotinue printing messages by call their cb.

'-T' can Continuously print updating objects, '-l' means only
print once.

Signed-off-by: jihandong <jihandong@xiaomi.com>
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
4ec3f70f1d apps/system/uorb: support orb_get_meta by name string
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
46c98420b7 system/uorb: add builtin sensor topics
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
jihandong
d8d1e1e761 apps/system/uorb: c unit testcases
testcases:
1. test_single(): single instance, advertise then subscribe.
2. test_multi_inst10(): 10 instance, each 1 subscriber.
3. test_multi(): 2 instances, 2 advertisers, 2 subscribers.
4. test_multi_reversed(): same as test_multi(), but subsribe before
		          advertise.
5. test_unadvertise(): unadvertise upper 4 advertisers.
6. test_multi2(): same as tset_multi(). but multi-thread.
7, test_queue():  topic queue_size = 16.

Signed-off-by: jihandong <jihandong@xiaomi.com>
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
jihandong
3528b5515f apps/system/uorb: c interfaces.
refer to: https://docs.px4.io/v1.12/en/middleware/uorb.html

- orb_open: do real work for advertise() and subscribe(), if thre is
            no user, register topic first, then save meta in driver;
            only first user can successfully set buffer number.
- orb_exists: check topic state, if topic only has subscribers,
	      return "not exists".

Signed-off-by: jihandong <jihandong@xiaomi.com>
2022-07-23 16:57:58 -03:00