Power consumption control method of stylus pen and electronic device

By identifying the storage state of the stylus and entering low-power mode, the problem of power consumption of the stylus caused by the lack of charging function of the folding screen mobile phone protective case is solved, thereby extending battery life and improving user satisfaction.

CN117707347BActive Publication Date: 2024-10-25HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310655396.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-02
Publication Date
2024-10-25
Estimated Expiration
2043-06-02

AI Technical Summary

Technical Problem

The protective case of foldable screen mobile phones does not have a charging function, causing the stylus to remain in standby mode when stored, resulting in large power consumption. How to extend the battery life of the stylus is an urgent problem that needs to be solved.

Method used

By identifying the storage state of the stylus, it enters the low-power mode. It uses the time information of the button press and lift events, combined with the acceleration sensor data, to accurately determine whether the stylus is in the storage state, and controls it to enter the low-power mode.

Benefits of technology

It effectively extends the battery life of the stylus and improves user satisfaction without increasing the cost of hardware equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117707347B_ABST
    Figure CN117707347B_ABST
Patent Text Reader

Abstract

The present disclosure provides a power consumption control method and an electronic device for a stylus pen, which are applied to the field of terminal technology and can accurately identify the storage state of the stylus pen. When the stylus pen is in the storage state, the stylus pen is put into a low power consumption mode, thereby extending the battery life of the stylus pen. The method includes: in response to a key press event of the stylus pen, acquiring and storing first feature information of the key press event; in response to a key lift event of the stylus pen, acquiring and storing second feature information of the key lift event; in the case of determining that the data information in the storage space of the stylus pen meets the first preset condition, based on the data information, determining the first value and the second value; in the case of the first value and the second value meeting the second preset condition, acquiring the state data of the stylus pen and the state data of the terminal device; in the case of determining that the stylus pen is in the storage state based on the state data of the stylus pen and the state data of the terminal device, controlling the stylus pen to be in a low power consumption mode.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of terminal technology, and in particular to a power consumption control method of a stylus pen and an electronic device. Background Art

[0002] With the popularization of terminal devices such as smart phones and tablets and the vigorous promotion of paperless office, stylus pens are expected to become standard equipment for smart terminals and be used in a variety of scenarios.

[0003] Generally, when the stylus is used with different terminal devices, the charging and storage methods of the stylus are slightly different. Figure 1 As shown in (a) of FIG. 1 , the magnetic stylus pen is used in combination with the tablet computer 1. The magnetic stylus pen can be adsorbed on the top of the tablet computer 1, and the magnetic stylus pen can be wirelessly charged and stored by adsorption. Figure 1 As shown in (b) of FIG. 1 , the stylus pen 1 is used together with the tablet computer 2 and the wireless keyboard. The wireless keyboard has a pen holder, and the stylus pen 1 can be inserted into the pen holder of the wireless keyboard to charge and store the stylus pen 1. For another example, Figure 1 As shown in (c) in the figure, the stylus pen 2 is used with a folding screen mobile phone (for example, Honor Magic Vs Ultimate Edition). As mobile phones are currently developing towards the direction of being thin and light, the stylus pen 2 cannot be directly stored and charged using a folding screen mobile phone. Figure 1 As shown in (d) in the figure, the stylus pen 2 can be stored in the mobile phone case of the foldable screen mobile phone. Since the mobile phone case has no charging function, the stylus pen 2 needs to be charged via a charging cable (for example, a type-C charging cable).

[0004] Based on the above, it can be seen that the protective case of the foldable screen mobile phone has no charging function. When the user is not using the stylus, the stylus is stored in the protective case carried by the user. If the user is not in a stationary state, the acceleration sensor in the stylus will also determine that the stylus is not in a stationary state, and the stylus will also be in standby mode, which consumes a lot of power. Therefore, how to extend the battery life of the stylus in the storage scenario is an urgent problem to be solved. Summary of the invention

[0005] The disclosed embodiments provide a power consumption control method of a stylus pen and an electronic device, which can accurately identify the storage state of the stylus pen. When the stylus pen is in the storage state, the stylus pen enters a low power consumption mode, thereby extending the battery life of the stylus pen and improving user satisfaction.

[0006] To achieve the above objectives, the embodiments of the present disclosure adopt the following technical solutions:

[0007] In a first aspect, the present disclosure provides a method for controlling power consumption of a stylus, the method comprising: first, in response to a key-pressing event of the stylus, obtaining and storing first characteristic information of the key-pressing event, the first characteristic information at least including a first time corresponding to the key-pressing event. Secondly, in response to a key-lifting event of the stylus, obtaining and storing second characteristic information of the key-lifting event; the second characteristic information at least including a second time corresponding to the key-lifting event. Thirdly, in the case where it is determined that the data information in the storage space of the stylus meets the first preset condition, based on the data information, determining a first value and a second value; the storage space of the stylus is used to store the first time and the second time, and the first value and the second value are used to determine whether the stylus is in a storage state. Then, in the case where the first value and the second value meet the second preset condition, obtaining the state data of the stylus and the state data of the terminal device. Finally, in the case where it is determined that the stylus is in the storage state based on the state data of the stylus and the state data of the terminal device, controlling the stylus to be in a low power consumption mode.

[0008] Based on the power consumption control method of the stylus pen of the first aspect, the occurrence time corresponding to the key pressing event and the occurrence time corresponding to the key lifting event are used to first determine whether the stylus pen is in the storage state. When the stylus pen is in the storage state, the state data of the stylus pen and the state data of the terminal device are used to determine whether the stylus pen is in the storage state again. In other words, the present disclosure determines whether the stylus pen is in the storage state through two judgments. In this way, the accuracy of the judgment result can be improved. And when it is determined that the stylus pen is in the storage state, the stylus pen is controlled to enter a low power consumption mode, thereby extending the battery life of the stylus pen and improving user satisfaction.

[0009] In combination with the first aspect, in another possible implementation, determining the first value and the second value based on the data information includes: determining the first value and the second value based on the data information and length information in the storage space of the stylus, the length information including the length information of the key of the stylus and the length information of multiple detection components in the storage component in the terminal device, the detection components are used to trigger the key pressing event and the key lifting event. Based on this possible implementation, a method for determining the first value and the second value is provided.

[0010] In combination with the first aspect, in another possible implementation, the first preset condition includes that the total number of the first time and the second time is equal to a threshold value, and determining that the data information in the storage space of the stylus meets the first preset condition includes: when the total number of the first time and the second time in the data information in the storage space of the stylus is equal to the threshold value, determining that the data information in the storage space of the stylus meets the first preset condition. Provide the specific content of the first preset condition. Since the total number of the first time and the second time is set based on multiple detection components in the storage component of the protective shell of the terminal device. Therefore, when the total number of the first time and the second time is equal to the threshold value, the stylus may be in the storage state. Therefore, based on the first preset condition, data that does not meet the conditions can be removed to avoid a large amount of invalid data processing, thereby improving data processing efficiency.

[0011] In combination with the first aspect, in another possible implementation, the first preset condition also includes that the values ​​corresponding to the first time and the second time are not preset values, and determining that the data information in the storage space of the stylus meets the first preset condition includes: when the total number of the first time and the second time in the data information in the storage space of the stylus is equal to the threshold value, and the values ​​corresponding to the first time and the second time are not preset values ​​(for example, the preset value is 0), determining that the data information in the storage space of the stylus meets the first preset condition. Another specific content of the first preset condition is provided. Since the values ​​corresponding to the first time and the second time are the occurrence times corresponding to the key pressing event and the key lifting event, the values ​​corresponding to the first time and the second time are not 0. The first preset condition can be further limited by using the fact that the values ​​corresponding to the first time and the second time are not 0, so that the data information that meets the first preset condition is screened out, and the result that the stylus is in the storage state can almost be obtained after calculation, thereby improving data processing efficiency.

[0012] In combination with the first aspect, in another possible implementation, the second preset condition includes that the first value is within a first preset range, and the second value is within a second preset range. Specific content of the second preset condition is provided.

[0013] In combination with the first aspect, in another possible implementation, the state data of the stylus pen includes the acceleration data of the stylus pen, the state data of the terminal device includes the acceleration data of the terminal device, and obtaining the state data of the terminal device includes: sending an acquisition request to the terminal device; receiving a reply response from the terminal device, the reply response includes the acceleration data of the terminal device. A method for obtaining the acceleration data of a terminal device is provided. When it is determined for the second time that the stylus pen is in the storage state, the acceleration data of the stylus pen and the acceleration data of the terminal device are used for further judgment. The acceleration data can accurately identify the state of the stylus pen and the terminal device, so that the state of the stylus pen and the terminal device can be used to judge whether the stylus pen is in the storage state again, thereby improving the accuracy of the judgment result.

[0014] In combination with the first aspect, in another possible implementation, determining that the stylus is in the storage state based on the state data of the stylus and the state data of the terminal device includes: determining the consistency result of the state data of the stylus and the state data of the terminal device; determining that the stylus is in the storage state when the consistency result of the state data of the stylus and the state data of the terminal device meets a third preset condition, the third preset condition being that the consistency result is greater than or equal to a preset consistency threshold. Based on this possible implementation, when the stylus is used with a terminal device, the states of the stylus and the terminal device are usually different. Therefore, a more accurate judgment result can be obtained based on the state data of the stylus and the state data of the terminal device.

[0015] In combination with the first aspect, in another possible implementation, before determining the consistency result of the state data of the stylus pen and the state data of the terminal device, the method includes: performing a preprocessing operation on the state data of the stylus pen and the state data of the terminal device to update the state data of the stylus pen and the state data of the terminal device, wherein the preprocessing operation includes a filtering operation. Based on this possible implementation, abnormal data in the state data of the stylus pen and the state data of the terminal device can be removed by filtering, thereby preventing the abnormal data from affecting the final calculation result and improving the accuracy of data processing.

[0016] In combination with the first aspect, in another possible implementation, the method further includes: in response to the pressing operation, the stylus pen exits the low power consumption mode. Based on this possible implementation, a method for exiting the low power consumption mode is provided.

[0017] In combination with the first aspect, in another possible implementation, the low power consumption mode includes any one of a deep sleep mode and a hibernation mode. Specific content of a low power consumption mode is provided.

[0018] In a second aspect, an embodiment of the present disclosure provides a power consumption control device for a stylus pen, which can be applied to an electronic device to implement the method in the first aspect. The functions of the power consumption control device for the stylus pen can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions, such as an acquisition module, a determination module, and a control module.

[0019] The acquisition module is configured to acquire and store first characteristic information of a key pressing event in response to a key pressing event of the stylus, wherein the first characteristic information at least includes a first time corresponding to the key pressing event.

[0020] The acquisition module is further configured to acquire and store second characteristic information of the key-up event in response to a key-up event of the stylus; the second characteristic information at least includes a second time corresponding to the key-up event.

[0021] The determination module is configured to determine a first value and a second value based on the data information when it is determined that the data information in the storage space of the stylus meets a first preset condition; the storage space of the stylus is used to store a first time and a second time, and the first value and the second value are used to determine whether the stylus is in a storage state.

