Disclosure of Invention
The invention mainly aims to provide a pressure difference-based electronic cigarette control method, equipment and a computer-readable storage medium, and aims to solve the technical problem that the existing electronic cigarette consumes electricity quickly.
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, wherein the electronic cigarette comprises 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 the minimum threshold value, the electronic cigarette is judged to be in a smoking state at present, the processor is controlled to be switched into a working state from a low power consumption state, and the atomizer is started through the processor to control the electronic cigarette to work;
and after the atomizer is started, controlling the processor to be switched from the working state to the low power consumption state.
Optionally, after the step of controlling the processor to shift 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 currently in an end state, controlling the processor to be switched into the working state from the low power consumption state, and closing the atomizer through the processor to stop the work of the electronic cigarette;
and after the atomizer is closed, controlling the processor to have the working state to be switched into the low power consumption state.
Optionally, before the step of detecting a current pressure difference of the electronic cigarette by the differential pressure sensor according to a preset detection period as the first pressure difference, the method further includes:
based on the minimum and maximum thresholds, initiating, by the processor, a threshold interrupt function to interrupt a low power consumption mode of the processor when a pressure differential of the e-cigarette is detected to be less than the minimum threshold or greater than the maximum threshold;
and based on the preset detection period, generating a period detection task through the processor so as to periodically detect the pressure difference of the electronic cigarette through the differential pressure sensor and control the processor to be switched into the low power consumption mode.
Optionally, the threshold interruption function includes a minimum threshold interruption function, and the determining that the electronic cigarette is currently in a smoking state when the first pressure difference is smaller than the minimum threshold, controlling the processor to shift from a low power consumption state to an operating state, and starting the atomizer through the processor to control the electronic cigarette to operate specifically includes:
when the first pressure difference is smaller than the minimum threshold value, determining that the electronic cigarette is currently in the smoking state, and generating a first interrupt instruction based on the minimum threshold interrupt function to switch the current mode of the processor;
and controlling the processor to be switched from the low power consumption state to the working state based on the first interrupt instruction, and starting the atomizer through the processor 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 shift from the low power consumption state to the operating state and activating the atomizer through the processor to control the electronic cigarette to operate based on the first interrupt instruction, 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, it is determined that the electronic cigarette is currently in an end state, the processor is controlled to be switched from the low power consumption state to the operating state, and the atomizer is turned off by the processor, so as to stop the operation of the electronic cigarette specifically includes:
when the second pressure difference is greater than the maximum threshold, determining that the electronic cigarette is currently in an end state, and generating a second interrupt instruction based on the maximum threshold interrupt function to switch a current mode of the processor;
and controlling the processor to be switched from the low power consumption state to the working state based on the second interrupt instruction, and closing the atomizer through the processor to stop the work of the electronic cigarette.
Optionally, after the step of controlling the processor to shift from the low power consumption state to the operating state and turning off the atomizer through the processor to stop the operation of the electronic cigarette based on the second interrupt instruction, 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.
Furthermore, 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 when the pressure difference-based electronic cigarette control program is executed by the processor, the steps of the pressure difference-based electronic cigarette control method as described above are implemented.
Furthermore, to achieve the above object, the present invention also provides a computer readable storage medium having a pressure difference based electronic cigarette control program stored thereon, wherein the pressure difference based electronic cigarette control program, when executed by a processor, implements the steps of the pressure difference based electronic cigarette control method as described above.
The invention provides an electronic cigarette control method based on pressure difference, which is applied to an electronic cigarette, wherein the electronic cigarette comprises a differential pressure sensor, a processor and an atomizer, and the electronic cigarette control method based on the pressure difference 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 the minimum threshold value, the electronic cigarette is judged to be in a smoking state at present, the processor is controlled to be switched into a working state from a low power consumption state, and the atomizer is started through the processor to control the electronic cigarette to work; and after the atomizer is started, controlling the processor to be switched 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 phenomenon that the differential pressure sensor detects in real time to increase power consumption is avoided. And only when the electronic cigarette is detected to be in a smoking state, starting the processor to control the electronic cigarette to work. And when the electronic cigarette does not need to work, the control treater is the low-power consumption state, reduces the treater and is in operating condition and the consumption that produces, prolongs the standby time of electronic cigarette, promotes user experience, has solved the power consumptive very fast technical problem of current electronic cigarette.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit 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, a mobile terminal and the like.
Referring to fig. 1, fig. 1 is a schematic diagram of a hardware structure of a differential pressure-based electronic cigarette control device according to an embodiment of the present invention. In an embodiment of the present invention, the electronic cigarette control device based on pressure difference may comprise a processor 1001 (e.g. a CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used for realizing connection communication among the 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 may be a non-volatile memory (e.g., a magnetic disk memory), and optionally, the memory 1005 may be a storage device independent of the processor 1001.
Those skilled in the art will appreciate that the hardware configuration shown in figure 1 does not constitute a limitation of a pressure differential-based electronic cigarette control device and may include more or fewer components than those shown, or some components in combination, or a different arrangement of components.
With continued reference to figure 1, the memory 1005 of figure 1, which is one type of 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 to a server and performing data communication with the server; and the processor 1001 may call 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 the pressure difference is applied to an electronic cigarette, the electronic cigarette includes a differential pressure sensor, a processor, and an atomizer, and the electronic cigarette control method based on the 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;
at present, the electronic cigarette consumes more power quickly, and user experience is reduced. In this embodiment, in order to solve the above problem, the differential pressure sensor is used to periodically detect the pressure of the electronic cigarette, so as to avoid the increase of power consumption caused by the real-time detection of the differential pressure sensor. And only when the electronic cigarette is detected to be in a smoking state, starting the processor 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, power consumption generated when the processor is in a working state is reduced, the standby time of the electronic cigarette is prolonged, and user experience is improved. Specifically, the structure of electron cigarette includes treater, differential pressure sensor and atomizer, and the treater is low-power consumption micro control unit MCU in this embodiment for receive the numerical value that each sensor read, be used for controlling the atomizer switch, still be used for controlling the drive atomizer. The working principle of the differential pressure sensor is as follows: the pressure difference between two sides can be known by measuring the resistance value of the piezoresistive diaphragm inside the sensor. Thus, the differential pressure sensor functions in the e-cigarette as: the sensor is characterized in that one side of the sensor is ambient atmospheric pressure, the other side of the sensor is pressure of a smoking channel of the electronic cigarette, 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 a set threshold, the electronic cigarette is determined to be in a smoking state, and the atomizer is started through the processor, so that a user can conveniently smoke. That is, the main power consumption sources of the electronic cigarette are the atomizer, the processor and the differential pressure sensor, so that in order to increase the service life 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 electronic cigarette 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 periodic measurement mechanism is executed on the differential pressure sensor, the differential pressure sensor is started only at a fixed period point for measurement, and the electronic cigarette is switched into the sleep mode after the measurement is completed, so that the purpose of saving power is achieved. And finally, starting the atomizer only when the electronic cigarette smoking state is detected, and closing the atomizer when the electronic cigarette smoking state is finished. 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 the minimum threshold value, judging that the electronic cigarette is in a smoking state at present, controlling the processor to be switched into a working state from a low power consumption state, and starting the atomizer through the processor to control the electronic cigarette to work;
in this embodiment, when the first pressure difference is smaller than the minimum threshold, it is determined that the electronic cigarette is in a smoking state. The electronic cigarette is used for smoking, and the processor is used for sending a working instruction to the atomizer to start the atomizer. Namely, a working instruction is sent to the processor, the processor is controlled to be switched from a current low power consumption state to a working state, namely, an 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 comprises a deep sleep mode or a deep sleep mode.
And step S30, after the atomizer is started, controlling the processor to be switched from the working state to the low power consumption state.
In this embodiment, after the processor starts the atomizer, that is, after a successful start instruction is detected, the processor is indicated to have completed start operation, and the processor is controlled to enter a low power consumption state from an operating state, so as to reduce power consumption of the processor.
The embodiment provides an electronic cigarette control method based on a pressure difference, which is applied to an electronic cigarette, wherein the electronic cigarette comprises a differential pressure sensor, a processor and an atomizer, and the electronic cigarette control method based on the pressure difference 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 the minimum threshold value, the electronic cigarette is judged to be in a smoking state at present, the processor is controlled to be switched into a working state from a low power consumption state, and the atomizer is started through the processor to control the electronic cigarette to work; and after the atomizer is started, controlling the processor to be switched 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 phenomenon that the differential pressure sensor detects in real time to increase power consumption is avoided. And only when the electronic cigarette is detected to be in a smoking state, starting the processor to control the electronic cigarette to work. And when the electronic cigarette does not need to work, the control treater is the low-power consumption state, reduces the treater and is in operating condition and the consumption that produces, prolongs the standby time of electronic cigarette, promotes user experience, has solved the power consumptive very fast technical problem of current electronic cigarette.
Referring to fig. 3, fig. 3 is a schematic flow chart of a pressure difference-based electronic cigarette control method according to a second embodiment of the present invention.
Based on the foregoing 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 by the differential pressure sensor, and determining whether the electronic cigarette is currently in an end state based on the second pressure difference;
step S50, when the second pressure difference is larger than the maximum threshold value, determining that the electronic cigarette is currently in an end state, controlling the processor to be switched to the working state from the low power consumption state, and closing the atomizer through the processor to stop 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, a second pressure difference of the electronic cigarette is detected by the differential pressure sensor, and when the second pressure difference is greater than a maximum threshold value, it indicates that the user has finished smoking, and the electronic cigarette is currently in a finished state. The atomizer needs to be shut down by the processor, and the working state of the atomizer is finished. Namely, a working instruction is sent to the processor to control the processor to be switched from the current low power consumption state to the working state. And then sending a closing instruction to the atomizer through a processor, closing the atomizer and stopping the work of the electronic cigarette. After a successful instruction for closing the atomizer is detected, namely the current work of the processor is finished, a sleep instruction or a dormant instruction is sent to the processor, so that the processor is switched into a low power consumption state from the current work state, and the purpose of saving power is achieved.
Referring to fig. 4, fig. 4 is a schematic flow chart of a pressure difference-based electronic cigarette control method according to a third embodiment of the present invention.
Based on the foregoing embodiment shown in fig. 3, in this embodiment, before the step S10, the method further includes:
step S70, based on the minimum threshold and the maximum threshold, starting a threshold interrupt function by the processor to interrupt a low power consumption mode of the processor when it is detected that the pressure difference of the e-cigarette is smaller than the minimum threshold or larger than the maximum threshold;
and step S80, based on the preset detection period, generating a periodic detection task through the processor, so as to periodically detect the pressure difference of the electronic cigarette through the differential pressure sensor, and controlling the processor to switch to 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, determining that the electronic cigarette is currently in the smoking state, and generating a first interrupt instruction based on the minimum threshold interrupt function to switch the current mode of the processor;
and controlling the processor to be switched from the low power consumption state to the working state based on the first interrupt instruction, and starting the atomizer through the processor to control the electronic cigarette to work.
Wherein the threshold interrupt function includes a maximum threshold interrupt function, and the step S20 further includes:
and closing the minimum threshold interruption function and opening the maximum threshold interruption function.
Wherein, the step S30 specifically includes:
when the second pressure difference is greater than the maximum threshold, determining that the electronic cigarette is currently in an end state, and generating a second interrupt instruction based on the maximum threshold interrupt function to switch a current mode of the processor;
controlling the processor to be switched from the low power consumption state to the working state based on the second interrupt instruction, and turning off the atomizer through the processor 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 supply is started, the processor first sets a lower threshold, i.e., a minimum threshold, of the differential pressure sensor, and starts a corresponding interrupt function and starts a periodic pressure measurement task. After the above operation is completed, the processor enters a low power consumption mode, such as a power saving sleep mode. When a user takes a smoking action, the pressure difference of the electronic cigarette is detected to be smaller than the lower limit threshold value through the differential pressure sensor, and an interruption is generated. The interrupt wakes up the processor, which first clears the current interrupt state and suspends the shut down of the lower threshold interrupt function. Then, an upper limit threshold value and an interruption function thereof are set, the atomizer is started, and after the work is finished, the current working state enters a low power consumption state, such as a sleep state. When the pressure difference of the electronic cigarette is detected through the pressure difference sensor and the pressure difference of the electronic cigarette is larger than the maximum threshold value, the smoking state of the electronic cigarette is finished, namely the pressure value of the current electronic cigarette is larger than the upper limit threshold value, an interrupt instruction is generated, and a processor is awakened to carry out the working state. The atomizer is closed through the processor, the upper limit threshold interruption function is temporarily closed, and then the lower limit threshold interruption function is restarted to circularly detect whether the user smokes the electronic cigarette. Namely, when the power supply of the electronic cigarette is started, the processor is used for setting a threshold interruption function and setting a periodic detection task of the differential pressure sensor, so that the differential pressure sensor can periodically detect the pressure of the smoking channel of the electronic cigarette. After the work is finished, the low power consumption mode, such as a sleep mode, is switched to. When the first pressure difference is smaller than the minimum threshold, the electronic cigarette is judged to be in the smoking state, and a first interrupt instruction is generated based on the minimum threshold interrupt function so as to switch the current mode of the processor and enable the processor to be switched from the low-power-consumption state to the working 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 finishing state currently, a second interruption instruction is generated based on the maximum threshold interruption function, the current mode of the processor is switched based on the second interruption instruction, and the electronic cigarette enters the working state. And closing the atomizer through the processor to stop the work of the electronic cigarette and wait for the next smoking action of the 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 at present when the first pressure difference is smaller than a minimum threshold value, controlling the processor to be switched into a working state from a low power consumption state, and starting the atomizer through the processor to control the electronic cigarette to work;
and the second state switching module is used for controlling the processor to be switched into the low power consumption state from the working state after the atomizer is started.
Further, the pressure difference-based electronic cigarette control device further comprises a third state switching module, and the third state switching module is configured to:
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 currently in an end state, controlling the processor to be switched into the working state from the low power consumption state, and closing the atomizer through the processor to stop the work of the electronic cigarette;
and after the atomizer is closed, controlling the processor to have the working state to be switched into the low power consumption state.
Further, the pressure differential-based electronic cigarette control device further comprises a threshold interrupt setting module configured to:
based on the minimum and maximum thresholds, initiating, by the processor, a threshold interrupt function to interrupt a low power consumption mode of the processor when a pressure differential of the e-cigarette is detected to be less than the minimum threshold or greater than the maximum threshold;
and based on the preset detection period, generating a period detection task through the processor so as to periodically detect the pressure difference of the electronic cigarette through the differential pressure sensor and control the processor to be switched 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:
a first interrupt generating unit, configured to determine that the electronic cigarette is currently in the smoking state when the first pressure difference is smaller than the minimum threshold, and generate a first interrupt instruction based on the minimum threshold interrupt function to switch a current mode of the processor;
and the first state switching unit is used for controlling the processor to be switched into the working state from the low power consumption 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:
a second interrupt generating unit, configured to determine that the electronic cigarette is currently in an end state when the second pressure difference is greater than the maximum threshold, and generate a second interrupt instruction based on the maximum threshold interrupt function to switch a current mode of the processor;
and the second state switching unit is used for controlling the processor to be switched into the working state from the low power consumption 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 interruption switching unit is used for closing the maximum threshold interruption function and opening the minimum threshold interruption function so as to detect whether the electronic cigarette is in the smoking state.
Each module in the electronic cigarette control device based on the pressure difference corresponds to each step in the embodiment of the electronic cigarette control method based on the pressure difference, and the functions and the implementation process of the electronic cigarette control device based on the pressure difference 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 present invention has stored thereon a pressure difference based electronic cigarette control program, wherein the pressure difference based electronic cigarette control program, when executed by a processor, implements the steps of the pressure difference based electronic cigarette control method as described above.
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, and details are not repeated 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 an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.