Detection method, readable storage medium, program product and electronic device

CN116679243BActive Publication Date: 2024-09-27HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211597668.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-12
Publication Date
2024-09-27
Estimated Expiration
2042-12-12

AI Technical Summary

Technical Problem

The existing technology is difficult to accurately detect whether the accessory device has been adsorbed to the electronic device, resulting in misjudgment and poor user experience.

Method used

By setting up a magnetic sensor in the electronic device and using the dynamic adjustment of the magnetic field intensity threshold, the magnetic field intensity threshold is determined based on the sum of the initial magnetic field intensity and the preset magnetic field intensity to determine whether the accessory device has been adsorbed.

Benefits of technology

It improves the accuracy of electronic devices in judging the adsorption status of accessory devices, reduces misjudgments, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116679243B
    Figure CN116679243B
Patent Text Reader

Abstract

The present application relates to the field of detection technology, and discloses a detection method, a readable storage medium, a program product, and an electronic device. The electronic device includes a magnetic sensor and at least one magnet. The electronic device can set the magnetic field strength threshold of the magnetic sensor to the sum of the magnetic field strength of at least one magnet acting on the magnetic sensor and a preset magnetic field strength, and after the magnetic field strength detected by the magnetic sensor is greater than or equal to the magnetic field strength threshold, determine that other electronic devices are adsorbed on the electronic device. In this way, since the magnetic field strength threshold increases with the increase of the magnetic field strength of the at least one magnet acting on the magnetic sensor and decreases with the decrease of the magnetic field strength of the at least one magnet acting on the magnetic sensor, the accuracy of the electronic device in determining whether there are other electronic devices adsorbed on the electronic device can be improved, which is conducive to improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of detection technology, and in particular to a detection method, a readable storage medium, a program product and an electronic device. Background Art

[0002] Electronic devices can usually be equipped with different accessory devices to expand the functions of the electronic devices and enhance the user experience. To improve the convenience of connection between the accessory device and the electronic device, magnets can be set in the electronic device and the accessory device respectively, so that the accessory device can be connected to the electronic device by magnetic attraction. After the accessory device has been adsorbed to the electronic device, the electronic device can communicate with the accessory device or charge the accessory device.

[0003] However, how to detect whether the accessory device has been attached to the electronic device is a problem that needs to be solved urgently. Summary of the invention

[0004] In view of this, the embodiments of the present application provide a detection method, a readable storage medium, a program product and an electronic device, which are conducive to improving the accuracy of an electronic device in detecting whether another electronic device is adsorbed on the electronic device.

[0005] In a first aspect, an embodiment of the present application provides a detection method, which is applied to a first electronic device, the first electronic device includes a magnetic sensor and at least one magnet; and the method includes:

[0006] When there is no magnetic field generated by a magnet outside the first electronic device, obtaining first magnetic field intensity data of at least one magnet inside the first electronic device acting on the magnetic sensor;

[0007] When the second electronic device including a magnet approaches the first electronic device, the second magnetic field strength data detected by the magnetic sensor is greater than the magnetic field strength threshold, which is determined based on the first magnetic field strength data;

[0008] It is determined that the second electronic device is attached to the first electronic device.

[0009] Through the method provided in the embodiment of the present application, the first electronic device can determine that the second electronic device is adsorbed on the first electronic device when the second magnetic field strength data detected by the magnetic sensor (such as the magnetometer hereinafter) is greater than the magnetic field strength threshold. Since the magnetic field strength threshold is based on the first magnetic field strength data (such as the initial magnetic field strength hereinafter) of at least one magnet inside the first electronic device acting on the magnetic sensor when there is no magnetic field generated by a magnet outside the first electronic device (such as when there are no other magnets around the first electronic device, or when the magnetic field strength of other magnets acting on the magnetic sensor can be ignored), it can avoid false detection caused by the position difference between at least one magnet and the magnetic sensor, the change of the magnetization strength of at least one magnet, etc. (that is, when the second electronic device is adsorbed on the first electronic device, it is judged that it is not adsorbed, and when the second electronic device is not adsorbed on the first electronic device, it is judged that it is adsorbed), which is conducive to improving the accuracy and user experience of the first electronic device in judging whether the second electronic device is adsorbed on the first electronic device.

[0010] It should be noted that when there is no magnetic field generated by a magnet outside the first electronic device, it does not mean that there is no magnetic field generated by any other magnet around the first electronic device, but that the magnetic field generated by other magnets can be ignored. In a possible implementation of the first aspect, the magnetic field strength threshold is the sum of the first magnetic field strength data and the third magnetic field strength data, wherein the third magnetic field strength data is determined based on the magnetic field strength data of the magnet in the second electronic device acting on the magnetic sensor when the second electronic device is adsorbed on the first electronic device.

[0011] That is to say, the magnetic field strength threshold is determined by the sum of the first magnetic field strength data and the third magnetic field strength data (for example, the preset magnetic field strength mentioned below). The magnetic field strength threshold increases with the increase of the first magnetic field strength data and decreases with the decrease of the second magnetic field strength data. This can avoid the problem of changes in the magnetic field strength of the magnet acting on the magnetic sensor due to the installation position tolerance of the magnet and the magnetic sensor, the magnetic field strength tolerance of the magnet, etc., which is conducive to further improving the accuracy of the first electronic device in judging whether the second electronic device has been adsorbed to the first electronic device.

[0012] In a possible implementation of the first aspect, when the second electronic device is attached to the first electronic device, the magnetic field strength data of the magnet in the second electronic device acting on the magnetic sensor is M, and the third magnetic field strength data is k×M, where 0 <k<1。

[0013] In a possible implementation of the first aspect, the first magnetic field intensity data includes magnetic field intensity data of at least one axis; and the magnetic field intensity data of each axis of the first magnetic field intensity data is within a corresponding preset threshold range.

[0014] That is to say, the magnetic field strength threshold will be determined based on the first magnetic field strength data only when the first magnetic field strength data is within the preset threshold range, which can avoid obtaining an erroneous magnetic field strength threshold, and is conducive to further improving the rationality of the magnetic field strength threshold, thereby improving the accuracy of the first electronic device in determining whether the second electronic device is adsorbed on the first electronic device.

[0015] In a possible implementation of the first aspect above, the difference between the magnetic field strength data of each axis in the above-mentioned first magnetic field strength data and the magnetic field strength data of the corresponding axis in the fourth magnetic field strength data is less than the preset difference of the corresponding axis, wherein the fourth magnetic field strength data is the magnetic field strength data of at least one magnet acting on the magnetic sensor when there is no magnetic field generated by a magnet outside the first electronic device, the magnetic field strength data of each axis in the fourth magnetic field strength data is within the corresponding preset threshold range, and the environment in which the first electronic device is located when obtaining the fourth magnetic field strength data is different from that when obtaining the first magnetic field strength data.

[0016] That is to say, in the absence of a magnetic field generated by a magnet outside the first electronic device, when the difference between the first magnetic field strength data and the second magnetic field strength data of the magnetic field strength data of the magnetic sensor of at least one magnet acting on the first electronic device in different environments is small, the magnetic field strength threshold is determined based on the first magnetic field strength data, which is conducive to further improving the rationality of the magnetic field strength threshold, and thus improving the accuracy of the first electronic device in judging whether the second electronic device is adsorbed on the first electronic device. In a possible implementation of the first aspect above, the first magnetic field strength data and the second magnetic field strength data both include first-axis magnetic field strength data, second-axis magnetic field strength data, and third-axis magnetic field strength data, wherein the preset difference corresponding to the first-axis magnetic field strength data is 200 microteslas, the preset difference corresponding to the second-axis magnetic field strength data is 5000 microteslas, and the preset difference corresponding to the third-axis magnetic field strength data is 5000 microteslas.

[0017] For example, the first axis may be along a narrower side of the first electronic device, the second axis may be along a wider side of the second electronic device, and the third axis may be a plane defined perpendicular to the first axis and the second axis.

[0018] In a possible implementation of the first aspect, the position of the first electronic device when acquiring the fourth magnetic field strength data is different from that when acquiring the first magnetic field strength data.

[0019] For example, the position of the first electronic device when acquiring the fourth magnetic field strength data and the position of the first electronic device when acquiring the first magnetic field strength data may be different test positions (eg, different test stations) under the same test environment.

[0020] In a possible implementation of the first aspect, the first magnetic field strength data is magnetic field strength data detected by the magnetic sensor when there is no magnetic field generated by a magnet outside the first electronic device.

[0021] In a second aspect, an embodiment of the present application provides an electronic device, comprising: a memory storing instructions; at least one magnet; at least one magnetic sensor; and at least one processor for executing instructions so that the electronic device implements the detection method provided in the first aspect and any possible implementation of the first aspect based on magnetic field strength data detected by the at least one magnetic sensor and magnetic field strength data of at least one magnet acting on each magnetic sensor.

[0022] In a third aspect, an embodiment of the present application provides a computer program product, which, when running on an electronic device, enables the electronic device to implement the detection method provided in the first aspect and any possible implementation of the first aspect.

[0023] In a fourth aspect, an embodiment of the present application provides a readable storage medium having instructions stored thereon. When the instructions are executed by an electronic device, the electronic device implements the detection method provided by the first aspect and any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 According to some embodiments of the present application, a schematic diagram of a process of adsorbing a stylus pen 20 to a tablet computer 10 is shown;

