Key detection method, device, equipment and storage medium
By calculating the capacitance change and rate of change of capacitive touch buttons, and combining threshold judgment and learning adjustment, the interference problem when multiple capacitive touch buttons exist adjacently is solved, improving the accuracy and sensitivity of button detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-10
- Publication Date
- 2026-03-20
AI Technical Summary
When multiple capacitive touch buttons are located adjacent to each other, interference between the buttons can easily occur, leading to accidental touches.
By acquiring touch sensing data from capacitive touch buttons, calculating the capacitance change and capacitance change rate, and combining the capacitance change threshold and capacitance change rate threshold, it is determined whether the button is pressed. After button detection, these thresholds are learned and adjusted to reduce interference.
It effectively reduces mutual interference when multiple capacitive touch buttons are adjacent, avoids accidental button presses, and improves button sensitivity and anti-interference performance.
Smart Images

Figure CN115800988B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of touch keys, and particularly relates to a key detection method and device, equipment and a storage medium. BACKGROUND
[0002] With the progress of science and technology, touch keys are applied more and more widely. Touch keys not only can reduce the size of keys and prevent keys from being damaged, but also are more sensitive and convenient. The touch keys include capacitive touch keys. For the capacitive touch keys, an electrode is arranged below the capacitive touch keys. An integrated circuit (IC) is used to collect the capacitance of the electrode, and a single-chip microcomputer connected with the touch IC acquires the capacitance change of the electrode. The single-chip microcomputer detects whether the corresponding capacitive touch key is pressed according to the capacitance change of the electrode.
[0003] At present, when detecting whether the capacitive touch key is pressed, the capacitance value of the electrode obtained is compared with a fixed static basic capacitance value. If the difference between the two is greater than a set threshold, it is determined that the capacitive touch key is pressed, that is, a key action is detected. However, when a plurality of capacitive touch keys exist adjacently, the phenomenon of mutual interference between keys occurs, resulting in key mis-touch. SUMMARY
[0004] The present application provides a key detection method, device, equipment and storage medium to solve the problem that when a plurality of capacitive touch keys exist adjacently, the phenomenon of mutual interference between keys occurs, resulting in key mis-touch.
[0005] In a first aspect, the present application provides a key detection method suitable for key detection of at least two capacitive touch keys adjacent in position. The key detection method comprises the following steps.
[0006] Obtaining touch sensing data of the at least two capacitive touch keys;
[0007] For each capacitive touch key, obtaining a capacitance change amount and a capacitance change rate of the capacitive touch key according to the touch sensing data, the capacitance change rate being a ratio of the capacitance change amount to a first capacitance change amount average, and the first capacitance change amount average being an average of the capacitance change amounts of the at least two capacitive touch keys; and determining whether the capacitive touch key is pressed according to the capacitance change amount and the capacitance change rate.
[0008] Optionally, the determining whether the capacitive touch key is pressed according to the capacitance change amount and the capacitance change rate comprises: determining that the capacitive touch key is pressed when the capacitance change amount is greater than or equal to a capacitance change threshold and a target difference value is greater than or equal to a capacitance change rate threshold, the target difference value being a difference between the capacitance change rate and a maximum value of the capacitance change rate corresponding to at least two capacitive touch keys, and the maximum value of the capacitance change rate being a maximum value of the capacitance change rate corresponding to the at least two capacitive touch keys; or determining that the capacitive touch key is not pressed when the capacitance change amount is less than the capacitance change threshold or the target difference value is less than the capacitance change rate threshold.
[0009] Optionally, the key detection method further comprises: when it is determined that the capacitive touch key is pressed, adjusting the capacitance change threshold corresponding to the capacitive touch key based on the capacitance change amount and N historical capacitance change amounts of the capacitive touch key, N being a non-negative integer.
[0010] Optionally, the adjusting the capacitance change threshold corresponding to the capacitive touch key based on the capacitance change amount and N historical capacitance change amounts of the capacitive touch key comprises: obtaining a second capacitance change amount average based on the capacitance change amount and the N historical capacitance change amounts of the capacitive touch key; and adjusting the capacitance change threshold corresponding to the capacitive touch key according to the second capacitance change amount average and the capacitance change threshold.
[0011] Optionally, the key detection method further comprises: when it is determined that the capacitive touch key is pressed, adjusting the capacitance change rate threshold corresponding to the capacitive touch key based on the capacitance change rate and N historical capacitance change rates of the capacitive touch key.
[0012] Optionally, the adjusting the capacitance change rate threshold corresponding to the capacitive touch key based on the capacitance change rate and N historical capacitance change rates of the capacitive touch key comprises: obtaining a first capacitance change rate difference value based on the capacitance change rate and a maximum value of the capacitance change rates of other capacitive touch keys; obtaining N first historical capacitance change rates of the capacitive touch key; obtaining a maximum value of second historical capacitance change rates of the other capacitive touch keys at the same time as each first historical capacitance change rate for each first historical capacitance change rate; obtaining N second capacitance change rate difference values according to the N first historical capacitance change rates and the maximum values of the second historical capacitance change rates; and adjusting the capacitance change rate threshold corresponding to the capacitive touch key according to the first capacitance change rate difference value and the N second capacitance change rate difference values.
[0013] Optionally, the key detection method further comprises: when it is determined that the capacitive touch key is pressed, obtaining a third capacitance change amount average based on a capacitance change amount of a capacitive touch key that is not pressed and N historical capacitance change amounts of the capacitive touch key that is not pressed; and adjusting a capacitance change threshold corresponding to the capacitive touch key that is not pressed according to the third capacitance change amount average.
[0014] Optionally, the key detection method further comprises: if the duration of pressing the capacitive touch key is greater than or equal to the duration threshold, adjusting the capacitive reference value corresponding to the capacitive touch key according to the difference between the capacitive value of the capacitive touch key and the capacitive change amount.
[0015] Optionally, the key detection method further comprises: if the duration of pressing the capacitive touch key is greater than or equal to the duration threshold, adjusting the capacitive reference value corresponding to the capacitive touch key according to the sum of the capacitive reference value corresponding to the capacitive touch key that is not pressed and the capacitive change amount.
[0016] Optionally, the key detection method further comprises: determining the number of times that the capacitive touch key is continuously pressed; if the number of times is greater than or equal to the number threshold, determining that the capacitive touch key is pressed; if the number of times is less than the number threshold, determining that the capacitive touch key is not pressed.
[0017] Optionally, the key detection method further comprises: when it is determined that at least two capacitive touch keys are not pressed, for each capacitive touch key, adjusting the capacitive reference value of the capacitive touch key according to the sum of the capacitive reference value corresponding to the capacitive touch key, the capacitive change amount, and L historical capacitive change amounts corresponding to the capacitive touch key when the capacitive touch key is not pressed, L being a positive integer.
[0018] In a second aspect, the present application provides a key detection device suitable for key detection of at least two capacitive touch keys adjacent in position, the key detection device comprising:
[0019] An acquisition module configured to acquire touch sensing data of the at least two capacitive touch keys;
[0020] A processing module configured to, for each capacitive touch key, obtain a capacitive change amount corresponding to the capacitive touch key and a capacitive change rate according to the touch sensing data, the capacitive change rate being a ratio of the capacitive change amount to a first capacitive change amount average, the first capacitive change amount average being an average of the capacitive change amounts of the at least two capacitive touch keys; and determine whether the capacitive touch key is pressed according to the capacitive change amount and the capacitive change rate.
[0021] Optionally, the processing module is specifically configured to: when the capacitive change amount is greater than or equal to a capacitive change threshold, and a target difference value is greater than or equal to a capacitive change rate threshold, determine that the capacitive touch key is pressed, the target difference value being a difference between the capacitive change rate and a maximum capacitive change rate, the maximum capacitive change rate being a maximum value in the capacitive change rates corresponding to the at least two capacitive touch keys; or when the capacitive change amount is less than the capacitive change threshold, or the target difference value is less than the capacitive change rate threshold, determine that the capacitive touch key is not pressed.
[0022] Optionally, the key detection apparatus further comprises an adjusting module configured to adjust the capacitance change threshold corresponding to the capacitive touch key based on the capacitance change amount and N historical capacitance change amounts of the capacitive touch key when it is determined that the capacitive touch key is pressed, where N is a non-negative integer.
[0023] Optionally, the adjusting module is specifically configured to obtain a second capacitance change amount mean value based on the capacitance change amount and N historical capacitance change amounts of the capacitive touch key; and adjust the capacitance change threshold corresponding to the capacitive touch key according to the second capacitance change amount mean value and the capacitance change threshold.
[0024] Optionally, the adjusting module is further configured to adjust the capacitance change rate threshold corresponding to the capacitive touch key based on the capacitance change rate and N historical capacitance change rates of the capacitive touch key when it is determined that the capacitive touch key is pressed.
[0025] Optionally, the adjusting module is specifically configured to obtain a first capacitance change rate difference value based on the capacitance change rate and a maximum value among the capacitance change rates of other capacitive touch keys; obtain N first historical capacitance change rates of the capacitive touch key; obtain a maximum value among second historical capacitance change rates of other capacitive touch keys at the same time as each first historical capacitance change rate for each first historical capacitance change rate; obtain N second capacitance change rate difference values according to the N first historical capacitance change rates and the maximum values among the second historical capacitance change rates; and adjust the capacitance change rate threshold corresponding to the capacitive touch key according to the first capacitance change rate difference value and the N second capacitance change rate difference values.
[0026] Optionally, the adjusting module is further configured to obtain a third capacitance change amount mean value based on the capacitance change amount and N historical capacitance change amounts of a capacitive touch key that is not pressed when it is determined that the capacitive touch key is pressed; and adjust the capacitance change threshold corresponding to the capacitive touch key that is not pressed according to the third capacitance change amount mean value.
[0027] Optionally, the adjusting module is further configured to adjust the capacitance reference value corresponding to the capacitive touch key according to a difference between the capacitance value and the capacitance change amount of the capacitive touch key if the duration for which the capacitive touch key is pressed is greater than or equal to a time threshold.
[0028] Optionally, the adjusting module is further configured to adjust the capacitance reference value corresponding to a capacitive touch key that is not pressed according to a sum of the capacitance reference value and the capacitance change amount of the capacitive touch key that is not pressed if the duration for which the capacitive touch key is pressed is greater than or equal to a time threshold.
[0029] Optionally, the processing module is further configured to: determine the number of times the capacitive touch key is continuously pressed; determine that the capacitive touch key is pressed if the number of times is greater than or equal to a number threshold; and determine that the capacitive touch key is not pressed if the number of times is less than the number threshold.
[0030] Optionally, the adjusting module is further configured to: when it is determined that none of the at least two capacitive touch keys is pressed, adjust, for each capacitive touch key, the capacitive reference value of the capacitive touch key according to the capacitive reference value corresponding to the capacitive touch key, the capacitive variation, and the sum of the L historical capacitive variations corresponding to the capacitive touch key when the capacitive touch key is not pressed, where L is a positive integer.
[0031] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory connected to the processor in communication;
[0032] The memory stores computer-executable instructions.
[0033] The processor executes the computer-executable instructions stored in the memory to implement the key detection method according to the first aspect of the present application.
[0034] In a fourth aspect, the present application provides a computer-readable storage medium, which stores computer program instructions, and the computer program instructions are executed to implement the key detection method according to the first aspect of the present application.
[0035] In a fifth aspect, the present application provides a computer program product, which comprises a computer program, and the computer program is executed by a processor to implement the key detection method according to the first aspect of the present application.
[0036] The key detection method, device, equipment and storage medium provided by the present application can obtain the touch sensing data of at least two capacitive touch keys, and for each capacitive touch key, the capacitive variation and the capacitive variation rate corresponding to the capacitive touch key are obtained according to the touch sensing data, and whether the capacitive touch key is pressed is determined according to the capacitive variation and the capacitive variation rate. Since the present application not only considers the capacitive variation corresponding to each capacitive touch key, but also combines the capacitive variation rate corresponding to each capacitive touch key, i.e. determines whether the capacitive touch key is pressed according to the capacitive variation and the capacitive variation rate, therefore, when multiple capacitive touch keys exist adjacently, the mutual interference between the keys can be greatly reduced, and the key mis-touch can be avoided. BRIEF DESCRIPTION OF DRAWINGS
[0037] 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 prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor.
[0038] Figure 1 The application scenario diagram provided for an embodiment of the present application;
[0039] Figure 2 The flowchart of the key detection method provided for an embodiment of the present application;
[0040] Figure 3 The flowchart of the key detection method provided for another embodiment of the present application;
[0041] Figure 4 The flowchart of the capacitive touch key effectiveness determination provided for an embodiment of the present application;
[0042] Figure 5 The flowchart of the key detection method provided for still another embodiment of the present application;
[0043] Figure 6 The flowchart of the key detection by the single-chip microcomputer provided for an embodiment of the present application;
[0044] Figure 7 The structural schematic diagram of the key detection device provided for an embodiment of the present application;
[0045] Figure 8 The structural schematic diagram of the key detection device provided for another embodiment of the present application;
[0046] Figure 9 The structural schematic diagram of the electronic device provided for an embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions in the embodiments of the present application will be described clearly and completely in the following with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all the other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the present application.
[0048] Currently, when detecting whether a capacitive touch button is pressed, the capacitance value of the acquired electrode is compared with a fixed static base capacitance value. If the difference between the two is greater than a set threshold, the capacitive touch button is determined to be pressed, i.e., a button action is detected. However, when multiple capacitive touch buttons exist adjacently, mutual interference can occur, especially when the electrodes are far from the capacitive touch panel. When a capacitive touch button is pressed, the capacitance change is weak, and the position of the capacitive touch button is prone to deviation, leading to accidental button presses. In addition, the accidental button press phenomenon is more serious when different electrodes have different sensitivities. If the set threshold corresponding to the capacitance change detected by the capacitive touch button is increased, the sensitivity of the capacitive touch button will decrease. Coupled with the aging of the device and the accumulation of contaminants on the electrodes of the capacitive touch button, this can directly cause the button to become unusable. Therefore, for multiple adjacent capacitive touch buttons (also known as multi-channel capacitive touch buttons), a new button detection and button learning method is needed to allow them to automatically adapt to the environment and achieve optimal performance and functionality. Current technology includes single-channel touch button learning methods, but these methods cannot handle multi-channel touch buttons.
[0049] To address the aforementioned issues, this application provides a key detection method, apparatus, device, and storage medium. By repeatedly detecting the capacitance data corresponding to capacitive touch keys on different channels, adjusting the capacitance reference value corresponding to each capacitive touch key and determining the threshold for whether a capacitive touch key is pressed based on the detection results, the key sensitivity is improved and the mutual interference between keys is reduced.
[0050] The following section provides examples illustrating the application scenarios of the solution provided in this application.
[0051] Figure 1 This is a schematic diagram illustrating an application scenario provided by an embodiment of this application. For example... Figure 1 As shown, in this application scenario, the capacitive touch panel 110 includes three adjacent capacitive touch buttons A, B, and C, and each capacitive touch button has an electrode underneath it. Figure 1 (Not shown in the diagram). When the capacitive touch button C is pressed, the touch IC 120, connected to the electrode corresponding to the capacitive touch button C, acquires the capacitance of the electrode, and the microcontroller 130, connected to the touch IC 120, obtains the capacitance change of the electrode. The microcontroller 130 detects whether the corresponding capacitive touch button C is pressed based on the capacitance change of the electrode. The specific implementation process of the microcontroller 130 detecting whether the corresponding capacitive touch button C is pressed based on the capacitance change of the electrode can be found in the solutions of the following embodiments.
[0052] It should be noted that, Figure 1The application embodiments only provide a schematic diagram of an application scenario, and do not limit the devices included in the application Figure 1 , nor do they limit the positional relationship between the devices in Figure 1 .
[0053] Next, the key detection method is introduced through specific embodiments.
[0054] Figure 2 The flowchart of the key detection method provided by the application embodiments is applicable to key detection of at least two capacitive touch keys adjacent in position. As shown in Figure 2 , the method of the application embodiments includes:
[0055] S201, obtaining touch sensing data of at least two capacitive touch keys.
[0056] In the application embodiments, by way of example, with reference to Figure 1 , the key detection of the capacitive touch keys is first the program running of the single-chip microcomputer, that is, the single-chip microcomputer is powered on, and the touch parameters corresponding to each capacitive touch key (i.e., the initialization touch parameters) are loaded from the memory. The touch parameters mainly include the capacitive reference values, the capacitive change threshold values, the capacitive change rate threshold values, and the clock frequencies corresponding to each capacitive touch key, respectively, and the touch IC is initialized through the gain and other parameters of the touch IC. Then, the touch IC obtains the touch sensing data of each capacitive touch key. By way of example, FDC2214 touch IC is used as the touch IC for touch sensing data collection; i.MXRT1052 is used as the single-chip microcomputer for reading and control; four electrodes corresponding to four capacitive touch keys, i.e., four touch channels, are used, and the distance between each electrode is less than, for example, 5 mm, so that the touch sensing data of the four capacitive touch keys is obtained. By way of example, the sampling frequency can be set to, for example, 100 ms, and the touch sensing data of the four capacitive touch keys is collected once every 100 ms.
[0057] S202, for each capacitive touch key, obtaining the capacitive change amount and the capacitive change rate corresponding to the capacitive touch key according to the touch sensing data, and determining whether the capacitive touch key is pressed according to the capacitive change amount and the capacitive change rate.
[0058] The capacitive change rate is the ratio of the capacitive change amount to the first capacitive change amount average, and the first capacitive change amount average is the average of the capacitive change amounts of the at least two capacitive touch keys.
[0059] In this step, after obtaining the touch sensing data of each capacitive touch key, the capacitive value corresponding to each capacitive touch key can be obtained according to the touch sensing data through Formula One as follows:
[0060]
[0061] Wherein, C total represents the capacitance value, unit is femto Farad (fF); pi is π, value is 3.141592653589793238463; F sensor represents the original capacitance value converted by the touch IC, F sensor =(Fref×FIN_SEL×DATA) / 2 28 Wherein, Fref represents the reference frequency, Fref=f_clk / freq_divider, wherein f_clk represents the clock frequency, f_clk takes a value such as 43330000, freq_divider represents the clock pre-division coefficient, freq_divider takes a value such as 1, then the value of Fref is such as 43330000 / 1=43330000, FIN_SEL represents that the clock frequency source comes from the internal clock, FIN_SEL takes a value such as 2; DATA represents the single-channel touch data obtained by the touch IC, that is, the touch sensing data of a single capacitive touch button; L_uH represents the parallel inductance value, L_uH is such as 18uH.
[0062] According to the capacitance values respectively corresponding to each capacitive touch button, the capacitance change amounts respectively corresponding to each capacitive touch button are obtained through the following formula two:
[0063] CR=C total -C baseline Formula two
[0064] Wherein, CR represents the capacitance change amount, C baseline represents the capacitance reference value.
[0065] According to the capacitance change amounts respectively corresponding to each capacitive touch button, the first capacitance change amount average is obtained through the following formula three:
[0066]
[0067] Wherein, CR v1 represents the first capacitance change amount average, CR i represents the capacitance change amount corresponding to each capacitive touch button, and m represents the total number of capacitive touch buttons.
[0068] The capacitance change rates respectively corresponding to each capacitive touch button are obtained through the following formula four:
[0069]
[0070] Wherein, CK represents the capacitance change rate.
[0071] After obtaining the capacitance change amount and the capacitance change rate corresponding to each capacitive touch key respectively, for each capacitive touch key, whether the capacitive touch key is pressed can be determined according to the capacitance change amount and the capacitance change rate. How to determine whether the capacitive touch key is pressed according to the capacitance change amount and the capacitance change rate can be referred to subsequent embodiments, which will not be described here.
[0072] The key detection method provided by the embodiment of the present application obtains the touch sensing data of at least two capacitive touch keys, for each capacitive touch key, obtains the capacitance change amount and the capacitance change rate corresponding to the capacitive touch key according to the touch sensing data, and determines whether the capacitive touch key is pressed according to the capacitance change amount and the capacitance change rate. Since the embodiment of the present application not only considers the capacitance change amount corresponding to each capacitive touch key respectively, but also combines the capacitance change rate corresponding to each capacitive touch key respectively, that is, determines whether the capacitive touch key is pressed according to the capacitance change amount and the capacitance change rate, therefore, when a plurality of capacitive touch keys exist adjacently, the mutual interference between the keys can be greatly reduced, and the key mis-touching can be avoided.
[0073] Figure 3 The flowchart of the key detection method provided by another embodiment of the present application. On the basis of the above-mentioned embodiment, the present embodiment further describes how to perform key detection. As shown in Figure 3 The method of the embodiment of the present application can include:
[0074] S301, obtaining touch sensing data of at least two capacitive touch keys.
[0075] The specific description of this step can be referred to the related description of S201 step in the embodiment shown in Figure 2 The specific description of this step can be referred to the related description of S201 step in the embodiment shown in
[0076] In the embodiment of the present application, Figure 2 S202 step in the above embodiment can be further refined into two steps S302 and S303 as follows:
[0077] S302, for each capacitive touch key, obtaining the capacitance change amount and the capacitance change rate corresponding to the capacitive touch key according to the touch sensing data; and when the capacitance change amount is greater than or equal to the capacitance change threshold value, and the target difference value is greater than or equal to the capacitance change rate threshold value, determining that the capacitive touch key is pressed.
[0078] Wherein, the target difference value is the difference between the capacitance change rate and the maximum value of the capacitance change rate, and the maximum value of the capacitance change rate is the maximum value in the capacitance change rates corresponding to the at least two capacitive touch keys.
[0079] In this step, referring to step S202, for each capacitive touch key, according to the touch sensing data, the capacitive change amount and the capacitive change rate corresponding to the capacitive touch key can be obtained, and thus the maximum capacitive change rate can be determined as the maximum value in the capacitive change rates corresponding to each capacitive touch key, and the target difference value is the difference between the capacitive change rate and the maximum capacitive change rate, which is denoted by CK delta for example. Exemplarily, the capacitive change threshold value and the capacitive change rate threshold value are touch parameters corresponding to the capacitive touch key loaded from the memory when the single-chip microcomputer is powered on, and the capacitive change threshold value is denoted by CR thr for example, and the capacitive change rate threshold value is denoted by CK delta_thr for example. Exemplarily, for each capacitive touch key, according to the capacitive change amount and the capacitive change threshold value corresponding to the capacitive touch key, when the capacitive change amount is greater than or equal to the capacitive change threshold value, it is considered that there can be a case that the capacitive change amount of multiple capacitive touch keys is greater than or equal to the capacitive change threshold value, i.e., a case that multiple capacitive touch keys are pressed simultaneously, and thus the judgment is made according to both the target difference value and the capacitive change rate threshold value. It can be understood that the capacitive touch key corresponding to the maximum capacitive change rate is the pressed capacitive touch key, and the target difference value is the difference between the capacitive change rate of the capacitive touch key corresponding to the maximum capacitive change rate and the capacitive change rate of the other adjacent capacitive touch key, and when the target difference value is greater than or equal to the capacitive change rate threshold value, it is determined that the capacitive touch key corresponding to the maximum capacitive change rate is pressed.
[0080] S303, for each capacitive touch key, according to the touch sensing data, the capacitive change amount and the capacitive change rate corresponding to the capacitive touch key are obtained, and when the capacitive change amount is less than the capacitive change threshold value or the target difference value is less than the capacitive change rate threshold value, it is determined that the capacitive touch key is not pressed.
[0081] On the basis of the above embodiment, in one possible implementation, for each capacitive touch key, according to the capacitive change amount and the capacitive change threshold value corresponding to the capacitive touch key, when the capacitive change amount is less than the capacitive change threshold value, it can be determined that the capacitive touch key is not pressed. In another possible implementation, for example, four capacitive touch keys are used, and it is considered that there can be a case that the capacitive change amount of multiple capacitive touch keys is greater than or equal to the capacitive change threshold value, i.e., a case that multiple capacitive touch keys are pressed simultaneously, and thus the judgment can be made according to the target difference value and the capacitive change rate threshold value, and when the target difference value is less than the capacitive change rate threshold value, it is determined that the capacitive touch key is not pressed.
[0082] The above steps S302 and S303 can be understood as the validity judgment of the capacitive touch key, wherein the capacitive touch key is pressed can be understood as the key is valid, and the capacitive touch key is not pressed can be understood as the key is invalid.
[0083] Based on the step S302, after determining that the capacitive touch key is pressed, the capacitive touch key can be learned through the steps S304-S306 as follows. The key learning is learning immediately after determining that the capacitive touch key is pressed (i.e. the key is effective) to update the capacitance change threshold and the capacitance change rate threshold, so as to learn the user habits and the environment, to realize the rationalization of the capacitance change threshold and the capacitance change rate threshold, to avoid the errors caused by the installation, or the different user key habits, to affect the effect of the capacitive touch key, and meanwhile, the capacitive touch keys learn from each other, which can also reduce the mutual interference between the keys.
[0084] S304, when determining that the capacitive touch key is pressed, adjusting the capacitance change threshold corresponding to the capacitive touch key based on the capacitance change amount and N historical capacitance change amounts of the capacitive touch key.
[0085] Wherein, N is a non-negative integer.
[0086] In this step, the N historical capacitance change amounts of the capacitive touch key can be understood as the capacitance change amounts corresponding to the last N times that the key is pressed before the current time. Therefore, when determining that the capacitive touch key is pressed, the capacitance change threshold corresponding to the capacitive touch key can be adjusted based on the capacitance change amount and the N historical capacitance change amounts of the capacitive touch key.
[0087] Further, optionally, adjusting the capacitance change threshold corresponding to the capacitive touch key based on the capacitance change amount and the N historical capacitance change amounts of the capacitive touch key can include: obtaining a second capacitance change amount mean based on the capacitance change amount and the N historical capacitance change amounts of the capacitive touch key; and adjusting the capacitance change threshold corresponding to the capacitive touch key according to the second capacitance change amount mean and the capacitance change threshold.
[0088] Exemplarily, the maximum N is 99, then according to the capacitance change amount and the N historical capacitance change amounts of the capacitive touch key, it can be determined that there are at most 100 capacitance change amounts, denoted as n, and the maximum n is 100, if n is less than 100, then the capacitance change amounts corresponding to the last n times that the capacitive touch key is pressed are taken. The second capacitance change amount mean corresponding to the n capacitance change amounts is obtained through the following formula five:
[0089] CR v2 =(CR1+CR2+…+CR n ) / n Formula five
[0090] Wherein, CR v2 represents the second capacitance change amount mean, CR1 to CR nThe capacitance change amount of the capacitive touch key and N historical capacitance change amounts.
[0091] According to the second capacitance change amount mean value and the capacitance change threshold value, the capacitance change threshold value corresponding to the capacitive touch key is adjusted, and the adjusted capacitance change threshold value corresponding to the capacitive touch key is obtained through Formula Six as follows:
[0092] CR thr_new_1 = CR thr + CR v2 × 0.8 Formula Six
[0093] Wherein, CR thr_new_1 represents the adjusted capacitance change threshold value corresponding to the capacitive touch key, and 0.8 is a capacitance change threshold value adjustment coefficient, which can be set as needed.
[0094] It can be understood that the adjusted capacitance change threshold value corresponding to the capacitive touch key is used for determining whether a capacitive touch key is pressed next time according to the obtained touch sensing data of at least two capacitive touch keys. By adjusting the capacitance change threshold value corresponding to the capacitive touch key, both key triggering and reduction of non-key touch interference can be ensured.
[0095] S305, when it is determined that the capacitive touch key is pressed, the capacitance change rate threshold value corresponding to the capacitive touch key is adjusted based on the capacitance change rate and N historical capacitance change rates of the capacitive touch key.
[0096] On the basis of the above-mentioned embodiments, the capacitance change rate threshold value determines the error event when multiple capacitive touch keys are pressed at the same time. When the difference between the capacitance change rate corresponding to the maximum value of the capacitive touch key and the capacitance change rate of other adjacent capacitive touch keys is less than the capacitance change rate threshold value, it is determined that multiple capacitive touch keys are pressed at the same time, and multiple capacitive touch keys are invalid, i.e. it is determined that the state of multiple capacitive touch keys is that none of them is pressed. The N historical capacitance change rates of the capacitive touch key can be understood as the maximum value of the capacitance change rate of other keys at the same time when the key is pressed N times before the current time. Therefore, when it is determined that the capacitive touch key is pressed, the capacitance change rate threshold value corresponding to the capacitive touch key can be adjusted based on the capacitance change rate and the N historical capacitance change rates of the capacitive touch key.
[0097] Further, optionally, adjusting the capacitance change rate threshold corresponding to the capacitive touch key based on the capacitance change rate and N historical capacitance change rates of the capacitive touch key can comprise: obtaining a first capacitance change rate difference based on the capacitance change rate and a maximum value of the capacitance change rates of other capacitive touch keys; obtaining N first historical capacitance change rates of the capacitive touch key; obtaining a maximum value of second historical capacitance change rates of other capacitive touch keys at the same time as each first historical capacitance change rate; obtaining N second capacitance change rate differences based on the N first historical capacitance change rates and the maximum values of the second historical capacitance change rates; and adjusting the capacitance change rate threshold corresponding to the capacitive touch key based on the first capacitance change rate difference and the N second capacitance change rate differences.
[0098] For example, if Nmax is 99, then based on the capacitance change rate and N historical capacitance change rates of the capacitive touch key, a maximum of 100 capacitance change rates can be determined, denoted as n, where nmax is 100. If n is less than 100, then the capacitance change rates of the capacitive touch key in the most recent n times when the capacitive touch key is pressed are taken. The adjusted capacitance change rate threshold corresponding to the capacitive touch key is obtained by the following formula seven:
[0099]
[0100] wherein CK delta_thr_new represents the adjusted capacitance change rate threshold corresponding to the capacitive touch key, CK n represents the capacitance change rate of the capacitive touch key, CK1 to CK n-1 represents the N first historical capacitance change rates of the capacitive touch key, CK nmax represents the maximum value of the capacitance change rates of other capacitive touch keys when the capacitive touch key is pressed, CK 1max to CK (n-1)max represents the N maximum values of the second historical capacitance change rates of other capacitive touch keys at the same time as the first historical capacitance change rates, (CK n - CK nmax ) represents the first capacitance change rate difference, (CK1-CK 1max ) + (CK2-CK 2max ) + … + (CK (n-1) - CK (n-1)max ) represents the N second capacitance change rate differences, and 1.2 is a capacitance change rate threshold adjustment coefficient which can be set as needed.
[0101] It can be understood that the adjusted capacitance change rate threshold corresponding to the capacitive touch key is used for determining whether a capacitive touch key is pressed next time according to the obtained touch sensing data of the at least two capacitive touch keys. By adjusting the capacitance change rate threshold corresponding to the capacitive touch key, most of the invalid key events caused by the error position touch and the error events when multiple keys are pressed at the same time can be shielded, the determination rate of the effective key event can be maximized, the fault tolerance can be improved, the key event can be effective when the touch position deviation is certain, and the user experience can be greatly improved.
[0102] In the step S306, when it is determined that the capacitive touch key is pressed, a third capacitance change amount mean value is obtained based on the capacitance change amount of the capacitive touch key that is not pressed and N historical capacitance change amounts of the capacitive touch key that is not pressed, and the capacitance change threshold corresponding to the capacitive touch key that is not pressed is adjusted according to the third capacitance change amount mean value.
[0103] In the step, when it is determined that the capacitive touch key is pressed, the capacitance change threshold corresponding to the other key (i.e., the capacitive touch key that is not pressed) is adjusted, so that the other key will not be determined as being pressed by the capacitance change rate due to the pressing of the capacitive touch key. In particular, for some less frequently used capacitive touch keys, the probability of false triggering of the key can be reduced and the anti-interference performance can be improved by key learning, the capacitance change threshold can be updated, the sensitivity decrease caused by long-term non-use can be reduced, and the key failure caused by the failure of the determination by the capacitance change threshold can be avoided. For example, the maximum N is 99, and the maximum number of capacitance change amounts can be determined according to the capacitance change amount of the capacitive touch key that is not pressed and the N historical capacitance change amounts of the capacitive touch key that is not pressed. The capacitance change amount corresponding to the capacitive touch key that is not pressed when the adjacent key is pressed is taken as the capacitance change amount of the last n times. Therefore, in the step S306, when it is determined that the capacitive touch key is pressed, a third capacitance change amount mean value is obtained based on the capacitance change amount of the capacitive touch key that is not pressed and N historical capacitance change amounts of the capacitive touch key that is not pressed, and the capacitance change threshold corresponding to the capacitive touch key that is not pressed is adjusted according to the third capacitance change amount mean value. For example, the adjusted capacitance change threshold corresponding to the capacitive touch key that is not pressed is obtained by the following formula eight:
[0104]
[0105] wherein, CR thr_new_2 represents the adjusted capacitance change threshold corresponding to the capacitive touch key that is not pressed, CR o1 to CR ona capacitance change amount of the capacitive touch key not pressed and N historical capacitance change amounts of the capacitive touch key not pressed, representing a third capacitance change amount average, 1.2 is a capacitance change threshold adjustment coefficient, which can be set as needed.
[0106] It can be understood that the adjusted capacitance change threshold of the capacitive touch key not pressed is used to determine whether a capacitive touch key is pressed next time according to the obtained touch sensing data of at least two capacitive touch keys. By adjusting the capacitance change threshold of the capacitive touch key not pressed, the probability of false touch when the adjacent key is pressed can be reduced, and the key sensitivity of the capacitive touch key not pressed can be learned.
[0107] S307, if the duration of the capacitive touch key being pressed is greater than or equal to the time threshold, adjusting the capacitance reference value corresponding to the capacitive touch key according to the difference between the capacitance value and the capacitance change amount of the capacitive touch key.
[0108] In this step, the capacitive touch key is pressed, but it has not been released for a long time, so key timeout learning is needed. The key timeout learning is used to solve the problem that other capacitive touch keys are invalid when some positions of the capacitive touch key panel are covered by water droplets, damaged, stuck by other substances, or pressed and blocked by other things. Considering that the capacitive touch key can still work normally when the interfering substance disappears, only the capacitance reference value corresponding to the capacitive touch key is adjusted, and the capacitance change threshold or the capacitance change rate threshold is not modified. Because the capacitance reference value corresponding to the capacitive touch key is constantly learned, and the influence of the pressed capacitive touch key can be reduced, the capacitive touch key will not occur again when the capacitive touch key is not released. Exemplarily, the time threshold can be set as needed. The adjusted capacitance reference value corresponding to the capacitive touch key is obtained by the following formula nine:
[0109] C baseline_new_1 = C total -(CRx0.8) Formula nine
[0110] Wherein, C baseline_new_1 represents the adjusted capacitance reference value corresponding to the capacitive touch key, and 0.8 is a capacitance reference value adjustment coefficient, which can be set as needed.
[0111] By adjusting the capacitance reference value corresponding to the capacitive touch key, the new capacitance reference value can be directly raised to 80% of the height of the current capacitance reference value (because CR=C total -C baseline ), so that it cannot pass the judgment of the capacitance change threshold and has learning space.
[0112] S308, if the duration of pressing the capacitive touch key is greater than or equal to the time threshold, adjusting the capacitive reference value corresponding to the capacitive touch key that is not pressed according to the sum of the capacitive reference value corresponding to the capacitive touch key that is not pressed and the capacitive change amount.
[0113] In this step, if the duration of pressing the capacitive touch key is greater than or equal to the time threshold, the capacitive touch key that is not pressed needs to learn the key timeout. The adjusted capacitive reference value corresponding to the capacitive touch key that is not pressed is obtained by the following formula ten:
[0114] C baseline_new_2 = C baseline + (CR x 0.5) Formula ten
[0115] Wherein, C baseline_new_2 represents the adjusted capacitive reference value corresponding to the capacitive touch key that is not pressed, and 0.5 is the capacitive reference value adjustment coefficient, which can be set as needed.
[0116] By adjusting the capacitive reference value corresponding to the capacitive touch key that is not pressed, the capacitive reference value corresponding to the capacitive touch key that is not pressed can be quickly raised by half of the capacitive change amount, which can not only reduce the judgment of false touch keys, but also ensure the normal use of the keys.
[0117] S309, when it is determined that at least two capacitive touch keys are not pressed, for each capacitive touch key, adjusting the capacitive reference value of the capacitive touch key according to the sum of the capacitive reference value corresponding to the capacitive touch key, the capacitive change amount and the L historical capacitive change amounts corresponding to the capacitive touch key when the capacitive touch key is not pressed.
[0118] Wherein, L is a positive integer.
[0119] In this step, when it is determined that at least two capacitive touch keys are not pressed, each capacitive touch key needs to learn statically to update the capacitive reference value of the capacitive touch key, so as to prevent the problem of key aging or key touch insensitivity caused by long-term non-use of the key. For example, L is 3, and the adjusted capacitive reference value of the capacitive touch key is obtained by the following formula eleven:
[0120] C baseline_new_3 = C baseline + CR x 0.05 + CR1 x 0.03 + CR2 x 0.01 + CR3 x 0.005 Formula eleven
[0121] Wherein, C baseline_new_3CR1 to CR3 represent three historical capacitance change amounts corresponding to the capacitive touch button not being pressed, wherein each of CR1 to CR3 is less than the corresponding capacitance change threshold, and the time sequence of CR1 to CR3 is from the nearest to the farthest from the current time, for example, CR1 is the capacitance change amount corresponding to the nearest time when the capacitive touch button is not pressed before the current time, and 0.05, 0.03, 0.01 and 0.005 are capacitance reference value adjustment coefficients, which can be set as needed.
[0122] It should be noted that considering the possibility of multiple capacitive touch buttons being pressed at the same time, the target difference and the capacitance change rate threshold can determine that no capacitive touch button is pressed, in which case each capacitive touch button does not perform static learning.
[0123] The key detection method provided in the embodiments of the present application comprises the following steps: obtaining touch sensing data of at least two capacitive touch keys; for each capacitive touch key, obtaining a capacitive change amount and a capacitive change rate of the capacitive touch key according to the touch sensing data; determining that the capacitive touch key is pressed when the capacitive change amount is greater than or equal to a capacitive change threshold and a target difference is greater than or equal to a capacitive change rate threshold, and determining that the capacitive touch key is not pressed when the capacitive change amount is less than the capacitive change threshold or the target difference is less than the capacitive change rate threshold; adjusting the capacitive change threshold of the capacitive touch key based on the capacitive change amount and N historical capacitive change amounts of the capacitive touch key when it is determined that the capacitive touch key is pressed; adjusting the capacitive change rate threshold of the capacitive touch key based on the capacitive change rate and N historical capacitive change rates of the capacitive touch key; obtaining a third capacitive change amount average based on the capacitive change amount of the capacitive touch key that is not pressed and N historical capacitive change amounts of the capacitive touch key that is not pressed; adjusting the capacitive change threshold of the capacitive touch key that is not pressed according to the third capacitive change amount average; adjusting a capacitive reference value of the capacitive touch key according to a difference between the capacitive value and the capacitive change amount of the capacitive touch key when the duration for which the capacitive touch key is pressed is greater than or equal to a time threshold, and adjusting the capacitive reference value of the capacitive touch key that is not pressed according to a sum of the capacitive reference value and the capacitive change amount of the capacitive touch key that is not pressed; and adjusting the capacitive reference value of the capacitive touch key according to a sum of the capacitive reference value and the capacitive change amount of the capacitive touch key and L historical capacitive change amounts of the capacitive touch key that is not pressed when it is determined that none of the at least two capacitive touch keys is pressed. Since the embodiments of the present application determine whether the capacitive touch key is pressed according to the capacitive change amount and the capacitive change rate, each capacitive touch key learns the key when it is determined that the capacitive touch key is pressed, learns the key overtime when the capacitive touch key is pressed for a long time, and learns statically when none of the capacitive touch keys is pressed, therefore, when multiple capacitive touch keys are adjacent, the mutual interference between the keys can be greatly reduced, the key mis-touching can be avoided, the sensitivity of the key can be greatly improved, the service life of the capacitive touch key can be maximally prolonged, and the user experience can be improved.
[0124] On the basis of the above embodiments, for each capacitive touch key, Figure 4 The flow chart of the capacitive touch key effectiveness determination provided in an embodiment of the present application is shown in Figure 4 The method provided in the embodiments of the present application can comprise the following steps:
[0125] S401, obtaining a capacitive value C of a capacitive touch key total .
[0126] S402, obtain the capacitance change CR and the capacitance change rate CK.
[0127] S403, determine whether the capacitance change CR is greater than or equal to the capacitance change threshold CR thr .
[0128] If CR is less than CR thr , execute S404; if CR is greater than or equal to CR thr , execute S405 to S407.
[0129] S404, determine that the key is invalid.
[0130] The key is invalid, that is, the capacitive touch key is not pressed.
[0131] S405, obtain the target difference CK delta .
[0132] The specific description of this step can be referred to the related description of S302 in the embodiment shown in Figure 3 , which will not be repeated here.
[0133] S406, determine whether the target difference CK delta is greater than or equal to the capacitance change rate threshold CK delta_thr .
[0134] If CK delta is greater than or equal to CK delta_thr , execute S407; if CK delta is less than CK delta_thr , execute S404.
[0135] S407, determine that the key is valid.
[0136] The key is valid, that is, the capacitive touch key is pressed.
[0137] On the basis of the above embodiment, optionally, the number of times that the capacitive touch key is continuously pressed is determined; if the number of times is greater than or equal to the number of times threshold, it is determined that the capacitive touch key is pressed; if the number of times is less than the number of times threshold, it is determined that the capacitive touch key is not pressed.
[0138] Exemplarily, the number of times threshold is 3. After it is determined that the capacitive touch key is continuously pressed 3 times, it is determined that the capacitive touch key is pressed; if the number of times is less than 3, it is determined that the capacitive touch key is not pressed. Through the above-mentioned manner, the capacitive touch key can be avoided from being mistakenly touched, and whether the capacitive touch key is pressed can be determined more accurately.
[0139] Based on the above embodiments, and exemplarily, in order to ensure more accurate determination of whether a capacitive touch button has been pressed, Figure 5 This is a flowchart of a key detection method provided in another embodiment of this application. Figure 5 As shown, the method in this application embodiment may include:
[0140] S501. Collect touch sensing data of four capacitive touch buttons at preset time intervals.
[0141] If the preset time interval is, for example, 100ms, then touch sensing data of the four capacitive touch buttons will be collected every 100ms.
[0142] S502. Convert the touch sensing data of the four capacitive touch buttons into corresponding capacitance data respectively.
[0143] For a detailed description of this step, please refer to [link / reference]. Figure 2 The relevant description of step S202 in the illustrated embodiment will not be repeated here.
[0144] S503. For each capacitive touch button, determine the validity of the capacitive touch button.
[0145] For a detailed description of this step, please refer to [link / reference]. Figure 4 The relevant descriptions of the embodiments shown will not be repeated here.
[0146] S504. Determine whether the validity judgment is passed.
[0147] If the validity check fails, proceed with steps S505 and S506; if the validity check passes, proceed with the relevant steps in S507 to S512.
[0148] S505: Determine that the capacitive touch button is invalid, clear the number of validity checks, set it to no button state, and store the updated parameters.
[0149] In this step, the no-button state means that no capacitive touch button is pressed.
[0150] S506, capacitive touch buttons undergo static learning.
[0151] For a detailed description of this step, please refer to [link / reference]. Figure 3 The description of step S309 in the illustrated embodiment will not be repeated here. After the capacitive touch button completes static learning, step S501 is executed.
[0152] S507. The number of validity checks is accumulated and added to a preset value.
[0153] The default value is, for example, 1.
[0154] S508, judging whether the number of times of the validity judgment is greater than or equal to a number threshold.
[0155] The number threshold is, for example, 3. If the number of times of the validity judgment is greater than or equal to 3, the relevant steps in S509 to S512 are executed; if the number of times of the validity judgment is less than 3, the step S501 is executed.
[0156] S509, determining that the capacitive touch key is valid, and setting to a key valid state.
[0157] S510, the capacitive touch key performs key learning.
[0158] The specific description of this step can be referred to the relevant description of the steps S304 to S306 in the embodiment shown in Figure 3 The specific description of this step can be referred to the relevant description of the steps S304 to S306 in the embodiment shown in
[0159] S511, judging whether the duration that the capacitive touch key is pressed is greater than or equal to a duration threshold.
[0160] The duration threshold is, for example, 5 seconds. If the duration that the capacitive touch key is pressed is greater than or equal to 5 seconds, the step S512 is executed; if the duration that the capacitive touch key is pressed is less than 5 seconds, the step S501 is executed.
[0161] S512, the capacitive touch key performs key timeout learning.
[0162] The specific description of this step can be referred to the relevant description of the steps S307 and S308 in the embodiment shown in Figure 3 The specific description of this step can be referred to the relevant description of the steps S307 and S308 in the embodiment shown in
[0163] After the capacitive touch key performs key timeout learning is completed, the step S501 is continued to be executed.
[0164] Figure 6 The flow chart of the single-chip microcomputer for key detection provided by an embodiment of the present application is shown in Figure 6 The method of the embodiment of the present application can include:
[0165] S601, the single-chip microcomputer program runs, and loads the touch parameters corresponding to each capacitive touch key.
[0166] S602, the capacitive data of each capacitive touch key of the touch IC is collected.
[0167] S603, the validity of each capacitive touch key is judged.
[0168] S604, according to the validity judgment result, each capacitive touch key performs corresponding learning.
[0169] S605, adjust the corresponding touch parameter of each capacitive touch key, and store the adjusted touch parameter.
[0170] On the basis of the above-mentioned embodiments, optionally, the touch IC can be other signal touch chip or hardware Resistor-Capacitance circuit touch scheme; the sampling frequency can be, for example, collecting touch sensing data of each capacitive touch key once every 50 ms; the number threshold value is, for example, 4 times; the capacitance reference value adjustment coefficient can be set as needed, for example, it can be changed from 0.8 to 0.9.
[0171] In summary, the technical scheme provided by the application has at least the following advantages:
[0172] (1) Through the learning of big data, the key is more and more useful, according to the touch characteristics and the installation environment self-learning, let the touch key more convenient, simple, reduce because of installation deviation, or replace the touch panel problem and the personal key time change intensity is not the same problem caused by the touch difficult to use.
[0173] (2) Through the mutual learning between the touch keys, even if the touch key is not often used, it can also be learned and adjusted when other touch keys are pressed, to prevent the problem that the touch key cannot be used due to aging, and to maintain the sensitivity of the touch key and prolong the service life of the touch key.
[0174] (3) When a touch key fails, other touch keys can be quickly adjusted to reduce the interference and loss caused by it.
[0175] (4) The self-learning of the touch key can maintain its sensitivity and anti-interference, always keep a benign balance between false touch and sensitivity, improve the user experience and service life.
[0176] The following is an embodiment of the application device, which can be used to execute the method embodiment of the application. For details not disclosed in the device embodiment of the application, please refer to the method embodiment of the application.
[0177] Figure 7 The structure diagram of the key detection device provided by an embodiment of the application is suitable for key detection of at least two capacitive touch keys adjacent in position. As shown in Figure 7 The key detection device 700 of the embodiment of the application comprises an acquisition module 701 and a processing module 702. Wherein:
[0178] The acquisition module 701 is used for acquiring touch sensing data of at least two capacitive touch keys.
[0179] The processing module 702 is configured to, for each capacitive touch key, obtain a capacitive change amount and a capacitive change rate of the capacitive touch key according to the touch sensing data, the capacitive change rate being a ratio of the capacitive change amount to a first capacitive change amount average, the first capacitive change amount average being an average of the capacitive change amounts of the at least two capacitive touch keys, and determine whether the capacitive touch key is pressed according to the capacitive change amount and the capacitive change rate.
[0180] In some embodiments, the processing module 702 can be specifically configured to: determine that the capacitive touch key is pressed when the capacitive change amount is greater than or equal to a capacitive change threshold and a target difference value is greater than or equal to a capacitive change rate threshold, the target difference value being a difference between the capacitive change rate and a capacitive change rate maximum, the capacitive change rate maximum being a maximum value in the capacitive change rates of the at least two capacitive touch keys; or determine that the capacitive touch key is not pressed when the capacitive change amount is less than the capacitive change threshold or the target difference value is less than the capacitive change rate threshold.
[0181] Figure 8 A structural schematic diagram of a key detection device provided by another embodiment of the present application is shown in FIG. 8. As shown in FIG. 8, the key detection device 800 of the embodiment of the present application can further include: Figure 8 Figure 7 as shown in the device structure, and can further include:
[0182] The adjusting module 703 is configured to, when it is determined that the capacitive touch key is pressed, adjust the capacitive change threshold corresponding to the capacitive touch key based on the capacitive change amount and N historical capacitive change amounts of the capacitive touch key, N being a non-negative integer.
[0183] In some embodiments, the adjusting module 703 can be specifically configured to: obtain a second capacitive change amount average based on the capacitive change amount and the N historical capacitive change amounts of the capacitive touch key; and adjust the capacitive change threshold corresponding to the capacitive touch key according to the second capacitive change amount average and the capacitive change threshold.
[0184] Optionally, the adjusting module 703 can also be configured to, when it is determined that the capacitive touch key is pressed, adjust the capacitive change rate threshold corresponding to the capacitive touch key based on the capacitive change rate and N historical capacitive change rates of the capacitive touch key.
[0185] Optionally, the adjusting module 703 can be specifically configured to: obtain a first capacitance change rate difference based on the capacitance change rate and a maximum value of capacitance change rates of other capacitive touch keys; obtain N first historical capacitance change rates of the capacitive touch key; obtain a maximum value of second historical capacitance change rates of other capacitive touch keys at the same time as each first historical capacitance change rate for each first historical capacitance change rate; obtain N second capacitance change rate differences based on the N first historical capacitance change rates and the maximum value of the second historical capacitance change rates; and adjust the capacitance change rate threshold corresponding to the capacitive touch key based on the first capacitance change rate difference and the N second capacitance change rate differences.
[0186] Optionally, the adjusting module 703 can be further configured to: obtain a third capacitance change amount average based on the capacitance change amount of the capacitive touch key that is not pressed and N historical capacitance change amounts of the capacitive touch key that is not pressed when it is determined that the capacitive touch key is pressed.
[0187] Optionally, the adjusting module 703 can be further configured to: if the duration for which the capacitive touch key is pressed is greater than or equal to a time threshold, adjust the capacitance reference value corresponding to the capacitive touch key based on the difference between the capacitance value and the capacitance change amount of the capacitive touch key.
[0188] Optionally, the adjusting module 703 can be further configured to: if the duration for which the capacitive touch key is pressed is greater than or equal to a time threshold, adjust the capacitance reference value corresponding to the capacitive touch key based on the sum of the capacitance reference value and the capacitance change amount of the capacitive touch key that is not pressed.
[0189] Optionally, the processing module 702 can be further configured to: determine the number of times the capacitive touch key is continuously pressed; if the number of times is greater than or equal to a number threshold, determine that the capacitive touch key is pressed; and if the number of times is less than the number threshold, determine that the capacitive touch key is not pressed.
[0190] Optionally, the adjusting module 703 can be further configured to: when it is determined that at least two capacitive touch keys are not pressed, adjust the capacitance reference value of each capacitive touch key based on the sum of the capacitance reference value and the capacitance change amount of the capacitive touch key and L historical capacitance change amounts of the capacitive touch key that is not pressed, L being a positive integer.
[0191] The apparatus of the embodiment can be used to execute the technical solutions of any of the above-described method embodiments, and has similar principles and technical effects, which will not be described here in detail.
[0192] Figure 9A structural schematic diagram of an electronic device is provided in an embodiment of the present application. Exemplarily, the electronic device can be provided as a device including at least two capacitive touch keys adjacent to each other. Referring to Figure 9 The electronic device 900 includes a processing component 901, which further includes one or more processors, and a memory resource represented by a memory 902, for storing instructions executable by the processing component 901, such as an application program. The application program stored in the memory 902 can include one or more than one module each corresponding to a set of instructions. In addition, the processing component 901 is configured to execute the instructions to perform any of the method embodiments described above.
[0193] The electronic device 900 can further include a power supply component 903 configured to perform power management of the electronic device 900, a wired or wireless network interface 904 configured to connect the electronic device 900 to a network, and an input / output (I / O) interface 905. The electronic device 900 can operate based on an operating system stored in the memory 902, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM or the like.
[0194] The present application also provides a computer-readable storage medium, which stores computer-executable instructions, and when the processor executes the computer-executable instructions, the scheme of the key detection method as described above is implemented.
[0195] The present application also provides a computer program product, which includes a computer program, and when the processor executes the computer program, the scheme of the key detection method as described above is implemented.
[0196] The computer-readable storage medium described above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium accessible by a general-purpose or special-purpose computer.
[0197] An example readable storage medium is coupled to the processor such that the processor can read information from the readable storage medium and can write information to the readable storage medium. Of course, the readable storage medium can be a part of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can exist as discrete components in the key detection device.
[0198] Those skilled in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by program instruction related hardware. The foregoing program can be stored in a computer readable storage medium. The program executes to perform the steps of the above-mentioned method embodiments; and the foregoing storage medium includes: ROM, RAM, magnetic disk or optical disk and various storage medium that can store program codes.
[0199] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A key detection method, characterized in that, A key detection method applicable to capacitive touch buttons with at least two adjacent positions, the key detection method comprising: Acquire touch sensing data from at least two capacitive touch buttons; For each of the capacitive touch buttons, based on the touch sensing data, the capacitance change and capacitance change rate corresponding to the capacitive touch button are obtained, the capacitance change rate being the ratio of the capacitance change to the average of the first capacitance change, the average of the first capacitance change being the average of the capacitance changes of the at least two capacitive touch buttons; and, based on the capacitance change and the capacitance change rate, it is determined whether the capacitive touch button is pressed. Determining whether the capacitive touch button is pressed based on the capacitance change and the capacitance change rate includes: When the capacitance change is greater than or equal to the capacitance change threshold and the target difference is greater than or equal to the capacitance change rate threshold, it is determined that the capacitive touch button is pressed. The target difference is the difference between the capacitance change rate and the maximum capacitance change rate. The maximum capacitance change rate is the maximum value among the capacitance change rates corresponding to the at least two capacitive touch buttons. Alternatively, if the capacitance change is less than the capacitance change threshold, or the target difference is less than the capacitance change rate threshold, it is determined that the capacitive touch button has not been pressed.
2. The button detection method according to claim 1, characterized in that, Also includes: When it is determined that the capacitive touch button is pressed, the capacitance change threshold corresponding to the capacitive touch button is adjusted based on the capacitance change and N historical capacitance changes of the capacitive touch button, where N is a non-negative integer.
3. The button detection method according to claim 2, characterized in that, The step of adjusting the capacitance change threshold corresponding to the capacitive touch button based on the capacitance change and N historical capacitance changes of the capacitive touch button includes: Based on the capacitance change and N historical capacitance changes of the capacitive touch button, the average value of the second capacitance change is obtained. Based on the average value of the second capacitance change and the capacitance change threshold, adjust the capacitance change threshold corresponding to the capacitive touch button.
4. The button detection method according to claim 1, characterized in that, Also includes: When it is determined that the capacitive touch button is pressed, the capacitance change rate threshold corresponding to the capacitive touch button is adjusted based on the capacitance change rate and N historical capacitance change rates of the capacitive touch button.
5. The button detection method according to claim 4, characterized in that, The step of adjusting the capacitance change rate threshold corresponding to the capacitive touch button based on the capacitance change rate and N historical capacitance change rates of the capacitive touch button includes: The first capacitance change rate difference is obtained based on the maximum value among the capacitance change rates of the stated capacitance change rate and the capacitance change rates of other capacitive touch buttons. Obtain N first historical capacitance change rates of the capacitive touch button; For each of the first historical capacitance change rates, obtain the maximum value among the second historical capacitance change rates of other capacitive touch buttons at the same moment as the first historical capacitance change rate. Based on the maximum value among the N first historical capacitance change rates and the second historical capacitance change rates, N differences in the second capacitance change rate are obtained; The capacitance change rate threshold corresponding to the capacitive touch button is adjusted based on the first capacitance change rate difference and the N second capacitance change rate differences.
6. The button detection method according to claim 1, characterized in that, Also includes: When it is determined that the capacitive touch button is pressed, a third average value of capacitance change is obtained based on the capacitance change of the unpressed capacitive touch button and N historical capacitance changes of the unpressed capacitive touch button. Based on the average value of the third capacitance change, adjust the capacitance change threshold corresponding to the unpressed capacitive touch button.
7. The button detection method according to claim 1, characterized in that, Also includes: If the duration of the capacitive touch button being pressed is greater than or equal to a duration threshold, the capacitance reference value corresponding to the capacitive touch button is adjusted according to the difference between the capacitance value of the capacitive touch button and the capacitance change.
8. The button detection method according to claim 1, characterized in that, Also includes: If the duration of the capacitive touch button being pressed is greater than or equal to the duration threshold, then the capacitive reference value corresponding to the unpressed capacitive touch button is adjusted according to the sum of the capacitance reference value corresponding to the unpressed capacitive touch button and the capacitance change.
9. The button detection method according to claim 1, characterized in that, Also includes: Determine the number of times the capacitive touch button is pressed consecutively; If the number of presses is greater than or equal to the threshold number, then the capacitive touch button is determined to be pressed. If the number of presses is less than the threshold number, then it is determined that the capacitive touch button has not been pressed.
10. The button detection method according to claim 1, characterized in that, Also includes: When it is determined that neither of the at least two capacitive touch buttons is pressed, for each capacitive touch button, the capacitive touch button's capacitive reference value is adjusted based on the sum of the capacitance reference value corresponding to the capacitive touch button, the capacitance change, and L historical capacitance changes corresponding to when the capacitive touch button is not pressed, where L is a positive integer.
11. A key detection device, characterized in that, A key detection device suitable for detecting at least two adjacent capacitive touch keys, the key detection device comprising: The acquisition module is used to acquire touch sensing data of at least two capacitive touch buttons; The processing module is configured to, for each of the capacitive touch buttons, obtain, based on the touch sensing data, the capacitance change amount and capacitance change rate corresponding to the capacitive touch button, wherein the capacitance change rate is the ratio of the capacitance change amount to a first average capacitance change amount, and the first average capacitance change amount is the average capacitance change amount of the at least two capacitive touch buttons; and, based on the capacitance change amount and the capacitance change rate, determine whether the capacitive touch button is pressed. The processing module is specifically configured to determine that the capacitive touch button is pressed when the capacitance change is greater than or equal to the capacitance change threshold and the target difference is greater than or equal to the capacitance change rate threshold, wherein the target difference is the difference between the capacitance change rate and the maximum capacitance change rate, and the maximum capacitance change rate is the maximum capacitance change rate among the at least two capacitive touch buttons; or, when the capacitance change is less than the capacitance change threshold or the target difference is less than the capacitance change rate threshold, determine that the capacitive touch button is not pressed.
12. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the key detection method as described in any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions, which, when executed, implement the key detection method as described in any one of claims 1 to 10.
14. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the key detection method as described in any one of claims 1 to 10.
Citation Information
Patent Citations
Touch identification method and device for capacitive touch keys
CN106301325A
Detection method and detection device for capacitive touch key
CN110380715A
Touch threshold correction method of touch key, wire controller, electric appliance and computer readable storage medium
CN111352534A