Writing implementation method and device of touch pen, touch pen and storage medium
By adjusting the reference pressure value to offset the temperature drift, the accuracy of the pressure sensor under temperature changes is solved, ensuring the accuracy of the writing trajectory and reducing costs.
Patent Information
- Application Number
- CN202310798664.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-30
- Publication Date
- 2024-12-31
AI Technical Summary
压力传感器在温度变化时会发生温度漂移,影响触摸笔检测笔尖受力精准性,导致书写轨迹显示不准确。
By collecting the initial pressure value when the pressure sensor is not written, the real-time pressure value is continuously collected, the reference pressure value is adjusted to offset the temperature drift, ensuring the accuracy of the pressure change amount, thereby ensuring the thickness of the writing track.
It effectively avoids the impact of temperature drift on the accuracy of the pressure sensor, ensures the accuracy of the writing trajectory, and can use a pressure sensor with lower accuracy, reducing the cost of the touch pen.
Smart Images

Figure CN119225545A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of touch pen technology, and more particularly to a method and device for implementing writing with a touch pen, a touch pen, and a storage medium. Background Art
[0002] With the development of touch screen technology, various terminal devices supporting touch screen functions have appeared in people's daily lives, such as mobile phones, laptops, tablet computers, learning machines, interactive smart tablets, etc. In order to meet application scenarios with high input accuracy requirements, such as drawing and note taking, a touch pen is configured for the terminal device to enable writing on the terminal device through the touch pen.
[0003] In the related art, a pressure sensor for detecting the force applied to the pen tip is installed in the touch pen, so that the touch screen can display writing tracks of different thicknesses when the force applied to the pen tip is different. However, when the external temperature where the pressure sensor is located changes, the pressure value detected by the pressure sensor will also change, that is, temperature drift occurs, which will affect the accuracy of the pressure sensor in detecting the actual force applied to the pen tip. Summary of the invention
[0004] The embodiments of the present application provide a writing implementation method and device for a touch pen, a touch pen, and a storage medium to solve the technical problem in the related art that the temperature drift of the pressure sensor affects the accuracy of detecting the actual force applied to the pen tip.
[0005] In a first aspect, an embodiment of the present application provides a method for implementing writing with a touch pen, wherein the touch pen is used to write on a touch screen, and the touch pen is provided with a pressure sensor, and the pressure sensor is used to detect the external pressure exerted on the tip of the touch pen and generate a corresponding pressure value;
[0006] The writing implementation method comprises:
[0007] collecting a first pressure value generated by the pressure sensor when the touch pen is not writing, and obtaining an initial reference pressure value according to the first pressure value;
[0008] Continuously collecting a second pressure value generated in real time by the pressure sensor;
[0009] Each time the second pressure value is collected, the current second pressure change is determined according to the second pressure value and the currently used reference pressure value. When it is determined that a positive temperature drift occurs according to the first pressure change and the second pressure change, the currently used reference pressure value is increased. When it is determined that a negative temperature drift occurs, the currently used reference pressure value is reduced. When it is determined that writing occurs, the current second pressure change is sent to the touch screen so that the touch screen determines the thickness of the currently displayed writing track. The first pressure change is the change in the pressure value corresponding to the pressure sensor when the touch pen writes the thinnest writing track. The thicker the writing track, the greater the change in the corresponding pressure value.
[0010] In a second aspect, an embodiment of the present application further provides a writing implementation device of a touch pen, wherein the touch pen is used to write on a touch screen, and the touch pen is provided with a pressure sensor, and the pressure sensor is used to detect the external pressure exerted on the tip of the touch pen and generate a corresponding pressure value;
[0011] The writing implementation device comprises:
[0012] A first collecting unit, configured to collect a first pressure value generated by the pressure sensor when the touch pen is not writing, and obtain an initial reference pressure value according to the first pressure value;
[0013] A second acquisition unit, used for continuously acquiring a second pressure value generated in real time by the pressure sensor;
[0014] The first determination unit is used to determine the current second pressure change according to the second pressure value and the currently used reference pressure value each time the second pressure value is collected; when it is determined that a positive temperature drift occurs according to the first pressure change and the second pressure change, the currently used reference pressure value is increased; when it is determined that a negative temperature drift occurs, the currently used reference pressure value is reduced; when it is determined that writing occurs, the current second pressure change is sent to the touch screen so that the touch screen determines the thickness of the currently displayed writing track; the first pressure change is the change in the pressure value corresponding to the pressure sensor when the touch pen writes the thinnest writing track, and the thicker the writing track, the greater the change in the corresponding pressure value.
[0015] In a third aspect, an embodiment of the present application further provides a touch pen, the touch pen is used for writing on a touch screen, the touch pen comprises: a pen holder and a pen tip, a microprocessor unit and a pressure sensor are arranged inside the pen holder,
[0016] The pressure sensor is used to detect the external pressure on the pen tip and generate a corresponding pressure value;
[0017] The microprocessing unit is used to collect a first pressure value generated by the pressure sensor when the touch pen is not writing, and obtain an initial reference pressure value according to the first pressure value; continuously collect a second pressure value generated by the pressure sensor in real time; each time the second pressure value is collected, determine a current second pressure change according to the second pressure value and a currently used reference pressure value; when it is determined that a positive temperature drift occurs according to the first pressure change and the second pressure change, increase the currently used reference pressure value; when it is determined that a negative temperature drift occurs, reduce the currently used reference pressure value; when it is determined that writing occurs, send the current second pressure change to the touch screen so that the touch screen determines the thickness of the currently displayed writing track, the first pressure change is the change in the pressure value corresponding to the pressure sensor when the touch pen writes the thinnest writing track, and the thicker the writing track, the greater the change in the corresponding pressure value.
[0018] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a microprocessor unit of the touch pen, implements the touch pen writing method as described in the first aspect.
[0019] In one embodiment of the present application, a first pressure value generated by a pressure sensor is collected when the touch pen is not writing, and an initial reference pressure value is obtained based on the first pressure value. After that, a second pressure value generated by the pressure sensor in real time is continuously collected, and each time the second pressure value is collected, a second pressure change is obtained according to the second pressure value and the reference pressure value currently in use. When it is determined that a positive temperature drift occurs in the pressure sensor according to the second pressure change and the first pressure change corresponding to the pressure sensor when the touch pen writes the thinnest writing track, the currently used reference pressure value is increased, and when it is determined that a negative temperature drift occurs, the currently used reference pressure value is reduced, and when it is determined that writing occurs, the current second pressure change is sent to the touch screen so that the touch screen determines the thickness of the currently displayed writing track. This technical solution solves the technical problem in the related art that the temperature drift of the pressure sensor affects the accuracy of detecting the actual force of the pen tip. Among them, by continuously collecting the real-time second pressure value, the real-time second pressure change amount in the touch pen application process is obtained. After that, based on the second pressure change amount and the first pressure change amount, it is possible to determine in real time whether the touch pen has temperature drift, and when temperature drift occurs, adjust the currently used reference pressure value to ensure the accuracy of the reference pressure value when temperature drift occurs, thereby ensuring the accuracy of the second pressure change amount, and also ensuring the accuracy of the thickness of the writing track determined based on the second pressure change amount. That is, during the application of the touch pen, it is determined in real time whether the currently used reference pressure value conforms to the actual situation, avoiding the influence of the temperature drift phenomenon on the accuracy of the pressure sensor. At this time, a pressure sensor with lower accuracy can be used, thereby saving the cost of the touch pen. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 A schematic diagram of an application scenario of a touch pen provided in one embodiment of the present application;
[0021] Figure 2 A flowchart of a method for implementing writing with a touch pen provided in one embodiment of the present application;
[0022] Figure 3 A flowchart of another method for implementing writing with a touch pen provided in one embodiment of the present application;
[0023] Figure 4 An exemplary flow chart of a method for implementing writing with a touch pen provided in one embodiment of the present application;
[0024] Figure 5 A schematic diagram of the structure of a writing device for a touch pen provided in one embodiment of the present application;
[0025] Figure 6 A schematic diagram of the structure of a touch pen provided in one embodiment of the present application. DETAILED DESCRIPTION
[0026] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only the parts related to the present application, rather than all structures, are shown in the accompanying drawings.
[0027] A pressure sensor is a device or apparatus that can sense pressure signals and convert them into usable output electrical signals according to certain rules. Generally speaking, the accuracy of pressure sensor detection is proportional to the cost of the pressure sensor, that is, the higher the detection accuracy, the higher the corresponding cost.
[0028] The field of intelligent interaction is one of the application fields of pressure sensors. In the field of intelligent interaction, with the popularization of electronic devices with touch screen functions, the demand for touch pens using pressure sensors is also increasing.
[0029] Among them, the touch pen using a pressure sensor can also be recorded as a pressure-sensitive pen, a stylus or a smart pen, etc. When the touch pen writes on the touch screen, the pressure sensor can detect the pressure on the tip of the touch pen. After that, the touch pen determines the pressure change that reflects the writing force (i.e., the actual force on the tip of the pen) based on the pressure detected by the pressure sensor and the reference pressure of the pressure sensor, and then the touch screen displays a writing track of corresponding thickness according to the pressure change. Among them, the reference pressure can be understood as the pressure detected by the pressure sensor when the touch pen is not writing. Generally speaking, the greater the pressure change and the greater the writing force, the thicker the writing track displayed on the touch screen. Based on this, determining the reference pressure of the pressure sensor is one of the key links to accurately determine the thickness of the writing track.
[0030] However, temperature drift may occur during the application of pressure sensors. The principle of temperature drift is that due to the thermal motion of molecules, the pressure sensor produces different pressure sensitivity values (ie, pressure values) at different temperatures.
[0031] Affected by temperature drift, when the tip of the touch pen is subjected to the same actual pressure (i.e., the same writing force), if the temperature of the environment where the pressure sensor is located increases, the pressure value detected by the pressure sensor will increase slightly. If the temperature of the environment where the pressure sensor is located decreases, the pressure value detected by the pressure sensor will decrease slightly. Then, when the pressure sensor is used in the touch pen to determine the pressure change during the writing process, the temperature drift phenomenon that occurs will cause the reference pressure of the pressure sensor to change. At this time, the reference pressure originally used by the touch pen cannot reflect the actual reference pressure of the pressure sensor, which in turn causes the pressure change determined by the touch pen to be unable to reflect the actual writing force of the touch pen, that is, the touch pen cannot accurately determine the actual force on the tip of the pen.
[0032] In the related art, the occurrence of temperature drift can be reduced by using high-precision pressure sensors. However, the higher the precision, the higher the cost of the pressure sensor and the higher the cost of the touch pen, which is not conducive to the sales and popularization of the touch pen.
[0033] Based on this, the embodiments of the present application provide a writing implementation method, device, touch pen and storage medium for a touch pen, so as to avoid the technical problem that the base pressure of the pressure sensor changes due to temperature drift of the pressure sensor, thereby affecting the accuracy of the touch pen in detecting the actual force applied to the pen tip, without increasing the cost of the pressure sensor. When temperature drift occurs, the touch pen can adjust the base pressure of the pressure sensor used by itself, thereby ensuring the accuracy of the measured pressure change, so that the thickness of the writing trajectory when the touch screen displays the writing trajectory can reflect the actual writing force.
[0034] An embodiment of the present application provides a writing implementation method of a touch pen, which can be executed by a writing implementation device. The writing implementation device can be implemented by software and / or hardware, and the writing implementation device can be composed of two or more physical entities, or can be composed of one physical entity. In one embodiment, the writing implementation device is a touch pen used for writing. The touch pen is used to write on a touch screen. The touch pen is provided with a pressure sensor, which is used to detect the external pressure on the tip of the touch pen and generate a corresponding pressure value.
[0035] At present, a touch screen can be understood as a display screen with integrated touch function, and the touch screen can realize the touch function through one or more methods such as infrared touch, capacitive touch and electromagnetic touch. In actual applications, the touch screen may not include a display screen, but is only a device that realizes the touch function. In this case, the touch screen can be used in conjunction with the display screen to realize touch control of the display screen.
[0036] The touch screen has a matching touch pen, so that writing (including drawing), control, etc. can be performed on the touch screen through the touch pen. When the touch pen writes on the touch screen, the touch screen detects the touch position of the touch pen and displays the corresponding writing track at the touch position.
[0037] It is understandable that when the touch screen is installed on a terminal device, the writing of the touch pen on the touch screen can be responded to by the terminal device and the touch screen can be controlled to display the corresponding writing track.
[0038] The terminal device may be a mobile phone, a laptop computer, a tablet computer, a learning machine, an interactive smart tablet, or other terminal devices that support touch screen functions. In one embodiment, the terminal device is an interactive smart tablet. The interactive smart tablet may be an integrated device that controls the content displayed on the display tablet and realizes human-computer interaction through touch technology, and integrates one or more functions such as a projector, an electronic whiteboard, a screen, a speaker, a television, and a video conferencing terminal. Reference Figure 1 , which shows an application scenario of a touch pen, wherein the touch pen 10 can write on the touch screen of the interactive smart tablet 20, so that the interactive smart tablet displays the corresponding writing track on the touch screen. Currently, during the writing process of the touch pen 10, based on different writing forces (which can also be understood as the touch force when contacting the touch screen), the touch screen can display writing tracks of different thicknesses.
[0039] For example, the touch pen is composed of a pen holder and a pen tip, and one or more processors are arranged inside the pen holder. Currently, the processor arranged in the touch pen is a microcontroller unit (MCU) as an example for description. The MCU can cooperate with other devices in the touch pen to realize various functions of the touch pen.
[0040] One or more pressure sensors are also installed inside the pen holder of the touch pen. Currently, one pressure sensor is installed as an example. The pressure sensor is connected to the MCU so that the MCU can collect the pressure value generated by the pressure sensor. The type of pressure sensor is not limited at present. In one embodiment, a pressure sensor with low accuracy can be used to reduce the cost of the pressure sensor.
[0041] During operation, the pressure sensor can detect the external pressure on the pen tip and generate a corresponding pressure value. The specific structure between the pressure sensor and the pen tip is not currently limited.
[0042] In one embodiment, the greater the external pressure on the pen tip, the greater the pressure value generated by the pressure sensor, that is, the external pressure and the pressure value are positively correlated. It can be understood that the external pressure is related to the writing force when the user writes with the touch pen. The greater the writing force, the greater the external pressure on the pen tip.
[0043] In one embodiment, the pressure value generated by the pressure sensor is an AD value, and the AD value can be understood as the value after the analog quantity is converted into a digital quantity. That is, during the use of the touch pen, the pressure sensor can generate an analog quantity based on the external pressure on the pen tip, and then convert the analog quantity into a digital quantity to obtain an AD value, and then send the AD value to the MCU so that the MCU can perform subsequent processing, such as determining the writing force of the touch pen when writing based on the AD value. In the present disclosure, the touch pen executing the writing implementation method can also be understood as the MCU in the touch pen executing the writing implementation method.
[0044] Optionally, a wireless communicator is installed in the pen body of the touch pen, and the wireless communicator is connected to the MCU. The wireless communicator can communicate with the electronic device where the touch screen is located, such as sending the writing force to the electronic device so that the touch screen determines the thickness of the displayed writing track according to the writing force.
[0045] It is understandable that the touch pen is also equipped with other components, such as a power supply, etc., which are not explained separately at present.
[0046] When the touch pen executes the writing implementation method, the specific process is as follows Figure 2 As shown, it includes steps 310 to 340:
[0047] Step 310: Collect a first pressure value generated by the pressure sensor when the touch pen is not writing, and obtain an initial reference pressure value according to the first pressure value.
[0048] The reference pressure value can be understood as the pressure value generated by the pressure sensor when the stylus pen is not writing and the external pressure on the pen tip is zero or almost zero. The reference pressure value can be used to determine the deformation degree of the pressure sensor during the stylus pen application process, and then determine the writing force during writing.
[0049] In one embodiment, a first pressure value generated by a pressure sensor is collected. The first pressure value can be understood as the pressure value generated by the pressure sensor when the touch pen is used and no writing is done (i.e., the external pressure received by the pen tip is zero or almost zero). Afterwards, an initial reference pressure value is determined based on the first pressure value. The initial reference pressure value refers to the reference pressure value determined for the first time during the current use of the touch pen. During the subsequent use of the touch pen, the reference pressure value of the pressure sensor may change with factors such as changes in the external environment.
[0050] Optionally, after the touch pen is powered on, it starts to collect the first pressure value. The power-on process can be understood as the process from power on to the touch pen being able to work. After the touch pen is powered on, the pressure sensor starts working to continuously detect the external pressure on the pen tip and generate a corresponding pressure value. When the touch pen is powered on and not writing, the touch pen can collect the first pressure value, and then use the collected first pressure value as the initial reference pressure value.
[0051] Optionally, after the touch pen is powered on, the first pressure value is collected multiple times continuously, and an initial reference pressure value is determined based on the multiple collected first pressure values, such as taking the average of the multiple collected first pressure values as the initial reference pressure value, or processing the multiple collected first pressure values based on a sliding average method, and taking the obtained result as the initial reference pressure value. It is understandable that the number of collection times when collecting the first pressure value multiple times can be set according to actual conditions, and the embodiment does not limit this.
[0052] Step 320: Continue to collect the second pressure value generated in real time by the pressure sensor.
[0053] Exemplarily, after obtaining the initial reference pressure value, the touch pen may start normal writing, that is, it is determined that the touch pen is ready, and whether writing occurs may be detected.
[0054] In one embodiment, when the touch pen is used normally (i.e., during the application of the touch pen), the touch pen continuously collects the pressure value generated by the pressure sensor in real time. At present, after obtaining the initial reference pressure value, the collected real-time pressure value is recorded as the second pressure value. The collection frequency when continuously collecting the second pressure value can be set according to actual needs, and it is only necessary to ensure that the touch pen promptly recognizes the writing when writing starts.
[0055] It should be noted that the collection of the second pressure value is stopped only when the touch pen is powered off, and step 330 is executed each time a second pressure value is collected.
[0056] Step 330: Each time the second pressure value is collected, the current second pressure change is determined according to the second pressure value and the currently used reference pressure value; when it is determined that a positive temperature drift occurs according to the first pressure change and the second pressure change, the currently used reference pressure value is increased; when it is determined that a negative temperature drift occurs, the currently used reference pressure value is reduced; when it is determined that writing occurs, the current second pressure change is sent to the touch screen so that the touch screen determines the thickness of the currently displayed writing track; the first pressure change is the change in the pressure value corresponding to the pressure sensor when the touch pen writes the thinnest writing track; the thicker the writing track, the greater the change in the corresponding pressure value.
[0057] For example, each time the second pressure value is collected, it is necessary to determine whether the second pressure value currently collected is a pressure value generated based on writing or a pressure value generated by temperature drift (hereinafter referred to as temperature drift), that is, to achieve writing detection and temperature drift detection, and when temperature drift occurs, the reference pressure value can be adjusted immediately. It can be understood that the touch pen uses the same judgment method for each second pressure value collected. Therefore, the embodiment takes the second pressure value collected once as an example to describe the specific working process of the touch pen.
[0058] Exemplarily, after collecting the second pressure value, the pressure difference between the second pressure value and the currently used reference pressure value is determined, and the pressure difference is currently recorded as the second pressure variation. The second pressure variation can be understood as the real-time pressure variation during the use of the touch pen, which can reflect the real-time deformation degree of the pressure sensor.
[0059] It can be understood that before the reference pressure value is adjusted, the currently used reference pressure value is the initial reference pressure value, and after the reference pressure value is adjusted, the currently used reference pressure value is the adjusted reference pressure value. That is, the reference pressure value used to determine the second pressure change is the latest reference pressure value.
[0060] After the second pressure variation is determined, the first pressure variation is compared with the second pressure variation based on the first pressure variation pre-stored in the touch pen.
[0061] The first pressure variation may reflect the degree of deformation that the pressure sensor should produce when the touch pen writes the thinnest writing track (compared to when no writing is done), that is, the variation of the pressure value corresponding to the pressure sensor.
[0062] In one embodiment, the pressure change required for the touch pen to just produce ink when writing can be understood as the first pressure change. Ink production can be understood as the touch screen recognizing the touch of the touch pen and displaying the corresponding writing track. If the writing force of the touch pen is light, the touch screen cannot recognize the touch of the touch pen and will not display the corresponding writing track. At this time, it can be considered that the touch pen has not produced ink.
[0063] At present, the greater the writing force, the thicker the writing track displayed on the touch screen, that is, the thicker the writing track obtained by the touch pen, the greater the corresponding pressure change. The pressure change can be understood as the degree of deformation of the pressure sensor compared to the reference pressure value, that is, the degree of force on the pen tip.
[0064] When the touch screen displays the thinnest writing track, the force applied to the pen tip (i.e., the external pressure) can be considered as the minimum force applied to the pen tip when the touch screen recognizes the touch and displays the writing track, i.e., the minimum writing force required by the touch pen when writing. A touch with a force lower than the minimum writing force will not be recognized by the touch screen. Under normal circumstances, the writing force applied by the user when writing with the touch pen is generally greater than or equal to the minimum writing force.
[0065] Based on this, in the embodiment, when the stylus pen writes the thinnest writing track, the pressure change amount that the pressure sensor should correspond to, that is, the first pressure change amount. Generally speaking, the first pressure change amount is greater than zero. That is, when the deformation degree of the pressure sensor is greater than the deformation degree corresponding to the first pressure change amount, the stylus pen can be considered to be writing.
[0066] In one embodiment, the first pressure change is pre-set in the touch pen. When the touch pen needs it, the first pressure change can be directly obtained. At this time, the first pressure change can be manually set and stored in the MCU of the touch pen before the touch pen leaves the factory. The determination rule of the first pressure change is not currently limited. For example, the writing data of the current batch of touch pens when they are used is manually collected, and the writing data includes the pressure value generated by the pressure sensor. Then, the first pressure change is calculated and statistically obtained based on the pressure value. For example, the pressure change corresponding to each touch pen just coming out of ink is determined based on the pressure value of the pressure sensor during the writing process of each touch pen and the reference pressure value of the pressure sensor. Then, each pressure change is statistically obtained to obtain the pressure change that best reflects the just-inking and used as the first pressure change. Among them, the statistical method is not currently limited. It can be understood that the structure, parameters, and pressure sensors and other devices used in the same batch of touch pens are the same.
[0067] Optionally, in the embodiment, after the first pressure variation is stored in the touch pen, the first pressure variation does not change during the touch pen application process (i.e., when the touch pen is handed over to the user). In actual application, the first pressure variation stored in the touch pen can also be adjusted as the touch pen is used (or upgraded).
[0068] Optionally, in actual applications, the touch pen can also calculate the first pressure change during the touch pen application process. For example, after the touch pen determines the initial reference pressure value, it can prompt the user to use the touch pen to write the thinnest writing track. After that, the touch pen collects the pressure value generated by the pressure sensor, and uses the pressure difference between the pressure value and the initial reference pressure value as the first pressure change. For another example, when the user uses the touch pen to write on the touch screen, the touch pen collects the pressure value generated by the pressure sensor in real time, and uses the pressure difference between the real-time pressure value and the initial reference pressure value as the pressure change generated in real time when writing. When the touch screen determines to display the thinnest writing track, it notifies the touch pen. After receiving the notification, the touch pen determines the current pressure change as the first pressure change.
[0069] When comparing the first pressure change and the second pressure change, if the second pressure change is greater than or equal to the first pressure change, it means that the real-time deformation degree of the current pressure sensor is greater than or equal to the deformation degree of the pressure sensor when writing the thinnest writing trajectory, that is, the touch corresponding to the force degree of the pen tip can be recognized by the touch screen and display the corresponding writing trajectory. At this time, the touch pen determines that writing has occurred (that is, it is writing).
[0070] If the second pressure change is less than the first pressure change, it means that the current real-time deformation degree of the pressure sensor has not reached the deformation degree of the pressure sensor when writing the thinnest writing track, that is, no writing has occurred. Since the deformation degree of the pressure sensor can reach the deformation degree corresponding to the thinnest writing track when the touch pen is writing, therefore, when the deformation degree of the pressure sensor does not reach the deformation degree corresponding to the thinnest writing track, the touch pen believes that the second pressure value generated by the pressure sensor is a second pressure value generated based on interference, that is, it is interfered by temperature drift, and therefore determines that temperature drift has occurred.
[0071] It can be understood that the deformation of the pressure sensor includes positive deformation and negative deformation. During positive deformation, the pressure value generated by the pressure sensor is greater than the reference pressure value, and during negative deformation, the pressure value generated by the pressure sensor is less than the reference pressure value. When writing occurs, the deformation of the pressure sensor should be positive deformation. If the pressure sensor undergoes negative deformation, it means that there may be an error in the internal structure of the touch pen. When negative deformation occurs, the pressure difference between the second pressure value generated by the pressure sensor and the reference pressure value is also negative, that is, the second pressure change is negative. At this time, the deformation degree of the pressure sensor corresponding to the second pressure change can also reach the deformation degree corresponding to the finest writing track, but it is a negative deformation degree.
[0072] Temperature drift includes positive drift and negative drift. Positive drift means that the temperature of the environment where the pressure sensor is located increases, and the pressure value detected by the pressure sensor increases slightly. Negative drift means that the temperature of the environment where the pressure sensor is located decreases, and the pressure value detected by the pressure sensor decreases slightly. When negative drift occurs, the pressure value generated by the pressure sensor will decrease slightly. At this time, if no writing occurs, the second pressure value generated by the pressure sensor will be less than the reference pressure value, that is, the second pressure change is a negative number.
[0073] Therefore, when the second pressure change is a negative number, it is necessary to distinguish whether it is caused by negative temperature drift or an error in the internal structure. Generally speaking, the absolute value of the second pressure change caused by negative temperature drift is smaller than the absolute value of the second pressure change caused by an error in the internal structure. Based on this, in the embodiment, when comparing the first pressure change and the second pressure change, the absolute value of the second pressure change is first determined, and then the absolute value of the second pressure change is compared with the first pressure change.
[0074] If the absolute value of the second pressure change is less than the first pressure change, it is determined that temperature drift has occurred. If the absolute value of the second pressure change is not less than the first pressure change, it can be determined whether the second pressure value is greater than the reference pressure value. If it is greater than the reference pressure value, it means that writing has occurred. Otherwise, it is determined that there is an error in the internal structure of the touch pen.
[0075] When it is determined that temperature drift has occurred, it can be further determined whether a positive temperature drift has occurred or a negative temperature drift has occurred. If a positive temperature drift has occurred, it means that the actual current reference pressure value of the pressure sensor (i.e., the pressure value generated by the pressure sensor when no writing has occurred) will be slightly greater than the reference pressure value currently used by the touch pen. At this time, the determined second pressure change should be greater than zero. Correspondingly, when a negative temperature drift has occurred, the second pressure change should be less than zero. Therefore, by determining whether the second pressure change is a positive number or a negative number, it can be determined whether the current temperature drift is a positive temperature drift or a negative temperature drift.
[0076] When positive temperature drift occurs, the external pressure on the pen tip is zero or almost zero, and the pressure value generated by the pressure sensor (i.e., the actual reference pressure value) is slightly greater than the currently used reference pressure value, that is, the currently used reference pressure value can no longer reflect the actual situation. At this time, it is necessary to increase the currently used reference pressure value so that the updated reference pressure value can adapt to the situation of positive temperature drift. When processing the second pressure value collected subsequently, use the updated reference pressure value as the currently used reference pressure value to ensure processing accuracy.
[0077] When negative temperature drift occurs, the external pressure on the pen tip is zero or almost zero, and the pressure value generated by the pressure sensor (i.e., the actual reference pressure value) is slightly smaller than the currently used reference pressure value, that is, the currently used reference pressure value can no longer reflect the actual situation. At this time, it is necessary to reduce the currently used reference pressure value so that the updated reference pressure value can adapt to the situation of positive temperature drift. When processing the second pressure value collected subsequently, use the updated reference pressure value as the currently used reference pressure value to ensure processing accuracy.
[0078] Among them, when increasing the currently used reference pressure value, the currently collected second pressure value may be updated as the reference pressure value, or the currently used reference pressure value may be increased according to a preset increase range (which may be set according to actual conditions), and the embodiment does not limit this. Similarly, when reducing the currently used reference pressure value, the currently collected second pressure value may be updated as the reference pressure value, or the currently used reference pressure value may be reduced according to a preset reduction range (which may be set according to actual conditions), and the embodiment does not limit this.
[0079] When it is determined that writing occurs, the touch pen sends the currently determined second pressure change amount to the touch screen, so that the touch screen determines the thickness of the currently displayed writing track.
[0080] In one embodiment, the touch pen can process the second pressure variation, convert it into an actual pressure value, and then send the actual pressure value to the touch screen. At this time, sending the current second pressure variation to the touch screen so that the touch screen determines the thickness of the displayed track may include: determining a third pressure value according to the current second pressure variation, the third pressure value being the actual pressure value of the touch pen tip; sending the third pressure value to the touch screen so that the touch screen determines the thickness of the currently displayed writing track.
[0081] Exemplarily, the actual writing force of the touch pen during writing is determined according to the current second pressure change, that is, the actual pressure value of the pen tip when the touch pen tip contacts the touch screen. At present, the actual pressure value of the pen tip is recorded as the third pressure value. Among them, the implementation method of the touch pen determining the third pressure value is not currently limited, for example, the actual pressure value corresponding to different pressure changes is pre-set, and then, according to the corresponding relationship, the third pressure value corresponding to the current second pressure change is obtained. After that, the touch pen sends the third pressure value to the touch screen. Optionally, the third pressure value is an AD value. After the touch pen determines the third pressure value, the third pressure value is converted from a digital value to an analog value, that is, the AD value is converted to a DA value, and then the DA value is sent to the electronic device where the touch screen is located. After receiving the DA value, the electronic device sends the DA value to the driver chip that drives the touch screen display in the touch screen, and the driver chip determines the thickness of the writing track corresponding to the currently detected touch (i.e., writing) according to the DA value. Optionally, the driver chip also pre-sets the DA value range corresponding to different thicknesses, and then determines the thickness corresponding to the currently received DA value according to the corresponding relationship.
[0082] It should be noted that the execution node of the operation of obtaining the first pressure change amount can be flexibly set, for example, the first pressure change amount can be obtained after the second pressure change amount is obtained, or the first pressure change amount can be obtained before or after the initial reference pressure value is obtained.
[0083] In the above, by collecting the first pressure value generated by the pressure sensor when the touch pen is not writing, and obtaining an initial reference pressure value based on the first pressure value, thereafter, continuously collecting the second pressure value generated by the pressure sensor in real time, and obtaining the second pressure change according to the second pressure value and the currently used reference pressure value each time the second pressure value is collected, and determining that the pressure sensor has a positive temperature drift according to the second pressure change and the first pressure change corresponding to the pressure sensor when the touch pen writes the thinnest writing track, the currently used reference pressure value is increased, and when it is determined that a negative temperature drift has occurred, the currently used reference pressure value is reduced, and when it is determined that writing has occurred, the current second pressure change is sent to the touch screen so that the touch screen determines the thickness of the currently displayed writing track. The technical solution solves the technical problem in the related art that the temperature drift of the pressure sensor affects the accuracy of detecting the actual force of the pen tip. Among them, by continuously collecting the real-time second pressure value, the real-time second pressure change amount in the touch pen application process is obtained. After that, based on the second pressure change amount and the first pressure change amount, it is possible to determine in real time whether the touch pen has temperature drift, and when temperature drift occurs, adjust the currently used reference pressure value to ensure the accuracy of the reference pressure value when temperature drift occurs, thereby ensuring the accuracy of the second pressure change amount, and also ensuring the accuracy of the thickness of the writing track determined based on the second pressure change amount. That is, during the application of the touch pen, it is determined in real time whether the currently used reference pressure value conforms to the actual situation, avoiding the influence of the temperature drift phenomenon on the accuracy of the pressure sensor. At this time, a pressure sensor with lower accuracy can be used, thereby saving the cost of the touch pen.
[0084] Figure 3 A flowchart of another writing implementation method of a touch pen provided in one embodiment of the present application. The current writing implementation method is based on the aforementioned writing implementation method, and describes in more detail how to determine the initial reference pressure value, how to determine the first pressure change, and how to determine the occurrence of temperature drift, writing, negative deformation, and corresponding processing methods.
[0085] refer to Figure 3 The writing implementation method includes steps 410 to 480:
[0086] Step 410: After the touch pen is powered on, collect multiple first pressure values generated by the pressure sensor when the touch pen is not writing, process the multiple first pressure values based on a sliding average method, obtain a fifth pressure value, and determine the fifth pressure value as an initial reference pressure value.
[0087] The first pressure value is a pressure value generated by the pressure sensor when the touch pen is not writing.
[0088] In one embodiment of the present application, the number of first pressure values is multiple. That is, after the touch pen is powered on, the first pressure value generated by the pressure sensor is collected multiple times. Ideally, the first pressure values collected multiple times should be equal. However, in actual applications, based on the influence of the pressure sensor's own hardware factors, external environmental factors, etc., the first pressure values collected multiple times may be slightly different. At this time, the initial reference pressure value obtained based on the first pressure values collected multiple times can better reflect the pressure value generated by the pressure sensor when the pen tip is not writing. Among them, the number of first pressure values collected can be set according to actual conditions.
[0089] Exemplarily, a sliding average method (also referred to as a sliding average algorithm or a moving average method) is used to calculate the first pressure value obtained by multiple acquisitions. Currently, the calculation result is recorded as the fifth pressure value. The fifth pressure value is the initial reference pressure value currently determined.
[0090] It can be understood that the sliding average method is a relatively commonly used calculation method, and the implementation process of the sliding average method is not described in detail in the embodiment.
[0091] It is understandable that, in addition to using the sliding average method, other methods may be used to obtain the fifth pressure value, such as using the average value of a plurality of first pressure values as the fifth pressure value.
[0092] Step 420: Continue to collect the second pressure value generated in real time by the pressure sensor.
[0093] Step 430: Each time the second pressure value is collected, a first difference between the second pressure value and the currently used reference pressure value is determined, and the first difference is used as the second pressure variation of the pressure sensor.
[0094] Exemplarily, after the second pressure value is collected this time, the second pressure value is subtracted from the currently used reference pressure value, and the pressure difference obtained by the subtraction is recorded as the first difference, and then the first difference is used as the second pressure change.
[0095] It is understandable that when the second pressure value is collected for the first time, the currently used reference pressure value is the initial reference pressure value. When the second pressure value is collected subsequently, if the reference pressure value changes, the currently used reference pressure value is the reference pressure value after the latest change.
[0096] Step 440: Determine whether the absolute value of the second pressure change is less than the first pressure change. If the absolute value of the second pressure change is less than the first pressure change, execute step 450. If the absolute value of the second pressure change is not less than the first pressure change, execute step 460.
[0097] The first pressure variation is the variation of the pressure value corresponding to the pressure sensor when the touch pen writes the thinnest writing track. The thicker the writing track, the greater the variation of the corresponding pressure value.
[0098] After determining the second pressure variation, the absolute value of the second pressure variation is taken. The absolute value of the second pressure variation can reflect the pressure variation degree of the corresponding second pressure value relative to the currently used reference pressure value, that is, the deformation degree of the pressure sensor.
[0099] In the process of the pressure sensor continuously generating the second pressure value, there is a possibility that the generated second pressure value is the reference pressure value. Based on this, in one embodiment of the present application, before this step, it may also include: determining whether the second pressure change is equal to zero; if the second pressure change is not equal to zero, then executing this step. If the second pressure change is equal to zero, then abandoning processing the currently acquired second pressure value.
[0100] Exemplarily, the second pressure change is zero, indicating that the second pressure value is equal to the currently used reference pressure value, that is, the pressure value generated by the pressure sensor is the pressure value that the pressure sensor should generate when the touch pen is not writing. At this time, the touch pen determines that the pressure value generated by the pressure sensor when writing is not occurring is not affected by the outside world (such as temperature drift, structural error), so the touch pen does not respond to the second pressure value, that is, it abandons processing the currently acquired second pressure value. At this time, the touch pen does not modify the reference pressure value.
[0101] If the second pressure change is not zero, it means that the pressure value generated by the pressure sensor has changed relative to the reference pressure value, so it is necessary to determine the cause of the pressure change. At this time, this step is performed to determine whether the absolute value of the second pressure change is less than the first pressure change.
[0102] It can be understood that when the stylus pen is writing and the pen tip contacts the touch screen, the pressure sensor generates a positive deformation, the pressure value generated by the pressure sensor should be greater than the reference pressure value, and the corresponding pressure change should also be greater than zero. At this time, the first pressure change corresponding to the thinnest writing track set in advance should also be greater than zero.
[0103] After determining whether the absolute value of the second pressure change is less than the first pressure change, if the absolute value of the second pressure change is less than the first pressure change, it means that the real-time deformation degree of the current pressure sensor has not reached the deformation degree of the pressure sensor when writing the thinnest writing track. At this time, when the tip of the touch pen contacts the touch screen under the pressure corresponding to the deformation degree, the touch cannot be recognized by the touch screen. However, when the user uses the touch pen to write on the touch screen, the touch of the touch pen can generally be recognized by the touch screen. Therefore, when the absolute value of the second pressure change is less than the first pressure change, it can be considered that the pressure sensor has generated a second pressure value that is less different from the reference pressure value based on interference. At present, the interference reason that causes the pressure sensor to generate this type of second pressure value is mainly temperature drift. Therefore, it can be determined that temperature drift has occurred, and then step 450 is executed.
[0104] If the absolute value of the second pressure change is greater than or equal to the first pressure change, it means that the current real-time deformation degree of the pressure sensor is greater than or equal to the deformation degree of the pressure sensor when writing the thinnest writing track, that is, when the tip of the touch pen contacts the touch screen under the pressure corresponding to the deformation degree, the touch screen can recognize the touch. Therefore, it can be considered that the touch pen has written, and then step 460 is executed.
[0105] It is understandable that in the process of using the touch pen, there is a situation where the absolute value of the second pressure change is greater than or equal to the first pressure change due to an error in the internal structure of the touch pen. If the touch pen determines the second pressure change generated in this case as a pressure change caused by writing, an erroneous response will occur, that is, the touch screen receives the data sent by the touch pen for determining the thickness of the track, but does not detect the touch of the touch pen. In order to avoid this situation, in one embodiment of the present application, after determining that the absolute value of the second pressure change is not less than the first pressure change, the following steps are performed: determine whether the second pressure value currently collected is greater than the currently used reference pressure value; if the second pressure value currently collected is greater than the currently used reference pressure value, execute step 460. If the second pressure value currently collected is less than the currently used reference pressure value, multiple second pressure values are continuously collected; based on the sliding average method, each collected second pressure value is processed to obtain a fourth pressure value, and the fourth pressure value is updated to the currently used reference pressure value.
[0106] When an error occurs in the internal structure of the touch pen, the pressure sensor may undergo negative deformation. When the deformation occurs negatively, the pressure sensor is affected by the internal structure and generates a pressure value smaller than the reference pressure value (which can be understood as the pressure sensor detecting that the pressure on the pen tip when not writing is "decreased"). That is, the second pressure value currently collected by the touch pen is less than the reference pressure value, and when a negative deformation occurs, the absolute value of the second pressure change calculated based on the second pressure value may be greater than or equal to the first pressure change. When the writing pen is writing, the pressure sensor will undergo positive deformation due to the increase in external pressure on the pen tip. At this time, the pressure sensor will generate a pressure value greater than the reference pressure value, that is, the second pressure value currently collected by the touch pen is greater than the reference pressure value, and the absolute value of the second pressure change calculated based on the second pressure value will be greater than or equal to the first pressure change. Based on this, in the embodiment, when it is determined that the absolute value of the second pressure change currently calculated is greater than or equal to the first pressure change, the second pressure value currently generated by the pressure sensor is compared with the currently used reference pressure value, that is, it is determined whether the second pressure value is less than the reference pressure value. It can be understood that since the first pressure change is a positive number, and the absolute value of the second pressure change is currently determined to be greater than the first pressure change, the second pressure value currently collected will not be equal to the reference pressure value, that is, when judging whether the second pressure value is less than the reference pressure value, there are only two cases: the second pressure value is greater than the reference pressure value and the second pressure value is less than the reference pressure value. When the second pressure value is greater than the reference pressure value, it is determined that the pressure sensor has positive deformation, so it can be determined that the touch pen has written, that is, step 460 is executed. When the second pressure value is less than the reference pressure value, it is determined that the pressure sensor has negative deformation, that is, an error has occurred in the structure inside the touch pen (the absolute value of the second pressure change caused by the negative direction temperature drift is less than the absolute value of the second pressure change caused by the internal structure error). At this time, in order to enable the touch pen to accurately detect the occurrence of writing when an error occurs in the structure inside the touch pen, it is necessary to adjust the currently used reference pressure value so that the adjusted reference pressure value is suitable for the case where an error occurs in the internal structure of the touch pen.
[0107] Exemplarily, when adjusting the currently used reference pressure value, a plurality of second pressure values are first continuously collected. The second pressure value at this time can reflect the pressure value generated by the pressure sensor when no writing occurs (i.e., the external pressure received by the pen tip is zero or almost zero) and the internal structure is wrong. Among them, the number of continuous collections (i.e., the number of second pressure values) is also set in combination with actual conditions, and there is currently no limit on this. Optionally, in the process of continuously collecting multiple second pressure values, each time a second pressure value is collected, the second pressure change may not be calculated until the currently used reference pressure value is adjusted. Afterwards, each time a second pressure value is collected, the second pressure change needs to be calculated, that is, return to execute step 430.
[0108] After continuously collecting multiple second pressure values, the multiple second pressure values are calculated using the sliding average method. At present, the calculation result is recorded as the fourth pressure value. The fourth pressure value is the currently adjusted reference pressure value, that is, the reference pressure value currently used. It can be understood that the sliding average method is a relatively common calculation method, and the implementation process of the sliding average method is not described in detail in the embodiment.
[0109] Step 450: When the second pressure change is greater than zero, it is determined that a positive temperature drift occurs, and the currently used reference pressure value is increased; when the second pressure change is less than zero, it is determined that a negative temperature drift occurs, and the currently used reference pressure value is reduced.
[0110] When the absolute value of the second pressure change is less than the first pressure change, it means that temperature drift has occurred. At this time, it is necessary to further determine whether the temperature drift is a positive temperature drift or a negative temperature drift. Among them, when the temperature drift is in the positive direction, the pressure value detected by the pressure sensor increases slightly, that is, when no writing occurs (that is, the external pressure received by the pen tip is zero or almost zero), the pressure value generated by the pressure sensor should be slightly greater than the currently used reference pressure value, that is, the second pressure change should be greater than zero. When the temperature drift is in the negative direction, the pressure value detected by the pressure sensor decreases slightly, that is, when no writing occurs (that is, the external pressure received by the pen tip is zero or almost zero), the pressure value generated by the pressure sensor should be slightly less than the currently used reference pressure value, that is, the second pressure change should be less than zero. Based on this, when the absolute value of the second pressure change is less than the first pressure change, determine whether the second pressure change is positive or negative. If the second pressure change is positive (that is, greater than zero), it is determined that a positive temperature drift has occurred, and the currently used reference pressure value is increased. If the second pressure change is negative (that is, less than zero), it is determined that a negative temperature drift has occurred, and the currently used reference pressure value is reduced.
[0111] In one embodiment of the present application, the currently used reference pressure value is increased according to a preset increase amplitude. At this time, increasing the currently used reference pressure value includes: adding the currently used reference pressure value to the minimum unit step value of the pressure value to update the currently used reference pressure value.
[0112] The minimum unit step value can be understood as the minimum unit pressure value that can be modified each time the reference pressure value is modified. The minimum unit step value can be pre-set in the MCU according to actual needs. Currently, the minimum unit step value is described as 1AD.
[0113] Exemplarily, the minimum unit step value is a preset increase amplitude. When it is determined that a positive temperature drift occurs, the minimum unit step value is obtained, and the currently used reference pressure value is added to the minimum unit step value to update the currently used reference pressure value. It can be understood that when the minimum unit step value is used as the preset increase amplitude, after multiple adjustments (i.e., when it is determined that a positive drift occurs based on multiple collected second pressure values, multiple minimum unit step values are added to the reference pressure value), after collecting the second pressure value again, the second pressure value will be equal to the currently used reference pressure value, that is, the second pressure change is equal to zero. At this time, the touch pen determines that the currently used reference pressure value is already suitable for the case where a positive temperature drift occurs, that is, based on the positive temperature drift, the reference pressure value is appropriately increased, ensuring that the second pressure value collected by the touch pen is equal to the reference pressure value when no writing occurs at the current ambient temperature, thereby ensuring the accuracy of identifying the occurrence of writing.
[0114] In one embodiment of the present application, the currently used reference pressure value is reduced according to a preset reduction amplitude. At this time, reducing the currently used reference pressure value includes: subtracting the minimum unit step value of the pressure value from the currently used reference pressure value to update the currently used reference pressure value.
[0115] At present, the preset reduction amplitude and the preset increase amplitude are both the minimum unit step value. When it is determined that a negative temperature drift occurs, the minimum unit step value is obtained, and the minimum unit step value is subtracted from the currently used reference pressure value to update the currently used reference pressure value. It can be understood that when the minimum unit step value is used as the preset reduction amplitude, after multiple adjustments (that is, based on the second pressure value collected multiple times to determine that a negative drift occurs, it is the reference pressure value minus multiple minimum unit step values), after collecting the second pressure value again, the second pressure value will be equal to the currently used reference pressure value, that is, the second pressure change is equal to zero. At this time, the touch pen determines that the currently used reference pressure value is already suitable for the case of a negative temperature drift, that is, based on the negative temperature drift, the reference pressure value is appropriately reduced, ensuring that at the current ambient temperature, when no writing occurs, the second pressure value collected by the touch pen is equal to the reference pressure value, thereby ensuring the accuracy of identifying the occurrence of writing.
[0116] Step 460: Determine that writing has occurred, and send the current second pressure change to the touch screen so that the touch screen determines the thickness of the currently displayed writing track.
[0117] This step may be specifically as follows: determining a third pressure value based on the current second pressure change, the third pressure value being the actual pressure value exerted on the tip of the touch pen; and sending the third pressure value to the touch screen so that the touch screen determines the thickness of the currently displayed writing track.
[0118] As described above, after the touch pen is powered on, the first pressure value generated by the pressure sensor when the touch pen is not writing is collected multiple times, and the initial reference pressure value is obtained based on the sliding average method, so that the initial reference pressure value can be guaranteed to be more in line with the actual use of the touch pen, that is, the accuracy of the initial reference pressure value is guaranteed. In addition, during the use of the touch pen, the real-time second pressure value of the pressure sensor is continuously collected, and the second pressure change is obtained based on the second pressure value and the currently used reference pressure value, so that the touch pen can grasp the real-time change degree of the pressure sensor. Afterwards, when the absolute value of the second pressure change is less than the first pressure change, it is determined that temperature drift has occurred, and the currently used reference pressure value is adjusted based on the minimum unit step value, so that the reference pressure value can slowly follow the temperature drift, that is, it is suitable for the case of temperature drift, thereby ensuring the accuracy of the subsequent determination of the second pressure change, that is, the accuracy of determining the thickness of the writing track. When the absolute value of the second pressure change is not less than the first pressure change, it is further determined whether the second pressure value is greater than the currently used reference pressure value. If it is, it is determined that writing has occurred; otherwise, it is determined that an error has occurred in the internal structure of the touch pen. At this time, a new reference pressure value is re-determined based on the second pressure values collected multiple times. This allows the reference pressure value to be applicable to situations where an error has occurred in the internal structure, thereby ensuring the accuracy of the subsequent determination of the second pressure change, that is, the accuracy of determining the thickness of the writing track.
[0119] The following is an exemplary description of the writing implementation method of the touch pen provided in the embodiment of the present application. In this example, the pressure value output by the pressure sensor is an AD value, and the greater the pressure, the greater the AD value. When temperature drift occurs, the adjustment amplitude of the reference pressure value is the minimum unit step value, and the minimum unit step value is 1AD.
[0120] Figure 4 This is an example flow chart of a method for implementing writing with a touch pen provided in one embodiment of the present application, refer to Figure 4 After the touch pen is powered on, the AD value currently generated by the pressure sensor (i.e., the first pressure value) is collected multiple times, and the AD values collected multiple times are calculated based on the sliding average method to obtain the base value (i.e., the reference pressure value). After that, the threshold AD corresponding to the finest writing trajectory (i.e., the first pressure change) is obtained and recorded as the T value. After that, the AD value (i.e., the second pressure value) generated by the pressure sensor in real time is continuously collected, which is currently recorded as the R value. After each R value is collected, the R value is subtracted from the base value to obtain the Δ value (i.e., the second pressure change). The Δ value can measure the degree of deformation of the pressure sensor. Determine whether the Δ value obtained after collecting the R value this time is equal to zero. If it is equal to zero, it means that the base value is currently collected. At this time, no subsequent processing is performed, and the R value continues to be collected, and the above steps are repeated.
[0121] If the Δ value is not zero, it means that the pressure value generated by the pressure sensor has changed. Therefore, continue to determine whether the absolute value of the Δ value is less than the T value. If the absolute value of the Δ value is less than the T value, it means that a temperature drift has occurred. After that, when it is determined that the Δ value is greater than zero, it means that a positive temperature drift has occurred. At this time, the base value is increased by 1AD to update the base value. When it is determined that the Δ value is less than zero, it means that a negative temperature drift has occurred. At this time, the base value is reduced by 1AD to update the base value. At this point, the processing of the R value collected this time is completed. After that, continue to collect R values and repeat the above steps.
[0122] If the absolute value of the Δ value is not less than the T value, it is further determined whether the R value is greater than the base value. If the R value is greater than the base value, it means that the pressure sensor has undergone positive deformation, that is, it is determined that writing has occurred. At this time, the actual pressure value (i.e., the third pressure value) is determined according to the Δ value and sent to the driver chip of the touch screen, so that the driver chip can display the corresponding writing track based on the actual pressure value. At this time, the processing of the R value collected this time is completed, and then the R value continues to be collected and the above steps are repeated.
[0123] If the R value is less than the base value, it means that the pressure sensor has undergone negative deformation, that is, it is determined that there is an error in the internal structure of the touch pen. At this time, continue to collect 20 R values, and calculate the 20 R values based on the sliding average method. The obtained value (i.e., the fourth pressure value) is updated as the base value. At this time, the processing of the collected R value is completed, and then continue to collect R values and repeat the above steps.
[0124] Based on this, it is possible to identify temperature drift, writing and internal structure errors during the use of the touch pen, and then adjust the reference pressure value when it is necessary to ensure that the reference pressure value is more in line with the actual situation of the touch pen, reducing the impact of temperature drift and internal structure errors on the accuracy of writing recognition.
[0125] Figure 5 A schematic diagram of a writing device for a touch pen provided in one embodiment of the present application. The writing device is applied to a touch pen, the touch pen is used to write on a touch screen, and the touch pen is provided with a pressure sensor, which is used to detect the external pressure on the tip of the touch pen and generate a corresponding pressure value. Figure 5 The writing implementation device includes: a first acquisition unit 501, a second acquisition unit 502 and a first determination unit 503.
[0126] The first acquisition unit 501 is used to acquire the first pressure value generated by the pressure sensor when the touch pen is not writing, and obtain the initial reference pressure value according to the first pressure value; the second acquisition unit 502 is used to continuously acquire the second pressure value generated by the pressure sensor in real time; the first determination unit 503 is used to determine the current second pressure change according to the second pressure value and the currently used reference pressure value each time the second pressure value is acquired, and to increase the currently used reference pressure value when it is determined that a positive temperature drift occurs according to the first pressure change and the second pressure change, and to reduce the currently used reference pressure value when it is determined that a negative temperature drift occurs, and to send the current second pressure change to the touch screen when writing occurs, so that the touch screen determines the thickness of the currently displayed writing track. The first pressure change is the change in the pressure value corresponding to the pressure sensor when the touch pen writes the thinnest writing track, and the thicker the writing track, the greater the change in the corresponding pressure value.
[0127] In one embodiment of the present application, the first determination unit 503 specifically includes: a first difference making unit, which is used to determine the first difference between the second pressure value and the currently used reference pressure value each time the second pressure value is collected, and use the first difference as the second pressure change of the pressure sensor; a first judgment subunit, which is used to judge whether the absolute value of the second pressure change is less than the first pressure change; a second determination subunit, which is used to determine that a positive temperature drift has occurred if the absolute value of the second pressure change is less than the first pressure change, and increase the currently used reference pressure value if the second pressure change is greater than zero, and determine that a negative temperature drift has occurred if the second pressure change is less than zero, and reduce the currently used reference pressure value; a third determination subunit, which is used to determine that writing has occurred if the absolute value of the second pressure change is not less than the first pressure change, and send the current second pressure change to the touch screen so that the touch screen determines the thickness of the currently displayed writing track.
[0128] In one embodiment of the present application, it also includes: a second judgment unit, used to judge whether the absolute value of the second pressure change is less than the first pressure change before judging whether the second pressure change is equal to zero; a first execution unit, used to execute the operation of judging whether the absolute value of the second pressure change is less than the first pressure change if the second pressure change is not equal to zero.
[0129] In one embodiment of the present application, the processing abandonment unit is used to abandon the processing of the currently acquired second pressure value if the second pressure change amount is equal to zero.
[0130] In one embodiment of the present application, when the first determination unit 503 is used to increase the currently used reference pressure value, it is specifically used to add the minimum unit step value of the pressure value to the currently used reference pressure value to update the currently used reference pressure value. When the first determination unit 503 is used to reduce the currently used reference pressure value, it is specifically used to subtract the minimum unit step value of the pressure value from the currently used reference pressure value to update the currently used reference pressure value.
[0131] In one embodiment of the present application, it also includes: a third judgment unit, which is used to judge whether the currently collected second pressure value is greater than the currently used reference pressure value if the absolute value of the second pressure change is not less than the first pressure change; and a second execution unit, which is used to determine whether writing has occurred and send the current second pressure change to the touch screen if the currently collected second pressure value is greater than the currently used reference pressure value.
[0132] In one embodiment of the present application, it also includes: a third acquisition unit, which is used to continuously collect multiple second pressure values if the currently collected second pressure value is less than the currently used reference pressure value; a fourth determination unit, which is used to process the collected second pressure values based on a sliding average method to obtain a fourth pressure value, and update the fourth pressure value to the currently used reference pressure value.
[0133] In one embodiment of the present application, the first determination unit 503, when used to send the current second pressure change to the touch screen so that the touch screen determines the thickness of the currently displayed writing track, is specifically used to: determine a third pressure value based on the current second pressure change, the third pressure value being the actual pressure value exerted on the tip of the touch pen; and send the third pressure value to the touch screen so that the touch screen determines the thickness of the currently displayed writing track.
[0134] In one embodiment of the present application, the number of first pressure values is multiple, and the first acquisition unit 501 is specifically used to: after the touch pen is powered on, collect multiple first pressure values generated by the pressure sensor when the touch pen is not writing, process the multiple first pressure values based on the sliding average method, obtain the fifth pressure value, and determine the fifth pressure value as the initial reference pressure value.
[0135] A writing implementation device provided in one embodiment of the present application is included in a touch pen and can be used to execute the writing implementation method in any of the above embodiments, and has corresponding functions and beneficial effects.
[0136] It is worth noting that in the embodiment of the above-mentioned writing implementation device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0137] An embodiment of the present application further provides a touch pen, Figure 6 A schematic diagram of the structure of a touch pen provided by an embodiment of the present application. Figure 6 The touch pen 10 includes a pen holder 11 and a pen tip 12. A processor is disposed inside the pen holder 11. In the embodiment, the processor is a microprocessing unit (currently MCU) 111. The number of MCU 111 can be one or more. Figure 6 The pen 11 is also provided with a pressure sensor 112. The MCU 111 and the pressure sensor 112 can be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.
[0138] The structure between the pressure sensor 112 and the pen tip 12 is not limited at present. For example, Figure 6 In the embodiment, the pressure sensor 112 and the pen tip 12 are in contact through the spring 113. When the pen tip 12 contacts the touch screen, the pressure exerted on the spring 113 compresses the spring 113, that is, the pressure exerted by the spring 113 on the pressure sensor 112 changes, thereby causing the pressure sensor 112 to deform positively and generate a corresponding pressure value. It can be understood that when an error occurs in the internal structure of the touch pen, the pen tip 12 is not subjected to pressure, and the pressure exerted on the pressure sensor 112 by the spring 113 is reduced. At this time, the pressure sensor 112 produces a negative deformation.
[0139] One or more programs and modules are stored in MCU111, such as the program instructions / modules corresponding to the touch pen executing the touch pen writing implementation method in the embodiment of the present application (for example, the first acquisition unit 501, the second acquisition unit 502 and the first determination unit 503 in the writing implementation device). MCU111 executes various functional applications and data processing of the touch pen by running the stored programs, instructions and modules, that is, implements the touch pen writing implementation method executed by the above-mentioned touch pen device.
[0140] A wireless communicator 114 is also provided inside the pen body 11. The wireless communicator 114 is connected to the MCU 111 and is used to realize a communication function with the outside world according to the instruction of the MCU 111, such as communicating with a touch screen.
[0141] The surface of the pen body 11 is also provided with at least one physical key (as shown in the figure), which can be connected to the MCU 111 so that the user can input key signals related to function control and user settings through the physical key.
[0142] A power source is also provided inside the pen holder 11 (not shown in the figure), and the power source is used to supply power to the components that need power inside the pen holder 11, such as the power source is connected to the MCU 111, and is used to supply power to the MCU 111, and when the MCU 111 is in use, the power source is supplied to other components that need power (such as a communication device) through the MCU 111. For another example, the power source can also be directly connected to other components that need power, and the embodiment does not limit this.
[0143] The touch pen is used to write on the touch screen. At this time, the pressure sensor 112 is used to detect the external pressure on the tip of the touch pen 12 and generate a corresponding pressure value. The microprocessor unit 111 is used to collect the first pressure value generated by the pressure sensor when the touch pen is not writing, and obtain the initial reference pressure value according to the first pressure value; continuously collect the second pressure value generated by the pressure sensor in real time; each time the second pressure value is collected, determine the current second pressure change according to the second pressure value and the currently used reference pressure value, and when it is determined that the positive temperature drift occurs according to the first pressure change and the second pressure change, increase the currently used reference pressure value, and when it is determined that the negative temperature drift occurs, reduce the currently used reference pressure value, and when it is determined that writing occurs, send the current second pressure change to the touch screen so that the touch screen determines the thickness of the currently displayed writing track. The first pressure change is the change in the pressure value corresponding to the pressure sensor when the touch pen writes the thinnest writing track. The thicker the writing track, the greater the change in the corresponding pressure value.
[0144] The above-mentioned touch pen includes a writing implementation device of the touch pen, which can be used to execute the writing implementation method of the touch pen. For technical details not described in this embodiment, reference can be made to the relevant descriptions in the aforementioned embodiments, and the touch pen has corresponding functions and beneficial effects.
[0145] One embodiment of the present application also provides a storage medium containing computer executable instructions, which, when executed by a microcontroller unit of the touch pen, are used to perform relevant operations in the touch pen writing implementation method provided in any embodiment of the present application, and have corresponding functions and beneficial effects.
[0146] Those skilled in the art should understand that the embodiments of the present application may be provided as methods, systems, or computer program products.
[0147] Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the functions in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0148] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0149] Note that the above are only preferred embodiments of the present application and the technical principles used. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the appended claims.
Claims
1. A method for implementing writing with a touch pen, characterized in that: The touch pen is used to write on the touch screen, and the touch pen is provided with a pressure sensor, and the pressure sensor is used to detect the external pressure on the tip of the touch pen and generate a corresponding pressure value; The writing implementation method comprises: collecting a first pressure value generated by the pressure sensor when the touch pen is not writing, and obtaining an initial reference pressure value according to the first pressure value; Continuously collecting a second pressure value generated in real time by the pressure sensor; Each time the second pressure value is collected, the current second pressure change is determined according to the second pressure value and the currently used reference pressure value. When it is determined that a positive temperature drift occurs according to the first pressure change and the second pressure change, the currently used reference pressure value is increased. When it is determined that a negative temperature drift occurs, the currently used reference pressure value is reduced. When it is determined that writing occurs, the current second pressure change is sent to the touch screen so that the touch screen determines the thickness of the currently displayed writing track. The first pressure change is the change in the pressure value corresponding to the pressure sensor when the touch pen writes the thinnest writing track. The thicker the writing track, the greater the change in the corresponding pressure value.
2. The writing implementation method according to claim 1, characterized in that: The method of determining the current second pressure change according to the second pressure value and the currently used reference pressure value, increasing the currently used reference pressure value when determining that a positive temperature drift occurs according to the first pressure change and the second pressure change, and decreasing the currently used reference pressure value when determining that a negative temperature drift occurs, and sending the current second pressure change to the touch screen when determining that writing occurs, so that the touch screen determines the thickness of the currently displayed writing track, includes: determining a first difference between the second pressure value and a currently used reference pressure value, and using the first difference as a second pressure variation of the pressure sensor; Determining whether the absolute value of the second pressure change is less than the first pressure change; If the absolute value of the second pressure change is smaller than the first pressure change, then when the second pressure change is greater than zero, it is determined that a positive temperature drift occurs, and the currently used reference pressure value is increased; and when the second pressure change is less than zero, it is determined that a negative temperature drift occurs, and the currently used reference pressure value is decreased; If the absolute value of the second pressure change is not less than the first pressure change, it is determined that writing has occurred, and the current second pressure change is sent to the touch screen so that the touch screen determines the thickness of the currently displayed writing track.
3. The writing implementation method according to claim 2, characterized in that: The determining whether the absolute value of the second pressure change is less than the first pressure change comprises: Determining whether the second pressure change is equal to zero; If the second pressure change is not equal to zero, an operation of determining whether the absolute value of the second pressure change is smaller than the first pressure change is performed.
4. The writing implementation method according to claim 3, characterized in that: Also includes: If the second pressure change is equal to zero, the processing of the currently acquired second pressure value is abandoned.
5. The writing implementation method according to claim 1 or 2, characterized in that: The step of increasing the currently used reference pressure value comprises: Add the minimum unit step value of the pressure value to the currently used reference pressure value to update the currently used reference pressure value; The reducing the currently used reference pressure value comprises: The minimum unit step value of the pressure value is subtracted from the currently used reference pressure value to update the currently used reference pressure value.
6. The writing implementation method according to claim 2 or 3, characterized in that: If the absolute value of the second pressure change is not less than the first pressure change, the method further comprises: Determine whether the second pressure value currently collected is greater than the reference pressure value currently used; If the currently collected second pressure value is greater than the currently used reference pressure value, an operation of determining that writing has occurred and sending the current second pressure change amount to the touch screen is performed.
7. The writing implementation method according to claim 6, characterized in that: Also includes: If the second pressure value currently collected is less than the reference pressure value currently used, then multiple second pressure values are continuously collected; Based on the sliding average method, the collected second pressure values are processed to obtain a fourth pressure value, and the fourth pressure value is updated to the currently used reference pressure value.
8. The writing implementation method according to claim 1, characterized in that: The step of sending the current second pressure change amount to the touch screen so that the touch screen determines the thickness of the currently displayed writing track includes: Determine a third pressure value according to the current second pressure change, where the third pressure value is the actual pressure value exerted on the tip of the touch pen; The third pressure value is sent to the touch screen so that the touch screen determines the thickness of the currently displayed writing track.
9. The writing implementation method according to claim 1, characterized in that: The number of the first pressure values is multiple, The collecting the first pressure value generated by the pressure sensor when the touch pen is not writing, and obtaining an initial reference pressure value according to the first pressure value, includes: After the touch pen is powered on, multiple first pressure values generated by the pressure sensor when the touch pen is not writing are collected, and based on a sliding average method, the multiple first pressure values are processed to obtain a fifth pressure value, and the fifth pressure value is determined as an initial reference pressure value.
10. A writing device for a touch pen, characterized in that: The touch pen is used to write on the touch screen, and the touch pen is provided with a pressure sensor, and the pressure sensor is used to detect the external pressure on the tip of the touch pen and generate a corresponding pressure value; The writing implementation device comprises: A first collecting unit, configured to collect a first pressure value generated by the pressure sensor when the touch pen is not writing, and obtain an initial reference pressure value according to the first pressure value; A second acquisition unit, used for continuously acquiring a second pressure value generated in real time by the pressure sensor; The first determination unit is used to determine the current second pressure change according to the second pressure value and the currently used reference pressure value each time the second pressure value is collected; when it is determined that a positive temperature drift occurs according to the first pressure change and the second pressure change, the currently used reference pressure value is increased; when it is determined that a negative temperature drift occurs, the currently used reference pressure value is reduced; when it is determined that writing occurs, the current second pressure change is sent to the touch screen so that the touch screen determines the thickness of the currently displayed writing track; the first pressure change is the change in the pressure value corresponding to the pressure sensor when the touch pen writes the thinnest writing track, and the thicker the writing track, the greater the change in the corresponding pressure value.
11. A touch pen, characterized in that: The touch pen is used for writing on the touch screen. The touch pen comprises: a pen holder and a pen tip. A microprocessor unit and a pressure sensor are arranged inside the pen holder. The pressure sensor is used to detect the external pressure on the pen tip and generate a corresponding pressure value; The microprocessing unit is used to collect a first pressure value generated by the pressure sensor when the touch pen is not writing, and obtain an initial reference pressure value according to the first pressure value; continuously collect a second pressure value generated by the pressure sensor in real time; each time the second pressure value is collected, determine a current second pressure change according to the second pressure value and a currently used reference pressure value; when it is determined that a positive temperature drift occurs according to the first pressure change and the second pressure change, increase the currently used reference pressure value; when it is determined that a negative temperature drift occurs, reduce the currently used reference pressure value; when it is determined that writing occurs, send the current second pressure change to the touch screen so that the touch screen determines the thickness of the currently displayed writing track, the first pressure change is the change in the pressure value corresponding to the pressure sensor when the touch pen writes the thinnest writing track, and the thicker the writing track, the greater the change in the corresponding pressure value.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by the microprocessor unit of the touch pen, the writing method of the touch pen as described in any one of claims 1 to 9 is implemented.