Control button adjustment method, electronic device and storage medium

By obtaining and verifying the induction parameters of the control buttons, the gear misjudgment problem caused by magnetic sensor interference is solved, the stability and accuracy of the control buttons in electronic devices are improved, and the user experience is improved.

CN114785334BActive Publication Date: 2024-12-17GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210383828.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-12
Publication Date
2024-12-17
Estimated Expiration
2042-04-12

AI Technical Summary

Technical Problem

Magnetic sensors in electronic devices are susceptible to interference, resulting in offsetting induction parameters and reducing the working stability and accuracy of the control buttons.

Method used

By obtaining the sensing parameters of the control button in the current gear, and when the magnetic sensor is in the interference environment, the preset strategy is used to determine the effectiveness of the sensing parameters. If it is effective, adjust the button to the corresponding gear to avoid disorderly switching and one-size-fits-all stop.

Benefits of technology

It improves the stability and accuracy of the control buttons, improves the user experience, and ensures that the buttons can still switch functions stably and accurately in interfering environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114785334B_ABST
    Figure CN114785334B_ABST
Patent Text Reader

Abstract

The present application discloses a control button adjustment method, an electronic device, and a storage medium, wherein the control button adjustment method is applied to an electronic device, the electronic device includes a control button and a magnetic sensor, and the method includes: obtaining a first sensing parameter corresponding to the current gear position of the control button; when the magnetic sensor is in an interference environment, using a first preset strategy to determine the validity of the first sensing parameter; if the first sensing parameter is valid, adjusting the control button to the gear position corresponding to the first sensing parameter. In the above manner, the present application can improve the stability of the working state of the control button.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of electronic equipment, and in particular to a control button adjustment method, an electronic device and a storage medium. Background Art

[0002] With the increasing popularity of electronic devices, electronic devices have become an indispensable social and entertainment tool in people's daily lives. Mobile phones, tablet computers and other electronic devices often switch different functions of the electronic devices by setting a touch screen. For example, when a mobile phone switches the scene switching method, it mainly sets the status bar through software, and the user touches the corresponding scene mode button in the status bar to switch the scene mode.

[0003] In order to facilitate users to control electronic devices, some manufacturers set mechanical control buttons on the surface of electronic devices. Users can directly touch the control buttons without lighting up the display screen. Users can drive the control buttons to move between different gears to switch different functions of the electronic device. Generally, electronic devices use magnetic sensors to sense the changes in the magnetic field caused by the movement of the control buttons to determine the gear position of the control buttons. However, the magnetic sensors are easily interfered, which causes the sensing parameters output by the magnetic sensors to shift, resulting in misjudgment of the gear position and reducing the stability of the working state of the control buttons. Summary of the invention

[0004] A first aspect of the present application provides a control button adjustment method, which is applied to an electronic device, wherein the electronic device includes a control button and a magnetic sensor, and the method includes: obtaining a first sensing parameter corresponding to the control button being in a current gear position; when the magnetic sensor is in an interference environment, determining the validity of the first sensing parameter using a first preset strategy; if the first sensing parameter is valid, adjusting the control button to the gear position corresponding to the first sensing parameter.

[0005] A second aspect of the present application provides an electronic device, which includes a control button, a magnetic sensor, a memory and a processor coupled to each other, the memory is used to store program data, and the processor is used to execute the program data to implement the aforementioned method.

[0006] A third aspect of the present application provides a computer-readable storage medium, in which program data is stored. When the program data is executed by a processor, it is used to implement the aforementioned method.

[0007] The beneficial effect of the present application is as follows: Different from the prior art, the present application obtains the first sensing parameter corresponding to the current gear position of the control button, and then when the magnetic sensor is in an interference environment, the validity of the first sensing parameter is determined by using the first preset strategy, and finally if the first sensing parameter is valid, the control button is adjusted to the gear position corresponding to the first sensing parameter. Among them, due to the sensitivity of the magnetic sensor to the magnetic field, the validity of the first sensing parameter is determined by the first preset strategy, and the control button is adjusted to the gear position only when the first sensing parameter is valid. This can effectively solve the problem that when the magnetic sensor is in an interference environment, the first sensing parameter deviates and causes the control button to switch gears in an disorderly manner, thereby improving the stability of the control button and improving the user experience. In addition, it can also avoid the one-size-fits-all approach when the magnetic sensor is in an interference environment, that is, directly stopping the adjustment of the control button. The present application further determines the validity of the first sensing parameter, and if the first sensing parameter is valid, the control button is adjusted to the gear position corresponding to the first sensing parameter, thereby ensuring that the control button is in a stable working state while improving the accuracy of the working state of the control button. BRIEF DESCRIPTION OF THE DRAWINGS

[0008] In order to more clearly illustrate the technical solutions in this application, the following briefly introduces the drawings required in the description of the embodiments. Obviously, the drawings described below are only some embodiments of this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:

[0009] Figure 1 This is a schematic diagram of the structure of the first embodiment of the control button of the present application;

[0010] Figure 2 This is a schematic diagram of the structure of the second embodiment of the control button of the present application;

[0011] Figure 3 This is a schematic diagram of the structure of the third embodiment of the control button of the present application;

[0012] Figure 4 This is a flow chart of an embodiment of a control button adjustment method of the present application;

[0013] Figure 5 It is a flowchart of another embodiment of the control button adjustment method of the present application;

[0014] Figure 6 It is a flowchart of another embodiment of the control button adjustment method of the present application;

[0015] Figure 7 yes Figure 5 A schematic diagram of a flow chart of an implementation method of step S22;

[0016] Figure 8 yes Figure 5 A schematic diagram of another embodiment of step S23;

[0017] Fig. 9 yes Figure 7 A flow chart of another embodiment of step S234;

[0018] Fig.10 It is a flowchart of another embodiment of the control button adjustment method of the present application;

[0019] Fig.11 It is a structural schematic diagram of an embodiment of the electronic device of the present application;

[0020] Fig.12 is a structural schematic diagram of another embodiment of the electronic device of the present application;

[0021] Fig.13 It is a structural diagram of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION

[0022] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase at various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0023] The terms "first" and "second" in this application are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first" and "second" can explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices.

[0024] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0025] See also Figure 1 , Figure 1 It is a structural diagram of the first embodiment of the control button of the present application.

