Electric quantity display method and electronic equipment

By storing battery-related data before upgrading the fuel gauge firmware and calculating the power level based on the backup data, the problem of fluctuating power levels caused by the fuel gauge firmware upgrade was solved, and the power level display efficiency after the fuel gauge firmware upgrade was improved.

CN121807326APending Publication Date: 2026-04-07HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

During software upgrades of electronic devices, firmware upgrades to the fuel gauge can cause significant fluctuations in fuel level, impacting user experience.

Method used

Before upgrading the fuel gauge firmware, a backup of the battery-related data is stored, and the battery level calculated based on the backup data is displayed on the screen to ensure the continuity of battery level before and after the firmware upgrade.

Benefits of technology

This avoids noticeable jumps in battery level during fuel gauge firmware upgrades and improves the efficiency of displaying battery level calculation after firmware upgrades.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121807326A_ABST
    Figure CN121807326A_ABST
Patent Text Reader

Abstract

The invention provides an electric quantity display method and electronic equipment, and relates to the technical field of terminals. The method comprises the steps that the electronic equipment displays first display electric quantity of the electronic equipment on a display screen, and under the condition that it is determined that firmware upgrading needs to be carried out on the voltameter, the electronic equipment can touch backup data (including the first display electric quantity) of related data of a storage battery of the voltameter and then carry out firmware upgrading. And displaying the second display electric quantity based on the end of the firmware upgrade of the voltameter. The second display electric quantity is calculated by the voltameter according to the backup data. On one hand, the backup data cannot be lost in the firmware upgrading process of the voltameter, and on the other hand, after the firmware upgrading of the voltameter is completed, the voltameter can directly read the backup data from the voltameter and calculate and display the electric quantity based on the backup data. Not only can the display electric quantity of the electronic equipment be prevented from obvious electric quantity jump before and after firmware upgrade of the voltameter, but also the efficiency of obtaining the display electric quantity by the voltameter can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of terminal, and in particular, to a power display method and electronic device. BACKGROUND

[0002] During the software upgrading process of the electronic device, the hardware modules including the power meter may also be upgraded with corresponding firmware. The power meter firmware upgrading process has the problem of obvious power jump, which affects the user experience when using the electronic device. SUMMARY

[0003] The present application provides a power display method and electronic device, which can avoid the obvious power jump of the power when the power meter firmware is upgraded, and improve the efficiency of obtaining and displaying the power after the power meter firmware is upgraded.

[0004] To achieve the above object, the present application adopts the following technical solutions:

[0005] In a first aspect, a power display method is provided, which is applied to an electronic device. The electronic device includes a power meter, a battery and a display screen, and the power meter is connected with the battery and the display screen. The method includes: the electronic device displays a first display power of the electronic device on the display screen; in a case where it is determined that the power meter needs to be upgraded with firmware, the electronic device can trigger the power meter to store backup data of the related data of the battery before upgrading the firmware, and based on the end of the power meter firmware upgrading, the electronic device can display a second display power on the display screen. The backup data includes the first display power, and the second display power is calculated by the power meter according to the stored backup data.

[0006] In the power display method provided by the present application, when the electronic device determines that the power meter needs to be upgraded with firmware, the electronic device can trigger the power meter to store backup data of the related data of the battery before upgrading the firmware. In this way, on the one hand, the backup data will not be lost during the power meter firmware upgrading process; on the other hand, after the power meter firmware upgrading is completed, the power meter can directly read the backup data from the power meter and calculate the display power based on the backup data, which not only can make the display power of the electronic device not have obvious power jump before and after the power meter firmware upgrading, but also can improve the efficiency of obtaining the backup data, thereby improving the efficiency of the power meter in calculating the display power after the power meter firmware upgrading.

[0007] In a possible implementation manner of the first aspect, the electronic device can further include a processor, and the processor is connected with the power meter. The above-mentioned triggering the power meter to store the backup data of the related data of the battery before upgrading the firmware in the case where it is determined that the power meter needs to be upgraded with firmware includes:

[0008] In response to the software upgrade of the electronic device including the firmware upgrade of the battery gauge, and the current firmware version of the battery gauge being lower than the firmware version to be upgraded, the processor sends a firmware upgrade instruction to the battery gauge. The battery gauge, in response to the firmware upgrade instruction, backs up the related data of the battery to obtain backup data, and stores the backup data. The processor sends the firmware data to be upgraded and an upgrade end instruction to the battery gauge. The battery gauge, in response to the upgrade end instruction, performs the firmware upgrade based on the firmware data to be upgraded. The firmware upgrade instruction is used to instruct the battery gauge to perform the firmware upgrade, and the upgrade end instruction is used to instruct the end of the sending of the firmware data to be upgraded.

[0009] In a possible implementation manner of the first aspect, the backup data of the related data of the battery stored by the battery gauge includes: after the battery gauge backs up the related data of the battery to obtain the backup data, the battery gauge stores the backup data in a backup area of the battery gauge. The backup area and a firmware area of the battery gauge are two independent storage areas, and the firmware area is used to store firmware data of the battery gauge. In this way, the backup data in the backup area and the firmware data in the firmware area are independent of each other. Therefore, when the battery gauge updates the firmware data in the firmware area, the backup data in the backup area is not affected; or when the battery gauge deletes the backup data in the backup area, the firmware data in the firmware area is not affected.

[0010] In a possible implementation manner of the first aspect, the battery gauge displays the battery capacity includes: after the battery gauge stores the backup data, the battery gauge restarts and is in an upgrade mode. The battery gauge performs the firmware upgrade based on the firmware data to be upgraded includes: in the upgrade mode, the battery gauge performs the firmware upgrade based on the firmware data to be upgraded.

[0011] In a possible implementation manner of the first aspect, the backup data further includes: a discharge depth of the battery before the firmware upgrade of the battery gauge, and a battery chemical capacity. The battery gauge calculates the second display capacity according to the stored backup data includes:

[0012] The battery gauge takes the discharge depth in the backup data as a first discharge depth after the firmware upgrade of the battery gauge, and takes the battery chemical capacity in the backup data as a first battery chemical capacity after the firmware upgrade of the battery gauge. The battery gauge obtains a first battery remaining capacity after the firmware upgrade of the battery gauge according to the first discharge depth and the first battery chemical capacity, and obtains a first battery full-charge capacity after the firmware upgrade of the battery gauge according to the first discharge depth. The battery gauge determines a first capacity percentage as a ratio of the first battery remaining capacity to the first battery full-charge capacity. The battery gauge calculates the second display capacity according to the first capacity percentage, the first display capacity, and the battery state.

[0013] In a possible implementation of the first aspect, the power gauge calculates the second display power according to the first power percentage, the first display power and the battery state, including: the power gauge takes the first display power as the second power percentage of the power gauge at the last time; in a case where an absolute value of a difference between the first power percentage and the second power percentage is greater than a first threshold, that is, the power percentage has a significant power jump phenomenon, the power gauge determines a target linear equation between the display power and the power percentage based on the battery state; and the power gauge substitutes the second power percentage into the target linear equation to obtain the second display power.

[0014] In the present application, once the power gauge detects that the power percentage has a power jump, the power gauge reacquires the corresponding target linear equation, thereby ensuring that the power percentage and the display power always maintain a corresponding linear relationship. In this way, it can be ensured that the display power reported by the power gauge always maintains linear change, thereby avoiding a significant jump phenomenon.

[0015] In a possible implementation of the first aspect, the battery state is a discharging state, and in the discharging state, the target linear equation is a first target linear equation. The power gauge determines the target linear equation between the display power and the power percentage based on the battery state, including: the power gauge determines, based on the battery being in the discharging state, a linear equation passing through a coordinate corresponding to the first power percentage and an origin coordinate as the first target linear equation. The horizontal coordinate in the coordinate corresponding to the first power percentage is the first power percentage, and the vertical coordinate in the coordinate corresponding to the first power percentage is the display power corresponding to the first power percentage.

