Electronic device, control method, and related apparatus

CN119958515BActive Publication Date: 2026-08-21HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311428667.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-30
Publication Date
2026-08-21
Estimated Expiration
2043-10-30

AI Technical Summary

Technical Problem

这样,在使用指南针之前,用户需要对指南针进行校准,操作繁琐,不利于用户体验

Benefits of technology

[0061] It should be understood that the third to seventh aspects of this application correspond to the technical solutions of the first aspect or the second aspect of this application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation are similar, and will not be repeated here.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119958515B_ABST
    Figure CN119958515B_ABST
Patent Text Reader

Abstract

The application provides an electronic device, a control method and related devices, and applies to the terminal technical field. The electronic device comprises a first module, a first impedance unit, a first amplification unit, a first compensation unit and a compass. The first impedance unit is connected in series in a working loop of the first module, and the two ends of the first impedance unit are also connected with the input end of the first amplification unit. The output end of the first amplification unit is connected with the first compensation unit. The first amplification unit is used for amplifying and outputting the voltage of the first impedance unit when the first module works. The positions of the first compensation unit and the compass are set so that when the first module works and the current flowing through the first impedance unit is a first current, the current flowing through the first compensation unit is a second current. The direction of the magnetic induction intensity generated by the second current at the compass is opposite to the direction of the magnetic induction intensity generated by the first current at the compass. In this way, the influence of the first current on the magnetic field in which the compass is located can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of terminal technology, and in particular to an electronic device, a control method, and related apparatus. Background Technology

[0002] With the development of smart terminals, some electronic devices are equipped with compasses, which can provide services for compass applications or map applications.

[0003] Currently, when users use compass or map apps, their electronic devices may prompt them to calibrate the compass. After calibration, the compass functions normally. This cumbersome process, requiring users to calibrate the compass before use, negatively impacts the user experience. Summary of the Invention

[0004] This application provides an electronic device, a control method, and related apparatus, which are applied in the field of terminal technology. In this application, it is beneficial to reduce the number of compass calibrations, thereby reducing user operations and improving user experience.

[0005] In a first aspect, this application proposes an electronic device comprising a first module, a first impedance unit, a first amplification unit, a first compensation unit, and a compass; the first impedance unit is connected in series in the working circuit of the first module, and both ends of the first impedance unit are also connected to the input terminal of the first amplification unit, and the output terminal of the first amplification unit is connected to the first compensation unit; the first amplification unit is used to amplify the voltage of the first impedance unit and output it when the first module is working; wherein, the two ends of the first compensation unit are a first end and a second end, the distance between the compass and the first compensation unit is a first distance, the angle formed by the first compensation unit and a first line segment is a first angle, and the first line segment is the distance between the first end and the compass. The angle formed by the line connecting the needle, the first compensation unit, and the second line segment is the second angle. The second line segment is the line connecting the second end to the compass. The positions of the first compensation unit and the compass are set such that when the first module is working, the following relationship is satisfied: when the current flowing through the first impedance unit is the first current, the current flowing through the first compensation unit is the second current. The direction of the magnetic induction intensity generated by the second current at the compass is opposite to the direction of the magnetic induction intensity generated by the first current at the compass. The value of the magnetic induction intensity generated by the second current at the compass is inversely correlated with the first distance and positively correlated with the second current and the first difference. The first difference is the difference between the cosine of the first angle and the cosine of the second angle.

[0006] When the first module is working, the current flowing through the first impedance unit is the current generated when the first module is working. The first amplification unit can amplify the voltage of the first impedance unit and output it, so that the current flowing through the first compensation unit is the second current. The value of the magnetic field strength generated by the second current at the compass is related to the position of the compass and the value of the second current. The value of the magnetic field strength generated by the second current at the compass can be less than or equal to the value of the magnetic field strength generated by the first current at the compass. The direction of the magnetic field strength generated by the second current at the compass is opposite to the direction of the magnetic field strength generated by the first current at the compass. This reduces the influence of the first current on the magnetic field of the compass, which helps to ensure that the difference between two adjacent data obtained by the compass is less than a preset difference. This, in turn, helps to reduce the number of times the compass needs to be calibrated, thereby reducing user operations and improving user experience. In addition, by reducing the influence of the first current on the magnetic field of the compass by the second current flowing through the first compensation unit, the influence of the first current on the magnetic field of the compass can be quickly compensated for, with small delay, high real-time performance, and no impact on the accuracy of the compass.

[0007] In one possible implementation, when the current flowing through the first impedance unit is the first current, the output voltage of the first amplification unit is the first voltage. The electronic device also includes a control unit, which is connected to the output terminal of the first amplification unit and is also connected to the first compensation unit. The control unit is used to obtain the second voltage corresponding to the first voltage from the first preset correspondence and control the output of the second voltage.

[0008] If the voltage output from the first amplification unit is directly used to make the current flowing through the first compensation unit the second current, the resistance of the first compensation unit may be small because the voltage output from the first amplification unit is relatively small. Therefore, this application sets a first preset correspondence, in which the first voltage corresponds to the second voltage. The second voltage can be the product of the resistance value of the first compensation unit and the second current. In this way, the resistance value of the first compensation unit can be set to the desired value. When the current flowing through the first impedance unit is the first current, the control unit controls the output of the second voltage. At this time, the current flowing through the first compensation unit is the second current. In this way, the setting of the resistance value of the first compensation unit is relatively flexible.

[0009] In one possible implementation, the electronic device further includes a codec connected to a control unit and a first compensation unit; the control unit is used to transmit first indication information to the codec when it obtains a second voltage corresponding to the first voltage from a first preset correspondence, the first indication information being used to instruct the codec to output the second voltage.

[0010] The codec may include one or more pins for output voltage, and the control unit may instruct the codec to output a second voltage via a first indication. This facilitates outputting a second voltage so that the current flowing through the first compensation unit is a second current.

[0011] In one possible implementation, the electronic device further includes a voltage regulation unit connected to a control unit and also connected to a first compensation unit. The control unit, when obtaining a second voltage corresponding to the first voltage from a first preset correspondence, controls the voltage regulation unit to output the second voltage. The voltage regulation unit may include a charge pump and a switching device such as a MOSFET. The control unit can adjust the duty cycle of the charge pump's output voltage via the switching device to output the second voltage. This facilitates outputting the second voltage so that the current flowing through the first compensation unit is a second current.

[0012] In one possible implementation, the electronic device further includes a second module, a second impedance unit, a second amplification unit, and a second compensation unit. The second impedance unit is connected in series in the working circuit of the second module, and its two ends are also connected to the input terminal of the second amplification unit. The output terminal of the second amplification unit is connected to the control unit, and the control unit is connected to the second compensation unit. The second amplification unit is used to amplify the voltage of the second impedance unit and output it when the second module is working. The two ends of the second compensation unit are the third and fourth terminals, the distance between the compass and the second compensation unit is the second distance, the angle formed by the second compensation unit and the third line segment is the third angle, and the third line segment is the distance between the third terminal and the compass. The angle formed by the line connecting the needle, the second compensation unit, and the fourth line segment is the fourth angle. The fourth line segment is the line connecting the fourth end to the compass. The positions of the second compensation unit and the compass are arranged such that when the second module is working, the following relationship is satisfied: when the current flowing through the second impedance unit is the third current, the current flowing through the second compensation unit is the fourth current. The direction of the magnetic induction intensity generated by the fourth current at the compass is opposite to the direction of the magnetic induction intensity generated by the third current at the compass. The value of the magnetic induction intensity generated by the fourth current at the compass is inversely correlated with the second distance and positively correlated with the fourth current and the second difference. The second difference is the difference between the cosine of the third angle and the cosine of the fourth angle. In the electronic device, the current generated by the second module may also affect the magnetic field of the compass. In this case, the electronic device may also include a second compensation unit to reduce the influence of the third current generated by the second module on the magnetic field of the compass when the second module is working.

[0013] In one possible implementation, the first module is a charging module for the electronic device, used to charge the device's battery; the second module is a communication module for the electronic device, used to enable wireless communication. Alternatively, the first module is a communication module for the electronic device, used to enable wireless communication; and the second module is a charging module for the electronic device, used to charge the battery. This approach, in both charging and communication scenarios, helps reduce the number of times the compass needs to be calibrated, thereby reducing user operations and improving the user experience.

[0014] In one possible implementation, the positions of the first compensation unit and the compass are set such that the relationship between the first distance, the first included angle, and the second included angle satisfies the following formula:

[0015]

[0016] B x21 =B p1 *sinθ 01 *cosθ 31 ≤B x1