[0025] Figure 2 According to some embodiments of the present application, a schematic diagram of initial magnetic field strength corresponding to a magnetometer of different tablet computers is shown;

[0026] Figure 3 According to some embodiments of the present application, a schematic diagram of a scene in which a stylus pen 20 is adsorbed onto a tablet computer 10 is shown;

[0027] Figure 4A According to some embodiments of the present application, a schematic diagram of a scenario in which the main device is a tablet computer 10 and the accessory device is a keyboard 30 is shown;

[0028] Figure 4B According to some embodiments of the present application, a schematic diagram of a scenario in which the main device is an earphone box 40 and the accessory devices are a left earphone 41L and a right earphone 42R is shown;

[0029] Figure 4C According to some embodiments of the present application, a schematic diagram of a scenario in which the main device is a smart TV 50 and the accessory device is a camera 60 is shown;

[0030] Figure 5 According to some embodiments of the present application, a flow chart of a detection method for detecting the initial magnetic field intensity MSI0 corresponding to the magnetometer MS-1 is shown;

[0031] Fig. 6A According to some embodiments of the present application, a schematic diagram of an interface for a user to input an MMI command displayed by a tablet computer 10 is shown;

[0032] Figure 6B According to some embodiments of the present application, a schematic diagram of an MMI test interface displayed by a tablet computer 10 is shown;

[0033] Figure 6C According to some embodiments of the present application, a schematic diagram of an interface of a tablet computer 10 displaying a magnetometer test pass message is shown;

[0034] Fig.6D According to some embodiments of the present application, a schematic diagram of an interface of a tablet computer 10 displaying a magnetometer test failure message is shown;

[0035] Figure 7 According to some embodiments of the present application, a flow chart of a method for detecting a first initial magnetic field intensity MSI0' of a magnetometer MS-1 is shown;

[0036] Figure 8 According to some embodiments of the present application, a schematic diagram of a process of a tablet computer 10 determining whether a magnetometer test has passed is shown;

[0037] Fig. 9 According to some embodiments of the present application, a flow chart of another method for detecting the initial magnetic field intensity MSI0 corresponding to the magnetometer MS-1 is shown;

[0038] Fig. 10A According to some embodiments of the present application, another schematic diagram of an interface for a user to input an MMI command displayed by a tablet computer 10 is shown;

[0039] Fig. 10B According to some embodiments of the present application, another schematic diagram of an MMI test interface displayed by a tablet computer 10 is shown;

[0040] Fig. 10C According to some embodiments of the present application, another interface schematic diagram of a magnetometer test pass message displayed by a tablet computer 10 is shown;

[0041] Fig. 10D According to some embodiments of the present application, a schematic diagram of an interface of a tablet computer 10 displaying a magnetometer calibration passed message is shown;

[0042] Fig. 10EAccording to some embodiments of the present application, another interface schematic diagram of a magnetometer test failure message displayed by a tablet computer 10 is shown;

[0043] Fig.10F According to some embodiments of the present application, a schematic diagram of an interface of a tablet computer 10 displaying a magnetometer calibration failure message is shown;

[0044] Fig.11 According to some embodiments of the present application, a flow chart of a method for detecting a magnetic field intensity threshold of a magnetometer is shown;

[0045] Fig.12 According to some embodiments of the present application, a schematic flow chart of an adsorption detection method is shown;

[0046] Fig.13 According to some embodiments of the present application, a structural schematic diagram of a tablet computer 10 is shown. DETAILED DESCRIPTION

[0047] Illustrative embodiments of the present application include, but are not limited to, a detection method, a readable storage medium, a program product, and an electronic device.

[0048] In order to improve the convenience of connection between the accessory device and the electronic device, magnets can be respectively provided in the electronic device and the accessory device, so that the accessory device can be connected to the electronic device by magnetic attraction. After the accessory device has been attracted to the electronic device, the electronic device can communicate with the accessory device or charge the accessory device.

[0049] In some embodiments, a magnetic sensor, such as a magnetometer, may be provided in the electronic device, so that the electronic device can determine that an accessory device is connected to the electronic device when the magnetic field strength detected by the magnetometer is greater than or equal to a preset value. For ease of description, the electronic device provided with a magnetometer is referred to as a main device below.

[0050] For example, Figure 1 According to some embodiments of the present application, a schematic diagram of a process of adsorbing a stylus pen 20 to a tablet computer 10 is shown.

[0051] refer to Figure 1 The tablet computer 10 (main device) is provided with a coil L1, a magnet M1, a magnet M2 and a magnetometer MS-1; the stylus pen 20 (accessory device) is provided with a coil L2, a magnet M3 and a magnet M4. The magnetic field strength detected by the magnetometer MS-1 increases from MSI0 to MSI1 when the distance between the stylus pen 20 and the tablet computer 10 decreases from L to 0. M, wherein MSI0 is the magnetic field strength detected by the magnetometer MS-1 when the stylus 20 is away from the tablet computer 10 (i.e., the magnetic field strength of the magnets M3 and M4 acting on the magnetometer MS-1 can be ignored) (i.e., the magnetic field strength of the magnets M1 and M2 used in the magnetometer MS-1, hereinafter referred to as the initial magnetic field strength), and MSI M It is the magnetic field strength detected by the magnetometer MS-1 when the stylus 20 is attached to the tablet computer 10. Based on this, the tablet computer 10 can set a magnetic field strength threshold MSI T , and the magnetic field strength detected by magnetometer MS-1 is greater than or equal to the magnetic field strength threshold MSI T In the case of the above, it is determined that the stylus pen 20 has been adsorbed onto the tablet computer 10, and the stylus pen 20 is charged through the coil L1 and the coil L2.

[0052] It is understood that the magnets M1, M2, M3 and M4 can be any form of magnets or magnet arrays that can be mutually adsorbed, and are not limited here. In some embodiments, in order to improve the accuracy of adsorption between the tablet computer 10 and the stylus 20, the magnets M1, M2, M3 and M4 can be magnets using a Halbach array.

[0053] It can be understood that in other embodiments, the magnet M1, the magnet M2, the magnet M3 and the magnet M4 may also be other magnets that can be attracted by magnetic force, which is not limited here.

[0054] However, due to factors such as the difference in the installation position of the magnetometer MS-1 and the magnets M1 and M2 (e.g., the installation position tolerance), the difference in the magnetization intensity of the magnets M1 and M2, and the change in the magnetization intensity of the magnets M1 and M2, the fluctuation range of the initial magnetic field intensity MSI0 detected by the magnetometer MS-1 when the stylus 20 is away from the tablet computer 10 is enlarged. Figure 2 , the horizontal axis is the device number, which is used to indicate different tablet computers from the same batch as the tablet computer 10; the vertical axis is the initial magnetic field strength corresponding to the magnetometers in different tablet computers, in microteslas. Figure 2 It can be seen that when the stylus is away from the tablet, the initial magnetic field strength MSI0 detected by the magnetometer fluctuates from 0 to -1000 microtesla (μT), where "-" means that the direction of the magnetic field strength detected by the magnetometer MS-1 is opposite to the reference direction preset by the magnetometer MS-1, and the absolute value of the initial magnetic field strength represents the magnetic field strength. If the developer sets a unified magnetic field strength threshold MSI for the batch of tablets T , which will cause some tablets to misjudge whether the stylus is adsorbed.

[0055] For example, suppose that the magnetic field strength of the stylus 10 acting on the magnetometer MS-1 after being attached to the tablet computer 10 is -1000 microtesla. T If the initial magnetic field strength MSI0 corresponding to the magnetometer MS-1 is -200 microtesla, the magnetic field strength detected by the magnetometer MS-1 after the stylus 10 is attached to the tablet 10 is -1200 microtesla, which does not reach the magnetic field strength threshold MSI0. T , the tablet computer 10 will determine that the stylus pen 10 is not adsorbed to the tablet computer 10, resulting in a misjudgment.

[0056] For another example, assume that the magnetic field strength of the stylus 10 acting on the magnetometer MS-1 after being attached to the tablet computer 10 is -1000 microtesla. T Set to -1500. If the initial magnetic field strength MSI0 corresponding to the magnetometer MS-1 is -800 microtesla, the magnetic field strength of the stylus 10 acting on the magnetometer MS-1 after it is not attached to the tablet 10 will reach -700 microtesla, and the magnetic field strength detected by the magnetometer MS-1 will reach the magnetic field strength threshold MSI T , the tablet computer 10 may determine that the stylus pen 10 has been adsorbed when the stylus pen 10 has not been adsorbed to the tablet computer 10 , resulting in a misjudgment.

[0057] In view of this, an embodiment of the present application provides a detection method, which is applied to a main device including a magnetic sensor and a magnet. The main device can set the magnetic field strength threshold MSI of the magnetic sensor to T Set to the initial magnetic field strength MSI0 corresponding to the magnetic sensor (i.e. the magnetic field strength of the magnet in the main device acting on the magnetic sensor) and a preset magnetic field strength MSI p The master device (eg, tablet computer 10) may detect a magnetic field strength greater than or equal to the magnetic field strength threshold MSI when the magnetic sensor (eg, magnetometer MS-1) detects the magnetic field strength. T After that, it is determined that the accessory device (such as the stylus 10) has been attached to the main device. T It increases with the increase of the initial magnetic field strength MSI0 corresponding to the magnetic sensor, and decreases with the decrease of the initial magnetic field strength MSI0 corresponding to the magnetic sensor. This can avoid the problem of changes in the magnetic field strength of the magnet acting on the magnetic sensor due to the installation position tolerance of the magnet and the magnetic sensor, the magnetic field strength tolerance of the magnet, etc., which is beneficial to improve the accuracy of the main device in judging whether the accessory device has been adsorbed to the main device and enhance the user experience.