[0026] In this embodiment, the control button 10 is a sliding button, that is, the control button 10 moves between the first gear position D1, the second gear position D2 and the third gear position D3 by sliding. The first gear position D1, the second gear position D2 and the third gear position D3 are arranged in sequence. The sliding track of the control button 10 between the first gear position D1 and the third gear position D3 is a straight line. In other embodiments, the sliding track of the control button 10 between the first gear position D1 and the third gear position D3 can also be an arc, a curve, etc.

[0027] like Figure 1 As shown, in some embodiments, the electronic device (not labeled) includes a control button 10, a magnetic sensor 20 and a device body 30. The magnetic sensor 20 includes a first magnetic sensor 21 and a second magnetic sensor 22 arranged at intervals. The control button 10 includes at least one magnet 11.

[0028] The magnetic sensor 20 is a device that converts the change of magnetic properties of the sensitive element caused by external factors such as magnetic field, current, stress strain, temperature, light, etc. into an electrical signal, and detects the corresponding physical quantity in this way. The control button 10 can move between the first gear position D1 and the third gear position D3, and causes the magnetic field around the magnetic sensor 20 to change. In some embodiments, the magnetic sensor 20 can be a magnetic field sensor, such as a Hall sensor. The device body 30 can include devices such as a memory, a processor, an image sensor, and a battery.

[0029] The device body 30 includes at least one side. The magnetic sensor 20 is disposed inside the device body 30 and close to one side, and the control button 10 is disposed outside the device body 30 and close to one side, so that the magnetic sensor 20 can sense the magnetic field change caused by the position change of the magnet 11 in the control button 10, and the user can contact the control button 10 to move the control button 10. When the control button 10 is in the first gear position D1, at least one magnet 11 is close to the first magnetic sensor 21, and when the control button 10 is in the third gear position D3, at least one magnet 11 is close to the second magnetic sensor 22. When the control button 10 is in the first gear position D1, the second gear position D2 and the third gear position D3, the distance between the at least one magnet 11 and the magnetic sensor 20 gradually increases, and the distance between the at least one magnet 11 and the second magnetic sensor 22 gradually decreases.

[0030] The electronic device can determine the current gear position of the control button 10 according to the sensing parameters output by the magnetic sensor 20, and then determine the corresponding function or mode based on the gear position of the control button 10. However, the magnetic sensor is relatively sensitive and easily interfered by the external magnetic field. When the magnetic sensor is interfered by the external magnetic field, the sensing parameters output by the magnetic sensor 20 will deviate, resulting in invalid sensing parameters.

[0031] like Figure 1 As shown, in a specific embodiment, the device body 30 includes four sides, namely a first side 31, a second side 32, a third side 33 and a fourth side 34, wherein the first side 31 and the second side 32 are parallel and equal in length, and the third side 33 and the fourth side 34 are parallel and equal in length. The magnetic sensor 20 is arranged inside the device body 30 near the first side 31, and the control button 10 is arranged outside the device body 30 and near the first side 31. The control button 10 can slide in the length direction of the first side 31. As an example, the length of the first side 31 can be greater than the length of the third side 33.

[0032] In some embodiments, the first side 31 of the device body 30 is provided with a groove (not shown), and the control button 10 is embedded in the groove and can slide along the groove, or the first side 31 of the device body 30 can also be provided with a slide rail (not shown), and the control button 10 is connected to the slide rail and can slide along the slide rail. In this embodiment, the sliding connection method of the control button 10 and the device body 30 is not limited, and in addition to the two methods described above, other possible structures can be selected according to actual needs.

[0033] In an application scenario, the user's finger presses the control button 10, and under the action of friction, the finger drives the control button 10 to slide in the length direction of the first side 31 to switch the control button 10 between different gears. During the sliding of the control button 10, the magnetic sensor 20 can sense the change in the magnetic field and output the corresponding sensing parameter. The electronic device can determine the gear position of the control button 10 based on the threshold range corresponding to the gear position of the sensing parameter. Generally, the closer the control button is to the magnetic sensor, the greater the sensing value output by the magnetic sensor.

[0034] In some implementations, the control button 10 may also be provided with a plurality of gears arranged in sequence, such as 4, 5, etc., which are not limited here.

[0035] In the present application, different gears correspond to selections of different functions or modes. Taking the scenario mode as an example, the scenario mode may include silent, vibrating and ringing, wherein the first gear D1 corresponds to silent, the second gear D2 corresponds to vibration, and the third gear D3 corresponds to ringing, wherein each gear has a corresponding threshold range, so by comparing the sensing parameter with the threshold range, the gear position that the control button 10 is currently in can be determined. For example, the threshold range corresponding to the first gear D1 is [a1, a2], and the threshold range corresponding to the second gear D2 is [a3, a4], wherein a1>a2>a3>a4. The sensing parameter corresponding to the control button 10 is recorded as G. If N∈[a1, a2], it is determined that the control button 10 is adjusted to the first gear D1. If N∈[a3, a4], it is determined that the control button 10 is adjusted to the second gear D2.

[0036] Among them, by arranging multiple magnets 11 in the control button 10, the magnetic field change caused by the control button 10 when it is close to or away from the magnetic sensor 20 can be greater, so that the sensing parameter changes more obviously, thereby different gears can be distinguished more clearly based on the sensing parameters.

[0037] like Figure 1 As shown, the second gear position D2 is located between the first magnetic sensor 21 and the second magnetic sensor 22, the first gear position D1 corresponds to the first magnetic sensor 21, and the second gear position D2 corresponds to the second magnetic sensor 22. When the control button 10 is in the second gear position D2, at least one magnet 11 in the control button 10 is located on the center line W1 of the first magnetic sensor 21 and the second magnetic sensor 22.

[0038] See also Figures 2 to 3 , Figure 2 is a schematic diagram of the structure of the second embodiment of the control button of the present application, Figure 3 It is a structural diagram of the third embodiment of the control button of the present application.

[0039] Different from the above embodiment, in this embodiment, the control button 10 is a roller button, that is, the control button 10 moves between the first gear position D1, the second gear position D2 and the third gear position D3 by rolling. The rolling track of the control button 10 between the first gear position D1, the second gear position D2 and the third gear position D3 is an arc.