[0017] B y21 =B p1 *sinθ 01 *cosθ 31 ≤B y1

[0018] B z21 =B p1 *cosθ 01 ≤B z1

[0019] Among them, B p1 Let I be the magnetic field strength generated by the second current at the compass, a1 be the first distance, and θ be the magnetic field strength generated by the second current at the compass. 11 Let θ be the first included angle. 21 The second included angle, μ0 is the free permeability, and B x21 For B p1 In a three-dimensional coordinate system, the component in the X direction, B y21 For B p1 The component in the Y direction in a three-dimensional coordinate system, B z21 For B p1 The component along the Z direction in a three-dimensional coordinate system, θ 01 Let θ be the angle between the plane formed by the first compensation unit and the magnetic sensor in the compass and the plane containing the circuit board of the electronic device. 31 The angle formed by the first compensation unit and the long side of the circuit board is defined. The circuit board contains a first module, a first impedance unit, a first amplification unit, a first compensation unit, and a compass. (B) x1Let B be the component of the magnetic field strength produced by the first current at the compass in the X direction. y1 Let B be the component of the magnetic field strength produced by the first current at the compass in the Y direction. z1 Let be the Z-direction component of the magnetic flux density generated by the first current at the compass.

[0020] The positioning of the first compensation unit and the compass can be such that the components of the magnetic induction intensity generated by the second current at the compass in each direction of the coordinate system are equal to the value of the magnetic induction intensity generated by the first current at the compass, thus canceling out the influence of the magnetic field generated by the first current at the compass; or the value of the magnetic induction intensity generated by the second current at the compass can be made smaller than the value of the magnetic induction intensity generated by the first current at the compass, thus reducing the influence of the first current on the magnetic field of the compass.

[0021] In one possible implementation, an electronic device is used to respond to a user's operation using a compass application or a map application to obtain a compass reading, the compass reading including the compass values ​​in M ​​directions in an M-dimensional coordinate system; to compensate for the value in any one of the M directions to obtain compensated data, the compensated data being used to represent the location of the electronic device; wherein, the compensation amount corresponding to the value in any direction is related to a first current, the compensation offset in any direction, and the compensation slope in any direction, and the compensation offset and the compensation slope in any direction are both constants.

[0022] The electronic device can be preset with compensation offset and compensation slope in any direction. In response to user operations using a compass or map application, it can calculate the compensation amount in any direction based on the first current, the compensation offset in any direction, and the compensation slope in any direction, and then compensate the compass reading in the corresponding direction based on the compensation amount. This further compensation of the compass reading helps to further reduce the influence of the first current on the magnetic field around the compass.

[0023] In one possible implementation, the compensation amount corresponding to the value in any direction is related to the first current, the compensation offset in any direction, and the compensation slope in any direction as follows:

[0024] Y 1 =K 1 I+B 1

[0025] Among them, Y 1 K represents the compensation amount corresponding to the value in any direction. 1 For the compensation slope in any direction, B 1 The compensation offset in any direction, where I is the first current.

[0026] When the compensation offset and the compensation slope in any direction are constant, the first current and the compensation amount corresponding to the value in any direction have a linear relationship. This relationship is simple and helps to improve the speed of calculating the compensation amount.

[0027] In one possible implementation, the compensation offset and the compensation slope in any direction are such that the sum of the compensation amount corresponding to the value in any direction and the component of the first magnetic induction intensity in any direction is less than or equal to the component of the second magnetic induction intensity in any direction. The first magnetic induction intensity is the magnetic induction intensity generated by the second current at the compass, and the second magnetic induction intensity is the magnetic induction intensity generated by the first current at the compass.

[0028] The compensation amount corresponding to the value in any direction calculated by the compensation offset and the compensation slope in any direction, and the sum of the component of the first magnetic induction intensity in any direction, can be less than or equal to the component of the second magnetic induction intensity in any direction. This helps to reduce the influence of the first current on the magnetic field where the compass is located.

[0029] In one possible implementation, the M-dimensional coordinate system is a three-dimensional coordinate system. The compass reading includes the compass value in each direction within the three-dimensional coordinate system, the compensation amount corresponding to each value in each direction, the components of the magnetic field strength generated by the first current at the compass in each direction within the three-dimensional coordinate system, and the components of the magnetic field strength generated by the second current at the compass in each direction within the three-dimensional coordinate system, all satisfying the following formula:

[0030]

[0031] B x22 =B p2 *sinθ 02 *cosθ 32 +Y x ≤B x1

[0032] B y22 =B p2 *sinθ 02 *cosθ 32 +Y y ≤B y1

[0033] B z22 =B p2 *cosθ 02 +Y z ≤B z1

[0034] Among them, B p2 Let I be the magnetic field strength generated by the second current at the compass, a be the first distance, and θ be the magnetic field strength produced by the second current at the compass. 12 Let θ be the first included angle.22 The second included angle, μ0 is the free permeability, and B x22 For B p2 In a three-dimensional coordinate system, the component in the X direction, B y22 For B p2 The component in the Y direction in a three-dimensional coordinate system, B z22 For B p2 The component along the Z direction in a three-dimensional coordinate system, θ 02 Let θ be the angle between the plane formed by the first compensation unit and the magnetic sensor in the compass and the plane containing the circuit board of the electronic device. 32 The angle formed by the first compensation unit and the long side of the circuit board is defined. The circuit board contains a first module, a first impedance unit, a first amplification unit, a first compensation unit, and a compass. (B) x1 Let B be the component of the magnetic field strength produced by the first current at the compass in the X direction. y1 Let B be the component of the magnetic field strength produced by the first current at the compass in the Y direction. z1 Y is the Z-direction component of the magnetic field strength generated by the first current at the compass. x The compensation amount corresponding to the value in the X direction, Y y The compensation amount corresponding to the value in the Y direction, Y z This is the compensation amount corresponding to the value in the Z direction.

[0035] In this way, the components of the magnetic induction intensity generated by the second current at the compass in each direction, plus the compensation amount in each direction, can be less than the components of the magnetic induction intensity generated by the first current at the compass in each direction, which helps to reduce the influence of the first current on the magnetic field where the compass is located.

[0036] In one possible implementation, the first impedance unit is connected to the first module and is also grounded. This way, the first impedance unit is positioned at the low-voltage end of the circuit containing the first module, compared to its placement at the high-voltage end of the circuit containing the second module. This results in a lower input voltage for the first amplification unit, helping to prevent excessive voltage from burning out the first amplification unit.

[0037] Secondly, this application provides a control method applied to an electronic device. The electronic device includes a first module, a first impedance unit, a first amplification unit, a first compensation unit, a compass, and a control unit. The first impedance unit is connected in series in the working circuit of the first module, and both ends of the first impedance unit are also connected to the input terminal of the first amplification unit. The output terminal of the first amplification unit is connected to the first compensation unit. The first amplification unit is used to amplify the voltage of the first impedance unit and output it when the first module is working. The two ends of the first compensation unit are a first terminal and a second terminal, the distance between the compass and the first compensation unit is a first distance, and the angle formed by the first compensation unit and a first line segment is a second distance. An included angle is formed by the first line segment connecting the first end to the compass, the second included angle is formed by the first compensation unit and the second line segment, and the second line segment is formed by the second end to the compass. The method includes: when the current flowing through the first impedance unit is the first current, the control unit controls the current flowing through the first compensation unit to be the second current. The direction of the magnetic induction intensity generated by the second current at the compass is opposite to the direction of the magnetic induction intensity generated by the first current at the compass. The value of the magnetic induction intensity generated by the second current at the compass is inversely correlated with the first distance and positively correlated with the second current and the first difference. The first difference is the difference between the cosine of the first included angle and the cosine of the second included angle.

[0038] In one possible implementation, the positions of the first compensation unit and the compass are set such that the relationship between the first distance, the first included angle, and the second included angle satisfies the following formula:

[0039]

[0040] B x21 =B p1 *sinθ 01 *cosθ 31 ≤B x1

[0041] B y21 =B p1 *sinθ 01 *cosθ 31 ≤B y1

[0042] B z21 =B p1 *cosθ 01 ≤B z1