[0058] It is understood that in some embodiments, the preset magnetic field strength can be determined by the magnetic field strength of the accessory device acting on the magnetic sensor after the accessory device is attached to the main device, so as to increase the magnetic field strength threshold MSI.T rationality, and further improve the accuracy of the host device in determining whether the accessory device has been adsorbed to the host device. For example, assume that after the accessory device is adsorbed to the host device, the magnetic field intensity acting on the magnetic sensor is MSI S , then the above preset magnetic field intensity MSI p can be a value that satisfies k×MSI S <MSI p ≤MSI S (k < 1).

[0059] It can be understood that in some embodiments, the initial magnetic field intensity MSI0 corresponding to the magnetic sensor can be determined by obtaining the reading of the magnetic sensor in a test environment where the accessory device is far from the host device and there are no other magnets around the host device. The specific determination method will be introduced in detail below and will not be limited here.

[0060] It can be understood that the magnetic sensor can be any sensor or device that can detect the magnetic field intensity, including but not limited to magnetometers, magnetic sensors, magnetic field intensity testers, gauss meters, etc., and will not be limited here. For ease of description, in the following embodiments, the magnetic sensor is taken as a magnetometer for introduction.

[0061] For example, for Figure 1 the situation shown, the tablet computer 10 can set the magnetic field intensity threshold MSI T of the magnetometer MS-1 to the sum of the initial magnetic field intensity MSI0 corresponding to the magnetometer MS-1 and a preset magnetic field intensity MSI p . In some embodiments, the above preset magnetic field intensity MSI p can be a value that satisfies k×MSI S <MSI p ≤MSI S (0 < k < 1), where MSI S is the magnetic field intensity acting on the magnetometer MS-1 by the magnets M3 and M4 after the stylus 20 is adsorbed to the tablet computer 10. Then referring to Figure 3 , when the magnetic field intensity detected by the magnetometer MS-1 of the tablet computer 10 is greater than or equal to MSI T , it is determined that the stylus 20 has been adsorbed to the tablet computer 10, and the stylus 20 is charged through the coils L1 and L2, and a prompt box 31 is displayed to prompt the user that the stylus 20 has been adsorbed and is being charged.

[0062] It is understood that the magnetic field strength detected by the magnetic sensor may include components in multiple directions or may be a composite quantity, which is not limited here. In some embodiments, when the magnetic field strength detected by the magnetic sensor includes multiple components, the initial magnetic field strength MSI0 or the preset magnetic field strength MSI corresponding to the magnetic sensor is P Or the magnetic field strength threshold MSI T It can include multiple components or a composite quantity. T When multiple components are included, the master device can detect the magnetic field strength when each component of the magnetic sensor is greater than or equal to MSI T When the corresponding component in the magnetic field is detected by the magnetic sensor, it is determined that the magnetic field strength is greater than or equal to the magnetic field strength threshold MSI. T If it is the magnetic field strength threshold MSI T It is a composite quantity. The master device can detect the composite quantity of the magnetic field strength detected by the magnetic sensor when it is greater than or equal to MSI. T When the magnetic field strength detected by the magnetic sensor is greater than or equal to the magnetic field strength threshold MSI T .

[0063] It can be understood that the main device can be any electronic device including a magnetometer and a magnet, including but not limited to laptop computers, tablet computers, displays, notebook computers, headphone boxes, smart TVs, mobile phones, smart speakers, servers, head-mounted displays, mobile email devices, portable game consoles, portable music players, reader devices, headphone boxes, etc., and the embodiments of the present application are not limited thereto.

[0064] It is understood that the accessory device may be any electronic device that includes a magnet and can be attached to the main device through the magnet, including but not limited to headphones, stylus pens, keyboards, cameras, handwriting tablets, handles, portable display screens, audio playback devices, etc. For example, in some embodiments, corresponding to main devices such as tablet computers and mobile phones, the accessory device may include a stylus pen, keyboard, etc.; corresponding to main devices such as laptops, monitors, smart TVs, desktop computers, etc., the accessory device may include a keyboard, camera, etc.; corresponding to main devices such as earphone boxes, the accessory device may be earphones, etc.

[0065] For example, Figure 4A According to some embodiments of the present application, a schematic diagram of a scenario in which the main device is a tablet computer 10 and the accessory device is a keyboard 30 is shown; Figure 4B According to some embodiments of the present application, a schematic diagram of a scenario in which the main device is an earphone box 40 and the accessory devices are a left earphone 41L and a right earphone 42R is shown; Figure 4C According to some embodiments of the present application, a schematic diagram of a scenario in which a main device is a smart TV 50 and an accessory device is a camera 60 is shown.

[0066] refer to Figure 4A The tablet computer 10 (main device) is provided with magnets M5, M6 and a magnetometer MS-2; the keyboard 30 (accessory device) is provided with magnets M7 and M8. The tablet computer 10 can set the magnetic field strength threshold MSI of the magnetometer MS-2 T-1 Set to the initial magnetic field intensity MSI corresponding to the magnetometer MS-2 0-1 and a preset magnetic field strength MSI p-1 Then the tablet computer 10 detects a magnetic field strength greater than or equal to MSI when the magnetic field strength detected by the magnetometer MS-2 is greater than or equal to MSI. T-1 In the case of the keyboard device 30 being adsorbed to the tablet computer 10 , a communication connection is established between the tablet computer 10 and the keyboard 30 , so that the user can interact with the tablet computer 10 through the keyboard 30 .

[0067] refer to Figure 4B The earphone box 40 (main device) is provided with magnets M11, M12, magnetometers MS-3 and MS-4; the left earphone 41L (accessory device) is provided with magnets M9; the right earphone 41R (accessory device) is provided with magnets M10. The earphone box 40 can set the magnetic field strength threshold MSI of the magnetometer MS-3 T-2 Set to the initial magnetic field intensity MSI corresponding to the magnetometer MS-3 0-2 and a preset magnetic field strength MSI p-1 The sum of the magnetic field strength threshold MSI of the magnetometer MS-4 T-3 Set to the initial magnetic field intensity MSI corresponding to the magnetometer MS-4 0-3 and a preset magnetic field strength MSI p-1 Then the headphone box 40 detects a magnetic field strength greater than or equal to MSI when the magnetometer MS-3 detects it. T-2 In the case where the left earphone 41L is adsorbed to the earphone box 40, the left earphone 41L is charged; and / or when the magnetic field strength detected by the magnetometer MS-4 is greater than or equal to MSI T-3 In this case, it is determined that the right earphone 41R has been adsorbed to the earphone box 40 and the left earphone 41R is charged.

[0068] refer to Figure 4C The smart TV 50 (main device) is provided with magnets M13, M14 and a magnetometer MS-5; the camera 60 (accessory device) is provided with magnets M15 and M16. The smart TV 50 can set the magnetic field strength threshold MSI of the magnetometer MS-5 T-4 Set to the initial magnetic field intensity MSI corresponding to the magnetometer MS-5 0-4 and a preset magnetic field strength MSI p-3Then the smart TV 50 detects a magnetic field strength greater than or equal to MSI when the magnetic field strength detected by the magnetometer MS-4 is greater than or equal to MSI. T-4 In the case of the above, it is determined that the camera 60 has been adsorbed to the smart TV 50, and a communication connection is established between the smart TV 50 and the camera 60, so that the user can take images or videos through the camera 60.

[0069] The following combination Figure 1 In the scenario shown, the main device is a tablet computer 10, the accessory device is a stylus 20, and the magnetic field strength detected by the magnetometer MS-1 includes components of three axes, X, Y, and Z, as an example to introduce the technical solution of the present application.

[0070] First, the technical solution for detecting the initial magnetic field intensity MSI0 corresponding to the magnetometer MS-1 is introduced.

[0071] Specifically, Figure 5 According to some embodiments of the present application, a flow chart of a method for detecting the initial magnetic field intensity MSI0 corresponding to the magnetometer MS-1 is shown. Figure 5 As shown, the process includes the following steps:

[0072] S500: The tablet computer 10 enters a magnetic field strength test environment.

[0073] After entering the magnetic field strength test environment, the tablet computer 10 can detect the initial magnetic field strength MSI0 corresponding to the magnetometer MS-1 by the method provided in the embodiment of the present application.

[0074] It can be understood that the magnetic field strength test environment can be an environment where there are no other magnets around the tablet computer 10, or an environment where the magnetic field strength of other magnets acting on the magnetometer MS-1 is negligible (for example, an environment where the magnetic field strength of other magnets acting on the magnetometer MS-1 is less than a preset negligible value).

[0075] S501: The tablet computer 10 detects an MMI instruction for testing the magnetometer MS-1.

[0076] When the tablet computer 10 detects a man-machine interface (MMI) test instruction (hereinafter referred to as MMI instruction) for testing the magnetometer MS-1, the detection method provided in the embodiment of the present application is triggered.

[0077] It can be understood that the MMI instructions are instructions preset by the developer of the electronic device. The user can send the MMI instructions to the electronic device through a wired or wireless communication connection, or enter the MMI instructions through the dial pad of an application in the electronic device (such as a dialing application, a contact application, a phone application, etc.) to trigger a test of a certain function in the electronic device.