[0040] like Figure 2As shown, P is a positioning point, indicating the current gear position of the control button 10. As the control button 10 rolls, the positioning point P can move to the corresponding position of different gears. The positioning point P is located in the second gear position D2, that is, the control button 10 is in the second gear position D2. In this embodiment, when the control button 10 is in the second gear position D2, at least one magnet 11 is located on the center line between the first magnetic sensor 21 and the second magnetic sensor 22. At this time, the difference in the induction value of the first magnetic sensor 21 and the second magnetic sensor 22 is 0, and fluctuates left and right. When the control button 10 rotates clockwise and switches to the third gear position D3, at least one magnet 11 is close to the second sensor. When the control button 10 rotates counterclockwise and switches to the first gear position D1, the magnet 11 is close to the first sensor.

[0041] When the control button 10 is in the first gear position D1 , at least one magnet 11 is close to the first magnetic sensor 21 . When the control button 10 is in the second gear position D2 , at least one magnet 11 is close to the second magnetic sensor 22 .

[0042] It should be noted that the distribution of gears can be set according to actual needs and is not limited here. For example, the control button 10 can rotate 360° clockwise and counterclockwise, that is, the rotation range is 0 to 360°, so at least part of the rotation range can be used for the division of gears. Figure 5 As shown, 0 to 180° in 0 to 360° can be divided into three gears according to 60°, wherein 0 to 60° corresponds to the first gear D1, 60 to 120° corresponds to the second gear D2, and 120 to 180° corresponds to the third gear D3. Correspondingly, the magnet 11 can be set at the 180 to 360° position of the control button 10. For example, the magnet 11 can be set between 180 and 270°. When the control button 10 is in the first gear D1, the magnetic sensor 20 is correspondingly located on the extension line from the center of the circle to the magnet 11, and at this time, the distance between the magnet 11 and the magnetic sensor 20 is the shortest.

[0043] However, when the control button 10 is in the second gear, at least one magnet 11 of the control button 10 can be set on the 270° dividing line, and the first magnetic sensor 21 and the second magnetic sensor 22 are distributed on both sides of the at least one magnet 11 and are equidistant from the at least one magnet 11.

[0044] like Figure 3 As shown, further, when the number of gears increases, the control button 10 may include a plurality of magnets 11 distributed at intervals to increase the distribution range of the sensing value, thereby increasing the distribution range of the sensing parameter. Compared with the sensing value range corresponding to one magnet 11 being [20, 40], the sensing value range corresponding to multiple magnets 11 may be [10, 50], so that the sensing parameter interval allocated to each gear is larger, and the gear can be determined more accurately.

[0045] Combination Figure 2 and Figure 3 As shown, 180° of 360° can be divided into 5 gears according to 36°, namely, the first gear D1, the second gear D2, the third gear D3, the fourth gear D4 and the fifth gear D5 arranged in sequence. At least one magnet 11 includes a first magnet 111 and a second magnet 112, the first magnet 111 is set on the 0° / 360° dividing line, and the second magnet 112 is set on the 180° dividing line. In other embodiments, the first magnet 111 can be set in the range of 180° to 270°, the second magnet 112 can be set in the range of 270° to 0° / 360°, the first magnet 111 and the first magnetic sensor 21 are correspondingly arranged, and the second magnet 112 and the second magnetic sensor 22 are correspondingly arranged. The first magnet 111 and the second magnet 112, and the first magnetic sensor 21 and the second magnetic sensor 22 are symmetrically arranged about the 90° / 270° dividing line.

[0046] See also Figure 4 , Figure 4 1 is a flow chart of an embodiment of the control button adjustment method of the present application. The method is applied to an electronic device, and the electronic device includes a control button. The control button can be any of the control buttons in the above embodiments. In this embodiment, Figure 1 The three-stage control button shown is used as an example for explanation.

[0047] The method may include the following steps:

[0048] Step S11: obtaining a first sensing parameter corresponding to the current gear position of the control button.

[0049] The sensing parameter is the sum and / or difference of the first sensing value and the second sensing value. The sensing parameter may include the first sensing parameter, the second sensing parameter and the third sensing parameter. The first sensing parameter, the second sensing parameter and the third sensing parameter are only used to distinguish the sensing parameters obtained at different times. Figures 1 to 3 As shown, the first induction value is acquired by the first magnetic sensor 21 , and the second induction value is acquired by the second magnetic sensor 22 .

[0050] In one example, the first sensing value is recorded as a1, the second sensing value is recorded as a2, and the sensing parameter is recorded as N, N=a1+a2, or N=a1-a2.

[0051] Step S12: when the magnetic sensor is in an interference environment, the validity of the first sensing parameter is determined using a first preset strategy.

[0052] The first preset strategy includes, for example, determining whether the last gear position of the control button is the first gear position or the second gear position, and then taking corresponding measures to determine the validity of the first sensing parameter according to the determination result. For details, please refer to the subsequent embodiments.

[0053] Step S13: If the first sensing parameter is valid, the control button is adjusted to a gear position corresponding to the first sensing parameter.

[0054] If the first sensing parameter is valid, it means that although the magnetic sensor is currently in an interference environment, it is not affected by the interference, so the corresponding gear can be determined based on the first sensing parameter, and then the button can be adjusted to the gear corresponding to the first sensing parameter. In this way, magnetic field fluctuations caused by interference can be avoided, thereby avoiding mis-switching of gears, thereby improving user experience.

[0055] The above scheme obtains the first sensing parameter corresponding to the current gear position of the control button, and then when the magnetic sensor is in an interference environment, the validity of the first sensing parameter is determined by the first preset strategy, and finally if the first sensing parameter is valid, the control button is adjusted to the gear position corresponding to the first sensing parameter. Among them, due to the sensitivity of the magnetic sensor to the magnetic field, the validity of the first sensing parameter is determined by the first preset strategy, and the control button is adjusted to the gear position only when the first sensing parameter is valid. This can effectively solve the problem that when the magnetic sensor is in an interference environment, the first sensing parameter deviates and causes the control button to switch gears in an disorderly manner, thereby improving the stability of the control button and improving the user experience. In addition, it can also avoid the one-size-fits-all approach when the magnetic sensor is in an interference environment, that is, directly stopping the adjustment of the control button. The present application further determines the validity of the first sensing parameter, and if the first sensing parameter is valid, the control button is adjusted to the gear position corresponding to the first sensing parameter, thereby ensuring that the control button is in a stable working state while improving the accuracy of the working state of the control button.

