Patent Description:
This application relates to the field of terminal technologies, and in particular, to an active stylus calibration method, an active stylus, and an electronic device.

With development of touch control technologies, more mobile terminals perform human-computer interaction in a touch control manner. In addition to being operated through touch by using a finger, a touchscreen of the mobile terminal may alternatively be operated through touch by using a stylus.

Styluses include a passive stylus and an active stylus. A function of the passive stylus is equivalent to a function of a finger of a person. When the passive stylus is in contact with the touchscreen, a small part of current flows from the touchscreen to the passive stylus through a touch point. This is equivalent to a change of an electrode capacitance at the touch point, and a control chip of the touchscreen may determine a position of the touch point by detecting the change of the electrode capacitance. A tip of the passive stylus is usually designed to be relatively large. As a type of the active stylus, an active capacitive stylus may transmit a voltage drive signal to change an electric field at a touch point, so as to change an electrode capacitance at the touch point. The control chip of the touchscreen may determine a position of the touch point by detecting a change of the electrode capacitance. A tip of the active stylus may be designed to be relatively small.

To achieve a natural writing effect, a force sensor is usually added to the tip of the active stylus. In this way, different tilts under different force may be implemented to simulate real handwriting of persons. A conventional force sensor may deform under an external force, causing force inaccuracy. This usually causes a problem of a false report point (or commonly referred to as "water leakage") generated between the active stylus and the touchscreen. Consequently, the force sensor needs to be calibrated in real time.

An existing force calibration method for the active stylus is usually as follows: When a user does not write, the force sensor detects that nib force basically remains unchanged. In this case, calibration is started. The calibration means that a current force value is used as a reference value, and a report point is generated on the touchscreen only when the force is greater than the reference value. However, when the active stylus is used for writing under fixed force, based on the foregoing determining condition, it is considered by mistake that a force value of the force sensor remains unchanged, and miscalibration occurs. As a result, if force subsequently exerted by the user on the stylus is less than the reference value, no report point can be generated between the active stylus and the touchscreen (or commonly referred to as "no water out"). Accordingly, in <CIT> a method for identifying an error in a tip status of a stylus is disclosed in which a detecting input from the stylus is send via an electrostatic wireless communication channel to a digitizer sensor and is used by said digitizer sensor to verify whether the tip of the stylus is currently in a hover or a touch state.

Accordingly, in order to overcome the above-mentioned deficiencies, the subject matter of the herein introduced independent claims is suggested. Dependent claims described favored embodiments of the herein claimed invention. More specifically, this application provides an active stylus calibration method and an active stylus to resolve a problem of miscalibration of the active stylus.

According to a first aspect, an embodiment of this application provides an active stylus calibration method. The method is applied to an electronic device having a touchscreen, and the method includes: The electronic device establishes a network connection to an active stylus, the active stylus transmits a function signal to the electronic device, and the electronic device determines a distance between the active stylus and the touchscreen of the electronic device based on a parameter value, obtained through detection, corresponding to the function signal. If timing is started when the distance is a first threshold, when timing duration reaches specified duration and the distance is a second threshold, a force calibration instruction is sent to the active stylus through a network, and the active stylus calibrates a force sensor based on the force calibration instruction.

In this embodiment of this application, when the active stylus is under fixed force, the distance between the active stylus and the touchscreen of the electronic device is always the first threshold, and therefore, miscalibration does not occur. In addition, when writing is finished, in a period from a time when a user starts to lift the stylus to a time when the user completely moves the stylus away from the screen, the active stylus calibrates the force sensor when determining that the distance reaches the second threshold and deformation restoration duration of the force sensor is already exceeded, so that miscalibration does not occur, and due to timely calibration, a false report point is not generated on the touchscreen in a process of lifting the stylus by the user.

In a possible design, the electronic device and the active stylus may be connected in a short distance based on a communications network such as Wi-Fi hotspot, Wi-Fi direct connection, Bluetooth, zigbee, or NFC.

These aspects or other aspects in this application are clearer and more intelligible in descriptions of the following embodiments.

The following describes technical solutions in embodiments of this application with reference to the accompanying drawings in the embodiments of this application. In the descriptions of the embodiments of this application, the following terms "first" and "second" are merely used for a purpose of description, and shall not be understood as an indication or implication of relative importance or an implicit indication of a quantity of indicated technical features. Therefore, a feature limited by "first" or "second" may explicitly or implicitly include one or more features. In the descriptions of the embodiments of this application, unless otherwise stated, "a plurality of" means two or more than two.