[0078] For example, reference Fig. 6A After confirming that the tablet computer 10 has entered the magnetic field strength test environment, the user can enter the MMI command "*#12345#" for testing the magnetometer MS-1 in the dial pad of the contact application. Then, when the tablet computer 10 detects that the user has entered the MMI command "*#12345#" for testing the magnetometer MS-1 in the dial pad of the contact application, it can switch to Figure 6B The MMI test interface corresponding to the MMI test application shown.

[0079] It can be understood that the above MMI instruction "*#12345#" is only an example. In other embodiments, the MMI instruction for testing the magnetometer MS-1 may also be other MMI instructions, which is not limited here.

[0080] S502: The tablet computer 10 reads and saves the three-axis magnetic field intensity data of the magnetometer MS-1.

[0081] After the user triggers a test instruction for the magnetometer MS- 1 , the tablet computer 10 reads and saves the three-axis magnetic field intensity data of the magnetometer MS- 1 .

[0082] For example, in some embodiments, reference Figure 6B The tablet computer 10 can trigger the test of the magnetometer MS-1 and read and save the three-axis magnetic field strength data of the magnetometer MS-1 when detecting the user's selection operation on the "Start Test" control 61 or pressing the key associated with the selection operation (such as the volume increase key 11 or the volume decrease key 12).

[0083] It can be understood that the three-axis magnetic field strength data of the magnetometer MS-1 may include the components M of the magnetic field strength at the magnetometer MS-1 in the X-axis direction, the Y-axis direction, and the Z-axis direction. X 、M Y and M Z Among them, reference Figure 1 The positive direction of the X-axis can be along the narrower side of the tablet computer 10 pointing to the side where the stylus 20 is adsorbed, the positive direction of the Y-axis is along the wider side of the tablet computer 10 (the side where the stylus 20 is adsorbed), and the positive direction of the Z-axis is perpendicular to the display screen of the tablet computer 10 and outward (not shown, that is, the Z-axis is perpendicular to the plane defined by the X-axis and the Y-axis).

[0084] S503: The tablet computer 10 determines whether the three-axis magnetic field strength data are all within the corresponding preset threshold range.

[0085] The tablet computer 10 determines whether the three-axis magnetic field strength data is within the corresponding preset threshold range. If the three-axis magnetic field strength data is within the corresponding preset threshold range, it means that the three-axis magnetic field strength data can be used as the initial magnetic field strength of the magnetometer MS-1, and go to step S504; otherwise, it means that the three-axis magnetic field strength data cannot be used as the initial magnetic field strength of the magnetometer MS-1, and go to step S508.

[0086] It can be understood that in some embodiments, the preset threshold range can be determined according to the installation position tolerance of the magnetometer MS-1 and the magnet M1 and the magnet M2, and the magnetization strength of the magnet M1 and the magnet M2. As an example, for the magnetic field strength data of the X-axis, assuming that the magnetometer MS-1 and the magnet M1 and the magnet M2 are all installed in theoretical positions, and the magnetization strength of the magnet M1 and the magnet M2 are both theoretical values, the component of the magnetic field strength of the magnet M1 and the magnet M2 acting on the magnetometer MS-1 on the X-axis is MX0, and the installation position tolerance of the magnetometer MS-1 and the magnet M1 and the magnet M2 causes the maximum change in the component of the magnetic field strength of the magnet M1 and the magnet M2 acting on the magnetometer MS-1 on the X-axis to be DMX1, and the magnetization strength tolerance of the magnet M1 and the magnet M2 causes the maximum change in the component of the magnetic field strength of the magnet M1 and the magnet M2 acting on the magnetometer MS-1 on the X-axis to be DMX2, then the preset threshold range of the magnetic field strength data of the magnetometer MS-1 on the X-axis can be [MX0-DMX1-DMX2, MX0+DMX1+DMX2].

[0087] It is understandable that in other embodiments, the preset threshold range corresponding to the magnetic field intensity data of the X-axis, Y-axis, and Z-axis may be determined by other methods, which are not limited here.

[0088] S504: The tablet computer 10 displays a message indicating that the magnetic field strength test has passed.

[0089] When determining that the three-axis magnetic field strength data of the magnetometer MS- 1 are all within the corresponding preset threshold range, the tablet computer 10 displays a message that the magnetic field strength test has passed.

[0090] For example, refer to Figure 6C , the tablet computer 10 may display a prompt message 62 to prompt the user that “the magnetometer test passed”.

[0091] S505: The tablet computer 10 saves the three-axis magnetic field strength data as the initial magnetic field strength corresponding to the magnetometer MS-1.

[0092] When determining that the three-axis magnetic field strength data of the magnetometer MS- 1 are all within the corresponding preset threshold range, the tablet computer 10 saves the three-axis magnetic field strength data as the initial magnetic field strength corresponding to the magnetometer MS- 1 .

[0093] It can be understood that in some embodiments, the execution order of step S504 and step S505 can be exchanged or combined into one step, which is not limited here.

[0094] S506: The tablet computer 10 determines whether the saving is successful.

[0095] The tablet computer 10 determines whether the three-axis magnetic field strength data is successfully saved as the initial magnetic field strength corresponding to the magnetometer MS-1. If the saving is successful, the process goes to step S507; otherwise, the process goes to step S505 to save again.

[0096] S507: End the current test and proceed to the next test.

[0097] After successfully saving the three-axis magnetic field strength data as the initial magnetic field strength corresponding to the magnetometer MS- 1 , the tablet computer 10 ends the current test (the test on the magnetometer MS- 1 ) and proceeds to the next test.

[0098] It can be understood that in some embodiments, the developer of the tablet computer 10 presets a test sequence for each function of the tablet computer 10, and the next test refers to a test that is sequenced after the test of the magnetometer MS-1 in the test sequence set by the developer of the tablet computer 10. The tablet computer 10 can automatically jump to the next test after completing a test.

[0099] It is understood that in other embodiments, the tablet computer 10 may also perform the next test after detecting the user's selection operation. Figure 6C After detecting that the user clicks on the “Perform next test (magnetometer calibration)” control 63 , the tablet computer 10 performs the next test.

[0100] S508: The tablet computer 10 displays a message indicating that the magnetic field strength test has failed.

[0101] When determining that the magnetic field strength data of at least one axis of the three-axis magnetic field strength data is not within the corresponding preset threshold range, the tablet computer 10 determines that the three-axis magnetic field strength data cannot be used as the initial magnetic field strength of the magnetometer MS-1, and displays a message that the magnetic field strength test failed.

[0102] For example, reference Fig.6D , the tablet computer 10 may display a message 64 indicating that the magnetic field strength test failed, to prompt the user that the "magnetometer test failed". It is understood that in some embodiments, the tablet computer 10 may also display a "retry" control 65 and, upon detecting a user's selection operation on the "retry" control 65 (e.g., clicking the "retry" control 65, or pressing the volume up key 11 or the volume down key 12), proceed to step S502 for retrying.

[0103] S509: End the current test and save the test data.

[0104] When the tablet computer 10 determines that the magnetic field strength data of at least one axis of the three-axis magnetic field strength data is not within the corresponding preset threshold range, the current test is terminated and the test data is saved so that the tester can analyze whether the magnet M1, magnet M2, and magnetometer MS-1 in the tablet computer 10 are improperly installed or have quality problems based on the saved data.

[0105] It can be understood that in some embodiments, the execution order of step S505 and step S509 can be exchanged or combined into one step, which is not limited here.

[0106] Through the method provided in the embodiment of the present application, the tablet computer 10 can determine the initial magnetic field strength data MSI0 corresponding to the magnetometer MS-1 by testing the magnetometer MS-1, thereby setting the magnetic field strength threshold MSI0 corresponding to the magnetometer MS-1. T Set to the determined initial magnetic field strength data MSI0 and the preset magnetic field strength MSI p Based on this, the tablet computer 10 can detect that the magnetic field strength data detected by the magnetometer MS-1 is greater than or equal to the magnetic field strength threshold MSI. T In the case of , it is determined that the stylus pen 20 has been adsorbed to the tablet computer 10. Due to the magnetic field strength threshold MSI T It changes with the change of the initial magnetic field intensity MSI0 corresponding to the magnetometer MS-1, which can improve the accuracy of the tablet computer 10 in judging whether the stylus 20 has been adsorbed to the tablet computer 1, which is beneficial to improving the user experience.

[0107] exist Figure 5 In the illustrated embodiment, when the three-axis magnetic field strength data of the magnetometer MS-1 are all within the corresponding preset threshold range, the tablet computer 10 saves the three-axis magnetic field strength data as the initial magnetic field strength corresponding to the magnetometer MS-1. The embodiment of the present application also provides another method for detecting the initial magnetic field strength MSI0 corresponding to the magnetometer MS-1. The tablet computer 10 can first obtain the first initial magnetic field strength MSI0' of the magnetometer MS-1 in a test environment, and then obtain the second initial magnetic field strength MSI0" of the magnetometer MS-1 in another test environment. When the difference between the first initial magnetic field strength MSI0' and the second initial magnetic field strength MSI0" is less than the preset difference, the first initial magnetic field strength MSI0' or the second initial magnetic field strength MSI0" is used as the initial magnetic field strength MSI0 corresponding to the magnetometer MS-1. This is conducive to further improving the accuracy of the detected initial magnetic field strength.

