Linear motor calibration method and related equipment

By dynamically adjusting the driving frequency of the linear motor, the problem of deteriorating vibration effects due to manufacturing tolerances and device aging is solved, thereby improving user experience and system stability.

CN120675467APending Publication Date: 2025-09-19HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410283857.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-12
Publication Date
2025-09-19

AI Technical Summary

Technical Problem

In the prior art, due to manufacturing tolerances and device aging of the linear motor, its actual resonant frequency differs significantly from the frequency set at the factory. When calibration fails, it is still driven at a fixed frequency, resulting in a deterioration in the vibration effect and affecting the user experience.

Method used

The linear motor is calibrated respectively through the first calibration frequency and the second calibration frequency to determine whether it is successful or not, and the driving frequency is dynamically adjusted according to the successful frequency, and the target frequency is saved to adapt to the resonant frequency offset to ensure the vibration effect.

Benefits of technology

It improves the vibration effect of the linear motor during use, enhances the user experience, avoids the weak vibration problem caused by frequency deviation, and maintains the stability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120675467A_ABST
    Figure CN120675467A_ABST
Patent Text Reader

Abstract

The invention discloses a linear motor calibration method and related equipment, which are applied to electronic equipment comprising a linear motor. Comprising the following steps: calibrating the linear motor through a first calibration frequency, and judging whether the linear motor is successfully calibrated at the first calibration frequency; if the first calibration frequency is successfully calibrated, driving the linear motor according to the first calibration frequency; determining a first target frequency based on the first calibration frequency, and storing the first target frequency; after driving the linear motor to vibrate for N periods according to the first calibration frequency, stopping driving the linear motor; calibrating the linear motor through the second calibration frequency, and judging whether the linear motor is successfully calibrated at the second calibration frequency; and if the calibration of the second calibration frequency fails, driving the linear motor according to the first target frequency. According to the embodiment of the invention, the driving frequency of the linear motor can be adaptively adjusted to improve the vibration effect of the linear motor, so that the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal equipment technology, and in particular to a linear motor calibration method and related equipment. Background Art

[0002] Linear motors, devices that convert electrical energy into linear mechanical energy, are widely used in various electronic devices. When a linear motor is installed in an electronic device, it can be driven to vibrate when it detects an application scenario that requires vibration (for example, when a phone receives an incoming call or message), creating a vibration effect for the electronic device.

[0003] In existing technology, linear motors are typically calibrated each time an electronic device is powered on, taking into account lifespan and environmental factors to ensure optimal operation. If calibration fails, the driver program will provide the driver chip with a fixed initial frequency value (e.g., 170Hz) as the linear motor's drive frequency. Ideally, this initial frequency value is the resonant frequency set by the linear motor at the factory.

[0004] However, due to the influence of manufacturing tolerances and device aging of the linear motor, the actual resonant frequency calculated during the actual calibration of the linear motor will shift. When the difference between the actual resonant frequency and the initial frequency value is too large, the linear motor calibration fails. At this time, if the electronic device continues to drive the linear motor according to the initial frequency value, it will cause the linear motor to vibrate weakly, making the vibration effect worse, thereby reducing the user experience. Therefore, how to provide a more flexible and better vibration calibration method that can adaptively adjust the driving frequency of the linear motor to improve the vibration effect of the linear motor when the actual resonant frequency of the linear motor shifts is an urgent problem to be solved. Summary of the Invention

[0005] The embodiments of the present application disclose a method and related equipment for calibrating a linear motor, which can adaptively adjust the driving frequency of the linear motor to improve the vibration effect of the linear motor, thereby enhancing the user experience.

[0006] In order to achieve the above technical objectives, the embodiments of the present application provide the following technical solutions:

[0007] In a first aspect, the present application provides a method for calibrating a linear motor, which is applied to an electronic device including a linear motor. The method may include: calibrating the linear motor through a first calibration frequency, and determining whether the linear motor is successfully calibrated at the first calibration frequency; the first calibration frequency is the resonant frequency of the linear motor calculated during the first calibration process; if the calibration is successful at the first calibration frequency, driving the linear motor according to the first calibration frequency; determining a first target frequency based on the first calibration frequency, and saving the first target frequency; after driving the linear motor to vibrate for N cycles according to the first calibration frequency, stopping driving the linear motor; wherein N is an integer greater than 0 or equal to 0; calibrating the linear motor through a second calibration frequency, and determining whether the linear motor is successfully calibrated at the second calibration frequency; the second calibration frequency is the resonant frequency of the linear motor calculated during the second calibration process; if the calibration fails at the second calibration frequency, driving the linear motor according to the first target frequency.

[0008] In an embodiment of the present application, the driving frequency of the linear motor can be adjusted in a targeted manner based on the results of motor calibration under different circumstances, thereby improving the vibration effect of the linear motor during use and enhancing the user experience. First, the linear motor is calibrated using a first calibration frequency. The first calibration frequency is the true resonant frequency of the linear motor calculated during the first calibration process. If the calibration is successful, the linear motor is driven according to the first calibration frequency before the next calibration of the linear motor to ensure that the linear motor can achieve a good vibration effect during use, thereby ensuring the feel of the linear motor during use and enhancing the user experience. At the same time, a first target frequency is determined based on the first calibration frequency that was successfully calibrated, and the determined first target frequency is saved so that the driving frequency of the linear motor can be quickly determined the next time the linear motor calibration fails, and the working state of the linear motor can be quickly restored. Furthermore, after the electronic device drives the linear motor to vibrate for N cycles at the first calibration frequency, the linear motor is calibrated at the second calibration frequency. The second calibration frequency is the resonant frequency of the linear motor calculated during the second calibration process. If the calibration fails, the linear motor is driven at the first target frequency determined during the previous successful calibration. This ensures that a reliable drive frequency (i.e., the first target frequency) can be quickly assigned to the linear motor when the linear motor calibration fails, thereby quickly restoring the linear motor's operating state while maintaining the vibration feel of the linear motor under normal operating conditions as much as possible, thereby improving system stability. In the prior art, when the linear motor calibration fails, a fixed initial frequency value (e.g., 170 Hz) is assigned to the linear motor as the drive frequency according to the resonant frequency set at the factory. When the actual resonant frequency of the linear motor deviates significantly from the resonant frequency set at the factory, it is very likely to cause weak vibration of the motor, affecting the vibration effect. Compared to the prior art, the embodiment of the present application can dynamically adjust the first target frequency of the linear motor when the calibration fails, based on the value of the resonant frequency (i.e., the first calibration frequency) determined during the last successful calibration of the linear motor. This allows the first target frequency to gradually approach the current true resonant frequency of the linear motor as the number of calibrations increases, ensuring that the linear motor maintains a normal vibration effect. Through the embodiment of the present application, it is possible to effectively solve the problem in the prior art that due to the influence of manufacturing tolerances, component aging, etc. of the linear motor, the actual resonant frequency of the linear motor during the calibration process is significantly different from the resonant frequency set at the factory (e.g., 170Hz), and the linear motor is still driven according to the resonant frequency set at the factory when the calibration fails, resulting in weak vibration of the linear motor. Therefore, during the linear motor calibration process, the driving frequency of the linear motor can be adaptively adjusted to improve the vibration effect of the linear motor, thereby enhancing the user experience.

[0009] In one possible implementation, before calibrating the linear motor using the first calibration frequency, the method further includes: after driving the linear motor to vibrate for M cycles at the first frequency, stopping driving the linear motor; wherein the first frequency is included in a preset frequency range, and M is an integer greater than or equal to 0.

[0010] In an embodiment of the present application, before calibrating the linear motor at a first calibration frequency, the linear motor is driven to vibrate for M cycles at a first frequency, where the first frequency is within a preset frequency range, for example, 155 Hz to 185 Hz. This embodiment of the present application ensures that the linear motor can function properly before calibration at the first calibration frequency, preventing a significant difference between the linear motor's drive frequency and its actual resonant frequency from affecting the vibration effect. It also prevents damage to the linear motor due to abnormal vibration, thereby maintaining a pleasant vibration feel for the linear motor and improving the success rate of subsequent calibration of the linear motor at the first calibration frequency, thereby enhancing the user experience.

[0011] In one possible implementation, calibrating the linear motor by a first calibration frequency and determining whether the linear motor is successfully calibrated at the first calibration frequency, or calibrating the linear motor by a second calibration frequency and determining whether the linear motor is successfully calibrated at the second calibration frequency, may include: obtaining a corresponding calibration frequency of the linear motor; the corresponding calibration frequency is the first calibration frequency or the second calibration frequency; determining whether the corresponding calibration frequency is within the preset frequency range; if so, determining that the calibration of the corresponding calibration frequency is successful; if not, determining that the calibration of the corresponding calibration frequency has failed.

[0012] In an embodiment of the present application, the resonant frequency of the linear motor calculated during the first calibration process (that is, the first calibration frequency) is first obtained, and then by determining whether the first calibration frequency is within a preset frequency range (e.g., 155Hz-185Hz), it is determined whether the linear motor is successfully calibrated at the first calibration frequency. Further, if the first calibration frequency is within the preset frequency range (e.g., 155Hz-185Hz), it is determined that the first calibration frequency calibration is successful; if not, it is determined that the first calibration frequency calibration has failed. Correspondingly, by first obtaining the resonant frequency of the linear motor calculated during the second calibration process (that is, the second calibration frequency), and then by determining whether the second calibration frequency is within the preset frequency range (e.g., 155Hz-185Hz), it is determined whether the linear motor is successfully calibrated at the second calibration frequency. Further, if the second calibration frequency is within the preset frequency range (e.g., 155Hz-185Hz), it is determined that the second calibration frequency calibration is successful; if not, it is determined that the second calibration frequency calibration has failed. Through the embodiments of the present application, it is possible to accurately determine whether the linear motor calibration is successful, and thus take corresponding measures to adjust the frequency of driving the linear motor so that the frequency of driving the linear motor is within a safe range (that is, a preset frequency range), thereby avoiding a large difference between the driving frequency of the linear motor and the actual resonant frequency, which affects the vibration effect. At the same time, it can also avoid abnormal vibration of the linear motor and damage to the linear motor. While maintaining the vibration effect of the linear motor, it can also improve the stability of the system.

[0013] In one possible implementation, the first frequency is a preset initial frequency or a third calibration frequency, and the third calibration frequency is the resonant frequency of the linear motor calculated by the last successful calibration before the first calibration frequency calibration; determining the first target frequency based on the first calibration frequency may include: when the first frequency is the preset initial frequency, determining the first target frequency based on the first calibration frequency and the preset initial frequency; when the first frequency is the third calibration frequency, determining the first target frequency based on the first calibration frequency and the third target frequency; and the third target frequency is obtained based on the third calibration frequency.

[0014] In an embodiment of the present application, before calibrating the linear motor using the first calibration frequency, the first frequency at which the linear motor is driven to vibrate for M cycles can be the resonant frequency set at the factory for the linear motor (i.e., the preset initial frequency), or can be the resonant frequency calculated from the last successful calibration before calibrating the linear motor using the first calibration frequency (i.e., the third calibration frequency). Specifically, when the first frequency is the preset initial frequency, calibrating the linear motor using the first calibration frequency can be performed when the electronic device is first powered on after leaving the factory, or when the linear motor calibration fails during the first power-on of the electronic device after leaving the factory. Therefore, when the linear motor is successfully calibrated using the first calibration frequency, a first target frequency can be determined based on the resonant frequency calculated during the first calibration process of the linear motor (i.e., the first calibration frequency) and the resonant frequency set at the factory for the linear motor (i.e., the preset initial frequency), such that the determined first target frequency is closer to the actual resonant frequency of the linear motor within the normal range of the linear motor drive frequency (i.e., the preset frequency range). When the first frequency is the frequency of the last successful calibration before the linear motor is calibrated by the first calibration frequency (that is, the third calibration frequency), then calibrating the linear motor by the first calibration frequency can be any calibration of the linear motor that has been successfully calibrated. Therefore, when the linear motor is successfully calibrated by the first calibration frequency, the first target frequency can be determined based on the resonant frequency calculated in the first calibration process of the linear motor (that is, the first calibration frequency) and the third target frequency determined based on the calculated resonant frequency of the linear motor (that is, the third calibration frequency) during the last successful calibration before the linear motor is calibrated by the first calibration frequency, which is closer to the true resonant frequency of the linear motor. Such that the determined first target frequency is closer to the true resonant frequency of the linear motor within the normal range of the linear motor driving frequency (that is, the preset frequency range). Through the embodiments of the present application, the frequency of driving the linear motor can be continuously adjusted according to the calibration frequency calculated by the most recent successful calibration of the linear motor, so that when the linear motor calibration fails next time, the determined first target frequency close to the true resonant frequency of the linear motor is used as the driving frequency of the linear motor, thereby improving the vibration effect of the linear motor, maintaining the feel of the linear motor and enhancing the user experience.

[0015] In one possible implementation, the method further includes: when the first frequency is the preset initial frequency, if the calibration of the first calibration frequency fails, driving the linear motor according to the preset initial frequency; when the first frequency is the third calibration frequency, if the calibration of the first calibration frequency fails, driving the linear motor according to the third target frequency.

[0016] In an embodiment of the present application, before the linear motor is calibrated by the first calibration frequency, the first frequency for driving the linear motor to vibrate M cycles can be the resonant frequency set when the linear motor leaves the factory (that is, the preset initial frequency), or can be the resonant frequency of the linear motor calculated by the last successful calibration before the calibration with the first calibration frequency (that is, the third calibration frequency). Therefore, when the first frequency is the resonant frequency set when the linear motor leaves the factory (that is, the preset initial frequency), calibrating the linear motor by the first calibration frequency can be the linear motor calibration performed when the electronic device is turned on for the first time after leaving the factory, or the linear motor calibration performed after the linear motor calibration fails when the electronic device is turned on for the first time after leaving the factory. Furthermore, if the first calibration frequency calibration fails, the linear motor is driven according to a preset initial frequency (for example, 170 Hz), so that when the electronic device fails to calibrate the linear motor for the first time or fails to calibrate the linear motor continuously for the first time when the power is turned on due to manufacturing tolerances of the linear motor or abnormalities in the motor hardware link, the frequency of driving the linear motor can be automatically retracted to the resonant frequency set when the linear motor leaves the factory (that is, the preset initial frequency), ensuring that the linear motor can operate normally to enhance the user experience; accordingly, when the first frequency is the resonant frequency of the linear motor calculated by the last successful calibration before the first calibration frequency calibration (that is, the third calibration frequency), calibrating the linear motor by the first calibration frequency can be any calibration of a linear motor that has been successfully calibrated. Furthermore, if the first calibration frequency fails, the linear motor is driven according to a third target frequency obtained based on the third calibration frequency, so that the electronic device can drive the linear motor according to the third target frequency determined based on the resonant frequency of the linear motor calculated when the linear motor was last successfully calibrated (that is, the third calibration frequency), which is closer to the true resonant frequency of the linear motor, so as to maintain the vibration effect of the linear motor; at the same time, it avoids the problem of weak vibration of the linear motor caused by the actual resonant frequency of the linear motor during the calibration process being significantly different from the resonant frequency set at the factory (that is, the preset initial frequency) due to the influence of manufacturing tolerances of the linear motor, device aging, etc., and the linear motor is still driven using the resonant frequency set at the factory (that is, the preset initial frequency) when the calibration fails. As the number of successful calibrations of the linear motor increases, the third target frequency determined by the electronic device based on the resonant frequency of the linear motor calculated when the linear motor was last successfully calibrated (that is, the third calibration frequency) can gradually fit the true resonant frequency of the true linear motor, thereby improving the vibration effect of the linear motor and enhancing the user experience.