The active stylus calibration methods provided in the embodiments of this application may be applied to a scenario, shown in <FIG>, in which an active stylus <NUM> and an electronic device <NUM> are interconnected based on a communications network. The active stylus <NUM> first establishes a network connection to the electronic device <NUM> through the network. When operating the electronic device <NUM>, the active stylus <NUM> transmits a function signal to the electronic device <NUM>. The electronic device <NUM> may determine a distance between the active stylus <NUM> and the electronic device <NUM> based on a parameter value, obtained through detection, corresponding to the function signal, and further sends, when the distance meets a specified condition, a force calibration instruction to the active stylus <NUM> through the network. The active stylus <NUM> calibrates a force sensor based on the force calibration instruction.

For example, the communications network may be a short-distance communications network such as a Wi-Fi hotspot network, a Wi-Fi P2P network, a Bluetooth network, a zigbee network, or a near field communication (near field communication, NFC) network.

It should be noted that in some embodiments of this application, the active stylus <NUM> shown in <FIG> may be an active capacitive stylus, or may be an active electromagnetic stylus; and the electronic device <NUM> shown in <FIG> may be a portable electronic device that further includes another function such as a personal digital assistant function and/or a music player function, such as a mobile phone, a tablet computer, or a wearable device (for example, a smart watch) having a wireless communication function. An example embodiment of the portable electronic device includes but is not limited to a portable electronic device using iOS®, Android®, Microsoft®, or another operating system. The portable electronic device may alternatively be another portable electronic device, for example, a laptop computer (laptop) with a touch-sensitive surface (for example, a touch panel). It should be further understood that, in some other embodiments of this application, the electronic device <NUM> may alternatively be a desktop computer with a touch-sensitive surface (for example, a touch panel), but not the portable electronic device.

For example, the electronic device <NUM> is a mobile phone, and <FIG> is a schematic structural diagram of the mobile phone.

The mobile phone may include a processor <NUM>, an external memory interface <NUM>, an internal memory <NUM>, a USB interface <NUM>, a charging management module <NUM>, a power management module <NUM>, a battery <NUM>, an antenna <NUM>, an antenna <NUM>, a mobile communications module <NUM>, a wireless communications module <NUM>, an audio module <NUM>, a speaker 170A, a telephone receiver 170B, a microphone 170C, a headset jack 170D, a sensor module <NUM>, a key <NUM>, a motor <NUM>, an indicator <NUM>, a camera <NUM>, a display <NUM>, a SIM card interface <NUM>, and the like. The sensor module <NUM> may include a gyro sensor 180A, an acceleration sensor 180B, an optical proximity sensor <NUM>, a fingerprint sensor <NUM>, a touch sensor <NUM>, and a rotating shaft sensor <NUM> (where certainly, the mobile phone <NUM> may alternatively include another sensor such as a temperature sensor, a force sensor, a distance sensor, a magnetic sensor, an ambient light sensor, a barometric force sensor, or a bone conduction sensor, which is not shown in the figure).

It may be understood that an illustrated structure in the embodiments of the present invention does not constitute a specific limitation on the mobile phone <NUM>. In some other embodiments of this application, the mobile phone <NUM> may include more or fewer parts than those shown in the figure, or combine some parts, or divide some parts, or have different part arrangements. The parts in the figure may be implemented by using hardware, software, or a combination of software and hardware.