[0043] Among them, B p1 Let I be the magnetic field strength generated by the second current at the compass, a1 be the first distance, and θ be the magnetic field strength generated by the second current at the compass. 11 Let θ be the first included angle. 21 The second included angle, μ0 is the free permeability, and Bx21 For B p1 In a three-dimensional coordinate system, the component in the X direction, B y21 For B p1 The component in the Y direction in a three-dimensional coordinate system, B z21 For B p1 The component along the Z direction in a three-dimensional coordinate system, θ 01 Let θ be the angle between the plane formed by the first compensation unit and the magnetic sensor in the compass and the plane containing the circuit board of the electronic device. 31 The angle formed by the first compensation unit and the long side of the circuit board is defined. The circuit board contains a first module, a first impedance unit, a first amplification unit, a first compensation unit, and a compass. (B) x1 Let B be the component of the magnetic field strength produced by the first current at the compass in the X direction. y1 Let B be the component of the magnetic field strength produced by the first current at the compass in the Y direction. z1 Let be the Z-direction component of the magnetic flux density generated by the first current at the compass.

[0044] In one possible implementation, when the current flowing through the first impedance unit is the first current, the method further includes: in response to a user's operation using a compass application or a map application, obtaining a compass reading, the compass reading including the values ​​of the compass in M ​​directions in an M-dimensional coordinate system; compensating the value in any one of the M directions to obtain compensated data, the compensated data being used to represent the location data of the electronic device; wherein, the compensation amount corresponding to the value in any direction is related to the first current, the compensation offset in any direction, and the compensation slope in any direction, and the compensation offset and the compensation slope in any direction are both constants.

[0045] In one possible implementation, the compensation amount corresponding to the value in any direction is related to the first current, the compensation offset in any direction, and the compensation slope in any direction as follows:

[0046] Y 1 =K 1 I+B 1

[0047] Among them, Y 1 K represents the compensation amount corresponding to the value in any direction. 1 For the compensation slope in any direction, B 1 The compensation offset in any direction, where I is the first current.

[0048] In one possible implementation, the compensation offset and the compensation slope in any direction are such that the sum of the compensation amount corresponding to the value in any direction and the component of the first magnetic induction intensity in any direction is less than or equal to the component of the second magnetic induction intensity in any direction. The first magnetic induction intensity is the magnetic induction intensity generated by the second current at the compass, and the second magnetic induction intensity is the magnetic induction intensity generated by the first current at the compass.

[0049] In one possible implementation, the M-dimensional coordinate system is a three-dimensional coordinate system. The compass reading includes the compass value in each direction within the three-dimensional coordinate system, the compensation amount corresponding to each value in each direction, the components of the magnetic field strength generated by the first current at the compass in each direction within the three-dimensional coordinate system, and the components of the magnetic field strength generated by the second current at the compass in each direction within the three-dimensional coordinate system, all satisfying the following formula:

[0050]

[0051] B x22 =B p2 *sinθ 02 *cosθ 32 +Y x ≤B x1

[0052] B y22 =B p2 *sinθ 02 *cosθ 32 +Y y ≤B y1

[0053] B z22 =B p2 *cosθ 02 +Y z ≤B z1

[0054] Among them, B p2 Let I be the magnetic field strength generated by the second current at the compass, a be the first distance, and θ be the magnetic field strength produced by the second current at the compass. 12 Let θ be the first included angle. 22 The second included angle, μ0 is the free permeability, and B x22 For B p2 In a three-dimensional coordinate system, the component in the X direction, B y22 For B p2 The component in the Y direction in a three-dimensional coordinate system, B z22 For B p2 The component along the Z direction in a three-dimensional coordinate system, θ 02 Let θ be the angle between the plane formed by the first compensation unit and the magnetic sensor in the compass and the plane containing the circuit board of the electronic device.32 The angle formed by the first compensation unit and the long side of the circuit board is defined. The circuit board contains a first module, a first impedance unit, a first amplification unit, a first compensation unit, and a compass. (B) x1 Let B be the component of the magnetic field strength produced by the first current at the compass in the X direction. y1 Let B be the component of the magnetic field strength produced by the first current at the compass in the Y direction. z1 Y is the Z-direction component of the magnetic field strength generated by the first current at the compass. x The compensation amount corresponding to the value in the X direction, Y y The compensation amount corresponding to the value in the Y direction, Y z This is the compensation amount corresponding to the value in the Z direction.

[0055] Thirdly, embodiments of this application provide an electronic device, which may also be referred to as a terminal, user equipment (UE), mobile station (MS), mobile terminal (MT), etc. Terminal devices can be mobile phones, smart TVs, wearable devices, tablets, computers with wireless transceiver capabilities, virtual reality (VR) terminal devices, augmented reality (AR) terminal devices, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, and so on.

[0056] The electronic device may be structured as shown in any of the first aspects above, and the electronic device may perform the methods shown in any of the second aspects above.

[0057] Fourthly, this application provides an electronic device including a processor and a memory, the memory for storing code instructions, and the processor for running the code instructions to execute the method performed by the electronic device in the first aspect, or to implement the method performed by the electronic device in the second aspect.

[0058] Fifthly, embodiments of this application provide a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the method executed by the electronic device as described in the first aspect, or implements the method executed by the electronic device as described in the second aspect.

[0059] Sixthly, embodiments of this application provide a computer program product, which includes a computer program that, when run, causes a computer to perform the method executed by the electronic device in the first aspect, or to implement the method executed by the electronic device in the second aspect.

[0060] In a seventh aspect, embodiments of this application provide a chip, the chip including a processor, the processor being configured to invoke a computer program in memory to execute a method as performed by the electronic device in the first aspect, or to implement a method as performed by the electronic device in the second aspect.

[0061] It should be understood that the third to seventh aspects of this application correspond to the technical solutions of the first aspect or the second aspect of this application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation are similar, and will not be repeated here. Attached Figure Description

[0062] Figure 1 This is a schematic diagram of the current flow direction in an electronic device;

[0063] Figure 2 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application;

[0064] Figure 3 A schematic diagram illustrating the deployment location of a first compensation unit and a compass, provided for an embodiment of this application;

[0065] Figure 4 A schematic diagram of the hardware structure of another electronic device provided in an embodiment of this application;

[0066] Figure 5 This is a schematic diagram illustrating a linear relationship provided in an embodiment of this application. Detailed Implementation

[0067] To facilitate a clear description of the technical solutions in the embodiments of this application, the following explanation is provided first:

[0068] In the embodiments of this application, terms such as "first" and "second" are used to distinguish identical or similar items with essentially the same function and effect. For example, the first compensation unit and the second compensation unit are only used to distinguish different compensation units and do not limit their order. Those skilled in the art will understand that terms such as "first" and "second" do not limit the quantity or execution order, and that terms such as "first" and "second" do not necessarily imply that they are different.

[0069] It should be noted that, in the embodiments of this application, the terms "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design scheme described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.

[0070] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, a--c, bc, or abc, where a, b, and c can be single or multiple.

[0071] It should be noted that the phrase "at...time" in the embodiments of this application can refer to the instant at which a certain situation occurs, or it can refer to a period of time before or after the occurrence of a certain situation. The embodiments of this application do not impose a specific limitation on this. In addition, the display interface provided in the embodiments of this application is only an example, and the display interface may include more or less content.

[0072] When users use compass or map apps, their electronic devices may prompt them to calibrate the compass. After calibration, the compass can be used normally.

[0073] This is because electronic devices equipped with a compass can periodically use the compass to detect the device's orientation. If the difference between two consecutive data points obtained from the compass exceeds a preset difference, such as 30 microseconds, the electronic device will prompt the user to perform compass calibration before the application accesses the compass data.

[0074] The reason why the difference between two consecutive data points is greater than the preset difference may be due to interference from the surrounding magnetic field. For example, due to the size limitations of electronic devices, charging modules and / or communication modules are deployed near the compass. In the charging scenario, the charging module has a charging current, and the magnetic field generated by the charging current will affect the magnetic field of the compass. In the communication scenario, the communication module has a working current, and the magnetic field generated by the working current will affect the magnetic field of the compass.

[0075] In other words, if there is an electric current near the compass, the magnetic field generated by this current will affect the magnetic field of the compass, causing the difference between two adjacent readings to be greater than the preset difference.

[0076] For example, Figure 1 A schematic diagram illustrating the current flow direction in an electronic device is shown. (For example...) Figure 1 As shown, the electronic device is a mobile phone. The electronic device includes a charging port 110, a battery 120, a compass 130, a charging module 140, a power amplifier (PA) 150, a communication module 160, and a mid-frame 170. The mid-frame 170 is used for transmitting current.

[0077] In both wireless and wired charging scenarios, when an electronic device is connected to a charger, the charger can charge the battery 120 of the electronic device. The flow of the charging current can include: positive terminal of the charger -> input terminal of charging interface 110 -> charging module 140 -> battery 120 -> mid-frame 170 -> input terminal of charging interface 110 -> negative terminal of the charger. Since the charging current is close to the compass 130, when the charging current passes through the mid-frame 170, it generates a magnetic field that affects the magnetic field of the compass 130. If the difference between the data obtained by the electronic device using the compass 130 before charging and the data obtained after charging is greater than a preset difference, the compass 130 needs to be calibrated before it can function properly. Therefore, when the electronic device detects an application calling the compass 130, it will prompt the user to calibrate the compass 130.

