Task execution method, smoke sensor, smoke alarm, storage medium and program product

By using a time-division multiplexed optical emitter to switch between smoke detection and battery detection, the problem of hardware resource consumption caused by the additional discharge circuit in traditional smoke sensors is solved, thereby reducing hardware costs and improving system integration, while ensuring the effectiveness of battery detection and the sensitivity of smoke detection.

CN121482948APending Publication Date: 2026-02-06SITERWELL ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511895867.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-15
Publication Date
2026-02-06

AI Technical Summary

Technical Problem

Traditional smoke sensors require an additional discharge circuit to eliminate battery passivation, resulting in high hardware resource consumption and an increase in the number of components and circuit board area.

Method used

By adopting a time-division multiplexing mechanism, the light emitter is dynamically switched between two main functions: smoke detection and battery detection/discharge. By injecting differentiated constant currents into the light emitter during different task periods, the battery detection function can be achieved without adding a battery detection circuit.

Benefits of technology

It reduces hardware costs and circuit board layout area, improves system integration and battery life, and ensures the sensitivity of smoke detection and the effectiveness of battery passivation elimination.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121482948A_ABST
    Figure CN121482948A_ABST
Patent Text Reader

Abstract

The invention provides a task execution method, a smoke sensor, a smoke alarm, a storage medium and a program product, and relates to the technical field of safety. According to the method, a light emitter in a smoke sensor is dynamically switched and used between smoke detection and battery detection discharge through a time division multiplexing mechanism, so that a single hardware resource can undertake multiple functions, the battery detection function can be realized by multiplexing a smoke detection circuit, a battery detection circuit does not need to be additionally arranged, and the cost is reduced. The hardware cost and the circuit board layout area are effectively reduced, and the system integration degree is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of security technology, and more specifically, to a task execution method, a smoke sensor, a smoke alarm, a storage medium, and a program product. Background Technology

[0002] As a core component of fire early warning systems, the reliability and practicality of smoke sensors are of paramount importance. Traditional smoke sensors generally use the principle of optical scattering for detection. This involves emitting light that passes through a detection cavity. When smoke particles enter, the light is scattered, and a receiver captures the scattered light signal to determine whether an alarm should be triggered.

[0003] In existing technologies, the functional modules of smoke sensors are typically designed independently. Specifically, the optical detection module and the power management module are completely separated at the hardware level. The optical detection module usually contains at least one light emitter and one receiver, which are sealed in an optical labyrinth to prevent interference from ambient light.

[0004] In battery-powered smoke sensors, accurate detection of battery status is a critical issue. This is especially true for chemical systems prone to passivation, such as lithium-manganese batteries, where the passivation film forming on the negative electrode surface causes voltage detection distortion. Existing technologies typically require the design of a separate battery discharge circuit, using external discrete components (such as power resistors and transistors) to form a load circuit and subject the battery to prolonged current discharge to eliminate the passivation effect.

[0005] This design requires an additional discharge circuit, which increases the number of components, the area of ​​the circuit board, and the overall cost, resulting in high consumption of hardware resources. Summary of the Invention

[0006] The purpose of this application is to provide a task execution method, a smoke sensor, a smoke alarm, a storage medium, and a program product to improve the problem of high hardware resource consumption caused by the need for an additional discharge circuit in the existing method.

[0007] In a first aspect, embodiments of this application provide a task execution method applied to a controller in a smoke sensor, the method comprising: Multiple tasks to be performed are determined, including a smoke detection task and a battery detection task. The smoke detection task is used to control the light emitter in the smoke sensor to emit light signals for smoke detection, and the battery detection task is used to use the light emitter as a load to perform a current-pull discharge process on the battery. The multiple tasks are executed using a time-sharing multiplexing method.

[0008] In the above implementation process, the light emitter in the smoke sensor is dynamically switched between two major functions, smoke detection and battery discharge detection, through a time-division multiplexing mechanism. This allows a single hardware resource to undertake multiple functional roles, so the battery detection function can be achieved by reusing the smoke detection circuit, without the need to add a separate battery detection circuit. This effectively reduces hardware costs and circuit board layout area, and improves system integration.

[0009] Optionally, the execution of the multiple tasks using a time-division multiplexing method includes: Obtain the task execution cycles of the smoke detection task and the battery detection task; The tasks to be executed are determined according to the task execution cycle and executed sequentially according to the priority principle.

[0010] In the above implementation process, by combining the task execution cycle to determine the tasks to be executed, the fine-grained time-sharing management of infrared transmitter resources is realized. This ensures that smoke detection tasks and battery detection tasks can be reliably triggered according to the preset cycle, and also dynamically resolves task conflicts through the priority principle.

[0011] The step of determining the tasks to be executed according to the task execution cycle and executing them sequentially according to priority includes: Based on the time-slice working mechanism, the tasks to be executed are determined according to the task execution cycle within each time slice, and then executed sequentially according to the priority principle.

[0012] In the above implementation process, by using a time-slice-based working mechanism, the tasks to be executed are dynamically planned according to the task execution cycle within each time slice, and ordered scheduling is carried out in combination with the priority principle. This ensures the timely triggering and reliable execution of periodic tasks, and prioritizes the response to high-priority tasks when resource conflicts occur. Thus, while maintaining the stability of system timing, the real-time performance of critical tasks (such as smoke detection and battery health monitoring) and the overall reliability of the system are significantly improved.

[0013] Optionally, the method further includes: If a task is still being executed and has not yet been completed after a time slice ends, execution will stop and the task in the next time slice will begin.

[0014] In the above implementation process, by forcibly switching tasks at the time slice boundary, the scheduler's control over system resources is periodically reclaimed, thereby preventing the abnormal or timed execution of a single task from causing long-term blocking of the entire task sequence. This effectively improves the real-time performance and determinism of the system's response to external events and ensures the stable operation of the multi-tasking environment.

[0015] Optionally, the method further includes: After completing all the tasks to be performed within a time slice, it enters a hibernation state and is awakened at the start of the next time slice.

[0016] In the above implementation process, by entering a sleep state immediately after completing the task of each time slice and strictly limiting the wake-up of the controller to the start of the next time slice, the system consumes energy only during the necessary working period, thereby minimizing the static power consumption during idle time, achieving precise matching between power consumption and task load, and improving battery life.

[0017] Optionally, the method further includes When performing the smoke detection task, a first constant current sink is input to the light emitter so that the light emitter emits a light signal to perform smoke detection; When performing the battery detection task, a second constant current sinking current is input to the light emitter so that the light emitter acts as a load to perform current discharge processing on the battery. Wherein, the second constant current sinking current is greater than or equal to the first constant current sinking current.

