Control method, device and storage medium of optical sensing communication terminal
By introducing a combined solution of sleep timer and reset timer into the optical sensing communication terminal, the problems of high energy consumption and low operating accuracy are solved, the reliability and accuracy of data transmission are achieved, and it is suitable for complex environments. Monitoring applications.
Patent Information
- Application Number
- CN202411132668.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-19
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-08-19
AI Technical Summary
Traditional optical sensing communication terminals have high energy consumption during long-term operation, low program operation accuracy and reliability, and are difficult to maintain in time, especially in complex environments.
Adopting a combination of sleep timer and reset timer, it automatically switches modes after reaching the preset timing time, executes the data sending program and performs reset operation to ensure the accuracy and reliability of data transmission.
It significantly reduces the energy consumption of the optical sensing communication terminal and regularly sends data during long-term operation, improving the accuracy and reliability of the program and ensuring the integrity of the monitoring data.
Smart Images

Figure CN118659940B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of optical communication technology, and in particular to a control method, device and storage medium for an optical sensor communication terminal. Background Art
[0002] Optical sensing communication terminals play a vital role in the field of underground environmental monitoring. They are buried underground or set in water to obtain key parameters such as humidity, temperature, water level, etc. collected by sensors in real time.
[0003] Traditional optical sensor communication terminals usually use a software watchdog mechanism, which determines whether the program is running normally by sending a "feed the dog" signal at regular intervals. However, in long-term application scenarios, frequently sending signals to the watchdog will increase the energy consumption of the optical sensor communication terminal. In addition, in such a complex and difficult to directly access environment, when the optical sensor communication terminal has errors or is stuck, the staff cannot find the location of the optical sensor communication terminal in time to repair it, which greatly affects the accuracy of the monitoring data and the reliability of the equipment. Summary of the invention
[0004] The present invention provides a control method, device and storage medium of an optical sensor communication terminal, so as to solve the problems of high energy consumption, low accuracy and reliability of running programs of the optical sensor communication terminal in the prior art.
[0005] The first aspect of the present invention provides a control method for an optical sensing communication terminal, comprising: after the optical sensing communication terminal is powered on, starting the sleep timer and the reset timer; judging whether the sleep timer has reached a preset first timing time; if the sleep timer has reached the first timing time, switching from sleep mode to working mode, and executing a data sending program to disturb the optical cable; when the data sending program has not finished running and the reset timer has reached a preset second timing time, resetting the program running on the optical sensing communication terminal; when the data sending program has finished running, restarting the sleep timer and the reset timer, and entering the sleep mode again.
[0006] In a feasible implementation manner, before starting the sleep timer and the reset timer, it also includes: performing self-check and program loading within a preset initialization time period, and entering the sleep mode after the initialization time period ends.
[0007] In a feasible implementation, when the data sending program has not completed running and the reset timer reaches a preset second timing time, before resetting the program running on the light sensing communication terminal, it also includes: constantly detecting a status flag in the data sending program; when it is detected that the status flag is sending completion, determining that the data sending program has completed running, otherwise, determining that the data sending program has not completed running.
[0008] In a feasible implementation, after the optical sensing communication terminal is powered on, before starting the sleep timer and the reset timer, it also includes: obtaining a first duration corresponding to the sleep mode and a second duration corresponding to the working mode; and determining the first timing time corresponding to the sleep timer and the second timing time corresponding to the reset timer based on the first duration and the second duration.
[0009] In a feasible implementation manner, the resetting operation on the program running on the optical sensing communication terminal includes: loading a reset vector from a preset reset vector address, the reset vector pointing to a program start address; and starting to execute a reset code based on the program start address to complete the initialization of the program running on the optical sensing communication terminal.
[0010] In a feasible implementation, the execution of the data transmission program includes: collecting data of the current environment and converting the data into a vibration signal; disturbing the optical cable according to the vibration signal so that the optical cable generates a reverse optical signal and sends it to the optical sensing communication base station.
[0011] In a feasible implementation manner, after resetting the program running on the optical sensing communication terminal, it also includes: re-executing the data sending program to disturb the optical cable, and starting the reset timer; when the data sending program has not been completed and the reset timer reaches the second time length, resetting the operation of the optical sensing communication terminal so that the optical sensing communication terminal re-executes the data sending program until the data sending program is completed.
[0012] The second aspect of the present invention provides a control device for an optical sensing communication terminal, and the control device for the optical sensing communication terminal includes: a starting module, which is used to start the sleep timer and the reset timer after the optical sensing communication terminal is powered on; a judgment module, which is used to judge whether the sleep timer has reached a preset first timing time; a processing module, which is used to switch from the sleep mode to the working mode if the sleep timer reaches the first timing time, and execute a data sending program; a reset module, which is used to reset the program running on the optical sensing communication terminal when the data sending program has not completed running and the reset timer reaches a preset second timing time; a restart module, which is used to restart the sleep timer and the reset timer when the data sending program has completed running, and enter the sleep mode again.
[0013] In a feasible implementation manner, the startup module is further used to: perform self-checking and program loading within a preset initialization time period, and enter a sleep mode after the initialization time period ends.
[0014] In a feasible implementation, the control device of the optical sensing communication terminal also includes: a detection module, which is used to constantly detect the status flag in the data sending program; and a determination module, which is used to determine that the data sending program has completed running when it is detected that the status flag is sending completion, otherwise, determine that the data sending program has not completed running.
[0015] In a feasible implementation, the startup module is also used to: obtain a first duration corresponding to the sleep mode and a second duration corresponding to the working mode; and determine the first timing time corresponding to the sleep timer and the second timing time corresponding to the reset timer based on the first duration and the second duration.
[0016] In a feasible implementation, the reset module is specifically used to: load a reset vector from a preset reset vector address, the reset vector points to a program start address; and start executing reset code based on the program start address to complete initialization of the program running on the optical sensing communication terminal.
[0017] In a feasible implementation, the processing module is specifically used to: collect data of the current environment and convert the data into a vibration signal; disturb the optical cable according to the vibration signal so that the optical cable generates a reverse optical signal and sends it to the optical sensing communication base station.
[0018] In a feasible implementation manner, the control device of the optical sensing communication terminal also includes: a re-execution module, which re-executes the data sending program to disturb the optical cable and starts the reset timer; a re-reset module, which is used to reset the operation of the optical sensing communication terminal when the data sending program has not been completed and the reset timer reaches the second time length, so that the optical sensing communication terminal re-executes the data sending program until the data sending program is completed.
[0019] The third aspect of the present invention provides an optical sensing communication terminal, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the optical sensing communication terminal executes the above-mentioned control method of the optical sensing communication terminal.
[0020] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned control method for an optical sensing communication terminal.
[0021] In the technical solution provided by the present invention, after the optical sensing communication terminal is powered on, the sleep timer and the reset timer are started; it is determined whether the sleep timer reaches a preset first timing time; if the sleep timer reaches the first timing time, it switches from the sleep mode to the working mode, and executes a data sending program to disturb the optical cable; when the data sending program has not completed running and the reset timer reaches a second timing time, the program running by the optical sensing communication terminal is reset; when the data sending program completes running, the sleep timer and the reset timer are restarted, and the sleep mode is entered again. In an embodiment of the present invention, after the optical sensing communication terminal is powered on, the sleep timer and the reset timer are started; it is determined whether the sleep timer reaches a preset first timing time; if the sleep timer reaches the first timing time, the sleep mode is switched to the working mode, and a data sending program is executed to disturb the optical cable; when the data sending program has not completed running and the reset timer reaches a second timing time, the program running in the optical sensing communication terminal is reset; when the data sending program completes running, the sleep timer and the reset timer are restarted, and the sleep mode is entered again, which is beneficial to reducing the energy consumption of the optical sensing communication terminal and improving the accuracy and reliability of the program running of the optical sensing communication terminal. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 A schematic diagram of an embodiment of an optical sensing communication terminal in an embodiment of the present invention;
[0023] Figure 2 A schematic diagram of another embodiment of an optical sensing communication terminal in an embodiment of the present invention;
[0024] Figure 3 A schematic diagram of an embodiment of a control method of an optical sensing communication terminal in an embodiment of the present invention;
[0025] Figure 4 A schematic diagram of another embodiment of a control method for an optical sensing communication terminal according to an embodiment of the present invention;
[0026] Figure 5 A schematic diagram of an embodiment of a control device for an optical sensing communication terminal in an embodiment of the present invention;
[0027] Figure 6 A schematic diagram of another embodiment of a control device for an optical sensing communication terminal in an embodiment of the present invention;
[0028] Figure 7 It is a schematic diagram of another embodiment of the optical sensing communication terminal in the embodiment of the present invention. DETAILED DESCRIPTION
[0029] The embodiments of the present invention provide a control method, a device and a storage medium for an optical sensing communication terminal, which reduce the energy consumption of the optical sensing communication terminal and improve the accuracy and reliability of the program operation of the optical sensing communication terminal.
[0030] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] See also Figure 1 , an embodiment of the optical sensing communication terminal in the embodiment of the present invention includes:
[0032] The optical sensing communication terminal is clamped on the optical cable, and the optical sensing communication terminal includes: a controller 101, which is used to run a program to collect data of the current environment, and modulate the data into a vibration signal to transmit it through the optical cable; a sleep timer 102, which is used to output a mode switching instruction after a preset first timing time is reached, wherein the mode switching instruction includes a wake-up instruction and a sleep instruction; when receiving the wake-up instruction, the controller 101 controls the optical sensing communication terminal to switch from the sleep mode to the working mode, and controls the optical sensing communication terminal to execute a data sending program to disturb the optical cable; after the data sending program is executed, the sleep instruction is received to enter the sleep mode again; a reset timer 103 connected to the controller 101 is used to generate a reset signal after a preset second timing time is reached, and reset the program running by the controller 101 based on the reset signal.
[0033] After the optical sensing communication terminal is powered on, if the sleep timer 102 reaches the first timing time, a mode switching instruction is generated and sent to the controller 101, wherein the mode switching instruction includes a wake-up instruction and a sleep instruction. The controller 101 receives the wake-up instruction, controls the optical sensing communication terminal to switch from the sleep mode to the working mode, and controls the optical sensing communication terminal to execute the data sending program to disturb the optical cable. If the data sending program is completed, the controller 101 receives the sleep instruction and controls the optical sensing communication terminal to enter the sleep mode again. If the data sending program is not completed and the reset timer 103 reaches the second timing time, the reset timer 103 generates a reset signal and sends the reset signal to the controller 101. After receiving the reset signal, the controller 101 resets the running program.
[0034] In this embodiment, by introducing a sleep timer, the optical sensing communication terminal can automatically switch from sleep mode to working mode and execute the data sending program after reaching a first timing time. During non-data sending periods, the optical sensing communication terminal remains in sleep mode, thereby significantly reducing the overall energy consumption of the optical sensing communication terminal. By introducing a reset timer, it can be ensured that the optical sensing communication terminal can periodically send data and perform a reset operation when necessary during long-term operation, thereby improving the accuracy and reliability of the program operation process.
[0035] See also Figure 2 , an embodiment of the optical sensing communication terminal in the embodiment of the present invention includes:
[0036] The optical sensing communication terminal includes a controller 201, a sleep timer 202, a reset timer 203, a sensor 204 and an oscillator 205, wherein the sensor 204 and the oscillator 205 are respectively connected to the controller, wherein the controller 201 includes a reset circuit 2011, and the output end of the sleep timer 202 is connected to the input end of the reset circuit 2011. After the reset timer 203 reaches a preset second timing time, a reset signal is generated and output to the input end of the reset circuit 2011, thereby resetting the program running in the optical sensing communication terminal.
[0037] After the optical sensing communication terminal is powered on, if the sleep timer 202 reaches the first timing time, a mode switching instruction is generated and sent to the controller 201, wherein the mode switching instruction includes a wake-up instruction and a sleep instruction. The controller 201 receives the wake-up instruction, controls the optical sensing communication terminal to switch from the sleep mode to the working mode, and controls the optical sensing communication terminal to execute the data sending program. The data sending program is for the controller 201 to obtain the data collected by the sensor 204, and convert the data into an electrical signal and transmit it to the vibration head 205. The vibration head 205 receives the electrical signal and converts it into a vibration signal to disturb the optical cable; if the data sending program is completed, the sleep instruction is received to enter the sleep mode again. If the data sending program is not completed and the reset timer 103 reaches the second timing time, the reset timer 203 generates a reset signal, and the reset signal is output from the output end of the reset timer 203 and received by the input end of the reset circuit. Based on the received reset signal, the program running by the controller 201 is reset.
[0038] In this embodiment, by introducing a sleep timer, the optical sensing communication terminal can automatically switch from sleep mode to working mode and execute the data sending program after reaching a first timing time. During non-data sending, the optical sensing communication terminal remains in sleep mode, thereby significantly reducing the overall energy consumption of the optical sensing communication terminal. By introducing a reset timer, it can be ensured that the optical sensing communication terminal can periodically send data and perform a reset operation when necessary during long-term operation, and the reset signal is received and processed by the reset circuit, further improving the accuracy and reliability of the program operation process.
[0039] The above describes the optical sensing communication terminal in the embodiment of the present invention. The following describes the control method of the optical sensing communication terminal in the embodiment of the present invention. Figure 3 , an embodiment of a control method of an optical sensing communication terminal in an embodiment of the present invention includes:
[0040] 301. After the optical sensing communication terminal is powered on, start a sleep timer and a reset timer;
[0041] After the optical sensor communication terminal is powered on, the sleep timer and the reset timer are started, and timing is performed by the sleep timer and the reset timer.
[0042] 302. Determine whether the sleep timer reaches a preset first timing time;
[0043] The sleep timer counts according to the set reference frequency and continuously records the elapsed time. During the timing process, the first value of the sleep timer is read, and the first value is compared with the first timing time to obtain a comparison result, and based on the comparison result, it is determined whether the sleep timer has reached the first timing time. The first value is subtracted from the first timing time to obtain a first difference. If the first difference is greater than zero, it is determined that the sleep timer has not reached the first timing time. If the first difference is less than or equal to zero, it is determined that the sleep timer has reached the first timing time.
[0044] 303. If the sleep timer reaches the first timing time, switch from the sleep mode to the working mode, and execute the data sending program to disturb the optical cable;
[0045] The optical sensing communication terminal is clamped on the optical cable. It collects target data, converts the target data into a vibration signal and acts on the optical cable to make it vibrate, thereby transmitting data.
[0046] Acquire target data, convert the target data into analog signals, amplify, filter and digitize the analog signals. The amplification step can enhance the strength of the analog signals for subsequent processing, the filtering step can remove noise and interference in the analog signals, and the digitization step converts the continuous analog signals into discrete digital signals for digital signal processing. Compress the pre-processed digital signals to reduce the bandwidth and storage space required for transmission; modulate and encode the compressed digital signals to convert them into vibration signals suitable for transmission in the vibration optical cable. The modulation and encoding process can select appropriate modulation methods and encoding schemes according to the transmission characteristics and system requirements of the vibration optical cable. The modulated and encoded vibration signals are transmitted through the vibration optical cable. The vibration optical cable is a special optical cable that contains vibration sensitive elements that can respond to vibrations and generate optical signals. The vibration signals are converted into optical signals by the vibration sensitive elements of the optical cable and transmitted through the transmission medium of the optical cable.
[0047] 304. When the data transmission program has not been completed and the reset timer reaches a preset second timing time, a reset operation is performed on the program running on the optical sensing communication terminal;
[0048] By checking the size of the TCP send buffer, when the size of the TCP send buffer is 0, it is determined that the data sending program has completed running, and when the size of the TCP send buffer is not 0, it is determined that the data sending program has not completed running. It is also possible to send data to the receiving end and determine whether the data sending program has completed running through the confirmation data packet sent by the receiving end.
[0049] Read the second value of the reset timer, subtract the second value from the second timing time, and obtain a second difference. If the second difference is greater than zero, it is determined that the reset timer has not reached the second timing time. If the second difference is less than or equal to zero, it is determined that the reset timer has reached the second timing time.
[0050] When the data transmission program is not completed and the reset timer reaches the second timing time, the program running on the optical sensing communication terminal is reset, and the reset operation includes restoring all internal registers of the controller to the initial value or preset value; clearing or resetting the internal state flags and counters of the controller; shutting down all peripheral interfaces to ensure that they are in a safe or default state; configuring the I / O port to a high-impedance input state to prevent the uncertain output state from affecting other devices. During the reset process, the interrupt and exception handling mechanism of the controller will be disabled or reset to ensure the smooth progress of the reset operation, including shutting down global interrupts, clearing any pending interrupt requests, etc.
[0051] 305. When the data sending program is finished running, restart the sleep timer and the reset timer, and enter the sleep mode again.
[0052] In an embodiment of the present invention, after the optical sensing communication terminal is powered on, a sleep timer and a reset timer are started; it is determined whether the sleep timer reaches a preset first timing time; if the sleep timer reaches the first timing time, the sleep mode is switched to the working mode, and a data sending program is executed to disturb the optical cable; when the data sending program has not been completed and the reset timer reaches a preset second timing time, the program running in the optical sensing communication terminal is reset; when the data sending program is completed, the sleep timer and the reset timer are restarted, and the sleep mode is entered again, which is beneficial to reducing the energy consumption of the optical sensing communication terminal and improving the accuracy and reliability of the program operation of the optical sensing communication terminal.
[0053] See also Figure 4 Another embodiment of the control method of the optical sensing communication terminal in the embodiment of the present invention includes:
[0054] 401. Obtain a first duration corresponding to a sleep mode and a second duration corresponding to a working mode;
[0055] The durations corresponding to the sleep mode and the working mode are pre-set durations. For example, the first duration is set to 3600s, and the second duration is the running duration of the data sending program. For example, when the running duration of the data sending program is 3s, the second duration can be set to 3s.
[0056] 402. Determine a first timing time corresponding to the sleep timer and a second timing time corresponding to the reset timer based on the first duration and the second duration;
[0057] The first duration is set as the first timing time. For example, when the first duration is set to 3600s and the second duration is set to 3s, the first duration is added to the second duration to obtain the third duration. The second timing time should be greater than the third duration. Therefore, a target coefficient can be set to adjust the third duration. The third duration is added to the target coefficient to obtain the second timing time. For example, the target coefficient is set to 2. If the third duration is 3603s, the second timing time is 3605s.
[0058] 403. After the optical sensor communication terminal is powered on, a self-check and program loading are performed within a preset initialization time period, and after the initialization time period ends, the terminal enters a sleep mode;
[0059] For example, if the preset initialization time period is 10s, then after the optical sensing communication terminal is powered on, it will maintain self-checking and program loading for 10s, and then enter the sleep mode after 10s. In sleep mode, most functions of the optical sensing communication terminal are turned off to save power. During the initialization time period, the optical sensing communication terminal can perform comprehensive self-checking operations and program loading, including hardware initialization, such as checking whether the sensor is working properly, ensuring that all interfaces and modules are properly connected, etc., and software initialization, such as loading necessary programs, setting initial parameters, etc.
[0060] 404. Start a sleep timer and a reset timer;
[0061] 405. Determine whether the sleep timer reaches a preset first timing time;
[0062] 406. If the sleep timer reaches the first timing time, switch from the sleep mode to the working mode, and execute the data sending program to disturb the optical cable;
[0063] If the sleep timer reaches the first timing time, it switches from the sleep mode to the working mode, collects data of the current environment, converts the data into a vibration signal, and transmits the vibration signal to the receiving end through the optical cable.
[0064] Collect data of the current environment, compress the data through a lossless compression algorithm to obtain compressed data; modulate the compressed data through at least one modulation method of frequency modulation, phase modulation, and amplitude modulation to obtain a modulated signal; encode the modulated signal through a coding algorithm to obtain a vibration signal, and transmit the vibration signal to the receiving end through a vibration optical cable.
[0065] 407. Constantly check the status flag in the data sending program;
[0066] 408. When it is detected that the status flag is sending completion, it is determined that the data sending program has completed running; otherwise, it is determined that the data sending program has not completed running.
[0067] The status flag is defined as a variable. For example, the status flag can be false / true, or the status flag can also be waiting to send, sending, sending completed, and sending failed; at different stages of the data sending process, the status flag is updated. For example, before data is sent, the status flag is set to "waiting to send" or "false", during the data sending process, it can be set to "sending", and when the data sending is completed, it is set to "sending completed" or "true". Therefore, when the status flag is detected as "sending completed", it is determined that the data sending program has completed running, and when the status flag is detected as other status flags other than "sending completed", it is determined that the data sending program has not completed running.
[0068] 409. When the data transmission program has not been completed and the reset timer reaches a preset second timing time, a reset operation is performed on the program running on the optical sensing communication terminal;
[0069] A reset vector is loaded from a preset reset vector address, and the reset vector points to a program start address; and reset code is executed based on the program start address to complete initialization of the program running on the optical sensor communication terminal.
[0070] The reset vector address is set in advance. The reset vector address is usually located in a specific memory area. After loading the reset vector, the integrity of the reset vector is checked to ensure that the reset vector has not been tampered with or damaged. After the check is completed, the reset vector address is used to jump to the program start address.
[0071] The specific execution steps for checking the integrity of the reset vector are: perform CRC calculation on the reset vector through the preset CRC algorithm and parameters to obtain the current CRC check code of the reset vector, compare the current CRC check code with the pre-stored target CRC check code, if the current CRC check code is consistent with the target CRC check code, it is determined that the integrity of the reset vector is verified; if the current CRC check code is inconsistent with the target CRC check code, it is determined that the integrity of the reset vector is not verified, indicating that an error has occurred in the transmission process or the storage process, and exception processing such as reloading the reset vector or requesting retransmission is required.
[0072] After resetting the program running on the optical sensing communication terminal, it also includes: re-executing the data sending program to disturb the optical cable, and starting a reset timer; when the data sending program has not been completed and the reset timer reaches a second time length, resetting the operation of the optical sensing communication terminal so that the optical sensing communication terminal re-executes the data sending program until the data sending program is completed.
[0073] 410. When the data sending program finishes running, restart the sleep timer and the reset timer, and enter the sleep mode again.
[0074] In an embodiment of the present invention, by acquiring a first duration corresponding to the sleep mode and a second duration corresponding to the working mode, a first timing time corresponding to the first clock module and a second timing time corresponding to the second clock module are determined based on the first duration and the second duration. After the optical sensing communication terminal is powered on, a sleep timer and a reset timer are started to determine whether the sleep timer reaches a preset first timing time. If the sleep timer reaches the first timing time, the sleep mode is switched to the working mode, and a data sending program is executed to disturb the optical cable. The status flag in the data sending program is always detected. When the status flag is detected to be sending completion, it is determined that the data sending program has completed running. Otherwise, it is determined that the data sending program has not completed running. When the data sending program has not completed running and the reset timer reaches the preset second timing time, the program running in the optical sensing communication terminal is reset. When the data sending program completes running, the sleep timer and the reset timer are restarted, and the sleep mode is entered again, which is beneficial to reducing the energy consumption of the optical sensing communication terminal and improving the accuracy and reliability of the program running of the optical sensing communication terminal.
[0075] The control method of the optical sensing communication terminal in the embodiment of the present invention is described above. The control device of the optical sensing communication terminal in the embodiment of the present invention is described below. Figure 5 , an embodiment of the control device of the optical sensing communication terminal in the embodiment of the present invention includes:
[0076] A start module 501 is used to start a sleep timer and a reset timer after the optical sensing communication terminal is powered on;
[0077] A determination module 502 is used to determine whether the sleep timer reaches a preset first timing time;
[0078] The first processing module 503 is used to switch from the sleep mode to the working mode and execute the data sending program if the sleep timer reaches the first timing time;
[0079] The reset module 504 is used to reset the program running on the optical sensor communication terminal when the data transmission program has not been completed and the reset timer reaches a preset second timing time;
[0080] The restart module 505 is used to restart the sleep timer and the reset timer when the data sending program finishes running, and enter the sleep mode again.
[0081] In an embodiment of the present invention, in this embodiment, after the optical sensing communication terminal is powered on, a sleep timer and a reset timer are started; it is determined whether the sleep timer reaches a preset first timing time; if the sleep timer reaches the first timing time, it switches from the sleep mode to the working mode, and executes a data sending program to disturb the optical cable; when the data sending program has not completed running and the reset timer reaches a preset second timing time, the program running in the optical sensing communication terminal is reset; when the data sending program completes running, the sleep timer and the reset timer are restarted, and the sleep mode is entered again, which is beneficial to reducing the energy consumption of the optical sensing communication terminal and improving the accuracy and reliability of the program running of the optical sensing communication terminal.
[0082] See also Figure 6 Another embodiment of the control device of the optical sensing communication terminal in the embodiment of the present invention includes:
[0083] A start module 501 is used to start a sleep timer and a reset timer after the optical sensing communication terminal is powered on;
[0084] A determination module 502 is used to determine whether the sleep timer reaches a preset first timing time;
[0085] The processing module 503 is used to switch from the sleep mode to the working mode and execute the data sending program if the sleep timer reaches the first timing time;
[0086] The reset module 504 is used to reset the program running on the optical sensor communication terminal when the data transmission program has not been completed and the reset timer reaches a preset second timing time;
[0087] The restart module 505 is used to restart the sleep timer and the reset timer when the data sending program finishes running, and enter the sleep mode again.
[0088] Optionally, the startup module 501 may also be specifically used for:
[0089] The system performs self-test and program loading during the preset initialization period, and enters sleep mode after the initialization period ends.
[0090] Optionally, the control device of the optical sensing communication terminal further includes:
[0091] A detection module 506, used to constantly detect the status flag in the data sending program;
[0092] The determination module 507 is used to determine that the data sending program has completed running when the status flag is detected to be sending completion, otherwise, determine that the data sending program has not completed running.
[0093] Optionally, the startup module can also be used to:
[0094] Obtain a first duration corresponding to the sleep mode and a second duration corresponding to the working mode; determine a first timing time corresponding to the sleep timer and a second timing time corresponding to the reset timer based on the first duration and the second duration.
[0095] Optionally, the reset module 504 is specifically used for:
[0096] A reset vector is loaded from a preset reset vector address, and the reset vector points to a program start address; and reset code is executed based on the program start address to complete the initialization of the program running on the optical sensor communication terminal.
[0097] Optionally, the processing module 503 is specifically configured to:
[0098] Collect data of the current environment and convert the data into a vibration signal; disturb the optical cable according to the vibration signal so that the optical cable generates a reverse optical signal and sends it to the optical sensing communication base station.
[0099] Optionally, the control device of the optical sensing communication terminal further includes:
[0100] Re-execute module 508, re-execute the data sending program to disturb the optical cable, and start the reset timer;
[0101] The resetting module 509 is used to reset the operation of the optical sensor communication terminal when the data transmission program has not been completed and the reset timer reaches the second time length, so that the optical sensor communication terminal re-executes the data transmission program until the data transmission program is completed.
[0102] In an embodiment of the present invention, by acquiring a first duration corresponding to the sleep mode and a second duration corresponding to the working mode, a first timing time corresponding to the first clock module and a second timing time corresponding to the second clock module are determined based on the first duration and the second duration. After the optical sensing communication terminal is powered on, a sleep timer and a reset timer are started to determine whether the sleep timer reaches a preset first timing time. If the sleep timer reaches the first timing time, the sleep mode is switched to the working mode, and a data sending program is executed to disturb the optical cable. The status flag in the data sending program is always detected. When the status flag is detected to be sending completion, it is determined that the data sending program has completed running. Otherwise, it is determined that the data sending program has not completed running. When the data sending program has not completed running and the reset timer reaches the preset second timing time, the program running in the optical sensing communication terminal is reset. When the data sending program completes running, the sleep timer and the reset timer are restarted, and the sleep mode is entered again, which is beneficial to reducing the energy consumption of the optical sensing communication terminal and improving the accuracy and reliability of the program running of the optical sensing communication terminal.
[0103] above Figure 5 and Figure 6 The control device of the optical sensor communication terminal in the embodiment of the present invention is described in detail from the perspective of modular functional entities. The optical sensor communication terminal in the embodiment of the present invention is described in detail from the perspective of hardware processing.
[0104] See also Figure 7 As shown, the optical sensing communication terminal includes a processor 700 and a memory 701. The memory 701 stores machine executable instructions that can be executed by the processor 700. The processor 700 executes the machine executable instructions to implement the control method of the optical sensing communication terminal.
[0105] Further, Figure 7 The optical sensing communication terminal shown further includes a bus 702 and a communication interface 703 , and the processor 700 , the communication interface 703 and the memory 701 are connected via the bus 702 .
[0106] Among them, the memory 701 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), for example, at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 703 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 702 can be an ISA bus, a PCI bus or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0107] The processor 700 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 hardware integrated logic circuit or software instructions in the processor 700. The above processor 700 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly embodied as a hardware decoding processor to be executed, or a combination of hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 701 , and the processor 700 reads the information in the memory 701 and completes the method steps of the above-mentioned embodiment in combination with its hardware.
[0108] The present invention also provides an optical sensing communication terminal, wherein the computer device includes a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor executes the steps of the control method of the optical sensing communication terminal in the above-mentioned embodiments.
[0109] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the control method of the optical sensing communication terminal.
[0110] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0111] If the integrated unit is implemented in the form of 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 the present invention is essentially or the part that contributes to the prior art or the whole or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0112] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A control method for an optical sensing communication terminal, characterized in that: The optical sensing communication terminal is used to be clamped on an optical cable, and the optical sensing communication terminal includes a controller, a sleep timer, and a reset timer, and the controller is connected to the sleep timer and the reset timer respectively, and the method includes: After the optical sensing communication terminal is powered on, starting the sleep timer and the reset timer; Determine whether the sleep timer reaches a preset first timing time; If the sleep timer reaches the first timing time, a mode switching instruction is generated by the sleep timer and sent to the controller to control the optical sensing communication terminal to switch from the sleep mode to the working mode, and execute a data sending program to disturb the optical cable; When the data transmission program has not been completed and the reset timer reaches a preset second timing time, a reset signal is generated by the reset timer and sent to the controller, and the controller performs a reset operation on the program running on the optical sensing communication terminal; When the data transmission program is finished running, restarting the sleep timer and the reset timer, and entering the sleep mode again; After the optical sensing communication terminal is powered on, before starting the sleep timer and the reset timer, the method further includes: Obtaining a first duration corresponding to the sleep mode and a second duration corresponding to the working mode; The first timing time corresponding to the sleep timer and the second timing time corresponding to the reset timer are determined based on the first duration and the second duration, wherein the second timing time is greater than the sum of the first duration and the second duration.
2. The control method of the optical sensing communication terminal according to claim 1, characterized in that: Before starting the sleep timer and the reset timer, the method further includes: The system performs self-check and program loading in a preset initialization time period, and enters a sleep mode after the initialization time period ends.
3. The control method of the optical sensing communication terminal according to claim 1, characterized in that: When the data transmission program has not been completed and the reset timer reaches a preset second timing time, before resetting the program running on the optical sensing communication terminal, the method further includes: Constantly checking the status flag in the data sending program; When it is detected that the status flag is sending completion, it is determined that the data sending program has completed running; otherwise, it is determined that the data sending program has not completed running.
4. The control method of the optical sensor communication terminal according to any one of claims 1 to 3, characterized in that: The resetting operation of the program running on the optical sensing communication terminal includes: Loading a reset vector from a preset reset vector address, wherein the reset vector points to a program start address; The reset code is executed based on the program start address to complete the initialization of the program running on the optical sensing communication terminal.
5. The control method of the optical sensor communication terminal according to any one of claims 1 to 3, characterized in that: The execution data sending program includes: Collecting data of the current environment and converting the data into vibration signals; The optical cable is disturbed according to the vibration signal so that the optical cable generates a reverse optical signal and sends it to an optical sensing communication base station.
6. The control method of the optical sensing communication terminal according to claim 1, characterized in that: After resetting the program running on the optical sensing communication terminal, the method further includes: re-execute the data transmission program to disturb the optical cable, and start the reset timer; When the data transmission program has not been completed and the reset timer reaches the second time length, the operation of the optical sensing communication terminal is reset so that the optical sensing communication terminal re-executes the data transmission program until the data transmission program is completed.
7. A control device for an optical sensing communication terminal, characterized in that: The optical sensing communication terminal is used to be clamped on the optical cable. The optical sensing communication terminal includes a controller, a sleep timer and a reset timer. The controller is connected to the sleep timer and the reset timer respectively. The control device of the optical sensing communication terminal includes: A starting module, used for starting the sleep timer and the reset timer after the optical sensing communication terminal is powered on; A judging module, used for judging whether the sleep timer reaches a preset first timing time; A first processing module, configured to generate a mode switching instruction through the sleep timer and send it to the controller if the sleep timer reaches the first timing time, so as to control the optical sensing communication terminal to switch from the sleep mode to the working mode and execute a data sending program; A reset module, used for, when the data transmission program has not finished running and the reset timer reaches a preset second timing time, generating a reset signal through the reset timer and sending it to the controller, so that the controller performs a reset operation on the program running on the optical sensing communication terminal; A restart module, used for restarting the sleep timer and the reset timer when the data sending program finishes running, and entering the sleep mode again; The startup module is also used to: obtain a first duration corresponding to the sleep mode and a second duration corresponding to the working mode; determine the first timing time corresponding to the sleep timer and the second timing time corresponding to the reset timer based on the first duration and the second duration, wherein the second timing time is greater than the sum of the first duration and the second duration.
8. The control device of the optical sensor communication terminal according to claim 7, characterized in that: The control device of the optical sensing communication terminal also includes: a re-execution module, used for re-executing the data transmission program to disturb the optical cable, and starting the reset timer; A resetting module is used to reset the operation of the optical sensing communication terminal when the data sending program has not been completed and the reset timer reaches the second time length, so that the optical sensing communication terminal re-executes the data sending program until the data sending program is completed.
9. An optical sensing communication terminal, characterized in that: The optical sensing communication terminal comprises: a memory and at least one processor, wherein instructions are stored in the memory; The at least one processor calls the instruction in the memory so that the optical sensing communication terminal executes the control method of the optical sensing communication terminal as described in any one of claims 1-6.
10. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instruction is executed by the processor, the control method of the optical sensing communication terminal as described in any one of claims 1-6 is implemented.
Citation Information
Patent Citations
Watchdog sleep and timed wake-up method and integrated circuit
CN116860498A
Optical sensing communication terminal
CN117434663A
A solution method of data transmission deadlock
CN1622526A
Commmunication apparatus with PHY / MAC cross layer structure using hardwired low MAC
KR1020120063286A
