Terminal distance sensor calibration method and apparatus, terminal device, and storage medium

By connecting to the coprocessor through the preset driver interface of the hardware abstraction layer, the sensor's noise floor value is obtained and controlled for calibration, which solves the problem that the sensor cannot be calibrated when ported to the coprocessor, and realizes low-power effective calibration and efficient data processing.

CN117201664BActive Publication Date: 2025-12-19HUIZHOU TCL MOBILE COMM CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210865373.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-21
Publication Date
2025-12-19
Estimated Expiration
2042-07-21

AI Technical Summary

Technical Problem

In existing technologies, after the sensor is ported to work under the coprocessor, the upper-layer calibration application cannot directly call the driver's calibration interface, resulting in sensor calibration failure and increased terminal power consumption.

Method used

The system connects directly to the coprocessor via the preset driver interface of the hardware abstraction layer. It calls the preset driver interface of the hardware abstraction layer to obtain and control the unobstructed noise floor value, the obstructed noise floor value, and the current noise floor value of the distance sensor. Based on these values, the sensor's brightness threshold is calibrated, which solves the problem that the sensor cannot be directly calibrated after it is ported to work under the coprocessor.

Benefits of technology

This enables efficient sensor calibration under a coprocessor, reducing terminal power consumption and improving the efficiency and reliability of sensor calibration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117201664B_ABST
    Figure CN117201664B_ABST
Patent Text Reader

Abstract

The application discloses a terminal distance sensor calibration method and device, a terminal equipment and a storage medium, a preset driving interface of a hardware abstraction layer is called to obtain an unobstructed bottom noise value and an obstructed bottom noise value of a distance sensor sent by a coprocessor; the preset driving interface of the hardware abstraction layer is called to obtain a current bottom noise value of the distance sensor in runtime sent by the coprocessor; and a driver of the distance sensor is controlled based on the preset driving interface of the hardware abstraction layer to calibrate a bright-dark threshold of the distance sensor according to the current bottom noise value, the unobstructed bottom noise value and the obstructed bottom noise value. According to the embodiment of the application, the preset driving interface of the hardware abstraction layer is called to directly call the distance sensor, and no driving node is needed, so that the problem that a calibration interface of a driver cannot be directly called by a calibration application of an upper layer after the sensor is transplanted to work under the coprocessor is solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of electronics, in particular to a distance sensor calibration method and device of a terminal, a terminal device and a storage medium. BACKGROUND

[0002] With the evolution of network communication technology, mobile portable devices such as mobile phones and tablets have gradually become indispensable communication tools in people's daily life and work. The numerous complex sensors in mobile phones and tablets also make their intelligent degree higher and higher, and the application of distance sensors is becoming more and more popular, such as mobile phone screen off when making or receiving a call, tablet 25cm distance eye protection function, etc.

[0003] Among them, the tablet 25cm distance eye protection function is to prompt that the distance is too close when detecting that the face is 25cm away from the tablet, and to limit the screen operation to achieve the eye protection function. The distance reference value of the eye protection function can be detected and distinguished by the distance sensor. In order to make the distance eye protection function accurately prompt at 25cm, the tablet usually uses automatic equipment to calibrate the performance of the distance sensor when it is shipped.

[0004] The existing calibration method is to directly write the offset value to the driver through the debugging node, but when the sensor is working, the CPU needs to be processed, which will increase the power consumption of the mobile phone. With the increasing demand for power consumption of mobile phones, the sensor begins to work under a special coprocessor, although it reduces the power consumption of the terminal, but in the calibration of the sensor, the upper calibration application cannot directly call the calibration interface of the driver, which makes the existing calibration method no longer applicable, which directly leads to the invalidation of the developed calibration software, and the distance sensor cannot be calibrated by automatic equipment. SUMMARY

[0005] The present application provides a kind of sensor calibration method, device, terminal equipment and storage medium of terminal of the present application embodiment, to realize the calibration of sensor when being transplanted to the coprocessor under work.

[0006] In one aspect, the present application embodiment provides a distance sensor calibration method of a terminal, the method comprising:

[0007] calling a preset driver interface of a hardware abstraction layer to obtain an unshielded noise floor value and a shielded noise floor value of a distance sensor sent by a coprocessor; the coprocessor is used to control the operation of the distance sensor;

[0008] calling a preset driver interface of the hardware abstraction layer to obtain a current noise floor value of the distance sensor when the coprocessor is running;

[0009] The preset driving interface of the hardware abstraction layer is called to control a driver of the distance sensor to calibrate a bright-dark threshold of the distance sensor according to the current noise floor value, the unobstructed noise floor value and the obstructed noise floor value.

[0010] Optionally, in some embodiments of the present application, the preset driving interface of the hardware abstraction layer is called to acquire the unobstructed noise floor value and the obstructed noise floor value of the distance sensor sent by the coprocessor, including:

[0011] The historical calibration data in the preset storage area is acquired; the historical calibration data includes historical unobstructed noise floor value and historical obstructed noise floor value;

[0012] If the historical calibration data meets the preset condition, the historical unobstructed noise floor value is set as the unobstructed noise floor value, and the historical obstructed noise floor value is set as the obstructed noise floor value;

[0013] If the historical calibration data does not meet the preset condition, a data reading instruction is sent to the coprocessor by calling the preset driving interface of the hardware abstraction layer, and the unobstructed noise floor value and the obstructed noise floor value of the distance sensor returned by the coprocessor based on the data reading instruction are acquired by calling the preset driving interface of the hardware abstraction layer.

[0014] Optionally, in some embodiments of the present application, the data reading instruction includes a first data reading instruction and a second data reading instruction;

[0015] The data reading instruction is sent to the coprocessor by calling the preset driving interface of the hardware abstraction layer, and the unobstructed noise floor value and the obstructed noise floor value of the distance sensor returned by the coprocessor based on the data reading instruction are acquired by calling the preset driving interface of the hardware abstraction layer, including:

[0016] The first data reading instruction is sent to the coprocessor by calling the preset driving interface of the hardware abstraction layer, and the unobstructed noise floor value returned by the coprocessor based on the first data reading instruction is received;

[0017] The unobstructed noise floor value is compared with a preset unobstructed noise floor threshold value;

[0018] If the unobstructed noise floor value does not meet the preset unobstructed noise floor threshold value, an alarm information is output; the alarm information is used to prompt the performance anomaly of the distance sensor;

[0019] If the unobstructed noise floor value meets the preset unobstructed noise floor threshold value, the second data reading instruction is sent to the coprocessor by calling the preset driving interface of the hardware abstraction layer, and the obstructed noise floor value returned by the coprocessor based on the second data reading instruction is received.

[0020] Optionally, in some embodiments of the present application, the preset driving interface of the hardware abstraction layer is called to obtain the current noise floor value of the distance sensor in operation sent by the coprocessor, including:

[0021] According to the unobstructed noise floor value and the obstructed noise floor value, an offset value is obtained.

[0022] According to a preset offset threshold, the offset value is verified.

[0023] If the offset value passes the verification, a preset driving interface of the hardware abstraction layer is called to issue a driving instruction to the coprocessor, and a preset driving interface of the hardware abstraction layer is called to obtain the current noise floor value of the distance sensor in operation returned by the coprocessor based on the driving instruction; the driving instruction is used to instruct the coprocessor to control the distance sensor to work and obtain the noise floor value collected by the distance sensor in operation.

[0024] Optionally, in some embodiments of the present application, the preset driving interface of the hardware abstraction layer is called to control the driving of the distance sensor to calibrate the on-off threshold of the distance sensor according to the current noise floor value, the unobstructed noise floor value and the obstructed noise floor value, including:

[0025] A preset driving interface of the hardware abstraction layer is called to issue a calibration instruction to the coprocessor, the calibration instruction including the unobstructed noise floor value, the current noise floor value and the obstructed noise floor value, the calibration instruction being used to instruct the coprocessor to write the unobstructed noise floor value and the obstructed noise floor value into the driving of the distance sensor, and control the driving of the distance sensor to calibrate the on-off threshold of the distance sensor according to the current noise floor value, the unobstructed noise floor value and the obstructed noise floor value.

[0026] Optionally, in some embodiments of the present application, after the preset driving interface of the hardware abstraction layer is called to control the driving of the distance sensor to calibrate the on-off threshold of the distance sensor according to the current noise floor value, the unobstructed noise floor value and the obstructed noise floor value, the method includes:

[0027] If the calibration completion instruction uploaded by the coprocessor is listened to, the unobstructed noise floor value and the obstructed noise floor value are written into a preset storage area.

[0028] Optionally, in some embodiments of the present application, the preset driving interface of the hardware abstraction layer is called to obtain the current noise floor value of the distance sensor in operation sent by the coprocessor, the method including:

[0029] The working state of the terminal is determined.

[0030] if the working state of the terminal is the on state, a preset bright-dark threshold is acquired, and a preset driving interface of the hardware abstraction layer is called to control a driver of the distance sensor to run for a preset time length according to the preset bright-dark threshold, then the preset driving interface of the hardware abstraction layer is called to acquire a current noise floor value of the distance sensor when the distance sensor is running, which is sent by the coprocessor, and the preset driving interface of the hardware abstraction layer is called to control the driver of the distance sensor to calibrate the preset bright-dark threshold according to the current noise floor value, the noise floor value without shielding, and the noise floor value with shielding;

[0031] if the working state of the terminal is the calibration state, the preset driving interface of the hardware abstraction layer is called to acquire the current noise floor value of the distance sensor when the distance sensor is running, which is sent by the coprocessor.

[0032] In another aspect, an embodiment of the present application provides a distance sensor calibration device of a terminal, the device comprising:

[0033] a reading module configured to call a preset driving interface of a hardware abstraction layer to acquire a noise floor value without shielding and a noise floor value with shielding of a distance sensor, which are sent by a coprocessor configured to control running of the distance sensor;

[0034] a driving module configured to call the preset driving interface of the hardware abstraction layer to acquire a current noise floor value of the distance sensor when the distance sensor is running, which is sent by the coprocessor;

[0035] a calibration module configured to control a driver of the distance sensor to calibrate a bright-dark threshold of the distance sensor according to the current noise floor value, the noise floor value without shielding, and the noise floor value with shielding, based on the preset driving interface of the hardware abstraction layer.

[0036] In another aspect, the present application provides a terminal device comprising a memory and a processor; the memory stores an application program, and the processor is configured to run the application program in the memory to perform the operations in the distance sensor calibration method of the terminal.

[0037] In another aspect, the present application provides a storage medium storing a plurality of instructions, which are suitable for being loaded by a processor to perform the steps in the distance sensor calibration method of the terminal.

[0038] The embodiment of the present application calls a preset driving interface of a hardware abstraction layer to obtain an unshielded floor noise value and a shielded floor noise value of a distance sensor sent by a coprocessor; calls the preset driving interface of the hardware abstraction layer to obtain a current floor noise value of the distance sensor at runtime sent by the coprocessor; controls a driver of the distance sensor to calibrate a bright-dark threshold of the distance sensor according to the current floor noise value, the unshielded floor noise value and the shielded floor noise value based on the preset driving interface of the hardware abstraction layer; the embodiment of the present application directly calls the distance sensor by calling the preset driving interface of the hardware abstraction layer, and does not need a driving node, thereby solving the problem that a calibration application of an upper layer cannot directly call a calibration interface of a driver after the sensor is transplanted to work under the SCP coprocessor. BRIEF DESCRIPTION OF DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort on the basis of these drawings.

[0040] Figure 1 is a distance sensor position diagram provided by the embodiment of the present application;

[0041] Figure 2 is a flow diagram of a distance sensor calibration method of a terminal provided by the embodiment of the present application;

[0042] Figure 3 is a structure diagram of a distance sensor calibration device of a terminal provided by the embodiment of the present application;

[0043] Figure 4 is a structure diagram of a terminal device provided by the embodiment of the present application. DETAILED DESCRIPTION

[0044] The technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings of the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present application.

[0045] As described in the background, the sensor arranged in the terminal between the terminal is directly connected with the processor in the terminal, the sensor is called and driven through the way of the underlying node, so when the sensor is calibrated, the offset value can be directly written into the driver through the way of debugging the node; but the way that the sensor is directly connected with the processor in the terminal needs the processor to process when the sensor is running, which increases the power consumption of the terminal. In order to solve the problem of increasing the power consumption of the terminal caused by the way that the sensor is directly connected with the processor in the terminal, a coprocessor is added in the terminal, and the sensor is connected with the coprocessor, and the sensor is called and driven by the coprocessor, so as to reduce the power consumption of the way that the sensor is directly connected with the processor in the terminal, but after the sensor is transplanted to work under the coprocessor, the sensor cannot be called through the driving node, and the calibration program in the terminal needs CPU to process when the calibration program is applied, and the sensor works under the coprocessor, which makes the calibration program unable to directly call the calibration interface of the driver, so that the calibration method of the sensor by directly writing the offset value into the driver through the debugging node is not applicable.

[0046] Based on this, in order to solve the problem that the sensor cannot be calibrated after being transplanted to work under the coprocessor, the present embodiment provides a distance sensor calibration method of a terminal, which directly issues instructions to the coprocessor where the distance sensor is located through a preset driving interface of a hardware abstraction layer, and connects the coprocessor through the preset driving interface of the hardware abstraction layer, so as to drive the distance sensor under the coprocessor to calibrate, without the driving node, solving the problem that the calibration application of the upper layer cannot directly call the calibration interface of the driver after the sensor is transplanted to work under the coprocessor; and in the sensor calibration, the unshielded noise value and the shielded noise value are read through the data reading mode, improving the efficiency of the sensor calibration and guaranteeing the reliability of the data.

[0047] In some embodiments of the present application, the terminal includes but is not limited to a mobile phone, a personal computer, a tablet computer, and a desktop computer. In some embodiments of the present application, the distance sensor is arranged in the terminal, as shown in Figure 1 Figure 1 is a distance sensor position diagram provided by the present embodiment, which can be arranged at the edge of the screen of the terminal. The distance sensor is used to detect the distance between the user's face and the terminal during the user's use of the terminal, and when it is detected that the distance between the user's face and the terminal is less than a preset distance, the terminal can be controlled to output a distance-too-close prompt information and close the response event of the screen of the terminal, so as to realize the eye protection function, and the terminal can also be controlled to close the screen, so that the user's face triggers other operations in the contact screen during the call.

[0048] As shown in Figure 2 Figure 2 ​​is a flowchart of a terminal distance sensor calibration method provided by an embodiment of the present application, and the terminal distance sensor calibration method shown in the flowchart includes steps 201-203.

[0049] 201, a preset driving interface of a hardware abstraction layer is invoked to obtain an unobstructed floor noise value and an obstructed floor noise value of a distance sensor sent by a coprocessor.

[0050] The coprocessor is configured to control operation of the distance sensor.

