Method, device, electronic device and readable storage medium for generating waveform file
By generating waveform files and utilizing the voltage amplitude relationship to adjust the resonant frequency of the linear motor, the high cost problem of traditional hardware feedback detection is solved, cost savings and vibration continuity are achieved, and it is suitable for a variety of vibration modes.
Patent Information
- Application Number
- CN202011244525.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-10
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2040-11-10
AI Technical Summary
The traditional hardware feedback detection method to calibrate the resonant frequency of the linear motor is costly and increases circuit complexity.
By generating a waveform file, the third voltage amplitude is calculated using the voltage amplitude relationship between the initial resonant frequency and the current resonant frequency, and the current waveform file is generated to drive the motor, avoiding the addition of a feedback circuit and directly adjusting the resonant frequency.
It reduces costs, reduces hardware requirements, ensures the continuity and accuracy of vibration, is suitable for multiple vibration modes, and has a wider range of application scenarios.
Smart Images

Figure CN114548141B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic technology, and in particular to a method, device, electronic device and readable storage medium for generating a waveform file. Background Art
[0002] As a common device, linear motors are widely used in people's work and life. For example, when using a mobile phone, a linear motor is used to make the phone vibrate.
[0003] Typically, as linear motors are used, their resonant frequency may shift. To ensure the motor's vibration performance, calibration of the resonant frequency is often necessary. Currently, hardware feedback detection is often used to calibrate linear motors. This involves adding a feedback circuit to the circuit to calibrate the resonant frequency of the linear motor.
[0004] However, the traditional method of using hardware feedback detection to calibrate the resonant frequency of the motor is costly due to the additional circuitry. Summary of the Invention
[0005] The present application provides a method for generating a waveform file, which can reduce costs.
[0006] In a first aspect, a method for generating a waveform file is provided, comprising:
[0007] Get the initial resonant frequency and current resonant frequency of the motor;
[0008] When the initial resonant frequency and the current resonant frequency are different, a third voltage amplitude is determined according to a first voltage amplitude and a second voltage amplitude, the first voltage amplitude and the second voltage amplitude being amplitudes of two adjacent sampling points of the AC drive signal corresponding to the initial resonant frequency, wherein a phase corresponding to the third voltage amplitude is greater than a phase corresponding to the first voltage amplitude and less than a phase corresponding to the second voltage amplitude, a difference between the phase corresponding to the third voltage amplitude and the phase corresponding to the first voltage amplitude is a first phase difference, a difference between the phase corresponding to the third voltage amplitude and the phase corresponding to the second voltage amplitude is a second phase difference, the third voltage amplitude is positively correlated with a sum of a first value and a second value, the first value is a product of the first voltage amplitude and a first weight coefficient, the second value is a product of the second voltage amplitude and a second weight coefficient, the first weight coefficient is a value obtained by dividing the second phase difference by the sum of the first phase difference and the second phase difference, and the second weight coefficient is a value obtained by dividing the first phase difference by the sum of the first phase difference and the second phase difference;
[0009] A current waveform file is generated according to the third voltage amplitude, wherein the current waveform file is used to generate an AC drive signal corresponding to the current resonant frequency, and the third voltage amplitude is the amplitude of a sampling point of the AC drive signal corresponding to the current resonant frequency.
[0010] The above initial resonant frequency is the frequency of the preset initial waveform file. The voltage data of two adjacent sampling points of the AC drive signal corresponding to the initial resonant frequency is used as the first voltage amplitude N index and the second voltage amplitude N index+1 , where the sampling time of the first voltage amplitude is before the sampling time of the second voltage amplitude, that is, the phase corresponding to the first voltage amplitude is smaller than the phase corresponding to the second voltage amplitude. The ratio of the current resonant frequency to the initial resonant frequency is used as the first proportional coefficient, that is, Vision1 = F0 / F, where F0 is the current resonant frequency and F is the initial resonant frequency. The phase at a sampling point in the initial waveform file can be multiplied by the first proportional coefficient to obtain the phase of the corresponding sampling point in the current waveform file. If the phase interval of each sampling point is used as a time unit, the magnitude of the phase difference between the phase of the sampling point in the current waveform file and the phase of the corresponding sampling point in the initial waveform file can be represented by the decimal part of the product of the sum of the sampling point serial number plus one and the first proportional coefficient, that is, a = (index+1)×Vision1-ROUNDDOWN(index+1)×Vision1. Since the phase at each sampling point is used as a time unit, a is a normalized value. When the starting points of the current waveform file and the initial waveform file are aligned, a can be used to represent the distance between the third voltage amplitude and the first voltage amplitude on the time axis. The phase difference between the sampling point in the current waveform file and the next sampling point in the corresponding initial waveform file can be expressed as b = 1-a to represent the distance between the third voltage amplitude and the second voltage amplitude. The first and second voltage amplitudes can be weighted according to the distance between the third voltage amplitude and the first and second voltage amplitudes to obtain the third voltage amplitude.
[0011] In this embodiment, the electronic device can weight the first and second voltage amplitudes according to the proximity of the third voltage amplitude to the first and second voltage amplitudes, thereby obtaining a reasonably accurate third voltage amplitude. Therefore, based on the current waveform file generated by the third voltage amplitude, the initial waveform file of the initial resonant frequency is converted into the current waveform file of the current resonant frequency, thereby generating an AC drive signal to drive the motor. Compared with the traditional method of using a feedback circuit for motor calibration, adjusting the motor frequency by adding a feedback circuit saves costs. At the same time, since this method does not add a feedback circuit, it has lower hardware requirements and a wider range of application scenarios.
[0012] Optionally, when the current resonant frequency is less than the initial resonant frequency, generating a current waveform file according to the third voltage amplitude includes:
[0013] Acquire a first data quantity, where the first data quantity is the number of voltage data belonging to one AC drive signal cycle in an initial waveform file, where the initial waveform file is a waveform file corresponding to the initial resonant frequency;
[0014] determining a second data quantity based on the first data quantity and a first transformation coefficient, wherein the first transformation coefficient is a ratio of the current resonant frequency to the initial resonant frequency, the initial resonant frequency being the frequency of the AC drive signal corresponding to the initial waveform file, and the second data quantity is a value obtained by rounding the product of the first data quantity and the first transformation coefficient;
[0015] Obtaining a first cycle number, where the first cycle number is the number of cycles of the AC drive signal corresponding to the initial waveform file;
[0016] determining a second number of cycles according to the first number of cycles and a second transformation coefficient, where the second number of cycles is a value obtained by rounding a product of the first number of cycles and the second transformation coefficient, and the second transformation coefficient is a ratio of the initial resonant frequency to the current resonant frequency;
[0017] The current waveform file is generated according to the second data quantity, the second cycle quantity and the third voltage amplitude, wherein the second data quantity is the number of voltage data belonging to one AC drive signal cycle in the current waveform file, and the second cycle quantity is the number of cycles corresponding to the voltage data contained in the current waveform file.
[0018] The electronic device will be the number of voltage data in the initial waveform file Point SUMThe number of voltage data belonging to one AC drive signal cycle in the initial waveform file is divided by the number of cycles of the AC drive signal corresponding to the initial waveform file, that is, divided by the first cycle number T. The electronic device uses the ratio of the initial resonant frequency F to the current resonant frequency F0 as the first conversion coefficient, and rounds the product of the first data number and the first conversion coefficient as the second data number, that is, the second data number T. 1point For T point ×(F / F0) is the value obtained by rounding. Among them, the second data quantity is the number of voltage data belonging to one AC drive signal cycle in the current waveform file. The electronic device uses the ratio of the current resonant frequency F0 to the initial resonant frequency F as the second conversion coefficient, and rounds the product of the second conversion coefficient and the above-mentioned first cycle number as the second cycle number, that is, the second cycle number T1=ROUNDDOWN(T×(F0 / F)). The second cycle number is the number of cycles corresponding to the voltage data contained in the current waveform file. The electronic device uses the second data number T 1point The number of voltage data NewPoint required by the current waveform file is determined by the second cycle number T1 SUM , such as NewPoint SUM =T1×T 1point . The second data quantity T 1point The product of the second cycle number T1 is used as the number of voltage data required by the current waveform file. The electronic device generates multiple third voltage amplitudes according to NewPoint SUM Extraction is performed, that is, the value of the third voltage amplitude that exceeds NewPoint SUM A certain amount of voltage data is deleted to ensure that the AC driving signal generated by the current waveform file is a full-cycle signal, thereby ensuring continuous vibration.
[0019] In this embodiment, the electronic device uses the first transformation coefficient and the second transformation coefficient to characterize the proportional relationship between the current resonant frequency and the initial resonant frequency, and based on the first transformation coefficient and the second transformation coefficient, respectively, according to the first cycle number and the first data number of the initial waveform file, obtains the second cycle number and the second data number required for the current waveform file, and further obtains the number of voltage data required for the current waveform file according to the product of the second cycle number and the second data number. Then, the third voltage amplitude is extracted according to the required number of voltage data, thereby removing part of the voltage data to obtain the waveform file data of a complete cycle, so as to ensure the continuity of the vibration feeling and improve the user experience.
[0020] Optionally, the vibration mode of the motor is a long vibration mode.
[0021] In this embodiment, since the current waveform file is a waveform file with a complete cycle, the electronic device can ensure the continuity of the waveform of the AC drive signal in the long vibration mode, that is, when the current waveform file is used cyclically to drive the motor. Therefore, using the current waveform file to cyclically drive the motor will not cause discontinuous vibration, thereby improving the user experience.
[0022] Optionally, the method also includes: when the current resonant frequency is greater than the initial resonant frequency, performing zero-padding processing on the current waveform file to obtain an updated waveform file, the number of voltage data in the updated waveform file is the same as the number of voltage data in the initial waveform file, and the initial waveform file is the waveform file corresponding to the initial resonant frequency.
[0023] In this embodiment, since the current resonant frequency is greater than the initial resonant frequency, the number of the third voltage amplitudes obtained after the frequency conversion is less than the number of voltage data in the initial waveform file data. Therefore, without changing the data length of the waveform file, the remaining spaces are padded with zeros to obtain an updated waveform file with the same number of voltage data as in the initial waveform file. This can avoid changing the stored data length of the waveform file, thereby facilitating data storage, reducing the amount of calculation, and ensuring the accuracy of data processing.
[0024] Optionally, the vibration mode of the motor is a short vibration mode, and the initial resonance frequency is the minimum vibration frequency of the motor.
[0025] In this embodiment, when the vibration mode of the motor is in the short vibration mode, for example, when the motor vibrates in feedback when a button is touched or a call is successfully connected, the initial waveform file of the minimum vibration frequency of the motor is pre-stored, so that the current waveform file corresponding to the current resonant frequency determined does not have more points. At this time, the electronic device pads the number of voltage data in the initial waveform file of the minimum resonant frequency with zeros to obtain an updated waveform file with the same number of voltage data as in the initial waveform file, thereby avoiding changing the stored data length of the initial waveform file, thereby facilitating data storage, reducing the amount of calculation, and ensuring the accuracy of data processing.
[0026] Optionally, obtaining the initial resonant frequency and the current resonant frequency of the motor includes:
[0027] Acquiring a plurality of acceleration data corresponding to each AC drive signal when the motor is driven to vibrate by the plurality of AC drive signals, wherein the acceleration data is used to characterize the magnitude of the acceleration of the motor during vibration, wherein the frequencies of the plurality of AC drive signals are distributed within a driving frequency range of the motor;
[0028] determining an average acceleration corresponding to each of the plurality of AC drive signals according to the plurality of acceleration data of the plurality of AC drive signals;
[0029] The current resonant frequency is determined according to a maximum average acceleration among a plurality of average accelerations of the plurality of AC drive signals, wherein the current resonant frequency is a frequency of the AC drive signal corresponding to the maximum average acceleration.
[0030] In this embodiment, the electronic device obtains multiple acceleration data corresponding to each AC drive signal when multiple AC drive signals drive the motor to vibrate. Since the frequencies of the above-mentioned multiple AC drive signals are distributed within the driving frequency range of the motor, the electronic device can use a frequency sweep method to obtain multiple acceleration data corresponding to multiple frequencies within the driving frequency range. The electronic device then accurately and conveniently determines the current resonant frequency corresponding to the maximum average acceleration based on the maximum average acceleration among the average accelerations corresponding to each AC signal. This method does not require adjusting the frequency of the motor by adding a feedback circuit, thus saving costs. At the same time, since this method does not add a feedback circuit, it has lower hardware requirements and a wider range of application scenarios.
[0031] Optionally, determining an average acceleration corresponding to each AC drive signal in the plurality of AC drive signals according to the plurality of acceleration data of the plurality of AC drive signals includes:
[0032] Obtaining a peak-to-peak value of acceleration data corresponding to each AC drive signal among the multiple AC drive signals;
[0033] An average acceleration corresponding to each of the multiple AC drive signals is determined according to the peak-to-peak value.
[0034] In this embodiment, the electronic device obtains the peak-to-peak value of the acceleration data corresponding to each of the above-mentioned multiple AC drive signals, removes the negative values during the calculation process, and then determines the average acceleration corresponding to each of the multiple AC drive signals based on the peak-to-peak value corresponding to each AC drive signal. Compared with the method of directly deleting the negative value part of the data, the peak-to-peak value can widen the difference between the data, which is convenient for screening and comparison.
[0035] Optionally, the peak-to-peak value is data obtained by removing the overshoot value from the first peak-to-peak value, and / or, the peak-to-peak value is data obtained by downsampling the first peak-to-peak value according to a preset sampling rate; the first peak-to-peak value is the original peak-to-peak value of the acceleration data corresponding to each AC drive signal in the multiple AC drive signals.
[0036] In this embodiment, by removing the overshoot value of the first peak-to-peak value, the validity of the data can be ensured, the accuracy of the average acceleration is improved, and the accuracy of the current resonant frequency is ensured. By downsampling the first peak-to-peak value, the amount of data can be effectively reduced, the efficiency of data processing is improved, and the efficiency of waveform file generation is improved.
[0037] In a second aspect, a device for generating a waveform file is provided, comprising a unit composed of software and / or hardware, which is used to execute any one of the methods in the technical solution described in the first aspect.
[0038] In a third aspect, an electronic device is provided, comprising a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that the electronic device executes any one of the methods in the technical solution described in the first aspect.
[0039] In a fourth aspect, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the processor executes any one of the methods in the technical solution described in the first aspect.
[0040] In a fifth aspect, a computer program product is provided, comprising: a computer program code, which, when executed on a terminal device, enables the terminal device to execute any one of the methods in the technical solution described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 1 is a schematic structural diagram of a terminal device 100 provided in an embodiment of the present application;
[0042] Figure 2 is a software structure block diagram of the terminal device 100 provided in an embodiment of the present application;
[0043] Figure 3 This is a flow chart of a method for determining the current resonant frequency of a motor provided in an embodiment of the present application;
[0044] Figure 4 is a schematic diagram of an example of acquired acceleration data provided in an embodiment of the present application;
[0045] Figure 5 This is a graph of multiple average accelerations corresponding to multiple frequencies provided in an embodiment of the present application;
[0046] Figure 6 yes Figure 5 The curve diagram of the average acceleration after smoothing and filtering the data in;
[0047] Figure 7is a schematic diagram of acceleration data obtained when a motor is in a fixed state according to an embodiment of the present application;
[0048] Figure 8 is a schematic diagram of acceleration data obtained when a motor is suspended in the air, according to an embodiment of the present application;
[0049] Figure 9 This is a waveform diagram of the current resonant frequency obtained multiple times according to an embodiment of the present application;
[0050] Figure 10 This is a flow chart of a method for obtaining the current resonant frequency provided in an embodiment of the present application;
[0051] Figure 11 This is a schematic diagram of an example of voltage data provided in an embodiment of the present application;
[0052] Figure 12 This is a flow chart of a method for generating a waveform file provided in an embodiment of the present application;
[0053] Figure 13 This is a schematic diagram of an example of corresponding waveform files according to sampling time provided in an embodiment of the present application;
[0054] Figure 14 This is a schematic diagram of an example of voltage data provided in an embodiment of the present application;
[0055] Figure 15 This is a schematic diagram of the number of voltage data points in each cycle in a waveform file of different frequencies provided in an embodiment of the present application;
[0056] Figure 16 This is a schematic diagram of a waveform file with a complete cycle provided in an embodiment of the present application;
[0057] Figure 17 This is a schematic diagram of a waveform file in which a waveform is mutated, provided in an embodiment of the present application;
[0058] Figure 18 1 is a schematic diagram of a waveform file after zero padding provided in an embodiment of the present application;
[0059] Figure 19 This is a structural diagram of an apparatus for generating a waveform file provided in an embodiment of the present application. DETAILED DESCRIPTION
[0060] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings in the embodiments of the present application. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships can exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0061] In the following, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the technical features indicated. Therefore, a feature specified as "first," "second," or "third" may explicitly or implicitly include one or more of the features.
[0062] The method for generating a waveform file provided in the embodiment of the present application can be applied to terminal devices such as mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR) / virtual reality (VR) devices, laptop computers, ultra-mobile personal computers (UMPCs), netbooks, and personal digital assistants (PDAs). The embodiment of the present application does not impose any restrictions on the specific type of terminal device.
[0063] For example, Figure 11 is a schematic diagram of the structure of an example terminal device 100 provided in an embodiment of the present application. The terminal device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identification module (SIM) card interface 195. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0064] It should be understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the terminal device 100. In other embodiments of the present application, the terminal 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.
[0065] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.
[0066] The controller may be the nerve center and command center of the terminal device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0067] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.
[0068] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface.
[0069] The I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple I2C bus lines. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, and the like via different I2C bus interfaces. For example, the processor 110 may be coupled to the touch sensor 180K via the I2C interface, enabling communication between the processor 110 and the touch sensor 180K via the I2C bus interface, thereby implementing the touch function of the terminal device 100.
[0070] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the I2S interface, enabling the function of answering calls through a Bluetooth headset.
[0071] The PCM interface can also be used for audio communication, sampling, quantizing, and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface, enabling the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
[0072] The UART interface is a universal serial data bus used for asynchronous communication. This bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is typically used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 via the UART interface to implement Bluetooth functionality. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the UART interface, enabling the function of playing music through Bluetooth headphones.
[0073] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display 194 and the camera 193. MIPI interfaces include the camera serial interface (CSI) and the display serial interface (DSI). In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the camera function of the terminal device 100. The processor 110 and the display 194 communicate via the DSI interface to implement the display function of the terminal device 100.
[0074] The GPIO interface can be configured via software. The GPIO interface can be configured as either a control signal or a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 to the camera 193, display 194, wireless communication module 160, audio module 170, sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
[0075] The USB interface 130 is an interface that complies with USB standards and may be a Mini USB interface, a Micro USB interface, a USB Type-C interface, or the like. The USB interface 130 can be used to connect a charger to charge the terminal device 100 and to transfer data between the terminal device 100 and peripheral devices. It can also be used to connect headphones to play audio. This interface can also be used to connect to other terminal devices, such as AR devices.
[0076] It is understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is merely an illustrative illustration and does not constitute a structural limitation on the terminal device 100. In other embodiments of the present application, the terminal device 100 may also adopt a different interface connection method from the above embodiments, or a combination of multiple interface connection methods.
[0077] The charging management module 140 is configured to receive charging input from a charger. The charger can be either a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 can receive wireless charging input via the wireless charging coil of the terminal device 100. While charging the battery 142, the charging management module 140 can also provide power to the terminal device via the power management module 141.
[0078] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and provides power to the processor 110, the internal memory 121, the external memory, the display 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage, impedance). In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0079] The wireless communication function of the terminal device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0080] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Figure 1The structures of antenna 1 and antenna 2 are merely examples. Each antenna in terminal device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with tuning switches.
[0081] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the terminal device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0082] 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-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 being processed by the baseband processor, the low-frequency baseband signal is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0083] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc. applied to the terminal device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0084] In some embodiments, the antenna 1 of the terminal device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the terminal device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0085] The terminal device 100 implements display functions through a GPU, display screen 194, and an application processor. The GPU is a microprocessor for image processing that connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.
[0086] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (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, terminal device 100 may include one or N display screens 194, where N is a positive integer greater than 1.
[0087] The terminal device 100 can realize the shooting function through the ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0088] The ISP processes data fed back by camera 193. 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 converted into a visible image. The ISP can also perform algorithmic optimization on image noise, brightness, and skin tone. 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 193.
[0089] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then passes the electrical signal 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 RGB, YUV or other format. In some embodiments, the terminal device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0090] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the terminal device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0091] Video codecs are used to compress or decompress digital video. Terminal device 100 may support one or more video codecs. This allows terminal device 100 to play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, and MPEG4.
[0092] The NPU is a neural network (NN) computing processor. Drawing on the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it rapidly processes input information and can continuously self-learn. The NPU can enable intelligent cognitive applications in the terminal device 100, such as image recognition, face recognition, speech recognition, and text comprehension.
[0093] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal device 100. The external memory card communicates with the processor 110 via the external memory interface 120 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.
[0094] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the terminal device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area can store data created during the use of the terminal device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0095] The terminal device 100 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0096] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be provided in the processor 110, or some functional modules of the audio module 170 can be provided in the processor 110.
[0097] The speaker 170A, also called a "speaker", is used to convert audio electrical signals into sound signals. The terminal device 100 can listen to music or listen to hands-free calls through the speaker 170A.
[0098] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals. When the terminal device 100 receives a call or voice message, the user can hear the voice by placing the receiver 170B close to the ear.
[0099] Microphone 170C, also known as "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to the microphone 170C to input the sound signal into the microphone 170C. The terminal device 100 can be provided with at least one microphone 170C. In other embodiments, the terminal device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the terminal device 100 can also be provided with three, four or more microphones 170C to realize sound signal collection, noise reduction, and can also identify the source of sound, realize directional recording function, etc.
[0100] The headphone jack 170D is used to connect a wired headphone and can be the USB interface 130 or a 3.5mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0101] Pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 180A can be located on display screen 194. There are many types of pressure sensors 180A, such as resistive, inductive, and capacitive. A capacitive pressure sensor can include at least two parallel plates made of conductive material. When force is applied to pressure sensor 180A, the capacitance between the electrodes changes. Terminal device 100 determines the intensity of the pressure based on this change in capacitance. When a touch operation is applied to display screen 194, terminal device 100 detects the intensity of the touch operation based on pressure sensor 180A. Terminal device 100 can also calculate the location of the touch based on the detection signal from pressure sensor 180A. In some embodiments, touch operations applied to the same touch location but with different touch operation intensities can correspond to different operation instructions. For example, when a touch operation with an intensity less than a first pressure threshold is applied to a short message application icon, an instruction to view short messages is executed. When a touch operation with an intensity greater than or equal to the first pressure threshold is applied to a short message application icon, an instruction to create a new short message is executed.
[0102] The gyroscope sensor 180B can be used to determine the motion posture of the terminal device 100. In some embodiments, the angular velocity of the terminal device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyroscope sensor 180B. The gyroscope sensor 180B can be used for shooting anti-shake. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of the terminal 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 terminal device 100 through reverse movement to achieve anti-shake. The gyroscope sensor 180B can also be used for navigation and somatosensory game scenes.
[0103] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the terminal device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist in positioning and navigation.
[0104] The magnetic sensor 180D includes a Hall effect sensor. The terminal device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip case. In some embodiments, when the terminal device 100 is a flip phone, the terminal device 100 can detect the opening and closing of the flip cover based on the magnetic sensor 180D. Furthermore, based on the detected opening and closing status of the case or flip cover, features such as automatic unlocking of the flip cover can be configured.
[0105] Accelerometer 180E can detect the magnitude of acceleration of the terminal device 100 in all directions (generally three axes). When the terminal device 100 is stationary, it can detect the magnitude and direction of gravity. It can also be used to identify the terminal device's posture, enabling applications such as switching between landscape and portrait modes and pedometers.
[0106] The distance sensor 180F is used to measure distance. The terminal device 100 can measure distance using infrared or laser. In some embodiments, when shooting a scene, the terminal device 100 can use the distance sensor 180F to measure distance to achieve fast focusing.
[0107] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The terminal device 100 emits infrared light outward through the light emitting diode. The terminal device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the terminal device 100. When insufficient reflected light is detected, the terminal device 100 can determine that there is no object near the terminal device 100. The terminal device 100 can use the proximity light sensor 180G to detect when the user holds the terminal device 100 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.
[0108] Ambient light sensor 180L is used to sense ambient light brightness. Terminal device 100 can adaptively adjust the brightness of display screen 194 based on the perceived ambient light. Ambient light sensor 180L can also be used to automatically adjust white balance when taking photos. Ambient light sensor 180L can also work with proximity light sensor 180G to detect whether terminal device 100 is in a pocket to prevent accidental touches.
[0109] The fingerprint sensor 180H is used to collect fingerprints. The terminal device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
[0110] The temperature sensor 180J is used to detect temperature. In some embodiments, the terminal device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the terminal device 100 reduces the performance of the processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the terminal device 100 heats the battery 142 to prevent the terminal device 100 from shutting down abnormally due to low temperature. In other embodiments, when the temperature is lower than another threshold, the terminal device 100 boosts the output voltage of the battery 142 to prevent abnormal shutdown due to low temperature.
[0111] The touch sensor 180K is also called a "touch panel." The touch sensor 180K can be provided on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen." The touch sensor 180K is used to detect touch operations applied thereto or in the vicinity thereof. The touch sensor can transmit the detected touch operations to the application processor to determine the type of touch event. Visual output related to the touch operations can be provided via the display screen 194. In other embodiments, the touch sensor 180K can also be provided on the surface of the terminal device 100, at a location different from that of the display screen 194.
[0112] The bone conduction sensor 180M can obtain vibration signals. In some embodiments, the bone conduction sensor 180M can obtain vibration signals from the vibrating bones of the human body. The bone conduction sensor 180M can also contact the human pulse to receive blood pressure pulse signals. In some embodiments, the bone conduction sensor 180M can also be set in headphones to form bone conduction headphones. The audio module 170 can parse out voice signals based on the vibration signals of the vibrating bones of the human body obtained by the bone conduction sensor 180M to implement voice functions. The application processor can parse heart rate information based on the blood pressure pulse signals obtained by the bone conduction sensor 180M to implement heart rate detection functions.
[0113] The buttons 190 include a power button, a volume button, etc. The buttons 190 may be mechanical buttons or touch buttons. The terminal device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the terminal device 100.
[0114] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
[0115] The indicator 192 may be an indicator light, which may be used to indicate the charging status, power level changes, messages, missed calls, notifications, etc.
[0116] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and disconnected from the terminal device 100 by inserting or removing it from the SIM card interface 195. The terminal device 100 can support one or N SIM card interfaces, where N is a positive integer greater than one. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 simultaneously. The multiple cards can be of the same or different types. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The terminal device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the terminal device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the terminal device 100 and cannot be separated from the terminal device 100.
[0117] The software system of the terminal device 100 can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. In the embodiment of the present application, the Android system with a layered architecture is used as an example to illustrate the software structure of the terminal device 100.
[0118] Figure 2 This is a software structure diagram of the terminal device 100 in an embodiment of the present application. The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer. The application layer can include a series of application packages.
[0119] like Figure 2 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
[0120] 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.
[0121] like Figure 2 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.
[0122] The window manager is used to manage window programs. The window manager can obtain the display size, determine whether there is a status bar, lock the screen, take screenshots, etc.
[0123] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0124] The view system includes visual controls, such as those for displaying text and images. The view system is used to build applications. A display interface can consist of one or more views. For example, a display interface containing a text notification icon might include a view for displaying text and a view for displaying images.
[0125] The phone manager is used to provide communication functions of the terminal device 100, such as management of call status (including answering, hanging up, etc.).
[0126] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0127] The Notification Manager allows applications to display notifications in the status bar. These messages can be displayed briefly and then disappear automatically, without requiring user interaction. For example, the Notification Manager can be used to notify users of completed downloads and message reminders. The Notification Manager can also display notifications in the top status bar of the system as icons or scrolling text, such as notifications from background applications, or as dialog windows on the screen. Examples include displaying text messages in the status bar, emitting alert sounds, vibrating the device, or flashing indicator lights.
[0128] The Android runtime includes the core library and the virtual machine. The Android runtime is responsible for scheduling and management of the Android system.
[0129] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.
[0130] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.
[0131] The system library can include multiple functional modules, such as a surface manager, media libraries, a 3D graphics processing library (such as OpenGL ES), and a 2D graphics engine (such as SGL).
[0132] The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.
[0133] 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.
[0134] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0135] A 2D graphics engine is a drawing engine for 2D drawings.
[0136] The kernel layer is the layer between hardware and software. The kernel layer includes at least display driver, camera driver, audio driver, and sensor driver.
[0137] For ease of understanding, the following examples of this application will be described with Figure 1 and Figure 2 Taking the terminal device of the structure shown as an example, in combination with the accompanying drawings and application scenarios, the method for generating a waveform file provided by the embodiment of the present application is specifically described. Generally, a linear motor generates vibration by the movement of a vibrator in a magnetic field. Different linear motors have different vibration sensations due to different resonant frequencies. Each linear motor has its own resonant frequency. If the linear motor is driven according to its own resonant frequency, the vibration sensation of the linear motor is the strongest, that is, the amplitude is the strongest. Generally, as the linear motor (hereinafter referred to as the motor) is used, the resonant frequency may shift. When the resonant frequency of the motor shifts, if the initial waveform file is still used to generate an AC drive signal, that is, if the motor is driven according to the initial resonant frequency, the vibration sensation will be weakened and the vibration effect cannot be guaranteed. The embodiment of the present application first obtains the resonant frequency corresponding to the motor by comparing the acceleration of the motor under AC drive signals of different frequencies, and then performs frequency conversion on the initial waveform file to obtain a waveform file corresponding to the resonant frequency to generate an AC drive signal to drive the motor, so that the motor can achieve the best vibration sensation when driven at its resonant frequency.
[0138] The technical solution of the embodiment of the present application can be used in the scenario where a Class D power amplifier (Class D) drives a motor. By using a Class D to drive a motor, the existing drive signal of the electronic device itself can be directly used, and the motor can be driven without adding other hardware costs. Even if the electronic device adds a Class D hardware circuit to obtain the drive signal, the cost is greatly reduced compared to adding a feedback circuit to achieve motor calibration. The above electronic device can be as follows Figure 1 The terminal device shown.
[0139] Here we first describe the detailed process of how the electronic device obtains the current resonant frequency of the motor in the current state.
[0140] Figure 3 This is a flow chart of a method for determining the current resonant frequency of a motor provided in an embodiment of the present application. Figure 3 As shown, the method 300 includes:
[0141] S310. Obtain multiple acceleration data corresponding to each AC drive signal when multiple AC drive signals drive the motor to vibrate, wherein the acceleration data is used to characterize the magnitude of the acceleration of the motor during vibration, and the frequencies of the multiple AC drive signals are distributed within the driving frequency range of the motor.
[0142] First, multiple frequency waveform files can be pre-installed in the electronic device. The frequencies corresponding to each of these multiple waveform files can cover the motor's driving frequency range, where the driving frequency range represents the distribution range of the motor's resonant frequency after the motor's resonant frequency shifts. For example, when the motor's initial resonant frequency is 235 Hz, the motor's resonant frequency is usually distributed within the range of 230 Hz-240 Hz after the resonant frequency shifts. In this case, it can be considered that the motor's driving frequency range is 230 Hz-240 Hz. In this case, the multiple frequency waveform files can include 11 frequency waveform files, including 230 Hz, 231 Hz, 232 Hz... and up to 240 Hz.
[0143] Specifically, the electronic device can use the waveform files of the above multiple frequencies to generate corresponding AC drive signals to drive the motor to vibrate respectively, and at the same time collect acceleration data during the vibration of the motor through the acceleration sensor. For example, the electronic device can use the AC drive signal generated by the waveform file corresponding to one frequency to drive the motor to vibrate for 500 milliseconds, stop for 50 milliseconds, and then use the AC drive signal generated by the waveform file corresponding to the next frequency to drive the motor to continue vibrating, thereby obtaining multiple acceleration data when each AC drive signal drives the motor to vibrate. Taking the driving frequency range of 230HZ-240HZ as an example, the frequency interval corresponding to each waveform file is 1HZ. The acceleration data when the AC drive signals generated by these multiple waveform files are used to drive the motor to vibrate can be seen as follows. Figure 4 As shown, the horizontal axis represents time and the vertical axis represents the acceleration data of the motor vibration. Figure 4 The acceleration data in the graph includes positive acceleration data (vertical axis coordinate is greater than 0) and negative acceleration data (vertical axis coordinate is less than 0). The above acceleration data can represent the magnitude of the acceleration of the motor during vibration.
[0144] S320 : Determine an average acceleration corresponding to each of the multiple AC drive signals according to the multiple acceleration data of the multiple AC drive signals.
[0145] Specifically, the electronic device can process and compare the acceleration data of the multiple AC drive signals to determine the average acceleration corresponding to each AC drive signal. For example, the electronic device can remove the negative values from the acceleration data, retain the positive values, and then average the maximum amplitudes of each cycle in the positive acceleration data to determine the average acceleration corresponding to the AC drive signal of that frequency. This average acceleration can represent the amplitude of vibration when the AC drive signal of the corresponding frequency drives the motor.
[0146] S330 . Determine the current resonant frequency according to a maximum average acceleration among a plurality of average accelerations of the plurality of AC drive signals, wherein the current resonant frequency is a frequency of the AC drive signal corresponding to the maximum average acceleration.
[0147] Specifically, the electronic device may compare the above-mentioned multiple average accelerations to obtain the maximum average acceleration, and then use the frequency corresponding to the maximum average acceleration as the current resonant frequency that can maximize the motor amplitude.
[0148] Optionally, the electronic device may also connect the above-mentioned multiple average accelerations in a coordinate system and generate a curve graph, such as Figure 5 As shown, the horizontal axis is the number of points and the vertical axis is the acceleration. Figure 5 The average acceleration of 41 points is used as an example. Figure 5 The data in is smoothed and filtered to obtain Figure 6 Then Figure 6The frequency corresponding to the maximum average acceleration in the frequency is superimposed with a preset frequency offset as the current resonant frequency. For example, when the frequency interval corresponding to each AC drive signal is 1HZ, the electronic device uses the data of four average accelerations for smoothing filtering, that is, the average of the average accelerations corresponding to the four nearby frequencies is used as the average acceleration corresponding to the current frequency, and then the frequency corresponding to the maximum average acceleration plus 2HZ is used as the current resonant frequency. Optionally, the electronic device can write the final value of the current resonant frequency into the corresponding non-volatile (NV) parameter item for subsequent call. Using smoothing filtering to process multiple average accelerations to obtain the maximum average acceleration can effectively remove interference noise and make the current resonant frequency more accurate.
[0149] In this embodiment, the electronic device obtains multiple acceleration data corresponding to each AC drive signal when multiple AC drive signals drive the motor to vibrate. Since the frequencies of the above-mentioned multiple AC drive signals are distributed within the driving frequency range of the motor, the electronic device can use a frequency sweep method to obtain multiple acceleration data corresponding to multiple frequencies within the driving frequency range. The electronic device then accurately and conveniently determines the current resonant frequency corresponding to the maximum average acceleration based on the maximum average acceleration among the average accelerations corresponding to each AC signal. This method does not require adjusting the frequency of the motor by adding a feedback circuit, thus saving costs. At the same time, since this method does not add a feedback circuit, it has lower hardware requirements and a wider range of application scenarios.
[0150] Optionally, in the above Figure 3 Based on the illustrated embodiment, one implementation of step S320 may further include: for ease of calculation, the electronic device removes negative values from the acceleration data corresponding to each of the multiple AC drive signals, i.e., taking a peak-to-peak value of the acceleration data corresponding to each AC drive signal, and then determining an average acceleration corresponding to each of the multiple AC drive signals based on the peak-to-peak value of each AC drive signal. Determining the average acceleration using the peak-to-peak value maximizes the differences between data, facilitating screening and comparison, compared to directly removing negative values.
[0151] Optionally, the acceleration data is usually periodic data, and the electronic device can take the original peak-to-peak value of this periodic acceleration data as the first peak-to-peak value. Usually, there will be overshoot when the motor starts to vibrate, so the overshoot value within a period of time after the vibration starts can be deleted to ensure the validity of the data. For example, when the first peak-to-peak value of each AC drive signal has 250 points of data, the first 80 points can be deleted to effectively remove the overshoot. Optionally, the electronic device can also downsample the first peak-to-peak value according to a preset sampling rate, for example, taking a first peak-to-peak value every 20 points as the above-mentioned peak-to-peak value. The preset sampling rate can be set according to the data accuracy requirements and computing efficiency. If the data accuracy requirements are high, a first peak-to-peak value can be taken every 10 points or less. If the computing efficiency requirements are high, a first peak-to-peak value can be taken every 30 points or more. The setting of the preset sampling rate is not limited in this embodiment of the application.
[0152] Optionally, the electronic device can also simultaneously remove overshoot values from the first peak-to-peak value and perform downsampling to ensure data validity, reduce the amount of computation, and improve data processing efficiency. Optionally, the electronic device can also remove overshoot points from the acceleration data and / or downsample the acceleration data at a preset sampling rate before obtaining the peak-to-peak value of the processed acceleration data. This can also ensure data validity and reduce the amount of computation, thereby improving data processing efficiency and, in turn, improving the efficiency of waveform file generation.
[0153] In the actual process of collecting acceleration data, the motor can be placed in a fixed state for collection. In this way, the overshoot of the acceleration data obtained in the fixed state will be greatly reduced, thereby reducing the peak-to-peak overshoot and further improving the accuracy of the current resonant frequency determined. Figure 7 and Figure 8 As shown, Figure 7 This is the acceleration data collected when the motor is fixed. Figure 8 This is the acceleration data collected when the motor is suspended. In comparison, Figure 8 When driven by AC drive signals of multiple frequencies, the motor has obvious overshoot when it starts to vibrate, which is manifested in Figure 8 In the middle, there are multiple protruding burrs.
[0154] Optionally, the electronic device may also repeat the above method multiple times to obtain multiple current resonant frequencies multiple times to observe the consistency of these current resonant frequencies to ensure the accuracy and effectiveness of the obtained current resonant frequencies. Figure 9As shown, after five tests, the current resonant frequency is distributed between 228HZ and 229HZ, and an error of plus or minus 2HZ is usually allowed. If the driving frequency range of the motor is 230HZ-240HZ, it can be determined that the motor adopts a resonant frequency of 230HZ; if the driving frequency range of the motor is 225HZ-235HZ, it can be determined that the vibration is strongest when driven by an AC driving signal of 228HZ.
[0155] In order to more clearly describe how to obtain the current resonant frequency, a specific embodiment is used for illustration. Figure 10 As shown, the method 1000 for an electronic device to obtain a current resonant frequency may include the following steps:
[0156] S1010 , obtaining acceleration data when the motor is driven by AC drive signals of 11 frequencies every 1 Hz between 230 Hz and 240 Hz.
[0157] S1020. For the acceleration data, take the peak-to-peak value of the acceleration data at every 20 points.
[0158] S1030 , obtaining an average acceleration corresponding to the AC drive signal of each frequency according to the peak-to-peak value corresponding to each AC drive signal, and obtaining average accelerations corresponding to 11 frequency points.
[0159] S1040 : For the 11 average accelerations, average every four of them to obtain a smoothed and filtered average acceleration.
[0160] S1050: Take the maximum value of the average acceleration after smoothing filtering.
[0161] S1060 , adding 2 Hz to the frequency of the AC drive signal corresponding to the maximum value of the average acceleration after smoothing and filtering as the current resonant frequency.
[0162] S1070: Write the current resonant frequency into the corresponding NV.
[0163] The implementation details and beneficial effects of obtaining the current resonant frequency in this embodiment can be found in the description of the aforementioned embodiment, which will not be repeated here.
[0164] The above embodiment describes how the electronic device obtains the current resonant frequency of the motor. The following describes a specific process of how to generate a waveform file for driving the motor based on the current resonant frequency.
[0165] The embodiment of the present application can be realized by spreading the initial waveform file of the initial resonant frequency. First, we define the first proportional coefficient, that is, the ratio of the current resonant frequency to the initial resonant frequency as the proportional coefficient. Taking the current resonant frequency as 232HZ and the initial resonant frequency as 235HZ as an example, the proportional coefficient Vision = 232 / 235, and the proportional coefficient can be a floating point number. Optionally, if the CPU core cannot perform floating point calculations, the numerical value can be uniformly expanded by 10,000 times for calculation. Then define a weight coefficient, and the weight coefficient a0 is used to characterize the degree of correlation between the voltage data of the current resonant frequency and the voltage data of the sampling point of the initial resonant frequency at the corresponding point. It can be obtained by the formula a0 = (index+1) × Vision-(index+1) or a variation of the formula, where index is the serial number of the voltage data, which is a variable and is usually used as the subscript of the voltage data N. The voltage data corresponding to the current resonant frequency can be obtained by the formula
[0166]
[0167] Or a variation of the formula. Here, index is incremented by 1 starting from 1, thereby obtaining voltage data at multiple points corresponding to the current resonant frequency, forming a transformed waveform file that can drive the motor to vibrate according to the current resonant frequency.
[0168] However, when using the above method to generate waveform files, as the index becomes larger and larger, the voltage data obtained each time will also become larger and larger, such as Figure 11 As shown, the amplitude of the voltage data corresponding to the generated waveform file becomes larger and larger, which is unreasonable. Therefore, we improve the above-mentioned spectrum spreading process, and the details can be seen in the following embodiments.
[0169] Figure 12 This is a flow chart of a method for generating a waveform file provided in an embodiment of the present application. Figure 12 As shown, the method 1200 includes:
[0170] S1210 : Obtain the initial resonant frequency and current resonant frequency of the motor.
[0171] Specifically, the electronic device obtains the initial resonant frequency and the current resonant frequency. The current resonant frequency can be obtained using the method for obtaining the current resonant frequency described in the above embodiment. The initial resonant frequency can be the frequency corresponding to the initial waveform file. The initial waveform file is a waveform file corresponding to a specific frequency, which can generate an AC drive signal of the initial resonant frequency to drive the motor to vibrate. It can be pre-stored in the electronic device or stored in a cloud device for easy access.
[0172] S1220: When the initial resonant frequency and the current resonant frequency are different, determine a third voltage amplitude according to the first voltage amplitude and the second voltage amplitude.
[0173] Typically, if the initial resonant frequency and the current resonant frequency are different, the initial waveform file needs to be converted. If the initial resonant frequency and the current resonant frequency are the same, no waveform file conversion is required. The waveform file conversion process mainly converts the voltage data of each sampling point in the initial waveform file into new voltage data.
[0174] Here, the voltage data, such as the amplitude, of two adjacent sampling points of the AC drive signal corresponding to the initial resonant frequency is used as the first voltage amplitude and the second voltage amplitude, wherein the sampling time of the first voltage amplitude is before the second voltage amplitude, that is, the phase corresponding to the first voltage amplitude is smaller than the phase corresponding to the second voltage amplitude.
[0175] First, define the first proportional coefficient Vision1, and take the ratio of the current resonant frequency to the initial resonant frequency as the first proportional coefficient, that is, Vision1 = F0 / F, where F0 is the current resonant frequency and F is the initial resonant frequency. Here, the second weight coefficient a is obtained according to the first proportional coefficient according to the formula a = (index+1) × Vision1-ROUNDDOWN(index+1) × Vision1 or a variation of the formula, where "ROUNDDOWN" is a function that rounds the absolute value, D = ROUNDDOWN(index+1) × Vision1, and the first weight coefficient b = 1-a. Then the third voltage amplitude can be obtained according to the formula N index ×b+N index+1 ×a or N index ×(1-a)+N index+1 ×a, or the transformation of these two formulas, where N index is the first voltage amplitude, N index+1 Then it is the second voltage amplitude.
[0176] It can be understood that the phase at a sampling point in the initial waveform file can be multiplied by the first proportional coefficient to obtain the phase of the corresponding sampling point in the current waveform file. If the phase interval between each sampling point is considered as a time unit, the magnitude of the phase difference between the phase of the sampling point in the current waveform file and the phase at the corresponding sampling point in the initial waveform file can be represented by the fractional part of the product of the sum of the sampling point's sequence number plus one and the first proportional coefficient, i.e., a = (index+1)×Vision1-ROUNDDOWN(index+1)×Vision1. Since the phase at each sampling point is considered as a time unit, a is a normalized value. When the starting points of the current waveform file and the initial waveform file are aligned, a can be used to represent the distance between the third voltage amplitude and the first voltage amplitude on the time axis. The phase difference between the phase corresponding to the sampling point in the current waveform file and the phase at the next sampling point in the corresponding initial waveform file can be represented by b = 1-a to represent the distance between the third voltage amplitude and the second voltage amplitude. By using the first weight coefficient and the second weight coefficient, the first voltage amplitude and the second voltage amplitude can be weighted according to the distance between the third voltage amplitude and the first voltage amplitude and the second voltage amplitude to obtain the third voltage amplitude.
[0177] Take the current resonant frequency as 232HZ and the initial resonant frequency as 235HZ as an example, see Figure 13 As shown, the digital axis is used as the phase corresponding to the voltage data to represent the time of the sampling point. On the digital axis of 235HZ, taking the second sampling point and the third sampling point as an example, 1 / 235 is the second sampling point, and the voltage data here is the first voltage amplitude. 2 / 235 is the third sampling point, and the voltage data here is the second voltage amplitude. Then on the digital axis of 232HZ, the third voltage amplitude at 1 / 232 can be calculated according to the formula N index ×(1-a)+N index+1 ×a or a modified version of this formula. Figure 13 As shown, the phase corresponding to the third voltage amplitude is greater than the phase corresponding to the first voltage amplitude and less than the phase corresponding to the second voltage amplitude, that is, the time difference between the third voltage amplitude and the first sampling point of the current waveform file, that is, the starting point of the current waveform file, is greater than the time difference between the first voltage amplitude and the first sampling point of the initial waveform file, that is, the starting point of the initial waveform file, and is less than the time difference between the second voltage amplitude and the starting point of the initial waveform file. Figure 13 In the equation, the horizontal coordinate of the third voltage amplitude at 1 / 232 corresponds to the horizontal coordinate between the first voltage amplitude and the second voltage amplitude. The difference between the phase corresponding to the third voltage amplitude and the phase corresponding to the first voltage amplitude is taken as the first phase difference, and the difference between the phase corresponding to the third voltage amplitude and the second voltage amplitude is taken as the second phase difference. Figure 13It can be seen that the sum of the first phase difference and the second phase difference can represent a time unit, so the electronic device divides the first phase difference by the sum of the first phase difference and the second phase difference to obtain the value as the second weight coefficient a, that is, using the formula a = (index + 1) × Vision1-ROUNDDOWN (index + 1) × Vision1, obtain the normalization coefficient corresponding to the phase difference corresponding to the third voltage amplitude and the first voltage amplitude, as the second weight coefficient a, a can represent the degree of distance between the third voltage amplitude and the first voltage amplitude; divide the second phase difference by the sum of the first phase difference and the second phase difference to obtain the value as the first weight coefficient b, or use the formula b = 1-a to obtain the normalization coefficient corresponding to the phase difference corresponding to the third voltage amplitude and the second voltage amplitude, as the first weight coefficient b, b can represent the degree of distance between the third voltage amplitude and the second voltage amplitude. The product of the above-mentioned first voltage amplitude and the first weight coefficient is taken as the first value, that is, the first value is N index ×(1-a) or N index ×b, the product of the second voltage amplitude and the second weight coefficient is taken as the second value, that is, the second value is N index+1 ×a, wherein the third voltage amplitude is positively correlated with the sum of the first value and the second value. For example, the first value N index ×(1-a) plus the second value N index+1 ×a, as the third voltage amplitude. Optionally, if the third voltage amplitude is the first sampling point corresponding to the current resonant frequency, the voltage data of the first sampling point of the initial waveform file, that is, the voltage data of the first sampling point, is directly used as the voltage data of the first sampling point corresponding to the current resonant frequency.
[0178] S1230. Generate a current waveform file according to the third voltage amplitude, wherein the current waveform file is used to generate an AC drive signal corresponding to the current resonant frequency, and the third voltage amplitude is a sampling point of the AC drive signal corresponding to the current resonant frequency.
[0179] Specifically, the electronic device calculates multiple third voltage amplitudes at the current resonant frequency point by point, thereby obtaining voltage data at multiple sampling points of the AC drive signal corresponding to the current resonant frequency, and generating a current waveform file. It should be noted that this current waveform file can generate an AC drive signal corresponding to the current resonant frequency, which is used to drive the motor to vibrate at the resonant frequency.
[0180] In this embodiment, since the first voltage amplitude and the second voltage amplitude are the amplitudes of two adjacent sampling points of the AC drive signal corresponding to the initial resonant frequency, the phase corresponding to the third voltage amplitude is greater than the phase corresponding to the first voltage amplitude and less than the phase corresponding to the second voltage amplitude, the difference between the phase corresponding to the third voltage amplitude and the phase corresponding to the first voltage amplitude is the first phase difference, the difference between the phase corresponding to the third voltage amplitude and the phase corresponding to the second voltage amplitude is the second phase difference, the third voltage amplitude is positively correlated with the sum of the first value and the second value, the first value is the product of the first voltage amplitude and the first weight coefficient, the second value is the product of the second voltage amplitude and the second weight coefficient, the first weight coefficient is the value obtained by dividing the second phase difference by the sum of the first phase difference and the second phase difference, and the second weight coefficient is the value obtained by dividing the first phase difference by the sum of the first phase difference and the second phase difference. Therefore, based on the above data relationship, the electronic device determines the third voltage amplitude based on the first voltage amplitude and the second voltage amplitude, and can use the second weight coefficient and the first weight coefficient, which characterize the degree of proximity of the third voltage amplitude to the first voltage amplitude and the second voltage amplitude, to reasonably weight the first voltage amplitude and the second voltage amplitude, thereby obtaining a reasonably accurate third voltage amplitude. Therefore, based on the current waveform file generated by the third voltage amplitude, the initial waveform file of the initial resonant frequency is converted to the current waveform file of the current resonant frequency, thereby generating an AC drive signal to drive the motor. Compared with the traditional method of motor calibration using a feedback circuit, adjusting the motor frequency by adding a feedback circuit saves costs. At the same time, since this method does not add a feedback circuit, it has lower hardware requirements and is applicable to a wider range of scenarios.
[0181] use Figure 12 The voltage data corresponding to the waveform file generated by the method shown can be Figure 14 As shown in the figure, this method will not cause the voltage data to become larger and larger, so the data is more reasonable.
[0182] Optionally, based on the above embodiment, when the current resonant frequency is less than the initial resonant frequency, the number of sampling points of the current waveform file obtained will increase, for example Figure 15 As shown, when a 235 Hz AC drive signal is used, the number of sampling points of the voltage data in one cycle is 409; when a 230 Hz AC drive signal is used, the number of sampling points of the voltage data in one cycle is 400; and when a 240 Hz AC drive signal is used, the number of sampling points of the voltage data in one cycle is 418. If the number of sampling points increases, the generated current waveform file may not be a file with a complete waveform cycle. In this case, the number of sampling points can be determined through this embodiment to obtain a current waveform file with a complete cycle. A possible implementation of the above step S1230 may include:
[0183] The electronic device will be the number of voltage data in the initial waveform file Point SUM Divide by the number of cycles of the AC drive signal corresponding to the initial waveform file, that is, divide by the first cycle number T, as the number of voltage data belonging to one AC drive signal cycle in the initial waveform file, usually the number is an integer. That is, the first data number T point =Point SUM / T, or T point =ROUNDDOWN(Point SUM / T). The electronic device uses the ratio of the initial resonant frequency F to the current resonant frequency F0 as the first conversion coefficient, and rounds the product of the first data quantity and the first conversion coefficient as the second data quantity, that is, the second data quantity T 1point For T point ×(F / F0) is the value obtained after rounding. Usually T 1point =ROUNDDOWN(T point ×(F / F0)), when the product of the first data quantity and the first transform coefficient is an integer, T 1point =T point ×(F / F0). The second data quantity is the number of voltage data belonging to one AC drive signal cycle in the current waveform file. The electronic device uses the ratio of the current resonant frequency F0 to the initial resonant frequency F as the second conversion coefficient, and rounds the product of the second conversion coefficient and the first number of cycles as the second number of cycles, that is, the second number of cycles T1 = ROUNDDOWN(T×(F0 / F)). The second number of cycles is the number of cycles corresponding to the voltage data contained in the current waveform file. Afterwards, the electronic device calculates the second number of cycles based on the second data quantity T 1point The electronic device generates the current waveform file based on the second data number T1 and the third voltage amplitude. 1point The number of voltage data NewPoint required by the current waveform file is determined by the second cycle number T1 SUM , such as NewPoint SUM =T1×T 1point . The second data quantity T 1point The product of the second cycle number T1 is used as the number of voltage data required by the current waveform file. The electronic device generates multiple third voltage amplitudes according to NewPoint SUM Extraction is performed, that is, the value of the third voltage amplitude that exceeds NewPoint SUM A certain amount of voltage data is deleted to ensure that the AC driving signal generated by the current waveform file is a full-cycle signal, thereby ensuring continuous vibration.
[0184] In one embodiment, the initial resonant frequency is 235 Hz, the current resonant frequency is 232 Hz, and when the first cycle number T is 24, the number of voltage data in the initial waveform file Point SUM is 9880, thus obtaining the number of data T point =Point SUM The integer part of / T is 411, that is, there are 408 data in each cycle of the AC drive signal in the initial waveform file. Then the electronic device calculates the second data quantity T 1point T point ×(F / F0) the integer part can be obtained T 1point =411×(235 / 232)=416. Then the electronic device uses the formula T1=ROUNDDOWN(T×(F0 / F))=ROUNDDOWN(24×(232 / 235))=23 to obtain the second cycle number T1 as 23. Finally, the number of voltage data required by the current waveform file is NewPoint SUM =T1×T 1point =23×416=9568. The electronic device extracts the first 9568 voltage data from the generated third voltage amplitude to generate a current waveform file, and discards the remaining data.
[0185] In this embodiment, the electronic device uses the first transformation coefficient and the second transformation coefficient to characterize the proportional relationship between the current resonant frequency and the initial resonant frequency, and based on the first transformation coefficient and the second transformation coefficient, respectively, according to the first cycle number and the first data number of the initial waveform file, obtains the second cycle number and the second data number required for the current waveform file, and further obtains the number of voltage data required for the current waveform file according to the product of the second cycle number and the second data number. Then, the third voltage amplitude is extracted according to the required number of voltage data, thereby removing part of the voltage data to obtain the waveform file data of a complete cycle, so as to ensure the continuity of the vibration feeling and improve the user experience.
[0186] Optionally, when the vibration mode of the motor is a long vibration mode, for example, in a ringing state, such as a call vibration or an alarm vibration, the initial waveform file usually does not store a very long waveform. If it is a long vibration mode, it is necessary to convert the frequency of the initial waveform file and then cyclically drive the motor to meet the vibration duration. If the current waveform file after the conversion is not a complete cycle, the vibration will be discontinuous during the cycle. Using the above embodiment, the electronic device obtains the required number of voltage data, extracts the third voltage amplitude according to the required number of voltage data, and thus obtains the current waveform file of the complete cycle, for example Figure 16 As shown, Figure 16The waveform in the file is a complete cycle waveform, which can ensure the continuity of the waveform when the motor is driven in a loop. Therefore, in the long vibration mode, using the current waveform file to drive the motor in a loop will not cause discontinuous vibration, thereby improving the user experience.
[0187] In one embodiment, when the current resonant frequency is greater than the initial resonant frequency, the electronic device can obtain the number of voltage data in the initial waveform file data. Since the number of third voltage amplitudes obtained after frequency conversion is less than the number of voltage data in the initial waveform file data when the current resonant frequency is greater than the initial resonant frequency, the remaining vacancies are padded with zeros without changing the data length of the waveform file, thereby obtaining an updated waveform file so that the number of voltage data in the updated waveform file is the same as the number of voltage data in the initial waveform file. For example, if the initial waveform file has 9880 data points and the number of voltage data in the current waveform file is 9568, the remaining vacancies of 9880-9568=312 points are padded with zeros. By padding the current waveform file with zeros to obtain an updated waveform file with the same number of voltage data as in the initial waveform file, the electronic device can avoid changing the stored data length of the waveform file, thereby facilitating data storage, reducing the amount of computation, and ensuring the accuracy of data processing.
[0188] On the basis of the above embodiment, when the vibration mode of the motor is a short vibration mode, such as when the motor vibrates when a key is touched or a call is successfully connected, the above initial resonant frequency can be the minimum vibration frequency of the motor. If the frequency of the pre-stored waveform file is high and the current resonant frequency is low, the number of sampling points will increase after the frequency conversion of the waveform file. If the number of storage bits for storing voltage data remains unchanged, and the duration corresponding to the initial waveform file is less than the duration of the short vibration, waveform loss may occur, for example Figure 17 As shown, the last waveform has obviously mutated. In this case, the problem can be solved by pre-storing an initial waveform file with a low frequency. That is, the current resonant frequency is greater than the above-mentioned minimum vibration frequency, and the number of voltage data in the current waveform file generated is less than the number of voltage data in the initial waveform file corresponding to the minimum vibration frequency. At this time, the electronic device can fill the remaining spaces with zeros without changing the data length of the waveform file. For example, when in short vibration mode, the initial waveform file corresponds to 230HZ, which is the minimum resonant frequency of the motor. At this time, the electronic device fills the number of voltage data in the initial waveform file of the minimum resonant frequency with zeros in the current waveform file, and obtains an updated waveform file with the same number of voltage data as in the initial waveform file, thereby avoiding changing the stored data length of the initial waveform file, thus facilitating data storage, reducing the amount of calculation, and ensuring the accuracy of data processing. The waveform file after zero filling can be found in Figure 18 As shown, there is no waveform variation.
[0189] The above describes in detail an example of a method for generating a waveform file provided by the present application. It is understandable that, in order to implement the above functions, the corresponding device includes a hardware structure and / or software module corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example 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 a hardware or computer software driven hardware manner 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.
[0190] The present application can divide the functional modules of the device for generating a waveform file according to the above method example. For example, each function can be divided into each functional module, or two or more functions can be integrated into one module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in this application is schematic and is only a logical functional division. In actual implementation, there may be other division methods.
[0191] Figure 19 The schematic diagram of the structure of a device for generating a waveform file provided by the present application is shown. The device 1900 includes an acquisition module 1901, a determination module 1902, and a generation module 1903.
[0192] The acquisition module 1901 is used to acquire the initial resonant frequency and the current resonant frequency of the motor.
[0193] Determination module 1902 is configured to determine, when the initial resonant frequency and the current resonant frequency are different, a third voltage amplitude based on a first voltage amplitude and a second voltage amplitude, where the first voltage amplitude and the second voltage amplitude are amplitudes of two adjacent sampling points of the AC drive signal corresponding to the initial resonant frequency, wherein a phase corresponding to the third voltage amplitude is greater than a phase corresponding to the first voltage amplitude and less than a phase corresponding to the second voltage amplitude, a difference between the phase corresponding to the third voltage amplitude and the phase corresponding to the first voltage amplitude is a first phase difference, and a difference between the phase corresponding to the third voltage amplitude and the phase corresponding to the second voltage amplitude is a second phase difference, the third voltage amplitude is positively correlated with a sum of a first value and a second value, the first value is a product of the first voltage amplitude and a first weight coefficient, the second value is a product of the second voltage amplitude and a second weight coefficient, the first weight coefficient is a value obtained by dividing the second phase difference by the sum of the first phase difference and the second phase difference, and the second weight coefficient is a value obtained by dividing the first phase difference by the sum of the first phase difference and the second phase difference.
[0194] A generation module 1903 is configured to generate a current waveform file based on the third voltage amplitude, wherein the current waveform file is used to generate an AC drive signal corresponding to the current resonant frequency, and the third voltage amplitude is the amplitude of a sampling point of the AC drive signal corresponding to the current resonant frequency.
[0195] Optionally, when the current resonant frequency is less than the initial resonant frequency, the generation module 1903 is specifically used to: obtain a first data quantity, where the first data quantity is the number of voltage data belonging to one AC drive signal cycle in the initial waveform file, and the initial waveform file is the waveform file corresponding to the initial resonant frequency; determine a second data quantity based on the first data quantity and a first transformation coefficient, where the first transformation coefficient is the ratio of the current resonant frequency to the initial resonant frequency, the initial resonant frequency is the frequency of the AC drive signal corresponding to the initial waveform file, and the second data quantity is a value obtained by rounding the product of the first data quantity and the first transformation coefficient; obtain a first cycle number The first cycle number is the number of cycles of the AC drive signal corresponding to the initial waveform file; the second cycle number is determined according to the first cycle number and the second transformation coefficient, the second cycle number is the value obtained by rounding the product of the first cycle number and the second transformation coefficient, and the second transformation coefficient is the ratio of the initial resonant frequency to the current resonant frequency; the current waveform file is generated according to the second data number, the second cycle number and the third voltage amplitude, the second data number is the number of voltage data belonging to one AC drive signal cycle in the current waveform file, and the second cycle number is the number of cycles corresponding to the voltage data contained in the current waveform file.
[0196] Optionally, the vibration mode of the motor is a long vibration mode.
[0197] Optionally, when the current resonant frequency is greater than the initial resonant frequency, the generation module 1903 is also used to: perform zero-padding processing on the current waveform file to obtain an updated waveform file, the number of voltage data in the updated waveform file is the same as the number of voltage data in the initial waveform file, and the initial waveform file is the waveform file corresponding to the initial resonant frequency.
[0198] Optionally, the vibration mode of the motor is a short vibration mode, and the initial resonance frequency is the minimum vibration frequency of the motor.
[0199] Optionally, the acquisition module 1901 is specifically used to: obtain multiple acceleration data corresponding to each AC drive signal when multiple AC drive signals drive the motor to vibrate, the acceleration data is used to characterize the magnitude of the acceleration of the motor during vibration, and the frequencies of the multiple AC drive signals are distributed within the driving frequency range of the motor; determine the average acceleration corresponding to each AC drive signal in the multiple AC drive signals based on the multiple acceleration data of the multiple AC drive signals; determine the current resonant frequency based on the maximum average acceleration among the multiple average accelerations of the multiple AC drive signals, wherein the current resonant frequency is the frequency of the AC drive signal corresponding to the maximum average acceleration.
[0200] Optionally, the acquisition module 1901 is specifically used to: obtain the peak-to-peak value of acceleration data corresponding to each AC drive signal in the multiple AC drive signals; and determine the average acceleration corresponding to each AC drive signal in the multiple AC drive signals according to the peak-to-peak value.
[0201] Optionally, the peak-to-peak value is data obtained by removing the overshoot value from the first peak-to-peak value, and / or, the peak-to-peak value is data obtained by downsampling the first peak-to-peak value according to a preset sampling rate; the first peak-to-peak value is the original peak-to-peak value of the acceleration data corresponding to each AC drive signal in the multiple AC drive signals.
[0202] The specific manner in which the device 1900 executes the method for generating a waveform file and the beneficial effects produced can be found in the relevant description in the method embodiment.
[0203] The embodiment of the present application also provides an electronic device, including the above-mentioned processor. The electronic device provided by this embodiment can be Figure 1 The terminal device 100 shown is used to execute the above-mentioned method for generating a waveform file. If an integrated unit is used, the terminal device may include a processing module, a storage module, and a communication module. The processing module may be used to control and manage the terminal device's operations. For example, it may be used to support the terminal device in executing the steps performed by the display unit, detection unit, and processing unit. The storage module may be used to support the terminal device in executing and storing program code and data. The communication module may be used to support communication between the terminal device and other devices.
[0204] The processing module may be a processor or a controller. It may implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, and so on. The storage module may be a memory. The communication module may specifically be a device that interacts with other terminal devices, such as a radio frequency circuit, a Bluetooth chip, or a Wi-Fi chip.
[0205] In one embodiment, when the processing module is a processor and the storage module is a memory, the computer device involved in this embodiment may be a computer having Figure 1 Terminal equipment with the structure shown.
[0206] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the processor executes the method for generating a waveform file described in any of the above embodiments.
[0207] The embodiment of the present application further provides a computer program product. When the computer program product is run on a computer, the computer is caused to execute the above-mentioned related steps to implement the method for generating a waveform file in the above-mentioned embodiment.
[0208] Among them, the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0209] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, 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.
[0210] Units described as separate components may or may not be physically separate, and components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0211] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0212] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0213] The above content is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A method for generating a waveform file, characterized in that: include: Get the initial resonant frequency and current resonant frequency of the motor; When the initial resonant frequency and the current resonant frequency are different, a third voltage amplitude is determined according to a first voltage amplitude and a second voltage amplitude, the first voltage amplitude and the second voltage amplitude being amplitudes of two adjacent sampling points of the AC drive signal corresponding to the initial resonant frequency, wherein a phase corresponding to the third voltage amplitude is greater than a phase corresponding to the first voltage amplitude and less than a phase corresponding to the second voltage amplitude, a difference between the phase corresponding to the third voltage amplitude and the phase corresponding to the first voltage amplitude is a first phase difference, a difference between the phase corresponding to the third voltage amplitude and the phase corresponding to the second voltage amplitude is a second phase difference, the third voltage amplitude is positively correlated with a sum of a first value and a second value, the first value is a product of the first voltage amplitude and a first weight coefficient, the second value is a product of the second voltage amplitude and a second weight coefficient, the first weight coefficient is a value obtained by dividing the second phase difference by the sum of the first phase difference and the second phase difference, and the second weight coefficient is a value obtained by dividing the first phase difference by the sum of the first phase difference and the second phase difference; Generating a current waveform file according to the third voltage amplitude includes: calculating multiple third voltage amplitudes of the current resonant frequency point by point, obtaining voltage data of multiple sampling points of the AC drive signal corresponding to the current resonant frequency, and generating the current waveform file; wherein the current waveform file is used to generate the AC drive signal corresponding to the current resonant frequency, and the third voltage amplitude is the amplitude of a sampling point of the AC drive signal corresponding to the current resonant frequency.
2. The method according to claim 1, characterized in that When the current resonant frequency is less than the initial resonant frequency, generating a current waveform file according to the third voltage amplitude includes: Acquire a first data quantity, where the first data quantity is the number of voltage data belonging to one AC drive signal cycle in an initial waveform file, where the initial waveform file is a waveform file corresponding to the initial resonant frequency; determining a second data quantity based on the first data quantity and a first transformation coefficient, wherein the first transformation coefficient is a ratio of the current resonant frequency to the initial resonant frequency, the initial resonant frequency being the frequency of the AC drive signal corresponding to the initial waveform file, and the second data quantity is a value obtained by rounding the product of the first data quantity and the first transformation coefficient; Obtaining a first cycle number, where the first cycle number is the number of cycles of the AC drive signal corresponding to the initial waveform file; determining a second number of cycles according to the first number of cycles and a second transformation coefficient, where the second number of cycles is a value obtained by rounding a product of the first number of cycles and the second transformation coefficient, and the second transformation coefficient is a ratio of the initial resonant frequency to the current resonant frequency; The current waveform file is generated according to the second data quantity, the second cycle quantity and the third voltage amplitude, including: determining the required number of voltage data through the second data quantity and the second cycle quantity, and extracting the third voltage amplitude according to the number of voltage data to obtain the current waveform file; the second data quantity represents the number of voltage data belonging to one AC drive signal cycle in the current waveform file, and the second cycle quantity represents the number of cycles corresponding to the voltage data contained in the current waveform file.
3. The method according to claim 2, characterized in that The vibration mode of the motor is a long vibration mode.
4. The method according to claim 1, wherein The method further comprises: When the current resonant frequency is greater than the initial resonant frequency, the current waveform file is padded with zeros to obtain an updated waveform file, the number of voltage data in the updated waveform file is the same as the number of voltage data in the initial waveform file, and the initial waveform file is the waveform file corresponding to the initial resonant frequency.
5. The method according to claim 4, characterized in that The vibration mode of the motor is a short vibration mode, and the initial resonance frequency is the minimum vibration frequency of the motor.
6. The method according to claim 1, wherein The obtaining of the initial resonant frequency and the current resonant frequency of the motor includes: Acquiring a plurality of acceleration data corresponding to each AC drive signal when the motor is driven to vibrate by the plurality of AC drive signals, wherein the acceleration data is used to characterize the magnitude of the acceleration of the motor during vibration, wherein the frequencies of the plurality of AC drive signals are distributed within a driving frequency range of the motor; determining an average acceleration corresponding to each of the plurality of AC drive signals according to the plurality of acceleration data of the plurality of AC drive signals; The current resonant frequency is determined according to a maximum average acceleration among a plurality of average accelerations of the plurality of AC drive signals, wherein the current resonant frequency is a frequency of the AC drive signal corresponding to the maximum average acceleration.
7. The method according to claim 6, characterized in that The step of determining an average acceleration corresponding to each of the plurality of AC drive signals based on the plurality of acceleration data of the plurality of AC drive signals comprises: Obtaining a peak-to-peak value of acceleration data corresponding to each AC drive signal among the multiple AC drive signals; An average acceleration corresponding to each of the multiple AC drive signals is determined according to the peak-to-peak value.
8. The method according to claim 7, characterized in that The peak-to-peak value is data obtained by removing an overshoot value from the first peak-to-peak value, and / or the peak-to-peak value is data obtained by downsampling the first peak-to-peak value according to a preset sampling rate; The first peak-to-peak value is an original peak-to-peak value of acceleration data corresponding to each AC drive signal in the multiple AC drive signals.
9. A device for generating a waveform file, characterized in that: include: An acquisition module, used to obtain the initial resonant frequency and current resonant frequency of the motor; a determination module, configured to determine a third voltage amplitude based on a first voltage amplitude and a second voltage amplitude when the initial resonant frequency and the current resonant frequency are different, the first voltage amplitude and the second voltage amplitude being amplitudes of two adjacent sampling points of the AC drive signal corresponding to the initial resonant frequency, wherein a phase corresponding to the third voltage amplitude is greater than a phase corresponding to the first voltage amplitude and less than a phase corresponding to the second voltage amplitude, a difference between the phase corresponding to the third voltage amplitude and the phase corresponding to the first voltage amplitude is a first phase difference, a difference between the phase corresponding to the third voltage amplitude and the phase corresponding to the second voltage amplitude is a second phase difference, the third voltage amplitude is positively correlated with a sum of a first value and a second value, the first value is a product of the first voltage amplitude and a first weight coefficient, the second value is a product of the second voltage amplitude and a second weight coefficient, the first weight coefficient is a value obtained by dividing the second phase difference by the sum of the first phase difference and the second phase difference, and the second weight coefficient is a value obtained by dividing the first phase difference by the sum of the first phase difference and the second phase difference; A generation module is used to generate a current waveform file according to the third voltage amplitude, including: obtaining voltage data of multiple sampling points of the AC drive signal corresponding to the current resonant frequency by point-by-point calculation of multiple third voltage amplitudes of the current resonant frequency, and generating the current waveform file; wherein, the current waveform file is used to generate the AC drive signal corresponding to the current resonant frequency, and the third voltage amplitude is the amplitude of a sampling point of the AC drive signal corresponding to the current resonant frequency.
10. The device according to claim 9, characterized in that When the current resonant frequency is less than the initial resonant frequency, the generating module is specifically configured to: Acquire a first data quantity, where the first data quantity is the number of voltage data belonging to one AC drive signal cycle in an initial waveform file, where the initial waveform file is a waveform file corresponding to the initial resonant frequency; determining a second data quantity based on the first data quantity and a first transformation coefficient, wherein the first transformation coefficient is a ratio of the current resonant frequency to the initial resonant frequency, the initial resonant frequency being the frequency of the AC drive signal corresponding to the initial waveform file, and the second data quantity is a value obtained by rounding the product of the first data quantity and the first transformation coefficient; Obtaining a first cycle number, where the first cycle number is the number of cycles of the AC drive signal corresponding to the initial waveform file; determining a second number of cycles according to the first number of cycles and a second transformation coefficient, where the second number of cycles is a value obtained by rounding a product of the first number of cycles and the second transformation coefficient, and the second transformation coefficient is a ratio of the initial resonant frequency to the current resonant frequency; Generating the current waveform file according to the second data quantity, the second cycle quantity, and the third voltage amplitude, including: determining the required number of voltage data according to the second data quantity and the second cycle quantity, and extracting the third voltage amplitude according to the number of voltage data to obtain the current waveform file; The second data quantity represents the number of voltage data belonging to one AC drive signal cycle in the current waveform file, and the second cycle quantity represents the number of cycles corresponding to the voltage data contained in the current waveform file.
11. The device according to claim 10, characterized in that The vibration mode of the motor is a long vibration mode.
12. The device according to claim 9, characterized in that When the current resonant frequency is greater than the initial resonant frequency, the generating module is further configured to: The current waveform file is padded with zeros to obtain an updated waveform file, wherein the number of voltage data in the updated waveform file is the same as the number of voltage data in the initial waveform file, and the initial waveform file is a waveform file corresponding to the initial resonant frequency.
13. The device according to claim 12, characterized in that The vibration mode of the motor is a short vibration mode, and the initial resonance frequency is the minimum vibration frequency of the motor.
14. The device according to claim 9, characterized in that The acquisition module is specifically used for: Acquiring a plurality of acceleration data corresponding to each AC drive signal when the motor is driven to vibrate by the plurality of AC drive signals, wherein the acceleration data is used to characterize the magnitude of the acceleration of the motor during vibration, wherein the frequencies of the plurality of AC drive signals are distributed within a driving frequency range of the motor; determining an average acceleration corresponding to each of the plurality of AC drive signals according to the plurality of acceleration data of the plurality of AC drive signals; The current resonant frequency is determined according to a maximum average acceleration among a plurality of average accelerations of the plurality of AC drive signals, wherein the current resonant frequency is a frequency of the AC drive signal corresponding to the maximum average acceleration.
15. The device according to claim 14, characterized in that The acquisition module is specifically used for: Obtaining a peak-to-peak value of acceleration data corresponding to each AC drive signal among the multiple AC drive signals; An average acceleration corresponding to each of the multiple AC drive signals is determined according to the peak-to-peak value.
16. The device according to claim 15, characterized in that The peak-to-peak value is data obtained by removing an overshoot value from the first peak-to-peak value, and / or the peak-to-peak value is data obtained by downsampling the first peak-to-peak value according to a preset sampling rate; The first peak-to-peak value is an original peak-to-peak value of acceleration data corresponding to each AC drive signal in the multiple AC drive signals.
17. An electronic device, characterized in that: include: processors, memory, and interfaces; The processor, memory and interface cooperate with each other, and the processor is used to execute the method according to any one of claims 1 to 8.
18. 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 processor is caused to perform the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Audio signal processing method and device
CN110536193A
System for generating motor driving signal
CN111211726A