[0018] In the above implementation process, by injecting differentiated constant current into the light emitter during different task execution periods, it can accurately emit infrared light signals during smoke detection and discharge current as a load during battery detection. This ensures both the sensitivity of smoke detection and the effectiveness of battery passivation elimination, and maximizes the utilization of hardware resources through single device reuse, significantly reducing system complexity and cost.

[0019] Optionally, the execution cycle of the battery detection task is longer than that of the smoke detection task. By setting a longer execution cycle for the battery detection task than for the smoke detection task, the different real-time requirements of the two are fully met. While ensuring high-frequency smoke detection and real-time response, the number of unnecessary high-current battery discharges is significantly reduced. This effectively extends battery life, reduces the average power consumption of the system, and avoids the occupation of hardware resources by frequent discharges, achieving an optimal balance between safety monitoring and equipment durability.

[0020] Optionally, the method further includes: If smoke is detected after the smoke detection task is performed, the task execution cycle of the smoke detection task is shortened. If an alarm is triggered after the battery detection task is performed.

[0021] In the above implementation process, by dynamically shortening the execution cycle of the smoke detection task when smoke is detected and triggering an alarm when the battery is abnormal, the system achieves an adaptive response under safety threats. This not only significantly improves the monitoring frequency and alarm timeliness under dangerous conditions, but also ensures that potential risks can be immediately alerted through the intelligent scheduling mechanism, thereby greatly enhancing the equipment's safety protection capabilities and the reliability of proactive early warning.

[0022] Optionally, the method further includes: When performing the battery detection task, the light emitter is controlled as a load to perform a current discharge process on the battery. After a set time period, the voltage information of the battery is collected and analyzed to obtain the battery test results.

[0023] In the above implementation process, by reusing the light emitter as a load to perform current discharge processing on the battery in the battery detection task, and collecting and analyzing voltage information after a set time, accurate detection of battery health status is achieved without adding a dedicated discharge circuit.

[0024] Optionally, during the initial power-on period of the smoke sensor, the task execution cycle of the battery detection task is a first cycle. After the set period, the task execution cycle of the battery detection task is updated to a second cycle, where the second cycle is longer than the first cycle.

[0025] In the above implementation process, by using a shorter battery detection cycle at the initial stage of power-on, battery electrode passivation can be quickly eliminated and an accurate voltage reference can be established. After the system is running stably, the cycle is switched to a longer one, which ensures the effectiveness and timeliness of battery status monitoring and avoids the extra power consumption caused by unnecessary frequent detection.

[0026] Optionally, the execution of the multiple tasks using a time-division multiplexing method includes: Obtain the task execution cycle and task execution duration for each of the multiple tasks; A task execution time sequence is generated based on the task execution cycle and the task execution duration, wherein each execution moment in the task execution time sequence corresponds to an execution task; Multiple tasks are executed sequentially according to the task execution time sequence.

[0027] In the above implementation process, by combining the task execution cycle and execution duration to generate an accurate task execution time sequence, the controller can pre-plan and accurately allocate the start and end times of each task, which not only avoids resource conflicts and execution overlap between tasks, but also significantly improves system stability and real-time response capabilities.

[0028] Optionally, generating a task execution time sequence based on the task execution cycle and the task execution duration includes: When scheduling the execution time of each task according to the task execution cycle, if it is determined that the execution time of a certain task is within the execution time of other tasks, then the execution time of that task is postponed according to the priority of the task, and a task execution time sequence is generated according to the scheduled execution time and the tasks corresponding to each execution time.

[0029] In the above implementation process, by dynamically identifying and handling time overlap conflicts between tasks when generating task execution time sequences, and intelligently adjusting the execution time points according to preset task priorities, resource contention is avoided in advance at the scheduling level, ensuring that the real-time response of high-priority tasks is not blocked, while maintaining the orderliness and determinism of the overall system scheduling sequence.

[0030] Secondly, embodiments of this application provide a smoke sensor, the smoke sensor comprising: case; The controller and the smoke detection circuit are both housed within the housing. The smoke detection circuit includes a light emitter and a light receiver. The controller is used to execute the aforementioned task execution method.

[0031] In the above implementation process, by multiplexing the light emitter, the dual functions of smoke detection and battery detection can be achieved without adding an additional discharge circuit to the smoke sensor, which reduces hardware cost and size and saves hardware resources.

[0032] Optionally, the light signal emitted by the light emitter is visible light or invisible light.

[0033] Optionally, the controller has a built-in sinking current constant current output circuit, which is connected to the light emitter.

[0034] Optionally, the sinking current constant current output circuit includes a single channel or a dual channel. In the case of a dual channel, one channel is connected to the optical emitter, and the other channel is connected to other optical emitters.

[0035] Thirdly, embodiments of this application provide a smoke alarm, which includes the smoke sensor described above.

[0036] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the steps of the method provided in the first aspect above.

[0037] Fifthly, embodiments of this application provide a computer program product, including computer program instructions, which, when read and executed by a processor, perform the steps of the method provided in the first aspect above.

[0038] Other features and advantages of this application will be set forth in the following description and will be apparent in part from the description or may be learned by practicing embodiments of this application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description

[0039] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0040] Figure 1 This is a schematic diagram of the structure of a smoke sensor provided in an embodiment of this application; Figure 2 A schematic diagram of a smoke detection circuit provided in an embodiment of this application; Figure 3 A flowchart of a task execution method provided in an embodiment of this application; Figure 4 This is a flowchart illustrating the time sequence of task execution in an embodiment of this application.

[0041] Icons: 10-Smoke sensor; 11-Housing; 12-Controller; 13-Light emitter; 14-Light receiver; 15-Other light emitters. Detailed Implementation

[0042] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.

[0043] It should be noted that the term "multiple" in the embodiments of the present invention refers to two or more. Therefore, in the embodiments of the present invention, "multiple" can also be understood as "at least two". "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A alone, A and B at the same time, and B alone.

[0044] This application provides a task execution method applied to the controller in a smoke sensor. The method uses a time-division multiplexing mechanism to dynamically switch the light emitter in the smoke sensor between two main functions: smoke detection and battery discharge detection. This allows a single hardware resource to perform multiple functional roles, thereby enabling the battery detection function to be realized by reusing the smoke detection circuit without having to add a separate battery detection circuit. This effectively reduces hardware costs and circuit board layout area, and improves system integration.