[0017] In one possible implementation, the method further includes: if the second calibration frequency is calibrated successfully, driving the linear motor according to the second calibration frequency; determining a second target frequency based on the second calibration frequency and the first target frequency, and saving the second target frequency.

[0018] In an embodiment of the present application, when the electronic device successfully calibrates the linear motor through the second calibration frequency, that is, when the resonant frequency of the linear motor calculated by the electronic device during the second calibration process (i.e., the second calibration frequency) is within a preset frequency range (e.g., 155 Hz-185 Hz), then before the next calibration of the linear motor, the linear motor is driven according to the resonant frequency of the linear motor calculated during the second calibration process (i.e., the second calibration frequency) to ensure that the linear motor can achieve a better vibration effect during use, thereby ensuring the feel of the linear motor during use to enhance the user experience; at the same time, based on the second calibration frequency calculated when the linear motor is successfully calibrated during the second calibration process, and During the last successful calibration before calibrating the linear motor through the second calibration frequency, the first target frequency that is closer to the actual resonant frequency of the linear motor is determined based on the calculated resonant frequency of the linear motor (that is, the first calibration frequency). The latest second target frequency that is closer to the actual resonant frequency of the linear motor within the normal range of the linear motor driving frequency (that is, the preset frequency range) can be determined, and the determined second target frequency can be saved. In order to facilitate the use of the latest second target frequency that is close to the actual resonant frequency of the linear motor as the driving frequency of the linear motor when the linear motor calibration fails next time, thereby improving the vibration effect of the linear motor, maintaining the feel of the linear motor and enhancing the user experience.

[0019] In one possible implementation, determining the first target frequency based on the first calibration frequency and the preset initial frequency may include: determining a weighted average of the first calibration frequency and the preset initial frequency as the first target frequency; the weight of the first calibration frequency is X, and the weight of the preset initial frequency is Y, where X is greater than 0, Y is greater than or equal to 0, and the sum of X and Y is equal to 1; determining the first target frequency based on the first calibration frequency and the third target frequency may include: determining the first target frequency as the weighted average of the first calibration frequency and the third target frequency; the weight of the first calibration frequency is X, and the weight of the third target frequency is Y, where X is greater than 0, Y is greater than or equal to 0, and the sum of X and Y is equal to 1.

[0020] In an embodiment of the present application, when the first frequency at which the linear motor is driven to vibrate for M cycles before the linear motor is calibrated using the first calibration frequency is the resonant frequency set at the factory for the linear motor (i.e., the preset initial frequency), a weighted average of the resonant frequency calculated during the first calibration process (i.e., the first calibration frequency) and the resonant frequency set at the factory for the linear motor (i.e., the preset initial frequency) can be used as the frequency at which the linear motor is driven when the next calibration of the linear motor fails (i.e., the first target frequency), wherein the weight X of the first calibration frequency is greater than 0, the weight Y of the preset initial frequency is greater than or equal to 0, and the sum of X and Y is 1. Therefore, by adjusting the values ​​of the weight parameters X and Y, the resonant frequency of the linear motor calculated in the first calibration process (i.e., the first calibration frequency) and the weight of the resonant frequency set at the factory for the linear motor (i.e., the preset initial frequency) can be adjusted to obtain a first target frequency that approaches the true resonant frequency of the linear motor within a preset frequency range (e.g., 155Hz-185Hz). This allows the linear motor to be driven according to the determined first target frequency when the linear motor calibration fails next time, thereby maintaining the vibration feel of the linear motor in a normal state as much as possible. This avoids the problem of weak vibration of the linear motor caused by the linear motor being driven uniformly according to the factory-set resonant frequency (i.e., the preset initial frequency) when the true resonant frequency of the linear motor deviates significantly (exceeding the preset frequency range) due to aging or environmental factors (e.g., weightlessness). This can improve the vibration effect of the linear motor and enhance the user experience. When, before the linear motor is calibrated using the first calibration frequency, the first frequency at which the linear motor is driven to vibrate for M cycles is the frequency of the last successful calibration before the linear motor is calibrated using the first calibration frequency (that is, the third calibration frequency), a weighted average of the resonant frequency calculated during the first calibration process (that is, the first calibration frequency) and a third target frequency determined based on the calculated resonant frequency of the linear motor during the last successful calibration process before the linear motor is calibrated using the first calibration frequency (that is, the third calibration frequency) can be used as the frequency (that is, the first target frequency) at which the linear motor is driven when the next calibration of the linear motor fails, wherein the weight X of the first calibration frequency is greater than 0, the weight Y of the third target frequency is greater than or equal to 0, and the sum of X and Y is 1.Therefore, the resonant frequency of the linear motor calculated during the first calibration process (i.e., the first calibration frequency) and the weight of the third target frequency determined based on the calculated resonant frequency of the linear motor (i.e., the third calibration frequency) during the last successful calibration before the first calibration frequency can be adjusted by adjusting the values ​​of the weight parameters X and Y. This allows for a first target frequency that approaches the true resonant frequency of the linear motor within a preset frequency range (e.g., 155 Hz-185 Hz). This allows the linear motor to be driven according to the determined first target frequency when the next calibration fails, thereby maintaining the vibration feel of the motor in a normal state as much as possible. This avoids the problem of weak vibration of the linear motor caused by driving the linear motor according to the factory-set resonant frequency (i.e., the preset initial frequency) when the linear motor calibration fails, due to a large deviation (exceeding the preset frequency range) of the true resonant frequency of the linear motor caused by aging or environmental factors (e.g., weightlessness). This improves the vibration effect of the linear motor and enhances the user experience. In addition, through the embodiment of the present application, the ratio of weights X and Y can be adjusted to adjust the speed at which the frequency (that is, the first target frequency) determined for driving the linear motor when the next calibration of the linear motor fails converges with the actual resonant frequency of the linear motor. At the same time, the weights of the initial frequency and the third target frequency are preset to be consistent, which can ensure that the speed at which the determined first target frequency converges with the actual resonant frequency of the linear motor remains unchanged, so that the difference between the first target frequency and the actual resonant frequency of the linear motor gradually decreases as the number of successful linear motor calibrations increases. Therefore, when the next calibration fails, driving the linear motor according to the determined first target frequency can maintain the vibration effect of the linear motor, thereby improving the stability of the system and enhancing the user experience.

[0021] In one possible implementation, determining the second target frequency based on the second calibration frequency and the first target frequency may include: determining a weighted average of the second calibration frequency and the first target frequency as the second target frequency; the weight of the second calibration frequency is X, and the weight of the first target frequency is Y, where X is greater than 0, Y is greater than or equal to 0, and the sum of X and Y is equal to 1.

[0022] In an embodiment of the present application, a weighted average of the resonant frequency calculated during the second calibration process (i.e., the second calibration frequency) and the first target frequency determined based on the calculated resonant frequency of the linear motor (i.e., the first calibration frequency) during the last successful calibration process before the second calibration frequency calibration (i.e., the first calibration frequency calibration) is calculated as the frequency for driving the linear motor when the next calibration of the linear motor fails (i.e., the second target frequency), wherein the weight X of the second calibration frequency is greater than 0, the weight Y of the first target frequency is greater than or equal to 0, and the sum of X and Y is 1. Therefore, in the embodiment of the present application, the resonant frequency of the linear motor calculated during the second calibration process (i.e., the second calibration frequency) and the weight of the first target frequency determined based on the calculated resonant frequency of the linear motor (i.e., the first calibration frequency) during the last successful calibration before the second calibration frequency calibration can be adjusted by adjusting the values ​​of the weight parameters X and Y, thereby obtaining a second target frequency that approaches the true resonant frequency of the linear motor within a preset frequency range (e.g., 155 Hz-185 Hz). This allows the linear motor to be driven according to the determined second target frequency when the next calibration of the linear motor fails, thereby maintaining the vibration feel of the linear motor as much as possible under normal conditions. At the same time, it can also avoid the problem of weak vibration of the linear motor caused by driving the linear motor according to the factory-set resonant frequency (i.e., the preset initial frequency) when the linear motor calibration fails, when the true resonant frequency of the linear motor deviates significantly (exceeds the preset frequency range) due to aging or environmental factors (e.g., weightlessness). This improves the vibration effect of the linear motor and enhances the user experience. In addition, in the embodiment of the present application, the ratio of the weights X and Y is consistent with the weights calculated when the linear motor calibration fails previously. Moreover, when both X and Y are greater than 0, the difference between the determined second target frequency and the actual resonant frequency of the linear motor can gradually decrease as the number of successful linear motor calibrations increases. This ensures that the linear motor can be driven according to the determined first target frequency when the calibration fails next time to maintain the vibration effect of the linear motor, thereby improving the stability of the system and enhancing the user experience.

[0023] In one possible implementation, determining the weighted average of the first calibration frequency and the preset initial frequency as the first target frequency, or determining the weighted average of the first calibration frequency and the third target frequency as the first target frequency, may include: if X is equal to 1 and Y is equal to 0, determining the first calibration frequency as the first target frequency; and determining the weighted average of the second calibration frequency and the first target frequency as the second target frequency may include: if X is equal to 1 and Y is equal to 0, determining the second calibration frequency as the second target frequency.

[0024] In an embodiment of the present application, when the weight X of the resonant frequency calculated during the first calibration process (i.e., the first calibration frequency) is equal to 1, and the resonant frequency set at the factory for the linear motor (i.e., the preset initial frequency), or the weight Y of the third target frequency determined based on the calculated resonant frequency of the linear motor (i.e., the third calibration frequency) during the last successful calibration process before the linear motor is calibrated using the first calibration frequency, is equal to 0, then if the first calibration frequency calibration is successful, the first calibration frequency is used as the first target frequency that can be used to drive the linear motor when the next linear motor calibration fails. When the weight X of the resonant frequency calculated during the second calibration process (i.e., the second calibration frequency) is equal to 1, and the weight Y of the first target frequency determined based on the calculated resonant frequency of the linear motor (i.e., the first calibration frequency) during the last successful calibration process before the second calibration frequency calibration (i.e., the first calibration frequency calibration), is equal to 0, then if the second calibration frequency calibration is successful, the second calibration frequency is used as the second target frequency that can be used to drive the linear motor when the next linear motor calibration fails. Through the embodiments of the present application, when the linear motor calibration fails, the linear motor is directly driven according to the resonant frequency calculated when the linear motor calibration was successful last time. Therefore, as long as the linear motor has a successful calibration experience once, the vibration effect of the linear motor can be guaranteed each time the calibration fails subsequently, ensuring that the vibration feel will not change significantly when the calibration fails, thereby improving the stability of the system and enhancing the user experience.

[0025] In one possible implementation, determining the first target frequency based on the first calibration frequency may include: calculating the first calibration frequency and an average frequency value of K calibration frequencies, and determining the first target frequency based on the average frequency value; the K calibration frequencies are calibration frequencies corresponding to K successful calibrations before calibration with the first calibration frequency.

[0026] In an embodiment of the present application, an average frequency value is calculated based on the resonant frequency calculated during the first calibration process (i.e., the first calibration frequency) and the calibration frequencies corresponding to K successful calibrations before the first calibration frequency calibration (i.e., the K calibration frequencies) to determine a first target frequency that can be used to drive the linear motor when the next calibration fails. This effectively avoids the problem that, due to environmental factors (e.g., weightlessness) or calculation errors, the resonant frequency (e.g., the first calibration frequency) calculated during the most recent successful calibration of the linear motor suddenly changes significantly, resulting in a large difference between the determined frequency for driving the linear motor when the next calibration fails (e.g., the first target frequency) and the actual resonant frequency, thereby affecting the vibration effect of the linear motor. The frequency for driving the linear motor when the next calibration fails (for example, the first target frequency) determined by the embodiment of the present application can be closer to the actual resonant frequency of the linear motor while minimizing the impact of sudden large changes in the resonant frequency (for example, the first calibration frequency) calculated when the linear motor was most recently successfully calibrated due to environmental factors (for example, weightlessness) or calculation errors, on the frequency for driving the linear motor when the next calibration fails (for example, the first target frequency). This avoids unstable vibration feel of the linear motor due to a single calibration error, thereby improving system stability and enhancing user experience.

[0027] In a second aspect, the present application provides a linear motor calibration device, which is applied to an electronic device including a linear motor and may include:

[0028] a calibration unit, configured to calibrate the linear motor using a first calibration frequency and determine whether the linear motor is successfully calibrated at the first calibration frequency; the first calibration frequency being a resonant frequency of the linear motor calculated during the first calibration process;

[0029] a driving unit, configured to drive the linear motor according to the first calibration frequency if calibration of the first calibration frequency is successful;

[0030] a determining unit, configured to determine a first target frequency based on the first calibration frequency, and save the first target frequency;

[0031] The driving unit is further configured to stop driving the linear motor after driving the linear motor to vibrate for N cycles according to the first calibration frequency, wherein N is an integer greater than or equal to 0;

[0032] The calibration unit is further configured to calibrate the linear motor using a second calibration frequency and determine whether the linear motor is successfully calibrated at the second calibration frequency; the second calibration frequency is a resonant frequency of the linear motor calculated during the second calibration process;

[0033] The driving unit is further configured to drive the linear motor according to the first target frequency if calibration of the second calibration frequency fails.