[0016] In a possible implementation of the first aspect, the battery state is a charging state, and in the charging state, the target linear equation is a second target linear equation. The power gauge determines the target linear equation between the display power and the power percentage based on the battery state, including: the power gauge determines, based on the battery being in the charging state, a linear equation passing through a coordinate corresponding to the first power percentage and a full-charge coordinate as the second target linear equation. The full-charge coordinate refers to a coordinate when the power percentage is full power and the display power is full power, the horizontal coordinate in the coordinate corresponding to the first power percentage is the first power percentage, and the vertical coordinate in the coordinate corresponding to the first power percentage is the display power corresponding to the first power percentage.

[0017] In a possible implementation of the first aspect, after taking the first display power as the second power percentage of the power gauge at the last time, the power display method further includes: in a case where an absolute value of a difference between the first power percentage and the second power percentage is less than the first threshold, the power gauge substitutes the second power percentage into an initial linear equation between the display power and the power percentage to obtain the second display power.

[0018] In a possible implementation form of the first aspect, the second display power is displayed on the display screen based on the end of the power gauge firmware upgrade, and the backup data is valid, comprising: the second display power is calculated by the power gauge based on the stored valid backup data. In this way, the problem of significant jump of the power gauge during the power gauge firmware upgrade can be further avoided.

[0019] In a possible implementation form of the first aspect, the backup data is stored in correspondence with the check code. The power gauge determines that the backup data is valid, comprising: in a case that the check code read from the backup area of the power gauge is a preset check code, the power gauge determines that the backup data is valid.

[0020] In a possible implementation form of the first aspect, after the end of the power gauge firmware upgrade and before the second display power is displayed on the display screen, the power display method further comprises: the power gauge is restarted and in the user mode. The second display power is displayed on the display screen, comprising: in the user mode, the power gauge monitors the battery and calculates the second display power of the battery, and the second display power is displayed on the display screen.

[0021] In a second aspect, the present application provides an electronic device, comprising a display screen, a battery, a memory and a power gauge, the power gauge being connected with the display screen, the battery and the memory. The display screen is used for displaying a display power. The memory stores computer program codes, the computer program codes comprising instructions. When the power gauge executes the instructions, the electronic device executes the method of the first aspect and any possible implementation form thereof.

[0022] In a third aspect, a computer readable storage medium is provided, the computer readable storage medium storing instructions, when the instructions are run on an electronic device, the electronic device can execute the method of any one of the first aspect.

[0023] In a fourth aspect, a computer program product is provided, the computer program product comprising instructions, when the instructions are run on an electronic device, the electronic device can execute the method of any one of the first aspect.

[0024] In a fifth aspect, a chip system is provided, the chip system comprising a processor, used for supporting the electronic device to implement the functions involved in the first aspect and any implementation form thereof. In a possible design, the electronic device further comprises an interface circuit, which can be used to receive signals from other devices (for example, a memory) or send signals to other devices (for example, a communication interface). The chip system can comprise a chip, and can also comprise other discrete devices.

[0025] It can be understood that the electronic device provided in the second aspect, the computer readable storage medium provided in the third aspect, the computer program product provided in the fourth aspect, and the chip system provided in the fifth aspect can achieve the beneficial effects of the first aspect and any possible implementation manner thereof, which will not be described herein. BRIEF DESCRIPTION OF DRAWINGS

[0026] Figure 1 FIG. 1 is a schematic diagram of the relationship between the displayed power and the power percentage of a battery in an embodiment;

[0027] Figure 2 FIG. 2 is another schematic diagram of the relationship between the displayed power and the power percentage of a battery in an embodiment;

[0028] Figure 3 FIG. 3 is a schematic diagram of a display interface of a mobile phone provided in an embodiment;

[0029] Figure 4 FIG. 4 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment;

[0030] Figure 5 FIG. 5 is a schematic diagram of the software architecture of an electronic device provided in an embodiment;

[0031] Figure 6 FIG. 6 is a schematic diagram of a power display method provided in an embodiment;

[0032] Figure 7 FIG. 7 is a schematic diagram of the structure of a storage area of a power meter provided in an embodiment;

[0033] Figure 8 FIG. 8 is a schematic diagram of a first target linear equation provided in an embodiment;

[0034] Figure 9 FIG. 9 is a schematic diagram of a second target linear equation provided in an embodiment;

[0035] Figure 10 FIG. 10 is a schematic diagram of the interface display of a mobile phone provided in an embodiment;

[0036] Figure 11 FIG. 11 is another schematic diagram of a power display method provided in an embodiment;

[0037] Figure 12 FIG. 12 is a schematic diagram of the structure of a chip system provided in an embodiment. DETAILED DESCRIPTION

[0038] The terms “first”, “second”, and the like used in the embodiments of the present application are only used for the purpose of distinguishing the same type of features, and cannot be understood as indicating relative importance, quantity, order, and the like.

[0039] The term "exemplary" or "for example" is used herein to mean an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "for example" should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the exemplary or for example embodiments are presented so as to enable a clear and concise disclosure of the disclosure.

[0040] The term "coupled" or "connected" is used herein to express a broad connection between two or more components, for example, a direct connection, or an indirect connection via an electronic device, such as a resistor, an inductor, a capacitor, or other electronic device.

[0041] First, some concepts related to the embodiments of the present application are introduced:

[0042] 1. Electric quantity jump: In the process of using an electronic device, the battery power of the electronic device suddenly changes, such as from full power to low power, or from low power to full power.

[0043] 2. Electric quantity meter: a device designed according to Faraday's law for monitoring and calculating the electric quantity of a battery. For example, the electric quantity meter can calculate the remaining capacity (RM) of the battery, the full charge capacity (FCC) of the battery, and the relative state of charge (RSOC) of the battery. In this paper, the relative state of charge of the battery can be referred to as the battery power percentage.

[0044] 3. Electric quantity meter firmware: the software algorithm inside the electric quantity meter, including the electric quantity algorithm and parameters. The parameters can include the remaining capacity RM of the battery, the full charge capacity FCC of the battery, the battery power percentage RSOC, and the voltage and current of the battery. In this paper, the electric quantity meter firmware upgrade mainly refers to updating the electric quantity algorithm inside the electric quantity meter. The electric quantity meter can calculate the battery power percentage and display the electric quantity through the electric quantity algorithm.

[0045] At present, electronic devices powered by batteries generally use electric quantity meters to monitor and calculate the electric quantity of the battery. Specifically, the electric quantity meter can determine the ratio between the remaining capacity RM of the battery and the full charge capacity FCC of the battery as the battery power percentage. As can be seen, the battery power percentage will be affected by the remaining capacity of the battery.

[0046] The power gauge can also calculate the display power of the battery based on the power percentage of the battery, and report the display power of the battery to a display module (such as a display screen) to display the display power of the battery on a user interface (UI) of the electronic device, so as to facilitate the user to understand the power of the electronic device. Specifically, there is a linear relationship between the power percentage and the display power, and the display power at each moment is calculated according to the power percentage at the previous moment.

[0047] Figure 1 A schematic diagram of the relationship between the display power and the power percentage of the battery in an embodiment is shown.

[0048] In an embodiment, as shown in Figure 1 Due to at least one factor such as external environment change (such as sudden change of ambient temperature), power gauge monitoring error, etc., there is a certain error between the remaining capacity calculated by the power gauge at the current moment and the remaining capacity at the previous moment, thereby causing a certain error between the power percentage calculated by the power gauge at the current moment and the power percentage at the previous moment.

[0049] When the error between the power percentages of adjacent moments is greater than the error threshold, the power percentage will appear obvious power jump. Since the display power changes with the change of the power percentage, when the power percentage appears obvious power jump, the display power will also appear obvious power jump. In order to avoid the display power from appearing obvious power jump, the power gauge can make the display power keep linear change through the built-in power algorithm during the continuous use of the electronic device, whether the battery is in discharging state or charging state, so that the display power will not appear obvious jump phenomenon.

