Signal Filtering Method, System, Device and Medium Based on Circular Queue Array
Through the signal filtering method of the ring queue array, the problem of inaccurate signal filtering of large-size resistive touch screens is solved, and the precise filtering of touch screen jump points and the reporting of accurate position values is realized, reducing the risk of equipment misoperation.
Patent Information
- Application Number
- CN202411977394.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2044-12-31
AI Technical Summary
When medical staff use large-size resistive touch screens, finger belly pressing operations can easily lead to inaccurate signal filtering, resulting in high risk of misoperation of equipment. Especially when the touch screen click position moves rapidly, it is easy to detect touch point sampling value errors.
The signal filtering method based on the ring queue array is adopted. By storing the identification value initialization, touch point sampling value storage, index value establishment, deviation value calculation and threshold judgment, the first few pressed touch screen and the first few touch point sampling values before the pop-up are automatically filtered, and the middle point of the ring queue array is selected for comparison, so as to adapt to the rapid movement and change of the touch screen click position.
It realizes accurate filtering of touch screen jump points, accurately reporting touch-press position values, reducing the risk of equipment misoperation.
Smart Images

Figure CN119400383B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the technical field of medical device touch screens, and particularly to a signal filtering method, system, device and medium based on a circular queue array. Background Art
[0002] An extracorporeal membrane oxygenation (ECMO) device is a high-risk medical device used for extracorporeal life support. When using a large-sized resistive touch screen, it is easy for medical staff to cause jump points and inaccurate pressing position values when pressing the screen with the fingertip, resulting in a high risk of incorrect device operation, which can easily cause psychological pressure on medical staff and doubts about the safety and stability of the device.
[0003] Especially when the user presses the screen with the fingertip, it is often the case that the click position on the touch screen changes rapidly. In this case, it is easier for many effective touch point sampling values to be filtered out due to incorrect recognition when the touch screen click position changes. Summary of the Invention
[0004] Therefore, the embodiments of the present invention provide a signal filtering method, system, device and medium based on a circular queue array to solve the technical problem that it is easy for medical staff to cause inaccurate signal filtering when pressing a large-sized resistive touch screen with the fingertip.
[0005] In order to achieve the above object, the embodiments of the present invention provide the following technical solutions:
[0006] According to the first aspect of the embodiments of the present invention, the embodiments of the present application provide a signal filtering method based on a circular queue array, the method comprising:
[0007] Setting a storage identification value for the circular queue array and initializing the storage identification value to a first initial value;
[0008] Obtaining each touch point sampling value and sequentially storing it into the circular queue array;
[0009] Establishing a corresponding first index value for each touch point sampling value in sequence and initializing the corresponding first valid point number to a second initial value;
[0010] Judging whether the first index value corresponding to the current touch point sampling value meets a first preset condition;
[0011] If the first index value corresponding to the current touch point sampling value meets the first preset condition, then setting the storage identification value to an updated value;
[0012] Determining a first median sampling value corresponding to the stored values in the current circular queue array and taking the remaining stored values as first reference point sampling values;
[0013] Calculate the sum of squares of the first deviation values between the current first median sample value and each first reference point sample value;
[0014] Judgment is made one by one to determine whether each sum of squares of the first deviation values is less than a first preset threshold;
[0015] If the sum of squares of the first deviation values is less than the first preset threshold, increase the first effective point number corresponding to the current first median sample value by 1, otherwise keep the first effective point number corresponding to the current first median sample value unchanged;
[0016] Obtain the first final value of the first effective point number corresponding to the current first median sample value, and judge whether the first final value is less than a second preset threshold;
[0017] If the first final value is greater than or equal to the second preset threshold, determine that the current first median sample value is a valid value and report it;
[0018] If the first final value is less than the second preset threshold, determine that the current first median sample value is an invalid value.
[0019] Further, corresponding first index values are established for each touch point sample value in sequence, including:
[0020] Determine the first index value corresponding to the first touch point sample value as 0 and increase it by 1 in sequence as the first index value corresponding to the subsequent touch point sample values;
[0021] Judge whether the first index value corresponding to the current touch point sample value reaches the index maximum value; wherein, the index maximum value takes the value obtained by subtracting 1 from the preset array length of the circular queue array;
[0022] If the first index value corresponding to the current touch point sample value reaches the index maximum value, update the first index value corresponding to the next touch point sample value to 0;
[0023] If the first index value corresponding to the current touch point sample value does not reach the index maximum value, increase the current first index value by 1 and update it as the first index value corresponding to the next touch point sample value.
[0024] Further, determine the first median sample value corresponding to the values already stored in the current circular queue array, including:
[0025] Calculate the second index value of the first median sample value based on the first index value corresponding to the current touch point sample value;
[0026] Select the already stored touch point sample value corresponding to the second index value as the first median sample value;
[0027] The calculation formula for the second index value is as follows:
[0028] middleIdx1 = (filterIdx1 + [MAX_P / 2]) % MAX_P
[0029] where middleIdx1 is the second index value, filterIdx1 is the first index value corresponding to the current touch point sampling value, MAX_P is the length of the circular queue array, "[]" is the integer operation, and "%" is the modulo operation.
[0030] Furthermore, the signal filtering method based on the circular queue array further includes:
[0031] After entering the interrupt function, assign the reporting flag value to an invalid assignment;
[0032] When the first valid value is reported, set the reporting flag value to a valid assignment;
[0033] After updating the first index value corresponding to the next touch point sampling value, monitor whether the interrupt signal is cancelled;
[0034] If the interrupt signal is cancelled, perform the touch screen bounce-up process, exit the interrupt function, and continue to monitor the interrupt signal generated by the touch screen press in real time;
[0035] If the interrupt signal is not cancelled, continue to receive the next touch point sampling value.
[0036] Furthermore, performing the touch screen bounce-up process includes:
[0037] Based on the reporting flag value, determine whether a touch point sampling value has been reported before;
[0038] If the reporting flag value is a valid assignment, it is determined that a touch point sampling value has been reported before, and directly exit the interrupt function;
[0039] If the reporting flag value is an invalid assignment, it is determined that a touch point sampling value has not been reported before, and judge whether the current storage flag value is the first initial value;
[0040] If the current storage flag value is not the first initial value, directly exit the interrupt function;
[0041] If the current storage flag value is the first initial value, determine the second median sampling value corresponding to the stored values in the current circular queue array and take the remaining stored values as the second reference point sampling values;
[0042] Calculate the sum of the squares of the second deviation values between the current second median sampling value and each second reference point sampling value;
[0043] Judging one by one whether the sum of squares of each second deviation value is less than a first preset threshold;
[0044] If the sum of squares of the second deviation value is less than the first preset threshold, then increase by 1 the first valid point number corresponding to the current second median sampling value, otherwise keep unchanged the first valid point number corresponding to the current second median sampling value;
[0045] Obtaining a second final value corresponding to the current second median sampling value, and judging whether the second final value is less than or equal to a third preset threshold;
[0046] If the second final value is less than or equal to the third preset threshold, then directly exit the interrupt function;
[0047] If the second final value is greater than the third preset threshold, then report the current second median sampling value and exit the interrupt function.
[0048] Further, the first formula for the sum of squares of the first deviation value is:
[0049] DV1 = (middleIdx.x1 - preIdx.x1) 2 +(middleIdx.y1 - preIdx.y1) 2
[0050] where DV1 is the sum of squares of the first deviation value, middleIdx.x1 is the abscissa value in the first median sampling value, middleIdx.y1 is the ordinate value in the first median sampling value, preIdx.x1 is the abscissa value in the current first reference point sampling value, and preIdx.y1 is the ordinate value in the current first reference point sampling value;
[0051] The second formula for the sum of squares of the second deviation value is:
[0052] DV2 = (middleIdx.x2 - preIdx.x2) 2 +(middleIdx.y2 - preIdx.y2) 2
[0053] where DV2 is the sum of squares of the second deviation value, middleIdx.x2 is the abscissa value in the second median sampling value, middleIdx.y2 is the ordinate value in the second median sampling value, preIdx.x2 is the abscissa value in the current second reference point sampling value, and preIdx.y2 is the ordinate value in the current second reference point sampling value.
[0054] Further, determining the second median sampling value corresponding to the stored values in the current circular queue array includes:
[0055] Calculate a third index value of the second median sample value based on a first index value corresponding to a last stored touch point sample value;
[0056] Select a stored touch point sample value corresponding to the third index value as the second median sample value;
[0057] The calculation formula of the third index value is:
[0058] middleIdx2 = [filterIdx2 / 2]
[0059] Where middleIdx2 is the third index value, filterIdx2 is the first index value corresponding to the last stored touch point sample value, and "[]" is the integer operation.
[0060] According to the second aspect of the embodiments of the present invention, embodiments of the present application provide a signal filtering system based on a circular queue array. The system includes:
[0061] An initialization module, configured to set a storage identification value for the circular queue array and initialize the storage identification value to a first initial value;
[0062] A storage module, configured to obtain each touch point sample value and sequentially store it into the circular queue array; sequentially establish a corresponding first index value for each touch point sample value and initialize a corresponding first valid point number to a second initial value;
[0063] A filtering module, configured to perform the following steps:
[0064] Determine whether a first index value corresponding to a current touch point sample value meets a first preset condition;
[0065] If the first index value corresponding to the current touch point sample value meets the first preset condition, set the storage identification value to an update value;
[0066] Determine a first median sample value corresponding to the currently stored values in the circular queue array and use the remaining stored values as first reference point sample values;
[0067] Calculate a sum of squares of first deviation values between the current first median sample value and each first reference point sample value;
[0068] Judging one by one whether each sum of squares of first deviation values is less than a first preset threshold;
[0069] If the sum of squares of the first deviation values is less than the first preset threshold, increase the first valid point number corresponding to the current first median sample value by 1, otherwise keep the first valid point number corresponding to the current first median sample value unchanged;
[0070] Obtain the first final value of the first effective number of points corresponding to the current first median sampling value, and determine whether the first final value is less than a second preset threshold;
[0071] If the first final value is greater than or equal to the second preset threshold, determine that the current first median sampling value is a valid value and report it;
[0072] If the first final value is less than the second preset threshold, determine that the current first median sampling value is an invalid value.
[0073] According to the third aspect of the embodiments of the present invention, there is provided a signal filtering device based on a circular queue array, the device includes: a processor and a memory;
[0074] The memory is used to store one or more program instructions;
[0075] The processor is used to run one or more program instructions to execute the steps of the signal filtering method based on the circular queue array as described in any one of the above.
[0076] According to the fourth aspect of the embodiments of the present invention, there is provided a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the signal filtering method based on the circular queue array as described in any one of the above are implemented.
[0077] Compared with the prior art, the signal filtering method, system, device and medium based on the circular queue array provided by the embodiments of the present application use the circular queue array to store the received touch point sampling values, take the middle value and compare it with the other front and rear values in the circular queue array. On the one hand, the first few touch point sampling values before the touch screen is pressed and the first few touch point sampling values before the touch screen bounces are automatically filtered, effectively removing the jitter during pressing and bouncing. On the other hand, the selected points are located in the middle of the circular queue array, and the adjacent front and rear points are compared, which is suitable for the situation where the click position on the touch screen changes rapidly, reducing the situation of being wrongly filtered due to position changes. The embodiments of the present invention are applicable to the field of medical devices, can accurately filter the jump points of the touch screen, realize accurate reporting of the touch press position value, and reduce the risk of misoperation of the device. Description of the Drawings
[0078] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only exemplary, and for those of ordinary skill in the art, without creative efforts, other implementation drawings can be obtained according to the provided drawings.
[0079] The structures, proportions, sizes, etc. illustrated in this specification are only used to cooperate with the content disclosed in the specification for those familiar with this technology to understand and read, and are not used to limit the conditions for the implementation of the present invention. Therefore, they do not have substantial technical significance. Any modification of the structure, change in the proportional relationship, or adjustment of the size, without affecting the efficacy that the present invention can produce and the purpose that can be achieved, should still fall within the scope that the technical content disclosed by the present invention can cover.
[0080] Figure 1 It is a schematic logical structure diagram of a signal filtering system based on a circular queue array provided by an embodiment of the present invention;
[0081] Figure 2 It is a schematic flow diagram of a signal filtering method based on a circular queue array provided by an embodiment of the present invention;
[0082] Figure 3 It is a schematic flow diagram of obtaining sampling values of each touch point provided by an embodiment of the present invention;
[0083] Figure 4 It is a schematic flow diagram of successively establishing corresponding first index values for the sampling values of each touch point provided by an embodiment of the present invention;
[0084] Figure 5 It is a schematic flow diagram of performing touch screen lift processing provided by an embodiment of the present invention. Specific Embodiments
[0085] The following specific embodiments illustrate the implementation manners of the present invention. Those familiar with this technology can easily understand other advantages and effects of the present invention from the content disclosed in this specification. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts belong to the scope protected by the present invention.
[0086] The purpose in the embodiments of the present invention is to: when pressing a large-size resistive touch screen with the finger pulp, use the storage method of a circular queue array to filter out jump points with relatively large deviations and sampling values with inaccurate pressing position values.
[0087] To solve the above technical problems, as Figure 1 shown, the embodiments of the present application provide a signal filtering system based on a circular queue array, and this system is applied to medical devices, especially ECMO (Extracorporeal Membrane Oxygenation) devices.
[0088] Specifically, the signal filtering system based on the circular queue array provided by the embodiments of the present application includes: an initialization module 1, a storage module 2, and a filtering module 3.
[0089] The initialization module 1 is used to set a storage identification value for the circular queue array and initialize the storage identification value to a first initial value.
[0090] The storage module 2 is used to receive the sampling values of each touch point and store them into the circular queue array in sequence; establish corresponding first index values for the sampling values of each touch point in sequence and initialize the corresponding first valid point numbers to a second initial value.
[0091] The filtering module 3 is used to perform the following steps: determine whether the first index value corresponding to the current touch point sampling value meets a first preset condition; if the first index value corresponding to the current touch point sampling value meets the first preset condition, set the storage identification value to an updated value; determine the first median sampling value corresponding to the stored values in the current circular queue array and take the remaining stored values as the first reference point sampling values; calculate the sum of the squares of the first deviation values between the current first median sampling value and each first reference point sampling value; judge one by one whether each sum of the squares of the first deviation values is less than a first preset threshold; if the sum of the squares of the first deviation values is less than the first preset threshold, increase the first valid point number corresponding to the current first median sampling value by 1, otherwise keep the first valid point number corresponding to the current first median sampling value unchanged; obtain the first final value of the first valid point number corresponding to the current first median sampling value and judge whether the first final value is less than a second preset threshold; if the first final value is greater than or equal to the second preset threshold, determine that the current first median sampling value is a valid value and report it; if the first final value is less than the second preset threshold, determine that the current first median sampling value is an invalid value.
[0092] Compared with the prior art, the signal filtering system based on the circular queue array provided by the embodiments of the present application uses a circular queue array to store the received touch point sampling values, takes the middle value and compares it with the remaining front and back values in the circular queue array. On the one hand, it automatically filters the first few touch point sampling values when the touch screen is pressed and the first few touch point sampling values before the touch screen bounces, effectively removing the jitter when pressing and bouncing. On the other hand, the selected points are located in the middle of the circular queue array, and the adjacent front and back points are compared, which is suitable for the situation where the click position of the touch screen changes rapidly, reducing the situation of being wrongly filtered due to position changes. The embodiments of the present invention are applicable to the field of medical devices, can accurately filter the jump points of the touch screen, realize accurate reporting of the touch press position value, and reduce the risk of misoperation of the device. The embodiments of the present invention are applicable to the field of medical devices, can accurately filter the jump points of the touch screen, realize accurate reporting of the touch press position value, and reduce the risk of misoperation of the device.
[0093] Corresponding to the above - disclosed signal filtering system based on a circular queue array, an embodiment of the present invention also discloses a signal filtering method based on a circular queue array. The following details the signal filtering method based on a circular queue array disclosed in the embodiments of the present invention in combination with the above - described signal filtering system based on a circular queue array.
[0094] In an embodiment of the present application, a circular queue array with a specific length is mainly used to store the received touch - point sampling values. If the sum of the squared deviation values of the median sampling value in the circular queue array from the other touch - point sampling values is less than a first preset threshold, the valid point number of the median sampling value is incremented by 1; otherwise, the valid point number of the median sampling value is not incremented. When all the values in the circular queue array have been compared, if the valid point number of the median sampling value is greater than a second preset threshold, the median sampling value is considered a valid value and reported to the operating system; otherwise, it is an invalid value and not reported.
[0095] As Figure 2 shown, the following details the specific steps of the signal filtering method based on a circular queue array provided in an embodiment of the present application.
[0096] The signal filtering method based on a circular queue array provided in an embodiment of the present application is applied to medical devices, especially ECMO (Extracorporeal Membrane Oxygenation) devices.
[0097] The initialization module 1 sets a storage identification value for the circular queue array and initializes the storage identification value to a first initial value.
[0098] In an embodiment of the present application, the storage identification value is used as a flag indicating that the first ring of the circular queue array is full. The storage identification value is denoted as bFirst, and the above - mentioned first initial value is 1.
[0099] The storage module 2 obtains each touch - point sampling value and stores them in the circular queue array in sequence.
[0100] Referring to Figure 3 , in an embodiment of the present application, the steps of obtaining each touch - point sampling value specifically include: real - time monitoring of the interrupt signal generated by the touch - screen press; if the interrupt signal is not detected, continue to perform real - time monitoring of the interrupt signal generated by the touch - screen press; if the interrupt signal is detected, enter a pre - set interrupt function and collect the touch - point sampling value according to a preset sampling period to obtain the touch - screen press signal.
[0101] In an embodiment of the present invention, the preset sampling period can be set to 1 ms. In this way, after entering the touch - screen interrupt function, the original touch - screen value is sampled every 1 ms, and the original touch - screen value is the touch - point sampling value.
[0102] Further, real-time monitoring is performed on the interrupt signal generated by touch screen pressing, including: real-time detecting the level of the touch screen interrupt pin; if the level of the touch screen interrupt pin is high, it is determined that no interrupt signal is detected, and the level of the touch screen interrupt pin is continuously detected in real time; if the level of the touch screen interrupt pin is low, it is determined that an interrupt signal is detected, and the preset interrupt function is entered.
[0103] When the touch screen is pressed, the interrupt pin of the touch screen IC (Integrated Circuit) generates an interrupt signal, and the interrupt signal continuously occurs during the pressing. When the interrupt signal generated by touch screen pressing occurs, the storage module 2 immediately receives the interrupt signal and immediately starts the interrupt program corresponding to the touch screen IC driver, and enters the preset interrupt function.
[0104] In the embodiment of the present application, a circular queue array is used to store touch point sampling values, and the specific steps include: initializing the circular queue array; each time a touch point sampling value is sampled, the current touch point sampling value is stored in the storage bit corresponding to the current index value of the initialized circular queue array.
[0105] In the embodiment of the present invention, specifically, the tscFilterArray array is used as the circular queue array for storing the sampled touch point sampling values. The length of the tscFilterArray array is set to MAX_P. Preferably, the preset array length of the circular queue array is greater than or equal to 6 and less than or equal to 10, that is, the value range of MAX_P can be set to be greater than or equal to 6 and less than or equal to 10.
[0106] If the preset array length of the circular queue array is too short, the number of comparison sampling values will be too small, resulting in too many missed filtered jump points and still a relatively high screen jump point rate. If the preset array length of the circular queue array is too long, the storage time interval between the current touch point sampling value and the last touch point sampling value in the circular queue array will be too long, and at this time, the large deviation of the comparison result may not be caused by jump points. Therefore, considering the above situations comprehensively, it is more appropriate for the preset array length MAX_P of the circular queue array to take a range greater than or equal to 6 and less than or equal to 10.
[0107] The storage module 2 sequentially establishes corresponding first index values for each touch point sampling value.
[0108] Reference Figure 4, in the embodiment of the present application, the step of receiving the sampling values of each touch point specifically includes: determining the first index value corresponding to the first touch point sampling value as 0 and sequentially increasing it by 1 as the first index value corresponding to the subsequent touch point sampling values; determining whether the first index value corresponding to the current touch point sampling value reaches the maximum index value; if the first index value corresponding to the current touch point sampling value reaches the maximum index value, updating the first index value corresponding to the next touch point sampling value to 0; if the first index value corresponding to the current touch point sampling value does not reach the maximum index value, updating the current first index value by increasing it by 1 as the first index value corresponding to the next touch point sampling value.
[0109] In the embodiment of the present application, the maximum index value is taken as the value obtained by subtracting 1 from the preset array length of the circular queue array. The first index value of the current touch point sampling value is filterIdx1. In the initial stage of sampling the touch point sampling values, each time a touch point sampling value is sampled, the current touch point sampling value is stored at the position corresponding to the first index value filterIdx1 in the circular queue array tscFilterArray, and then the first index value filterIdx1 is incremented by 1 backward.
[0110] The direction of the circular queue array is two-way. In the embodiment of the present invention, the forward direction of the circular queue array is the direction in which the first index value decreases sequentially. When the index is 0, the next first index value forward is the maximum index value in the circular queue array (i.e., the first index value obtained by subtracting 1 from MAX_P). The backward direction of the circular queue array is the direction in which the first index value increases sequentially. When the index is the maximum index value in the circular queue array (i.e., the first index value obtained by subtracting 1 from MAX_P), the next first index value backward is the first index value 0 at the head of the circular queue array. The first index values of the circular queue array are 0, 1, 2,..., MAX_P - 1.
[0111] Initialize the corresponding first valid point count to the second initial value through the storage module 2.
[0112] In the embodiment of the present application, slidecount is used as the effective slide point count. That is to say, the first valid point count is denoted as slidecount. Before comparing the first median sampling value with the remaining stored touch point sampling values in the circular queue array, slidecout is first initialized to the second initial value, and the second initial value is 0.
[0113] Determine whether the first index value corresponding to the current touch point sampling value meets the first preset condition through the filtering module 3.
[0114] In the embodiment of the present application, the first preset condition is that the first index value corresponding to the current touch point sampling value is equal to the index maximum value for the first time. If the first index value corresponding to the current touch point sampling value does not meet the first preset condition, the storage identification value is maintained as 1, and the next touch point sampling value is continuously received. If the first index value corresponding to the current touch point sampling value meets the first preset condition, the storage identification value is set to the update value. Further, the update value is 0, that is, when filterIdx1 is equal to the value of MAX_P minus 1 for the first time, bFirst is set to 0.
[0115] The filtering module 3 determines the first median sampling value corresponding to the stored numerical values in the current circular queue array and takes the remaining stored numerical values as the first reference point sampling values.
[0116] In the embodiment of the present application, the specific steps for determining the first median sampling value corresponding to the stored numerical values in the current circular queue array include: calculating the second index value of the first median sampling value based on the first index value corresponding to the current touch point sampling value; selecting the stored touch point sampling value corresponding to the second index value as the first median sampling value.
[0117] Further, the calculation formula for the second index value is:
[0118] middleIdx1 = (filterIdx1 + [MAX_P / 2]) % MAX_P
[0119] where middleIdx1 is the second index value, filterIdx1 is the first index value corresponding to the current touch point sampling value, MAX_P is the length of the circular queue array, "[]" is the rounding operation, and "%" is the remainder operation.
[0120] Specifically, in the embodiment of the present application, the rounding operation can be either rounding up. For example, when MAX_P is 7 and the first index value filterIdx1 corresponding to the current touch point sampling value is 0, the calculation result of the second index value middleIdx1 is 4. The rounding operation can also be rounding down. For example, when MAX_P is 7 and the first index value filterIdx1 corresponding to the current touch point sampling value is 0, the calculation result of the second index value middleIdx1 is 3.
[0121] The filtering module 3 calculates the sum of the squares of the first deviation values between the current first median sampling value and each first reference point sampling value.
[0122] Specifically, the first formula for the sum of the squares of the first deviation values is:
[0123] DV1 = (middleIdx.x1 - preIdx.x1) 2+(middleIdx.y1 - preIdx.y1) 2
[0124] Wherein, DV1 is the sum of squares of the first deviation values, middleIdx.x1 is the abscissa value in the first median sampling value, middleIdx.y1 is the ordinate value in the first median sampling value, preIdx.x1 is the abscissa value in the current first reference point sampling value, and preIdx.y1 is the ordinate value in the current first reference point sampling value.
[0125] The filtering module 3 judges one by one whether each sum of squares of the first deviation values is less than the first preset threshold.
[0126] Further, the value algorithm formula of the first preset threshold is:
[0127] OFFSET_LIMIT = N 2
[0128] Wherein, OFFSET_LIMIT is the value of the first preset threshold, and N is the number of deviation pixel points.
[0129] For example, in an embodiment of the present application, the number of deviation pixel points N is taken as 15, that is, OFFSET_LIMIT = 15 2 = 225.
[0130] Specifically, the algorithm for the number of deviation pixel points N is as follows:
[0131] The diameter of each pixel point = the length of the display screen on the X-axis / the X-axis resolution of the LCD = the length of the display screen on the Y-axis / the Y-axis resolution of the LCD
[0132] The size of a 10-inch display screen is 245.76 cm × 184.32 cm, and the corresponding resolution is 1024 × 768. In the horizontal direction: 245.76 cm / 1024 = 0.24 cm, in the vertical direction: 184.32 cm / 768 = 0.24 cm, that is, the diameter of each pixel point is 0.24 cm. The deviation distance is taken to be greater than or equal to 3 cm and less than or equal to 5 cm (about the range of a finger pulp). At this time, the number of deviation pixel points = the deviation distance / the diameter of each pixel point, that is, the number of deviation pixel points is taken to be greater than or equal to 13 and less than or equal to 21, and the first preset threshold (deviation square limit value) is taken to be greater than or equal to 169 and less than or equal to 441.
[0133] If the sum of squares of the first deviation value is less than the first preset threshold, the first valid point number corresponding to the current first median sampling value is increased by 1, otherwise the first valid point number corresponding to the current first median sampling value remains unchanged.
[0134] Specifically, slidecount is used as the first effective point count. The effective point count can also be referred to as the effective slide point count. Before comparing the current first median sampling value with the first reference point sampling value in the circular queue array, slidecount is first initialized to 0.
[0135] The first final value of the first effective point count corresponding to the current first median sampling value is obtained through the filtering module 3.
[0136] Preferably, in the embodiment of the present application, based on the second index value, the corresponding touch point sampling value is taken one position forward in turn as the current first reference point sampling value; until the first index value corresponding to the taken touch point sampling value is equal to the second index value, the first final value of the first effective point count corresponding to the current first median sampling value is obtained.
[0137] The filtering module 3 determines whether the first final value is less than the second preset threshold.
[0138] In the embodiment of the present invention, the second preset threshold is denoted as VALID_P. If the value of VALID_P is too small, the reported jump point rate will still be too high; if the value of VALID_P is too high, too many touch point sampling values will be filtered out, resulting in too few reported touch point sampling values. Considering comprehensively, as described above, the range of the second preset threshold VALID_P of the effective point count limit value is greater than or equal to the first difference (the value obtained by subtracting 4 from MAX_P) and less than or equal to the second difference (the value obtained by subtracting 2 from MAX_P). For example, in an embodiment of the present application, the preset array length MAX_P of the circular queue array is taken as 6, and the corresponding second preset threshold VALID_P is taken as 3.
[0139] If the first final value is greater than or equal to the second preset threshold, it is determined that the current first median sampling value is a valid value and reported; if the first final value is less than the second preset threshold, it is determined that the current first median sampling value is an invalid value.
[0140] In addition, after entering the interrupt function, the reporting flag value is assigned an invalid assignment; when the first valid value is reported for the first time, the reporting flag value assignment is set to a valid assignment.
[0141] Preferably, in the embodiment of the present application, after updating the first index value corresponding to the next touch point sampling value, it is monitored whether the interrupt signal is cancelled; if the interrupt signal is cancelled, the touch screen lift - up process is executed, the interrupt function is exited, and the interrupt signal generated by the touch screen press is continuously monitored in real - time; if the interrupt signal is not cancelled, the next touch point sampling value is continuously received.
[0142] Reference Figure 5 , in the embodiment of the present application, the following details the specific steps of the above - mentioned touch screen lift - up process.
[0143] First, determine whether the touch point sampling value has been reported before based on the reported identification value; if the reported identification value is a valid assignment, it is determined that the touch point sampling value has been reported before, and the interrupt function is directly exited; if the reported identification value is an invalid assignment, it is determined that the touch point sampling value has not been reported before, and it is judged whether the current storage identification value is the first initial value; if the current storage identification value is not the first initial value, the interrupt function is directly exited; if the current storage identification value is the first initial value, determine the second median sampling value corresponding to the value stored in the current circular queue array and take the remaining stored values as the second reference point sampling values.
[0144] In the embodiment of the present application, the specific steps for determining the second median sampling value corresponding to the value stored in the current circular queue array include: calculating the third index value of the second median sampling value based on the first index value corresponding to the last stored touch point sampling value; selecting the stored touch point sampling value corresponding to the third index value as the second median sampling value;
[0145] Further, the calculation formula for the third index value is:
[0146] middleIdx2 = [filterIdx2 / 2]
[0147] where middleIdx2 is the third index value, filterIdx2 is the first index value corresponding to the last stored touch point sampling value, and "[]" is the rounding operation.
[0148] Specifically, in the embodiment of the present application, the rounding operation can either adopt rounding up. For example, when the first index value filterIdx2 corresponding to the last stored touch point sampling value is 7, the calculation result of the third index value middleIdx2 is 4. The rounding operation can also adopt rounding down. For example, when the first index value filterIdx2 corresponding to the last stored touch point sampling value is 7, the calculation result of the third index value middleIdx2 is 3. It should be noted that the rounding operations in the calculation formulas of the second index value and the third index value need to be consistent, that is, when the rounding operation in the calculation formula of the second index value adopts rounding up, the rounding operation in the calculation formula of the third index value also adopts rounding up, and when the rounding operation in the calculation formula of the second index value adopts rounding down, the rounding operation in the calculation formula of the third index value also adopts rounding down.
[0149] Then, calculate the sum of the squares of the second deviation values between the current second median sampling value and each second reference point sampling value.
[0150] Specifically, the second formula for the sum of the squares of the second deviation values is:
[0151] DV2 = (middleIdx.x2 - preIdx.x2) 2 + (middleIdx.y2 - preIdx.y2) 2
[0152] Where DV2 is the sum of squares of the second deviation values, middleIdx.x2 is the abscissa value in the second median sampling value, middleIdx.y2 is the ordinate value in the second median sampling value, preIdx.x2 is the abscissa value in the current second reference point sampling value, and preIdx.y2 is the ordinate value in the current second reference point sampling value.
[0153] Next, determine one by one whether each sum of squares of the second deviation values is less than the first preset threshold; if the sum of squares of the second deviation values is less than the first preset threshold, increase the first effective point count corresponding to the current second median sampling value by 1, otherwise keep the first effective point count corresponding to the current second median sampling value unchanged; obtain the second final value corresponding to the current second median sampling value, and determine whether the second final value is less than or equal to the third preset threshold. In the embodiment of the present invention, the third preset threshold can be taken as 2; if the second final value is less than or equal to the third preset threshold, directly exit the interrupt function; if the second final value is greater than the third preset threshold, report the current second median sampling value and exit the interrupt function.
[0154] Compared with the prior art, the signal filtering method based on a circular queue array provided by the embodiment of the present application uses a circular queue array to store the received touch point sampling values, takes the middle value and compares it with the remaining front and back values in the circular queue array. On the one hand, it automatically filters the first few touch point sampling values when the touch screen is pressed and the first few touch point sampling values before the touch screen bounces, effectively removing the jitter when pressing and bouncing. On the other hand, the selected points are located in the middle of the circular queue array, and the adjacent front and back points are compared, which is suitable for the situation where the click position on the touch screen changes rapidly, reducing the situation of being wrongly filtered due to position changes. The embodiment of the present invention is applicable to the field of medical devices, can accurately filter the jump points of the touch screen, realize accurate reporting of the touch press position value, and reduce the risk of misoperation of the device.
[0155] In addition, the embodiment of the present invention also provides a signal filtering device based on a circular queue array. The device includes: a processor and a memory; the memory is used to store one or more program instructions; the processor is used to run one or more program instructions to execute the steps of the signal filtering method based on a circular queue array as described in any one of the above.
[0156] In addition, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the signal filtering method based on a circular queue array as described in any one of the above are implemented.
[0157] In an embodiment of the present invention, the processor may be an integrated circuit chip with the ability to process signals. The processor may be a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0158] It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present invention can be directly embodied as being executed by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The processor reads the information in the storage medium and combines its hardware to complete the steps of the above method.
[0159] The storage medium may be a memory, for example, it may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories.
[0160] Among them, the non-volatile memory may be a read-only memory (ROM), a programmable ROM (PROM), an erasable programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), or a flash memory.
[0161] The volatile memory may be a Random Access Memory (RAM) which serves as an external cache. By way of example but not limitation, many forms of RAM are available, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM).
[0162] The storage media described in the embodiments of the present invention are intended to include, but not limited to, these and any other suitable types of memories.
[0163] Those skilled in the art should be able to realize that in one or more of the above examples, the functions described in the present invention can be implemented by a combination of hardware and software. When applying software, the corresponding functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. The computer-readable medium includes computer storage media and communication media, where the communication media includes any medium that facilitates the transfer of a computer program from one place to another. The storage media can be any available medium that can be accessed by a general or special purpose computer.
[0164] Although the present invention has been described in detail with general descriptions and specific embodiments above, based on the present invention, some modifications or improvements can be made, which are obvious to those skilled in the art. Therefore, these modifications or improvements made without departing from the spirit of the present invention all fall within the scope of the present invention claimed.
Claims
1. A signal filtering method based on a circular queue array, characterized in that The method includes: Setting a storage identification value for the circular queue array and initializing the storage identification value to a first initial value; Obtaining each touch point sampling value and sequentially storing the touch point sampling values into the circular queue array; Sequentially establishing corresponding first index values for each touch point sampling value and initializing the corresponding first valid point count to a second initial value; Judging whether the first index value corresponding to the current touch point sampling value meets a first preset condition, where the first preset condition is that the first index value corresponding to the current touch point sampling value is equal to the index maximum value for the first time; If the first index value corresponding to the current touch point sampling value meets the first preset condition, then setting the storage identification value to an updated value; determining the first median sampling value corresponding to the stored values in the current circular queue array and taking the remaining stored values as the first reference point sampling values; Calculating the sum of squares of the first deviation values between the current first median sampling value and each of the first reference point sampling values; Judging one by one whether each sum of squares of the first deviation values is less than a first preset threshold; If the sum of squares of the first deviation values is less than the first preset threshold, then increasing the first valid point count corresponding to the current first median sampling value by 1, otherwise keeping the first valid point count corresponding to the current first median sampling value unchanged; Obtaining a first final value of the first valid point count corresponding to the current first median sampling value and judging whether the first final value is less than a second preset threshold; If the first final value is greater than or equal to the second preset threshold, then determining that the current first median sampling value is a valid value and reporting it; If the first final value is less than the second preset threshold, then determining that the current first median sampling value is an invalid value.
2. The signal filtering method based on a circular queue array according to claim 1, wherein Sequentially establishing corresponding first index values for each touch point sampling value, including: Determining the first index value corresponding to the first touch point sampling value as 0 and sequentially increasing it by 1 as the first index value corresponding to subsequent touch point sampling values; Judging whether the first index value corresponding to the current touch point sampling value reaches the index maximum value; where the index maximum value takes the value obtained by subtracting 1 from the preset array length of the circular queue array; If the first index value corresponding to the current touch point sampling value reaches the index maximum value, then updating the first index value corresponding to the next touch point sampling value to 0; If the first index value corresponding to the current touch point sampling value does not reach the index maximum value, then increasing the current first index value by 1 and updating it to the first index value corresponding to the next touch point sampling value.
3. The signal filtering method based on a circular queue array according to claim 2, wherein Determining the first median sampling value corresponding to the stored values in the current circular queue array, including: Calculating a second index value of the first median sampling value based on the first index value corresponding to the current touch point sampling value; Selecting the stored touch point sampling value corresponding to the second index value as the first median sampling value; The calculation formula for the second index value is: middleIdx1 = (filterIdx1 + [MAX_P / 2]) % MAX_P where middleIdx1 is the second index value, filterIdx1 is the first index value corresponding to the current touch point sampling value, MAX_P is the length of the circular queue array, "[]” is the integer operation, and "%” is the modulo operation.
4. The signal filtering method based on a circular queue array according to claim 3, wherein The method further includes: After entering the interrupt function, assign an invalid value to the reporting identification value; After the first valid value is reported, set the reporting identification value to a valid value; After updating the first index value corresponding to the sampling value of the next touch point, monitor whether the interrupt signal is cancelled; If the interrupt signal is cancelled, perform the touch screen lift processing, exit the interrupt function, and continue to monitor the interrupt signal generated by the touch screen press in real time; If the interrupt signal is not cancelled, continue to receive the sampling value of the next touch point.
5. The signal filtering method based on a circular queue array according to claim 4, wherein Performing the touch screen lift processing includes: Judging whether a touch point sampling value has been reported before based on the reporting identification value; If the reporting identification value is a valid value, it is determined that a touch point sampling value has been reported before, and the interrupt function is directly exited; If the reporting identification value is an invalid value, it is determined that a touch point sampling value has not been reported before, and it is judged whether the current storage identification value is the first initial value; If the current storage identification value is not the first initial value, directly exit the interrupt function; If the current storage identification value is the first initial value, determine the second median sampling value corresponding to the stored values in the current circular queue array and take the remaining stored values as the second reference point sampling values; Calculate the sum of squares of the second deviation values between the current second median sampling value and each second reference point sampling value; Judging one by one whether each sum of squares of the second deviation values is less than the first preset threshold; If the sum of squares of the second deviation values is less than the first preset threshold, increase the first valid point number corresponding to the current second median sampling value by 1, otherwise keep the first valid point number corresponding to the current second median sampling value unchanged; Obtain the second final value corresponding to the current second median sampling value and judge whether the second final value is less than or equal to the third preset threshold; If the second final value is less than or equal to the third preset threshold, directly exit the interrupt function; If the second final value is greater than the third preset threshold, report the current second median sampling value and exit the interrupt function.
6. The signal filtering method based on a circular queue array according to claim 5, characterized in that The first formula for the sum of squares of the first deviation values is: DV1 = (middleIdx.x1 - preIdx.x1) 2 + (middleIdx.y1 - preIdx.y1) 2 Where DV1 is the sum of squares of the first deviation values, middleIdx.x1 is the abscissa value in the first median sampling value, middleIdx.y1 is the ordinate value in the first median sampling value, preIdx.x1 is the abscissa value in the current first reference point sampling value, and preIdx.y1 is the ordinate value in the current first reference point sampling value; The second formula for the sum of squares of the second deviation values is: DV2 = (middleIdx.x2 - preIdx.x2) 2 + (middleIdx.y2 - preIdx.y2) 2 Where DV2 is the sum of squares of the second deviation values, middleIdx.x2 is the abscissa value in the second median sampling value, middleIdx.y2 is the ordinate value in the second median sampling value, preIdx.x2 is the abscissa value in the current second reference point sampling value, and preIdx.y2 is the ordinate value in the current second reference point sampling value.
7. The signal filtering method based on a circular queue array according to claim 6, characterized in that, Determining the second median sampling value corresponding to the stored values in the current circular queue array includes: Calculating the third index value of the second median sampling value based on the first index value corresponding to the last stored touch point sampling value; Select the stored touch point sampling value corresponding to the third index value as the second median sampling value; The calculation formula of the third index value is: middleIdx2 = [filterIdx2 / 2] where middleIdx2 is the third index value, filterIdx2 is the first index value corresponding to the last stored touch point sampling value, and "[]" is the integer operation.
8. A signal filtering system based on a circular queue array, characterized in that, The system includes: An initialization module for setting a storage identification value for the circular queue array and initializing the storage identification value to a first initial value; A storage module for obtaining each touch point sampling value and sequentially storing them into the circular queue array; sequentially establishing a corresponding first index value for each touch point sampling value and initializing the corresponding first valid point number to a second initial value; A filtering module for performing the following steps: Determine whether the first index value corresponding to the current touch point sampling value meets a first preset condition, where the first preset condition is that the first index value corresponding to the current touch point sampling value is equal to the index maximum value for the first time; If the first index value corresponding to the current touch point sampling value meets the first preset condition, then set the storage identification value to after the update value; determine the first median sampling value corresponding to the currently stored numerical value in the circular queue array and take the remaining stored numerical values as the first reference point sampling values; Calculate the sum of the squares of the first deviation values between the current first median sampling value and each first reference point sampling value; Judging one by one whether each sum of the squares of the first deviation values is less than a first preset threshold; If the sum of the squares of the first deviation values is less than the first preset threshold, then increase the first valid point number corresponding to the current first median sampling value by 1, otherwise keep the first valid point number corresponding to the current first median sampling value unchanged; Obtain the first final value of the first valid point number corresponding to the current first median sampling value and determine whether the first final value is less than a second preset threshold; If the first final value is greater than or equal to the second preset threshold, then determine that the current first median sampling value is a valid value and report it; If the first final value is less than the second preset threshold, then determine that the current first median sampling value is an invalid value.
9. A signal filtering device based on a circular queue array, characterized in that, The device includes: a processor and a memory; The memory is used to store one or more program instructions; The processor is used to run one or more program instructions to execute the steps of the signal filtering method based on the circular queue array as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by the processor, the steps of the signal filtering method based on the circular queue array as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Anti-jitter control method and device, equipment and storage medium
CN118170277A
Touch screen point jumping prevention method, system and equipment and storage medium
CN118377396A