[0034] In an embodiment of the present application, in a linear motor calibration device, a calibration unit first calibrates the linear motor using the resonant frequency of the linear motor calculated during a first calibration process (i.e., a first calibration frequency), and determines whether the linear motor is successfully calibrated at the first calibration frequency. If calibration at the first calibration frequency is successful, the linear motor is driven by a driving unit according to the determined first calibration frequency. Simultaneously, a determination unit determines a first target frequency based on the first calibration frequency and stores the first target frequency. Furthermore, after the driving unit drives the linear motor to vibrate for N cycles at the first calibration frequency, the driving unit stops driving the linear motor. The calibration unit then calibrates the linear motor using the resonant frequency of the linear motor calculated during a second calibration process (i.e., a second calibration frequency), and determines whether calibration at the second calibration frequency is successful. If calibration at the second calibration frequency fails, the linear motor is driven by the driving unit according to the first target frequency determined during the previous successful calibration. In the prior art, when a linear motor calibration fails, a fixed initial frequency value (e.g., 170 Hz) is assigned to the linear motor as the drive frequency, based on the resonant frequency set at the factory. If the linear motor's actual resonant frequency deviates significantly from the factory-set resonant frequency, this can easily lead to weak vibrations in the motor, impacting the vibration effect. Compared to the prior art, the present embodiment dynamically adjusts the first target frequency for driving the linear motor when calibration fails based on the resonant frequency determined during the last successful calibration of the linear motor (i.e., the first calibration frequency). This allows the first target frequency to gradually approach the linear motor's current actual resonant frequency as the number of calibrations increases, ensuring that the linear motor maintains normal vibration. Through the embodiments of the present application, it is possible to effectively solve the problem in the prior art that due to the influence of manufacturing tolerances of linear motors, device aging, etc., the actual resonant frequency of the linear motor during the calibration process is significantly different from the resonant frequency set at the factory (for example, 170Hz), and when the calibration fails, the linear motor is still driven according to the resonant frequency set at the factory, resulting in weak vibration of the linear motor. Therefore, during the linear motor calibration process, the driving frequency of the linear motor can be adaptively adjusted to improve the vibration effect of the linear motor, thereby enhancing the user experience.

[0035] In a possible implementation, before calibrating the linear motor using the first calibration frequency, the driving unit is further configured to:

[0036] After driving the linear motor to vibrate for M cycles at a first frequency, the driving of the linear motor is stopped; wherein the first frequency is included in a preset frequency range, and M is an integer greater than or equal to 0.

[0037] In a possible implementation, the calibration unit is specifically configured to:

[0038] Acquire a corresponding calibration frequency of the linear motor; the corresponding calibration frequency is the first calibration frequency or the second calibration frequency;

[0039] Determining whether the corresponding calibration frequency is within the preset frequency range;

[0040] If yes, it is determined that the corresponding calibration frequency is calibrated successfully;

[0041] If not, it is determined that the calibration of the corresponding calibration frequency has failed.

[0042] In one possible implementation, the first frequency is a preset initial frequency or a third calibration frequency, and the third calibration frequency is a resonant frequency of the linear motor calculated by a previous successful calibration before calibration at the first calibration frequency; the determining unit is specifically configured to:

[0043] In a case where the first frequency is the preset initial frequency, determining the first target frequency based on the first calibration frequency and the preset initial frequency;

[0044] In a case where the first frequency is the third calibration frequency, the first target frequency is determined based on the first calibration frequency and a third target frequency; and the third target frequency is obtained based on the third calibration frequency.

[0045] In a possible implementation, the driving unit is further configured to:

[0046] In a case where the first frequency is the preset initial frequency, if the first calibration frequency fails to calibrate, driving the linear motor according to the preset initial frequency;

[0047] In a case where the first frequency is the third calibration frequency, if the first calibration frequency fails to be calibrated, the linear motor is driven according to the third target frequency.

[0048] In a possible implementation, the driving unit is further configured to:

[0049] If the second calibration frequency calibration is successful, driving the linear motor according to the second calibration frequency;

[0050] The determining unit is further configured to:

[0051] A second target frequency is determined based on the second calibration frequency and the first target frequency, and the second target frequency is stored.

[0052] In a possible implementation, the determining unit is specifically configured to:

[0053] Determine a weighted average of the first calibration frequency and the preset initial frequency as the first target frequency; the weight of the first calibration frequency is X, and the weight of the initial frequency is Y, where X is greater than 0, Y is greater than or equal to 0, and the sum of X and Y is equal to 1;

[0054] Alternatively, a weighted average of the first calibration frequency and the third target frequency is determined as the first target frequency; the weight of the first calibration frequency is X, and the weight of the third target frequency is Y, where X is greater than 0, Y is greater than or equal to 0, and the sum of X and Y is equal to 1.

[0055] In a possible implementation, the determining unit is specifically configured to:

[0056] A weighted average of the second calibration frequency and the first target frequency is determined as the second target frequency; the weight of the second calibration frequency is X, and the weight of the first target frequency is Y, where X is greater than 0, Y is greater than or equal to 0, and the sum of X and Y is equal to 1.

[0057] In a possible implementation, the determining unit is specifically configured to:

[0058] If X is equal to 1 and Y is equal to 0, the first calibration frequency is determined as the first target frequency;

[0059] Alternatively, if X is equal to 1 and Y is equal to 0, the second calibration frequency is determined as the second target frequency.

[0060] In a possible implementation, the determining unit is specifically configured to:

[0061] The first calibration frequency and an average frequency value of K calibration frequencies are calculated, and a first target frequency is determined based on the average frequency value; the K calibration frequencies are calibration frequencies corresponding to K successful calibrations before calibration with the first calibration frequency.

[0062] In a third aspect, the present application provides an electronic device, which may include a linear motor, a processor and a memory, wherein the memory is used to store programs and various data, and the processor is used to call the program code stored in the memory so that the terminal device executes the method in any possible implementation of the first aspect above.

[0063] In a fourth aspect, the present application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method in any possible implementation of the first aspect.

[0064] In a fifth aspect, an embodiment of the present application provides a computer program, which may include instructions. When the computer program is run on a computer, the computer executes the method in any possible implementation of the first aspect above. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] Figure 1A This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.

[0066] Figure 1B This is an example block diagram of the software structure of an electronic device 100 provided in an embodiment of the present application.

[0067] Figure 2A Schematic diagram showing how the vibration amplitude of a linear motor provided in an embodiment of the present application varies with the driving frequency.

[0068] Figure 2B It is a flow chart of a linear motor calibration method in the prior art.

[0069] Figure 3 This is a flow chart of a method for calibrating a linear motor provided in an embodiment of the present application.

[0070] Figure 4A This is a specific flow chart of a linear motor calibration method provided in an embodiment of the present application.

[0071] Figure 4B This is a specific flow chart of another linear motor calibration method provided in an embodiment of the present application.

[0072] Figure 4C This is a specific flow chart of another linear motor calibration method provided in an embodiment of the present application.

[0073] Figure 5A This is a flow chart of another method for calibrating a linear motor provided in an embodiment of the present application.

[0074] Figure 5B This is a schematic diagram of the change between the frequency determined by calibrating a linear motor based on different weights and the number of motor calibration times provided in an embodiment of the present application.

[0075] Figure 5C This is a flow chart of another method for calibrating a linear motor provided in an embodiment of the present application.

[0076] Figure 6 It is a structural schematic diagram of a linear motor calibration device provided in an embodiment of the present application.

[0077] Figure 7This is a schematic diagram of the hardware structure of another electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0078] The embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application.

[0079] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments and are not intended to limit the embodiments of the present application. As used in the description of the embodiments of the present application and the appended claims, the singular expressions "one", "a kind of", "said", "above", "the", and "this" are intended to also include plural expressions, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in the embodiments of the present application refers to and includes any or all possible combinations of one or more listed items.

[0080] The terms "first," "second," "third," and "fourth," etc., in the specification and claims of this application and the accompanying drawings are used to distinguish between different objects, rather than to describe a specific order. In addition, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements, but may optionally include steps or elements not listed, or may optionally include other steps or elements inherent to the process, method, product, or apparatus.

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

[0082] The term "user interface (UI)" in the following embodiments of this application refers to a medium interface for interaction and information exchange between an application or operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. The user interface is a source code written in a specific computer language such as Java and extensible markup language (XML). The interface source code is parsed and rendered on an electronic device and finally presented as content that the user can recognize. The commonly used form of user interface is graphical user interface (GUI), which refers to a user interface related to computer operations that is displayed in a graphical manner. It can be a visual interface element such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc. displayed on the display screen of an electronic device.

[0083] First, some of the terms in this application are explained to help those skilled in the art understand the embodiments of this application.

[0084] (1) A motor is a device that converts electrical energy into mechanical energy through the principle of electromagnetic induction. It can also be called an electric motor or an electric motor. It is used in various devices and systems, such as mobile phones, CNC machine tools, and medical equipment. Among them, ordinary nonlinear motors rotate, and the magnetic field is switched by brushes to maintain the motor's rotation in one direction; while linear motors vibrate left and right, and the frequency and amplitude of their vibration can be controlled by a dedicated controller, directly converting electrical energy into linear motion mechanical energy.

[0085] (2) Motor material is a term in the field of manufacturing and supply chain management. This term usually refers to motor (electrical) parts or components obtained from suppliers or manufacturers in the supply chain.

[0086] (3) Resonant frequency refers to the frequency at which a physical system produces the maximum amplitude when subjected to external excitation. At this frequency, the system's response to external excitation becomes very significant, with the amplitude reaching its maximum value.

[0087] (4) The normal distribution is one of the most important continuous probability distributions in probability theory and statistics, also known as the Gaussian distribution. It is characterized by a bell-shaped curve, central symmetry, and a gradual decrease in both directions from the mean. When the sample size is large enough, the sample mean from any distribution will approximately follow a normal distribution. In manufacturing, the production process of each motor may be affected by various factors, but due to the complexity of the many influencing factors, the overall effect of these influencing factors may cause the sample mean to approximately follow a normal distribution.

[0088] In order to facilitate the introduction of the technical problems and application scenarios to be solved by this application, the electronic device involved in the embodiments of this application is introduced below.

[0089] Figure 1A A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown. The electronic device 100 can be used to execute the linear motor calibration method provided in an embodiment of the present application. It can be understood that the electronic device 100 is an intelligent terminal device, which can be of various types, and the embodiment of the present application does not limit its specific type. For example, it can be a mobile phone, and can also include a tablet computer, a desktop computer, a desktop computer with a touch-sensitive surface or touch panel, a laptop computer (laptop), a handheld computer, a notebook computer, a smart screen, a wearable device (such as a smart watch, a smart bracelet, etc.), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a car machine, a smart headset, a game console, and can also be an Internet of Things (IOT) device or a smart home device such as a smart water heater, a smart lamp, a smart air conditioner, etc. Please refer to Figure 1A , combined with Figure 1A The components of the electronic device 100 are described in detail.

[0090] Electronic device 100 may include a processor 101, memory 102, wireless communication module 103, mobile communication module 104, antenna 103A, antenna 104A, linear motor 105, linear motor controller 106, sensor module 107, camera 108, display 109, display controller 110, power management module 111, battery 112, etc. Sensor module 107 may include a gyroscope sensor 107A, an acceleration sensor 107B, an ambient light sensor 107C, an image sensor 107D, a distance sensor 107E, etc. Wireless communication module 103 may include a WLAN communication module, a Bluetooth communication module, etc. These multiple components may transmit data via a bus.

[0091] The processor 101 is the control center of the electronic device 100. It connects the various parts of the entire electronic device 100 using various interfaces and lines. It executes various functions of the electronic device 100 and processes data by running or executing software programs and / or modules stored in the memory 102, and calling data stored in the memory 102, thereby controlling the electronic device 100 as a whole. Optionally, the processor 101 may include one or more processing units. For example, the processor 101 may include an application processor (AP), a modem processor, a graphics processing unit (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). Among them, different processing units can be independent devices or integrated into one or more processors.

[0092] The memory 102 can be used to store software programs and modules. The processor 101 executes various functional applications and data processing of the electronic device 100 by running the software programs and modules stored in the memory 102. The memory 102 may include, but is not limited to, a read-only memory (ROM), a static random access memory (SRAM), a synchronous dynamic random access memory (SDRAM), or a random access memory (RAM). Furthermore, the memory 102 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.); and the data storage area may store data created according to the use of the electronic device 100 (such as audio data, a phone book, etc.). Optionally, the memory 102 may also be provided inside the processor 101 for storing instructions and data. In addition, the processor 101 can enable the electronic device 100 to execute the control method of the prior art and the control method provided in the embodiments of the present application, or other applications and data processing by running instructions stored in the memory 102.

[0093] The wireless communication function of the electronic device 100 can be implemented through the antenna 103A, the antenna 104A, the mobile communication module 104, the wireless communication module 103, the modem processor and the baseband processor.

[0094] Antenna 103A and antenna 104A can be used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.

[0095] The mobile communication module 104 can provide wireless communication solutions, including 2G / 3G / 4G / 5G, for the electronic device 100. The mobile communication module 104 can include at least one filter, a switch, a power amplifier, a low-noise amplifier (LNA), and the like. The mobile communication module 104 can receive electromagnetic waves through the antenna 104A, filter and amplify the received electromagnetic waves, and transmit them to the modem processor for demodulation. The mobile communication module 104 can also amplify the signals modulated by the modem processor and convert them into electromagnetic waves for radiation via the antenna 104A.

[0096] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium- or high-frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is passed to the application processor. The application processor outputs audio signals through an audio device or displays images or videos on the display screen 109.

[0097] The wireless communication module 103 can provide wireless communication solutions including wireless local area networks (WLAN), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc. applied to the electronic device 100. The wireless communication module 103 can be one or more devices integrating at least one communication processing module. The wireless communication module 103 receives electromagnetic waves via the antenna 103A, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 101. The wireless communication module 103 can also receive the signal to be sent from the processor 101, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 103A.

[0098] Linear motor 105, commonly known as a haptic feedback motor or vibration motor, converts electrical energy into linear mechanical energy, providing tactile feedback when a user interacts with a device. Examples include vibration prompts on a touch screen, button click feedback, and incoming call notification vibrations. During gaming, linear motors can be used to simulate various tactile sensations, such as equipment vibration and collision feedback, thereby enhancing gaming immersion.

[0099] The linear motor controller 106 may include a linear motor driver chip 106A for controlling the vibration effect of the linear motor 105. The linear motor driver chip 106A may be electrically connected to the linear motor 105. The linear motor driver chip 106A can simulate an alternating signal (alternating voltage) of any frequency using pulse width modulation (PWM) technology and supply it to the corresponding linear motor 105 via differential transmission. In other words, the linear motor driver chip 106A can apply drive voltages of different frequencies to the linear motor. Under any drive voltage frequency, the linear motor's coils can be energized and generate a corresponding magnetic field. Of course, drive voltages of different frequencies generate different magnetic fields. Under different magnetic fields, the linear motor's vibration frequency and amplitude vary, resulting in different vibration effects. It is understood that the linear motor achieves optimal vibration when the frequency corresponding to the drive voltage simulated by the linear motor driver chip 106A is equal to the resonant frequency of the linear motor.

[0100] The gyroscope sensor 107A can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyroscope sensor 107A. The gyroscope sensor 107A can be used for anti-shake shooting. For example, when the shutter is pressed, the gyroscope sensor 107A detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyroscope sensor 107A can also be used for navigation and somatosensory game scenes.

[0101] Accelerometer 107B can detect the magnitude of acceleration of electronic device 100 in all directions (generally three axes). When electronic device 100 is stationary, it can detect the magnitude and direction of gravity. It can also be used to identify the electronic device's posture. For example, accelerometer 107B can be used in applications such as landscape or portrait screen switching and pedometers.

