[go: up one dir, main page]

CN117707470A - Data processing methods, readable storage media, electronic equipment - Google Patents

Data processing methods, readable storage media, electronic equipment Download PDF

Info

Publication number
CN117707470A
CN117707470A CN202310645683.5A CN202310645683A CN117707470A CN 117707470 A CN117707470 A CN 117707470A CN 202310645683 A CN202310645683 A CN 202310645683A CN 117707470 A CN117707470 A CN 117707470A
Authority
CN
China
Prior art keywords
data
sensor
odr
processor
application
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202310645683.5A
Other languages
Chinese (zh)
Other versions
CN117707470B (en
Inventor
孙文冬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202310645683.5A priority Critical patent/CN117707470B/en
Publication of CN117707470A publication Critical patent/CN117707470A/en
Application granted granted Critical
Publication of CN117707470B publication Critical patent/CN117707470B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/22Arrangements for sorting or merging computer data on continuous record carriers, e.g. tape, drum, disc
    • G06F7/36Combined merging and sorting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/02Comparing digital values
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/76Arrangements for rearranging, permuting or selecting data according to predetermined rules, independently of the content of the data

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Arrangements For Transmission Of Measured Signals (AREA)

Abstract

本申请涉及数据处理技术领域,公开了一种数据处理方法、可读存储介质、电子设备。本申请的数据处理方法,应用于电子设备中的至少一个处理器,并且电子设备包括传感器;方法包括:处理器获取传感器上报的第一数据,第一数据具有第一帧数;处理器确定第一帧与处理器运行应用程序所需的目标上报帧数不同,并且应用程序对上报第一数据的速度有精度要求时;处理器将第一数据处理为与目标帧数相同的第二数据,以满足应用程序实现相关的功能。通过本申请的方法,处理器可以对上报给应用程序数据的速度进行动态地调整,在应用程序需要高精度的速度获取数据时,处理器能够保证应用程序获取传感器数据的速度达到目标要求。

This application relates to the field of data processing technology and discloses a data processing method, a readable storage medium, and an electronic device. The data processing method of the present application is applied to at least one processor in an electronic device, and the electronic device includes a sensor; the method includes: the processor obtains the first data reported by the sensor, and the first data has the first frame number; the processor determines the When one frame is different from the target number of frames required by the processor to run the application, and the application has accuracy requirements for the speed of reporting the first data; the processor processes the first data into second data that is the same as the target number of frames, To meet the application implementation related functions. Through the method of this application, the processor can dynamically adjust the speed of data reported to the application program. When the application program needs to obtain data at a high-precision speed, the processor can ensure that the speed at which the application program obtains sensor data meets the target requirements.

Description

数据处理方法、可读存储介质、电子设备Data processing methods, readable storage media, electronic devices

技术领域Technical field

本申请涉及数据处理技术领域,特别涉及一种数据处理方法、可读存储介质、电子设备。This application relates to the field of data processing technology, and in particular to a data processing method, a readable storage medium, and an electronic device.

背景技术Background technique

如今,智能手机、平板电脑等电子设备中均安装了多个传感器,例如加速度传感器、陀螺仪等等。这些传感器通常可通过中断的方式上报采集到的数据给处理器,处理器中运行对应的应用程序,以实现相应应用程序的功能。Nowadays, electronic devices such as smartphones and tablets are equipped with multiple sensors, such as acceleration sensors, gyroscopes, etc. These sensors can usually report the collected data to the processor through interrupts, and the processor runs the corresponding application program to realize the functions of the corresponding application program.

在一些场景下,应用程序对传感器数据输出速率(output data rate,ODR)的精度要求较高。例如,在计步器的活动识别或者电子设备的兼容性测试(compatibility testsuite,CTS)等场景下,传感器的ODR精度需要达到±3%。而由于传感器的特性,例如,传感器本身的电容电阻震荡电路中,电阻和电容在传输数据时会存在误差,这就导致传感器本身的ODR的精度降低。并且,越是在高ODR的情况下,传感器的ODR误差就越明显。In some scenarios, applications have higher accuracy requirements for sensor data output rate (ODR). For example, in scenarios such as activity recognition of pedometers or compatibility test suite (CTS) of electronic devices, the ODR accuracy of the sensor needs to reach ±3%. Due to the characteristics of the sensor, for example, in the capacitance-resistance oscillation circuit of the sensor itself, there will be errors in the resistance and capacitance when transmitting data, which leads to a reduction in the accuracy of the ODR of the sensor itself. Moreover, the higher the ODR situation, the more obvious the ODR error of the sensor becomes.

目前,手机和平板等电子设备上的传感器大多具有在高ODR下运行的需求,例如,计步器的数据输出速率需要在1000HZ以上。此时传感器的ODR误差就会变大,传感器在传输数据时就会出现数据丢失的情况。这就导致传感器在高ODR场景下运行会出现数据传输不达标的情况,严重影响传感器对应应用程序实现相应功能的准确性。Currently, most of the sensors on electronic devices such as mobile phones and tablets have the requirement to operate under high ODR. For example, the data output rate of a pedometer needs to be above 1000HZ. At this time, the ODR error of the sensor will become larger, and data loss will occur when the sensor transmits data. This results in substandard data transmission when the sensor is operated in a high ODR scenario, seriously affecting the accuracy of the corresponding functions of the sensor's corresponding application.

发明内容Contents of the invention

本申请实施例提供了一种数据处理方法、可读存储介质、电子设备。Embodiments of the present application provide a data processing method, a readable storage medium, and an electronic device.

第一方面,本申请实施例提供了一种数据处理方法,应用于电子设备中的至少一个处理器,并且电子设备包括传感器;方法包括:获取传感器上报的第一数据,第一数据具有第一帧数;确定第一帧数满足第一条件,其中,第一条件包括第一帧数与目标上报帧数不同;将第一数据处理为第二数据,其中,第二数据的第二帧数与目标上报帧数相同;基于第二数据执行与第一数据相关的功能。In a first aspect, embodiments of the present application provide a data processing method, which is applied to at least one processor in an electronic device, and the electronic device includes a sensor; the method includes: acquiring first data reported by the sensor, and the first data has a first Number of frames; determine that the first number of frames satisfies the first condition, where the first condition includes that the first number of frames is different from the number of target reported frames; process the first data into second data, where the second number of frames of the second data The same as the target reporting frame number; perform functions related to the first data based on the second data.

可以理解,在本申请的一些实施例中,电子设备的处理器运行相关应用程序时,会向传感器下发上报数据的目标速度,由于传感器上报数据的速度有误差。因此应用程序对传感器上报数据的速度有第一条件时,处理器可以对传感器上报的第一数据进行调整,使第一数据的帧数满足应用程序的目标上报帧数,以满足应用程序准确地实现相关功能。示例性地,第一数据可以是下述文件中没有经过处理器调整的加速度数据或者传感器数据,第二数据可以是下述文件中经过处理器调整后的加速度数据或者传感器数据。It can be understood that in some embodiments of the present application, when the processor of the electronic device runs the relevant application program, it will send the target speed of the reported data to the sensor because there is an error in the speed of the sensor reporting data. Therefore, when the application has a first condition for the speed of data reporting by the sensor, the processor can adjust the first data reported by the sensor so that the number of frames of the first data meets the target number of frames reported by the application, so as to satisfy the application accurately. Implement related functions. For example, the first data may be acceleration data or sensor data in the following file that has not been adjusted by the processor, and the second data may be acceleration data or sensor data that has been adjusted by the processor in the file described below.

在上述第一方面的一种可能的实现中,上述方法还包括:第一条件还包括下列中的至少一项:传感器上报第一数据的速度达到第一速度;传感器上报第一数据的速度精度要求为第一精度。In a possible implementation of the above first aspect, the above method further includes: the first condition further includes at least one of the following: the speed at which the sensor reports the first data reaches the first speed; the speed accuracy at which the sensor reports the first data The requirement is first accuracy.

可以理解,第一条件例如可以包括传感器上报第一数据的速度达到第一速度,第一速度例如可以是传感器上报数据的极限速度,或者与极限速度接近,例如极限速度的80%。在另一些实施例中,第一条件还可以是应用程序对传感器上报第一数据的速度有精度要求,例如需要传感器准确地以应用程序下发的目标上报速度上报数据。可以理解,第一速度可以是目标上报速度或者是下文的目标ODR。It can be understood that the first condition may include, for example, that the speed at which the sensor reports the first data reaches the first speed. The first speed may be, for example, the limit speed at which the sensor reports data, or is close to the limit speed, for example, 80% of the limit speed. In other embodiments, the first condition may also be that the application program has accuracy requirements for the speed at which the sensor reports the first data, for example, the sensor is required to accurately report data at the target reporting speed issued by the application program. It can be understood that the first speed may be the target reporting speed or the target ODR below.

在上述第一方面的一种可能的实现中,上述方法还包括:将第一数据处理为第二数据,包括:对应于第一帧数小于目标上报帧数,对第一数据补充第三数据,生成第二数据;对应于第一帧数大于目标上报帧数,在第一数据中删减第四数据,生成第二数据。In a possible implementation of the above first aspect, the above method further includes: processing the first data into second data, including: corresponding to the first frame number being less than the target reporting frame number, supplementing the first data with the third data , generate second data; corresponding to the number of first frames being greater than the number of target reported frames, delete the fourth data from the first data to generate second data.

可以理解,在本申请的一些实施例中,处理器例如可以通过补帧或者删减帧数的方式处理传感器上报的第一数据,以生成满足应用程序的第二数据。It can be understood that in some embodiments of the present application, the processor may process the first data reported by the sensor by, for example, adding frames or deleting the number of frames to generate second data that satisfies the application program.

在上述第一方面的一种可能的实现中,上述方法还包括:第一数据包括传感器获取的多个传感器数据以及各传感器数据对应的时间戳。In a possible implementation of the above first aspect, the above method further includes: the first data includes a plurality of sensor data acquired by the sensor and a timestamp corresponding to each sensor data.

可以理解,在本申请的一些实施例中,第一数据包括传感器数据和传感器数据对应的时间戳,传感器按照时间戳的先后顺序排序将传感器数据上报给处理器,以保证处理器获取传感器数据顺序的准确性。It can be understood that in some embodiments of the present application, the first data includes sensor data and the timestamp corresponding to the sensor data. The sensor reports the sensor data to the processor in order of the timestamps to ensure that the processor obtains the sensor data in order. accuracy.

在上述第一方面的一种可能的实现中,上述方法还包括:对应于第一帧数小于目标上报帧数,对第一数据补充第三数据,生成第二数据,包括:按照第一数据中各传感器数据的时间戳的先后,对多个传感器数据进行排序;将排序后的多个传感器数据分为多个传感器数据子集,其中,传感器数据子集的数目与第三数据的帧数相同,每个传感器数据子集中的传感器数据的数目相同;在不同传感器数据子集的相同部位插入数据插值,生成第二数据。In a possible implementation of the above first aspect, the above method further includes: corresponding to the first frame number being less than the target reporting frame number, supplementing the first data with third data, and generating the second data, including: according to the first data Sort the multiple sensor data according to the order of the timestamps of each sensor data; divide the sorted multiple sensor data into multiple sensor data subsets, where the number of sensor data subsets is equal to the number of frames of the third data The same, the number of sensor data in each sensor data subset is the same; data interpolation is inserted in the same position of different sensor data subsets to generate the second data.

可以理解,第一数据根据时间戳的先后顺序分成多个传感器数据子集,多个传感器数据子集也是按照时间戳的顺序排列,传感器数据子集的数目与需要补充的第三数据的帧数相同。每个传感器数据子集中,传感器数据的帧数相同。在进行补帧时,可以在每个传感器数据子集的相同部位插入数据插值,从而生成第二数据。例如,将第一数据按照时间戳的顺序分成4个传感器数据子集,每个传感器数据子集中包括3帧数据。则在进行补帧时,可以在每个传感器数据子集的第2帧和第3帧之间插入数据插值。以此,可以保证对第一数据补充第三数据的均匀性。在另一些实施例中,每个传感器数据子集中的传感器数据的帧数可以不同,例如,有两个传感器数据子集中的传感器数据的帧数差值为1,这种实施例是由于第一帧数不能均分到多个传感器数据子集中导致。It can be understood that the first data is divided into multiple sensor data subsets according to the order of timestamps, and the multiple sensor data subsets are also arranged in the order of timestamps. The number of sensor data subsets is related to the number of frames of the third data that need to be supplemented. same. The number of frames of sensor data is the same in each sensor data subset. When performing frame patching, data interpolation can be inserted at the same location in each sensor data subset to generate second data. For example, the first data is divided into 4 sensor data subsets in the order of time stamps, and each sensor data subset includes 3 frames of data. Then when performing frame complementation, data interpolation can be inserted between the 2nd and 3rd frames of each sensor data subset. In this way, the uniformity of supplementing the first data with the third data can be ensured. In other embodiments, the number of frames of sensor data in each sensor data subset may be different. For example, the difference in the number of frames of sensor data in two sensor data subsets is 1. This embodiment is due to the first The number of frames cannot be evenly divided into multiple sensor data subsets.

在上述第一方面的一种可能的实现中,上述方法还包括:通过以下方式中的任意一种生成数据差值:计算传感器数据子集中两端的两个传感器数据的平均值作为该传感器数据子集与相邻传感器数据子集之间的数据插值;对传感器数据子集中两端的至少两个传感器数据进行数据拟合,获取该传感器数据子集与相邻传感器数据子集之间的数据插值。In a possible implementation of the above first aspect, the above method further includes: generating a data difference value in any one of the following ways: calculating an average of two sensor data at both ends of the sensor data subset as the sensor data subset. Data interpolation between the set and adjacent sensor data subsets; perform data fitting on at least two sensor data at both ends of the sensor data subset to obtain data interpolation between the sensor data subset and adjacent sensor data subsets.

可以理解,在进行补帧时,可以获取补帧位置处相邻的两个传感器数据的平均值作为补充的传感器数据。在另一些实施例中,补充的数据例如还可以是对补帧位置相邻的多个传感器数据进行拟合,从而获取在补帧位置处拟合出的传感器数据作为补充的数据。通过上述方式获取补帧位置处的传感器数据,能够使补充的数据更加真实,保证传感器数据的精确度。It can be understood that when performing frame filling, the average value of two adjacent sensor data at the position of the filling frame can be obtained as supplementary sensor data. In other embodiments, the supplementary data may also be, for example, fitting multiple sensor data adjacent to the supplementary frame position, thereby obtaining the fitted sensor data at the supplementary frame position as the supplementary data. Obtaining the sensor data at the supplementary frame position through the above method can make the supplementary data more realistic and ensure the accuracy of the sensor data.

在上述第一方面的一种可能的实现中,上述方法还包括:对应于第一帧数大于目标上报帧数,在第一数据中删减第四数据,生成第二数据,包括:按照第一数据中各传感器数据的时间戳的先后,对多个传感器数据进行排序;从排序后的多个传感器数据中,以第一数目为间隔获取传感器数据,其中,获取的传感器数据的数目与第四数据的帧数相同;删除获取的传感器数据,生成第二数据。In a possible implementation of the above first aspect, the above method further includes: corresponding to the first frame number being greater than the target reporting frame number, deleting the fourth data from the first data, and generating the second data, including: according to the first Sort the multiple sensor data according to the time stamp of each sensor data in the data; from the sorted multiple sensor data, obtain sensor data at intervals of the first number, where the number of acquired sensor data is equal to the number of the first number. The number of frames of the four data is the same; delete the acquired sensor data and generate the second data.

可以理解,第一数据可以根据时间戳的先后顺序排列,在进行删减帧数时,以第一数目为间隔获取数据。第一数目可以根据删减的第四数据的帧数以及第一数据的第一帧数确定。例如第一帧数为12个,目标上报帧数为10帧,则第四数据的帧数是2,即需要删减2帧数据。则第一数目可以设置为5。即每隔5帧数据获取1帧数据,从而获取第6帧数据和第12帧数据作为删减的数据,剩下的10帧数据作为第二数据。It can be understood that the first data can be arranged according to the order of time stamps, and when deleting the number of frames, the data can be obtained at intervals of the first number. The first number may be determined based on the number of frames of the deleted fourth data and the number of first frames of the first data. For example, the number of first frames is 12, and the number of target reported frames is 10, then the number of frames of the fourth data is 2, that is, 2 frames of data need to be deleted. Then the first number can be set to 5. That is, 1 frame of data is obtained every 5 frames of data, thereby obtaining the 6th frame of data and the 12th frame of data as the deleted data, and the remaining 10 frames of data are used as the second data.

在上述第一方面的一种可能的实现中,上述方法还包括:基于传感器上报第一数据所用的第一时间和处理器的目标上报速度确定目标上报帧数。In a possible implementation of the above first aspect, the above method further includes: determining the target reporting frame number based on the first time it takes for the sensor to report the first data and the target reporting speed of the processor.

可以理解,处理器在向传感器下发目标上报速度后,可以基于目标上报速度以及传感器上报第一数据的第一时间,获取目标上报帧数,目标上报帧数即为目标上报速度与第一时间的乘积。It can be understood that after the processor sends the target reporting speed to the sensor, it can obtain the target reporting frame number based on the target reporting speed and the first time the sensor reports the first data. The target reporting frame number is the target reporting speed and the first time. product of .

第二方面,本申请实施例提供了一种电子设备,包括至少一个处理器和传感器;至少一个处理器用于:获取传感器上报的第一数据,第一数据具有第一帧数;确定第一帧数是否满足第一条件,其中,第一条件包括第一帧数与目标上报帧数不同;对应于第一帧数满足第一条件,将第一数据处理为第二数据,其中,第二数据的第二帧数与目标上报帧数相同;基于第二数据执行与第一数据相关的功能。In a second aspect, embodiments of the present application provide an electronic device, including at least one processor and a sensor; at least one processor is configured to: obtain the first data reported by the sensor, where the first data has a first frame number; determine the first frame Whether the number meets the first condition, where the first condition includes that the first frame number is different from the target reported frame number; corresponding to the first frame number meeting the first condition, the first data is processed into the second data, where the second data The second frame number is the same as the target reporting frame number; functions related to the first data are performed based on the second data.

可以理解,在处理器运行应用程序获取传感器数据时,会向传感器下发上报传感器数据的目标上报速度。传感器需要以目标上报速度上报数据,当传感器上报第一数据的速度不能达到目标上报速度时,处理器可以对第一数据进行调整,以满足传感器运行的应用程序的需求,从而保证应用程序实现相应功能的准确性。It can be understood that when the processor runs an application to obtain sensor data, the target reporting speed of the sensor data will be sent to the sensor. The sensor needs to report data at the target reporting speed. When the sensor reports the first data at a speed that cannot reach the target reporting speed, the processor can adjust the first data to meet the needs of the application running the sensor, thereby ensuring that the application implements the corresponding Functional accuracy.

在上述第二方面的一种可能的实现中,上述方法还包括:至少一个处理器包括第一处理器和第二处理器,其中,第一处理器用于获取传感器上报的第一数据;第一处理器确定第一帧数满足第一条件,将第一数据处理为第二数据;第二处理器用于从第一处理器获取第二数据,并执行与第一数据相关的功能。In a possible implementation of the second aspect, the method further includes: at least one processor including a first processor and a second processor, wherein the first processor is used to obtain the first data reported by the sensor; The processor determines that the first frame number meets the first condition and processes the first data into second data; the second processor is used to obtain the second data from the first processor and perform functions related to the first data.

可以理解,在本申请的一些实施例中,第二处理器例如可以是应用处理器,用于运行应用程序,例如计步器等。第一处理器例如可以是协处理器,用于获取传感器数据,并对传感器数据进行调整。例如,计步器应用对传感器上报的传感器数据的速度有精度要去时,协处理器在获取传感器上报的传感器数据时,将对传感器数据进行补充或者删减一些数据,然后再上报给应用处理,补充或者删减数据的过程具体参考下文描述。应用处理器在运行计步器应用时,根据协处理器上报的传感器数据进行计步计算。It can be understood that in some embodiments of the present application, the second processor may be, for example, an application processor, used to run application programs, such as a pedometer, etc. The first processor may be, for example, a co-processor, used to obtain sensor data and adjust the sensor data. For example, if a pedometer application requires precision in the speed of sensor data reported by the sensor, the coprocessor will supplement or delete some data from the sensor data when obtaining the sensor data reported by the sensor, and then report it to the application for processing. , please refer to the following description for the process of supplementing or deleting data. When the application processor runs the pedometer application, it performs step counting calculations based on the sensor data reported by the coprocessor.

第三方面,本申请实施例提供了一种计算机可读存储介质,可读存储介质上存储有指令,指令在计算机上执行时,使计算机执行上述第一方面及第一方面的各种可能实现提供的数据处理方法。In a third aspect, embodiments of the present application provide a computer-readable storage medium. Instructions are stored on the readable storage medium. When the instructions are executed on a computer, they cause the computer to execute the above-mentioned first aspect and various possible implementations of the first aspect. Provided data processing methods.

附图说明Description of the drawings

图1示出了一种电子设备的结构示意图;Figure 1 shows a schematic structural diagram of an electronic device;

图2示出了一种传感器向处理器传输数据的时序图;Figure 2 shows a timing diagram of a sensor transmitting data to a processor;

图3a根据本申请的一些实施例,示出了一种电子设备的结构示意图;Figure 3a shows a schematic structural diagram of an electronic device according to some embodiments of the present application;

图3b根据本申请的一些实施例,示出了一种传感器向处理器传输数据的时序图;Figure 3b shows a timing diagram of a sensor transmitting data to a processor according to some embodiments of the present application;

图4根据本申请的一些实施例,示出了一种传感器数据处理方法的实施流程图;Figure 4 shows an implementation flow chart of a sensor data processing method according to some embodiments of the present application;

图5根据本申请的一些实施例,示出了另一种传感器数据处理方法的实施流程图;Figure 5 shows an implementation flow chart of another sensor data processing method according to some embodiments of the present application;

图6根据本申请的一些实施例,示出了一种传感器数据处理过程的交互流程图;Figure 6 shows an interactive flow chart of a sensor data processing process according to some embodiments of the present application;

图7根据本申请的一些实施例,示出了一种电子设备的结构示意图;Figure 7 shows a schematic structural diagram of an electronic device according to some embodiments of the present application;

图8根据本申请的一些实施例,示出了一种手机的系统软件架构示意框图。Figure 8 shows a schematic block diagram of the system software architecture of a mobile phone according to some embodiments of the present application.

具体实施方式Detailed ways

本申请的说明性实施例包括但不限于数据处理方法、可读存储介质、电子设备。Illustrative embodiments of the present application include, but are not limited to, data processing methods, readable storage media, and electronic devices.

为了使本申请实施例的目的、技术方案和优点更加清楚,下面将结合说明书附图以及具体的实施方式对本申请实施例中的技术方案进行详细的说明。In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described in detail below with reference to the accompanying drawings and specific implementation modes.

图1示出了一种电子设备100的结构示意图。Figure 1 shows a schematic structural diagram of an electronic device 100.

如图1所示,电子设备100包括处理器110和传感器模块180。其中,传感器模块180包括存储器13。As shown in FIG. 1 , the electronic device 100 includes a processor 110 and a sensor module 180 . Among them, the sensor module 180 includes a memory 13 .

处理器110运行应用程序,并基于从传感器模块180获取的加速度数据,确定相应应用程序的功能。例如,处理器110可以运行计步应用程序,并基于传感器模块180上报的加速度数据,通过计步算法从加速度数据中提取出步态特征的方式,实现计步功能。The processor 110 runs the application program and determines the function of the corresponding application program based on the acceleration data obtained from the sensor module 180 . For example, the processor 110 can run a pedometer application, and based on the acceleration data reported by the sensor module 180, implement the pedometer function by extracting gait features from the acceleration data through a pedometer algorithm.

存储器13用于存储传感器模块180检测到的数据,例如加速度数据等。在一些实施例中,存储器13可以通过先进先出队列(first in first out,FIFO)存储加速度数据,传感器模块180可以将检测到的加速度数据逐帧添加到FIFO中。当存储器13缓存的数据达到预设数据量时,例如达到预设帧数时,传感器模块180触发中断,并将存储器13内的数据传输给处理器110。The memory 13 is used to store data detected by the sensor module 180, such as acceleration data. In some embodiments, the memory 13 may store acceleration data through a first in first out (FIFO) queue, and the sensor module 180 may add the detected acceleration data to the FIFO frame by frame. When the data cached in the memory 13 reaches a preset data amount, for example, when a preset number of frames is reached, the sensor module 180 triggers an interrupt and transmits the data in the memory 13 to the processor 110 .

可以理解,一帧数据中可以包括传感器模块180的加速度数据,以及对应加速度数据的时间戳。It can be understood that one frame of data may include acceleration data of the sensor module 180 and a timestamp corresponding to the acceleration data.

由于传感器模块180的采集一帧数据的时长并不是固定的,每次存储器13中的数据缓存到预设帧数所需的时间也会存在差异,也就是说传感器模块180触发中断的间隔不同,传感器模块180的ODR是变化的。如此,如果传感器模块180的ODR变化较大,即传感器模块180的ODR的精度较低,传感器模块180在单位时间内上报给处理器110的数据的帧数的变化也较大,可能会导致应用程序的功能异常。Since the length of time for the sensor module 180 to collect one frame of data is not fixed, the time required for the data in the memory 13 to be cached to the preset number of frames will also be different each time. That is to say, the interval at which the sensor module 180 triggers an interrupt is different. The ODR of sensor module 180 varies. In this way, if the ODR of the sensor module 180 changes greatly, that is, the accuracy of the ODR of the sensor module 180 is low, the number of frames of data reported by the sensor module 180 to the processor 110 within a unit time also changes greatly, which may cause the application to fail. The program functions abnormally.

例如,图2示出了一种传感器模块180向处理器110传输数据的时序图。For example, FIG. 2 shows a timing diagram in which the sensor module 180 transmits data to the processor 110 .

如图2所示,假设传感器模块180每缓存20帧数据向处理器110上报一次,即每缓存20帧数据触发一次中断。假设传感器模块180从t1=0ms开始传输数据,第一次触发中断的时间为t2=200ms,第二次触发中断的时间为t3=440ms。也就是说,在t1到t2期间,传感器模块180的ODR为20帧/200ms×1000=100帧/s,即每秒上报100帧数据,t2到t3期间,传感器模块180的ODR为20帧/240ms×1000=83帧/s,即每秒上报83帧数据。As shown in FIG. 2 , it is assumed that the sensor module 180 reports to the processor 110 every 20 frames of data cached, that is, an interrupt is triggered every 20 frames of data cached. Assume that the sensor module 180 starts transmitting data from t1=0ms, the first time the interrupt is triggered is t2=200ms, and the second time the interrupt is triggered is t3=440ms. That is to say, from t1 to t2, the ODR of the sensor module 180 is 20 frames/200ms×1000=100 frames/s, that is, 100 frames of data are reported per second. From t2 to t3, the ODR of the sensor module 180 is 20 frames/s. 240ms×1000=83 frames/s, that is, 83 frames of data are reported per second.

如果应用程序需求的ODR是100帧/s,即在0至t3时间内传感器模块180需要上报的数据帧数应当为440ms×100帧/s=44帧。而传感器模块180实际在0至t3时间内发生了两次中断,每次中断上报20帧数据。因此传感器模块180实际上报的数据为40帧,与应用程序所需的数据量不同,可能会导致应用程序获得的计步数据也会不准确。If the ODR required by the application is 100 frames/s, that is, the number of data frames that the sensor module 180 needs to report between 0 and t3 should be 440ms×100 frames/s=44 frames. The sensor module 180 actually has two interrupts between 0 and t3, and each interrupt reports 20 frames of data. Therefore, the data actually reported by the sensor module 180 is 40 frames, which is different from the amount of data required by the application, which may cause the step counting data obtained by the application to be inaccurate.

为了解决上述问题,本申请提供了一种传感器数据处理方法,电子设备中的处理器从传感器模块180获取应用程序所需的传感器数据时,可以在应用程序的数据上报要求(例如目标ODR、是否高精度上报等)满足调整条件时,将传感器每次中断触发后上报的数据帧数调整到与目标ODR对应的数据帧数(以下称为目标上报帧数)一致后,再传送给应用程序。In order to solve the above problems, this application provides a sensor data processing method. When the processor in the electronic device obtains the sensor data required by the application program from the sensor module 180, it can report the data reporting requirements of the application program (such as target ODR, whether When the adjustment conditions are met (high-precision reporting, etc.), the number of data frames reported by the sensor after each interrupt trigger is adjusted to be consistent with the number of data frames corresponding to the target ODR (hereinafter referred to as the target number of reported frames), and then transmitted to the application.

例如,调整条件为目标ODR达到预设值时,例如达到传感器模块180的极限ODR的80%。或者应用程序要求高精度ODR上报传感器数据。在满足调整条件后,处理器会对传感器上报数据的ODR进行调整,从而以目标ODR将传感器数据传送给应用程序。For example, the adjustment condition is when the target ODR reaches a preset value, for example, reaches 80% of the limit ODR of the sensor module 180 . Or the application requires high-precision ODR to report sensor data. After the adjustment conditions are met, the processor adjusts the ODR of the data reported by the sensor, thereby transmitting the sensor data to the application program with the target ODR.

调整方式例如是在传感器上报中断触发时的数据帧数(以下称为缓存帧数)小于目标上报帧数时,处理器可以通过补帧的方式将传感器上报的数据帧数补齐至目标上报帧数再传送给应用程序。补帧的方式例如可以通过在补帧位置处基于帧数数据进行拟合插值。The adjustment method is, for example, when the number of data frames when the sensor reporting interrupt is triggered (hereinafter referred to as the number of cached frames) is less than the target reporting frame number, the processor can supplement the number of data frames reported by the sensor to the target reporting frame by padding frames. The data is then sent to the application. The frame-filling method may be, for example, by performing fitting interpolation based on the frame number data at the frame-filling position.

再例如,调整方式为传感器出现数据溢出,即传感器触发中断时上报的帧数大于目标上报帧数。处理器可以删除传感器上报的部分帧数,使上报的数据帧数与目标上报帧数相同后,再传送给应用程序。For another example, the adjustment method is that data overflow occurs in the sensor, that is, the number of frames reported when the sensor triggers an interrupt is greater than the target number of frames reported. The processor can delete some of the frames reported by the sensor to make the number of data frames reported equal to the target number of frames reported, and then transmit it to the application.

通过本申请提供的数据处理的方法,在应用程序的数据上报要求满足调整条件时,能够使应用程序获取数据的ODR与目标ODR相同。从而保证应用程序能够获得准确的数据量,实现相应的功能。Through the data processing method provided by this application, when the data reporting requirements of the application meet the adjustment conditions, the ODR of the data obtained by the application can be the same as the target ODR. This ensures that applications can obtain accurate amounts of data and implement corresponding functions.

此外,处理器是在应用程序对传感器ODR的要求满足调整条件时,开启上述的调整方案(以下称为ODR调整方案),保证传感器ODR的精度,从而保证对应应用程序功能的准确性。而在应用程序对传感器的ODR的要求不满足调整条件时时,处理器则关闭ODR调整方案,从而保证传感器数据的准确性,以满足应用程序对传感器数据精度的要求。In addition, when the application's requirements for the sensor ODR meet the adjustment conditions, the processor starts the above-mentioned adjustment scheme (hereinafter referred to as the ODR adjustment scheme) to ensure the accuracy of the sensor ODR, thereby ensuring the accuracy of the corresponding application function. When the application program's requirements for the ODR of the sensor do not meet the adjustment conditions, the processor turns off the ODR adjustment scheme to ensure the accuracy of the sensor data and meet the application program's requirements for sensor data accuracy.

应理解,目标上报帧数可以根据目标ODR、传感器该次上报数据距离上次上报数据的时间间隔DT来确定。示例性地,目标上报帧数可以是目标ODR与DT的乘积。例如,假设目标ODR为100帧/秒,DT=200ms,则目标上报帧数为100帧/秒×200ms=20帧。It should be understood that the number of frames reported by the target can be determined based on the target ODR and the time interval DT between the data reported by the sensor and the data reported last time by the sensor. For example, the target reporting frame number may be the product of the target ODR and DT. For example, assuming that the target ODR is 100 frames/second and DT=200ms, the target number of frames reported is 100 frames/second × 200ms = 20 frames.

具体地,图3a根据本申请的实施例示出了一种电子设备100的结构示意图。Specifically, FIG. 3a shows a schematic structural diagram of an electronic device 100 according to an embodiment of the present application.

如图3a所示,电子设备100包括处理器110和传感器模块180。其中,处理器110中包括应用处理器14和协处理器15,传感器模块180中包括存储器13。As shown in Figure 3a, the electronic device 100 includes a processor 110 and a sensor module 180. The processor 110 includes an application processor 14 and a co-processor 15 , and the sensor module 180 includes a memory 13 .

存储器13用于存储传感器模块180检测到的传感器数据。当存储器13缓存的数据达到预设数据量时,例如达到预设帧数时。传感器模块180触发中断,并将存储器13内的数据传输给协处理器15。The memory 13 is used to store sensor data detected by the sensor module 180 . When the data cached in the memory 13 reaches a preset data amount, for example, when a preset number of frames is reached. The sensor module 180 triggers an interrupt and transmits the data in the memory 13 to the coprocessor 15 .

协处理器15用于从传感器模块180获取的加速度数据,并对加速度数据进行调整,使传感器模块180的ODR满足应用程序的目标ODR。例如,协处理器15可以启动ODR调整方案,对传感器模块180上报的加速度数据进行补帧或者删减,使传感器模块180的ODR满足目标ODR。并将调整后的传感器数据上报给应用处理器14。The coprocessor 15 is used to obtain acceleration data from the sensor module 180 and adjust the acceleration data so that the ODR of the sensor module 180 meets the target ODR of the application program. For example, the coprocessor 15 can initiate an ODR adjustment plan to supplement or delete the acceleration data reported by the sensor module 180 so that the ODR of the sensor module 180 meets the target ODR. and report the adjusted sensor data to the application processor 14 .

应用处理器14用于运行应用程序,并基于从协处理器15获取的加速度数据,确定相应应用程序的功能。例如,应用处理器14可以运行计步应用程序,并基于协处理器15上报的加速度数据,通过计步算法从加速度数据中提取出步态特征的方式,实现计步功能。The application processor 14 is used to run the application program and determine the function of the corresponding application program based on the acceleration data obtained from the coprocessor 15 . For example, the application processor 14 can run a pedometer application program, and based on the acceleration data reported by the coprocessor 15, implement the pedometer function by extracting gait features from the acceleration data through a pedometer algorithm.

通过本实施例的电子设备,在应用程序对传感器模块180的ODR精度有需求时,协处理器15可以启动ODR调整方案,从而对传感器模块180上报的数据进行调整,使应用处理器14获取数据的ODR满足应用程序的目标ODR。Through the electronic device of this embodiment, when the application program has requirements for the ODR accuracy of the sensor module 180, the coprocessor 15 can start the ODR adjustment scheme, thereby adjusting the data reported by the sensor module 180, so that the application processor 14 can obtain the data. The ODR meets the application's target ODR.

图3b根据本申请的实施例示出了一种传感器模块180向协处理器15传输数据的时序图。FIG. 3b shows a timing diagram in which the sensor module 180 transmits data to the coprocessor 15 according to an embodiment of the present application.

如图3b所示,假设传感器模块180的目标ODR为100帧/秒、目标ODR大于预设ODR,并且传感器模块180每缓存20帧数据触发一次中断,将缓存的数据上报给协处理器15。As shown in Figure 3b, assume that the target ODR of the sensor module 180 is 100 frames/second, the target ODR is greater than the preset ODR, and the sensor module 180 triggers an interrupt every 20 frames of data cached, and reports the cached data to the coprocessor 15.

参考图3b,传感器模块180第一次开始缓存数据的时间为t1=0ms,缓存到20帧数据的时间为t2=200ms,即传感器模块180在第200ms时触发一次中断,将缓存的数据上报给协处理器15。此时实际ODR=20帧/200ms=100帧/秒,与目标ODR一致,协处理器15无需对数据进行处理,直接传送给应用程序。Referring to Figure 3b, the time when the sensor module 180 starts to cache data for the first time is t1=0ms, and the time when it caches 20 frames of data is t2=200ms. That is, the sensor module 180 triggers an interrupt at the 200ms and reports the cached data to Coprocessor 15. At this time, the actual ODR = 20 frames/200ms = 100 frames/second, which is consistent with the target ODR. The coprocessor 15 does not need to process the data and directly transmits it to the application program.

继续参考图3b,传感器模块180第二次触发中断的时间为t3=410ms,DT=t3-t2=210ms。此时,实际ODR=20帧/210ms=95.2帧/秒,小于目标ODR。也就是说传感器模块180缓存20帧数据的时间变长,传感器模块180实际ODR达不到目标ODR,协处理器15需要对传感器模块180上报的数据进行补帧。此时,目标上报帧数为100帧/秒×210ms=21帧,协处理器15可以在传感器模块180上报的数据中插入一帧数据后再上报给应用处理器14,应用处理器14运行应用程序,使应用程序在210ms内接收到21帧数据,从而确保应用程序获取数据的ODR与目标ODR相同。Continuing to refer to Figure 3b, the time when the sensor module 180 triggers the interrupt for the second time is t3=410ms, DT=t3-t2=210ms. At this time, the actual ODR=20 frames/210ms=95.2 frames/second, which is smaller than the target ODR. That is to say, the time for the sensor module 180 to cache 20 frames of data becomes longer, the actual ODR of the sensor module 180 cannot reach the target ODR, and the coprocessor 15 needs to frame the data reported by the sensor module 180 . At this time, the target number of frames to be reported is 100 frames/second × 210ms = 21 frames. The coprocessor 15 can insert one frame of data into the data reported by the sensor module 180 and then report it to the application processor 14. The application processor 14 runs the application. The program enables the application to receive 21 frames of data within 210ms, thereby ensuring that the ODR of the application's data acquisition is the same as the target ODR.

示例性地,协处理器15可以在第21帧到第40帧之间的补帧例如可以是在第30帧后面插入第30’帧数据,即在传感器模块180上报数据的中间部分插入一帧数据。For example, the coprocessor 15 can insert the 30th frame data after the 30th frame in the supplementary frame between the 21st frame and the 40th frame, that is, insert a frame in the middle part of the data reported by the sensor module 180 data.

应理解,在另一些实施例中,协处理器15还可以在传感器模块180上报的数据的头部或者尾部插入一帧数据。It should be understood that in other embodiments, the coprocessor 15 can also insert a frame of data at the head or tail of the data reported by the sensor module 180 .

继续参考图3b,传感器模块180第三次触发中断的时间为t4=580ms,DT=t4-t3=170ms,此时,实际ODR=20帧/170ms=117.6帧/秒,大于目标ODR。也就是说传感器模块180缓存20帧数据的时间变短,传感器模块180实际ODR超过目标ODR,协处理器15需要对传感器模块180上报的数据进行删减。此时,目标上报帧数为100帧/秒×170ms=17帧,因此协处理器15可以在传感器模块180第三次中断触发上报数据中删减三帧数据,以确保应用程序获取的数据的ODR与目标ODR相同。例如,协处理器15可以删除第41帧、第50帧以及第60帧的数据,从而使得应用程序在170ms内只获取到17帧数据。Continuing to refer to Figure 3b, the time when the sensor module 180 triggers the interrupt for the third time is t4=580ms, DT=t4-t3=170ms. At this time, the actual ODR=20 frames/170ms=117.6 frames/second, which is greater than the target ODR. That is to say, the time for the sensor module 180 to cache 20 frames of data becomes shorter, the actual ODR of the sensor module 180 exceeds the target ODR, and the coprocessor 15 needs to delete the data reported by the sensor module 180 . At this time, the target number of frames to be reported is 100 frames/second × 170ms = 17 frames. Therefore, the coprocessor 15 can delete three frames of data from the third interrupt triggered reporting data of the sensor module 180 to ensure the accuracy of the data obtained by the application program. The ODR is the same as the target ODR. For example, the coprocessor 15 can delete the data of the 41st frame, the 50th frame and the 60th frame, so that the application program only obtains 17 frames of data within 170ms.

如此,可以保证应用程序获取传感器数据的速度与目标ODR相同,从而保证应用程序实现相应功能的准确性。In this way, it can be guaranteed that the speed at which the application obtains sensor data is the same as the target ODR, thus ensuring the accuracy of the application in implementing the corresponding functions.

图4根据本申请的实施例示出了一种传感器数据处理方法的实施流程图。Figure 4 shows an implementation flow chart of a sensor data processing method according to an embodiment of the present application.

可以理解,本申请实施例所提供的传感器数据处理方法应用于电子设备中,该电子设备可以包括但不限于:手机、平板、电脑、智能手表、车机会议终端、桌面型、膝上型、手持计算机、上网本,以及增强现实(augmented reality,AR)\虚拟现实(virtual reality,VR)设备、智能电视、智能手表等可穿戴设备、服务器、便携式游戏机、便携式音乐播放器、阅读器设备、其中嵌入或耦接有一个或多个处理器、或包括传感器的其他电子设备。It can be understood that the sensor data processing method provided by the embodiment of the present application is applied to electronic devices. The electronic devices may include but are not limited to: mobile phones, tablets, computers, smart watches, car-machine conference terminals, desktops, laptops, Handheld computers, netbooks, as well as augmented reality (AR)/virtual reality (VR) devices, smart TVs, smart watches and other wearable devices, servers, portable game consoles, portable music players, reader devices, One or more processors or other electronic devices including sensors are embedded or coupled therein.

应理解,以下各个步骤的执行主体可以均为电子设备中用于处理传感器数据的协处理器,例如前述电子设备100的协处理器15。以下在介绍各个步骤时,不再介绍各个步骤的执行主体。It should be understood that the execution subject of each of the following steps may be a co-processor in the electronic device for processing sensor data, such as the co-processor 15 of the aforementioned electronic device 100 . When introducing each step below, the execution subject of each step will not be introduced.

401,向传感器下发应用程序的目标ODR。401. Send the target ODR of the application to the sensor.

示例性地,在应用处理器14运行应用程序需要获取传感器的数据时,会向协处理器15下发目标ODR,目标ODR为应用程序获取传感器数据的速度。协处理器15将目标ODR发送给传感器,传感器按照目标ODR向协处理器15传输采集到的传感器数据。For example, when the application processor 14 needs to obtain sensor data when running an application program, it will issue a target ODR to the coprocessor 15 , where the target ODR is the speed at which the application program obtains sensor data. The coprocessor 15 sends the target ODR to the sensor, and the sensor transmits the collected sensor data to the coprocessor 15 according to the target ODR.

402,判断目标ODR是否达到传感器的极限ODR。402, determine whether the target ODR reaches the limit ODR of the sensor.

示例性地,传感器本身具有极限ODR数据,当传感器在极限ODR下传输数据时,ODR会有较大的误差,需要对传感器传输的数据进行处理。因此,当协处理器15获取传感器上报的数据时,需要判断目标ODR是否达到极限ODR。应理解,传感器最大只能以极限ODR传输数据,当目标ODR大于极限ODR时,传感器以极限ODR传输数据。For example, the sensor itself has extreme ODR data. When the sensor transmits data under the extreme ODR, the ODR will have a large error, and the data transmitted by the sensor needs to be processed. Therefore, when the coprocessor 15 obtains the data reported by the sensor, it needs to determine whether the target ODR reaches the limit ODR. It should be understood that the sensor can only transmit data at the limit ODR. When the target ODR is greater than the limit ODR, the sensor transmits data at the limit ODR.

若判断结果为是,例如协处理器15检测到目标ODR大于极限ODR,传感器需要以极限ODR传输数据,会出现较大的误差,则执行404步骤,判断目标ODR是否大于传感器的实际ODR。以便对传感器的ODR进行调整。If the judgment result is yes, for example, the coprocessor 15 detects that the target ODR is greater than the limit ODR and the sensor needs to transmit data with the limit ODR, which will cause a large error, then step 404 is executed to determine whether the target ODR is greater than the actual ODR of the sensor. In order to adjust the ODR of the sensor.

若判断结果为否,例如协处理器15检测到目标ODR没有达到极限ODR,传感器在传输数据时的误差在应用程序的允许范围内,则执行403步骤,判断应用程序是否开启高精度订阅。If the judgment result is no, for example, the coprocessor 15 detects that the target ODR does not reach the limit ODR and the error of the sensor when transmitting data is within the allowable range of the application, then step 403 is executed to determine whether the application has turned on high-precision subscription.

403,判断应用程序是否开启高精度订阅。403, determine whether the application enables high-precision subscription.

示例性地,在一些实施例中,应用程序对传感器的ODR有精度要求。因此,对这类应用程序在获取传感器数据时,需要保证传感器ODR的精确度。例如,电子设备中可以存储白名单,以便于协处理器15可以基于白名单来判断应用程序是否开启高精度订阅。例如,在应用程序获取传感器的数据时,协处理器15可以通过判断对应应用程序是否在白名单中,从而确定是否在向应用处理器14上报数据时对数据进行调整。For example, in some embodiments, the application has accuracy requirements for the ODR of the sensor. Therefore, when acquiring sensor data for such applications, it is necessary to ensure the accuracy of the sensor ODR. For example, a whitelist can be stored in the electronic device, so that the coprocessor 15 can determine whether the application program enables high-precision subscription based on the whitelist. For example, when an application obtains sensor data, the coprocessor 15 can determine whether to adjust the data when reporting the data to the application processor 14 by determining whether the corresponding application is in the whitelist.

若判断结果为是,例如应用程序在白名单里,应用程序对传感器的ODR精度有要求。则执行404步骤,判断目标ODR是否大于传感器的实际ODR。If the judgment result is yes, for example, the application is in the whitelist, the application has requirements for the ODR accuracy of the sensor. Then execute step 404 to determine whether the target ODR is greater than the actual ODR of the sensor.

若判断结果为否,例如应用程序没有在白名单里,应用程序对传感器的ODR精度没有特殊要求,传感器在传输数据时的误差在应用程序的允许范围内,则执行407步骤,上报数据。If the judgment result is no, for example, the application is not in the whitelist, the application has no special requirements for the ODR accuracy of the sensor, and the error when the sensor transmits data is within the allowable range of the application, then step 407 is executed to report the data.

在另一些实施例中,高精度订阅可以基于投票机制确定。以加速度传感器为例,如果第一应用、第二应用和第三应用均需要用到加速度传感器的数据。第一应用和第三应用对加速度传感器的ODR没有精度要求,并且第一应用和第三应用的目标ODR没有达到加速度传感器的极限ODR。而第二应用对加速度传感器的ODR有精度要求。则协处理器15在获取加速度传感器上报的数据后,需要开启ODR调整方案,对加速度传感器的ODR进行调整。应理解,投票机制例如可以是,传感器选择多个应用程序中精度要求最高的ODR上报传感器数据。In other embodiments, high-precision subscriptions may be determined based on a voting mechanism. Taking the acceleration sensor as an example, if the first application, the second application and the third application all need to use the data of the acceleration sensor. The first application and the third application have no accuracy requirements for the ODR of the acceleration sensor, and the target ODR of the first application and the third application do not reach the limit ODR of the acceleration sensor. The second application has accuracy requirements for the ODR of the acceleration sensor. Then, after acquiring the data reported by the acceleration sensor, the coprocessor 15 needs to start the ODR adjustment scheme and adjust the ODR of the acceleration sensor. It should be understood that the voting mechanism may be, for example, that the sensor selects the ODR with the highest accuracy requirement among multiple applications to report sensor data.

在另一些实施例中,高精度订阅的投票机制例如还可以根据应用程序的目标ODR大小设置。例如,第一应用程序、第二应用程序和第三应用程序均需要获取加速度传感器的加速度数据,其中,第一应用的目标ODR最高,达到1000Hz。则加速度传感器就需要以最高的目标ODR传输数据,即以1000Hz的速度传输数据。如果传感器的极限ODR就是1000Hz,则协处理器15需要开启ODR调整方案,以保证协处理器15向应用处理器14上报数据的速度稳定在1000Hz。应理解,投票机制例如可以是,传感器按照多个应用中目标ODR最大的ODR上报传感器数据。In other embodiments, the voting mechanism for high-precision subscriptions can also be set according to the target ODR size of the application. For example, the first application, the second application, and the third application all need to obtain acceleration data from the acceleration sensor. Among them, the first application has the highest target ODR, reaching 1000 Hz. Then the acceleration sensor needs to transmit data at the highest target ODR, that is, transmit data at a speed of 1000Hz. If the sensor's limit ODR is 1000Hz, the coprocessor 15 needs to enable the ODR adjustment scheme to ensure that the speed at which the coprocessor 15 reports data to the application processor 14 is stable at 1000Hz. It should be understood that the voting mechanism may be, for example, that the sensor reports sensor data according to the ODR with the largest target ODR among multiple applications.

可以理解,在另一种实施例中,402的判断步骤可以与403的步骤颠倒。即先判断应用程序是否开启高精度订阅,再判断应用程序的目标ODR是否达到传感器的极限ODR。本实施例各个步骤的标号顺序以及描述顺序并不对步骤执行的次序做具体的限定。It can be understood that in another embodiment, the judgment step of 402 may be reversed from the step of 403. That is, first determine whether the application has turned on high-precision subscription, and then determine whether the application's target ODR reaches the sensor's limit ODR. The numbering sequence and description sequence of each step in this embodiment do not specifically limit the execution order of the steps.

404,判断目标ODR是否大于传感器的实际ODR。404, determine whether the target ODR is greater than the actual ODR of the sensor.

示例性地,传感器将采集到的数据缓存到内部的存储器中,当存储器的数据达到预设值时,传感器触发一次中断,将存储器中缓存的数据上报给协处理器15。传感器每次触发中断时会记录中断的时间戳,协处理器15可以根据中断时间戳可以获得传感器每次缓存到预设数据的缓存时间。例如,当前触发中断的时间戳与上一次触发中断的时间戳相减,就是存储器上一次缓存到预设数据量的缓存时间(以下称为实际缓存时间,也即前述DT)。如果实际缓存时间大于传感器在目标ODR下的缓存时间(以下称为目标缓存时间),则可以确定传感器的实际ODR小于目标ODR。同样,如果协处理器15检测到传感器的实际缓存时间小于目标缓存时间,则可以表示,传感器的实际ODR大于目标ODR。For example, the sensor caches the collected data into an internal memory. When the data in the memory reaches a preset value, the sensor triggers an interrupt and reports the data cached in the memory to the coprocessor 15 . Each time the sensor triggers an interrupt, it will record the timestamp of the interrupt. The coprocessor 15 can obtain the cache time of each time the sensor caches preset data based on the interrupt timestamp. For example, subtracting the timestamp of the current interrupt triggering from the timestamp of the last triggering interrupt is the cache time of the last time the memory cached a preset amount of data (hereinafter referred to as the actual cache time, also known as the aforementioned DT). If the actual cache time is greater than the cache time of the sensor under the target ODR (hereinafter referred to as the target cache time), it can be determined that the actual ODR of the sensor is less than the target ODR. Similarly, if the coprocessor 15 detects that the actual cache time of the sensor is less than the target cache time, it can mean that the actual ODR of the sensor is greater than the target ODR.

若判断结果为是,例如,协处理器15检测到传感器的实际缓存时间大于目标缓存时间,表示目标ODR大于实际ODR,则执行406步骤,对传感器数据进行补帧。If the judgment result is yes, for example, the coprocessor 15 detects that the actual cache time of the sensor is greater than the target cache time, indicating that the target ODR is greater than the actual ODR, step 406 is executed to frame the sensor data.

若判断结果为否,例如,协处理器15检测到传感器的实际缓存时间小于目标缓存时间,表示目标ODR小于实际ODR,则执行405步骤,删除部分传感器数据。If the judgment result is no, for example, the coprocessor 15 detects that the actual cache time of the sensor is less than the target cache time, indicating that the target ODR is less than the actual ODR, step 405 is executed to delete part of the sensor data.

405,删除部分传感器数据。405, delete some sensor data.

示例性地,当传感器的实际ODR大于目标ODR时,传感器每次触发中断的时间会缩短。因此,协处理器15可以对传感器上报的数据删减一些数据,才能够保证向应用处理器14上报数据的帧数与目标上报帧数一致。For example, when the actual ODR of the sensor is greater than the target ODR, the time for each interrupt triggered by the sensor will be shortened. Therefore, the coprocessor 15 can delete some data from the data reported by the sensor to ensure that the number of frames reported to the application processor 14 is consistent with the target number of frames reported.

例如,对于前述图3所示的情形,目标ODR为100帧/s,传感器内的存储器每缓存20帧数据触发一次中断,则目标缓存时间为200ms。但是传感器传输20帧数据时用了170ms,此时,传感器的实际ODR为20帧/170ms=118帧/秒,大于目标ODR。此时,目标上报帧数为100帧/秒×170ms=17帧。因此,传感器实际上报的帧数比目标上报帧数多了20帧-17帧=3帧数据。所以,协处理器15需要对传感器上报的数据删减3帧数据。For example, for the situation shown in Figure 3 mentioned above, the target ODR is 100 frames/s, and the memory in the sensor triggers an interrupt every 20 frames of data cached, then the target cache time is 200ms. However, it takes 170ms for the sensor to transmit 20 frames of data. At this time, the actual ODR of the sensor is 20 frames/170ms = 118 frames/second, which is greater than the target ODR. At this time, the target number of frames reported is 100 frames/second × 170ms = 17 frames. Therefore, the number of frames actually reported by the sensor is 20 frames - 17 frames = 3 frames more than the number of frames reported by the target. Therefore, the coprocessor 15 needs to delete 3 frames of data from the data reported by the sensor.

示例性地,协处理器15删减帧数数据的方式例如可以是将20帧数据分成2个区域,在每个区域端点的位置删减相应的数据。在另一些实施例中,删减数据的位置还可以根据每帧数据的时间戳来设置。例如在20帧数据中选择相邻两帧数据的时间戳最短的3组数据,在每组数据中选择一帧数据进行删减,以此删减3帧数据,能够使剩下17帧数据的分布更加均匀。可以理解,本方案对删减帧数的位置并不做具体的限定,可以根据具体的需要在相应的位置进行删减帧数。For example, the way the coprocessor 15 deletes the frame number data may be to divide the 20 frames of data into two regions, and delete the corresponding data at the endpoint of each region. In other embodiments, the position of the deleted data can also be set according to the timestamp of each frame of data. For example, among 20 frames of data, select 3 groups of data with the shortest timestamps of two adjacent frames of data, and select one frame of data in each group of data to delete. In this way, 3 frames of data can be deleted, so that the remaining 17 frames of data can be deleted. The distribution is more even. It can be understood that this solution does not specifically limit the position where the number of frames is deleted, and the number of frames can be deleted at the corresponding position according to specific needs.

406,对传感器数据进行补帧。406. Frame complement the sensor data.

示例性地,当传感器的实际ODR小于目标ODR时,传感器每次中断的时间会延长,因此,协处理器15需要补充一些数据,才能够保证向应用处理器14上报数据的速度满足目标ODR。For example, when the actual ODR of the sensor is less than the target ODR, the time of each interruption of the sensor will be extended. Therefore, the coprocessor 15 needs to supplement some data to ensure that the speed of reporting data to the application processor 14 meets the target ODR.

例如,目标ODR为100帧/秒,存储器13每缓存20帧数据传感器会触发一次中断,即传感器需要每200ms触发一次中断。但是传感器传输20帧数据时用了240ms,传感器的实际ODR为20帧/240ms=83帧/秒,小于目标ODR。此时,目标上报帧数为100帧/秒×240ms=24帧。因此,传感器实际上报的数据比目标上报的数据少了24帧-20帧=4帧。所以,协处理器15需要对传感器上报的数据补4帧数据。For example, if the target ODR is 100 frames/second, the sensor will trigger an interrupt every 20 frames of data cached in the memory 13, that is, the sensor needs to trigger an interrupt every 200ms. However, it takes 240ms for the sensor to transmit 20 frames of data. The actual ODR of the sensor is 20 frames/240ms = 83 frames/second, which is smaller than the target ODR. At this time, the target number of frames reported is 100 frames/second × 240ms = 24 frames. Therefore, the data actually reported by the sensor is 24 frames - 20 frames = 4 frames less than the data reported by the target. Therefore, the coprocessor 15 needs to supplement the data reported by the sensor with 4 frames of data.

补帧的方式例如可以是将20帧数据分成3个区域,在每个区域端点的位置补充相应的数据。在另一些实施例中,补帧的位置还可以根据每帧数据的时间戳来设置,例如在相邻两针时间戳最长的4个节点进行补帧。可以理解,本方案对补帧的位置并不做具体的限定,可以根据具体的需要在相应的位置进行补帧。补充帧数的数据大小例如可以根据补帧位置附近的数据来确定。例如,协处理器15通过取补帧位置相邻的两个数据平均值作为补帧的数据。在另一些实施例中,协处理器15还可以将20帧数据以时间为横轴,传感器采集的数值为纵轴,拟合一条曲线。然后在曲线上选择补帧的时间点对应的数值作为补帧的数据,或者采用最邻近法、线性插值等方法进行补帧。The method of supplementing frames can be, for example, dividing 20 frames of data into three regions, and supplementing corresponding data at the endpoints of each region. In other embodiments, the position of the supplementary frame can also be set according to the timestamp of each frame of data, for example, the supplementary frame is performed on the four nodes with the longest timestamps of two adjacent needles. It can be understood that this solution does not specifically limit the position of the supplementary frame, and the supplementary frame can be performed at the corresponding position according to specific needs. The data size of the supplementary frame number may be determined based on data near the supplementary frame position, for example. For example, the coprocessor 15 takes the average of two data adjacent to the complementary frame position as the data of the complementary frame. In other embodiments, the coprocessor 15 can also fit the 20 frames of data to a curve with time as the horizontal axis and the values collected by the sensor as the vertical axis. Then select the value corresponding to the time point of the frame on the curve as the data of the frame, or use the nearest neighbor method, linear interpolation and other methods to complement the frame.

407,上报数据。407, report data.

示例性地,协处理器15在调整完传感器的数据后即可将传感器数据上报给应用处理器14,应用处理器14运行应用程序,并基于协处理器15上报的传感器数据实现相应的功能。可以理解,如果传感器数据不需要调整时,协处理器15可以直接把获取的传感器数据上报给应用处理器14。For example, after adjusting the sensor data, the coprocessor 15 can report the sensor data to the application processor 14. The application processor 14 runs the application program and implements corresponding functions based on the sensor data reported by the coprocessor 15. It can be understood that if the sensor data does not need to be adjusted, the coprocessor 15 can directly report the acquired sensor data to the application processor 14 .

在本申请的实施例中,在协处理器15需要获取传感器数据时,可以根据应用程序的需求开启ODR调整方案。例如,当应用程序的目标ODR达到传感器的极限ODR时,或者应用程序对传感器的ODR有精度要求时,协处理器15开启ODR调整方案。以保证应用程序能够以目标ODR获取传感器数据,实现相应的功能。当一些应用程序对传感器的ODR没有要求时,协处理器15可以关闭ODR调整方案,不需要对传感器数据进行补帧或者删减帧数,从而保证传感器数据的精确性。In the embodiment of the present application, when the coprocessor 15 needs to obtain sensor data, the ODR adjustment scheme can be enabled according to the needs of the application program. For example, when the target ODR of the application reaches the limit ODR of the sensor, or when the application has accuracy requirements for the ODR of the sensor, the coprocessor 15 starts the ODR adjustment scheme. To ensure that the application can obtain sensor data with the target ODR and implement the corresponding functions. When some applications have no requirements for the ODR of the sensor, the coprocessor 15 can turn off the ODR adjustment scheme, and there is no need to supplement the sensor data or delete the number of frames, thereby ensuring the accuracy of the sensor data.

应理解,在一些实施例中,也可以由应用处理器14,或者设置于处理器110外部的微控制单元(micro controller unit,MCU)来执行前述步骤401至步骤407的部分或全部步骤,在此不做限定。It should be understood that in some embodiments, some or all of the aforementioned steps 401 to 407 may also be executed by the application processor 14 or a micro controller unit (MCU) provided outside the processor 110. This is not limited.

图5根据本申请的一些实施例示出了另一种传感器数据处理方法的实施流程图。Figure 5 shows an implementation flow chart of another sensor data processing method according to some embodiments of the present application.

可以理解,图5所示流程各步骤的执行主体可以均为电子设备中对传感器数据进行处理的协处理器15,在此不做限制。为简化描述,下面在介绍图5所示流程各步骤时将不再重复介绍各步骤的执行主体。It can be understood that the execution subject of each step of the process shown in Figure 5 can be the co-processor 15 in the electronic device that processes sensor data, and there is no limitation here. In order to simplify the description, when introducing each step of the process shown in Figure 5 below, the execution subject of each step will not be repeatedly introduced.

如图5所示,该方法包括以下流程:As shown in Figure 5, the method includes the following processes:

501,判断目标ODR是否达到传感器的极限ODR。501, determine whether the target ODR reaches the sensor's limit ODR.

示例性地,在应用处理器14运行应用程序需要获取传感器的数据时,会向协处理器15下发应用程序的目标ODR,协处理器15再将目标ODR下发给传感器,传感器按照目标ODR传输采集到的数据。传感器本身具有极限ODR数据,当传感器在极限ODR下传输数据时,数据传输速度会有较大的误差,需要对传感器传输的数据进行处理。因此,协处理器15需要判断目标ODR是否达到极限ODR。For example, when the application processor 14 runs an application program and needs to obtain sensor data, it will issue the target ODR of the application program to the coprocessor 15, and the coprocessor 15 will then issue the target ODR to the sensor, and the sensor will issue the target ODR according to the target ODR. Transfer the collected data. The sensor itself has extreme ODR data. When the sensor transmits data under extreme ODR, there will be a large error in the data transmission speed, and the data transmitted by the sensor needs to be processed. Therefore, the coprocessor 15 needs to determine whether the target ODR reaches the limit ODR.

若判断结果为是,例如目标ODR超过极限ODR,传感器以极限ODR传输数据会出现较大的误差。则执行503步骤,确定传感器的实际ODR小于目标ODR导致数据丢失。或者执行506步骤,确定传感器的实际ODR大于目标ODR导致数据溢出。If the judgment result is yes, for example, the target ODR exceeds the limit ODR, the sensor will transmit data with the limit ODR and there will be a large error. Then perform step 503 to determine that the actual ODR of the sensor is less than the target ODR, resulting in data loss. Or perform step 506 to determine that the actual ODR of the sensor is greater than the target ODR, causing data overflow.

若判断结果为否,例如目标ODR小于极限ODR,传感器在传输数据时的误差在允许范围内,则执行502步骤,判断应用程序是否开启高精度订阅。If the judgment result is no, for example, the target ODR is less than the limit ODR and the error of the sensor when transmitting data is within the allowable range, then step 502 is executed to determine whether the application has turned on high-precision subscription.

502,判断应用程序是否开启高精度订阅。502, determine whether the application enables high-precision subscription.

示例性地,在一些实施例中,应用程序对传感器的ODR有精度要求。因此,应用处理器14运行这类应用程序在获取传感器数据时,需要保证数据传输速度的精确度。例如,电子设备中可以存储白名单,以便于协处理器15可以基于白名单来判断应用程序是否开启高精度订阅。例如,在应用程序获取传感器的数据时,协处理器15可以通过判断对应应用程序是否在白名单中,从而确定是否在向应用处理器14上报数据时对数据进行调整。For example, in some embodiments, the application has accuracy requirements for the ODR of the sensor. Therefore, when the application processor 14 runs this type of application program to obtain sensor data, it needs to ensure the accuracy of the data transmission speed. For example, a whitelist can be stored in the electronic device, so that the coprocessor 15 can determine whether the application program enables high-precision subscription based on the whitelist. For example, when an application obtains sensor data, the coprocessor 15 can determine whether to adjust the data when reporting the data to the application processor 14 by determining whether the corresponding application is in the whitelist.

若判断结果为是,例如应用程序在白名单里,对传感器的ODR精度有要求。则执行503步骤,确定传感器的实际ODR小于目标ODR导致数据丢失。或者执行506步骤,确定传感器的实际ODR大于目标ODR导致数据溢出。If the judgment result is yes, for example, the application is in the whitelist and has requirements for the ODR accuracy of the sensor. Then perform step 503 to determine that the actual ODR of the sensor is less than the target ODR, resulting in data loss. Or perform step 506 to determine that the actual ODR of the sensor is greater than the target ODR, causing data overflow.

若判断结果为否,例如应用程序没有在白名单里,对传感器的ODR精度没有特殊要求,传感器在传输数据时的误差在允许范围内,则执行507步骤,上报数据。If the judgment result is negative, for example, the application is not in the whitelist, there are no special requirements for the ODR accuracy of the sensor, and the error of the sensor when transmitting data is within the allowable range, then step 507 is executed to report the data.

可以理解,在另一种实施例中,501的判断步骤可以与502的步骤颠倒。即协处理器15先判断应用程序是否开启高精度订阅,再判断应用程序的目标ODR是否达到传感器的极限ODR。本申请对流程步骤的描述顺序并不对流程的具体实施顺序进行任何限制。It can be understood that in another embodiment, the judgment step of 501 may be reversed from the step of 502. That is, the coprocessor 15 first determines whether the application program has enabled high-precision subscription, and then determines whether the target ODR of the application program reaches the limit ODR of the sensor. The order in which the process steps are described in this application does not place any restrictions on the specific implementation order of the process.

503,确定传感器的实际ODR小于目标ODR导致数据丢失。503, it is determined that the actual ODR of the sensor is less than the target ODR, resulting in data loss.

示例性地,传感器将采集到的数据缓存到内部的存储器中,当存储器的数据达到预设值时,传感器触发一次中断,将缓存的数据上报给协处理器15。传感器每次触发中断时会记录中断的时间戳,协处理器15根据传感器中断时间戳可以获得传感器每次缓存到预设数据的缓存时间。例如,传感器当前触发中断的时间戳与上一次触发中断的时间戳相减,就是当前上报数据的实际缓存时间,即DT。如果该缓存时间大于目标ODR的目标缓存时间,则可以确定传感器的实际ODR小于目标ODR。因此,传感器在一定时间内传感器上报的数据量不能达到要求,即缺少一部分数据。协处理器15将传感器数据上报给应用处理器14时,会导致应用程序实现的功能部够准确。For example, the sensor caches the collected data into an internal memory. When the data in the memory reaches a preset value, the sensor triggers an interrupt and reports the cached data to the coprocessor 15 . Each time the sensor triggers an interrupt, the timestamp of the interrupt is recorded. The coprocessor 15 can obtain the cache time of each time the sensor caches preset data based on the sensor interrupt timestamp. For example, the timestamp of the current interrupt triggered by the sensor is subtracted from the timestamp of the last triggered interrupt, which is the actual cache time of the currently reported data, that is, DT. If the cache time is greater than the target cache time of the target ODR, it can be determined that the actual ODR of the sensor is less than the target ODR. Therefore, the amount of data reported by the sensor within a certain period of time cannot meet the requirements, that is, part of the data is missing. When the coprocessor 15 reports the sensor data to the application processor 14, it will cause the functions implemented by the application program to be accurate enough.

504,对传感器上报的数据获取补帧位置并进行斜率计算。504. Obtain the complementary frame position from the data reported by the sensor and calculate the slope.

示例性地,协处理器15在补帧时可以根据目标ODR和实际缓存时间DT生成目标帧数,在补帧时可以将传感器上报的数据补充到目标帧数。补帧位置的确定例如可以参照图4实施例中的406步骤。协处理器15在进行补帧时可以获取补帧位置的传感器数据的斜率,基于斜率生成需要补充的帧数数据。例如,对补帧位置相邻两帧的传感器数据取平均值,作为补帧位置的传感器数据。For example, the coprocessor 15 can generate the target frame number according to the target ODR and the actual cache time DT when supplementing the frame, and can supplement the data reported by the sensor to the target frame number when supplementing the frame. For example, the determination of the position of the complementary frame may refer to step 406 in the embodiment of FIG. 4 . When performing frame filling, the coprocessor 15 can obtain the slope of the sensor data at the position of the frame filling, and generate frame number data that needs to be supplemented based on the slope. For example, the sensor data of two adjacent frames at the complementary frame position are averaged as the sensor data at the complementary frame position.

505,对丢失的数据进行补帧。505. Complement the lost data.

示例性地,在协处理器15获取补帧位置和补帧数据后,即可对传感器上报的数据进行补帧,以保证上报给应用处理器14的数据传输速度满足目标ODR。For example, after the coprocessor 15 obtains the frame-filling position and the frame-filling data, the frame-filling can be performed on the data reported by the sensor to ensure that the data transmission speed reported to the application processor 14 meets the target ODR.

506,确定传感器的实际ODR大于目标ODR导致数据溢出。506. It is determined that the actual ODR of the sensor is greater than the target ODR, causing data overflow.

示例性地,如果传感器上报数据的实际缓存时间小于目标ODR的缓存时间,则可以确定传感器的实际ODR大于目标ODR。这样,在一定时间内,传感器上报的数据就会超过传感器为目标ODR时上报的数据。协处理器15将传感器数据上报给应用处理器14时,同样会导致对应用程序的功能会不准确。For example, if the actual cache time of the data reported by the sensor is less than the cache time of the target ODR, it can be determined that the actual ODR of the sensor is greater than the target ODR. In this way, within a certain period of time, the data reported by the sensor will exceed the data reported when the sensor is the target ODR. When the coprocessor 15 reports the sensor data to the application processor 14, the function of the application program will also be inaccurate.

507,对溢出的数据进行删减。507, delete the overflow data.

示例性地,当传感器的实际ODR大于目标ODR时,传感器每次触发中断的时间会缩短。因此,协处理器15需要对传感器上报的数据删减一些数据,才能够保证向应用处理器14上报数据的帧数与目标上报帧数一致。删减帧数的方法可以参照图4实施例中的405步骤。For example, when the actual ODR of the sensor is greater than the target ODR, the time for each interrupt triggered by the sensor will be shortened. Therefore, the coprocessor 15 needs to delete some data from the data reported by the sensor to ensure that the number of frames reported to the application processor 14 is consistent with the target number of frames reported. For the method of deleting the number of frames, refer to step 405 in the embodiment of FIG. 4 .

508,上报数据。508, report data.

示例性地,协处理器15获取传感器上报的数据后,基于ODR调整方案对传感器数据进行调整。然后,协处理器15将调整后的传感器数据上报给应用处理器14。应用处理器14运行的应用程序,实现应用程序的功能。可以理解,如果传感器数据不需要调整时,协处理器15可以直接把获取的传感器数据上报给应用处理器14。For example, after obtaining the data reported by the sensor, the coprocessor 15 adjusts the sensor data based on the ODR adjustment plan. Then, the coprocessor 15 reports the adjusted sensor data to the application processor 14 . The application processor 14 runs an application program to implement the functions of the application program. It can be understood that if the sensor data does not need to be adjusted, the coprocessor 15 can directly report the acquired sensor data to the application processor 14 .

可以理解,通过本申请的实施例,协处理器15能够动态开启ODR调整方案,使上报数据的速度满足应用程序的需求。It can be understood that through the embodiments of the present application, the coprocessor 15 can dynamically enable the ODR adjustment scheme so that the speed of reporting data meets the needs of the application program.

进一步,图6根据本申请的实施例,示出了一种传感器数据处理过程的交互流程图。Further, FIG. 6 shows an interactive flow chart of a sensor data processing process according to an embodiment of the present application.

示例性地,图6所示流程图中分别示出了三种应用程序获取传感器数据的流程图。例如,应用程序611a是需要在高ODR下传输数据的应用程序。应用程序611b是对ODR具有高精度要求的应用程序。应用程序611c是标准的应用程序,容许ODR的传输具有一定的误差。For example, the flow chart shown in FIG. 6 shows the flow charts of three applications for obtaining sensor data respectively. For example, application 611a is an application that needs to transmit data under high ODR. Application 611b is an application with high accuracy requirements for ODR. Application program 611c is a standard application program, allowing certain errors in ODR transmission.

其中,传感器数据处理过程中的交互主体例如可以是应用处理器14和传感器集线器620。传感器集线器620可以设置于协处理器15中。The interacting subjects in the sensor data processing process may be, for example, the application processor 14 and the sensor hub 620 . Sensor hub 620 may be provided in coprocessor 15 .

应用处理器14用于运行包括应用程序611和硬件抽象层(hardware abstractlayer,HAL)中的传感器HAL 612。硬件抽象层是对硬件驱动的封装,为上层提供一个统一的硬件能力通用接口。The application processor 14 is used to run an application program 611 and a sensor HAL 612 in a hardware abstraction layer (HAL). The hardware abstraction layer encapsulates the hardware driver and provides a unified universal interface for hardware capabilities to the upper layer.

传感器集线器620可以设置在协处理器15中,用于运行传感器驱动621、其他算法622以及计步算法623。传感器驱动621用于传输出传感器数据以及实施上述任一项实施例中的传感器数据处理方法。其他算法622,用于对传感器数据进行其他方式的处理。计步算法623用于基于传感器数据生成计步器所需的数据。The sensor hub 620 may be provided in the coprocessor 15 for running the sensor driver 621, other algorithms 622, and the step counting algorithm 623. The sensor driver 621 is used to transmit sensor data and implement the sensor data processing method in any of the above embodiments. Other algorithms 622 are used to process sensor data in other ways. The pedometer algorithm 623 is used to generate the data required by the pedometer based on the sensor data.

具体的,如图5所示,应用程序611a的交互流程包括如下步骤:Specifically, as shown in Figure 5, the interaction process of application 611a includes the following steps:

S611,应用程序611a激活传感器HAL 512。S611, the application 611a activates the sensor HAL 512.

示例性地,应用程序611a在获取对应传感器的数据时,需要在电子设备100的操作系统的HAL层激活对应传感器的HAL 612。For example, when the application program 611a obtains the data of the corresponding sensor, it needs to activate the HAL 612 of the corresponding sensor in the HAL layer of the operating system of the electronic device 100 .

S612,应用程序611a向传感器HAL 612发送目标ODR。S612, the application program 611a sends the target ODR to the sensor HAL 612.

示例性地,应用程序611a在获取传感器数据时,会向传感器HAL 612下发目标ODR。使传感器驱动612以目标ODR传输传感器数据。For example, when the application program 611a obtains sensor data, it will issue the target ODR to the sensor HAL 612. The sensor driver 612 is caused to transmit the sensor data at the target ODR.

S613,传感器HAL 612确定目标ODR与极限ODR相等。S613, the sensor HAL 612 determines that the target ODR is equal to the limit ODR.

示例性地,传感器在极限ODR下输出数据误差较高,因此,需要通过如图4实施例中的传感器数据处理方法对传感器驱动621传输的数据进行处理。在传感器HAL 612确定目标ODR与极限ODR相等时,传感器驱动621开启ODR调整方案。For example, the sensor output data error is high under extreme ODR. Therefore, the data transmitted by the sensor driver 621 needs to be processed through the sensor data processing method in the embodiment of FIG. 4 . When the sensor HAL 612 determines that the target ODR is equal to the limit ODR, the sensor driver 621 starts the ODR adjustment scheme.

可以理解,目标ODR并不一定需要严格大于极限ODR或者与极限ODR相等再开启ODR调整方案。在另一些实施例中,如果目标ODR接近传感器的极限ODR也可以开启ODR调整方案。例如,目标ODR达到极限ODR的80%时,需要开启ODR调整方案。It can be understood that the target ODR does not necessarily need to be strictly greater than the limit ODR or equal to the limit ODR before starting the ODR adjustment plan. In other embodiments, the ODR adjustment scheme may also be enabled if the target ODR is close to the limit ODR of the sensor. For example, when the target ODR reaches 80% of the limit ODR, the ODR adjustment plan needs to be enabled.

S614,传感器驱动621向传感器HAL 612返回传感器数据。S614, the sensor driver 621 returns sensor data to the sensor HAL 612.

示例性地,传感器驱动621通过传感器HAL 612向应用程序611a传输经过处理后的传感器数据。对传感器数据的处理例如可以是:在传感器驱动621检测到上报数据时的ODR小于目标ODR时,对上报的数据进行补帧,保证上报传感器数据的数据传输速率等于目标ODR。在传感器驱动621检测到传感器上报数据时的实际ODR大于目标ODR时,对传感器上报的数据进行删减。保证传感器驱动621向应用程序611a上报传感器数据的数据传输速率等于目标ODR,以此保证应用程序611a获取传感器数据速度的准确性。For example, the sensor driver 621 transmits the processed sensor data to the application program 611a through the sensor HAL 612. The processing of the sensor data may be, for example: when the sensor driver 621 detects that the ODR of the reported data is less than the target ODR, frame-filling is performed on the reported data to ensure that the data transmission rate of the reported sensor data is equal to the target ODR. When the sensor driver 621 detects that the actual ODR when the sensor reports data is greater than the target ODR, the data reported by the sensor is deleted. It is ensured that the data transmission rate of sensor data reported by the sensor driver 621 to the application program 611a is equal to the target ODR, thereby ensuring the accuracy of the speed at which the application program 611a obtains sensor data.

应理解,补帧和删减帧数的过程可以参考图4实施例中的405步骤和406步骤。It should be understood that the process of adding frames and deleting the number of frames can refer to steps 405 and 406 in the embodiment of FIG. 4 .

S615,应用程序611a关闭传感器HAL 612。S615, the application 611a turns off the sensor HAL 612.

示例性地,需要高ODR传输数据的应用程序611a例如可以具有多个,在每个应用程序611a结束获取传感器数据时,都会继续判断下一个应用程序611a的目标ODR是否达到极限ODR,在确定下一个应用程序611a的目标ODR小于极限ODR时,则可以关闭ODR调整方案,使传感器驱动612输出原始传感器数据。For example, there may be multiple applications 611a that require high ODR to transmit data. When each application 611a finishes acquiring sensor data, it will continue to determine whether the target ODR of the next application 611a reaches the limit ODR. After determining When the target ODR of an application 611a is less than the limit ODR, the ODR adjustment scheme can be turned off so that the sensor driver 612 outputs raw sensor data.

继续参考图6,应用程序611b的交互流程包括如下步骤:Continuing to refer to Figure 6, the interaction process of the application 611b includes the following steps:

S621,应用程序611b激活传感器HAL 612。S621, the application program 611b activates the sensor HAL 612.

示例性地,应用程序611b在获取对应传感器的数据时,需要在电子设备100的操作系统的HAL层激活对应传感器的HAL 612。For example, when the application program 611b obtains the data of the corresponding sensor, it needs to activate the HAL 612 of the corresponding sensor in the HAL layer of the operating system of the electronic device 100 .

S622,应用程序611b向传感器HAL 612发送目标ODR。S622, the application 611b sends the target ODR to the sensor HAL 612.

示例性地,应用程序611b在获取传感器数据时,会向传感器HAL 612下发目标ODR。使传感器驱动612以目标ODR传输传感器数据。For example, when acquiring sensor data, the application program 611b will send the target ODR to the sensor HAL 612. The sensor driver 612 is caused to transmit the sensor data at the target ODR.

S623,传感器HAL 612向传感器驱动621添加高精度订阅计数。S623, the sensor HAL 612 adds a high-precision subscription count to the sensor driver 621.

示例性地,当应用程序611b对ODR的精度有要求时,传感器HAL 612会向传感器驱动621进行高精度订阅计数。高精度订阅计数用于记录应用程序611b的数量,即对ODR有高精度要求的应用程序611的数量。For example, when the application program 611b has requirements for the accuracy of the ODR, the sensor HAL 612 will perform high-precision subscription counting to the sensor driver 621. The high-precision subscription count is used to record the number of applications 611b, that is, the number of applications 611 that have high-precision requirements for ODR.

应理解,进行高精度订阅的应用程序对传感器ODR的精度要求较高,传感器在向该应用程序上报数据时,需要开启ODR调整方案,以保证传感器ODR的精度。It should be understood that applications that perform high-precision subscriptions have higher accuracy requirements for sensor ODR. When the sensor reports data to the application, it needs to enable the ODR adjustment scheme to ensure the accuracy of the sensor ODR.

可以理解,高ODR精度需求的应用程序611b例如可以包括多个,每有一个高ODR精度需求的应用程序611b进行高精度订阅时,传感器HAL 612会增加一次高精度订阅的计数。It can be understood that, for example, there may be multiple applications 611b with high ODR accuracy requirements. Each time an application 611b with high ODR accuracy requirements performs a high-precision subscription, the sensor HAL 612 will increase the count of high-precision subscriptions.

在传感器驱动621的具有高精度订阅时,说明当前应用程序611b对传感器的ODR精度有要求,因此,需要启动ODR调整方案,通过如图4实施例中的数据处理方法对传感器驱动621传输的数据进行处理。When the sensor driver 621 has a high-precision subscription, it means that the current application 611b has requirements for the ODR accuracy of the sensor. Therefore, it is necessary to start the ODR adjustment plan and process the data transmitted by the sensor driver 621 through the data processing method in the embodiment of Figure 4. for processing.

S624,传感器驱动621向传感器HAL 612返回传感器数据。S624, the sensor driver 621 returns sensor data to the sensor HAL 612.

示例性地,传感器驱动621通过传感器HAL 612向应用程序611b传输经过ODR调整方案处理后的传感器数据。For example, the sensor driver 621 transmits the sensor data processed by the ODR adjustment scheme to the application program 611b through the sensor HAL 612.

例如,对传感器数据的处理例如可以是:传感器驱动621在检测到传感器中断触发时上报数据的实际ODR小于目标ODR时,对上报的传感器数据进行补帧,保证上报传感器数据的数据传输速率等于目标ODR。传感器驱动621在检测到传感器中断触发时的ODR大于目标ODR时,对传感器上报的数据进行删减,保证传感器驱动621上报传感器数据的数据传输速率等于目标ODR。应理解,补帧和删减帧数的过程可以参考图4实施例中的405步骤和406步骤。For example, the processing of sensor data can be: when the sensor driver 621 detects that the actual ODR of the reported data is less than the target ODR when the sensor interrupt is triggered, the sensor driver 621 performs supplementary frames on the reported sensor data to ensure that the data transmission rate of the reported sensor data is equal to the target. ODR. When the sensor driver 621 detects that the ODR when the sensor interrupt is triggered is greater than the target ODR, it deletes the data reported by the sensor to ensure that the data transmission rate of the sensor data reported by the sensor driver 621 is equal to the target ODR. It should be understood that the process of adding frames and deleting the number of frames can refer to steps 405 and 406 in the embodiment of FIG. 4 .

S625,应用程序611b关闭传感器HAL 612。S625, the application 611b turns off the sensor HAL 612.

示例性地,在每次应用程序611b结束获取传感器数据时,都会减少高精度订阅的计数,当高精度订阅的计数减少到0时,则表示没有应用程序611b需要高ODR精度输出数据,传感器驱动621可以关闭ODR调整方案,上报原始传感器数据。For example, every time the application 611b ends acquiring sensor data, the count of the high-precision subscription is reduced. When the count of the high-precision subscription is reduced to 0, it means that no application 611b needs high ODR precision output data, and the sensor driver 621 can turn off the ODR adjustment scheme and report raw sensor data.

在另一些实施例中,传感器中枢620中还包括计步算法623,计步算法623需要传感器驱动621以高精度ODR输出数据。传感器驱动621在开启ODR调整方案时,计步算法623对传感器驱动621发出重采样请求,然后传感器驱动621向计步算法623返回调整后的传感器数据,以满足计步算法623的计算需求。In other embodiments, the sensor hub 620 also includes a step counting algorithm 623. The step counting algorithm 623 requires the sensor driver 621 to output data with high-precision ODR. When the sensor driver 621 turns on the ODR adjustment scheme, the pedometer algorithm 623 sends a resampling request to the sensor driver 621, and then the sensor driver 621 returns the adjusted sensor data to the pedometer algorithm 623 to meet the calculation requirements of the pedometer algorithm 623.

继续参考图6,应用程序611c的交互流程包括如下步骤:Continuing to refer to Figure 6, the interaction process of application 611c includes the following steps:

S631,应用程序611c激活传感器HAL 612。S631, the application 611c activates the sensor HAL 612.

示例性地,应用程序611c在获取对应传感器的数据时,需要在电子设备100的操作系统的HAL层激活对应传感器的HAL 612。For example, when the application program 611c obtains the data of the corresponding sensor, it needs to activate the HAL 612 of the corresponding sensor in the HAL layer of the operating system of the electronic device 100 .

S632,应用程序611c向传感器HAL 612发送目标ODR。S632, the application 611c sends the target ODR to the sensor HAL 612.

示例性地,应用程序611c在获取传感器数据时,会向传感器HAL 612下发目标ODR。使传感器驱动612以目标ODR传输传感器数据。For example, when acquiring sensor data, the application program 611c will send the target ODR to the sensor HAL 612. The sensor driver 612 is caused to transmit the sensor data at the target ODR.

S633,传感器HAL 612设置传感器驱动621以目标ODR传输数据。S633, the sensor HAL 612 sets the sensor driver 621 to transmit data with the target ODR.

可以理解,标准应用程序611c可以是对传感器ODR没有精度要求,并且目标ODR较低的应用程序611c。在目标ODR较低时,传感器ODR的误差较低,在应用程序611c的允许范围内,传感器驱动621则不需要开启ODR调整方案,以保证传感器数据的精度,此时ODR调整方案处于关闭状态。It can be understood that the standard application 611c may be an application 611c that has no accuracy requirements for sensor ODR and has a low target ODR. When the target ODR is low, the sensor ODR error is low, and within the allowable range of the application 611c, the sensor driver 621 does not need to turn on the ODR adjustment scheme to ensure the accuracy of the sensor data. At this time, the ODR adjustment scheme is turned off.

S634,传感器驱动621向传感器HAL 612返回传感器数据。S634, the sensor driver 621 returns sensor data to the sensor HAL 612.

示例性地,传感器驱动621确定不需要开启ODR调整方案时,可以直接通过传感器HAL 612向应用程序611c传输原始的传感器数据。For example, when the sensor driver 621 determines that the ODR adjustment scheme does not need to be enabled, the original sensor data can be directly transmitted to the application program 611c through the sensor HAL 612.

可以理解,在ODR调整方案关闭时,传感器集线器620中其他算法622可以对传感器驱动621发出重采样请求。此时传感器驱动621可以将传感器数据传输给其他算法622,基于其他算法622对传感器数据进行处理。It can be understood that when the ODR adjustment scheme is turned off, other algorithms 622 in the sensor hub 620 may issue a resampling request to the sensor driver 621. At this time, the sensor driver 621 can transmit the sensor data to other algorithms 622 and process the sensor data based on the other algorithms 622 .

S635,应用程序611c关闭传感器HAL 612。S635, the application 611c turns off the sensor HAL 612.

示例性地,标准应用程序611c例如可以具有多个,在每个应用程序611c结束获取传感器数据时,都会继续判断下一个应用程序611c的目标ODR是否达到极限ODR,在确定下一个应用程序611c的目标ODR小于极限ODR时,则可以保持ODR调整方案为关闭状态,使传感器驱动612输出原始传感器数据。For example, there may be multiple standard applications 611c. When each application 611c ends acquiring sensor data, it will continue to determine whether the target ODR of the next application 611c reaches the limit ODR. After determining the target ODR of the next application 611c, When the target ODR is less than the limit ODR, the ODR adjustment scheme can be kept in a closed state so that the sensor driver 612 outputs original sensor data.

通过本实施例,传感器驱动621可以动态开启ODR调整方案。例如,应用程序611a处于高ODR下传输数据,ODR会出现较大的误差,传感器驱动621会启动ODR调整方案。或者应用程序611b对ODR有高精度要求时,传感器驱动621也会启动ODR调整方案。以此满足各种应用程序611对传感器ODR的需求。在应用程序611对传感器ODR没有要求时,例如,应用程序611c允许传感器ODR有存储在一定的误差,则传感器驱动621关闭ODR调整方案。以此可以避免对传感器驱动621对传感器数据进行补帧或者删减帧数,保证传感器驱动621传输传感器数据的准确性。Through this embodiment, the sensor driver 621 can dynamically start the ODR adjustment scheme. For example, if the application 611a transmits data under high ODR, a large error will occur in the ODR, and the sensor driver 621 will initiate an ODR adjustment plan. Or when the application 611b has high accuracy requirements for ODR, the sensor driver 621 will also start the ODR adjustment plan. In this way, various applications 611 meet the sensor ODR requirements. When the application program 611 has no requirements for the sensor ODR, for example, the application program 611c allows the sensor ODR to have a certain error stored, then the sensor driver 621 turns off the ODR adjustment scheme. In this way, the sensor driver 621 can avoid adding frames or deleting the number of frames to the sensor data, thereby ensuring the accuracy of the sensor data transmitted by the sensor driver 621 .

下面以手机为例,对本发明一些实施例中涉及的电子设备进行详细介绍。Taking a mobile phone as an example, the electronic devices involved in some embodiments of the present invention are introduced in detail below.

图7根据本申请的实施例示出了一种电子设备的结构示意图。Figure 7 shows a schematic structural diagram of an electronic device according to an embodiment of the present application.

电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and Subscriber identification module (subscriber identification module, SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.

可以理解的是,本发明实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100 . In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figures, or some components may be combined, some components may be separated, or some components may be arranged differently. The components illustrated may be implemented in hardware, software, or a combination of software and hardware.

处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processingunit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (GPU), an image signal processor ( image signal processor (ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processing unit (NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors.

控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller can generate operation control signals based on the instruction operation code and timing signals to complete the control of fetching and executing instructions.

处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in processor 110 is cache memory. This memory may hold instructions or data that have been recently used or recycled by processor 110 . If the processor 110 needs to use the instructions or data again, it can be called directly from the memory. Repeated access is avoided and the waiting time of the processor 110 is reduced, thus improving the efficiency of the system.

在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuitsound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purposeinput/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuitsound, I2S) interface, a pulse code modulation (PCM) interface, and a universal asynchronous receiver (universal asynchronous receiver) /transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (subscriber identity module, SIM) interface, and/or Universal serial bus (USB) interface, etc.

I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K、加速度传感器180E等,从而获取相应的传感器数据并对传感器的ODR进行调整。The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (derail clock line, SCL). In some embodiments, processor 110 may include multiple sets of I2C buses. The processor 110 can respectively couple the touch sensor 180K, the acceleration sensor 180E, etc. through different I2C bus interfaces to obtain corresponding sensor data and adjust the ODR of the sensor.

UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。The UART interface is a universal serial data bus used for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication.

MIPI接口可以被用于连接处理器110与显示屏,摄像头等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serialinterface,DSI)等。The MIPI interface can be used to connect the processor 110 with peripheral devices such as display screens and cameras. MIPI interfaces include camera serial interface (CSI), display serial interface (display serial interface, DSI), etc.

GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头,显示屏,无线通信模块160,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。The GPIO interface can be configured through software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with a camera, a display screen, a wireless communication module 160, a sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, etc.

USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。The USB interface 130 is an interface that complies with USB standard specifications, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through them. This interface can also be used to connect other electronic devices, such as AR devices, etc.

可以理解的是,本发明实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It can be understood that the interface connection relationships between the modules illustrated in the embodiment of the present invention are only schematic illustrations and do not constitute a structural limitation of the electronic device 100 . In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。The charging management module 140 is used to receive charging input from the charger. Among them, the charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from the wired charger through the USB interface 130 . In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through the wireless charging coil of the electronic device 100 . While the charging management module 140 charges the battery 142, it can also provide power to the electronic device through the power management module 141.

电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,显示屏,摄像头,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charging management module 140 to provide power to the processor 110, internal memory 121, display screen, camera, wireless communication module 160, etc. The power management module 141 can also be used to monitor battery capacity, battery cycle times, battery health status (leakage, impedance) and other parameters. In some other embodiments, the power management module 141 may also be provided in the processor 110 . In other embodiments, the power management module 141 and the charging management module 140 may also be provided in the same device.

电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example: Antenna 1 can be reused as a diversity antenna for a wireless LAN. In other embodiments, antennas may be used in conjunction with tuning switches.

移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。The mobile communication module 150 can provide solutions for wireless communication including 2G/3G/4G/5G applied on the electronic device 100 . The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves through the antenna 1, perform filtering, amplification and other processing on the received electromagnetic waves, and transmit them to the modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves through the antenna 1 for radiation. In some embodiments, at least part of the functional modules of the mobile communication module 150 may be disposed in the processor 110 . In some embodiments, at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be provided in the same device.

无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wirelesslocal area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (bluetooth, BT), and global navigation satellite system. (global navigation satellite system, GNSS), frequency modulation (FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 . The wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.

外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100 . The external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. Such as saving music, videos, etc. files in external memory card.

内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。处理器110通过运行存储在内部存储器121的指令,和/或存储在设置于处理器中的存储器的指令,执行电子设备100的各种功能应用以及数据处理。Internal memory 121 may be used to store computer executable program code, which includes instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the stored program area can store an operating system, at least one application program required for a function (such as a sound playback function, an image playback function, etc.). The storage data area may store data created during use of the electronic device 100 (such as audio data, phone book, etc.). In addition, the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.

压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。The pressure sensor 180A is used to sense pressure signals and can convert the pressure signals into electrical signals. In some embodiments, pressure sensor 180A may be disposed on display screen 194 . There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor may include at least two parallel plates of conductive material. When a force is applied to pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation is performed on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A. The electronic device 100 may also calculate the touched position based on the detection signal of the pressure sensor 180A.

陀螺仪传感器180B可以用于确定电子设备100的运动姿态。The gyro sensor 180B may be used to determine the motion posture of the electronic device 100 .

气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。Air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.

磁传感器180D例如可以包括霍尔传感器。The magnetic sensor 180D may include a Hall sensor, for example.

加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。The acceleration sensor 180E can detect the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of electronic devices and be used in horizontal and vertical screen switching, pedometer and other applications.

距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。Distance sensor 180F for measuring distance. Electronic device 100 can measure distance via infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 may utilize the distance sensor 180F to measure distance to achieve fast focusing.

接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备100通过发光二极管向外发射红外光。电子设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备100附近有物体。当检测到不充分的反射光时,电子设备100可以确定电子设备100附近没有物体。电子设备100可以利用接近光传感器180G检测用户手持电子设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。Proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outwardly through the light emitting diode. Electronic device 100 uses photodiodes to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100 . When insufficient reflected light is detected, the electronic device 100 may determine that there is no object near the electronic device 100 . The electronic device 100 can use the proximity light sensor 180G to detect when the user holds the electronic device 100 close to the ear for talking, so as to automatically turn off the screen to save power.

环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。The ambient light sensor 180L is used to sense ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in the pocket to prevent accidental touching.

指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。Fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access to application locks, fingerprint photography, fingerprint answering of incoming calls, etc.

温度传感器180J用于检测温度。Temperature sensor 180J is used to detect temperature.

触摸传感器180K,也称“触控器件”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。Touch sensor 180K, also known as "touch device". The touch sensor 180K can be disposed on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is used to detect a touch operation on or near the touch sensor 180K. The touch sensor can pass the detected touch operation to the application processor to determine the touch event type. Visual output related to the touch operation may be provided through display screen 194 . In other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a location different from that of the display screen 194 .

骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。Bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human body's vocal part. The bone conduction sensor 180M can also contact the human body's pulse and receive blood pressure beating signals.

SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备100采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备100中,不能和电子设备100分离。The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to or separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195 . The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card, etc. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the plurality of cards may be the same or different. The SIM card interface 195 is also compatible with different types of SIM cards. The SIM card interface 195 is also compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 100 uses an eSIM, that is, an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100 .

图8根据本申请实施例示出了一种手机100的系统软件架构示意框图。FIG. 8 shows a schematic block diagram of the system software architecture of a mobile phone 100 according to an embodiment of the present application.

手机100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本发明实施例以分层架构的Android系统为例,示例性说明手机100的软件结构。The software system of mobile phone 100 can adopt layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. The embodiment of the present invention takes the Android system with a layered architecture as an example to illustrate the software structure of the mobile phone 100 .

分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(android runtime)和系统库,以及内核层。The layered architecture divides the software into several layers, and each layer has clear roles and division of labor. The layers communicate through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: application layer, application framework layer, Android runtime (android runtime) and system libraries, and kernel layer.

如图8所示,应用程序层可以包括一系列应用程序包。As shown in Figure 8, the application layer can include a series of application packages.

应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。Application packages can include camera, gallery, calendar, calling, map, navigation, WLAN, Bluetooth, music, video, SMS and other applications.

应用程序框架层为应用程序层的应用程序提供应用编程接口(applicationprogramming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions.

应用程序框架层可以包括窗口管理服务(windows manager service,WMS),视图系统(view system),图形系统(graphics system),显示合成(surface flinger),显示引擎服务(display engine service),资源管理器,通知管理器等。The application framework layer can include window management service (WMS), view system (view system), graphics system (graphics system), display synthesis (surface flinger), display engine service (display engine service), resource manager , notification manager, etc.

WMS,用于管理窗口程序。WMS可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。WMS, used to manage window programs. WMS can obtain the display size, determine whether there is a status bar, lock the screen, capture the screen, etc.

视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成。The view system includes visual controls, such as controls that display text, controls that display pictures, etc. A view system can be used to build applications. The display interface can consist of one or more views.

图形系统,是系统中的通用编程软件包,由图形I/O设备构成,基本功能是图元生成、属性设置等。The graphics system is a general programming software package in the system. It is composed of graphics I/O devices. Its basic functions are primitive generation, attribute setting, etc.

Surface Flinger也可称作界面合成,Surface Flinger的作用是接受WMS提供的图形显示数据,将它们合成,并输入到显示设备上显示。Surface Flinger可以使用开放图形库(open graphics library,OpenGL)硬件合成器(hard ware composer,HWC)来合成界面(surface)。Surface Flinger can also be called interface synthesis. The function of Surface Flinger is to accept the graphic display data provided by WMS, synthesize them, and input them to the display device for display. Surface Flinger can use the open graphics library (OpenGL) hardware composer (HWC) to synthesize the interface (surface).

显示引擎服务,可以调用硬件抽象层中基于环境光传感器180L提供的硬件能力获取环境光的光照强度。The display engine service can call the hardware capabilities provided by the ambient light sensor 180L in the hardware abstraction layer to obtain the illumination intensity of the ambient light.

资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。The resource manager provides various resources to applications, such as localized strings, icons, pictures, layout files, video files, etc.

通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。The notification manager allows applications to display notification information in the status bar, which can be used to convey notification-type messages and can automatically disappear after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be notifications that appear in the status bar at the top of the system in the form of charts or scroll bar text, such as notifications for applications running in the background, or notifications that appear on the screen in the form of conversation windows. For example, text information is prompted in the status bar, a beep sounds, the electronic device vibrates, the indicator light flashes, etc.

Android Runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。Android Runtime includes core libraries and virtual machines. The Android runtime is responsible for the scheduling and management of the Android system. The core library contains two parts: one is the functional functions that need to be called by the Java language, and the other is the core library of Android.

应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。The application layer and application framework layer run in virtual machines. The virtual machine executes the java files of the application layer and application framework layer as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection and other functions.

系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(media libraries),三维图形处理库(例如:开放图形库(OpenGL),或者针对嵌入式系统的开放图形库(open graphics library for embedded systems,OpenGL ES)),2D图形引擎(例如:Skia图形库(skia graphics library,SGL))等。可以理解,Android应用程序可以调用SGL或OpenGL ES接口来绘制渲染UI界面。System libraries can include multiple functional modules. For example: surface manager (surface manager), media library (media libraries), 3D graphics processing library (such as: Open Graphics Library (OpenGL), or open graphics library for embedded systems (open graphics library for embedded systems, OpenGL ES) )), 2D graphics engine (for example: Skia graphics library (SGL)), etc. It is understandable that Android applications can call the SGL or OpenGL ES interface to draw and render the UI interface.

表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。The surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.

媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, composition, and layer processing.

2D图形引擎是2D绘图的绘图引擎。2D Graphics Engine is a drawing engine for 2D drawing.

可以理解,Android应用里面的图形绘制分为2D和3D两种,2D可以由Skia来实现的,Skia也可以调用部分OpenGL ES的内容来实现简单的3D效果。It is understandable that graphics drawing in Android applications is divided into two types: 2D and 3D. 2D can be implemented by Skia, and Skia can also call some OpenGL ES content to achieve simple 3D effects.

硬件抽象层,即HAL层,是对硬件驱动的封装,为上层提供一个统一的硬件能力通用接口。如图8所示,硬件抽象层包括CPU HAL、GPU HAL、传感器HAL、显示HAL以及摄像头HAL等。The hardware abstraction layer, or HAL layer, encapsulates the hardware driver and provides a unified universal interface for hardware capabilities for the upper layer. As shown in Figure 8, the hardware abstraction layer includes CPU HAL, GPU HAL, sensor HAL, display HAL, camera HAL, etc.

内核层是硬件和软件之间的层。内核层至少包含CPU驱动,GPU驱动,显示驱动,传感器驱动,摄像头驱动等。The kernel layer is the layer between hardware and software. The kernel layer includes at least CPU driver, GPU driver, display driver, sensor driver, camera driver, etc.

内核层例如还可以包括ODR校正模块。ODR校正模块可以执行本申请实施例提出的任一传感器数据的处理方法,以得到一组传感器数据,再将传感器数据提供给应用程序层中的应用。例如,ODR校正模块可以通过执行本申请实施例提出的任一传感器数据的处理方法,得到一组加速度数据,并将加速度数据提供给计步器应用。The kernel layer may also include an ODR correction module, for example. The ODR correction module can execute any sensor data processing method proposed in the embodiments of this application to obtain a set of sensor data, and then provide the sensor data to the application in the application layer. For example, the ODR correction module can obtain a set of acceleration data by executing any of the sensor data processing methods proposed in the embodiments of this application, and provide the acceleration data to the pedometer application.

具体可参考图4示出的传感器数据的处理方法的相关内容,此处不再赘述。需要说明的是,ODR校正模块还可以在应用程序框架层或者系统库。本申请实施例对于ODR校正模块在软件框架中所处的位置不做限制。For details, reference may be made to the relevant content of the sensor data processing method shown in FIG. 4 , which will not be described again here. It should be noted that the ODR correction module can also be at the application framework layer or system library. The embodiment of the present application does not limit the location of the ODR correction module in the software framework.

在附图中,可以以特定布置和/或顺序示出一些结构或方法特征。然而,应该理解,可能不需要这样的特定布置和/或排序。而是,在一些实施例中,这些特征可以以不同于说明性附图中所示的方式和/或顺序来布置。另外,在特定图中包括结构或方法特征并不意味着暗示在所有实施例中都需要这样的特征,并且在一些实施例中,可以不包括这些特征或者可以与其他特征组合。In the drawings, some structural or methodological features may be shown in specific arrangements and/or orders. However, it should be understood that such specific arrangement and/or ordering may not be required. Rather, in some embodiments, the features may be arranged in a different manner and/or order than shown in the illustrative figures. Additionally, the inclusion of structural or methodological features in a particular figure is not meant to imply that such features are required in all embodiments, and in some embodiments these features may not be included or may be combined with other features.

需要说明的是,本申请各设备实施例中提到的各单元/模块都是逻辑单元/模块,在物理上,一个逻辑单元/模块可以是一个物理单元/模块,也可以是一个物理单元/模块的一部分,还可以以多个物理单元/模块的组合实现,这些逻辑单元/模块本身的物理实现方式并不是最重要的,这些逻辑单元/模块所实现的功能的组合才是解决本申请所提出的技术问题的关键。此外,为了突出本申请的创新部分,本申请上述各设备实施例并没有将与解决本申请所提出的技术问题关系不太密切的单元/模块引入,这并不表明上述设备实施例并不存在其它的单元/模块。It should be noted that each unit/module mentioned in each device embodiment of this application is a logical unit/module. Physically, a logical unit/module can be a physical unit/module, or it can be a physical unit/module. Part of the module can also be implemented as a combination of multiple physical units/modules. The physical implementation of these logical units/modules is not the most important. The combination of functions implemented by these logical units/modules is what solves the problem of this application. Key technical issues raised. In addition, in order to highlight the innovative part of this application, the above-mentioned equipment embodiments of this application do not introduce units/modules that are not closely related to solving the technical problems raised by this application. This does not mean that the above-mentioned equipment embodiments do not exist. Other units/modules.

需要说明的是,在本专利的示例和说明书中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that in the examples and descriptions of this patent, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply There is no such actual relationship or sequence between these entities or operations. Furthermore, the terms "comprises," "comprises," or any other variations thereof are intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus that includes a list of elements includes not only those elements, but also those not expressly listed other elements, or elements inherent to the process, method, article or equipment. Without further limitation, an element defined by the statement "comprises a" does not exclude the presence of additional identical elements in a process, method, article, or device that includes the stated element.

虽然通过参照本申请的某些优选实施例,已经对本申请进行了图示和描述,但本领域的普通技术人员应该明白,可以在形式上和细节上对其作各种改变,而不偏离本申请的精神和范围。Although the present application has been illustrated and described with reference to certain preferred embodiments thereof, it will be understood by those of ordinary skill in the art that various changes may be made in form and detail without departing from the present invention. The spirit and scope of the application.

Claims (11)

1.一种数据处理方法,其特征在于,应用于电子设备中的至少一个处理器,并且所述电子设备包括传感器;1. A data processing method, characterized in that it is applied to at least one processor in an electronic device, and the electronic device includes a sensor; 所述方法包括:The methods include: 获取所述传感器上报的第一数据,所述第一数据具有第一帧数;Obtain the first data reported by the sensor, where the first data has a first frame number; 确定所述第一帧数满足第一条件,其中,所述第一条件包括所述第一帧数与目标上报帧数不同;Determine that the first frame number satisfies a first condition, wherein the first condition includes that the first frame number is different from the target reported frame number; 将所述第一数据处理为第二数据,其中,所述第二数据的第二帧数与目标上报帧数相同;Process the first data into second data, wherein the second frame number of the second data is the same as the target reporting frame number; 基于所述第二数据执行与所述第一数据相关的功能。Performing a function related to the first data based on the second data. 2.根据权利要求1所述的方法,其特征在于,所述第一条件还包括下列中的至少一项:2. The method of claim 1, wherein the first condition further includes at least one of the following: 所述传感器上报第一数据的速度达到第一速度;The speed at which the sensor reports the first data reaches the first speed; 所述传感器上报第一数据的速度精度要求为第一精度。The speed accuracy requirement of the first data reported by the sensor is the first accuracy. 3.根据权利要求1所述的方法,其特征在于,将所述第一数据处理为第二数据,包括:3. The method according to claim 1, characterized in that processing the first data into second data includes: 对应于所述第一帧数小于所述目标上报帧数,对所述第一数据补充第三数据,生成所述第二数据;Corresponding to the first frame number being less than the target reporting frame number, supplementing the first data with third data to generate the second data; 对应于所述第一帧数大于所述目标上报帧数,在所述第一数据中删减第四数据,生成所述第二数据。Corresponding to the fact that the first frame number is greater than the target reporting frame number, fourth data is deleted from the first data to generate the second data. 4.根据权利要求3所述的方法,其特征在于,所述第一数据包括所述传感器获取的多个传感器数据以及各传感器数据对应的时间戳。4. The method according to claim 3, wherein the first data includes a plurality of sensor data obtained by the sensor and a timestamp corresponding to each sensor data. 5.根据权利要求4所述的方法,其特征在于,所述对应于所述第一帧数小于所述目标上报帧数,对所述第一数据补充第三数据,生成所述第二数据,包括:5. The method according to claim 4, characterized in that when the number of frames corresponding to the first frame is less than the number of target reporting frames, third data is supplemented to the first data to generate the second data. ,include: 按照所述第一数据中各传感器数据的时间戳的先后,对所述多个传感器数据进行排序;Sorting the plurality of sensor data according to the order of the timestamps of each sensor data in the first data; 将排序后的所述多个所述传感器数据分为多个传感器数据子集,其中,所述传感器数据子集的数目与所述第三数据的帧数相同,每个所述传感器数据子集中的传感器数据的数目相同;Divide the sorted plurality of sensor data into multiple sensor data subsets, wherein the number of the sensor data subsets is the same as the number of frames of the third data, and each of the sensor data subsets The number of sensor data is the same; 在不同传感器数据子集的相同部位插入数据插值,生成所述第二数据。Data interpolation is inserted at the same location in different sensor data subsets to generate the second data. 6.根据权利要求5所述的方法,其特征在于,通过以下方式中的任意一种生成所述数据差值:6. The method according to claim 5, characterized in that the data difference is generated in any one of the following ways: 计算所述传感器数据子集中两端的两个所述传感器数据的平均值作为该传感器数据子集与相邻传感器数据子集之间的数据插值;Calculate the average of the two sensor data at both ends of the sensor data subset as a data interpolation between the sensor data subset and an adjacent sensor data subset; 对所述传感器数据子集中两端的至少两个所述传感器数据进行数据拟合,获取该传感器数据子集与相邻传感器数据子集之间的数据插值。Perform data fitting on at least two sensor data at both ends of the sensor data subset to obtain data interpolation between the sensor data subset and adjacent sensor data subsets. 7.根据权利要求4所述的方法,其特征在于,所述对应于所述第一帧数大于所述目标上报帧数,在所述第一数据中删减第四数据,生成所述第二数据,包括:7. The method according to claim 4, characterized in that, corresponding to the first frame number being greater than the target reporting frame number, fourth data is deleted from the first data to generate the third 2. Data, including: 按照所述第一数据中各传感器数据的时间戳的先后,对所述多个传感器数据进行排序;Sorting the plurality of sensor data according to the order of the timestamps of each sensor data in the first data; 从排序后的所述多个所述传感器数据中,以第一数目为间隔获取所述传感器数据,其中,获取的所述传感器数据的数目与所述第四数据的帧数相同;From the sorted plurality of sensor data, acquire the sensor data at intervals of a first number, wherein the number of acquired sensor data is the same as the number of frames of the fourth data; 删除获取的传感器数据,生成所述第二数据。The acquired sensor data is deleted and the second data is generated. 8.根据权利要求1至7中任一项所述的方法,其特征在于,还包括:8. The method according to any one of claims 1 to 7, further comprising: 基于所述传感器上报所述第一数据所用的第一时间和所述处理器的目标上报速度确定所述目标上报帧数。The target reporting frame number is determined based on the first time it takes for the sensor to report the first data and the target reporting speed of the processor. 9.一种电子设备,其特征在于,包括至少一个处理器和传感器;9. An electronic device, characterized by including at least one processor and a sensor; 所述至少一个处理器用于:The at least one processor is used for: 获取所述传感器上报的第一数据,所述第一数据具有第一帧数;Obtain the first data reported by the sensor, where the first data has a first frame number; 确定所述第一帧数是否满足第一条件,其中,所述第一条件包括所述第一帧数与目标上报帧数不同;Determine whether the first frame number satisfies a first condition, wherein the first condition includes that the first frame number is different from the target reported frame number; 对应于所述第一帧数满足所述第一条件,将所述第一数据处理为第二数据,其中,所述第二数据的第二帧数与目标上报帧数相同;Corresponding to the first frame number satisfying the first condition, the first data is processed into second data, wherein the second frame number of the second data is the same as the target reporting frame number; 基于所述第二数据执行与所述第一数据相关的功能。Performing a function related to the first data based on the second data. 10.根据权利要求9所述的电子设备,其特征在于,所述至少一个处理器包括第一处理器和第二处理器,其中,10. The electronic device of claim 9, wherein the at least one processor includes a first processor and a second processor, wherein, 所述第一处理器用于获取所述传感器上报的第一数据,并确定所述第一帧数是否满足第一条件,并且,The first processor is configured to obtain the first data reported by the sensor and determine whether the first number of frames meets a first condition, and, 在所述第一帧数满足所述第一条件时,将所述第一数据处理为第二数据;When the first frame number meets the first condition, process the first data into second data; 所述第二处理器用于从所述第一处理器获取所述第二数据,并执行与所述第一数据相关的功能。The second processor is configured to obtain the second data from the first processor and perform functions related to the first data. 11.一种计算机可读存储介质,其特征在于,所述可读存储介质上存储有指令,所述指令在计算机上执行时,使所述计算机执行权利要求1至8中任一项所述的数据处理方法。11. A computer-readable storage medium, characterized in that instructions are stored on the readable storage medium, and when the instructions are executed on a computer, they cause the computer to execute any one of claims 1 to 8. data processing methods.
CN202310645683.5A 2023-06-01 2023-06-01 Data processing method, readable storage medium, and electronic device Active CN117707470B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310645683.5A CN117707470B (en) 2023-06-01 2023-06-01 Data processing method, readable storage medium, and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310645683.5A CN117707470B (en) 2023-06-01 2023-06-01 Data processing method, readable storage medium, and electronic device

Publications (2)

Publication Number Publication Date
CN117707470A true CN117707470A (en) 2024-03-15
CN117707470B CN117707470B (en) 2024-10-08

Family

ID=90159438

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310645683.5A Active CN117707470B (en) 2023-06-01 2023-06-01 Data processing method, readable storage medium, and electronic device

Country Status (1)

Country Link
CN (1) CN117707470B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118094090A (en) * 2024-04-28 2024-05-28 深圳由莱智能电子有限公司 Mobile identification method, mobile identification device, beauty instrument and storage medium
CN118426873A (en) * 2024-06-27 2024-08-02 荣耀终端有限公司 Data processing method, electronic device, storage medium and chip

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114185512A (en) * 2021-11-01 2022-03-15 荣耀终端有限公司 Sensor data processing method, electronic device and readable storage medium
CN114979465A (en) * 2022-04-19 2022-08-30 荣耀终端有限公司 Video processing method, electronic device and readable medium
CN115514860A (en) * 2022-09-09 2022-12-23 维沃移动通信有限公司 Dynamic frame rate compensation method, image processing circuit and electronic equipment
CN116033275A (en) * 2023-03-29 2023-04-28 荣耀终端有限公司 A kind of automatic exposure method, electronic equipment and computer-readable storage medium
CN116182895A (en) * 2023-02-21 2023-05-30 哲库科技(上海)有限公司 Motion state detection method, electronic device and chip

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114185512A (en) * 2021-11-01 2022-03-15 荣耀终端有限公司 Sensor data processing method, electronic device and readable storage medium
WO2023071489A1 (en) * 2021-11-01 2023-05-04 荣耀终端有限公司 Sensor data processing method, electronic device, and readable storage medium
CN114979465A (en) * 2022-04-19 2022-08-30 荣耀终端有限公司 Video processing method, electronic device and readable medium
CN115514860A (en) * 2022-09-09 2022-12-23 维沃移动通信有限公司 Dynamic frame rate compensation method, image processing circuit and electronic equipment
CN116182895A (en) * 2023-02-21 2023-05-30 哲库科技(上海)有限公司 Motion state detection method, electronic device and chip
CN116033275A (en) * 2023-03-29 2023-04-28 荣耀终端有限公司 A kind of automatic exposure method, electronic equipment and computer-readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118094090A (en) * 2024-04-28 2024-05-28 深圳由莱智能电子有限公司 Mobile identification method, mobile identification device, beauty instrument and storage medium
CN118426873A (en) * 2024-06-27 2024-08-02 荣耀终端有限公司 Data processing method, electronic device, storage medium and chip

Also Published As

Publication number Publication date
CN117707470B (en) 2024-10-08

Similar Documents

Publication Publication Date Title
JP7280005B2 (en) Wireless charging method and electronic device
CN110825469A (en) Voice assistant display method and device
CN117707470B (en) Data processing method, readable storage medium, and electronic device
CN113473074B (en) Detection method, electronic equipment, detection equipment and storage medium
CN115017003B (en) Load prediction method and load prediction device
CN113688019B (en) Response time duration detection method and device
WO2022166435A1 (en) Picture sharing method and electronic device
WO2022100141A1 (en) Plug-in management method, system and apparatus
CN115017002B (en) Frequency prediction method and frequency prediction device
WO2021052070A1 (en) Frame rate identification method and electronic device
CN114466449A (en) Position feature acquisition method and electronic equipment
CN115655310B (en) Data calibration method, electronic device and readable storage medium
CN116070035B (en) Data processing methods and electronic equipment
CN114185512B (en) Sensor data processing method, electronic device and readable storage medium
CN115562514B (en) Touch display method, graphical interface and related device
CN110058729B (en) Method and electronic device for adjusting the sensitivity of touch detection
CN113641634B (en) Method for controlling log flow and electronic equipment
WO2022033355A1 (en) Mail processing method and electronic device
CN115964231A (en) Load model-based assessment method and device
CN115437601B (en) Image sorting method, electronic device, program product and medium
CN113485969B (en) Storage fragmentation method and device, terminal and computer storage medium
CN114264884B (en) Dielectric constant measurement method and device
CN115981756A (en) Data processing method, related device and communication system
CN110519319B (en) Method and device for splitting partitions
CN116528063B (en) Shooting method, readable storage medium and electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address

Address after: Unit 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong 518040

Patentee after: Honor Terminal Co.,Ltd.

Country or region after: China

Address before: 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong

Patentee before: Honor Device Co.,Ltd.

Country or region before: China

CP03 Change of name, title or address