[0056] See also Figures 5 and 6 , Figure 5 is a flow chart of another embodiment of the control button adjustment method of the present application, Figure 6 is a flow chart of another embodiment of the control button adjustment method of the present application, Figure 7 yes Figure 5 Schematic diagram of the process of step S22 in an implementation manner.

[0057] Different from the above embodiment, in this embodiment, step S22 is further included before step S12.

[0058] Step S21: obtaining a first sensing parameter corresponding to the current gear position of the control button.

[0059] Step S22: determining whether the magnetic sensor is in an interference environment based on a difference between the first sensing parameter and the corresponding calibration parameter.

[0060] In some implementations, step S22 may include sub-steps S221 - S224 .

[0061] Step S221: determining a difference between a first sensing parameter and a corresponding calibration parameter; wherein the calibration parameter is measured in an interference-free environment when the control button is in the current gear position.

[0062] Specifically, the corresponding gear position can be determined according to the first sensing parameter, and then the corresponding calibration parameter can be searched based on the gear position corresponding to the first sensing parameter, so that the calibration parameter corresponding to the first sensing parameter can be obtained. Wherein, the corresponding gear position can be determined according to the first sensing parameter, and each gear position can correspond to a threshold range, so that by determining the threshold range to which the first sensing parameter belongs, the gear position corresponding to the first sensing parameter can be determined. The threshold range can be set as needed and is not limited here.

[0063] The calibration parameters may include a calibration sum value and / or a calibration difference value.

[0064] In one example, Figure 1 Taking the three-stage control button shown in the figure as an example, the control button includes three gears, and the sensing values ​​of the first magnetic sensor and the second magnetic sensor are used as the difference and the sum respectively. Therefore, each gear has a calibration difference and a calibration sum, a total of 6 groups of data, and the calibration parameters include the calibration sum and the calibration difference. In other examples, the calibration parameters may also include one of the calibration sum and the calibration difference.

[0065] Step S222: determining whether the difference between the first sensing parameter and the corresponding calibration parameter is greater than a preset threshold.

[0066] If so, execute step S223; otherwise, execute step S224.

[0067] Step S223: Determine whether the magnetic sensor is in an interference environment.

[0068] Step S224: Determine whether the magnetic sensor is in an interference-free environment.

[0069] In an application scenario, the first sensing parameter (denoted as N1), the current gear position of the control button is the first gear position, the first sensing parameter corresponding to the first gear position is denoted as N1, and the calibration parameter is denoted as J1. The difference between the first sensing parameter and the corresponding calibration parameter is |N1-J1|=M. If M is greater than a preset threshold value K (K is an empirical value), it is determined that the magnetic sensor is in an interference environment, otherwise, it is determined that the magnetic sensor is in a non-interference environment.

[0070] Among them, when calculating the difference between the first sensing parameter and the calibration parameter, if the first sensing parameter is the sum of the two magnetic sensors (recorded as the sensing sum), the calibration parameter involved in the calculation is the calibration sum; if the first sensing parameter is the difference between the two magnetic sensors (recorded as the sensing difference), the calibration parameter involved in the calculation is the calibration difference. In this embodiment, the difference between the sensing sum and the corresponding calibration sum, and the difference between the sensing difference and the corresponding calibration difference can be determined respectively, and compared with the preset thresholds respectively. If one of the differences is greater than the preset threshold, it can be determined that the magnetic sensor is in an interference environment.

[0071] Step S23: when the magnetic sensor is in an interference environment, the validity of the first sensing parameter is determined using a first preset strategy.

[0072] Step S24: If the first sensing parameter is valid, the control button is adjusted to a gear position corresponding to the first sensing parameter.

[0073] For the description of the above steps S21, S23-S24, please refer to the above embodiments, which will not be repeated here.

[0074] See also Figure 8 , Figure 8 yes Figure 5 FIG. 1 is a flow chart of another embodiment of step S23 in FIG.

[0075] Different from the above embodiment, this embodiment provides a method for determining the validity of the first induction, which is specifically as follows: In this embodiment, step S23 may include sub-steps S231 to S224.

[0076] Step S231: Determine whether the last gear position of the control button is the first gear position or the second gear position, wherein there is at least one gear position between the first gear position and the second gear position.

[0077] If so, execute step S232.

[0078] If not, execute step S235.

[0079] Specifically, the electronic device can record the historical gear positions of the control button. For example, the electronic device can store the historical gear positions of the control button locally to facilitate subsequent inspection. As a result, the electronic device can directly obtain the last gear position of the control button, and then determine whether the last gear position of the control button is the first gear position or the second gear position. If so, it means that the control button may have continuously crossed multiple gear positions, causing the first sensing parameter to be greater than the preset threshold value K, which may lead to misjudgment as interference, and then choose to obtain the second sensing parameter corresponding to the current gear position of the control button again (denoted as N2), and make another judgment.

[0080] In one example, Figure 1Taking the three-stage control button shown in the figure as an example, the first gear position and the second gear position can be the first and last gear positions of the control button respectively, that is, the first gear position D1 and the third gear position D3, and there is a gear position between D1 and D3.

[0081] Step S232: obtaining again the second sensing parameter corresponding to the control button being in the current gear position.

[0082] Step S233: based on the difference between the second sensing parameter and the corresponding calibration parameter, determining whether the magnetic sensor is in an interference environment.

[0083] If the current gear position of the control button is still the first gear position, the difference between the second sensing parameter and the corresponding calibration parameter is the difference between N2 and J1.

[0084] Step S234: If the magnetic sensor is in a non-interference environment, determine that the first sensing parameter is valid.

[0085] If the magnetic sensor is in an interference-free environment, it means that the control button is interrupted because the first sensing parameter caused by continuously crossing multiple gears is greater than the preset threshold, rather than being affected by magnetic field interference, so the first sensing parameter is valid.