[0050] Currently, in the software upgrading process of an electronic device, the hardware modules in the electronic device, including the power gauge, can also be upgraded with corresponding firmware. The firmware upgrading of the power gauge includes updating the power algorithm in the power gauge, and the power gauge will restart after the firmware upgrading is completed, which will cause the data such as the display power and the power percentage before the firmware upgrading of the power gauge to be lost. Thus, after the firmware upgrading of the power gauge is completed, the power gauge will recalculate the power percentage based on the upgraded firmware (such as the updated power algorithm) and the relevant parameters monitored after the upgrading, that is, obtain the power percentage after the firmware upgrading of the power gauge, and replace the display power after the firmware upgrading of the power gauge with the power percentage after the firmware upgrading of the power gauge. Since the power percentage after the firmware upgrading of the power gauge is recalculated, there is a large change between the power percentages before and after the firmware upgrading of the power gauge, that is, the power percentages before and after the firmware upgrading of the power gauge have obvious power jumps. At this time, replacing the display power after the firmware upgrading of the power gauge with the power percentage after the firmware upgrading of the power gauge will cause a large change between the display powers before and after the firmware upgrading of the power gauge, that is, the display power of the battery has obvious power jumps.

[0051] Figure 2 A second schematic diagram of the relationship between the display power and the power percentage of the battery in an embodiment is shown.

[0052] In an embodiment, as shown in Figure 2 For example, in the case that the electronic device is in a discharging state after the firmware upgrading of the power gauge, the display power has a large change, that is, the display power has obvious power jumps. The obvious power jumps of the display power will affect the experience of the user when using the electronic device, especially at the critical moment of the power of the electronic device (such as when the user uses the electronic device to perform an important task).

[0053] The electronic device referred to in this paper can be called terminal, user equipment (UE), mobile station (MS), mobile terminal (MT), etc., which includes a battery and a power meter. The electronic device can be a mobile phone, a smart TV, a wearable device, a tablet computer (Pad), a computer with wireless transceiver function, a virtual reality (VR) device, an augmented reality (AR) device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, or a wireless terminal in smart home, etc.

[0054] For ease of understanding, the following takes the electronic device as a mobile phone as an example, combined with the following Figure 3 The display power jump is introduced as follows:

[0055] Figure 3 A display interface schematic diagram of the mobile phone provided by an embodiment is shown.

[0056] In an embodiment, as shown in A of Figure 3 , the mobile phone 100 displays a first interface 110 before software upgrading. The first interface 110 includes a first time 111 and a first power icon 112. The first power icon 112 is used to display that the display power of the battery of the mobile phone 100 is 90% at the first time 8:00.

[0057] As shown in B of Figure 3 , the mobile phone 100 displays a second interface 120 after software upgrading. The second interface 120 includes a second time 121 and a second power icon 122. The second power icon 122 is used to display that the display power of the battery of the mobile phone 100 is 84% at the second time 8:03.

[0058] As can be seen, the display power of the mobile phone 100 before software upgrading is 90%, and the display power jump of the mobile phone 100 after software upgrading is 84%, that is, the change of the display power of the battery is 6%, which will make the user experience the power jump obviously, resulting in poor user experience.

[0059] To this end, the embodiments of the present application provide a power display method and an electronic device. Specifically, in the case where the electronic device determines that the firmware of the power meter needs to be upgraded, the electronic device can trigger the power meter to perform the firmware upgrade after storing backup data of the related data of the battery. In this way, on the one hand, the backup data will not be lost during the firmware upgrade of the power meter, and after the firmware upgrade of the power meter is completed, the power meter can directly read the backup data from the power meter and calculate and display the power based on the backup data, so that the displayed power of the electronic device will not have an obvious power jump before and after the firmware upgrade of the power meter. For example, the displayed power before the firmware upgrade of the power meter is 90%, and the displayed power after the firmware upgrade of the power meter is still 90%, or the displayed power after the firmware upgrade of the power meter is 89% or other values close to 90%.

[0060] On the other hand, in the embodiments of the present application, since the backup data is directly stored in the power meter, after the firmware upgrade of the power meter is completed, the power meter can directly read the backup data from the power meter, which can improve the efficiency of obtaining the backup data and thus improve the efficiency of the power meter in calculating and displaying the power after the firmware upgrade of the power meter.

[0061] Figure 4 A hardware structure schematic diagram of an electronic device provided by the embodiments of the present application is shown. The following describes the hardware structure of the electronic device in combination with the hardware structure schematic diagram. Figure 4 The hardware structure of the electronic device is introduced.

[0062] Taking the electronic device as a mobile phone for example. As shown in the figure, Figure 4 the electronic device 400 can include a processor 410, a memory 420, a display screen 430, a sensor module 440, a power management module 450, a power meter 451, a battery 460, a charging management module 470, a universal serial bus (USB) interface 480, a camera 490, an audio module 491, a communication module 492, and an antenna, etc.

[0063] The processor 410 can include one or more processing units, for example: the processor 410 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, an audio data signal processor (ADSP), and / or a neural-network processing unit (NPU), etc. Among them, different processing units can be independent devices, or can be integrated in one or more processors. The controller can be the nerve center and command center of the electronic device 400. The controller can generate operation control signals according to instruction operation codes and timing signals, complete the control of fetching instructions and executing instructions.

[0064] In the embodiment of the application, the processor 410 is connected with the battery gauge 451, and the processor 410 and the battery gauge 451 communicate through an inter-integrated circuit bus (I2C) protocol. When the electronic device 400 is upgraded in software, if the processor 410 determines that the firmware of the battery gauge 451 needs to be upgraded, the processor 410 can send a firmware upgrade instruction to the battery gauge 451 to instruct the battery gauge 451 to perform firmware upgrade. After the battery gauge 451 receives the firmware upgrade instruction, the battery gauge 451 can back up the related data of the battery to obtain backup data, store the backup data in a specific storage area of the battery gauge 451, restart and enter an upgrade mode. Storing the backup data of the related data of the battery in the specific storage area can prevent the related data from being lost during the process of upgrading the firmware of the battery gauge 451, thereby avoiding the battery gauge from reacquiring the related data after the firmware upgrade is completed, and further avoiding the battery gauge from displaying a significant jump in the battery level after the firmware upgrade is completed.

[0065] The processor 410 is further configured to write the to-be-upgraded firmware data into the battery gauge 451, so that the battery gauge 451 performs firmware upgrade based on the to-be-upgraded firmware data.

[0066] In an example, the processor 410 can write the to-be-upgraded firmware data into the battery gauge 451 after a first time length after sending the firmware upgrade instruction to the battery gauge 451. In this way, time can be saved, the communication efficiency between the processor and the battery gauge can be improved, and thus the firmware upgrade efficiency of the battery gauge can be improved.

[0067] In another example, the processor 410 can write the firmware data to be upgraded to the fuel gauge 451 again after determining that the fuel gauge 451 is in the upgrade mode. In this way, unnecessary communication between the processor 410 and the fuel gauge 451 can be avoided, and it can be ensured that the fuel gauge 451 firmware upgrade can be carried out smoothly.

[0068] The memory 420 can be used to store computer executable program codes, which include instructions. The processor 410 performs various functional applications and data processing of the electronic device by running the instructions stored in the memory 420. The memory 420 can include a program storage area and a data storage area. The program storage area can store an operating system and at least one application program required by a function (such as a sound playing function, an interface display function, etc.). The data storage area can store data created during use of the electronic device (such as a notification message) and the like. In addition, the memory 420 can include a high-speed random access memory, and can also include a non-volatile memory such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (UFS), etc.

[0069] The electronic device 400 implements a display function through a GPU, a display screen 430, and an application processor, etc. The GPU is a microprocessor for image processing, connected to the display screen 430 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 410 can include one or more GPUs that execute program instructions to generate or change display information.

[0070] The display screen 430 is used to display images, videos, etc. The display screen 430 includes a display panel. The display panel can adopt a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Mini-LED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc.

[0071] In the embodiments of the present application, the display screen 430 can display a UI interface, and the UI interface can include a power icon (such as the first power icon and the second power icon referred to herein), to facilitate the user to understand the power of the electronic device.

