Power level display method and apparatus, electronic device, storage medium, and product
By synchronizing power information in electronic devices, the problem of inconsistent power display of dual-system devices is solved, achieving smooth and stable power display to ensure user experience.
Patent Information
- Application Number
- PCT/CN2024/086434
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-12
- Filing Date
- 2024-04-07
- Publication Date
- 2024-10-17
AI Technical Summary
When electronic devices equipped with dual systems display power, due to differences in the power information calculation methods and power measurement components of different operating systems, the power information jumps or changes sharply, resulting in inconsistent displays.
By using a power measurement component in an electronic device to obtain battery power information, and synchronizing this information between the first operating system and the second operating system, it is ensured that the power information displayed in the two systems is consistent, and a smooth and stable power display is achieved.
It effectively avoids jumps or sharp changes in power information caused by system switching, ensuring consistent power information displayed under different operating systems, and improving user experience.
Smart Images

Figure CN2024086434_17102024_PF_FP_ABST
Abstract
Description
Power display method, device, electronic device, storage medium, and product
[0001] Related applications
[0002] This application claims priority to Chinese patent application number 2023103918156, filed on April 12, 2023, entitled “Power display method, device, electronic device, storage medium, product,” the entire text of which is hereby incorporated by reference. Technical Field
[0003] The present application relates to the technical field of electronic equipment, and in particular to a method, device, electronic equipment, storage medium, and product for displaying power. Background Art
[0004] Jing Technology
[0005] As electronic devices become more and more powerful, a single operating system sometimes cannot meet people's demands for the functions of electronic devices. Therefore, some electronic devices have begun to be equipped with dual systems to provide users with a better user experience.
[0006] However, when electronic devices equipped with dual operating systems calculate battery power, different operating systems may obtain different power information, which in turn leads to significant differences in the power information displayed by different operating systems.
[0007] Summary of the Invention
[0008] The embodiments of the present application provide a method, device, electronic device, and computer-readable storage medium for displaying power, which can enable the electronic device to maintain smoothness and stability throughout the entire power display process.
[0009] In one aspect, a power display method is provided, which is applied to an electronic device. The electronic device includes a first chip and a second chip, the first chip is used to run a first operating system, the second chip is used to run a second operating system, and the electronic device also includes a power measurement component, and the first chip is connected to the power measurement component; the method includes:
[0010] Acquiring power information of the battery of the electronic device through the power measurement component;
[0011] Under the condition that the first operating system and the second operating system are in a startup state and the first operating system is running in the foreground on the electronic device, the first operating system obtains the battery power information from the power measurement component as the first power information, and displays the first power information in the first operating system;
[0012] In response to the system switching instruction, the electronic device runs the second operating system in the foreground and displays second power information in the second operating system; wherein the second power information is obtained based on the updated battery power information obtained by the power measurement component.
[0013] In another aspect, a power display device is provided, which is applied to an electronic device. The electronic device includes a first chip and a second chip, the first chip is used to run a first operating system, and the second chip is used to run a second operating system. The electronic device also includes a power measurement component, and the first chip is connected to the power measurement component. The device includes:
[0014] A power information acquisition module, configured to acquire power information of the battery of the electronic device through the power measurement component;
[0015] a first display module, configured to, under the condition that the first operating system and the second operating system are in a startup state and the first operating system is running in the foreground on the electronic device, cause the first operating system to obtain the battery power information from the power measurement component as first power information and display the first power information in the first operating system;
[0016] The second display module is used to respond to the system switching instruction, and the electronic device runs the second operating system in the foreground, and displays the second power information in the second operating system; wherein, the second power information is obtained based on the updated battery power information obtained by the power measurement component.
[0017] On the other hand, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the power display method described above.
[0018] On the other hand, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the power display method described above are implemented.
[0019] On the other hand, a computer program product is provided, including a computer program, which implements the steps of the power display method described above when executed by a processor.
[0020] The above-mentioned power display method, device, electronic device, storage medium, and product include an electronic device comprising a first chip and a second chip, the first chip being used to run a first operating system, the second chip being used to run a second operating system, and a power measurement component being connected to the first chip. The electronic device obtains power information of the electronic device's battery through the power measurement component; when the first and second operating systems are in an activated state and the first operating system is running in the foreground on the electronic device, the first operating system obtains the battery power information from the power measurement component as the first power information and displays the first power information in the first operating system; in response to a system switching instruction, the electronic device runs the second operating system in the foreground and displays the second power information in the second operating system; wherein the second power information is obtained based on the updated battery power information obtained by the power measurement component. Since the power information displayed in the first and second operating systems is the power information of the electronic device's battery obtained by the power measurement component, that is, the power information obtained in the first and second operating systems is consistent, the power information displayed on the two systems will not jump or change dramatically as the two systems switch. Thus, the power information displayed by the electronic device in different operating systems remains smooth and stable, avoiding obvious differences. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the conventional technology, the following briefly introduces the drawings required for use in the embodiments or the conventional technology descriptions. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the disclosed drawings without any creative work.
[0022] FIG1 is a diagram showing an application environment of a method for displaying power in one embodiment;
[0023] FIG2 is a flow chart of a method for displaying power in one embodiment;
[0024] FIG3 is a flow chart of a method for displaying power in another embodiment;
[0025] 4 is a flow chart of a method for disconnecting the power measurement component from the first chip and completing the connection between the power measurement component and the second chip in response to a system switching instruction in FIG. 3 ;
[0026] FIG5 is a system architecture diagram of synchronizing battery power information between a first operating system and a second operating system of an electronic device in one embodiment;
[0027] FIG6 is a flow chart of a method for a second chip to obtain first power information from a first chip according to an embodiment;
[0028] FIG7 is a flow chart of a method for displaying power in another embodiment;
[0029] FIG8 is a system architecture diagram of synchronizing battery power information between a first operating system and a second operating system of an electronic device in one embodiment;
[0030] FIG9 is a flow chart of a method for displaying power in an exemplary embodiment;
[0031] FIG10 is a signaling sequence diagram of synchronizing battery power information in a first operating system and a second operating system of an electronic device in one embodiment;
[0032] FIG11 is a schematic diagram of a system architecture of an electronic device according to an embodiment;
[0033] FIG12 is a block diagram of a power display device according to an embodiment;
[0034] FIG13 is a structural block diagram of a power display device in another embodiment;
[0035] FIG14 is a schematic diagram of the internal structure of an electronic device in one embodiment. DETAILED DESCRIPTION
[0036] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0037] In order to make the purpose, technical solutions and advantages of this application more clearly understood, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0038] It will be understood that the terms "first," "second," etc., used herein may be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, a first operating system may be referred to as a second operating system, and similarly, a second operating system may be referred to as a first operating system, without departing from the scope of this application. The first operating system and the second operating system are both operating systems, but they are not the same operating system.
[0039] As electronic devices become more and more powerful, a single operating system sometimes cannot meet people's demands for the functions of electronic devices. Therefore, some electronic devices have begun to be equipped with dual systems to provide users with a better user experience.
[0040] Because the internal software architectures of the dual systems are different, different operating systems on electronic devices often use different methods to calculate battery power information. Therefore, the power information calculated by different operating systems is not the same. Alternatively, different operating systems on electronic devices use different power measurement components to calculate battery power information. Due to the differences between different power measurement components, the power information calculated by different operating systems is also different. Furthermore, when an electronic device equipped with a dual system displays the battery power, the battery power information will jump or change dramatically as the two systems switch or the system restarts.
[0041] For example, when an electronic device switches from a second operating system (e.g., 50% battery) to a first operating system, the first operating system may calculate the battery level as 53% or 45% due to a different battery calculation algorithm or fluctuations in initial battery calculation conditions. Obviously, this is a case where the battery level information jumps or changes dramatically.
[0042] For example, after an electronic device has been running in a first operating system for a long time, the battery level drops significantly (for example, only 3% of the battery level remains), and then the electronic device switches back to a second operating system. Under the second operating system, the electronic device initially displays 50% of the battery level remaining, and then quickly approaches 3% of the actual battery level. At this time, the battery power information will jump or change dramatically.
[0043] For example, if an electronic device uses different power calculation methods to calculate power information in a first operating system and a second operating system, then after the electronic device runs the first operating system for a long time, the error between the power information calculated by the first operating system and the power information calculated by the second operating system will become increasingly larger. Consequently, when the electronic device switches between operating systems, the battery power information may jump or change dramatically.
[0044] To address the issue of battery charge information displaying abrupt or sudden changes when switching between two operating systems or restarting a system in an electronic device equipped with dual or multiple operating systems, a method for displaying battery charge is proposed in this embodiment. Figure 1 is a schematic diagram of an application environment for the method for displaying battery charge in one embodiment. As shown in Figure 1, the application environment includes an electronic device 120. Electronic device 120 includes a first chip and a second chip. The first chip is configured to run a first operating system, and the second chip is configured to run a second operating system. The electronic device also includes a charge measurement component, with the first chip connected to the charge measurement component. Electronic device 120 obtains battery charge information from the charge measurement component. When the first and second operating systems are activated and the first operating system is running in the foreground of the electronic device, the first operating system obtains the battery charge information from the charge measurement component as first charge information and displays the first charge information in the first operating system. In response to a system switching instruction, the electronic device runs the second operating system in the foreground and displays second charge information in the second operating system. The second charge information is obtained based on the updated battery charge information obtained by the charge measurement component. The electronic device 120 may be, but is not limited to, various personal computers, laptops, smartphones, tablet computers, IoT devices, and portable wearable devices. IoT devices may include smart speakers, smart TVs, smart air conditioners, smart vehicle-mounted devices, smart cars, etc. Portable wearable devices may include smart watches, smart bracelets, head-mounted devices, etc.
[0045] FIG2 is a flow chart of a method for displaying power in one embodiment. The method for displaying power in this embodiment is described by taking the electronic device in FIG1 as an example. The electronic device includes a first chip and a second chip. The first chip is used to run a first operating system, and the second chip is used to run a second operating system. The electronic device also includes a power measurement component, and the first chip is connected to the power measurement component. As shown in FIG2, the method for displaying power includes steps 220 to 260, wherein:
[0046] Step 220: Obtain the battery power information of the electronic device through the power measurement component.
[0047] Here, the power measurement component refers to a component used for power measurement in an electronic device. Among them, the power measurement component may include a fuel gauge (FG), of course, this application does not limit this. The power supply battery supplies power to the first operating system (System_A) and the second operating system (SystemB) through the power supply bus. The fuel gauge FG is connected to the power supply bus, and the fuel gauge can collect the charging current and discharging current of the power supply battery in real time through the CSP pin and the CSN pin, and calculate the battery power information based on the charging current and the discharging current; or collect the charging voltage and the discharging voltage of the power supply battery in real time, and calculate the battery power information based on the charging voltage and the discharging voltage. Thus, the electronic device realizes real-time acquisition of the battery power information of the electronic device through the power measurement component.
[0048] Here, the power information includes at least one of the information such as the remaining power information of the battery, the power mode of the battery, the state of charge information of the battery, the life information of the battery, and the capacity of the battery. Among them, the power mode of the battery includes normal mode, power saving mode, ultra power saving mode, etc., which are not limited in this application. It can be understood that when the battery of the electronic device is in normal mode, all applications on the electronic device can be started normally; when the battery of the electronic device is in power saving mode, some applications on the electronic device (for example, communication-related applications) can be started normally; when the battery of the electronic device is in ultra power saving mode, except for applications that support basic system functions (clock, GPS, etc.), other applications on the electronic device cannot be started.
[0049] In step 240, when the first operating system and the second operating system are in the startup state and the first operating system is running in the foreground on the electronic device, the first operating system obtains the battery power information from the power measurement component as the first power information and displays the first power information in the first operating system.
[0050] First, the electronic device detects whether the first operating system and the second operating system are both in the startup state. Here, the first operating system can be any one of the MCU system, the Android system, and the Symbian system, and the second operating system can also be any one of the MCU system, the Android system, and the Symbian system, and this application does not limit this. And the first operating system and the second operating system are different operating systems. If the first operating system and the second operating system are in the startup state, then in order to avoid the problem of battery power information jumping or changing sharply as the two systems of the electronic device are switched, the electronic device needs to synchronize the battery power information in the first operating system and the second operating system. By synchronizing the battery power information in the first operating system and the second operating system, the consistency of the battery power information obtained in the first operating system and the second operating system can be improved. In other words, improving consistency can be understood as reducing the difference between the battery power information obtained in the first operating system and the second operating system.
[0051] Then, when the first operating system is running in the foreground on the electronic device, that is, the first operating system is in the foreground running state, the interface and application of the first operating system are running on the electronic device. Then, the second operating system is in the background running state. Therefore, when the first operating system is in the foreground running state, it is necessary to display the battery power information in the first operating system.
[0052] Then, the first operating system obtains the battery power information from the power measurement component as the first power information, and displays the first power information in the first operating system. Optionally, the first operating system can send the first power information obtained from the power measurement component to the battery service (BatteryService), and then report the first power information to the UI interface under the first operating system or the application under the first operating system through the BatteryService. Then, after receiving the first power information of the battery under the first operating system, the UI interface under the first operating system can render and display the first power information of the battery on the UI interface under the first operating system based on the power information.
[0053] After receiving the first power information of the battery under the first operating system, the application under the first operating system can adjust the operating status, operating parameters or operating mode of the application in response to the first power information. Of course, this application does not limit this. For example, if the application under the first operating system receives the first power information of the battery under the first operating system as 20%, in response to the first power information 20%, the application under the first operating system controls the application to enter the power saving mode. Of course, this application does not limit this. Here, the size of the first power information is not limited to 20%, it can also be 15% or 25%, etc. Of course, this application does not limit this.
[0054] Step 260: In response to the system switching instruction, the electronic device runs the second operating system in the foreground and displays the second power information in the second operating system; wherein the second power information is obtained based on the updated battery power information obtained by the power measurement component.
[0055] When the running state of the first operating system is the foreground running state, the first battery power information is displayed in the first operating system. Then, if the electronic device receives a system switching instruction, it responds to the system switching instruction, wherein the system switching instruction may be an instruction sent by the first operating system to the second operating system, which carries wake-up information, and the second operating system can be awakened based on the wake-up information. After the second operating system is awakened, the electronic device runs the second operating system in the foreground, that is, the running state of the second operating system is the foreground running state at this time, and the interface and application of the second operating system are run on the electronic device. And the interface and application of the second operating system running on the electronic device may be different from the interface and application of the first operating system running on the electronic device. Then, accordingly, the running state of the first operating system is the background running state.
[0056] Therefore, when the running state of the second operating system is the foreground running state, the second power information of the battery can be displayed in the second operating system. Optionally, the second operating system of the electronic device can obtain the second power information based on the power information of the updated battery obtained by the power measurement component. Then, the second operating system can send the second power information of the battery to the battery service (BatteryService), and then report the second power information to the UI interface under the second operating system or the application under the second operating system through the BatteryService. Then, after receiving the second power information of the battery under the second operating system, the UI interface under the second operating system can render and display the second power information of the battery on the UI interface under the second operating system based on the second power information.
[0057] After receiving the second power information of the battery under the second operating system, the application under the second operating system can adjust the operating status, operating parameters or operating mode of the application in response to the second power information. Of course, this application does not limit this. For example, if the application under the second operating system receives the second power information of the battery under the second operating system as 20%, in response to the second power information 20%, the application under the second operating system controls the power saving mode of the application. Of course, this application does not limit this. Here, the second power information is not limited to 20%, it can also be 15% or 25%, etc. Of course, this application does not limit this.
[0058] In an embodiment of the present application, an electronic device obtains the battery power information of the electronic device through a power measurement component; under the condition that the first operating system and the second operating system are in the startup state and the first operating system is running on the foreground of the electronic device, the first operating system obtains the battery power information from the power measurement component as the first power information and displays the first power information in the first operating system; in response to the system switching instruction, the electronic device runs the second operating system in the foreground and displays the second power information in the second operating system; wherein the second power information is obtained based on the updated battery power information obtained by the power measurement component. Since the power information displayed in the first operating system and the second operating system are both the battery power information of the electronic device obtained by the power measurement component, that is, the power information obtained in the first operating system and the second operating system are consistent, therefore, with the switching of the two systems, the power information displayed on the two systems respectively will not jump or change sharply. Furthermore, the power information displayed by the electronic device in different operating systems is kept smooth and stable to avoid obvious differences.
[0059] In the previous embodiment, a process was described in which, under the condition that a first operating system is running in the foreground on an electronic device, the first operating system obtains battery power information from a power measurement component as first power information and displays the first power information in the first operating system; in response to a system switching instruction, the electronic device runs a second operating system in the foreground and displays the second power information in the second operating system. In this embodiment, as shown in FIG3 , a power display method is provided, further comprising:
[0060] Step 270 , in response to the system switching instruction, the power measurement component is disconnected from the first chip and the power measurement component is connected to the second chip;
[0061] In step 280 , the second chip obtains updated battery power information from the power measurement component, and uses the updated battery power information as second power information.
[0062] Here, the first chip is a microcontroller unit (MCU) and the second chip is a system-on-chip (SOC); then, the first operating system is the MCU system and the second operating system is the Android system. Alternatively, the first chip is a system-on-chip (SOC) and the second chip is a microcontroller unit (MCU); then, the first operating system is the Android system and the second operating system is the MCU system. This application does not limit this.
[0063] Since the first chip in the electronic device remains connected to the power measurement component in the default state, when the first operating system is running in the foreground on the electronic device, the first operating system can directly obtain the battery power information from the power measurement component as the first power information, and display the first power information in the first operating system.
[0064] Then, if the electronic device receives a system switching instruction, it controls the power measurement component to disconnect from the first chip and controls the power measurement component to connect to the second chip in response to the system switching instruction. In this way, the second chip can obtain the updated battery power information from the power measurement component and use the updated battery power information as the second power information.
[0065] In an embodiment of the present application, when an electronic device receives a system switching instruction, it controls the power measurement component to disconnect from the first chip and connect to the second chip in response to the system switching instruction. Then, the second chip can obtain the updated battery power information from the power measurement component and use the updated battery power information as the second power information. In this way, when the first operating system is running in the foreground on the electronic device, the first operating system obtains the battery power information from the power measurement component as the first power information. When the second operating system is running in the foreground on the electronic device, the second operating system also obtains the updated battery power information from the power measurement component as the second power information. Therefore, both the first operating system and the second operating system obtain power information from the same power measurement component. Furthermore, even if a system switch occurs, the power information displayed on the two systems will not jump or change dramatically.
[0066] In the previous embodiment, a specific implementation method is described in which both the first operating system and the second operating system obtain power information from the same power measurement component. In this embodiment, it is further described that the electronic device also includes a control switch, which is connected to the power measurement component. As shown in Figure 4, step 270, in response to the system switching instruction, the power measurement component is disconnected from the first chip and the power measurement component is connected to the second chip, including:
[0067] Step 272 : Generate a power measurement component switching instruction in response to the system switching instruction.
[0068] The power measurement component switching instruction is an instruction for controlling the power measurement component to disconnect from the currently connected chip and switch to connecting to another chip. For example, in response to the system switching instruction, the electronic device not only triggers the operating system switching operation, but also triggers the generation of the power measurement component switching instruction.
[0069] When the electronic device is running a first operating system by default in the foreground, in response to a system switching instruction, it is detected whether the electronic device is running a second operating system in the foreground. If it is detected that the electronic device is running the second operating system in the foreground, a power measurement component switching instruction is generated. For example, when the electronic device is running an MCU system by default in the foreground, in response to the system switching instruction, it is detected whether the electronic device is running an Android system in the foreground. If it is detected that the electronic device is running an Android system in the foreground, a power measurement component switching instruction is generated.
[0070] Step 274 , in response to the power measurement component switching instruction, controlling the power measurement component to disconnect from the first chip and controlling the power measurement component to connect to the second chip by controlling the switch.
[0071] Assuming that the power measurement component is currently connected to the first chip, the electronic device responds to the power measurement component switching instruction by controlling the switch to disconnect the power measurement component from the first chip and connect the power measurement component to the second chip.
[0072] Figure 5 shows a system architecture diagram for synchronizing battery charge information between a first operating system and a second operating system in an electronic device according to one embodiment. The electronic device includes a first chip 510 and a second chip 530. First chip 510 is used to run a first operating system (System_A), and second chip 530 is used to run a second operating system (System_B). The two operating systems, System_A and System_B, can communicate with each other via a bus such as SPI or UART.
[0073] The electronic device also includes a power supply battery 550 (BATTERY), a power measurement component 570 and a control switch 590. Here, the power measurement component may include a fuel gauge (FG), of course, this application does not limit this. The power supply battery supplies power to the first operating system (System_A) and the second operating system (SystemB) through the power supply bus. A fuel gauge FG is connected to the power supply bus. The fuel gauge can collect the charging current and discharging current of the power supply battery through the CSP pin and the CSN pin, and calculate the remaining power of the battery based on the charging current and the discharging current; or collect the charging voltage and the discharging voltage of the power supply battery, and calculate the remaining power of the battery based on the charging voltage and the discharging voltage.
[0074] The first operating system (System_A) and the second operating system (System_B) are each connected to a control switch via the I2C bus. In other words, the first chip and the second chip are each connected to the control switch via the I2C bus. The control switch is then connected to the same fuel gauge FG via the I2C bus. Therefore, the electronic device can control System_A or System_B via the I2C bus to connect to the fuel gauge FG.
[0075] Therefore, when the first operating system is running in the foreground of the electronic device, the control switch is used by default to control the first chip to connect to the fuel gauge FG, and then the fuel measurement component is controlled to initialize and calculate the first battery power information, and the first chip is controlled to obtain the first battery power information. Because the first power information calculated by the fuel gauge is closely related to the actual state of the battery, the control switch can be used to control the first chip to accurately obtain the first battery power information from the fuel gauge FG.
[0076] The process of initializing the power measurement component of the electronic device includes collecting current ambient temperature information, collecting resistance information of the power meter, and collecting information such as the charging current and discharging current, or the charging voltage and discharging voltage of the power supply battery through the CSP pin and the CSN pin; and also includes the process of loading battery calibration results. Here, the battery calibration results include a battery calibration curve, which is used to characterize the mapping relationship between information such as the charging current and discharging current, or the charging voltage and discharging voltage of the power supply battery and the battery power information under different ambient temperature information. For example, the battery calibration curve can be a SOC-OCV curve, of course, this application is not limited to this.
[0077] Then, after the power measurement component is initialized, the electronic device can calculate the first power information of the battery based on the charging current and discharging current, or charging voltage and discharging voltage of the power supply battery and the battery calibration curve, and control the first chip to obtain the first power information of the battery vertically through I2C.
[0078] Next, in response to the system switching instruction, the electronic device runs the second operating system in the foreground. Furthermore, in response to the system switching instruction, the electronic device generates a power measurement component switching instruction. Furthermore, in response to the power measurement component switching instruction, the electronic device controls the switch to disconnect the power meter FG from the first chip and connect the power meter FG to the second chip.
[0079] In an embodiment of the present application, the electronic device further includes a control switch, and the first chip and the second chip are respectively connected to the control switch via an I2C bus, and the control switch is connected to the same power measurement component via the I2C bus. Therefore, the electronic device can control the first chip or the second chip to connect to the same power measurement component via the I2C bus via the control switch, which is obviously a simple and fast control method. Therefore, under the condition that the first operating system is running in the foreground of the electronic device, the control switch is used by default to control the first chip to connect to the power measurement component, and then the power measurement component is controlled to initialize and calculate the first power information of the battery, and the first chip is controlled to obtain the first power information of the battery. Then, in response to the system switching instruction, the electronic device runs the second operating system in the foreground. The electronic device generates a power measurement component switching instruction in response to the system switching instruction. Then, in response to the power measurement component switching instruction, the control switch is used to control the power measurement component to disconnect from the first chip and control the power measurement component to complete the connection with the second chip. In this way, the second chip is controlled to directly obtain the second power information of the battery from the power measurement component accurately.
[0080] In the previous embodiment, a process was described in which an electronic device controls a switch to connect a first chip to a power measurement component, and then controls the power measurement component to initialize and calculate first power information of a battery. In this embodiment, a power display method is further provided, further comprising:
[0081] The first chip calibrates the battery and generates a battery calibration result;
[0082] The first operating system obtains battery power information from the power measurement component as first power information, including:
[0083] The first chip controls the power measurement component to be initialized according to the battery calibration result, and obtains the battery power information through the power measurement component after the power measurement component is initialized;
[0084] The battery power information is used as the first power information.
[0085] Optionally, before the electronic device obtains the battery power information of the electronic device through the power measurement component, the first chip pre-calibrates the battery to generate a battery calibration result. The battery calibration result includes a battery calibration curve, which is used to characterize the mapping relationship between information such as the charging current and discharging current, or the charging voltage and discharging voltage of the power supply battery and the battery power information under different ambient temperature information. For example, the battery calibration curve can be a SOC-OCV curve, of course, this application is not limited to this.
[0086] Here, the first chip can calibrate the battery using the equal-current constant-voltage charging method. The process of calibrating the battery using the equal-current constant-voltage charging method includes three steps: calibration, measurement, and evaluation. During the calibration process, the battery needs to be placed under a constant voltage condition, and the battery needs to be charged to a preset charge depth, and then the battery needs to be exhausted. During the measurement process, the battery needs to be charged again to a preset charge depth, and then the battery needs to be exhausted. Finally, during the evaluation process, the actual capacity of the battery and other technical indicators are calculated to obtain the battery calibration result.
[0087] After the first chip calibrates the battery and obtains the battery calibration result, the first chip can control the power measurement component to initialize according to the battery calibration result. After the power measurement component is initialized, the power measurement component obtains the battery power information. Optionally, the process of the first chip controlling the power measurement component to initialize includes collecting current ambient temperature information, collecting power meter resistance information, and collecting information such as the charging current and discharging current, or charging voltage and discharging voltage of the power supply battery through the CSP pin and CSN pin; and also includes the process of loading the battery calibration result.
[0088] Then, after the power measurement component is initialized, the electronic device can obtain the battery power information through the power measurement component based on information such as the charging current and discharging current, or the charging voltage and discharging voltage of the power supply battery and the battery calibration curve. For example, the first chip can be connected to the control switch via I2C, and the control switch is then connected to the power measurement component. Thus, the first chip can obtain the first battery power information through the power measurement component.
[0089] In an embodiment of the present application, the first chip calibrates the battery in advance and generates a battery calibration result. The battery calibration result includes a mapping relationship between information such as the charging current and discharging current, or the charging voltage and discharging voltage of the power supply battery and the battery's power information. Then, the first chip can control the power measurement component to initialize according to the battery calibration result, and after the power measurement component is initialized, obtain the battery's power information through the power measurement component, and use the battery's power information as the first power information. Because the first chip has calibrated the battery in advance, the subsequent control of the power measurement component to initialize according to the battery calibration result can improve the accuracy of the power measurement component. Furthermore, after the power measurement component is initialized, the first chip can accurately calculate the first power information of the battery.
[0090] In one embodiment, a method for displaying power is provided, further comprising:
[0091] The second chip obtains the first power information from the first chip and uses the first power information as the second power information; the first power information is the updated battery power information obtained by the first chip based on the power measurement component.
[0092] Optionally, if the first chip is used as the chip currently connected to the power measurement component, the first chip is controlled to obtain the first power information of the battery in real time through the power measurement component, and the first power information is displayed in the first operating system. Then, the electronic device responds to the system switching instruction, the electronic device runs the second operating system in the foreground, and the second chip can obtain the first power information from the first chip. In this case, the first power information is the updated battery power information obtained by the first chip based on the power measurement component.
[0093] The process of the second chip obtaining the first power information from the first chip may be that the second chip actively obtains the first power information from the first chip. Of course, the second chip may also passively obtain the first power information from the first chip, that is, the first chip actively sends the updated battery power information obtained based on the power measurement component to the second chip, which is not limited in this application.
[0094] In an embodiment of the present application, if the first chip is currently connected to the power measurement component, the first chip is controlled to obtain first battery power information in real time through the power measurement component and display the first battery power information in the first operating system. Then, in response to a system switch instruction, the electronic device runs the second operating system in the foreground, and the second chip can obtain the first battery power information from the first chip. In this case, the first battery power information is the updated battery power information obtained by the first chip based on the power measurement component. That is, the first chip in the electronic device is always connected to the power measurement component. When the electronic device runs the first operating system in the foreground, the first chip directly obtains the first battery power information in real time through the power measurement component and displays the first battery power information in the first operating system. When the electronic device runs the second operating system in the foreground, the second chip indirectly obtains the updated first battery power information in real time through the power measurement component via the first chip and displays the updated first battery power information as the second battery power information. In this way, both the first and second operating systems obtain power information from the same power measurement component. Furthermore, even if a system switch occurs, the power information displayed on the two systems will not jump or change dramatically.
[0095] In the previous embodiment, the second chip obtains the first power information from the first chip and uses the first power information as the second power information. In this embodiment, the first chip is further connected to the second chip in communication; the second chip obtains the first power information from the first chip, including:
[0096] In response to the system switching instruction, the second chip sends a request instruction to the first chip through the communication connection; the request instruction is used to instruct the first chip to send the first power information to the second chip;
[0097] The second chip receives the first power information.
[0098] Here, it is described that the second chip obtains the first power information from the first chip and uses the first power information as a way of using the second power information. The first chip and the second chip are connected through a preset communication method, that is, the first chip and the second chip are connected through a dual-core communication method. Then, in response to the system switching instruction, the second chip obtains the first power information of the battery from the first chip through a preset communication method. The preset communication method here is the dual-core communication method. As shown in Figure 5, the two operating systems System_A and System_B can perform dual-core communication through a bus such as SPI or UART. Therefore, the electronic device can control the second chip to obtain the first power information of the battery from the first chip through a bus such as SPI or UART.
[0099] For example, in response to the system switching instruction, the second chip sends a request instruction to the first chip via the communication connection. The request instruction is used to instruct the first chip to send the first power information to the second chip. In this way, the second chip can receive the first power information.
[0100] In an embodiment of the present application, first, in response to a system switching instruction, the second chip sends a request instruction to the first chip via a preset communication method. The request instruction is used to instruct the first chip to send the first battery power information to the second chip. Then, after receiving the request instruction, the first chip sends the first battery power information to the second chip. Finally, the second chip receives the first battery power information. In this way, the second chip obtains the first battery power information from the first chip.
[0101] In the previous embodiment, a method was described in which the second chip obtains the first power information from the first chip and uses the first power information as the second power information. This method mainly adopts the method of responding to the system switching instruction and sending a request instruction to the first chip through a preset communication method. Then, after receiving the request instruction, the first chip sends the first power information of the battery to the second chip. In this embodiment, it is further described that the second chip obtains the first power information from the first chip, and further includes:
[0102] When the first power information displayed in the first operating system is updated, the first chip sends the updated first power information to the second chip through the communication connection;
[0103] The second chip receives the updated first power information.
[0104] As shown in FIG6 , the second chip obtains the first power information from the first chip, including the following steps:
[0105] Step 620, determining whether the first power information displayed in the first operating system is updated;
[0106] Step 640: When the first power information displayed in the first operating system is updated, the first chip sends the updated first power information to the second chip via the communication connection;
[0107] Step 660: The second chip receives the updated first power level information.
[0108] Here, another way is described in which the second chip obtains the first power information from the first chip and uses the first power information as the second power information. Under the condition that the first operating system is running in the foreground of the electronic device, the first operating system obtains the battery power information from the power measurement component as the first power information, and displays the first power information in the first operating system. Therefore, the first operating system can monitor whether the obtained first power information of the battery changes. If it is monitored that the first power information of the battery is updated, the first chip sends the updated first power information to the second chip through a communication connection. Then, the second chip receives the updated first power information, and updates the initial second power information in the second chip according to the updated first power information as the new second power information.
[0109] In an embodiment of the present application, under the condition that the first operating system is running in the foreground of the electronic device, the first operating system obtains the battery power information from the power measurement component as the first power information, and displays the first power information in the first operating system. Therefore, the first operating system can monitor whether the obtained first power information of the battery changes. If it is monitored that the first power information of the battery is updated, the first chip actively sends the updated first power information to the second chip through the communication connection. Therefore, the second chip realizes the acquisition of the first power information from the first chip. In this way, the second chip does not need to continuously obtain the second power information of the battery. Instead, when the first power information of the battery is detected to have changed, the first chip controls the first chip to send the first power information of the battery to the second chip. Furthermore, while improving the second chip's ability to accurately obtain the battery's power information, the power consumption of the system is reduced.
[0110] In one embodiment, a method for displaying power is provided, further comprising:
[0111] When the electronic device switches from a power-off state to a power-on state, obtaining a target operating system running in the foreground of the electronic device; the target operating system includes the first operating system or the second operating system;
[0112] Connect the target chip corresponding to the target operating system to the power measurement component;
[0113] The target chip obtains the battery power information from the power measurement component as target power information, and displays the target power information in the target operating system.
[0114] Optionally, when the electronic device switches from a power-off state to a power-on state, generally, the electronic device can run the target operating system in the foreground in the power-on state. Here, the target operating system includes the first operating system or the second operating system. That is, the electronic device can run the first operating system or the second operating system in the foreground in the power-on state.
[0115] Then, at this time, the target operating system running in the foreground needs to display the power level, while the operating system running in the background does not need to display the power level for the time being. Therefore, when the electronic device is switched from the off state to the on state, the target chip corresponding to the target operating system can be directly connected to the power measurement component. In this way, the target chip can directly obtain the battery power information as the target power information from the power measurement component and display the target power information in the target operating system. Obviously, when the electronic device is switched from the off state to the on state, there is no need to switch the power measurement component to connect with the target chip, thereby improving the efficiency of the power display and reducing the system power consumption.
[0116] Alternatively, if the electronic device switches from a shutdown state to a power-on state, assuming that the MCU system is running in the foreground, the MCU system running in the foreground needs to display the power level, while the Android system running in the background does not need to display the power level for the time being. Therefore, the first chip corresponding to the MCU system can be directly connected to the power measurement component. The first chip is a microcontroller unit MCU. In this way, the first chip can directly obtain the battery power information from the power measurement component as the target power information and display the target power information in the MCU system.
[0117] Similarly, if an electronic device switches from a powered-on state to a powered-on state, assuming the Android system is running in the foreground, the Android system running in the foreground needs to display the battery level, while the MCU system running in the background does not need to display the battery level for the time being. Therefore, a second chip corresponding to the Android system can be directly connected to the battery level measurement component. The second chip is a system-on-chip (SOC). In this way, the second chip can directly obtain the battery level information from the battery level measurement component as the target battery level information and display the target battery level information in the Android system.
[0118] In an embodiment of the present application, when the electronic device switches from a powered-on state to a powered-on state, the target chip corresponding to the target operating system running in the foreground is directly connected to the power measurement component. Thus, the target chip can directly obtain the battery power information from the power measurement component and use it as the target power information. Finally, the target power information is displayed in the target operating system. Obviously, in this process, there is no need to switch the power measurement component to connect to the target chip, thereby improving the efficiency of the power display and reducing system power consumption.
[0119] In one embodiment, a method for displaying power is provided, further comprising:
[0120] When the electronic device receives a shutdown instruction, if the power measurement component is connected to the second chip, the power measurement component is controlled to be connected to the first chip;
[0121] The power consumption when the first operating system is run on the first chip is less than the power consumption when the second operating system is run on the second chip.
[0122] When an electronic device receives a shutdown command while powered on, it responds to the shutdown command by first determining whether the power measurement component is connected to the first chip. The power consumption when running a first operating system on the first chip is less than the power consumption when running a second operating system on the second chip. This can be understood as the first chip being a microcontroller unit (MCU) and the second chip being a system-on-chip (SOC); accordingly, the first operating system is the MCU system and the second operating system is the Android system.
[0123] Because the power consumption of running the first operating system on the first chip is lower than that of running the second operating system on the second chip, the electronic device can control the power measurement component to connect to the first chip in response to the shutdown instruction. In this way, when the electronic device is next powered on, the power measurement component remains connected to the first chip with lower power consumption, further reducing system power consumption.
[0124] After determining whether the power measurement component is connected to the first chip, if the power measurement component is connected to the second chip, the power measurement component is controlled to connect to the first chip. For example, the power measurement component is disconnected from the second chip by controlling the switch, and the power measurement component is controlled to connect to the first chip. If it is determined that the power measurement component is connected to the first chip, the power measurement component remains connected to the first chip. Finally, the electronic device executes a shutdown operation in response to the shutdown instruction.
[0125] In an embodiment of the present application, when an electronic device receives a shutdown command while powered on, the electronic device first determines, in response to the shutdown command, whether the power measurement component is connected to the first chip. If the power measurement component is connected to the second chip, which has higher power consumption, the power measurement component is controlled to connect to the first chip, which has lower power consumption. This ensures that the power measurement component is connected to the first chip, which has lower power consumption, before the electronic device performs a shutdown operation. Consequently, when the electronic device is powered on the next time, the power measurement component remains connected to the first chip, which has lower power consumption, further reducing system power consumption.
[0126] In one embodiment, as shown in FIG7 , a method for displaying power level is provided, including:
[0127] Step 720: Obtain battery power information and store the battery power information in a preset storage space;
[0128] Step 740: Control the first chip or the second chip to obtain battery power information from a preset storage space through a preset communication method;
[0129] Step 760: Synchronize the battery power information with the power information in the first operating system and the power information in the second operating system.
[0130] FIG8 is a diagram illustrating a system architecture for synchronizing battery charge information between a first operating system and a second operating system in an electronic device according to an embodiment. The electronic device includes a first chip 810 and a second chip 830. The first chip is configured to run a first operating system (System_A), and the second chip is configured to run a second operating system (System_B). The two operating systems, System_A and System_B, can communicate with each other via a bus such as SPI or UART. Furthermore, the first chip 810 can be connected to a preset storage space 850.
[0131] Here, after the electronic device obtains the battery power information, the battery power information can be stored in a preset storage space. Here, a partition can be divided in the memory of any operating system in the electronic device as the preset storage space, or a partition can be divided in the memory of a commonly used operating system in the electronic device as the preset storage space. Of course, this application does not limit this.
[0132] For example, assuming that the first operating system is an MCU system, since the power consumption of the MCU system is low, the MCU system can be used as a common operating system in electronic devices. Therefore, the Nand-flash memory of the MCU system can be partitioned as a preset storage space (such as an NVRAM partition). Among them, the Nand-flash memory is a type of flash memory, which uses a nonlinear macro unit mode inside. The NVRAM partition stores data in the form of raw data and can play a role in data backup. Here, the Nand-flash memory is just a type of memory in the MCU system, and a limitation is made on this.
[0133] Then, the first chip or the second chip is controlled to obtain the battery power information from the preset storage space through a preset communication method. Assuming that the battery power information is stored in the preset storage space in the first operating system, the battery power information can be directly obtained from the preset storage space through the first chip. Next, the second chip is controlled to obtain the battery power information from the preset storage space through a preset communication method. That is, the second chip is controlled to obtain the battery power information from the preset storage space through a dual-core communication method (SPI or UART bus).
[0134] Because the first chip and the second chip both obtain the battery power information from the same preset storage space, the battery power information obtained by the first chip and the second chip is the same. Finally, the battery power information is synchronized with the power information in the first operating system and the power information in the second operating system. Therefore, the consistency of the power information in the first operating system and the power information in the second operating system can be improved.
[0135] In an embodiment of the present application, when synchronizing the battery power information in the first operating system and the second operating system, it includes: first, obtaining the battery power information and storing the battery power information in a preset storage space. Then controlling the first chip or the second chip to obtain the battery power information from the preset storage space through a preset communication method. Since the first chip and the second chip both obtain the battery power information from the same preset storage space, the battery power information obtained by the first chip and the second chip is the same. Finally, the battery power information is synchronized to the power information in the first operating system and the power information in the second operating system. Therefore, the consistency of the power information in the first operating system and the power information in the second operating system can be improved.
[0136] In the previous embodiment, the process of synchronizing battery power information in the first operating system and the second operating system when the first operating system and the second operating system are in the startup state and displaying the battery power information in each operating system is described. In this embodiment, the electronic device further includes a power measurement component and provides a power display method, further comprising:
[0137] If the first operating system is in the startup state and the second operating system is in the shutdown state, the first chip is controlled to obtain first power information of the battery from the power measurement component, and the first power information is displayed in the first operating system.
[0138] The electronic device can detect the operating status of a first operating system and a second operating system, where the operating status includes an on-state or off-state. If the first operating system is detected to be on-state and the second operating system is off-state, since the second operating system is off-state, it is not necessary to display the battery level in the second operating system. In this case, the first chip is controlled to obtain the first battery level information from the battery level measurement component, and the first battery level information is displayed in the first operating system.
[0139] When controlling the first chip to obtain the first battery power information from the power measurement component, the control switch can be used to control the first chip to connect to the power gauge FG, and then control the power measurement component to initialize and calculate the first battery power information, and then control the first chip to obtain the first battery power information. Because the power information calculated by the power gauge is closely related to the actual state of the battery, the control switch can be used to control the first chip to accurately obtain the first battery power information from the power gauge FG.
[0140] Then, the first chip can report the first battery power information to the UI interface under the first operating system or the application under the first operating system. Then, after receiving the first battery power information under the first operating system, the UI interface under the first operating system can render and display the first battery power information on the UI interface under the first operating system based on the first battery power information.
[0141] In an embodiment of the present application, if it is detected that the first operating system is in the startup state and the second operating system is in the shutdown state, then since the second operating system is in the shutdown state at this time, there is no need to display the power level in the second operating system. Then, at this time, the first chip is controlled to obtain the first power level information of the battery from the power measurement component, and the first power level information is displayed in the first operating system. In the case where the first operating system is in the startup state and the second operating system is in the shutdown state, the first power level information is displayed in real time in the first operating system.
[0142] In the previous embodiment, if it is detected that the first operating system is in the startup state and the second operating system is in the shutdown state, the process of controlling the first chip to obtain first battery power information from the power measurement component and displaying the first battery power information in the first operating system is described. This embodiment further provides a power display method, which also includes:
[0143] If the first operating system is in a shutdown state and the second operating system is in a startup state, the second chip is controlled to obtain second power information of the battery from the power measurement component, and the second power information is displayed in the second operating system.
[0144] The electronic device can detect the operating status of a first operating system and a second operating system, where the operating status includes an on-state or off-state. If the second operating system is detected to be on-state and the first operating system is off-state, since the first operating system is off-state, it is not necessary to display the battery level in the first operating system. In this case, the second chip is controlled to obtain the second battery level information from the battery level measurement component, and the second battery level information is displayed in the second operating system.
[0145] When controlling the second chip to obtain the second battery power information from the power measurement component, the control switch can be used to control the second chip to connect to the power gauge FG, and then the power measurement component can be controlled to initialize and calculate the second battery power information, and the second chip can be controlled to obtain the second battery power information. Because the power information calculated by the power gauge is closely related to the actual state of the battery, the control switch can be used to control the second chip to accurately obtain the second battery power information from the power gauge FG.
[0146] Then, the second chip can report the second battery power information to the UI interface under the second operating system or the application under the second operating system. Then, after receiving the second battery power information under the second operating system, the UI interface under the second operating system can render and display the second battery power information on the UI interface under the second operating system based on the second battery power information.
[0147] In an embodiment of the present application, if it is detected that the second operating system is in the startup state and the first operating system is in the shutdown state, then since the first operating system is in the shutdown state at this time, it is not necessary to display the power level in the first operating system. Then, at this time, the second chip is controlled to obtain the second power level information of the battery from the power measurement component, and the second power level information is displayed in the second operating system. In the case where the second operating system is in the startup state and the first operating system is in the shutdown state, the second power level information is displayed in the second operating system in real time.
[0148] In an exemplary embodiment, an electronic device includes a first chip and a second chip, wherein the first chip is used to run a first operating system, and the second chip is used to run a second operating system. The first chip is a microcontroller unit (MCU), and the second chip is a system-on-chip (SOC). Therefore, the first operating system is an MCU system, and the second operating system is an Android system. As shown in FIG9 , a method for displaying power is provided, comprising:
[0149] Step 902: calibrate the battery and generate a battery calibration result;
[0150] Step 904: Detect the running status of the first operating system and the second operating system;
[0151] Step 906: If it is detected that the first operating system and the second operating system are in the startup state, the first chip is controlled to connect to the power measurement component through the control switch;
[0152] Step 908: Control the power measurement component to initialize and calculate first power information of the battery, and control the first chip to obtain the first power information of the battery;
[0153] Step 910: When a first operating system is running on the electronic device, display the battery power information in the first operating system;
[0154] Step 912: In response to the system switching instruction, run the second operating system on the electronic device;
[0155] Step 914, switching the second chip to connect to the power measurement component by controlling the switch;
[0156] Step 916: Control the power measurement component to calculate the second power information of the battery, control the second chip to obtain the second power information of the battery, and synchronize the second power information with the power information in the second operating system;
[0157] Step 918, displaying battery power information in the second operating system;
[0158] Step 920: If the first operating system is in the startup state and the second operating system is in the shutdown state, control the first chip to obtain first battery power information from the power measurement component and display the first battery power information in the first operating system;
[0159] Step 922: If the first operating system is in a shutdown state and the second operating system is in a startup state, control the second chip to obtain second battery power information from the power measurement component and display the second battery power information in the second operating system.
[0160] As shown in Figure 10, it is a signaling timing diagram of an electronic device synchronizing battery power information in a first operating system and a second operating system in one embodiment. In conjunction with Figure 10, the electronic device includes an interface (System_A_UI) of the first operating system, a driver (System_A_Driver) of the first operating system, a control switch and a fuel gauge module, a driver (System_B_Driver) of the second operating system, and an interface (System_B_UI) of the second operating system. Here, if the electronic device controls the first chip to be connected to the fuel gauge FG through the I2C bus via the control switch, a method for displaying power is provided, including:
[0161] Step 1002: Control the first chip to connect to the power measurement component through a control switch, and control the power measurement component to initialize and calculate first power information of the battery;
[0162] Step 1004: Control the driver (System_A_Driver) of the first operating system to send a first request RequestA to the control switch and the fuel meter module, where the first request is used to obtain first power information of the battery from the control switch and the fuel meter module.
[0163] Step 1006: Control the switch and the power meter module to send a first report ReportA to the driver (System_A_Driver) of the first operating system. The first report ReportA carries first power information of the battery.
[0164] Step 1008: Control the driver (System_A_Driver) of the first operating system to send a first report ReportA to the interface (System_A_UI) of the first operating system; the first battery power information can be displayed in the interface (System_A_UI) of the first operating system;
[0165] Step 1010: Control the driver of the second operating system (System_B_Driver) to obtain first battery power information from the driver of the first operating system (System_A_Driver) through a Notify / Request method, and use the first battery power information as the battery power information in the second operating system; the first battery power information can be displayed in the interface (System_B_UI) of the second operating system;
[0166] Here, if the electronic device controls the second chip to be connected to the fuel gauge FG via the I2C bus through the control switch, a method for displaying fuel level is provided, including:
[0167] Step 1012: Control the second chip to connect to the power measurement component through the control switch, and control the power measurement component to initialize and calculate the second power information of the battery;
[0168] Step 1014: Control the driver (System_B_Driver) of the second operating system to send a second request RequestB to the control switch and the fuel meter module, where the second request is used to obtain second battery power information from the control switch and the fuel meter module.
[0169] Step 1016: Control the switch and the power meter module to send a second report (Report B) to the driver (System_B_Driver) of the second operating system. The second report (Report B) carries the second power information of the battery.
[0170] Step 1018: Control the driver (System_B_Driver) of the second operating system to send a second report ReportB to the interface (System_B_UI) of the second operating system; the second battery power information can be displayed in the interface (System_B_UI) of the second operating system.
[0171] In step 1020, the driver (System_A_Driver) of the first operating system is controlled to obtain the second battery power information from the driver (System_B_Driver) of the second operating system through the Notify / Request method, and the second battery power information is used as the battery power information in the first operating system; the second battery power information can be displayed in the interface (System_A_UI) of the first operating system.
[0172] As shown in Figure 11, this is a schematic diagram of the system architecture of an electronic device in one embodiment. The entire system of the electronic device can be divided into four layers, involving the hardware layer, the kernel or driver layer, the framework layer, and the application layer. Among them, the hardware layer provides the power supply, SPI, UART bus and other hardware capabilities of the entire system, including the CPU and bus. The kernel or driver layer includes drivers for various buses (I2C driver), SWITCH switch driver, fuel gauge FG driver, battery file PROFILE, charging process management, power calculation, etc. The kernel or driver layer also includes dual-core communication bus drivers such as SPI or UART drivers. The framework layer mainly serves as a link between the driver and application layers, manages application requests and drive messages, and implements information synchronization management during dual-core communication, such as the battery management service BatteryService. The application layer mainly performs interface display, handles logical processing and response of user interaction operations, etc., including multiple application programs APP_n and battery display UI interface Battery UI.
[0173] In this embodiment, the electronic device can control a switch to connect the first chip to the power measurement component, which then controls the power measurement component to initialize and calculate the first battery power information. Ultimately, the first chip obtains the first battery power information. This allows the first chip to accurately obtain the first battery power information directly from the power measurement component. The electronic device can control a switch to connect the second chip to the power measurement component, which then controls the power measurement component to initialize and calculate the second battery power information. Ultimately, the second chip can also obtain the second battery power information. This allows the second chip to accurately obtain the second battery power information directly from the power measurement component. Both the first and second operating systems obtain the battery power information from the same power measurement component. Therefore, the battery power information obtained by the first and second operating systems is consistent. Furthermore, as the two systems switch, the power information displayed on each system does not jump or change dramatically. Ultimately, the electronic device maintains smooth and stable power display throughout the entire power display process.
[0174] It should be understood that, although the various steps in the above flow chart are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the above flow chart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily to be performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0175] Based on the same inventive concept, as shown in FIG12 , a power display device 1200 is provided, which is applied to an electronic device. The electronic device includes a first chip and a second chip, the first chip being used to run a first operating system, and the second chip being used to run a second operating system. The electronic device also includes a power measurement component, and the first chip is connected to the power measurement component. The device includes:
[0176] The power information acquisition module 1220 is used to obtain the power information of the battery of the electronic device through the power measurement component;
[0177] A first display module 1240 is configured to, when the first operating system and the second operating system are in an activated state and the first operating system is running in the foreground on the electronic device, cause the first operating system to obtain battery power information from the power measurement component as first power information and display the first power information in the first operating system;
[0178] The second display module 1260 is used to respond to the system switching instruction, and the electronic device runs the second operating system in the foreground, and displays the second power information in the second operating system; wherein the second power information is obtained based on the updated battery power information obtained by the power measurement component.
[0179] In one embodiment, as shown in FIG13 , a power display device 1200 is provided, which further includes:
[0180] A first power measurement component connection module 1270 is configured to disconnect the power measurement component from the first chip and connect the power measurement component to the second chip in response to a system switching instruction;
[0181] The second power information generating module 1280 is configured to enable the second chip to obtain updated battery power information from the power measurement component and use the updated battery power information as the second power information.
[0182] In one embodiment, the electronic device further includes a control switch connected to the power measurement component; the first power measurement component connection module 1270 is further configured to generate a power measurement component switching instruction in response to a system switching instruction; in response to the power measurement component switching instruction, the power measurement component is disconnected from the first chip through the control switch, and the power measurement component is connected to the second chip.
[0183] In one embodiment, the first power measurement component connection module 1270 is further configured to detect whether the electronic device is running the second operating system in the foreground in response to a system switching instruction; if it is detected that the electronic device is running the second operating system in the foreground, generate a power measurement component switching instruction.
[0184] In one embodiment, as shown in FIG13 , the second power information generating module 1280 is also used for the second chip to obtain the first power information from the first chip and use the first power information as the second power information; the first power information is the updated battery power information obtained by the first chip based on the power measurement component.
[0185] In one embodiment, the first chip is communicatively connected to the second chip; the second power information generation module 1280 is also used to respond to the system switching instruction, and the second chip sends a request instruction to the first chip through the communication connection; the request instruction is used to instruct the first chip to send the first power information to the second chip; the second chip receives the first power information and uses the first power information as the second power information.
[0186] In one embodiment, the second power information generation module 1280 is also used to, when the first power information displayed in the first operating system is updated, the first chip sends the updated first power information to the second chip through a communication connection; the second chip receives the updated first power information and uses the first power information as the second power information.
[0187] In one embodiment, a power display device is provided, the device further comprising:
[0188] A battery calibration module, configured to use the first chip to calibrate the battery and generate a battery calibration result;
[0189] The first display module 1240 is further configured to control the first chip to initialize the power measurement component according to the battery calibration result, and obtain the battery power information through the power measurement component after the power measurement component is initialized; and use the battery power information as the first power information.
[0190] In one embodiment, a power display device is provided, the device further comprising:
[0191] A target operating system acquisition module is used to acquire the target operating system running in the foreground of the electronic device when the electronic device switches from the off state to the on state; the target operating system includes the first operating system or the second operating system;
[0192] A second power measurement component connection module is used to connect the target chip corresponding to the target operating system to the power measurement component;
[0193] The target power information display module is used for the target chip to obtain the battery power information from the power measurement component as the target power information, and to display the target power information in the target operating system.
[0194] In one embodiment, a power display device is provided, the device further comprising:
[0195] a third power measurement component connection module, configured to control the power measurement component to be connected to the first chip if the power measurement component is connected to the second chip when the electronic device receives a shutdown instruction;
[0196] The power consumption when the first operating system is run on the first chip is less than the power consumption when the second operating system is run on the second chip.
[0197] In one embodiment, the power consumption when the first operating system is run on the first chip is less than the power consumption when the second operating system is run on the second chip;
[0198] Alternatively, the power consumption when the first operating system is run on the first chip is greater than or equal to the power consumption when the second operating system is run on the second chip.
[0199] The division of the modules in the above power display device is only for illustration. In other embodiments, the power display device can be divided into different modules as needed to complete all or part of the functions of the above power display device.
[0200] For the specific definition of the power display device, please refer to the definition of the power display method above and will not be repeated here. Each module in the above power display device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each of the above modules.
[0201] Figure 14 is a schematic diagram of the internal structure of an electronic device in one embodiment. The electronic device can be any terminal device such as a mobile phone, tablet computer, laptop computer, desktop computer, PDA (Personal Digital Assistant), POS (Point of Sales), vehicle-mounted computer, wearable device, etc. The electronic device includes a processor and memory connected via a system bus. The processor may include one or more processing units. The processor may be a CPU (Central Processing Unit) or a DSP (Digital Signal Processing), etc. The memory may include a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The computer program can be executed by the processor to implement a power display method provided in each of the following embodiments. The internal memory provides a cache operating environment for the operating system computer program in the non-volatile storage medium.
[0202] Each module in the power display device provided in the embodiments of the present application may be implemented in the form of a computer program. The computer program may be executed on an electronic device. The program modules comprising the computer program may be stored in a memory of the electronic device. When the computer program is executed by a processor, the steps of the method described in the embodiments of the present application are implemented.
[0203] The present application also provides a computer-readable storage medium, one or more non-volatile computer-readable storage media containing computer-executable instructions, which, when executed by one or more processors, cause the processors to perform the steps of the power display method.
[0204] An embodiment of the present application also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the power display method.
[0205] As used herein, any reference to memory, storage, database, or other medium may include non-volatile and / or volatile memory. Non-volatile memory may include ROM (Read-Only Memory), PROM (Programmable Read-only Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-only Memory), or flash memory. Volatile memory may include RAM (Random Access Memory), which serves as an external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as SRAM (Static Random Access Memory), DRAM (Dynamic Random Access Memory), SDRAM (Synchronous Dynamic Random Access Memory), Double Data Rate DDR SDRAM (Double Data Rate Synchronous Dynamic Random Access memory), ESDRAM (Enhanced Synchronous Dynamic Random Access memory), SLDRAM (Sync Link Dynamic Random Access Memory), RDRAM (Rambus Dynamic Random Access Memory), and DRDRAM (Direct Rambus Dynamic Random Access Memory).
[0206] The technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above-mentioned embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0207] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.
Claims
1. A method for displaying power level, It is characterized in that Applied to an electronic device, the electronic device comprises a first chip and a second chip, the first chip is used to run a first operating system, the second chip is used to run a second operating system, the electronic device further comprises a power measurement component, and the first chip is connected to the power measurement component; the method comprises: Acquiring power information of a battery of the electronic device through the power measurement component; Under the condition that the first operating system and the second operating system are in a startup state and the first operating system is running in the foreground on the electronic device, the first operating system obtains the power information of the battery from the power measurement component as the first power information, and displays the first power information in the first operating system; In response to the system switching instruction, the electronic device runs the second operating system in the foreground and displays second power information in the second operating system; wherein the second power information is obtained based on the updated power information of the battery obtained by the power measurement component.
2. The method according to claim 1, It is characterized in that The method further comprises: In response to the system switching instruction, the power measurement component is disconnected from the first chip and the power measurement component is connected to the second chip; The second chip obtains the updated power information of the battery from the power measurement component, and uses the updated power information of the battery as the second power information.
3. The method according to claim 2, It is characterized in that The electronic device further includes a control switch, the control switch being connected to the power measurement component; in response to the system switching instruction, the power measurement component is disconnected from the first chip and the power measurement component is connected to the second chip, including: generating a power measurement component switching instruction in response to the system switching instruction; In response to the power measurement component switching instruction, the power measurement component is controlled by the control switch to be disconnected from the first chip, and the power measurement component is controlled to be connected to the second chip.
4. The method according to claim 3, It is characterized in that The generating a power measurement component switching instruction in response to the system switching instruction comprises: In response to the system switching instruction, detecting whether the second operating system is running in the foreground of the electronic device; If it is detected that the electronic device is running the second operating system in the foreground, the power measurement component switching instruction is generated.
5. The method according to claim 1, It is characterized in that The method further comprises: The second chip obtains the first power information from the first chip, and uses the first power information as the second power information; the first power information is the updated power information of the battery obtained by the first chip based on the power measurement component.
6. The method according to claim 5, It is characterized in that The first chip is in communication connection with the second chip; the second chip obtains the first power information from the first chip, and uses the first power information as the second power information, including: In response to the system switching instruction, the second chip sends a request instruction to the first chip through the communication connection; the request instruction is used to instruct the first chip to send the first power information to the second chip; The second chip receives the first power information and uses the first power information as the second power information.
7. The method according to claim 5, It is characterized in that The second chip acquires the first power information from the first chip and uses the first power information as the second power information, further comprising: Under the condition that the first power information displayed in the first operating system is updated, the first chip sends the updated first power information to the second chip through a communication connection; The second chip receives the updated first power information and uses the first power information as the second power information.
8. The method according to claim 1, It is characterized in that The method further comprises: The first chip calibrates the battery and generates a battery calibration result; The first operating system obtains the power information of the battery from the power measurement component as first power information, including: The first chip controls the power measurement component to be initialized according to the battery calibration result, and after the power measurement component is initialized, obtains the power information of the battery through the power measurement component; The power information of the battery is used as the first power information.
9. The method according to claim 2, It is characterized in that The method further comprises: When the electronic device is switched from the off state to the on state, the target operating system running in the foreground of the electronic device is obtained; The target operating system includes a first operating system or a second operating system; Connecting the target chip corresponding to the target operating system to the power measurement component; The target chip obtains the power information of the battery from the power measurement component as target power information, and displays the target power information in the target operating system.
10. The method according to claim 2, It is characterized in that The method further comprises: When the electronic device receives a shutdown instruction, if the power measurement component is connected to the second chip, controlling the power measurement component to be connected to the first chip; The power consumption when the first operating system is run on the first chip is less than the power consumption when the second operating system is run on the second chip.
11. The method according to any one of claims 1 to 9, It is characterized in that The power consumption when the first operating system is run on the first chip is less than the power consumption when the second operating system is run on the second chip; Or, the power consumption when the first operating system is run on the first chip is greater than or equal to the power consumption when the second operating system is run on the second chip.
12. The method according to claim 1, It is characterized in that The electrical quantity measurement component includes an electrical quantity meter.
13. The method according to claim 1, It is characterized in that The power information includes at least one of the remaining power information of the battery, the power mode of the battery, the state of charge information of the battery, the life information of the battery, and the power capacity of the battery.
14. The method according to claim 13, It is characterized in that The battery power mode includes a normal mode, a power saving mode and an ultra power saving mode; wherein, when the battery of the electronic device is in the normal mode, all applications on the electronic device can be started normally; when the battery of the electronic device is in the power saving mode, some applications on the electronic device can be started normally; when the battery of the electronic device is in the ultra power saving mode, except for applications that support basic system functions, other applications on the electronic device cannot be started.
15. The method according to claim 1, It is characterized in that The first operating system and the second operating system are different operating systems.
16. The method according to claim 1, It is characterized in that The system switching instruction is an instruction sent by the first operating system to the second operating system; The system switching instruction carries wake-up information; wherein the second operating system is woken up based on the wake-up information.
17. A power display device, It is characterized in that Applied to an electronic device, the electronic device comprises a first chip and a second chip, the first chip is used to run a first operating system, the second chip is used to run a second operating system, the electronic device further comprises a power measurement component, and the first chip is connected to the power measurement component; the device comprises: A power information acquisition module, used to acquire the power information of the battery of the electronic device through the power measurement component; A first display module, configured to, under the condition that the first operating system and the second operating system are in a startup state and the first operating system is running in the foreground on the electronic device, cause the first operating system to obtain the power information of the battery from the power measurement component as the first power information, and display the first power information in the first operating system; The second display module is used to respond to the system switching instruction, and the electronic device runs the second operating system in the foreground, and displays the second power information in the second operating system; wherein the second power information is obtained based on the updated battery power information obtained by the power measurement component.
18. An electronic device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the computer program is executed by the processor, the processor executes the steps of the power display method according to any one of claims 1 to 16.
19. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the power display method according to any one of claims 1 to 16 are implemented.
20. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the power display method described in any one of claims 1 to 16 are implemented.
Citation Information
Patent Citations
Method and system for measuring remaining capacity of a battery with open circuit voltage detection
CN101008667A
Battery parameter calibrating device and method
CN105182247A
Application starting method and device, storage medium and electronic equipment
CN112988256A
Electric quantity display method and device, storage medium and terminal equipment
CN115220983A
Electronic equipment data processing method and device, electronic equipment and storage medium
CN115617411A