[0086] If the magnetic sensor is in an interference environment, it means that the control button is not interrupted because the first sensing parameter is greater than the preset threshold due to continuous crossing of multiple gears, that is, the magnetic sensor is indeed interrupted due to magnetic field interference. Therefore, in this embodiment, it can be determined that the first sensing parameter is invalid, and the electronic device does not need to adjust the control button to the gear corresponding to the first sensing parameter. In other embodiments, after determining that it is in an interference environment based on the difference between the second sensing parameter and the corresponding calibration parameter, the type of interference can be further determined, and corresponding processing methods can be adopted based on different interference types.

[0087] In some implementations, when the control button is in an interference environment and the last position of the control button is not the first position or the second position, it can be determined that the first sensing parameter is invalid, and the electronic device does not need to adjust the control button to the position corresponding to the first sensing parameter. However, in this embodiment, when the control button is in an interference environment and the last position of the control button is not the first position or the second position, the interference type can be further determined, and corresponding processing methods can be adopted based on different interference types, as follows:

[0088] Step S235: Determine whether the magnetic sensor was in an interference environment last time.

[0089] Specifically, the electronic device records the historical sensing values ​​of the magnetic sensor and the data of each interference judgment, including whether the magnetic sensor was in an interference environment last time. For example, after the electronic device judges whether the magnetic sensor is in an interference environment each time, it can store the judgment result for subsequent use.

[0090] Step S236: If the magnetic sensor was in an interference environment last time and the interference type is stable interference, it is determined that the first sensing parameter is valid.

[0091] After determining that the first sensing parameter is valid, the corresponding gear position can be determined based on the first sensing parameter, and then the interruption threshold (i.e., the threshold range corresponding to each gear position) can be updated based on the first sensing parameter, and then the key position can be reported. Wherein, updating the interruption threshold based on the first sensing parameter, for example, is to determine whether the margin of the first sensing parameter from the corresponding threshold range endpoint is less than the first preset value. If so, the threshold range corresponding to all gear positions is uniformly adjusted in the deviation direction so that the margin of the first sensing parameter from the corresponding threshold range endpoint is greater than the second preset value. Wherein, the first preset value can be 5% of the corresponding threshold range, and the second preset value can be 10% of the corresponding threshold range.

[0092] Step S237: If the magnetic sensor was in an interference environment last time and the interference type was unstable interference, then the sensing parameters of the control button in the current gear position are obtained for a preset number of times and the control button is dormant for a preset time.

[0093] The preset number of times and the preset duration can be set as needed. In this embodiment, the preset number of times is 10 to 20 times, for example, 15 times; the preset duration is 1 second to 1 minute, for example, 5 seconds.

[0094] like Figure 6 As shown, the last interference situation is judged. If there was no interference last time, it means that the interference environment is entered from a non-interference environment. In some embodiments, if the magnetic sensor was in a non-interference environment last time and the interference type was stable interference, the last gear position is maintained and the interruption threshold is updated based on the first sensing parameter. In some embodiments, if the magnetic sensor was in a non-interference environment last time and the interference type was unstable interference, there is no need to adjust the control button to the gear position corresponding to the first sensing parameter, and the process can be ended.

[0095] like Figure 6 As shown, in this embodiment, before step S235, a preset number of sensing parameters of the control button (corresponding to Figure 6 The cyclic reading in the figure is performed four times to take the average value, which is not marked in the figure). After step S235, the interference type (corresponding to the interference type of the magnetic sensor) can be determined based on the preset number of sensing parameters. Figure 6The interference type judgment in the figure is not marked). Among them, the preset number can be set as needed, for example, 4.

[0096] like Figure 6 As shown, in some embodiments, determining the interference type of the magnetic sensor may include: determining an average value of a preset number of sensing parameters (corresponding to Figure 6 The difference between the first and last sensing parameters (not marked in the figure) is used as the judgment range, wherein the preset number of sensing values ​​are collected by the magnetic sensor; if the judgment range is greater than or equal to the interference threshold, it is determined that the interference type of the magnetic sensor is unstable interference. Specifically, the corresponding formula is as follows:

[0097]

[0098] Among them, diff is the judgment range, which is used to judge whether it is unstable interference; n is the preset number, a i is the i-th sensing value, i∈[1,n]; a n is the last sensing value among the preset number of sensing values. If difff ≥ T (T is the interference threshold, T can be an empirical value), it is determined that the interference type of the magnetic sensor is unstable interference. After the electronic device identifies that the magnetic sensor is in an interference environment, it continuously reads the sensing value n times every preset time range and averages it. The preset time range can be set according to actual needs, for example, 30s.

[0099] In some embodiments, determining the interference type of the magnetic sensor may include: determining whether the first induction value and the second induction value increase or decrease at the same time, and whether the difference between the induction parameter and the calibration parameter corresponding to the current gear position remains unchanged within a preset time range; if so, determining that the interference type of the magnetic sensor is stable interference. The induction parameter is the sum or difference of the first induction value and the second induction value, wherein the first induction value is acquired by the first magnetic sensor, and the second induction value is acquired by the second magnetic sensor.

[0100] Specifically, N = sensing parameter - calibration parameter = (HALL1-HALL2) - calibration (HALL1-HALL2). HALL1 is the sensing value collected by the first magnetic sensor, and HALL2 is the sensing value collected by the second magnetic sensor. N is the increment introduced by the steady-state interference, N ≥ K. If HALL1 and HALL2 increase or decrease at the same time, and N does not change within the preset time range, it is determined that the interference type of the magnetic sensor is stable interference.

[0101] See also Fig. 9 , Fig. 9 yes Figure 8 FIG. 1 is a flow chart of another embodiment of step S234 in FIG.

[0102] Different from the above embodiment, after the magnetic sensor is in a non-interference environment, this embodiment further determines whether the magnetic sensor was in an interference environment last time to determine whether there is continuous fluctuation interference.

[0103] In this embodiment, step S234 may include sub-steps S2341 to S2345.

[0104] Step S2341: If the magnetic sensor is in a non-interference environment, determine whether the magnetic sensor was in an interference environment last time.

[0105] For the description of determining whether the magnetic sensor was in an interference environment last time, reference may be made to the above-mentioned step S235 , which will not be repeated here.

[0106] Step S2342: If the magnetic sensor was in a non-interference environment last time, determine that the first sensing parameter is valid.

[0107] If the magnetic sensor was in a non-interference environment last time, it means that the magnetic sensor has always been in a non-interference environment, so the first sensing parameter is valid.

[0108] Step S2343: If the magnetic sensor was in an interference environment last time, the third sensing parameter corresponding to the control button being in the current gear position is obtained again.

[0109] If the magnetic sensor was in an interference environment last time, it means that the magnetic sensor has entered an interference-free environment from an interference environment, which means that there may be continuous fluctuation interference at present. Therefore, the third sensing parameter corresponding to the current position of the control button can be obtained again to perform interference judgment again.

[0110] Step S2344: Based on the difference between the third sensing parameter and the corresponding calibration parameter, determine whether the magnetic sensor is in an interference environment.

[0111] Please refer to steps S221 to S222, which will not be repeated here.

[0112] Step S2345: If the magnetic sensor is in a non-interference environment, determine that the first sensing parameter is valid.

[0113] If the magnetic sensor is in an interference-free environment, it means that there is no continuous fluctuation interference, so it can be determined that the first sensing parameter is valid, and then the control button is adjusted to the gear corresponding to the first sensing parameter.

[0114] If the magnetic sensor is in an interference environment, it means that there is continuous fluctuation interference, so it can be determined that the first sensing parameter is invalid, so there is no need to adjust the control button to the gear corresponding to the first sensing parameter, and the process ends directly.

[0115] like Figure 6 As shown, in a specific embodiment, the magnetic sensor is a Hall sensor (HALL). Under normal circumstances, when there is no external interference or when interference is not considered, the algorithm flow is as follows:

[0116] (1) Start;

[0117] (2) Interrupt triggering, that is, each time the button is pressed, the data collected by the magnetic sensor will change. When the change is greater than a certain value, the magnetic sensor is triggered to collect data;

[0118] (3) obtaining the reading value (sensing value) of the magnetic sensor, that is, reading the sensing value through the internal control module of the mobile phone (such as a processor), and determining the sensing parameters);