[0051] The unobstructed floor noise value refers to a floor noise value collected by the distance sensor when a screen of the terminal is unobstructed, and the obstructed floor noise value refers to a floor noise value collected by the distance sensor when the screen of the terminal is obstructed. In some embodiments of the present application, the screen of the terminal being obstructed can be that the distance sensor arranged on the screen of the terminal is obstructed by foreign matter, for example, the distance sensor arranged on the screen of the terminal is obstructed by paper scraps, oil stains, dust and the like. The terminal being obstructed by foreign matter can also be that the terminal is obstructed by paper, a face of a test personnel, a palm of the test personnel, a paper box and the like at a preset distance from the screen of the terminal, wherein the preset distance can be 25 cm, or 32 cm, or 25 cm≤the preset distance≤32 cm, that is, the terminal is obstructed at the preset distance from the screen of the terminal, and the floor noise value at this time is collected by the distance sensor to obtain the obstructed floor noise value.

[0052] It is considered that when the sensor is transplanted to work under the coprocessor, the calibration application cannot directly call the driving interface of the coprocessor to calibrate the distance sensor, and in order to solve this problem, a driving interface is developed in the hardware abstraction layer in the embodiments of the present application, and an instruction is sent to the coprocessor through the driving interface, the coprocessor responds to the instruction to perform corresponding operations, and calibration is realized. The hardware abstraction layer is an interface layer between the operating system kernel and the coprocessor, and its purpose is to abstract the hardware, which hides the hardware interface details of a specific platform, provides a virtual hardware platform for the operating system, so that the calibration application can send an instruction to the coprocessor through the hardware abstraction layer.

[0053] In some embodiments of the present application, the preset driving interface is configured to interact with the coprocessor where the distance sensor is located, and the data interaction includes issuing an instruction, receiving a reported instruction and reading data.

[0054] In some embodiments of the present application, when the terminal is powered on, in order to ensure the normal use of the terminal, the preset on-off threshold of the terminal can be set as the on-off threshold of the distance sensor, wherein the on-off threshold includes an on-screen threshold and an off-screen threshold, and the off-screen threshold is greater than the on-screen threshold. The off-screen threshold is used to turn on the eye protection function of the terminal, and the on-screen threshold is used to turn off the eye protection function of the terminal. It can be understood that, when the terminal is in use, the distance between the face of the user and the screen of the terminal is detected by the distance sensor. When the distance is less than or equal to the distance threshold corresponding to the off-screen threshold, the terminal is controlled to output prompt information on the current view of the screen to prompt the user that the distance between the user and the screen of the terminal is too close, and a transparent interface is displayed on the current view, which is used to block the response to the click event of the user. The distance between the face of the user and the screen of the terminal is continuously acquired. When the distance is greater than or equal to the distance threshold corresponding to the on-screen threshold, the transparent interface is closed to respond to the click event input by the user.

[0055] 202, a preset driving interface of a hardware abstraction layer is called to acquire the current noise floor value of the distance sensor running sent by the coprocessor.

[0056] In some embodiments of the present application, step 202 includes: calling a preset driving interface of a hardware abstraction layer to issue a driving instruction to a coprocessor where the distance sensor is located, controlling the coprocessor to drive the distance sensor to work, and acquiring the current noise floor value of the distance sensor when it works. A feedback instruction is generated according to the current noise floor value, and the feedback instruction is reported to the hardware abstraction layer through the coprocessor. When it is detected that there is a feedback instruction reported, the preset driving interface of the hardware abstraction layer is called to acquire the current noise floor value of the distance sensor running sent by the coprocessor.

[0057] In some embodiments of the present application, after the driving instruction is issued, a thread is started to monitor. If it is detected that there is a feedback instruction reported within a preset time, the preset driving interface of the hardware abstraction layer is called to acquire the feedback instruction, and the current noise floor value collected by the distance sensor in response to the driving instruction is received. If it is not detected that there is a feedback instruction reported within the preset time, the preset driving interface of the hardware abstraction layer is called again to issue a driving instruction to the coprocessor where the distance sensor is located. The number of times of issuing the driving instruction is recorded. If the number of times of issuing the driving instruction is greater than or equal to a preset number threshold, an alarm information is output, and the alarm information indicates that there is an abnormality in data transmission of the terminal.

[0058] 203, based on the preset driving interface of the hardware abstraction layer, the driver of the distance sensor is controlled to calibrate the on-off threshold of the distance sensor according to the current noise floor value, the unobstructed noise floor value and the obstructed noise floor value.

[0059] The on-off threshold is used to determine the on-off state of the eye protection function of the terminal. The driver is used to control the operation of the distance sensor to realize the eye protection function of the terminal.

[0060] In some embodiments of the present application, step 203 comprises: obtaining the offset value according to the unobstructed floor noise value and the obstructed floor noise value, and obtaining the on-off threshold of the distance sensor according to the sum of the offset value and the current floor noise value. The offset value is used to represent the floor noise difference between the unobstructed floor noise value and the obstructed floor noise value of the distance sensor.

[0061] In some embodiments of the present application, obtaining the on-off threshold of the distance sensor according to the sum of the offset value and the current floor noise value comprises: obtaining the off-screen threshold according to the sum of the current floor noise value and the offset value, obtaining a pre-stored threshold parameter, obtaining the on-screen threshold according to the off-screen threshold and the threshold parameter, and setting the off-screen threshold and the on-screen threshold as the on-off threshold of the distance sensor. The threshold parameter represents the difference between the off-screen threshold and the on-screen threshold.

[0062] In some embodiments of the present application, there are various ways to determine the offset value of the distance sensor, which exemplarily include:

[0063] (1) The difference between the unobstructed floor noise value and the obstructed floor noise value in the calibration data can be calculated, and the difference is set as the offset value.

[0064] (2) The calibration data can be input into a pre-set calculation model, and the offset value of the distance sensor is determined through the calculation model. The calculation model can be a mathematical model, a data processing model, etc.

[0065] (3) The difference between the unobstructed floor noise value and the obstructed floor noise value in the calibration data can be calculated, a pre-set calibration database is queried to determine the target difference value range where the difference is located, a pre-set offset value corresponding to the target difference value range is obtained, and the pre-set offset value corresponding to the target difference value range is set as the offset value of the distance sensor. The calibration database stores a plurality of difference value ranges and a pre-set offset value corresponding to each difference value range.

[0066] It should be noted that the above-mentioned determination method of the offset value of the distance sensor is only exemplary and does not constitute a limitation on the calibration method of the distance sensor of the terminal provided by the application.

[0067] The embodiments of the present application directly call the distance sensor through the pre-set driving interface of the hardware abstraction layer, without the need of a driving node, thereby solving the problem that the calibration application of the upper layer cannot directly call the calibration interface of the driver after the sensor is transplanted to work under the coprocessor.

[0068] In some embodiments of the present application, when acquiring the calibration data, the historical calibration data in the preset storage area can be read, and when the reading fails, a preset driving interface of the hardware abstraction layer is called to send a data reading instruction to the coprocessor, and a preset driving interface of the hardware abstraction layer is called to acquire the unshielded noise floor value and the shielded noise floor value of the distance sensor returned by the coprocessor based on the data reading instruction. Wherein, the reading failure can be that no historical calibration data is reported within a preset time, or that the reported historical calibration data is empty, wherein the historical calibration data includes the historical unshielded noise floor value and the historical shielded noise floor value obtained after the previous calibration. Specifically, the method for acquiring the unshielded noise floor value and the shielded noise floor value includes steps a1-a3:

[0069] Step a1, acquire the historical calibration data in the preset storage area.

[0070] In some embodiments of the present application, the preset storage area can be the register of the processor in the terminal, or the NVRAM (full name: Non-Volatile Random Access Memory, Chinese: Non-Volatile Random Access Memory) in the terminal, or the register of the coprocessor, or the data storage area of the distance sensor, or the database in the terminal providing data storage service, or the storage device connected with the terminal network, such as cloud database, data server, etc.