[0045] To facilitate understanding of this method, the structure of the smoke sensor will be introduced below.

[0046] like Figure 1 As shown, the smoke sensor 10 includes a housing 11, a controller 12, and a smoke detection circuit. The smoke detection circuit includes a light emitter 13 and a light receiver 14. The controller 12, the light emitter 13, and the light receiver 14 are all housed within the housing 11. The light emitter 13 and the light receiver 14 are both electrically connected to the controller 12. The controller 12 is used to execute the task execution method in this solution.

[0047] Specifically, the interior of the housing 11 is hollow, and the interior of the housing 11 can be used to accommodate functional devices and protect them.

[0048] The controller 12 can be located on a control board that integrates a smoke detection circuit. The controller 12 may refer to the microcontroller unit (MCU) in the smoke sensor 10, which may include functions such as executing programs, controlling the smoke detection circuit, detecting batteries, and performing logical judgments.

[0049] In theory or under perfect conditions, when there is no smoke, the light receiver 14 will not receive the light beam emitted by the light emitter 13. However, due to the reflection or refraction of light by the inner wall of the housing, even when there is no smoke inside the smoke sensor 10, the light receiver 14 can receive a certain amount of the light beam emitted by the light emitter 13, i.e., the light signal, which is called background noise (this value is determined and known before leaving the factory). When the smoke sensor detects more light signals, the smoke concentration is detected based on the increment value relative to the background noise. Specifically, the smoke sensor 10 is a photoelectric smoke sensor.

[0050] For example, during normal use, the controller 12 can control the operation of the light transmitter 13 and the light receiver 14, and detect the smoke concentration inside the housing 11 with the cooperation of the light transmitter 13 and the light receiver 14; the controller 12 can communicate with the audible and visual components of the smoke alarm to realize the alarm function of the smoke alarm.

[0051] The light emitter 13 in this solution can also be used as a load in battery detection to perform current discharge processing on the battery. By reusing the light emitter 13, the dual functions of smoke detection and battery detection can be achieved without adding an additional battery detection circuit to the smoke sensor 10, reducing hardware cost and size and saving hardware resources.

[0052] In this design, the battery powers the smoke detection circuit. In one embodiment, the battery is installed outside the housing of the smoke sensor 10 and inside the smoke alarm. In other embodiments, the battery is installed inside the housing of the smoke sensor 10.

[0053] In addition, in some examples, the smoke sensor 10 may also include other light emitters 15. The light signal emitted by the light emitter 13 can be visible or invisible light, as can the other light emitters 15.

[0054] In a specific embodiment, the controller 12 can control the light emitter 13 to emit a light beam of a certain wavelength and control other light emitters 15 to emit a light beam of a different wavelength. After receiving the signals of the two light beams respectively, the light receiver 14 can analyze the presence of smoke by detecting the two light signals separately, for example, by analyzing the signal increment characteristics of the two light signals. When both light signals indicate the presence of smoke, it can be determined that smoke is generated at this time. If either light signal indicates the absence of smoke, it can be determined that no smoke is generated at this time. In this way, by detecting the two signals, the accuracy of smoke detection can be improved and false alarms can be avoided. Obviously, the type of smoke can also be accurately identified by using the ratio between the two light signals received from the light emitter 13 and other light emitters 15 at different times, so as to reduce false alarms.

[0055] like Figure 2 The diagram shows a smoke detection circuit in a smoke sensor. D1 is the light transmitter in this design, D3 is another light transmitter, and D2 is the light receiver. The light transmitter D1, the other light transmitter D3, and the light receiver D2 work together for smoke detection, i.e., dual-transmitter, single-receiver. Because the two transmitters can emit signals with different wavelengths, the light receiver D2 can receive both types of light signals. The controller can then use these two light signals to comprehensively determine the presence of smoke, thus avoiding false alarms caused by a single transmitter.

[0056] In some implementations, the smoke detection circuit comprises two parts: a maze signal transmitting circuit, including a light emitter D1 and other light emitters D3, as well as a current-limiting resistor R and a capacitor EC. The current-limiting resistor R limits the current in the maze signal transmitting circuit to protect the emitting diodes, while the capacitor EC provides a stable operating voltage to the maze signal transmitting circuit to prevent power fluctuations from affecting the light intensity.

[0057] In this system, the battery being tested in the battery detection task has its positive terminal electrically connected to the power supply terminal Vdd, and its negative terminal grounded, providing power to the entire system, including the smoke detection circuit and the controller. One end of the current-limiting resistor is connected to the power supply terminal Vdd, and the other end is connected to the positive terminal of the capacitor EC, with the negative terminal of the capacitor EC grounded. One pin of the light transmitter D1, ISINK1, is connected to the corresponding pin of the controller 12, and one pin of the other light transmitter D3, ISINK0, is connected to the corresponding pin of the controller 12. Another part is the maze signal receiving circuit, including the light receiver D2. The two pins of the light receiver D2, A0P1 and A0N1, are also connected to the corresponding pins of the controller 12. The light receiver D2 receives the light signal and converts it into an electrical signal, feeding it back to the controller 12; and the electrical signal received by the controller 12 corresponds to the light signal received by the light receiver D2. Specifically, the smoke detection circuit implements the current discharge process in the battery detection task by multiplexing the maze signal transmitting circuit.

[0058] Understandably, this solution is a time-division multiplexing control method for the optical transmitter D1. In actual hardware design, other optical transmitters D3 can be omitted, meaning that smoke detection can also be performed using single-transmitter, single-receiver.

[0059] In addition, this solution also provides a smoke alarm, which includes the smoke sensor mentioned above. Of course, in practical applications, the smoke alarm may also include other devices, such as a buzzer.

[0060] Please refer to Figure 3 , Figure 3 A flowchart of a task execution method provided in this application embodiment, the method being applied to the controller in the smoke sensor described above, the method comprising the following steps: Step S110: Identify the multiple tasks to be performed.

[0061] After startup, the controller creates a task list in memory to manage multiple tasks that need to be executed periodically. In this solution, these tasks include smoke detection and battery detection. The smoke detection task involves controlling the light emitter in the smoke sensor (i.e.,...). Figure 2 The light emitter D1 in the circuit emits light signals for smoke detection, and the battery detection task includes using the light emitter as a load to perform current discharge processing on the battery.

[0062] In this context, current slurry discharge refers to actively drawing a large, controllable current from the battery to consume its charge. In this scheme, the purpose of current slurry discharge is not to deplete the battery, but rather to use a light emitter as a load to cause the passivation film on the negative electrode surface of the battery to detach, be damaged, or be broken down, thereby making subsequent battery voltage detection more accurate.