[0108] Specifically, Figure 7According to some embodiments of the present application, a flow chart of a method for detecting the first initial magnetic field strength MSI0' of the magnetometer MS-1 is shown. The execution subject of the flow is a tablet computer 10, such as Figure 7 As shown, the process includes the following steps:

[0109] S701: Initialize the MMI test interface.

[0110] When the tablet computer 10 is in the first test environment, upon detecting an MMI instruction corresponding to obtaining the first initial magnetic field intensity MSI0' of the magnetometer MS-1, the test interface of the MMI test application can be initialized.

[0111] It is understandable that the MMI instruction may be sent to the tablet computer 10 by other electronic devices; it may also be input by the user on the tablet computer 10; or it may be automatically generated by the tablet computer 10 after completing the test that is arranged before the test sequence set by the developer, "obtaining the first initial magnetic field strength MSI0' of the magnetometer MS-1". The embodiment of the present application does not limit the source of the MMI instruction corresponding to obtaining the first initial magnetic field strength MSI0' of the magnetometer MS-1.

[0112] For example, reference Fig. 6A The tablet computer 10 can be initialized to the state where the user enters the MMI command "*#12345#" for testing the magnetometer MS-1 in the dial pad of the contact application. Figure 6B The MMI test interface of the MMI test application is shown.

[0113] It can be understood that in some embodiments, the first test environment can be an environment where there are no other magnets around the tablet computer 10, or an environment where the magnetic field strength of other magnets acting on the magnetometer MS-1 is negligible (for example, an environment where the magnetic field strength of other magnets acting on the magnetometer MS-1 is less than a preset negligible value).

[0114] It can be understood that in some embodiments, the first test environment can be the aforementioned magnetic field strength test environment.

[0115] S702: Determine whether to enter this test from the previous test.

[0116] After initializing the MMI test interface, the tablet computer 10 determines whether to enter the test of obtaining the first initial magnetic field strength MSI0' of the magnetometer MS-1 from the previous test. If yes, it means that the test can be started directly, and the process goes to step S704; otherwise, it means that further confirmation from the user is required, and the process goes to step S703.

[0117] It can be understood that the previous test refers to the test that is before the test of “obtaining the first initial magnetic field intensity MSI0′ of the magnetometer MS- 1 ” in the test sequence set by the developer of the tablet computer 10 .

[0118] S703: Waiting for key triggering.

[0119] When the tablet computer 10 determines that the test of "obtaining the first initial magnetic field intensity MSI0' of the magnetometer MS-1" is not entered from the previous test, it waits for a key trigger. During the waiting for the key trigger, if it is detected that the first preset key is triggered, it means that the user agrees to perform the test, and the process goes to step S704; if it is detected that the second preset key is triggered, it means that the user refuses to perform the test, and the process goes to step S708.

[0120] It can be understood that the first preset button and the second preset button can be any two different buttons in the tablet computer 10. For example, in some embodiments, the first preset button can be the volume increase button 11 or the volume decrease button 12, and the second preset button can be the power button 13.

[0121] S704: Start testing.

[0122] When the tablet computer 10 determines that the test is entered from the previous test or detects that the user triggers the first preset button, it starts the test, that is, starts to obtain the first initial magnetic field intensity MSI0' of the magnetometer MS-1.

[0123] S705: Determine whether the test passes.

[0124] The tablet computer 10 determines whether the test is passed. If the test is passed, the process goes to step S706 ; otherwise, the process goes to step S707 .

[0125] It can be understood that, in some embodiments, the tablet computer 10 can determine that the test is passed when the magnetic field intensity data of each axis in the first initial magnetic field intensity MSI0′ is within the corresponding preset threshold range.

[0126] Specifically, refer to Figure 8 The tablet computer 10 can determine whether the test passes by executing the following steps S705A to S705E:

[0127] S705A: Receive the MMI instruction for testing the magnetometer MS-1 sent by the MMI test application.

[0128] When the tablet computer 10 determines that the test is entered from a previous test or detects that the user triggers the first preset button, the tablet computer 10 may receive an MMI instruction for testing the magnetometer MS- 1 sent by the MMI test application.

[0129] S705B: Acquire three-axis magnetic field strength data, and determine whether the three-axis magnetic field strength data are all within the corresponding preset threshold range.

[0130] After receiving the MMI instruction for testing the magnetometer MS-1 sent by the MMI test application, the tablet computer 10 obtains the three-axis magnetic field strength data of the magnetometer MS-1 and determines whether the three-axis magnetic field strength data are all within the corresponding preset threshold range. If it is determined whether the three-axis magnetic field strength data are all within the corresponding preset threshold range, it means that the three-axis magnetic field strength data can be used as the first initial magnetic field strength MSI0' of the first magnetometer MS-1, and the process goes to step S705D; otherwise, it means that the three-axis magnetic field strength data cannot be the first initial magnetic field strength MSI0' of the magnetometer MS-1, and the process goes to step S705C.

[0131] It can be understood that the specific method of determining whether the three-axis magnetic field intensity data are all within the corresponding preset threshold range can refer to the aforementioned step S503, which will not be described in detail here.

[0132] S705C: Return a test failure flag to the MMI test application.

[0133] When the tablet computer 10 determines that at least one magnetic field strength data is not within the corresponding preset threshold range, it determines that the test has failed and returns a test failure flag to the MMI test application. Then, when the MMI test application receives the returned test failure flag, the tablet computer 10 can determine that the test has failed and proceed to step S707.

[0134] S705D: Save the three-axis magnetic field intensity data as the first initial magnetic field intensity MSI0'.

[0135] When determining that the three-axis magnetic field intensity data are all within the corresponding preset threshold range, the tablet computer 10 saves the three-axis magnetic field intensity data as the first initial magnetic field intensity MSI0′.

