Touch button detection methods, devices, equipment and media
By setting a touch channel for each touch button, sampling and judging the analog quantities of pressed and unpressed buttons, and combining environmental noise thresholds and trigger thresholds, the problem of false triggering caused by liquid dripping in capacitive touch technology in home appliances is solved, and accurate button response is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-29
- Publication Date
- 2026-03-10
AI Technical Summary
Existing capacitive touch technology is susceptible to liquid leakage in home appliances, leading to false triggering and making it difficult to accurately distinguish between valid touches and false touches.
By setting a touch channel for each touch button, sampling the analog signals of pressed and unpressed buttons, determining whether a trigger is needed based on preset conditions, and combining the environmental noise threshold and trigger threshold, updating the target environmental noise threshold and trigger threshold when the terminal is powered on to adapt to the current environment.
This effectively avoids accidental touches caused by liquid dripping, ensures accurate button response, and improves the accuracy and reliability of touch button detection.
Smart Images

Figure CN116184055B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of touch keys, in particular to a touch key detection method, device, equipment and medium. BACKGROUND
[0002] At present, the application of touch keys and touch technology is very mature and common. The long service life, good sealing design (waterproof and dustproof) and other advantages make it widely used in various electronic products, such as mobile phones, tablets, induction cookers, coffee machines, etc. According to the classification of touch application technology, the current mainstream is: capacitive touch, resistive touch, infrared touch, etc.
[0003] Capacitive touch and resistive touch mainly use the change of capacitance or resistance value in the touch sensing area when touched, and the logic circuit (frequency generating circuit, etc.) inside the chip to form a sampling recognition circuit to effectively recognize and judge the touch. Infrared touch mainly uses the reflection of infrared emission signals in a certain distance to obstacles to recognize and judge. Because the sensitivity of resistive touch is poor, and the distance of infrared touch is not easy to control and is easy to trigger, the most widely used is capacitive touch technology.
[0004] However, there are too many factors that cause capacitance changes, and the change range is too large, and the application scene is too complex. How to distinguish which is effective touch and which is false touch has always been a difficult problem. Especially in the application of household appliances, such as induction cookers, blenders and other household appliances, when encountering liquid dripping on the key area, false triggering often occurs, and normal operation cannot be responded. SUMMARY
[0005] Therefore, it is necessary to provide a touch key detection method, device, equipment and medium to avoid false touch for the above problems.
[0006] A touch key detection method, characterized by being applied to a terminal provided with a plurality of touch keys, one touch key corresponding to one touch channel, the method comprising:
[0007] When at least one touch key is detected to be pressed, the touch channel corresponding to the pressed key is sampled to obtain a first analog quantity, and the pressed key is the key pressed in the plurality of touch keys;
[0008] If it is determined according to the first analog quantity that the pressed key meets the first preset condition of being triggered, the touch channel corresponding to the unpressed key is sampled to obtain a second analog quantity, and the unpressed key is the key not pressed in the plurality of touch keys;
[0009] If it is determined according to the second analog quantity that the non-pressed key meets the second preset condition of not being triggered, the pressed key is responded to.
[0010] In one of the embodiments, the method further comprises:
[0011] If it is determined according to the first analog quantity that the pressed key does not meet the first preset condition of being triggered, or according to the second analog quantity that the non-pressed key does not meet the second preset condition of not being triggered, the response of the pressed key to the key is stopped.
[0012] In one of the embodiments, the method further comprises:
[0013] The target environmental noise threshold and the target trigger threshold corresponding to the pressed key are obtained, the target environmental noise threshold corresponding to the pressed key is a reference value for measuring whether the pressed key is disturbed by the environment, and the target trigger threshold corresponding to the pressed key is a predetermined analog quantity change threshold for measuring whether the pressed key is triggered;
[0014] If the first analog quantity is greater than the sum of the target trigger threshold corresponding to the pressed key and the target environmental noise threshold, it is determined that the pressed key meets the first preset condition of being triggered.
[0015] If the first analog quantity is less than or equal to the sum of the target trigger threshold corresponding to the pressed key and the target environmental noise threshold, it is determined that the pressed key does not meet the first preset condition of being triggered.
[0016] In one of the embodiments, the method further comprises:
[0017] The target environmental noise threshold and the target trigger threshold corresponding to the non-pressed key are obtained, the target environmental noise threshold corresponding to the non-pressed key is a predetermined reference value for measuring whether the non-pressed key is disturbed, and the target trigger threshold corresponding to the non-pressed key is a predetermined analog quantity change threshold for measuring whether the non-pressed key is triggered.
[0018] The difference between the second analog quantity corresponding to the non-pressed key and the target environmental noise threshold corresponding to the non-pressed key is taken as a first difference, and if the ratio of the first difference to the target trigger threshold is less than a first preset ratio, it is determined that the non-pressed key meets the second preset condition of not being triggered.
[0019] If the ratio of the first difference to the target trigger threshold is greater than or equal to the first preset ratio, it is determined that the non-pressed key does not meet the second preset condition of not being triggered.
[0020] In one of the embodiments, the method further comprises:
[0021] updating the target ambient noise threshold and the target trigger threshold of each touch key when the terminal is powered on.
[0022] In one of the embodiments, the updating the target ambient noise threshold and the target trigger threshold of each touch key comprises:
[0023] obtaining an initial ambient noise threshold and an initial trigger threshold of a target touch channel; wherein the target touch channel is any one of the plurality of touch channels;
[0024] performing a cyclic sampling operation on the target touch channel to obtain a first preset number of analog quantities, wherein the cyclic sampling operation comprises sampling the target touch channel at every preset time interval, and taking a mean value of the first preset number of analog quantities as a first analog quantity mean value;
[0025] if the first analog quantity mean value meets a third preset condition, determining the target ambient noise threshold of the target touch channel according to the first analog quantity mean value; the third preset condition is a condition for updating the initial ambient noise;
[0026] performing a second preset number of cyclic sampling operations on the target touch channel to obtain a second preset number of analog quantity mean values, taking a mean value of the second preset number of analog quantity mean values as a second analog quantity mean value, and determining the target trigger threshold of the target touch channel according to the second analog quantity mean value.
[0027] In one of the embodiments, the obtaining an initial ambient noise threshold and an initial trigger threshold of a target touch channel comprises:
[0028] sampling the target touch channel, and taking a sampled analog quantity as the initial ambient noise threshold of the target touch channel;
[0029] obtaining a second preset ratio and a maximum analog quantity of the target touch channel, calculating a product of the maximum analog quantity and the second preset ratio, and taking the product as the initial trigger threshold.
[0030] In one of the embodiments, the method further comprises:
[0031] taking the target ambient noise threshold of the target touch channel determined after the terminal is powered on last time as the initial ambient noise threshold of the target touch channel when the terminal is powered on;
[0032] taking the target trigger threshold of the target touch channel determined after the terminal is powered on last time as the initial trigger threshold of the target touch channel when the terminal is powered on.
[0033] In one of the embodiments, the third preset condition is that the first analog quantity mean is less than the sum of the initial ambient noise threshold and the initial trigger threshold, and the difference between the first analog quantity means of any two touch channels is less than a preset difference threshold.
[0034] The target ambient noise threshold of the target touch channel is determined according to the first analog quantity mean, including:
[0035] The first analog quantity mean is taken as the target ambient noise threshold of the target touch channel.
[0036] In one of the embodiments, the target trigger threshold of the target touch channel is determined according to the second analog quantity mean, including:
[0037] The difference between the second analog quantity mean and the target ambient noise threshold is calculated to obtain a second difference, and the sum of the second difference and the initial trigger threshold is taken as the target trigger threshold.
[0038] A touch key detection device applied to a terminal provided with a plurality of touch keys, one touch key corresponding to one touch channel, the device including:
[0039] A first judgment module, configured to, when detecting that at least one touch key is pressed, sample the touch channel corresponding to the pressed key to obtain a first analog quantity, the pressed key being the pressed key; if it is determined according to the first analog quantity that the pressed key meets a first preset condition of being triggered, sample the touch channel corresponding to the unpressed key to obtain a second analog quantity, the unpressed key being the unpressed key;
[0040] A second judgment module, configured to, if it is determined according to the second analog quantity that the unpressed key meets a second preset condition of not being triggered, perform a key response on the pressed key.
[0041] A computer readable storage medium storing a computer program, the computer program being executed by a processor to make the processor execute the steps of any one of the above touch key detection methods.
[0042] A terminal device including a memory, a processor and a touch key, the memory storing a computer program, the computer program being executed by the processor to make the processor execute the steps of any one of the above touch key detection methods.
[0043] The application provides a touch key detection method, device, equipment and medium. When at least one touch key is detected to be pressed, a touch channel corresponding to the pressed key is sampled to obtain a first analog quantity. If the pressed key is determined to meet a first preset condition of being triggered according to the first analog quantity, it can be determined that the pressed key meets the triggering condition. The touch channel corresponding to the unpressed key is continuously sampled to obtain a second analog quantity. If the unpressed key is determined to meet a second preset condition of not being triggered according to the second analog quantity, it can be determined that the unpressed key does not meet the triggering condition. If liquid drops on the key area, multiple keys may be triggered, and the mis-touch condition occurs. By combining the two conditions, that is, using multiple keys as auxiliary reference, it can be determined that only the pressed key is triggered, which can avoid the terminal mis-triggering condition caused by liquid leakage, and can realize correct key response of the pressed key. BRIEF DESCRIPTION OF DRAWINGS
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description only constitute some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor.
[0045] In the formula, the first analog quantity is the first analog quantity of the touch channel corresponding to the pressed key, the second analog quantity is the second analog quantity of the touch channel corresponding to the unpressed key, the first preset condition is the first preset condition of being triggered, and the second preset condition is the second preset condition of not being triggered.
[0046] Figure 1 It is a flowchart for updating the target environment noise threshold and the target triggering threshold of each touch key in an embodiment.
[0047] Figure 2 It is a circuit schematic diagram of a touch key in an embodiment.
[0048] Figure 3 It is a flowchart for touch key detection in an embodiment.
[0049] Figure 4 It is a structural schematic diagram of a touch key detection device in an embodiment.
[0050] Figure 5 It is a structural block diagram of a terminal device in an embodiment. DETAILED DESCRIPTION
[0051] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments only constitute some embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the present application.
[0052] The touch button detection method in this application is applied to a terminal with multiple touch buttons. For example, the terminal may be a mobile phone, tablet, induction cooker, coffee machine, etc. The touch buttons are used to perform specific functions when triggered; for example, for an induction cooker, multiple touch buttons can perform functions such as "stir-frying," "boiling water," and "hot pot" when triggered. Each touch button corresponds to a specific touch channel. Figure 2 As shown, touch channels 1-4 are set for touch buttons Touch1-Touch4 (T1-T4). The analog quantities sampled in the touch channels will change due to the touch button being pressed or external interference, such as liquid residue on the corresponding touch button.
[0053] In this application, the determination of whether a terminal is accidentally touched is based on multiple predefined target ambient noise thresholds and target trigger thresholds for touch buttons. The target ambient noise threshold is a baseline value used to measure whether the touch buttons are affected by environmental interference. The target trigger threshold is a pre-determined threshold for analog quantity changes used to measure whether a touch button is triggered.
[0054] To ensure the timeliness of the data, this application updates the target ambient noise threshold and target trigger threshold for each touch button every time the terminal is powered on (i.e., when the terminal is powered on).
[0055] In one specific embodiment, such as Figure 1 As shown, update the target ambient noise threshold and target trigger threshold for each touch button, including:
[0056] Step 102: Obtain the initial ambient noise threshold of the target touch channel, and determine the initial trigger threshold of the target touch channel based on the initial ambient noise threshold.
[0057] The target touch channel can be any one of multiple touch channels. For example... Figure 2 As shown, this refers to any one of touch channels 1-4. Therefore, it can be understood that in this embodiment, all touch channels can use the same method to determine their corresponding target ambient noise threshold and target trigger threshold.
[0058] In one specific embodiment, after the terminal is powered on, firstly, touch channels 1-4 are sampled respectively. The sampled analog signals are filtered and used as initial environmental noise thresholds. These initial environmental noise thresholds can serve as a reference value for initially judging whether the touch buttons are interfered with. For example, according to actual testing, the initial environmental noise thresholds obtained for touch channels 1-4 correspond to: T1_V = 24; T2_V = 22; T3_V = 21; T4_V = 23 respectively. Secondly, a second preset ratio is obtained, and the maximum analog signal of touch channels 1-4 is obtained respectively. The product of the maximum analog signal and the second preset ratio is calculated, and this product is the initial trigger threshold. For example, the second preset ratio is set to 2 / 3. Of course, the second preset ratio can also be adjusted according to the structure and type of the device, etc., and is not specifically limited here. The maximum analog signal is the actual sampling range of the analog signal of the target touch channel. The maximum analog signal of different touch channels varies and can be obtained through pre-determination. For example, if the maximum analog signal of touch channel 1 is 90, then the corresponding product value Tr1_v is 60. Similarly, based on actual testing, the initial trigger thresholds for other touch channels 2-4 are: Tr2_v = 62; Tr3_v = 61; Tr4_v = 65. In this example, the initial environmental noise threshold and initial trigger threshold are re-determined through sampling each time the terminal is powered on. This avoids deviations in touch button detection caused by changes in the external environment.
[0059] In another specific embodiment, it is not necessary to re-determine the initial ambient noise threshold and initial trigger threshold through sampling. Specifically, the terminal saves the set target ambient noise threshold and target trigger threshold to a storage medium or the cloud before each power-off. Then, when the terminal powers on again, it can directly read the storage medium or download the corresponding data from the cloud, and use the target ambient noise threshold of the target touch channel determined after the terminal's last power-on as the initial ambient noise threshold of the target touch channel at the current power-on; similarly, the target trigger threshold of the target touch channel determined after the terminal's last power-on can be used as the initial trigger threshold of the target touch channel at the current power-on. Since the target ambient noise threshold and target trigger threshold determined after the last power-on are relatively close to the final target ambient noise threshold and target trigger threshold determined this time, by directly associating the two sets of data, the time required to update the target ambient noise threshold and target trigger threshold of each touch button can be reduced, improving efficiency.
[0060] Step 104: Perform a cyclic sampling operation on the target touch channel to obtain the analog quantity of the first preset number of times, and take the average of the analog quantity of the first preset number of times as the first analog quantity mean. Determine whether the first analog quantity mean meets the third preset condition. If the first analog quantity mean meets the third preset condition, proceed to step 106 to determine the target environmental noise threshold of the target touch channel based on the first analog quantity mean.
[0061] The cyclic sampling operation includes sampling the target touch channel at preset time intervals, obtaining a first preset number of analog values. The third preset condition is the condition for updating the initial ambient noise. If the third preset condition is met, it indicates that the set initial ambient noise threshold has a certain error, and step 106 is executed to eliminate the error. If the third preset condition is not met, it indicates that the set initial ambient noise threshold has no error, and the initial ambient noise threshold is directly used as the target ambient noise threshold.
[0062] In one specific embodiment, a cyclic sampling operation is set as follows: the target touch channel is sampled once every 5ms, and the value is taken ten times consecutively. Of course, the sampling frequency and the number of samples in the cyclic sampling operation can be adjusted accordingly, and no specific limitation is made here. The average of the ten values is then calculated to obtain the first analog mean.
[0063] In one specific embodiment, the third preset condition is set as follows: the average value of the first analog quantity is less than the sum of the initial ambient noise threshold and the initial trigger threshold, and the difference between the average values of the first analog quantities of any two touch channels is less than a preset difference threshold. When both conditions are met simultaneously, it indicates that each touch button is not interfered with by external factors. For example, the difference threshold is set to 15. According to actual testing, the average values of the first analog quantities sampled by touch channels 1-4 correspond to: T1_t = 26; T2_t = 21; T3_t = 24; T4_t = 25, respectively. By comparing the average value of the first analog quantity with the sum of the initial ambient noise threshold and the initial trigger threshold of the corresponding channel, we can obtain:
[0064] (T1_t=26)<<(T1 V +Tr1 v =84); (T2_t=21)<<(T2_V+Tr2_v=84);
[0065] (T3_t=24)<<(T3 V +Tr3 v =82); (T4_t=25)<<(T4 V +Tr4 v =88);
[0066] Meanwhile, the difference between the average values of the first analog quantities of any two touch channels is less than 15. Therefore, it is determined that the third preset condition is met. At this time, the average value of the first analog quantity can be directly used as the target ambient noise threshold of the target touch channel. Therefore, the target ambient noise thresholds for touch channels 1-4 are respectively: T1_V1 = 26; T2_V1 = 21; T3_V1 = 24; T4_V1 = 25.
[0067] Since the initial environmental noise threshold set in step 102 is only data obtained from a single sampling, it is not representative. Through the cyclic sampling operation in this step, the error in the initial environmental noise threshold can be corrected.
[0068] Step 108: Perform a second preset number of cyclic sampling operations on the target touch channel to obtain the average value of the analog quantity for the second preset number of sampling operations. Use the average value of the analog quantity for the second preset number of sampling operations as the second average value of the analog quantity, and determine the target trigger threshold of the target touch channel based on the second average value of the analog quantity.
[0069] For example, the second preset number of times is set to 10. Similar to step 104, the average of the analog signals is first taken, and this process is repeated 10 times. Then, the average of these 10 analog signal averages is taken to obtain the second average analog signal. According to actual testing, the second average analog signal values sampled from touch channels 1-4 correspond to: T1_t1 = 23; T2_t1 = 22; T3_t1 = 22; T4_t1 = 22, respectively.
[0070] In one specific embodiment, the average value of the second analog signal is compared with the target ambient noise threshold. This comparison serves as the basis for adjusting the sensitivity of the touch button to adapt to the current environment, and the initial trigger threshold is adjusted accordingly to obtain the target trigger threshold. Specifically, the difference between the average value of the second analog signal and the target ambient noise threshold is calculated to obtain the second difference. The sum of the second difference and the initial trigger threshold is used as the target trigger threshold. For example, for touch channel 1, the second difference T1_t1 - T1_V1 = -3, then the target trigger threshold Tr1_v1 = Tr1_v + (T1_t1 - T1_V1) = 57. Similarly, the target trigger thresholds for other touch channels 2-4 correspond to:
[0071] Tr2_v1=Tr2_v+(T2_t1-T2_V1)=63;
[0072] Tr3_v1=Tr3_v+(T3_t1-T3_V1)=59;
[0073] Tr4_v1=Tr4_v+(T4_t1-T4_V1)=62;
[0074] Similarly, since the initial trigger threshold set in step 102 is only based on a single sample of data, it is not representative. Through multiple cyclic sampling operations in this step, the error in the initial trigger threshold can be reasonably corrected based on the adjustment amount of the target environmental noise threshold.
[0075] Using the above method, the target environmental noise threshold and the target trigger threshold can be updated in real time each time the terminal is powered on, so that the terminal can adapt to the current environmental interference and provide a reliable data basis for the terminal to determine whether it has been accidentally touched.
[0076] like Figure 3 As shown, Figure 3 This is a flowchart illustrating a touch button detection method in one embodiment. The steps provided by the touch button detection method in this embodiment include:
[0077] Step 302: When at least one touch button is detected to be pressed, the touch channel corresponding to the pressed button is sampled to obtain the first analog signal.
[0078] In this context, a pressed button is the one among multiple touch buttons that is actually pressed. Each touch channel has a corresponding touch element, which can be an electrode, spring, pad, or other similar device capable of touch detection. When the microcontroller unit (MCU) detects a change in the capacitance of at least one touch element, it determines that a touch button has been pressed, samples the touch channel corresponding to the pressed button, and obtains a first analog quantity. For example, when button T1 is detected to be pressed, touch channel 1 is sampled, and after filtering by the circuit, the measured first analog quantity is T1_t2 = 108.
[0079] Step 304: Determine whether the pressed button meets the first preset condition for triggering based on the first analog signal. If the first analog signal determines that the pressed button meets the first preset condition for triggering, then proceed to step 306: Sample the touch channel corresponding to the unpressed button to obtain the second analog signal.
[0080] Among these, the unpressed buttons are those that have not been pressed among the multiple touch buttons, which are the opposite of the pressed buttons. Therefore, for example, the unpressed buttons are T2-T4.
[0081] In one specific embodiment, the step of determining whether a pressed button meets the first preset condition for triggering includes: firstly, obtaining the target ambient noise threshold and the target trigger threshold corresponding to the pressed button. The target ambient noise threshold corresponding to the pressed button is a benchmark value used to measure whether the pressed button is affected by environmental interference, and the target trigger threshold corresponding to the pressed button is a pre-determined analog quantity change threshold used to measure whether the pressed button is triggered. For example, for touch button T1, the obtained target ambient noise threshold T1_V1 is 26, and the obtained target ambient noise threshold Tr1_v1 is 57.
[0082] Secondly, it is determined whether the first analog quantity is greater than the sum of the target trigger threshold and the target ambient noise threshold corresponding to the pressed button. If the first analog quantity is greater than the sum of the target trigger threshold and the target ambient noise threshold corresponding to the pressed button, it is determined that the pressed button meets the first preset condition for being triggered; if the first analog quantity is less than or equal to the sum of the target trigger threshold and the target ambient noise threshold corresponding to the pressed button, it is determined that the pressed button does not meet the first preset condition for being triggered. In this embodiment, since T1_t2>(T1_V1+Tr1_v1)=83, it is determined that the pressed button meets the first preset condition for being triggered. At this time, the valid flag of the touch button T1 is marked as T1_flag=1, indicating that the current T1 button may be triggered normally. In this example, the determination of whether the pressed button meets the first preset condition for being triggered is based on the sum of the target ambient noise threshold and the target trigger threshold. This comprehensively considers the influence of the current external environmental factors and the current user's pressing factors on whether the button is triggered, making the determination of whether the button is triggered more accurate.
[0083] In another specific embodiment, an analog quantity range can be preset. If the first analog quantity is greater than the maximum value of the analog quantity range, it indicates that the corresponding button has been triggered, and the pressed button is determined to meet the first preset condition for triggering. For example, the analog quantity range is set to 40-100. Since the first analog quantity 108 > 100, it is determined that the pressed button meets the first preset condition for triggering. This embodiment provides another rule for determining whether a button is triggered, with relatively simpler processing logic and a correspondingly faster touch button detection process.
[0084] Based on this, the touch channels 2-4 corresponding to the unpressed buttons T2-T4 are sampled. For example, after circuit filtering, the sampled second analog quantities correspond to: T2_t2 = 31; T3_t2 = 26; T4_t2 = 28.
[0085] Step 308: Determine whether the unpressed button meets the second preset condition of not being triggered based on the second analog signal. If the second analog signal determines that the unpressed button meets the second preset condition of not being triggered, then proceed to step 310 to respond to the pressed button.
[0086] In one specific embodiment, the step of determining whether an unpressed button meets the second preset condition of not being triggered includes: first, obtaining the target ambient noise threshold and the target trigger threshold corresponding to the unpressed button. The target ambient noise threshold corresponding to the unpressed button is a pre-determined benchmark value used to measure whether the unpressed button is interfered with, and the target trigger threshold corresponding to the unpressed button is a pre-determined analog quantity change threshold used to measure whether the unpressed button is triggered. For example, for unpressed buttons T2-T4, the obtained target ambient noise thresholds are respectively: T2_V1 = 21; T3_V1 = 24; T4_V1 = 25, and the obtained target trigger thresholds are respectively: Tr2_v1 = 63; Tr3_v1 = 59; Tr4_v1 = 62.
[0087] Secondly, the difference between the second analog quantity corresponding to the unpressed button and the target ambient noise threshold corresponding to the unpressed button is taken as the first difference. If the ratio of the first difference to the target trigger threshold is less than the first preset ratio, it is determined that the unpressed button meets the second preset condition of not being triggered; if the ratio of the first difference to the target trigger threshold is greater than or equal to the first preset ratio, it is determined that the unpressed button does not meet the second preset condition of not being triggered. For example, the first preset ratio is set to 1 / 2. Of course, this first preset ratio can also be adjusted according to the structure and type of the device, etc., and is not specifically limited here. For the unpressed button T2, the first difference is T2_t2-T2_V1. At this time, (T2_t2-T2_V1)Tr2_v1<1 / 2, so it can be determined that the unpressed button T2 meets the second preset condition of not being triggered. Similarly, since (T3_t2-T3_V1)Tr3_v1<1 / 2; (T4_t2-T4_V1)Tr4_v1<1 / 2, it can be determined that other unpressed buttons T3 and T4 also meet the second preset condition of not being triggered. At this time, T1_flag = 1 is maintained, indicating that the current T1 button is normally triggered, and the driver terminal responds to the action corresponding to the T1 button. In this embodiment, the sum of the target ambient noise threshold and the target trigger threshold is also used to determine whether the unpressed button meets the first preset condition of not being triggered. In addition to detecting the pressed button, the detection of whether other unpressed buttons are triggered is also performed simultaneously. If liquid drips into the button area, it may cause multiple buttons to be triggered, resulting in accidental touches. This embodiment effectively avoids this situation by simultaneously detecting other unpressed buttons.
[0088] In another specific embodiment, an analog quantity range can be preset. If the second analog quantity is less than the minimum value of this range, it indicates that the corresponding button has not been triggered, thus confirming that the unpressed button meets the second preset condition of not being triggered. For example, if the analog quantity range is set to 40-100, since the second analog quantities (T2_t2, T3_t2, T4_t2=) are all less than 40, T1_flag=1 is maintained, driving the terminal to respond to the action corresponding to button T1. Relatively speaking, the processing logic of this embodiment is simpler, and the touch button detection process is correspondingly faster.
[0089] Furthermore, if it is determined from the first analog quantity that pressing the button does not meet the first preset condition for being triggered, or if it is determined from the second analog quantity that not pressing the button does not meet the second preset condition for not being triggered, then step 312 is executed to stop responding to the pressed button.
[0090] In the touch button detection method described in the above embodiments, when at least one touch button is detected to be pressed, the touch channel corresponding to the pressed button is sampled to obtain a first analog signal. If the pressed button meets the first preset condition for being triggered based on the first analog signal, then the pressed button can be determined to meet the trigger condition. The touch channel corresponding to the unpressed button is then sampled to obtain a second analog signal. If the unpressed button meets the second preset condition for not being triggered based on the second analog signal, then the unpressed button does not meet the trigger condition. If liquid drips onto the button area, it may cause multiple buttons to be triggered, resulting in accidental touches. By combining these two conditions, i.e., using multiple buttons together as an auxiliary reference, it can be determined that only the pressed button is triggered. This avoids accidental triggering of the terminal due to liquid leakage and ensures that the pressed button performs the correct button response.
[0091] In one embodiment, such as Figure 4 As shown, a touch button detection device is proposed for use in a terminal with multiple touch buttons, where each touch button corresponds to a touch channel. The device includes:
[0092] The first judgment module 402 is used to sample the touch channel corresponding to the pressed button to obtain a first analog quantity when at least one touch button is detected to be pressed, wherein the pressed button is the button that was pressed; if it is determined from the first analog quantity that the pressed button meets the first preset condition for being triggered, then the touch channel corresponding to the unpressed button is sampled to obtain a second analog quantity; wherein the unpressed button is the button that was not pressed.
[0093] The second judgment module 404 is used to respond to the pressed button if it is determined from the second analog quantity that the unpressed button meets the second preset condition of not being triggered.
[0094] In one implementation, the first judgment module 402 is further specifically used to: obtain the target ambient noise threshold and the target trigger threshold corresponding to the pressed button, wherein the target ambient noise threshold corresponding to the pressed button is a benchmark value used to measure whether the pressed button is affected by environmental interference, and the target trigger threshold corresponding to the pressed button is a predetermined analog quantity change threshold used to measure whether the pressed button is triggered; if the first analog quantity is greater than the sum of the target trigger threshold and the target ambient noise threshold corresponding to the pressed button, then it is determined that the pressed button meets the first preset condition for being triggered; if the first analog quantity is less than or equal to the sum of the target trigger threshold and the target ambient noise threshold corresponding to the pressed button, then it is determined that the pressed button does not meet the first preset condition for being triggered.
[0095] In one implementation, the second judgment module 404 is further specifically used to: obtain the target ambient noise threshold and the target trigger threshold corresponding to the unpressed button, wherein the target ambient noise threshold corresponding to the unpressed button is a predetermined benchmark value used to measure whether the unpressed button is interfered with, and the target trigger threshold corresponding to the unpressed button is a predetermined analog quantity change threshold used to measure whether the unpressed button is triggered; take the difference between the second analog quantity corresponding to the unpressed button and the target ambient noise threshold corresponding to the unpressed button as the first difference; if the ratio of the first difference to the target trigger threshold is less than the first preset ratio, then determine that the unpressed button meets the second preset condition of not being triggered; if the ratio of the first difference to the target trigger threshold is greater than or equal to the first preset ratio, then determine that the unpressed button does not meet the second preset condition of not being triggered.
[0096] In one implementation, the touch button detection device further includes an update module for updating the target ambient noise threshold and target trigger threshold for each touch button when the terminal is powered on.
[0097] In one implementation, the update module is further specifically used for: obtaining the initial ambient noise threshold of the target touch channel, and determining the initial trigger threshold of the target touch channel based on the initial ambient noise threshold; wherein the target touch channel is any one of multiple touch channels; performing a cyclic sampling operation on the target touch channel to obtain a first preset number of analog quantities, the cyclic sampling operation including sampling the target touch channel at preset time intervals, and taking the average of the first preset number of analog quantities as the first analog quantity average; if the first analog quantity average satisfies a third preset condition, then determining the target ambient noise threshold of the target touch channel based on the first analog quantity average; the third preset condition is the condition for updating the initial ambient noise; performing a second preset number of cyclic sampling operations on the target touch channel to obtain the second preset number of analog quantity averages, taking the average of the second preset number of analog quantity averages as the second analog quantity average, and determining the target trigger threshold of the target touch channel based on the second analog quantity average.
[0098] In one implementation, the update module is further specifically used for: sampling the target touch channel, using the sampled analog quantity as the initial environmental noise threshold of the target touch channel; obtaining a second preset ratio and the maximum analog quantity of the target touch channel, calculating the product of the maximum analog quantity and the second preset ratio, and using the product as the initial trigger threshold.
[0099] In one implementation, the update module is further specifically used to: use the target ambient noise threshold of the target touch channel determined after the terminal was last powered on as the initial ambient noise threshold of the target touch channel when the terminal is powered on; and use the target trigger threshold of the target touch channel determined after the terminal was last powered on as the initial trigger threshold of the target touch channel when the terminal is powered on.
[0100] In one implementation, the update module is also specifically used to: use the average value of the first analog quantity as the target ambient noise threshold for the target touch channel.
[0101] In one implementation, the update module is also specifically used to: calculate the difference between the mean of the second analog quantity and the target environmental noise threshold, obtain the second difference, and use the sum of the second difference and the initial trigger threshold as the target trigger threshold.
[0102] A computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to perform the following steps: when at least one touch button is detected to be pressed, sampling the touch channel corresponding to the pressed button to obtain a first analog signal, wherein the pressed button is one of a plurality of touch buttons; if the pressed button is determined to meet a first preset condition for being triggered based on the first analog signal, sampling the touch channel corresponding to an unpressed button to obtain a second analog signal, wherein the unpressed button is one of a plurality of touch buttons that has not been pressed; if the unpressed button is determined to meet a second preset condition for not being triggered based on the second analog signal, then performing a button response on the pressed button.
[0103] A terminal device includes a memory, a processor, and touch buttons. The memory stores a computer program. When the computer program is executed by the processor, the processor performs the following steps: when at least one touch button is detected to be pressed, the touch channel corresponding to the pressed button is sampled to obtain a first analog signal, wherein the pressed button is one of a plurality of touch buttons; if the pressed button is determined to meet a first preset condition for being triggered based on the first analog signal, the touch channel corresponding to an unpressed button is sampled to obtain a second analog signal, wherein the unpressed button is one of a plurality of touch buttons that has not been pressed; if the unpressed button is determined to meet a second preset condition for not being triggered based on the second analog signal, a button response is performed on the pressed button.
[0104] It should be noted that the above-mentioned touch button detection method, device, equipment and computer-readable storage medium belong to the same general inventive concept, and the contents of the embodiments of the touch button detection method, device, equipment and computer-readable storage medium are applicable to each other.
[0105] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0106] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0107] The above embodiments merely illustrate several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A touch key detection method, characterized by, The method is applied to a terminal provided with a plurality of touch keys, one touch key corresponding to one touch channel, and comprises the following steps: When at least one touch key is detected to be pressed, sampling the touch channel corresponding to the pressed key to obtain a first analog quantity, the pressed key being a pressed key among the plurality of touch keys; If it is determined according to the first analog quantity that the pressed key meets a first preset condition of being triggered, sampling the touch channel corresponding to an unpressed key to obtain a second analog quantity, the unpressed key being an unpressed key among the plurality of touch keys; If it is determined according to the second analog quantity that the unpressed key meets a second preset condition of not being triggered, performing a key response on the pressed key; The method further comprises the following steps: Obtaining a target environmental noise threshold and a target trigger threshold corresponding to the unpressed key, the target environmental noise threshold corresponding to the unpressed key being a predetermined reference value for measuring whether the unpressed key is disturbed, and the target trigger threshold corresponding to the unpressed key being a predetermined analog quantity change threshold for measuring whether the unpressed key is triggered; Taking the difference between the second analog quantity corresponding to the unpressed key and the target environmental noise threshold corresponding to the unpressed key as a first difference, and if the ratio of the first difference to the target trigger threshold is less than a first preset ratio, it is determined that the unpressed key meets the second preset condition of not being triggered; If the ratio of the first difference to the target trigger threshold is greater than or equal to the first preset ratio, it is determined that the unpressed key does not meet the second preset condition of not being triggered.
2. The method of claim 1, wherein, The method further comprises the following steps: If it is determined according to the first analog quantity that the pressed key does not meet the first preset condition of being triggered, or it is determined according to the second analog quantity that the unpressed key does not meet the second preset condition of not being triggered, stopping the key response on the pressed key.
3. The method of claim 1, wherein, The method further comprises the following steps: Obtaining a target environmental noise threshold and a target trigger threshold corresponding to the pressed key, the target environmental noise threshold corresponding to the pressed key being a reference value for measuring whether the pressed key is disturbed by the environment, and the target trigger threshold corresponding to the pressed key being a predetermined analog quantity change threshold for measuring whether the pressed key is triggered; If the first analog quantity is greater than the sum of the target trigger threshold corresponding to the pressed key and the target environmental noise threshold, it is determined that the pressed key meets the first preset condition of being triggered; If the first analog quantity is less than or equal to the sum of the target trigger threshold corresponding to the pressed key and the target environmental noise threshold, it is determined that the pressed key does not meet the first preset condition of being triggered.
4. The method according to claim 1 or 3, characterized in that, The method further comprises the following steps: When the terminal is powered on, updating the target environmental noise threshold and the target trigger threshold of each touch key.
5. The method of claim 4, wherein, The updating of the target environmental noise threshold and the target trigger threshold of each touch key comprises the following steps: Obtaining an initial environmental noise threshold and an initial trigger threshold of a target touch channel, wherein the target touch channel is any one of the plurality of touch channels; The target touch channel is subjected to a cyclic sampling operation to obtain a first preset number of analog quantities, the cyclic sampling operation comprising sampling the target touch channel at every preset time interval, and taking the mean value of the first preset number of analog quantities as a first analog quantity mean value; If the first analog quantity mean value satisfies a third preset condition, a target environmental noise threshold of the target touch channel is determined according to the first analog quantity mean value; the third preset condition is a condition for updating the initial environmental noise; The target touch channel is subjected to a second preset number of cyclic sampling operations to obtain a second preset number of analog quantity mean values, the mean value of the second preset number of analog quantity mean values is taken as a second analog quantity mean value, and a target trigger threshold of the target touch channel is determined according to the second analog quantity mean value.
6. The method of claim 5, wherein, The method further comprises: The target touch channel is subjected to a cyclic sampling operation to obtain a first preset number of analog quantities, the cyclic sampling operation comprising sampling the target touch channel at every preset time interval, and taking the mean value of the first preset number of analog quantities as a first analog quantity mean value; If the first analog quantity mean value satisfies a third preset condition, a target environmental noise threshold of the target touch channel is determined according to the first analog quantity mean value; the third preset condition is a condition for updating the initial environmental noise; 7. The method of claim 5, wherein, The target touch channel is subjected to a second preset number of cyclic sampling operations to obtain a second preset number of analog quantity mean values, the mean value of the second preset number of analog quantity mean values is taken as a second analog quantity mean value, and a target trigger threshold of the target touch channel is determined according to the second analog quantity mean value. The method further comprises: The target touch channel is subjected to a cyclic sampling operation to obtain a first preset number of analog quantities, the cyclic sampling operation comprising sampling the target touch channel at every preset time interval, and taking the mean value of the first preset number of analog quantities as a first analog quantity mean value; 8. The method of claim 5, wherein, If the first analog quantity mean value satisfies a third preset condition, a target environmental noise threshold of the target touch channel is determined according to the first analog quantity mean value; the third preset condition is a condition for updating the initial environmental noise; The target touch channel is subjected to a second preset number of cyclic sampling operations to obtain a second preset number of analog quantity mean values, the mean value of the second preset number of analog quantity mean values is taken as a second analog quantity mean value, and a target trigger threshold of the target touch channel is determined according to the second analog quantity mean value. The method further comprises:
9. The method of claim 5, wherein, The target touch channel is subjected to a cyclic sampling operation to obtain a first preset number of analog quantities, the cyclic sampling operation comprising sampling the target touch channel at every preset time interval, and taking the mean value of the first preset number of analog quantities as a first analog quantity mean value; If the first analog quantity mean value satisfies a third preset condition, a target environmental noise threshold of the target touch channel is determined according to the first analog quantity mean value; the third preset condition is a condition for updating the initial environmental noise; 10. A touch key detection apparatus, characterized by comprising: The target touch channel is subjected to a second preset number of cyclic sampling operations to obtain a second preset number of analog quantity mean values, the mean value of the second preset number of analog quantity mean values is taken as a second analog quantity mean value, and a target trigger threshold of the target touch channel is determined according to the second analog quantity mean value. The method further comprises: The target touch channel is subjected to a cyclic sampling operation to obtain a first preset number of analog quantities, the cyclic sampling operation comprising sampling the target touch channel at every preset time interval, and taking the mean value of the first preset number of analog quantities as a first analog quantity mean value; If the first analog quantity mean value satisfies a third preset condition, a target environmental noise threshold of the target touch channel is determined according to the first analog quantity mean value; the third preset condition is a condition for updating the initial environmental noise; The target touch channel is subjected to a second preset number of cyclic sampling operations to obtain a second preset number of analog quantity mean values, the mean value of the second preset number of analog quantity mean values is taken as a second analog quantity mean value, and a target trigger threshold of the target touch channel is determined according to the second analog quantity mean value. The method further comprises: The target touch channel is subjected to a cyclic sampling operation to obtain a first preset number of analog quantities, the cyclic sampling operation comprising sampling the target touch channel at every preset time interval, and taking the mean value of the first preset number of analog quantities as a first analog quantity mean value; If the first analog quantity mean value satisfies a third preset condition, a target environmental noise threshold of the target touch channel is determined according to the first analog quantity mean value; the third preset condition is a condition for updating the initial environmental noise; The target touch channel is subjected to a second preset number of cyclic sampling operations to obtain a second preset number of analog quantity mean values, the mean value of the second preset number of analog quantity mean values is taken as a second analog quantity mean value, and a target trigger threshold of the target touch channel is determined according to the second analog quantity mean value. The method further comprises: The target touch channel is subjected to a cyclic sampling operation to obtain a first preset number of analog quantities, the cyclic sampling operation comprising sampling the target touch channel at every preset time interval, and taking the mean value of the first preset number of analog quantities as a first analog quantity mean value; If the first analog quantity mean value satisfies a third preset condition, a target environmental noise threshold of the target touch channel is determined according to the first analog quantity mean value; the third preset condition is a condition for updating the initial environmental noise; The target touch channel is subjected to a second preset number of cyclic sampling operations to obtain a second preset number of analog quantity mean values, the mean value of the second preset number of analog quantity mean values is taken as a second analog quantity mean value, and a target trigger threshold of the target touch channel is determined according to the second analog quantity mean value. The method further comprises: The target touch channel is subjected to a cyclic sampling operation to obtain a first preset number of analog quantities, the cyclic sampling operation comprising sampling the target touch channel at every preset time interval, and taking the mean value of the first preset number of analog quantities as a first analog quantity mean value; If the first analog quantity mean value satisfies a third preset condition, a target environmental noise threshold of the target touch channel is determined according to the first analog quantity mean value; the third preset condition is a condition for updating the initial environmental noise; The target touch channel is subjected to a second preset number of cyclic sampling operations to obtain a second preset number of analog quantity mean values, the mean value of the second preset number of analog quantity mean values is taken as a second analog quantity mean value, and a target trigger threshold of the target touch channel is determined according to the second analog quantity mean value. The method further comprises: The target touch channel is subjected to a cyclic sampling operation to obtain a first preset number of analog quantities, the cyclic sampling operation comprising sampling the target touch channel at every preset time interval, and taking the mean value of the first preset number of analog quantities as a first analog quantity mean value; If the first analog quantity mean value satisfies a third preset condition, a target environmental noise threshold of the target touch channel is determined according to the first analog quantity mean value; the third preset condition is a condition for updating the initial environmental noise; The target touch channel is subjected to a second preset number of cyclic sampling operations to obtain a second preset number of analog quantity mean values, the mean value of the second preset number of analog quantity mean values is taken as a second analog quantity mean value, and a target trigger threshold of the target touch channel is determined according to the second analog quantity mean value. The method further comprises: The target touch channel is subjected to a cyclic sampling operation to obtain a first preset number of analog quantities, the cyclic sampling operation comprising sampling the target touch channel at every preset time interval, and taking the mean value of the first preset number of analog quantities as a first analog quantity mean value; If the first analog quantity mean value satisfies a third preset condition, a target environmental noise threshold of the target touch channel is determined according to the first analog quantity mean value; the third preset condition is a condition for updating the initial environmental noise; The target touch channel is subjected to a second preset number of cyclic sampling operations to obtain a second preset number of analog quantity mean values, the mean value of the second preset number of analog quantity mean values is taken as a second analog quantity mean value, and a target trigger threshold of the target touch channel is determined according to the second analog quantity mean value. The second judging module is further configured to: obtain a target environmental noise threshold and a target trigger threshold corresponding to the non-pressed key, the target environmental noise threshold corresponding to the non-pressed key being a predetermined reference value for measuring whether the non-pressed key is disturbed, and the target trigger threshold corresponding to the non-pressed key being a predetermined analog quantity change threshold for measuring whether the non-pressed key is triggered; take a difference between the second analog quantity corresponding to the non-pressed key and the target environmental noise threshold corresponding to the non-pressed key as a first difference, and determine that the non-pressed key meets a second preset condition of not being triggered if a ratio of the first difference to the target trigger threshold is less than a first preset ratio; determine that the non-pressed key does not meet the second preset condition of not being triggered if the ratio of the first difference to the target trigger threshold is greater than or equal to the first preset ratio.
11. A computer-readable storage medium storing a computer program, characterized in that, The computer program is executed by the processor to enable the processor to perform the steps of the method according to any one of claims 1 to 9.
12. A terminal device comprising a memory, a processor and a touch key, characterized in that, The memory stores a computer program, and the computer program is executed by the processor to enable the processor to perform the steps of the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Space mouse and touch identification method and device
CN102707818A
Touch key detection equipment and method
CN111865289A