[0022] The acquisition module is further configured to acquire the status data of the stylus pen and the status data of the terminal device when the first value and the second value meet the second preset condition.

[0023] The control module is configured to control the stylus to be in a low power consumption mode when it is determined that the stylus is in a storage state based on the state data of the stylus and the state data of the terminal device.

[0024] In combination with the second aspect, in a possible implementation, the determination module is further configured to determine the first value and the second value based on the data information and length information in the storage space of the stylus, the length information including the length information of the key of the stylus and the length information of multiple detection components in the storage assembly in the terminal device, and the detection components are used to trigger key pressing events and key lifting events.

[0025] In combination with the second aspect, in a possible implementation, the first preset condition includes that the total number of the first time and the second time is equal to a threshold value, and the determination module is further configured to determine that the data information in the storage space of the stylus satisfies the first preset condition when the total number of the first time and the second time in the data information in the storage space of the stylus is equal to the threshold value.

[0026] In combination with the second aspect, in a possible implementation method, the first preset condition also includes that the values ​​corresponding to the first time and the second time are not preset values, and the determination module is further configured to determine that the data information in the storage space of the stylus meets the first preset condition when the total number of the first time and the second time in the data information in the storage space of the stylus is equal to a threshold and the values ​​corresponding to the first time and the second time are not preset values.

[0027] In combination with the second aspect, in a possible implementation manner, the second preset condition includes that the first value is within a first preset range, and the second value is within a second preset range.

[0028] In combination with the second aspect, in a possible implementation method, the status data of the stylus includes acceleration data of the stylus, the status data of the terminal device includes acceleration data of the terminal device, and the acquisition module is further configured to send an acquisition request to the terminal device; and receive a reply response from the terminal device, the reply response including the acceleration data of the terminal device.

[0029] In combination with the second aspect, in a possible implementation method, the control module is also configured to determine the consistency result of the status data of the stylus pen and the status data of the terminal device; when the consistency result of the status data of the stylus pen and the status data of the terminal device meets the third preset condition, it is determined that the stylus pen is in the storage state, and the third preset condition is that the consistency result is greater than or equal to a preset consistency threshold.

[0030] In conjunction with the second aspect, in a possible implementation, the power consumption control device of the stylus pen further includes a preprocessing module. The preprocessing module is configured to perform a preprocessing operation on the state data of the stylus pen and the state data of the terminal device to update the state data of the stylus pen and the state data of the terminal device, and the preprocessing operation includes a filtering operation.

[0031] In a possible implementation, the control module is further configured to cause the stylus to exit the low power consumption mode in response to a pressing operation.

[0032] In combination with the second aspect, in a possible implementation, the low power consumption mode includes any one of a deep sleep mode and a hibernation mode.

[0033] In a third aspect, the present disclosure provides an electronic device, comprising: a memory, a display screen, and one or more processors; the memory, the display screen, and the processor are coupled. The memory is used to store computer program codes, and the computer program codes include computer instructions; when the electronic device is running, the processor is used to execute one or more computer instructions stored in the memory, so that the electronic device executes the power consumption control method of the stylus pen as described in any one of the first aspects above.

[0034] In a fourth aspect, the present disclosure provides a computer storage medium, comprising computer instructions, which, when executed on an electronic device, enables the electronic device to execute the power consumption control method for a stylus pen as described in any one of the first aspects.

[0035] In a fifth aspect, the present disclosure provides a computer program product. When the computer program product is executed on an electronic device, the electronic device executes the power consumption control method of a stylus pen as described in any one of the first aspects.

[0036] In a sixth aspect, a device (for example, the device may be a chip system) is provided, the device including a processor for supporting a first device to implement the functions involved in the first aspect. In one possible design, the device also includes a memory for storing program instructions and data necessary for the first device. When the device is a chip system, it may be composed of a chip, or may include a chip and other discrete devices.

[0037] It should be understood that the beneficial effects of the second to sixth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 A schematic diagram of an application of a stylus provided in an embodiment of the present disclosure;

[0039] Figure 2 A schematic diagram of a scenario provided for an embodiment of the present disclosure.

[0040] Figure 3 A schematic structural diagram of a stylus provided in an embodiment of the present disclosure.

[0041] Figure 4 A schematic diagram of the hardware structure of a terminal device provided in an embodiment of the present disclosure.

[0042] Figure 5 A schematic diagram of the software structure of a terminal device provided in an embodiment of the present disclosure.

[0043] Figure 6 A schematic diagram of a protective shell of a terminal device provided in an embodiment of the present disclosure.

[0044] Figure 7 A schematic flow chart of a method for controlling power consumption of a stylus pen provided in an embodiment of the present disclosure.

[0045] Figure 8 A schematic diagram of storing a stylus provided in an embodiment of the present disclosure.

[0046] Fig. 9 A schematic flow chart of another method for controlling power consumption of a stylus provided in an embodiment of the present disclosure.

[0047] Fig.10 A schematic diagram of the structure of a power consumption control device for a stylus pen provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0048] The technical solution in the embodiment of the present disclosure will be described below in conjunction with the drawings in the embodiment of the present disclosure. Among them, in the description of the present disclosure, unless otherwise specified, " / " indicates that the objects associated before and after are in an "or" relationship, for example, A / B can represent A or B; "and / or" in the present disclosure is only a kind of association relationship describing the associated objects, indicating that there can be three relationships, for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. And, in the description of the present disclosure, unless otherwise specified, "multiple" refers to two or more than two. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple. In addition, in order to facilitate the clear description of the technical solutions of the embodiments of the present disclosure, in the embodiments of the present disclosure, the words "first", "second" and the like are used to distinguish between the same items or similar items with substantially the same functions and effects. Those skilled in the art will understand that the words "first", "second" and the like do not limit the quantity and execution order, and the words "first", "second" and the like do not necessarily limit the differences. At the same time, in the embodiments of the present disclosure, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present disclosure should not be interpreted as being more preferred or more advantageous than other embodiments or design. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete manner for easy understanding.

[0049] In addition, the network architecture and business scenarios described in the embodiments of the present disclosure are intended to more clearly illustrate the technical solutions of the embodiments of the present disclosure, and do not constitute a limitation on the technical solutions provided by the embodiments of the present disclosure. Ordinary technicians in this field can know that with the evolution of network architecture and the emergence of new business scenarios, the technical solutions provided by the embodiments of the present disclosure are also applicable to similar technical problems.

[0050] With the development of terminal devices, the functions of terminal devices are becoming more and more abundant, almost meeting the needs of users in a variety of different scenarios. For example, in daily meetings, video learning and other scenarios, users can take notes through terminal devices to meet the user's recording needs.

[0051] When users take notes through terminal devices, many people are still accustomed to using traditional paper and pen. In order to meet the needs of users to use traditional paper and pen, many terminal devices are currently equipped with corresponding "stylus pens".

[0052] Among them, the stylus can include active capacitive pens and passive capacitive pens. The active capacitive pen is relatively large in size. When the active capacitive pen is used with a terminal device, the active capacitive pen is usually stored outside the terminal device. The passive capacitive pen is relatively small in size. When the passive capacitive pen is used with a terminal device, the passive capacitive pen can be stored inside the terminal device (for example, a Samsung mobile phone).

[0053] For example, taking the terminal device as a smart phone, when the user does not need to use the stylus, the stylus can be stored in the protective case of the smart phone. When the user needs to use the stylus, he can turn on the Bluetooth of the smart phone, search for available devices, establish pairing and connection between the smart phone and the stylus, etc. Since the protective case of the smart phone has no charging function, when the user is not using the stylus, the stylus is stored in the protective case carried by the user. If the user is not in a stationary state, the acceleration sensor in the stylus will also determine that the stylus is not in a stationary state, and the stylus is always in standby mode. Therefore, the stylus is always in standby mode when it is stored, which consumes a lot of power. Therefore, how to extend the battery life of the stylus in the storage scenario is an urgent problem that needs to be solved.

[0054] In the related art, a magnet can be added to the protective case of the smartphone or the smartphone, and a Hall sensor can be added to the corresponding position of the stylus to achieve storage, but this will increase the cost of the hardware equipment.

[0055] To this end, the embodiment of the present disclosure provides a power consumption control method for a stylus pen, by which the storage state of the stylus pen can be accurately identified. When the stylus pen is in the storage state, the stylus pen enters a low power consumption mode, thereby extending the battery life of the stylus pen, improving user satisfaction, and not increasing the cost of hardware equipment.

[0056] Figure 2 Schematic diagram of a scenario applicable to the embodiment of the present disclosure. Figure 2 , the scene includes a stylus 201, a terminal device 202, and a protective shell 203 of the terminal device, wherein the protective shell 203 of the terminal device includes a storage component 2031. The storage component 2031 is used to store the stylus 201, and the protective shell 203 of the terminal device is used to store the terminal device 202. The stylus 201 can provide input to the terminal device 202, and the terminal device 202 performs an operation in response to the input based on the input of the stylus 201.

[0057] Specifically, the stylus 201 can directly perform touch operations on the touch screen of the terminal device 202 to achieve input. For example, the instructions of related controls can be identified through the input of the stylus 201, and writing and drawing can be achieved according to the input of the stylus 201, etc., which are not limited here.

[0058] The stylus 201 and the terminal device 202 can be interconnected through a communication network to achieve wireless signal interaction. Figure 2 In the scenario shown, the communication network may be, but is not limited to, a short-range communication network such as a WI-FI hotspot network, a WI-FI peer-to-peer (P2P) network, a Bluetooth network, a Zigbee network, or a near field communication (NFC) network.

[0059] In the disclosed embodiment, the stylus 201 may be a capacitive stylus, and the capacitive stylus may include: a passive capacitive stylus and an active capacitive stylus. The passive capacitive stylus may be called a passive capacitive stylus, and the active capacitive stylus may be called an active capacitive stylus.

[0060] The active capacitive pen (i.e., the stylus 201) usually has a built-in battery and chip, and the chip can be used to send high-voltage signals to stimulate the capacitive screen (i.e., the touch screen) of the terminal device 202 to calculate relevant coordinates. One or more electrodes can be set in the active capacitive pen (e.g., in the pen tip), and the active capacitive pen can transmit signals through the electrodes. Figure 2 As shown, when the stylus 201 is an active capacitive stylus, an electrode array needs to be integrated on the touch screen of the terminal device 202 that interacts with the stylus 201. In one embodiment, the electrode array can be a capacitive electrode array. The terminal device 202 can receive a signal from the stylus 201 through the electrode array, and then when receiving the signal, it can identify the position of the stylus 201 on the touch screen based on the change in the capacitance value on the touch screen. In the disclosed embodiment, the stylus 201 can also be called a touch pen.

