Reference updating method, proximity sensing device and electronic device
By dynamically updating the baseline value of the P-Sensor, the problem of misjudgment caused by environmental changes is solved, and the sensitivity consistency and detection accuracy of the sensor in different environments are achieved.
Patent Information
- Application Number
- CN202210785538.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-04
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2042-07-04
AI Technical Summary
In a complex and changing environment, the P-Sensor benchmark is easily affected by external factors, leading to misjudgment.
By dynamically updating the benchmark value, including obtaining the mean of the sampled values within the preset value range or updating the target benchmark value when a reverse anomaly occurs, the counting mechanism and the distance threshold are combined to determine whether the object is approaching or far away, thereby avoiding frequent updates and jitters.
Maintain consistent sensor sensitivity in different environments, reduce misjudgments, and improve detection accuracy and user experience.
Smart Images

Figure CN115166849B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of proximity sensing, and in particular to a reference updating method, a proximity sensing device, and an electronic device. Background Art
[0002] P-Sensors (Proximity Sensors) are widely used in various fields, primarily to detect the proximity of objects. Common devices using P-Sensors include mobile phones, laptops, automatic doors, helmets, and automatic air conditioners. Currently, P-Sensors typically use light-sensing ranging, detecting the proximity of objects by measuring changes in light intensity relative to a baseline.
[0003] However, in actual application scenarios, the environment in which the P-Sensor is located is complex and changeable. Therefore, the benchmark is easily affected by the external environment (for example, temperature fluctuations and environmental changes), resulting in deviations in the benchmark, which may cause the P-Sensor to misjudge. Summary of the Invention
[0004] The embodiments of the present application provide a reference update method, a proximity sensor device, and an electronic device, which help the sensor have the same sensitivity in different environments, thereby reducing the impact of the environment on the proximity sensor and further reducing misjudgments.
[0005] In a first aspect, an embodiment of the present application provides a baseline updating method, comprising:
[0006] Get the sample value;
[0007] When there is no preset benchmark value, obtain the target benchmark value;
[0008] When there is a preset reference value, the preset reference value is used as the target reference value. If the sample value is within the preset value range, the target reference value is updated;
[0009] In the embodiment of the present application, the preset value range is determined by the target reference value, and the preset value range includes a preset first value range and a preset second value range.
[0010] The embodiments of the present application help the sensor have the same sensitivity in different environments, thereby reducing the impact of the environment on the proximity sensor and further reducing misjudgments.
[0011] In one possible implementation, if the sample value is within a preset value range, updating the target reference value includes:
[0012] If the sample value is within the preset first value range, the mean of the sample value is obtained;
[0013] Updates the target reference value based on the mean of the sampled values.
[0014] The embodiments of the present application can reduce errors caused by fluctuations in sampling values.
[0015] In one possible implementation, updating the target reference value based on the mean of the sampled values includes:
[0016] Counting the total number of consecutive sampling values within a preset first value range;
[0017] If the total number is greater than or equal to the preset count threshold, the target reference value is updated based on the average of the consecutive sampled values.
[0018] In the embodiment of the present application, the counting mechanism can distinguish changes caused by the environment and the proximity of objects, prevent errors caused by frequent updates, and at the same time improve efficiency and enhance user experience.
[0019] In one possible implementation, the preset first value range is a range from the target reference value - the preset first update threshold to the target reference value + the preset first update threshold.
[0020] In one possible implementation, after the target reference value is updated, the total number of consecutive sampling values within a preset first value range is set to zero.
[0021] In an embodiment of the present application, while improving the accuracy of the proximity sensor's judgment results by dynamically updating the reference value, after updating the target reference value, the total number of consecutive sampling values within the preset first value range is promptly set to zero, thereby avoiding the previously counted counts affecting the update of subsequent reference values.
[0022] In one possible implementation, if the sample value is within a preset value range, updating the target reference value includes:
[0023] If the target reference value is abnormal when the sampling value is within the preset second value range, the target reference value is updated based on the sampling value.
[0024] In one possible implementation, the preset second value range is smaller than the range of the target reference value minus the preset second update threshold.
[0025] In one possible implementation, the preset second update threshold is greater than the preset first update threshold.
[0026] In one possible implementation, the method further includes:
[0027] If the sampling value is not within the preset value range, the detection result of the object proximity judgment is determined based on the sampling value.
[0028] In one possible implementation, if the sampled value is not within a preset value range, determining the detection result of the object proximity judgment based on the sampled value includes:
[0029] If the sampling value is greater than or equal to the target reference value + the preset first distance threshold, the detection result is determined to be that the object is approaching; or,
[0030] If the sampling value is less than or equal to the target reference value + the preset second distance threshold, and greater than the target reference value + the preset first update threshold, the detection result is determined to be that the object is far away; or,
[0031] If the sampling value is less than the target reference value + the preset first distance threshold and greater than the target reference value + the preset second distance threshold, the detection result of this sampling is kept consistent with the detection result of the previous sampling.
[0032] In the embodiment of the present application, jitter caused by frequent status updates can be avoided by keeping the detection result of the current sampling consistent with the detection result of the previous sampling.
[0033] In one possible implementation, continuous sampling is performed to obtain multiple sample values;
[0034] When the sampling value is stable, determining an initial reference value based on the multiple sampling values, wherein the sampling value is stable when the fluctuation of the sampling value is within a preset first fluctuation range;
[0035] An object approach judgment is performed based on an initial reference value. If the detection result is that the object is approaching, the initial reference value is determined as the target reference value. When the sampling value is unstable, continuous sampling is performed again to obtain multiple sampling values, wherein the unstable sampling value means that the fluctuation of the sampling value is not within the preset first fluctuation range.
[0036] The embodiments of the present application can improve the user experience by detecting the calibration target reference value in real time.
[0037] In one possible implementation, if the sampling value is greater than or equal to the initial reference value plus a preset third distance threshold, the detection result is determined to be that the object is approaching.
[0038] In an embodiment of the present application, when obtaining the target reference value, in order to simplify the reference update method, the preset third distance threshold can be the same as the preset first distance threshold. Of course, the preset third distance threshold can also be different from the preset first distance threshold. For example, when the preset third distance threshold is smaller than the preset first distance threshold, the range of the initial reference value + the preset third distance threshold is larger, and the target reference value can be determined more quickly, thereby quickly entering the dynamic update process of the target reference value, thereby improving the detection accuracy of the proximity sensor.
[0039] In one possible implementation, if the initial reference value is reversely abnormal when the sampling value is within a preset third value range, continuous sampling is performed again to obtain multiple sampling values, wherein the preset third value range is a range smaller than the initial reference value - the preset third update threshold.
[0040] In an embodiment of the present application, when obtaining the target reference value, in order to simplify the reference update method, the preset third update threshold can be the same as the preset second update threshold. Of course, the preset third update threshold can also be different from the preset second update threshold. For example, when the preset third update threshold is greater than the preset second update threshold, the range of the initial reference value-the preset third update threshold is smaller, and it will not be easily judged as an initial value reverse abnormality. The target reference value can be determined more quickly, thereby quickly entering the dynamic update process of the target reference value, thereby improving the detection accuracy of the proximity sensor.
[0041] In a second aspect, an embodiment of the present application provides a proximity sensing device, which is used to execute any one of the reference update methods provided in the first aspect.
[0042] In the embodiment of the present application, the proximity sensing device may include a processor, and the processor may execute any one of the benchmark update methods provided in the first aspect.
[0043] In a third aspect, an embodiment of the present application provides an electronic device, including: the proximity sensing device provided in the second aspect.
[0044] The benchmark updating method provided in the embodiment of the present application can dynamically adjust the benchmark as the external environment changes, which helps the proximity sensor device to have the same sensitivity in different environments, thereby reducing the impact of the environment on the sensor device and further reducing misjudgments. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 A schematic diagram of a method for calculating a reference value provided in an embodiment of the present application;
[0046] Figure 2 A schematic diagram of a distance determination method provided in an embodiment of the present application;
[0047] Figure 3 A flowchart of an embodiment of the benchmark update method provided by this application;
[0048] Figure 4 A flowchart of another embodiment of the benchmark update method provided by this application;
[0049] Figure 5 A schematic diagram of an embodiment of updating a target reference value provided by the present application;
[0050] Figure 6A schematic diagram of another embodiment of updating the target reference value provided by the present application;
[0051] Figure 7 A schematic diagram of an embodiment of the test result determination provided by this application;
[0052] Figure 8 This is a flow chart of another embodiment of the benchmark updating method provided by this application. DETAILED DESCRIPTION
[0053] The P-Sensor usually detects whether an object is approaching by the change in light intensity relative to a reference. Therefore, the P-Sensor will pre-set a reference value. Figure 1 The calculation method of the reference value is shown as an example. Figure 1 As shown, the P-Sensor collects ambient light and light source light, and calculates the ambient light intensity and light source light intensity, where the light source can be a light-emitting diode (LED) or a vertical-cavity surface-emitting laser (VCSEL). The ambient light intensity can be the light intensity calculated by the P-Sensor after the ambient light passes through the screen, and the light source light intensity is the light intensity calculated by the P-Sensor after the light source light is reflected by the screen. The screen can be a mobile phone screen or other light-transmitting cover. It can be understood that when the light source is turned off, the P-Sensor only collects ambient light, that is, the light intensity when the light source is turned off = the ambient light intensity; when the light source is turned on, the P-Sensor can collect ambient light and light source light, that is, the light intensity when the light source is turned on = the ambient light intensity + the light source light intensity. By calculating the difference between the light intensity when the light source is turned on and the light intensity when the light source is turned off, the light source light intensity value can be obtained, and this calculated light source light intensity value can be used as a reference value for proximity judgment.
[0054] Figure 2 The following example shows how the P-Sensor detects whether an object is approaching. Figure 2As shown in the figure, when the P-Sensor is activated for detection, the light source is on. At this point, when an object approaches, the P-Sensor collects both the light source and ambient light. Because the object is approaching, the light source light collected by the P-Sensor includes not only the light source light reflected from the screen (i.e., screen reflected light) but also the light source light reflected from the object (i.e., object reflected light). Therefore, the light source light intensity = screen reflected light intensity + object reflected light intensity. At this point, the difference between the light intensity with the light source on and off is calculated again. Since the light intensity remains unchanged when the light source is off, while the light intensity increases when the light source is on, the difference between the two increases, meaning it is greater than the baseline value, indicating an approaching object. Furthermore, as the object approaches, the intensity of the object's reflected light increases, causing the overall light source light intensity to increase. This also increases the difference between the light intensity with the light source on and off, indicating an approaching object.
[0055] It can be seen that when the P-Sensor is sampling, only when the reference value is accurate can the detection result of the P-Sensor be accurate. Usually, the above reference value is set in the factory environment. However, as the instrument is used, the screen may be damaged or dirty, or the current sampling environment may change, which will cause the value collected by the P-Sensor in the current environment to deviate significantly from the value collected in the factory environment. In other words, the reference value in the current environment is no longer applicable to the current environment. If you continue to use the factory-set reference value for distance judgment, for example, Figure 2 The method shown here uses a baseline value to determine distance after collecting the light intensity difference, which can lead to misjudgments. For example, the value sampled when the screen is greasy is greater than when it is clean. If the P-Sensor samples a value greater than the baseline value, it will mistakenly determine that an object is approaching, when the actual problem may be greasy stains rather than an object.
[0056] Based on the above problems, an embodiment of the present application proposes a baseline update method, which is applied to a proximity sensing device, and can update the baseline value based on the current environment, which helps the proximity sensing device to have the same sensitivity in different environments, thereby reducing the impact of the environment on the sensor and further reducing misjudgments.
[0057] Now combined Figure 3-Figure 7 The benchmark updating method provided in the embodiment of the present application is described.
[0058] like Figure 3 The figure shows a flow chart of an embodiment of the benchmark update method provided by the present application, which specifically includes the following steps:
[0059] Step 301, obtaining a sample value;
[0060] Specifically, the proximity sensor device can obtain a sample value by real-time sampling, wherein the sample value can be the difference between the light intensity when the light source is turned on and the light intensity when the light source is turned off. For example, the sample value can be obtained by Figure 2 The method shown in FIG. 1 is used to calculate the value of the preset reference value. Optionally, after sampling, it can be confirmed whether there is a preset reference value. Specifically, when the proximity sensor device performs detection, the preset reference value can be obtained. The preset reference value can be obtained through real-time sampling or can be pre-set.
[0061] Step 302: When there is no preset reference value, obtain a target reference value.
[0062] Specifically, the target reference value may be preset at the factory.
[0063] Step 303: When there is a preset reference value, the preset reference value is used as the target reference value.
[0064] After executing step 303 , it can be confirmed whether the sample value is within the preset value range. If it is within the preset value range, execute 304 . The method may further include: if it is not within the preset value range, execute 305 .
[0065] Step 304: If the sample value is within the preset value range, the target reference value is updated.
[0066] In step 304 , the preset value range may be determined by the target reference value, and the preset value range may include a preset first value range and a preset second value range.
[0067] Specifically, after the proximity sensor device collects a sample value, a determination may be made based on the sample value to determine whether the target reference value needs to be updated.
[0068] In a specific implementation, the sampled value can be compared with a preset value range to determine whether the target reference value needs to be updated. The preset value range can include a preset first value range and a preset second value range. The preset first value range can correspond to an update scenario under normal circumstances, and the preset second value range can correspond to an update scenario under abnormal circumstances where the target reference value is reversed.
[0069] In an optional embodiment, step 304 may further include:
[0070] Step 3041: if the sample value is within the preset first value range, obtain the mean of the sample value;
[0071] Updates the target reference value based on the mean of the sampled values.
[0072] The updating of the target reference value based on the mean of the sampled values may further include:
[0073] Counting the total number of consecutive sampling values within a preset first value range;
[0074] If the total number is greater than or equal to the preset count threshold, the target reference value is updated based on the average of the consecutive sampled values.
[0075] Specifically, if the sampling value is within the preset first value range, it means that the sampling value fluctuates within the normal range. At this time, continuous sampling can be performed, thereby obtaining the sampling values of multiple consecutive samples, and the target reference value can be updated based on the average of the sampling values of the multiple consecutive samples, wherein the sampling values of the multiple consecutive samples are all within the preset first value range. By calculating the average of the sampling values, the average can be made closer to the actual reference value in the current environment, thereby further improving the accuracy of the detection. Optionally, after updating the target reference value, the total number of consecutive sampling values within the preset first value range is reset to zero.
[0076] In an embodiment of the present application, while improving the accuracy of the proximity sensor's judgment results by dynamically updating the reference value, after updating the target reference value, the total number of consecutive sampling values within the preset first value range is promptly set to zero, thereby avoiding the previously counted counts affecting the update of subsequent reference values.
[0077] In an optional embodiment, step 304 may further include:
[0078] Step 3042: If the target reference value is abnormally reversed when the sampling value is within the preset second value range, the target reference value is updated based on the sampling value.
[0079] Specifically, if the sampling value is within the preset second value range, it means that the sampling value is in an abnormal range, thereby determining that the current target reference value is not suitable for the current environment. At this time, the target reference value can be updated according to the current sampling value.
[0080] Step 305: If the sampling value is not within the preset value range, a detection result of object proximity judgment is determined based on the sampling value.
[0081] Specifically, if the sampling value is not within the above-mentioned preset value range, for example, the sampling value is neither within the preset first value range nor within the preset second value range, the detection result of the object approach judgment can be determined based on the sampling value, wherein the detection result may include the object moving away and the object approaching.
[0082] In the embodiment of the present application, by updating the reference value during actual detection, the sensor can have the same sensitivity in different environments, thereby reducing the impact of the environment on the sensor and further reducing misjudgment. Figure 5 Another embodiment of the reference update method provided in this application is described exemplarily.
[0083] In step 3041, the preset first value range may be a range from the target reference value - the preset first update threshold to the target reference value + the preset first update threshold. Among them, the preset first update threshold may be a threshold for limiting the fluctuation range of the sampling value. In a specific implementation, assuming that the preset first update threshold is base_update_threshod, the preset first value range is base - base_update_threshod <= <Diff> <= base + base_update_threshod, where <Diff> is the sampling value and base is the target reference value.
[0084] When the sampling value is within the preset first value range, multiple sampling values may be continuously collected, and the target reference value may be updated according to the mean value of the multiple continuously sampled sampling values. Among them, the above-mentioned method of continuously collecting multiple sampling values may be performed by the proximity sensing device according to a preset sampling period, and the embodiments of this application do not make special limitations on this point. Taking the sampling period as T as an example, the proximity sensing device samples a sampling value every period T. If any sampling value is within the preset first value range, the collection of the next sampling value will continue and continuous sampling will be performed. Among them, when continuously collecting sampling values within the preset first value range, after each sampling value is collected, the cumulative count may be performed. When the cumulative count value reaches the preset count threshold, the target reference value may be updated based on the mean value of the continuous sampling values.
[0085] Figure 5 It is a schematic diagram for updating the target reference value based on the sampling values within the normal fluctuation range. As Figure 5 shown, assuming that the preset count threshold is 4, the proximity sensing device obtains 4 sampling values, namely Diff1, Diff2, Diff3, and Diff4, within 4 consecutive periods T, and all these 4 sampling values are within the preset first value range. Since the cumulative count value of the continuous sampling has reached the preset count threshold, at this time, the mean value of the sampling values may be calculated. For example, the mean value of the sampling values = (Diff1 + Diff2 + Diff3 + Diff4) / 4. By updating the target reference value by taking the average of the sampling values accumulated a certain number of times, the changes caused by the environment and the approach of the object can be distinguished, and the errors caused by frequent updates can be avoided.
[0086] Next, in combination with Figure 6An exemplary illustration is given for another embodiment of the reference update method provided in this application. In step 3042, the preset second value range can be a range less than the target reference value minus the preset second update threshold. Among them, the preset second update threshold can be a threshold representing the abnormal range. In specific implementation, assuming the preset second update threshold is base_reverse_threshod, the preset second value range is Diff < base - base_reverse_threshod.
[0087] When the sampled value is within the preset second value range, the target reference value can be updated according to the current sampled value. Figure 6 It is a schematic diagram for updating the target reference value based on the sampled value within the abnormal range. As Figure 6 shown, the proximity sensing device collects the sampled value Diff. Since the sampled value Diff < base - base_reverse_threshod, at this time, the sampled value Diff can be updated as the target reference value, thereby repairing the incorrect reference and avoiding the trouble of factory calibration.
[0088] As an embodiment of this application, the preset second update threshold is greater than the preset first update threshold.
[0089] Next, in combination with Figure 7 An exemplary illustration is given for another embodiment of the reference update method provided in this application. In step 305, when Diff > base + base_update_threshod, it can be considered that the sampled value is not within the preset value range. At this time, the detection result can be determined according to the sampled value.
[0090] In specific implementation, the specific manner of determining the detection result according to the sampled value can be:
[0091] If the sampled value is greater than or equal to the target reference value plus the preset first distance threshold, it is determined that the detection result is that the object is approaching. Among them, the preset first distance threshold can be a threshold for determining that the object is relatively close to the proximity sensing device. Assuming the preset first distance threshold is near_threshold, when Diff >= base + near_threshold, it is determined that the detection result is that the object is approaching, or it can be considered that the object is at a relatively close distance to the proximity sensing device.
[0092] If the sampled value is less than or equal to the target reference value plus the preset second distance threshold and greater than the target reference value plus the preset first update threshold, it is determined that the detection result is that the object is moving away. Assuming that the preset second distance threshold is far_threshold, when base + base_update_threshod < Diff <= base + far_threshold, it is determined that the detection result is that the object is moving away, or it can be considered that the object is at a relatively far distance from the proximity sensing device.
[0093] If the sampled value is less than the target reference value plus the preset first distance threshold and greater than the target reference value plus the preset second distance threshold, the detection result of this sampling is kept the same as that of the previous sampling. Exemplarily, if the previous sampled value is determined that the object is approaching, keeping the detection result of this sampling the same as that of the previous sampling specifically means: the detection result of this sampling is that the object is approaching; if the previous sampled value is determined that the object is moving away, keeping the detection result of this sampling the same as that of the previous sampling specifically means: the detection result of this sampling is that the object is moving away. By setting a buffer zone between the preset first distance threshold and the preset second distance threshold and keeping the detection result of this sampling the same as that of the previous sampling, the frequent jitter of the detection result can be avoided.
[0094] Figure 7 It is a schematic diagram for distance judgment based on sampled values not within the preset value range. As Figure 7 shown, if the proximity sensing device samples a sampled value Diff1, since base + base_update_threshod < Diff1 < base + far_threshold, at this time it can be determined that the detection result is that the object is moving away. If the proximity sensing device samples a sampled value Diff3, since base + near_threshold < Diff3, at this time it can be determined that the detection result is that the object is approaching. If the proximity sensing device first samples a sampled value Diff1 and then samples a sampled value Diff2, since base + far_threshold < Diff2 < base + near_threshold, at this time it can be determined that the detection result is that the object is moving away; if the proximity sensing device first samples a sampled value Diff3 and then samples a sampled value Diff2, since base + far_threshold < Diff2 < base + near_threshold, at this time it can be determined that the detection result is that the object is approaching.
[0095] Figure 8 It is a schematic flowchart of another embodiment of the reference update method provided by this application. In Figure 8In the embodiment shown, if the proximity sensor device is not set with a target reference value when it leaves the factory, the target reference value can be obtained through real-time sampling. The above step 302 specifically includes the following steps:
[0096] Step 3021: Continuously sample to obtain multiple sampling values.
[0097] Specifically, the proximity sensor device can continuously perform sampling, thereby obtaining a plurality of continuous sampling values. The continuous sampling can be performed according to a preset sampling period, which is not particularly limited in the embodiment of the present application.
[0098] Step 3022: When the sampling value is stable, an initial reference value is determined based on the multiple sampling values, wherein the sampling value is stable when the fluctuation of the sampling value is within a preset first fluctuation range.
[0099] Specifically, in the process of continuously sampling and obtaining sample values by the proximity sensing device, it is possible to determine whether the sample values are stable. In a specific implementation, the above-mentioned method for determining the stability of the sample values can be: whether the multiple sample values obtained by continuous sampling all fluctuate within a certain range, wherein the above-mentioned certain range can be a preset first fluctuation range. If the multiple sample values obtained by continuous sampling all fluctuate within a certain range, then the initial reference value can be determined based on the multiple sample values obtained by continuous sampling. For example, the first sample value can be used as the initial reference value, or the last sample value can be used as the initial reference value, or any sample value can be used as the reference value, or the average of multiple sample values can be used as the initial reference value. The embodiment of the present application does not specifically limit this. If the multiple sample values obtained by continuous sampling do not all fluctuate within a certain range, continuous sampling can be performed again. When the sample value is unstable, step 3021 is re-executed, that is, continuous sampling is performed to obtain multiple sample values, wherein the unstable sample value means that the fluctuation of the sample value is not within the preset first fluctuation range.
[0100] In step 3023, an object proximity test is performed based on the initial reference value. If the detection result indicates that the object is approaching, the initial reference value is determined as the target reference value. Specifically, after determining the initial reference value, object proximity test can be performed based on the initial reference value. For example, the object can be brought close to the proximity sensor device, and the accuracy of the initial reference value can be determined based on the detection result. When the object approaches, the proximity sensor device performs a detection. If the detection result indicates that the object is approaching, the initial reference value is determined as the target reference value. Because the initial reference value has been continuously sampled, it has adapted to the current environment and is not subject to significant deviations due to environmental changes. Therefore, if an object is determined to be approaching, the sampled value at this time differs significantly from the initial reference value. This significant difference is not due to a misjudgment, and the initial reference value can be considered accurate. If the sampled value falls within an abnormal range during the detection process, steps 3021 and 3022 are repeated until the target reference value is obtained.
[0101] Optionally, in step 3023, if the sampling value is greater than or equal to the initial reference value + a preset third distance threshold, the detection result is determined to be that the object is approaching.
[0102] In an embodiment of the present application, when obtaining the target reference value, in order to simplify the reference update method, the preset third distance threshold can be the same as the preset first distance threshold. Of course, the preset third distance threshold can also be different from the preset first distance threshold. For example, when the preset third distance threshold is smaller than the preset first distance threshold, the range of the initial reference value + the preset third distance threshold is larger, and the target reference value can be determined more quickly, thereby quickly entering the dynamic update process of the target reference value, thereby improving the detection accuracy of the proximity sensor.
[0103] Optionally, if the initial reference value is reversely abnormal when the sampling value is within a preset third value range, continuous sampling is performed again to obtain multiple sampling values, wherein the preset third value range is a range smaller than the initial reference value - the preset third update threshold.
[0104] In an embodiment of the present application, when obtaining the target reference value, in order to simplify the reference update method, the preset third update threshold can be the same as the preset second update threshold. Of course, the preset third update threshold can also be different from the preset second update threshold. For example, when the preset third update threshold is greater than the preset second update threshold, the range of the initial reference value-the preset third update threshold is smaller, and it will not be easily judged as an initial value reverse abnormality. The target reference value can be determined more quickly, thereby quickly entering the dynamic update process of the target reference value, thereby improving the detection accuracy of the proximity sensor.
[0105] The benchmark updating method provided in the embodiment of the present application can dynamically adjust the benchmark as the external environment changes, which helps the proximity sensor device to have the same sensitivity in different environments, thereby reducing the impact of the environment on the sensor device and further reducing misjudgments.
[0106] The embodiments of the present application further provide a proximity sensing device for executing the above-mentioned baseline updating method. Optionally, the proximity sensing device may include a processor, and the processor may execute the above-mentioned baseline updating method.
[0107] Another embodiment of the present application further provides an electronic device including the aforementioned proximity sensing device.
Claims
1. A benchmark updating method, characterized in that: The method comprises: Get the sample value; When there is no preset benchmark value, obtain the target benchmark value; When there is a preset reference value, the preset reference value is used as the target reference value; If the sampled value is within a preset value range, updating the target reference value; If the sample value is within a preset value range, updating the target reference value includes: If the sampled value is within a preset first value range, obtaining an average of the sampled values; and updating the target reference value based on the average of the sampled values; If the target reference value is abnormal when the sampling value is within the preset second value range, updating the target reference value based on the sampling value; Among them, the preset first value range is the range of the target reference value - the preset first update threshold to the target reference value + the preset first update threshold, the preset second value range is the range less than the target reference value - the preset second update threshold, and the preset second update threshold is greater than the preset first update threshold.
2. The method according to claim 1, characterized in that Updating the target reference value based on the mean of the sampled values includes: Counting the total number of consecutive sampling values within the preset first value range; If the total number is greater than or equal to a preset counting threshold, the target reference value is updated based on an average of the consecutive sampling values.
3. The method according to claim 1 or 2, characterized in that After the target reference value is updated, the total number of consecutive sampling values within the preset first value range is set to zero.
4. The method according to claim 1, wherein The method further comprises: If the sampling value is not within the preset value range, a detection result of object proximity judgment is determined based on the sampling value.
5. The method according to claim 4, characterized in that If the sampling value is not within the preset value range, determining the detection result of the object approach judgment based on the sampling value includes: If the sampling value is greater than or equal to the target reference value + the preset first distance threshold, the detection result is determined to be that the object is approaching; or, If the sampling value is less than or equal to the target reference value + the preset second distance threshold, and greater than the target reference value + the preset first update threshold, then the detection result is determined to be that the object is far away; or, If the sampling value is less than the target reference value + the preset first distance threshold and greater than the target reference value + the preset second distance threshold, the detection result of the current sampling is kept consistent with the detection result of the previous sampling; The preset first distance threshold is greater than the preset second distance threshold, and the preset second distance threshold is greater than the preset first update threshold.
6. The method according to claim 1, characterized in that The obtaining of the target reference value comprises: Continuous sampling to obtain multiple sampling values; When the sampling value is stable, determining an initial reference value based on the multiple sampling values, wherein the sampling value is stable when the fluctuation of the sampling value is within a preset first fluctuation range; performing a detection of object approach based on the initial reference value, and if the detection result indicates that the object is approaching, determining the initial reference value as the target reference value; When the sampling value is unstable, continuous sampling is performed again to obtain multiple sampling values, wherein the sampling value is unstable when the fluctuation of the sampling value is not within the preset first fluctuation range.
7. The method according to claim 6, characterized in that If the sampling value is greater than or equal to the initial reference value+the preset third distance threshold, the detection result is determined to be that the object is approaching.
8. The method according to claim 6, characterized in that If the initial reference value is reversely abnormal when the sampling value is within a preset third value range, continuous sampling is performed again to obtain multiple sampling values, wherein the preset third value range is a range smaller than the initial reference value minus a preset third update threshold.
9. A proximity sensing device, characterized in that: The proximity sensing device is used to execute the reference updating method according to any one of claims 1-8. 10 . An electronic device comprising the proximity sensing device according to claim 9 .
Citation Information
Patent Citations
Control method of air volume self-adjusting range hood and air volume self-adjusting range hood
CN107741041A