Key trigger determination method, terminal and medium based on infrared distance sensor
By processing the light inlet of infrared distance sensors and dynamically judging the key triggering status, the problems of restricted material selection and environmental calibration requirements in the prior art are solved, and the flexibility of reliable key triggering and material selection in different environments is achieved.
Patent Information
- Application Number
- CN202210722410.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-24
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2042-06-24
AI Technical Summary
The existing touch button technology has limited material selection in products with high explosion-proof grade requirements, and keys based on infrared distance sensors need to be calibrated in different environments, and products with diverse usage environments cannot be used directly.
By using the amount of light inlet obtained by the infrared distance sensor as the original data, a sequence of processing is performed to dynamically determine whether the key is triggered, reducing the light transmittance requirement in the key area, and no recalibration is required in different usage environments.
It realizes reliable triggering of keys in different environments, reduces the requirements for light transmittance in key areas, avoids the need for distance correction, and is suitable for products with diversified use environments.
Smart Images

Figure CN115149937B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of touch buttons, and in particular to a button trigger determination method, a terminal and a medium based on an infrared distance sensor. Background Art
[0002] Touch buttons are the most common input devices in electronic equipment products. For commonly used capacitive sensing buttons, the panel must be made of non-conductive materials. The panel strength is relatively low, which cannot meet the requirements of products with high explosion-proof levels. At the same time, the limited choice of appearance materials also leads to the limitation of product appearance quality. Pressure-sensitive buttons trigger buttons by detecting slight surface deformation. This type of button panel can be made of conductive or non-conductive materials, which can improve the appearance texture. However, since the surface needs to deform, the material selection cannot be extremely hard, and the button area must be made very thin, which cannot meet the requirements of products with high explosion-proof levels. Touch buttons based on infrared distance sensors have no requirements for panel materials, but the infrared distance sensor itself has requirements for the use environment. The button area has high requirements for light transmittance, and calibration is required in different environments before use. It cannot be directly used for products with diverse use environments. Summary of the invention
[0003] To solve the above problems, the present invention provides a key trigger determination method based on an infrared distance sensor. The method utilizes the principle of the infrared distance sensor and uses the amount of light input obtained by the infrared distance sensor as raw data. By continuously detecting the amount of light input by the infrared distance sensor, a sequence of processing is performed on the amount of light input. The method dynamically determines whether a key is triggered based on the usage environment data, thereby reducing the requirements for the light transmittance of the key area and does not require recalibration in different usage environments.
[0004] One of the technical solutions of the present invention is achieved through the following technical solutions:
[0005] A key trigger determination method based on an infrared distance sensor is applied to a mobile terminal, wherein the mobile terminal includes at least one key and at least one infrared distance sensor corresponding to the key, and the method includes the following steps:
[0006] Step 1, presetting the initial values of the reference data and trigger data of the infrared distance sensor; and setting the reference boundary range, trigger boundary range, light filter range, press ratio value α and release ratio β, and 0<α<1, 0<β<1, α>β;
[0007] Step 2: Determine whether the current benchmark data exceeds the benchmark boundary range. If so, limit the current benchmark data, otherwise retain the current benchmark data; and perform weighted calculation on the current benchmark data and the historical benchmark data set to obtain the current valid benchmark data;
[0008] Step 3: determine whether the current trigger data exceeds the trigger boundary range. If so, limit the current trigger data, otherwise keep the current trigger data; and perform weighted calculation on the current trigger data and the historical trigger data set to obtain the current valid trigger data;
[0009] Step 4: Calculate the relative factor based on the current valid benchmark data and the valid trigger data;
[0010] Step 5, calculating the key press trigger condition and the key release trigger condition according to the current valid benchmark data, the press ratio value α, the release ratio value β and the relative factor;
[0011] Step 6: collecting light input data of the infrared distance sensor in real time;
[0012] Step 7, determine whether the current light input amount data exceeds the light input filtering range, if so, filter the current light input amount data, discard the current light input amount data, and return to step 6 to continue collecting; otherwise, retain the current light input amount data; and perform weighted calculation on the current light input amount data and the historical light input amount data set to obtain the current effective light input amount data;
[0013] Step 8, compare the current effective light input data with the button press trigger condition and the button release trigger condition. When the current effective light input data is greater than the button press trigger condition, the result is a button trigger, and the current effective light input data is output as the input of the next trigger data, and enter step 3; when the current effective light input data is less than the button release trigger condition, the result is that the button is not triggered, and the current effective light input data is output as the input of the next benchmark data, and enter step 2; the current effective light input data of other conditions is discarded, and the original benchmark data and trigger data are retained as the next input, and enter step 2;
[0014] Step 9: Process the key logic according to the key trigger result and output the state of the key being pressed or released.
[0015] Furthermore, in step 1, initial values of the reference data and trigger data of the infrared distance sensor are preset, specifically including:
[0016] Presetting the initial value of the reference data of the infrared distance sensor, the initial value of the reference data is selected by collecting the values read by the infrared distance sensors of a plurality of product prototypes when the keys are not pressed, and calculating the average value as the initial value of the reference data;
[0017] The initial value of the trigger data of the infrared distance sensor is preset, and the initial value of the trigger data is selected by collecting the values read by the infrared distance sensors of a plurality of product prototypes when a button is pressed, and calculating the average value as the initial value of the trigger data.
[0018] Furthermore, the limiting processing in step 2 and step 3 is specifically as follows:
[0019] The current benchmark data exceeding the benchmark boundary range is limited to the boundary value of the benchmark boundary range closest to its value. If the current benchmark data is greater than the upper boundary of the benchmark boundary range, the current benchmark data is limited to the value set by the upper boundary. If the current benchmark data is less than the lower boundary of the benchmark boundary range, the current benchmark data is limited to the value set by the lower boundary.
[0020] Or the current trigger data that exceeds the trigger boundary range is limited to the boundary value of the trigger boundary range that is closest to its value. If the current trigger data is greater than the upper boundary of the trigger boundary range, the current trigger data is limited to the value set by the upper boundary. If the current trigger data is less than the lower boundary of the trigger boundary range, the current trigger data is limited to the value set by the lower boundary.
[0021] Furthermore, the calculation formula of the relative factor in step 4 is: relative factor=(current valid trigger data-current valid reference data) / current valid reference data.
[0022] Furthermore, the calculation formulas for the key press trigger condition and the key release trigger condition in step 5 are respectively:
[0023] Key press trigger condition = current valid benchmark data + current valid benchmark data × relative factor × press ratio;
[0024] Key release trigger condition = current valid reference data + current valid reference data × relative factor × release ratio.
[0025] Furthermore, the historical benchmark data set in step 3 is the historical benchmark data set collected by the infrared distance sensor before the past time T1, the historical trigger data set in step 4 is the historical trigger data set collected by the infrared distance sensor before the past time T2, and the historical light input data set in step 7 is the historical light input data set collected by the infrared distance sensor before the past time T3; the values of T1, T2 and T3 are set by the user.
[0026] Furthermore, in step 6, the light input data of the infrared distance sensor is collected in real time, and the data is updated at a time T4, and the value of T4 is set by the user.
[0027] Furthermore, the step 9 specifically includes:
[0028] If the last key trigger result is key not triggered, and the current key trigger result is key triggered, then the output is key pressed; if the last key trigger result is key triggered, and the current key trigger result is key not triggered, then the output is key released; if the last key trigger result is key not triggered, and the current key trigger result is key not triggered, then the output is key not pressed; if the last key trigger result is key triggered, and the current key trigger result is key triggered, then the output is key pressed; in the case of key pressed, if the duration of the key trigger is less than time T5, it is judged as a short press, if the duration of the key trigger is not less than time T5, it is judged as a long press, and the value of T5 is set by the user.
[0029] The second technical solution of the present invention is achieved through the following technical solution:
[0030] A mobile terminal comprises: a memory, a processor, an infrared distance sensor, a button, and a button trigger determination program based on the infrared distance sensor stored in the memory and executable on the processor, wherein the button trigger determination program based on the infrared distance sensor implements the steps of the above-mentioned button trigger determination method based on the infrared distance sensor when executed by the processor.
[0031] The third technical solution of the present invention is achieved through the following technical solution:
[0032] A computer-readable storage medium stores a key trigger determination program based on an infrared distance sensor. When the key trigger determination program based on the infrared distance sensor is executed by the processor, the steps of the key trigger determination method based on the infrared distance sensor are implemented.
[0033] The beneficial effects of the present invention are:
[0034] 1. The present invention only needs to collect the amount of light entering the infrared distance sensor, and does not need to obtain accurate distance data of the infrared distance sensor. Therefore, the requirements for the light transmittance of the key area are relatively low, and the material selection of the key area has a wider range of use;
[0035] 2. The present invention directly processes the raw data of the amount of light entering the infrared distance sensor, so it is not necessary to perform distance calibration on the infrared distance sensor before leaving the factory, thus saving production costs;
[0036] 3. The present invention collects infrared data in real time, performs a sequence of processing on the collected data, and dynamically and adaptively adjusts the key triggering conditions in real time according to the characteristics of the data, thereby being able to meet the needs of products with diverse usage environments. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 It is a flow chart of a key trigger determination method based on an infrared distance sensor provided by an embodiment of the present invention.
[0039] Figure 2 It is a structural schematic diagram of a mobile terminal provided by an embodiment of the present invention.
[0040] Figure 3 It is a structural schematic diagram of a computer-readable storage medium provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the invention claimed for protection, but merely represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0042] Reference Figure 1 As shown, an embodiment of the present invention provides a key trigger determination method based on an infrared distance sensor, which is applied to a mobile terminal, wherein the mobile terminal includes at least one key and at least one infrared distance sensor corresponding to the key, and the method includes the following steps:
[0043] Step 1, presetting the initial values of the reference data and trigger data of the infrared distance sensor; and setting the reference boundary range, trigger boundary range, light filter range, press ratio value α and release ratio β, and 0<α<1, 0<β<1, α>β; through parameter setting, it is convenient for later data processing, and these parameters are used as the basis for calculation and judgment of data in later steps;
[0044] In this embodiment, the initial value presetting of the reference data and the trigger data of the infrared distance sensor specifically includes:
[0045] The initial value of the reference data of the infrared distance sensor is preset. The initial value of the reference data is selected by collecting the values read by the infrared distance sensors of multiple product prototypes (50 in this case) when the button is not pressed, and calculating the average value as the initial value of the reference data; using the average value as the initial value can ensure the accuracy of the initial value and be closer to the real data;
[0046] The trigger data of the infrared distance sensor is preset with an initial value. The initial value of the trigger data is selected by collecting the values read by the infrared distance sensors of multiple product prototypes (50 in this case) when a button is pressed, and calculating the average value as the initial value of the trigger data; using the average value as the initial value can ensure the accuracy of the initial value and be closer to the real data;
[0047] The selection of the reference boundary range, trigger boundary range and light filter range needs to be based on the product structure. Data statistics are collected for multiple product prototypes (50 in this case) in various usage environments (outdoors, indoors, during the day, at night, with liquid on the button surface, etc.) to obtain the maximum perception range of the infrared distance sensor.
[0048] Step 2: Determine whether the current benchmark data exceeds the benchmark boundary range. If so, limit the current benchmark data, otherwise keep the current benchmark data; and perform weighted calculation on the current benchmark data and the historical benchmark data set to obtain the current valid benchmark data. The main purpose of weighted calculation is to make the sample better reflect the overall characteristics;
[0049] The weighted calculation formula is as follows: f i is the weight factor. The larger the weight of the new data, the faster the update response. In this case, fi=1(i<k / 2),f i=2(i> = k / 2), update the current real-time benchmark data;
[0050] In this embodiment, the current benchmark data that exceeds the benchmark boundary range is limited to the boundary value of the benchmark boundary range that is closest to its value. If the current benchmark data is greater than the upper boundary of the benchmark boundary range, the current benchmark data is limited to the value set by the upper boundary. If the current benchmark data is less than the lower boundary of the benchmark boundary range, the current benchmark data is limited to the value set by the lower boundary. The purpose of this is to improve the stability of the system, avoid the algorithm running to uncontrollable values, and reduce interference from unreasonable external factors.
[0051] Step 3: Determine whether the current trigger data exceeds the trigger boundary range. If so, limit the current trigger data, otherwise keep the current trigger data; and perform weighted calculation on the current trigger data and the historical trigger data set to obtain the current valid trigger data; the main purpose of weighted calculation is to make the sample better reflect the overall characteristics;
[0052] The weighted calculation formula is as follows: f i is the weight factor. The larger the weight of the new data, the faster the update response. In this case, f1=1(i=1), f i =f i-1 +0.2(i>1), update the current real-time trigger data;
[0053] In this embodiment, the current trigger data that exceeds the trigger boundary range is limited to the boundary value of the trigger boundary range that is closest to its value. If the current trigger data is greater than the upper boundary of the trigger boundary range, the current trigger data is limited to the value set by the upper boundary. If the current trigger data is less than the lower boundary of the trigger boundary range, the current trigger data is limited to the value set by the lower boundary. The purpose of this is to improve the stability of the system, avoid the algorithm running to uncontrollable values, and reduce interference from unreasonable external factors.
[0054] Step 4: Calculate the relative factor based on the current valid benchmark data and the valid trigger data;
[0055] In this embodiment, the calculation formula of the relative factor is: relative factor = (current effective trigger data - current effective reference data) / current effective reference data, that is, Wherein, n represents the relative factor, L represents the current valid trigger data, and M represents the current valid reference data.
[0056] Step 5, calculating the key press trigger condition and the key release trigger condition according to the current valid benchmark data, the press ratio value α, the release ratio value β and the relative factor;
[0057] In this embodiment, the calculation formulas for the key press trigger condition and the key release trigger condition are respectively:
[0058] The key press trigger condition = current valid reference data + current valid reference data × relative factor × press ratio, that is, Q1 = M + M × n × α, Q1 represents the key press trigger condition;
[0059] Key release trigger condition = current valid reference data + current valid reference data × relative factor × release ratio, that is, Q2 = M + M × n × β, Q2 represents the key release trigger condition;
[0060] Since α>β, Q1>Q2.
[0061] Step 6: real-time acquisition of the light input data of the infrared distance sensor. Since the present invention only needs to acquire the light input data of the infrared distance sensor and does not need to acquire accurate distance data of the infrared distance sensor, the light transmittance requirement of the key area is relatively low, and the material selection of the key area has a wider range of use.
[0062] Step 7: Determine whether the current light input data exceeds the light input filtering range. If so, filter the current light input data, discard the current light input data, and return to step 6 to continue collecting; otherwise, retain the current light input data; the purpose of this is to improve the stability of the system, prevent the algorithm from running to uncontrollable values, and reduce interference from unreasonable external factors. Perform weighted calculation on the current light input data and the historical light input data set to obtain the current effective light input data; the main purpose of weighted calculation is to make the sample better reflect the overall characteristics;
[0063] The weighted calculation formula is as follows: f i is the weight factor. The larger the weight of the new data, the faster the update response. In this case, fi=1(i<k / 2),f i=2(i> = k / 2), update the current real-time light input data;
[0064] Step 8, compare the current effective light input data with the button pressing trigger condition and the button releasing trigger condition. When the current effective light input data is greater than the button pressing trigger condition, that is, N>Q1, N represents the current effective light input data, and the result is button triggering. Output the current effective light input data as the input of the next trigger data, and enter step 3; when the current effective light input data is less than the button releasing trigger condition, that is, N<Q2, the result is that the button is not triggered, output the current effective light input data as the input of the next benchmark data, and enter step 2; the current effective light input data of other conditions is discarded, and the original benchmark data and trigger data are retained as the next input, and enter step 2; in this way, the current button trigger status (pressed or released) can be obtained, and the current effective light input data can be output as the input of the next benchmark data and trigger data, which ensures the accuracy of the data and the stability of the system;
[0065] Step 9: Process the key logic according to the key trigger result and output the state of the key being pressed or released;
[0066] In this embodiment, step 9 specifically includes:
[0067] If the last key trigger result is key not triggered, and the current key trigger result is key triggered, then the key pressed is output; if the last key trigger result is key triggered, and the current key trigger result is key not triggered, then the key released is output; if the last key trigger result is key not triggered, and the current key trigger result is key not triggered, then the key not pressed is output; if the last key trigger result is key triggered, and the current key trigger result is key triggered, then the key pressed is output; in the case of key pressed, the duration of key pressed is calculated by a timer, if the duration of key triggered is less than time T5, it is judged as a short press, if the duration of key triggered is not less than time T5, it is judged as a long press, and the value of T5 is set by the user; the real-time key status of the key (long press, short press or release) can be obtained.
[0068] In this embodiment, the historical benchmark data set in step 3 is the historical benchmark data set collected by the infrared distance sensor before the past time T1, the historical trigger data set in step 4 is the historical trigger data set collected by the infrared distance sensor before the past time T2, and the historical light input data set in step 7 is the historical light input data set collected by the infrared distance sensor before the past time T3; in step 6, the light input data of the infrared distance sensor is collected in real time, and the data update time is T4; the values of T1, T2, T3 and T4 are set by the user; the range of T1, T2, T3 and T4 is 10-500ms.
[0069] A specific embodiment is:
[0070] Step S1, presetting the initial value of the reference data of the infrared distance sensor to 50, the initial value of the trigger data of the infrared distance sensor to 80, the reference boundary range to 20-100, the trigger boundary range to 50-150, the light filter range to 40-120, the pressing ratio α to 0.8, and the releasing ratio β to 0.3;
[0071] Step S2, taking the initial value 50 of the benchmark data as the current benchmark data. The present invention directly processes the raw data of the amount of light entering the infrared distance sensor, so it is not necessary to perform distance calibration on the infrared distance sensor before leaving the factory, saving production costs; comparing the current benchmark data with the benchmark boundary range, judging that the initial value 50 of the benchmark data is within the benchmark boundary range, no limiting processing is performed, and the current benchmark data is retained; and performing weighted calculation on the current benchmark data and the historical benchmark data set collected 100ms (in this embodiment, T1=100ms, the longer the time, the slower the key response) before to obtain 50. Since it is the first calculation and there is no historical benchmark data set, the first current benchmark data is used as the historical benchmark data set for calculation;
[0072] Step S3, taking the initial value 80 of the trigger data as the current trigger data. The present invention directly processes the raw data of the amount of light entering the infrared distance sensor, so it is not necessary to perform distance calibration on the infrared distance sensor before leaving the factory, saving production costs; comparing the current trigger data with the trigger boundary range, and judging that the initial value 80 of the current trigger data is within the trigger boundary range, no limiting processing is performed, and the current trigger data is retained; and performing weighted calculation on the current trigger data and the historical trigger data set collected 100ms (in this embodiment, T2=100ms, the longer the time, the slower the key response) before to obtain 80. Since it is the first calculation and there is no historical trigger data set, the first current trigger data is used as the historical trigger data set for calculation;
[0073] Step S4, calculating a relative factor based on current valid reference data and valid trigger data;
[0074]
[0075] Step S5, calculating the key pressing trigger condition and the key releasing trigger condition according to the current valid reference data, the pressing ratio value α, the releasing ratio value β and the relative factor;
[0076] Q1=M+M×n×α=50+50×0.6×0.8=74
[0077] Q2=M+M×n×β=50+50×0.6×0.3=59
[0078] Step S6, real-time acquisition of the light input data of the infrared distance sensor, the current light input data collected is 20; the data update time is 100ms (in this embodiment, T4=100ms, the longer the time, the slower the key response); real-time acquisition of infrared data, a sequence of processing of the collected data, real-time adaptive dynamic adjustment of the key triggering conditions according to the data characteristics, so as to meet the needs of products with diverse usage environments;
[0079] Step S7, compare the current light intake data with the light intake filtering range, and determine that the current light intake data exceeds the light intake filtering range, then filter the current light intake data, discard the current light intake data, and return to step 6 to continue collecting; collect the next current light intake data of 55, compare the current light intake data with the light intake filtering range, and determine that the current light intake data 55 is within the light intake filtering range, then do not filter, and retain the current light intake data 55; and perform weighted calculation on the current light intake data and the historical light intake data set collected 100ms (in this embodiment, T3=100ms, the longer the time, the slower the key response) before, and obtain the current effective light intake data of 55; since there is no historical light intake data set at this time, the first current light intake data is used as the historical light intake data set for calculation;
[0080] Step S8, compare the current effective light input amount data 55 with the button press trigger condition 74 and the button release trigger bar 59, determine that the current effective light input amount data 55 is less than the button release trigger condition 59, and the result is that the button is not triggered, output the current effective light input amount data 55 as the input of the next benchmark data (data when the button is not triggered), that is, the current benchmark data has completed an update, and enter step 2 to continue processing. At this time, the current trigger data has not been updated, so the original trigger data is retained for further processing;
[0081] Step S9, compare the current benchmark data 55 with the benchmark boundary range 50-150, and determine that the current benchmark data 55 is within the benchmark boundary range, then do not perform limiting processing, and retain the current benchmark data; and perform weighted calculation on the current benchmark data and the historical benchmark data set collected 100ms (in this embodiment, T1=100ms, the longer the time, the slower the key response) before. At this time, there is a historical trigger data set, and the first benchmark data 50 is used as the historical benchmark data set, and weighted calculation is performed to obtain the effective benchmark data 52; at this time, the current effective trigger data has not been updated, so the last current effective trigger data 80 is retained to perform steps S3-S8. The result is n=0.54, Q1=74.46, Q2=60.42. The current light input data is collected again as 85, which is within the light input range. The effective light input data 75 is obtained by weighted calculation with the historical light input data set 55. It is judged that the effective light input data 75> the key press trigger condition 74.46. The key is judged to be triggered this time, and the current effective light input data 75 is output as the input of the next trigger data (the data when the key is triggered). That is, the current trigger data has completed an update, and enters step 3 to continue processing. At this time, the current benchmark data has not been updated, so the original benchmark data is retained for further processing; this is repeated to calculate the result of each key trigger;
[0082] Step S10, calculate that the last key trigger result is that the key is not triggered, and the key trigger result this time is that the key is triggered. At this time, the state of the key is that the key is pressed, and the timer starts timing. When the time exceeds 300ms (T5=300ms), the key long press state is output, and when it does not exceed 300ms, the key short press state is output; the data is collected and changed in real time, so the key trigger result each time will be different. It is more intuitive to judge the current key state by the last and this key trigger results.
[0083] like Figure 2 As shown, a mobile terminal of the present invention comprises: a memory, a processor, an infrared distance sensor, a button, and a button trigger determination program based on an infrared distance sensor stored in the memory and executable on the processor, wherein the button trigger determination program based on the infrared distance sensor implements the steps of the above-mentioned button trigger determination method based on the infrared distance sensor when executed by the processor.
[0084] like Figure 3 As shown, a computer-readable storage medium of the present invention stores a key trigger determination program based on an infrared distance sensor, and when the key trigger determination program based on the infrared distance sensor is executed by the processor, the steps of the key trigger determination method based on the infrared distance sensor are implemented.
[0085] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A key trigger determination method based on an infrared distance sensor, applied to a mobile terminal, characterized in that: The mobile terminal includes at least one button and at least one infrared distance sensor corresponding to the button, and the method includes the following steps: Step 1: preset the initial values of the reference data and trigger data of the infrared distance sensor; and set the reference boundary range, trigger boundary range, light filter range, and proportional value. and release ratio ,and , , ; Step 2: determine whether the current benchmark data exceeds the benchmark boundary range. If so, limit the current benchmark data; otherwise, retain the current benchmark data; The current benchmark data and the historical benchmark data set are weighted and calculated to obtain the current effective benchmark data; Step 3: determine whether the current trigger data exceeds the trigger boundary range. If so, limit the current trigger data, otherwise keep the current trigger data; The current trigger data and the historical trigger data set are weighted and calculated to obtain the current effective trigger data; Step 4: Calculate the relative factor based on the current valid benchmark data and the valid trigger data; Step 5: Press the proportional value according to the current valid benchmark data , Release ratio value And relative factors to calculate the key press trigger condition and key release trigger condition; Step 6: collecting light input data of the infrared distance sensor in real time; Step 7, determine whether the current light input amount data exceeds the light input filtering range, if so, filter the current light input amount data, discard the current light input amount data, and return to step 6 to continue collecting; otherwise, retain the current light input amount data; and perform weighted calculation on the current light input amount data and the historical light input amount data set to obtain the current effective light input amount data; Step 8, compare the current effective light input data with the button press trigger condition and the button release trigger condition. When the current effective light input data is greater than the button press trigger condition, the result is a button trigger, and the current effective light input data is output as the input of the next trigger data, and enter step 3; when the current effective light input data is less than the button release trigger condition, the result is that the button is not triggered, and the current effective light input data is output as the input of the next benchmark data, and enter step 2; the current effective light input data of other conditions is discarded, and the original benchmark data and trigger data are retained as the next input, and enter step 2; Step 9: Process the key logic according to the key trigger result and output the state of the key being pressed or released.
2. A key trigger determination method based on an infrared distance sensor according to claim 1, characterized in that: In step 1, initial values of the reference data and trigger data of the infrared distance sensor are preset, which specifically includes: Presetting the initial value of the reference data of the infrared distance sensor, the initial value of the reference data is selected by collecting the values read by the infrared distance sensors of a plurality of product prototypes when the keys are not pressed, and calculating the average value as the initial value of the reference data; The initial value of the trigger data of the infrared distance sensor is preset, and the initial value of the trigger data is selected by collecting the values read by the infrared distance sensors of a plurality of product prototypes when a button is pressed, and calculating the average value as the initial value of the trigger data.
3. The key trigger determination method based on infrared distance sensor according to claim 1, characterized in that: The specific limiting processing in step 2 and step 3 is as follows: The current benchmark data exceeding the benchmark boundary range is limited to the boundary value of the benchmark boundary range closest to its value. If the current benchmark data is greater than the upper boundary of the benchmark boundary range, the current benchmark data is limited to the value set by the upper boundary. If the current benchmark data is less than the lower boundary of the benchmark boundary range, the current benchmark data is limited to the value set by the lower boundary. Or the current trigger data that exceeds the trigger boundary range is limited to the boundary value of the trigger boundary range that is closest to its value. If the current trigger data is greater than the upper boundary of the trigger boundary range, the current trigger data is limited to the value set by the upper boundary. If the current trigger data is less than the lower boundary of the trigger boundary range, the current trigger data is limited to the value set by the lower boundary.
4. The key trigger determination method based on infrared distance sensor according to claim 1, characterized in that: The calculation formula of the relative factor in step 4 is: relative factor=(current effective trigger data-current effective reference data) / current effective reference data.
5. The method for determining key triggering based on an infrared distance sensor according to claim 1, characterized in that: The calculation formulas for the key press trigger condition and the key release trigger condition in step 5 are: Key press trigger condition = current valid benchmark data + current valid benchmark data × relative factor × press ratio; Key release trigger condition = current valid benchmark data + current valid benchmark data × relative factor × release ratio.
6. The method for determining key triggering based on an infrared distance sensor according to claim 1, characterized in that: The historical benchmark data set in step 3 is the historical benchmark data set collected by the infrared distance sensor before the past time T1, the historical trigger data set in step 4 is the historical trigger data set collected by the infrared distance sensor before the past time T2, and the historical light input data set in step 7 is the historical light input data set collected by the infrared distance sensor before the past time T3; the values of T1, T2 and T3 are set by the user.
7. The key trigger determination method based on infrared distance sensor according to claim 1, characterized in that: In the step 6, the light input data of the infrared distance sensor is collected in real time, and the data is updated at a time T4, and the value of T4 is set by the user.
8. The key trigger determination method based on infrared distance sensor according to claim 1, characterized in that: The step 9 specifically includes: If the last key trigger result is key not triggered, and the current key trigger result is key triggered, then the output is key pressed; if the last key trigger result is key triggered, and the current key trigger result is key not triggered, then the output is key released; if the last key trigger result is key not triggered, and the current key trigger result is key not triggered, then the output is key not pressed; if the last key trigger result is key triggered, and the current key trigger result is key triggered, then the output is key pressed; in the case of key pressed, if the duration of the key trigger is less than time T5, it is judged as a short press, if the duration of the key trigger is not less than time T5, it is judged as a long press, and the value of T5 is set by the user.
9. A mobile terminal, characterized in that: The mobile terminal includes: a memory, a processor, an infrared distance sensor, a button, and a button trigger determination program based on an infrared distance sensor stored in the memory and executable on the processor. When the button trigger determination program based on the infrared distance sensor is executed by the processor, the steps of the button trigger determination method based on the infrared distance sensor as described in any one of claims 1 to 8 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a key trigger determination program based on an infrared distance sensor, and when the key trigger determination program based on an infrared distance sensor is executed by a processor, the steps of the key trigger determination method based on an infrared distance sensor as described in any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Key trigger method and apparatus
CN105549734A
Detector of an elevator automatic door opening and closing control system
KR1019980040004A