[0102] The ambient light sensor 107C is used to sense the brightness of the ambient light. The electronic device 100 can adaptively adjust the brightness of the display screen 109 based on the sensed ambient light brightness. The ambient light sensor 107C can also be used to automatically adjust the white balance when taking pictures.

[0103] Image sensor 107D, also known as a photosensitive element, utilizes the photoelectric conversion function of a photoelectric device to convert the light image on the photosensitive surface into an electrical signal proportional to the light image. The image sensor can be a charge coupled device (CCD) sensor or a complementary metal oxide semiconductor (CMOS) sensor.

[0104] The distance sensor 107E can be used to measure distance. The electronic device 100 can measure distance using infrared or laser. In some shooting scenarios, the electronic device 100 can use the distance sensor 107E to measure distance to achieve fast focusing.

[0105] The electronic device 100 can implement a shooting function through an ISP, a camera 108, a video codec, a GPU, a display screen 109, and an application processor.

[0106] The ISP processes data fed back by camera 108. For example, when taking a photo, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, which is then passed to the ISP for processing and transformed into a visible image. The ISP can also perform algorithmic optimization on image noise and brightness. It can also optimize parameters such as exposure and color temperature of the captured scene. In some embodiments, the ISP can be located within camera 108.

[0107] The camera 108 can be used to capture still images or videos. An object's optical image is projected onto the image sensor through the lens. The image sensor converts the optical signal into an electrical signal, which is then transmitted to the ISP for conversion 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 format, such as RGB or YUV. In some embodiments, the electronic device 100 may include one or N cameras 108, where N is a positive integer greater than one.

[0108] Video codecs are used to compress or decompress digital images. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can open or save pictures or videos in multiple encoding formats.

[0109] Electronic device 100 can implement display functions through a GPU, display screen 109, and an application processor. A GPU is a microprocessor for image processing that connects display screen 109 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 101 may include one or more GPUs that execute program instructions to generate or modify display information.

[0110] Display screen 109 is used to display images, videos, etc. Display screen 109 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 (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, or a quantum dot light-emitting diode (QLED). In some embodiments, electronic device 100 may include one or N display screens 109, where N is a positive integer greater than 1.

[0111] The display controller 110, also known as an integrated circuit controller (ICC), can be used to control the image display, brightness, color, and other parameters on the display screen 109. The display controller 110 can be an electronic chip or integrated circuit that controls and manages the parameters of the display screen 109 to control the display's hardware functions, such as adjusting the display's brightness, rendering images, and generating the final image output. In some embodiments, a GPU may be integrated on the same chip as the display controller 110, but their functions are separate. The GPU can perform image calculations, while the display controller 110 manages the hardware characteristics of the display screen 109.

[0112] The power management module 111 can connect to the battery 112 to detect the status of the battery 112 and control the charging and discharging process to manage the power supply and power consumption of the electronic device 100 and ensure the safe and efficient use of the battery 112. In addition, the power management module 111 can also control the electronic device 100 to enter a sleep mode, turn off the display screen 109 by sending corresponding instructions to the display controller 110, and wake up the electronic device 100 when it needs to resume normal operation to reduce power consumption.

[0113] It should be understood that the structure illustrated in the embodiments of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0114] The software system of the electronic device 100 can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a microservice architecture, or a cloud architecture. In the embodiment of the present application, the layered architecture of the Android system is used as an example to illustrate the software structure of the electronic device 100.

[0115] Figure 1B This is an example block diagram of the software structure of an electronic device 100 provided in an embodiment of the present application.

[0116] The layered architecture divides software into several layers, each with a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the Android system may include an application layer, an application framework layer, an Android runtime (Android runtime) and system libraries, a hardware abstraction layer (HAL), a kernel layer, and a hardware layer. It should be noted that the embodiments of the present application are illustrated using the Android system as an example. In other operating systems, as long as the functions implemented by each functional module are similar to those of the embodiments of the present application, the solutions of the present application can also be implemented.

[0117] The application layer can include a series of application packages. Figure 1B As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, settings, music, lock screen application, short message, etc. It is understandable that the application layer may also include other application packages, such as payment applications, shopping applications, banking applications, chat applications, financial management applications and other third-party applications, which are not limited in this application.

[0118] The application framework layer provides an application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions. For example, it may include an activity manager, a window manager, a content provider, a view system, a resource manager, a notification manager, a vibration service, etc., which are not limited in this embodiment of the application. The vibration service is used to provide vibration-related support services.

[0119] The system library can include multiple functional modules, such as a surface manager, media libraries, a 3D graphics processing library (e.g., OpenGL ES), and a 2D graphics engine (e.g., SGL).

[0120] The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.

[0121] The media library supports playback and recording of a variety of common audio and video formats, as well as static image files. The media library can support a variety of audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0122] 3D graphics processing libraries (e.g. OpenGL ES) are used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0123] A 2D graphics engine (eg, SGL) is a drawing engine for 2D drawing.

[0124] The Android runtime consists of core libraries and a virtual machine (VM). The Android runtime is responsible for scheduling and management of the Android system. The core libraries consist of two parts: one for Java-based functions and the other for the Android core library. The application layer and application framework layer run in the VM. The VM executes Java files from the application and framework layers as binary files. The VM is responsible for managing object lifecycles, stack management, thread management, security and exception management, and garbage collection.

[0125] The hardware abstraction layer (HAL) is an encapsulation of the Linux kernel driver, providing an interface to the upper layer and shielding the implementation details of the underlying hardware. The hardware abstraction layer (HAL) may include a vibration HAL (vibrator HAL), a camera HAL (camera HAL), etc. Among them, the vibration HAL may include a type judgment module, etc. The type judgment module can obtain the default resonant frequency corresponding to the installed linear motor by reading the configuration file of the motor. In some embodiments, the default resonant frequency may be the resonant frequency of the linear motor in a single state, and in other embodiments, the above-mentioned default resonant frequency may also be the resonant frequency after the linear motor is assembled to the electronic device. The default resonant frequency mentioned in the subsequent embodiments may refer to the factory-set resonant frequency recorded in the linear motor configuration file, or it may be the resonant frequency successfully measured and saved each time the linear motor is calibrated after being assembled to the electronic device.

[0126] The kernel layer is the layer between hardware and software. It includes at least the display driver, audio driver, camera driver, and vibration driver. The vibration driver is a program that allows high-level computer software to interact with the hardware, essentially driving the linear motor.

[0127] The hardware layer may include memory, linear motor driver chips, and linear motors, etc. Among them, the motor driver chip is used to simulate the driving voltage for the linear motor to drive the linear motor to vibrate. The linear motor is used to vibrate to give the user a sense of vibration. Therefore, when the electronic device recognizes a business scenario that requires vibration (for example, a scenario in which an application installed in the electronic device is triggered to vibrate by business logic), the vibration HAL of the hardware abstraction layer can be called through the vibration service in the application framework layer. The vibration HAL then instructs the motor driver chip to drive the linear motor to vibrate through the vibration drive of the kernel layer.

[0128] Based on the above description of the electronic device 100, the technical problems to be specifically solved by this application are further proposed.

[0129] A linear motor is a device that converts electrical potential energy into mechanical energy. Specifically, when power is supplied to the linear motor, the coils within it are energized. This energization generates a magnetic field within the linear motor. This magnetic field causes the rotor in the linear motor to reciprocate in a specified direction, driving the linear motor to vibrate back and forth. Furthermore, after power is removed from the linear motor, due to inertia and spatial damping, the linear motor will continue to oscillate in a damped manner for a short period of time until it comes to a complete stop.

[0130] At present, linear motors have been widely used in various electronic devices due to their advantages such as strong vibration, crispness, and low energy consumption. In some embodiments, during operation, if an electronic device equipped with a linear motor identifies a business scenario that requires vibration (for example, a scenario in which an application installed in the electronic device triggers vibration by business logic), it can drive the corresponding linear motor to vibrate, thereby driving the electronic device to vibrate together. In this way, the electronic device can provide users with multiple types of vibration services in different business scenarios.

[0131] Taking a mobile phone equipped with a linear motor as an example, when the phone receives an incoming call, the phone can drive the linear motor to vibrate, providing a call reminder service; when the phone receives a message (such as a text message, application information, etc.), the phone can also drive the linear motor to vibrate, providing a message reminder service; when the phone's system time reaches the pre-configured alarm time, the phone can also drive the linear motor to vibrate, providing a vibration alarm; when the user uses the phone to play games, the linear motor can also be used to simulate different tactile sensations, such as equipment vibration, collision feedback, etc., thereby enhancing the immersiveness of the game. It can be seen that linear motors can be used in many scenarios in electronic devices and have become an indispensable component in electronic devices.

[0132] Furthermore, the electronic device can drive the corresponding linear motor by applying a driving voltage to the linear motor, energizing the coils in the linear motor and generating a magnetic field. This magnetic field then causes the linear motor to vibrate. It is understood that the electronic device can apply driving voltages of different frequencies to the linear motor to cause the linear motor to vibrate at different frequencies. For ease of description, the frequency of the driving voltage may be referred to as the driving frequency. Furthermore, applying driving voltages of different frequencies may also be referred to as driving the linear motor at different frequencies.

[0133] See Figure 2A , Figure 2A Schematic diagram showing the variation of the vibration amplitude of the linear motor according to the driving frequency provided in the embodiment of the present application. Figure 2A As shown in the figure, the vibration amplitudes that the linear motor can achieve are different at different driving frequencies. When the driving frequency reaches f0, the vibration amplitude of the linear motor can reach the maximum. Figure 2A f0 in the equation is the resonant frequency of the linear motor, also known as the natural frequency. It is the oscillation frequency of the linear motor itself. At this frequency, f0, applying the lowest drive voltage produces the optimal vibration effect, meaning the linear motor's vibration amplitude reaches its maximum. Conversely, if the linear motor is driven at a frequency higher or lower than the resonant frequency, the vibration amplitude will be too small, resulting in weak motor vibration that affects the user's feel.

[0134] In business scenarios where vibration is required, electronic devices typically drive the linear motor according to its resonant frequency to achieve optimal vibration. However, the linear motors used in electronic devices may be affected by various factors during the production process, resulting in a small tolerance between the actual resonant frequency of the produced linear motor and the resonant frequency set at the factory (i.e., the preset initial frequency). Alternatively, as the linear motor ages, its internal components (such as springs) may age or deform, causing these problems to cause the resonant frequency of the linear motor to change.

[0135] Therefore, before the electronic device activates the linear motor, it is necessary to calibrate the resonant frequency of the linear motor, which is also called linear motor calibration. Through linear motor calibration, the actual resonant frequency of the linear motor can be obtained. Figure 2B , Figure 2B This is a flow chart of a linear motor calibration method in the prior art. Figure 2B As shown, when an electronic device performs power-on calibration on a linear motor, it first determines whether the calibration is successful by checking whether the calibration value is within a preset frequency range (e.g., 155Hz-185Hz). If the calibration is successful, the calibration value becomes the actual resonant frequency of the linear motor. The calibration value is then output so that the linear motor is subsequently driven at the frequency of the calibration value during use to ensure that the linear motor maintains a good vibration effect. If the calibration fails, a fixed initial frequency value is output, which is usually the resonant frequency set by the linear motor at the factory, that is, the preset initial frequency (e.g., 170Hz) as the driving frequency of the linear motor. Due to manufacturing tolerances, component aging, etc. of the linear motor, the actual resonant frequency of the linear motor has shifted. At this time, driving the linear motor at the preset initial frequency (e.g., 170Hz) will cause the linear motor to vibrate weakly, resulting in a poor vibration effect, thereby reducing the user experience. Therefore, how to provide a more flexible and effective vibration calibration method that can adaptively adjust the driving frequency of the linear motor to improve the vibration effect of the linear motor when the actual resonant frequency of the linear motor shifts is an urgent problem to be solved.

[0136] Based on the above Figure 1A and Figure 1B The hardware and software architecture of the electronic device provided by the present invention specifically analyzes and solves the technical problems in the above-mentioned prior art.

[0137] See Figure 3 , Figure 3 This is a flow chart of a linear motor calibration method provided by an embodiment of the present application. This method can be applied to the above Figure 1AIn the electronic device, the above Figure 1B The software architecture in the implementation enables the electronic device to be used to support and execute Figure 3 The method flow steps shown are S301-S306.

[0138] Step S301: calibrating the linear motor using a first calibration frequency, and determining whether the linear motor is successfully calibrated at the first calibration frequency.

[0139] The first calibration frequency is the resonant frequency of the linear motor calculated during the first calibration process.

[0140] In a possible implementation, before calibrating the linear motor using the first calibration frequency, the method may further include: after driving the linear motor to vibrate for M cycles according to the first frequency, stopping driving the linear motor.

[0141] Specifically, before calibrating the linear motor at the first calibration frequency, the linear motor is driven to vibrate for M cycles at the first frequency, where the first frequency is within a preset frequency range, for example, 155 Hz to 185 Hz, and M is an integer greater than or equal to 0. This embodiment of the present application ensures that the linear motor can be used normally before calibration at the first calibration frequency, preventing a significant difference between the linear motor's drive frequency and its actual resonant frequency from affecting the vibration effect. It also prevents damage to the linear motor due to abnormal vibration, thereby maintaining a pleasant vibration feel for the linear motor and improving the success rate of subsequent calibration of the linear motor at the first calibration frequency, thereby enhancing the user experience.

[0142] Step S302: If the first calibration frequency is calibrated successfully, the linear motor is driven according to the first calibration frequency.

[0143] Specifically, if the resonant frequency of the linear motor calculated during the first calibration process (that is, the first calibration frequency) is calibrated successfully, the linear motor will be driven according to the first calibration frequency before the next calibration of the linear motor to ensure that the linear motor can achieve a better vibration effect during use, thereby ensuring the feel of the linear motor during use to enhance the user experience.

[0144] In one possible implementation, calibrating the linear motor using a first calibration frequency and determining whether the linear motor is successfully calibrated at the first calibration frequency may include: obtaining the first calibration frequency of the linear motor; determining whether the first calibration frequency is within a preset frequency range; if so, determining that the calibration of the first calibration frequency is successful; if not, determining that the calibration of the first calibration frequency is a failure.

[0145] Specifically, the embodiment of the present application first obtains the resonant frequency of the linear motor calculated in the first calibration process (that is, the first calibration frequency), and then determines whether the linear motor is successfully calibrated at the first calibration frequency by determining whether the first calibration frequency is within a preset frequency range (for example, 155Hz-185Hz). Furthermore, if the first calibration frequency is within the preset frequency range (for example, 155Hz-185Hz), it is determined that the first calibration frequency calibration is successful; if not, it is determined that the first calibration frequency calibration fails. Through the embodiment of the present application, it is possible to accurately determine whether the linear motor calibration is successful, and thus take corresponding measures to adjust the frequency of driving the linear motor so that the frequency of driving the linear motor is within a safe range (that is, the preset frequency range), thereby avoiding the driving frequency of the linear motor and the actual resonant frequency being too different and affecting the vibration effect. At the same time, it is also possible to avoid abnormal vibration of the linear motor and damage to the linear motor, while maintaining the vibration effect of the linear motor and improving the stability of the system.