[0136] It can be understood that in some embodiments, the first initial magnetic field strength MSI0' can be expressed as MSI0'=[MSI0'(x), MSI0'(y), MSI0'(z)], wherein MSI0'(x), MSI0'(y), MSI0'(z) respectively represent the components of the first initial magnetic field strength MSI0' in the x-axis direction, the y-axis direction and the z-axis direction.

[0137] S705E: Return a test pass flag to the MMI test application.

[0138] When the tablet computer 10 determines that the three-axis magnetic field strength data are all within the corresponding preset threshold range, it returns a test pass mark to the MMI test application. Then, when the MMI test application receives the returned test pass mark, the tablet computer 10 determines that the test is passed and goes to step S706.

[0139] It is understandable that in other embodiments, the tablet computer 10 may also determine whether the test is passed by other methods, which are not limited here.

[0140] S706: Jump to the next test.

[0141] When the tablet computer 10 determines that the test has passed, that is, when the first initial magnetic field strength MSI0' has been obtained, it jumps to the next test. The next test is a test for calibrating the first initial magnetic field strength MSI0', that is, obtaining the second initial magnetic field strength MSI0" of the magnetometer MS-1 in the second test environment, and determining the initial magnetic field strength MSI0 corresponding to the magnetometer MS-1 based on the difference between the first initial magnetic field strength MSI0' and the second initial magnetic field strength MSI0".

[0142] S707: Waiting for key triggering.

[0143] When the tablet computer 10 determines that the test fails, it waits for a key to be triggered so as to perform the next operation according to the triggered key. For example, in some embodiments, the tablet computer 20 may go to step S708 when it is detected that the user triggers the second preset key.

[0144] S708: Test failed.

[0145] When the tablet computer 10 detects that the second preset button is triggered, it determines that the test has failed and ends the test of obtaining the first initial magnetic field strength MSI0′.

[0146] Understandably, Figure 7 The method of obtaining the first initial magnetic field strength MSI0' of the magnetometer MS-1 shown is only an example. In other embodiments, the first initial magnetic field strength MSI0' may also be obtained by other methods, such as by Figure 5 The present invention is obtained by referring to the embodiment shown in the figure and is not limited here.

[0147] The following describes a solution for the tablet computer 10 to determine the initial magnetic field intensity MSI0 corresponding to the magnetometer MS-1 based on the difference between the first initial magnetic field intensity MSI0′ and the second initial magnetic field intensity MSI0″.

[0148] Specifically, Fig. 9According to some embodiments of the present application, a flow chart of another method for detecting the initial magnetic field intensity MSI0 corresponding to the magnetometer MS-1 is shown. Fig. 9 As shown, the process includes the following steps:

[0149] S900: The tablet computer 10 enters the second test environment.

[0150] After entering the second test environment, the tablet computer 10 can obtain the initial magnetic field intensity MSI0 corresponding to the magnetometer MS-1 through the method provided in the embodiment of the present application.

[0151] It can be understood that the second test environment can be an environment where there are no other magnets around the tablet computer 10, or an environment where the magnetic field strength of other magnets acting on the magnetometer MS-1 is negligible (for example, an environment where the magnetic field strength of other magnets acting on the magnetometer MS-1 is less than a preset negligible value), and the second test environment is different from the aforementioned first test environment.

[0152] It can be understood that, in some embodiments, the first test environment and the second test environment may be different test stations or different locations in the same test laboratory.

[0153] S901: The tablet computer 10 detects an MMI instruction for calibrating the magnetometer MS-1.

[0154] When the tablet computer 10 detects the MMI instruction of the calibration magnetometer MS-1, the detection method provided in the embodiment of the present application is triggered.

[0155] For example, reference Fig. 10A After confirming that the tablet computer 10 has entered the second test environment, the user can enter the MMI command "*#123456#" for calibrating the magnetometer MS-1 in the dial pad of the contact application. Then, when the tablet computer 10 detects that the user has entered the MMI command "*#123456#" for calibrating the magnetometer MS-1 in the dial pad of the contact application, it can switch to Fig. 10B The MMI test interface shown.

[0156] It can be understood that the above MMI instruction "*#123456#" is only an example. In other embodiments, the MMI instruction for calibrating the magnetometer MS-1 may also be other MMI instructions, which is not limited here.

[0157] S902: The tablet computer 10 reads and saves the current three-axis magnetic field strength data of the magnetometer MS-1.

[0158] After the user triggers a calibration instruction for the magnetometer MS- 1 , the tablet computer 10 reads and saves the current three-axis magnetic field intensity data of the magnetometer MS- 1 .

[0159] For example, reference Fig. 10B When the tablet computer 10 detects that the user clicks the "Start Calibration" control 1001, or detects that the user presses the volume increase key 11 or the volume decrease key 12, the tablet computer 10 reads and saves the current three-axis magnetic field intensity data of the magnetometer MS-1.

[0160] S903: The tablet computer 10 determines whether the current three-axis magnetic field strength data are all within the corresponding preset threshold range.

[0161] The tablet computer 10 determines whether the current three-axis magnetic field strength data is within the corresponding preset threshold range. If the current three-axis magnetic field strength data is within the corresponding preset threshold range, it means that the three-axis magnetic field strength data can be used as the second initial magnetic field strength MSI0", and go to step S904; otherwise, it means that the current three-axis magnetic field strength data cannot be used as the second initial magnetic field strength MSI0", and go to step S910.

[0162] It can be understood that the specific method of determining whether the current three-axis magnetic field intensity data are all within the corresponding preset threshold range can refer to the aforementioned step S503, which will not be described in detail here.

[0163] S904: The tablet computer 10 displays a message indicating that the magnetic field strength test has passed.

[0164] When determining that the current three-axis magnetic field strength data are all within the corresponding preset threshold range, the tablet computer 10 displays a message that the magnetic field strength test has passed.

[0165] For example, refer to Fig. 10C , the tablet computer 10 may display a prompt message 1002 to prompt the user that “the magnetometer test passed”.

[0166] S905: The tablet computer 10 stores the current three-axis magnetic field strength data as the second initial magnetic field strength MSI0".

[0167] When determining that the current three-axis magnetic field strength data are within the corresponding preset threshold range, the tablet computer 10 stores the current three-axis magnetic field strength data as the second initial magnetic field strength MSI0".

[0168] It can be understood that in some embodiments, the second initial magnetic field strength MSI0' can be expressed as MSI0"=[MSI0"(x), MSI0"(y), MSI0"(z)], wherein MSI0"(x), MSI0"(y), MSI0"(z) respectively represent the components of the second initial magnetic field strength MSI0" in the x-axis direction, the y-axis direction and the z-axis direction.

[0169] It can be understood that in some embodiments, the execution order of step S904 and step S905 can be swapped or combined into one step, which is not limited herein.

[0170] S906: The tablet computer 10 reads the first initial magnetic field intensity MSI0' and the second initial magnetic field intensity MSI0".

[0171] The tablet computer 10 reads the first initial magnetic field intensity MSI0' and the second initial magnetic field intensity MSI0"

[0172] S907: The tablet computer 10 determines whether the difference between the first initial magnetic field intensity MSI0' and the second initial magnetic field intensity MSI0" is within a preset difference range.

[0173] After the tablet computer 10 reads the first initial magnetic field intensity MSI0' and the second initial magnetic field intensity MSI0", it determines whether the difference between the first initial magnetic field intensity MSI0' and the second initial magnetic field intensity MSI0" is within a preset difference range. If it is determined that the difference between the first initial magnetic field intensity MSI0' and the second initial magnetic field intensity MSI0" is within the preset difference range, it indicates that the first initial magnetic field intensity MSI0' or the second initial magnetic field intensity MSI0" can be used as the initial magnetic field intensity MSI0 corresponding to the magnetometer MS-1, and proceeds to step S908; otherwise, it indicates that the first initial magnetic field intensity MSI0' and the second initial magnetic field intensity MSI0" cannot be used as the initial magnetic field intensity MSI0 corresponding to the magnetometer MS-1, and proceeds to step S912.

[0174] Exemplarily, in some embodiments, the tablet computer 10 can determine that the difference between the first initial magnetic field intensity MSI0' and the second initial magnetic field intensity MSI0" is within a preset difference range when the following conditions are met: |MSI0"(x) - MSI0'(x)| < a, and |MSI0"(y) - MSI0'(y)| < b, and |MSI0"(z) - MSI0'(z)| < c. Where a, b, and c are empirical values or preset values. For example, in some instances, a can be 200 microteslas, b can be 5000 microteslas, and c can be 5000 microteslas. It can be understood that in other embodiments, a, b, and c can also take other values, which are not limited herein.

[0175] S908: The tablet computer 10 displays a calibration passed message.

[0176] When the tablet computer 10 determines that the difference between the first initial magnetic field intensity MSI0' and the second initial magnetic field intensity MSI0" is within a preset difference range, it displays a message indicating that the magnetometer calibration has passed.

[0177] For example, refer to Fig. 10D The tablet computer 10 may display a prompt message 1003 after the prompt message 1002 to prompt the user that “magnetometer calibration passed”.

[0178] It can be understood that when the tablet computer 10 determines that the difference between the first initial magnetic field strength MSI0' and the second initial magnetic field strength MSI0" is within a preset difference range, the first initial magnetic field strength MSI0' or the second initial magnetic field strength MSI0" can be used as the initial magnetic field strength MSI0 corresponding to the magnetometer MS-1.

[0179] It can be understood that the tablet computer 10 uses the first initial magnetic field strength MSI0′ or the second initial magnetic field strength MSI0″ as the initial magnetic field strength MSI0 corresponding to the magnetometer MS-1, and can set the magnetic field strength threshold MSI0 corresponding to the magnetometer MS-1. T Set to the initial magnetic field strength MSI0 and the aforementioned preset magnetic field strength MSI p Then, the tablet computer 10 can detect that the magnetic field strength of the magnetometer MS-1 is greater than or equal to the magnetic field strength threshold MSI. T In the case of the above, it is determined that the stylus pen 20 has been adsorbed on the tablet computer 10, and the stylus pen 20 is charged.

[0180] S909: End the current test and proceed to the next test.

[0181] After displaying the calibration passed message, the tablet computer 10 ends the current test (a test for calibrating the magnetometer) and proceeds to the next test.

[0182] It can be understood that the next test is a test that is ordered after the calibration of the magnetometer MS-1 in the test sequence set by the developer of the tablet computer 10. After completing a test, the tablet computer 10 can automatically jump to the next test, or detect a user selection operation (for example, detecting that the user clicks Fig. 10D After clicking the "Proceed to next test" control 1004 in the dialog box, proceed to the next test.

[0183] S910: The tablet computer 10 displays a message indicating that the magnetic field strength test has failed.

[0184] When determining that the magnetic field strength data of at least one axis of the current three-axis magnetic field strength data is not within the corresponding preset threshold range, the tablet computer 10 determines that the current three-axis magnetic field strength data cannot be used as the second initial magnetic field strength MSI0" of the magnetometer MS-1, and displays a message that the magnetometer test has failed.

[0185] For example, reference Fig. 10E, the tablet computer 10 may display a prompt message 1005 to prompt the user that "the magnetometer test failed". It is understood that in some embodiments, the tablet computer 10 may also display a "recalibrate" control 1006 and, upon detecting a user's selection operation on the "recalibrate" control 1006 (e.g., clicking the "recalibrate" control 1006, or pressing the volume up key 11 or the volume down key 12), proceed to step S902 for a retry.

[0186] S911: End the current test and save the test data.

[0187] After displaying a test failure message or a calibration failure message, the tablet computer 10 ends the current test and saves the test data.

[0188] S912: The tablet computer 10 displays a magnetometer calibration failure message.

[0189] When determining that the difference between the first initial magnetic field strength MSI0′ and the second initial magnetic field strength MSI0″ is not within the preset difference range, the tablet computer 10 displays a message that the magnetometer calibration has failed.

[0190] For example, reference Fig.10F The tablet computer 10 may display a prompt message 1007 after the prompt message 1002 to prompt the user that “magnetometer calibration failed”.

[0191] It can be understood that in some embodiments, the tablet computer 10 can also display the "Recalibration" control 1006 and go to step S902 to retry when detecting the user's selection operation on the "Recalibration" control 1006 (for example, clicking the "Recalibration" control 1006, or pressing the volume up key 11 or the volume down key 12).

[0192] Through the method provided by the implementation of the present application, the tablet computer 10 uses the first initial magnetic field strength MSI0' or the second initial magnetic field strength MSI0" as the initial magnetic field strength MSI0 corresponding to the magnetometer MS-1 only when the difference between the first initial magnetic field strength MSI0' and the second initial magnetic field strength MSI0" is less than the preset difference. This is conducive to further improving the accuracy of the determined initial magnetic field strength, and thus improving the accuracy of the tablet computer 10 in determining whether the stylus 20 is adsorbed to the tablet computer 10.

[0193] It is understood that in some embodiments, when the magnetic field strength of the magnet M1 or the magnet M2 acting on the magnetometer MS-1 changes due to a change in magnetization strength of the magnet M1 or the magnet M2, the tablet computer 10 may not accurately detect whether the stylus 20 has been adsorbed to the tablet computer 10. Figures 7 to 10FThe illustrated embodiment is used to adjust the initial magnetic field strength MSI0 corresponding to the magnetometer MS- 1 , thereby improving the accuracy of the tablet computer 10 in determining whether the stylus 20 is attached to the tablet computer 10 .

[0194] Combination Figures 1 to 10F The embodiment shown, the embodiment of the present application also provides a method for detecting the magnetic field strength threshold of a magnetometer.

[0195] Specifically, Fig.11 According to some embodiments of the present application, a flow chart of a method for detecting a magnetic field strength threshold of a magnetometer is shown. The execution subject of the flow is a main device, such as Fig.11 As shown, the process includes the following steps:

[0196] S1101: Acquire magnetic field strength data of a magnetic sensor under a first test environment.

[0197] The host device obtains magnetic field strength data of a magnetic sensor (eg, a magnetometer) under a first test environment.

[0198] It can be understood that the first test environment can be an environment where there are no other magnets around the main device, or an environment where the magnetic field strength of other magnets acting on the magnetic sensor is negligible (for example, an environment where the magnetic field strength of other magnets acting on the magnetic sensor is less than a preset negligible value).

[0199] It can be understood that in some embodiments, the first test environment may also be the aforementioned magnetic field strength test environment.

[0200] S1102: Determine whether the acquired magnetic field strength data meets a preset condition.

[0201] The main device determines whether the acquired magnetic field strength data meets the preset conditions. If the acquired magnetic field strength data meets the preset conditions, it means that the acquired magnetic field strength data can be used as the initial magnetic field strength corresponding to the magnetic sensor, and go to step S1103; otherwise, it means that the acquired magnetic field strength data cannot be used as the initial magnetic field strength corresponding to the magnetic sensor, and the process ends.

[0202] It can be understood that, in some embodiments, the preset conditions may include a first condition, that is, the magnetic field intensity data of each axis in the acquired magnetic field intensity data is within a corresponding preset threshold range.

[0203] It can be understood that the specific manner in which the tablet computer 10 determines whether the acquired magnetic field strength data meets the first condition can refer to the aforementioned step S503, which will not be described in detail here.

[0204] It can be understood that in some embodiments, the preset condition can further include a second condition based on the first condition, that is, the difference between the magnetic field strength data obtained in the first test environment and the magnetic field strength data obtained in the second test environment is within a preset difference range, wherein the magnetic field strength data obtained in the second test environment satisfies the above-mentioned first condition.

[0205] It can be understood that the specific manner in which the tablet computer 10 determines whether the acquired magnetic field strength data satisfies the second condition can refer to the aforementioned step S903 and step S907, which will not be described in detail here.

[0206] S1103: taking the sum of the acquired magnetic field strength and the preset magnetic field strength as the magnetic field strength threshold corresponding to the magnetic sensor.

[0207] When the master device determines that the acquired magnetic field strength data meets the preset condition, the master device uses the sum of the acquired magnetic field strength and the preset magnetic field strength as the magnetic field strength threshold corresponding to the magnetic sensor.

[0208] It is understood that the preset magnetic field strength may be a preset value or an empirical value. In some embodiments, the preset magnetic field strength may be determined by the magnetic field strength of the accessory device acting on the magnetic sensor after the accessory device is attached to the main device, so as to increase the magnetic field strength threshold MSI. T The rationality of the main device can further improve the accuracy of the main device in judging whether the accessory device has been attached to the main device. For example, if the accessory device is attached to the main device, the magnetic field strength of the accessory device acting on the magnetic sensor is MSI. S , then the above preset magnetic field intensity MSI p It can be k×MSI S <MSI p ≤MSI S (k<1) any value.

[0209] After the main device determines the magnetic field strength threshold of the magnetic sensor, the main device can determine that an accessory device is attached to the main device when the magnetic field strength detected by the magnetic sensor is greater than or equal to the magnetic field strength threshold.

[0210] Through the method provided in the embodiment of the present application, since the magnetic field strength threshold corresponding to the magnetic sensor increases with the increase of the initial magnetic field strength corresponding to the magnetic sensor and decreases with the decrease of the initial magnetic field strength corresponding to the magnetic sensor, the accuracy of the main device in judging whether the accessory device has been adsorbed to the main device can be improved, which is beneficial to improving the user experience.

[0211] Combination Figures 1 to 11 In the embodiment shown, the present application also provides an adsorption detection method.

[0212] Specifically, Fig.12According to some embodiments of the present application, a schematic diagram of a process of adsorption detection method is shown. The execution subject of the process is a main device, such as Fig.12 As shown, the process includes the following steps:

[0213] S1201: Obtain the current magnetic field strength of the magnetic sensor.

[0214] The host device obtains the current magnetic field strength of a magnetic sensor (eg, a magnetometer).

[0215] S1202: Determine whether the current magnetic field strength is greater than or equal to the magnetic field strength threshold corresponding to the magnetic sensor.

[0216] The main device determines whether the current magnetic field strength is greater than or equal to the magnetic field strength threshold corresponding to the magnetic sensor. If the main device determines that the current magnetic field strength is greater than or equal to the magnetic field strength threshold corresponding to the magnetic sensor, it means that an accessory device has been attached to the main device, and the process goes to step S1203; otherwise, it means that no accessory device has been attached to the main device, and the process goes to step S1204.

[0217] It can be understood that the magnetic field intensity threshold corresponding to the magnetic sensor can be obtained by the aforementioned Figures 1 to 11 The illustrated implementation provides a detection method for determining a magnetic field strength threshold.

[0218] In some embodiments, assuming that the magnetic field strength threshold and the current magnetic field strength each include a quantity, the main device can determine that the current magnetic field strength is greater than or equal to the magnetic field strength threshold corresponding to the magnetic sensor when the absolute value of the current magnetic field strength is greater than or equal to the absolute value of the magnetic field strength threshold corresponding to the magnetic sensor.

[0219] In some embodiments, assuming that the magnetic field strength threshold and the current magnetic field strength respectively include the same number of components, the main device can determine that the current magnetic field strength is greater than or equal to the magnetic field strength threshold corresponding to the magnetic sensor when each component of the current magnetic field strength is greater than or equal to the corresponding component in the magnetic field strength threshold corresponding to the magnetic sensor.

[0220] In some embodiments, assuming that the magnetic field strength threshold is a quantity and the current magnetic field strength includes multiple components, the main device can determine that the current magnetic field strength is greater than or equal to the magnetic field strength threshold corresponding to the magnetic sensor when the combined amount of the components of the current magnetic field strength is greater than or equal to the magnetic field strength threshold corresponding to the magnetic sensor.

[0221] It is understandable that in other embodiments, the master device may also determine whether the current magnetic field strength is greater than or equal to the magnetic field strength threshold corresponding to the magnetic sensor in other ways, which is not limited here.

[0222] S1203: Determine that the accessory device has been adsorbed to the main device.

[0223] When the current magnetic field strength is greater than or equal to the magnetic field strength threshold corresponding to the magnetic sensor, the main device determines that the accessory device is not attached to the main device, so that the main device can communicate with the accessory device or charge the accessory device.

[0224] S1204: Determine whether the accessory device is not attached to the main device.

[0225] When the current magnetic field strength is less than the magnetic field strength threshold corresponding to the magnetic sensor, the main device determines that the accessory device is not attached to the main device.

[0226] Through the method provided in the embodiment of the present application, since the magnetic field strength threshold corresponding to the magnetic sensor increases with the increase of the initial magnetic field strength corresponding to the magnetic sensor and decreases with the decrease of the initial magnetic field strength corresponding to the magnetic sensor, the accuracy of the main device in judging whether the accessory device has been adsorbed to the main device can be improved, which is beneficial to improving the user experience.

[0227] further, Fig.13 According to some embodiments of the present application, a hardware structure diagram of a tablet computer 10 is shown.

[0228] like Fig.13 As shown, the tablet computer 10 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a magnet 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.

[0229] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0230] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0231] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0232] In some embodiments, the processor 110 can be used to execute instructions corresponding to the detection methods provided in the embodiments of the present application, such as instructions for detecting the initial magnetic field strength of the magnetometer MS-1, instructions for generating a magnetic field strength threshold of the magnetometer MS-1, and instructions for determining whether the stylus 20 has been adsorbed to the tablet computer 10 based on the magnetic field strength detected by the magnetometer MS-1 and the magnetic field strength threshold of the magnetometer MS-1.