[0078] In some scenarios, battery 120 includes a main battery and a secondary battery. The charging current of both the main battery and the secondary battery can be transmitted through the mid-frame 170 to the output terminal of the charging interface 110, and then to the negative terminal of the charger. In this scenario, the difference between the data obtained by the electronic device using compass 130 before charging and the data obtained by the electronic device using compass 130 after charging may exceed a preset difference value. In this case, compass 130 needs to be calibrated before it can work properly.

[0079] In a communication scenario, the communication module 160 operates, and the flow of the operating current can be: battery 120 → PA150 → communication module 160 → battery 120. The compass 130 is close to this circuit, and the magnetic field generated by the operating current will affect the magnetic field of the compass 130. If the difference between the data obtained by the electronic device using the compass 130 before communication and the data obtained after communication is greater than a preset difference, the electronic device will prompt the user to calibrate the compass 130 when it detects an application calling the compass 130.

[0080] In view of this, embodiments of this application provide an electronic device, a control method, and related apparatus. A compensation unit is deployed near a compass. When a charging current (and / or operating current) is generated near the compass, the electronic device can provide a compensation current through the compensation unit. The direction of the magnetic induction intensity generated by the compensation current is opposite to the direction of the magnetic induction intensity generated by the charging current (and / or operating current). The value of the magnetic induction intensity generated by the compensation current is less than or equal to the value of the magnetic induction intensity generated by the charging current (and / or operating current). This can minimize the influence of the charging current (and / or operating current) on the magnetic field where the compass is located, which is beneficial to ensure that the difference between two adjacent data obtained using the compass is less than a preset difference. This helps to reduce the number of times the compass needs to be calibrated, thereby reducing user operations and improving the user experience.

[0081] It should be noted that the embodiments of this application are illustrated using charging and communication scenarios as examples. These embodiments are applicable to any scenario where the current generated in the electronic device affects the magnetic field of the compass. It is understood that, in addition to the presence of a charging module in the charging scenario and / or a communication module in the communication scenario, other scenarios may exist where other modules generate significant currents during operation, which can interfere with the magnetic field of the compass. These embodiments do not limit the specific scenarios or modules that cause interference.

[0082] To better understand the electronic device provided in the embodiments of this application, the electronic device provided in the embodiments of this application will be described in detail below.

[0083] Figure 2 A schematic diagram of the hardware structure of an electronic device according to an embodiment of this application is shown. Figure 2As shown, the electronic device includes a first module 210, a first impedance unit 220, a first amplification unit 230, a first compensation unit 240, and a compass 250. The first impedance unit 220 is connected in series in the working circuit of the first module 210. Both ends of the first impedance unit 220 are also connected to the input terminals of the first amplification unit 230, and the output terminal of the first amplification unit 230 is connected to the first compensation unit 240. The first amplification unit 230 amplifies the voltage of the first impedance unit 220 and outputs it when the first module 210 is working. The two ends of the first compensation unit 240 are the first end and the second end. The distance between the compass 250 and the first compensation unit 240 is the first distance. The angle formed by the first compensation unit 240 and the first line segment is the first angle. The first line segment is the line connecting the first end and the compass 250. The angle formed by the first compensation unit 240 and the second line segment is the first angle. The included angle is the second included angle, and the second line segment is the line connecting the second end and the compass 250; the positions of the first compensation unit 240 and the compass 250 are set such that when the first module 210 is working, the following relationship is satisfied: when the current flowing through the first impedance unit 220 is the first current, the current flowing through the first compensation unit 240 is the second current, the direction of the magnetic induction intensity generated by the second current at the compass 250 is opposite to the direction of the magnetic induction intensity generated by the first current at the compass 250, the value of the magnetic induction intensity generated by the second current at the compass 250 is inversely correlated with the first distance, and positively correlated with the second current and the first difference, the first difference being the difference between the cosine value of the first included angle and the cosine value of the second included angle.

[0084] The current generated when the first module 210 is working will have a significant impact on the magnetic field of the compass 250. Therefore, the first module 210 is a module that can have a significant impact on the magnetic field of the compass 250. For example, the first module 210 can be the one described above. Figure 1 The charging module 140 or communication module 160 shown is an example. A first impedance unit 220 is connected in series in the working circuit of the first module 210, such that when the first module 210 is working, the current flowing through the first impedance unit 220 is the current generated when the first module 210 is working. The first impedance unit 220 can be a device with resistance, for example, a resistor. The voltage of the first compensation unit 240 can be the voltage output by the first amplification unit 230. When the first amplification unit 230 outputs a voltage, the first compensation unit 240 can generate current. In some implementations, the first compensation unit 240 can be a straight wire or a resistor. The first amplification unit 230 can amplify the voltage; for example, the first amplification unit 230 can be a voltage amplifier or an operational amplifier circuit. This application does not limit the specific amplification factor of the first amplification unit 230.

[0085] When the first module 210 is working, the current flowing through the first impedance unit 220 is the current generated when the first module 210 is working. The first amplification unit 230 can amplify the voltage of the first impedance unit 220 and output it, so that the current flowing through the first compensation unit 240 is the second current. The value of the magnetic induction intensity generated by the second current at the compass 250 is related to the deployment position of the compass 250 and the value of the second current. The value of the magnetic induction intensity generated by the second current at the compass 250 can be less than or equal to the value of the magnetic induction intensity generated by the first current at the compass 250. The direction of the magnetic induction intensity generated by the second current at the compass 250 is opposite to the direction of the magnetic induction intensity generated by the first current at the compass 250. In this way, the influence of the magnetic field of the first current at the compass 250 can be reduced, which is conducive to making the difference between two adjacent data obtained by the compass 250 less than a preset difference value, thereby reducing the number of times the compass 250 needs to be calibrated, reducing user operations, and improving user experience. Furthermore, by reducing the influence of the first current on the magnetic field of the compass by the second current flowing through the first compensation unit, the influence of the first current on the magnetic field of the compass can be quickly compensated with minimal delay, high real-time performance, and no impact on the accuracy of the compass.

[0086] The positioning of the first compensation unit 240 and the compass 250 is such that the magnetic induction intensity generated by the second current at the compass 250 is inversely correlated with the first distance and positively correlated with the second current and the first difference, where the first difference is the difference between the cosine of the first angle and the cosine of the second angle. In some implementations, the relationship between the first distance, the first angle, and the second angle satisfies the following formula:

[0087]

[0088] B x21 =B p1 *sinθ 01 *cosθ 31 ≤B x1

[0089] B y21 =B p1 *sinθ 01 *cosθ 31 ≤B y1

[0090] B z21 =B p1 *cosθ 01 ≤B z1

[0091] Among them, B p1Let I be the magnetic field strength generated by the second current at point 250 on the compass, a1 be the first distance, and θ be the magnetic field strength generated by the second current at point 250 on the compass. 11 Let θ be the first included angle. 21 The second included angle, μ0 is the free permeability, and B x21 For B p1 In a three-dimensional coordinate system, the component in the X direction, B y21 For B p1 The component in the Y direction in a three-dimensional coordinate system, B z21 For B p1 The component along the Z direction in a three-dimensional coordinate system, θ 01 θ is the angle between the plane formed by the magnetic sensors in the first compensation unit 240 and the compass 250 and the plane containing the circuit board of the electronic device. 31 The angle formed by the first compensation unit 240 and the long side of the circuit board is defined. The circuit board contains a first module, a first impedance unit, a first amplification unit, the first compensation unit 240, and a compass 250. x1 B is the component of the magnetic field strength produced by the first current at compass position 250 in the X direction. y1 Let B be the component of the magnetic field strength produced by the first current at compass position 250 in the Y direction. z1 Let be the Z-direction component of the magnetic flux density generated by the first current at compass position 250.

[0092] The positions of the first compensation unit 240 and the compass 250 are configured such that the component of the magnetic induction intensity generated by the second current at the compass 250 in the X direction is less than or equal to the component of the magnetic induction intensity generated by the first current at the compass 250 in the X direction, the component of the magnetic induction intensity generated by the second current at the compass 250 in the Y direction is less than or equal to the component of the magnetic induction intensity generated by the first current at the compass 250 in the Y direction, and the component of the magnetic induction intensity generated by the second current at the compass 250 in the Z direction is less than or equal to the component of the magnetic induction intensity generated by the first current at the compass 250 in the Z direction.