[0146] Step S303: determining a first target frequency based on the first calibration frequency, and saving the first target frequency.

[0147] Specifically, when the resonant frequency of the linear motor (i.e., the first calibration frequency) calculated during the first calibration process is successfully calibrated, a first target frequency is determined based on the successfully calibrated first calibration frequency, and the determined first target frequency is saved. This allows for rapid determination of the linear motor's drive frequency and rapid restoration of the linear motor's operating state the next time the linear motor calibration fails. It should be noted that there is no specific order between steps S302 and S303 in this embodiment of the present application. That is, step S302 can be executed before, after, or simultaneously with step S303, and this is not limited in this embodiment of the present application.

[0148] Optionally, the first frequency is a preset initial frequency or a third calibration frequency; determining the first target frequency based on the first calibration frequency may include: when the first frequency is the preset initial frequency, determining the first target frequency based on the first calibration frequency and the preset initial frequency; when the first frequency is the third calibration frequency, determining the first target frequency based on the first calibration frequency and the third target frequency.

[0149] Specifically, the third calibration frequency is the resonant frequency of the linear motor calculated from the last successful calibration before calibration at the first calibration frequency. The third target frequency is obtained based on the third calibration frequency. Prior to calibrating the linear motor at the first calibration frequency, the first frequency used to drive the linear motor to vibrate for M cycles can be the resonant frequency set at the factory for the linear motor (i.e., the preset initial frequency) or the resonant frequency calculated from the last successful calibration before calibration at the first calibration frequency (i.e., the third calibration frequency). Specifically, when the first frequency is the preset initial frequency, calibrating the linear motor through the first calibration frequency can be the linear motor calibration performed when the electronic device is turned on for the first time after leaving the factory, or the linear motor calibration performed after the linear motor calibration fails when the electronic device is turned on for the first time after leaving the factory. Therefore, when the linear motor is successfully calibrated through the first calibration frequency, the first target frequency can be determined based on the resonant frequency calculated during the first calibration process of the linear motor (that is, the first calibration frequency) and the resonant frequency set when the linear motor leaves the factory (that is, the preset initial frequency), so that the determined first target frequency is closer to the actual resonant frequency of the linear motor within the normal range of the linear motor driving frequency (that is, the preset frequency range). When the first frequency is the frequency of the last successful calibration before the linear motor is calibrated by the first calibration frequency (that is, the third calibration frequency), then calibrating the linear motor by the first calibration frequency can be any calibration of the linear motor that has been successfully calibrated. Therefore, when the linear motor is successfully calibrated by the first calibration frequency, the first target frequency can be determined based on the resonant frequency calculated in the first calibration process of the linear motor (that is, the first calibration frequency) and the third target frequency determined based on the calculated resonant frequency of the linear motor (that is, the third calibration frequency) during the last successful calibration before the linear motor is calibrated by the first calibration frequency, which is closer to the true resonant frequency of the linear motor. Such that the determined first target frequency is closer to the true resonant frequency of the linear motor within the normal range of the linear motor driving frequency (that is, the preset frequency range). Through the embodiments of the present application, the frequency of driving the linear motor can be continuously adjusted according to the calibration frequency calculated by the most recent successful calibration of the linear motor, so that when the linear motor calibration fails next time, the determined first target frequency close to the true resonant frequency of the linear motor is used as the driving frequency of the linear motor, thereby improving the vibration effect of the linear motor, maintaining the feel of the linear motor and enhancing the user experience.

[0150] In one possible implementation, determining the first target frequency based on the first calibration frequency and the preset initial frequency may include: determining the weighted average of the first calibration frequency and the preset initial frequency as the first target frequency; determining the first target frequency based on the first calibration frequency and the third target frequency may include: determining the weighted average of the first calibration frequency and the third target frequency as the first target frequency.

[0151] The weight of the first calibration frequency is X, and the weight of the preset initial frequency or the third target frequency is Y, where X is greater than 0, Y is greater than or equal to 0, and the sum of X and Y is equal to 1. Specifically, when, before calibrating the linear motor using the first calibration frequency, the first frequency at which the linear motor is driven to vibrate for M cycles is the resonant frequency set at the factory for the linear motor (i.e., the preset initial frequency), a weighted average of the resonant frequency calculated during the first calibration process (i.e., the first calibration frequency) and the resonant frequency set at the factory for the linear motor (i.e., the preset initial frequency) can be used as the frequency at which the linear motor is driven when the next calibration fails (i.e., the first target frequency). The weight X of the first calibration frequency is greater than 0, the weight Y of the preset initial frequency is greater than or equal to 0, and the sum of X and Y is 1. Therefore, by adjusting the values ​​of the weight parameters X and Y, the resonant frequency of the linear motor calculated in the first calibration process (that is, the first calibration frequency) and the weight of the resonant frequency set at the factory for the linear motor (that is, the preset initial frequency) can be adjusted to obtain a first target frequency that is close to the true resonant frequency of the linear motor within a preset frequency range (for example, 155Hz-185Hz). This allows the linear motor to be driven according to the determined first target frequency when the linear motor calibration fails next time, thereby maintaining the feel of the motor in a normal state as much as possible. This effectively avoids the problem of weak vibration of the linear motor caused by the linear motor being driven uniformly according to the factory-set resonant frequency (that is, the preset initial frequency) when the true resonant frequency of the linear motor deviates significantly (exceeding the preset frequency range) due to aging or environmental factors (such as weightlessness). This thereby improves the vibration effect of the linear motor and enhances the user experience.

[0152] When, before the linear motor is calibrated using the first calibration frequency, the first frequency at which the linear motor is driven to vibrate for M cycles is the frequency of the last successful calibration before the linear motor is calibrated using the first calibration frequency (that is, the third calibration frequency), a weighted average of the resonant frequency calculated during the first calibration process (that is, the first calibration frequency) and a third target frequency determined based on the calculated resonant frequency of the linear motor during the last successful calibration process before the linear motor is calibrated using the first calibration frequency (that is, the third calibration frequency) can be used as the frequency (that is, the first target frequency) at which the linear motor is driven when the next calibration of the linear motor fails, wherein the weight X of the first calibration frequency is greater than 0, the weight Y of the third target frequency is greater than or equal to 0, and the sum of X and Y is 1. Therefore, by adjusting the values ​​of the weight parameters X and Y, the resonant frequency of the linear motor calculated during the first calibration process (i.e., the first calibration frequency) and the weight of the third target frequency determined based on the calculated resonant frequency of the linear motor during the last successful calibration before the first calibration frequency calibration (i.e., the third calibration frequency) can be adjusted to obtain a first target frequency that approaches the true resonant frequency of the linear motor within a preset frequency range (e.g., 155 Hz-185 Hz). This allows the linear motor to be driven according to the determined first target frequency when the next calibration of the linear motor fails, thereby maintaining a normal vibration feel. At the same time, it can also avoid the problem of weak vibration of the linear motor caused by driving the linear motor according to the factory-set resonant frequency (i.e., the preset initial frequency) when the true resonant frequency of the linear motor deviates significantly (exceeding the preset frequency range) due to aging or environmental factors (e.g., weightlessness). This can thereby improve the vibration effect of the linear motor and enhance the user experience.

[0153] In addition, through the embodiment of the present application, the ratio of weights X and Y can be adjusted to adjust the speed at which the frequency (that is, the first target frequency) determined for driving the linear motor when the next calibration of the linear motor fails converges with the actual resonant frequency of the linear motor. At the same time, the weights of the initial frequency and the third target frequency are preset to be consistent, which can ensure that the speed at which the determined first target frequency converges with the actual resonant frequency of the linear motor remains unchanged, so that the difference between the first target frequency and the actual resonant frequency of the linear motor gradually decreases as the number of successful linear motor calibrations increases. Therefore, when the next calibration fails, driving the linear motor according to the determined first target frequency can maintain the vibration effect of the linear motor, thereby improving the stability of the system and enhancing the user experience.

[0154] Optionally, determining a weighted average of the first calibration frequency and a preset initial frequency as the first target frequency, or determining a weighted average of the first calibration frequency and a third target frequency as the first target frequency may include: if X is equal to 1 and Y is equal to 0, determining the first calibration frequency as the first target frequency.

[0155] Specifically, if the weight X of the resonant frequency calculated during the first calibration process (i.e., the first calibration frequency) is equal to 1, and the resonant frequency set at the factory for the linear motor (i.e., the preset initial frequency), or the weight Y of the third target frequency determined based on the resonant frequency of the linear motor calculated during the last successful calibration process before the linear motor was calibrated using the first calibration frequency, is equal to 0, then if the first calibration frequency is successfully calibrated, the first calibration frequency is used as the first target frequency for driving the linear motor when the next linear motor calibration fails. According to embodiments of the present application, when the linear motor calibration fails, the linear motor is driven directly according to the resonant frequency calculated during the last successful linear motor calibration. Therefore, as long as the linear motor has a successful calibration experience, the vibration effect of the linear motor can be guaranteed for each subsequent calibration failure, ensuring that the vibration feel does not significantly change when the calibration fails, thereby improving system stability and enhancing the user experience.

[0156] Optionally, determining the first target frequency based on the first calibration frequency may include: calculating the first calibration frequency and an average frequency value of K calibration frequencies, and determining the first target frequency based on the average frequency value.

[0157] Specifically, the K calibration frequencies are the calibration frequencies corresponding to the K successful calibrations prior to the first calibration frequency calibration. The resonant frequency calculated during the first calibration process (i.e., the first calibration frequency) and the calibration frequencies corresponding to the K successful calibrations prior to the first calibration frequency calibration (i.e., the K calibration frequencies) are used to calculate an average frequency value to determine the first target frequency that can be used to drive the linear motor when the next calibration fails. This effectively avoids the problem that, due to environmental factors (e.g., weightlessness) or calculation errors, the resonant frequency (e.g., the first calibration frequency) calculated during the most recent successful calibration of the linear motor suddenly changes significantly, resulting in a significant difference between the determined frequency for driving the linear motor (e.g., the first target frequency) and the actual resonant frequency when the next calibration fails, thus affecting the vibration effect of the linear motor. The frequency for driving the linear motor when the next calibration fails (for example, the first target frequency) determined by the embodiment of the present application can be closer to the actual resonant frequency of the linear motor while minimizing the impact of sudden large changes in the resonant frequency (for example, the first calibration frequency) calculated when the linear motor was most recently successfully calibrated due to environmental factors (for example, weightlessness) or calculation errors, on the frequency for driving the linear motor when the next calibration fails (for example, the first target frequency). This avoids unstable vibration feel of the linear motor due to a single calibration error, thereby improving system stability and enhancing user experience.

[0158] In one possible implementation, the above method also includes: when the first frequency is a preset initial frequency, if the first calibration frequency calibration fails, driving the linear motor according to the preset initial frequency; when the first frequency is a third calibration frequency, if the first calibration frequency calibration fails, driving the linear motor according to the third target frequency.

[0159] Specifically, since the first frequency that drives the linear motor to vibrate M cycles before the linear motor is calibrated by the first calibration frequency can be the resonant frequency set when the linear motor leaves the factory (that is, the preset initial frequency), or it can be the resonant frequency of the linear motor calculated by the last successful calibration before the calibration with the first calibration frequency (that is, the third calibration frequency), therefore, when the first frequency is the resonant frequency set when the linear motor leaves the factory (that is, the preset initial frequency), calibrating the linear motor by the first calibration frequency can be the linear motor calibration performed when the electronic device is turned on for the first time after leaving the factory, or it can be the linear motor calibration performed after the linear motor calibration fails when the electronic device is turned on for the first time after leaving the factory. Furthermore, if the first calibration frequency calibration fails, the linear motor is driven according to a preset initial frequency (for example, 170 Hz), so that when the electronic device fails to calibrate the linear motor for the first time or fails to calibrate the linear motor continuously for the first time due to manufacturing tolerances or motor hardware link abnormalities, the frequency of driving the linear motor can be automatically retracted to the resonant frequency set when the linear motor leaves the factory (that is, the preset initial frequency), ensuring that the linear motor can operate normally to enhance the user experience; accordingly, when the first frequency is the resonant frequency of the linear motor calculated by the last successful calibration before the first calibration frequency calibration (that is, the third calibration frequency), calibrating the linear motor by the first calibration frequency can be any calibration of a linear motor that has been successfully calibrated. Furthermore, if the first calibration frequency fails, the linear motor is driven according to a third target frequency obtained based on the third calibration frequency, so that the electronic device can drive the linear motor according to the third target frequency determined based on the resonant frequency of the linear motor calculated when the linear motor was last successfully calibrated (that is, the third calibration frequency), which is closer to the true resonant frequency of the linear motor, so as to maintain the vibration effect of the linear motor; at the same time, it avoids the problem of weak vibration of the linear motor caused by the actual resonant frequency of the linear motor during the calibration process being significantly different from the resonant frequency set at the factory (that is, the preset initial frequency) due to the influence of manufacturing tolerances of the linear motor, device aging, etc., and the linear motor is still driven using the resonant frequency set at the factory (that is, the preset initial frequency) when the calibration fails. As the number of successful calibrations of the linear motor increases, the third target frequency determined by the electronic device based on the resonant frequency of the linear motor calculated when the linear motor was last successfully calibrated (that is, the third calibration frequency) can gradually fit the true resonant frequency of the true linear motor, thereby improving the vibration effect of the linear motor and enhancing the user experience.

[0160] Step S304 : After driving the linear motor to vibrate for N cycles according to the first calibration frequency, stopping driving the linear motor.

[0161] Specifically, N is an integer greater than or equal to 0. If the resonant frequency of the linear motor calculated during the first calibration process (i.e., the first calibration frequency) is successfully calibrated, the electronic device drives the linear motor to vibrate for N cycles at the first calibration frequency, and stops driving the linear motor until the next calibration of the linear motor (i.e., calibration at the second calibration frequency).

[0162] Step S305: calibrating the linear motor using a second calibration frequency, and determining whether the linear motor is successfully calibrated at the second calibration frequency.

[0163] Specifically, after the electronic device drives the linear motor to vibrate for N cycles according to the first calibration frequency, the linear motor is calibrated using the second calibration frequency. At the same time, based on the resonant frequency of the linear motor calculated during the second calibration process (that is, the second calibration frequency), it is determined whether the linear motor is successfully calibrated at the second calibration frequency.

[0164] In one possible implementation, calibrating the linear motor using a second calibration frequency and determining whether the linear motor is successfully calibrated at the second calibration frequency may include: obtaining the second calibration frequency of the linear motor; determining whether the second calibration frequency is within a preset frequency range; if so, determining that the calibration of the second calibration frequency is successful; if not, determining that the calibration of the second calibration frequency is a failure.