[0233] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the tablet computer 10, and can also be used to transfer data between the tablet computer 10 and peripheral devices. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.

[0234] The charging management module 140 is used to receive charging input from the charger. While charging the battery 142, the charging management module 140 can also power the electronic device through the power management module 141. In some embodiments, the charging management module 140 can also include the aforementioned coil L1 for charging other electronic devices attached to the tablet computer 10.

[0235] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160.

[0236] The wireless communication function of the tablet computer 10 can be implemented through the antenna 1, the wireless communication module 160, the modem processor and the baseband processor.

[0237] The antenna 1 is used to transmit and receive electromagnetic wave signals.

[0238] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the tablet computer 10. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 can receive electromagnetic waves from the antenna 1, and filter, amplify and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The wireless communication module 160 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1.

[0239] The tablet computer 10 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0240] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a mini-LED, a micro-LED, a micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the tablet computer 10 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0241] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the tablet computer 10 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0242] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the tablet computer 10. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0243] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions, such as the aforementioned memory 103. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, at least one application required for a function, etc. The data storage area may store data created during the use of the tablet computer 10, for example, it may be used to store the initial magnetic field strength, magnetic field strength threshold, etc. corresponding to the magnetometer MS-1. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications of the tablet computer 10 by running instructions stored in the internal memory 121 and / or instructions stored in a memory provided in the processor 110.

