Touch sampling method, electronic equipment and computer readable storage medium
By adjusting the capacitive touch sampling time, combining the key scanning time and error touch rate, the critical value of sensitivity and accuracy is determined, the sampling time debugging problem in the prior art is solved, and the button performance optimization and cost reduction are achieved.
Patent Information
- Application Number
- CN202411125501.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-12-27
AI Technical Summary
The existing capacitive touch sampling duration debugging has problems of difficulty in balancing sensitivity and accuracy, resulting in increased response or possibility of error contact, and high debugging time and cost.
By obtaining the key scanning time and touch error rate, adjusting the sampling time to determine the first critical value and the second critical value, comprehensively considering sensitivity and accuracy, to shorten the sampling time confirmation, reduce debugging time and development costs.
It effectively balances the sensitivity and accuracy of touch buttons, shortens the sampling time confirmation process, and reduces debugging time and development costs.
Smart Images

Figure CN119200890A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the technical field of key detection, and in particular to a touch sampling method, an electronic device, and a computer-readable storage medium. Background Art
[0002] The capacitive touch circuit is a touch module that uses an internal counter to count the sampling time (a number of charge and discharge cycles) to obtain the count value based on the change in capacitance caused by the presence or absence of pressure or the difference in the pressure medium.
[0003] In different development and application scenarios, the sampling time of capacitive touch is often adjusted again according to the actual touch medium material, resulting in additional costs. The sampling time is a key parameter that determines the sensitivity and accuracy of touch button triggering. If the sampling time is too long, the touch button will not respond sensitively. If the sampling time is too short, the possibility of false touch of the touch button will increase, and the press judgment margin will be too small. Summary of the invention
[0004] An object of the embodiments of the present application is to provide a touch sampling method, an electronic device, and a computer-readable storage medium to solve the existing sampling duration debugging problem.
[0005] In a first aspect, an embodiment of the present application provides a touch sampling method, comprising: Obtaining a key scanning duration, adjusting a sampling duration, and determining a first critical value of the sampling duration according to the adjusted sampling duration and the key scanning duration; Acquire a false touch rate, adjust a sampling duration, acquire sampling count values of different sampling durations, calculate an error through the sampling count values, and determine a second critical value of the sampling duration according to the false touch rate and the error; A final value of the sampling duration is determined according to the first critical value and the second critical value.
[0006] In a second aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory is connected to the processor, and the processor is used to execute one or more computer programs stored in the memory. When the processor executes the one or more computer programs, the electronic device implements the touch sampling method as described above.
[0007] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the touch sampling method as described above.
[0008] In the touch sampling method provided in the embodiment of the present application, by obtaining the sampling count value and the key scanning time, the sampling time is adjusted to obtain the first critical value, and the touch false touch rate is obtained, the sampling time is adjusted to obtain the second critical value, and the final value of the sampling time is determined by the first critical value and the second critical value. Among them, the first critical value can be used as a basis for judging the sensitivity of the key, and the second critical value can be used as a basis for judging the accuracy of the key. The comprehensive consideration of the two can shorten the sampling time confirmation and reduce the debugging time cost and development cost under the premise of effectively ensuring the key performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0010] Figure 1 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application; Figure 2 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application; Figure 3 A schematic diagram of a flow chart of a touch sampling method provided in an embodiment of the present application; Figure 4 A schematic diagram of the method steps for determining a first critical value provided in an embodiment of the present application; Figure 5 is a schematic diagram of the method steps for further determining the first critical value provided in an embodiment of the present application; Figure 6 is a schematic diagram of the steps of a method for determining a second critical value provided in an embodiment of the present application; Figure 7 is a schematic diagram of the method steps for further determining the second critical value provided in an embodiment of the present application; Figure 8 It is a specific flow chart of a touch sampling method provided in an embodiment of the present application; Fig. 9 is a structural schematic diagram of a touch sampling device provided in an embodiment of the present application; Fig.10 yes Fig. 9 A schematic structural diagram of the first determination module shown; Fig.11 yes Fig. 9 A schematic structural diagram of a second determination module shown; Fig.12 yes Fig. 9 A schematic structural diagram of the third determination module shown; Fig.13 It is a schematic diagram of the hardware structure of a controller provided in an embodiment of the present application. DETAILED DESCRIPTION
[0011] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0012] It should be noted that, if there is no conflict, the various features in the embodiments of the present application can be combined with each other, all within the scope of protection of the present application. In addition, although the functional module division is performed in the device schematic diagram and the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in a different order from the module division in the device or the flow chart. Furthermore, the words "first", "second", "third", etc. used in this application do not limit the data and execution order, but only distinguish the same items or similar items with basically the same functions and effects.
[0013] The electronic device provided in the embodiments of the present application can be any type of electronic device, including but not limited to a single-chip microcomputer, headphones, a smart phone, a tablet computer, etc.
[0014] See also Figure 1 The electronic device 100 includes a key module 101 and a key detection circuit 102 .
[0015] The button module 101 is used to provide the user with any appropriate button operation, for example, the button operation includes a single button pressing operation, a continuous single button pressing operation, a multi-point pressing operation, a sliding operation, etc.
[0016] Buttons are usually used in electronic devices equipped with touch screens, which are equivalent to sensing elements. Since the human body carries a lot of water and electrolytes, which have a certain degree of conductivity, the human body has electrical conductivity, and a capacitance effect will be generated under the action of different electric fields. A tiny capacitance will be formed between the sensing element and the ground. When the user touches the touch screen with a finger, due to the capacitance between the human body and the ground, the capacitance generated by the human body and the capacitance generated by the sensing element are connected together, thus forming an effect of increasing the total capacitance, causing the capacitance value of the sensing element to change, so that the touch screen can detect the position and action of the finger contact, and then identify the corresponding button operation.
[0017] The key detection circuit 102 is electrically connected to the key module 101 and is used to detect various pressing operations performed by the user through the key module 101. Figure 2 As shown, the key detection circuit 102 includes a sampling module 1021 and a controller 1022. The sampling module 1021 is electrically connected to the key module 101, and is used to sample the capacitance value generated by the key module 101 and output an analog signal, which may be a voltage signal. The controller 1022 is electrically connected to the sampling module 1021, and is used to obtain the analog signal output by the sampling module 1021 and detect various pressing operations performed by the user through the key module 101 based on the analog signal.
[0018] In some embodiments, the sampling module 1021 includes a timer 10211, a counter 10212, a sampler 10213, etc. The timer 10211 is configured with a sampling duration, and the length of the sampling duration directly affects the sensitivity and accuracy of the key; the counter 10212 is configured with a sampling count value, which is related to the number of sampling bits and is used to count the sampling duration, and determines the sampling accuracy and range; the sampler 10213 is configured with a sampling rate, and the sampling rate determines the number of samples per unit time. The sampling duration, sampling counter and sampling rate can all be manually set according to needs.
[0019] The recognition of key operations is periodic. When the key detection circuit 102 detects a change in capacitance, the recognition command is triggered. During the key scanning time of an identification cycle, the capacitance of the key is sampled according to the above-mentioned sampling time, sampling count value, sampling rate and other related touch parameters. Generally speaking, the sampling time must not exceed the key scanning time, and a certain time margin must be reserved for the recognition and processing of the key operation.
[0020] In some embodiments, the controller 1022 can be any general purpose processor, digital signal processor (DSP), application specific integrated circuit (ASIC), field programmable gate array (FPGA), single chip microcomputer, ARM (Acorn RISC Machine) or other programmable logic device, discrete gate or transistor logic, discrete hardware components or any combination of these components. In addition, the controller 1022 can also be any conventional processor, controller, microcontroller or state machine. The controller 1022 can also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, multiple microprocessors, one or more microprocessors combined with a DSP and / or any other such configuration.
[0021] See also Figure 3 , the embodiment of the present application provides a touch sampling method, including: Obtaining a key scanning duration, adjusting a sampling duration, and determining a first critical value of the sampling duration according to the adjusted sampling duration and the key scanning duration; Acquire a false touch rate, adjust a sampling duration, acquire sampling count values of different sampling durations, calculate an error through the sampling count values, and determine a second critical value of the sampling duration according to the false touch rate and the error; A final value of the sampling duration is determined according to the first critical value and the second critical value.
[0022] The above-mentioned key scanning duration is preset, and the key scanning duration refers to the time required for a key scan to identify a key operation once.
[0023] Under the same key scan duration, different sampling durations have different sampling count values. For example, under a 30ms key scan duration, the sampling count value of a 10ms sampling duration is half of that of a 20ms sampling duration. Therefore, different sampling durations have different sampling count values, which have different effects. Under the same key scan duration, the higher the sampling duration ratio, the more sampling points, the larger the sampling count value, and the higher the sensitivity of the key recognition operation.
[0024] Therefore, when the sampling duration is approaching the key scanning duration, the sensitivity is continuously improved, and when the sampling duration is almost equal to the key scanning duration, the first critical value can be obtained.
[0025] The above-mentioned touch false touch rate is also preset, and the desired false touch rate can be set according to specific needs. The lower the false touch rate, the higher the accuracy of key recognition required.
[0026] Similarly, under the same key scanning time, different sampling time lengths have different sampling count values, different sensitivities, and different errors. By comparing the errors under different sampling time lengths with the expected touch false touch rate, the closer the error is to the expected touch false touch rate, the higher the accuracy of key recognition.
[0027] Therefore, when the error is approaching the expected false touch rate, the accuracy is continuously improved, and when the error is almost the same as the expected false touch rate, the second critical value can be obtained.
[0028] In summary, the first critical value can indicate the degree of sensitivity, and the second critical value can indicate the degree of accuracy. By comprehensively considering the two, an appropriate numerical choice can be made between sensitivity and accuracy according to specific needs.
[0029] In some embodiments, reference Figure 4 As shown, the above adjustment of the sampling duration, according to the adjusted sampling duration and the key scanning duration, determines the first critical value of the sampling duration, specifically, includes the following steps: S101, setting a first initial value, where the first initial value is a specific sampling duration value, and obtaining a sampling count value; S102, adjusting the first initial value to obtain an adjusted sampling count value; S103, comparing the adjusted sampling count value with the preset sampling count value, and when the adjusted sampling count value is not greater than the preset sampling count value, using the adjusted first initial value as a temporary sampling duration; S104: Compare the temporary sampling duration with the key scanning duration, and repeat steps S102 and S103 until the first critical value is determined.
[0030] The above-mentioned preset sampling count value is preset. According to the foregoing content, the sampling count value is used for sampling counting. During the sampling work of completing the sampling time, each time a sample point is collected, the sampling count value is +1. The sampling count value is related to the number of sampling bits and has a counting range. For example, a 16-bit sampling bit number quantizes the sampling range into 2^16 parts. The maximum value of the sampling count value is 2^16 = 65536. The preset sampling count value must not be greater than the maximum value.
[0031] In the above step S101, the first initial value is the initial sampling duration value, and at the initial sampling duration value, the key is sampled to obtain a sampling count value; in the above step S102, the initial first initial value is adjusted. In some specific embodiments, the adjustment is gradually increased, and at the adjusted first initial value, the key is sampled to obtain a sampling count value.
[0032] In the above step S103, after obtaining the sampling count value, it is necessary to compare it with the preset sampling count value. The reason is that the sampling count value has a range. In order to prevent the overflow of the count from causing inaccurate counting, it is necessary to compare the sampling count value with the maximum sampling count value. When the sampling count value is not greater than the preset sampling count value, the first initial value is used as the temporary sampling duration. In some specific embodiments, the preset sampling count value is less than the maximum sampling count value, and the key press judgment margin needs to be reserved to meet the data processing time requirements.
[0033] Reference Figure 5 As shown, in the above step S104, after obtaining the temporary sampling duration from step S103, the key scanning duration is compared. In some embodiments, step S104 is specifically as follows: S1041, comparing the temporary sampling duration with the key scanning duration; S1042: If the temporary sampling duration is less than or equal to the key scanning duration, repeat steps S102 and S103; S1043: If the temporary sampling duration is greater than the key scanning duration, determine the last temporary sampling duration as the first critical value.
[0034] The temporary sampling duration is continuously updated according to the continuous adjustment of the sampling duration. In short, the sampling duration is adjusted once, and after the comparison condition with the preset sampling count value is met, the temporary sampling duration is updated to the adjusted sampling duration. After the comparison condition with the key scanning duration in step S104 is met, the sampling duration adjustment steps of S102 and the temporary sampling duration update steps of S103 are repeated.
[0035] When the temporary sampling time is longer than the key scanning time, the signal triggered by the key capacitor cannot be detected by the key scanning in time, which will lead to reduced sensitivity. At this time, the sampling time needs to be reduced, and the last temporary sampling time can be determined as the target critical value closest to the key scanning time.
[0036] In some embodiments, reference Figure 6 As shown, the adjusting sampling duration, obtaining sampling count values with different sampling durations, calculating the error through the sampling count values, and determining the second critical value of the sampling duration according to the touch false touch rate and the error, specifically includes the following steps: S201, setting a second initial value, where the second initial value is a specific sampling duration value, obtaining a current sampling count value, and calculating an error; S202, adjusting the second initial value, obtaining an adjusted sampling count value, and calculating an adjusted error; S203: Compare the adjusted error with the false touch rate, and repeat step S202 until the second critical value is determined.
[0037] Similar to the first initial value in the above embodiment, the second initial value is also an initial sampling duration value. The second initial value may be the same as or different from the first initial value, and this embodiment does not impose any specific limitation thereto.
[0038] In the above step S201, the second initial value is the initial sampling duration value. Under the initial sampling duration value, the key is sampled to obtain a sampling count value, and an error calculation is performed based on the sampling count value. The error calculation may include one or more of relative error calculation, variance calculation, and standard deviation calculation. The relative error can reflect the credibility of the sampling count value measurement data, the variance can reflect the smoothness of the sampling count value measurement, and the standard deviation can reflect the discreteness of the sampling count value.
[0039] In some embodiments, when the initial sampling duration value is low, the sampling count value often has a large deviation due to the short sampling time of the capacitance, and since the time used for sampling is short, the margin for judging the press is often very small, which is not conducive to the actual operation of the touch control. Therefore, several sampling count values can be averaged as the sampling count value corresponding to the true value of the capacitance value of the dielectric material.
[0040] In the above step S202, the initial second initial value is adjusted. In some specific embodiments, the adjustment is gradually increased, and at the adjusted second initial value, the key is sampled to obtain a sampling count value, and an error calculation is performed.
[0041] Reference Figure 7 As shown, in the above step S203, after obtaining the error from step S202, the touch error rate is compared. In some embodiments, step S203 is specifically as follows: S2031, comparing the adjusted error with the touch false touch rate; S2032: If the adjusted error is greater than or equal to the touch error rate, repeat step S202; S2033: If the adjusted error is less than or equal to the false touch rate, determine that a second initial value corresponding to the current error is the second critical value.
[0042] Similar to the temporary sampling duration in the above-mentioned embodiment, the error calculated above is continuously updated according to the continuous adjustment of the sampling duration. In short, the sampling duration is adjusted once, and the error corresponding to the sampling duration is calculated. After the comparison condition with the false touch rate in step S203 is met, the sampling duration adjustment and error calculation steps of S202 are repeated.
[0043] When the error is less than or equal to the false touch rate, it means that the corresponding sampling time at this time is sufficient to meet the accuracy requirement, and the current second initial value can be determined as the target critical value.
[0044] After the determination of the first initial value and the second initial value is completed, the final value of the sampling duration needs to be determined based on the first initial value and the second initial value. In some embodiments, the determination method is specifically as follows: According to the first critical value and the second critical value, a set of intersections of the two is obtained, and one element is selected from the set as the final value of the sampling duration.
[0045] For example, the first critical value is 30ms, the second critical value is 20ms, and the intersection thereof is 20-30ms. An appropriate value may be selected between 20-30ms. If the usage scenario places more emphasis on sensitivity and accuracy is also important, any value between 25-30ms may be selected. The higher the sensitivity, the larger the value. If the usage scenario places more emphasis on accuracy and sensitivity cannot be ignored, any value between 20-25ms may be selected. The higher the accuracy, the smaller the value.
[0046] In some embodiments, if there is no intersection between the first critical value and the second critical value, the touch parameters, such as one or more of the key scanning duration, the number of sampling bits, the sampling rate, the touch false touch rate, etc., can be readjusted, and then the touch sampling method provided by the present invention can be re-executed to obtain a suitable intersection set, and finally select an appropriate final sampling duration value.
[0047] In some embodiments, the first critical value is achieved in a pressed state, and the second critical value is achieved in a non-pressed state.
[0048] Reference Figure 8 , which shows the specific process of the above embodiment, which can be specifically divided into three parts: the first part determines the first critical value related to sensitivity; the second part determines the second critical value related to accuracy; the third part determines the final sampling duration value. The specific processes of the three parts are as follows: In the first part, the touch sampling method first obtains the key scanning time and sets the first initial value. When the first initial value is set for the first time, a smaller sampling time can be selected. When the key is in a pressed state, a sampling count value is obtained; then a determination is made as to whether the sampling count value exceeds the preset sampling count value. If so, the setting of the first initial value is unreasonable, the sampling time is too long, and the sampling time needs to be readjusted. Otherwise, the first initial value can be determined as a temporary sampling time for further operation.
[0049] After determining the temporary sampling duration, compare the temporary sampling duration with the key scanning duration. If the temporary sampling duration is less than the key scanning duration, it means that the key scanning duration has not yet been clearly approached, and the sampling duration can be further adjusted, and then the sampling count value is collected, the temporary sampling duration is updated, and the temporary sampling duration is compared with the key scanning duration to finally determine the first critical value; if the temporary sampling duration is equal to the key scanning duration, it can be determined that the sampling duration used at this time is the minimum sampling duration that meets the sensitivity requirement, and the sampling duration is determined to be the first critical value; if the temporary sampling duration is greater than the key scanning duration, it can be determined that the last temporary sampling duration is the first critical value closest to the key scanning duration.
[0050] In the second part, the touch sampling method first obtains the touch false touch rate and sets a second initial value. When the second initial value is set for the first time, the minimum sampling duration can be selected. When the button is not pressed, the sampling count value is obtained, and the error is calculated; then it is determined whether the error meets the touch false touch rate. If the error is greater than the touch false touch rate, it can be determined that the sampling duration at this time does not meet the requirement and the sampling duration needs to be further adjusted. The sampling count value is then collected, the error is updated, and the updated error and the touch false touch rate are compared to finally determine the second critical value that meets the requirement; if the error is less than or equal to the touch false touch rate, it can be determined that the sampling duration used at this time is the minimum sampling duration that meets the accuracy requirement, and the sampling duration is determined to be the second critical value.
[0051] In the third part, after determining the first critical value and the second critical value, it is determined whether there is an intersection between the first critical value and the second critical value. If not, it means that there is no sampling duration that meets both the sensitivity requirements and the accuracy requirements in the current environment, and the touch parameters need to be readjusted, such as re-adjusting one or more of the key scanning duration, the number of sampling bits, the sampling rate, the touch false touch rate, etc., and then executing the touch sampling method provided in this embodiment; if so, select an appropriate element in the intersection according to specific needs as the final sampling duration value, and the requirements can be considered based on the weights of sensitivity and accuracy.
[0052] The above touch sampling method obtains the sampling count value and the key scanning time, adjusts the sampling time to obtain the first critical value, obtains the touch false touch rate, adjusts the sampling time to obtain the second critical value, and determines the final value of the sampling time by the first critical value and the second critical value. Among them, the first critical value can be used as a basis for judging the key sensitivity, and the second critical value can be used as a basis for judging the key accuracy. The comprehensive consideration of the two can shorten the sampling time confirmation and reduce the debugging time cost and development cost under the premise of effectively ensuring the key performance.
[0053] As another aspect of the embodiment of the present application, the embodiment of the present application provides a touch sampling device, wherein the touch sampling device can be a software module, the software module includes a number of instructions, which are stored in a memory, and the processor can access the memory and call the instructions for execution to complete the touch sampling method described in each of the above embodiments.
[0054] In some embodiments, the touch sampling device can be constructed by hardware devices, for example, the touch sampling device can be constructed by one or more chips, and the chips can work in coordination with each other to complete the touch sampling methods described in the above embodiments. For another example, the touch sampling device can also be constructed by a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a single-chip microcomputer, an ARM (Acorn RISC Machine), a programmable logic device, a discrete gate or transistor logic, a discrete hardware component, or any combination of these components.
[0055] In some embodiments, see Fig. 9 The touch sampling device 400 provided in the embodiment of the present application includes a first determination module 301, a second determination module 302 and a third determination module 303. The first determination module 301 is used to determine a first critical value related to sensitivity, the second determination module 302 is used to determine a second critical value related to accuracy, and the third determination module 303 is used to determine a final value of the sampling duration.
[0056] In some embodiments, see Fig.10 The first determination module 301 includes a first judgment unit 3011 and a first determination unit 3012. The first judgment unit 3011 is used to judge whether the sampling duration and the key scanning duration meet the conditions, and the first determination unit 3012 is used to determine the first critical value when the sampling duration and the key scanning duration meet the conditions.
[0057] In some embodiments, see Fig.11 The second determination module 302 includes a second judgment unit 3021 and a second determination unit 3022. The second judgment unit 3021 is used to judge whether the error and the touch error rate meet the condition, and the second determination unit 3022 is used to determine the second critical value when the error and the touch error rate meet the condition.
[0058] In some embodiments, see Fig.12 The third determination module 303 includes a third judgment unit 3031 and a third determination unit 3032. The third judgment unit 3031 is used to judge whether the first critical value and the second critical value have an intersection, and the third determination unit 3032 is used to determine the final value of the sampling duration when the first critical value and the second critical value have an intersection.
[0059] It should be noted that the above touch sampling device can execute the touch sampling method provided in the embodiment of the present application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in the embodiment of the touch sampling device, please refer to the touch sampling method provided in the embodiment of the present application.
[0060] See also Fig.13 , Fig.13 A schematic diagram of the hardware structure of a controller is provided for an embodiment of the present application. Fig.13 As shown, the controller 401 includes one or more processors 4011 and a memory 4012. Fig.13 A processor 4011 is taken as an example.
[0061] The processor 4011 is configured to support the computer device to perform the corresponding functions in the method in the above method embodiment. The processor 4011 can be a central processing unit (CPU), a network processor (NP), a hardware chip or any combination thereof. The above hardware chip can be an application specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The above PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
[0062] The memory 4012 is used to store program codes. The memory 4012 may include a volatile memory (VM), such as a random access memory (RAM); the memory may also include a non-volatile memory (NVM), such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); the memory 4012 may also include a combination of the above-mentioned types of memory.
[0063] The memory 4012 can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions / modules corresponding to the touch sampling method in the embodiment of the present application. The processor 4012 executes various functional applications and data processing of the touch sampling method and the touch sampling device by running the non-volatile software programs, instructions and modules stored in the memory 4012, that is, realizes the functions of the touch sampling method and each module or unit of the touch sampling device provided in the above method embodiment.
[0064] The memory 4012 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required by at least one function. The data storage area may store data created according to the use of the touch sampling device, etc. In some embodiments, the memory 4012 may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the touch sampling device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0065] The one or more modules are stored in the memory 4012, and when executed by the one or more processors 4011, the touch sampling method in any of the above method embodiments is executed, for example, the method steps described in the above method embodiments are executed to realize the functions of the modules described in the above device embodiments.
[0066] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a computer, the computer executes the method described in the above embodiment.
[0067] It is understood by those skilled in the art that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0068] Finally, it should be noted that the present application can be implemented in many different forms and is not limited to the embodiments described in this specification. These embodiments are not intended to be additional limitations on the content of the present application. The purpose of providing these implementation methods is to make the understanding of the disclosure of the present application more thorough and comprehensive. And under the thinking of the present application, the above-mentioned technical features continue to be combined with each other, and there are many other changes in different aspects of the present application as described above, which are all deemed to be within the scope of the present application specification. Further, for those of ordinary skill in the art, improvements or changes can be made according to the above description, and all these improvements and changes should fall within the scope of protection of the claims attached to the present application.
Claims
1. A touch sampling method, characterized in that: include: Obtaining a key scanning duration, adjusting a sampling duration, and determining a first critical value of the sampling duration according to the adjusted sampling duration and the key scanning duration; Acquire a false touch rate, adjust a sampling duration, acquire sampling count values of different sampling durations, calculate an error through the sampling count values, and determine a second critical value of the sampling duration according to the false touch rate and the error; A final value of the sampling duration is determined according to the first critical value and the second critical value.
2. The touch sampling method according to claim 1, characterized in that: The adjusting of the sampling duration, and determining a first critical value of the sampling duration according to the adjusted sampling duration and the key scanning duration, specifically comprises the following steps: S101, setting a first initial value, where the first initial value is a specific sampling duration value, and obtaining a sampling count value under the first initial value; S102, adjusting the first initial value to obtain an adjusted sampling count value; S103, comparing the adjusted sampling count value with the preset sampling count value, and when the adjusted sampling count value is not greater than the preset sampling count value, using the adjusted first initial value as a temporary sampling duration; S104: Compare the temporary sampling duration with the key scanning duration, and repeat steps S102 and S103 until the first critical value is determined.
3. The touch sampling method according to claim 2, characterized in that: The step S104 is specifically as follows: S1041, comparing the temporary sampling duration with the key scanning duration; S1042: If the temporary sampling duration is less than or equal to the key scanning duration, repeat steps S102 and S103; S1043: If the temporary sampling duration is greater than the key scanning duration, determine the last temporary sampling duration as the first critical value.
4. The touch sampling method according to claim 1, characterized in that: The adjusting the sampling duration, obtaining sampling count values with different sampling durations, calculating the error through the sampling count values, and determining the second critical value of the sampling duration according to the touch false touch rate and the error, specifically includes the following steps: S201, setting a second initial value, where the second initial value is a specific sampling duration value, obtaining a current sampling count value, and calculating an error; S202, adjusting the second initial value, obtaining an adjusted sampling count value, and calculating an adjusted error; S203: Compare the adjusted error with the false touch rate, and repeat step S202 until the second critical value is determined.
5. The touch sampling method according to claim 4, characterized in that: The step S203 is specifically as follows: S2031, comparing the adjusted error with the touch false touch rate; S2032: If the adjusted error is greater than or equal to the touch error rate, repeat step S202; S2033: If the adjusted error is less than or equal to the false touch rate, determine that a second initial value corresponding to the current error is the second critical value.
6. The touch sampling method according to any one of claims 1 to 5, characterized in that: The determining of the final value of the sampling duration according to the first critical value and the second critical value is specifically, According to the first critical value and the second critical value, a set of intersections of the two is obtained, and one element is selected from the set as the final value of the sampling duration.
7. The touch sampling method according to claim 6, characterized in that: The adjusting of the sampling duration specifically includes gradually increasing the value of the sampling duration.
8. The touch sampling method according to claim 7, characterized in that: The first critical value is completed in a pressed state, and the second critical value is completed in a non-pressed state.
9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the memory is connected to the processor, and the processor is used to execute one or more computer programs stored in the memory. When the processor executes the one or more computer programs, the electronic device implements the touch sampling method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the touch sampling method according to any one of claims 1 to 8.