[0071] In some embodiments of the present application, the preset storage area can be accessed to read the historical calibration data in the preset storage area, and whether the historical calibration data meets the preset condition is determined according to the reading return value; if the reading return value is "0" or "N", it means that the historical calibration data reading fails, and it is determined that the historical calibration data does not meet the preset condition; if the reading return value is "1" or "Y", it means that the historical calibration data reading succeeds, and it is determined whether the historical calibration data is empty; if the historical calibration data is empty, it is determined that the historical calibration data does not meet the preset condition; if the historical calibration data is not empty, it is determined that the historical calibration data meets the preset condition. Wherein, the preset condition represents that the historical calibration data is real calibration data.

[0072] In some embodiments of the present application, in order to further verify the authenticity of the historical calibration data and ensure the reliability of the subsequent calibration, when the historical calibration data is not empty, the target field in the historical calibration data is read, the target field is compared with the preset field, if the target field is consistent with the preset field, it is determined that the historical calibration data meets the preset condition, if the target field is not consistent with the preset field, it is determined that the historical calibration data does not meet the preset condition. The target field can be a verification code of the historical calibration data, and the preset field can be a verification code pre-stored in the register of the terminal or a verification code pre-stored in the server connected with the terminal. In some embodiments of the present application, after the blocked noise value and the unblocked noise value are determined at each calibration, the verification code is generated according to the preset encoding rule, the verification code, the blocked noise value and the unblocked noise value are set as the calibration data, written into the preset storage area, and the verification code is stored in the register of the terminal or uploaded to the server.

[0073] In some embodiments of the present application, considering that when the terminal is in the powered-on state, the sensor in the terminal is still in the unstarted state, and in order to ensure that the terminal can work normally, the bright and dark thresholds of the distance sensor can be set as preset bright and dark thresholds, wherein the values of the bright threshold and the dark threshold in the preset bright and dark thresholds are set to be relatively large, so as to ensure that the terminal can be used normally when the terminal is in the powered-on state. Specifically, whether the terminal is in the powered-on state is determined by determining whether the sensor start instruction is issued, if the terminal is in the powered-on state, the preset bright and dark thresholds are obtained, and the preset bright and dark thresholds are set as the bright and dark thresholds of the distance sensor, if the terminal is not in the powered-on state, the operation of determining whether the historical calibration data meets the preset condition is performed. The sensor start instruction is used to start the distance sensor by the coprocessor, for example, the sensor start instruction can be an enable instruction.

[0074] In some embodiments of the present application, whether the terminal is in the powered-on state is determined by determining whether the sensor start instruction is issued, including: if the sensor start instruction is issued within a preset time period, it is determined that the terminal is not in the powered-on state, if the sensor start instruction is not issued within the preset time, it is determined that the terminal is in the powered-on state.

[0075] In some embodiments of the present application, considering that the noise floor of the distance sensor is different after each time the terminal is powered on, in order to ensure that the eye protection function is normally started after each time the terminal is powered on, the running time of the terminal can be obtained after the preset on-off threshold is set as the on-off threshold of the distance sensor, when the running time is greater than or equal to a preset time threshold, the historical calibration data is read, and a driving instruction is issued to the coprocessor where the distance sensor is located through the preset driving interface of the hardware abstraction layer, the current noise floor fed back by the driving instruction is received, the on-off threshold of the distance sensor of the terminal is adjusted according to the current noise floor and the historical calibration data, and the adjusted on-off threshold is set as a new on-off threshold. In some embodiments of the present application, the historical calibration data can be read according to steps a1-a3.

[0076] In step a2, if the historical calibration data meets the preset condition, the historical unobstructed noise floor is set as the unobstructed noise floor, and the historical obstructed noise floor is set as the obstructed noise floor.

[0077] In step a3, if the historical calibration data does not meet the preset condition, a data reading instruction is sent to the coprocessor by calling the preset driving interface of the hardware abstraction layer, and the unobstructed noise floor and the obstructed noise floor of the distance sensor returned by the coprocessor based on the data reading instruction are obtained by calling the preset driving interface of the hardware abstraction layer; the data reading instruction is used to instruct the coprocessor to control the distance sensor to work and obtain the noise floor collected by the distance sensor when working.

[0078] In some embodiments of the present application, during the use of the terminal, the terminal is affected by the environment, the wear of the distance sensor, and the fact that the screen of the terminal is blocked by foreign matter, etc., so that the monitoring accuracy of the distance sensor of the terminal changes. If the historical calibration data stored after the last calibration is still used at this time, the accuracy of the on-off threshold of the distance sensor may be reduced, thereby causing the eye protection function of the terminal to be unable to start normally. Based on this, after the historical calibration data is read, a driving instruction is issued to the coprocessor where the distance sensor is located through the preset driving interface of the hardware abstraction layer, the first noise floor fed back by the driving instruction is received, the difference between the historical unobstructed noise floor in the historical calibration data and the first noise floor is calculated, if the difference between the historical unobstructed noise floor in the historical calibration data and the first noise floor is greater than or equal to a first preset difference threshold, a driving instruction is issued to the coprocessor where the distance sensor is located through the preset driving interface of the hardware abstraction layer, and the unobstructed noise floor and the obstructed noise floor fed back by the driving instruction are received; if the difference between the historical obstructed noise floor in the historical calibration data and the first noise floor is less than the first preset difference threshold, the historical unobstructed noise floor is set as the unobstructed noise floor, and the historical obstructed noise floor is set as the obstructed noise floor. The first noise floor refers to the noise floor collected by the distance sensor of the terminal at the current time.

[0079] In some embodiments of the present application, the difference between the historical blocked noise floor value in the historical calibration data and the first noise floor value can also be calculated. If the difference between the historical blocked noise floor value in the historical calibration data and the first noise floor value is greater than or equal to a second preset difference threshold, a driving instruction is issued to the coprocessor where the distance sensor is located through a preset driving interface of the hardware abstraction layer, and the unblocked noise floor value and the blocked noise floor value fed back by the driving instruction are received. If the difference between the historical blocked noise floor value in the historical calibration data and the first noise floor value is less than the second preset difference threshold, the historical unblocked noise floor value is set as the unblocked noise floor value, and the historical blocked noise floor value is set as the blocked noise floor value.

[0080] In some embodiments of the present application, the data reading instruction includes a first data reading instruction and a second data reading instruction, wherein the first data reading instruction is used to instruct the coprocessor to report the unblocked noise floor value, and the second data reading instruction is used to instruct the coprocessor to report the blocked noise floor value. Specifically, the method for obtaining the unblocked noise floor value and the blocked noise floor value includes:

[0081] (1) A preset driving interface of the hardware abstraction layer is called to send the first data reading instruction to the coprocessor and receive the unblocked noise floor value returned by the coprocessor based on the first data reading instruction.

[0082] (2) The unblocked noise floor value is compared with a preset unblocked noise floor threshold.

[0083] (3) If the unblocked noise floor value does not conform to the preset unblocked noise floor threshold, an alarm information is outputted. The alarm information is used to prompt the performance anomaly of the distance sensor.

[0084] (4) If the unblocked noise floor value conforms to the preset unblocked noise floor threshold, a preset driving interface of the hardware abstraction layer is called to send the second data reading instruction to the coprocessor and receive the blocked noise floor value returned by the coprocessor based on the second data reading instruction.

[0085] In some embodiments of the present application, after the first data reading instruction is issued to the coprocessor where the distance sensor is located through the preset driving interface of the hardware abstraction layer, the coprocessor controls the distance sensor to collect the noise floor value according to a preset period, and writes the collected noise floor value and the collection time of the noise floor value into a register. The noise floor value corresponding to the collection time matched with the time of reading and sending the first data reading instruction is set as the unblocked noise floor value, and the unblocked noise floor value is reported to the hardware abstraction layer.