[0165] Specifically, the embodiment of the present application first obtains the resonant frequency of the linear motor calculated in the second calibration process (that is, the second calibration frequency), and then determines whether the linear motor is successfully calibrated at the second calibration frequency by determining whether the second calibration frequency is within a preset frequency range (for example, 155Hz-185Hz). Furthermore, if the second calibration frequency is within the preset frequency range (for example, 155Hz-185Hz), it is determined that the second calibration frequency calibration is successful; if not, it is determined that the second calibration frequency calibration fails. Through the embodiment of the present application, it is possible to accurately determine whether the linear motor calibration is successful, and thus take corresponding measures to adjust the frequency of driving the linear motor so that the frequency of driving the linear motor is within a safe range (that is, the preset frequency range), thereby avoiding the driving frequency of the linear motor and the actual resonant frequency being too different and affecting the vibration effect. At the same time, it is also possible to avoid abnormal vibration of the linear motor and damage to the linear motor, while maintaining the vibration effect of the linear motor and improving the stability of the system.

[0166] Step S306 : If the second calibration frequency fails, driving the linear motor according to the first target frequency.

[0167] Specifically, when the resonant frequency of the linear motor calculated during the second calibration process (i.e., the second calibration frequency) fails to calibrate, the linear motor is driven according to the first target frequency determined during the previous successful calibration. This ensures that a reliable drive frequency (i.e., the first target frequency) can be quickly assigned to the linear motor when the linear motor calibration fails. This quickly restores the linear motor's operating state while maintaining the vibration feel of the linear motor under normal operating conditions as much as possible, thereby improving system stability. In the prior art, when a linear motor calibration fails, a fixed initial frequency value (e.g., 170 Hz) is assigned to the linear motor as the drive frequency based on the resonant frequency set at the factory. When the actual resonant frequency of the linear motor deviates significantly from the factory-set resonant frequency, this can easily lead to weak vibration of the motor, affecting the vibration effect. Compared to the prior art, the present embodiment can dynamically adjust the first target frequency of the linear motor when the calibration fails based on the resonant frequency determined during the previous successful calibration of the linear motor (i.e., the first calibration frequency). This allows the first target frequency to gradually approach the current actual resonant frequency of the linear motor as the calibration number increases, ensuring that the linear motor maintains normal vibration. Through the embodiments of the present application, it is possible to effectively solve the problem in the prior art that due to the influence of manufacturing tolerances of linear motors, device aging, etc., the actual resonant frequency of the linear motor during the calibration process is significantly different from the resonant frequency set at the factory (for example, 170Hz), and when the calibration fails, the linear motor is still driven according to the resonant frequency set at the factory, resulting in weak vibration of the linear motor. Therefore, during the linear motor calibration process, the driving frequency of the linear motor can be adaptively adjusted to improve the vibration effect of the linear motor, thereby enhancing the user experience.

[0168] In a possible implementation, the method further includes: if the second calibration frequency is calibrated successfully, driving the linear motor according to the second calibration frequency; determining a second target frequency based on the second calibration frequency and the first target frequency, and saving the second target frequency.

[0169] Specifically, when the electronic device successfully calibrates the linear motor through the resonant frequency of the linear motor calculated in the second calibration process (that is, the second calibration frequency), that is, when the second calibration frequency is within the preset frequency range (for example, 155Hz-185Hz), then before the next calibration of the linear motor, the linear motor is driven according to the resonant frequency of the linear motor calculated in the second calibration process (that is, the second calibration frequency) to ensure that the linear motor can achieve a better vibration effect during use, thereby ensuring the feel of the linear motor during use to enhance the user experience; at the same time, based on the second calibration frequency calculated when the linear motor is successfully calibrated in the second calibration process, and through the The second calibration frequency is used to calibrate the linear motor during the last successful calibration before the first target frequency that is closer to the actual resonant frequency of the linear motor is determined based on the calculated resonant frequency of the linear motor (that is, the first calibration frequency). The latest second target frequency that is closer to the actual resonant frequency of the linear motor within the normal range of the linear motor driving frequency (that is, the preset frequency range) can be determined, and the determined second target frequency can be saved. In order to facilitate the use of the latest second target frequency that is close to the actual resonant frequency of the linear motor as the driving frequency of the linear motor when the linear motor calibration fails next time, thereby improving the vibration effect of the linear motor, maintaining the feel of the linear motor, and enhancing the user experience.

[0170] Optionally, determining the second target frequency based on the second calibration frequency and the first target frequency may include: determining a weighted average of the second calibration frequency and the first target frequency as the second target frequency.

[0171] Among them, the weight of the second calibration frequency is X, the weight of the first target frequency is Y, X is greater than 0, Y is greater than or equal to 0, and the sum of X and Y is equal to 1. Specifically, the resonant frequency calculated in the second calibration process (that is, the second calibration frequency) is used as the weighted average of the first target frequency determined based on the resonant frequency of the linear motor calculated in the last successful calibration (that is, the first calibration frequency calibration) before the second calibration frequency calibration, and the calculated resonant frequency of the linear motor (that is, the first calibration frequency) in the last successful calibration before the second calibration frequency calibration. The frequency to drive the linear motor when the next calibration of the linear motor fails (that is, the second target frequency) can be adjusted by adjusting the values ​​of the weight parameters X and Y. The weight of the first target frequency determined by the linear motor calibration (i.e., the initial frequency) is used to obtain a second target frequency within a preset frequency range (e.g., 155 Hz-185 Hz) that approaches the true resonant frequency of the linear motor. This allows the linear motor to be driven at the second target frequency when the next calibration fails, thereby maintaining the vibration feel of the linear motor as much as possible. This also prevents the linear motor from vibrating weakly when the linear motor calibration fails, which can occur when the linear motor is driven at the factory-set resonant frequency (i.e., the preset initial frequency) if the true resonant frequency of the linear motor shifts significantly (exceeding the preset frequency range) due to aging or environmental factors (e.g., weightlessness). This improves the vibration effect of the linear motor and enhances the user experience. Furthermore, in this embodiment of the present application, the ratio of the weights X and Y is consistent with the weights calculated when the linear motor calibration fails previously. When both X and Y are greater than 0, the difference between the second target frequency and the true resonant frequency of the linear motor gradually decreases as the number of successful linear motor calibrations increases. This ensures that the linear motor can be driven at the first target frequency when the next calibration fails to maintain the vibration effect of the linear motor, thereby improving system stability and enhancing the user experience.

[0172] In a possible implementation, determining a weighted average of the second calibration frequency and the first target frequency as the second target frequency may include: if X is equal to 1 and Y is equal to 0, determining the second calibration frequency as the second target frequency.

[0173] Specifically, when the weight X of the resonant frequency calculated during the second calibration process (i.e., the second calibration frequency) is equal to 1, and the weight Y of the first target frequency determined based on the resonant frequency of the linear motor calculated during the last successful calibration (i.e., the first calibration frequency) before the second calibration frequency calibration is equal to 0, if the second calibration frequency calibration is successful, the second calibration frequency is used as the second target frequency that can be used to drive the linear motor when the next linear motor calibration fails. According to the embodiments of the present application, when the linear motor calibration fails, the linear motor is directly driven according to the resonant frequency calculated during the last successful linear motor calibration. Therefore, as long as the linear motor has a successful calibration experience, the vibration effect of the linear motor can be guaranteed for each subsequent calibration failure, ensuring that the vibration feel does not change significantly when the calibration fails, thereby improving the stability of the system and enhancing the user experience.

[0174] For example, see Figure 4A , Figure 4A This is a specific flow chart of a linear motor calibration method provided by an embodiment of the present application. This method can be applied to the above Figure 1A In the electronic device, the above Figure 1B The software architecture in the implementation enables the electronic device to be used to support and execute Figure 4A The method flow steps shown are S4A01-S4A15.

[0175] It should be noted that in the embodiment of the present application, the calibration of the linear motor can be set during the power-on phase of the electronic device. Of course, the calibration of the linear motor can also be set at other time stages, for example, during the period when the linear motor is driven to vibrate triggered by a business scenario. In short, the embodiment of the present application does not specifically limit this. For the sake of convenience, the subsequent embodiments mainly take the calibration of the linear motor triggered during the power-on phase as an example to introduce the specific implementation details of the linear motor calibration method provided by the embodiment of the present application.

[0176] Step S4A01: the linear motor driving chip drives the linear motor to vibrate for M cycles at a first frequency, and then stops driving the linear motor.

[0177] Specifically, before calibrating the linear motor using the first calibration frequency, the linear motor is driven to vibrate for M cycles at the first frequency, and the first frequency is within a preset frequency range, for example, 155Hz-185Hz. In some embodiments, the first frequency can be the resonant frequency set at the factory for the linear motor (that is, the preset initial frequency), or it can be the resonant frequency calculated from the last successful calibration before calibrating the linear motor using the first calibration frequency (that is, the third calibration frequency). For a detailed description of step S4A01, please refer to the above Figure 3The relevant description of step S301 is not repeated here.

[0178] Step S4A02: The system service receives a boot instruction.

[0179] In some embodiments, the above-mentioned instruction to power on can be triggered by the user. For example, when the user clicks the power button of the electronic device, the instruction to power on can be triggered. In other embodiments, the above-mentioned instruction to power on can also be automatically generated when the system time reaches a specified time point. For example, an automatic power-on time is pre-configured, that is, at a specified time point, when the system time reaches the automatic power-on time and the electronic device is in the off state, the electronic device can automatically generate the instruction to power on.

[0180] Step S4A03: The system service sends a calibration instruction to the vibration driver.

[0181] In some embodiments, after receiving a power-on instruction, the system service initiates a power-on process. The power-on process includes a linear motor calibration step. Thus, after the power-on process enters the linear motor calibration step, the system service can send a calibration instruction to the vibration driver via the vibration service, instructing the vibration driver to initiate calibration of the linear motor.

[0182] Step S4A04: Vibration drive obtains a first calibration frequency of the linear motor.

[0183] In some embodiments, the vibration driver may obtain the resonant frequency of the linear motor (ie, the first calibration frequency) calculated in the first calibration process through the linear motor driver chip in response to the instruction instructing calibration.

[0184] Step S4A05: The vibration driver determines whether the first calibration frequency is within a preset frequency range.

[0185] Furthermore, after obtaining the first calibration frequency of the linear motor, the vibration driver determines whether the linear motor is successfully calibrated at the first calibration frequency by determining whether the first calibration frequency is within a preset frequency range (eg, 155 Hz-185 Hz).

[0186] Step S4A06: If yes, the vibration drive is determined to be calibrated successfully at the first calibration frequency.

[0187] Furthermore, if the first calibration frequency is within a preset frequency range (eg, 155 Hz-185 Hz), the vibration drive determines that the first calibration frequency calibration is successful.

[0188] Specifically, the above steps S4A04 to S4A06 are about how the vibration drive calibrates the linear motor through the first calibration frequency and determines whether the linear motor is calibrated successfully at the first calibration frequency. Figure 3 The relevant description of step S301 is not repeated here.

[0189] Step S4A07: If the first calibration frequency is calibrated successfully, the linear motor driving chip drives the linear motor according to the first calibration frequency.

[0190] Specifically, for a detailed description of the linear motor driving chip driving the linear motor according to the first calibration frequency in step S4A07, please refer to the above Figure 3 The relevant description of step S302 in will not be repeated here.

[0191] Step S4A08: The vibration driver determines a first target frequency based on the first calibration frequency, and saves the first target frequency.

[0192] In some embodiments, when the first frequency is a preset initial frequency, the first target frequency is determined based on the resonant frequency calculated during the first calibration process of the linear motor (i.e., the first calibration frequency) and the resonant frequency set at the factory for the linear motor (i.e., the preset initial frequency). When the first frequency is the frequency of the last successful calibration before the linear motor is calibrated using the first calibration frequency (i.e., the third calibration frequency), the first target frequency is determined based on the resonant frequency calculated during the first calibration process of the linear motor (i.e., the first calibration frequency) and a third target frequency that is closer to the true resonant frequency of the linear motor and is determined based on the resonant frequency of the linear motor calculated during the last successful calibration before the linear motor is calibrated using the first calibration frequency (i.e., the third calibration frequency). In other embodiments, the first target frequency, which can be used to drive the linear motor when the next calibration fails, is determined by calculating an average frequency value between the resonant frequency calculated during the first calibration process (i.e., the first calibration frequency) and the calibration frequencies corresponding to K successful calibrations before the calibration using the first calibration frequency (i.e., the K calibration frequencies). Specifically, for a detailed description of how the vibration drive determines the first target frequency based on the first calibration frequency in the above step S4A08, please refer to the above Figure 3 It should be understood that there is no clear order between step S4A07 and step S4A08 in the embodiment of the present application. Step S4A07 can be executed before or after step S4A08, or can be executed simultaneously. The embodiment of the present application does not limit this.

[0193] Step S4A09 : After the linear motor driving chip drives the linear motor to vibrate for N cycles according to the first calibration frequency, the linear motor driving chip stops driving the linear motor.

[0194] Specifically, for a detailed description of step S4A09, please refer to the above Figure 3 The relevant description of step S302 in will not be repeated here.

[0195] Step S4A10: The system service receives the boot instruction again.

[0196] Step S4A11: The system service sends a calibration instruction to the vibration driver.

[0197] Specifically, the detailed description of step S4A10-step S4A11 is similar to the specific method described in the above steps S4A02-step S4A03, and will not be repeated here.

[0198] Step S4A12: Vibration drive obtains a second calibration frequency of the linear motor.

[0199] Step S4A13: Vibration driving determines whether the second calibration frequency is within the preset frequency range.

[0200] Step S4A14: If not, the vibration drive is determined to be a second calibration frequency calibration failure.

[0201] Specifically, the above steps S4A12 to S4A14 are about how the vibration drive calibrates the linear motor through the second calibration frequency and determines whether the linear motor is successfully calibrated at the second calibration frequency. Figure 3 The relevant description of step S305 is not repeated here.

[0202] Step S4A15: If the second calibration frequency fails, the linear motor driving chip drives the linear motor according to the first target frequency.

[0203] Specifically, for a detailed description of step S4A15, please refer to the above Figure 3 The relevant description of step S306 in will not be repeated here.

[0204] For example, see Figure 4B , Figure 4B This is a specific flow chart of another linear motor calibration method provided by the embodiment of the present application. This method can be applied to the above Figure 1A In the electronic device, the above Figure 1B The software architecture in the implementation enables the electronic device to be used to support and execute Figure 4B The method flow steps shown are S4B01-S4B07.

[0205] Step S4B01 : the linear motor driving chip drives the linear motor to vibrate for M cycles at a first frequency, and then stops driving the linear motor.

[0206] Step S4B02: The system service receives a boot instruction.

[0207] Step S4B03: The system service sends a calibration instruction to the vibration driver.

