Disclosure of Invention
The present invention provides a method and a system for controlling acquisition of a detection time of a charger based on a mobile terminal, aiming at the above-mentioned defects in the prior art. The invention provides a charger detection opportunity acquisition method, aiming at enabling a mobile terminal to start detecting a charger at a more accurate opportunity so as to improve the charger detection efficiency, thereby facilitating the use of a user.
The technical scheme adopted by the invention for solving the technical problem is as follows:
a charger detection opportunity acquisition control method based on a mobile terminal comprises the following steps:
A. the mobile terminal detects whether the charging input end is connected with voltage, and when the charging input end of the mobile terminal is detected to be connected with voltage, whether the voltage connected with the charging input end is higher than or equal to a first preset voltage is judged;
B. when the voltage accessed by the charging input end is higher than or equal to a first preset voltage, controlling a starting timer to detect whether the voltage accessed by the charging input end is lower than or equal to a second preset voltage within a preset time;
C. if the voltage accessed by the charging input end in the preset time is lower than or equal to a second preset voltage, the control returns to the step A; and if the voltage connected to the charging input end is not lower than or equal to a second preset voltage in the preset time, controlling to start the detection of the charger.
The mobile terminal-based charger detection opportunity acquisition control method further comprises the following steps before the step A:
the mobile terminal comprises a first presetting module, a second presetting module and a control module, wherein the first presetting module is used for presetting high-level interruption of a charging input end on the mobile terminal and generating the high-level interruption when the mobile terminal detects that the voltage of the charging input end is higher than or equal to a first preset voltage.
The mobile terminal-based charger detection opportunity acquisition control method further comprises the following steps before the step A:
the second presetting module is used for presetting low-level interruption of the charging input end on the mobile terminal and generating the low-level interruption when the mobile terminal detects that the voltage of the charging input end is lower than or equal to a second preset voltage.
The mobile terminal-based charger detection opportunity acquisition control method comprises the step of configuring high-level interruption of a charging input end on the mobile terminal, wherein the high-level interruption is configured to be generated when the charging input end of the mobile terminal is higher than or equal to 5V voltage.
The mobile terminal-based charger detection opportunity acquisition control method comprises the step of configuring low-level interruption of a charging input end on the mobile terminal, wherein the low-level interruption is configured to be generated when the charging input end of the mobile terminal is lower than or equal to 4.5 voltage.
The charger detection opportunity acquisition control method based on the mobile terminal is characterized in that the preset time is 1 second, the first preset voltage is 5V, and the second preset voltage is 4.5V.
The mobile terminal-based charger detection opportunity acquisition control method includes:
c1, when detecting that the charging input end of the mobile terminal generates high-level interruption within the preset time, and detecting low-level interruption at the charging input end, controlling to return to the step A;
c2 controls the start of the charger test if no low interrupt is detected at the charging input within the predetermined time period when the generation of a high interrupt at the charging input of the mobile terminal is detected.
A charger detection opportunity acquisition control system based on a mobile terminal comprises:
the detection and judgment module is used for detecting whether the charging input end of the mobile terminal is connected with voltage or not, and judging whether the voltage connected with the charging input end is higher than or equal to a first preset voltage or not when the voltage connected with the charging input end of the mobile terminal is detected;
the first control module is used for controlling the starting timer to detect whether the voltage accessed by the charging input end is lower than or equal to a second preset voltage within a preset time when the voltage accessed by the charging input end is higher than or equal to the first preset voltage;
the second control module is used for controlling and returning to detect whether the charging input end is connected with the voltage or not if the voltage connected with the charging input end is lower than or equal to a second preset voltage in the preset time; and if the voltage connected to the charging input end is not lower than or equal to a second preset voltage in the preset time, controlling to start the detection of the charger.
The charger detection opportunity acquisition control system based on the mobile terminal further comprises:
the mobile terminal comprises a first presetting module, a second presetting module and a control module, wherein the first presetting module is used for presetting high level interruption of a charging input end on the mobile terminal and generating the high level interruption when the mobile terminal detects that the voltage of the charging input end is higher than or equal to a first preset voltage;
the second presetting module is used for presetting low-level interruption of the charging input end on the mobile terminal and generating the low-level interruption when the mobile terminal detects that the voltage of the charging input end is lower than or equal to a second preset voltage.
The mobile terminal-based charger detection opportunity acquisition control system is characterized in that the preset time is 1 second, the first preset voltage is 5V, and the second preset voltage is 4.5V;
the high-level interruption of the charging input end configured on the mobile terminal is configured to generate high-level interruption when the charging input end of the mobile terminal is higher than or equal to 5V voltage;
the low-level interrupt of the charging input end configured on the mobile terminal is configured to generate low-level interrupt when the charging input end of the mobile terminal is lower than or equal to 4.5 voltage;
the second control module includes:
the first control unit is used for controlling and returning to detect whether the charging input end is connected with voltage or not when the charging input end detects low level interruption within the preset time when the charging input end detects that the charging input end of the mobile terminal generates high level interruption;
and the second control unit is used for controlling the starting of the charger detection if the low-level interruption is not detected at the charging input end within the preset time when the charging input end of the mobile terminal is detected to generate the high-level interruption.
The invention provides a charger detection opportunity acquisition control method and system based on a mobile terminal, wherein the method is characterized in that high level interruption of a charging input end of the mobile terminal is configured; when detecting that the charging input end of the mobile terminal generates a high level, starting a timer and configuring low level interruption of the charging input end of the mobile terminal; when the timer times out, the charger detection is initiated. The mobile terminal can start to detect the charger at a more accurate time so as to improve the detection efficiency of the charger, thereby facilitating the use of users.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer and clearer, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 2, fig. 2 is a flowchart illustrating a method for controlling acquisition of charger detection timing based on a mobile terminal according to a preferred embodiment of the present invention. As shown in fig. 2, a method for controlling acquisition of a detection opportunity of a charger based on a mobile terminal according to an embodiment of the present invention includes:
s10, the mobile terminal detects whether the charging input end is connected with voltage, and when the charging input end of the mobile terminal is detected to be connected with voltage, whether the voltage connected with the charging input end is higher than or equal to a first preset voltage is judged.
In the embodiment of the invention, when the mobile terminal is connected with the charger, the mobile terminal detects whether the charging input end is connected with voltage, and when the charging input end of the mobile terminal is detected to have voltage connection, the mobile terminal judges whether the voltage connected with the charging input end is higher than or equal to a first preset voltage, wherein the first preset voltage is 5V.
And S20, when the voltage connected to the charging input end is higher than or equal to a first preset voltage, controlling a starting timer to detect whether the voltage connected to the charging input end is lower than or equal to a second preset voltage within a preset time.
In the embodiment of the present invention, when the voltage applied to the charging input terminal is higher than or equal to the first predetermined voltage and is 5V, the start timer is controlled to detect whether the voltage applied to the charging input terminal is lower than or equal to a second predetermined voltage within a predetermined time, where the predetermined time is 1 second, and the second predetermined voltage is 4.5V.
S30, if the voltage connected to the charging input end in the preset time is lower than or equal to a second preset voltage, the control returns to the step S10; and if the voltage connected to the charging input end is not lower than or equal to a second preset voltage in the preset time, controlling to start the detection of the charger.
That is, in the present invention, if the voltage applied to the charging input terminal is lower than or equal to 4.5V within 1 second, the control returns to step S10; and if the voltage connected to the charging input end is not lower than or equal to 4.5V within 1 second, controlling to start the detection of the charger.
Of course, in the implementation of the present invention, the high-level interrupt of the charging input terminal may be configured on the mobile terminal in advance, and is used for generating the high-level interrupt when the mobile terminal detects that the voltage of the charging input terminal is higher than or equal to the first predetermined voltage (5V). And configuring a low-level interrupt of the charging input terminal on the mobile terminal in advance for generating the low-level interrupt when the mobile terminal detects that the voltage of the charging input terminal is lower than or equal to a second predetermined voltage (4.5V).
Wherein, the high-level interruption of the charging input end configured on the mobile terminal is configured to generate the high-level interruption when the charging input end of the mobile terminal is higher than or equal to 5V voltage. The low-level interrupt configuring the charging input terminal on the mobile terminal is configured to generate a low-level interrupt when the charging input terminal of the mobile terminal is lower than or equal to 4.5 voltage.
When the voltage connected to the charging input end is higher than or equal to the first preset voltage and is 5V, the starting timer is controlled to detect whether the voltage connected to the charging input end is lower than or equal to a second preset voltage (4.5V) within a preset time (1 second). When detecting that the charging input end of the mobile terminal generates a high level interruption within the preset time (1 second), and detecting a low level interruption at the charging input end, the control returns to the step S10; and if the low-level interruption is not detected at the charging input end within the preset time (1 second) when the charging input end of the mobile terminal is detected to generate the high-level interruption, controlling to start the charger detection.
Therefore, the charging detection is started immediately when the charger is inserted into the mobile terminal, but the charging detection is started after the charger is inserted stably and the detection voltage is stabilized at 5V for a preset time (for example, 1 second), so that the mobile terminal can start to detect the charger at a more accurate time to improve the detection efficiency of the charger, and the use of a user is facilitated.
Referring to fig. 3, fig. 3 is a flowchart illustrating a method for controlling acquisition of charger detection timing based on a mobile terminal according to a preferred embodiment of the present invention. As shown in fig. 2, a method for controlling acquisition of a detection opportunity of a charger based on a mobile terminal according to an embodiment of the present invention includes:
s100, configuring a high-level interrupt of a charging input end of the mobile terminal, and generating an interrupt when the mobile terminal detects that the voltage of the charging input end is higher than or equal to a first preset voltage; when detecting that the charging input end of the mobile terminal generates a high level, executing the step S200;
specifically, the configuring the high-level interrupt of the mobile terminal charging input terminal is configured to generate an interrupt when the mobile terminal charging input terminal is higher than or equal to 5V voltage; that is, an interrupt is generated as long as the voltage at the charging input of the mobile terminal is greater than or equal to 5V and is detected by the main controller of the mobile terminal.
S200, starting a timer and configuring low level interruption of a charging input end of the mobile terminal; when detecting that the input end of the mobile terminal generates a low level, closing the timer and executing S100;
the step S200 further includes setting the timeout time of the timer to 1 second.
That is, in the step, 1 timer of 1 second is started and low level interruption of the charging input end of the mobile terminal is configured; when detecting that the input terminal of the mobile terminal generates a low level, the timer is turned off and S100 is executed, and if the timer times out, the step S300 is entered when the input terminal does not detect a low level interrupt.
Specifically, the configuring the low-level interrupt of the mobile terminal charging input terminal is configuring to generate an interrupt when the mobile terminal charging input terminal is lower than 4.5 voltages; that is, an interrupt is generated and detected by the mobile terminal host controller whenever the voltage at the charging input of the mobile terminal is less than or equal to 4.5V.
And S300, when the timer is over time, starting charger detection.
As can be seen from the above, the embodiment of the method of the present invention configures a high level interrupt at the charging input terminal of the mobile terminal; when detecting that the charging input end of the mobile terminal generates a high level, starting a timer and configuring low level interruption of the charging input end of the mobile terminal; when the timer times out, the charger detection is initiated. The mobile terminal can start to detect the charger at a more accurate time so as to improve the detection efficiency of the charger, thereby facilitating the use of users.
Based on the above method embodiment, the present invention further provides a charger detection opportunity acquisition control system based on a mobile terminal, as shown in fig. 4, the system includes:
the detecting and judging module 210 is used for detecting whether the charging input end of the mobile terminal is connected with voltage or not, and when the charging input end of the mobile terminal is detected to be connected with voltage, judging whether the voltage connected with the charging input end is higher than or equal to a first preset voltage or not; as described above.
The first control module 220 is configured to control the start timer to detect whether the voltage applied to the charging input terminal is lower than or equal to a second predetermined voltage within a predetermined time when the voltage applied to the charging input terminal is higher than or equal to a first predetermined voltage; as described above.
The second control module 230 is configured to control to return to detect whether the charging input terminal is connected with the voltage if the voltage connected to the charging input terminal is lower than or equal to a second predetermined voltage during the predetermined time; if the voltage accessed by the charging input end in the preset time is not lower than or equal to a second preset voltage, controlling to start the charger to detect; as described above.
The charger detection opportunity acquisition control system based on the mobile terminal further comprises:
the mobile terminal comprises a first presetting module, a second presetting module and a control module, wherein the first presetting module is used for presetting high level interruption of a charging input end on the mobile terminal and generating the high level interruption when the mobile terminal detects that the voltage of the charging input end is higher than or equal to a first preset voltage; as described above.
The second preset module is used for configuring low level interruption of the charging input end on the mobile terminal in advance and generating the low level interruption when the mobile terminal detects that the voltage of the charging input end is lower than or equal to a second preset voltage; as described above.
The mobile terminal-based charger detection opportunity acquisition control system is characterized in that the preset time is 1 second, the first preset voltage is 5V, and the second preset voltage is 4.5V; as described above.
The high-level interruption of the charging input end configured on the mobile terminal is configured to generate high-level interruption when the charging input end of the mobile terminal is higher than or equal to 5V voltage;
the low-level interrupt of the charging input end configured on the mobile terminal is configured to generate low-level interrupt when the charging input end of the mobile terminal is lower than or equal to 4.5 voltage; as described above.
The second control module includes:
the first control unit is used for controlling and returning to detect whether the charging input end is connected with voltage or not when the charging input end detects low level interruption within the preset time when the charging input end detects that the charging input end of the mobile terminal generates high level interruption; as described above.
The second control unit is used for controlling the starting of the charger detection if the low-level interruption is not detected at the charging input end within the preset time when the charging input end of the mobile terminal is detected to generate the high-level interruption; as described above.
In summary, according to the charger detection opportunity acquisition control method and system based on the mobile terminal provided by the invention, the method is implemented by configuring the high-level interrupt of the charging input end of the mobile terminal; when detecting that the charging input end of the mobile terminal generates a high level, starting a timer and configuring low level interruption of the charging input end of the mobile terminal; when the timer times out, the charger detection is initiated. The mobile terminal can start to detect the charger at a more accurate time so as to improve the detection efficiency of the charger, thereby facilitating the use of users.
Of course, it will be understood by those skilled in the art that all or part of the processes of the methods of the above embodiments may be implemented by a computer program instructing relevant hardware (such as a processor, a controller, etc.), and the program may be stored in a computer readable storage medium, and when executed, the program may include the processes of the above method embodiments. The storage medium may be a memory, a magnetic disk, an optical disk, etc.
It is to be understood that the invention is not limited to the examples described above, but that modifications and variations may be effected thereto by those of ordinary skill in the art in light of the foregoing description, and that all such modifications and variations are intended to be within the scope of the invention as defined by the appended claims.