[0072] The sensor module 440 can include a pressure sensor, a gyro sensor, a barometric pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, and a bone conduction sensor, etc.

[0073] The charging management module 470 is configured to receive charging input from a charger. In some embodiments of wired charging, the charging management module 470 can receive charging input from a wired charger through the USB interface 480. In some embodiments of wireless charging, the charging management module 470 can receive wireless charging input through a wireless charging coil of the electronic device 400. The charging management module 470 can supply power to the electronic device while charging the battery 460 through the power management module 450.

[0074] The power management module 450 receives input from the battery 460 and / or the charging management module 470 to supply power to the processor 410, the memory 420, the display screen 430, etc.

[0075] In some embodiments, the power gauge 451 can be integrated in the power management module 450, and in other embodiments, the power gauge 451 and the power management module 450 can be two separate modules. Figure 4 The power gauge 451 is integrated in the power management module 450 as an example. The power gauge 451 and the processor 410 are two independent devices, i.e., the power gauge in the embodiments of the present application is an external power gauge. In addition, the power gauge 451 has a continuous storage function. For example, the power gauge 451 can include a read-only memory.

[0076] In the embodiments of the present application, when the power gauge 451 receives the firmware upgrade instruction sent by the processor 410, the backup operation of the related data of the battery is independently completed by the power gauge 451. In this way, the backup data of the related data is still stored in the power gauge 451, and when the power gauge 451 completes the firmware upgrade, the backup data can be directly read from the power gauge. In this way, the efficiency of the power gauge 451 to obtain the backup data is improved, so that the efficiency of the power gauge 451 to obtain the display power after the power gauge firmware upgrade can be improved, and the obvious power jump of the display power caused by the power gauge firmware upgrade can be avoided.

[0077] The camera 490 is configured to capture still images or videos. The audio module 491 is configured to convert digital audio information into analog audio signals, convert analog audio input into digital audio signals, and encode and decode audio signals. The communication module 492 can provide solutions for wireless communication, including wireless local area networks (WLAN), Bluetooth (BT), and the like, which are applied to the electronic device 400.

[0078] It can be understood that the structure illustrated in the embodiments does not constitute a specific limitation on the electronic device 400. In other embodiments, the electronic device 400 can include more or fewer components than illustrated, or combine certain components, or split certain components, or different arrangement of components. The illustrated components can be implemented in hardware, software, or a combination of software and hardware.

[0079] Generally, the implementation of the power display function in the electronic device requires not only hardware support but also software cooperation. The software system of the electronic device can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. The embodiments of the present application take the layered architecture of the Android operating system For example, in combination with Figure 5 The software architecture of the electronic device related to the embodiments of the present application is introduced.

[0080] Figure 5 A software architecture diagram of an electronic device provided by the embodiments of the present application is shown.

[0081] As Figure 5 shown, the layered architecture divides the software into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In an embodiment, the Android operating system is divided into three layers, from top to bottom: the application (APP) layer, the application framework (AF) layer, and the kernel layer.

[0082] The application layer can include a series of application packages. As Figure 5 shown, the application package can include a power display UI and an upgrade service.

[0083] The upgrade service can store an upgrade program of the electronic device. The upgrade program of the electronic device is used to upgrade the software of the electronic device. During the software upgrade process, the hardware modules including the power gauge can also be upgraded. Therefore, during the running of the upgrade service, the power gauge firmware can be upgraded by triggering the relevant modules (such as ADSP and power gauge firmware) in the kernel layer through the application framework.

[0084] The power display UI is used to display the power on the display screen of the electronic device, so that the user can obtain the power information of the electronic device.

[0085] The application framework layer can provide the application program of the application layer with an application programming interface (API) and a programming framework.

[0086] The kernel layer is a layer between hardware and software. The kernel layer includes various drivers such as power gauge driver and display screen driver, and modules such as power gauge firmware and ADSP.

[0087] The power gauge driver can be used to drive the power gauge to work, so as to monitor the relevant data and state of the battery. The display screen driver can be used to drive the display screen to display different display interfaces. The power gauge firmware includes firmware data, which can include program code corresponding to the power algorithm. The power gauge firmware is also used to update the firmware data based on the to-be-updated firmware data, that is, the power gauge firmware updates the power algorithm stored in the power gauge firmware based on the program code of the to-be-updated power algorithm. The ADSP is used to determine that the current firmware version of the power gauge is lower than the to-be-upgraded firmware version during the upgrade process of the electronic device, obtain the to-be-upgraded firmware data from the upgrade service, and send the to-be-upgraded firmware data to the power gauge firmware.

[0088] It should be noted that, Figure 5 The layers in the software structure and the components included in each layer shown do not constitute a specific limitation on the electronic device. In other embodiments, the electronic device can include more layers than shown. Each layer can include more or fewer components than shown. In addition, the above-mentioned various functional modules can be combined into one functional module, and the various layers can be combined into one layer.

[0089] It can be understood that, in order to implement the method in the embodiments of the present application, the electronic device comprises hardware and / or software modules corresponding to the execution of each function. The algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is implemented in hardware or computer software driven hardware depends on the specific application of the technical solution and the design constraints. Those skilled in the art can use different methods to implement the described functions for each specific application in conjunction with the embodiments.

[0090] The following describes the power display method provided by the embodiments of the present application in conjunction with the related modules in the software architecture shown in the figures. Figure 6-10 The execution subject is Figure 5 The power display method provided by the embodiments of the present application is introduced by taking the related modules in the software architecture shown in the figures as examples.

[0091] Figure 6 One of the flow diagrams of the power display method provided by the embodiments of the present application is shown. As Figure 6 shown, in one embodiment, the method can include:

[0092] S601, the display screen displays a first display power.

[0093] The first display power refers to the display power shown on the user interface of the electronic device before software upgrade.

[0094] For example, as shown in A in Figure 3 , the first display power is the display power 90% corresponding to the first power icon 112.

[0095] S602, based on the firmware upgrade of the power meter included in the software upgrade of the electronic device, the processor sends a firmware version query instruction to the power meter.

[0096] The firmware version query instruction is used to instruct the power meter to send the version number of the current firmware version of the power meter to the processor, so that the processor obtains the version number of the current firmware version of the power meter.

[0097] In one embodiment, the software upgrade of the electronic device can include at least one of software program upgrade and hardware firmware upgrade. When the electronic device needs to be upgraded, the processor can obtain the version number of the software program to be upgraded or the version number of the hardware firmware from the server or other devices. In the case where the software upgrade of the electronic device includes hardware firmware upgrade (such as power meter firmware upgrade), the processor can obtain the version number of the firmware to be upgraded of the power meter.

[0098] In an embodiment, during the process of upgrading the firmware of the battery gauge, the processor and the battery gauge can communicate with each other through an inter-integrated circuit bus (I2C) protocol to transmit corresponding data between the processor and the battery gauge. For example, the processor sends a firmware version query instruction to the battery gauge. During the communication between the processor and the battery gauge, the processor serves as a master device and the battery gauge serves as a slave device.

[0099] S603. The battery gauge sends a version number of the current firmware version of the battery gauge to the processor.

[0100] After receiving the firmware version query instruction, the battery gauge sends the version number of the current firmware version to the processor, so that the processor determines whether the firmware version to be upgraded is higher than the current firmware version of the battery gauge, and thus determines whether the battery gauge needs to upgrade the firmware.

[0101] S604. The processor sends a firmware upgrade instruction to the battery gauge based on the version number of the current firmware version being lower than the version number of the firmware version to be upgraded.

[0102] When the processor determines that the version number of the firmware version to be upgraded is higher than the version number of the current firmware version of the battery gauge, i.e., the processor determines that the firmware version to be upgraded is higher than the current firmware version of the battery gauge, the processor determines that the battery gauge needs to upgrade the firmware. When the processor determines that the version number of the firmware version to be upgraded is lower than the version number of the current firmware version of the battery gauge, or the version number of the firmware version to be upgraded is the same as the version number of the current firmware version of the battery gauge, i.e., the processor determines that the firmware version to be upgraded is lower than the current firmware version of the battery gauge, or the firmware version to be upgraded is the same as the current firmware version, the processor determines that the battery gauge does not need to upgrade the firmware.