[0093] For example, Figure 3 A schematic diagram showing the deployment location of a first compensation unit and a compass is provided. Figure 3 As shown, in the plane formed by the first compensation unit and the compass, the first distance between the compass 250 and the first compensation unit 240 is represented by a1, the line connecting the first end to the compass 250 is the first line segment, and the first included angle formed by the first compensation unit 240 and the first line segment is represented by θ. 11 This indicates that the line connecting the second end to the compass 250 is the second line segment, and the second included angle formed by the first compensation unit 240 and the second line segment is denoted by θ. 21The second current flowing through the first compensation unit 240 can be represented by I, and the value of the magnetic induction intensity generated by the second current I at the compass 250 is represented by B. p1 It means that B p1 This can be expressed by the formula above.

[0094] In the perspective view of the first compensation unit and compass deployment, the circuit board includes a first module 210, a first impedance unit 220, a first amplification unit 230, a first compensation unit 240, and a compass 250. The first module 210, first impedance unit 220, and first amplification unit 230 are not shown. It should be noted that the circuit board has a certain height, causing the plane formed by the magnetic sensors in the first compensation unit 240 and the compass 250 to form a certain angle with the plane of the circuit board. Figure 3 As shown, the angle between the plane formed by the magnetic sensor in the first compensation unit 240 and the compass 250 and the plane of the circuit board is θ. 01 The angle between the first compensation unit 240 and the long side of the circuit board is θ. 31 Understandably, when the deployment positions of the compass 250 and the first compensation unit 240 are determined, θ 01 and θ 31 It is known. The current flowing through the first compensation unit 240 is the second current, and the direction of the second current can be as follows: Figure 3 As shown, the direction of the magnetic field strength generated by the second current at compass 250 is as follows: Figure 3 As shown. The magnetic induction intensity B produced by the second current at point 250 on the compass. p1 The relationship between the components in each direction and the components in each direction of the magnetic induction intensity generated by the first current at compass 250 can be shown by the formula above.

[0095] When the current flowing through the first impedance unit 220 is the first current, the current flowing through the first compensation unit 240 is the second current. The reason for this design will be explained below.

[0096] When the current flowing through the first impedance unit 220 is the first current, the value and direction of the magnetic induction intensity generated by the first current at the compass 250 are measurable. Given that the magnetic induction intensity generated by the first current at the compass 250 is known, the X-axis, Y-axis, and Z-axis components of the magnetic induction intensity generated by the first current at the compass 250 are also known. If the magnetic induction intensity B generated by the second current at the compass 250 is... p1 The component along the X-axis is equal to the component along the X-axis of the magnetic field strength produced by the first current at compass 250, causing the magnetic field strength B produced by the second current at compass 250 to... p1The component of the magnetic field strength along the Y-axis is equal to the component of the magnetic field strength produced by the first current at compass position 250 along the Y-axis. If the component of the second magnetic field strength along the Z-axis is equal to the component of the magnetic field strength produced by the first current at compass position 250 along the Z-axis, then we can obtain B. p1 θ 01 and θ 31 When θ 01 and θ 31 Given that the distance between the compass 250 and the first compensation unit 240 is known, the angle formed by the first compensation unit 240 and the first line segment is known, and the angle formed by the first compensation unit 240 and the second line segment is known. (The last part, "B," appears to be an unrelated instruction and is left untranslated.) p1 Substituting the distance and the two included angles into the above formula, we can obtain the second current. It is understandable that B at this point... p1 The distance and the two included angles are all expected values. When the deployment position of the first compensation unit 240 meets the expected value or has a certain error from the expected value, the influence of the first current on the magnetic field of the compass 250 can be reduced.

[0097] The following embodiment of this application also provides a hardware structure diagram of an electronic device.

[0098] Figure 4 A schematic diagram of the hardware structure of another electronic device provided in an embodiment of this application is shown. For example... Figure 4 As shown, the electronic device includes a first module 210, a first impedance unit 220, a first amplification unit 230, a first compensation unit 240, a compass 250, an analog-to-digital converter (ADC) 410, a control unit 420, a codec 430, a second module 440, a second impedance unit 450, a second amplification unit 460, and a second compensation unit 470.

[0099] The connection relationship between the first module 210, the first impedance unit 220, and the first amplification unit 230 can be as described above. Figure 2As shown, this application embodiment does not limit this. The second impedance unit 450 is connected in series in the working circuit of the second module 440, and the two ends of the second impedance unit 450 are also connected to the input terminal of the second amplification unit 460. The output terminal of the first amplification unit 230 and the output terminal of the second amplification unit 460 are respectively connected to the ADC 410. The ADC 410 is also connected to the control unit 420. The control unit 420 is also connected to the compass 250 and the codec 430. The codec 430 is also connected to the first compensation unit 240 and the second compensation unit 470. The second amplification unit 460 can be used to amplify the voltage of the second impedance unit 450 and output it when the second module 440 is working; wherein, the control unit 420 can be connected to the compass 250 via a two-wire serial (inter-integrated) connection. The circuit (I2C) bus is connected. The two ends of the second compensation unit 470 are the third end and the fourth end. The distance between the compass 250 and the second compensation unit 470 is the second distance. The angle formed by the second compensation unit 470 and the third line segment is the third angle. The third line segment is the line connecting the third end and the compass 250. The angle formed by the second compensation unit 470 and the fourth line segment is the fourth angle. The fourth line segment is the line connecting the fourth end and the compass 250. The positions of the second compensation unit 470 and the compass 250 are set such that when the first... When the second module 440 is working, the following relationship is satisfied: when the current flowing through the second impedance unit 450 is the third current, the current flowing through the second compensation unit 470 is the fourth current. The direction of the magnetic induction intensity generated by the fourth current at the compass 250 is opposite to the direction of the magnetic induction intensity generated by the third current at the compass 250. The value of the magnetic induction intensity generated by the fourth current at the compass 250 is inversely correlated with the second distance and positively correlated with the fourth current and the second difference. The second difference is the difference between the cosine value of the third angle and the cosine value of the fourth angle.

[0100] The first module 210 can be a charging module for charging the battery. In some implementations, the first module 210 includes a fast-charging chip and a battery. The first impedance unit 220 has a small resistance, such as several hundred milliohms, and a relatively small voltage across it, approximately tens of millivolts, thus having little impact on the first module 210. The first impedance unit 220 is connected in series in the operating circuit of the first module 210 and can include various possible implementations. In some implementations, as described above... Figure 4As shown, one end of the first impedance unit 220 can be connected to the battery, and the other end can be connected to ground. This way, the voltage at one end of the first impedance unit 220 is the voltage of the first impedance unit 220 itself, while the other end has no voltage. This results in a lower voltage at the input terminal of the first amplification unit 230, which helps prevent excessive voltage from burning out the first amplification unit 230. In other implementations, one end of the first impedance unit 220 is connected to the fast charging chip, and the other end is connected to the battery. This series connection of the fast charging chip, the first impedance unit 220, and the battery facilitates the acquisition of the operating current of the first module 210. The first amplification unit 230 can be an operational amplifier circuit; in some implementations, the first amplification unit 230 can be composed of A1, R1, R2, R3, and R4.

[0101] The second module 440 can be used to implement communication in electronic devices, such as 5G or Wi-Fi communication. In some implementations, the second module 440 may include a power amplifier (PA) and a 5G or Wi-Fi communication module. The resistance value of the second impedance unit 450 is also relatively small, so its impact on the second module 440 is minimal. The second impedance unit 450 is connected in series in the working circuit of the second module 440, and can be implemented in various ways. For details, please refer to the way the first impedance unit 220 is connected in series in the working circuit of the first module 210, which will not be elaborated here. The second amplification unit 460 can be an operational amplifier circuit. In some implementations, the second amplification unit 460 may be composed of A1, R5, R6, R7, and R8.

[0102] ADC 410 can be any ADC in an electronic device, and this application embodiment does not limit this. For example, ADC 410 can be an ADC included in a power management unit (PMU) in an electronic device, or ADC 410 can be an ADC included in a control unit in an electronic device. Codec 430 can be replaced by any device in an electronic device that can output analog voltage, and this application embodiment does not limit this. For example, codec 430 can be replaced by a voltage regulation unit in an electronic device. For example, the voltage regulation unit can be a MOSFET and a power supply (e.g., a charge pump) for output voltage. The electronic device controls the duty cycle of the power supply output voltage so that the power supply for output voltage can output an analog voltage. Control unit 420 can be a central processing unit (CPU) chip, an application processor (AP) chip, or a system-on-chip (SOC) chip, etc., and this application embodiment does not limit this.