[0061] The terminal device 202 in the embodiment of the present disclosure may be referred to as user equipment (UE), terminal, etc. For example, the terminal device 202 may be a tablet computer (portable android device, PAD), a personal digital assistant (personal digital assistant, PDA), a handheld device with wireless communication function, a computing device, a vehicle-mounted device or a wearable device, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, a wireless terminal in smart home, etc., a mobile terminal or a fixed terminal with a touch screen. The form of the terminal device is not specifically limited in the embodiment of the present disclosure.

[0062] The protective shell 203 of the terminal device in the embodiment of the present disclosure is used to store the stylus 201 and the terminal device 202. When the user does not need to use the stylus 201, the stylus 201 can be inserted into the storage component 2031 in the protective shell 203 of the terminal device. When the user needs to use the stylus 201, the stylus 201 can be pulled out from the storage component 2031. The terminal device 202 can be stored in the protective shell 203 of the terminal device all the time to play a protective role.

[0063] The system architecture described in the embodiments of the present disclosure is intended to more clearly illustrate the technical solutions of the embodiments of the present disclosure, and does not constitute a limitation on the technical solutions provided by the embodiments of the present disclosure. A person of ordinary skill in the art can appreciate that with the evolution of network architecture and the emergence of new business scenarios, the technical solutions provided by the embodiments of the present disclosure are also applicable to similar technical problems.

[0064] Figure 3 This is a schematic diagram of the structure of a stylus pen 201 provided in an embodiment of the present disclosure. Figure 3As shown, the stylus 201 may include a pen tip 2011, a button 2012, a pen body 2013, a pen clip 2014 and a main circuit board. The main circuit board may include a microcontroller unit (MCU) and an acceleration sensor. The MCU and the acceleration sensor are coupled. The MCU is used to control the stylus to perform corresponding control functions. The acceleration sensor is used to detect the state of the stylus. For example, the state of the stylus may include a rotating state, a stationary state, a shaking state, etc. The button 2012 is used to control the stylus 201 to trigger multiple functions (for example, shut down, start up, switch between eraser and brush, etc.). Figure 2 As shown, when the stylus pen 201 is not in use, the stylus pen 201 can be fixed in place by using the pen clip 2014 in the stylus pen 201. Figure 2 In the storage component 2031 of the protective shell 203 of the terminal device shown.

[0065] For a stylus with a replaceable pen tip, the main circuit board can be disposed in the pen body 2013. The interior of the pen body 2013 is a hollow structure, and the pen tip 2011 and the pen body 2013 can be connected by plugging or snapping, or by threading. The button 2012 and the pen body 2013 can be connected by plugging or snapping, and the pen body 2013 and the pen clip 2014 can also be connected by plugging or snapping, which is not limited in the embodiment of the present disclosure.

[0066] Figure 4 FIG. 1 shows a schematic diagram of the hardware structure of a terminal device. Figure 4 As shown, the terminal device may include: a processor 410, an external memory interface 420, an internal memory 421, a universal serial bus (USB) interface 430, a charging management module 440, a power management module 441, a battery 442, an antenna 1, an antenna 2, a mobile communication module 450, a wireless communication module 460, an audio module 470, a speaker 470A, a receiver 470B, a microphone 470C, an earphone interface 430D, a sensor module 480, a button 490, a motor 491, an indicator 492, a camera 493, a display screen 494, and a subscriber identification module (SIM) card interface 495, etc. The sensor module 480 may include a pressure sensor 480A, a gyroscope sensor 480B, an air pressure sensor 480C, a magnetic sensor 480D, an acceleration sensor 480E, a distance sensor 480F, a proximity light sensor 480G, a fingerprint sensor 480H, a temperature sensor 480J, a touch sensor 480K, an ambient light sensor 480L, a bone conduction sensor 480M, etc.

[0067] It is to be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the terminal device. In other embodiments, the terminal device may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0068] The processor 410 may include one or more processing units, for example, the processor 410 may include an application processor (AP), a modem, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0069] The charging management module 440 is used to receive charging input from a charger, where the charger can be a wireless charger or a wired charger.

[0070] The power management module 441 is used to connect the battery 442, the charging management module 440 and the processor 410. The power management module 441 receives input from the battery 442 and / or the charging management module 440 to power the processor 410, the internal memory 421, the display screen 494, the camera 493, and the wireless communication module 460.

[0071] The wireless communication function of the terminal device can be implemented through antenna 1, antenna 2, mobile communication module 450, wireless communication module 460, modem and baseband processor.

[0072] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the terminal device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas.

[0073] The mobile communication module 450 can provide wireless communication solutions including 2G / 3G / 4G / 5G etc. applied on the terminal equipment.

[0074] The wireless communication module 460 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to terminal devices. The wireless communication module 460 can be one or more devices integrating at least one communication processing module. The wireless communication module 460 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and filters it, and sends the processed signal to the processor 410. The wireless communication module 460 can also receive the signal to be sent from the processor 410, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0075] The terminal device realizes the display function through the GPU, the display screen 494, and the application processor, etc. The GPU is a microprocessor for image processing, connecting the display screen 494 and the application processor.

[0076] The display screen 494 is used to display images, videos, etc. A series of graphical user interfaces (GUIs) can be displayed on the display screen 494 of the terminal device.

[0077] The terminal device can realize the shooting function through ISP, camera 493, video codec, GPU, display screen 494 and application processor.

[0078] Camera 493 is used to capture still images or videos.

[0079] The external memory interface 420 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal device.

[0080] The internal memory 421 may be used to store computer executable program codes, which include instructions. The processor 410 executes various functional applications and data processing of the terminal device by running the instructions stored in the internal memory 421 .

[0081] The terminal device can implement audio functions through the audio module 470, the speaker 470A, the receiver 470B, the microphone 470C, the headphone interface 430D, and the application processor, etc. For example, music playback, recording, etc. The terminal device may also include a pressure sensor 480A, an air pressure sensor 480C, a gyroscope sensor 480B, a magnetic sensor 480D, an acceleration sensor 480E, a distance sensor 480F, a proximity light sensor 480G, an ambient light sensor 480L, a fingerprint sensor 480H, a temperature sensor 480J, a touch sensor 480K, a bone conduction sensor 480M, a button 490, a motor 491, an indicator 492, etc.

[0082] The SIM card interface 495 is used to connect a SIM card. The SIM card can be connected to or separated from the terminal device by inserting the SIM card interface 495 or pulling it out from the SIM card interface 495. The terminal device can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 495 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 495 at the same time. The SIM card interface 495 is also compatible with external memory cards. The terminal device interacts with the network through the SIM card to realize functions such as calls and data communications.

[0083] In addition, an operating system, such as Hongmeng operating system, iOS operating system, Android operating system, Windows operating system, etc., is running on the above components. Applications can be installed and run on the operating system. In other embodiments, there may be multiple operating systems running in the terminal device.

[0084] It should be understood that Figure 4 The hardware modules included in the terminal device shown are only illustrative descriptions and do not limit the specific structure of the terminal device. In fact, the terminal device provided by the embodiment of the present disclosure may also include other hardware modules that have an interactive relationship with the hardware modules illustrated in the figure, which are not specifically limited here. For example, the terminal device may also include a flashlight, a micro-projection device, etc. For another example, if the terminal device is a PC, then the terminal device may also include components such as a keyboard and a mouse.

[0085] The software system of the above terminal device can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. Taking the system as an example, the software structure of the mobile phone is illustrated.

[0086] The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through interfaces. The system is divided into four layers, from top to bottom: application layer, application framework layer, Android runtime and system library, and kernel layer.

[0087] The application layer can include a series of application packages.

[0088] like Figure 5 As shown, the application package may include applications such as Bluetooth, camera, calendar, call, map, navigation, WLAN, music, video, short message, etc.

[0089] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

[0090] The application framework layer may include an activity manager, a window manager, a content provider, a view system, a resource manager, a notification manager, etc., and the embodiments of the present disclosure do not impose any restrictions on this.

[0091] Activity Manager: used to manage the life cycle of each application. Applications usually run in the operating system in the form of Activities. For each Activity, there is a corresponding application record (ActivityRecord) in the Activity Manager. This ActivityRecord records the status of the Activity of the application. The Activity Manager can use this ActivityRecord as an identifier to schedule the Activity process of the application.

[0092] Window Manager Service: It is used to manage the graphical user interface (GUI) resources used on the screen. Specifically, it can be used to obtain the screen size, create and destroy windows, show and hide windows, layout windows, manage focus, and manage input methods and wallpapers.

[0093] The system library and kernel layer below the application framework layer can be called the underlying system. The underlying system includes an underlying display system for providing display services. For example, the underlying display system includes a display driver in the kernel layer and a surface manager in the system library.

[0094] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system. The core library consists of two parts: one is the function that the Java language needs to call, and the other is the Android core library. The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0095] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.

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

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

[0098] OpenGL ES is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0099] SGL is a graphics engine for 2D graphics.

[0100] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.

[0101] A schematic diagram of the structure of a protective shell 203 of a terminal device provided in an embodiment of the present disclosure. Figure 6 As shown in (a) of FIG. 1 , the protective shell 203 of the terminal device may include a storage component 2031 and a housing 2032. The storage component 2031 includes a clamping portion 20311, a first detection component 20312, and a second detection component 20313. The clamping portion 20311 is used to clamp the pen clip 2014 of the stylus.

[0102] The first detection component 20312 and the second detection component 20313 are used to determine whether the stylus pen is in the storage state.

[0103] For example, Figure 6 (b) shows a cross-sectional view of a storage assembly 2031. Figure 6As can be seen from (b), the clamping portion 20311 is a recessed portion that is recessed inward along the outer wall of the storage component 2031. The clamping portion 20311 is arranged near the top of the storage component 2031. The first detection component 20312 and the second detection component 20313 are located below the clamping portion 20311, and the second detection component 20313 is located below the first detection component 20312. The first detection component 20312 and the second detection component 20313 are protrusions that protrude inward along the inner wall of the storage component 2031, and the user cannot directly observe them from the outside of the protective shell 203 of the terminal device. The first detection component 20312 and the second detection component 20313 are separated by a preset distance. The first detection component 20312 and the second detection component 20313 can be a cuboid or a cube. The length of the first detection component 20312 is L1, and the length of the second detection component 20313 is L2.

[0104] Insert the stylus pen 201 into the storage component 2031, Figure 6 (c) in the figure shows a cross-sectional view of the storage component 2031 after the stylus 201 is inserted. In order to ensure that the stylus 201 can be securely stored in the storage component 2031, the stylus 201 almost completely occupies all the internal space of the storage component 2031. During the insertion of the stylus 201, since the gap between the key 2012 of the stylus 201 and the first detection component 20312 and the second detection component 20313 is too small, the key 2012 of the stylus 201 will inevitably be lifted and pressed due to the appearance of the first detection component 20312 and the second detection component 20313. It is understandable that during the process of pulling out the stylus 201, the key 2012 of the stylus 201 will also be lifted and pressed.