[0208] Step S4B04: Vibration drive obtains a first calibration frequency of the linear motor.

[0209] Step S4B05: The vibration driver determines whether the first calibration frequency is within a preset frequency range.

[0210] Specifically, the description of the above steps S4B01 to S4B05 can be found in the above Figure 4A The relevant descriptions of steps S4A01 to S4A05 in the description will not be repeated here.

[0211] Step S4B06: If not, the vibration drive is determined to be a first calibration frequency calibration failure.

[0212] Specifically, if the resonant frequency (ie, the first calibration frequency) calculated during the first calibration process of the linear motor is within a preset frequency range (eg, 155 Hz-185 Hz), the vibration drive determines that the first calibration frequency calibration is successful.

[0213] Step S4B07: If the first calibration frequency calibration fails, the linear motor driving chip drives the linear motor according to the first frequency.

[0214] Specifically, for a detailed description of the linear motor driving chip driving the linear motor according to the first frequency in step S4B07, please refer to the above Figure 3 The relevant description of step S302 in will not be repeated here.

[0215] For example, see Figure 4C , Figure 4C This is a specific flow chart of another linear motor calibration method provided by the embodiment of the present application. This method can be applied to the above Figure 1A In the electronic device, the above Figure 1B The software architecture in the method may include the above steps S4A01 to S4A09, and after steps S4A01 to S4A09, may further include the following steps S4C10 to S4C16.

[0216] Step S4C10: The system service receives the boot instruction again.

[0217] Step S4C11: The system service sends a calibration instruction to the vibration driver.

[0218] Step S4C12: Vibration drive obtains a second calibration frequency of the linear motor.

[0219] Step S4C13: Vibration driving determines whether the second calibration frequency is within the preset frequency range.

[0220] Specifically, for the description of the above steps S4C10 to S4C13, please refer to the above Figure 4A The relevant descriptions of steps S4A10 to S4A13 in the above description will not be repeated here.

[0221] Step S4C14: If yes, the vibration drive is determined to be calibrated successfully at the second calibration frequency.

[0222] Specifically, if the resonant frequency of the linear motor calculated in the second calibration process of the linear motor (ie, the second calibration frequency) is within a preset frequency range (eg, 155 Hz-185 Hz), the vibration drive determines that the first calibration frequency calibration is successful.

[0223] Step S4C15: If the second calibration frequency is calibrated successfully, the linear motor driver chip drives the linear motor according to the second calibration frequency.

[0224] Step S4C16: The vibration driver determines a second target frequency based on the second calibration frequency and the first target frequency, and saves the second target frequency.

[0225] Specifically, regarding steps S4C15-S4C16, when the second calibration frequency is successful, the linear motor driver chip drives the linear motor according to the second calibration frequency, and the vibration driver determines the second target frequency based on the second calibration frequency and the first target frequency, and saves the detailed description of the second target frequency, please refer to the above Figure 3 The relevant description of step S306 in will not be repeated here.

[0226] For example, see Figure 5A , Figure 5A This is a flow chart of another linear motor calibration method provided in an embodiment of the present application. This method can be applied to the above Figure 1A In the electronic device, the above Figure 1B The software architecture is implemented in the embodiment of the present invention, so that the electronic device can be used to implement the above Figure 3 Steps S301-S306 of the method embodiment shown, or Figures 4A-4C Part or all of steps S4A01-S4A15, steps S4B01-step S4B07, and steps S4C10-step S4C15 in the method embodiment shown.

[0227] When calibrating an electronic device equipped with a linear motor with a motor frequency of 170 Hz, such as Figure 5A As shown, when the electronic device leaves the factory, the default resonant frequency (i.e. Figure 5A The variable A) is the resonant frequency (that is, the preset initial frequency) of 120Hz set when the linear motor leaves the factory. After receiving the power-on calibration instruction, the electronic device performs the first power-on calibration on the linear motor after leaving the factory and determines whether the calibration is successful. That is, the electronic device calculates the resonant frequency in the first power-on calibration process of the linear motor after leaving the factory (that is, the first calibration process) to obtain the current calibration value (that is, the first calibration frequency), and determines whether the current calibration value (that is, the first calibration frequency) is within the preset frequency range of 155Hz-185Hz (excluding 155Hz and 185Hz). If not, it is determined that the calibration failed (that is, the first frequency calibration failed), and the default resonant frequency of 170Hz (that is, the first frequency calibration failed) in the configuration file of the linear motor is output. Figure 5A Variable A in ), so that during subsequent use, the linear motor driver chip can drive the linear motor to vibrate according to the default resonant frequency of 170 Hz (that is, the preset initial frequency). When the electronic device fails to calibrate the linear motor for the first time or fails to calibrate the linear motor continuously for the first time due to manufacturing tolerances of the linear motor or abnormalities in the motor hardware link, the frequency of driving the linear motor can be automatically retracted to the resonant frequency set at the factory for the linear motor (that is, the preset initial frequency), ensuring that the linear motor can operate normally to enhance the user experience.

[0228] When the current calibration value (i.e., the first calibration frequency) is greater than 155Hz and less than 185Hz, the calibration is determined to be successful (i.e., the first frequency calibration is successful). Variable B is assigned the current calibration value and output. This ensures that, until the next linear motor calibration, the linear motor driver chip drives the linear motor to vibrate according to the current calibration value (i.e., the first calibration frequency). This ensures that the linear motor achieves optimal vibration during use, thereby maintaining a pleasant feel and enhancing the user experience. Simultaneously, a weighted average is calculated based on variable B (i.e., the first calibration frequency) and variable A (i.e., the preset initial frequency), with variable B having a weight of m / (m+n) and variable A having a weight of n / (m+n). This new variable A (i.e., the first target frequency) is obtained and stored in the linear motor configuration file as the new default resonant frequency. This allows the linear motor to be quickly assigned a reliable drive frequency (i.e., the first target frequency) if the next calibration fails. This allows the linear motor to quickly recover while maintaining the vibration feel of the linear motor as much as possible during normal operation, thereby improving system stability.

[0229] Furthermore, when the electronic device receives the power-on calibration instruction again, it calibrates the linear motor again and determines whether the calibration is successful. That is, the electronic device obtains the calibration value (that is, the second calibration frequency) by recalculating the resonant frequency of the linear motor in this calibration process (that is, the second calibration process), and determines whether the calibration value (that is, the second calibration frequency) is within the preset frequency range of 155Hz-185Hz (excluding 155Hz and 185Hz). If not, it is determined that the calibration failed (that is, the second frequency calibration failed), and the variable A (that is, the first target frequency) stored in the configuration file of the linear motor is output, so that before the next calibration, the linear motor driver chip can drive the linear motor to vibrate according to the variable A (that is, the first target frequency), thereby quickly restoring the working state of the linear motor while maintaining the vibration feel of the linear motor under normal working state as much as possible, thereby improving the stability of the system.

[0230] When the current calibration value (i.e., the second calibration frequency) is greater than 155Hz and less than 185Hz, the calibration is determined to be successful (i.e., the second frequency calibration is successful), and the variable B is reassigned to the current calibration value (i.e., the second calibration frequency) and the variable B is output, so that before the next calibration of the linear motor, the linear motor driver chip drives the linear motor to vibrate according to the current calibration value (i.e., the second calibration frequency) to ensure that the linear motor can achieve a better vibration effect during use, thereby ensuring the feel of the linear motor during use to enhance the user experience. At the same time, a weighted average is calculated based on variable B (that is, the second calibration frequency) and variable A (that is, the first target frequency). The weight of variable B is m / (m+n), and the weight of variable A is n / (m+n). A new variable A (that is, the second target frequency) is obtained and stored in the configuration file of the linear motor as the new default resonant frequency. This allows the linear motor to be quickly assigned a reliable driving frequency (that is, the second target frequency) the next time the calibration fails, thereby quickly restoring the working state of the linear motor while maintaining the vibration feel of the linear motor under normal working conditions as much as possible, thereby improving the stability of the system.

[0231] It should be noted that the method embodiment described in the embodiments of the present application is only one possible implementation method of the linear motor calibration method provided in the present application. In some embodiments, the embodiments of the present application may also include other more / fewer steps. Therefore, the embodiments of the present application do not constitute a limitation on the above method.

[0232] For example, in combination with the above Figure 5AThe method embodiment described above provides a set of frequency data tables for continuously calibrating a linear motor based on different values ​​of m and n. As shown in Table 1:

[0233] Table 1

[0234]

[0235]

[0236] Among them, when the calibration frequency calculated during the continuous calibration of the motor is consistent with the actual resonant frequency (that is, motor F0), it can be seen that as the number of linear motor calibrations increases, the actual resonant frequency of the motor (that is, motor F0) shifts. When m=1, n=1, the weight of variable B is 1 / 2 (that is, the weight X is 1 / 2), and the weight of variable A is 1 / 2 (that is, the weight Y is 1 / 2). Through the above Figure 5A The motor calibration method described in the calculation results in the corresponding frequencies of 172.5, 173.75, 174.375...176.7337 Hz, which are the default resonant frequencies saved during each calibration process. They can be used to drive the linear motor to vibrate when the next calibration fails, thereby ensuring the vibration effect of the motor and improving the user experience. When m=1 and n=0, the weight of variable B is 1 (that is, the weight X is 1), and the weight of variable A is 0 (that is, the weight Y is 0). Through the above Figure 5A The motor calibration method described in [1] calculates the corresponding frequencies of 170, 175, 175…177 Hz as the default resonant frequency saved during each calibration process. This default resonant frequency is the calibration frequency at the time of the previous successful calibration. Therefore, as long as there is a successful calibration experience, the vibration effect of the linear motor can be guaranteed in each subsequent calibration failure, ensuring that the vibration feel does not change significantly when the calibration fails, improving system stability and enhancing the user experience.

[0237] Based on the above Figure 5A The method embodiment described above and the frequency data of the linear motor determined by continuous calibration under different values ​​of m and n provided in Table 1 can be found in Figure 5B , Figure 5B A schematic diagram of the change between the frequency determined by calibrating a linear motor based on different weights and the number of motor calibration times provided in an embodiment of the present application.

[0238] like Figure 5BAs shown, compared with the actual resonant frequency of the linear motor during the motor calibration process (that is, motor F0), when the motor F0 remains unchanged from the F0 at the last calibration, the frequency corresponding to m=1, n=0 is equal to the actual resonant frequency of the linear motor. Therefore, when the actual resonant frequency of the linear motor remains unchanged, it can be ensured that the linear motor is driven according to the frequency corresponding to m=1, n=0 when the next calibration fails, which can achieve the best vibration effect to maintain the user feel, thereby improving the user experience. When the actual resonant frequency of the linear motor (that is, motor F0) suddenly changes, for example, when motor F0 suddenly changes from 175Hz to 175.5Hz during the sixth calibration, the frequency curve corresponding to m=1, n=1 is closer to the actual resonant frequency of the linear motor (that is, motor F0) than the frequency curve corresponding to m=1, n=0. As the number of successful linear motor calibrations increases, the difference between the frequency corresponding to m=1, n=1 and the actual resonant frequency of the linear motor (that is, motor F0) gradually decreases, thereby reducing the impact of factors such as manufacturing tolerances and device aging on the vibration effect of the linear motor. This allows the electronic device to give the linear motor a driving frequency close to the actual resonant frequency when the linear motor calibration fails, thereby improving the vibration effect of the linear motor and enhancing the user experience.

[0239] For example, see Figure 5C , Figure 5C This is a flow chart of another linear motor calibration method provided in an embodiment of the present application. This method can be applied to the above Figure 1A In the electronic device, the above Figure 1B The software architecture is implemented in the embodiment of the present invention, so that the electronic device can be used to implement the above Figure 3 Steps S301-S306 of the method embodiment shown, or Figures 4A-4C Part or all of steps S4A01-S4A15, steps S4B01-step S4B07, and steps S4C10-step S4C15 in the method embodiment shown.

