Pulse-silence-based stimulation output configuration security update method, system, medium, terminal and program product
Patent Information
- Application Number
- CN202611507943.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-28
- Publication Date
- 2026-10-30
AI Technical Summary
对于运行过程中需要改写的刺激参数,若采用屏蔽波形发生器中断的方式保护参数写入过程,则可能影响依赖所述中断执行的刺激波形实时控制过程;而若保持波形发生器中断正常响应,仅依据当前处于静默阶段这一状态启动参数更新,则由于参数写入需要一定的执行时间,参数更新操作可能在尚未完成时进入下一刺激输出阶段
[0020]本申请通过将脉冲静默状态判定、安全更新窗口的时间余量控制、波形发生器中断持续响应以及刺激参数和电极矩阵的协调更新相结合,实现对刺激输出配置更新开始时机和执行过程的双重约束,降低带电切换、参数更新跨越输出段、刺激参数异常以及电极矩阵误配置等风险,提高多通道电刺激设备刺激输出配置更新过程的实时性、稳定性和安全性。
Smart Images

Figure CN122998609A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electrode matrix safe switching technology, and in particular to a method, system, medium, terminal and program product for safe updating of stimulation output configuration based on pulse quiescence period. Background Technology
[0002] In multi-channel electrical stimulation devices, the connection between the current source and different stimulation electrodes is typically established through an electrode matrix, and a waveform generator controls the current source to output stimulation pulses according to preset stimulation parameters. As the stimulation program, stimulation intensity, or stimulation channel combination changes, stimulation parameters such as stimulation amplitude, pulse width, frequency, and silence time need to be adjusted accordingly, and the electrode connection relationships in the electrode matrix need to be adjusted when changes in stimulation electrodes are involved.
[0003] Because the electrode matrix is directly associated with the stimulation output path of the current source, switching the electrode matrix during the stimulation pulse output process can easily cause unexpected intermediate states in the switching process between the original electrode connection relationship and the new electrode connection relationship, resulting in transient glitches, channel misconduction, or crosstalk. Furthermore, when the new electrode configuration involves multiple electrode switches, updating each electrode switch separately may create temporary conduction paths that are inconsistent with the target electrode connection relationship before the electrode matrix completes the target configuration.
[0004] Furthermore, updating the stimulus output configuration typically involves rewriting the corresponding parameter registers of the waveform generator. If the stimulus parameters are updated directly during the stimulus output process, some stimulus parameters may be updated while others remain unchanged. When the stimulus parameter update is accompanied by electrode matrix switching, new electrode connections may be established before the corresponding stimulus parameters have been updated, thus affecting the stability of the stimulus pulse output. Especially in multi-current source output scenarios, the recovery timing after the stimulus output configuration update may also affect the pulse output relationship between different current sources.
[0005] During the real-time control of the stimulation device, the waveform generator can generate an interrupt at a preset position. The controller responds to the interrupt to perform operations such as output beat maintenance, pulse counting, silence control, and soft start. For stimulation parameters that need to be modified during operation, if the parameter writing process is protected by disabling the waveform generator interrupt, it may affect the real-time control process of the stimulation waveform that depends on the interrupt. However, if the waveform generator interrupt is kept in normal response and parameter updates are initiated only based on the current silence phase, the parameter update operation may enter the next stimulation output phase before the parameter writing process is completed, since parameter writing requires a certain execution time.
[0006] Therefore, when the stimulus output is in a silent phase, how to further determine a safe update timing with sufficient update time margin so that the stimulus output configuration update operation can be completed before the start of the next stimulus output phase, while avoiding the impact on the real-time control of the stimulus waveform by interrupting the waveform generator, and ensuring the safety and integrity of electrode matrix switching when electrode combination changes are involved, remains a problem that needs to be solved in the process of multi-channel electrical stimulation output control.
[0007] Therefore, it is necessary to provide a method, system, medium, terminal, and program product for securely updating stimulus output configuration based on pulse quiescence period to solve the above-mentioned problems in the prior art. Summary of the Invention
[0008] In view of the shortcomings of the prior art described above, the purpose of this application is to provide a method, system, medium, terminal and program product for securely updating stimulus output configuration based on pulse quiescence period, so as to solve the above problems.
[0009] To achieve the above and other related objectives, a first aspect of this application provides a method for safely updating stimulus output configuration based on a pulse quiescent period, comprising: acquiring stimulus output configuration parameters to be updated; determining that the current stimulus output is in a pulse quiescent period based on the operating state of the waveform generator and the electrical state of the electrode matrix; within the pulse quiescent period, determining a safe update window based on the start time of the next output segment of the current source, the maximum execution duration of the stimulus output configuration update operation, and a preset protection margin, such that when the stimulus output configuration update operation is initiated within the safe update window, the sum of the current time, the maximum execution duration, and the preset protection margin is not later than the start time of the next output segment. Within the safety update window, the interrupt of the waveform generator is kept enabled, and the stimulation output configuration update operation is initiated according to the stimulation output configuration parameters to be updated. The stimulation output configuration update operation includes updating stimulation parameters, and when the stimulation output configuration parameters to be updated involve changes in electrode combinations, it also includes updating the electrode matrix. After confirming that the stimulation output configuration update operation is completed within the safety update window and the update verification passes, the current source is controlled to restore stimulation pulse output according to the updated stimulation output configuration. If the stimulation output configuration update operation is not completed within the safety update window or the update verification fails, the restoration of stimulation pulse output is prohibited.
[0010] In some embodiments of the first aspect of this application, determining that the current stimulus output is in a pulse silence period based on the operating state of the waveform generator and the electrical state of the electrode matrix specifically includes: determining whether each current source is currently in the pulse output stage based on the output progress of the waveform generator, and updating the corresponding pulse state identifier according to the output state of each current source; obtaining the electrical detection result corresponding to the electrode matrix, and determining whether the electrode matrix meets the preset electrical silence condition based on the electrical detection result; when there is no current source in the pulse output stage and the electrode matrix meets the preset electrical silence condition, determining that the current stimulus output is in the pulse silence period.
[0011] In some embodiments of the first aspect of this application, determining the safety update window during the pulse silence period specifically includes: after detecting that the current source has entered a silence state, initiating a timing control operation; determining the end time corresponding to the safety update window according to the timing control operation, and disabling the execution permission of the stimulus output configuration update operation when the end time is reached, wherein the end time corresponding to the safety update window is located before the start time of the next output segment.
[0012] In some embodiments of the first aspect of this application, the timing control operation is implemented by a hardware timer; wherein the hardware timer starts after the current source enters a silent state and is triggered at a preset advance time before the start of the next output segment of the corresponding current source, so as to maintain a time margin between the start time of the stimulus output configuration update operation and the next output segment.
[0013] In some embodiments of the first aspect of this application, the step of performing the stimulus output configuration update operation according to the stimulus output configuration parameters to be updated specifically includes: caching the stimulus output configuration parameters to be updated; updating the stimulus parameters corresponding to the waveform generator according to the cached stimulus output configuration parameters to be updated within the security update window; wherein the stimulus parameters include at least one of current amplitude, pulse width, frequency, silence time, and stimulus mode.
[0014] In some embodiments of the first aspect of this application, when the stimulus output configuration parameters to be updated involve changes in electrode combinations, the stimulus output configuration parameters to be updated further include a matrix electrode configuration. The electrode matrix update includes: determining the target switch state corresponding to each electrode switch according to the matrix electrode configuration; combining each target switch state to form a complete matrix configuration frame; writing the complete matrix configuration frame into a matrix switch chip within the security update window to control the electrode matrix to switch to the corresponding target electrode connection relationship; after the complete matrix configuration frame is written, performing a readback verification on the electrode matrix or performing a communication verification on the transmission result of the complete matrix configuration frame, and determining that the electrode matrix update is complete when the verification passes.
[0015] To achieve the above and other related objectives, a second aspect of this application provides a stimulation output configuration safety update system based on a pulse quiescent period, comprising a controller, a waveform generator, a current source, and an electrode matrix; the waveform generator is used to generate stimulation waveforms, the current source is used to output stimulation pulses, and the electrode matrix is disposed in the stimulation output path of the current source; the controller is used to acquire the stimulation output configuration parameters to be updated; based on the operating state of the waveform generator and the electrical state of the electrode matrix, it is determined that the current stimulation output is in a pulse quiescent period; within the pulse quiescent period, a safety update window is determined based on the start time of the next output segment of the current source, the maximum execution duration of the stimulation output configuration update operation, and a preset protection margin, such that when the stimulation output configuration update operation is initiated within the safety update window, the current time, the current output, and the current output are all within the pulse quiescent period. The sum of the maximum execution time and the preset protection margin shall not be later than the start time of the next output segment; within the safety update window, the interrupt of the waveform generator shall be kept enabled, and the stimulation output configuration update operation shall be initiated according to the stimulation output configuration parameters to be updated; wherein, the stimulation output configuration update operation includes stimulation parameter update, and when the stimulation output configuration parameters to be updated involve changes in electrode combination, it also includes electrode matrix update; the controller is further configured to control the current source to restore stimulation pulse output according to the updated stimulation output configuration after determining that the stimulation output configuration update operation is completed within the safety update window and the update verification is passed; if the stimulation output configuration update operation is not completed within the safety update window or the update verification fails, the current source shall be prohibited from restoring stimulation pulse output.
[0016] To achieve the above and other related objectives, a third aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method.
[0017] To achieve the above and other related objectives, a fourth aspect of this application provides a computer program product comprising computer program code that, when executed on a computer, causes the computer to implement the method.
[0018] To achieve the above and other related objectives, a fifth aspect of this application provides an electronic terminal, including a memory, a processor, and a computer program stored in the memory; the processor executes the computer program to implement the method.
[0019] As described above, this application has the following beneficial effects:
[0020] This application combines pulse silence state determination, time margin control of safety update window, continuous response to waveform generator interruption, and coordinated update of stimulation parameters and electrode matrix to achieve dual constraints on the start timing and execution process of stimulation output configuration update. This reduces risks such as live switching, parameter updates crossing output segments, abnormal stimulation parameters, and misconfiguration of electrode matrix, thereby improving the real-time performance, stability, and safety of the stimulation output configuration update process of multi-channel electrical stimulation equipment. Attached Figure Description
[0021] Figure 1 The diagram shows a flowchart of a security update process for stimulus output configuration based on pulse quiescence period in one embodiment of this application.
[0022] Figure 2 The diagram shown is a structural schematic of a security update of stimulus output configuration based on pulse quiescence period in one embodiment of this application.
[0023] Figure 3 The diagram shown is a structural schematic of an electronic terminal according to an embodiment of this application. Detailed Implementation
[0024] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be noted that, unless otherwise specified, the following embodiments and features in the embodiments can be combined with each other.
[0025] In the embodiments of this application, the terms "first" and "second" are used to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and that the terms "first" and "second" do not necessarily imply that they are different.
[0026] It should be noted that, in the embodiments of this application, the words "exemplary" or "for example" indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0027] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0028] To facilitate understanding of the embodiments of this application, firstly, in conjunction with Figure 1 Detailed explanation. Figure 1 This document illustrates a flowchart of a method for securely updating stimulus output configuration based on a pulse quiescence period, as described in an embodiment of the present invention. The method for securely updating stimulus output configuration based on a pulse quiescence period in this embodiment mainly includes the following steps:
[0029] Step S11: Obtain the configuration parameters of the stimulus output to be updated.
[0030] Specifically, upon receiving an external command, the command is parsed and its parameters are converted to obtain the stimulus output configuration parameters to be updated corresponding to this stimulus output configuration update. These parameters are then cached for use in subsequent stimulus output configuration updates. The external command, upon being received, does not directly rewrite the currently running waveform generator or electrode matrix; instead, it first forms and caches the corresponding stimulus output configuration parameters to be updated, thereby isolating the current stimulus output from the stimulus output configuration update to be executed.
[0031] In one embodiment of this application, the stimulus output configuration parameters to be updated include stimulus parameters, which include at least one of current amplitude, pulse width, frequency, silence time, and stimulus mode. The current amplitude parameter in the external command can be converted into a corresponding internal current amplitude parameter through a preset amplitude calibration process.
[0032] In one embodiment of this application, before caching the stimulus output configuration parameters to be updated, or before submitting the stimulus output configuration parameters to be updated to the corresponding configuration object, a range check is performed on the stimulus parameters to be updated. The range check includes checking at least one of current amplitude, pulse width, frequency, silence time, and stimulation mode to determine whether the corresponding stimulus parameter is within a preset safety range. When the parameter check passes, the corresponding caching or stimulus output configuration update operation is allowed to continue; when any stimulus parameter to be updated exceeds the corresponding preset safety range, the current stimulus output configuration update is rejected, and the current stimulus output configuration is maintained.
[0033] The acquired stimulus parameters are first cached in the parameter cache area. After it is determined that the subsequent safety update conditions are met, the parameter configuration position of the waveform generator is updated according to the cached stimulus parameters. This is to avoid the intermediate state where some parameters have been updated while others remain unchanged when external instructions arrive and directly modify the running stimulus parameters.
[0034] When the stimulus output configuration parameters to be updated involve changes in electrode combinations, the stimulus output configuration parameters to be updated also include a matrix electrode configuration. The matrix electrode configuration is used to characterize the target electrode connection relationship corresponding to this stimulus output configuration update, including the positive and negative channel parameters of the corresponding current source. Based on the positive and negative channel parameters, the positive and negative electrodes participating in subsequent stimulus outputs can be determined, and this serves as the basis for generating complete matrix configuration information.
[0035] In one embodiment of this application, the update content involved in this stimulus output configuration update can be determined based on the stimulus output configuration parameters to be updated. When only the stimulus parameters change and the electrode combination remains unchanged, the current electrode matrix configuration can be kept unchanged, and the corresponding stimulus parameters can be updated; when the stimulus output configuration parameters to be updated involve changes in the electrode combination, the corresponding electrode matrix update is performed simultaneously with the update of the corresponding stimulus parameters.
[0036] Step S12: Determine whether the current stimulus output is in the pulse quiescent period based on the operating status of the waveform generator and the electrical status of the electrode matrix.
[0037] It should be noted that the pulse silence period refers to the operating phase in which the current source stops outputting stimulation pulses and the current electrode matrix meets the preset electrical silence conditions. Since residual current may still exist in the electrode matrix and its corresponding stimulation output circuit after the current source stops outputting stimulation pulses, this embodiment does not use the cessation of current source output as the sole criterion for determining the pulse silence period. Instead, it separately judges the pulse output state of the current source and the electrical state of the current electrode matrix, and determines that the current stimulation output is in the pulse silence period when both meet the corresponding silence conditions.
[0038] In one embodiment of this application, determining whether the current stimulus output is in a pulse silence period based on the operating state of the waveform generator and the electrical state of the electrode matrix includes: determining the current output stage of the corresponding current source based on the address interrupt state of the waveform generator, and updating the corresponding pulse output state flag based on the current output stage; obtaining the matrix current detection value corresponding to the current electrode matrix, determining whether there is a current source in the pulse output stage based on the pulse output state flag, and determining whether the current electrode matrix meets the preset electrical silence condition based on the matrix current detection value; when there is no current source in the pulse output stage and the matrix current detection value meets the preset electrical silence condition, determining that the current stimulus output is in the pulse silence period.
[0039] Specifically, the waveform generator controls the corresponding current source to output stimulation pulses according to the current stimulation parameters, and the address interruption status is used to characterize the output progress of the waveform generator in the current stimulation cycle. The current source is determined to be in the pulse output phase based on the waveform output position corresponding to the address interruption status. When it is determined that the current source is in the pulse output phase, the corresponding pulse output status flag is updated to the first state; when it is determined that the current source has exited the pulse output phase, the corresponding pulse output status flag is updated to the second state. The first state indicates that the current source is currently outputting stimulation pulses, and the second state indicates that the current source is not outputting stimulation pulses.
[0040] In one embodiment of this application, the output progress of the waveform generator can be determined based on the address interruption status, waveform segment count value, and pulse count value. The address interruption status indicates that the waveform generator has reached the corresponding waveform output position, the waveform segment count value indicates the current waveform segment, and the pulse count value indicates the pulse output progress during the current stimulation process. Whether the corresponding current source is currently in the pulse output stage is determined based on the address interruption status, the waveform segment count value, and the pulse count value, and the corresponding pulse output status flag is updated based on the determination result.
[0041] In one embodiment, the matrix current detection value is obtained by a current detection circuit located in the stimulation output circuit corresponding to the current electrode matrix. This matrix current detection value characterizes whether residual current still exists in the current electrode matrix after the current source stops outputting the stimulation pulse. The preset electrical silence condition can be that the absolute value of the matrix current detection value is not greater than a preset silence threshold. The preset silence threshold distinguishes between residual current that characterizes the continued movement of charges in the electrode matrix and current states that meet the electrical silence requirement. Its specific value can be preset based on the detection accuracy of the current detection circuit and the operating parameters of the stimulation output circuit corresponding to the electrode matrix; no specific limitation is made here.
[0042] Furthermore, after determining that there are no current sources in the pulse output phase based on the pulse output status flags, the matrix current detection value continues to be acquired. If the absolute value of the matrix current detection value is still greater than the preset silence threshold, it indicates that although each current source has stopped stimulating pulse output, there is still residual current in the current electrode matrix. At this time, it is uncertain whether the current stimulation output is in the pulse silence period, and subsequent stimulation output configuration update processes are prohibited.
[0043] Furthermore, the matrix current detection value is continuously acquired. When it is determined that there is no current source in the pulse output stage according to the pulse output status flags, and the absolute value of the matrix current detection value is not greater than the preset silence threshold, the current stimulus output is determined to be in the pulse silence period, and the subsequent safety update window determination process is entered.
[0044] It should be noted that the pulse output status flag in this embodiment is used to characterize the current actual pulse output status of the corresponding current source, and is distinct from the update permission status used to control the execution authority of the stimulus output configuration update operation. The pulse output status flag is determined based on the actual output progress of the waveform generator, while the update permission status can also change in advance according to the arrival time of the next output segment. Therefore, when the current source is actually still in the silent phase, the initiation of a new stimulus output configuration update operation can be prohibited in advance based on the time constraint of the subsequent safety update window.
[0045] Therefore, the determination of the pulse quiescent period is constrained by both the pulse output state of the current source and the electrical state of the electrode matrix, thus avoiding the need to enter the stimulation output configuration update process simply because the current source stops outputting stimulation pulses, and instead perform the relevant update operation when there is still residual current in the electrode matrix.
[0046] Step S13: During the pulse silence period, a safe update window is determined based on the start time of the next output segment of the current source, the maximum execution duration of the stimulus output configuration update operation, and the preset protection margin, so that when the stimulus output configuration update operation is started within the safe update window, the sum of the current time, the maximum execution duration, and the preset protection margin is not later than the start time of the next output segment.
[0047] Specifically, after determining in step S12 that the current stimulus output is within the pulse quiescent period, the entire pulse quiescent period is not considered as the time interval within which the stimulus output configuration update operation can be initiated. Instead, the safe update window is determined by further considering the start time of the next output segment and the execution duration required for the stimulus output configuration update operation. The safe update window is used to limit the timing of initiating the stimulus output configuration update operation. When the safe update window is open, the stimulus output configuration update operation is allowed to be initiated; when the safe update window is closed, the initiation of a new stimulus output configuration update operation is prohibited.
[0048] In one embodiment of this application, the maximum execution time and a preset protection margin required to complete a stimulus output configuration update operation are obtained, and the remaining time between the current moment and the start time of the next output segment is determined. Based on the remaining time, the maximum execution time, and the preset protection margin, it is determined whether the update start condition is met at the current moment.
[0049] Specifically, when the sum of the current time, the maximum execution duration, and the preset protection margin is not later than the start time of the next output segment, the update start condition is determined to be met, and the current stimulus output configuration update operation is allowed to start; when the sum of the current time, the maximum execution duration, and the preset protection margin is later than the start time of the next output segment, even if the current period is still in the pulse silence period, the current stimulus output configuration update operation is prohibited from starting, and the current stimulus output configuration update operation is postponed to the next pulse silence period for re-judgment.
[0050] In one embodiment of this application, the timing control of the security update window is implemented through a hardware timer. When a corresponding current source is detected to enter a silent phase, the hardware timer corresponding to the current source is started, and the trigger time of the hardware timer is configured according to the start time of the next output segment and the reserved duration, so that the hardware timer is triggered before the reserved duration before the start of the next output segment.
[0051] When the current source enters the silent phase and the corresponding safety update time condition is met, the corresponding update permission state is set to the allowed update state; when the hardware timer is triggered, the corresponding update permission state is switched to the prohibited update state in advance. At this time, the current source can still be in the silent phase in terms of actual waveform output timing, but the software control layer has prohibited the initiation of new stimulus output configuration update operations, thereby closing the stimulus output configuration update entry in advance before the next output segment actually begins.
[0052] In one embodiment of this application, the hardware timer is a single-shot timer, which starts when a pulse group output is completed and enters a silent phase, and is triggered at a preset time before the start of the next output segment. For a stimulation device including multiple current sources, a corresponding hardware timer channel can be configured for each current source, and each hardware timer channel performs timing control according to the stimulation output sequence of the corresponding current source. The safe update window is opened when all current sources meet the update permission conditions, and the safe update window is closed when the update permission status corresponding to any current source is switched to the prohibited update status.
[0053] Furthermore, during the determination of the aforementioned safety update window and the update of the stimulus output configuration, the waveform generator interrupt remains enabled, and the stimulus output configuration update operation is not protected from critical sections by disabling the waveform generator interrupt. Therefore, the stimulus output beat maintenance, pulse counting, inter-group silencing, and soft-start control performed by the waveform generator interrupt can continue to be executed according to the original operating sequence.
[0054] In this way, the safety update window is not only constrained by whether it is currently in the pulse quiescent period, but also by the arrival time of the next output segment and the maximum execution time of the stimulus output configuration update operation. This avoids starting parameter updates simply because it is currently in the quiescent phase, and causing the update operation to be extended to the next output segment due to insufficient remaining quiescent time.
[0055] Step S14: Within the security update window, keep the interrupt of the waveform generator enabled, and initiate the stimulus output configuration update operation according to the stimulus output configuration parameters to be updated; wherein, the stimulus output configuration update operation includes stimulus parameter update, and when the stimulus output configuration parameters to be updated involve changes in electrode combination, it also includes electrode matrix update.
[0056] Specifically, once the security update window is determined to be open, the update content involved in this stimulus output configuration update is determined based on the cached stimulus output configuration parameters to be updated in step S11, and the corresponding stimulus output configuration update operation is initiated. During the execution of the stimulus output configuration update operation, the interrupt corresponding to the waveform generator is kept enabled so that the real-time control process corresponding to the waveform generator can be executed normally.
[0057] In one embodiment of this application, when the stimulus output configuration parameters to be updated involve only changes in stimulus parameters and not changes in electrode combinations, the current electrode matrix configuration remains unchanged, and the parameter configuration positions corresponding to the waveform generator are updated according to the cached stimulus parameters. For example, when only the current amplitude changes, the parameters corresponding to the current amplitude can be updated; when the stimulation program changes, the pulse width, frequency, silence time, and corresponding parameters in the stimulation mode can be updated according to the stimulus output configuration parameters to be updated.
[0058] When the stimulus output configuration parameters to be updated involve changes in electrode combinations, the electrode matrix is updated under the safety time constraint corresponding to the safety update window. First, the current electrode matrix is switched to a preset safety clearing state so that the original electrode connection relationship corresponding to the current stimulus configuration is deactivated. Then, the target electrode connection relationship is determined according to the matrix electrode configuration obtained in step S11. After generating the complete matrix configuration information corresponding to the target electrode matrix, the current electrode matrix is reconfigured based on the complete matrix configuration information, so that the electrode matrix is switched from the original electrode connection relationship to the target electrode connection relationship through the preset safety clearing state.
[0059] In one embodiment of this application, the process of switching the current electrode matrix to a preset safe clearing state includes: obtaining a predefined clearing state matrix code, sending the clearing state matrix code to a matrix switch chip, and controlling the positive and negative electrode switches in the current electrode matrix corresponding to the original stimulation configuration to exit the working state, thereby disconnecting the original positive and negative electrode connections. The preset safe clearing state serves as an intermediate state between the original electrode matrix configuration and the target electrode matrix configuration, to avoid unexpected conduction paths forming during the switching process when directly switching from the original electrode connection relationship to the target electrode connection relationship.
[0060] In one specific embodiment, during the configuration process of executing the preset security clearing state, the transmit and receive buffers corresponding to the matrix communication interface can also be cleared and the matrix communication state can be reset to clear the configuration data remaining in the previous matrix configuration process, so that the subsequent writing of complete matrix configuration information is not affected by historical configuration data.
[0061] In one embodiment of this application, the specific process of generating complete matrix configuration information based on the matrix electrode configuration includes: obtaining target positive electrode channel parameters and target negative electrode channel parameters from the matrix electrode configuration; determining the target switching state of the corresponding positive electrode switch based on the target positive electrode channel parameters, determining the target switching state of the corresponding negative electrode switch based on the target negative electrode channel parameters, and determining the target switching states of the remaining electrode switches; and combining the target switching states of each electrode switch according to a preset matrix configuration format to form a complete matrix configuration frame characterizing the overall switching state of the target electrode matrix.
[0062] Specifically, the complete matrix configuration frame may include a positive electrode bitmap and a negative electrode bitmap. The positive electrode bitmap represents the positive electrode gating state of each electrode in the target electrode matrix configuration, and the negative electrode bitmap represents the negative electrode gating state of each electrode in the target electrode matrix configuration. By pre-combining the target switch states corresponding to each electrode to form the complete matrix configuration frame, the target electrode matrix configuration is determined before being written to the matrix switch chip, avoiding the need to determine and update the electrode switch states one by one on the matrix switch chip side.
[0063] In one embodiment of this application, the complete matrix configuration frame is written into a matrix switch chip via an SPI communication interface. The matrix switch chip then sets the switching state of each electrode switch according to the complete matrix configuration frame to establish a target positive and negative electrode connection relationship corresponding to the matrix electrode configuration.
[0064] In one embodiment of this application, when writing the complete matrix configuration frame via the SPI communication interface, the chip select signal of the matrix switch chip can be controlled by software. Before sending the complete matrix configuration frame, the chip select signal is controlled to enter an active state; after the SPI receives a predetermined number of bytes and generates a receive completion interrupt, the chip select signal is controlled to exit the active state, so that the chip select end time corresponding to one matrix configuration data transmission is determined by the deterministic event of the completion of receiving the predetermined number of bytes.
[0065] Therefore, even if the transmission interval between SPI bytes changes due to other interrupt handling processes, the chip select process will not end prematurely based solely on the byte transmission time. This allows the matrix switch chip to end the corresponding configuration process only after the complete matrix configuration data transmission is completed, thereby improving the determinism of the electrode matrix switching time and the integrity of the configuration data.
[0066] Further, in one embodiment, after the SPI receives the predetermined number of bytes, a readback verification is performed on the current matrix configuration data. The readback verification may include reading verification information returned by the matrix switch chip and comparing the verification information with the target verification information corresponding to the currently written matrix configuration information. When the readback verification passes, it is determined that the electrode matrix update is complete; when the readback verification fails, it is determined that the current stimulation output configuration update is abnormal, the current source stops outputting stimulation pulses, a system-level critical error interrupt is triggered, the fault event code corresponding to the current stimulation output configuration update abnormality is recorded, and fault information containing the fault event code is uploaded to prevent the resumption of stimulation output in the event of an electrode matrix configuration abnormality, and the current configuration abnormality is recorded.
[0067] In another embodiment of this application, a communication verification can be performed on the transmission result of the complete matrix configuration frame to determine whether the complete matrix configuration frame has been transmitted completely and correctly to the matrix switch chip; when the communication verification passes, it is determined that the electrode matrix update is complete; when the communication verification fails, it is determined that the current electrode matrix update is abnormal, and the recovery of stimulation pulse output is prohibited.
[0068] Step S15: After completing the stimulation output configuration update operation, control the current source to restore the stimulation pulse output according to the updated stimulation output configuration.
[0069] Specifically, after completing the stimulus output configuration update operation corresponding to step S14, it is determined whether the corresponding update operation has been completed based on the update content involved in this stimulus output configuration update. When this stimulus output configuration update only involves stimulus parameter updates, after confirming that the corresponding stimulus parameters have been updated, it is allowed to restore the stimulus pulse output according to the updated stimulus parameters; when this stimulus output configuration update also involves electrode matrix updates, it is allowed to restore the stimulus pulse output after confirming that both the stimulus parameter updates and the electrode matrix updates have been completed.
[0070] In one embodiment of this application, when a readback check is performed during the electrode matrix update process, passing the readback check is also considered as one of the conditions for resuming the stimulation pulse output. If the stimulation output configuration update operation is not completed within the safe update window, or if any of the stimulation parameter update, electrode matrix update, or corresponding update check is not completed or does not meet the preset requirements, then the resumption of stimulation pulse output is prohibited, and the corresponding current source is kept from stimulating pulse output to avoid resuming stimulation before the stimulation output configuration is fully effective.
[0071] Furthermore, it is determined whether the stimulus output configuration update operation is completed within the security update window; if the stimulus output configuration update operation is not completed within the security update window, or the update verification fails, the restoration of stimulus pulse output is prohibited.
[0072] In one embodiment, when a single current source outputs a stimulation pulse, after determining that the stimulation output configuration has been updated, the corresponding current source is controlled to resume stimulation pulse output according to the updated stimulation output configuration.
[0073] In another embodiment, the current source includes a first current source and a second current source. When the two current sources output stimulation pulses, after the stimulation output configuration update is completed, the recovery output timing of the two current sources is controlled according to the stimulation cycle relationship between the two current sources to avoid the two stimulation pulses from overlapping.
[0074] Specifically, the common period of the two stimuli and the timing conditions for allowing misalignment are determined based on the frequency, pulse width and stimulation mode of the two current sources, and the start-up timing of the second starting current source in the two current sources is determined based on the current pulse count.
[0075] In one embodiment of this application, when staggered output of two current sources is required, the first starting current source is first controlled to resume output of stimulation pulses, and the current pulse count is updated during the output of stimulation pulses by the first starting current source. The current pulse count is used to determine whether the start-up timing corresponding to the second starting current source has been reached. When the start-up timing is reached, after the first starting current source completes its corresponding stimulation pulse, the second starting current source is started with a time delay, so that the stimulation pulses of the second starting current source are staggered in time relative to the stimulation pulses of the first starting current source.
[0076] The specific duration of the timing delay can be determined based on the stimulation cycle relationship between the two current sources and the timing conditions that allow for misalignment; this application does not limit its specific value. By controlling the recovery output timing of the two current sources, the two current sources can restore the stimulation pulse output according to the corresponding timing relationship, thereby reducing the possibility of the two stimulation pulses being turned on simultaneously.
[0077] Therefore, this embodiment first determines the pulse silence period by the operating state of the waveform generator and the electrical state of the electrode matrix, and further determines the safe update window based on the execution duration of the next output segment and the stimulus output configuration update operation during the pulse silence period. While maintaining the normal response of the waveform generator interruption, the stimulus parameters and the corresponding electrode matrix are updated. After the update is completed, the current source is controlled to re-output the stimulus pulse according to the corresponding recovery sequence, thereby continuously constraining the entry timing, execution process and recovery process of the stimulus output configuration update.
[0078] Figure 2 This is a schematic diagram of a stimulation output configuration security update system 200 based on pulse quiescence period provided in an embodiment of this application. Figure 2As shown, the system 200 includes: a controller 201, a waveform generator 202, a current source 203, and an electrode matrix 204.
[0079] The waveform generator 202 is used to generate stimulation waveforms, the current source 203 is used to output stimulation pulses, and the electrode matrix 204 is disposed in the stimulation output path of the current source.
[0080] The controller 201 is used to acquire the stimulus output configuration parameters to be updated; determine that the current stimulus output is in a pulse silence period based on the operating status of the waveform generator 202 and the electrical status of the electrode matrix; within the pulse silence period, determine a safe update window based on the start time of the next output segment of the current source 203, the maximum execution duration of the stimulus output configuration update operation, and the preset protection margin, and determine whether to allow the stimulus output configuration update operation to be started based on the time relationship between the current time, the maximum execution duration, the preset protection margin, and the start time of the next output segment; if the update start conditions are not met, postpone the stimulus output configuration update operation to the next pulse silence period; if the stimulus output configuration update operation is not completed within the safe update window or the update verification fails, prohibit the current source 203 from resuming stimulus pulse output. Within the security update window, the interrupt of the waveform generator 202 is kept enabled, and the stimulation output configuration update operation is performed according to the stimulation output configuration parameters to be updated. The stimulation output configuration update operation includes updating stimulation parameters, and when the stimulation output configuration parameters to be updated involve changes in electrode combinations, it also includes updating the electrode matrix 204. After completing the stimulation output configuration update operation, the current source 203 is controlled to restore stimulation pulse output according to the updated stimulation output configuration.
[0081] It should be understood that the specific process of each module performing the above-mentioned steps has been described in detail in the above method embodiments, and will not be repeated here for the sake of brevity.
[0082] It should also be understood that the module division in the embodiments of this application is illustrative and only represents a logical functional division; in actual implementation, there may be other division methods. Furthermore, the functional modules in the various embodiments of this application can be integrated into a single processor, exist as separate physical entities, or be integrated into a single module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0083] Figure 3 This is a schematic block diagram of the electronic terminal provided in an embodiment of this application. Figure 3As shown, the electronic terminal 300 includes at least one processor 301, a memory 302, at least one network interface 303, and a user interface 305. The various components in the electronic terminal 300 are coupled together via a bus system 304. It is understood that the bus system 304 is used to implement communication between these components. In addition to a data bus, the bus system 304 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in… Figure 3 The general will label all buses as bus systems.
[0084] The user interface 305 may include a monitor, keyboard, mouse, trackball, clicker, button, touchpad, or touch screen.
[0085] It is understood that memory 302 can be volatile memory or non-volatile memory, or both. Non-volatile memory can be read-only memory (ROM) or programmable read-only memory (PROM), which serves as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM) and synchronous static random access memory (SSRAM). The memories described in the embodiments of this invention are intended to include, but are not limited to, these and any other suitable categories of memory.
[0086] In this embodiment of the invention, the memory 302 is used to store various types of data to support the operation of the electronic terminal 300. Examples of this data include: any executable program for operation on the electronic terminal 300, such as the operating system 3021 and application programs 3022; the operating system 3021 contains various system programs, such as the framework layer, core library layer, driver layer, etc., for implementing various basic services and handling hardware-based tasks. The application program 3022 may contain various applications, such as a media player, browser, etc., for implementing various application services. The method for securely updating the stimulus output configuration based on the pulse quiescence period provided in this embodiment of the invention can be included in the application program 3022.
[0087] The methods disclosed in the above embodiments of the present invention can be applied to or implemented by processor 301. Processor 301 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 301 or by instructions in the form of software. The processor 301 may be a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Processor 301 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. General-purpose processor 301 may be a microprocessor or any conventional processor, etc. The steps of the stimulation output configuration security update method based on pulse silence period provided in the embodiments of the present invention can be directly reflected as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. The software modules may be located in a storage medium, which is located in a memory. The processor reads the information in the memory and combines it with its hardware to complete the steps of the aforementioned method.
[0088] In an exemplary embodiment, the electronic terminal 300 may be used by one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), or complex programmable logic devices (CPLDs) to execute the aforementioned method.
[0089] According to the method provided in the embodiments of this application, this application also provides a computer program product, which includes: computer program code, which, when run on a computer, causes the computer to perform the method of any of the embodiments described above.
[0090] According to the method provided in the embodiments of this application, this application also provides a computer-readable storage medium storing program code, which, when run on a computer, causes the computer to perform the method of any of the embodiments described above.
[0091] As used in this specification, the terms "component," "module," "system," etc., are used to refer to computer-related entities, hardware, firmware, combinations of hardware and software, software, or software in execution. For example, a component can be, but is not limited to, a process running on a processor, a processor, an object, an executable file, an execution thread, a program, and / or a computer. As illustrated, applications running on computing devices and computing devices can both be components. One or more components may reside in a process and / or an execution thread, and components may be located on a single computer and / or distributed among two or more computers. Furthermore, these components can be executed from various computer-readable media on which various data structures are stored. Components can communicate, for example, via local and / or remote processes based on signals having one or more data packets (e.g., data from two components interacting with another component between a local system, a distributed system, and / or a network, such as the Internet interacting with other systems via signals).
[0092] Those skilled in the art will recognize that the various illustrative logical blocks and steps described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.
[0093] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0094] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0095] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0096] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0097] In the above embodiments, the functions of each functional unit can be implemented entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. A computer program product includes one or more computer instructions (programs). When the computer program instructions (programs) are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. Computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. Available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., high-density digital video discs (DVDs)), or semiconductor media (e.g., solid-state disks (SSDs)).
[0098] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0099] In summary, this application provides a method, system, medium, terminal, and program product for safe updating of stimulus output configuration based on a pulse silence period. The pulse silence period is determined based on the operating state of the waveform generator and the electrical state of the electrode matrix. A safe update window is determined based on the start time of the next output segment of the current source, the maximum execution duration of the configuration update operation, and a preset protection margin. When the update initiation conditions are met, the stimulus parameter update is initiated while maintaining the waveform generator interrupt enable. Electrode matrix updates are performed when changes in electrode combinations are involved; otherwise, the update is delayed until the next pulse silence period. The stimulus pulse output is restored after the update operation is completed within the safe update window and passes verification; otherwise, restoration is prohibited. This application can reduce the risk of stimulus output issues caused by configuration updates crossing output segments and abnormal configurations, thereby improving the safety and stability of stimulus output.
[0100] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this application should still be covered by the claims of this application.
Claims
1. A method for securely updating stimulus output configuration based on pulse quiescence period, characterized in that, include: Obtain the stimulus output configuration parameters to be updated; Based on the operating status of the waveform generator and the electrical status of the electrode matrix, it is determined that the current stimulus output is in the pulse quiescent period; During the pulse silence period, a safe update window is determined based on the start time of the next output segment of the current source, the maximum execution duration of the stimulus output configuration update operation, and the preset protection margin, so that when the stimulus output configuration update operation is started within the safe update window, the sum of the current time, the maximum execution duration, and the preset protection margin is not later than the start time of the next output segment. Within the security update window, the interrupt of the waveform generator is kept enabled, and the stimulus output configuration update operation is initiated according to the stimulus output configuration parameters to be updated; wherein, the stimulus output configuration update operation includes stimulus parameter update, and when the stimulus output configuration parameters to be updated involve changes in electrode combination, it also includes electrode matrix update; After confirming that the stimulus output configuration update operation is completed within the safe update window and the update verification passes, the current source is controlled to restore the stimulus pulse output according to the updated stimulus output configuration; if the stimulus output configuration update operation is not completed within the safe update window or the update verification fails, the restoration of stimulus pulse output is prohibited.
2. The method for securely updating stimulus output configuration based on pulse quiescence period according to claim 1, characterized in that, The determination of whether the current stimulus output is in a pulse quiescent period based on the operating status of the waveform generator and the electrical status of the electrode matrix specifically includes: Determine whether each current source is currently in the pulse output stage based on the output progress of the waveform generator, and update the corresponding pulse status identifier according to the output status of each current source. Obtain the electrical detection results corresponding to the electrode matrix, and determine whether the electrode matrix meets the preset electrical silence conditions based on the electrical detection results; When there is no current source in the pulse output phase and the electrode matrix satisfies the preset electrical silence condition, the current stimulus output is determined to be in the pulse silence period.
3. The method for securely updating stimulus output configuration based on pulse quiescence period according to claim 1, characterized in that, The determination of the safety update window within the pulse silence period specifically includes: After detecting that the current source has entered a silent state, a timing control operation is initiated; The end time corresponding to the safety update window is determined according to the timing control operation, and the execution permission of the stimulus output configuration update operation is closed when the end time is reached. The end time corresponding to the safety update window is located before the start time of the next output segment.
4. The method for securely updating stimulus output configuration based on pulse quiescence period according to claim 3, characterized in that, The timing control operation is implemented through a hardware timer; The hardware timer starts after the current source enters a silent state and is triggered at a preset advance time before the start of the next output segment of the corresponding current source, so as to maintain a time margin between the start time of the stimulus output configuration update operation and the next output segment.
5. The method for securely updating stimulus output configuration based on pulse quiescence period according to claim 1, characterized in that, The step of performing the stimulus output configuration update operation according to the stimulus output configuration parameters to be updated specifically includes: The stimulus output configuration parameters to be updated are cached; Within the security update window, the stimulation parameters corresponding to the waveform generator are updated according to the cached stimulation output configuration parameters to be updated; wherein, the stimulation parameters include at least one of current amplitude, pulse width, frequency, silence time, and stimulation mode.
6. The method for securely updating stimulus output configuration based on pulse quiescence period according to claim 1, characterized in that, When the stimulus output configuration parameters to be updated involve changes in electrode combinations, the stimulus output configuration parameters to be updated further include matrix electrode configuration, and the electrode matrix update includes: The target switching state corresponding to each electrode switch is determined based on the matrix electrode configuration. The target switch states are combined to form a complete matrix configuration frame; Within the security update window, the complete matrix configuration frame is written to the matrix switch chip to control the electrode matrix to switch to the corresponding target electrode connection relationship; After the complete matrix configuration frame is written, a readback verification is performed on the electrode matrix or a communication verification is performed on the transmission result of the complete matrix configuration frame, and the electrode matrix update is determined to be complete when the verification passes.
7. A stimulus output configuration security update system based on pulse quiescence period, characterized in that, Includes a controller, waveform generator, current source, and electrode matrix; The waveform generator is used to generate stimulation waveforms, the current source is used to output stimulation pulses, and the electrode matrix is set in the stimulation output path of the current source. The controller is used to acquire the configuration parameters of the stimulus output to be updated; Based on the operating status of the waveform generator and the electrical status of the electrode matrix, it is determined that the current stimulus output is in the pulse quiescent period; During the pulse silence period, a safe update window is determined based on the start time of the next output segment of the current source, the maximum execution duration of the stimulus output configuration update operation, and the preset protection margin, so that when the stimulus output configuration update operation is started within the safe update window, the sum of the current time, the maximum execution duration, and the preset protection margin is not later than the start time of the next output segment. Within the safety update window, the interrupt of the waveform generator is kept enabled, and the stimulation output configuration update operation is initiated according to the stimulation output configuration parameters to be updated. The stimulation output configuration update operation includes updating stimulation parameters, and when the stimulation output configuration parameters to be updated involve changes in electrode combinations, it also includes updating the electrode matrix. The controller is further configured to control the current source to restore stimulation pulse output according to the updated stimulation output configuration after determining that the stimulation output configuration update operation is completed within the safety update window and the update verification passes. If the stimulation output configuration update operation is not completed within the safety update window or the update verification fails, the current source is prohibited from restoring stimulation pulse output.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the method for securely updating the stimulus output configuration based on the pulse quiescence period as described in any one of claims 1 to 6.
9. A computer program product, characterized in that, The computer program product includes computer program code that, when run on a computer, causes the computer to implement the stimulation output configuration security update method based on the pulse quiescence period as described in any one of claims 1 to 6.
10. An electronic terminal, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the method for securely updating stimulus output configuration based on pulse quiescence period as described in any one of claims 1 to 6.