[0103] The ADC 410 can be used to convert the analog voltage output by the first amplification unit 230 and / or the second amplification unit 460 into a digital voltage and then output it. The control unit 420 can be used to obtain a first voltage from the ADC 410 and a second voltage corresponding to the first voltage from a first preset correspondence when the output voltage of the first amplification unit 230 is a first voltage, and output a first indication information to the codec 430 to instruct the codec 430 to output the second voltage; it can also be used to obtain a fourth voltage corresponding to the third voltage from a second preset correspondence when the output voltage of the second amplification unit 460 is a third voltage, and output a second indication information to the codec 430 to instruct the codec 430 to output the fourth voltage. The first and second preset correspondences are calibrated experimentally by the researchers. The second voltage can be greater than or equal to the product of the resistance of the first compensation unit 240 and the second current. When the second voltage is equal to the product of the resistance of the first compensation unit 240 and the second current, the first compensation unit 240 can be connected to the codec 430 or grounded. This simplifies the circuit. When the second voltage is greater than the product of the resistance of the first compensation unit 240 and the second current, other components can be included in the path between the codec 430 and the first compensation unit 240, offering greater flexibility. The relationship between the fourth voltage and the fourth current is similar and will not be elaborated here.

[0104] The codec 430 can be used to obtain first indication information from the control unit 420 and output a second voltage based on the first indication information, so that the current flowing through the first compensation unit 240 is the second current; it can also be used to obtain second indication information from the control unit 420 and output a fourth voltage based on the second indication information, so that the current flowing through the second compensation unit 470 is the fourth current.

[0105] Understandably, when the first module 210 and the second module 440 operate simultaneously, the ADC 410 can obtain two analog voltages, convert them into digital voltages, and transmit them to the control unit 420. After obtaining these two digital voltages, the control unit 420 can retrieve the corresponding voltages from the first and second preset correspondences, respectively, and control the codec 430 to output. At this time, both the first compensation unit 240 and the second compensation unit 470 have current flowing through them.

[0106] In the above Figure 4In the illustrated electronic device, the ADC 410, control unit 420, and codec 430 are all optional. The first amplification unit 230 can provide voltage to the first compensation unit 240. Because the output voltage of the first amplification unit 230 is relatively small, the resistance of the first compensation unit 240 may be relatively small. Therefore, this application sets a first preset correspondence in the control unit 420, in which a first voltage corresponds to a second voltage. The second voltage can be the product of the resistance value of the first compensation unit 240 and the second current. In this way, the resistance value of the first compensation unit 240 can be set to a desired value. When the current flowing through the first impedance unit 240 is the first current, the control unit 420 controls the output of the second voltage. At this time, the current flowing through the first compensation unit is the second current. Thus, the setting of the resistance value of the first compensation unit is relatively flexible. Providing voltage to the second compensation unit 470 through the control unit 420 has the same advantages, which will not be elaborated here.

[0107] The codec 430 outputs a second voltage, causing the current flowing through the first compensation unit 240 to be a second current, or causing the current flowing through the second compensation unit 470 to be a fourth current, which helps to reduce the influence of the first current on the magnetic field near the compass. In some implementations, the codec 430 can also process the audio of the electronic device. In this case, embodiments of this application can use an idle pin of the codec 430 to output a voltage for either the first compensation unit 240 or the second compensation unit 470.

[0108] The ADC 410 converts the analog voltage output by the first amplification unit 230 and / or the second amplification unit 460 into a digital voltage, which can facilitate the subsequent determination of the voltage of the first compensation unit 240 or the second compensation unit 470 and help improve the calculation speed.

[0109] When there is a deviation between the deployment location of the first compensation unit 240 and the expected value, this embodiment of the application can, when determining the deployment location of the first compensation unit 240 in the electronic device, measure the difference between the magnetic induction intensity generated by the first current at the compass 250 and the magnetic induction intensity generated by the second current at the compass 250, determine the impact on the compass 250 reading through this difference, calculate the compensation amount for the compass 250 reading, and store the calculation relationship between the compensation amount and the first current in the electronic device. This is so that when the electronic device calls the compass 250, for example, when it needs to display the parameters obtained using the compass 250, further compensation is performed on the data obtained using the compass 250, and the compensated data is used as the final data obtained using the compass 250, so as to further reduce the impact of the first current at the compass 250.

[0110] For example, the electronic device can be used to respond to a user's operation using a compass application or a map application to obtain the reading of the compass 250, the compass reading including the values ​​of the compass 250 in M ​​directions in an M-dimensional coordinate system; to compensate for the value in any one of the M directions to obtain compensated data, the compensated data being used to represent the location data of the electronic device; wherein, the compensation amount corresponding to the value in any direction is related to a first current, the compensation offset in any direction, and the compensation slope in any direction, and the compensation offset and the compensation slope in any direction are both constants.

[0111] The electronic device can be preset with compensation offset and compensation slope in any direction. In response to user operations using a compass or map application, it can calculate the compensation amount in any direction based on the first current, the compensation offset in any direction, and the compensation slope in any direction, and then compensate the compass reading in the corresponding direction based on the compensation amount. This further compensation of the compass reading helps to further reduce the influence of the first current on the magnetic field around the compass.

[0112] Optionally, the compensation offset and compensation slope in any direction can be such that the sum of the compensation amount corresponding to the value in any direction and the component of the first magnetic flux density in any direction is less than or equal to the component of the second magnetic flux density in any direction. The first magnetic flux density is the magnetic flux density generated by the second current at the compass, and the second magnetic flux density is the magnetic flux density generated by the first current at the compass. In this way, the sum of the compensation amount corresponding to the value in any direction calculated using the compensation offset and compensation slope in any direction, and the component of the first magnetic flux density in any direction, can be less than or equal to the component of the second magnetic flux density in any direction, which helps to reduce the influence of the first current on the magnetic field of the compass.

[0113] In some implementations, the compensation amount corresponding to the value in any of the above directions is related to the first current, the compensation offset in any direction, and the compensation slope in any direction as follows:

[0114] Y 1 =K 1 I+B 1

[0115] Among them, Y 1 K represents the compensation amount corresponding to the value in any direction. 1 For the compensation slope in any direction, B 1 The compensation offset in any direction, where I is the first current.

[0116] When the compensation offset and the compensation slope in any direction are constant, the first current and the compensation amount corresponding to the value in any direction have a linear relationship. This relationship is simple and helps to improve the speed of calculating the compensation amount.

[0117] For example, Figure 5 A schematic diagram illustrating a linear relationship is shown. (For example...) Figure 5 As shown, the unit of the first current I is amperes (A), and the compensation amount Y... 1 The unit is microtesla (μT). The correspondence between the first current and the compensation amount of at least one directional axis can be linear, such as... Figure 5 As shown, when the first current is 4A, the compensation amount is 20μT; when the first current is 8A, the compensation amount is 40μT. Therefore, the relationship between the first current and the compensation amount can be expressed as Y. 1 =K 1 I+B 1 , where Y 1 It is 5, B 1 It is 0.

[0118] It is understood that if the M-dimensional coordinate system is a three-dimensional coordinate system, the three-dimensional coordinate system can include the X-direction, Y-direction, and Z-direction. The compensation amount in the X-direction can be related to the compensation slope and compensation offset in the X-direction; the compensation amount in the Y-direction can be related to the compensation slope and compensation offset in the Y-direction; and the compensation amount in the Z-direction can be related to the compensation slope and compensation offset in the Z-direction. The compensation slope, compensation offset, compensation slope, compensation offset, and compensation offset in the X-direction, Y-direction, and Z-direction are all constants, and their values ​​can be the same or different. This application does not limit this aspect in the embodiments.

[0119] Understandably, the correspondence between the first current and the compensation amounts in each direction is pre-established, determined based on the compass 250 data under charging scenarios (various charging currents) and non-charging scenarios during the test. This allows the electronic device to perform compensation in all directions of the coordinate system, providing greater flexibility.

[0120] Optionally, if the aforementioned M-dimensional coordinate system is a three-dimensional coordinate system, then the reading of the compass 250 includes the values ​​of the compass 250 in each direction in the three-dimensional coordinate system. The compensation amount corresponding to the values ​​in each direction in the three-dimensional coordinate system, the components of the magnetic induction intensity generated by the first current at the compass 250 in each direction in the three-dimensional coordinate system, and the components of the magnetic induction intensity generated by the second current at the compass 250 in each direction in the three-dimensional coordinate system satisfy the following formula:

[0121]

[0122] B x22 =B p2 *sinθ 02 *cosθ 32 +Y x ≤B x1

[0123] B y22 =B p2 *sinθ 02 *cosθ 32 +Y y ≤B y1

[0124] B z22 =B p2 *cosθ 02 +Y z ≤B z1

[0125] Among them, B p2 Let I be the magnetic field strength generated by the second current at point 250 on the compass, a be the first distance, and θ be the magnetic field strength produced by the second current at point 250 on the compass. 12 Let θ be the first included angle. 22 The second included angle, μ0 is the free permeability, and B x22 For B p2 In a three-dimensional coordinate system, the component in the X direction, B y22 For B p2 The component in the Y direction in a three-dimensional coordinate system, B z22 For B p2 The component along the Z direction in a three-dimensional coordinate system, θ 02 θ is the angle between the plane formed by the magnetic sensors in the first compensation unit 240 and the compass 250 and the plane containing the circuit board of the electronic device. 32 The angle formed by the first compensation unit 240 and the long side of the circuit board is defined by the angle between the first compensation unit 240 and the long side of the circuit board. The circuit board is equipped with a first module 210, a first impedance unit 220, a first amplification unit 230, a first compensation unit 240, and a compass 250. x1 B is the component of the magnetic field strength produced by the first current at compass position 250 in the X direction. y1 Let B be the component of the magnetic field strength produced by the first current at compass position 250 in the Y direction. z1 Y is the Z-direction component of the magnetic field strength generated by the first current at compass position 250. x The compensation amount corresponding to the value in the X direction, Y y The compensation amount corresponding to the value in the Y direction, Y z This is the compensation amount corresponding to the value in the Z direction.

[0126] In this way, the components of the magnetic induction intensity generated by the second current at the compass 250 in each direction, plus the compensation amount in each direction, can be less than the components of the magnetic induction intensity generated by the first current at the compass 250 in each direction, which is beneficial to reducing the influence of the first current on the magnetic field where the compass 250 is located.

[0127] It is understandable that in standby mode, the electronic device does not invoke the compass, and therefore may not execute the methods provided in this application embodiment to save power. When the electronic device's application invokes the compass (or in a scenario where the compass is registered), the electronic device can execute the methods provided in this application embodiment to obtain relatively accurate data using the compass.

[0128] This application also provides a computer program product comprising one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. For example, available media may include magnetic media (e.g., floppy disk, hard disk, or magnetic tape), optical media (e.g., digital versatile disc (DVD)), or semiconductor media (e.g., solid-state disk (SSD)).

[0129] This application also provides a computer-readable storage medium. The methods described in the above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any combination thereof. The computer-readable medium may include computer storage media and communication media, and may also include any medium capable of transferring a computer program from one place to another. The storage medium can be any target medium accessible by a computer.

[0130] As one possible design, computer-readable media may include compact disc read-only memory (CD-ROM), RAM, ROM, EEPROM, or other optical disc storage; computer-readable media may also include disk storage or other disk storage devices. Furthermore, any connecting cable may also be appropriately referred to as computer-readable media. For example, if software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave, then coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of media. As used herein, disks and optical discs include optical discs (CD), laser discs, optical discs, digital versatile discs (DVD), floppy disks, and Blu-ray discs, where disks typically reproduce data magnetically, while optical discs optically reproduce data using lasers.

[0131] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

Claims

1. An electronic device, characterized in that, The electronic device includes a first module, a first impedance unit, a first amplification unit, a first compensation unit, and a compass; the first impedance unit is connected in series in the working circuit of the first module, and both ends of the first impedance unit are also connected to the input terminal of the first amplification unit, and the output terminal of the first amplification unit is connected to the first compensation unit. The first amplification unit is used to amplify the voltage of the first impedance unit and output it when the first module is working; Wherein, the two ends of the first compensation unit are a first end and a second end; the distance between the compass and the first compensation unit is a first distance; the angle formed by the first compensation unit and a first line segment is a first angle; the first line segment is the line connecting the first end and the compass; the angle formed by the first compensation unit and a second line segment is a second angle; the second line segment is the line connecting the second end and the compass; the positions of the first compensation unit and the compass are arranged such that when the first module is working, the following relationship is satisfied: When the current flowing through the first impedance unit is the first current, the current flowing through the first compensation unit is the second current. The direction of the magnetic induction intensity generated by the second current at the compass is opposite to the direction of the magnetic induction intensity generated by the first current at the compass. The value of the magnetic induction intensity generated by the second current at the compass is inversely correlated with the first distance and positively correlated with the second current and the first difference. The first difference is the difference between the cosine value of the first angle and the cosine value of the second angle.

2. The electronic device according to claim 1, characterized in that, When the current flowing through the first impedance unit is the first current, the output voltage of the first amplification unit is the first voltage. The electronic device also includes a control unit, which is connected to the output terminal of the first amplification unit and is also connected to the first compensation unit. The control unit is used to obtain a second voltage corresponding to the first voltage from a first preset correspondence, and control the output of the second voltage.

3. The electronic device according to claim 2, characterized in that, The electronic device further includes a codec connected to the control unit and also connected to the first compensation unit; The control unit is configured to transmit first indication information to the codec when it obtains the second voltage corresponding to the first voltage from the first preset correspondence. The first indication information is used to instruct the codec to output the second voltage.

4. The electronic device according to claim 2, characterized in that, The electronic device further includes a voltage regulation unit, which is connected to the control unit and also connected to the first compensation unit; The control unit is configured to control the voltage regulation unit to output the second voltage when it obtains the second voltage corresponding to the first voltage from the first preset correspondence.

5. The electronic device according to claim 1, characterized in that, The electronic device further includes a second module, a second impedance unit, a second amplification unit, and a second compensation unit; the second impedance unit is connected in series in the working circuit of the second module, and the two ends of the second impedance unit are also connected to the input terminal of the second amplification unit, and the output terminal of the second amplification unit is connected to the second compensation unit; The second amplification unit is used to amplify the voltage of the second impedance unit and output it when the second module is working; Wherein, the two ends of the second compensation unit are the third end and the fourth end; the distance between the compass and the second compensation unit is the second distance; the angle formed by the second compensation unit and the third line segment is the third angle; the third line segment is the line connecting the third end and the compass; the angle formed by the second compensation unit and the fourth line segment is the fourth angle; the fourth line segment is the line connecting the fourth end and the compass; the positions of the second compensation unit and the compass are arranged such that when the second module is working, the following relationship is satisfied: When the current flowing through the second impedance unit is the third current, the current flowing through the second compensation unit is the fourth current. The direction of the magnetic induction intensity generated by the fourth current at the compass is opposite to the direction of the magnetic induction intensity generated by the third current at the compass. The value of the magnetic induction intensity generated by the fourth current at the compass is inversely correlated with the second distance and positively correlated with the fourth current and the second difference. The second difference is the difference between the cosine of the third angle and the cosine of the fourth angle.

6. The electronic device according to claim 5, characterized in that, The first module is a charging module for the electronic device, used to charge the battery of the electronic device; the second module is a communication module for the electronic device, used to enable wireless communication of the electronic device; or, The first module is the communication module of the electronic device, used to realize wireless communication of the electronic device; the second module is the charging module of the electronic device, used to charge the battery of the electronic device.

7. The electronic device according to any one of claims 1 to 6, characterized in that, The positions of the first compensation unit and the compass are set such that the relationship between the first distance, the first included angle, and the second included angle satisfies the following formula: in, Let I be the magnetic field strength generated by the second current at the compass, and let a1 be the first distance. The first included angle, The second included angle, The permeability of free space, For the The component in the X direction in a three-dimensional coordinate system For the The component in the Y direction in the three-dimensional coordinate system, For the The component in the Z direction in the three-dimensional coordinate system, The angle between the plane formed by the first compensation unit and the magnetic sensor in the compass and the plane where the circuit board of the electronic device is located. The angle formed by the first compensation unit and the long side of the circuit board is defined. The circuit board is equipped with the first module, the first impedance unit, the first amplification unit, the first compensation unit, and the compass. The component of the magnetic flux density generated by the first current at the compass in the X direction. Let Y be the component of the magnetic flux density generated by the first current at the compass in the Y direction. The component of the magnetic flux density generated by the first current at the compass in the Z direction.

8. The electronic device according to any one of claims 1 to 6, characterized in that, The electronic device is used to obtain the reading of the compass in response to the user's operation of using a compass application or a map application. The reading of the compass includes the values ​​of the compass in M ​​directions in an M-dimensional coordinate system. The value of any one of the M directions is compensated to obtain compensated data, which is used to represent the location data of the electronic device; wherein, the compensation amount corresponding to the value of any one direction is related to the first current, the compensation offset of any one direction, and the compensation slope of any one direction, and the compensation offset and the compensation slope of any one direction are both constants.