[0240] like Figure 5C As shown, when the calibration value (that is, Figure 5C When the variable B in the calibration is successful, the calibration value (i.e. Figure 5C The variable B in the equation and the average frequency value of the calibration frequencies corresponding to the K successful calibrations before this calibration, that is, Figure 5C The variable C in the linear motor configuration file is stored in the default resonant frequency (that is, Figure 5CThe weighted average value is calculated, where the weight of the average frequency value (i.e., variable C) is m / (m+n), and the weight of variable A is n / (m+n). The new variable A (i.e., the first target frequency) is obtained and stored in the configuration file of the linear motor as the new default resonant frequency. Specifically, Figure 5C The detailed description of the method embodiment in Figure 5A The method embodiment in is similar, please refer to Figure 5A The relevant description in will not be repeated here.

[0241] By using the embodiment of the present application, it is possible to effectively avoid the situation where the resonant frequency (i.e. the resonant frequency calculated when the linear motor was successfully calibrated) is incorrect due to environmental factors (such as weightlessness) or calculation errors. Figure 5C The variable B in the equation ( ) suddenly changes greatly, causing the frequency of the linear motor to be driven when the next calibration fails to be determined to be different from the actual resonant frequency, which affects the vibration effect of the linear motor. Figure 5C The variable A in the equation can be used to get closer to the true resonant frequency of the linear motor while minimizing the error in the resonant frequency calculated during the most recent successful calibration of the linear motor (i.e., Figure 5C The variable B in the equation ( ) suddenly changes greatly, which will affect the frequency of the linear motor when the next calibration fails (i.e. Figure 5C The influence of variable A) in the calibration is reduced to avoid the unstable vibration of the linear motor caused by a single calibration error, thereby improving the stability of the system and enhancing the user experience.

[0242] It can be understood that the above method embodiment only specifically describes one possible implementation method of the present application. In some embodiments, the present application method may have other possible implementation methods, which are not limited by the present application embodiment.

[0243] The above detailed description of the method of the embodiment of the present application, it can be understood that, in order to realize the corresponding functions mentioned above, each device includes a hardware structure and / or software module corresponding to the execution of each function. In combination with the units and steps of the examples described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application. The following introduces the equipment provided in the embodiment of the present application.

[0244] See Figure 6, Figure 6 6 is a schematic diagram of a linear motor calibration apparatus provided in an embodiment of the present application. Apparatus 600 can be applied to electronic devices including linear motors; apparatus 600 can include a calibration unit 601, a drive unit 602, and a determination unit 603. Each unit is described in detail below:

[0245] a calibration unit 601 configured to calibrate the linear motor using a first calibration frequency and determine whether the linear motor is successfully calibrated at the first calibration frequency; the first calibration frequency being the resonant frequency of the linear motor calculated during the first calibration process;

[0246] a driving unit 602 configured to drive the linear motor according to the first calibration frequency if the first calibration frequency calibration is successful;

[0247] a determining unit 603, configured to determine a first target frequency based on the first calibration frequency, and save the first target frequency;

[0248] The driving unit 602 is further configured to stop driving the linear motor after driving the linear motor to vibrate for N cycles according to the first calibration frequency, wherein N is an integer greater than or equal to 0;

[0249] The calibration unit 601 is further configured to calibrate the linear motor using a second calibration frequency and determine whether the linear motor is successfully calibrated at the second calibration frequency; the second calibration frequency is a resonant frequency of the linear motor calculated during the second calibration process;

[0250] The driving unit 602 is further configured to drive the linear motor according to the first target frequency if the second calibration frequency calibration fails.

[0251] In an embodiment of the present application, in a linear motor calibration apparatus, a calibration unit 601 first calibrates the linear motor using the resonant frequency of the linear motor calculated during a first calibration process (i.e., the first calibration frequency), and determines whether the linear motor is successfully calibrated at the first calibration frequency. If calibration at the first calibration frequency is successful, the linear motor is driven by a driving unit 602 according to the determined first calibration frequency. Simultaneously, a determination unit 603 determines a first target frequency based on the first calibration frequency and stores the first target frequency. Furthermore, after driving the linear motor for N cycles at the first calibration frequency, the driving unit 602 stops driving the linear motor. The calibration unit 601 then calibrates the linear motor using the resonant frequency of the linear motor calculated during a second calibration process (i.e., the second calibration frequency), and determines whether calibration at the second calibration frequency is successful. If calibration at the second calibration frequency fails, the linear motor is driven by the driving unit 602 according to the first target frequency determined during the previous successful calibration. In the prior art, when a linear motor calibration fails, a fixed initial frequency value (e.g., 170 Hz) is assigned to the linear motor as the drive frequency, based on the resonant frequency set at the factory. This can easily lead to weak vibrations in the motor, impacting the vibration effect. Compared to the prior art, the present embodiment dynamically adjusts the first target frequency for driving the linear motor when calibration fails based on the resonant frequency determined during the last successful calibration of the linear motor (i.e., the first calibration frequency). This allows the first target frequency to gradually approach the linear motor's current actual resonant frequency as the number of calibrations increases, ensuring that the linear motor maintains normal vibration. Through the embodiments of the present application, it is possible to effectively solve the problem in the prior art that due to the influence of manufacturing tolerances of linear motors, device aging, etc., the actual resonant frequency of the linear motor during the calibration process is significantly different from the resonant frequency set at the factory (for example, 170Hz), and when the calibration fails, the linear motor is still driven according to the resonant frequency set at the factory, resulting in weak vibration of the linear motor. Therefore, during the linear motor calibration process, the driving frequency of the linear motor can be adaptively adjusted to improve the vibration effect of the linear motor, thereby enhancing the user experience.

[0252] In a possible implementation, before calibrating the linear motor using the first calibration frequency, the driving unit 602 is further configured to:

[0253] After driving the linear motor to vibrate for M cycles at a first frequency, the driving of the linear motor is stopped; wherein the first frequency is included in a preset frequency range, and M is an integer greater than or equal to 0.

[0254] In a possible implementation, the calibration unit 601 is specifically configured to:

[0255] Acquire a corresponding calibration frequency of the linear motor; the corresponding calibration frequency is the first calibration frequency or the second calibration frequency;

[0256] Determining whether the corresponding calibration frequency is within the preset frequency range;

[0257] If yes, it is determined that the corresponding calibration frequency is calibrated successfully;

[0258] If not, it is determined that the calibration of the corresponding calibration frequency has failed.

[0259] In one possible implementation, the first frequency is a preset initial frequency or a third calibration frequency, and the third calibration frequency is a resonant frequency of the linear motor calculated by a previous successful calibration before calibration at the first calibration frequency; the determining unit 603 is specifically configured to:

[0260] In a case where the first frequency is the preset initial frequency, determining the first target frequency based on the first calibration frequency and the preset initial frequency;

[0261] In a case where the first frequency is the third calibration frequency, the first target frequency is determined based on the first calibration frequency and a third target frequency; and the third target frequency is obtained based on the third calibration frequency.

[0262] In a possible implementation, the driving unit 602 is further configured to:

[0263] In a case where the first frequency is the preset initial frequency, if the first calibration frequency fails to calibrate, driving the linear motor according to the preset initial frequency;

[0264] In a case where the first frequency is the third calibration frequency, if the first calibration frequency fails to be calibrated, the linear motor is driven according to the third target frequency.

[0265] In a possible implementation, the driving unit 602 is further configured to:

[0266] If the second calibration frequency calibration is successful, driving the linear motor according to the second calibration frequency;

[0267] The determining unit 603 is further configured to:

[0268] A second target frequency is determined based on the second calibration frequency and the first target frequency, and the second target frequency is stored.

[0269] In a possible implementation, the determining unit 603 is specifically configured to:

[0270] Determine a weighted average of the first calibration frequency and the preset initial frequency as the first target frequency; the weight of the first calibration frequency is X, and the weight of the initial frequency is Y, where X is greater than 0, Y is greater than or equal to 0, and the sum of X and Y is equal to 1;

[0271] Alternatively, a weighted average of the first calibration frequency and the third target frequency is determined as the first target frequency; the weight of the first calibration frequency is X, and the weight of the third target frequency is Y, where X is greater than 0, Y is greater than or equal to 0, and the sum of X and Y is equal to 1.

[0272] In a possible implementation, the determining unit 603 is specifically configured to:

[0273] A weighted average of the second calibration frequency and the first target frequency is determined as the second target frequency; the weight of the second calibration frequency is X, and the weight of the first target frequency is Y, where X is greater than 0, Y is greater than or equal to 0, and the sum of X and Y is equal to 1.

[0274] In a possible implementation, the determining unit 603 is specifically configured to:

[0275] If X is equal to 1 and Y is equal to 0, the first calibration frequency is determined as the first target frequency;

[0276] Alternatively, if X is equal to 1 and Y is equal to 0, the second calibration frequency is determined as the second target frequency.

[0277] In a possible implementation, the determining unit 603 is specifically configured to:

[0278] The first calibration frequency and an average frequency value of K calibration frequencies are calculated, and a first target frequency is determined based on the average frequency value; the K calibration frequencies are calibration frequencies corresponding to K successful calibrations before calibration with the first calibration frequency.

[0279] It should be noted that the functions of the various units in the device 600 described in the embodiment of the present application can refer to the relevant description of the above-mentioned method embodiment, and will not be repeated here. It is understandable that the device and method provided in the embodiment of the present application can be implemented in other ways. For example, the system embodiment described above is merely schematic. For example, the division of the above-mentioned 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, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0280] See Figure 7 , Figure 7 Schematic diagram of the hardware structure of another electronic device provided in the embodiment of the present application. Figure 7 As shown, the electronic device 700 includes at least one processor 701, a memory 702, and a linear motor 703. The processor 701, the memory 702, and the linear motor 703 can be connected via a bus 704, which can be a communication connection, an electrical connection, or other forms. Specifically, the memory 702 is used to store program instructions. The processor 701 is used to call the program instructions stored in the memory 702 so that the electronic device 700 can execute some or all of the steps in the method for linear motor calibration provided in the embodiment of the present application. The description of its various components and related steps can be referred to above and will not be repeated here.

[0281] It should be noted that the electronic device 700 provided in the embodiment of the present application may include more or fewer components than shown in the figure, or combine some components, separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or any combination of software and hardware.

[0282] An embodiment of the present application also provides a computer-readable storage medium, wherein the computer-readable storage medium may store a program, and when the computer program is executed by a processor, it implements part or all of the steps of any one of the control methods recorded in the above method embodiments.

[0283] An embodiment of the present application also provides a computer program, which includes instructions. When the computer program is executed by a computing device, the computing device can execute some or all of the steps of any of the above-mentioned control methods.

[0284] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0285] As used in the above embodiments, the term “when…” may be interpreted to mean “if…” or “after…” or “in response to determining…” or “in response to detecting…”, depending on the context. Similarly, the phrases “upon determining…” or “if (stated condition or event) is detected” may be interpreted to mean “if determining…” or “in response to determining…” or “upon detecting (stated condition or event)” or “in response to detecting (stated condition or event)”, depending on the context.

[0286] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should know that this application is not limited by the described order of actions, because according to this application, certain steps may be performed in other orders or simultaneously, or certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application. It should also be noted that the features and functions of two or more devices disclosed herein can be concretized in one device. Conversely, the features and functions of a device described above can be further divided into being concretized by multiple devices.

[0287] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described herein are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0288] Those skilled in the art will appreciate that all or part of the process steps in the above-described method embodiments can be implemented by a computer program instructing the relevant hardware. The program can be stored in a computer-readable storage medium, and when executed, the program can include the process steps in the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.

[0289] In short, the above description is only an embodiment of the technical solution of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent replacements, improvements, etc. made based on the disclosure of this application should be included in the scope of protection of this application.

Claims

1. A method for calibrating a linear motor, characterized in that: Applied to an electronic device including a linear motor, the method comprises: Calibrate the linear motor using a first calibration frequency, and determine whether the linear motor is successfully calibrated at the first calibration frequency; the first calibration frequency is the resonant frequency of the linear motor calculated during the first calibration process; If the first calibration frequency is calibrated successfully, driving the linear motor according to the first calibration frequency; determining a first target frequency based on the first calibration frequency, and saving the first target frequency; After driving the linear motor to vibrate for N cycles according to the first calibration frequency, stopping driving the linear motor; wherein N is an integer greater than or equal to 0; Calibrate the linear motor using a second calibration frequency, and determine whether the linear motor is successfully calibrated at the second calibration frequency; the second calibration frequency is the resonant frequency of the linear motor calculated during the second calibration process; If the second calibration frequency fails, the linear motor is driven according to the first target frequency.

2. The method according to claim 1, characterized in that Before calibrating the linear motor using the first calibration frequency, the method further includes: After driving the linear motor to vibrate for M cycles at a first frequency, the driving of the linear motor is stopped; wherein the first frequency is included in a preset frequency range, and M is an integer greater than or equal to 0.

3. The method according to claim 1 or 2, characterized in that The step of calibrating the linear motor using a first calibration frequency and determining whether the linear motor is successfully calibrated at the first calibration frequency, or the step of calibrating the linear motor using a second calibration frequency and determining whether the linear motor is successfully calibrated at the second calibration frequency, includes: Acquire a corresponding calibration frequency of the linear motor; the corresponding calibration frequency is the first calibration frequency or the second calibration frequency; Determining whether the corresponding calibration frequency is within the preset frequency range; If yes, it is determined that the corresponding calibration frequency is calibrated successfully; If not, it is determined that the calibration of the corresponding calibration frequency has failed.

4. The method according to claim 2 or 3, characterized in that The first frequency is a preset initial frequency or a third calibration frequency, and the third calibration frequency is a resonant frequency of the linear motor calculated by a previous successful calibration before calibration at the first calibration frequency; The determining a first target frequency based on the first calibration frequency includes: In a case where the first frequency is the preset initial frequency, determining the first target frequency based on the first calibration frequency and the preset initial frequency; In a case where the first frequency is the third calibration frequency, the first target frequency is determined based on the first calibration frequency and a third target frequency; and the third target frequency is obtained based on the third calibration frequency.

5. The method according to claim 4, characterized in that The method further comprises: In a case where the first frequency is the preset initial frequency, if the first calibration frequency fails to calibrate, driving the linear motor according to the preset initial frequency; In a case where the first frequency is the third calibration frequency, if the first calibration frequency fails to be calibrated, the linear motor is driven according to the third target frequency.

6. The method according to any one of claims 1 to 4, characterized in that The method further comprises: If the second calibration frequency calibration is successful, driving the linear motor according to the second calibration frequency; A second target frequency is determined based on the second calibration frequency and the first target frequency, and the second target frequency is stored.

7. The method according to any one of claims 4 to 6, characterized in that The determining the first target frequency based on the first calibration frequency and the preset initial frequency includes: Determine a weighted average of the first calibration frequency and the preset initial frequency as the first target frequency; the weight of the first calibration frequency is X, and the weight of the preset initial frequency is Y, where X is greater than 0, Y is greater than or equal to 0, and the sum of X and Y is equal to 1; The determining the first target frequency based on the first calibration frequency and a third target frequency includes: A weighted average of the first calibration frequency and the third target frequency is determined as the first target frequency; the weight of the first calibration frequency is X, and the weight of the third target frequency is Y, where X is greater than 0, Y is greater than or equal to 0, and the sum of X and Y is equal to 1.

8. The method according to claim 6 or 7, characterized in that The determining the second target frequency based on the second calibration frequency and the first target frequency includes: A weighted average of the second calibration frequency and the first target frequency is determined as the second target frequency; the weight of the second calibration frequency is X, and the weight of the first target frequency is Y, where X is greater than 0, Y is greater than or equal to 0, and the sum of X and Y is equal to 1.

9. The method according to claim 7 or 8, characterized in that The step of determining a weighted average of the first calibration frequency and the preset initial frequency as the first target frequency, or the step of determining a weighted average of the first calibration frequency and the third target frequency as the first target frequency, includes: If X is equal to 1 and Y is equal to 0, the first calibration frequency is determined as the first target frequency; The step of determining a weighted average of the second calibration frequency and the first target frequency as the second target frequency includes: If X is equal to 1 and Y is equal to 0, the second calibration frequency is determined as the second target frequency.

10. The method according to claim 1, characterized in that The determining a first target frequency based on the first calibration frequency includes: The first calibration frequency and an average frequency value of K calibration frequencies are calculated, and a first target frequency is determined based on the average frequency value; the K calibration frequencies are calibration frequencies corresponding to K successful calibrations before calibration with the first calibration frequency.

11. A linear motor calibration device, characterized in that: Applications in electronic devices containing linear motors, including: a calibration unit, configured to calibrate the linear motor using a first calibration frequency and determine whether the linear motor is successfully calibrated at the first calibration frequency; the first calibration frequency being a resonant frequency of the linear motor calculated during the first calibration process; a driving unit, configured to drive the linear motor according to the first calibration frequency if calibration of the first calibration frequency is successful; a determining unit, configured to determine a first target frequency based on the first calibration frequency, and save the first target frequency; The driving unit is further configured to stop driving the linear motor after driving the linear motor to vibrate for N cycles according to the first calibration frequency, wherein N is an integer greater than or equal to 0; The calibration unit is further configured to calibrate the linear motor using a second calibration frequency and determine whether the linear motor is successfully calibrated at the second calibration frequency; the second calibration frequency is a resonant frequency of the linear motor calculated during the second calibration process; The driving unit is further configured to drive the linear motor according to the first target frequency if calibration of the second calibration frequency fails.

12. An electronic device, characterized in that: The electronic device includes a linear motor, a processor and a memory, wherein the memory is used to store programs and various data, and the processor is used to call the program code stored in the memory so that the electronic device executes the method according to any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.

14. A computer program, characterized in that The computer program comprises instructions, and when the computer program is run on a computer, the computer is caused to perform the method according to any one of claims 1 to 10.