[0105] It is understandable that when the stylus is stored using the storage component 2031 including the first detection component 20312 and the second detection component 20313, in order to distinguish the user's key pressing behavior and the stylus storage behavior as much as possible, the length of the first detection component 20312 can be set as short as possible, and the length of the second detection component 20313 can be set as long as possible. Alternatively, the length of the first detection component 20312 can be set as long as possible, and the length of the second detection component 20313 can be set as short as possible. Because the duration of a user pressing a key is usually relatively fixed, if one detection component is longer and the other detection component is shorter, then when the stylus passes through the two detection components, the corresponding duration will differ greatly. In this way, the user's key pressing behavior and the stylus storage behavior can be clearly distinguished.

[0106] The above is exemplified by taking the storage component 2031 including the first detection component 20312 and the second detection component 20313 as an example. It should be noted that the storage component 2031 may include multiple detection components, for example, the storage component 2031 includes 3 detection components. The stylus can enter the storage state through the 3 detection components. The storage behavior corresponding to the 3 detection components is: a key press event and a key lift event will be detected 3 times in a period of time. Since the user's key press behavior generally only occurs once in a period of time. Therefore, using the storage component including 3 detection components, most of the user's key press behaviors and the stylus storage behaviors can be distinguished, which is convenient for subsequent accurate identification of whether the stylus is in the storage state. For another example, the storage component 2031 includes 5 detection components. The stylus can enter the storage state through the 5 detection components. The storage behavior corresponding to the 5 detection components is: a key press event and a key lift event will be detected 5 times in a period of time. In this way, the user's keystroke behavior and the stylus storage behavior can be accurately distinguished, thereby accurately identifying the stylus storage state. The present disclosure does not limit the number, size, shape, and distance between multiple detection components in the storage component 2031 (ie, the length of the preset distance).

[0107] The following is a description of the process of the power consumption control method of the stylus provided in the embodiment of the present disclosure. Figure 7 As shown, specifically including:

[0108] Step 701: The stylus pen and the terminal device establish a Bluetooth connection.

[0109] In some examples, when the user needs to use the stylus as an auxiliary tool to control the terminal device, the user can trigger the stylus to turn on, and after the stylus is turned on, the Bluetooth module of the stylus can be turned on. After the Bluetooth module of the stylus is turned on, a Bluetooth connection can be established with the terminal device.

[0110] Exemplarily, after the Bluetooth module of the stylus is turned on, first, the Bluetooth module of the stylus can send handshake data to the terminal device (for example, a smart phone). When the distance between the stylus and the terminal device meets the preset threshold, the terminal device can receive handshake data from the stylus. Then, the terminal device performs device verification based on the received handshake data, and returns the device verification result to the stylus. If the device verification result returned by the terminal device to the stylus indicates that the verification is passed, the stylus sends the Bluetooth information of the stylus to the terminal device. Then, the terminal device performs Bluetooth information verification based on the received Bluetooth information. Finally, the terminal device returns the result of the Bluetooth information verification to the stylus. When the result of the Bluetooth information verification indicates that the verification is passed, the terminal device and the stylus establish a Bluetooth connection.

[0111] In some examples, the terminal device and the stylus pen may both have a wireless chip, and the wireless chip may support wireless communication within a preset distance. The stylus pen may send handshake data to the terminal device based on wireless transparent transmission. The handshake data may include the device name of the stylus pen, the product serial number (SN), software system information, product hardware information, and other content related to the device information of the stylus pen, which is not limited in the embodiments of the present disclosure.

[0112] It can be understood that the above-mentioned “preset threshold” may be the maximum transmission distance for communication between the stylus pen and the wireless chip of the terminal device, for example, within 10 mm.

[0113] It should be understood that in the embodiments of the present disclosure, both the terminal device and the stylus include a Bluetooth module integrated with a Bluetooth function, which is used to communicate via Bluetooth transmission. Optionally, the Bluetooth module may include a chip, a circuit set, and other peripheral devices, etc., which are not described here. Optionally, the Bluetooth module may include a classic Bluetooth (Bluetooth, BT) module, or a Bluetooth low energy module (Bluetooth low energy module, BLE), and the embodiments of the present disclosure do not limit the implementation form of the Bluetooth module.

[0114] It should also be understood that in the embodiments of the present disclosure, the "Bluetooth information of the stylus" may include the Bluetooth protocol information, wireless information, media access control (MAC) address information during Bluetooth connection, Internet protocol address (IP address) and other information related to the Bluetooth connection of the stylus. The embodiments of the present disclosure are referred to as "Bluetooth information". The "Bluetooth information" can be used to support the establishment of a Bluetooth channel between the terminal device and the stylus. The embodiments of the present disclosure do not limit the specific content of the "Bluetooth information".

[0115] Step 702: When the key interrupt module in the stylus detects that a key of the stylus is pressed, the key interrupt module sends a first interrupt notification to the stylus task module.

[0116] In some examples, the MCU of the stylus includes a key interrupt module, a stylus task module, and a sensor task module. The key interrupt module is used to send an interrupt to the stylus task module in response to a key event. The stylus task module is used to execute the task triggered in the stylus. The sensor task module is used to start a sensor (e.g., an acceleration sensor) and use the sensor to obtain state data of the stylus (e.g., acceleration data of the stylus).

[0117] After the stylus pen and the terminal device establish a Bluetooth connection, when the key interrupt module detects that a key of the stylus pen has changed (for example, a key is pressed), the key interrupt module will send a first interrupt notification to the stylus pen task module, so that the stylus pen task module can trigger a corresponding functional operation in response to the first interrupt notification.

[0118] In some examples, the first interrupt notification is used to indicate to the stylus task module that a key of the stylus has changed.

[0119] Step 703: In response to the first interrupt notification, the stylus task module determines the key event type.

[0120] After the stylus task module receives the first interrupt notification, the stylus task module may determine the key event type according to the first interrupt notification, and thus may determine for the first time whether the stylus enters the storage state according to the key event type.

[0121] In some examples, the key event type may include a key lift event and a key press event. The key lift event is used to indicate that the key of the stylus is in a key lift state. The key press event is used to indicate that the key of the stylus is in a key press state. The first interrupt notification includes a level signal of the first interrupt.

[0122] In some examples, the stylus task module determines the key event type according to the first interrupt notification, which may include: first, the stylus task module reads the level signal of the first interrupt in the first interrupt notification according to the first interrupt notification, and then identifies the key event type as a key lift event or a key press event according to the level signal of the first interrupt.

[0123] For example, when the level signal of the first interrupt in the first interrupt notification is at a high level, the key event type is determined to be a key lift event. When the level signal of the first interrupt in the first interrupt notification is at a low level, the key event type is determined to be a key press event.

[0124] For another example, when the level signal of the first interrupt in the first interrupt notification is at a high level, the key event type is determined to be a key press event. When the level signal of the first interrupt in the first interrupt notification is at a low level, the key event type is determined to be a key lift event.

[0125] It should be noted that the present disclosure does not limit the key event types corresponding to different level signals, which shall be subject to actual application. The following takes the case where the level signal is a high level and the key event type is determined to be a key lift event. The following takes the case where the level signal is a low level and the key event type is determined to be a key press event as an example for illustrative description.

[0126] Step 704: When the key event type is a key pressing event, the stylus task module records the first time.

[0127] After the stylus task module determines the key event type, if the key event type is a key press event, the stylus task module records the first time, and then determines for the first time whether the stylus enters the storage state according to the first time.

[0128] In some examples, the first time is the time corresponding to each time the key of the stylus is pressed. The first time may include multiple first sub-times, and each time the key of the stylus is pressed corresponds to a first sub-time.

[0129] In some examples, the stylus task module may record the first time in a storage space (buffer) of the stylus. After the stylus is powered on, as long as a key press event occurs, the stylus task module obtains the first time and stores the first time in the storage space of the stylus.

[0130] Step 705: When the key event type is a key lift event, the stylus task module records the second time and determines whether the data information in the storage space of the stylus meets a preset condition.

[0131] After the stylus task module determines the key event type, when the key event type is a key press event, the stylus task module records the second time and determines whether the data information in the storage space meets the preset conditions, thereby performing different processing operations based on whether the data information in the storage space meets the preset conditions.

[0132] In some examples, the second time is the time corresponding to each time the key of the stylus is lifted. The second time may include a plurality of second sub-times, and each time the key of the stylus is lifted corresponds to a second sub-time.

[0133] In some examples, the stylus task module may record the second time in the storage space of the stylus. After the stylus is powered on, whenever a key lift event occurs, the stylus task acquires the second time and stores the acquired second time in the storage space of the stylus.

[0134] In some examples, the data information in the storage space of the stylus includes a first time and a second time.

[0135] Usually, a key press and a key release occur in correspondence, so the first time corresponding to the key press event and the second time corresponding to the key release event can be stored as a group of time data. Therefore, the stylus can record time data in groups.

[0136] When the stylus records time data in groups, the data information in the storage space of the stylus may include multiple groups of time data. One group of time data includes two time values, which are the time value corresponding to the key lift event and the time value corresponding to the key press event. When the data information in the storage space exceeds multiple groups of time data, the stylus will replace the old time data with the new time data, so that the data information in the storage space always includes only multiple groups of time data.

[0137] It should be noted that the number of multiple sets of time data is related to the number of detection components in the storage component in the protective shell of the terminal device. For example, the storage component includes 2 detection components (i.e., the first detection component and the second detection component mentioned above), then the multiple sets of time data are 2 sets of time data. For another example, the storage component includes 3 detection components, then the multiple sets of time data are 3 sets of time data. In other words, the number of multiple sets of time data is consistent with the number of detection components, and the present disclosure does not limit the number of detection components.

[0138] In addition, if the correlation between key actions is not considered, as long as a key event is triggered, the occurrence time corresponding to the key event is stored. Then the data information in the storage space of the stylus pen may include multiple time data. When the data information in the storage space exceeds the multiple time data, the stylus pen will use the new time data to replace the old time data, so that the data information in the storage space always includes only multiple time data.

[0139] It should be noted that the number of multiple time data is related to the number of detection components in the storage component in the protective shell of the terminal device. For example, the storage component includes two detection components (namely, the first detection component and the second detection component mentioned above). When the key of the stylus passes through the first detection component, a key press event and a key lift event will occur. When the key of the stylus passes through the second detection component, a key press event and a key lift event will also occur. That is, the key of the stylus is triggered 4 times, and the multiple time data are 4 time data. For another example, the storage component includes 3 detection components, then the multiple time data are 6 time data. In other words, the number of multiple time data is twice the number of detection components, and the present disclosure does not limit the number of detection components.

[0140] The following is an exemplary description using an example in which the data information in the storage space includes multiple groups of time data.

[0141] After the stylus is turned on, the user will trigger a key press event and a key lift event due to their own usage needs. Only when the key press event and the key lift event are triggered for the first time, the data information in the storage space only includes one set of time data. In other cases, the data information in the storage space includes multiple sets of time data.