[0086] In some embodiments of the present application, after the preset driving interface of the hardware abstraction layer is called to issue the first data reading instruction to the coprocessor where the distance sensor is located, the coprocessor controls the distance sensor to collect the noise floor value at a preset period to obtain a plurality of noise floor values, sets the minimum noise floor value in the plurality of noise floor values as the unobstructed noise floor value, and reports the unobstructed noise floor value to the hardware abstraction layer.

[0087] In some embodiments of the present application, after the preset driving interface of the hardware abstraction layer is called to issue the first data reading instruction to the coprocessor where the distance sensor is located, the coprocessor controls the distance sensor to collect the noise floor value at a preset period to obtain a plurality of noise floor values, sets the average, mode or median of the plurality of noise floor values as the unobstructed noise floor value, and reports the unobstructed noise floor value to the hardware abstraction layer.

[0088] In some embodiments of the present application, when reporting the unobstructed noise floor value, the coprocessor reports a data reading feedback instruction at the same time in order to enable the hardware abstraction layer to read as soon as possible. When the coprocessor reports the data reading feedback instruction, the preset driving interface of the hardware abstraction layer is called to read the unobstructed noise floor value reported by the coprocessor. The data reading feedback instruction can be a RAW_ACTION instruction, and the driving instruction can be enableRawData. In some embodiments of the present application, when the first data reading instruction is issued, the first data reading instruction is transmitted to the SCP coprocessor through the preset driving interface of the hardware abstraction layer through encapsulation on the AP side. In some embodiments of the present application, in order to determine the performance of the distance sensor, when the unobstructed noise floor value is received, the unobstructed noise floor value is compared with a preset noise floor threshold value, and whether the initial low noise meets the preset unobstructed noise floor threshold value is determined according to the comparison result. If the initial low noise meets the preset condition, a second data reading instruction is issued to the coprocessor where the distance sensor is located in response to the noise floor value reading instruction by calling the preset driving interface of the hardware abstraction layer, and an obstructed noise floor value returned by the second data reading instruction is received. The preset condition indicates that the unobstructed noise floor value is less than or equal to the preset noise floor threshold value, i.e. the unobstructed noise floor value is compared with the preset noise floor threshold value. If the unobstructed noise floor value is greater than the preset noise floor threshold value, it is determined that the initial low noise does not meet the preset unobstructed noise floor threshold value. If the unobstructed noise floor value is less than or equal to the preset noise floor threshold value, it is determined that the initial low noise meets the preset unobstructed noise floor threshold value.

[0089] In some embodiments of the present application, after determining that the initial low noise meets the preset unobstructed noise threshold, prompt information for continuing calibration is output to prompt the staff to perform obstruction at a preset distance from the terminal screen; in response to a noise value reading instruction input by the user, a preset driving interface of the hardware abstraction layer is called to issue a second data reading instruction to the coprocessor where the distance sensor is located, and an obstructed noise value returned by the second data reading instruction is received. In some embodiments of the present application, the preset driving interface of the hardware abstraction layer can be used to issue the second data reading instruction to the coprocessor where the distance sensor is located, so as to read the obstructed noise value in the register of the coprocessor. In some embodiments of the present application, similar to the reading method of the unobstructed noise value, after issuing the second data reading instruction, a thread is started to listen, and when the data reading feedback instruction is reported, the obstructed noise value is read. In some embodiments of the present application, the coprocessor reads the noise value corresponding to the collection time matching the time of issuing the second data reading instruction from the register in response to the second data reading instruction, sets the read noise value corresponding to the collection time matching the time of issuing the second data reading instruction as the obstructed noise value, and reports the data reading feedback instruction when reporting the unobstructed noise value.

[0090] In some embodiments of the present application, if the initial low noise does not meet the preset unobstructed noise threshold, alarm information is output to prompt the staff that the distance sensor of the terminal is abnormal.

[0091] In some embodiments of the present application, whether the terminal is calibrated for the first time can be determined by determining whether the read historical calibration data is empty; if the terminal is calibrated for the first time, when the initial low noise does not meet the preset unobstructed noise threshold, alarm information is output to prompt the staff that the distance sensor of the terminal is abnormal; if the terminal is not calibrated for the first time, when the initial low noise does not meet the preset unobstructed noise threshold, it indicates that the distance sensor of the terminal has an error, and in order to ensure the normal use of the distance sensor, it is necessary to re-determine the calibration, so it is necessary to obtain the obstructed noise value of the distance sensor and determine the calibration data according to the unobstructed noise value and the obstructed noise value. In some embodiments of the present application, if the read historical calibration data is empty, it is determined that the terminal is calibrated for the first time; if the read historical calibration data is not empty, it is determined that the terminal is not calibrated for the first time.

[0092] In some embodiments of the present application, after determining the calibration data, the offset value of the distance sensor can be obtained according to the difference between the unobstructed noise value and the obstructed noise value, the offset value is verified, and if the offset value passes the verification, a preset driving interface of the hardware abstraction layer is called to issue a driving instruction to the coprocessor, and the current noise value of the distance sensor running at the time based on the driving instruction returned by the coprocessor is obtained. Specifically, the method for obtaining the current noise value comprises:

[0093] (1) Obtain an offset value according to the unshielded noise value and the shielded noise value.

[0094] (2) Verify the offset value according to a preset offset threshold.

[0095] (3) If the offset value passes the verification, call a preset driving interface of the hardware abstraction layer to issue a driving instruction to the coprocessor, and call the preset driving interface of the hardware abstraction layer to obtain a current noise value of the distance sensor at runtime returned by the coprocessor based on the driving instruction. The driving instruction is used to instruct the coprocessor to control the distance sensor to work and to obtain the noise value collected by the distance sensor when working.

[0096] In some embodiments of the present application, the preset driving interface of the hardware abstraction layer can be called to issue an offset value calculation instruction to the driver of the terminal. The offset value calculation instruction is used to drive the driver of the terminal to set the offset value of the distance sensor according to the unshielded noise value and the shielded noise value, and to obtain the offset value returned by the driver based on the offset value calculation instruction.

[0097] In some embodiments of the present application, the offset value can be obtained by comparing the shielded noise value with the unshielded noise value. The offset value is verified by comparing the offset value with the first preset offset threshold and the second preset offset threshold respectively. If the offset value is greater than the first preset offset threshold and less than the second preset offset threshold, it is determined that the offset value passes the verification. If the offset value is less than the first preset offset threshold and / or the offset value is greater than the second preset offset threshold, it is determined that the offset value fails the verification. The first preset offset threshold is greater than the second preset offset threshold. It should be noted that the specific values of the first preset offset threshold and the second preset offset threshold are not limited in the embodiments of the present application, and can be set according to the actual application scenario and the performance of the distance sensor. For example, the first preset offset threshold can be set to 50, and the second preset offset threshold can be set to 500.

[0098] In some embodiments of the present application, if the offset value fails the verification, it indicates that the distance sensor may have an abnormality. The above steps of obtaining the unshielded noise value and the shielded noise value and determining the offset value are re-executed to obtain a new offset value. The new offset value is verified. If the new offset value passes the verification, the preset driving interface of the hardware abstraction layer is called to issue a driving instruction to the coprocessor, and the preset driving interface of the hardware abstraction layer is called to obtain a current noise value of the distance sensor at runtime returned by the coprocessor based on the driving instruction. If the new offset value fails the verification, the above steps of obtaining the unshielded noise value and the shielded noise value and determining the offset value are re-executed to obtain a new offset value. The new offset value is verified, and the number of re-acquisition of the offset value is recorded. If the number of re-acquisition of the offset value is greater than or equal to a preset number threshold, an alarm information is output to prompt the staff to maintain.

