Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The first embodiment is as follows:
the charging control method provided by this embodiment can control the current charging according to a preset reverse charging control strategy when the external power supply is reversely charged during the charging process of the terminal. Referring to fig. 1, a specific charging control method includes:
s101: detecting whether the terminal is connected with an external power supply currently or not, and if not, continuing to detect; if yes, go to S102.
S102: detecting whether the terminal carries out reverse charging on the external power supply currently, if so, turning to S103; otherwise, go to S104.
S103: and controlling the current charging according to a preset reverse charging control strategy, namely properly controlling the reverse charging of the current terminal to the external power supply according to the preset control strategy.
S104: and judging whether the terminal is still connected with the external power supply at present, if so, turning to S102, and if not, ending.
In this embodiment, the method for detecting whether the terminal is connected to the external power source may be any conventional detection method, for example, the terminal may check whether the external power source is connected through a round-robin or interrupt method. Specifically, the external power supply insertion condition can be obtained by reading and writing only the memory of the power supply management chip in the terminal, starting a thread or a timer, and reading and writing the register of the power supply management chip. Meanwhile, in order to avoid the situation that a user frequently plugs and unplugs due to some factors to cause misjudgment, in this embodiment, the power management chip register may be read for multiple times, and whether the terminal is currently connected with the external power supply is judged by synthesizing the situation of multiple readings. And when the connection of the terminal and the external power supply is detected, stopping the thread or the timer.
In this embodiment, whether the terminal is currently connected to the external power supply is determined, which may be performed in the foregoing manner, or in any other manner that can identify disconnection between the terminal and the external power supply.
In this embodiment, after detecting that the terminal is currently connected to the external power supply, before detecting whether the terminal is currently charging the external power supply in the reverse direction, the method may further perform screening and determining on the type of the external power supply currently connected to the terminal, specifically referring to fig. 2, including:
s201: judging whether the currently connected external power supply is a fixed power supply, if so, turning to S202; otherwise, go to S203.
S202: and judging whether the terminal is currently reversely charged to the external power supply.
S203: and the terminal normally performs a charging process.
The fixed power supply in this embodiment is a power supply that stores electric energy and can provide a charging interface to charge an external terminal, or can acquire electric energy from external charging. Such as various charge pal, etc.
In this embodiment, the type of the external power source accessed by the terminal may be any one of USB charging, seat charging, wall charging, or a fixed power source, and the terminal may determine the type of the current external power source through various parameters acquired by the internal power management chip, for example, the type may be determined specifically through external power source parameters such as external power source voltage, external power source current, external power source capacity, and external power source temperature acquired by the power management chip, and may also be determined according to other manners.
In this embodiment, the method for detecting whether the terminal is currently charging the external power source in the reverse direction includes, but is not limited to, any one of the following reverse methods:
the first method is as follows:
and detecting whether the current voltage of the external power supply is smaller than the current voltage of the terminal, if so, judging that the terminal carries out reverse charging on the external power supply currently.
The second method comprises the following steps:
and monitoring the voltage of the terminal in the charging process, and if the voltage drop of the terminal is monitored, judging that the terminal carries out reverse charging on the external power supply currently.
The third method comprises the following steps:
and monitoring the electric quantity of the terminal in the charging process, and if the electric quantity of the terminal is monitored to be reduced, judging that the terminal carries out reverse charging on the external power supply currently.
The method is as follows:
when the voltage and the electric quantity of the monitoring terminal are monitored in the charging process, if any one of the voltage and the electric quantity of the monitoring terminal is reduced or the voltage and the electric quantity of the monitoring terminal are simultaneously reduced, the situation that the external power supply is reversely charged at present is judged.
The invention will be further illustrated by taking an external power supply as an example of a fixed power supply in combination. As shown in fig. 3, the method comprises the following steps:
s301: when the external power supply connected with the terminal is identified to be a fixed power supply (such as a charger), acquiring parameters for transferring charging, wherein the parameters comprise the voltage of the external power supply; but may also include parameters such as current, power, temperature, etc. of the external power source.
S302: judging whether the voltage of the external power supply is lower than the current voltage of the terminal, if so, turning to S303; otherwise, go to S304.
S303: and starting a timer, actively removing the voltage of the external power supply for a plurality of times within a set time, and if the voltage is lower than the terminal voltage within a detection time period, judging that reverse charging is performed.
S304: and re-detecting the judgment in the charging process.
S302 may also determine that reverse charging is being performed if the terminal voltage and capacity continue to decrease by continuously reading the voltage and capacity of the terminal itself for a preset detection period.
The preset strategy in this embodiment can be flexibly set according to actual requirements. For example, a corresponding default control strategy may be directly preset, and a corresponding control process may be directly performed according to the control strategy. The method can also be set to remind the user, so as to obtain the instruction issued by the user in real time and control according to the instruction issued by the user in real time.
When the corresponding default control instruction is directly preset, the implementation mode includes, but is not limited to, any one of the following modes:
the first method is as follows:
the reverse charging control strategy comprises stopping charging;
controlling the current charge according to a reverse charge control strategy comprises: and when the terminal is detected to reversely charge the external power supply, stopping reversely charging the external power supply by the terminal.
The second method comprises the following steps:
the reverse charging control strategy comprises: when the external power supply is a fixed power supply, reverse charging is allowed, otherwise, reverse charging is forbidden;
controlling the current charge according to a reverse charge control strategy comprises:
judging whether the external power supply is a fixed power supply, if so, allowing the terminal to charge the external power supply; otherwise, stopping the terminal from charging the external power supply.
The situation can allow a user to reversely charge the external power supply according to actual requirements, and the requirements of the user on some special application scenes can be met.
The control strategy is to remind the user, and when the control is performed according to a real-time control instruction under the user, the control strategy comprises the following steps:
when the terminal is detected to be currently charged to an external power supply, a reminding instruction is sent to a user, and the reminding instruction can be realized through at least one of characters, sound, pictures, vibration and the like. The user can issue a corresponding control instruction, such as a charging stopping instruction or a charging allowing instruction, according to the reminding instruction and the current actual application scene. And then stopping the current charging or keeping the current charging to continue normally according to the received real-time control instruction.
In this embodiment, when it is detected that the terminal currently charges the external power supply, a soft interrupt may be issued first, so as to trigger a subsequent control process, which is described below by taking a preset default control policy as an example, and as shown in fig. 4, the method includes:
s401: a soft interrupt for reverse charging is received.
S402: and acquiring the set default control strategy.
S403: judging whether to stop the current charging according to a default control strategy, if so, turning to S404; otherwise, go to S405.
S404: and performing charge cut-off processing on the current charge, and stopping the charge.
S405: the current charge is not cut off, and the charge is maintained.
According to the scheme provided by the embodiment of the invention, when the terminal detects that the terminal reversely charges the external power supply in the terminal charging process, the preset reverse charging control strategy can be adopted to perform corresponding intervention on the current charging, for example, the external power supply is stopped or continuously reversely charged under the condition allowed by a user, so that the user experience satisfaction can be improved and reduced, the damage to the terminal battery is avoided, and the service life of the battery is prolonged.
Example two:
referring to fig. 5, the present embodiment provides a terminal, which may be a mobile phone, an IPAD, a reader, etc. It includes charge control device 1, and wherein, charge control device 1 refers to as shown in fig. 6, includes:
and the power supply connection detection module 11 is used for detecting whether the terminal is connected with an external power supply.
The power connection detection module 11 may detect whether the terminal is connected to the external power source by any existing detection method, for example, the power connection detection module 11 may check whether the external power source is connected by a polling or interruption method. Specifically, the external power supply insertion condition can be obtained by reading and writing only the memory of the power supply management chip in the terminal, starting a thread or a timer, and reading and writing the register of the power supply management chip. Meanwhile, in order to avoid the situation that a user frequently plugs and unplugs due to some factors to cause misjudgment, in this embodiment, the power management chip register may be read for multiple times, and whether the terminal is currently connected with the external power supply is judged by synthesizing the situation of multiple readings.
In this embodiment, the power connection detecting module 11 may be further configured to determine whether the terminal is disconnected from the external power source currently, and may also perform the determination in the above manner, or adopt any other manner capable of identifying disconnection between the terminal and the external power source.
And the control module 12 is configured to, when the terminal is connected to the external power supply and when it is detected that the terminal currently performs reverse charging on the external power supply, control current charging according to a preset reverse charging control policy.
Referring to fig. 7, the charging control apparatus may further include a category identification module 13, configured to detect whether the external power source is a fixed power source before the control module 12 detects whether the terminal currently performs reverse charging on the external power source, and if so, trigger the control module 12 to detect whether the terminal currently performs reverse charging on the external power source. The fixed power supply in this embodiment is a power supply that stores electric energy and can provide a charging interface to charge an external terminal, or can acquire electric energy from external charging. Such as various charge pal, etc.
In this embodiment, the type of the external power source accessed by the terminal may be any one of USB charging, seat charging, wall charging, or a fixed power source, and the terminal may determine the type of the current external power source through various parameters acquired by the internal power management chip, for example, the type may be determined specifically through external power source parameters such as external power source voltage, external power source current, external power source capacity, and external power source temperature acquired by the power management chip, and may also be determined according to other manners.
Referring to fig. 8, the control module 12 in the present embodiment may include a charging direction detection unit 111, a charging decision unit 112, and an execution unit 113.
The charging direction detection unit 111 may specifically determine the current charging direction by any one of the following manners.
The first method is as follows:
and detecting whether the current voltage of the external power supply is smaller than the current voltage of the terminal, if so, judging that the terminal carries out reverse charging on the external power supply currently.
The second method comprises the following steps:
and monitoring the voltage of the terminal in the charging process, and if the voltage drop of the terminal is monitored, judging that the terminal carries out reverse charging on the external power supply currently.
The third method comprises the following steps:
and monitoring the electric quantity of the terminal in the charging process, and if the electric quantity of the terminal is monitored to be reduced, judging that the terminal carries out reverse charging on the external power supply currently.
The method is as follows:
when the voltage and the electric quantity of the monitoring terminal are monitored in the charging process, if any one of the voltage and the electric quantity of the monitoring terminal is reduced or the voltage and the electric quantity of the monitoring terminal are simultaneously reduced, the situation that the external power supply is reversely charged at present is judged.
The charging decision unit 112 is configured to store a reverse charging control strategy, and the preset strategy may be flexibly set according to actual requirements. For example, a corresponding default control strategy may be directly preset, and a corresponding control process may be directly performed according to the control strategy. The method can also be set to remind the user, so as to obtain the instruction issued by the user in real time and control according to the instruction issued by the user in real time.
When the corresponding default control instruction is directly preset, the implementation mode includes, but is not limited to, any one of the following modes:
the first method is as follows:
the reverse charging control strategy comprises stopping charging;
the performing unit 113 controlling the current charging according to the reverse charging control strategy includes: and when the terminal is detected to reversely charge the external power supply, stopping reversely charging the external power supply by the terminal.
The second method comprises the following steps:
the execution unit 113 reverse charging control strategy includes: when the external power supply is a fixed power supply, reverse charging is allowed, otherwise, reverse charging is forbidden;
controlling the current charge according to a reverse charge control strategy comprises:
judging whether the external power supply is a fixed power supply, if so, allowing the terminal to charge the external power supply; otherwise, stopping the terminal from charging the external power supply.
The situation can allow a user to reversely charge the external power supply according to actual requirements, and the requirements of the user on some special application scenes can be met.
The control strategy is to remind the user, and when the control is performed according to a real-time control instruction of the user, the execution unit 113 is configured to send a reminding instruction to the user when detecting that the terminal is currently charging to an external power source, where the reminding instruction may be implemented by at least one of text, sound, picture, vibration, and the like. The user can issue a corresponding control instruction, such as a charging stopping instruction or a charging allowing instruction, according to the reminding instruction and the current actual application scene. The execution unit 113 then stops the current charging or keeps the current charging to continue normally according to the received real-time control instruction.
The functions of the above modules in this embodiment may be implemented by a processor or a controller in the terminal, and the above modules may be configured inside the processor or the controller. That is, it should be understood by those skilled in the art that the modules or steps of the above-described embodiments of the present invention can be implemented by a general-purpose computing device, they can be centralized on a single computing device or distributed over a network of multiple computing devices, alternatively, they can be implemented by program code executable by a computing device, so that they can be stored in a computer storage medium (ROM/RAM, magnetic disk, optical disk) and executed by a computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be separately fabricated into individual integrated circuit modules, or multiple modules or steps of them can be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The charging control device arranged in the terminal provided by the embodiment of the invention can detect whether the terminal carries out reverse charging on the external power supply or not in the terminal charging process, and if the detection result is yes, a preset reverse charging control strategy is adopted to carry out corresponding intervention on the current charging, for example, the external power supply is stopped or continuously carries out reverse charging under the condition of permission of a user, so that the satisfaction degree of user experience can be improved and reduced, the damage of the terminal to the battery discharged for a long time is avoided, the service life of the battery is prolonged, and the use cost of the user is reduced.
The foregoing is a more detailed description of embodiments of the present invention, and the present invention is not to be considered limited to such descriptions. For those skilled in the art to which the invention pertains, several simple deductions or substitutions can be made without departing from the spirit of the invention, and all shall be considered as belonging to the protection scope of the invention.