[0063] The light emitter in this solution has two functions: smoke detection and battery detection. The smoke detection application is standard and will not be elaborated upon. In the battery detection application, the light emitter acts as a load during the current-pull discharge process. The controller outputs a relatively long and large current to the light emitter, causing the passivation film on the negative electrode of the battery to detach or break down. The battery voltage is then detected and anomalies are identified accordingly. This process of outputting a relatively long and large current to break down the negative electrode passivation film is called current-pull discharge. The current in this current-pull discharge process is larger and lasts longer than the current in the smoke detection process.

[0064] Understandably, the light receiver may not be working while the controller is performing the battery detection task, or the controller may not process the light signal detected by the light receiver.

[0065] Step S120: Execute multiple tasks using a time-sharing multiplexing method.

[0066] Time-sharing multiplexing refers to using the same hardware resource (i.e., optical transmitter D1) to perform different functions at different times, with these functions being staggered in time.

[0067] For example, after startup, the controller can first check if the execution cycle of either the battery detection task or the smoke detection task has been reached. If the battery detection task's cycle has been reached, it is executed, with the light transmitter acting as a load. After the battery detection task is completed, if the smoke detection task's cycle has been reached, it is executed, with the light transmitter acting as the smoke detection signal transmitter. This way, the light transmitter only executes one function at any given time, avoiding conflicts. Since the light transmitter's regular function, smoke detection, has a very short execution time, it remains idle most of the time. This allows it to perform the discharge function of the battery detection task during the remaining time, achieving efficient resource reuse.

[0068] In the above implementation process, the time-sharing multiplexing mechanism enables a single hardware resource to undertake multiple functional roles. Thus, the battery detection function can be realized by reusing the smoke detection circuit, without the need to add a battery detection circuit. This effectively reduces hardware costs and circuit board layout area, and improves system integration.

[0069] Based on the above embodiments, this solution primarily employs two methods to implement the time-sharing multiplexing approach for executing multiple tasks. One method involves the controller executing tasks according to their execution cycles. In this method, the controller considers task priority only at the execution time point and selects the highest-priority task for execution. The other method involves the controller executing each task sequentially based on a generated task execution time sequence, which indicates the execution time point of each task. In this method, the controller prioritizes the execution time points of each task, considering task priority when allocating execution time points.

[0070] When executing tasks using time-sharing multiplexing, multiple tasks may need to use the same hardware resource, i.e., the optical transmitter, at the same time, resulting in task conflicts. To address this, this solution assigns priorities to different tasks to determine their order of execution during scheduling or execution.

[0071] Since battery issues can cause system failure, preventing other tasks from executing, it's crucial to ensure battery health monitoring remains unaffected. This solution prioritizes tasks based on two principles: 1. Battery detection tasks have higher priority than smoke detection tasks to ensure reliable power supply; 2. In case of conflict, the smoke detection task can be terminated or paused while the battery detection task is executed. The termination mode immediately stops the smoke detection task, releases resources, and executes the battery detection task, which then restarts in the next cycle. The pause mode saves the smoke detection status, restores the status after executing the battery detection task, and resumes execution from the point of interruption.

[0072] The first implementation of time-sharing reuse is to execute each task sequentially based on the task execution cycle and task priority.

[0073] The controller can first obtain the task execution cycle of the smoke detection task and the battery detection task, then determine the tasks to be executed according to the task execution cycle, and execute them in sequence according to the priority principle.

[0074] In other words, the controller can determine the execution time of each task based on its execution cycle. When the execution time arrives, the corresponding task is executed. If there are task conflicts at the same time (i.e., multiple tasks need to be executed, or one task needs to be executed while another task is being executed), the corresponding task is executed according to the priority principle mentioned above.

[0075] For example, the execution cycle of the smoke detection task is 8 seconds, and the execution cycle of the battery detection task is 40 seconds. In the time slice of 40 seconds to 48 seconds, the smoke detection task and the battery detection task need to be executed at the same time in the 40th second, which means there is a task conflict. According to the task priority principle, the battery detection task with higher priority can be executed first.

[0076] In some other implementations, for the task conflict detection mechanism, the controller can maintain a resource lock flag to identify which task is currently occupying the light transmitter. For example, a resource lock flag of 1 indicates that the light transmitter is currently occupied by a battery detection task, while a resource lock flag of 0 indicates that the light transmitter is currently occupied by a smoke detection task. The controller can check the resource lock flag before each task is executed to determine the hardware resource occupancy status, and the controller can modify the resource lock flag during the execution of each task.

[0077] The controller can identify resource occupancy status through resource lock flags. When a high-priority task needs resources but the resources are occupied, it can preemptively execute; if a low-priority task needs resources but the resources are occupied, it will enter a ready-to-wait state or postpone execution.

[0078] Based on the above embodiments, the controller can use a time-slice working mechanism to determine the tasks to be executed within each time slice according to the task execution cycle, and execute them sequentially according to the priority principle.

[0079] The time slice here can be understood as the controller's work cycle. For example, if the controller is woken up every 8 seconds, this 8 seconds is a time slice. Within each time slice, the controller determines the tasks to be executed based on the task execution cycle.

[0080] The time-slice-based working mechanism can be understood as the controller being periodically woken up according to fixed time slices, and each time it is woken up, it checks and executes the tasks that should run in the current time slice.

[0081] In the above implementation process, by using a time-slice-based working mechanism, the tasks to be executed are dynamically planned according to the task execution cycle within each time slice, and ordered scheduling is carried out in combination with the priority principle. This ensures the timely triggering and reliable execution of periodic tasks, and prioritizes the response to high-priority tasks when resource conflicts occur. Thus, while maintaining the stability of system timing, the real-time performance of critical tasks (such as smoke detection and battery health monitoring) and the overall reliability of the system are significantly improved.

[0082] In some implementations, if there are tasks that are being executed but have not yet been completed after a time slice ends, execution is stopped and the tasks in the next time slice begin to be executed.

[0083] When a timer interrupt is triggered, the controller is awakened from sleep mode. Based on the task execution cycle, the controller determines all tasks that need to be executed within the current time slice, forming a list of tasks to be executed. The controller can then execute the tasks in the list sequentially according to priority, while continuously checking whether the current time has reached the end of the current time slice.

[0084] When the timer interrupts again, it signifies the end of the current time slice. Regardless of what task the controller is currently performing, it will immediately respond to this interrupt and then proceed to the next time slice.