9. The electronic device according to claim 8, characterized in that, The compensation amount corresponding to the value in any direction is related to the first current, the compensation offset in any direction, and the compensation slope in any direction by the following relationship: Among them, Y 1 K is the compensation amount corresponding to the value in any of the directions. 1 B is the compensation slope in any of the directions. 1 The compensation offset in any direction, I 1 This is the first current.

10. The electronic device according to claim 9, characterized in that, The compensation offset in any direction and the compensation slope in any direction are such that the sum of the compensation amount corresponding to the value in any direction and the component of the first magnetic induction intensity in any direction is less than or equal to the component of the second magnetic induction intensity in any direction, wherein the first magnetic induction intensity is the magnetic induction intensity generated by the second current at the compass, and the second magnetic induction intensity is the magnetic induction intensity generated by the first current at the compass.

11. The electronic device according to claim 9 or 10, characterized in that, The M-dimensional coordinate system is a three-dimensional coordinate system. Therefore, the compass reading includes the compass value in each direction within the three-dimensional coordinate system. The compensation amount corresponding to the value in each direction, the components of the magnetic induction intensity generated by the first current at the compass in each direction within the three-dimensional coordinate system, and the components of the magnetic induction intensity generated by the second current at the compass in each direction within the three-dimensional coordinate system satisfy the following formula: in, Let I be the magnetic field strength generated by the second current at the compass, and let a1 be the first distance. The first included angle, The second included angle, The permeability of free space, For the The component in the X direction in the three-dimensional coordinate system, For the The component in the Y direction in the three-dimensional coordinate system, For the The component in the Z direction in the three-dimensional coordinate system, The angle between the plane formed by the first compensation unit and the magnetic sensor in the compass and the plane where the circuit board of the electronic device is located. The angle formed by the first compensation unit and the long side of the circuit board is defined. The circuit board is equipped with the first module, the first impedance unit, the first amplification unit, the first compensation unit, and the compass. The component of the magnetic flux density generated by the first current at the compass in the X direction. Let Y be the component of the magnetic flux density generated by the first current at the compass in the Y direction. Let Z be the component of the magnetic flux density generated by the first current at the compass in the Z direction. This is the compensation amount corresponding to the value in the X direction. The compensation amount corresponding to the value in the Y direction. This is the compensation amount corresponding to the value in the Z direction.

12. The electronic device according to any one of claims 1 to 6, characterized in that, The first impedance unit is connected to the first module, and the first impedance unit is also grounded.

13. A control method, characterized in that, This invention relates to an electronic device comprising a first module, a first impedance unit, a first amplification unit, a first compensation unit, a compass, and a control unit. The first impedance unit is connected in series in the working circuit of the first module, and both ends of the first impedance unit are connected to the input terminal of the first amplification unit. The output terminal of the first amplification unit is connected to the first compensation unit. The first amplification unit amplifies the voltage of the first impedance unit and outputs it when the first module is working. The first compensation unit has two ends: a first end and a second end. The distance between the compass and the first compensation unit is a first distance. The angle formed by the first compensation unit and a first line segment is a first angle. The first line segment is the line connecting the first end and the compass. The angle formed by the first compensation unit and a second line segment is a second angle. The second line segment is the line connecting the second end and the compass. The method includes: When the current flowing through the first impedance unit is the first current, the control unit controls the current flowing through the first compensation unit to be the second current. The direction of the magnetic induction intensity generated by the second current at the compass is opposite to the direction of the magnetic induction intensity generated by the first current at the compass. The value of the magnetic induction intensity generated by the second current at the compass is inversely correlated with the first distance and positively correlated with the second current and the first difference. The first difference is the difference between the cosine of the first angle and the cosine of the second angle.

14. The method according to claim 13, characterized in that, The positions of the first compensation unit and the compass are set such that the relationship between the first distance, the first included angle, and the second included angle satisfies the following formula: in, Let I be the magnetic field strength generated by the second current at the compass, and let a1 be the first distance. The first included angle, The second included angle, The permeability of free space, For the The component in the X direction in a three-dimensional coordinate system For the The component in the Y direction in the three-dimensional coordinate system, For the The component in the Z direction in the three-dimensional coordinate system, The angle between the plane formed by the first compensation unit and the magnetic sensor in the compass and the plane where the circuit board of the electronic device is located. The angle formed by the first compensation unit and the long side of the circuit board is defined. The circuit board is equipped with the first module, the first impedance unit, the first amplification unit, the first compensation unit, and the compass. The component of the magnetic flux density generated by the first current at the compass in the X direction. Let Y be the component of the magnetic flux density generated by the first current at the compass in the Y direction. The component of the magnetic flux density generated by the first current at the compass in the Z direction.

15. The method according to claim 13, characterized in that, When the current flowing through the first impedance unit is a first current, the method further includes: In response to a user's operation using a compass application or map application, the compass reading is obtained, and the compass reading includes the values ​​of the compass in M ​​directions in an M-dimensional coordinate system; The value of any one of the M directions is compensated to obtain compensated data, which is used to represent the location data of the electronic device; wherein, the compensation amount corresponding to the value of any one direction is related to the first current, the compensation offset of any one direction, and the compensation slope of any one direction, and the compensation offset and the compensation slope of any one direction are both constants.

16. The method according to claim 15, characterized in that, The compensation amount corresponding to the value in any direction is related to the first current, the compensation offset in any direction, and the compensation slope in any direction by the following relationship: Among them, Y 1 K is the compensation amount corresponding to the value in any of the directions. 1 B is the compensation slope in any of the directions. 1 The compensation offset in any direction, I 1 This is the first current.

17. The method according to claim 15 or 16, characterized in that, The compensation offset in any direction and the compensation slope in any direction are such that the sum of the compensation amount corresponding to the value in any direction and the component of the first magnetic induction intensity in any direction is less than or equal to the component of the second magnetic induction intensity in any direction, wherein the first magnetic induction intensity is the magnetic induction intensity generated by the second current at the compass, and the second magnetic induction intensity is the magnetic induction intensity generated by the first current at the compass.

18. The method according to claim 15 or 16, characterized in that, The M-dimensional coordinate system is a three-dimensional coordinate system. Therefore, the compass reading includes the compass value in each direction within the three-dimensional coordinate system. The compensation amount corresponding to the value in each direction, the components of the magnetic induction intensity generated by the first current at the compass in each direction within the three-dimensional coordinate system, and the components of the magnetic induction intensity generated by the second current at the compass in each direction within the three-dimensional coordinate system satisfy the following formula: in, Let I be the magnetic field strength generated by the second current at the compass, and let a1 be the first distance. The first included angle, The second included angle, The permeability of free space, For the The component in the X direction in the three-dimensional coordinate system, For the The component in the Y direction in the three-dimensional coordinate system, For the The component in the Z direction in the three-dimensional coordinate system, The angle between the plane formed by the first compensation unit and the magnetic sensor in the compass and the plane where the circuit board of the electronic device is located. The angle formed by the first compensation unit and the long side of the circuit board is defined. The circuit board is equipped with the first module, the first impedance unit, the first amplification unit, the first compensation unit, and the compass. The component of the magnetic flux density generated by the first current at the compass in the X direction. Let Y be the component of the magnetic flux density generated by the first current at the compass in the Y direction. Let Z be the component of the magnetic flux density generated by the first current at the compass in the Z direction. This is the compensation amount corresponding to the value in the X direction. The compensation amount corresponding to the value in the Y direction. This is the compensation amount corresponding to the value in the Z direction.

19. An electronic device, characterized in that, include: The system includes a processor, a memory, a first module, a first impedance unit, a first amplification unit, a first compensation unit, and a compass. The first impedance unit is connected in series in the working circuit of the first module. Both ends of the first impedance unit are also connected to the input terminal of the first amplification unit, and the output terminal of the first amplification unit is connected to the first compensation unit. The first amplification unit is used to amplify the voltage of the first impedance unit and output it when the first module is working; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the electronic device to perform the method as described in any one of claims 13-18.

20. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 13-18.

21. A computer program product, characterized in that, Includes a computer program that, when run, causes a computer to perform the method as described in any one of claims 13-18.

Citation Information

Patent Citations

  • System and method for eliminating charging interference of electronic compass and electronic device

    CN113155113A

  • Method and system for electronic compass calibration and verification

    US20060152217A1