Disclosure of Invention
The invention mainly aims to provide a pressure difference-based electronic cigarette control method, pressure difference-based electronic cigarette control equipment and a computer-readable storage medium, and aims to solve the technical problem that the power consumption of the existing electronic cigarettes is high.
In order to achieve the above object, the present invention provides a pressure difference-based electronic cigarette control method, which is applied to an electronic cigarette, the electronic cigarette includes a pressure difference sensor, a processor and an atomizer, the pressure difference-based electronic cigarette control method includes the following steps:
detecting a first pressure difference of the electronic cigarette through the differential pressure sensor according to a preset detection period, and judging whether the electronic cigarette is in a smoking state currently or not based on the first pressure difference;
when the first pressure difference is smaller than a minimum threshold value, judging that the electronic cigarette is in a smoking state currently, controlling the processor to change from a low-power consumption state to a working state, and starting the atomizer through the processor to control the electronic cigarette to work;
and after the atomizer is started, controlling the processor to switch from the working state to the low-power consumption state.
Optionally, after the step of controlling the processor to switch from the operating state to the low power consumption state after the atomizer is started, the method further includes:
detecting a second pressure difference of the electronic cigarette through the differential pressure sensor, and judging whether the electronic cigarette is in an ending state currently or not based on the second pressure difference;
when the second pressure difference is larger than a maximum threshold value, judging that the electronic cigarette is in an ending state currently, controlling the processor to switch from the low-power consumption state to the working state, and closing the atomizer through the processor so as to stop the work of the electronic cigarette;
and after the atomizer is closed, controlling the processor to change the working state into the low-power consumption state.
Optionally, the step of detecting, according to a preset detection period, the current pressure difference of the electronic cigarette by the differential pressure sensor, as the first pressure difference, further includes:
starting a threshold interrupt function by the processor based on the minimum threshold and the maximum threshold to interrupt a low power consumption mode of the processor when detecting that the pressure difference of the electronic cigarette is smaller than the minimum threshold or larger than the maximum threshold;
based on the preset detection period, a period detection task is generated by the processor so as to carry out period detection on the pressure difference of the electronic cigarette through the pressure difference sensor, and the processor is controlled to switch into the low-power consumption mode.
Optionally, the threshold interruption function includes a minimum threshold interruption function, and when the first pressure difference is smaller than a minimum threshold, determining that the electronic cigarette is currently in a smoking state, controlling the processor to change from a low power consumption state to a working state, and starting the atomizer through the processor, so as to control the electronic cigarette to work specifically includes:
when the first pressure difference is smaller than the minimum threshold value, judging that the electronic cigarette is in the smoking state currently, and generating a first interrupt instruction based on the minimum threshold value interrupt function so as to switch the current mode of the processor;
and based on the first interrupt instruction, controlling the processor to switch from the low-power consumption state to the working state, and starting the atomizer through the processor so as to control the electronic cigarette to work.
Optionally, the threshold interrupt function includes a maximum threshold interrupt function, and after the step of controlling the processor to switch from the low power consumption state to the working state and starting the atomizer by the processor to control the electronic cigarette to work, the method further includes:
and closing the minimum threshold interruption function and opening the maximum threshold interruption function.
Optionally, when the second pressure difference is greater than the maximum threshold, determining that the electronic cigarette is currently in an end state, controlling the processor to switch from the low power consumption state to the working state, and closing the atomizer through the processor, so as to stop the work of the electronic cigarette specifically includes:
when the second pressure difference is larger than the maximum threshold, judging that the electronic cigarette is in an ending state currently, and generating a second interrupt instruction based on the maximum threshold interrupt function so as to switch the current mode of the processor;
and controlling the processor to switch from the low-power consumption state to the working state based on the second interrupt instruction, and closing the atomizer through the processor so as to stop the work of the electronic cigarette.
Optionally, after the step of controlling the processor to switch from the low power consumption state to the working state based on the second interrupt instruction and closing the atomizer by the processor to stop the working of the electronic cigarette, the method further includes:
and closing the maximum threshold interruption function and opening the minimum threshold interruption function to detect whether the electronic cigarette is in the smoking state.
The processor is a low-power-consumption micro control unit MCU, and the low-power-consumption mode comprises a deep sleep mode or a deep sleep mode.
Optionally, the processor is a low power consumption micro control unit MCU, and the low power consumption mode includes a deep sleep mode or a deep sleep mode.
In addition, in order to achieve the above object, the present invention also provides a pressure-difference-based electronic cigarette control device, which includes a processor, a memory, and a pressure-difference-based electronic cigarette control program stored on the memory and executable by the processor, wherein the pressure-difference-based electronic cigarette control program, when executed by the processor, implements the steps of the pressure-difference-based electronic cigarette control method as described above.
In addition, in order to achieve the above object, the present invention also provides a computer readable storage medium having stored thereon a pressure difference based e-cigarette control program, wherein the pressure difference based e-cigarette control program, when executed by a processor, implements the steps of the pressure difference based e-cigarette control method as described above.
The invention provides a pressure difference-based electronic cigarette control method, which is applied to electronic cigarettes, wherein the electronic cigarettes comprise a differential pressure sensor, a processor and an atomizer, and the pressure difference-based electronic cigarette control method comprises the following steps: detecting a first pressure difference of the electronic cigarette through the differential pressure sensor according to a preset detection period, and judging whether the electronic cigarette is in a smoking state currently or not based on the first pressure difference; when the first pressure difference is smaller than a minimum threshold value, judging that the electronic cigarette is in a smoking state currently, controlling the processor to change from a low-power consumption state to a working state, and starting the atomizer through the processor to control the electronic cigarette to work; and after the atomizer is started, controlling the processor to switch from the working state to the low-power consumption state. Through the mode, the electronic cigarette is subjected to periodic pressure detection through the differential pressure sensor, so that the differential pressure sensor is prevented from detecting in real time and increasing power consumption. And the processor is started only when the electronic cigarette is detected to be in a smoking state so as to control the electronic cigarette to work. When the electronic cigarette does not need to work, the processor is controlled to be in a low-power-consumption state, so that the power consumption generated when the processor is in a working state is reduced, the standby time of the electronic cigarette is prolonged, the user experience is improved, and the technical problem that the power consumption of the existing electronic cigarette is relatively fast is solved.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The electronic cigarette control method based on the pressure difference is mainly applied to electronic cigarette control equipment based on the pressure difference, and the electronic cigarette control equipment based on the pressure difference can be equipment with display and processing functions such as a PC (personal computer), a portable computer and a mobile terminal.
Referring to fig. 1, fig. 1 is a schematic hardware structure diagram of an electronic cigarette control device based on pressure difference according to an embodiment of the present invention. In embodiments of the present invention, the pressure differential based e-cigarette control device may include a processor 1001 (e.g., a CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein the communication bus 1002 is used to enable connected communications between these components; the user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard); the network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface); the memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory, and the memory 1005 may alternatively be a storage device independent of the processor 1001.
Those skilled in the art will appreciate that the hardware configuration shown in fig. 1 does not constitute a limitation of the pressure differential based e-cigarette control device, and may include more or fewer components than shown, or may combine certain components, or may have a different arrangement of components.
With continued reference to fig. 1, the memory 1005 of fig. 1, which is a computer readable storage medium, may include an operating system, a network communication module, and a pressure differential based e-cigarette control program.
In fig. 1, the network communication module is mainly used for connecting with a server and performing data communication with the server; the processor 1001 may invoke the electronic cigarette control program based on the pressure difference stored in the memory 1005, and execute the electronic cigarette control method based on the pressure difference according to the embodiment of the present invention.
The embodiment of the invention provides an electronic cigarette control method based on pressure difference.
Referring to fig. 2, fig. 2 is a schematic flow chart of a first embodiment of the electronic cigarette control method based on pressure difference according to the present invention.
In this embodiment, the electronic cigarette control method based on pressure difference is applied to an electronic cigarette, the electronic cigarette includes a pressure difference sensor, a processor and an atomizer, and the electronic cigarette control method based on pressure difference includes the following steps:
step S10, detecting a first pressure difference of the electronic cigarette through the differential pressure sensor according to a preset detection period, and judging whether the electronic cigarette is in a smoking state currently or not based on the first pressure difference;
the current electronic cigarette consumes faster electricity, and reduces user experience. In this embodiment, in order to solve the above-mentioned problem, the periodic pressure detection is performed on the electronic cigarette by the differential pressure sensor, so that the differential pressure sensor is prevented from detecting in real time and increasing power consumption. And the processor is started only when the electronic cigarette is detected to be in a smoking state so as to control the electronic cigarette to work. When the electronic cigarette does not need to work, the processor is controlled to be in a low-power-consumption state, so that the power consumption generated when the processor is in a working state is reduced, the standby time of the electronic cigarette is prolonged, and the user experience is improved. Specifically, the structure of the electronic cigarette comprises a processor, a differential pressure sensor and an atomizer, wherein the processor is a low-power-consumption micro control unit MCU in the embodiment, and is used for receiving the numerical values read by the sensors, controlling the switch of the atomizer and controlling and driving the atomizer. The working principle of the differential pressure sensor is as follows: holes are formed in two sides of the piezoresistive diaphragm of the sensor, the holes correspond to pressures on two sides respectively, when pressure differences exist on two sides, the piezoresistive diaphragm in the sensor deforms towards one side, and the pressure differences on two sides can be known by measuring the resistance of the diaphragm. Therefore, the differential pressure sensor functions as: when a user smokes, the pressure of the smoking channel can be reduced, the diaphragm can be pushed inwards by the external environment, and the sensor can determine the pressure difference between the smoking channel and the external environment by sensing the change of the resistance of the diaphragm. And when the pressure difference exceeds the set threshold, determining that the electronic cigarette is in a smoking state currently, and starting the atomizer through the processor so as to facilitate a user to smoke. In other words, the main power consumption sources of the electronic cigarette are the atomizer, the processor and the differential pressure sensor, so in order to increase the service time of the battery of the electronic cigarette, the power consumption of the processor can be reduced, for example, the workload of the processor is reduced, the processor enters a low power consumption mode (such as a power saving mode, a sleep mode or a sleep mode) when the electronic cigarette does not need to work, then a periodical measurement mechanism is executed on the differential pressure sensor, the differential pressure sensor is started only at a fixed periodical point to measure, and the electronic cigarette is shifted to a sleep state after the measurement is completed, so as to achieve the purpose of saving electricity. And finally, starting the atomizer only when the smoking state of the electronic cigarette is detected, and closing the atomizer when the smoking state is finished. Namely, according to a preset detection period, detecting a first pressure difference of the electronic cigarette through the differential pressure sensor, and judging whether the electronic cigarette is in a smoking state currently or not based on the first pressure difference.
Step S20, when the first pressure difference is smaller than a minimum threshold value, judging that the electronic cigarette is in a smoking state currently, controlling the processor to change from a low-power consumption state to a working state, and starting the atomizer through the processor so as to control the electronic cigarette to work;
in this embodiment, when the first pressure difference is smaller than a minimum threshold, it is determined that the electronic cigarette is in a smoking state. The electronic cigarette indicates that a user needs to use the electronic cigarette to smoke, and the processor needs to send a working instruction to the atomizer to start the atomizer. The working instruction is sent to the processor, the processor is controlled to be converted into a working state from a current low-power consumption state, namely, the atomizer switch is turned on and the atomizer is driven to work, so that the electronic cigarette enters the working state, and a user can smoke. Wherein the low power consumption state includes a deep sleep mode or a deep sleep mode.
And step S30, after the atomizer is started, controlling the processor to switch from the working state to the low-power consumption state.
In this embodiment, after the atomizer is started by the processor, that is, after a start success instruction is detected, the processor is indicated to have completed the start operation, and the processor is controlled to enter a low power consumption state from a working state, so as to reduce the power consumption of the processor.
The embodiment provides a pressure difference-based electronic cigarette control method, which is applied to electronic cigarettes, wherein the electronic cigarettes comprise a differential pressure sensor, a processor and an atomizer, and the pressure difference-based electronic cigarette control method comprises the following steps: detecting a first pressure difference of the electronic cigarette through the differential pressure sensor according to a preset detection period, and judging whether the electronic cigarette is in a smoking state currently or not based on the first pressure difference; when the first pressure difference is smaller than a minimum threshold value, judging that the electronic cigarette is in a smoking state currently, controlling the processor to change from a low-power consumption state to a working state, and starting the atomizer through the processor to control the electronic cigarette to work; and after the atomizer is started, controlling the processor to switch from the working state to the low-power consumption state. Through the mode, the electronic cigarette is subjected to periodic pressure detection through the differential pressure sensor, so that the differential pressure sensor is prevented from detecting in real time and increasing power consumption. And the processor is started only when the electronic cigarette is detected to be in a smoking state so as to control the electronic cigarette to work. When the electronic cigarette does not need to work, the processor is controlled to be in a low-power-consumption state, so that the power consumption generated when the processor is in a working state is reduced, the standby time of the electronic cigarette is prolonged, the user experience is improved, and the technical problem that the power consumption of the existing electronic cigarette is relatively fast is solved.
Referring to fig. 3, fig. 3 is a schematic flow chart of a second embodiment of the electronic cigarette control method based on pressure difference according to the present invention.
Based on the embodiment shown in fig. 2, in this embodiment, after step S30, the method further includes:
step S40, detecting a second pressure difference of the electronic cigarette through the differential pressure sensor, and judging whether the electronic cigarette is in an ending state currently or not based on the second pressure difference;
step S50, when the second pressure difference is larger than a maximum threshold value, judging that the electronic cigarette is in an ending state currently, controlling the processor to switch from the low-power consumption state to the working state, and closing the atomizer through the processor so as to stop the work of the electronic cigarette;
and step S60, after the atomizer is closed, controlling the processor to have the working state to be switched into the low-power consumption state.
In order to further reduce the power consumption of the processor, in this embodiment, the differential pressure sensor detects a second pressure difference of the electronic cigarette, and when the second pressure difference is greater than a maximum threshold, it indicates that the user has finished smoking, and the electronic cigarette is currently in an end state. The atomizer needs to be turned off by the processor, and the working state of the atomizer is finished. And sending a working instruction to the processor to control the processor to change from the current low-power consumption state to the working state. And then sending a closing instruction to the atomizer through the processor, closing the atomizer, and stopping the work of the electronic cigarette. After a successful instruction for closing the atomizer is detected, the current work of the processor is finished, and a sleep instruction or a dormancy instruction is sent to the processor, so that the processor is switched into a low-power consumption state from the current working state, and the purpose of saving electricity is achieved.
Referring to fig. 4, fig. 4 is a schematic flow chart of a third embodiment of the electronic cigarette control method based on pressure difference according to the present invention.
Based on the embodiment shown in fig. 3, in this embodiment, before step S10, the method further includes:
step S70, based on the minimum threshold value and the maximum threshold value, starting a threshold value interruption function by the processor to interrupt a low power consumption mode of the processor when detecting that the pressure difference of the electronic cigarette is smaller than the minimum threshold value or larger than the maximum threshold value;
and step S80, based on the preset detection period, generating a period detection task by the processor so as to carry out period detection on the pressure difference of the electronic cigarette by the differential pressure sensor and control the processor to switch into the low-power consumption mode.
Wherein the threshold interrupt function includes a minimum threshold interrupt function, and the step S20 specifically includes:
when the first pressure difference is smaller than the minimum threshold value, judging that the electronic cigarette is in the smoking state currently, and generating a first interrupt instruction based on the minimum threshold value interrupt function so as to switch the current mode of the processor;
and based on the first interrupt instruction, controlling the processor to switch from the low-power consumption state to the working state, and starting the atomizer through the processor so as to control the electronic cigarette to work.
Wherein the threshold interrupt function includes a maximum threshold interrupt function, and the step S20 specifically further includes:
and closing the minimum threshold interruption function and opening the maximum threshold interruption function.
The step S30 specifically includes:
when the second pressure difference is larger than the maximum threshold, judging that the electronic cigarette is in an ending state currently, and generating a second interrupt instruction based on the maximum threshold interrupt function so as to switch the current mode of the processor;
based on the second interrupt instruction, controlling the processor to switch from the low-power consumption state to the working state, and closing the atomizer through the processor so as to stop the work of the electronic cigarette;
and closing the maximum threshold interruption function and opening the minimum threshold interruption function to detect whether the electronic cigarette is in the smoking state.
In this embodiment, after the power is started, the processor sets a lower threshold, i.e. a minimum threshold, of the differential pressure sensor, and starts the corresponding interrupt function and starts the periodic pressure measurement task. After the above-mentioned work is completed, the processor enters a low power consumption mode, such as a power saving sleep mode. When a user generates smoking action, the pressure difference of the electronic cigarette is detected to be smaller than a lower limit threshold value through the pressure difference sensor, and interruption is generated. The interrupt wakes up the processor, which first clears the current interrupt state and pauses the shut down lower threshold interrupt function. And setting an upper limit threshold and an interruption function thereof, starting the atomizer, and entering a low-power consumption state, such as a sleep state, from the current working state after the work is completed. And detecting the pressure difference of the electronic cigarette through a pressure difference sensor, and when the pressure difference of the electronic cigarette is larger than a maximum threshold value, indicating that the smoking state of the electronic cigarette is finished, namely, the current pressure value of the electronic cigarette is larger than an upper threshold value, generating an interrupt instruction, and waking up a processor to perform a working state. And closing the atomizer through the processor, temporarily closing the upper limit threshold interruption function, and then restarting the lower limit threshold interruption function so as to circularly detect whether a user performs smoking action on the electronic cigarette. When the power supply of the electronic cigarette is started, a threshold interruption function is set through the processor, and a periodic detection task of the differential pressure sensor is set, so that the differential pressure sensor can carry out periodic pressure detection on a smoking channel of the electronic cigarette. After the above-mentioned work is completed, a low power consumption mode such as a sleep mode is shifted. When the first pressure difference is smaller than the minimum threshold, the electronic cigarette is judged to be in the smoking state currently, and a first interrupt instruction is generated based on the minimum threshold interrupt function so as to switch the current mode of the processor, so that the processor is switched into a working state from a low-power consumption state. And starting the atomizer through the processor to enable the electronic cigarette to work outwards. When the pressure difference sensor detects that the second pressure difference is larger than the maximum threshold, namely, the user finishes the current smoking action, the electronic cigarette is judged to be in the ending state currently, a second interrupt instruction is generated based on the maximum threshold interrupt function, the current mode of the processor is switched based on the second interrupt instruction, and the electronic cigarette enters the working state. And closing the atomizer through the processor so as to stop the work of the electronic cigarette and wait for the next smoking action of a user. And simultaneously closing the maximum threshold interruption function and opening the minimum threshold interruption function to detect whether the electronic cigarette is in the smoking state.
In addition, the embodiment of the invention also provides an electronic cigarette control device based on the pressure difference.
In this embodiment, the electronic cigarette control device based on pressure difference includes:
the smoking state judging module is used for detecting a first pressure difference of the electronic cigarette through the differential pressure sensor according to a preset detection period and judging whether the electronic cigarette is in a smoking state currently or not based on the first pressure difference;
the first state switching module is used for judging that the electronic cigarette is in a smoking state currently when the first pressure difference is smaller than a minimum threshold value, controlling the processor to switch from a low-power consumption state to a working state, and starting the atomizer through the processor so as to control the electronic cigarette to work;
and the second state switching module is used for controlling the processor to switch from the working state to the low-power consumption state after the atomizer is started.
Further, the electronic cigarette control device based on the pressure difference further comprises a third state switching module, wherein the third state switching module is used for:
detecting a second pressure difference of the electronic cigarette through the differential pressure sensor, and judging whether the electronic cigarette is in an ending state currently or not based on the second pressure difference;
when the second pressure difference is larger than a maximum threshold value, judging that the electronic cigarette is in an ending state currently, controlling the processor to switch from the low-power consumption state to the working state, and closing the atomizer through the processor so as to stop the work of the electronic cigarette;
and after the atomizer is closed, controlling the processor to change the working state into the low-power consumption state.
Further, the electronic cigarette control device based on the pressure difference further comprises a threshold interruption setting module, wherein the threshold interruption setting module is used for:
starting a threshold interrupt function by the processor based on the minimum threshold and the maximum threshold to interrupt a low power consumption mode of the processor when detecting that the pressure difference of the electronic cigarette is smaller than the minimum threshold or larger than the maximum threshold;
based on the preset detection period, a period detection task is generated by the processor so as to carry out period detection on the pressure difference of the electronic cigarette through the pressure difference sensor, and the processor is controlled to switch into the low-power consumption mode.
Further, the threshold interrupt function includes a minimum threshold interrupt function and a maximum threshold interrupt function, and the first state switching module specifically includes:
the first interrupt generation unit is used for judging that the electronic cigarette is in the smoking state currently when the first pressure difference is smaller than the minimum threshold value, and generating a first interrupt instruction based on the minimum threshold value interrupt function so as to switch the current mode of the processor;
the first state switching unit is used for controlling the processor to switch from the low-power consumption state to the working state based on the first interrupt instruction, and starting the atomizer through the processor so as to control the electronic cigarette to work.
And the first interrupt switching unit is used for closing the minimum threshold interrupt function and opening the maximum threshold interrupt function.
Further, the second state switching module specifically includes:
the second interrupt generating unit is used for judging that the electronic cigarette is in an ending state currently when the second pressure difference is larger than the maximum threshold value, and generating a second interrupt instruction based on the maximum threshold value interrupt function so as to switch the current mode of the processor;
and the second state switching unit is used for controlling the processor to switch from the low-power consumption state to the working state based on the second interrupt instruction, and closing the atomizer through the processor so as to stop the work of the electronic cigarette.
And the second interrupt switching unit is used for closing the maximum threshold interrupt function and opening the minimum threshold interrupt function so as to detect whether the electronic cigarette is in the smoking state.
The modules in the electronic cigarette control device based on the pressure difference correspond to the steps in the electronic cigarette control method based on the pressure difference, and the functions and the implementation process of the modules are not described in detail herein.
In addition, the embodiment of the invention also provides a computer readable storage medium.
The computer readable storage medium of the invention stores the electronic cigarette control program based on the pressure difference, wherein when the electronic cigarette control program based on the pressure difference is executed by a processor, the steps of the electronic cigarette control method based on the pressure difference are realized.
The method implemented when the electronic cigarette control program based on the pressure difference is executed may refer to various embodiments of the electronic cigarette control method based on the pressure difference according to the present invention, and will not be described herein.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as described above, comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.