[0099] In some embodiments of the present application, if the offset value fails to pass the verification, it indicates that the distance sensor may have an abnormality, and the above steps of obtaining the unshielded noise floor value and the shielded noise floor value, and determining the offset value are re-executed to obtain a plurality of new offset values, an offset average value is obtained according to the plurality of new offset values, and the offset average value is compared with the first preset offset threshold and the second preset offset threshold respectively to verify the offset value; if the verification passes, a preset driving interface of the hardware abstraction layer is called to obtain the current noise floor value of the distance sensor returned by the coprocessor based on the driving instruction; and if the verification fails, an alarm information is output to prompt the staff to maintain.

[0100] In some embodiments of the present application, if the offset value passes the verification, a preset driving interface of the hardware abstraction layer is called to issue a driving instruction to the coprocessor, a preset driving interface of the hardware abstraction layer is called to obtain the current noise floor value of the distance sensor returned by the coprocessor based on the driving instruction, a preset driving interface of the hardware abstraction layer is called to issue a calibration instruction to the coprocessor, and the driver of the distance sensor is controlled to calibrate the on-off threshold of the distance sensor according to the current noise floor value, the unshielded noise floor value and the shielded noise floor value. The calibration instruction includes the unshielded noise floor value, the current noise floor value and the shielded noise floor value, and is used to instruct the coprocessor to write the unshielded noise floor value and the shielded noise floor value into the driver of the distance sensor, and control the driver of the distance sensor to calibrate the on-off threshold of the distance sensor according to the current noise floor value, the unshielded noise floor value and the shielded noise floor value. In some embodiments of the present application, the calibration instruction can be a configCalibration instruction, the calibration instruction is packaged after the AP side, and a preset driving interface of the hardware abstraction layer is called to issue the packaged calibration instruction to the coprocessor, and the packaged calibration instruction is transmitted to the coprocessor. The coprocessor receives the calibration instruction, calculates the offset value according to the unshielded noise floor value and the shielded noise floor value in the calibration instruction, reads the current noise floor value, obtains the off-screen threshold by calculating the sum of the offset value and the current noise floor value, obtains the on-screen threshold according to the off-screen threshold and the pre-stored threshold parameter, writes the off-screen threshold and the on-screen threshold into the register of the terminal, and reports the calibration completion instruction after the off-screen threshold and the on-screen threshold are written into the register. The on-screen threshold can be obtained according to the off-screen threshold and the pre-stored threshold parameter, that is, the difference between the off-screen threshold and the pre-stored threshold parameter is set as the on-screen threshold, and the threshold parameter can be 15, that is, the off-screen threshold-15 is set as the on-screen threshold. In some embodiments of the present application, after the calibration instruction is issued, a thread is started to listen, and when the calibration completion instruction is reported, it is determined that the calibration of the distance sensor is completed, and then the unshielded noise floor value and the shielded noise floor value are written into the preset storage area.

[0101] The distance sensor calibration method of the terminal provided by the embodiment of the present application directly calls the distance sensor by calling the preset driving interface of the hardware abstraction layer, and does not need a driving node, thereby solving the problem that the calibration application of the upper layer cannot directly call the calibration interface of the driving after the sensor is transplanted to work under the coprocessor.

[0102] In order to better implement the distance sensor calibration method of the terminal provided by the embodiment of the present application, on the basis of the distance sensor calibration method of the terminal, the embodiment of the present application provides a distance sensor calibration device of a terminal, as shown in Figure 3 Figure 3 is a structural schematic diagram of the distance sensor calibration device of the terminal provided by the embodiment of the present application, and the distance sensor calibration device of the terminal shown comprises:

[0103] The reading module 301 is configured to call the preset driving interface of the hardware abstraction layer to obtain the unshielded floor noise value and the shielded floor noise value of the distance sensor sent by the coprocessor; and the coprocessor is configured to control the operation of the distance sensor.

[0104] The driving module 302 is configured to call the preset driving interface of the hardware abstraction layer to obtain the current floor noise value of the distance sensor in operation sent by the coprocessor.

[0105] The calibration module 303 is configured to control the driver of the distance sensor to calibrate the bright-dark threshold of the distance sensor based on the current floor noise value, the unshielded floor noise value and the shielded floor noise value according to the preset driving interface of the hardware abstraction layer.

[0106] In some embodiments of the present application, the reading module 301 comprises:

[0107] The data acquisition unit is configured to acquire historical calibration data in a preset storage area; the historical calibration data comprises historical unshielded floor noise value and historical shielded floor noise value.

[0108] The first reading unit is configured to, if the historical calibration data meets the preset condition, set the historical unshielded floor noise value as the unshielded floor noise value and set the historical shielded floor noise value as the shielded floor noise value.

[0109] The second reading unit is configured to, if the historical calibration data does not meet the preset condition, call the preset driving interface of the hardware abstraction layer to send a data reading instruction to the coprocessor, and call the preset driving interface of the hardware abstraction layer to obtain the unshielded floor noise value and the shielded floor noise value of the distance sensor returned by the coprocessor based on the data reading instruction.

[0110] In some embodiments of the present application, the second reading unit is configured to:

[0111] ​sending, to the coprocessor, a first data reading instruction by calling a preset driving interface of the hardware abstraction layer, and receiving an unshielded floor noise value returned by the coprocessor based on the first data reading instruction;

[0112] comparing the unshielded floor noise value with a preset unshielded floor noise threshold value;

[0113] if the unshielded floor noise value does not conform to the preset unshielded floor noise threshold value, outputting an alarm information; the alarm information is used to prompt an abnormal performance of the distance sensor;

[0114] if the unshielded floor noise value conforms to the preset unshielded floor noise threshold value, sending, to the coprocessor, a second data reading instruction by calling the preset driving interface of the hardware abstraction layer, and receiving a shielded floor noise value returned by the coprocessor based on the second data reading instruction.

[0115] In some embodiments of the present application, the driving module 302 is configured to:

[0116] obtaining an offset value according to the unshielded floor noise value and the shielded floor noise value;

[0117] verifying the offset value according to a preset offset threshold value;

[0118] if the offset value passes the verification, issuing a driving instruction to the coprocessor by calling the preset driving interface of the hardware abstraction layer, and obtaining a current floor noise value of the distance sensor at runtime returned by the coprocessor based on the driving instruction; the driving instruction is used to instruct the coprocessor to control the distance sensor to work and to acquire the floor noise value collected by the distance sensor when working.

[0119] In some embodiments of the present application, the calibration module 303 is configured to:

[0120] issuing a calibration instruction to the coprocessor by calling the preset driving interface of the hardware abstraction layer, the calibration instruction including the unshielded floor noise value, the current floor noise value and the shielded floor noise value, the calibration instruction being used to instruct the coprocessor to write the unshielded floor noise value and the shielded floor noise value into a drive of the distance sensor, and to control the drive of the distance sensor to calibrate a bright-dark threshold of the distance sensor according to the current floor noise value, the unshielded floor noise value and the shielded floor noise value.

[0121] In some embodiments of the present application, the calibration module 303 is configured to: if a calibration completion instruction uploaded by the coprocessor is listened to, write the unshielded floor noise value and the shielded floor noise value into a preset storage area.

[0122] In some embodiments of the present application, the driving module 302 is configured to:

[0123] determining a working state of the terminal;