[0103] In an embodiment, the version number can be represented by a number. The larger the number corresponding to the version number, the higher the version. The smaller the number corresponding to the version number, the lower the version.

[0104] For example, it is assumed that the version number of the firmware version to be upgraded is 2.0 and the version number of the current firmware version is 1.0. Since 2.0 is greater than 1.0, the current firmware version is lower than the firmware version to be upgraded. Therefore, the processor can determine that the battery gauge needs to upgrade the firmware, and thus the processor sends a firmware upgrade instruction to the battery gauge.

[0105] The firmware upgrade instruction is used to instruct the battery gauge to upgrade the firmware.

[0106] It should be understood that if the processor determines that the current firmware version is higher than the firmware version to be upgraded, or the current firmware version is the same as the firmware version to be upgraded, the battery gauge and the processor no longer perform the following steps.

[0107] S605, the power gauge receives the firmware upgrade instruction, in response to the firmware upgrade instruction, backs up the related data of the battery to obtain backup data, and stores the backup data in a specific storage area of the power gauge.

[0108] In an embodiment, the related data of the battery can include: the discharge depth of the battery before the power gauge firmware upgrade, the battery chemical capacity, the displayed power (i.e., the first displayed power), and the like. Based on this, the backup data can include: the discharge depth of the battery before the power gauge firmware upgrade, the battery chemical capacity, the displayed power, and the like.

[0109] In other embodiments, the related data of the battery can also include: the full charge capacity of the battery, and the like. Based on this, the backup data can also include: the full charge capacity of the battery before the power gauge firmware upgrade, and the like.

[0110] In an embodiment, the specific storage area of the power gauge is non-volatile, and therefore, storing the backup data in the specific storage area of the power gauge can avoid the loss of the backup data during the power gauge firmware upgrade. For example, the specific storage area of the power gauge can be a read-only memory (ROM) of the power gauge. The structure of the ROM will be described below in conjunction with Figure 7 The structure of the ROM is introduced.

[0111] Figure 7 The structure of the specific storage area of the power gauge provided in an embodiment of the present application is shown.

[0112] In an embodiment, as shown in Figure 7 The ROM of the power gauge can include a plurality of mutually independent storage areas (such as sector-shaped storage areas, which can be referred to as sectors), and the size of each sector 700 can be the same or different, which is not limited herein. Figure 7 The sectors in the ROM of the power gauge are shown as rectangular areas in

[0113] The power gauge stores the backup data in a specific storage area of the power gauge refers to that the power gauge stores the backup data in a specific sector of the ROM of the power gauge, which can be referred to as a backup sector 710 (the backup sector can also be referred to as a backup area). The backup sector 710 and the firmware sector 720 (the firmware sector can also be referred to as a firmware area) used to store firmware data are two independent sectors. In this way, the backup data in the backup sector and the firmware data in the firmware sector can not interfere with each other. Therefore, when the power gauge updates the firmware data in the firmware sector, the backup data in the backup sector will not be affected; or when the power gauge deletes the backup data in the backup sector, the firmware data in the firmware sector will not be affected.

[0114] The structure of one backup sector can include two parts, the first part is used to store a check code (may be referred to as a magic word), and the second part is used to store backup data. The second part can include a plurality of fields, and one field is used to store one of the backup data. For example, the second part of one backup sector can include: the discharge depth of the battery before the power gauge firmware upgrade, the battery chemical capacity of the battery before the power gauge firmware upgrade, and the like.

[0115] For example, the structure of one backup sector can be as shown in Table 1:

[0116] Table 1

[0117]

[0118] In an embodiment, the working mode of the power gauge can include: a user mode (may be referred to as a normal working mode) and an upgrade mode (may be referred to as an in-system programming (ISP) mode).

[0119] In the user mode, the power gauge is used to monitor and report the battery status, so as to provide the electronic device with data about the battery health, safety diagnosis, and other data reflecting the battery performance. Generally, the power gauge is in the user mode most of the time.

[0120] In the upgrade mode, the processor can write the updated firmware data, i.e., the to-be-upgraded firmware data, to the power gauge, so as to upgrade the firmware of the power gauge.

[0121] In an embodiment, after the power gauge receives the firmware upgrade instruction and executes the firmware upgrade instruction, the power gauge also restarts and selects the upgrade mode, so that the power gauge is in the upgrade mode. In this way, the power gauge can receive the to-be-upgraded firmware data sent by the processor in the upgrade mode, and perform the firmware upgrade based on the to-be-upgraded firmware data.

[0122] According to the nature of the specific storage area of the power gauge, after the backup data is stored in the specific storage area of the power gauge, the backup data will not be lost even if the power gauge is restarted. Therefore, in this embodiment, the power gauge restarts after the backup data is stored in the specific storage area of the power gauge, so as to avoid the loss of the related data of the battery and achieve the backup purpose.

[0123] S606, the processor writes the to-be-upgraded firmware data to the power gauge.

[0124] In an embodiment, when the processor determines that the power gauge needs to be upgraded, the processor can obtain the to-be-upgraded firmware data of the power gauge from a server or other device. For example, the to-be-upgraded firmware data can include the program code of the power algorithm to be updated in the power gauge.

[0125] In an embodiment, the writing of the to-be-upgraded firmware data by the processor to the fuel gauge refers to that the processor sends the to-be-upgraded firmware data to the fuel gauge through the I2C communication protocol, so as to update the firmware data of the fuel gauge. The writing of the to-be-upgraded firmware data by the processor to the fuel gauge can include the following cases:

[0126] In an example, the processor can write the to-be-upgraded firmware data to the fuel gauge after a first time duration from sending the firmware upgrade instruction to the fuel gauge, so as to update the firmware data in the firmware area of the fuel gauge and perform the firmware upgrade.

[0127] Generally, within the first time duration after the fuel gauge receives the firmware upgrade instruction sent by the processor, the fuel gauge can execute the firmware upgrade instruction, for example, the fuel gauge can backup the related data of the battery to obtain backup data and store the backup data in a specific storage area of the fuel gauge, and for another example, the fuel gauge can also restart and select the upgrade mode, so that the fuel gauge is in the upgrade mode. Therefore, the processor can write the to-be-upgraded firmware data to the fuel gauge directly after the first time duration from sending the firmware upgrade instruction to the fuel gauge. In this way, time can be saved, the communication efficiency between the processor and the fuel gauge can be improved, and the firmware upgrade efficiency of the fuel gauge can be improved.

[0128] It should be understood that the first time duration is related to at least the time duration required for the fuel gauge to execute the firmware upgrade instruction, and therefore the first time duration corresponding to different fuel gauges can be different.

[0129] In another example, the processor can write the to-be-upgraded firmware data to the fuel gauge after sending the firmware upgrade instruction to the fuel gauge and determining that the fuel gauge has executed the firmware upgrade instruction. In this way, unnecessary communication between the processor and the fuel gauge can be avoided, and it can be ensured that the firmware upgrade of the fuel gauge can be carried out smoothly.

[0130] For example, the processor can send a status query instruction to the power meter after a second time duration from sending the firmware upgrade instruction to the power meter. The status query instruction is used to query whether the power meter has executed the firmware upgrade instruction. For example, the status query instruction can be used to query whether the power meter has stored the backup data in the specific storage area of the power meter. For another example, the status query instruction can be used to query whether the power meter is in the upgrade mode after the restart. After receiving the status query instruction, the power meter feeds back the current status of the power meter to the processor. In this way, when the processor determines that the power meter has stored the backup data in the specific storage area of the power meter, or has been in the upgrade mode after the restart, the processor writes the to-be-upgraded firmware data to the power meter. However, when the processor determines that the power meter has not stored the backup data in the specific storage area of the power meter, or has not been in the upgrade mode after the restart, the processor does not write the to-be-upgraded firmware data to the power meter.