[0119] (8) Obtaining the position, i.e. determining the position of the key at that time based on the data obtained by HALL;

[0120] (9) Update interruption threshold;

[0121] (10) Reporting key position;

[0122] (11)End.

[0123] In this embodiment, before step ⑧ obtaining the position (i.e. determining the corresponding gear position based on the sensing parameter and adjusting the control button to the gear position), the interference situation is judged based on the first preset strategy and the second preset strategy. Specifically, after step ③, the following is also included:

[0124] (4) Interference judgment (i.e., step S22: judging whether the control button is in an interference environment based on the difference between the first sensing parameter and the corresponding calibration parameter); if so, executing step (12); otherwise, executing step (5).

[0125] (5) Whether there was interference last time (i.e., step S2341: if the magnetic sensor is in a non-interference environment, determine whether the magnetic sensor was in an interference environment last time); if so, execute step (6); otherwise, execute step (8).

[0126] (6) Obtaining the HALL reading value (ie, step S2343: if the magnetic sensor was in an interference environment last time, obtaining the third sensing parameter corresponding to the control button being in the current gear position again).

[0127] (7) Interference judgment (i.e., step S2344: judging whether the magnetic sensor is in an interference environment based on the difference between the third sensing parameter and the corresponding calibration parameter); if so, executing step (11); otherwise, executing step (8).

[0128] (12) The last position is up or down (i.e., step S231: determine whether the last gear position of the control button is the first gear position or the second gear position, wherein there is at least one gear position between the first gear position and the second gear position); if so, execute step (13); otherwise, execute step (15).

[0129] (13) Obtaining the HALL reading value (i.e., step S232: again obtaining the second sensing parameter corresponding to the control button being in the current gear position).

[0130] (14) Interference judgment (i.e., step S232: judging whether the magnetic sensor is in an interference environment based on the difference between the second sensing parameter and the corresponding calibration parameter); if so, executing step (15); otherwise, executing step (5).

[0131] (15) Read the data four times in a loop and take the average value.

[0132] (16) Whether there was interference last time (i.e., step S235: determining whether the magnetic sensor was in an interference environment last time); if so, executing step (18); otherwise, executing step (17).

[0133] (17) Interference type determination.

[0134] (18) Interference type determination.

[0135] For the corresponding descriptions of steps 17 and 18, please refer to the descriptions of the corresponding positions of steps S236 and S237 in the above embodiment.

[0136] (19) Maintain last position.

[0137] (20) Count 15 times and sleep for 5 seconds.

[0138] See also Fig.10 , Fig.10 It is a flow chart of another embodiment of the control button adjustment method of the present application.

[0139] Different from the above embodiment, in this embodiment, after obtaining the first sensing parameter corresponding to the control button being in the current gear position, if the magnetic sensor is in an interference-free environment, the second preset strategy can also be used to determine the validity of the first sensing parameter, wherein the first preset strategy is different from the second preset strategy.

[0140] Step S31: obtaining a first sensing parameter corresponding to the current gear position of the control button.

[0141] Step S32: when the magnetic sensor is in an interference environment, the validity of the first sensing parameter is determined using a first preset strategy.

[0142] Step S33: If the magnetic sensor is in a non-interference environment, the validity of the first sensing parameter is determined using a second preset strategy.

[0143] Specifically, determining the validity of the first sensing parameter using the second preset strategy may include: determining whether the magnetic sensor was in an interference environment last time; if the magnetic sensor was in a non-interference environment last time, determining that the first sensing parameter is valid. For this, please refer to the description of steps S2341 to S2342 above.

[0144] If the magnetic sensor was in an interference environment last time, the second sensing parameter corresponding to the control button being in the current gear position is obtained again; based on the difference between the second sensing parameter and the corresponding calibration parameter, it is determined whether the magnetic sensor is in an interference environment; if the magnetic sensor is in a non-interference environment, it is determined that the first sensing parameter is valid. For this, please refer to the description of the above steps S2343 to S2345.

[0145] Step S34: If the first sensing parameter is valid, the control button is adjusted to the gear position corresponding to the first sensing parameter.

[0146] For the description of the above steps S31, S32, and S34, please refer to the corresponding positions in the aforementioned embodiments, which will not be repeated here.

[0147] See also Fig.11 , Fig.11 It is a structural schematic diagram of an embodiment of the electronic device of the present application.