[0142] In the storage scenario of the stylus, the stylus needs to be used in conjunction with the protective case of the above-mentioned terminal device. Figure 6 It can be seen that in this scenario, the key of the stylus pen will pass through the first detection component and the second detection component in the storage component of the protective shell of the terminal device, and the key of the stylus pen will trigger 2 key press events and 2 key lift events. Since each time the key of the stylus pen triggers a key press event and a key lift event, the stylus pen task module will record the occurrence time corresponding to the key press event and the occurrence time corresponding to the key lift event in the storage space of the stylus pen. Therefore, the stylus pen will record 2 sets of time data, and the values ​​corresponding to the 2 sets of time data are not preset values. Exemplarily, the preset value is 0. Therefore, the preset condition is set that the data information in the storage space of the stylus pen includes 2 sets of time data, and the values ​​corresponding to the 2 sets of time data are not preset values. This preset condition can be used to illustrate that the key of the stylus pen is triggered by at least 2 key press events and 2 key lift events.

[0143] Step 706: When the data information in the storage space of the stylus meets a preset condition, the stylus task module determines a first value and a second value according to the data information and the length information in the storage space of the stylus.

[0144] After determining whether the data information in the storage space of the stylus pen meets the preset conditions, if the data information in the storage space of the stylus pen meets the preset conditions, the length information is obtained. Then, the first value and the second value are determined according to the data information in the storage space and the length information. Thus, it is first determined whether the stylus pen is in the storage state based on the first value and the second value.

[0145] In some examples, the length information includes the length information of the key of the stylus and the length information of multiple detection components in the storage component in the terminal device. The length information of the multiple detection components in the storage component in the terminal device includes the length of the first detection component, the length of the second detection component, and the length between the first detection component and the second detection component in the storage component.

[0146] For example, Figure 8 As shown, the length of the key 2011 of the stylus pen is L1, the length of the first detection component 20312 is L2, the length of the second detection component 20313 is L3, and the length between the first detection component 20312 and the second detection component 20313 is L4.

[0147] In combination with step 705, it can be known that the preset condition is that the storage space of the stylus pen includes two sets of time data, and the values ​​corresponding to the two sets of time data are not preset values. When the data information in the storage space of the stylus pen meets the preset condition, it means that two sets of time data are stored in the storage space of the stylus pen, one set of time data includes time data corresponding to a key lift event and time data corresponding to a key press event. The other set of time data includes time data corresponding to another key lift event and time data corresponding to a key press event.

[0148] In some examples, the first value satisfies the following relationship:

[0149] ((t2-t1) / (t4-t3)) / ((L2+L1) / (L3+L1)) =K1 Formula (1)

[0150] The second value satisfies the following relationship:

[0151] ((t2-t1) / ( t3-t2)) / ((L2+L1) / (L4-L1)) =K2 Formula (2)

[0152] Wherein, t1 is the time value corresponding to a key press event, t2 is the time value corresponding to a key release event, t3 is the time value corresponding to another key press event, and t4 is the time value corresponding to another key release event. K1 is the first value, and K2 is the second value.

[0153] When the stylus pen is inserted into the storage component at a uniform speed, the above formula (1) can be transformed to obtain the following expression:

[0154]

[0155] By transforming formula (2), we can get the following expression:

[0156]

[0157] Combining the above modified expressions, it can be seen that when the stylus is inserted into the storage component at a uniform speed, k1 and k2 can be equal to 1, that is, the first value and the second value are both 1. Usually, when the user inserts the stylus into the storage component, the speed is not necessarily uniform, so the determined first value and second value are not necessarily 1.

[0158] Step 707: The stylus task module determines for the first time whether the stylus is in the storage state based on the first value and the second value.

[0159] After determining the first value and the second value, it can be determined whether the stylus is in the storage state for the first time based on the first value and the second value. If the stylus is in the storage state, the acceleration sensor is used to verify whether the stylus is in the storage state for the second time.

[0160] In some examples, the stylus task module determines whether the stylus is in the storage state based on the first value and the second value, which may include: after the stylus task module determines the first value and the second value, it may determine whether the first value is in a first preset interval and whether the second value is in a second preset interval. If the first value is in the first preset interval and the second value is in the second preset interval, it is considered that the stylus is in the storage state. If the first value is not in the first preset interval, or the second value is not in the second preset interval, it is considered that the stylus is not in the storage state.

[0161] Exemplarily, the first preset interval and the second preset interval are the same, and the first preset interval and the second preset interval can be [0.8, 1.2]. The present disclosure does not limit the first preset interval and the second preset interval, and the first preset interval and the second preset interval can also be different. The first preset interval and the second preset interval can be appropriately adjusted according to the actual measurement results.

[0162] Step 708: If the data information in the storage space of the stylus task module does not meet the preset conditions, the process ends.

[0163] After determining whether the data information in the storage space of the stylus pen meets the preset conditions, if the data information in the storage space of the stylus pen does not meet the preset conditions, it means that the number of key press events and key lift events of the key of the stylus pen does not exceed two. According to the setting of the detection component in the storage component, the key of the stylus pen has at least two key press events and two key lift events. Therefore, the key of the stylus pen is not inserted into the storage component, and the process ends.

[0164] It should be noted that the embodiment of the present disclosure may not limit the execution order between step 706 and step 708. For example, only step 706 may be executed; or step 708 may be executed first and then step 706; the specific order may be determined according to actual use requirements.

[0165] Step 709: When it is determined that the stylus is in the storage state, the stylus task module sends a stylus acquisition notification to the sensor task module of the stylus, and sends a terminal device acquisition notification to the Bluetooth stylus management module of the terminal device.

[0166] When it is determined that the stylus is in the storage state, the stylus task module sends a stylus acquisition notification to the sensor task module of the stylus to acquire the state data of the stylus, and sends a terminal device acquisition notification to the Bluetooth stylus management module of the terminal device to acquire the state data of the terminal device, thereby determining whether the stylus and the terminal device are in the same state.

[0167] In some examples, the stylus acquisition notification is used to instruct the stylus sensor task module to start the stylus sensor and use the stylus sensor to obtain multiple groups of stylus status data at preset intervals. The terminal device acquisition notification is used to instruct the Bluetooth stylus management module to start the terminal device sensor and use the terminal device sensor to obtain multiple groups of terminal device status data at preset intervals.

[0168] In other examples, the status data of the stylus includes acceleration data of the stylus. The stylus acquisition notification is used to instruct the sensor task module of the stylus to start the sensor of the stylus, and the sensor of the stylus is used to obtain multiple groups of stylus status data at preset intervals, including: the stylus acquisition notification is used to instruct the sensor task module of the stylus to start the acceleration sensor of the stylus, and the acceleration sensor of the stylus is used to obtain multiple groups of stylus acceleration data at preset intervals. The status data of the terminal device includes the acceleration data of the terminal device. The terminal device acquisition notification is used to instruct the Bluetooth stylus management module to start the acceleration sensor of the terminal device, and the acceleration sensor of the terminal device is used to obtain multiple groups of terminal device acceleration data at preset intervals.

[0169] It should be noted that the status data of the stylus may also include other status data of the stylus, and the status data of the terminal device may also include other status data of the terminal device. The present disclosure does not impose any limitation on this, as long as it can indicate whether the status of the terminal device of the stylus is consistent.

[0170] Step 710: In response to the stylus acquisition notification, the sensor task module starts the acceleration sensor and reads multiple groups of acceleration data of the stylus at preset intervals.

[0171] After receiving the stylus acquisition notification, the sensor task module can start the acceleration sensor of the stylus according to the stylus acquisition notification, so that the acceleration sensor of the stylus reads multiple sets of acceleration data of the stylus at preset intervals, and then determines whether the acceleration data of the stylus is consistent with the acceleration data of the terminal device.

[0172] For example, the preset interval may be 100 ms. The multiple groups of acceleration data of the stylus may include 10 groups of acceleration data of the stylus. The present disclosure does not limit the preset interval and the number of groups of acceleration data of the stylus, which may be determined according to actual needs.

[0173] In some examples, a set of acceleration data of a stylus includes three-axis acceleration values ​​(x, y, z) of the stylus and sampling timestamps corresponding to the acceleration values.

[0174] Step 711: The sensor task module sends a stylus reply response to the stylus task module.

[0175] The stylus pen reply response includes multiple groups of acceleration data of the stylus pen.

[0176] Since the sensor task module controls the acceleration sensor of the stylus pen to read multiple sets of acceleration data of the stylus pen at preset intervals, after obtaining multiple sets of acceleration data of the stylus pen, the sensor task module can send the multiple sets of acceleration data of the stylus pen to the stylus task module at once. The sensor task module can also send the acceleration data of a set of stylus pen to the stylus task module every time it obtains the acceleration data of the stylus pen. The present disclosure does not limit the sending time of multiple sets of stylus pen acceleration values.

[0177] Step 712: In response to the terminal device obtaining the notification, the Bluetooth stylus management module controls the terminal device to start the acceleration sensor, and reads multiple groups of acceleration data of the terminal device at preset intervals.

[0178] After receiving the terminal device acquisition notification, the Bluetooth stylus management module can start the acceleration sensor of the terminal device according to the terminal device acquisition notification, so that the acceleration sensor of the terminal device reads multiple groups of acceleration data of the terminal device at a preset interval, and then determines whether the acceleration data of the terminal device is consistent with the acceleration data of the stylus.

[0179] Exemplarily, the multiple groups of acceleration data of terminal devices may include 10 groups of acceleration data of terminal devices. The present disclosure does not limit the number of groups of acceleration data of terminal devices, which can be determined according to actual needs.

[0180] In some examples, a set of acceleration data of a terminal device includes three-axis acceleration values ​​(x, y, z) of the terminal device and a sampling timestamp corresponding to the acceleration values.

[0181] Step 713: The Bluetooth stylus management module sends a terminal device reply response to the stylus task module.

[0182] The terminal device reply response includes multiple groups of acceleration data of the terminal device.

[0183] Since the Bluetooth stylus management module controls the acceleration sensor of the terminal device to read the acceleration data of multiple groups of terminal devices at preset intervals, after obtaining the acceleration data of multiple groups of terminal devices, the Bluetooth stylus management module can send the acceleration data of multiple groups of terminal devices to the stylus task module at the same time. The Bluetooth stylus management module can also send the acceleration data of a group of terminal devices to the stylus task module every time it obtains the acceleration data of the group of terminal devices. The present disclosure does not limit the sending time of the acceleration values ​​of multiple groups of terminal devices.

[0184] It should be noted that the embodiment of the present disclosure may not limit the execution order between step 710 and step 712. For example, step 710 may be executed first and then step 712; step 712 may be executed first and then step 710; step 710 and step 712 may also be executed simultaneously, which may be determined according to actual usage requirements.

[0185] Step 714: The stylus task module filters the multiple groups of stylus acceleration data and the multiple groups of terminal device acceleration data to obtain the filtered multiple groups of stylus acceleration data and the filtered multiple groups of terminal device acceleration data.

[0186] After the stylus task module obtains multiple sets of stylus acceleration data and multiple sets of terminal device acceleration data, the multiple sets of stylus acceleration data and multiple sets of terminal device acceleration data can be filtered to obtain filtered multiple sets of stylus acceleration data and filtered multiple sets of terminal device acceleration data, thereby removing abnormal data and preventing the abnormal data from affecting the final judgment result.