[0131] In an embodiment, before the processor writes the to-be-upgraded firmware data to the power meter, the processor can send a clearing instruction to the power meter. The clearing instruction is used to instruct the power meter to clear the firmware data stored in the firmware area of the ROM of the power meter. The clearing instruction can include the firmware area address and the like. After receiving the clearing instruction, the power meter can determine the area whose data needs to be cleared based on the firmware area address in the clearing instruction, and clear the data in the area so as to store the to-be-upgraded firmware data in the area.

[0132] S607, based on that the processor has written all the to-be-upgraded firmware data to the power meter, the processor sends an upgrade end instruction to the power meter.

[0133] The upgrade end instruction is used to instruct the processor to end the sending of the to-be-upgraded firmware data. That is, the upgrade end instruction is used to instruct that the processor has written all the to-be-upgraded data to the power meter, and the processor will not write the to-be-upgraded firmware data to the power meter any more.

[0134] In an embodiment, the to-be-upgraded firmware data can include multiple frames of sub-data. The processor writing the to-be-upgraded firmware data to the power meter can include that the processor writes corresponding sub-data to the power meter for multiple times until all the sub-data are written to the power meter. When the processor writes all the to-be-upgraded firmware data to the power meter, the processor sends an upgrade end instruction to the power meter to notify the power meter that all the to-be-upgraded firmware data has been received. In this way, the power meter can perform firmware upgrade based on all the to-be-upgraded firmware data received.

[0135] S608, the power meter performs firmware upgrade based on the to-be-upgraded firmware data.

[0136] In an embodiment, the power gauge upgrades the firmware based on the to-be-upgraded firmware data refers to that the power gauge replaces the program code of the power algorithm included in the original firmware data with the program code of the power algorithm included in the to-be-upgraded firmware data. That is, the power gauge upgrades the firmware refers to that the power gauge updates the program code of the power algorithm, thereby updating the power algorithm of the power gauge.

[0137] S609, the power gauge restarts and selects the user mode.

[0138] After the power gauge receives all the to-be-upgraded firmware data and completes the firmware upgrade based on all the to-be-upgraded firmware data, the power gauge can restart and select the user mode, so that the power gauge is in the user mode, thereby continuing to monitor and report the battery status.

[0139] S610, the power gauge calculates the second display power of the power gauge after the firmware upgrade as initial data of the updated power algorithm based on the backup data.

[0140] In an embodiment, since the display power is obtained based on the power percentage, the power gauge can include two steps when calculating the second display power of the power gauge after the firmware upgrade: the power gauge calculates the power percentage of the power gauge after the firmware upgrade (which can be referred to as the first power percentage), and the power gauge calculates the second display power based on the first power percentage.

[0141] In an embodiment, the power gauge calculates the first power percentage can include the following steps:

[0142] S11, the power gauge takes the depth of discharge in the backup data as the first depth of discharge after the firmware upgrade of the power gauge, takes the battery chemical capacity in the backup data as the first battery chemical capacity after the firmware upgrade of the power gauge, and determines the first battery remaining capacity after the firmware upgrade of the power gauge based on the first depth of discharge and the first battery chemical capacity.

[0143] For example, the process of S11 can be represented by the following formula (1):

[0144]

[0145] wherein RM1 is the first battery remaining capacity after the firmware upgrade of the power gauge, qmax1 is the first battery chemical capacity after the firmware upgrade of the power gauge, DOD1 is the first depth of discharge after the firmware upgrade of the power gauge, and M is a constant, usually 10000.

[0146] Since qmax1 and DOD1 in formula (1) are both from the backup data, the first battery remaining capacity calculated by formula (1) after the battery gauge firmware is upgraded is basically consistent with the battery remaining capacity before the battery gauge firmware is upgraded, that is, the battery remaining capacity before and after the battery gauge firmware is upgraded does not have an obvious jump.

[0147] S12, the battery gauge determines the first battery full charge capacity after the battery gauge firmware is upgraded based on the first discharge depth after the battery gauge firmware is upgraded.

[0148] For example, the process of S12 can be represented by the following formula (2):

[0149] FCC1=k×qmax1 (2)

[0150] Wherein, FCC1 is the first battery full charge capacity after the battery gauge firmware is upgraded, k is a constant, and k is slightly less than 1.

[0151] In an example, the battery gauge can directly backup the battery full charge capacity before the battery gauge firmware is upgraded, so that the battery gauge can directly take the battery full charge capacity before the battery gauge firmware is upgraded as the first battery full charge capacity after the battery gauge firmware is upgraded, without the need to calculate the first battery full charge capacity after the battery gauge firmware is upgraded. In this way, the computing power of the battery gauge can be saved.

[0152] S13, the battery gauge determines the first state of charge percentage after the battery gauge firmware is upgraded based on the ratio between the first battery remaining capacity after the battery gauge firmware is upgraded and the first battery full charge capacity.

[0153] For example, the process of S13 can be represented by the following formula (3):

[0154]

[0155] Wherein, RSOC1 is the first state of charge percentage after the battery gauge firmware is upgraded.

[0156] In an example, the battery gauge calculating the second display power based on the first state of charge percentage can include: the battery gauge calculating the second display power after the battery gauge firmware is upgraded based on the first state of charge percentage, the first display power and the battery state.

[0157] Since the battery remaining capacity before and after the battery gauge firmware is upgraded is basically consistent, and the battery full charge capacity before and after the battery gauge firmware is upgraded is basically consistent, the state of charge percentage before and after the battery gauge firmware is upgraded is also basically consistent. That is, the state of charge percentage before and after the battery gauge firmware is upgraded does not have an obvious power jump.

[0158] Since the obvious power jump of the power percentage will cause the obvious power jump of the display power, and the obvious power jump of the power percentage will not cause the obvious power jump of the display power, when the power percentage does not have the obvious power jump before and after the power gauge firmware upgrade, the display power will not have the obvious power jump before and after the power gauge firmware upgrade.

[0159] Specifically, the power gauge calculates the second display power based on the first power percentage, the first display power and the battery state can include the following steps:

[0160] S21, the power gauge takes the first display power in the backup data as the second power percentage of the power gauge at the last time.

[0161] The first power percentage is the power percentage after the power gauge firmware upgrade, which can also be regarded as the current power percentage. Relative to the first power percentage, the second power percentage is the power percentage at the last time of the current time.

[0162] S22, the power gauge calculates the absolute value of the difference between the first power percentage and the second power percentage.

[0163] The absolute value of the difference between the first power percentage and the second power percentage can indicate the jump value between the adjacent two power percentages in the fixed time interval.

[0164] S23, in the case that the absolute value of the difference between the first power percentage and the second power percentage is greater than the first threshold value, the power gauge reacquires the target linear equation between the display power and the power percentage based on the battery state.

[0165] If the absolute value of the difference between the first power percentage and the second power percentage is greater than the first threshold value, it indicates that the power percentage has an obvious power jump. In order to avoid the obvious power jump of the display power, the power gauge needs to reacquire the target linear equation between the display power and the power percentage.

[0166] The battery state includes the charging state and the discharging state. When the battery is in the charging state, the target linear equation can be referred to as the first target linear equation; when the battery is in the discharging state, the target linear equation can be referred to as the second target linear equation. The process of the power gauge acquiring the corresponding target linear equation when the battery is in different states is introduced below.

[0167] Figure 8 A schematic diagram of the first target linear equation provided in the embodiment of the application is shown.

[0168] In an example, taking the battery in the discharging state as an example, as shown in Figure 8As shown, after the power algorithm is initialized, there is no error between the remaining capacity calculated by the power meter and the actual remaining capacity, and the battery discharges according to the initial curve S0. The equation corresponding to the initial curve S0 is the initial linear equation between the displayed power and the power percentage. The initial curve S0 can be represented by the following formula (4):

[0169] SmoothSOC=Alpha×RSOC+Beta (4)

[0170] Where SmoothSOC is the displayed battery level, RSOC is the battery percentage, and Alpha and Beta are constants.