[0085] In the above implementation process, by forcibly switching tasks at the time slice boundary, the abnormal or timed execution of a single task can be prevented from causing long-term blocking of the entire task sequence, which effectively improves the real-time performance and determinism of the system's response to external events and ensures the stable operation of the multi-tasking environment.

[0086] In some implementations, the controller enters a sleep state after completing all the tasks to be performed within a time slice, and is woken up at the beginning of the next time slice.

[0087] In other words, once all tasks within the current time slice are completed, the controller can immediately enter a sleep state, waiting to be awakened again at the start of the next time slice.

[0088] The controller can determine the length of the idle time based on the task execution cycle. For example, if task A has an execution cycle of 8 seconds and task B has an execution cycle of 40 seconds, and task A requires 4ms to complete, then within the 0s-8s time slice, there is an idle time from 5ms to 8000ms. During these idle times, the controller can enter a sleep state. By controlling the controller to enter a sleep state during the idle time of task execution, the static power consumption of the system when there is no task processing is minimized.

[0089] In some implementations, a minimum effective sleep time threshold, such as 100ms, can be set. Sleep mode is only activated when the idle time exceeds this threshold. This is because the sleep / wake-up process itself incurs time and power consumption overhead, and excessively short sleep sessions may consume more power than non-sleep sessions.

[0090] In the above implementation process, by entering a sleep state immediately after completing the task of each time slice, the static power consumption during idle time is minimized, achieving a precise match between power consumption and task load, and improving battery life.

[0091] Based on the above embodiments, the task execution cycle of the battery detection task is longer than that of the smoke detection task.

[0092] Understandably, battery testing, as a maintenance task, can adopt a long-cycle execution strategy, while smoke detection, as a core safety monitoring task, can adopt a short-cycle execution strategy.

[0093] This way, most of the time, only high-frequency smoke detection tasks need to be performed, and a small portion of the time is spent performing low-frequency battery detection tasks.

[0094] In some implementations, the execution cycles of the two tasks can be configured and dynamically updated. For example, if the controller determines that the smoke concentration is increasing after performing a smoke detection task, i.e., confirms the presence of smoke, the execution cycle of the smoke detection task can be shortened, thus speeding up smoke detection. Similarly, if a battery malfunction is detected after performing a battery detection task, a battery malfunction alarm is triggered.

[0095] The controller can establish a historical detection record table for each task to record abnormal events, and set a continuous normal counter and an abnormal counter. If smoke is detected during a smoke detection, the task execution cycle of the smoke detection can be shortened to expedite smoke detection and earlier identification of fire alarms. The abnormal event is then recorded in the historical detection record table, and the continuous normal counter is reset. If no smoke is detected for several consecutive cycles, the system can gradually revert to the initial task execution cycle.

[0096] After performing the battery detection task, the controller performs anomaly detection on the battery. If abnormalities such as abnormal battery voltage, increased internal resistance, or decreased capacity are detected, it indicates a problem with the battery and triggers a battery anomaly alarm. Specifically, the controller can control the buzzer in the smoke sensor to emit an alarm sound or use other light emitters in the smoke sensor to emit a flashing red light to indicate a battery anomaly.

[0097] In some implementations, if the battery voltage is detected to be normal multiple times in a row, the controller can appropriately delay the execution cycle of the battery detection task, that is, reduce the detection frequency, in order to reduce unnecessary battery energy consumption and damage to the optical transmitter, and achieve a balance between system power consumption and maintenance requirements.

[0098] In the above implementation process, by dynamically shortening the execution cycle of the smoke detection task when smoke is detected and triggering an alarm when the battery is abnormal, the system achieves an adaptive response under safety threats. This not only significantly improves the monitoring frequency and alarm timeliness under dangerous conditions, but also ensures that potential risks can be immediately alerted through the intelligent scheduling mechanism, thereby greatly enhancing the equipment's safety protection capabilities and the reliability of proactive early warning.

[0099] Based on the above embodiments, when performing battery testing tasks, the controller can control the light emitter as a load to perform current discharge processing on the battery. After a set time, the voltage information of the battery is collected and analyzed to obtain the battery testing results.

[0100] Specifically, during battery testing, the controller performs a current discharge process to remove the passivation film on the battery electrode surface. Battery testing is divided into two stages: The first stage begins with the current discharge process; after the circuit stabilizes, the second stage begins. The first stage takes approximately 1-2 ms, so the set duration can be 3 ms. In the second stage, the current discharge process continues. After 3 ms, the controller collects and analyzes battery voltage information. This stage takes several hundred microseconds. Finally, the program ends and returns to its original state.

[0101] If the battery detection results obtained in the second stage indicate that the battery voltage is low, an alarm can be triggered directly.

[0102] Taking a 3V battery as an example, if the controller detects that the actual voltage is lower than or equal to 2.7V, it will issue a low-voltage alarm. The low-voltage setting varies depending on the battery product and should be determined according to product requirements.

[0103] In the above implementation process, by reusing the light emitter as a load to perform current discharge processing on the battery in the battery detection task, and collecting and analyzing voltage information after a set time, accurate detection of battery health status is achieved without adding a dedicated discharge circuit.

[0104] Based on the above embodiments, within the initial power-on set time of the smoke sensor, the task execution cycle of the battery detection task is the first cycle, and after the set time, the task execution cycle of the battery detection task is the second cycle, which is longer than the first cycle.

[0105] For example, within the first two hours after the smoke sensor is initially powered on, the battery detection task has a cycle time of 40 seconds, and after two hours, the cycle time is 600 seconds. Therefore, after two hours, the controller can re-determine the execution time of the battery detection task based on its cycle time in the same way.

[0106] In the above implementation process, by using a shorter battery detection cycle at the initial stage of power-on, battery electrode passivation can be quickly eliminated and an accurate voltage reference can be established. After the system is running stably, the cycle is switched to a longer one, which ensures the effectiveness and timeliness of battery status monitoring and avoids the extra power consumption caused by unnecessary frequent detection.

[0107] Based on the above embodiments, when performing a smoke detection task, the controller can input a first constant current sinking current to the light emitter so that the light emitter emits a light signal for smoke detection; when performing a battery detection task, a second constant current sinking current is input to the light emitter so that the light emitter acts as a load to perform current discharge processing on the battery, wherein the second constant current sinking current is greater than or equal to the first constant current sinking current.

[0108] The first constant current sinking current refers to the current driving the light emitter during smoke detection. This current is sufficient to allow the light emitter to emit infrared light of sufficient intensity for detection, while maintaining low power consumption and device safety.

