Data adjustment method and device, equipment and medium
By fitting and adjusting the magnetic field data collected after rotation of the rotatable magnetic device, the problem of inaccuracy of magnetic field data caused by assembly error and rotation is solved, and the accuracy of functional implementation is improved.
Patent Information
- Application Number
- CN202510245719.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-03
- Publication Date
- 2025-06-20
AI Technical Summary
Assembly errors and rotation of rotatable magnetic devices will lead to inaccuracy of magnetic field data, affecting the functional implementation of electronic devices.
By rotating the rotatable magnetic device while keeping the position of the electronic device unchanged, multiple magnetic field data components are acquired, and elliptic curve fitting is performed to obtain adjustment parameters, and then adjust the magnetic field data to reduce errors.
The accuracy and reliability of magnetic field data are improved, thereby improving the accuracy of determining the rotation angle of rotatable magnetic devices and ensuring the accurate implementation of the corresponding functions.
Smart Images

Figure CN120179091A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of computer technology, and particularly relates to a data adjustment method, apparatus, device, and medium. Background Art
[0002] As the functions of electronic devices become more and more abundant, there are also more and more components in electronic devices.
[0003] Some electronic devices have rotatable magnetic components. By rotating the rotatable magnetic component, corresponding functions can be realized. Specifically, the electronic device can determine the rotation angle of the rotatable magnetic component based on magnetic field data, and realize corresponding functions based on the rotation angle difference before and after the rotation of the rotatable magnetic component. For example, the magnetic crown of a smart watch can adjust the interface, functions, applications, etc. of the smart watch by rotating the magnetic crown.
[0004] However, both the assembly error of the rotatable magnetic component and the rotation of the rotatable magnetic component will cause changes in the surrounding magnetic field, thereby affecting the accuracy of the magnetic field data collected by the electronic device. Subsequently, the rotation angle of the rotatable magnetic component determined based on the magnetic field data will be inaccurate, and the corresponding functions cannot be accurately realized. Summary of the Invention
[0005] The purpose of the embodiments of this application is to provide a data adjustment method, apparatus, device, and medium, which can adjust magnetic field data through the adjustment parameters obtained by fitting, reduce the influence of the assembly error of the rotatable magnetic component and the rotation of the rotatable magnetic component on the magnetic field data, improve the accuracy and reliability of the magnetic field data, thereby improving the accuracy of determining the rotation angle of the rotatable magnetic component, and ensuring that the corresponding functions can be accurately realized.
[0006] In a first aspect, the embodiments of this application provide a data adjustment method, which is applied to an electronic device. The electronic device includes a rotatable magnetic component. The method includes:
[0007] Rotate the rotatable magnetic component while keeping the position of the electronic device unchanged;
[0008] Obtain a plurality of first magnetic field data components in a first direction and a plurality of second magnetic field data components in a second direction. Each first magnetic field data component corresponds to a second magnetic field data component. The first direction and the second direction are perpendicular to each other, and both the first direction and the second direction are parallel to the rotation plane of the rotatable magnetic component;
[0009] Perform elliptic curve fitting on the plurality of first magnetic field data components and the plurality of second magnetic field data components to obtain adjustment parameters;
[0010] Adjust the magnetic field data based on the adjustment parameters to obtain adjusted magnetic field data.
[0011] In a second aspect, an embodiment of the present application provides a data adjustment device, which is applied to an electronic device. The electronic device includes a rotatable magnetic device. The device includes:
[0012] A rotation module, configured to rotate the rotatable magnetic device while keeping the position of the electronic device unchanged;
[0013] A first acquisition module, configured to acquire a plurality of first magnetic field data components in a first direction and a plurality of second magnetic field data components in a second direction. Each first magnetic field data component corresponds to a second magnetic field data component. The first direction and the second direction are perpendicular to each other, and both the first direction and the second direction are parallel to the rotation plane of the rotatable magnetic device;
[0014] A fitting module, configured to perform elliptic curve fitting on the plurality of first magnetic field data components and the plurality of second magnetic field data components to obtain adjustment parameters;
[0015] An adjustment module, configured to adjust the magnetic field data based on the adjustment parameters to obtain adjusted magnetic field data.
[0016] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory. The memory stores a program or instruction that can run on the processor. When the program or instruction is executed by the processor, the steps of the method described in the first aspect are implemented.
[0017] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0018] In a fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor, and the processor is configured to run a program or instruction to implement the method described in the first aspect.
[0019] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the method described in the first aspect.
[0020] In an embodiment of the present application, the rotatable magnetic device can be rotated while keeping the position of the electronic device unchanged, and a plurality of first magnetic field data components in a first direction and a plurality of second magnetic field data components in a second direction are acquired. Each first magnetic field data component corresponds to a second magnetic field data component. The first direction and the second direction are perpendicular to each other, and both the first direction and the second direction are parallel to the rotation plane of the rotatable magnetic device. By performing elliptic curve fitting on the plurality of first magnetic field data components and the plurality of second magnetic field data components, an adjustment parameter can be obtained. Then, the magnetic field data can be adjusted based on the adjustment parameter to obtain adjusted magnetic field data. In this way, by adjusting the magnetic field data with the adjustment parameter obtained by fitting, the assembly error of the rotatable magnetic device and the influence of the rotation of the rotatable magnetic device on the magnetic field data can be reduced, the accuracy and reliability of the magnetic field data can be improved, thereby improving the accuracy of determining the rotation angle of the rotatable magnetic device and ensuring that the corresponding functions can be accurately realized. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 is a schematic structural diagram of an electronic device according to an exemplary embodiment;
[0022] Figure 2 is one of the schematic flowcharts of a data adjustment method according to an exemplary embodiment;
[0023] Figure 3 is one of the schematic structural diagrams of a rotatable magnetic device according to an exemplary embodiment;
[0024] Figure 4 is another schematic structural diagram of a rotatable magnetic device according to an exemplary embodiment;
[0025] Figure 5 is one of the schematic diagrams of a magnetic field data distribution according to an exemplary embodiment;
[0026] Figure 6 is another schematic diagram of a magnetic field data distribution according to an exemplary embodiment;
[0027] Figure 7 is yet another schematic diagram of a magnetic field data distribution according to an exemplary embodiment;
[0028] Figure 8 is a schematic diagram of an adjusted magnetic field data distribution according to an exemplary embodiment;
[0029] Figure 9 is a schematic diagram of a scenario of external magnetic field interference according to an exemplary embodiment;
[0030] Figure 10It is the second flowchart diagram of a data adjustment method shown according to an exemplary embodiment;
[0031] Figure 11 It is the third flowchart diagram of a data adjustment method shown according to an exemplary embodiment;
[0032] Figure 12 It is the structural block diagram of a data adjustment device shown according to an exemplary embodiment;
[0033] Figure 13 It is the structural block diagram of an electronic device shown according to an exemplary embodiment;
[0034] Figure 14 It is the hardware structural diagram of an electronic device for implementing the embodiments of the present application. Detailed implementation manners
[0035] Next, the technical solutions in the embodiments of the present application will be clearly described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art belong to the scope of protection of the present application.
[0036] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. generally belong to the same category, and do not limit the number of objects. For example, the first object can be one or multiple. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / " generally indicates an "or" relationship between the associated objects before and after.
[0037] As in the background art, with the development of technology, electronic devices have become an indispensable part of daily life. Some electronic devices have rotatable magnetic devices, and corresponding functions can be realized by rotating the rotatable magnetic devices. For example, smart watches.
[0038] The crown of a traditional watch is mainly used to adjust time and date. However, with the emergence of smartwatches, the functions of the crown have changed from traditional functions such as adjusting time and date to functions such as adjusting the interface, functions, and applications of smartwatches. By rotating, pressing, and sliding the crown, users can perform operations such as navigation, application selection, setting adjustment, screen lighting, menu switching, and game state switching on the smartwatch. Currently, most of the crowns used on the market are optical crowns, whose principle is similar to that of watches. They all use built-in optical sensors to capture images, then calculate the relative position of rotation or sliding, and finally report the position information through interruption or polling. Although the code implementation is simple and external interference is small, the optical crown has complex assembly, high structural requirements, and high cost.
[0039] Due to the complex assembly, high structural requirements, and high cost of the optical crown, in related technologies, magnetic crowns are usually used instead of optical crowns. A magnetic crown generally consists of a rotating crown rod, a rotatable magnet, and a Hall sensor. The rotatable magnet is assembled on the rotating crown rod. When the magnetic crown is rotated, the rotatable magnet will also be driven to rotate.
[0040] The rotation of the rotatable magnet will generate a certain amount of hard magnetic environment interference, which will cause errors in the magnetic field data collected by the magnetic crown. Moreover, the assembly error of the magnetic crown itself will also cause errors in the magnetic field data, which will affect the functions that need to be realized based on the magnetic crown in the smartwatch, and the accuracy and reliability of the smartwatch will be affected.
[0041] Therefore, a solution that can improve the accuracy of magnetic field data and ensure the accurate realization of functions related to rotatable magnetic devices is needed.
[0042] Based on this, the embodiments of the present application provide a data adjustment method, device, equipment, and medium. It is possible to rotate the rotatable magnetic device while keeping the position of the electronic device unchanged, and obtain a plurality of first magnetic field data components in a first direction and a plurality of second magnetic field data components in a second direction. Each first magnetic field data component corresponds to a second magnetic field data component. The first direction and the second direction are perpendicular to each other, and both the first direction and the second direction are parallel to the rotation plane of the rotatable magnetic device. By performing elliptic curve fitting on the plurality of first magnetic field data components and the plurality of second magnetic field data components, adjustment parameters can be obtained, and then the magnetic field data can be adjusted based on the adjustment parameters to obtain adjusted magnetic field data. In this way, by adjusting the magnetic field data with the adjustment parameters obtained by fitting, the assembly error of the rotatable magnetic device and the influence of the rotation of the rotatable magnetic device on the magnetic field data can be reduced, the accuracy and reliability of the magnetic field data can be improved, and thus the accuracy of determining the rotation angle of the rotatable magnetic device can be improved, ensuring that the corresponding functions can be accurately realized.
[0043] The data adjustment method, device, equipment, and medium provided in the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings through specific embodiments and their application scenarios.
[0044] The data adjustment method provided in the embodiments of the present application can be applied to an application scenario where the functions of an electronic device are realized through a rotatable magnetic device.
[0045] For the data adjustment method provided in the embodiments of the present application, the execution subject can be an electronic device. The following will be combined with Figure 1 to describe the electronic device provided in the embodiments of the present application in detail.
[0046] Figure 1 is a schematic structural diagram of an electronic device shown according to an exemplary embodiment.
[0047] The electronic device can be an electronic device with a rotatable magnetic device. For example: smart watches, foldable screen mobile phones, smart speakers, etc. The rotatable magnetic device in a smart watch can be a magnetic crown or a magnetic bezel.
[0048] As Figure 1 shown, the electronic device can include: a rotatable magnetic device 110, a microcontroller unit (MCU) 120, and a geomagnetic device 130.
[0049] Among them, the rotatable magnetic device 110 can include a rotatable magnet. Exemplarily, the rotatable magnet can be a permanent magnet. The corresponding functions of the electronic device can be realized by rotating the rotatable magnetic device 110.
[0050] The MCU 120 can be used to rotate the rotatable magnetic device while keeping the position of the electronic device unchanged; obtain a plurality of first magnetic field data components in a first direction and a plurality of second magnetic field data components in a second direction, each first magnetic field data component corresponding to a second magnetic field data component, the first direction and the second direction being perpendicular to each other, and the first direction and the second direction both being parallel to the rotation plane of the rotatable magnetic device; perform elliptic curve fitting on the plurality of first magnetic field data components and the plurality of second magnetic field data components to obtain adjustment parameters; and adjust the magnetic field data based on the adjustment parameters to obtain adjusted magnetic field data.
[0051] Thus, while keeping the position of the electronic device unchanged, the rotatable magnetic device can be rotated, and a plurality of first magnetic field data components in a first direction and a plurality of second magnetic field data components in a second direction can be obtained. Each first magnetic field data component corresponds to a second magnetic field data component. The first direction and the second direction are perpendicular to each other, and both the first direction and the second direction are parallel to the rotation plane of the rotatable magnetic device. By performing elliptic curve fitting on the plurality of first magnetic field data components and the plurality of second magnetic field data components, adjustment parameters can be obtained. Then, the magnetic field data can be adjusted based on the adjustment parameters to obtain adjusted magnetic field data. In this way, by adjusting the magnetic field data with the adjustment parameters obtained by fitting, the assembly error of the rotatable magnetic device and the influence of the rotation of the rotatable magnetic device on the magnetic field data can be reduced, the accuracy and reliability of the magnetic field data can be improved, thereby improving the accuracy of determining the rotation angle of the rotatable magnetic device and ensuring that the corresponding functions can be accurately implemented.
[0052] It should be noted that the above execution subject does not constitute a limitation to this application.
[0053] The following Figure 2 will provide a detailed description of the data adjustment method provided in the embodiments of this application.
[0054] Figure 2 is a flowchart of a data adjustment method shown according to an exemplary embodiment.
[0055] As Figure 2 shown, the data adjustment method may include the following steps:
[0056] Step 210, rotate the rotatable magnetic device while keeping the position of the electronic device unchanged.
[0057] Here, the rotatable magnetic device may include a Hall device and a rotatable magnet.
[0058] Exemplarily, two positional relationships between the Hall device and the rotatable magnet may be respectively as Figure 3 and Figure 4 shown. Figure 3 In, the rotatable magnet 112 is directly above the Hall device 111. The XY plane parallel to the rotation plane of the rotatable magnet 112 can be regarded as the main plane, and the Z axis perpendicular to the rotation plane of the rotatable magnet 112 can be regarded as the third axis. Figure 4 In, the rotatable magnet 112 is perpendicular to the Hall device 111. The XZ plane parallel to the rotation plane of the rotatable magnet 112 can be regarded as the main plane, and the Y axis perpendicular to the rotation plane of the rotatable magnet 112 can be regarded as the third axis. The rotatable magnetic device can rotate around the third axis.
[0059] Specifically, place the electronic device at a fixed position to ensure that the position of the electronic device remains unchanged and the magnetic field strength is constant throughout the experiment, with minimal external magnetic field interference. Then, the rotatable magnet in the rotatable magnetic device can be controlled to rotate at a constant speed by a slow motor, ensuring that the stepping speed is as stable as possible and rotating several turns.
[0060] Exemplarily, the electronic device can be a smart watch, and the rotatable magnetic device can be a magnetic crown or a magnetic bezel.
[0061] Step 220: Obtain a plurality of first magnetic field data components in a first direction and a plurality of second magnetic field data components in a second direction.
[0062] Here, each first magnetic field data component can correspond to a second magnetic field data component.
[0063] The first direction and the second direction can be perpendicular to each other. The first direction and the second direction can both be parallel to the rotation plane of the rotatable magnetic device.
[0064] Taking Figure 3 as an example, the first direction can be the x-axis direction and the second direction can be the y-axis direction; alternatively, the first direction can be the y-axis direction and the second direction can be the x-axis direction.
[0065] Taking Figure 4 as an example, the first direction can be the x-axis direction and the second direction can be the z-axis direction; alternatively, the first direction can be the z-axis direction and the second direction can be the x-axis direction.
[0066] Subsequently, taking Figure 3 as an example, where the first direction is the x-axis direction and the second direction is the y-axis direction, an introduction will be given.
[0067] Specifically, during the rotation of the rotatable magnetic device, the first magnetic field data components in the first direction and the second magnetic field data components in the second direction corresponding to each rotation angle can be collected when the rotatable magnetic device is at multiple different rotation angles.
[0068] The rotation angle can refer to the angle accumulated by the rotatable magnetic device relative to a preset reference position. The preset reference position can be set according to actual needs and is not limited here. The rotation angle can be greater than 0° and less than or equal to 360°, or can be greater than 360°.
[0069] Exemplarily, during the rotation process, the first magnetic field data components in the first direction corresponding to the rotatable magnetic device at multiple different rotation angles are acquired, and the second magnetic field data components in the second direction corresponding to the rotatable magnetic device at the multiple rotation angles are acquired. By correlating the first magnetic field data components and the second magnetic field data components corresponding to the same rotation angle, a plurality of first magnetic field data components and second magnetic field data components respectively corresponding to the plurality of first magnetic field data components can be obtained.
[0070] Step 230: Perform elliptic curve fitting on the plurality of first magnetic field data components and the plurality of second magnetic field data components to obtain adjustment parameters.
[0071] Here, elliptic curve fitting is performed on the plurality of first magnetic field data components and the second magnetic field data components respectively corresponding to the plurality of first magnetic field data components.
[0072] The algorithm for elliptic curve fitting can be the Least Squares Fitting of Ellipses algorithm.
[0073] Exemplarily, the first magnetic field data components in the plurality of first directions and the second magnetic field data components in the second directions respectively corresponding to the plurality of first magnetic field data components can be as Figure 5 shown.
[0074] The magnetic field data distribution map generated based on the plurality of first magnetic field data components and the plurality of second magnetic field data components affected by the rotation interference of the rotatable magnetic device can be as Figure 6 shown. The data is elliptical, while the data without interference is circular. Therefore, the Least Squares Fitting of Ellipses algorithm can be used to fit the interfered data. The fitted data can be as Figure 7 shown.
[0075] Exemplarily, the formula for the Least Squares Fitting of Ellipses algorithm can be Formula (1). Substitute the first magnetic field data component in the x-axis direction into x in the formula, and substitute the second magnetic field data component in the y-axis direction into y in the formula. By substituting multiple sets of data, the values of parameters a, b, c, d, and e can be determined by fitting, and a, b, and c among them are determined as adjustment parameters.
[0076] ax 2 +bxy+cy 2 +dx+ey=1 Formula (1)
[0077] In this way, based on the elliptic curve fitting to determine the adjustment parameters, the adjustment parameters can adjust the data that is elliptically distributed due to the rotation interference of the rotatable magnetic device to a circular distribution, accurately removing the interference caused by the rotation of the rotatable magnetic device.
[0078] Step 240: Adjust the magnetic field data based on the adjustment parameters to obtain adjusted magnetic field data.
[0079] Here, the magnetic field data can be the magnetic field intensity collected by a Hall device included in a rotatable magnetic device. The Hall device can be a Hall sensor.
[0080] The adjusted magnetic field data can be data obtained by adjusting the magnetic field data. The magnetic field data can include magnetic field data components in multiple directions. Specifically, the magnetic field data can at least include a magnetic field data component in a first direction and a magnetic field data component in a second direction. The adjustment parameters can be used to adjust the magnetic field data component in the first direction and the magnetic field data component in the second direction.
[0081] The adjustment parameters can include a radius processing parameter and an ellipse processing parameter. The adjustment process can include radius processing and ellipse processing.
[0082] Exemplarily, the radius processing parameter can include: OS cos and OS sin , and the ellipse processing parameter can include: a, b, and c. The magnetic field data can include a first magnetic field data component X data and a second magnetic field data component Y data .
[0083] Specifically, first, the radius processing parameter OS cos is used to perform radius processing on the first magnetic field data component X data , as shown in formula (2), and then the ellipse processing parameters a and b are used to perform ellipse processing on the radius-processed first magnetic field data component X' data , as shown in formula (3), so as to obtain a first adjusted magnetic field data component X'' data .
[0084] X' data = X data - OS cos Formula (2)
[0085] X'' data = a * X' data + b * Y' data Formula (3)
[0086] First, the radius processing parameter OS sin can be used to perform radius processing on the second magnetic field data component Y data , as shown in formula (4), and then the ellipse processing parameters b and c are used to perform ellipse processing on the radius-processed second magnetic field data component Y d ' ata , as shown in formula (5), so as to obtain a second adjusted magnetic field data component Y'' data .
[0087] Y d ′ ata =Y data -OS sin Formula (4)
[0088] Y″ data =b*X′ data +c*Y″ data Formula (5)
[0089] The first adjusted magnetic field data component X″ data and the second adjusted magnetic field data component Y″ data are the adjusted magnetic field data.
[0090] Thus, while keeping the position of the electronic device unchanged, the rotatable magnetic device can be rotated, and a plurality of first magnetic field data components in a first direction and a plurality of second magnetic field data components in a second direction can be obtained. Each first magnetic field data component corresponds to a second magnetic field data component. The first direction and the second direction are perpendicular to each other, and both the first direction and the second direction are parallel to the rotation plane of the rotatable magnetic device. By performing elliptic curve fitting on the plurality of first magnetic field data components and the plurality of second magnetic field data components, adjustment parameters can be obtained. Then, based on the adjustment parameters, the magnetic field data can be adjusted to obtain the adjusted magnetic field data. In this way, by adjusting the magnetic field data with the adjustment parameters obtained by fitting, the assembly error of the rotatable magnetic device and the influence of the rotation of the rotatable magnetic device on the magnetic field data can be reduced, the accuracy and reliability of the magnetic field data can be improved, thereby improving the accuracy of determining the rotation angle of the rotatable magnetic device and ensuring that the corresponding functions can be accurately realized.
[0091] In addition, when there is interference from an external magnetic field (such as a magnet, a mobile phone, a tablet, etc.), the functions implemented based on the rotatable magnetic device will also be affected. In severe cases, the related functions will fail, affecting the user experience.
[0092] Based on this, in some embodiments, after step 240, the method may further include:
[0093] Determining whether there is interference from an external magnetic field based on the adjusted magnetic field data;
[0094] When it is determined that there is no interference from an external magnetic field, determining the first rotation angle of the rotatable magnetic device based on the adjusted magnetic field data;
[0095] When it is determined that there is interference from an external magnetic field, turning off the function of the rotatable magnetic device.
[0096] Here, the interference from an external magnetic field may refer to the interference of other magnetic fields except for the rotatable magnetic device itself and the earth's magnetic field.
[0097] If there is no external magnetic field interference, the adjusted magnetic field data obtained by adjustment is already data with relatively high accuracy. However, in actual scenarios, there is often external magnetic field interference. If there is external magnetic field interference, the adjusted magnetic field data obtained by adjustment is still inaccurate. Therefore, in order to determine whether the adjusted magnetic field data is accurate, it is necessary to determine whether there is external magnetic field interference.
[0098] Specifically, if there is no external magnetic field interference, it can indicate that the accuracy of the adjusted magnetic field data is relatively high. The first rotation angle of the rotatable magnetic device can be determined based on the adjusted magnetic field data, and then the corresponding function can be implemented based on the first rotation angle.
[0099] Specifically, the first rotation angle of the rotatable magnetic device can be determined based on the first adjusted magnetic field data component in the first direction and the second adjusted magnetic field data component in the second direction included in the adjusted magnetic field data.
[0100] If there is external magnetic field interference, it can indicate that the accuracy of the adjusted magnetic field data is relatively low. It can be considered that the functions implemented based on the magnetic field data of the rotatable magnetic device will be affected, and in severe cases, the related functions will fail. In order to avoid misleading users due to related function disorders, when it is determined that there is external magnetic field interference, the reporting of the magnetic field data can be blocked and the functions of the rotatable magnetic device can be turned off.
[0101] In this way, by determining the first rotation angle of the rotatable magnetic device based on the adjusted magnetic field data in the case of no external magnetic field interference to implement the function of the rotatable magnetic device, and turning off the function of the rotatable magnetic device in the case of external magnetic field interference, the accuracy of the related functions can be ensured and users can be avoided being misled.
[0102] In some embodiments, after turning off the function of the rotatable magnetic device in the above case of determining that there is external magnetic field interference, the method may further include:
[0103] Obtain the magnetic field data within a preset time period;
[0104] When the magnetic field data within the preset time period is all within the second preset range, turn on the function of the rotatable magnetic device.
[0105] Here, the magnetic field data within the preset time period can be the original magnetic field data collected.
[0106] Both the preset time period and the second preset range can be set according to actual needs and are not limited here.
[0107] Specifically, when the magnetic field data within the preset time period is all within the second preset range, it can indicate that the magnetic field data is stable. Therefore, the function of the rotatable magnetic device that was turned off before can be restored.
[0108] In this way, by monitoring the magnetic field data, when it is found that the magnetic field data is stable, the function of the rotatable magnetic device that was previously turned off can be restored in a timely manner, avoiding affecting the normal use of the corresponding function by the user.
[0109] In addition, in some embodiments, after determining whether there is external magnetic field interference based on the adjusted magnetic field data, the method may further include:
[0110] When it is determined that there is external magnetic field interference, output a prompt message to prompt the user that the magnetic field environment is abnormal.
[0111] Here, if it is determined that there is external magnetic field interference, it can indicate that the accuracy of the adjusted magnetic field data is relatively low. Performing subsequent calculations based on this adjusted magnetic field data cannot accurately implement the corresponding function and may lead to functional disorders. Therefore, when it is determined that there is external magnetic field interference, a prompt message can be output, and this prompt message can be used to prompt the user that the magnetic field environment is abnormal.
[0112] Exemplarily, when it is determined that there is external magnetic field interference, "Magnetic field environment abnormal, magnetic crown function fails" can be displayed on the display interface of the user's smart watch.
[0113] In this way, by outputting a prompt message when it is determined that there is external magnetic field interference to prompt the user that the magnetic field environment is abnormal, it is possible to avoid the user obtaining incorrect information due to trusting the related functions of the rotatable magnetic device, and it can also remind the user to keep the electronic device away from the external magnetic field.
[0114] In some embodiments, the above process can be repeated to collect more magnetic field data for analysis in order to verify the feasibility and effectiveness of the related functions of the rotatable magnetic device.
[0115] In some embodiments, determining whether there is external magnetic field interference based on the adjusted magnetic field data may include:
[0116] Determine the external magnetic field offset based on the adjusted magnetic field data;
[0117] When any one of the offsets in the external magnetic field offset exceeds the first preset range, determine that there is external magnetic field interference;
[0118] When none of the offsets in the external magnetic field offset exceeds the first preset range, determine that there is no external magnetic field interference.
[0119] Here, the external magnetic field offset can be used to measure the degree of interference of the external magnetic field on the magnetic field data of the rotatable magnetic device. The external magnetic field offset can include at least one of the magnetic field offset in the rotation plane, the magnetic field offset in the third direction, and the angular offset of the rotatable magnetic device. The third direction can be perpendicular to the rotation plane. Adjusting the magnetic field data can include a first adjusted magnetic field data component in the first direction and a second adjusted magnetic field data component in the second direction.
[0120] Specifically, as long as one of the external magnetic field offsets exceeds the first preset range, it can be determined that there is external magnetic field interference; if all the offsets included in the external magnetic field offset do not exceed the first preset range, it can be determined that there is no external magnetic field interference.
[0121] The first preset range can be set according to actual needs, and different first preset ranges can be set for different offsets.
[0122] Exemplarily, the first preset range of the magnetic field offset mag radius in the rotation plane can be mag low_th ≤mag radius ≤mag high_th , where mag low_th is the lower limit of the first preset range of the magnetic field offset in the rotation plane, and mag high_th is the upper limit of the first preset range of the magnetic field offset in the rotation plane.
[0123] The first preset range of the magnetic field offset S 3rd in the third direction can be S 3rd <TH 3rd .
[0124] The first preset range of the angular offset θ′ can be θ′ < TH θ .
[0125] In this way, by determining the external magnetic field offset and judging whether the external magnetic field offset exceeds the first preset range, it can be accurately judged whether there is external magnetic field interference.
[0126] In some embodiments, when the external magnetic field offset includes the magnetic field offset in the rotation plane, the above determination of the external magnetic field offset based on the adjusted magnetic field data may include:
[0127] Determining the magnetic field offset in the rotation plane based on the first adjusted magnetic field data component and the second adjusted magnetic field data component.
[0128] Here, if there is interference from the external magnetic field, the adjusted magnetic field data in the rotation plane will shift.
[0129] Exemplarily, when there is no external magnetic field interference, the distribution of the adjusted magnetic field data can be as shown by the data 810 in Figure 8 ; if, as shown in Figure 9 , a magnet 910 appears near the rotatable magnetic device 110, according to the magnetic properties, if the polarities of the sides of the magnet 910 and the rotatable magnetic device 110 that are close to each other are different, it will cause the adjusted magnetic field data to shift in the direction of the magnet 910. Therefore, when there is external magnetic field interference, the distribution of the adjusted magnetic field data can be as shown by the data 820 in Figure 8 .
[0130] As shown in Figure 8 , when there is no external magnetic field interference, the distance between the data points of the adjusted magnetic field data and the origin is the radius of the circle, while when there is external magnetic field interference, the distribution of the adjusted magnetic field data will shift, resulting in the distance between the data points of the adjusted magnetic field data and the origin exceeding a certain range and no longer being the radius of the circle.
[0131] Therefore, the distance between the data points of the adjusted magnetic field data and the origin can be used as the magnetic field offset of the rotation plane, and based on this magnetic field offset of the rotation plane, it can be determined whether there is external magnetic field interference.
[0132] Exemplarily, the formula for calculating the distance between the data points of the adjusted magnetic field data and the origin, that is, the magnetic field offset of the rotation plane, can be formula (6).
[0133] mag radius = Sqrt(algo x ×algo x + algo y ×algo y ) Formula (6)
[0134] Wherein, mag radius is the magnetic field offset of the rotation plane, algo x is the component of the adjusted magnetic field data in the x-axis direction, that is, the first adjusted magnetic field data component, and algo y is the component of the adjusted magnetic field data in the y-axis direction, that is, the second adjusted magnetic field data component.
[0135] In this way, through the magnetic field offset of the rotation plane determined based on the first adjusted magnetic field data component and the second adjusted magnetic field data component, the magnetic field offset situation of the rotation plane can be reflected, so as to accurately determine whether there is external magnetic field interference.
[0136] In some embodiments, the magnetic field data may include a third magnetic field data component in the third direction;
[0137] When the external magnetic field offset includes the magnetic field offset in the third direction, the above determination of the external magnetic field offset based on the adjusted magnetic field data may include:
[0138] Based on the first adjusted magnetic field data component and the second adjusted magnetic field data component, determine the second rotation angle of the rotatable magnetic device;
[0139] Based on the preset correspondence between the rotation angle of the rotatable magnetic device and the magnetic field data component in the third direction, determine the fourth magnetic field data component in the third direction corresponding to the second rotation angle;
[0140] Based on the third magnetic field data component and the fourth magnetic field data component, determine the magnetic field offset in the third direction.
[0141] Here, the magnetic field offset in the third direction may be the absolute value of the difference between the third magnetic field data component in the third direction and the fourth magnetic field data component in the third direction.
[0142] The fourth magnetic field data component may be the magnetic field data component in the third direction without external magnetic field interference deduced based on the preset correspondence. The third magnetic field data component in the third direction may be collected. If the difference between the two is large, it may indicate the existence of external magnetic field interference; if the difference between the two is small, it may indicate the absence of external magnetic field interference.
[0143] Specifically, the second rotation angle can be calculated by formula (7).
[0144]
[0145] where θ is the second rotation angle.
[0146] The preset correspondence can be obtained in the following way:
[0147] While keeping the position of the electronic device unchanged, rotate the rotatable magnetic device; during the rotation of the rotatable magnetic device, obtain the magnetic field data components in the third direction when the rotatable magnetic device is at multiple different rotation angles, and each rotation angle corresponds to a magnetic field data component in the third direction; fit the multiple different rotation angles and their respectively corresponding magnetic field data components in the third direction to obtain the preset correspondence.
[0148] The preset correspondence can be as shown in formula (8).
[0149] Substitute the second rotation angle θ into formula (8), and the fourth magnetic field data component in the third direction can be calculated.
[0150] Mag 3rd =A 3rd cos(θ+δ3rd ) + B 3rd Formula (8)
[0151] Wherein, Mag 3rd is the fourth magnetic field data component in the third direction, and A 3rd , δ 3rd and B 3rd are all sine wave fitting parameters. Through the above fitting process, the values of the sine wave fitting parameters can be obtained.
[0152] Then, calculate the magnetic field offset in the third direction through Formula (9).
[0153] S 3rd = Abs(algo 3rd - Mag 3rd ) Formula (9)
[0154] Wherein, algo 3rd is the third magnetic field data component in the third direction.
[0155] In this way, according to the difference between the fourth magnetic field data component in the third direction determined based on the first adjusted magnetic field data component and the second adjusted magnetic field data component, and the third magnetic field data component in the third direction, it can be accurately determined whether there is external magnetic field interference.
[0156] In some embodiments, when the external magnetic field offset includes an angular offset, the above method for determining the external magnetic field offset based on the adjusted magnetic field data may include:
[0157] Determine the second rotation angle of the rotatable magnetic device based on the first adjusted magnetic field data component and the second adjusted magnetic field data component;
[0158] Determine the angular offset based on the second rotation angle and the third rotation angle.
[0159] Here, the third rotation angle can be calculated in the previous angle calculation period corresponding to the angle calculation period of the second rotation angle. The angle calculation period corresponding to the second rotation angle may refer to the anti-interference protection period for calculating the second rotation angle currently. The previous angle calculation period may refer to the anti-interference protection period for calculating the third rotation angle during the previous anti-interference protection.
[0160] The third rotation angle can be determined based on the adjusted magnetic field data calculated in the previous period, and the adjusted magnetic field data in the previous period can be obtained by adjusting the magnetic field data collected in the previous period.
[0161] Specifically, when there is no external magnetic field interference, the second rotation angle calculated by the algorithm basically conforms to the normal distribution. However, when there is external magnetic field interference, the adjustment of the magnetic field data will be abnormal, resulting in a change in the calculated second rotation angle. Therefore, the difference between the second rotation angle determined in the current cycle and the third rotation angle determined in the previous cycle can be determined as the angle offset, and whether there is external magnetic field interference can be judged based on this angle offset.
[0162] The method for determining the second rotation angle will not be elaborated here. The process of determining the third rotation angle based on the adjusted magnetic field data in the previous cycle is the same as that of determining the second rotation angle, and will not be elaborated here either. In addition, the above process of determining the first rotation angle based on the adjusted magnetic field data is also the same as that of determining the second rotation angle, and will not be elaborated here.
[0163] The calculation formula for the angle offset is formula (10).
[0164] Δθ = θ - θ' Formula (10)
[0165] Where, Δθ is the angle offset, θ is the second rotation angle, and θ' is the third rotation angle.
[0166] In this way, since external magnetic field interference will cause abnormal adjustment of the magnetic field data, and then cause abnormal changes in the rotation angle calculated based on the adjusted magnetic field data, it is possible to accurately judge whether there is external magnetic field interference based on the changes in the calculated rotation angle.
[0167] To better describe the entire solution, based on the above embodiments, a specific example is given, such as Figure 10 As shown, the data adjustment method may include step 1001 - step 1009, which will be explained in detail below.
[0168] Step 1001, rotate the rotatable magnetic device while keeping the position of the electronic device unchanged.
[0169] Step 1002, obtain a plurality of first magnetic field data components in the first direction and a plurality of second magnetic field data components in the second direction.
[0170] Step 1003, perform elliptic curve fitting on the plurality of first magnetic field data components and the plurality of second magnetic field data components to obtain adjustment parameters.
[0171] Step 1004, adjust the magnetic field data based on the adjustment parameters to obtain adjusted magnetic field data.
[0172] Step 1005, judge whether the magnetic field offset in the rotation plane exceeds its corresponding first preset range.
[0173] If so, execute step 1009; if not, execute step 1006.
[0174] Step 1006: Determine whether the magnetic field offset in the third direction exceeds its corresponding first preset range.
[0175] If so, execute step 1009; if not, execute step 1007.
[0176] Step 1007: Determine whether the angle offset exceeds its corresponding first preset range.
[0177] If so, execute step 1009; if not, execute step 1008.
[0178] Step 1008: Determine the first rotation angle of the rotatable magnetic device based on the adjusted magnetic field data.
[0179] Step 1009: Turn off the function of the rotatable magnetic device.
[0180] To better describe the entire solution, based on the above embodiments, here is another specific example. For example, Figure 11 as shown, taking the electronic device as a smart watch and the rotatable magnetic device as a magnetic crown as an example, the data adjustment method may include steps 1101 - 1110, which will be explained in detail below.
[0181] Step 1101: The magnetic crown is continuously rotated, and the crown interruption thread can continuously trigger the interruption logic.
[0182] Step 1102: The crown processing thread sets the ODR of the magnetic crown.
[0183] Step 1103: The crown processing thread turns off the interruption.
[0184] Step 1104: The crown processing thread starts the crown timer.
[0185] Step 1105: The crown timer thread times.
[0186] Step 1106: The crown processing thread collects magnetic field data.
[0187] Step 1107: The crown processing thread adjusts the magnetic field data.
[0188] Step 1108: The crown processing thread determines whether there is external magnetic field interference.
[0189] If so, execute step 1109; if not, execute step 1110.
[0190] Step 1109: Report to the application and prompt "strong magnetic interference".
[0191] Step 1110: Report the application and conduct business interactions.
[0192] The embodiment of the present application solves the problem of inaccurate magnetic field data caused by the interference of the rotatable magnet in the rotatable magnetic device with the magnetic field, making the solution for the electronic device to implement corresponding functions through the rotatable magnetic device more feasible. The embodiment of the present application improves the accuracy of the magnetic field data of the rotatable magnetic device, and also avoids the problem of unreliable functions of the electronic device caused by external magnetic field interference, enhancing the user experience. It can also reduce equipment and design costs, thus achieving the effect of cost reduction and efficiency improvement.
[0193] The solution provided by the embodiment of the present application can be widely applied in the field of mobile devices such as smart watches, smart phones, and tablets. The solution provided by the embodiment of the present application can be applied to projects of magnetic devices, such as game controllers, smart lamps, automotive air pumps, etc. These application fields all use Hall sensors and have relatively high requirements for the accuracy of magnetic field data. The solution provided by the embodiment of the present application can meet these requirements and improve the performance and reliability of these systems. The solution provided by the embodiment of the present application can also be applied to modules with relatively strict requirements for the hard magnetic environment and modules whose devices themselves are affected by external magnetic field interference.
[0194] For the data adjustment method provided by the embodiment of the present application, the execution subject can be a data adjustment device. In the embodiment of the present application, taking the data adjustment device executing the data adjustment method as an example, the data adjustment device provided by the embodiment of the present application is described.
[0195] Based on the same inventive concept, the present application also provides a data adjustment device. The following combines Figure 12 to describe the data adjustment device provided by the embodiment of the present application in detail.
[0196] Figure 12 is a structural block diagram of a data adjustment device shown according to an exemplary embodiment.
[0197] As Figure 12 shown, the data adjustment device 1200 can be applied to an electronic device, which can include a rotatable magnetic device. The data adjustment device 1200 can include:
[0198] A rotation module 1201, configured to rotate the rotatable magnetic device while keeping the position of the electronic device unchanged;
[0199] A first acquisition module 1202, configured to acquire a plurality of first magnetic field data components in a first direction and a plurality of second magnetic field data components in a second direction. Each first magnetic field data component corresponds to a second magnetic field data component. The first direction and the second direction are perpendicular to each other, and both the first direction and the second direction are parallel to the rotation plane of the rotatable magnetic device;
[0200] The fitting module 1203 is configured to perform elliptic curve fitting on a plurality of first magnetic field data components and a plurality of second magnetic field data components to obtain adjustment parameters;
[0201] The adjustment module 1204 is configured to adjust the magnetic field data based on the adjustment parameters to obtain adjusted magnetic field data.
[0202] The above data adjustment device 1200 will be described in detail below, as follows:
[0203] In one embodiment, the data adjustment device 1200 may further include:
[0204] The first determination module is configured to determine whether there is an external magnetic field interference based on the adjusted magnetic field data after adjusting the magnetic field data based on the adjustment parameters to obtain the adjusted magnetic field data;
[0205] The second determination module is configured to determine the first rotation angle of the rotatable magnetic device based on the adjusted magnetic field data when it is determined that there is no external magnetic field interference;
[0206] The shutdown module is configured to shut down the function of the rotatable magnetic device when it is determined that there is an external magnetic field interference.
[0207] In one embodiment, the first determination module may include:
[0208] The first determination sub-module is configured to determine an external magnetic field offset based on the adjusted magnetic field data, where the external magnetic field offset includes at least one of a magnetic field offset in the rotation plane, a magnetic field offset in a third direction, and an angular offset of the rotatable magnetic device, the third direction is perpendicular to the rotation plane, and the adjusted magnetic field data includes a first adjusted magnetic field data component in a first direction and a second adjusted magnetic field data component in a second direction;
[0209] The second determination sub-module is configured to determine that there is an external magnetic field interference when any one of the offsets in the external magnetic field offset exceeds a first preset range;
[0210] The third determination sub-module is configured to determine that there is no external magnetic field interference when none of the offsets in the external magnetic field offset exceeds the first preset range.
[0211] In one embodiment, the first determination sub-module may include:
[0212] The first determination unit is configured to determine the magnetic field offset in the rotation plane based on the first adjusted magnetic field data component and the second adjusted magnetic field data component when the external magnetic field offset includes the magnetic field offset in the rotation plane.
[0213] In one embodiment, the magnetic field data includes a third magnetic field data component in a third direction;
[0214] The first determination sub-module may include:
[0215] A second determination unit, configured to determine a second rotation angle of the rotatable magnetic device based on the first adjusted magnetic field data component and the second adjusted magnetic field data component when the external magnetic field offset includes a magnetic field offset in the third direction;
[0216] A third determination unit, configured to determine a fourth magnetic field data component in the third direction corresponding to the second rotation angle based on a preset correspondence between the rotation angle of the rotatable magnetic device and the magnetic field data component in the third direction;
[0217] A fourth determination unit, configured to determine a magnetic field offset in the third direction based on the third magnetic field data component and the fourth magnetic field data component.
[0218] In one embodiment, the first determination sub-module may include:
[0219] A fifth determination unit, configured to determine a second rotation angle of the rotatable magnetic device based on the first adjusted magnetic field data component and the second adjusted magnetic field data component when the external magnetic field offset includes an angular offset;
[0220] A sixth determination unit, configured to determine the angular offset based on the second rotation angle and the third rotation angle, where the third rotation angle is calculated in the previous angle calculation period corresponding to the second rotation angle.
[0221] In one embodiment, the data adjustment device 1200 may further include:
[0222] A second acquisition module, configured to acquire magnetic field data within a preset duration after turning off the function of the rotatable magnetic device when it is determined that there is external magnetic field interference;
[0223] An activation module, configured to activate the function of the rotatable magnetic device when the magnetic field data within the preset duration is all within a second preset range.
[0224] Thus, while keeping the position of the electronic device unchanged, the rotatable magnetic device can be rotated, and a plurality of first magnetic field data components in a first direction and a plurality of second magnetic field data components in a second direction can be obtained. Each first magnetic field data component corresponds to a second magnetic field data component. The first direction and the second direction are perpendicular to each other, and both the first direction and the second direction are parallel to the rotation plane of the rotatable magnetic device. By performing elliptic curve fitting on the plurality of first magnetic field data components and the plurality of second magnetic field data components, adjustment parameters can be obtained, and then the magnetic field data can be adjusted based on the adjustment parameters to obtain adjusted magnetic field data. In this way, by adjusting the magnetic field data with the adjustment parameters obtained by fitting, the assembly error of the rotatable magnetic device and the influence of the rotation of the rotatable magnetic device on the magnetic field data can be reduced, the accuracy and reliability of the magnetic field data can be improved, thereby improving the accuracy of determining the rotation angle of the rotatable magnetic device and ensuring that the corresponding functions can be accurately implemented.
[0225] The data adjustment device in the embodiments of the present application can be an electronic device or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices other than the terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a handheld computer, an in-vehicle electronic device, a Mobile Internet Device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. It can also be a server, a Network Attached Storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, etc. The embodiments of the present application do not make specific limitations.
[0226] The data adjustment device in the embodiments of the present application can be a device with an operating system. The operating system can be an Android operating system, an iOS operating system, or other possible operating systems. The embodiments of the present application do not make specific limitations.
[0227] The data adjustment device provided in the embodiments of the present application can implement Figure 2-11 each process implemented by the method embodiments, achieving the same technical effects. To avoid repetition, details are not described here again.
[0228] In some embodiments, such asFigure 13 As shown in the figure, an embodiment of the present application further provides an electronic device 1300, including a processor 1301 and a memory 1302. A program or instruction that can run on the processor 1301 is stored on the memory 1302. When the program or instruction is executed by the processor 1301, each step of the above-described data adjustment method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be elaborated here.
[0229] It should be noted that the electronic device in the embodiment of the present application includes the above-mentioned mobile electronic device and non-mobile electronic device.
[0230] Figure 14 It is a schematic diagram of the hardware structure of an electronic device for implementing an embodiment of the present application.
[0231] The electronic device 1400 includes but is not limited to: a radio frequency unit 1401, a network module 1402, an audio output unit 1403, an input unit 1404, a sensor 1405, a display unit 1406, a user input unit 1407, an interface unit 1408, a memory 1409, and a processor 1410 and other components.
[0232] Those skilled in the art can understand that the electronic device 1400 may further include a power supply (such as a battery) for supplying power to each component. The power supply can be logically connected to the processor 1410 through a power management system, so as to implement functions such as management of charging, discharging, and power consumption management through the power management system. Figure 14 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0233] Among them, the processor 1410 is used to rotate the rotatable magnetic device while keeping the position of the electronic device unchanged;
[0234] Obtain a plurality of first magnetic field data components in a first direction and a plurality of second magnetic field data components in a second direction. Each first magnetic field data component corresponds to a second magnetic field data component. The first direction and the second direction are perpendicular to each other, and both the first direction and the second direction are parallel to the rotation plane of the rotatable magnetic device;
[0235] Perform elliptic curve fitting on the plurality of first magnetic field data components and the plurality of second magnetic field data components to obtain adjustment parameters;
[0236] Adjust the magnetic field data based on the adjustment parameters to obtain adjusted magnetic field data.
[0237] Thus, while keeping the position of the electronic device unchanged, the rotatable magnetic device can be rotated, and a plurality of first magnetic field data components in a first direction and a plurality of second magnetic field data components in a second direction can be obtained. Each first magnetic field data component corresponds to a second magnetic field data component. The first direction and the second direction are perpendicular to each other, and both the first direction and the second direction are parallel to the rotation plane of the rotatable magnetic device. By performing elliptic curve fitting on the plurality of first magnetic field data components and the plurality of second magnetic field data components, adjustment parameters can be obtained. Then, the magnetic field data can be adjusted based on the adjustment parameters to obtain adjusted magnetic field data. In this way, by adjusting the magnetic field data with the adjustment parameters obtained by fitting, the assembly error of the rotatable magnetic device and the influence of the rotation of the rotatable magnetic device on the magnetic field data can be reduced, the accuracy and reliability of the magnetic field data can be improved, thereby improving the accuracy of determining the rotation angle of the rotatable magnetic device and ensuring that the corresponding functions can be accurately implemented.
[0238] In some embodiments, the processor 1410 is further configured to, after adjusting the magnetic field data based on the adjustment parameters to obtain adjusted magnetic field data, determine whether there is external magnetic field interference based on the adjusted magnetic field data;
[0239] In the case of determining that there is no external magnetic field interference, determine the first rotation angle of the rotatable magnetic device based on the adjusted magnetic field data;
[0240] In the case of determining that there is external magnetic field interference, turn off the function of the rotatable magnetic device.
[0241] In this way, by determining the first rotation angle of the rotatable magnetic device based on the adjusted magnetic field data in the case of no external magnetic field interference, so as to realize the function of the rotatable magnetic device, and by turning off the function of the rotatable magnetic device in the case of external magnetic field interference, the accuracy of related functions can be ensured and the user can be prevented from being misled.
[0242] In some embodiments, the processor 1410 is further configured to determine an external magnetic field offset based on the adjusted magnetic field data. The external magnetic field offset includes at least one of a magnetic field offset in the rotation plane, a magnetic field offset in a third direction, and an angular offset of the rotatable magnetic device. The third direction is perpendicular to the rotation plane. The adjusted magnetic field data includes a first adjusted magnetic field data component in the first direction and a second adjusted magnetic field data component in the second direction;
[0243] In the case where any one of the offsets in the external magnetic field offset exceeds a first preset range, it is determined that there is external magnetic field interference;
[0244] In the case where none of the offsets in the external magnetic field offset exceeds the first preset range, it is determined that there is no external magnetic field interference.
[0245] Thus, by determining the external magnetic field offset and judging whether the external magnetic field offset exceeds the first preset range, it is possible to accurately judge whether there is external magnetic field interference.
[0246] In some embodiments, the processor 1410 is further configured to, when the external magnetic field offset includes the magnetic field offset of the rotation plane, determine the magnetic field offset of the rotation plane based on the first adjusted magnetic field data component and the second adjusted magnetic field data component.
[0247] Thus, the magnetic field offset of the rotation plane determined based on the first adjusted magnetic field data component and the second adjusted magnetic field data component can reflect the magnetic field offset situation of the rotation plane, so as to accurately judge whether there is external magnetic field interference.
[0248] In some embodiments, the magnetic field data includes a third magnetic field data component in a third direction;
[0249] The processor 1410 is further configured to, when the external magnetic field offset includes the magnetic field offset in the third direction, determine the second rotation angle of the rotatable magnetic device based on the first adjusted magnetic field data component and the second adjusted magnetic field data component;
[0250] Based on the preset correspondence between the rotation angle of the rotatable magnetic device and the magnetic field data component in the third direction, determine the fourth magnetic field data component in the third direction corresponding to the second rotation angle;
[0251] Based on the third magnetic field data component and the fourth magnetic field data component, determine the magnetic field offset in the third direction.
[0252] Thus, it is possible to accurately judge whether there is external magnetic field interference according to the difference between the fourth magnetic field data component in the third direction determined based on the first adjusted magnetic field data component and the second adjusted magnetic field data component and the third magnetic field data component in the third direction.
[0253] In some embodiments, the processor 1410 is further configured to, when the external magnetic field offset includes an angular offset, determine the second rotation angle of the rotatable magnetic device based on the first adjusted magnetic field data component and the second adjusted magnetic field data component;
[0254] Based on the second rotation angle and the third rotation angle, determine the angular offset, where the third rotation angle is calculated in the previous angle calculation period corresponding to the angle calculation period of the second rotation angle.
[0255] Thus, since external magnetic field interference will cause abnormal adjustment magnetic field data, and then cause abnormal changes in the rotation angle calculated based on the adjustment magnetic field data, it is possible to accurately judge whether there is external magnetic field interference based on the changes in the calculated rotation angle.
[0256] In some embodiments, the processor 1410 is further configured to, after determining that there is external magnetic field interference and turning off the function of the rotatable magnetic device, obtain magnetic field data within a preset duration;
[0257] When the magnetic field data within the preset duration are all within a second preset range, turn on the function of the rotatable magnetic device.
[0258] In this way, by monitoring the magnetic field data, when it is found that the magnetic field data is stable, the function of the previously turned-off rotatable magnetic device can be restored in time to avoid affecting the normal use of the corresponding function by the user.
[0259] It should be understood that in the embodiments of the present application, the input unit 1404 may include a Graphics Processing Unit (GPU) 14041 and a microphone 14042. The graphics processor 14041 processes the image data of static pictures or videos obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 1406 may include a display panel 14061, and the display panel 14061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1407 includes at least one of a touch panel 14071 and other input devices 14072. The touch panel 14071 is also called a touch screen. The touch panel 14071 may include two parts: a touch detection device and a touch controller. The other input devices 14072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, power on / off keys, etc.), a trackball, a mouse, and a joystick, which will not be elaborated here.
[0260] The memory 1409 can be used to store software programs and various data. The memory 1409 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data. Among them, the first storage area may store an operating system, application programs or instructions required for at least one function (such as a sound playback function, an image playback function, etc.). In addition, the memory 1409 may include a volatile memory or a non-volatile memory, or the memory 1409 may include both a volatile memory and a non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDR SDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synch link dynamic random access memory (SLDRAM), and a direct rambus random access memory (DRRAM). The memory 1409 in the embodiments of the present application includes, but is not limited to, these and any other suitable types of memories.
[0261] The processor 1410 may include one or more processing units; in some embodiments, the processor 1410 integrates an application processor and a modem processor. Among them, the application processor mainly processes operations related to the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communication signals, such as a baseband processor. It can be understood that the above modem processor may not be integrated into the processor 1410 either.
[0262] The embodiments of the present application also provide a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, it implements each process of the above data adjustment method embodiment and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0263] Among them, the processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory, random access memory, magnetic disks, or optical discs, etc.
[0264] Another embodiment of the present application provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement each process of the above data adjustment method embodiment, and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0265] It should be understood that the chip mentioned in the embodiments of the present application may also be referred to as a system-on-chip, system chip, chip system, or system-on-chip, etc.
[0266] The embodiments of the present application provide a computer program product. The program product is stored in a storage medium and is executed by at least one processor to implement each process of the above data adjustment method embodiment, and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0267] It should be noted that in this article, the term "including", "comprising", or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article, or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article, or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article, or device including that element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in the reverse order according to the functions involved. For example, the described methods may be performed in an order different from that described, and various steps may be added, omitted, or combined. Additionally, the features described with reference to certain examples may be combined in other examples.
[0268] Through the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present application, in essence or the part that contributes to the prior art, can be embodied in the form of a computer software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions for causing a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in various embodiments of the present application.
[0269] The embodiments of the present application have been described above in conjunction with the accompanying drawings. However, the present application is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not restrictive. Under the inspiration of the present application, those of ordinary skill in the art can also make many forms without departing from the purpose of the present application and the scope protected by the claims, and all of them belong to the protection scope of the present application.
Claims
1. A data adjustment method, applied to an electronic device, characterized in that: The electronic device includes a rotatable magnetic device, and the method includes: While keeping the position of the electronic device unchanged, rotating the rotatable magnetic device; Acquire a plurality of first magnetic field data components in a first direction and a plurality of second magnetic field data components in a second direction, each of the first magnetic field data components corresponds to one second magnetic field data component, the first direction and the second direction are perpendicular to each other, and the first direction and the second direction are parallel to a rotation plane of the rotatable magnetic device; Performing elliptic curve fitting on the plurality of first magnetic field data components and the plurality of second magnetic field data components to obtain adjustment parameters; The magnetic field data is adjusted based on the adjustment parameters to obtain adjusted magnetic field data.
2. The method according to claim 1, characterized in that After adjusting the magnetic field data based on the adjustment parameter to obtain the adjusted magnetic field data, the method further includes: Determining whether there is external magnetic field interference based on the adjusted magnetic field data; In the case where it is determined that there is no external magnetic field interference, determining a first rotation angle of the rotatable magnetic device based on the adjusted magnetic field data; When it is determined that there is external magnetic field interference, the function of the rotatable magnetic device is turned off.
3. The method according to claim 2, characterized in that The determining whether there is external magnetic field interference based on the adjusted magnetic field data includes: determining an external magnetic field offset based on the adjustment magnetic field data, the external magnetic field offset comprising at least one of a magnetic field offset of the rotation plane, a magnetic field offset in a third direction, and an angular offset of the rotatable magnetic device, the third direction being perpendicular to the rotation plane, and the adjustment magnetic field data comprising a first adjustment magnetic field data component in the first direction and a second adjustment magnetic field data component in the second direction; When any of the external magnetic field offsets exceeds a first preset range, determining that external magnetic field interference exists; When the offsets in the external magnetic field offsets do not exceed the first preset range, it is determined that there is no external magnetic field interference.
4. The method according to claim 3, characterized in that In a case where the external magnetic field offset includes the magnetic field offset of the rotation plane, determining the external magnetic field offset based on the adjusted magnetic field data includes: Based on the first adjusted magnetic field data component and the second adjusted magnetic field data component, a magnetic field offset of the rotation plane is determined.
5. The method according to claim 3, characterized in that: The magnetic field data includes a third magnetic field data component in the third direction; In a case where the external magnetic field offset includes the magnetic field offset in the third direction, determining the external magnetic field offset based on the adjusted magnetic field data includes: determining a second rotation angle of the rotatable magnetic device based on the first adjustment magnetic field data component and the second adjustment magnetic field data component; determining a fourth magnetic field data component in the third direction corresponding to the second rotation angle based on a preset correspondence between the rotation angle of the rotatable magnetic device and the magnetic field data component in the third direction; Based on the third magnetic field data component and the fourth magnetic field data component, a magnetic field offset in the third direction is determined.
6. The method according to claim 3, characterized in that In a case where the external magnetic field offset includes the angle offset, determining the external magnetic field offset based on the adjusted magnetic field data includes: determining a second rotation angle of the rotatable magnetic device based on the first adjustment magnetic field data component and the second adjustment magnetic field data component; The angle offset is determined based on the second rotation angle and a third rotation angle, wherein the third rotation angle is calculated in an angle calculation cycle before an angle calculation cycle corresponding to the second rotation angle.
7. The method according to claim 2, characterized in that After shutting down the function of the rotatable magnetic device when it is determined that there is external magnetic field interference, the method further includes: Obtain magnetic field data within a preset time period; When the magnetic field data within the preset time period are all within a second preset range, the function of the rotatable magnetic device is turned on.
8. A data adjustment device, applied to electronic equipment, characterized in that: The electronic device includes a rotatable magnetic device, including: A rotating module, used for rotating the rotatable magnetic device while keeping the position of the electronic device unchanged; A first acquisition module, configured to acquire a plurality of first magnetic field data components in a first direction and a plurality of second magnetic field data components in a second direction, each of the first magnetic field data components corresponds to one second magnetic field data component, the first direction and the second direction are perpendicular to each other, and both the first direction and the second direction are parallel to a rotation plane of the rotatable magnetic device; A fitting module, used for performing elliptic curve fitting on the plurality of first magnetic field data components and the plurality of second magnetic field data components to obtain adjustment parameters; The adjustment module is used to adjust the magnetic field data based on the adjustment parameters to obtain adjusted magnetic field data.
9. The device according to claim 8, characterized in that The device also includes: A first determination module, configured to determine whether there is external magnetic field interference based on the adjusted magnetic field data after the magnetic field data is adjusted based on the adjustment parameter to obtain the adjusted magnetic field data; A second determination module is used to determine a first rotation angle of the rotatable magnetic device based on the adjusted magnetic field data when it is determined that there is no external magnetic field interference; The shut-down module is used to shut down the function of the rotatable magnetic device when it is determined that there is external magnetic field interference.
10. The device according to claim 9, characterized in that The first determining module comprises: a first determination submodule, configured to determine an external magnetic field offset based on the adjustment magnetic field data, wherein the external magnetic field offset includes at least one of a magnetic field offset in the rotation plane, a magnetic field offset in a third direction, and an angular offset of the rotatable magnetic device, wherein the third direction is perpendicular to the rotation plane, and the adjustment magnetic field data includes a first adjustment magnetic field data component in the first direction and a second adjustment magnetic field data component in the second direction; A second determination submodule, configured to determine that there is external magnetic field interference when any offset of the external magnetic field offset exceeds a first preset range; The third determination submodule is used to determine that there is no external magnetic field interference when the offsets in the external magnetic field offsets do not exceed the first preset range.
11. The device according to claim 10, characterized in that The first determining submodule includes: The first determining unit is configured to determine the magnetic field offset of the rotation plane based on the first adjustment magnetic field data component and the second adjustment magnetic field data component when the external magnetic field offset includes the magnetic field offset of the rotation plane.
12. The device according to claim 10, characterized in that The magnetic field data includes a third magnetic field data component in the third direction; The first determining submodule includes: a second determining unit, configured to determine a second rotation angle of the rotatable magnetic device based on the first adjustment magnetic field data component and the second adjustment magnetic field data component when the external magnetic field offset includes the magnetic field offset in the third direction; a third determining unit, configured to determine a fourth magnetic field data component in the third direction corresponding to the second rotation angle based on a preset correspondence between the rotation angle of the rotatable magnetic device and the magnetic field data component in the third direction; The fourth determining unit is used to determine the magnetic field offset in the third direction based on the third magnetic field data component and the fourth magnetic field data component.
13. The device according to claim 10, characterized in that The first determining submodule includes: A fifth determining unit, configured to determine a second rotation angle of the rotatable magnetic device based on the first adjustment magnetic field data component and the second adjustment magnetic field data component when the external magnetic field offset includes the angle offset; A sixth determining unit is used to determine the angle offset based on the second rotation angle and a third rotation angle, where the third rotation angle is calculated in an angle calculation cycle before the angle calculation cycle corresponding to the second rotation angle.
14. The device according to claim 9, characterized in that The device also includes: A second acquisition module is used to acquire magnetic field data within a preset time period after the function of the rotatable magnetic device is turned off when it is determined that there is external magnetic field interference; The activation module is used to activate the function of the rotatable magnetic device when the magnetic field data within the preset time period are all within a second preset range.
15. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the data adjustment method according to any one of claims 1 to 7 are implemented.
16. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the steps of the data adjustment method according to any one of claims 1 to 7 are implemented.