[0148] In this embodiment, the electronic device 100 includes a control button and a magnetic sensor, as well as an acquisition module 110, a determination module 120, and an adjustment module 130. The acquisition module 110 is used to acquire a first sensing parameter corresponding to the current gear position of the control button; the determination module 120 is used to determine the validity of the first sensing parameter using a first preset strategy when the magnetic sensor is in an interference environment; and the adjustment module 130 is used to adjust the control button to the gear position corresponding to the first sensing parameter if the first sensing parameter is valid.

[0149] In some embodiments, the validity of the first sensing parameter is determined using a first preset strategy, including: determining whether the last gear position of the control button is the first gear position or the second gear position, wherein there is at least one gear position between the first gear position and the second gear position; if so, obtaining again the second sensing parameter corresponding to the current gear position of the control button; based on the difference between the second sensing parameter and the corresponding calibration parameter, determining whether the magnetic sensor is in an interference environment; if the magnetic sensor is in a non-interference environment, determining that the first sensing parameter is valid.

[0150] In some embodiments, if the magnetic sensor is in a non-interference environment, determining that the first sensing parameter is valid includes: if the magnetic sensor is in a non-interference environment, determining whether the magnetic sensor was in an interference environment last time; if the magnetic sensor was in a non-interference environment last time, determining that the first sensing parameter is valid.

[0151] In some embodiments, after determining whether the magnetic sensor was in an interference environment last time, the method further includes: if the magnetic sensor was in an interference environment last time, obtaining again the third sensing parameter corresponding to the control button being in the current gear position; based on the difference between the third sensing parameter and the corresponding calibration parameter, determining whether the magnetic sensor is in an interference environment; if the magnetic sensor is in a non-interference environment, determining that the first sensing parameter is valid.

[0152] In some embodiments, after determining whether the last gear position of the control button was the first gear position or the second gear position, it also includes: if not, determining whether the magnetic sensor was in an interference environment last time; if the magnetic sensor was in an interference environment last time and the interference type was stable interference, determining that the first sensing parameter is valid.

[0153] In some embodiments, if not, after determining whether the magnetic sensor was in an interference environment last time, it also includes: if the magnetic sensor was in an interference environment last time and the interference type was unstable interference, obtaining the sensing parameters of the control button in the current gear position for a preset number of times and sleeping for a preset time.

[0154] In some embodiments, if not, after determining whether the magnetic sensor was in an interference environment last time, the method further includes: if the magnetic sensor was in a non-interference environment last time and the interference type was stable interference, maintaining the last gear position and updating the interruption threshold based on the first sensing parameter.

[0155] In some embodiments, if not, before determining whether the magnetic sensor was in an interference environment last time, the method further includes: obtaining a preset number of sensing parameters of the control button; if not, after determining whether the magnetic sensor was in an interference environment last time, the method further includes: determining the interference type of the magnetic sensor based on the preset number of sensing parameters.

[0156] In some embodiments, determining the interference type of the magnetic sensor includes: determining the difference between an average value of a preset number of sensing values ​​and a last sensing value as a judgment range, wherein the preset number of sensing values ​​are collected by the magnetic sensor; if the judgment range is greater than or equal to the interference threshold, determining that the interference type of the magnetic sensor is unstable interference; and / or, the sensing parameter is the sum or difference of a first sensing value and a second sensing value, wherein the first sensing value is collected by the first magnetic sensor and the second sensing value is collected by the second magnetic sensor, and determining the interference type of the magnetic sensor includes: determining whether the first sensing value and the second sensing value increase or decrease at the same time, and whether the difference between the sensing parameter corresponding to the current gear and the calibration parameter remains unchanged within a preset time range; if so, determining that the interference type of the magnetic sensor is stable interference.

[0157] In some embodiments, after obtaining the first sensing parameter corresponding to the control button being in the current gear position, the method further includes: if the magnetic sensor is in an interference-free environment, determining the validity of the first sensing parameter using a second preset strategy.

[0158] In some embodiments, determining the validity of the first sensing parameter using the second preset strategy includes: determining whether the magnetic sensor was in an interference environment last time; if the magnetic sensor was in a non-interference environment last time, determining that the first sensing parameter is valid.

[0159] In some embodiments, after determining whether the magnetic sensor was in an interference environment last time, the method further includes: if the magnetic sensor was in an interference environment last time, obtaining again the second sensing parameter corresponding to the control button being in the current gear position; based on the difference between the second sensing parameter and the corresponding calibration parameter, determining whether the magnetic sensor is in an interference environment; if the magnetic sensor is in a non-interference environment, determining that the first sensing parameter is valid.

[0160] In some embodiments, if the magnetic sensor is in an interference environment, before using the first preset strategy to determine the validity of the first sensing parameter, it also includes: judging whether the magnetic sensor is in an interference environment based on the difference between the first sensing parameter and the corresponding calibration parameter.

[0161] In some embodiments, based on the difference between the first sensing parameter and the corresponding calibration parameter, determining whether the magnetic sensor is in an interference environment includes: determining the difference between the first sensing parameter and the corresponding calibration parameter; wherein the calibration parameter is measured in an interference-free environment when the control button is in the current gear position; determining whether the difference between the first sensing parameter and the corresponding calibration parameter is greater than a preset threshold; if so, determining that the magnetic sensor is in an interference environment.

[0162] See also Fig.12 , Fig.12It is a structural schematic diagram of another embodiment of the electronic device of the present application.

[0163] The electronic device 200 may include a control button 210, a magnetic sensor 220, a memory 230 and a processor 240 coupled to each other, the memory 230 is used to store program data, and the processor 240 is used to execute program data to implement the steps in any of the above method embodiments. The electronic device 200 may include, but is not limited to: a personal computer (e.g., a desktop, a laptop, a tablet computer, a handheld computer, etc.), a mobile phone, a server, a wearable device, and augmented reality (AR for short), virtual reality (VR for short) equipment, a television, etc., which are not limited here. The magnetic sensor 220 can be connected to the processor for data transmission. The electronic device may also include a device body, which may include a display screen, a middle frame, a battery, a camera assembly, a speaker, a microphone, etc.

[0164] Specifically, the processor 240 is used to control itself and the memory 230 to implement the steps in any of the above method embodiments. The processor 240 may also be referred to as a CPU (Central Processing Unit). The processor 240 may be an integrated circuit chip having signal processing capabilities. The processor 240 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. In addition, the processor 240 may be implemented by a plurality of integrated circuit chips.

