Touch event synchronization and message reassembly method based on multi-channel timestamp alignment
By constructing a sliding time window and an event density statistical model, the risk of clock inaccuracy is quantified, enabling precise calibration of the multi-channel touch system. This solves the problems of lag and insufficient adaptability in existing calibration strategies, and improves the system's response sensitivity and long-term stability.
Patent Information
- Application Number
- CN202611346836.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-01
- Publication Date
- 2026-11-17
AI Technical Summary
In existing multi-channel touch event synchronization and message reassembly technologies, calibration triggering strategies with fixed periods or single thresholds cannot respond to intensive user interactions and scene switching, resulting in increased power consumption, calibration lag, and a lack of adaptability. They cannot adapt to device aging and changes in user habits, affecting message alignment quality.
By acquiring multi-channel event streams, a sliding time window is constructed to detect changes in event density, an event density statistical model is generated, the cost of cross-channel sequence deformation is calculated, the risk of clock misalignment is quantified, local or global calibration is performed, and timestamps are interpolated to achieve accurate calibration.
It enhances the context awareness and dynamic adaptability of timestamp calibration, reduces unnecessary full-channel collaborative operations, lowers resource consumption, enhances system real-time performance and stability, and adapts to equipment aging and changes in user habits.
Smart Images

Figure CN123114298A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of multi-channel touch event synchronization and clock calibration technology, and in particular to a method for touch event synchronization and message reassembly based on multi-channel timestamp alignment. Background Technology
[0002] In the current field of multi-channel touch event synchronization and message reassembly, the mainstream technical approach typically employs a clock calibration triggering strategy driven by a fixed time period or static threshold. Specifically, to achieve time consistency of multi-channel data, touch sensing systems often configure independent local hardware clocks to run on each sensing channel, periodically prompting each channel to synchronize its clock via predefined calibration commands. From hardware design and system integration to upper-layer applications, this approach generally relies on timed triggering mechanisms or sets a single static threshold based on statistical results to determine calibration requirements. When the time deviation between touch channels exceeds the set tolerance, the system initiates a global calibration or partial channel recalibration to correct timestamp errors in the event stream.
[0003] However, current technologies still face several prominent issues. First, calibration triggering based on fixed periods or single thresholds lacks correlation with the actual interaction context, failing to respond to intensive user interactions, scene switching, or temporary anomalies. This results in unnecessary calibration during sparse event flows, increasing power consumption and computational burden; and in periods of high-density interaction, calibration lags, and accumulated clock drift is not corrected in time, affecting message alignment quality. Second, technologies relying on environmental sensing and monitoring are too tightly coupled to external conditions, failing to guarantee broad applicability in diverse devices or complex production environments. Third, existing timestamp alignments mostly use simple statistical characteristics such as the average event interval, making it difficult to accurately quantify the decay of timing consistency between channels and potential drift risks. Finally, the lack of on-demand adaptive calibration thresholds and strategies prevents automatic adaptation to device aging and long-term changes in user habits, leading to parameter aging and decreased system robustness. Summary of the Invention
[0004] This application provides a method for touch event synchronization and message reassembly based on multi-channel timestamp alignment, which aims to solve one of the problems or issues of the prior art mentioned in the background.
[0005] The touch event synchronization and message reassembly method based on multi-channel timestamp alignment provided in this application specifically includes:
[0006] S1: Obtain the raw event stream from the multi-touch channels. The raw event stream contains local hardware timestamps and basic attribute data for each channel to form a set of multi-channel timing events to be processed.
[0007] S2: Based on the multi-channel time-series event set, a sliding time window is independently constructed for each channel and the number of events within a unit time window is calculated. The step change in event density is detected by sliding window difference to generate an event density statistical model that characterizes the rhythm of user interaction.
[0008] S3: Using the interaction time periods divided by the event density statistical model, extract the event time series representation of each channel within the corresponding time window, perform cross-channel sequence comparison, calculate the time deformation cost of any two channel event sequences, and generate a cross-channel sequence deformation cost index.
[0009] S4: Integrate the event density change rate in the event density statistical model, the cross-channel sequence deformation cost index, and the residual convergence speed after historical calibration, and perform multi-dimensional weighted calculation to generate a clock misalignment risk score that quantifies the degree of clock misalignment.
[0010] S5: If the clock misalignment risk score is in the low to medium risk range, then start local drift prediction and generate local drift prediction parameters.
[0011] S6: If the clock misalignment risk score is in the high-risk range, activate the full-channel collaborative calibration process and transmit the timestamp pairs of key anchor events to generate a global time reference correction instruction.
[0012] S7: Based on the local drift prediction parameters or the global time base correction command, calculate the time axis offset corresponding to each subsequent unprocessed event through interpolation compensation, and use the time axis offset to recalibrate the timestamp of the event to generate a calibrated event stream after time base unification.
[0013] S8: Based on the statistical characteristics of the calibrated event stream after time standardization, update the baseline parameters of the event density statistical model and the fluctuation threshold of the cross-channel sequence alignment.
[0014] The touch event synchronization and message reassembly method based on multi-channel timestamp alignment provided in this application has the following beneficial effects:
[0015] (1) By constructing a multi-dimensional clock misalignment risk assessment mechanism based on the spatiotemporal statistical characteristics of the event stream itself, the context awareness and dynamic adaptability of timestamp calibration triggering are significantly improved. Compared with traditional schemes that rely on fixed-period polling or preset thresholds to trigger calibration, this invention autonomously extracts behavioral evolution characteristics such as event density change rate, cross-channel sequence deformation cost, and historical residual convergence speed from the touch event stream, forming a risk scoring system that does not require external time source or physical sensor support. This effectively overcomes the technical defects of static triggering strategies that are prone to "overcalibration" or "undercalibration" in non-steady-state usage scenarios. This mechanism can accurately identify the active period of user interaction and the trend of implicit clock drift aggravation, and significantly reduce unnecessary full-channel collaborative operations while ensuring synchronization accuracy. This transforms calibration behavior from passive response to active prediction, achieving an optimized balance between high-precision time alignment and system resource overhead.
[0016] (2) The introduction of a graded response and low-intrusion calibration execution architecture effectively enhances the real-time performance, stability, and maintainability of the system. When the risk score is in the low to medium range, only the local drift trend prediction module is used for lightweight modeling and to cache compensation parameters, avoiding frequent cross-channel communication. The simplified timestamp exchange process is activated only in high-risk situations where intervention is necessary, limiting the data transmission range to key anchor event pairs, significantly reducing bandwidth usage and processing latency. In the calibration implementation phase, the interpolation compensation method is used to directly apply the predicted offset to the timestamp recalibration of subsequent events, rather than modifying the underlying hardware counter. This ensures the reversibility and security of the calibration process and avoids system interruptions or state disturbances caused by register writing. In addition, the system has continuous self-learning capabilities, automatically updating the event density baseline model and sequence alignment threshold after each calibration. This allows the detection and response strategies to be dynamically optimized as equipment ages, the environment changes, and user habits evolve, thus constructing a closed-loop, adaptive, and time-synchronization maintenance system that requires no manual intervention.
[0017] The synergistic effect of the above-mentioned technologies enables this solution to achieve intelligent sensing and efficient suppression of clock drift in multi-channel touch systems without adding additional sensors or relying on external timing conditions. It is not only significantly superior to traditional rule-driven fixed-period calibration methods, but also achieves substantial breakthroughs in response sensitivity, computational efficiency and long-term stability, demonstrating good engineering practicality and broad application expansion prospects. Attached Figure Description
[0018] Figure 1 This is the main flowchart of a touch event synchronization and message reassembly method based on multi-channel timestamp alignment.
[0019] Figure 2 This is a sub-flowchart of a touch event synchronization and message reassembly method based on multi-channel timestamp alignment.
[0020] Figure 3 This is another sub-flowchart of the touch event synchronization and message reassembly method based on multi-channel timestamp alignment. Detailed Implementation
[0021] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0022] The following disclosure provides many different embodiments or examples for implementing different structures of the invention. To simplify the disclosure, specific examples of components and arrangements are described below. Of course, these are merely examples and are not intended to limit the invention. Furthermore, reference numerals and / or letters may be repeated in different examples; such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.
[0023] like Figure 1 As shown, this application provides a method for touch event synchronization and message reassembly based on multi-channel timestamp alignment, specifically including:
[0024] S1: Obtain the raw event stream from the multi-touch channels. The raw event stream contains local hardware timestamps and basic attribute data for each channel to form a set of multi-channel timing events to be processed.
[0025] S2: Based on the multi-channel time-series event set, a sliding time window is independently constructed for each channel and the number of events within a unit time window is calculated. The step change in event density is detected by sliding window difference to generate an event density statistical model that characterizes the rhythm of user interaction.
[0026] S3: Using the interaction time periods divided by the event density statistical model, extract the event time series representation of each channel within the corresponding time window, perform cross-channel sequence comparison, calculate the time deformation cost of any two channel event sequences, and generate a cross-channel sequence deformation cost index.
[0027] S4: Integrate the event density change rate in the event density statistical model, the cross-channel sequence deformation cost index, and the residual convergence speed after historical calibration, and perform multi-dimensional weighted calculation to generate a clock misalignment risk score that quantifies the degree of clock misalignment.
[0028] S5: If the clock misalignment risk score is in the low to medium risk range, then start local drift prediction and generate local drift prediction parameters.
[0029] S6: If the clock misalignment risk score is in the high-risk range, activate the full-channel collaborative calibration process and transmit the timestamp pairs of key anchor events to generate a global time reference correction instruction.
[0030] S7: Based on the local drift prediction parameters or the global time base correction command, calculate the time axis offset corresponding to each subsequent unprocessed event through interpolation compensation, and use the time axis offset to recalibrate the timestamp of the event to generate a calibrated event stream after time base unification.
[0031] S8: Based on the statistical characteristics of the calibrated event stream after time standardization, update the baseline parameters of the event density statistical model and the fluctuation threshold of the cross-channel sequence alignment.
[0032] Step S1: Obtain the raw event stream from the multi-touch channels. The raw event stream contains the local hardware timestamps and basic attribute data of each channel to form a set of multi-channel timing events to be processed. Specifically, this includes:
[0033] S1.1: Parallel monitoring and acquisition of asynchronous hardware interrupt signals output from multiple touch sensor channels, extracting raw physical quantities including local counter values, coordinate positions, pressure intensity, and contact area to generate raw event data packets with channel identifiers.
[0034] The system receives asynchronous hardware interrupt request signals from multiple touch sensor channels. These interrupt request signals carry the physical channel identifier that triggered the event and a snapshot value of the underlying counter at the time of the interrupt. The interrupt controller at the system kernel level performs priority arbitration and queuing for the multiple interrupt signals arriving in parallel, ensuring that high-priority touch event interrupts are responded to immediately and avoiding packet loss in nested interrupts or high-load scenarios. For each responded interrupt request, the system immediately reads the raw physical quantity data from the corresponding touch sensor register, including the capacitance change value of the two-dimensional coordinate array, the analog voltage reading of the pressure sensor, and the geometric distribution matrix of the contact area. The read raw physical quantity data is atomically bound to the local hardware counter value captured at the time of the interrupt, forming a raw data tuple containing time base information and spatial state information. A unique channel identifier and a globally incrementing event sequence number are appended to each raw data tuple to distinguish the data source and maintain the order of event processing. The raw data tuples with channel identifiers are written in batches to a circular buffer via direct memory access, reducing CPU context switching overhead and generating raw event data packets with channel identifiers. Through the above-mentioned parallel listening, atomic binding and buffer writing processing methods, multiple asynchronous hardware interrupt signals are transformed into raw event data packets with unified structure and traceable timing. This achieves high-fidelity acquisition and preliminary structuring of multi-channel touch events, providing a complete and accurate input data source for subsequent time domain mapping transformation.
[0035] S1.2: Based on the local counter value in the original event data packet, and combined with the preset clock frequency parameters of each channel, perform a time domain mapping transformation to convert the discrete counter value into a local hardware timestamp with millisecond-level resolution, so as to generate a preliminary time-series event carrying a standardized time stamp.
[0036] Read the raw event data packet with channel identifier generated in the previous step S1.1, and parse out the discrete count value recorded by the hardware counter of each touch channel. This count value represents the number of clock cycles that have elapsed since the channel initialization or the last reset.
[0037] Retrieve preset clock frequency parameters that match the current channel identifier from the system configuration storage area. These parameters include the nominal crystal oscillator frequency and the factory-calibrated frequency correction factor, which are used to establish a mapping reference from the count value to physical time.
[0038] Perform a time-domain linear mapping transformation, divide the discrete hardware count value by the actual operating frequency of the channel, calculate the absolute time length in seconds, and realize the conversion from dimensionless counting space to continuous time space.
[0039] The calculated time value in seconds is scaled by multiplying it by a millisecond conversion factor of 1000 to convert it into a time value with millisecond-level resolution, so as to meet the time granularity requirements of the subsequent sliding time window statistical model.
[0040] Perform a floating-point to fixed-point format conversion on the scaled time value or retain a high-precision floating-point representation to generate preliminary timing events with standardized time stamps, ensuring that the timestamp data is stored in memory in a uniform format and has sufficient precision to distinguish high-frequency touch events.
[0041] By using the linear mapping and scaling method based on preset frequency parameters, the discrete hardware count values obtained in the previous step are transformed into local hardware timestamps with unified dimensions and millisecond-level resolution. This generates preliminary timing events carrying standardized time stamps, achieving preliminary normalization of multi-channel heterogeneous clock sources at the software level and providing a consistent time measurement basis for subsequent cross-channel time reference unification.
[0042] S1.3: Perform attribute field encapsulation processing on the preliminary time-series event carrying standardized time stamps, and integrate the local hardware timestamp, coordinate position, pressure intensity, contact area and event type code into a data structure with a fixed format to generate a single-channel structured event object with complete semantic information.
[0043] S1.4: Perform a multi-channel data stream aggregation operation based on the channel identifier of the single-channel structured event object, and globally sort and insert the data of all channels into the buffer queue according to the absolute physical time order of the events arriving at the system, so as to generate a multi-channel mixed event stream arranged linearly on the time axis.
[0044] Receive a single-channel structured event object with complete semantic information generated in step S1.3. The object includes a channel identifier ID and a local hardware timestamp T. local Coordinate position (X, Y), pressure intensity P, and contact area A.
[0045] Initialize a global priority buffer queue based on a min-heap data structure, with the sort key set to the local hardware timestamp T of the event. local It is used to maintain the strict order of multi-channel event streams in the time dimension.
[0046] Iterate through the input buffers of all active touch channels, read the current frontmost single-channel structured event object to be processed, and extract its channel identifier ID and local hardware timestamp T. local As a key index field.
[0047] The extracted key index fields are inserted into the global priority buffer queue, and a heaping operation is performed to ensure that the top element of the heap is always the event object with the smallest timestamp among all channels, thus ensuring the logical consistency of the timeline advancement.
[0048] Pop the event object with the smallest local hardware timestamp from the top of the global priority buffer queue, mark it as the latest valid event on the current global timeline, and record its absolute physical arrival time T. arrival .
[0049] Compare the timestamp T of the current pop-up event local Timestamp T of the previous processed event prev The time interval Δt is calculated. If Δt is less than zero or exceeds the preset maximum allowable jitter threshold, the timing anomaly marking logic is triggered.
[0050] For event objects that pass the timing verification, their original channel identifier ID and basic attribute data are retained and appended to the multi-channel mixed event stream buffer of linear output in the order of pop-up.
[0051] The system continuously monitors the interrupt signals of each channel. Once a new event object is generated in a channel, the above insertion and heaping operations are immediately executed to achieve dynamic convergence of multiple asynchronous data streams into a single synchronous ordered stream.
[0052] By using a global priority sorting and buffer queue insertion mechanism based on min-heap, the discrete and asynchronous multi-channel single-channel structured event objects in the previous step are transformed into a multi-channel hybrid event stream arranged linearly along the time axis, achieving strict ordered alignment of multi-source heterogeneous touch events in the time dimension, and providing a unified time reference sequence for density statistics within the subsequent sliding time window.
[0053] S1.5: Perform boundary verification and integrity encapsulation processing on the multi-channel mixed event stream, add sequence start flag and data length verification bit, and finally form a set of multi-channel time-series events to be processed that can be directly called by the downstream sliding time window module.
[0054] Step S2: Based on the multi-channel time-series event set, a sliding time window is independently constructed for each channel, and the number of events within a unit time window is calculated. Step changes in event density are detected through sliding window differential detection to generate an event density statistical model characterizing the user interaction rhythm. Specifically, this includes:
[0055] S2.1: Obtain the raw event stream data from the multi-channel time-series event set, construct a sliding time window sequence independent of each touch channel based on the preset time resolution parameters, and map the continuously arriving discrete touch events to the corresponding time window intervals to generate a segmented event subset with window identifiers.
[0056] The system receives a set of multi-channel timing events to be processed from the output of step S1. This set contains structured event objects sorted by global physical time, each with a channel identifier and a local hardware timestamp. For each independent touch channel, a sliding time window sequence based on a preset time resolution parameter is initialized. This time resolution parameter is set according to the system's real-time requirements for sensing the interaction rhythm, typically configured to be in the range of 5 to 20 milliseconds to balance computational granularity and processing overhead.
[0057] The starting reference time of the sliding time window sequence is determined based on the local hardware timestamp of the first event in each channel's event stream. Subsequently, continuous and partially overlapping or completely adjacent time window intervals are generated sequentially according to a preset time step to ensure the integrity and continuity of the time axis coverage. For each generated time window, a left-closed and right-open boundary condition is defined, that is, events at the start time are included while events at the end time are excluded. This establishes a strict time domain division standard to avoid duplicate counting or omission of events between adjacent windows.
[0058] Iterate through all structured event objects within the current channel, extract the local hardware timestamp of each event, and compare it with the start and end time boundaries of each window in the sliding time window sequence. If the local hardware timestamp of an event falls within the boundary range of a specific time window, then the event is assigned to the segmented event subset corresponding to that window, and a unique window identifier ID is assigned to that subset. This ID is composed of the channel number and the window sequence index to achieve multi-dimensional unique positioning.
[0059] During the event mapping process, a dynamic pointer is maintained to point to the time window that is currently being filled. As the event timestamp increases, when the timestamp of a subsequent event is detected to exceed the right boundary of the current window, the write permission of the current window is closed, and the pointer is moved to the next time window to continue to perform the attribution determination and aggregation operation of subsequent events until all pending events in the channel are mapped to the corresponding time window interval.
[0060] By constructing a sliding time window based on a preset time resolution and processing event mapping, continuously arriving discrete touch events are transformed into segmented event subsets with clear window identifiers. This achieves the conversion from unstructured time-series data to structured time-slice data, providing a standardized data foundation for subsequent event density statistics and step change detection within the execution unit time window, and ensuring the alignment accuracy of the context-aware mechanism in the time dimension.
[0061] S2.2: For each segmented event subset generated by each channel, perform an event counting operation within a unit time window, count the number of touch events contained in each sliding time window, and convert discrete physical events into continuous time series values to generate the original event density sequence.
[0062] S2.3: Based on the generated original event density sequence, the sliding window difference method is used to calculate the rate of change of the number of events between adjacent time windows, and the local gradient information of the event flow in the time dimension is extracted to generate the event density change rate sequence.
[0063] S2.4: Using the generated event density change rate sequence, execute the step change detection logic to identify abrupt change points where the change rate exceeds the preset dynamic threshold, and divide the continuous density change process into different interactive state intervals to generate interactive time period division markers.
[0064] Receive the event density change rate sequence generated in the previous step S2.3. This sequence records the first-order difference result of the number of events in each touch channel within a continuous sliding time window, and serves as the raw data input for detecting sudden changes in the interaction state.
[0065] Dynamic baseline noise suppression processing is performed on the event density change rate sequence. The exponential weighted moving average method is used to filter out high-frequency random fluctuations caused by sensor hardware jitter or minor environmental interference, and to extract low-frequency trend components that represent the user's true interaction intention.
[0066] An adaptive threshold generator based on historical interaction statistical features is constructed to calculate the mean and standard deviation of the event density change rate within a preset time window in real time. The sensitivity parameter of the mutation judgment is dynamically adjusted in combination with the current system load coefficient to generate a dynamic judgment threshold that evolves over time.
[0067] Each sampling point in the event density change rate sequence after noise suppression is compared with the dynamic determination threshold point by point to identify local extreme points whose absolute values exceed the threshold and mark them as potential interactive state transition candidate points.
[0068] Temporal neighborhood clustering analysis is performed on the potential interactive state transition candidate points to eliminate isolated false alarm points caused by instantaneous noise, retain the abrupt change intervals with continuous time on the time axis, and determine the precise boundary time when the interactive state undergoes a substantial transition.
[0069] Based on the determined precise boundary times, the continuous time axis is divided into several independent interactive state intervals, namely the high-density active interaction period, the low-density idle period, and the transition decay period, and a unique state identifier is assigned to each interval.
[0070] Generate a list of interaction time period segmentation markers containing start timestamps, end timestamps, and corresponding status identifiers. This list fully describes the structured distribution characteristics of user interaction rhythm in the time dimension.
[0071] Through the aforementioned step change detection logic and dynamic threshold determination mechanism, the continuous event density change rate sequence obtained in the previous step is transformed into a discrete interaction time period segmentation marker, realizing accurate perception and structured expression of user interaction context, and providing a semantically consistent time slice benchmark for subsequent cross-channel sequence comparison.
[0072] S2.5: Based on the generated interaction time period division markers, the original event density sequence is structurally reorganized, and the statistical characteristic parameters of each time period are integrated to construct a data structure that can dynamically reflect the distribution pattern of the user's active interaction intensive period and idle period, so as to generate an event density statistical model that represents the rhythm of user interaction.
[0073] The interaction time period segmentation marker sequence output from step S2.4 and the raw event density sequence generated in step S2.2 are received as the data input basis for this step. The interaction time period segmentation marker sequence contains the status identifier of each time window, used to distinguish between high-density interaction periods, low-density idle periods, and transition periods; the raw event density sequence records the touch event count values of each channel within the corresponding time window.
[0074] Based on the interaction period segmentation markers, a segmentation extraction operation is performed on the original event density sequence to cut the continuous time series data into several interaction subsequences with independent semantics. For each subsequence marked as a "high-density interaction period", its start and end timestamps are extracted, the duration of the period is calculated, and the total number of events in all time windows within the period is counted to obtain the total number of global events for the interaction burst.
[0075] For each subsequence marked as a "low-density idle period", zero-filling detection and noise filtering are performed. Since there may be sparse false touch events caused by sensor jitter during the idle period, median filtering is used to smooth the local event density during the idle period and remove isolated non-zero count points to obtain the baseline event density value that characterizes the background noise level of the system.
[0076] For time windows in the "transition period," i.e., the critical interval where event density undergoes a step change, slope fitting is performed. Event density data from N time windows before and after the transition period are selected, and a local linear regression model is constructed to calculate the instantaneous rate of change of event density over time. This rate of change reflects the dynamic transition speed of user interaction behavior from static to active or from active to static.
[0077] By integrating the extracted multidimensional statistical features, a data structure for the event density statistical model is constructed. This data structure contains three core fields: interaction intensity factor, idle baseline noise level, and dynamic transition rate. The interaction intensity factor is defined as the ratio of the average event density during a high-density interaction period to the idle baseline noise level, used to quantify the significance of user-initiated interactions.
[0078] We introduce the weighted exponential moving average (EWMA) method to recursively update the historical interaction intensity factor in order to generate dynamic baseline parameters that adapt to long-term user habits.
[0079] According to dynamic baseline parameter B t The deviation from the current real-time event density is used to calculate the context-aware weighting coefficients. When the real-time event density is significantly higher than the dynamic baseline, a high weight is assigned, indicating that the system is in a high-confidence active interaction state, and subsequent clock calibration should prioritize accuracy. When the real-time event density is close to the dynamic baseline, a low weight is assigned, indicating that the system is in an idle or noise-dominated state, and subsequent clock calibration can focus on reducing power consumption.
[0080] The calculated context-aware weight coefficients, dynamic baseline parameters, and boundary timestamps for each interaction period are encapsulated into a standardized event density statistical model object. This object not only contains the current statistical snapshot but also retains historical trend parameters for backtracking, forming a context-aware data structure with time-evolution capabilities.
[0081] Through the above-mentioned structured recombination and dynamic baseline update processing, the discrete interaction time period markers generated in the previous step are transformed into an event density statistical model with semantic depth and temporal memory. This achieves a technological leap from simple event counting to user interaction rhythm perception, providing a precise quantitative decision basis for subsequent context-based adaptive clock calibration triggering.
[0082] like Figure 2 As shown, step S3 involves: using the interaction time periods divided by the event density statistical model, extracting the event time series representations of each channel within the corresponding time window, performing cross-channel sequence comparison, and calculating the time deformation cost of any two channel event sequences to generate a cross-channel sequence deformation cost index. Specifically, this includes:
[0083] S3.1: Based on the interaction time period boundary identifier output by the event density statistical model, the multi-channel time-series event set is sliced to generate a candidate event subset sequence containing local high-density touch events.
[0084] The system receives interaction time segmentation markers from the event density statistical model. These markers include the start and end times of each time window and the corresponding interaction status identifier, serving as boundary constraints for data slicing. It iterates through the global sorting buffer in the multi-channel time-series event set, distributing events to independent processing queues for each channel based on the channel identifier, ensuring isolation and parallelism of subsequent slicing operations at the channel level. For each touch channel, it extracts all pending events within the current sliding time window, constructing a temporary event list containing local hardware timestamps, coordinate positions, and pressure values. It reads the start and end time thresholds from the interaction time segmentation markers and performs linear scan filtering on the temporary event list, removing redundant event data whose timestamps fall within inactive interaction intervals or idle periods. It retains event records whose timestamps are strictly within the boundaries of high-density interaction time segments, forming a preliminary candidate event subset, ensuring that the selected events have significant user-initiated interaction characteristics. It performs spatiotemporal continuity verification on the preliminary candidate event subset, calculating the time interval between adjacent events. If a breakpoint exceeds a preset maximum silence threshold, the subset is further split into multiple independent local high-density event blocks. Each local high-density event block is assigned a unique sequence index identifier, and its absolute starting offset on the global timeline is recorded to maintain a timing reference benchmark for subsequent cross-channel comparisons. Local high-density event blocks generated from all channels are integrated and structurally encapsulated according to channel ID and sequence index to generate a candidate event subset sequence containing local high-density touch events. Through multi-level filtering based on interaction time-period boundaries and spatiotemporal continuity splitting, the continuous multi-channel raw event stream is transformed into a discrete candidate subset sequence focused on high-value interaction segments. This achieves data focusing on clock drift-sensitive areas, significantly reducing the computational complexity of subsequent dynamic time warping algorithms and improving the signal-to-noise ratio of deformation cost calculation.
[0085] S3.2: For each channel data in the candidate event subset sequence, extract the local hardware timestamp as a time dimension feature and map it into a normalized time vector to generate an event time series representation vector that represents the interaction rhythm of a single channel.
[0086] S3.3: Construct a distance cost matrix between any two channels based on the event time series representation vector, perform a global path search to find the path with the minimum cumulative distance, and generate the minimum cumulative distance value representing the optimal solution for time axis alignment.
[0087] The system receives an event time-series representation vector generated in step S3.2, representing the interaction rhythm of a single channel. This vector contains a normalized local hardware timestamp sequence and corresponding physical attribute feature values. For any two touch channels A and B to be compared, the system extracts the time dimension component from their event time-series representation vectors, constructing a time-series vector of length N for channel A and a time-series vector of length M for channel B, where N and M represent the number of valid touch events captured by the two channels within the current sliding time window, respectively.
[0088] Based on the time series vectors of channel A and channel B, an N×M distance cost matrix is initialized. Each element in the matrix represents the local distance metric between the i-th event in channel A and the j-th event in channel B. Euclidean distance is used to calculate the geometric distance between each pair of event points in the multidimensional feature space, specifically including the absolute value of the timestamp difference, the Euclidean distance of the coordinate positions, and the difference in pressure intensity. A weighted summation is then used to generate the local distance value, which is filled into the corresponding position (i, j) of the distance cost matrix.
[0089] Based on the distance cost matrix, a cumulative distance matrix is constructed to record the minimum cumulative path cost from the starting point to the current point. Path constraints for the dynamic time warping algorithm are set, including monotonicity, continuity, and boundary conditions, to ensure the physical rationality of the time axis mapping. The first row, first column, and top-left element of the cumulative distance matrix are initialized, where the top-left element equals the local distance value at the corresponding position in the distance cost matrix, and the remaining boundary elements are obtained by summing the local distance values of the predecessor nodes and their own local distance values.
[0090] Traverse the non-boundary region of the cumulative distance matrix. For any element (i, j) in the matrix, calculate the cumulative distance values of its three predecessor nodes (i-1, j), (i, j-1), and (i-1, j-1). Select the node with the smallest cumulative distance value among these three predecessor nodes and add it to the local distance value of the current position (i, j) to obtain the minimum cumulative distance value of the current position.
[0091] Repeat the above traversal and calculation process until all elements of the cumulative distance matrix are covered, ensuring that each position stores the globally optimal path cost from the starting point to that position. When traversing to the bottom right element (N, M) of the matrix, the value stored at that position is the minimum cumulative distance between the event sequences of channel A and channel B. This value quantifies the overall distortion of the two channel event streams on the time axis, reflecting the total amount of timing misalignment caused by clock drift.
[0092] By using the global path search mechanism of the dynamic time warping algorithm, discrete local distance metrics are transformed into minimum cumulative distance values that characterize the optimal solution for time axis alignment. This enables precise quantification of the implicit clock drift amplitude between multiple channels, providing core data support for the subsequent generation of cross-channel sequence deformation cost indicators.
[0093] S3.4: Perform a normalization operation based on the deviation ratio between the minimum cumulative distance value and the ideal linear alignment reference distance to generate the original deformation metric parameter for quantizing the amplitude of the time synchronization error between channels.
[0094] The system receives the minimum cumulative distance value representing the optimal solution for time axis alignment, as well as the theoretical length parameter of each channel event sequence within the current interaction period, from the output of step S3.3. The minimum cumulative distance value reflects the total cost of non-rigid matching of the two channel event sequences in the time dimension under dynamic time warping path constraints, while the theoretical length parameter is used to construct the linear alignment benchmark under ideal conditions.
[0095] Based on the minimum cumulative distance value and the theoretical sequence length, the ideal linear alignment reference distance is calculated. In an ideal scenario with no clock drift and completely consistent sampling rates, the event sequences of the two channels should exhibit a strict one-to-one correspondence. In this case, the dynamic time warping path degenerates into a diagonal, and its cumulative distance is the expected value of the sum of the Euclidean distances of the corresponding points. The ideal linear alignment reference distance is calculated using the following formula:
[0096]
[0097] Among them, D ideal The ideal linear alignment baseline distance is N, where N is the number of valid event pairs participating in the comparison within the current interaction period, and t is the distance between the two points. A,i and t B,i These are the normalized timestamp values for channels A and B at the i-th alignment point, respectively. This reference distance eliminates the dimensional effects caused by the different absolute time spans of events, establishing a reference zero point in the zero-drift state.
[0098] Calculate the deviation between the minimum cumulative distance value and the ideal linear alignment reference distance to obtain the original absolute deformation. Then, calculate the actual minimum cumulative distance D obtained through global path search in S3.3. actual Subtract the D obtained from the above calculation ideal This yields the total additional time distortion introduced by non-ideal alignment. This difference directly quantifies the degree of nonlinear deformation of the sequence caused by clock frequency differences, initial phase shifts, and random jitter, eliminating the interference of uneven distribution of event time intervals on the measurement results.
[0099] A sequence length normalization factor is introduced to standardize the original absolute deformation, generating a dimensionless original deformation metric parameter. Considering the significant differences in event density across different interaction periods, the cumulative distances generated by short-duration high-density interactions and long-duration low-density interactions are not directly comparable; therefore, the absolute deviation needs to be mapped to the average deformation cost per unit event pair. Standardization is performed using the following formula:
[0100]
[0101] Among them, M raw To quantify the original deformation metric parameter for the magnitude of inter-channel time synchronization error, D actual This is the minimum cumulative distance value output by the dynamic time warping algorithm. This ratio form eliminates the influence of sequence length and absolute time span of events, making the deformation index generated by interaction segments of different durations and densities have a unified physical meaning and comparability.
[0102] Nonnegativity constraints and outlier truncation are applied to the generated raw deformation measurement parameters. Due to measurement noise or extreme outliers, the calculated M... raw Small negative values or extremely large values exceeding the physically reasonable range may occur. A lower threshold is set to 0 to ensure that the deformation measurement parameter always represents a positive degree of time inaccuracy; an upper threshold is set to a preset maximum allowable drift ratio, and values exceeding this threshold are forcibly truncated to prevent a single extreme mismatch from causing misjudgments in subsequent risk scoring modules. After cleaning, M... raw This is the original deformation measurement parameter of the final output.
[0103] Through the above-mentioned deviation ratio mapping and standardized calculation processing, the minimum cumulative distance value of the previous step is transformed into a raw deformation measurement parameter with unified dimensions and eliminating length dependence. This achieves accurate quantification of the implicit clock drift amplitude between multiple channels and provides standardized input data for subsequent fusion of multi-dimensional features to generate clock inaccuracy risk scores.
[0104] For example, within the current sliding time window, both channel A and channel B detect a rapid sliding operation lasting 500ms. After preprocessing, a normalized time series containing 20 key touch points is extracted. The actual minimum cumulative distance D is calculated using a dynamic time warping algorithm. actual The time interval is 12.5 ms·unit (unit distance dimension). Based on the timestamp distribution of the events from both channels, the ideal linear alignment reference distance D is calculated. ideal The value is 10.0 ms·unit. Substituting into the normalization formula, the numerator is 12.5 - 10.0 = 2.5 ms·unit, and the denominator is 10.0 ms·unit. This yields the original deformation measurement parameter M. raw= 2.5 / 10.0 = 0.25. This value of 0.25 indicates that in the current interaction segment, there is a non-linear time distortion between the two channels equivalent to 25% of the reference time scale, suggesting a significant clock asynchrony. If the other idle period contains only 2 sparse events, D actual For 1.2ms·unit, D ideal If it is 1.0 ms·unit, then M raw = (1.2-1.0) / 1.0 = 0.2. Although the absolute distance difference is small, the standardized deformation parameter still accurately reflects the relative inaccuracy, ensuring the consistency of the evaluation index under different interaction densities. The system passes the deformation parameters of 0.25 and 0.2 to step S3.5 for weighted aggregation, effectively avoiding evaluation bias caused by differences in the number of events.
[0105] S3.5: Perform weighted aggregation on the original deformation metric parameters of all channel pairs to generate a cross-channel sequence deformation cost index that ultimately characterizes the overall clock misalignment trend of the system.
[0106] Receive the raw deformation metric parameters between any two channels from the output of step S3.4. These parameters quantify the degree of time axis alignment deviation of a specific channel within a sliding time window and serve as the initial input data for weighted aggregation processing.
[0107] A dynamic weight allocation matrix based on channel topology and interaction activity is constructed. For the N touch channels in the system, a weight vector containing N×(N-1) / 2 elements is generated, where each element corresponds to the confidence weight coefficient of a pair of channel combinations.
[0108] Based on the event density statistics of each channel within the current sliding time window, the interaction activity index of a single channel is calculated. Channels with a large number of events are identified as high-confidence reference sources and given a higher weight in the pairing relationship, so as to suppress noise interference caused by sparse sampling in low event density channels.
[0109] By combining the physical layout topology of multi-touch sensors, spatially adjacent channel pairs and spatially separated channel pairs are identified. For spatially adjacent channel pairs that have the potential for multi-touch association, a spatial coupling enhancement factor is applied to increase the contribution ratio of their deformation measurement in the overall evaluation.
[0110] Perform a weighted summation operation, multiply the original deformation measurement parameters of each pair of channels element by element with their corresponding dynamic weight coefficients, accumulate the weighted results of all channel pairs, and generate an intermediate aggregate value that characterizes the global clock misalignment trend of the system.
[0111] A normalization factor is introduced to unify the dimensions of intermediate aggregate values, eliminating numerical fluctuations caused by differences in the number of channels or changes in the length of the time window, and ensuring the comparability of indicators across different hardware configurations.
[0112] An exponentially weighted moving average method is used to smooth and filter the normalized aggregate value, and deformation cost information from historical moments is integrated to reduce the jitter caused by instantaneous abnormal interaction behavior, thus generating a final stable cross-channel sequence deformation cost index with temporal continuity.
[0113] Through the above-mentioned dynamic weight allocation, spatial coupling enhancement and exponential smoothing filtering, the discrete channel pair deformation parameters obtained in the previous step are transformed into global quantitative indicators reflecting the overall clock synchronization status of the system. This achieves a highly robust characterization of the multi-channel clock misalignment trend and provides accurate input for subsequent risk scoring.
[0114] For example, in a system with four touch channels (Ch1, Ch2, Ch3, Ch4), the current sliding time window length is 50ms. The number of events for Ch1, Ch2, Ch3, and Ch4 within this window are 20, 18, 5, and 2, respectively. The original deformation metric parameters (DTW distance normalized values) for each channel calculated in step S3.4 are as follows: D(1,2)=0.05, D(1,3)=0.12, D(1,4)=0.15, D(2,3)=0.11, D(2,4)=0.14, D(3,4)=0.08. First, calculate the activity index for each channel. Assuming the total number of events is 45, the activity indexes are A1=20 / 45≈0.44, A2=0.40, A3=0.11, and A4=0.04. Construct channel pair weights. Taking Ch1-Ch2 as an example, its weight W(1,2) is determined by the average activity of the two channels, W(1,2)=(A1+A2) / 2=0.42. Considering that Ch1 and Ch2 are physically adjacent, a spatial coupling enhancement factor of 1.2 is applied, so the final W'(1,2)=0.42×1.2=0.504. Similarly, calculate the weights of other channel pairs. Assuming that Ch3-Ch4 are adjacent but have extremely low activity, the weight is only 0.05. Perform a weighted summation: Sum = D(1,2)×W'(1,2) + D(1,3)×W'(1,3) + ... + D(3,4)×W'(3,4). Assume that the calculated intermediate aggregate value is 0.065. Introduce a normalization factor K=1.0 (calibrated based on the standard window event count). Finally, an exponentially weighted moving average with a smoothing coefficient α=0.3 is used. If the deformation cost index at the previous time step was 0.060, then the current final index Cost = 0.3×0.065 + 0.7×0.060 = 0.0195 + 0.042 = 0.0615. This index effectively masks the noise caused by the low sampling rate of Ch4, highlights the slight inaccuracies between the high-activity channels Ch1 and Ch2, and significantly improves the accuracy of clock inaccuracy assessment.
[0115] like Figure 3 As shown, step S4 involves fusing the event density change rate in the event density statistical model, the cross-channel sequence deformation cost index, and the residual convergence speed after historical calibration, and performing a multi-dimensional weighted calculation to generate a clock inaccuracy risk score that quantifies the degree of clock inaccuracy. Specifically, this includes:
[0116] S4.1: Based on the event quantity sequence per unit time window in the event density statistical model, perform a first-order difference operation to calculate the event quantity difference between adjacent time windows, and normalize the difference to generate an event density change rate that characterizes the degree of abrupt change in user interaction rhythm.
[0117] Obtain the sequence of event counts per unit time window output from the event density statistical model. This sequence records the discrete event counts captured by each touch channel within a preset sliding time window, serving as the basic data source characterizing user interaction activity.
[0118] A time-series alignment check is performed on the sequence of events within the unit time window to ensure that the data indexes of adjacent time windows are continuous and without missing data. If data gaps caused by system interruption or packet loss are detected, linear interpolation is used to fill the count values of the missing windows in order to construct a complete time-dimensional dataset.
[0119] Based on the complete time-dimensional dataset, perform first-order difference operations to calculate the number N of events in the current time window t. t The number of events N compared to the previous time window t-1 t-1 The difference between them is used to quantify the absolute change in the event flow within adjacent time segments, and to calculate the change in the original event density.
[0120] Considering the cardinality effect caused by different user interaction habits and differences in touch sensor sensitivity, the direct use of absolute differences lacks cross-scenario comparability. The original changes need to be normalized to eliminate the influence of dimensions.
[0121] The arithmetic mean of the number of events in the current time window and the previous time window is calculated as a benchmark reference value to measure the relative magnitude of the change, thus avoiding excessive noise sensitivity due to small absolute changes in low event density ranges.
[0122] Based on the original event density change ΔN t Compared with the benchmark reference value N avg Perform normalized division to generate a dimensionless event density change rate index, which reflects the relative intensity of sudden changes in user interaction rhythm.
[0123] The calculated event density change rate R density Amplitude limiting is performed, and upper and lower threshold boundaries are set to suppress extreme outliers caused by transient electromagnetic interference or sensor mis-touch, ensuring the stability of the signal input to the subsequent risk scoring model.
[0124] The event density change rate after the amplitude limiting process is mapped to the interval [0, 1]. By taking the absolute value and dividing it by the maximum allowable change rate, a standardized event density mutation degree index is generated. This index directly represents the degree of drastic transition of the user's interaction state from idle to dense or from dense to idle at the current moment.
[0125] By using the first-order difference and normalization processing method described above, the event quantity sequence of the previous step is transformed into an event density change rate index that characterizes the degree of abrupt changes in the user interaction rhythm. This enables the quantitative extraction of dynamic features of interactive behavior in the context environment, providing a highly sensitive triggering basis for subsequent judgment of clock inaccuracy risk.
[0126] S4.2: Using the dynamic time warping distance value in the cross-channel sequence deformation cost index, combined with the preset time deformation benchmark threshold, perform deviation ratio mapping processing to generate a sequence desynchronization factor that characterizes the trend of deterioration in multi-channel timing consistency.
[0127] Receive the cross-channel sequence deformation cost index output from step S3.5. This index contains the minimum cumulative distance between each channel pair calculated based on the dynamic time warping algorithm, which serves as the original metric data characterizing the consistency of multi-channel timing at the current moment.
[0128] The system calls a preset time deformation benchmark threshold database to retrieve a standard reference value that matches the current interaction time type and event density level. The standard reference value represents the theoretical minimum dynamic time warping distance upper limit caused by normal user interaction jitter under ideal clock synchronization conditions.
[0129] The minimum cumulative distance value is subtracted from the retrieved time deformation reference threshold, and the absolute deviation between the two is calculated to quantify the degree of deviation of the current actual time alignment state from the ideal reference state.
[0130] The sequence desynchronization factor is calculated using the following formula:
[0131]
[0132] Where δ is the sequence desynchronization factor, D DTW T is the minimum cumulative distance value generated in step S3.3. base This is the preset time deformation reference threshold.
[0133] The calculated deviation ratio is subjected to non-negative constraint processing. If the deviation ratio is negative, it is forced to be set to zero to eliminate noise interference when the measured distance is less than the theoretical threshold due to the extremely stable interaction rhythm, and to ensure that the physical meaning of the desynchronization factor clearly points to the trend of time series deterioration.
[0134] A saturation limiting mechanism is introduced to restrict the processed deviation ratio within a preset maximum desynchronization range, preventing the risk score from fluctuating drastically due to a surge in distance values caused by extreme abnormal events, and ensuring the numerical stability of subsequent weighted calculations.
[0135] By using the above-mentioned deviation ratio mapping and nonlinear constraint processing, the cross-channel sequence deformation cost index obtained in the previous step is transformed into a dimensionless sequence desynchronization factor with monotonically increasing characteristics. This achieves accurate quantification of the deterioration trend of multi-channel time series consistency and provides standardized input variables for subsequent multi-dimensional risk scoring fusion.
[0136] For example, in a dual-channel touch interaction scenario, the main channel A and the secondary channel B collect 15 and 14 touch events respectively within the current sliding time window. The minimum cumulative distance D between the two channel event sequences is calculated using the dynamic time warping algorithm in step S3.3. DTW The time interval is 42.5 milliseconds. Based on the currently identified "high-frequency sliding" interaction state, the system retrieves the corresponding time deformation benchmark threshold T from the benchmark library. base The deviation is 30.0 milliseconds. Subtracting this value yields an absolute deviation of 12.5 milliseconds. Substituting this into the formula, the deviation ratio is calculated as: (42.5 - 30.0) / 30.0 = 0.4167. Since this value is positive and does not exceed the preset maximum desynchronization limit of 1.0, it is directly output as the sequence desynchronization factor δ. If in another scenario D... DTW It is 28.0 milliseconds, which is less than T. base The calculated result is -0.067. After non-negative constraint processing, the sequence desynchronization factor δ is corrected to 0.0, indicating that the current timing consistency is better than the baseline expectation and there is no risk of desynchronization. This processing method effectively distinguishes between normal interactive fluctuations and timing distortions caused by clock drift, significantly improving the robustness of risk assessment.
[0137] S4.3: Based on the error decay slope in the historical calibrated residual convergence speed data, perform exponential smoothing filtering to extract the residual convergence confidence parameter that characterizes the effectiveness of the current clock drift compensation.
[0138] After each full-channel collaborative calibration, the system continuously records the residual error values of each slave channel relative to the master channel after compensation within a preset time window (e.g., 5 seconds after calibration), forming a residual error time series. This series is fitted using an exponential decay model with nonlinear least squares to obtain the decay coefficient, which is defined as the original residual convergence rate. A larger coefficient indicates faster clock error elimination after calibration and higher clock source stability. If the goodness of fit of multiple consecutive calibrations is lower than a preset threshold, a linear decay model is used, or the number of iterations required for the residual error to decay from its peak to a preset stable threshold (e.g., 1 millisecond) is directly calculated as an alternative measure of convergence rate.
[0139] The raw convergence rate sequence obtained from the most recent (e.g., 5) full-channel calibration events is normalized, mapping its values to the interval between 0 and 1. Then, a first-order exponentially weighted moving average is used for filtering: the residual convergence confidence parameter at the current moment is obtained by weighting the normalized convergence rate of the current calibration with the confidence parameter at the previous moment using a preset smoothing factor (ranging from 0.1 to 0.3); the initial confidence parameter is set to 0.5. A confidence parameter closer to 1 indicates faster calibration convergence and a more stable current clock source; a parameter closer to 0 indicates slow convergence or compensation failure. This parameter will be used in subsequent multi-dimensional risk weighting calculations.
[0140] S4.4: Based on the event density change rate, the sequence desynchronization factor, and the residual convergence confidence parameter, a weighted summation operation is performed by calling a preset multidimensional weight allocation matrix to generate an original risk accumulation value that comprehensively reflects the current system clock state.
[0141] The normalized event density change rate, the sequence desynchronization factor characterizing the deterioration trend of multi-channel timing consistency, and the residual convergence confidence parameter characterizing the effectiveness of current clock drift compensation are received as input vectors for multi-dimensional risk weighting operations.
[0142] The pre-set multidimensional weight allocation matrix is invoked. This matrix is stored in the system's non-volatile memory and contains three independent weight components corresponding to the sensitivity of event density mutation, cross-channel deformation penalty coefficient, and historical calibration reliability, respectively. It is used to quantify the contribution of each dimension index to the overall clock misalignment risk.
[0143] Based on the current system operation mode identifier, the appropriate weight combination is dynamically retrieved from the weight allocation matrix. If the system is in a high-load interaction state, the weight ratio of the event density change rate is automatically increased. If it is in a silent standby state, the weight ratio of the sequence desynchronization factor is increased to achieve context-aware differentiated risk assessment.
[0144] The event density change rate and the corresponding density mutation sensitivity weight are multiplied element-wise to generate the first-dimensional risk component that reflects the impact of drastic fluctuations in user interaction rhythm on clock stability.
[0145] The sequence desynchronization factor and the corresponding cross-channel deformation penalty coefficient are multiplied element-wise to generate a second-dimensional risk component that reflects the degree of nonlinear distortion of the time axis between multiple channels.
[0146] The residual convergence confidence parameter is transformed into a residual divergence risk index by performing an inverse transformation or negative correlation mapping. Then, it is multiplied element-wise with the historical calibration confidence weight to generate a third-dimensional risk component that reflects the impact of past calibration effect degradation.
[0147] A three-dimensional risk vector space is constructed, and the first, second, and third risk components generated above are vector superimposed and algebraic summation is performed to eliminate the local deviation interference of single-dimensional indicators. The original cumulative risk value that comprehensively reflects the current system clock state is then calculated.
[0148] Boundary truncation is performed on the calculated raw risk accumulation value to limit its numerical range to non-negative real number intervals, prevent risk score overflow caused by extreme abnormal data, and ensure the numerical stability of subsequent nonlinear mapping processing.
[0149] By adaptively calling the multidimensional weight allocation matrix and linearly superimposing the three-dimensional risk components, the heterogeneous timing characteristic indicators output in the previous step are transformed into original risk accumulation values with unified dimensions. This achieves deep fusion and quantitative characterization of multi-source clock misalignment signals, providing accurate decision-making basis for subsequent triggering of graded calibration strategies.
[0150] S4.5: Perform nonlinear sigmoid function mapping on the original risk accumulation value to convert the dimensionless accumulation value into an interval-standardized quantized clock misalignment risk score, which serves as the final decision variable for triggering local drift prediction or global collaborative calibration processes.
[0151] After the system outputs the normalized clock misalignment risk score R in step S4.5, it then uses a low-risk threshold Th, either preset or dynamically maintained by configuration in step S8, as the basis for the score. low With high risk threshold Th high (Initial default values, e.g., Th) low =0.3、Th high Risk level classification is performed when R ≤ Th (=0.7): low When the risk level is low, no compensation is required; when Th low <R≤Th high When the risk level is in the low to medium range, the local drift trend prediction submodule in step S5 is triggered; when R > Th high When the time is in a high-risk range, the full-channel collaborative calibration process in step S6 is triggered.
[0152] For example, suppose the clock misalignment risk score R calculated within the current sliding time window is 0.52, and the system threshold is configured as Th low =0.3、Th high =0.7. Since 0.3 < 0.52 ≤ 0.7, it is determined to be in the medium-low risk range. The system automatically starts step S5 to generate local drift prediction parameters for subsequent interpolation compensation, thereby avoiding the frequent use of high-overhead full-channel collaborative calibration.
[0153] Step S5: If the clock misalignment risk score is in the low to medium risk range, then local drift prediction is initiated to generate local drift prediction parameters. Specifically, this includes:
[0154] S5.1: Obtain the short-time historical event timestamp sequence of the current channel in the multi-channel time-series event set, and perform time interval extraction processing based on the difference operation of adjacent timestamps to generate a short-time historical event interval sequence that represents the touch interaction rhythm.
[0155] Obtain the short-term historical event timestamp sequence of the current channel in the multi-channel time sequence event set. This sequence contains discrete touch events arranged in arrival order within a preset backtracking time window and their corresponding local hardware counter values.
[0156] The short-term historical event timestamp sequence is subjected to channel isolation and index reconstruction processing. Based on the channel identifier, an independent subset of events belonging to the current channel to be calibrated is selected, and the local time index is reset to eliminate the timing confusion caused by cross-channel data interleaving.
[0157] Extract the local hardware timestamps of two adjacent valid touch events from the subset of independent events, and define them as the current event timestamp T. curr With the preceding event timestamp T prev Construct pairs of time reference sets.
[0158] Based on the aforementioned time reference set, a difference operation is performed to calculate the time interval Delta between adjacent events. T Quantify the discrete distribution characteristics of touch interaction on a microscopic time scale.
[0159] Iterate through all consecutive event pairs in the subset of independent events, and repeat the above difference operation to generate an original time interval sequence consisting of multiple time interval values.
[0160] The generated original time interval sequence is subjected to monotonicity verification to remove negative or zero intervals caused by hardware interrupt delays or software scheduling jitter, ensuring the physical consistency of the time flow direction.
[0161] The time interval values after cleaning are linearly arranged according to the order in which the events occurred, forming a short-term historical event interval sequence that represents the current channel touch interaction rhythm.
[0162] By using the above-mentioned adjacent timestamp difference and serialization processing method, the multi-channel mixed event stream of the previous step is transformed into a short-term historical event interval sequence of a single channel dimension, realizing the feature transformation from absolute time point to relative time interval, and providing a basic data source reflecting the clock frequency deviation for subsequent drift model fitting.
[0163] S5.2: Receive the short-term historical event interval sequence, perform data smoothing and outlier removal processing based on the sliding window mechanism, and generate a cleaned standard event interval sequence.
[0164] S5.3: Using the cleaned standard event interval sequence, perform linear regression fitting based on the least squares method to generate linear drift model coefficients that characterize the clock frequency deviation trend.
[0165] Receive the standard event interval sequence after cleaning in step S5.2. This sequence consists of the time difference between adjacent touch events after removing outliers and smoothing, and serves as the basic data source characterizing the stability of the local clock frequency of the current channel.
[0166] Construct a two-dimensional discrete dataset with event index as the independent variable and event interval time as the dependent variable. Let y denote the i-th event interval in the cleaned standard event interval sequence. i The corresponding event cumulative index is denoted as x. i , where i ranges from 1 to N, and N is the total number of valid event intervals within the current sliding window.
[0167] Based on the principle of least squares, a linear regression model is established to fit the trend of event interval evolution over time. It is assumed that there is a linear relationship between event interval and event index: y = kx + b, where k represents the clock frequency drift slope and b represents the initial phase offset intercept.
[0168] The residual sum of squares function is defined to measure the deviation between the fitted line and the actual data points. The optimal model coefficients are solved by minimizing this function. The expression for the residual sum of squares function is as follows:
[0169]
[0170] Where J(k, b) is the sum of squared residuals, k is the drift slope to be determined, b is the intercept to be determined, and y i Let x be the interval of the i-th measured event. i This is the index value of the i-th event.
[0171] Take the partial derivatives of the residual sum of squares function with respect to parameters k and b, respectively, and set the partial derivatives to zero to obtain the extreme points, thereby establishing a normal system of equations. Solve the system of equations to obtain the analytical solutions for the slope k and intercept b.
[0172] Numerical calculations are performed by substituting the cleaned standard event interval sequence data to solve for the specific values of slope k and intercept b. The slope k directly represents the amount of time interval change caused by a unit event index change, i.e., the relative drift rate of the clock frequency.
[0173] The calculated slope k is physically verified. If the absolute value of the slope is lower than the system noise threshold, it is determined that there is no significant linear drift at the current time, and the slope is forced to zero to avoid noise amplification. If the slope exceeds the reasonable physical range, the fitting result is marked as invalid and the effective coefficient of the previous period is retained.
[0174] The verified slope k and intercept b are encapsulated into a linear drift model coefficient vector [k, b]. This vector fully describes the frequency deviation trend and phase shift state of the local clock of the touch channel relative to the ideal clock within the current short-time window.
[0175] By using the least squares linear regression fitting method, the standard event interval sequence after the previous step of cleaning is transformed into linear drift model coefficients that characterize the trend of clock frequency deviation. This achieves accurate quantitative extraction of local clock drift features and provides core mathematical model support for the subsequent generation of local drift prediction parameters.
[0176] The linear drift model is a simplified mathematical model used in this invention to describe and predict the frequency deviation and phase shift of the local touch channel clock relative to an ideal reference clock. This model assumes that the cumulative clock drift is linearly related to time within a short time window.
[0177] The core parameters of the linear drift model are a set of two-dimensional linear coefficient vectors, consisting of the following two components:
[0178] Frequency drift slope: Characterizes the relative rate of deviation of clock counts within a unit event index (or unit time), reflecting the drift trend of the hardware crystal oscillator frequency. A positive value indicates that the local clock is faster than the ideal reference clock, and a negative value indicates that it is slower.
[0179] Initial phase offset intercept: Characterizes the instantaneous phase deviation of the local clock relative to the ideal reference clock at the current moment, and is used as the initial value to compensate for accumulated drift.
[0180] This model assumes a linear relationship between the event interval and the event index within a short sliding window, meaning the event interval changes linearly with the order of events. The slope obtained through fitting can directly quantify the clock frequency drift rate, while the intercept reflects the initial timing alignment error.
[0181] The linear drift model is constructed by combining offline statistics with online adaptive fitting, specifically including the following steps:
[0182] Data preparation: In step S5.2, the system receives the short-term historical event timestamp sequence of the current channel, generates the original event interval sequence through adjacent timestamp difference operation, and then performs sliding window smoothing and outlier removal processing to obtain the cleaned standard event interval sequence. This sequence serves as the input dataset for linear regression.
[0183] Coordinate system establishment: A two-dimensional discrete data point set is constructed using the cumulative index of events within the sliding window (i.e., the sequential number of events) as the independent variable and the corresponding post-cleaning event interval as the dependent variable. Each data point represents the mapping relationship between the time interval between adjacent touch events and the event sequence number.
[0184] Least Squares Fitting: Employing the least squares method, this approach assumes a linear relationship between the event interval and the event index. The optimal drift slope and intercept are determined by minimizing the sum of squared residuals across all data points. Specifically, the system iterates through all data points within the window, calculates the sum of squared deviations between the fitted line and the actual data points, and finds the line parameters that minimize this sum. The solution process involves establishing a system of normal equations and analytically solving for the slope and intercept values.
[0185] Coefficient verification and correction: The slope obtained from the fitting is physically validated. If the absolute value of the slope is lower than the system's preset noise threshold (e.g., caused by sensor jitter or quantization error), it is determined that there is no significant linear drift, and the slope is forcibly set to zero to avoid misjudging noise as a drift trend. If the slope exceeds a reasonable physical range (e.g., much greater than the maximum allowable deviation of the crystal oscillator), the fitting result is marked as invalid, and the valid model coefficients from the previous cycle are retained.
[0186] Model storage and updating: The calibrated slope and intercept are encapsulated into linear drift model coefficient vectors and stored in the local calibration data structure corresponding to each channel. After each sliding window update, the above fitting process is repeated to achieve online adaptive updating of the model coefficients.
[0187] The linear drift model described above enables low-overhead prediction and timestamp compensation for local clock drift.
[0188] S5.4: Based on the coefficients of the linear drift model, perform drift estimation processing based on the time axis mapping relationship to generate local drift prediction parameters for the corresponding future time window.
[0189] Receive the linear drift model coefficients output from step S5.3, including the slope parameter k characterizing the clock frequency deviation. drift With the intercept parameter b characterizing the initial phase shift offset This serves as the basic input data for estimating the drift amount.
[0190] Get the local hardware timestamp t for each uncalibrated event in the current pending event stream. local This timestamp is generated based on independent counters for each channel and reflects the original physical moment when the event occurred.
[0191] A linear mapping function is constructed from the local hardware time domain to the global unified logical time domain. This function uses the local hardware timestamp as the independent variable and the predicted global aligned timestamp as the dependent variable, aiming to eliminate the cumulative error caused by crystal oscillator frequency differences.
[0192] The local drift prediction compensation amount at any time within a future time window is calculated using the following formula:
[0193]
[0194] Where, Δt pred This indicates a specific local timestamp t. local The calculated predicted drift compensation amount, k drift The linear drift slope obtained from the fitting in step S5.3 reflects the relative deviation rate of the clock count per unit time, b offset This is the intercept term of the linear drift model, reflecting the instantaneous phase deviation at the current moment.
[0195] The calculated predicted drift compensation amount Δt pred Perform a validity check to see if the value is within the preset physical reasonable range. If the compensation amount overflows due to model overfitting or abnormal noise, clamp it to the maximum allowable drift threshold to prevent non-physical jumps in the time axis.
[0196] The verified predicted drift compensation amount is associated and encapsulated with the corresponding channel identifier, event sequence number and confidence level mark to form a structured local drift prediction parameter set. This parameter set directly describes the system's short-term evolution prediction result of the current channel clock behavior without the intervention of an external reference source.
[0197] By using the above-mentioned drift estimation method based on linear mapping relationship, the static model coefficients generated in the previous step are transformed into local drift prediction parameters that are dynamically adapted to each specific event time point. This realizes the data transformation from macro trend fitting to micro event-level compensation, providing an accurate and real-time correction basis for subsequent low-overhead timestamp recalibration, and significantly reducing the processing delay caused by waiting for global calibration instructions.
[0198] S5.5: Integrate the local drift prediction parameters with the current channel identification information, and perform parameter packaging processing based on the data structure encapsulation protocol to generate a local drift prediction data packet to be written into the calibration preparation queue.
[0199] Step S6: If the clock misalignment risk score is in the high-risk range, activate the full-channel collaborative calibration process and transmit the timestamp pairs of key anchor events to generate a global time reference correction command. Specifically, this includes:
[0200] S6.1: Based on the determination result that the clock inaccuracy risk score jumps to the high-risk range, perform feature scanning on the multi-channel time series event set within the current sliding time window, extract a subset of candidate events with significant spatiotemporal mutation characteristics, and generate a list of potential anchor point events to be screened.
[0201] The signal indicating that the received clock misalignment risk score jumps to the high-risk range serves as the trigger condition for initiating the full-channel collaborative calibration process.
[0202] Extract all raw touch event data generated by each channel within a preset time window from the multi-channel time sequence event set within the current sliding time window, and construct a local event pool to be analyzed.
[0203] For each event in the local event pool, its local hardware timestamp, two-dimensional coordinate position, pressure intensity value, and contact area parameters are parsed to establish a multi-dimensional feature index table.
[0204] Calculate the time interval difference between adjacent events to generate an event interval sequence in the time dimension, which is used to characterize the instantaneous rhythm changes of user interaction.
[0205] Calculate the Euclidean distance between adjacent events in screen space to generate a displacement sequence in the spatial dimension, which is used to characterize the continuity of the user's finger swipe trajectory.
[0206] Based on the time interval sequence and displacement sequence, a spatiotemporal joint feature vector is constructed, where the time component reflects the interaction frequency and the spatial component reflects the motion amplitude.
[0207] Define a spatiotemporal catastrophe detection operator. This operator quantifies the local singularity of an event by weighting and combining the absolute values of the first derivative of the time interval and the absolute values of the second derivative of the displacement, and calculates the spatiotemporal catastrophe index of the i-th event.
[0208] Peak detection is performed on the calculated spatiotemporal mutation index sequence to identify local maxima of the index. These points correspond to moments when user interaction behavior changes significantly, such as the start of a click, a change in direction, or the end of a rapid swipe.
[0209] A dynamic threshold filtering mechanism is set up to retain only candidate events whose spatiotemporal mutation index exceeds the mean plus twice the standard deviation within the current window, in order to filter out minor noise fluctuations and insignificant state transitions.
[0210] Cross-channel spatiotemporal correlation matching is performed on the selected candidate events to find event pairs that occur in close time and have a high degree of spatial overlap on different channels, confirming that they are projections of the same physical touch action on multiple sensors.
[0211] High-confidence candidate events that have been verified across channels are marked as potential anchor events, and their channel identifier, original timestamp, and spatial coordinate information are recorded.
[0212] Arrange all events marked as potential anchors in chronological order to generate a list of potential anchor events to be filtered.
[0213] By using the above-mentioned spatiotemporal mutation feature scanning and cross-channel correlation verification processing method, the multi-channel time series event set of the previous step is transformed into a list of potential anchor point events with high discriminativeness to be screened, so as to achieve the expected technical effect of accurately locating key calibration reference points from massive redundant data.
[0214] S6.2: Using the list of potential anchor point events to be screened, perform joint weighted calculation on the local curvature change rate and cross-channel spatial overlap of candidate events in each channel to screen out the key events with the highest time positioning accuracy and the most representative spatial distribution, so as to generate a multi-channel key anchor point event sequence.
[0215] Receive the list of potential anchor point events to be screened generated in step S6.1. This list contains candidate event data with significant spatiotemporal abrupt change characteristics detected by each touch channel in the high-risk range. Each candidate event carries a local hardware timestamp, two-dimensional coordinate position, pressure intensity value and contact area attribute.
[0216] For each candidate event in the list, extract the sequence of continuous historical trajectory points in the channel in which it is located, calculate the instantaneous velocity vector and acceleration vector based on the spatial displacement and time interval of adjacent trajectory points, and construct a local motion state descriptor.
[0217] Using the local motion state descriptor, curvature estimation is employed to calculate the degree of trajectory curvature at candidate event points. Specifically, the ratio of the cross product magnitude of the velocity vector and the acceleration vector to the cube of the velocity magnitude is calculated to obtain the local curvature change rate, which characterizes the precision and stability of touch operation.
[0218] The calculated original curvature values are normalized and mapped to the [0,1] interval to generate a curvature confidence factor that characterizes the accuracy of event time positioning in a single channel. The lower the curvature, the smoother and more stable the touch trajectory, and the smaller the corresponding timestamp capture error.
[0219] Parallel calculation of cross-channel spatial overlap is performed, traversing the candidate event set of all channel pairs, and calculating the Euclidean distance between any two candidate events from different channels in the screen coordinate system.
[0220] Set a spatial overlap threshold, mark channel pairs with an Euclidean distance less than the threshold as spatially overlapping event pairs, and count the number of times each candidate event participates in spatial overlap and the average overlap accuracy.
[0221] Based on the spatial overlap statistics, the cross-channel spatial overlap index of each candidate event is calculated. This index reflects the spatial consistency of the event from a multi-channel perspective. The higher the overlap, the higher the credibility of the event as a multi-channel synchronization benchmark.
[0222] A joint weighted scoring model is constructed, which linearly combines the normalized local curvature confidence factor with the cross-channel spatial overlap index, and the weight coefficients are adaptively adjusted according to the dynamic characteristics of the current interaction scenario.
[0223] The joint weighted scores of all candidate events are sorted in descending order, and the top N events with the highest scores are selected as key anchor events to ensure that the selected events are evenly distributed in time and cover the main interaction areas.
[0224] The selected key anchor events are deduplicated and conflict resolved. If multiple high-scoring events exist in the same time segment, the single event with higher spatial overlap and lower curvature is retained first to avoid redundant calibration data.
[0225] The final selected key anchor events are reorganized according to channel identifiers and timing logic to form a structured multi-channel key anchor event sequence, which includes a globally unique identifier, local timestamp, and spatial coordinate information for each anchor.
[0226] By combining the local curvature analysis and cross-channel spatial overlap calculation, the potential candidate events in the previous step are transformed into a multi-channel key anchor point event sequence with high temporal positioning accuracy and high spatial representativeness. This enables highly reliable screening of calibration reference points and significantly reduces clock calibration errors caused by touch jitter or single-channel noise.
[0227] S6.3: Based on the multi-channel key anchor event sequence, construct a simplified message structure that only contains the local hardware timestamp and global logical sequence number of the anchor event, and perform cross-channel point-to-point timestamp pair transmission operation to generate an anchor timestamp exchange dataset for drift calculation.
[0228] Receive the multi-channel key anchor point event sequence output by step S6.2. The sequence contains key event objects with significant spatiotemporal mutation characteristics selected by each touch channel at the high-risk calibration trigger time. Each object carries a local hardware timestamp, global logical sequence number, channel identifier and spatial coordinate attributes.
[0229] The data structure serialization operation is performed on the multi-channel key anchor point event sequence to remove unnecessary physical attribute fields such as pressure intensity, contact area and original coordinate data, and retain only the core metadata used for time sequence alignment, including channel ID, local counter value when the event occurs and globally unique logical index allocated by the system, in order to build a lightweight data payload.
[0230] Based on the retained core metadata, a simplified message structure is defined. This structure uses a combination of a fixed-length header and a variable-length data area. The header contains a message type identifier, a source channel mask, and a timestamp precision marker. The data area arranges the local timestamps and global logical sequence numbers of anchor events in channel order to ensure that the message size is minimized and to reduce bus transmission latency.
[0231] The constructed simplified message structure is encapsulated into cross-channel point-to-point transmission protocol data packets. For the master-slave channel architecture, the master control channel serves as the time reference source, and each slave channel serves as a node to be calibrated. A one-way or two-way timestamp exchange link is established, and the data packets are injected into the underlying hardware interrupt handling process according to the preset communication priority queue.
[0232] The system performs cross-channel point-to-point timestamp pair transmission operations. The master channel broadcasts the global logical sequence number and high-precision reference timestamp of its key anchor point event. After receiving the data, each slave channel immediately records its own local hardware timestamp of the corresponding global logical sequence number event and forms a timestamp pair with the received reference timestamp. The pairs are then transmitted back to the central processing unit via shared memory or a high-speed serial interface.
[0233] The central processing unit collects timestamp pairs returned by all channels, verifies the consistency of the global logical sequence number, removes invalid data pairs caused by packet loss or out-of-order delivery, and groups and aggregates the valid timestamp pairs according to the channel identifier to form a mapping table containing the reference time of the master channel and the local time of each slave channel.
[0234] The mapping table is subjected to a standardized format conversion, and the discrete timestamp pairs are integrated into a structured anchor timestamp exchange dataset. This dataset explicitly records the difference distribution of local clock readings of each channel at the same global logical moment, providing high-confidence input samples for subsequent drift parameter calculation.
[0235] By constructing a simplified message structure containing only core timing information and performing efficient cross-channel point-to-point transmission, the key anchor events selected in the previous step are transformed into a standardized anchor timestamp exchange dataset. This achieves multi-channel time base synchronization information interaction with minimal communication overhead, laying a data foundation for high-precision clock drift calculation.
[0236] S6.4: Based on the anchor timestamp exchange dataset, the least squares method is used to fit the linear clock drift slope and initial phase offset of each slave channel relative to the master channel, and error parameter calculation is performed to generate a global clock drift parameter set characterizing the timing deviation between channels.
[0237] Receive the anchor point timestamp exchange dataset generated in step S6.3. This dataset contains paired timestamp records of the master channel and multiple slave channels at key interaction moments, which serve as the raw input data for clock drift parameter calculation.
[0238] The anchor timestamp exchange dataset is preprocessed, and the global logical timestamp sequence of the master channel is extracted as the independent variable benchmark. At the same time, the local hardware timestamp sequence corresponding to each subordinate channel is extracted as the dependent variable observation, and a two-dimensional coordinate point set is constructed for linear regression analysis.
[0239] For each slave channel, a linear mapping model between local time and global time is established. It is assumed that there is a constant frequency deviation (slope) and initial phase offset (intercept) between the two. The linear equation is defined as y = kx + b, where x is the master channel timestamp, y is the slave channel timestamp, k is the clock drift slope, and b is the initial phase offset.
[0240] An error objective function is constructed using the least squares method, aiming to minimize the sum of squared residuals between the actual observation timestamps of the subordinate channels and the predicted timestamps of the linear model in all anchor-paired data, in order to determine the optimal values of the k and b parameters.
[0241] Construct the following least squares loss function formula:
[0242]
[0243] Where N is the logarithm of valid anchor point events within the current sliding time window, and x i Let y be the timestamp of the master control channel in the i-th anchor event. i Let be the local hardware timestamp of the slave channel in the i-th anchor event, k be the clock drift slope to be solved, and b be the initial phase offset to be solved.
[0244] To find the parameters k and b that minimize the loss function L(k, b), we take the partial derivatives with respect to k and b, and set them to zero, resulting in a system of normal equations. Rearranging these equations, we obtain the formulas for calculating the clock drift slope k and the initial phase offset b.
[0245] Iterate through all slave channels, successively substituting the anchor timestamp data of each channel, and independently calculate the dedicated clock drift slope k of each slave channel relative to the master channel using the formula. j and initial phase offset b j , where j represents the subordinate channel index.
[0246] The calculated drift slopes and phase offsets of each channel are combined into structured data to form a global clock drift parameter set containing channel ID, slope value, intercept value, and fitting confidence index.
[0247] By employing least squares fitting, discrete anchor timestamp pairing data is transformed into a continuous set of global clock drift parameters. This enables precise quantification of the nonlinear drift characteristics of each slave channel clock, providing a basis for subsequent high-precision timestamp recalibration.
[0248] S6.5: Based on the global clock drift parameter group, construct a control instruction package containing the target channel identifier, compensation slope value and phase correction amount, and perform instruction encapsulation and broadcast distribution operations to generate a global time base correction instruction to drive the subsequent interpolation compensation module.
[0249] Step S7: Based on the local drift prediction parameters or the global time base correction command, the time axis offset corresponding to each subsequent unprocessed event is calculated through interpolation compensation, and the timestamps of the events are recalibrated using the time axis offsets to generate a calibrated event stream after time base unification. Specifically, this includes:
[0250] S7.1: Obtain local drift prediction parameters or global time base correction commands as input control sources, and convert the frequency deviation values and phase offsets in the input control sources into a basic time axis offset sequence in the standard time domain based on linear mapping, so as to generate the basic time correction vector to be applied.
[0251] S7.2: Receive the set of unprocessed subsequent events from the raw event stream of the multi-touch channel, extract the local hardware timestamp and event arrival time index carried by each event, and construct the time-series anchor dataset to be recalibrated.
[0252] S7.3: Based on the event arrival time index in the time-series anchor point dataset to be recalibrated, the basic time correction vector is spatiotemporally discretized using piecewise linear interpolation, and the instantaneous time axis offset of each subsequent unprocessed event is calculated to generate a refined time compensation coefficient list.
[0253] Read the arrival time index of each subsequent unprocessed event in the time-series anchor point dataset to be recalibrated. This index represents the relative position of the event on the system's global time axis and serves as the input of the independent variable for interpolation calculation.
[0254] Extract the known discrete calibration point sequence from the base time correction vector. The sequence contains the cumulative time axis offset of several key time nodes, which constitutes the node dataset of the interpolation function.
[0255] Determine the position of the arrival time index of the current event to be processed within the interval between two adjacent calibration points in the base time correction vector, and identify the predecessor calibration point and the successor calibration point and their corresponding timestamp and offset values.
[0256] Based on the principle of linear interpolation, the time ratio coefficient of the event to be processed relative to the predecessor calibration point is calculated. This coefficient reflects the relative weight of the event time within the calibration interval.
[0257] The instantaneous time axis offset is calculated using the following formula:
[0258]
[0259] in, The instantaneous time axis offset is calculated. Indexed by the arrival time of the current event. and These are the timestamps of adjacent calibration points. and These represent the time axis offsets corresponding to adjacent calibration points.
[0260] The calculated instantaneous time axis offset is associated with the event identifier and encapsulated to form a key-value pair structure containing time compensation information.
[0261] Iterate through all subsequent unprocessed events in the dataset of time-series anchor points to be recalibrated, and repeat the above interval positioning and offset calculation process until all unprocessed events are covered.
[0262] Arrange and combine all generated instantaneous time axis offsets in chronological order of event arrival to construct a continuous time compensation sequence.
[0263] The basic time correction vector is spatiotemporally discretized by piecewise linear interpolation, transforming the basic time correction vector from the previous step into a refined list of time compensation coefficients covering all unprocessed events. This achieves continuous time deviation mapping from sparse calibration points to dense event streams, ensuring that each event receives a clock compensation value that precisely matches its occurrence time.
[0264] S7.4: For each event in the set of subsequent unprocessed events, perform an algebraic superposition operation on its original local hardware timestamp and the corresponding instantaneous time axis offset in the list of refined time compensation coefficients to generate a target calibration timestamp after recalibration.
[0265] Obtain a single target event object from the set of events to be recalibrated, extract its original local hardware timestamp value and the event arrival time index determined in the preceding step S7.2, and use it as the primary key for querying the time axis offset.
[0266] Based on the event arrival time index, perform a binary search or linear interpolation positioning operation in the refined time compensation coefficient list to retrieve the two discrete compensation nodes closest to the event arrival time, and obtain the instantaneous time axis offset of the predecessor node and the instantaneous time axis offset of the successor node respectively.
[0267] Calculate the time difference between the arrival time of the target event and the timestamp of the predecessor node, and divide this time difference by the time interval between the predecessor node and the successor node to obtain the linear interpolation scaling factor used for weighted calculation, ensuring the continuity of the offset mapping.
[0268] The instantaneous time axis offset corresponding to the target event is calculated using the following linear interpolation formula:
[0269]
[0270] in, For the target event at the arrival time The instantaneous time axis offset at that point. and These are the instantaneous time axis offsets of the predecessor node and the successor node, respectively. and These are the timestamps corresponding to the predecessor and successor nodes, respectively.
[0271] The calculated instantaneous time axis offset is algebraically superimposed on the original local hardware timestamp of the target event, that is, the original timestamp value is added to the instantaneous time axis offset to eliminate timing deviations caused by clock drift.
[0272] The result of the superposition operation is subjected to integer rounding. According to the system's preset time resolution accuracy requirements, the floating-point calibration timestamp is converted into an integer timestamp value that conforms to the message specification, and the target calibration timestamp after recalibration is generated.
[0273] By using the above linear interpolation and algebraic superposition processing method, the discretized basic time correction vector generated in the previous step is transformed into continuous and accurate target calibration timestamp data, which realizes high-precision unification of the time reference for multi-channel touch events and ensures that the time series received by the subsequent event synchronization module has a high degree of consistency.
[0274] For example, in a multi-channel capacitive touchscreen system, there is a microsecond-level clock drift between the master channel and the slave channel. Assume the target event to be processed is a finger swipe touch acquired by the slave channel, with an original local hardware timestamp of 1000500 microseconds. The event arrival time index points to the 100th sampling point in the refined time compensation coefficient list. In the compensation coefficient list generated in the preceding step S7.3, the timestamp corresponding to the 100th node (predecessor node) is 1000400 microseconds, with an instantaneous time axis offset of +12.5 microseconds; the timestamp corresponding to the 101st node (successor node) is 1000600 microseconds, with an instantaneous time axis offset of +13.1 microseconds. First, the time difference between the target event arrival time of 1000500 microseconds and the predecessor node's timestamp of 1000400 microseconds is calculated to be 100 microseconds. The time interval between the predecessor and successor nodes is 200 microseconds, resulting in a linear interpolation scaling factor of 0.5. Next, the instantaneous time axis offset is calculated using the linear interpolation formula: δ(1000500) = 12.5 + 0.5 * (13.1 - 12.5) = 12.5 + 0.3 = 12.8 microseconds. Then, this instantaneous offset of 12.8 microseconds is algebraically superimposed with the original timestamp of 1000500 microseconds to obtain 1000512.8 microseconds. Finally, rounding is performed to generate the final target calibration timestamp of 1000513 microseconds. This process effectively compensates for the cumulative drift error of the slave channel relative to the master channel, making the position of the touch event on a unified time axis more accurate, significantly improving the timing alignment accuracy of multi-finger gesture recognition, and avoiding gesture breakage or misjudgment caused by timestamp misalignment.
[0275] S7.5: Replace the local hardware timestamp field in the original event stream with the target calibration timestamp, and retain the basic attribute data such as coordinates, pressure and contact area unchanged. Reorganize the event message structure of each channel to output a calibration event stream with a unified time reference.
[0276] The system receives the target calibration timestamp after recalibration and the corresponding original event basic attribute data, including coordinate position, pressure intensity, contact area and event type code, as the input source for message reassembly.
[0277] A standardized unified time base event data structure is constructed, which includes a globally unique event identifier, a channel source identifier, a unified calibration timestamp field, and a multi-dimensional physical attribute load area to ensure the consistency of data format across channels at the logical level.
[0278] The generated target calibration timestamp is written into the timestamp field of the unified time base event data structure, replacing the original local hardware counter value or the uncorrected initial timestamp, thus establishing the precise position of the event on the global timeline.
[0279] Non-time-sensitive attributes such as coordinate position, pressure intensity, contact area and event type code are extracted from the original event stream, and their original numerical accuracy and dimensions are kept unchanged. They are then directly mapped to the physical attribute load area of the unified time base event data structure.
[0280] Perform data integrity checks to verify the validity of the calibration timestamp and the non-empty state of the physical attribute data, prevent message distortion caused by data truncation or transmission errors, and ensure the semantic integrity of the reassembled event object.
[0281] The recombined event objects are classified and indexed based on the channel source identifier, and a fast retrieval mapping table based on the channel ID is established so that the downstream synchronization module can efficiently distinguish and process independent event streams from different touch sensors.
[0282] Following the chronological order of the global timeline, the recombined event objects of each channel are sequentially filled into the output buffer queue, forming a linear event sequence with strict timing logic, thus eliminating the out-of-order phenomenon caused by multi-channel concurrency.
[0283] The event sequence in the output buffer queue is serialized and encapsulated, and a frame header synchronization word, a data packet length identifier, and a cyclic redundancy check code are added to generate a standardized data packet that conforms to the communication protocol specification.
[0284] Through the above message reassembly and serialization encapsulation processing, the discrete calibration timestamps and original physical attributes generated in the previous step are transformed into a calibration event stream with a unified time base and standardized structure. This achieves strict alignment of multi-channel touch events in the time dimension and standardized output of data format, providing a highly consistent data foundation for subsequent event synchronization and interaction logic parsing.
[0285] Step S8: Based on the statistical characteristics of the time-referenced calibrated event stream, update the baseline parameters of the event density statistical model and the fluctuation threshold of the cross-channel sequence alignment. Specifically, this includes:
[0286] S8.1: Obtain the global timestamp sequence and channel identifier attributes in the calibration event stream after time standardization, and perform sliding window resampling processing on the global timestamp sequence to generate a standardized time series event set with fixed time resolution.
[0287] S8.2: Based on the standardized time-series event set, independently calculate the event count value within a unit time window for each touch channel and perform a first-order difference operation to generate an event density change rate sequence that characterizes the current interaction rhythm.
[0288] S8.3: Construct a probability distribution model using the event density change rate sequence and extract the statistical moment features of its long-term stable interval. Perform exponential weighted moving average filtering on the statistical moment features to generate updated event density baseline parameters.
[0289] S8.4: Based on the interaction time periods divided by the updated event density baseline parameters, extract the event time series representation of each channel within the corresponding time window and re-execute the dynamic time warping algorithm to generate a cross-channel sequence deformation cost distribution set that reflects the current device synchronization status.
[0290] S8.5: Calculate the percentile threshold based on the cross-channel sequence deformation cost distribution set and fuse it with the historical calibration residual convergence speed index. Perform adaptive offset correction processing on the percentile threshold to generate an adaptive evolution configuration that adapts to the current device status and user habits.
[0291] Receive the cross-channel sequence deformation cost distribution set generated in step S8.4. This distribution set contains the dynamic time warping distance values calculated within multiple historical sliding time windows, serving as the original data basis for characterizing the current multi-channel timing synchronization state.
[0292] The cross-channel sequence deformation cost distribution set is sorted and statistically analyzed to extract percentile values at a specified confidence level and construct an initial threshold benchmark that reflects the normal synchronization error boundary of the system.
[0293] By employing the inverse operation method of the cumulative distribution function, the sorted deformation cost sequence is traversed to locate the critical point where the cumulative probability reaches the upper limit of the preset confidence interval, and the deformation cost corresponding to the critical point is determined as the original percentile threshold.
[0294] The original percentile threshold is calculated using the following formula:
[0295]
[0296] Among them, T raw D is the original percentile threshold. sorted The sorted cross-channel sequence deformation cost sequence is N, where N is the total number of samples, P is the preset reliability ratio (e.g., 0.95), and the symbol ⌈⌉ indicates the rounding up operation.
[0297] Obtain the residual convergence speed index after historical calibration. This index reflects the number of iterations or time span required for the system clock error to decay to a stable state after the previous calibration operation, and is used to quantify the stability characteristics of the current hardware clock source.
[0298] The residual convergence speed index is normalized and mapped to a range of zero to one to generate a convergence confidence factor characterizing the stability of the clock source. The faster the convergence speed, the closer the factor is to one, indicating that the system has a lower tolerance for threshold fluctuations.
[0299] The original percentile threshold and the convergence confidence factor are combined, and an adaptive offset correction process is performed. The original threshold is dynamically weighted and adjusted using the convergence confidence factor to generate a final fluctuation threshold that adapts to the current device status and user habits.
[0300] A high convergence confidence factor indicates that the clock source is stable, and the system tends to tighten the threshold to capture small drift trends; a low convergence confidence factor indicates that the clock source jitter is large, and the system tends to relax the threshold to avoid false calibration.
[0301] The final fluctuation threshold in the adaptive evolution configuration is generated using the following formula:
[0302]
[0303] Among them, T final α is the final fluctuation threshold, α is the adjustment coefficient used to control the sensitivity of the convergence speed to the threshold, and C is the convergence confidence factor.
[0304] The generated final fluctuation threshold is written into the configuration parameter area of the event density statistical model, replacing the original fixed threshold, thus completing the dynamic update of the decision logic of the cross-channel sequence alignment module.
[0305] By using the above adaptive offset correction method, the deformation cost distribution and historical convergence characteristics of the previous step are transformed into dynamically adjusted fluctuation threshold data, realizing the adaptability of the calibration triggering mechanism to the degree of equipment aging and environmental interference factors, and significantly reducing the false alarm or missed alarm rate caused by threshold rigidity.
[0306] For example, in a high-concurrency multi-touch interaction scenario, the system collects cross-channel sequence deformation cost data within the past 100 sliding time windows. After sorting, the deformation cost value corresponding to the 95th percentile is 12.5 milliseconds, i.e., T. raw =12.5. Historical data shows that the residual convergence rates for the last 5 calibrations were 10ms, 12ms, 11ms, 13ms, and 12ms, respectively, with the current convergence rate V=12ms. Historical extreme value V min =8ms, V max=20ms. Substitute into the formula to calculate the convergence confidence factor C = 1 - (12 - 8) / (20 - 8) = 1 - 4 / 12 ≈ 0.67. Set the adjustment coefficient α = 0.5. Substitute into the final threshold formula to calculate: T final =12.5*(1+0.5*(1-0.67))=12.5*(1+0.165)=12.5*1.165≈14.56 milliseconds. The system dynamically adjusts the fluctuation threshold for cross-channel sequence alignment from the default 10 milliseconds to 14.56 milliseconds. Under this configuration, the system effectively filters out noise interference caused by slight clock jitter, avoids unnecessary frequent calibration, and retains the ability to detect significant drifts exceeding 14.56 milliseconds. This reduces the calibration trigger frequency by approximately 40%, while maintaining event synchronization accuracy at the sub-millisecond level, significantly improving the system's energy efficiency.
[0307] For those skilled in the art, various other corresponding changes and modifications can be made based on the technical solutions and concepts described above, and all such changes and modifications should fall within the protection scope of the claims of this invention.
[0308] Unless otherwise defined, the technical or scientific terms used herein shall have the ordinary meaning as understood by one of ordinary skill in the art to which this application pertains. The terms “first,” “second,” “third,” and similar terms used in this patent application specification and claims do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Similarly, the terms “an” or “a” and similar terms do not indicate a quantity limitation, but rather indicate the presence of at least one. The terms “comprising” or “including” and similar terms mean that the elements or objects preceding “comprising” or “including” encompass the elements or objects listed following “comprising” or “including” and their equivalents, and do not exclude other elements or objects. The “multiple” mentioned in the embodiments of this application refers to two or more. A and / or B indicate three possibilities: A; B; and A and B.
[0309] The above description is merely an exemplary embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and such modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A touch event synchronization and message reassembly method based on multi-channel timestamp alignment, specifically including: S1: Obtain the raw event stream from the multi-touch channels and form a multi-channel timing event set; S2: Based on a multi-channel time-series event set, a sliding time window is independently constructed for each channel and the number of events within a unit time window is calculated. The step change in event density is detected by sliding window difference, and an event density statistical model representing the rhythm of user interaction is generated. S3: Using the interactive time periods divided by the event density statistical model, extract the event time series representation of each channel within the corresponding time window, perform cross-channel sequence comparison, calculate the time deformation cost of any two channel event sequences, and generate cross-channel sequence deformation cost index. S4: Integrate the event density change rate, cross-channel sequence deformation cost index and historical calibration residual convergence speed in the event density statistical model, perform multi-dimensional weighted calculation, and generate a clock misalignment risk score that quantifies the degree of clock misalignment; S5: If the clock misalignment risk score is in the low to medium risk range, start local drift prediction and generate local drift prediction parameters; S6: If the clock misalignment risk score is in the high-risk range, activate the full-channel collaborative calibration process and transmit the timestamp pairs of key anchor events to generate a global time reference correction command. S7: Based on local drift prediction parameters or global time base correction instructions, calculate the time axis offset corresponding to each subsequent unprocessed event through interpolation compensation, and use the time axis offset to recalibrate the timestamp of the event to generate a calibrated event stream after time base unification.
2. The touch event synchronization and message reassembly method based on multi-channel timestamp alignment according to claim 1, characterized in that, The raw event stream contains local hardware timestamps and basic attribute data for each channel.
3. The touch event synchronization and message reassembly method based on multi-channel timestamp alignment according to claim 1, characterized in that, Following S7, the following also includes: S8: Based on the statistical characteristics of the calibrated event stream after time standardization, update the baseline parameters of the event density statistical model and the fluctuation threshold of the cross-channel sequence alignment.
4. The touch event synchronization and message reassembly method based on multi-channel timestamp alignment according to claim 1, characterized in that, S3 specifically includes: Based on the interaction time period boundary identifiers output by the event density statistical model, the multi-channel time series event set is sliced to generate candidate event subset sequences. For each channel data in the candidate event subset sequence, the local hardware timestamp is extracted as a time dimension feature and mapped to a normalized time vector to generate an event time series representation vector that represents the interaction rhythm of a single channel. Based on the event time series representation vector, a distance cost matrix between any two channels is constructed. A global path search is performed to find the minimum cumulative distance path, so as to generate the minimum cumulative distance value of the optimal solution representing the time axis alignment. A standardization operation is performed based on the ratio of the deviation between the minimum cumulative distance value and the ideal linear alignment reference distance to generate the raw deformation metric parameters for quantifying the magnitude of the inter-channel time synchronization error. Weighted aggregation is performed on the original deformation metric parameters of all channel pairs to generate a cross-channel sequence deformation cost index that ultimately characterizes the overall clock misalignment trend of the system.
5. The touch event synchronization and message reassembly method based on multi-channel timestamp alignment according to claim 4, characterized in that, The candidate event subset sequence contains local high-density touch events.
6. The touch event synchronization and message reassembly method based on multi-channel timestamp alignment according to claim 1, characterized in that, S4 specifically includes: Based on the event quantity sequence per unit time window in the event density statistical model, a first-order difference operation is performed to calculate the difference in the number of events between adjacent time windows, and the difference is normalized to generate the event density change rate. By utilizing the dynamic time warping distance value in the cross-channel sequence deformation cost index and combining it with a preset time deformation benchmark threshold, deviation ratio mapping processing is performed to generate a sequence desynchronization factor that characterizes the trend of multi-channel time series consistency degradation. Based on the error decay slope in the historical calibrated residual convergence rate data, exponential smoothing filtering is performed to extract the residual convergence confidence parameter. Based on the event density change rate, sequence desynchronization factor, and residual convergence confidence parameter, a weighted summation operation is performed by calling a pre-set multi-dimensional weight allocation matrix to generate an original risk accumulation value that comprehensively reflects the current system clock state. The original risk accumulation value is processed by a nonlinear sigmoid function to convert the dimensionless accumulation value into an interval-standardized quantized clock misalignment risk score, which serves as the final decision variable to trigger local drift prediction or global collaborative calibration process.
7. The touch event synchronization and message reassembly method based on multi-channel timestamp alignment according to claim 6, characterized in that, The event density change rate characterizes the degree of abrupt changes in the rhythm of user interaction.
8. The touch event synchronization and message reassembly method based on multi-channel timestamp alignment according to claim 6, characterized in that, The residual convergence confidence parameter characterizes the effectiveness of the current clock drift compensation.
9. The touch event synchronization and message reassembly method based on multi-channel timestamp alignment according to claim 1, characterized in that, S5 specifically includes: Obtain the short-time historical event timestamp sequence of the current channel in the multi-channel time series event set, and perform time interval extraction processing based on the difference operation of adjacent timestamps to generate a short-time historical event interval sequence; Receive short-term historical event interval sequences, perform data smoothing and outlier removal based on a sliding window mechanism to generate cleaned standard event interval sequences; Using the cleaned standard event interval sequence, linear regression fitting is performed based on the least squares method to generate linear drift model coefficients that characterize the clock frequency deviation trend. Based on the coefficients of the linear drift model, drift estimation is performed based on the time axis mapping relationship to generate local drift prediction parameters for the corresponding future time window; The local drift prediction parameters are integrated with the current channel identification information, and the parameter packaging process is performed based on the data structure encapsulation protocol to generate a local drift prediction data packet to be written to the calibration preparation queue.
10. The touch event synchronization and message reassembly method based on multi-channel timestamp alignment according to claim 9, characterized in that, The short-term historical event interval sequence represents the touch interaction rhythm.