[0124] If the working state of the terminal is the booting state, preset on-off thresholds are acquired, and preset driving interfaces of a hardware abstraction layer are called to control a driver of the distance sensor to run for a preset time length according to the preset on-off thresholds, then preset driving interfaces of the hardware abstraction layer are called to acquire a current noise floor value of the distance sensor running sent by the coprocessor, and the preset driving interfaces of the hardware abstraction layer are called to control the driver of the distance sensor to calibrate the preset on-off thresholds according to the current noise floor value, the noise floor value without shielding, and the noise floor value with shielding.

[0125] If the working state of the terminal is the calibration state, preset driving interfaces of a hardware abstraction layer are called to acquire a current noise floor value of the distance sensor running sent by the coprocessor.

[0126] The distance sensor calibration device of the terminal provided by the embodiment of the application directly calls the distance sensor by calling preset driving interfaces of a hardware abstraction layer, and does not need a driving node, thereby solving the problem that after the sensor is transplanted to work under the SCP coprocessor, the calibration application of the upper layer cannot directly call the calibration interface of the driver.

[0127] The embodiment of the application further provides a terminal device, as shown in the accompanying drawings, Figure 4 The terminal device can include radio frequency (RF, Radio Frequency) circuit 401, memory 402 including one or more computer readable storage media, input unit 403, display unit 404, sensor 405, audio circuit 406, wireless fidelity (WiFi, Wireless Fidelity) module 407, processor 408 including one or more processing cores, and power supply 409, etc. Those skilled in the art can understand, Figure 4 The terminal device structure shown in the accompanying drawings does not constitute a limitation on the terminal device, and can include more or fewer components than the drawings, or combine certain components, or different component arrangements. Among them:

[0128] The RF circuit 401 can be used for receiving and sending signals in the process of information or communication, in particular, receiving the downlink information from the base station and sending the uplink data to the base station. Generally, the RF circuit 401 includes, but is not limited to, an antenna, at least one amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, etc. In addition, the RF circuit 401 can also communicate with the network and other devices through wireless communication. The wireless communication can use any communication standards or protocols, including but not limited to Global System for Mobile Communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.

[0129] The memory 402 can be used to store software programs and modules, and the processor 408 can execute various functions and data processing by running the software programs and modules stored in the memory 402. The memory 402 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.), etc.; the data storage area can store data created according to the use of the terminal device (such as audio data, a phone book, etc.), etc. In addition, the memory 402 can include a high-speed random access memory, and can also include a non-volatile memory, for example, at least one magnetic disk storage device, a flash memory device, or other volatile solid-state memory device. Accordingly, the memory 402 can also include a memory controller to provide access for the processor 408 and the input unit 403 to the memory 402.

[0130] The input unit 403 can be configured to receive input of digital or character information, and to generate a key, mouse, joystick, optical or trackball signal input related to user settings and function control. Specifically, in one embodiment, the input unit 403 can include a touch-sensitive surface and other input devices. The touch-sensitive surface, also known as a touch display or touchpad, can collect touch operations (such as a user's operation on or near the touch-sensitive surface using a finger, a stylus, or any suitable object or accessory) on or near the touch-sensitive surface and drive the corresponding connection device according to the pre-set program. Optionally, the touch-sensitive surface can include two parts of touch detection device and touch controller. Among them, the touch detection device detects the touch position of the user and detects the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device and converts it into touch coordinates, and sends it to the processor 408, and can receive the command from the processor 408 and execute it. In addition, the touch-sensitive surface can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch-sensitive surface, the input unit 403 can also include other input devices. Specifically, the other input devices can include one or more of a physical keyboard, function keys (such as volume control keys, on-off keys, etc.), trackballs, mice, joysticks, etc.

[0131] The display unit 404 can be configured to display information input by a user or information provided to a user and various graphical user interfaces of a terminal device, which can be composed of graphics, text, icons, video, and any combination thereof. The display unit 404 can include a display panel, which can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch-sensitive surface can cover the display panel, and when the touch-sensitive surface detects a touch operation on or near it, it is transmitted to the processor 408 to determine the type of touch event, and then the processor 408 provides corresponding visual output on the display panel according to the type of touch event. Although in the above description, the touch-sensitive surface and the display panel are implemented as two independent components to realize input and output functions, in some embodiments, the touch-sensitive surface and the display panel can be integrated to realize input and output functions. Figure 4

[0132] ​The terminal device can further include at least one sensor 405, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor can include an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel according to the brightness of ambient light, and the proximity sensor can turn off the display panel and / or backlight when the terminal device is moved to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and when at rest, it can detect the magnitude and direction of gravity, which can be used for identifying the posture of the mobile phone (such as switching between landscape and portrait screens, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometers, taps), and the like. As for other sensors that the terminal device can also be configured, such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, and the like, they will not be described here.

[0133] The audio circuit 406, the speaker, and the microphone can provide an audio interface between the user and the terminal device. The audio circuit 406 can convert the received audio data into an electrical signal and transmit it to the speaker, which converts the electrical signal into a sound signal and outputs it. On the other hand, the microphone collects a sound signal and converts it into an electrical signal, which is received by the audio circuit 406 and converted into audio data. The audio data is then output to the processor 408 for processing, and then transmitted to another terminal device via the RF circuit 401, or output to the memory 402 for further processing. The audio circuit 406 can also include a jack for connecting external earphones to the terminal device.

[0134] WiFi is a short-range wireless transmission technology. The WiFi module 407 can help the user to send and receive emails, browse web pages, and access streaming media, etc. It provides users with wireless broadband Internet access. Although Figure 4 The WiFi module 407 is shown, but it is understood that it does not belong to the essential components of the terminal device, and can be omitted as needed without changing the essence of the application.

[0135] The processor 408 is the control center of the terminal device, which connects all parts of the mobile phone through various interfaces and lines, executes various functions of the terminal device and processes data by running or executing software programs and / or modules stored in the memory 402, and calling data stored in the memory 402, thereby monitoring the mobile phone as a whole. Optionally, the processor 408 can include one or more processing cores; preferably, the processor 408 can integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 408.

[0136] The terminal device also includes a power supply 409 (such as a battery) for supplying power to each component. Preferably, the power supply can be logically connected to the processor 408 through a power management system, so that the power management system can manage charging, discharging, power consumption management, and the like. The power supply 409 can also include one or more DC or AC power sources, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and any other components.

[0137] Although not shown, the terminal device can also include a camera, a Bluetooth module, and the like, which will not be described here. In the present embodiment, the processor 408 in the terminal device loads one or more executable files corresponding to the processes of one or more application programs into the memory 402 according to the following instructions, and runs the application programs stored in the memory 402 by the processor 408, thereby implementing various functions:

[0138] The preset driving interface of the hardware abstraction layer is called to obtain the unshielded floor noise value and the shielded floor noise value of the distance sensor sent by the coprocessor; the coprocessor is used for controlling the running of the distance sensor;

[0139] The preset driving interface of the hardware abstraction layer is called to obtain the current floor noise value of the distance sensor when running, which is sent by the coprocessor;

[0140] Based on the driver of the distance sensor controlled by the preset driving interface of the hardware abstraction layer, the on-off threshold of the distance sensor is calibrated according to the current floor noise value, the unshielded floor noise value and the shielded floor noise value.

[0141] Those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by related hardware controlled by instructions, which can be stored in a computer readable storage medium and loaded and executed by a processor.

[0142] To this end, the embodiment of the present application provides a storage medium, which stores a plurality of instructions. The instructions can be loaded by a processor to execute the steps in any distance sensor calibration method of the terminal provided by the embodiment of the present application. For example, the instructions can execute the following steps:

[0143] The preset driving interface of the hardware abstraction layer is called to obtain the unshielded floor noise value and the shielded floor noise value of the distance sensor sent by the coprocessor; the coprocessor is used for controlling the running of the distance sensor;

[0144] The preset driving interface of the hardware abstraction layer is called to obtain the current floor noise value of the distance sensor when running, which is sent by the coprocessor;

[0145] The preset driving interface based on the hardware abstraction layer controls the driver of the distance sensor to calibrate the on-off threshold of the distance sensor according to the current noise value, the unobstructed noise value and the obstructed noise value.

[0146] The specific implementation of the above operations can refer to the foregoing embodiments, and will not be described here.

[0147] The storage medium can include a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0148] Due to the instructions stored in the storage medium, the steps of the distance sensor calibration method of any terminal provided by the embodiments of the present application can be executed, thus the beneficial effects of the distance sensor calibration method of any terminal provided by the embodiments of the present application can be achieved, which will be described in detail in the foregoing embodiments and will not be described here.