[0171] For example, when the fuel gauge detects a change in battery percentage from A1 to B1, the curve displaying the battery level versus the battery percentage changes from the initial curve S0 to a first target curve S1. The equation corresponding to the first target curve S1 is the first target linear equation between the displayed battery level and the battery percentage. At this time, based on the coordinates (RSOCB1, SmoothSOCB1) corresponding to the battery percentage B1 after the change and the origin coordinates (0, 0), the fuel gauge can obtain the first target linear equation. Beta = 0.

[0172] Based on this, the first objective linear equation can be expressed by the following formula (5):

[0173]

[0174] It should be understood that when the battery is in a discharging state, once the fuel gauge detects a jump in the battery percentage, the fuel gauge will re-acquire the corresponding first objective linear equation.

[0175] Figure 9 A schematic diagram of the second objective linear equation provided in an embodiment of this application is shown.

[0176] In another example, assuming the battery is charging, such as... Figure 9 As shown, after the power algorithm is initialized, there is no error between the remaining capacity calculated by the power meter and the actual remaining capacity, and the battery is charged according to the initial curve S0.

[0177] For example, when the fuel gauge detects a jump in battery percentage from A2 to B2, the curve showing the relationship between battery level and percentage changes from the initial curve S0 to a second target curve S2. The equation corresponding to the second target curve S2 is the second target linear equation between the displayed battery level and percentage. At this time, based on the coordinates (RSOCB2, SmoothSOCB2) corresponding to the battery percentage B2 after the jump and the full charge coordinates (100, 100), the fuel gauge can obtain the equation in the second target linear equation.

[0178]

[0179] Accordingly, the second target linear equation can be represented by the following formula (6):

[0180]

[0181] It should be understood that when the battery is in the charging state, once the power meter detects that the power percentage has a power jump, the power meter reacquires the corresponding second target linear equation.

[0182] S24, the power meter substitutes the second power percentage into the target linear equation to obtain a second display power.

[0183] Since the display power at each moment is calculated according to the power percentage at the previous moment, and the second power percentage is the power percentage at the previous moment, after the target linear equation between the power percentage and the display power is determined, the second power percentage is substituted into the target linear equation to obtain the display power at the current moment.

[0184] In summary, once the power meter detects that the power percentage has a power jump, the power meter reacquires the corresponding target linear equation, thereby ensuring that the power percentage and the display power always maintain a corresponding linear relationship. In this way, it can be ensured that the display power reported by the power meter always maintains linear change, thereby avoiding obvious jump phenomenon.

[0185] S25, in the case that the absolute value of the difference between the first power percentage and the second power percentage is less than the first threshold, the power meter substitutes the second power percentage into the initial linear equation to obtain a second display power.

[0186] If the absolute value of the difference between the first power percentage and the second power percentage is less than the first threshold, it indicates that there is no obvious power jump in the power percentage, so it is not necessary to determine the linear equation between the display power and the power percentage again, so the second power percentage is directly substituted into the initial linear equation to obtain the second display power.

[0187] Optionally, before the power meter uses the backup data as the initial data of the updated power algorithm, the power meter can verify the validity of the backup data, thereby further avoiding the problem of obvious power jump when the power meter firmware is upgraded.

[0188] If the backup data is determined to be valid by the power gauge, the power gauge can calculate the display power using the valid backup data. If the backup data is determined to be invalid by the power gauge, which means that the backup of the related data of the battery is not performed, the power gauge will not calculate the display power using the backup data. At this time, the power gauge can reacquire the related data of the battery, and calculate the power percentage after the power gauge firmware upgrade based on the reacquired related data of the battery, and further calculate the display power after the power gauge firmware upgrade based on the power percentage after the power gauge firmware upgrade.

[0189] It should be understood that how the power gauge calculates the power percentage after the power gauge firmware upgrade based on the reacquired related data of the battery can refer to the related description in the prior art, which will not be described herein.

[0190] In an embodiment, the power gauge can determine the validity of the backup data by verifying the validity of the check code read from the backup area. If the power gauge determines that the check code read from the backup area is valid, it indicates that the backup data is valid. If the power gauge determines that the check code read from the backup area is invalid, it indicates that the backup data is invalid.

[0191] Generally, the check code in the backup area is fixed. After the power gauge completes the firmware upgrade, the power gauge can read the check code in the backup area, and compare the check code read from the backup area with the preset check code. If the check code read from the backup area is consistent with the preset check code, the power gauge can determine that the check code is valid, and further determine that the backup data is valid. Otherwise, the power gauge can determine that the check code is invalid, and further determine that the backup data is invalid.

[0192] S611, the power gauge sends the second display power to the display screen through the processor.

[0193] S612, the display screen displays the second display power.

[0194] Figure 10 The interface display diagram of the mobile phone provided by the embodiment of the application is shown.

[0195] In an embodiment, as shown in A in Figure 10 The mobile phone 100 displays a third interface 1010 before software upgrade. The third interface 1010 includes a third time 1011 and a third power icon 1012. The third power icon 1012 is used to display that the display power of the battery of the mobile phone 100 at the third time 18:00 is 90% (i.e., the first display power).

[0196] As shown in B in Figure 10As shown in B of FIG. 10, the mobile phone 100 displays a fourth interface 1020 after the software upgrade. The fourth interface 1020 includes a fourth time 1021 and a fourth power icon 1022. The fourth power icon 1022 is used to display that the display power of the battery of the mobile phone 100 at the fourth time 18:03 (i.e., the second display power) is 89%.

[0197] It can be seen that the display power of the mobile phone 100 before the software upgrade is 90%, and the display power of the mobile phone 100 after the software upgrade is 89%, that is, the change of the display power is 1%. That is, the display power does not change obviously, thereby improving the user experience.

[0198] The above describes the power display method provided by the embodiments of the present application with the related modules in the electronic device as the execution subject. The following describes the power display method provided by the embodiments of the present application with the electronic device as the execution subject. Figure 11 The execution subject is Figure 4 The power display method provided by the embodiments of the present application is described with reference to the electronic device as shown in FIG. 10.

[0199] Figure 11 FIG. 11 shows a flowchart of a power display method provided by the embodiments of the present application. Figure 11 The method can include the following steps.

[0200] S1101, the electronic device displays a first display power of the electronic device on the display screen.

[0201] This step can refer to the related description in the above S601, and will not be described herein.

[0202] S1102, in a case where it is determined that the firmware of the power meter is upgraded, the electronic device triggers the power meter to store backup data of the related data of the battery before the firmware upgrade.

[0203] This step can include the related description in the above S602-S609, and will not be described herein.

[0204] S1103, the electronic device displays a second display power on the display screen based on the end of the firmware upgrade of the power meter.

[0205] This step can include the related description in the above S610-S612, and will not be described herein.

[0206] Figure 12 FIG. 12 shows a structural diagram of a chip system provided by the embodiments of the present application.

[0207] In an embodiment, as Figure 12As shown, the embodiment of the present application further provides a chip system. The chip system 1900 comprises at least one processor 1901 and at least one interface circuit 1902. The at least one processor 1901 and the at least one interface circuit 1902 can be interconnected through a line. The processor 1901 is configured to support the electronic device to implement each step in the above method embodiments, and the at least one interface circuit 1902 can be configured to receive a signal from another device (for example, a memory) or send a signal to another device (for example, a communication interface). The chip system can comprise a chip, and can also comprise other discrete devices.

[0208] The embodiment of the present application further provides a computer storage medium comprising instructions which, when executed on the above electronic device, cause the electronic device to perform each step in the above method embodiments.

[0209] The embodiment of the present application further provides a computer program product comprising instructions which, when executed on the above electronic device, cause the electronic device to perform each step in the above method embodiments.

[0210] The technical effects of the chip system, the computer storage medium and the computer program product are referred to the technical effects of the above method embodiments.

[0211] It should be understood that, in various embodiments of the present application, the size of the sequence number of each process described above does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0212] Those skilled in the art can appreciate that the modules and algorithm steps of each example described in connection with the embodiments disclosed herein can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0213] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system, device and module can refer to the corresponding process in the above method embodiments, which will not be described here.