The processor <NUM> may include one or more processing units. For example, the processor <NUM> may include an application processor (application processor, AP), a modem processor, a graphics processing unit (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural-network processing unit (Neural-network Processing Unit, NPU). Different processing units may be independent components, or may be integrated into one or more processors. The controller may be a nerve center and a command center of the mobile phone <NUM>. The controller may generate an operation control signal based on an instruction operation code and a time sequence signal, to complete control of instruction reading and instruction execution.

A memory may be further disposed in the processor <NUM>, and is configured to store an instruction and data. In some embodiments, the memory in the processor <NUM> is a cache memory. The memory may store an instruction or data that is just used or cyclically used by the processor <NUM>. If the processor <NUM> needs to use the instruction or the data again, the processor <NUM> may directly invoke the instruction or the data from the memory, to avoid repeated access and reduce a waiting period of the processor <NUM>. Therefore, system efficiency is improved.

The processor <NUM> may run the active stylus calibration methods provided in the embodiments of this application, to resolve problems of miscalibration and water leakage of an active stylus. When different components are integrated into the processor <NUM>, for example, a CPU and a GPU are integrated, the CPU and the GPU may cooperate to perform the active stylus calibration methods provided in the embodiments of this application. For example, in the methods, some algorithms are performed by the CPU, and the other algorithms are performed by the GPU, to obtain relatively fast processing efficiency.

The display <NUM> is configured to display an image, a video, and the like. The display <NUM> includes a display panel. The display panel may use a liquid crystal display (liquid crystal display, LCD), an organic light-emitting diode (organic light-emitting diode, OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (active-matrix organic light emitting diode, AMOLED), a flexible light-emitting diode (flex light-emitting diode, FLED), a miniLED, a microLED, a micro-OLED, a quantum dot light-emitting diode (quantum dot light emitting diodes, QLED), or the like. In some embodiments, the mobile phone <NUM> may include one or N displays <NUM>. N is a positive integer greater than <NUM>.

In the embodiments of this application, in one case, as a type of the active stylus, an active capacitive stylus may transmit a voltage drive signal to change an electric field at a touch point, so as to change an electrode capacitance at the touch point. A control chip of the display may determine a position of the touch point by detecting a change of the electrode capacitance. In another case, as a type of the active stylus, an active electromagnetic stylus transmits an electromagnetic drive signal, and interacts with an electromagnetic induction panel that is behind the display. When the active electromagnetic stylus approaches the display, an induction line under the electromagnetic induction panel that is behind the display changes, and a control chip of the display receives signals based on antenna arrays in the horizontal direction and the vertical direction, and obtains, through calculation, a coordinate position of the stylus based on a change of a magnetic flux.

The camera <NUM> (a front camera or a rear camera) is configured to capture a static image or a video. Usually, the camera <NUM> may include a photosensitive element such as a lens group and an image sensor. The lens group includes a plurality of lenses (a convex lens or a concave lens), and is configured to: collect an optical signal reflected by a to-be-photographed object, and transfer the collected optical signal to the image sensor. The image sensor generates an original image of the to-be-photographed object based on the optical signal.

The internal memory <NUM> may be configured to store computer-executable program code, and the executable program code includes an instruction. The processor <NUM> runs the instruction stored in the internal memory <NUM>, to implement various function applications and data processing of the mobile phone <NUM>. The internal memory <NUM> may include a program storage area and a data storage area. The program storage area may store code of an operating system, an application program (for example, a camera application or a WeChat application), or the like. The data storage area may store data (for example, an image or a video collected by the camera application) created during use of the mobile phone <NUM> or the like.

The internal memory <NUM> may alternatively store code of an anti-accidental touch algorithm provided in the embodiments of this application. When the code, stored in the internal memory <NUM>, of the anti-accidental touch algorithm is run by the processor <NUM>, a touch operation in a folding or unfolding process may be shielded.

In addition, the internal memory <NUM> may include a high-speed random access memory, and may further include a nonvolatile memory, for example, at least one magnetic disk storage device, a flash memory device, or a universal flash storage (universal flash storage, UFS).

Certainly, the code, provided in the embodiments of this application, of the anti-accidental touch algorithm may alternatively be stored in an external memory. In this case, the processor <NUM> may run, by using the external memory interface <NUM>, the code, stored in the external memory, of the anti-accidental touch algorithm, to shield a touch operation in a folding or unfolding process.

The following describes a function of the sensor module <NUM>.

The gyro sensor 180A may be configured to determine a motion posture of the mobile phone <NUM>. In some embodiments, an angular velocity of the electronic device <NUM> separately around three axes (namely, an x axis, a y axis, and a z axis) may be determined by using the gyro sensor 180A. In other words, the gyro sensor 180A may be configured to detect a current motion status of the mobile phone <NUM>, for example, whether the mobile phone <NUM> is in a shaken or static state.

The acceleration sensor 180B may detect values of accelerations in various directions (usually in directions of the three axes) of the mobile phone <NUM>. In other words, the gyro sensor 180A may be configured to detect a current motion status of the mobile phone <NUM>, for example, whether the mobile phone <NUM> is in a shaken or static state. The optical proximity sensor <NUM> may include, for example, a light emitting diode (LED) and an optical detector such as a photodiode. The light emitting diode may be an infrared light emitting diode. The mobile phone transmits infrared light outward by using the light emitting diode. The mobile phone detects infrared reflected light from a nearby object by using the photodiode. When sufficient reflected light is detected, it may be determined that there is an object near the mobile phone. When insufficient reflected light is detected, the mobile phone may determine that there is no object near the mobile phone.

The gyro sensor 180A (or the acceleration sensor 180B) may send, to the processor <NUM>, motion status information (for example, the angular velocity) obtained through detection. The processor <NUM> determines, based on the motion status information, whether the mobile phone is currently in a handheld state or a tripod state (where for example, when the angular velocity is not <NUM>, it indicates that the mobile phone <NUM> is in the handheld state).

The fingerprint sensor <NUM> is configured to collect a fingerprint. The mobile phone <NUM> may use a feature of the collected fingerprint to implement fingerprint unlocking, application access locking, fingerprint photographing, fingerprint call answering, and the like.

The touch sensor <NUM> is also referred to as a "touch panel". The touch sensor <NUM> may be disposed in the display <NUM>, and the touch sensor <NUM> and the display <NUM> constitute a touchscreen, which is also referred to as a "touch control screen". The touch sensor <NUM> is configured to detect a touch operation on or near the touch sensor <NUM>. The touch sensor may transfer the detected touch operation to an application processor, to determine a type of a touch event. Visual output related to the touch operation may be provided by using the display <NUM>. In some other embodiments, the touch sensor <NUM> may alternatively be disposed on a surface of the mobile phone <NUM> at a position different from a position of the display <NUM>.

For example, the display <NUM> of the mobile phone <NUM> displays a home screen, and the home screen includes icons of a plurality of applications (for example, a camera application and a WeChat application). A user taps an icon of the camera application on the home screen by using the touch sensor <NUM>, to trigger the processor <NUM> to start the camera application and open the camera <NUM>. The display <NUM> displays a screen of the camera application, for example, a viewfinder screen.

A wireless communication function of the mobile phone <NUM> may be implemented by using the antenna <NUM>, the antenna <NUM>, the mobile communications module <NUM>, the wireless communications module <NUM>, the modem processor, the baseband processor, and the like.

The antenna <NUM> and the antenna <NUM> are configured to transmit and receive an electromagnetic wave signal. Each antenna in the terminal device <NUM> may be configured to cover one or more communication bands. Different antennas may be further multiplexed, to improve antenna utilization. For example, the antenna <NUM> may be multiplexed as a diversity antenna of a wireless local area network. In some other embodiments, the antenna may be used in combination with a tuning switch.

The mobile communications module <NUM> can provide a solution, applied to the terminal device <NUM>, for wireless communication including <NUM>/<NUM>/<NUM>/<NUM> and the like. The mobile communications module <NUM> may include at least one filter, a switch, a power amplifier, a low noise amplifier (low noise amplifier, LNA), and the like. The mobile communications module <NUM> may receive an electromagnetic wave by using the antenna <NUM>, perform processing such as filtering or amplification on the received electromagnetic wave, and transfer the electromagnetic wave to the modem processor for demodulation. The mobile communications module <NUM> may further amplify a signal modulated by the modem processor, and convert the signal into an electromagnetic wave for radiation by using the antenna <NUM>. In some embodiments, at least some function modules in the mobile communications module <NUM> may be disposed in the processor <NUM>. In some embodiments, at least some function modules in the mobile communications module <NUM> may be disposed in a same component as at least some modules in the processor <NUM>.

The modem processor may include a modulator and a demodulator. The modulator is configured to modulate a to-be-sent low-frequency baseband signal into a medium-high-frequency signal. The demodulator is configured to demodulate a received electromagnetic wave signal into a low-frequency baseband signal. Then the demodulator transfers the low-frequency baseband signal obtained through demodulation to the baseband processor for processing. The low-frequency baseband signal is processed by the baseband processor and is transferred to the application processor. The application processor outputs a sound signal by using an audio device (which is not limited to the speaker 170A, the telephone receiver 170B, or the like), or displays an image or a video by using the display <NUM>. In some embodiments, the modem processor may be an independent component. In some other embodiments, the modem processor may be independent of the processor <NUM>, and is disposed in a same device with the mobile communications module <NUM> or another function module.

The wireless communications module <NUM> may provide a solution, applied to the terminal device <NUM>, for wireless communication including a wireless local area network (wireless local area network, WLAN) (for example, a wireless fidelity (wireless fidelity, Wi-Fi) network), Bluetooth (Bluetooth, BT), a global navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), a near field wireless communication (near field communication, NFC) technology, an infrared (infrared, IR) technology, or the like. The wireless communications module <NUM> may be one or more components integrating at least one communications processing module. The wireless communications module <NUM> receives an electromagnetic wave by using the antenna <NUM>, performs frequency modulation and filtering processing on an electromagnetic wave signal, and sends a signal obtained after processing to the processor <NUM>. The wireless communications module <NUM> may further receive a to-be-sent signal from the processor <NUM>, perform frequency modulation on and amplify the signal, and convert the signal into an electromagnetic wave for radiation by using the antenna <NUM>.

In addition, the mobile phone <NUM> may implement an audio function by using the audio module <NUM>, the speaker 170A, the telephone receiver 170B, the microphone 170C, the headset jack 170D, the application processor, and the like. For example, the function may be music playing and recording. The mobile phone <NUM> may receive an input from the key <NUM>, and generate a key signal input related to a user setting and function control of the mobile phone <NUM>. The mobile phone <NUM> may generate a vibration prompt (for example, an incoming call vibration prompt) by using the motor <NUM>. The indicator <NUM> in the mobile phone <NUM> may be an indicator light, may be configured to indicate a charging state and a power change, and may also be configured to indicate a message, a missed call, a notification, and the like. The SIM card interface <NUM> in the mobile phone <NUM> is configured to connect to a SIM card. The SIM card may be inserted into the SIM card interface <NUM> or plugged from the SIM card interface <NUM>, to implement contact with or separation from the mobile phone <NUM>.

It should be understood that during actual application, the mobile phone <NUM> may include more or fewer parts than those shown in <FIG>. This is not limited in this embodiment of this application.

As shown in <FIG>, an embodiment of the present invention further provides a schematic structural diagram of an active stylus <NUM> used in cooperation with the touchscreen in <FIG>. The active stylus <NUM> includes a stylus shell <NUM>, a stylus core <NUM>, a microprocessor <NUM>, and a battery <NUM>.

The stylus core <NUM> has a force sensor, and the force sensor deforms when the force sensor is under force.

The microprocessor <NUM> is connected to the stylus core <NUM>, and is configured to: generate a function signal, and send the function signal to a display <NUM> of an electronic device <NUM> by using the stylus core <NUM>.

When the active stylus <NUM> is an active capacitive stylus, the function signal is a voltage drive signal. When the active stylus <NUM> is an active voltage stylus, the function signal is an electromagnetic drive signal.

The battery <NUM> is configured to provide power supply for the microprocessor <NUM>, and a rechargeable lithium battery may be used to provide the power supply.

All the following embodiments may be implemented on the active stylus <NUM> and the electronic device <NUM> that have the foregoing hardware structures.

An embodiment of this application provides an active stylus calibration method. The method can implement calibration of an active stylus <NUM> by an electronic device <NUM>.

<NUM>: The electronic device <NUM> establishes a network connection to the active stylus <NUM>.

For example, the electronic device <NUM> and the active stylus <NUM> may be connected in a short distance based on a communications network such as Wi-Fi hotspot, Wi-Fi direct connection, Bluetooth, zigbee, or NFC.

A user may perform manual pairing by turning on a switch of Bluetooth or a hotspot in settings. In this embodiment of this application, if the user holds the active stylus <NUM> and touches a home screen of the electronic device for a long time, a function of pairing the electronic device <NUM> with the active stylus <NUM> may be automatically triggered, and when a progress bar is displayed as <NUM>% on the home screen of the electronic device <NUM>, pairing succeeds. This is shown in <FIG>.

<NUM>: The active stylus <NUM> transmits a function signal to the electronic device <NUM>.

For example, as shown in <FIG> of <FIG>, when a user holds the active stylus <NUM> to write words "writing test" on a touchscreen of a mobile phone, and after the user completes writing "writing test is completed" and a stylus nib leaves the touchscreen, the active stylus <NUM> transmits a function signal to the touchscreen of the mobile phone. In one case, when the active stylus <NUM> is an active capacitive stylus, the function signal is a voltage drive signal, and a touchscreen of the electronic device <NUM> receives the voltage drive signal. When a distance between the electronic device <NUM> and the active stylus <NUM> is as that shown in <FIG>, the received voltage drive signal is relatively strong, and a capacitance value at a touch point is relatively large. When a distance between the electronic device <NUM> and the active stylus <NUM> is as that shown in <FIG>, the received voltage drive signal is relatively weak, and a capacitance value at a touch point is relatively small. In another case, when the active stylus <NUM> is an active electromagnetic stylus, the function signal is an electromagnetic drive signal. The touchscreen of the electronic device <NUM> receives the electromagnetic drive signal. When a distance between the electronic device <NUM> and the active stylus <NUM> is as that shown in <FIG>, the received electromagnetic drive signal is relatively strong, and a magnetic flux at a touch point is relatively large. When a distance between the electronic device <NUM> and the active stylus <NUM> is as that shown in <FIG>, the received electromagnetic drive signal is relatively weak, and a magnetic flux at a touch point is relatively small.

<NUM>: The electronic device <NUM> determines a distance between the active stylus <NUM> and the touchscreen of the electronic device <NUM> based on a parameter value, obtained through detection, corresponding to the function signal. If timing is started when the distance is a first threshold, when timing duration reaches specified duration and the distance is a second threshold, a force calibration instruction is sent to the active stylus <NUM> through a network.

The second threshold is greater than the first threshold. In other words, in this scenario, the distance between the active stylus <NUM> and the touchscreen of the electronic device <NUM> gradually increases. It should be noted that, a developer pre-trains and generates a correspondence between different parameter values, detected by the electronic device, corresponding to function signals and distances between the active stylus <NUM> and the touchscreen. In this way, when detecting different parameter values, the electronic device <NUM> may correspondingly obtain corresponding distance values.

For example, as shown in <FIG>, if the distance between the active stylus <NUM> and the touchscreen of the electronic device <NUM> changes from that in <FIG> to that in <FIG>, a relationship between the parameter value and the distance is shown in <FIG>. It can be learned that a larger distance indicates a smaller parameter value. Usually, in a period during which the active stylus completes writing and leaves the touch panel, there exists a force deformation restoration period of the force sensor. As shown in <FIG>, after the stylus completely leaves the screen, there is still a force deformation restoration period (namely, a period from t2 to t3). In the prior art, calibration is performed only when the active stylus <NUM> detects that force does not change. Therefore, a false report point (commonly referred to as "water leakage") is easily generated on the touch panel in the deformation restoration period.

In this embodiment of this application, when the electronic device <NUM> detects that the distance increases from zero to the first threshold (where for example, the first threshold is <NUM> millimeter), the electronic device starts timing. When the timing duration reaches the specified duration (where the specified duration is related to deformation restoration duration of the force sensor, for example, <NUM> milliseconds) and the distance reaches the second threshold (where for example, the first threshold is <NUM> millimeters), the electronic device generates the force calibration instruction at this moment, and sends the force calibration instruction to the active stylus <NUM>.

In other words, the electronic device <NUM> presets that when the distance between the active stylus <NUM> and the touchscreen of the electronic device <NUM> is less than the first threshold, the active stylus <NUM> may generate a report point on the touchscreen. However, when the distance between the active stylus <NUM> and the touchscreen of the electronic device <NUM> increases to the second threshold, and duration counted from the first threshold already reaches the deformation restoration duration of the force sensor, the force calibration instruction is generated, and the force calibration instruction is sent to the active stylus <NUM>.

<NUM>: The active stylus <NUM> calibrates the force sensor.

In other words, the active stylus <NUM> uses a current force value detected by the force sensor as a reference value.

It can be learned that in this embodiment of this application, a current status of the stylus is determined based on the distance between the active stylus and the touchscreen of the electronic device <NUM>. When the stylus is far away from the screen and the force sensor already completes deformation restoration, the stylus is indicated, by using Bluetooth or another short-distance network, to perform force calibration. Therefore, when the active stylus is used for writing under fixed force, the distance between the active stylus and the touchscreen of the electronic device <NUM> is always the first threshold, and therefore, miscalibration does not occur. In addition, when writing is finished, in a period from a time when the user starts to lift the stylus to a time when the user completely moves the stylus away from the screen, the electronic device <NUM> calibrates the active stylus <NUM> when determining that the distance reaches the second threshold and deformation restoration duration of the force sensor is already exceeded, so that miscalibration does not occur, and due to timely calibration, a false report point (that is, "water leakage") is not generated on the touchscreen in a process of lifting the stylus by the user.

An embodiment of this application provides another active stylus calibration method. The method can implement calibration of an active stylus <NUM> based on a distance between the active stylus <NUM> and an electronic device <NUM>.

<NUM>: The active stylus <NUM> transmits a function signal to the electronic device.

<NUM>: The electronic device <NUM> detects the function signal, and determines a parameter value corresponding to the function signal.

<NUM>: The electronic device <NUM> sends, to the active stylus <NUM>, the parameter value corresponding to the function signal.

<NUM>: The active stylus <NUM> determines a distance between the active stylus and a touchscreen based on the parameter value; and if timing is started when the distance is a first threshold, when timing duration reaches specified duration and the distance is a second threshold, a force sensor is calibrated.

Similarly, the second threshold is greater than the first threshold. In other words, in this scenario, the distance between the active stylus <NUM> and the touchscreen of the electronic device <NUM> gradually increases. It should be noted that, a developer pre-trains and generates a correspondence between different parameter values, detected by the electronic device, corresponding to function signals and distances between the active stylus <NUM> and the touchscreen. In this way, when detecting different parameter values, the electronic device <NUM> may correspondingly obtain corresponding distance values.

For example, as shown in <FIG>, if the distance between the active stylus <NUM> and the touchscreen of the electronic device <NUM> changes from that in <FIG> to that in <FIG>, the electronic device <NUM> sends, to the active stylus <NUM>, the parameter value, detected in this period, corresponding to the function signal, and then the active stylus <NUM> determines the distance based on the parameter value. If timing is started when the distance increases from zero to the first threshold (where for example, the first threshold is <NUM> millimeter), when the timing duration reaches the specified duration (where the specified duration is related to deformation restoration duration of the force sensor, for example, <NUM> milliseconds) and the distance reaches the second threshold (where for example, the first threshold is <NUM> millimeters), the active stylus <NUM> performs force calibration on the force sensor.

In other words, the electronic device <NUM> presets that when the distance between the active stylus <NUM> and the touchscreen of the electronic device <NUM> is less than the first threshold, the active stylus <NUM> may generate a report point on the touchscreen. However, when the active stylus <NUM> determines that the distance between the active stylus <NUM> and the electronic device <NUM> increases to the second threshold, and deformation restoration duration is already exceeded, the force sensor is calibrated. Therefore, when the active stylus is under fixed force, the distance between the active stylus and the touchscreen of the electronic device <NUM> is always the first threshold, and therefore, miscalibration does not occur. In addition, when writing is finished, in a period from a time when a user starts to lift the stylus to a time when the user completely moves the stylus away from the screen, the active stylus <NUM> calibrates the force sensor when determining that the distance reaches the second threshold and deformation restoration duration of the force sensor is already exceeded, so that miscalibration does not occur, and due to timely calibration, a false report point (that is, "water leakage") is not generated on the touchscreen in a process of lifting the stylus by the user.

An embodiment of this application further provides an active stylus calibration method and apparatus. As shown in <FIG>, the apparatus includes a transceiver module <NUM> and a detection module <NUM>.

In a possible embodiment, the transceiver module <NUM> is configured to establish a network connection to an active stylus, the detection module <NUM> is configured to detect a function signal transmitted by the active stylus, and the apparatus further includes a processing module <NUM>, configured to: determine a distance between the active stylus and a touchscreen based on a parameter value, obtained through detection, corresponding to the function signal. The transceiver module <NUM> is further configured to: when timing duration reaches specified duration and the distance is a second threshold, send a force calibration instruction to the active stylus through the network connection. Related content in the method embodiments of <FIG> may be cited in the foregoing function descriptions, and details are not described repeatedly herein.

In another possible embodiment, the transceiver module <NUM> is configured to establish a network connection to an active stylus, the detection module <NUM> is configured to detect a function signal transmitted by the active stylus, and the transceiver module <NUM> is further configured to send, to the active stylus through the network connection, a parameter value, obtained through detection, corresponding to the function signal, so that the active stylus calibrates a force sensor when determining that the parameter value, obtained through detection, corresponding to the function signal meets specified condition. Related content in the method embodiment of <FIG> may be cited in the foregoing function descriptions, and details are not described repeatedly herein.

It should be noted that the apparatus has a function of implementing the electronic device in the foregoing method designs. These unit modules may be implemented by hardware in the electronic device, or may be implemented by hardware in the electronic device by executing corresponding software. This is not limited in this embodiment of this application.

It can be learned that this embodiment of this application can be used to resolve a problem of miscalibration of the active stylus and a problem of water leakage caused by untimely calibration.

In some other embodiments of this application, the embodiments of this application disclose an electronic device. As shown in <FIG>, the electronic device may include a touchscreen <NUM>, where the touchscreen <NUM> includes a touch panel <NUM> and a display <NUM>; one or more processors <NUM>; a memory <NUM>; one or more applications (not shown); one or more computer programs <NUM>; and a transceiver <NUM>. The foregoing components may be connected by using one or more communications buses <NUM>. The one or more computer programs <NUM> are stored in the memory <NUM> and configured to be executed by the one or more processors <NUM>. The one or more computer programs <NUM> include an instruction, and the instruction may be used to perform steps in the embodiments of <FIG>.

An embodiment of this application further provides an active stylus calibration method and apparatus. As shown in <FIG>, the apparatus includes a transceiver module <NUM>, a function signal transmitting module <NUM>, and a processing module <NUM>.

In a possible embodiment, the transceiver module <NUM> is configured to establish a network connection to an electronic device, the function signal transmitting module <NUM> is configured to transmit a function signal to a touchscreen of the electronic device, and the transceiver module <NUM> is further configured to receive a force calibration instruction sent by the electronic device. The processing module <NUM> is configured to calibrate a force sensor. Related content in the method embodiments of <FIG> may be cited in the foregoing function descriptions, and details are not described repeatedly herein.

In another possible embodiment, the transceiver module <NUM> is configured to establish a network connection to an electronic device, the function signal transmitting module <NUM> is configured to transmit a function signal to a touchscreen of the electronic device, and the transceiver module <NUM> is further configured to receive a parameter value, sent by the electronic device, corresponding to the function signal. The processing module <NUM> is configured to determine a distance between an active stylus and the touchscreen based on the parameter value, obtained through detection, corresponding to the function signal. When timing duration reaches specified duration and the distance is a second threshold, the force sensor is calibrated. Related content in the method embodiment of <FIG> may be cited in the foregoing function descriptions, and details are not described repeatedly herein.

It should be noted that the apparatus has a function of implementing the active stylus in the foregoing method designs. These unit modules may be implemented by hardware in the active stylus, or may be implemented by hardware in the active stylus by executing corresponding software. This is not limited in this embodiment of this application.

In some other embodiments of this application, the embodiments of this application disclose an active stylus. As shown in <FIG>, the active stylus may include a transceiver <NUM>, a microprocessor <NUM>, a memory <NUM>, one or more computer programs <NUM>, and a transceiver <NUM>. The foregoing components may be connected by using one or more communications buses <NUM>. The one or more computer programs <NUM> are stored in the memory <NUM> and configured to be executed by the one or more processors <NUM>. The one or more computer programs <NUM> include an instruction, and the instruction may be used to perform steps in the embodiments of <FIG>.

An embodiment of this application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer instruction, and when the computer instruction is run on an electronic device, the electronic device is enabled to perform the foregoing related method steps, to implement the active stylus calibration methods in the foregoing embodiments.

An embodiment of this application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer instruction, and when the computer instruction is run on an active stylus, the active stylus is enabled to perform the foregoing related method steps, to implement the active stylus calibration methods in the foregoing embodiments.

An embodiment of this application further provides a computer program product. When the computer program product is run on a computer, the computer is enabled to perform the foregoing related steps, to implement the active stylus calibration methods in the foregoing embodiments.

In addition, an embodiment of this application further provides an apparatus. The apparatus may be specifically a chip, a component, or a module. The apparatus may include a processor and a memory that are connected. The memory is configured to store a computer executable instruction, and when the apparatus runs, the processor may execute the computer executable instruction stored in the memory, so that the chip performs the active stylus calibration methods in the foregoing method embodiments.

The electronic device, the computer-readable storage medium, the computer program product, or the chip provided in the embodiments of this application is configured to perform the corresponding method provided above. Therefore, for beneficial effects that can be achieved, refer to the beneficial effects of the corresponding method provided above.

The foregoing descriptions about implementations allow a person skilled in the art to understand that, for the purpose of convenient and brief description, division of the foregoing function modules is taken as an example for illustration. During actual application, the foregoing functions can be allocated to different modules and implemented based on a requirement, in other words, an inner structure of an apparatus is divided into different function modules, to implement all or some of the functions described above.

In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the module or unit division is merely logical function division and may be other division in actual implementation. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections may be implemented through some interfaces.

The units described as separate parts may or may not be physically separate, and parts displayed as units may be one or more physical units, may be located in one place, or may be distributed on different places.

When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, the integrated unit may be stored in a readable storage medium. Based on such an understanding, the technical solutions of this application essentially, or the part contributing to the prior art, or all or some of the technical solutions may be implemented in the form of a software product. The software product is stored in a storage medium and includes several instructions for instructing a device (which may be a single-chip microcomputer, a chip or the like) or a processor (processor) to perform all or some of the steps of the methods described in the embodiments of this application. The foregoing storage medium includes: any medium that can store program code, such as a USB flash drive, a removable hard disk, a read-only memory (read-only memory, ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disc.

Claim 1:
An active stylus calibration method, applied to an active stylus (<NUM>), wherein the method comprises:
establishing a network connection to an electronic device (<NUM>) having a touchscreen (<NUM>);
transmitting a function signal to the electronic device (<NUM>); and
receiving, through the network connection, a force calibration instruction sent by the electronic device (<NUM>), and calibrating a force sensor based on the force calibration instruction,
the method being characterized in that
the force calibration instruction is generated by the electronic device (<NUM>) when the electronic device (<NUM>) determines that a parameter value, obtained through detection of the function signal, meets a specified condition, wherein the specified condition comprises: a timing duration reaches a specified duration and a distance reaches a second threshold wherein the timing is started when the distance reaches a first threshold; the distance is determined by the electronic device (<NUM>) based on the parameter value, wherein a smaller parameter value indicates a larger distance; the second threshold is greater than the first threshold; and the specified duration relates to a deformation restoration period of the force sensor of the active stylus (<NUM>) in which a deformation of the force sensor is restored.