[0187] In some examples, the stylus task module filters multiple groups of stylus acceleration data and multiple groups of terminal device acceleration data to obtain the filtered multiple groups of stylus acceleration data and the filtered multiple groups of terminal device acceleration data, which may include: the stylus task module compares the sampling timestamps corresponding to the acceleration values ​​of each group of stylus in the multiple groups of stylus acceleration data and the sampling timestamps corresponding to the acceleration values ​​of each group of terminal devices in the multiple groups of terminal device acceleration data, and when the sampling timestamps corresponding to the acceleration values ​​of each group of stylus and the sampling timestamps corresponding to the acceleration values ​​of each group of terminal devices exceed a preset time threshold, the acceleration values ​​of the group of stylus and the acceleration values ​​of the group of terminal devices are deleted, thereby obtaining the filtered multiple groups of stylus acceleration data and the filtered multiple groups of terminal device acceleration data.

[0188] Exemplarily, the multiple groups of acceleration data of the stylus include acceleration data of X groups of the stylus, and the multiple groups of acceleration data of the terminal devices include acceleration data of X groups of the terminal devices. The filtered multiple groups of acceleration data of the terminal devices include acceleration data of y groups of the stylus. The filtered multiple groups of acceleration values ​​of the terminal devices include acceleration data of y groups of the terminal devices. Wherein, X is greater than or equal to y. The preset time threshold may be 50ms, which is not limited in the present disclosure and may be determined according to actual use requirements.

[0189] Step 715: The stylus task module determines the consistency results of the filtered multiple groups of acceleration data of the stylus and the filtered multiple groups of acceleration data of the terminal devices.

[0190] After obtaining the filtered multiple sets of stylus acceleration data and the filtered multiple sets of terminal device acceleration data, the stylus task module can make a consistency judgment on the filtered multiple sets of stylus acceleration data and the filtered multiple sets of terminal device acceleration data, so as to determine whether the stylus and the terminal device are in the same state.

[0191] In some examples, the stylus task module determines the consistency result of the filtered multiple groups of stylus acceleration data and the filtered multiple groups of terminal device acceleration data, which can be: the stylus task module uses a consistency algorithm to calculate the consistency of the filtered multiple groups of stylus acceleration data and the filtered multiple groups of terminal device acceleration data to obtain a consistency result.

[0192] Exemplarily, the consistency algorithm may be a Kendall correlation coefficient method, a Pearson correlation coefficient method, or a Sperman correlation coefficient method, which is not limited in the present disclosure and may be determined based on actual use requirements.

[0193] Step 716: When it is determined that the filtered multiple groups of acceleration data of the stylus are consistent with the filtered multiple groups of acceleration data of the terminal devices, control the stylus to enter a low power consumption mode.

[0194] After the stylus task module obtains the consistency results of the filtered multiple groups of stylus acceleration data and the filtered multiple groups of terminal device acceleration data, if the consistency results determine that the stylus and the terminal device are in the same state, it is considered that the stylus is in the storage state after the second verification, and the stylus is controlled to enter the low power consumption mode to reduce the power consumption of the stylus. If the consistency results determine that the stylus and the terminal device are not in the same state, it is considered that the stylus is not in the storage state after the second verification, and the process ends.

[0195] In some examples, determining that the filtered multiple groups of acceleration data of the stylus are consistent with the filtered multiple groups of acceleration data of the terminal devices may include: using a consistency algorithm to obtain consistency results corresponding to the filtered multiple groups of acceleration data of the stylus and the filtered multiple groups of acceleration data of the terminal devices. Then, the consistency result is compared with a preset consistency threshold, and when the consistency result is greater than or equal to the preset consistency threshold, it is determined that the filtered multiple groups of acceleration data of the stylus are consistent with the filtered multiple groups of acceleration data of the terminal devices. When the consistency result is less than the preset consistency threshold, it is determined that the filtered multiple groups of acceleration data of the stylus are inconsistent with the filtered multiple groups of acceleration data of the terminal devices.

[0196] In some examples, the low power consumption mode may include a deep sleep mode and a sleep mode. The deep sleep mode may also be referred to as a pseudo shutdown mode. When the stylus is in the deep sleep mode, the Bluetooth connection between the stylus and the terminal device is disconnected. When the stylus is in the sleep mode, the Bluetooth connection between the stylus and the terminal device is connected.

[0197] For example, the current and battery life of the stylus in different modes are shown in Table 1.

[0198] Table 1

[0199] Stylus working mode Wake-up mode Sleep Mode Deep sleep mode Working current 2.5mA 200uA 20uA Battery life 0.5 days 6 days 60 days

[0200] As shown in Table 1, when the stylus is in different working modes, the corresponding working current and battery life are different. Among them, when the working mode of the stylus is in wake-up mode, the working current of the stylus is 2.5mA, and the stylus can last for 0.5 days. When the working mode of the stylus is in sleep mode, the working current of the stylus is 200uA, and the stylus can last for 6 days. When the working mode of the stylus is in deep sleep mode, the working current of the stylus is 20uA, and the stylus can last for 60 days.

[0201] It can be seen from Table 1 that if the stylus is in deep sleep mode, the working current of the stylus will be greatly reduced. The endurance of the stylus is better. Therefore, when the stylus is determined to be stored in the storage component, the stylus can be controlled to enter a low power consumption mode, thereby reducing the power consumption of the stylus and extending the endurance of the stylus.

[0202] It should be noted that, since tablet computers are developing in the direction of large screens and convenient use, the magnetic stylus used with tablet computers will also pay more attention to the convenience of user operation. Therefore, the magnetic stylus does not have buttons, and the pen holder of the magnetic stylus has a built-in sensing touch device, which can respond to the user's click operation to achieve a variety of control functions. Accordingly, due to the presence of the sensing touch device, the design of the magnetic stylus will not be too small. Among them, the click operation can be any of a single-click operation, a double-click operation, a triple-click operation, and a multi-finger tapping operation.

[0203] Folding screen mobile phones are developing in the direction of being light and thin, so the stylus used with folding screen mobile phones is also developing in the direction of being exquisite and compact. Therefore, the design of the stylus cannot be too large. If a sensing touch device is built into the pen holder of the stylus, the size of the stylus will inevitably become larger, which is not in line with the development trend of the stylus. If a sensing touch device is built into the stylus and the size of the stylus is not increased, the setting position of the sensing touch device will be relatively limited. When using it, the user needs to try many times on the surface of the stylus to find an effective control position, which greatly reduces the convenience of user operation. Therefore, in accordance with the development trend of the stylus, in order to facilitate user control, external buttons can be placed on the pen holder of the stylus so that the user can achieve multiple control functions by pressing the buttons.

[0204] In some examples, the user implements a variety of control functions by pressing buttons, including the user long pressing the button to control the stylus to turn on and off. When the folding screen mobile phone uses memos, notes or other third-party applications (for example, painting applications), the switch between the eraser and the brush can be controlled by pressing the button. The stylus can also set the air mouse mode, and the stylus can be used as a mouse by pressing the button. When the folding screen mobile phone uses notes and PDF, the switch between the brush and lasso functions can be controlled by pressing the button. When the folding screen mobile phone uses XXPDF reader, XX mind map or office software, the click to switch function can be pre-set, and the preset function switch can be controlled by pressing the button when applying. The present disclosure does not limit the control functions that can be achieved by the buttons of the stylus, which can be determined according to actual usage requirements.

[0205] In combination with the foregoing, it can be known that multiple functions can be achieved by clicking the button of the stylus. That is, during the use of the stylus, too many functions can be achieved by pressing a button once. If a button press is detected, the acceleration data is read once. This will cause the stylus to frequently wake up the acceleration sensor of the stylus and the acceleration sensor of the terminal device. It brings great power consumption to the stylus and the terminal device. When the user uses the stylus, there are few scenarios in which the control function is realized by triggering two buttons. Therefore, the storage component of the present disclosure includes two detection components (the first detection component and the second detection component mentioned above). Since the preset condition is related to the number of detection components, the preset condition includes that the data information in the storage space of the stylus includes two sets of time data, and the values ​​corresponding to the two sets of time data are not preset values. Based on the preset condition, the key behavior of most users and the storage behavior of the stylus can be distinguished.

[0206] Compared with triggering the acceleration sensor of the stylus pen and the acceleration sensor of the terminal device when the preset conditions only include one set of time data and the values ​​corresponding to the one set of time data are not the preset values, this can avoid frequent activation of the acceleration sensor and reduce the power consumption of the stylus pen and the terminal device.

[0207] In other examples, the preset condition may also be that the data information in the storage space of the stylus includes 3 sets of time data, and the values ​​corresponding to the 3 sets of time data are not preset values. Or the data information in the storage space of the stylus includes 5 sets of time data, and the values ​​corresponding to the 5 sets of time data are not preset values. Since the frequency of the user clicking the physical key 3 times in a row and the user clicking the physical key 5 times in a row is extremely low, the user's key behavior and the stylus storage behavior can be almost completely distinguished, thereby greatly improving the recognition accuracy of whether the stylus enters the storage state. It can be understood that if the preset condition sets the data information in the storage space of the stylus to include 3 sets of time data, and the values ​​corresponding to the 3 sets of time data are not preset values, then the storage component needs to include 3 detection components. If the preset condition sets the data information in the storage space of the stylus to include 5 sets of time data, and the values ​​corresponding to the 5 sets of time data are not preset values, then the storage component needs to include 5 detection components.

[0208] In addition, it can be seen from step 702 to step 716 that the present disclosure finally identifies whether the stylus is in the storage state through two judgments. The first judgment is determined based on the occurrence time of the key press event and the occurrence time of the key lift event. In the case of the first judgment that the stylus is in the storage state, the acceleration sensor of the stylus and the acceleration sensor of the terminal device are used again to determine whether the stylus is in the storage state.

[0209] Through two judgments, the accuracy of identifying whether the stylus is in the storage state can be improved. Although the two judgments will bring a certain amount of power consumption, compared with the power consumption, the present disclosure gives priority to improving the recognition accuracy and preventing the stylus from entering the low power mode when it should not enter the low power mode. In other words, even if the stylus is inserted into the storage component and the stylus does not enter the low power mode, it will not affect the user's experience, but will only increase the power consumption of the stylus. If the stylus is misjudged during the user's use of the stylus, and it is believed that the stylus is in the storage state. Then, when the stylus is not inserted into the storage component, the stylus is controlled to enter the low power mode, which will directly affect the user's experience and reduce user satisfaction.

[0210] Step 717: When the stylus pen is in the low power consumption mode, if the key interrupt module of the stylus pen detects that a key of the stylus pen is pressed, the key interrupt module sends a second interrupt notification to the stylus pen task module.

[0211] When the stylus is in low power mode, if the key interrupt module of the stylus detects that a key of the stylus is pressed, the key interrupt module sends a second interrupt notification to the stylus task module, so that the stylus exits the low power mode and enters the wake-up mode.