[0109] The second constant current sinking current refers to the current driving the light emitter during battery discharge detection. This current can be greater than or equal to the normal current for smoke detection, and is generally longer. Its main purpose is to allow the light emitter to act as a load, causing the passivation film on the negative electrode surface of the battery to peel off / be damaged / break down, rather than being used for smoke detection. When the controller performs the battery detection task, its light emitter will also emit light under the drive of the second constant current sinking current, but at this time the controller will ignore the detection signal from the light receiver, which is equivalent to not processing the detection signal for smoke detection. Obviously, when the light emitter is a visible light emitter, it emits visible light under the drive of the second constant current sinking current; when the light emitter is an invisible light emitter, it emits invisible light under the drive of the second constant current sinking current.

[0110] In some implementations, the controller may also have a built-in constant current sinking output circuit SCC connected to the light emitter. This circuit includes a single channel, in which case the constant current sinking output circuit is connected to the light emitter. When performing smoke detection or battery detection tasks, the controller can control the constant current sinking output circuit SCC to output a corresponding constant current sinking current to the light emitter according to the different tasks being performed.

[0111] In some other implementations, the current may include dual or multiple channels, in which one channel is connected to an optical emitter and the other channel is connected to other optical emitters.

[0112] The controller can adjust the current of the output channel of the constant current output circuit SCC to achieve the purpose of outputting different currents for different optical transmitters.

[0113] In a multi-channel configuration, the controller can select the channel to be connected and the output current according to the requirements of different task scenarios, thereby achieving the purpose of using different currents to drive optical transmitters and / or other optical transmitters to achieve different functions.

[0114] Among them, the constant current output circuit SCC can output 20-200mA from the port and has multiple adjustable constant current sinking currents.

[0115] In some implementations, taking a single channel as an example, the detection currents for two tasks can be pre-configured in the controller. For instance, the first constant current sinking current for the smoke detection task is 40mA, and the second constant current sinking current for the battery detection task is 75mA (which can be greater than or equal to the first constant current sinking current). These two constant current sinking currents can be configured to the sinking current constant current output circuit SCC, which can then output a current of the corresponding magnitude according to the configured constant current sinking currents.

[0116] In some other implementations, taking a dual-channel configuration as an example, one output channel is connected to other light emitters, and the other output channel is connected to the light emitter. The control software can select the appropriate channel and adjust the circuit's output current according to the different tasks being performed. For example, when performing a smoke detection task with the light emitter, the circuit's output current is adjusted to supply the light emitter as needed. Similarly, if other light emitters also participate in smoke detection, the circuit's output current is adjusted to supply the other light emitters as needed.

[0117] At each time a task is executed, the controller can control the corresponding sinking current constant current output circuit SCC to output the corresponding constant current sinking current to the optical transmitter.

[0118] For example, when performing a smoke detection task, the controller controls the constant current output circuit SCC00 to output a first constant current sink, which lasts for t2. Driven by the first constant current sink, the light emitter emits infrared light of a specific intensity, typically for a short duration of 200µs. The light receiver synchronously collects the scattered light signal, and the controller processes and analyzes the signal to determine the presence of smoke.

[0119] The controller then remains in standby or sleep mode, preparing for the next task.

[0120] During battery testing, the controller controls the constant current output circuit SCC00 to output a second constant current for a duration of t1, which can be greater than t2. The light emitter acts as a load under the drive of the second constant current, effectively eliminating the electrode passivation film under the prolonged action of the second constant current.

[0121] Of course, the time for each task execution can also be pre-configured for the sinking current constant current output circuit SCC, so that the time for the sinking current constant current output circuit SCC to output current can be controlled; at other times, the sinking current constant current output circuit SCC may not output current.

[0122] In some other implementations, the controller may integrate or connect at least two sink current constant current output circuits (SCCs). For example, one sink current constant current output circuit (SCC) may be connected to the input of the light emitter, and the other sink current constant current output circuit (SCC) may also be connected to the input of the light emitter. In this case, the two sink current constant current output circuits can be used to output corresponding constant current sinking currents under different tasks. For example, when performing a smoke detection task, one of the constant current sink current output circuits is controlled to output a first constant current sinking current to the light emitter; when performing a battery detection task, the other constant current sink current output circuit is controlled to output a second constant current sinking current to the light emitter.

[0123] In some other implementations, if there are two sinking current constant current output circuits, one sinking current constant current output circuit can be connected to optical transmitter D1, and the other sinking current constant current output circuit can be connected to other optical transmitter D3. In this way, the two sinking current constant current output circuits can output corresponding currents for different optical transmitters to drive the two optical transmitters to achieve different functions.

[0124] In the above implementation process, by injecting differentiated constant current into the light emitter during different task execution periods, it can accurately emit light signals during smoke detection and discharge current as a load during battery detection. This ensures both the sensitivity of smoke detection and the effectiveness of eliminating battery passivation. Furthermore, by reusing a single device, the hardware resources are maximized without the need for additional battery detection circuitry, significantly reducing system complexity and cost.

[0125] The second implementation of time-sharing reuse is to execute each task sequentially based on the task execution time sequence.

[0126] The controller first obtains the task execution cycle and duration for each of the multiple tasks, and then generates a task execution time sequence based on the task execution cycle and duration. Each execution moment in the task execution time sequence corresponds to an execution task, and then the multiple tasks are executed sequentially according to the task execution time sequence.

[0127] The task execution cycle refers to the fixed time interval between two executions of the same task, while the task execution duration refers to the time required to execute each task. For example, the execution cycle of a smoke detection task is 8 seconds, and the task execution duration is 4 milliseconds; the execution cycle of a battery detection task is 40 seconds or 600 seconds (for example, the execution cycle is once every 40 seconds within 2 hours after the smoke sensor is powered on, and then once every 600 seconds thereafter), and the task execution duration is 1 second.

[0128] A task execution time series is a list arranged chronologically that clearly defines which task the controller should execute at what point in time; it is a timetable for precise time-sharing multiplexing. The execution moment refers to a specific point in time within the time series, usually measured in milliseconds or seconds after system startup.

[0129] After the controller is started, it can first identify the multiple tasks that need to be managed and their execution cycles. For example, task A (smoke detection): cycle is 8s, task B (battery detection): cycle is 40s.

[0130] The controller can use a hardware timer to establish a stable time base, such as generating an interrupt every 1 millisecond, and maintain a 64-bit system clock counter.