[0149] The distance sensor calibration method, device, terminal equipment and storage medium provided by the embodiments of the present application are described in detail above, and the principles and implementation manners of the present application are described by applying specific examples in this paper; the above embodiment descriptions are only used to help understand the method of the present application and its core idea; meanwhile, for those skilled in the art, the specific implementation manners and application ranges will be changed according to the idea of the present application, and the above description should not be understood as a limitation of the present application.

Claims

1. A distance sensor calibration method of a terminal, characterized by, The method comprises: calling a preset driving interface of a hardware abstraction layer to obtain an unshielded noise floor value and a shielded noise floor value of a distance sensor sent by a coprocessor, the coprocessor being configured to control operation of the distance sensor; calling the preset driving interface of the hardware abstraction layer to obtain a current noise floor value of the distance sensor in operation sent by the coprocessor; controlling, based on the preset driving interface of the hardware abstraction layer, a driver of the distance sensor to calibrate a bright-dark threshold of the distance sensor according to the current noise floor value, the unshielded noise floor value and the shielded noise floor value.

2. The terminal's distance sensor calibration method of claim 1, wherein, The calling of the preset driving interface of the hardware abstraction layer to obtain the unshielded noise floor value and the shielded noise floor value of the distance sensor sent by the coprocessor comprises: obtaining historical calibration data in a preset storage area, the historical calibration data comprising a historical unshielded noise floor value and a historical shielded noise floor value; if the historical calibration data meets a preset condition, setting the historical unshielded noise floor value as the unshielded noise floor value and setting the historical shielded noise floor value as the shielded noise floor value; if the historical calibration data does not meet the preset condition, calling the preset driving interface of the hardware abstraction layer to send a data reading instruction to the coprocessor and calling the preset driving interface of the hardware abstraction layer to obtain the unshielded noise floor value and the shielded noise floor value of the distance sensor returned by the coprocessor based on the data reading instruction.

3. The terminal's distance sensor calibration method of claim 2, wherein, The data reading instruction comprises a first data reading instruction and a second data reading instruction. The calling of the preset driving interface of the hardware abstraction layer to send the data reading instruction to the coprocessor and to obtain the unshielded noise floor value and the shielded noise floor value of the distance sensor returned by the coprocessor based on the data reading instruction comprises: calling the preset driving interface of the hardware abstraction layer to send the first data reading instruction to the coprocessor and to receive the unshielded noise floor value returned by the coprocessor based on the first data reading instruction; comparing the unshielded noise floor value with a preset unshielded noise floor threshold value; if the unshielded noise floor value does not meet the preset unshielded noise floor threshold value, outputting an alarm information, the alarm information being configured to prompt an abnormal performance of the distance sensor; if the unshielded noise floor value meets the preset unshielded noise floor threshold value, calling the preset driving interface of the hardware abstraction layer to send the second data reading instruction to the coprocessor and to receive the shielded noise floor value returned by the coprocessor based on the second data reading instruction.

4. The terminal's distance sensor calibration method of claim 1, wherein, The calling of the preset driving interface of the hardware abstraction layer to obtain the current noise floor value of the distance sensor in operation sent by the coprocessor comprises: obtaining an offset value according to the unshielded noise floor value and the shielded noise floor value; verifying the offset value according to a preset offset threshold value; If the offset value passes the verification, a preset driving interface of the hardware abstraction layer is called to send a driving instruction to the coprocessor, and a preset driving interface of the hardware abstraction layer is called to obtain the current noise floor value of the distance sensor at runtime returned by the coprocessor based on the driving instruction, and the driving instruction is used to instruct the coprocessor to control the distance sensor to work and obtain the noise floor value collected by the distance sensor when working.

5. The terminal's distance sensor calibration method of claim 1, wherein, The driving of the distance sensor based on the preset driving interface of the hardware abstraction layer is calibrated according to the current noise floor value, the unobstructed noise floor value and the obstructed noise floor value, including: The preset driving interface of the hardware abstraction layer is called to send a calibration instruction to the coprocessor, and the calibration instruction includes the unobstructed noise floor value, the current noise floor value and the obstructed noise floor value, and the calibration instruction is used to instruct the coprocessor to write the unobstructed noise floor value and the obstructed noise floor value into the driving of the distance sensor, and control the driving of the distance sensor to calibrate the on-off threshold of the distance sensor according to the current noise floor value, the unobstructed noise floor value and the obstructed noise floor value.

6. The terminal's distance sensor calibration method of claim 1, wherein, After the driving of the distance sensor based on the preset driving interface of the hardware abstraction layer is calibrated according to the current noise floor value, the unobstructed noise floor value and the obstructed noise floor value, the method includes: If the calibration completion instruction uploaded by the coprocessor is monitored, the unobstructed noise floor value and the obstructed noise floor value are written into a preset storage area.

7. The distance sensor calibration method of a terminal according to any one of claims 1 to 6, wherein The preset driving interface of the hardware abstraction layer is called to obtain the current noise floor value of the distance sensor at runtime sent by the coprocessor, and the method includes: Determine the working state of the terminal; If the working state of the terminal is the booting state, a preset on-off threshold is obtained, and after the driver of the distance sensor is controlled to run for a preset time length according to the preset on-off threshold by the preset driving interface of the hardware abstraction layer, the current noise floor value of the distance sensor at runtime sent by the coprocessor is obtained by the preset driving interface of the hardware abstraction layer, and the preset on-off threshold is calibrated according to the current noise floor value, the unobstructed noise floor value and the obstructed noise floor value by the driving of the distance sensor based on the preset driving interface of the hardware abstraction layer; If the working state of the terminal is the calibration state, the current noise floor value of the distance sensor at runtime sent by the coprocessor is obtained by the preset driving interface of the hardware abstraction layer.

8. A distance sensor calibration apparatus of a terminal, characterized by comprising: The device includes: The reading module is configured to call the preset driving interface of the hardware abstraction layer to obtain the unobstructed noise floor value and the obstructed noise floor value of the distance sensor sent by the coprocessor, and the coprocessor is configured to control the operation of the distance sensor; The driving module is configured to call the preset driving interface of the hardware abstraction layer to obtain the current noise floor value of the distance sensor at runtime sent by the coprocessor; A calibration module is configured to control a driver of the distance sensor to calibrate an on-off threshold of the distance sensor according to the current noise floor value, the unobstructed noise floor value and the obstructed noise floor value based on a preset driving interface of the hardware abstraction layer.

9. A terminal device, comprising: The terminal comprises a memory and a processor; the memory stores an application program; and the processor is configured to run the application program in the memory to perform the operations in the distance sensor calibration method of any one of claims 1 to 7.

10. A storage medium, characterized by The storage medium stores a plurality of instructions adapted to be loaded by the processor to perform the steps in the distance sensor calibration method of any one of claims 1 to 7.

Citation Information

Patent Citations

  • Automatic calibration device and method of mobile terminal distance sensor

    CN106791209A

  • Parameter calibration method for range sensor and terminal

    CN107219515A