[0244] The tablet computer 10 can implement audio functions such as music playing and recording through the audio module 170 , the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0245] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals.

[0246] The speaker 170A, also called a "horn", is used to convert audio electrical signals into sound signals.

[0247] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals.

[0248] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals.

[0249] The earphone jack 170D is used to connect a wired earphone.

[0250] The pressure sensor 180A is used to sense pressure signals and can convert pressure signals into electrical signals. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The tablet computer 10 determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 194, the tablet computer 10 detects the intensity of the touch operation based on the pressure sensor 180A. The tablet computer 10 can also calculate the position of the touch based on the detection signal of the pressure sensor 180A.

[0251] The magnetic sensor 180D can be used to detect magnetic signals. In some embodiments, the magnetic sensor 180D can be a magnetic sensor for detecting magnetic field strength, such as the aforementioned magnetometer MS-1, for detecting the magnetic field strength of the magnet 195 (such as the aforementioned magnet M1 and magnet M2) or other magnets (such as the magnet M3 and magnet M4 in the stylus 20) acting on the magnetometer MS-1.

[0252] The acceleration sensor 180E can detect the magnitude of acceleration of the tablet computer 10 in all directions (generally three axes). When the tablet computer 10 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device, to determine whether the tablet computer 10 is in a horizontal screen state, and for applications such as a pedometer.

[0253] The ambient light sensor 180L is used to sense the ambient light brightness. The tablet computer 10 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the tablet computer 10 is in a pocket to prevent accidental touches.

[0254] The fingerprint sensor 180H is used to collect fingerprints. The tablet computer 10 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.

[0255] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the tablet computer 10, which is different from the position of the display screen 194.

[0256] The bone conduction sensor 180M can obtain a vibration signal. In some embodiments, the bone conduction sensor 180M can obtain a vibration signal of a vibrating bone block of a human vocal part.

[0257] The button 190 includes a power button, a volume button (such as the aforementioned volume up button 11 and volume down button 12), etc. The button 190 may be a mechanical button. It may also be a touch button. The tablet computer 10 may receive a button input and generate a key signal input related to the user settings and function control of the tablet computer 10. In some embodiments, the processor 110 may trigger the detection and calibration of the magnetometer MS-1 on the corresponding interface when detecting the user's operation of the volume up button 11 and the volume down button 12.

[0258] Motor 191 can generate vibration prompts.

[0259] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

[0260] The magnet 195 may include 1-N magnets, such as the aforementioned magnet M1 and magnet M2, for adsorbing accessory devices.

[0261] Understandably, Fig.13 The structure of the tablet computer 10 shown is only an example. In other embodiments, the tablet computer 10 may adopt other structures, may include more or fewer modules, and may also split or combine some modules, which is not limited here.

[0262] The various embodiments of the mechanism disclosed in the present application can be implemented in hardware, software, firmware or a combination of these implementation methods. The embodiments of the present application can be implemented as a computer program or program code executed on a programmable system, which includes at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device and at least one output device.

[0263] Program code can be applied to input instructions to perform the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, a processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.

[0264] Program code can be implemented with high-level programming language or object-oriented programming language to communicate with the processing system. When necessary, program code can also be implemented with assembly language or machine language. In fact, the mechanism described in this application is not limited to the scope of any specific programming language. In either case, the language can be a compiled language or an interpreted language.

[0265] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, instructions may be distributed over a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine (e.g., computer) readable form, including, but not limited to, floppy disks, optical disks, optical disks, read-only memories (CD-ROMs), magneto-optical disks, read-only memories (ROMs), random access memories (RAMs), erasable programmable read-only memories (EPROMs), electrically erasable programmable read-only memories (EEPROMs), magnetic or optical cards, flash memory, or a tangible machine-readable memory for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in electrical, optical, acoustic, or other forms of propagation signals. Therefore, machine-readable media include any type of machine-readable media suitable for storing or transmitting electronic instructions or information in a machine (e.g., computer) readable form.

[0266] In the accompanying drawings, some structural or method features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be required. Instead, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. In addition, the inclusion of structural or method features in a particular figure does not mean that such features are required in all embodiments, and in some embodiments, these features may not be included or may be combined with other features.

[0267] It should be noted that the units / modules mentioned in the various device embodiments of the present application are all logical units / modules. Physically, a logical unit / module can be a physical unit / module, or a part of a physical unit / module, or can be implemented as a combination of multiple physical units / modules. The physical implementation method of these logical units / modules themselves is not the most important. The combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed by the present application. In addition, in order to highlight the innovative part of the present application, the above-mentioned device embodiments of the present application do not introduce units / modules that are not closely related to solving the technical problems proposed by the present application, which does not mean that there are no other units / modules in the above-mentioned device embodiments.

[0268] It should be noted that in the examples and description of this patent, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "includes" 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 includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "includes one" do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0269] Although the present application has been illustrated and described with reference to certain preferred embodiments thereof, it will be apparent to those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present application.

Claims

1. A detection method, applied to a first electronic device, characterized in that: The first electronic device includes a magnetic sensor and at least one magnet; and the method includes: When there is no magnetic field generated by a magnet outside the first electronic device, obtaining first magnetic field strength data of at least one magnet inside the first electronic device acting on the magnetic sensor; the magnitude of the first magnetic field strength data is related to the installation position tolerance of the at least one magnet and the magnetic sensor and the change in magnetization strength of the at least one magnet; Alternatively, the magnitude of the first magnetic field strength data is related to the installation position tolerance of the at least one magnet and the magnetic sensor, the magnetization strength difference of the at least one magnet, and the magnetization strength change of the at least one magnet; Alternatively, the magnitude of the first magnetic field strength data is related to the installation position tolerance of the at least one magnet and the magnetic sensor, and the magnetic field strength tolerance of the at least one magnet; When a second electronic device including a magnet approaches the first electronic device, the second magnetic field strength data detected by the magnetic sensor is greater than a magnetic field strength threshold value, and the magnetic field strength threshold value changes based on a change in the first magnetic field strength data; It is determined that the second electronic device is attached to the first electronic device.

2. The method according to claim 1, characterized in that The magnetic field strength threshold is the sum of the first magnetic field strength data and the third magnetic field strength data, wherein the third magnetic field strength data is determined based on the magnetic field strength data of the magnet in the second electronic device acting on the magnetic sensor when the second electronic device is adsorbed on the first electronic device.

3. The method according to claim 2, characterized in that When the second electronic device is attached to the first electronic device, the magnetic field strength data of the magnet in the second electronic device acting on the magnetic sensor is M, and the third magnetic field strength data is k×M, where 0 <k<1。 4. The method according to any one of claims 1 to 3, characterized in that The first magnetic field strength data includes magnetic field strength data of at least one axis; and the magnetic field strength data of each axis of the first magnetic field strength data is within a corresponding preset threshold range.

5. The method according to claim 4, characterized in that The difference between the magnetic field strength data of each axis in the first magnetic field strength data and the magnetic field strength data of the corresponding axis in the fourth magnetic field strength data is less than the preset difference of the corresponding axis, wherein the fourth magnetic field strength data is the magnetic field strength data of the at least one magnet acting on the magnetic sensor when there is no magnetic field generated by a magnet outside the first electronic device, the magnetic field strength data of each axis in the fourth magnetic field strength data is within the corresponding preset threshold range, and the environment in which the first electronic device is located when the fourth magnetic field strength data is obtained is different from that when the first magnetic field strength data is obtained.

6. The method according to claim 4, characterized in that The first magnetic field strength data and the second magnetic field strength data both include first-axis magnetic field strength data, second-axis magnetic field strength data, and third-axis magnetic field strength data, wherein the preset difference corresponding to the first-axis magnetic field strength data is 200 microteslas, the preset difference corresponding to the second-axis magnetic field strength data is 5000 microteslas, and the preset difference corresponding to the third-axis magnetic field strength data is 5000 microteslas.

7. The method according to claim 6, characterized in that The position of the first electronic device when acquiring the fourth magnetic field strength data is different from that when acquiring the first magnetic field strength data.

8. The method according to claim 1, characterized in that The first magnetic field strength data is magnetic field strength data detected by the magnetic sensor when there is no magnetic field generated by a magnet outside the first electronic device.

9. An electronic device, characterized in that: include: A memory, wherein instructions are stored in the memory; at least one magnet; at least one magnetic sensor; At least one processor is used to execute the instructions to enable the electronic device to implement the detection method according to any one of claims 1 to 8 based on the magnetic field strength data detected by the at least one magnetic sensor and the magnetic field strength data of the at least one magnet acting on each of the magnetic sensors.

10. A computer program product, characterized in that When the program product is run on an electronic device, the electronic device is enabled to implement the detection method according to any one of claims 1 to 8.

11. A readable storage medium, characterized in that: The readable storage medium stores instructions, and when the instructions are executed by an electronic device, the electronic device implements the detection method according to any one of claims 1 to 8.