[0212] In some examples, the second interrupt notification is used to trigger the stylus to exit the low power consumption mode and enter the wake-up mode.

[0213] In some examples, when the stylus is in a deep sleep mode in a low power consumption mode, when a key interrupt module of the stylus detects that a key of the stylus is pressed, the key interrupt module sends a second interrupt notification to the stylus task module to cause the stylus to exit the deep sleep mode and enter a wake-up mode.

[0214] When the program corresponding to the stylus-triggered wake-up mode starts running, the stylus task module will set the task start (taskready) flag. When the flag is set to 0, it means that the current stylus has not completed the startup. When the flag is set to 1, it means that the current stylus has completed the startup and is in wake-up mode. When the flag is set to 0 (that is, during the startup process), if the stylus task module receives an interrupt notification again, the interrupt notification will not be processed. When the flag is set to 1 (that is, after the startup is completed), if the stylus task module receives an interrupt notification again, it will continue to process the interrupt notification.

[0215] In other examples, when the stylus is in sleep mode in low power consumption mode, when the key interrupt module of the stylus detects that a key of the stylus is pressed, the key interrupt module sends a second interrupt notification to the stylus task module to make the stylus exit the sleep mode and enter the wake-up mode.

[0216] Step 718: In response to the second interrupt notification, the stylus task module controls the stylus to exit the low power consumption mode, enter the wake-up mode, and be in a Bluetooth connection state with the terminal device.

[0217] After receiving the second interrupt notification, the stylus task module controls the stylus to exit the low power consumption mode, enter the wake-up mode, and be in a Bluetooth connection state with the terminal device.

[0218] In some examples, the low power consumption mode is a deep sleep mode. After receiving the second interrupt notification, the stylus task module controls the stylus to exit the deep sleep mode and enter the wake-up mode. Since the stylus is in the deep sleep mode, the Bluetooth connection between the stylus and the terminal device is disconnected. Therefore, after the stylus is turned on, the stylus will turn on the Bluetooth automatic reconnection, so that the stylus and the terminal device establish a Bluetooth connection.

[0219] In other examples, the low power mode is a sleep mode. After receiving the second interrupt notification, the stylus task module controls the stylus to exit the sleep mode in the low power mode and enter the wake-up mode. Since the stylus is in deep sleep mode, the Bluetooth connection between the stylus and the terminal device is disconnected. Since the stylus is in sleep mode, the Bluetooth between the stylus and the terminal device is connected. Therefore, after the stylus is turned on, the stylus and the terminal device are still in a Bluetooth connection state.

[0220] Therefore, this solution uses the occurrence time corresponding to the key press event and the occurrence time corresponding to the key lift event to first determine whether the stylus is in the storage state. When the stylus is in the storage state, the state data of the stylus and the state data of the terminal device are used to determine whether the stylus is in the storage state again. In other words, the present disclosure determines whether the stylus is in the storage state through two judgments. In this way, the accuracy of the judgment result can be improved. And when it is determined that the stylus is in the storage state, the stylus is controlled to enter the low power consumption mode, thereby extending the battery life of the stylus and improving user satisfaction.

[0221] For ease of understanding, the following Fig. 9 The power consumption control method of the stylus provided in the embodiment of the present disclosure is described. Fig. 9 As shown, the power consumption control method of the stylus pen may include the following steps 901 to 905.

[0222] Step 901: In response to a key pressing event of a stylus pen, first characteristic information of the key pressing event is acquired and stored, where the first characteristic information at least includes a first time corresponding to the key pressing event.

[0223] In the embodiment of the present disclosure, in response to a key pressing event of the stylus, first feature information of the key pressing event is obtained and stored. The first feature information at least includes the first time corresponding to the key pressing event. Figure 7 Steps 701 to 704 in the illustrated embodiment will not be described in detail in the embodiment of the present disclosure.

[0224] Step 902: In response to a key-up event of the stylus pen, obtain and store second characteristic information of the key-up event; the second characteristic information at least includes a second time corresponding to the key-up event.

[0225] In the embodiment of the present disclosure, in response to a key lift event of the stylus, second feature information of the key lift event is obtained and stored; the second feature information at least includes a second time corresponding to the key lift event, which can be referred to above. Figure 7 Step 705 in the illustrated embodiment will not be described in detail in the embodiment of the present disclosure.

[0226] Step 903: When it is determined that the data information in the storage space of the stylus meets the first preset condition, determine a first value and a second value based on the data information.

[0227] In some examples, the storage space of the stylus is used to store the first time and the second time, and the first value and the second value are used to determine whether the stylus is in a storage state.

[0228] In the embodiment of the present disclosure, when it is determined that the data information in the storage space of the stylus meets the first preset condition, the first value and the second value are determined based on the data information. Figure 7 Step 706 in the illustrated embodiment will not be described in detail in the embodiment of the present disclosure.

[0229] In some examples, the first preset condition includes that the total number of the first time and the second time is equal to a threshold value, and determining that the data information in the storage space of the stylus satisfies the first preset condition includes: when the total number of the first time and the second time in the data information in the storage space of the stylus is equal to the threshold value, determining that the data information in the storage space of the stylus satisfies the first preset condition.

[0230] In some examples, the first preset condition also includes that the values ​​corresponding to the first time and the second time are not preset values, and determining that the data information in the storage space of the stylus meets the first preset condition includes: when the total number of the first time and the second time in the data information in the storage space of the stylus is equal to a threshold, and the values ​​corresponding to the first time and the second time are not preset values, determining that the data information in the storage space of the stylus meets the first preset condition.

[0231] Among them, the first preset condition and the above Figure 7 The preset conditions in step 705 and step 706 in the embodiment shown are similar. The two sets of time data in the preset conditions are equivalent to the first time and the second time. The values ​​corresponding to the two sets of time data in the preset conditions are not preset values, which is equivalent to the values ​​corresponding to the first time and the second time are not preset values.

[0232] In some examples, a first value and a second value are determined based on data information, including: determining the first value and the second value according to data information and length information in a storage space of the stylus, the length information including length information of a key of the stylus and length information of multiple detection components in a storage component in a terminal device, the detection components being used to trigger a key press event and a key lift event.

[0233] In the embodiment of the present disclosure, the first value and the second value are determined according to the data information and the length information in the storage space of the stylus. Figure 7 Step 706 in the illustrated embodiment will not be described in detail in the embodiment of the present disclosure.

[0234] Step 904: When the first value and the second value meet a second preset condition, obtain status data of the stylus pen and status data of the terminal device.

[0235] In some examples, the second preset condition includes the first value being within a first preset range and the second value being within a second preset range.

[0236] In some examples, the status data of the stylus includes acceleration data of the stylus, the status data of the terminal device includes acceleration data of the terminal device, and obtaining the status data of the terminal device includes: sending an acquisition request to the terminal device; receiving a reply response from the terminal device, the reply response including the acceleration data of the terminal device.

[0237] The acquisition request can be the above Figure 7 In step 709 of the embodiment shown in the figure, the terminal device obtains the notification. The reply response may be the above Figure 7 The terminal device in step 713 of the embodiment shown in the figure replies with a response. The acceleration data of the terminal device may be the above Figure 7 Multiple groups of acceleration data of terminal devices in step 713 in the illustrated embodiment.

[0238] In the embodiment of the present disclosure, when the first value and the second value meet the second preset condition, the state data of the stylus and the state data of the terminal device are obtained, and the second preset condition includes that the first value is within the first preset range and the second value is within the second preset range. Figure 7 Steps 707 to 713 in the illustrated embodiment will not be described in detail in the embodiment of the present disclosure.

[0239] Step 905: When it is determined that the stylus is in the storage state based on the state data of the stylus and the state data of the terminal device, control the stylus to be in a low power consumption mode.

[0240] In the embodiment of the present disclosure, when it is determined that the stylus is in the storage state based on the state data of the stylus and the state data of the terminal device, the stylus is controlled to be in the low power consumption mode. Figure 7 Steps 714 to 716 in the illustrated embodiment will not be described in detail in the embodiment of the present disclosure.

[0241] In some examples, before determining the consistency result of the stylus status data and the terminal device status data, it includes: performing a preprocessing operation on the stylus status data and the terminal device status data to update the stylus status data and the terminal device status data, and the preprocessing operation includes a filtering operation.

[0242] The updated state data of the stylus pen and the state data of the terminal device may be the above Figure 7 The filtered multiple groups of acceleration data of the stylus and the filtered multiple groups of acceleration data of the terminal device in step 714 in the illustrated embodiment.

[0243] In the embodiment of the present disclosure, a preprocessing operation is performed on the state data of the stylus pen and the state data of the terminal device to update the state data of the stylus pen and the state data of the terminal device. The preprocessing operation includes a filtering operation. Figure 7 Step 714 in the illustrated embodiment will not be described in detail in the embodiment of the present disclosure.

[0244] In some examples, determining that the stylus is in a storage state is based on status data of the stylus and status data of a terminal device, including: determining a consistency result of the status data of the stylus and the status data of the terminal device; and determining that the stylus is in the storage state when the consistency result of the status data of the stylus and the status data of the terminal device meets a third preset condition, the third preset condition being that the consistency result is greater than or equal to a preset consistency threshold.

[0245] In the embodiment of the present disclosure, the consistency result of the state data of the stylus pen and the state data of the terminal device is determined; when the consistency result of the state data of the stylus pen and the state data of the terminal device meets the third preset condition, it is determined that the stylus pen is in the storage state, and the third preset condition is that the consistency result is greater than or equal to the preset consistency threshold. Figure 7 Steps 715 and 716 in the illustrated embodiment will not be described in detail in the embodiment of the present disclosure.

[0246] In some examples, the method further includes: in response to the pressing operation, the stylus pen exits a low power consumption mode.

[0247] The pressing operation may be the above Figure 7 In the illustrated embodiment, a key of the stylus is pressed in step 717 .

[0248] In the embodiment of the present disclosure, in response to the pressing operation, the stylus pen exits the low power consumption mode. Figure 7 Steps 717 and 718 in the illustrated embodiment will not be described in detail in the embodiment of the present disclosure.

[0249] In some examples, the low power consumption mode includes any of a deep sleep mode and a hibernation mode.

[0250] Corresponding to the method in the aforementioned embodiment, the embodiment of the present disclosure further provides a power consumption control device for a stylus. The power consumption control device for the stylus can be applied to an electronic device to implement the method in the aforementioned embodiment. The function of the power consumption control device for the stylus can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.

[0251] For example, Fig.10 A schematic diagram of the structure of a power consumption control device 1000 for a stylus pen is shown. Fig.10 As shown, the power consumption control device 1000 of the stylus pen may include: an acquisition module 1001, a determination module 1002, a control module 1003, and the like.

[0252] The acquisition module 1001 is configured to, in response to a key pressing event of the stylus pen, acquire and store first characteristic information of the key pressing event, where the first characteristic information at least includes a first time corresponding to the key pressing event;