[0131] When constructing a task execution time series, first calculate the least common multiple of all task cycles. This value represents the large cycle of the entire time series, for example, 40 seconds as a large cycle. Then, within this large cycle, generate all execution time points for each task. For example, task A might execute at 8s, 16s, 24s, and 32s, while task B might execute at 0s and 40s. Understandably, when assigning execution time points to each task, if overlapping time points are encountered, the allocation follows the principle of executing only one task at that time point. For instance, tasks A and B could both execute at 0s and 40s, but in this case, the higher-priority task could be assigned to that time point.

[0132] Then, the time points of all tasks can be merged into a list, sorted in chronological order, to form the final task execution time sequence.

[0133] During task execution, the controller maintains a current sequence pointer, pointing to the next task time point to be executed. At each time point, the task corresponding to that moment is executed. After execution, the pointer moves to the next time point in the sequence. For example, after the smoke sensor is activated, task B is executed at 0s, task A is executed 8s later, then task A is executed again at 16s, until task B is executed again at 40s. After 40s, both tasks are executed again, starting a new cycle.

[0134] In some implementations, to achieve low power consumption, the controller can enter a low-power sleep mode between two adjacent execution moments. For example, if task A is executed every 8 seconds and task A requires 4ms to complete, the controller can enter sleep mode between 8005ms and 16000ms; then the system can wake up the controller using a real-time clock or at the next execution moment.

[0135] In the above implementation process, by combining the task execution cycle and execution duration to generate an accurate task execution time sequence, the controller can pre-plan and accurately allocate the start and end times of each task, which not only avoids resource conflicts and execution overlap between tasks, but also significantly improves system stability and real-time response capabilities.

[0136] In the above method of generating task execution time sequence, when the controller arranges the task execution time point of each task according to the task execution cycle, if it is determined that the execution time point of a certain task is within the task execution duration of other tasks, then it determines whether the task execution time point of that task should be postponed according to the priority of the task, and generates task execution time sequence according to the arranged task execution time point and the tasks corresponding to each task execution time point.

[0137] Understandably, in some cases, there may be task execution conflicts between smoke detection tasks and battery detection tasks. For example, there are two situations: the first situation is that a task is being executed at the same time, but the execution time of other tasks has arrived; the second situation is that two tasks need to be started and executed at the same time.

[0138] For the first scenario, the way to resolve task conflicts is to postpone the execution time of the lower-priority task. For example, if task A needs to be executed at 2 seconds, but task B has not yet been completed, meaning the execution time of task A at 2 seconds falls within the execution duration of task B, then the decision to postpone task A at 2 seconds should be based on the task priorities.

[0139] If task B has a higher priority, then task A, which is scheduled to be executed in the 2nd second, can be postponed until task B is completed. That is, task A will not be scheduled to be executed at the task execution time point of the 2nd second, but will be postponed.

[0140] If task A has a higher priority, then task A, which is to be executed in the 2nd second, can be executed without delay. At this time, task B can be paused, and task B can be executed after task A is completed.

[0141] In the second scenario, the solution to task conflicts is to execute the higher-priority task first. For example, if task A and task B need to be executed simultaneously at time 0, the tasks are scheduled according to their priority. If task A has a higher priority, it will be executed first at time 0, and task B can be postponed to the next execution cycle.

[0142] In the above implementation process, by dynamically identifying and handling time overlap conflicts between tasks when generating task execution time sequences, and intelligently adjusting the execution time points according to preset task priorities, resource contention is avoided in advance at the scheduling level, ensuring that the real-time response of high-priority tasks is not blocked, while maintaining the orderliness and determinism of the overall system scheduling sequence.

[0143] In some implementations, battery detection tasks can be performed during the idle periods of smoke detection tasks by planning the task execution cycle, thus achieving deep reuse of hardware resources. In smoke detection tasks, the effective operating time of the light emitter is extremely short (e.g., a few hundred microseconds), after which it enters a long idle state. Battery detection tasks, as maintenance operations, do not have high real-time requirements and can be flexibly scheduled to be performed during idle periods. By completely staggering the two tasks in time, time-sharing multiplexing of the same light emitter can be achieved without affecting the smoke detection function, thereby saving hardware resources and improving system integration.

[0144] like Figure 4 The diagram shows the time sequence of each task execution. D1 represents optical transmitter 13, D3 represents other optical transmitters 15 in this scheme, and D2 represents optical receiver 14. D1 and D3 can be used together for smoke detection, i.e., dual-transmitter, single-receiver. After the controller's main program starts, the hardware and software are initialized. The real-time clock (RTC) interrupt triggers the clock management scheduling system (which stores the execution time sequence of each task). This scheduling system checks its maintained task time sequence table and then executes each task sequentially. The specific process is as follows (taking dual-transmitter, single-receiver as an example): (1) System wake-up and basic checks.

[0145] The controller is woken from sleep mode by a timer, reads the real-time clock (RTC), updates the global timestamp, and then can prioritize completing a self-test. During the smoke alarm's power-on initialization, it checks whether the self-test indicator lights up normally and whether the buzzer sounds normally; during each time the controller is woken up at a set time, only critical status checks can be performed.

[0146] (2) Battery testing task.

[0147] The system determines whether the execution time point T1 of the battery detection task has been reached based on the task execution cycle. If so, the battery detection task is executed. For example, the output current of the constant current sinking circuit SCC00 is configured to be a constant current sinking current X1. The optical transmitter D1 is turned on as a load and discharged continuously for a duration t1, collecting battery signals. After the battery signal collection is complete, the constant current sinking circuit SCC00 is turned off, and then the battery voltage is evaluated, such as assessing the battery's health status. The system then continues to detect the execution time points of other tasks. X1 is in milliamperes (mA), and t1 is in milliseconds (ms).

[0148] (3) Smoke detection task.

[0149] The system checks if the task execution time point T2 for the smoke detection task has been reached. If so, the smoke detection task is executed. For example, the first smoke detection task is executed first. The output current of the constant current sinking circuit SCC00 is configured to be a constant current sinking current X2, driving the optical transmitter D1 to emit an optical signal for a duration of t2. The optical receiver D2 collects the optical signal. After the optical signal (i.e., the first smoke signal) is collected, the constant current sinking circuit SCC00 is turned off, and the controller receives the first electrical signal. The unit of X2 is milliamperes (mA), and the unit of t2 is milliseconds (ms).