[0165] See also Fig.13 , Fig.13 It is a structural diagram of an embodiment of a computer-readable storage medium of the present application.

[0166] The computer-readable storage medium 300 stores program data 310 , and when the program data 310 is executed by a processor, it is used to implement the steps in any of the above method embodiments.

[0167] The computer-readable storage medium 300 may be a medium that can store computer programs, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or may be a server that stores the computer program. The server may send the stored computer program to other devices for execution, or may execute the stored computer program itself.

[0168] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0169] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0170] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0171] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

[0172] The above descriptions are merely embodiments of the present application and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A control button adjustment method, characterized in that: Applied to an electronic device, the electronic device includes a control button and a magnetic sensor, and the method includes: Acquire a first sensing parameter corresponding to the current gear position of the control button; When the magnetic sensor is in an interference environment, determining the validity of the first sensing parameter using a first preset strategy includes: Determining whether the last gear position of the control button is the first gear position or the second gear position, wherein the first gear position and the second gear position are separated by at least one gear position; If yes, then obtaining the second sensing parameter corresponding to the current gear position of the control button again; determining, based on a difference between the second sensing parameter and a corresponding calibration parameter, whether the magnetic sensor is in an interference environment; If the magnetic sensor is in a non-interference environment, determining that the first sensing parameter is valid; If the first sensing parameter is valid, the control button is adjusted to a gear position corresponding to the first sensing parameter.

2. The method according to claim 1, characterized in that If the magnetic sensor is in a non-interference environment, determining that the first sensing parameter is valid includes: If the magnetic sensor is in a non-interference environment, determining whether the magnetic sensor was in an interference environment last time; If the magnetic sensor was in a non-interference environment last time, it is determined that the first sensing parameter is valid.

3. The method according to claim 2, characterized in that After determining whether the magnetic sensor was in an interference environment last time, the method further includes: If the magnetic sensor was in an interference environment last time, obtaining again the third sensing parameter corresponding to the current gear position of the control button; determining whether the magnetic sensor is in an interference environment based on a difference between the third sensing parameter and a corresponding calibration parameter; If the magnetic sensor is in a non-interference environment, it is determined that the first sensing parameter is valid.

4. The method according to claim 1, characterized in that After determining whether the last gear position of the control button is the first gear position or the second gear position, the method further includes: If not, determining whether the magnetic sensor was in an interference environment last time; If the magnetic sensor was in an interference environment last time and the interference type was stable interference, it is determined that the first sensing parameter is valid.

5. The method according to claim 4, characterized in that If not, after determining whether the magnetic sensor was in an interference environment last time, the method further includes: If the magnetic sensor was in an interference environment last time and the interference type was unstable interference, the sensing parameters of the control button in the current gear are obtained for a preset number of times and the control button is dormant for a preset time.

6. The method according to claim 4, characterized in that If not, after determining whether the magnetic sensor was in an interference environment last time, the method further includes: If the magnetic sensor was in a non-interference environment last time and the interference type was stable interference, the last gear position is maintained and the interruption threshold is updated based on the first sensing parameter.

7. The method according to claim 4, characterized in that If not, before determining whether the magnetic sensor was in an interference environment last time, the method further includes: Obtaining a preset number of sensing parameters of the control button; If not, after determining whether the magnetic sensor was in an interference environment last time, the method further includes: Based on the latter preset number of sensing parameters, the interference type of the magnetic sensor is determined.

8. The method according to claim 7, characterized in that The determining the interference type of the magnetic sensor includes: Determine the difference between the average value of the last preset number of sensing values ​​and the last sensing value as a judgment range, wherein the preset number of sensing values ​​are collected by the magnetic sensor; If the judgment range is greater than or equal to the interference threshold, determining that the interference type of the magnetic sensor is unstable interference; and / or, The sensing parameter is a sum or difference of a first sensing value and a second sensing value, wherein the first sensing value is acquired by a first magnetic sensor, and the second sensing value is acquired by a second magnetic sensor, and the determining of the interference type of the magnetic sensor includes: Determine whether the first sensing value and the second sensing value increase or decrease at the same time, and whether the difference between the sensing parameter and the calibration parameter corresponding to the current gear position remains unchanged within a preset time range; If so, it is determined that the interference type in which the magnetic sensor is located is stable interference.

9. The method according to claim 1, characterized in that After obtaining the first sensing parameter corresponding to the control button being in the current gear position, the method further includes: If the magnetic sensor is in a non-interference environment, the validity of the first sensing parameter is determined using a second preset strategy.

10. The method according to claim 9, characterized in that The determining the validity of the first sensing parameter by using the second preset strategy includes: Determining whether the magnetic sensor was in an interference environment last time; If the magnetic sensor was in a non-interference environment last time, it is determined that the first sensing parameter is valid.

11. The method according to claim 10, characterized in that After determining whether the magnetic sensor was in an interference environment last time, the method further includes: If the magnetic sensor was in an interference environment last time, obtaining again the second sensing parameter corresponding to the control button being in the current gear position; determining, based on a difference between the second sensing parameter and a corresponding calibration parameter, whether the magnetic sensor is in an interference environment; If the magnetic sensor is in a non-interference environment, it is determined that the first sensing parameter is valid.

12. The method according to claim 1, characterized in that If the magnetic sensor is in an interference environment, before using a first preset strategy to determine the validity of the first sensing parameter, the method further includes: Based on the difference between the first sensing parameter and the corresponding calibration parameter, it is determined whether the magnetic sensor is in an interference environment.

13. The method according to claim 12, characterized in that The determining, based on the difference between the first sensing parameter and the corresponding calibration parameter, whether the magnetic sensor is in an interference environment comprises: Determine a difference between the first sensing parameter and a corresponding calibration parameter; wherein the calibration parameter is measured when the control button is in a current gear position in an interference-free environment; Determining whether a difference between the first sensing parameter and a corresponding calibration parameter is greater than a preset threshold; If so, it is determined that the magnetic sensor is in an interference environment.

14. An electronic device, characterized in that: The electronic device includes a control button, a magnetic sensor, a memory and a processor coupled to each other, the memory is used to store program data, and the processor is used to execute the program data to implement the method according to any one of claims 1-13.

15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program data, and when the program data is executed by a processor, it is used to implement the method according to any one of claims 1 to 13.