[0214] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other manners. For example, the embodiments of the device described above are merely schematic. For example, the division of the modules is merely logical function division. There can be another division manner for the actual implementation. For example, a plurality of modules or components can be combined or integrated into another device, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, devices or modules, and can be in electrical, mechanical or other forms.

[0215] The modules illustrated as separated components can or can not be physically separated, and the components illustrated as modules can or can not be physical modules, i.e., can be located in one device or distributed on a plurality of devices. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiments.

[0216] In addition, each functional module in each embodiment of the present application can be integrated in one device, or each module can be physically present alone, or two or more modules can be integrated in one device.

[0217] In the above embodiments, all or part can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, the computer program instructions generate the processes or functions described in the embodiments of the present application. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable devices. The computer instructions can be stored in a computer storage medium or transferred from one computer storage medium to another computer storage medium, for example, the computer instructions can be transferred from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) manner. The computer storage medium can be any available medium that can be accessed by a computer or data storage device including one or more servers, data centers, etc. integrated with the medium. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)), etc.

[0218] The above merely provides the specific implementation of the present application, but the protection scope of the present application is not limited to this. Any person skilled in the art can easily think of the changes or replacements within the technical range disclosed by the present application, which should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A method for displaying battery level, characterized in that, The method is applied to an electronic device, the electronic device including a fuel gauge, a battery, and a display screen, the fuel gauge being connected to the battery and the display screen; the method includes: The first display battery level of the electronic device is displayed on the screen; If a firmware upgrade is required for the fuel gauge, the firmware upgrade is performed after backing up the relevant battery data stored in the fuel gauge is triggered; wherein, the backup data includes the first displayed battery level; Upon completion of the firmware upgrade of the fuel gauge, a second display fuel level is shown on the screen. The second display fuel level is calculated by the fuel gauge based on the stored backup data.

2. The method according to claim 1, characterized in that, The electronic device further includes a processor connected to the fuel gauge; the step of triggering the backup data of the fuel gauge storing relevant battery data after determining that a firmware upgrade is needed for the fuel gauge includes: In response to a software upgrade of the electronic device including a firmware upgrade of the fuel gauge, and the current firmware version of the fuel gauge being lower than the firmware version to be upgraded, the processor sends a firmware upgrade instruction to the fuel gauge; wherein the firmware upgrade instruction is used to instruct the fuel gauge to perform a firmware upgrade; In response to the firmware upgrade command, the fuel gauge backs up the relevant data of the battery to obtain backup data and stores the backup data; The processor sends firmware data to be upgraded and an upgrade end command to the fuel gauge; wherein, the upgrade end command is used to indicate the termination of sending the firmware data to be upgraded. The fuel gauge responds to the upgrade end command and performs a firmware upgrade based on the firmware data to be upgraded.

3. The method according to claim 2, characterized in that, The fuel gauge stores backup data related to the battery, including: The fuel gauge backs up the relevant data of the battery to obtain backup data; The fuel gauge stores the backup data in the backup area of ​​the fuel gauge; the backup area and the firmware area of ​​the fuel gauge are two independent storage areas, and the firmware area is used to store the firmware data of the fuel gauge.

4. The method according to claim 2 or 3, characterized in that, The method further includes: After storing the backup data, the fuel meter restarts and enters upgrade mode; The fuel gauge performs a firmware upgrade based on the firmware data to be upgraded, including: in the upgrade mode, the fuel gauge performs a firmware upgrade based on the firmware data to be upgraded.

5. The method according to any one of claims 1-4, characterized in that, The backup data also includes: the battery's depth of discharge and battery chemical capacity before the fuel gauge firmware upgrade; The power meter calculates the second displayed power level based on the stored backup data, including: The fuel gauge uses the depth of discharge in the backup data as the first depth of discharge after the fuel gauge firmware upgrade, and uses the battery chemical capacity in the backup data as the first battery chemical capacity after the fuel gauge firmware upgrade. The fuel gauge obtains the remaining capacity of the first battery after the firmware upgrade based on the first discharge depth and the first battery chemical capacity, and obtains the full charge capacity of the first battery after the firmware upgrade based on the first discharge depth. The fuel gauge determines the first battery percentage as the ratio of the remaining capacity of the first battery to the full charge capacity of the first battery. The fuel gauge calculates the second displayed battery level based on the first battery percentage, the first displayed battery level, and the battery status.

6. The method according to claim 5, characterized in that, The fuel gauge calculates the second displayed battery level based on the first battery percentage, the first displayed battery level, and the battery status, including: The fuel gauge uses the first displayed power level as the second power percentage of the fuel gauge at the previous moment; If the absolute value of the difference between the first battery percentage and the second battery percentage is greater than a first threshold, the fuel gauge determines a target linear equation between the displayed battery level and the battery percentage based on the battery state. The fuel gauge substitutes the second percentage of fuel consumption into the target linear equation to obtain the second displayed fuel consumption.

7. The method according to claim 6, characterized in that, The battery is in a discharged state; in the discharged state, the target linear equation is a first target linear equation. The fuel gauge determines a target linear equation between the displayed battery level and the battery percentage based on the battery state, including: Based on the battery being in the discharge state, the fuel gauge determines the first target linear equation as the linear equation that passes through the coordinates corresponding to the first percentage of charge and the coordinates of the origin. Wherein, the horizontal axis of the coordinate system corresponding to the first battery percentage is the first battery percentage, and the vertical axis of the coordinate system corresponding to the first battery percentage is the displayed battery level corresponding to the first battery percentage.

8. The method according to claim 6 or 7, characterized in that, The battery state is a charging state; in the charging state, the target linear equation is a second target linear equation; The fuel gauge determines a target linear equation between the displayed battery level and the battery percentage based on the battery state, including: Based on the battery being in the charging state, the fuel gauge determines the second target linear equation by the linear equation passing through the coordinates corresponding to the first percentage of charge and the coordinates of full charge. The full charge coordinate refers to the coordinate when the battery percentage is full and the displayed battery level is full; the horizontal axis of the coordinate corresponding to the first battery percentage is the first battery percentage, and the vertical axis of the coordinate corresponding to the first battery percentage is the displayed battery level corresponding to the first battery percentage.

9. The method according to any one of claims 6-8, characterized in that, After using the first displayed battery level as the second battery percentage of the battery meter at the previous moment, the method further includes: If the absolute value is less than the first threshold, the fuel gauge substitutes the second power percentage into the initial linear equation between the displayed power and the power percentage to obtain the second displayed power.

10. The method according to any one of claims 1-9, characterized in that, Upon completion of the firmware upgrade based on the fuel gauge, a second display of the fuel level is shown on the screen, including: Once the firmware upgrade of the fuel gauge is complete and the backup data is valid, a second display fuel level is shown on the display screen; wherein the second display fuel level is calculated by the fuel gauge based on the stored valid backup data.

11. The method according to claim 10, characterized in that, The backup data is stored in correspondence with the verification code, and the fuel meter determines the validity of the backup data, including: If the verification code read from the backup area of ​​the fuel meter is a preset verification code, the fuel meter determines that the backup data is valid.

12. The method according to any one of claims 1-11, characterized in that, After the power meter firmware upgrade is completed and before the second power level is displayed on the screen, the method further includes: The fuel gauge restarts and enters user mode; Displaying a second displayed battery level on the display screen includes: in the user mode, the fuel gauge monitors the battery and calculates the second displayed battery level, and displays the second displayed battery level on the display screen.

13. An electronic device, characterized in that, The device includes a display screen, a battery, a memory, and a fuel gauge, wherein the fuel gauge is connected to the display screen, the battery, and the memory; the display screen is used to display the battery level; the memory stores computer program code, which includes instructions; when the fuel gauge executes the instructions, the electronic device performs the method as described in any one of claims 1-12.

14. A computer-readable storage medium, characterized in that, Includes instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1-12.

15. A computer program product, characterized in that, Includes instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1-12.