[0253] The acquisition module 1001 is further configured to, in response to a key-up event of the stylus pen, acquire and store second characteristic information of the key-up event; the second characteristic information at least includes a second time corresponding to the key-up event;

[0254] The determination module 1002 is configured to determine a first value and a second value based on the data information when it is determined that the data information in the storage space of the stylus pen meets a first preset condition; the storage space of the stylus pen is used to store the first time and the second time, and the first value and the second value are used to determine whether the stylus pen is in a storage state;

[0255] The acquisition module 1001 is further configured to acquire the state data of the stylus pen and the state data of the terminal device when the first value and the second value meet the second preset condition;

[0256] The control module 1003 is configured to control the stylus to be in a low power consumption mode when it is determined that the stylus is in a storage state based on the state data of the stylus and the state data of the terminal device.

[0257] In one possible implementation, the determination module 1002 is further configured to determine the first value and the second value based on the data information and length information in the storage space of the stylus, the length information including the length information of the key of the stylus and the length information of multiple detection components in the storage component in the terminal device, and the detection components are used to trigger the key pressing event and the key lifting event.

[0258] In one possible implementation, the first preset condition includes that the total number of the first time and the second time is equal to a threshold value, and the determination module 1002 is further configured to determine that the data information in the storage space of the stylus satisfies the first preset condition when the total number of the first time and the second time in the data information in the storage space of the stylus is equal to the threshold value.

[0259] In one possible implementation, the first preset condition also includes that the values ​​corresponding to the first time and the second time are not preset values, and the determination module 1002 is further configured to determine that the data information in the storage space of the stylus meets the first preset condition when the total number of the first time and the second time in the data information in the storage space of the stylus is equal to a threshold and the values ​​corresponding to the first time and the second time are not preset values.

[0260] In a possible implementation, the second preset condition includes that the first value is within a first preset range, and the second value is within a second preset range.

[0261] In a possible implementation, the status data of the stylus includes acceleration data of the stylus, the status data of the terminal device includes acceleration data of the terminal device, and the acquisition module 1001 is further configured to send an acquisition request to the terminal device; receive a reply response from the terminal device, and the reply response includes acceleration data of the terminal device.

[0262] In a possible implementation, the control module 1003 is further configured to determine the consistency result of the status data of the stylus pen and the status data of the terminal device; when the consistency result of the status data of the stylus pen and the status data of the terminal device meets a third preset condition, it is determined that the stylus pen is in the storage state, and the third preset condition is that the consistency result is greater than or equal to a preset consistency threshold.

[0263] In a possible implementation, the power consumption control device 1000 of the stylus pen further includes a preprocessing module 1004. The preprocessing module 1004 is configured to perform a preprocessing operation on the state data of the stylus pen and the state data of the terminal device to update the state data of the stylus pen and the state data of the terminal device, and the preprocessing operation includes a filtering operation.

[0264] In a possible implementation, the control module 1003 is further configured to cause the stylus to exit the low power consumption mode in response to a pressing operation.

[0265] In a possible implementation, the low power consumption mode includes any one of a deep sleep mode and a hibernation mode.

[0266] It should be understood that the division of units or modules (hereinafter referred to as units) in the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or physically separated. And the units in the device can all be implemented in the form of software calling through processing elements; or all in the form of hardware; or some units can be implemented in the form of software calling through processing elements, and some units can be implemented in the form of hardware.

[0267] For example, each unit can be a separately established processing element, or it can be integrated in a certain chip of the device. In addition, it can also be stored in a memory in the form of a program, and called and executed by a certain processing element of the device. In addition, all or part of these units can be integrated together, or they can be implemented independently. The processing element here can also be called a processor, which can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each unit above can be implemented by an integrated logic circuit of hardware in the processor element or in the form of software called by a processing element.

[0268] It should be understood that each step in the above method embodiment provided by the present disclosure can be completed by an integrated logic circuit of hardware in a processor or by instructions in the form of software. The method steps disclosed in the embodiments of the present disclosure can be directly embodied as being executed by a hardware processor, or by a combination of hardware and software modules in a processor.

[0269] In one example, the unit in the above apparatus may be one or more integrated circuits configured to implement the above method, such as one or more ASICs, or one or more DSPs, or one or more FPGAs, or a combination of at least two of these integrated circuit forms.

[0270] For another example, when the units in the device can be implemented in the form of a processing element scheduling program, the processing element can be a general-purpose processor, such as a CPU or other processor that can call a program. For another example, these units can be integrated together and implemented in the form of a system on a chip SOC.

[0271] In one implementation, the units of the above apparatus implementing the corresponding steps in the above method can be implemented in the form of a processing element scheduling program. For example, the apparatus may include a processing element and a storage element, and the processing element calls the program stored in the storage element to execute the method of the above method embodiment. The storage element may be a storage element on the same chip as the processing element, that is, an on-chip storage element.

[0272] In another implementation, the program for executing the above method may be in a storage element on a different chip from the processing element, i.e., an off-chip storage element. In this case, the processing element calls or loads the program from the off-chip storage element to the on-chip storage element to call and execute the method of the above method embodiment.

[0273] For example, the embodiments of the present disclosure may also provide a device, such as an electronic device, which may include a processor and a memory for storing instructions executable by the processor. When the processor is configured to execute the above instructions, the electronic device implements the power consumption control method of the stylus pen as in the above embodiment. The memory may be located inside the electronic device or outside the electronic device. And the processor includes one or more.

[0274] In another implementation, the unit of the device implementing each step in the above method may be configured as one or more processing elements, which may be arranged on the corresponding electronic device, and the processing element here may be an integrated circuit, for example: one or more ASICs, or one or more DSPs, or one or more FPGAs, or a combination of these integrated circuits. These integrated circuits may be integrated together to form a chip.

[0275] For example, the present disclosure also provides a chip, which can be applied to the above electronic device. The chip includes one or more interface circuits and one or more processors; the interface circuits and the processors are interconnected through lines; the processor receives and executes computer instructions from the memory of the electronic device through the interface circuit to implement the method in the above method embodiment.

[0276] The embodiment of the present disclosure further provides a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by an electronic device, the electronic device can implement the power consumption control method of the stylus pen as described above.

[0277] The disclosed embodiment also provides a computer program product, including computer instructions executed by the electronic device as described above, and when the computer instructions are executed in the electronic device, the electronic device can implement the power consumption control method of the stylus as described above. Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

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

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

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

[0281] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present disclosure is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, such as a program. The software product is stored in a program product, such as a computer-readable storage medium, including a number of instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the methods of each embodiment of the present disclosure. The aforementioned storage medium includes: U disk, mobile hard disk, ROM, RAM, disk or optical disk and other media that can store program codes.

[0282] For example, the embodiment of the present disclosure may also provide a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by an electronic device, the electronic device implements the power consumption control method of the stylus pen in the aforementioned method embodiment.

[0283] The above are only specific embodiments of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present disclosure should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A method for controlling power consumption of a stylus pen, It is characterized in that Methods include: In response to a key pressing event of the stylus, acquiring and storing first characteristic information of the key pressing event, wherein the first characteristic information at least includes a first time corresponding to the key pressing event; In response to a key-up event of the stylus, acquiring and storing second characteristic information of the key-up event; the second characteristic information at least includes a second time corresponding to the key-up event; In the case where it is determined that the data information in the storage space of the stylus pen meets the first preset condition, a first value and a second value are determined based on the data information; the data information includes the first time and the second time, and the first value and the second value are used to first determine whether the stylus pen is in the storage state; the first preset condition includes that the total number of the first time and the second time is equal to a threshold; the threshold is related to the number of multiple detection components set in a storage component of the terminal device, the storage component is used to store the stylus pen, the multiple detection components include a first detection component and a second detection component, and the first detection component and the second detection component are convex blocks protruding inward along the inner wall of the storage component; the first value is used to represent the proportional relationship between the speeds of the keys of the stylus pen passing through the respective detection components, and the second value is used to represent the proportional relationship between the speed of the keys of the stylus pen passing through the first detection component and the speed of the keys of the stylus pen passing through the first detection component and the second detection component, and the first detection component is adjacent to the second detection component; When the first value and the second value meet a second preset condition, acquiring status data of the stylus pen and status data of the terminal device; The second preset condition includes that the first value is within a first preset range, and the second value is within a second preset range; When it is determined again that the stylus pen is in the storage state based on the state data of the stylus pen and the state data of the terminal device, the stylus pen is controlled to be in a low power consumption mode.

2. The method according to claim 1, It is characterized in that The determining, based on the data information, a first value and a second value, comprises: The first value and the second value are determined based on data information and length information in the storage space of the stylus, wherein the length information includes length information of the key of the stylus and length information of multiple detection components in the storage component in the terminal device, and the detection components are used to trigger the key pressing event and the key lifting event.

3. The method according to claim 1, It is characterized in that The first preset condition also includes that the values ​​corresponding to the first time and the second time are not preset values, and determining that the data information in the storage space of the stylus pen meets the first preset condition includes: When the total number of the first time and the second time in the data information in the storage space of the stylus pen is equal to a threshold, and the values ​​corresponding to the first time and the second time are not preset values, it is determined that the data information in the storage space of the stylus pen meets the first preset condition.

4. The method according to any one of claims 1 to 3, It is characterized in that The state data of the stylus pen includes acceleration data of the stylus pen, the state data of the terminal device includes acceleration data of the terminal device, and acquiring the state data of the terminal device includes: Sending an acquisition request to the terminal device; A reply response is received from the terminal device, wherein the reply response includes acceleration data of the terminal device.

5. The method according to any one of claims 1 to 4, It is characterized in that The determining that the stylus pen is in the storage state based on the state data of the stylus pen and the state data of the terminal device includes: Determine the consistency result of the state data of the stylus pen and the state data of the terminal device; When a consistency result between the status data of the stylus pen and the status data of the terminal device meets a third preset condition, it is determined that the stylus pen is in the storage state, and the third preset condition is that the consistency result is greater than or equal to a preset consistency threshold.

6. The method according to claim 5, It is characterized in that Before determining the consistency result of the status data of the stylus pen and the status data of the terminal device, the method includes: A preprocessing operation is performed on the status data of the stylus pen and the status data of the terminal device to update the status data of the stylus pen and the status data of the terminal device, wherein the preprocessing operation includes a filtering operation.

7. The method according to any one of claims 1 to 6, It is characterized in that The method further comprises: In response to the pressing operation, the stylus pen exits the low power consumption mode.

8. The method according to any one of claims 1 to 7, It is characterized in that The low power consumption mode includes any one of a deep sleep mode and a hibernation mode.

9. An electronic device, It is characterized in that The electronic device comprises a processor and a memory for storing instructions executable by the processor; when the processor is configured to execute the instructions, the electronic device implements the method according to any one of claims 1 to 8.

10. A computer-readable storage medium having computer program instructions stored thereon; It is characterized in that When the computer program instructions are executed by an electronic device, the electronic device implements the method according to any one of claims 1 to 8.