[0150] If the execution time point T3 of the second smoke detection task is reached, the output current of the constant current sinking circuit SCC01 is configured to be a constant current sinking current X3, driving other light emitters D3 to emit light signals for a duration of t3. long The optical receiver D2 acquires the optical signal. After the optical signal (i.e., the second smoke signal) is acquired, the constant current output circuit SCC01 is turned off, and the controller obtains the second electrical signal. The unit of X3 is milliampere (mA), and the unit of t3 is millisecond (ms).

[0151] Specifically, in this embodiment, the constant current sinking current X1 is greater than the constant current sinking current X2, and the duration t1 is greater than the duration t2. Furthermore, the constant current sinking current X3 and duration t3 driving the other optical transmitter D3 can be configured according to the smoke detection task of the dual-transmitter single-receiver smoke sensor, aiming to achieve time-sharing driving of the optical transmitter D1 and facilitate smoke recognition.

[0152] The controller uses a smoke recognition algorithm based on the first electrical signal, the second electrical signal, and background noise to identify smoke conditions such as smoke type and determine whether a fire alarm is present; or it uses a smoke sensor fault identification algorithm to identify smoke sensor contamination, such as dust, flying insects, etc., which cause excessive background noise and determine whether a smoke sensor malfunction is present.

[0153] After completing each task, the controller enters sleep mode.

[0154] This application provides a computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it performs the method process executed by the electronic device in the above method embodiments.

[0155] This embodiment discloses a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions, and when the program instructions are executed by a computer, the computer can perform the methods provided in the above-described method embodiments, such as including: The system identifies multiple tasks to be performed, including a smoke detection task and a battery detection task. The smoke detection task includes controlling a light emitter in the smoke sensor to emit a light signal for smoke detection, and the battery detection task includes using the light emitter as a load to perform a current-pull discharge process on the battery. The multiple tasks are executed using a time-sharing multiplexing method.

[0156] In summary, the embodiments of this application provide a task execution method, a smoke sensor, a smoke alarm, a storage medium, and a program product. This method uses a time-division multiplexing mechanism to dynamically switch the use of the light emitter in the smoke sensor between two major functions: smoke detection and battery discharge detection. This allows a single hardware resource to undertake multiple functional roles, thereby reusing the smoke detection circuit to achieve the battery detection function without the need to add a separate battery detection circuit. This effectively reduces hardware costs and circuit board layout area, and improves system integration.

[0157] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A task execution method, characterized in that, The method, applied to a controller in a smoke sensor, includes: The system identifies multiple tasks to be performed, including a smoke detection task and a battery detection task. The smoke detection task includes controlling a light emitter in the smoke sensor to emit a light signal for smoke detection, and the battery detection task includes using the light emitter as a load to perform a current-pull discharge process on the battery. The multiple tasks are executed using a time-sharing multiplexing method.

2. The method according to claim 1, characterized in that, The execution of the multiple tasks using a time-division multiplexing method includes: Obtain the task execution cycles of the smoke detection task and the battery detection task; The tasks to be executed are determined according to the task execution cycle and executed sequentially according to the priority principle.

3. The method according to claim 2, characterized in that, The step of determining the tasks to be executed according to the task execution cycle and executing them sequentially according to priority includes: Based on the time-slice working mechanism, the tasks to be executed are determined according to the task execution cycle within each time slice, and then executed sequentially according to the priority principle.

4. The method according to claim 3, characterized in that, The method further includes: If a task is still being executed and has not yet been completed after a time slice ends, execution will stop and the task in the next time slice will begin.

5. The method according to claim 3, characterized in that, The method further includes: After completing all the tasks to be performed within a time slice, it enters a hibernation state and is awakened at the start of the next time slice.

6. The method according to claim 2, characterized in that, The method further includes: When performing the smoke detection task, a first constant current sink is input to the light emitter so that the light emitter emits a light signal to perform smoke detection; When performing the battery detection task, a second constant current sinking current is input to the light emitter so that the light emitter acts as a load to perform current discharge processing on the battery. Wherein, the second constant current sinking current is greater than or equal to the first constant current sinking current.

7. The method according to claim 2, characterized in that, The execution cycle of the battery detection task is longer than that of the smoke detection task.

8. The method according to claim 2, characterized in that, The method further includes: If smoke is detected after the smoke detection task is performed, the task execution cycle of the smoke detection task is shortened. If the battery is found to be abnormal after the battery detection task is performed, an alarm is triggered.

9. The method according to claim 2, characterized in that, The method further includes: When performing the battery detection task, the light emitter is controlled as a load to perform a current discharge process on the battery. After a set time period, the voltage information of the battery is collected and analyzed to obtain the battery test results.

10. The method according to claim 2, characterized in that, During the initial power-on period of the smoke sensor, the task execution cycle of the battery detection task is a first cycle. After the set period, the task execution cycle of the battery detection task is updated to a second cycle, which is longer than the first cycle.

11. The method according to claim 1, characterized in that, The execution of the multiple tasks using a time-division multiplexing method includes: Obtain the task execution cycle and task execution duration for each of the multiple tasks; A task execution time sequence is generated based on the task execution cycle and the task execution duration, wherein each execution moment in the task execution time sequence corresponds to an execution task; Multiple tasks are executed sequentially according to the task execution time sequence.

12. The method according to claim 11, characterized in that, The step of generating a task execution time sequence based on the task execution cycle and the task execution duration includes: When scheduling the execution time of each task according to the task execution cycle, if it is determined that the execution time of a certain task is within the execution time of other tasks, then the execution time of that task is postponed according to the priority of the task, and a task execution time sequence is generated according to the scheduled execution time and the tasks corresponding to each execution time.

13. A smoke sensor, characterized in that, The smoke sensor includes: case; The controller and the smoke detection circuit are both housed within the housing. The smoke detection circuit includes a light emitter and a light receiver, both of which are electrically connected to the controller. The controller is used to execute the method described in any one of claims 1-12.

14. The smoke sensor according to claim 13, characterized in that, The light signal emitted by the light emitter can be visible or invisible light.

15. The smoke sensor according to claim 13, characterized in that, The controller has a built-in constant current output circuit for sinking current, which is connected to the light emitter.

16. The smoke sensor according to claim 15, characterized in that, The current sinking constant current output circuit includes a single channel or a dual channel. In the case of a dual channel, one channel is connected to the optical emitter, and the other channel is connected to other optical emitters.

17. A smoke detector, characterized in that, The smoke alarm includes the smoke sensor according to any one of claims 13-16.

18. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it performs the method as described in any one of claims 1-12.

19. A computer program product, characterized in that, It includes computer program instructions, which, when read and executed by a processor, perform the method as described in any one of claims 1-12.