Device control method, device, storage medium and electronic device
By obtaining and utilizing the initial position and preset distance of the second housing in the electronic device, the driving mechanism is controlled to drive the second housing to move in a similar manner, which solves the unavoidable fault problem when the user manually controls the movement of the housing and improves the efficiency of the equipment. stability and security.
Patent Information
- Application Number
- CN202110231580.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-02
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-03-02
AI Technical Summary
When users manually control the movement of the casing of a large-screen electronic device, it is difficult to accurately control the force, which can easily lead to electronic device failure.
When the driving mechanism is in a non-working state, the initial position of the second housing relative to the first housing is obtained, and the second position is determined based on the preset distance. When the second housing moves to this position, the driving mechanism is controlled to drive the second housing. The two shells make similar movements to avoid failures caused by external forces.
It effectively avoids electronic equipment failures caused by external forces and improves the stability and use safety of the equipment.
Smart Images

Figure CN112965570B
Abstract
Description
Technical Field
[0001] The present application belongs to the field of electronic technology, and in particular, relates to a device control method, device, storage medium and electronic device. Background Art
[0002] With the pursuit of the ultimate user experience, users have higher and higher performance requirements for electronic devices such as smartphones and tablets. For example, in order to facilitate users to obtain better video viewing effects, large-screen electronic devices have gradually become a development trend.
[0003] At present, for large-screen electronic devices, part of the screen can be hidden inside the electronic device to facilitate the user to carry. By moving the housings of the electronic device away from or towards each other, the hidden part of the screen can be exposed to the outside of the electronic device, or the part of the screen exposed to the outside can be hidden inside. However, when the user manually controls the housings of the electronic device to move away from or towards each other, the user cannot accurately control the force, which can easily cause the electronic device to malfunction. Summary of the invention
[0004] The embodiments of the present application provide a device control method, apparatus, storage medium and electronic device, which can prevent malfunction of the electronic device.
[0005] In a first aspect, an embodiment of the present application provides a device control method, which is applied to an electronic device, wherein the electronic device includes a driving mechanism and a first shell and a second shell that are slidably connected, wherein the driving mechanism is used to drive the second shell to move relative to the first shell, and the method includes:
[0006] When the driving mechanism is in a non-working state, obtaining a first position of the second shell relative to the first shell;
[0007] Determine a second position according to the first position, where the second position is a position of the second shell relative to the first shell after the second shell moves a preset distance from the first position;
[0008] If the second shell moves from the first position to the second position relative to the first shell, the driving mechanism is controlled to drive the second shell to move similarly relative to the first shell.
[0009] In a second aspect, an embodiment of the present application provides a device control device, which is applied to an electronic device, characterized in that the electronic device includes a driving mechanism and a first shell and a second shell that are slidably connected, the driving mechanism is used to drive the second shell to move relative to the first shell, and the device includes:
[0010] an acquisition module, used for acquiring a first position of the second housing relative to the first housing when the driving mechanism is in a non-working state;
[0011] A determination module, configured to determine a second position according to the first position, wherein the second position is a position of the second shell relative to the first shell after the second shell moves a preset distance from the first position;
[0012] The control module is used for controlling the driving mechanism to drive the second shell to make a similar movement relative to the first shell if the second shell moves from the first position to the second position relative to the first shell.
[0013] In a third aspect, an embodiment of the present application provides a storage medium on which a computer program is stored. When the computer program is executed on a computer, the computer executes the process in the device control method provided by the embodiment of the present application.
[0014] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the processor is used to execute the process in the device control method provided in the embodiment of the present application by calling a computer program stored in the memory.
[0015] The device control method of the embodiment of the present application is applied to an electronic device, which includes a driving mechanism and a first shell and a second shell slidably connected, the driving mechanism is used to drive the second shell to move relative to the first shell, when the driving mechanism is in a non-working state, the first position of the second shell relative to the first shell is obtained; according to the first position, the second position is determined, the second position is the position of the second shell after moving a preset distance from the first position relative to the first shell; if the second shell moves from the first position to the second position relative to the first shell, the driving mechanism is controlled to drive the second shell to make a similar movement relative to the first shell. Since the solution of the present application can actively control the driving mechanism to drive the second shell to make a similar movement relative to the first shell when the driving mechanism is in a non-working state and the second shell moves a long distance relative to the first shell, it can avoid malfunction of the electronic device caused by external force stretching or pressing the second shell. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The technical solution and beneficial effects of the present application will be made apparent by describing in detail the specific implementation methods of the present application in conjunction with the accompanying drawings.
[0017] Figure 1 This is a schematic diagram of the first structure of an electronic device provided in an embodiment of the present application.
[0018] Figure 2This is a second structural diagram of an electronic device provided in an embodiment of the present application.
[0019] Figure 3 This is a first flow chart of the device control method provided in the embodiment of the present application.
[0020] Figure 4 This is a second flow chart of the device control method provided in the embodiment of the present application.
[0021] Figure 5 It is a schematic diagram of an exploded view of an electronic device provided in an embodiment of the present application.
[0022] Figure 6 This is a schematic diagram of the first cross-sectional structure of an electronic device provided in an embodiment of the present application.
[0023] Figure 7 This is a schematic diagram of a second cross-sectional structure of an electronic device provided in an embodiment of the present application.
[0024] Figure 8 This is a schematic diagram of the third cross-sectional structure of the electronic device provided in an embodiment of the present application.
[0025] Fig. 9 This is a third flow chart of the device control method provided in the embodiment of the present application.
[0026] Fig.10 It is a structural schematic diagram of the equipment control device provided in an embodiment of the present application.
[0027] Fig.11 This is a third structural diagram of the electronic device provided in the embodiment of the present application.
[0028] Fig.12 This is a fourth structural schematic diagram of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0029] Please refer to the drawings, where the same component symbols represent the same components. The principle of the present application is illustrated by implementing it in an appropriate computing environment. The following description is based on the illustrated specific embodiments of the present application, which should not be considered as limiting other specific embodiments of the present application that are not described in detail herein.
[0030] Understandably, please also refer to Figure 1 and Figure 2 , Figure 1 is a schematic diagram of a first structure of an electronic device provided in an embodiment of the present application, Figure 21 is a second structural diagram of an electronic device provided in an embodiment of the present application. The electronic device 100 of this embodiment includes a housing assembly 10 and a drive mechanism 70. The housing assembly 10 is a hollow structure; the drive mechanism 70 can be arranged in the housing assembly 10. It can be understood that the electronic device 100 of the embodiment of the present application includes but is not limited to mobile terminals such as mobile phones and tablets or other portable electronic devices. In this article, the electronic device 100 is taken as a mobile phone for example.
[0031] In this embodiment, the housing assembly 10 includes a first housing 12 and a second housing 14 that are slidably connected. The driving mechanism 70 can be linked with the second housing 14, and the driving mechanism 70 can be used to drive the second housing 14 to move relative to the first housing 12, such as to move away from or move closer to the first housing 12. When the driving mechanism 70 drives the second housing 14 to move away from the first housing 12, the electronic device 100 can be Figure 1 The status shown enters Figure 2 When the driving mechanism 70 drives the second housing 14 to move relative to the first housing 12, the electronic device 100 can be Figure 2 The status shown enters Figure 1 Status shown.
[0032] See also Figure 3 , Figure 3 This is a schematic diagram of a first flow chart of a device control method provided in an embodiment of the present application. The device control method can be applied to the above-mentioned electronic device. The flow chart may include:
[0033] 101. When the driving mechanism is in a non-working state, obtain a first position of the second shell relative to the first shell.
[0034] The driving mechanism may be a motor such as a stepping motor. When the driving mechanism drives the second housing to move relative to the first housing, the driving mechanism is in a working state. When the driving mechanism does not drive the second housing to move relative to the first housing, the driving mechanism is in a non-working state.
[0035] It is understandable that, since the second shell is slidably connected to the first shell, the second shell can also move relative to the first shell under the control of an external force. For example, the user can also manually control the second shell to move away from or towards the first shell. However, when the user manually controls the second shell to move away from or towards the first shell, the user cannot accurately control the force, and the second shell may be continuously and violently controlled to move away from or towards the first shell, causing the electronic device to malfunction.
[0036] In order to avoid the above situation that causes the electronic device to malfunction, in this embodiment, when the driving mechanism is in a non-working state, that is, when the driving mechanism does not drive the second shell to move relative to the first shell, the electronic device can obtain the first position of the second shell relative to the first shell. When the driving mechanism is in a working state, the electronic device may not perform any processing.
[0037] For example, the first position of the second housing relative to the first housing may be as follows: Figure 1 The first position of the second housing relative to the first housing may also be as shown in Figure 2 shown.
[0038] 102. Determine a second position based on the first position, where the second position is a position of the second shell after the second shell moves a preset distance relative to the first shell from the first position.
[0039] For example, assuming that the first position of the second housing relative to the first housing is Figure 2 As shown, the second position may be a position after the second shell moves from the first position to the direction close to the first shell relative to the first shell by a preset distance, and the second position may also be a position after the second shell moves from the first position to the direction away from the first shell relative to the first shell by a preset distance. The preset distance may be set according to actual conditions and is not specifically limited here. For example, the preset distance may be 1 mm, 1.2 mm, 1.5 mm, 2 mm or 3 mm, etc.
[0040] 103. If the second shell moves from the first position to the second position relative to the first shell, the control driving mechanism drives the second shell to make a similar movement relative to the first shell.
[0041] For example, assuming that the first position of the second housing relative to the first housing is Figure 1 As shown, the second position of the second housing relative to the first housing is as shown in Figure 2 As shown, when the driving mechanism is in a non-operating state, if the second housing is relative to the first housing as shown in Figure 1 The first position shown moves to Figure 2 In the second position shown, the electronic device can control the driving mechanism to enter a working state to drive the second shell to perform a similar movement relative to the first shell.
[0042] The device control method of the embodiment of the present application is applied to an electronic device, which includes a driving mechanism and a first shell and a second shell slidably connected, the driving mechanism is used to drive the second shell to move relative to the first shell, when the driving mechanism is in a non-working state, the first position of the second shell relative to the first shell is obtained; according to the first position, the second position is determined, the second position is the position of the second shell after moving a preset distance from the first position relative to the first shell; if the second shell moves from the first position to the second position relative to the first shell, the driving mechanism is controlled to drive the second shell to make a similar movement relative to the first shell. Since the solution of the present application can actively control the driving mechanism to drive the second shell to make a similar movement relative to the first shell when the driving mechanism is in a non-working state and the second shell moves a long distance relative to the first shell, it can avoid malfunction of the electronic device caused by external force stretching or pressing the second shell.
[0043] In some embodiments, when the movement distance of the second shell relative to the first shell is less than a preset distance, the control drive mechanism continues to remain in a non-working state.
[0044] It is understandable that in actual applications, since the second shell is slidably connected to the first shell, there may be a situation where the user accidentally touches the second shell, causing the second shell to move relative to the first shell. In the above situation, the second shell often only moves a very short distance relative to the first shell, and this distance may be less than the preset distance. Since the second shell only moves a very short distance relative to the first shell, it is relatively difficult to cause the electronic device to malfunction. Therefore, when the second shell only moves a very short distance relative to the first shell, that is, the second shell does not move from the first position to the second position relative to the first shell, the electronic device may not control the drive mechanism to drive the second shell to make a similar movement relative to the first shell.
[0045] In addition, when the movement distance of the second shell relative to the first shell is less than the preset distance, if the electronic device receives a telescopic instruction instructing the drive mechanism to drive the second shell to move relative to the first shell, the electronic device can control the drive mechanism to drive the second shell to move relative to the first shell. When the movement distance of the second shell relative to the first shell is less than the preset distance, if the electronic device does not receive a telescopic instruction instructing the drive mechanism to drive the second shell to move relative to the first shell, the electronic device can continue to detect whether the second shell moves from the first position to the second position relative to the first shell.
[0046] Among them, the extension instruction may include an extension instruction and a contraction instruction. When the electronic device receives the extension instruction, the electronic device may control the driving mechanism to drive the second shell to move away from the first shell. When the electronic device receives the contraction instruction, the electronic device may control the driving mechanism to drive the second shell to move closer to the first shell. The extension instruction and the contraction instruction may be triggered by the user touching a preset button on the electronic device. The setting position of the preset button may be determined according to actual conditions and is not specifically limited here.
[0047] It can be understood that external force controlling the second shell to move at a faster speed relative to the first shell is very likely to cause the electronic device to malfunction, while external force controlling the second shell to move at a slower speed relative to the first shell is relatively less likely to cause the electronic device to malfunction. In order to reduce the processing load of the processor, the electronic device can move the second shell from a first position to a second position relative to the first shell, and when the moving speed of the second shell is greater than a preset speed, the control drive mechanism drives the second shell to make a similar movement relative to the first shell.
[0048] In some embodiments, when the electronic device controls the driving mechanism to drive the second shell to make a similar motion relative to the first shell, the external force has not stopped controlling the movement of the second shell relative to the first shell. The electronic device can detect whether the movement direction of the driving mechanism driving the second shell to make a similar motion relative to the first shell is the same as the movement direction of the external force controlling the second shell to make a similar motion relative to the first shell; if they are the same, the electronic device can continue to control the driving mechanism to drive the second shell to make a similar motion relative to the first shell; if they are not the same, the electronic device can stop controlling the driving mechanism to drive the second shell to make a similar motion relative to the first shell.
[0049] Please also read Figure 1 and Figure 2 The electronic device 100 may further include a Hall sensor 40. When the second housing 14 moves relative to the first housing 12, the position of the second housing 14 relative to the first housing 12 changes, and the Hall value of the Hall sensor 40 changes with the change of the position of the second housing 14 relative to the first housing 12.
[0050] See also Figure 4 , Figure 4 : is a second flow chart of the device control method provided in the embodiment of the present application. The device control method can be applied to the electronic device including the Hall sensor. The flow chart may include:
[0051] 201. When the driving mechanism is in a non-working state, the electronic device obtains a first Hall value of the Hall sensor.
[0052] 202. The electronic device determines a first position of the second shell relative to the first shell according to the first Hall value.
[0053] Among them, the Hall sensor is a magnetic field sensor made based on the Hall effect. The stronger the magnetic field, the larger the Hall value of the Hall sensor, and the weaker the magnetic field, the smaller the Hall value of the Hall sensor.
[0054] In this embodiment, the Hall value of the Hall sensor changes as the position of the second shell relative to the first shell changes. Based on this, the electronic device can set a mapping relationship between the Hall value and the shell position according to the mutual change relationship between the Hall value of the Hall sensor and the position of the second shell relative to the first shell, and use it as a preset mapping relationship between the Hall value and the shell position. After obtaining the first Hall value of the Hall sensor, the electronic device can determine the position of the second shell relative to the first shell according to the first Hall value and the preset mapping relationship between the Hall value and the shell position.
[0055] 203. The electronic device determines a second position based on the first position, where the second position is a position of the second shell relative to the first shell after the second shell moves a preset distance from the first position.
[0056] For example, assuming that the first position of the second housing relative to the first housing is Figure 2 As shown, the second position may be a position after the second shell moves from the first position to the direction close to the first shell relative to the first shell by a preset distance, and the second position may also be a position after the second shell moves from the first position to the direction away from the first shell relative to the first shell by a preset distance. The preset distance may be set according to actual conditions and is not specifically limited here. For example, the preset distance may be 1 mm, 1.2 mm, 1.5 mm, 2 mm or 3 mm, etc.
[0057] 204. The electronic device determines a second Hall value corresponding to the second position.
[0058] For example, after determining the second position of the second shell relative to the first shell, the electronic device can determine the second Hall value corresponding to the second position according to a preset mapping relationship between the Hall value and the shell position.
[0059] 205. If the Hall value of the Hall sensor reaches the second Hall value from the first Hall value, the electronic device controls the driving mechanism to drive the second shell to perform a similar movement relative to the first shell.
[0060] It can be understood that when the Hall value of the Hall sensor reaches the second Hall value from the first Hall value, it can be determined that the second shell moves from the first position to the first position relative to the first shell. Then, in order to avoid the phenomenon that the user continues to violently control the movement of the second shell relative to the first shell, the electronic device can control the driving mechanism to drive the second shell to make similar movements relative to the first shell.
[0061] In some embodiments, please refer to Figure 1, Figure 2 , Figure 5 , Figure 6 and Figure 7 The electronic device 100 may further include a magnet 20, a flexible display screen 30, a Hall sensor 40, a driving member 50, a driving mechanism 70 and a camera 90. The components such as the magnet 20, the Hall sensor 40, the driving member 50, the driving mechanism 70 and the camera 90 may be arranged in the housing component 10.
[0062] The first housing 12 and the second housing 14 together form a receiving space 16. The receiving space 16 can be used to place components such as the magnet 20, the Hall sensor 40, the driving member 50, the camera 90, and the driving mechanism 70. The housing assembly 10 may also include a back cover 18, which together with the first housing 12 and the second housing 14 forms the receiving space 16. Specifically, the magnet 20 may be disposed in the second housing 14, and the Hall sensor 40 may be disposed in the first housing 12.
[0063] The driving member 50 is disposed on the second housing 14, one end of the flexible display screen 30 is disposed on the second housing 14, the flexible display screen 30 bypasses the driving member 50, and the other end of the flexible display screen 30 is disposed in the accommodating space 16, so that part of the flexible display screen 30 is hidden in the accommodating space 16, and the part of the flexible display screen 30 hidden in the accommodating space 16 may not be lit. The first housing 12 and the second housing 14 are relatively far apart, and the flexible display screen 30 can be driven to unfold by the driving member 50, so that more of the flexible display screen 30 is exposed outside the accommodating space 16. The flexible display screen 30 exposed outside the accommodating space 16 is lit up, so that the display area presented by the electronic device 100 becomes larger.
[0064] The driving member 50 can be specifically a rotating shaft structure with teeth 52 on the outside. The flexible display screen 30 is linked to the driving member 50 by meshing or the like. When the first shell 12 and the second shell 14 are relatively far apart, the driving member 50 drives the part of the flexible display screen 30 meshed on the driving member 50 to move and unfold.
[0065] It can be understood that the driving member 50 can also be a round shaft without teeth 52. When the first shell 12 and the second shell 14 are relatively far away from each other, the driving member 50 is used to open the part of the flexible display screen 30 wound on the driving member 50, so that more of the flexible display screen 30 is exposed outside the accommodating space 16 and is in a flat state. Specifically, the driving member 50 is rotatably arranged on the second shell 14. When the flexible display screen 30 is gradually opened, the driving member 50 can rotate with the movement of the flexible display screen 30. In other embodiments, the driving member 50 can also be fixed on the second shell 14, and the driving member 50 has a smooth surface. When the flexible display screen 30 is opened, the driving member 50 can slidably contact with the flexible display screen 30 through its smooth surface.
[0066] When the first housing 12 and the second housing 14 are relatively close to each other, the flexible display screen can be driven to retract by the driving member 50. Alternatively, the electronic device 100 further includes a reset member (not shown), and one end of the flexible display screen accommodated in the accommodating space 16 is linked to the reset member. When the first housing 12 and the second housing 14 are relatively close to each other, the reset member drives the flexible display screen 30 to reset, thereby partially retracting the flexible display screen 30 into the accommodating space 16.
[0067] In this embodiment, the driving mechanism 70 can be arranged in the accommodating space 16, and the driving mechanism 70 can be linked with the second shell 14. The driving mechanism 70 is used to drive the second shell 14 to move away from the first shell 12 along the movement direction F2, thereby driving the flexible display screen 30 to unfold. The driving mechanism 70 is also used to drive the second shell 14 to move closer to the first shell 12 along the movement direction F1, thereby driving the flexible display screen 30 to shrink.
[0068] In some embodiments, the first housing 12 may further include a slide rail (not shown in the figure), and the second housing 14 may further include a sliding member (not shown in the figure), and the sliding member may slide relative to the slide rail so that the second housing 14 is slidably connected to the first housing 12. The driving mechanism 70 may drive the sliding member to slide on the slide rail so that the second housing moves relative to the first housing. The Hall sensor 40 may be disposed on the slide rail, and the magnet 20 may be disposed on the sliding member.
[0069] Process 202 may include:
[0070] The electronic device determines a third position of the magnet relative to the Hall sensor according to the first Hall value and a preset mapping relationship between the Hall value and the position;
[0071] The electronic device determines the first position of the second housing relative to the first housing according to the third position;
[0072] Process 204 may include:
[0073] The electronic device determines a fourth position of the magnet relative to the Hall sensor based on the second position;
[0074] The electronic device determines the Hall value corresponding to the fourth position according to the mapping relationship;
[0075] The electronic device uses the Hall value corresponding to the fourth position as the second Hall value corresponding to the second position.
[0076] It is understandable that the magnet can be an electromagnet. The electromagnet can generate a magnetic field when it is energized. As the second shell moves relative to the first shell, the position of the magnet arranged in the second shell relative to the Hall sensor arranged in the first shell changes, and accordingly, the magnetic field strength sensed by the Hall sensor will also change, and the Hall value of the Hall sensor will also change accordingly. Based on this, the electronic device can set a mapping relationship between the Hall value and the magnet position, and the mapping relationship can reflect the relationship between the Hall value of the Hall sensor and the position of the magnet relative to the Hall sensor. The mapping relationship between the Hall value and the magnet position can be used as a preset mapping relationship between the Hall value and the position. After obtaining the position of the magnet relative to the Hall sensor, the electronic device can determine the Hall value corresponding to the position of the magnet relative to the Hall sensor according to the position of the magnet relative to the Hall sensor and the mapping relationship between the Hall value and the position. After obtaining the Hall value, the electronic device can determine the position of the magnet relative to the Hall sensor according to the Hall value and the mapping relationship between the Hall value and the position. Since the positional relationship between the Hall sensor and the first shell does not change, the positional relationship between the magnet and the second shell does not change. Therefore, after determining the position of the magnet relative to the Hall sensor, the electronic device can determine the position of the second shell relative to the first shell.
[0077] In some embodiments, the electronic device may also set a mapping relationship between the magnet position and the housing position, which may reflect the relationship between the position of the magnet relative to the Hall sensor and the position of the second housing relative to the first housing. The mapping relationship between the magnet position and the housing position may be used as a preset mapping relationship between the magnet position and the housing position.
[0078] For example, after obtaining the first Hall value of the Hall sensor, the electronic device can determine the third position of the magnet relative to the Hall sensor according to the first Hall value and the preset mapping relationship between the Hall value and the position. After determining the third position of the magnet relative to the Hall sensor, the electronic device can determine the first position of the second shell relative to the first shell according to the third position and the preset mapping relationship between the magnet position and the shell position.
[0079] For another example, after determining the second position of the second shell relative to the first shell, the electronic device can determine the fourth position of the magnet relative to the Hall sensor based on the second position and the mapping relationship between the magnet position and the shell position. After determining the fourth position, the electronic device can determine the Hall value corresponding to the fourth position based on the fourth position and the mapping relationship between the preset Hall value and the position, and use the Hall value corresponding to the fourth position as the second Hall value corresponding to the second position.
[0080] To understand the position of a magnet relative to a Hall sensor, see the following example.
[0081] For example, see Figure 6The first housing 12 may further include a frame 121. Assuming that the Hall sensor 40 is 6 mm away from the frame 121 and the magnet 20 is 2 mm away from the frame 121, the magnet 20 is 4 mm away from the Hall sensor 40 along the movement direction F1.
[0082] In some embodiments, the Hall sensor may be a 3-axis Hall sensor, that is, the electronic device may obtain the Hall value corresponding to the x-axis, the Hall value corresponding to the y-axis, and the Hall value corresponding to the z-axis of the 3-axis Hall sensor. That is to say, when the Hall sensor is a 3-axis Hall sensor, the electronic device obtains the first Hall value of the Hall sensor, which may include: the electronic device obtains the Hall value corresponding to the x-axis, the Hall value corresponding to the y-axis, and the Hall value corresponding to the z-axis of the Hall sensor. Among them, the Hall value corresponding to the x-axis can be used as the first x-axis Hall value component, the Hall value corresponding to the y-axis can be used as the first y-axis Hall value component, and the Hall value corresponding to the z-axis can be used as the first z-axis Hall value component. In this embodiment, the first y-axis Hall value component does not change with the change of the magnet position. Therefore, when the electronic device obtains the Hall value of the Hall sensor, it may not obtain the first y-axis Hall value component. After obtaining the first x-axis Hall value component and the first z-axis Hall value component, the electronic device can determine the third position of the magnet relative to the Hall sensor according to the first x-axis Hall value component and the first z-axis Hall value component.
[0083] For example, the electronic device may pre-set the mapping relationship between the x-axis Hall value component and the magnet position as the preset mapping relationship between the x-axis component and the magnet position. The electronic device may also pre-set the mapping relationship between the z-axis Hall value component and the magnet position as the preset mapping relationship between the z-axis component and the magnet position. After obtaining the first x-axis Hall value component and the first z-axis Hall value component, the electronic device may determine the seventh position of the magnet relative to the Hall sensor based on the first x-axis Hall value component and the preset mapping relationship between the x-axis component and the magnet position; the electronic device may determine the eighth position of the magnet relative to the Hall sensor based on the first z-axis Hall value component and the preset mapping relationship between the z-axis component and the magnet position; when the seventh position is the same as the eighth position, the electronic device may determine the seventh position or the eighth position as the third position of the magnet relative to the Hall sensor.
[0084] When the seventh position is different from the eighth position, the electronic device can determine the third position of the magnet relative to the Hall sensor according to the seventh position and the eighth position. For example, assuming that the seventh position is 2 mm away from the Hall sensor along the movement direction F1, and the eighth position is 2.02 mm away from the Hall sensor along the movement direction F1, the electronic device can use the distance of 2.01 mm from the Hall sensor along the movement direction F1 as the third position of the magnet relative to the Hall sensor.
[0085] In other embodiments, when the electronic device determines multiple seventh positions of the magnet relative to the Hall sensor based on the first x-axis Hall value component and determines an eighth position of the magnet relative to the Hall sensor based on the first z-axis Hall value component, the electronic device may determine the position of the magnet relative to the Hall sensor based on the position closest to the eighth position among the multiple seventh positions and the eighth position.
[0086] Specifically, how to determine the position of the magnet relative to the Hall sensor based on the position closest to the eighth position among the plurality of seventh positions and the eighth position can be referred to the above embodiment, which will not be described in detail here.
[0087] In some embodiments, when the electronic device determines a seventh position of the magnet relative to the Hall sensor based on the first x-axis Hall value component and determines multiple eighth positions of the magnet relative to the Hall sensor based on the first z-axis Hall value component, the electronic device can determine the position of the magnet relative to the Hall sensor based on the seventh position and the position of the multiple eighth positions closest to the seventh position.
[0088] Specifically, how to determine the position of the magnet relative to the Hall sensor based on the seventh position and the position closest to the seventh position among the plurality of eighth positions can be referred to the above embodiment, which will not be described in detail here.
[0089] In other embodiments, when the electronic device determines multiple seventh positions of the magnet relative to the Hall sensor based on the first x-axis Hall value component, and determines multiple eighth positions of the magnet relative to the Hall sensor based on the first z-axis Hall value component, the electronic device can determine the two closest positions from the multiple seventh positions and the multiple eighth positions, and the two closest positions are from the seventh position and the eighth position, respectively; the electronic device can determine the position of the magnet relative to the Hall sensor based on the two closest positions.
[0090] For example, assuming that there are two seventh positions, which are 2 mm away from the Hall sensor along the movement direction F1 and 7 mm away from the Hall sensor along the movement direction F1, and there are two eighth positions, which are 2.02 mm away from the Hall sensor along the movement direction F1 and 5 mm away from the Hall sensor along the movement direction F1, the electronic device can determine that the two positions are 2 mm away from the Hall sensor along the movement direction F1 and 2.02 mm away from the Hall sensor along the movement direction F1 as the two closest positions.
[0091] Specifically, how to determine the position of the magnet relative to the Hall sensor based on the two closest positions can be found in the above embodiments, which will not be described in detail here.
[0092] See also Figure 8The electronic device may further include a plurality of Hall sensors 40 , which may be arranged at intervals on the first housing along the movement direction F1 ( F2 ) of the second housing.
[0093] See also Fig. 9 , Fig. 9 The third flow chart of the device control method provided in the embodiment of the present application is as follows. The device control method can be applied to the electronic device including the magnet and the multiple Hall sensors. The flow chart may include:
[0094] 301. When the driving mechanism is in a non-working state, the electronic device obtains a Hall value of each Hall sensor to obtain a plurality of third Hall values.
[0095] It is understandable that the magnetic field generated by the magnet when it is energized is limited to a certain range. Therefore, there is a problem that when the second shell moves to a certain position, a Hall sensor set on the first shell cannot sense the magnetic field generated by the magnet set on the second shell due to the long length of the first shell along the movement direction F1 (F2), and thus the position of the magnet relative to the Hall sensor cannot be determined. Based on the above reasons, multiple Hall sensors can be set, and the multiple Hall sensors are arranged at intervals on the first shell along the movement direction F1 (F2), so that when the position of the magnet changes with the movement of the second shell, the Hall sensor at the corresponding position can sense the magnetic field at the corresponding position, so that the corresponding Hall value can be obtained.
[0096] In this embodiment, when the driving mechanism is in a non-working state, the electronic device can obtain the Hall value of each Hall sensor to obtain multiple third Hall values. When the Hall sensor does not sense the magnetic field, the Hall value of the Hall sensor is zero. When the Hall sensor senses the magnetic field, the Hall value of the Hall sensor is not zero.
[0097] The number of Hall sensors and the spacing between adjacent Hall sensors can be determined according to actual needs and are not specifically limited here.
[0098] 302. The electronic device determines a candidate Hall value from a plurality of third Hall values, and the value of the candidate Hall value is not zero.
[0099] It is understandable that since the Hall value of the Hall sensor is zero, it means that the Hall sensor fails to sense the magnetic field. Therefore, the position of the magnet relative to the Hall sensor cannot be accurately determined based on the Hall value of the Hall sensor. Therefore, after obtaining multiple third Hall values, the electronic device can remove the Hall values with a value of zero from the multiple third Hall values and only retain the Hall values with a value that is not zero. The Hall value with a value that is not zero is the candidate Hall value.
[0100] 303. The electronic device determines a first position of the second shell relative to the first shell according to the candidate Hall value.
[0101] It can be understood that when the magnetic field can cover the positions of multiple Hall sensors, the electronic device can obtain multiple candidate Hall values; when the magnetic field only covers the position of one Hall sensor, the electronic device only obtains one candidate Hall value.
[0102] When the electronic device obtains a plurality of candidate Hall values, the electronic device may determine the first position of the second housing relative to the first housing according to the plurality of candidate Hall values.
[0103] For example, the electronic device can pre-establish a mapping relationship between the Hall value of each Hall sensor and the position of the housing to obtain a mapping relationship corresponding to each Hall sensor. The first mapping relationship corresponding to each Hall sensor can reflect the relationship between the Hall value of each Hall sensor and the position of the second housing relative to the first housing.
[0104] After obtaining multiple candidate Hall values, the electronic device can obtain a mapping relationship corresponding to the Hall sensor corresponding to each candidate Hall value, and determine the position corresponding to each candidate Hall value according to the mapping relationship to obtain multiple ninth positions. The electronic device can determine any one of the multiple ninth positions as the first position of the second shell relative to the first shell.
[0105] When only one candidate Hall value is obtained, the electronic device may obtain a mapping relationship corresponding to the Hall sensor corresponding to the candidate Hall value, and determine the first position of the second housing relative to the first housing according to the mapping relationship.
[0106] 304. The electronic device determines a second position based on the first position, where the second position is a position of the second shell relative to the first shell after the second shell moves a preset distance from the first position.
[0107] For example, assuming that the first position of the second housing relative to the first housing is Figure 2 As shown, the second position may be a position after the second shell moves from the first position to the direction close to the first shell relative to the first shell by a preset distance, and the second position may also be a position after the second shell moves from the first position to the direction away from the first shell relative to the first shell by a preset distance. The preset distance may be set according to actual conditions and is not specifically limited here. For example, the preset distance may be 1 mm, 1.2 mm, 1.5 mm, 2 mm or 3 mm, etc.
[0108] 305. If the second shell moves from the first position to the second position relative to the first shell, the electronic device controls the driving mechanism to drive the second shell to make a similar movement relative to the first shell.
[0109] For example, assuming that the first position of the second housing relative to the first housing is Figure 1 As shown, the second position of the second housing relative to the first housing is as shown in Figure 2 As shown, when the driving mechanism is in a non-operating state, if the second housing is relative to the first housing as shown in Figure 1 The first position shown moves to Figure 2 In the second position shown, the electronic device can control the driving mechanism to enter a working state to drive the second shell to perform a similar movement relative to the first shell.
[0110] In some embodiments, after obtaining multiple ninth positions, the electronic device can determine the tenth position corresponding to each ninth position according to each ninth position, and the tenth position corresponding to each ninth position is the position of the second shell relative to the first shell after the second shell moves a preset distance from each ninth position. Subsequently, when the second shell moves relative to the first shell to any one of the multiple tenth positions, the electronic device can control the driving mechanism to drive the second shell to move similarly relative to the first shell.
[0111] In some embodiments, process 303 may include:
[0112] When there are multiple candidate Hall values, the electronic device determines the Hall value with the largest value among the multiple candidate Hall values as the target Hall value;
[0113] The electronic device determines a first position of the second housing relative to the first housing according to the target Hall value.
[0114] It is understandable that the closer the distance between the Hall sensor and the magnet, the stronger the magnetic field sensed by the Hall sensor, the larger the Hall value of the Hall sensor, and accordingly, the Hall value of the Hall sensor is relatively more accurate. Based on this, after obtaining multiple candidate Hall values, the electronic device can determine the Hall value with the largest value among the multiple Hall values as the target Hall value; then, the electronic device can determine the first position of the second shell relative to the first shell based on the mapping relationship between the target Hall value and the Hall sensor corresponding to the target Hall value.
[0115] In some embodiments, the electronic device determines the first position of the second shell relative to the first shell based on the target Hall value, which may include: the electronic device determines the position of the magnet relative to the Hall sensor based on the target Hall value and a preset mapping relationship between the Hall value and the position; the electronic device determines the first position of the second shell relative to the first shell based on the position of the magnet relative to the Hall sensor.
[0116] In some embodiments, the target Hall value includes an x-axis Hall value component and a z-axis Hall value component, and the electronic device determines the first position of the second housing relative to the first housing according to the target Hall value, including:
[0117] The electronic device determines a fifth position of the magnet relative to the Hall sensor corresponding to the target Hall value according to the x-axis Hall value component and a preset mapping relationship between the x-axis Hall value component and the position;
[0118] The electronic device determines a sixth position of the magnet relative to the Hall sensor corresponding to the target Hall value according to the z-axis Hall value component and a preset mapping relationship between the z-axis Hall value component and the position;
[0119] The electronic device determines a first position of the second housing relative to the first housing according to the fifth position and the sixth position.
[0120] When the fifth position and the sixth position are the same, the electronic device may determine the fifth position or the sixth position as the position of the magnet relative to the Hall sensor, and determine the first position of the second shell relative to the first shell based on the position.
[0121] When the fifth position is different from the sixth position, the electronic device can determine the position of the magnet relative to the Hall sensor based on the fifth position and the sixth position, and determine the first position of the second shell relative to the first shell based on the position. For example, assuming that the seventh position is 3 mm away from the Hall sensor along the movement direction F2, and the eighth position is 3.02 mm away from the Hall sensor along the movement direction F2, the electronic device can use the distance of 3.01 mm from the Hall sensor along the movement direction F2 as the position of the magnet relative to the Hall sensor, and determine the first position of the second shell relative to the first shell based on the position.
[0122] In the embodiments of the present application, a plurality refers to “two” or “more than two”.
[0123] See also Fig.10 , Fig.10 A schematic diagram of the structure of the device control device provided in the embodiment of the present application. The device control device 60 can be applied to an electronic device, the electronic device includes a driving mechanism and a first shell and a second shell in sliding connection, the driving mechanism is used to drive the second shell to move relative to the first shell, and the device control device 60 includes: an acquisition module 601, a determination module 602 and a control module 603.
[0124] An acquisition module 601 is used to acquire a first position of the second housing relative to the first housing when the driving mechanism is in a non-working state;
[0125] A determination module 602 is used to determine a second position according to the first position, where the second position is a position of the second housing relative to the first housing after the second housing moves a preset distance from the first position;
[0126] The control module 603 is used to control the driving mechanism to drive the second housing to make a similar movement relative to the first housing if the second housing moves from a first position to a second position relative to the first housing.
[0127] In some embodiments, the electronic device further includes a Hall sensor, and the acquisition module 601 can be used to: when the driving mechanism is in a non-working state, acquire a first Hall value of the Hall sensor; determine a first position of the second housing relative to the first housing according to the first Hall value;
[0128] The determination module 602 may be used to: determine a second Hall value corresponding to a second position;
[0129] The control module 603 may be used to: if the Hall value of the Hall sensor reaches a second Hall value from a first Hall value, control the driving mechanism to drive the second housing to perform a similar movement relative to the first housing.
[0130] In some embodiments, the electronic device further includes a magnet, the Hall sensor is disposed on the first housing, and the magnet is disposed on the second housing, and the acquisition module 601 can be used to: determine a third position of the magnet relative to the Hall sensor according to the first Hall value and a preset mapping relationship between the Hall value and the position; determine the first position of the second housing relative to the first housing according to the third position;
[0131] The determination module 602 can be used to: determine the fourth position of the magnet relative to the Hall sensor according to the second position; determine the Hall value corresponding to the fourth position according to the mapping relationship; and use the Hall value corresponding to the fourth position as the second Hall value corresponding to the second position.
[0132] In some embodiments, the electronic device also includes a magnet and multiple Hall sensors, the multiple Hall sensors are arranged on the first shell at intervals along the movement direction of the second shell, and the magnet is arranged on the second shell. The acquisition module 601 can be used to: when the driving mechanism is in a non-working state, obtain the Hall value of each Hall sensor to obtain multiple third Hall values; determine a candidate Hall value from the multiple third Hall values, and the value of the candidate Hall value is not zero; determine the first position of the second shell relative to the first shell according to the candidate Hall value.
[0133] In some embodiments, the acquisition module 601 can be used to: when there are multiple candidate Hall values, determine the Hall value with the largest value among the multiple candidate Hall values as the target Hall value; and determine the first position of the second shell relative to the first shell according to the target Hall value.
[0134] In some embodiments, the target Hall value includes an x-axis Hall value component and a z-axis Hall value component, and the acquisition module 601 can be used to: determine the fifth position of the magnet relative to the Hall sensor corresponding to the target Hall value based on the x-axis Hall value component and the preset mapping relationship between the x-axis Hall value component and the position; determine the sixth position of the magnet relative to the Hall sensor corresponding to the target Hall value based on the z-axis Hall value component and the preset mapping relationship between the z-axis Hall value component and the position; determine the first position of the second shell relative to the first shell based on the fifth position and the sixth position.
[0135] In some embodiments, the control module 603 can be used to: when the second shell has not moved to the second position relative to the first shell and receives a telescopic operation, control the driving mechanism to drive the second shell to move relative to the first shell, and the telescopic operation is used to instruct the driving mechanism to drive the second shell to move relative to the first shell.
[0136] In some embodiments, the first shell and the second shell together form a accommodating space, and the electronic device also includes a flexible display screen, one end of the flexible display screen is arranged in the second shell, and the other end of the flexible display screen is arranged in the accommodating space, so that part of the flexible display screen is hidden in the accommodating space, and when the second shell moves relative to the first shell, it can drive the flexible display screen to expand or shrink.
[0137] In some embodiments, the control module 603 can be used to: if the second shell moves from a first position to a second position relative to the first shell and the moving speed of the second shell is greater than a preset speed, control the driving mechanism to drive the second shell to make a similar movement relative to the first shell.
[0138] An embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed on a computer, the computer executes the process in the device control method provided in this embodiment.
[0139] An embodiment of the present application also provides an electronic device, including a memory and a processor, wherein the processor is used to execute the process in the device control method provided in the present embodiment by calling a computer program stored in the memory.
[0140] For example, the electronic device may be a mobile terminal such as a tablet computer or a smart phone. Fig.11 , Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0141] The electronic device 100 may include components such as a memory 110, a processor 120, a magnet 20, a Hall sensor 40, and a driving mechanism 70. Those skilled in the art will appreciate that Fig.11The electronic device structure shown in the figure does not constitute a limitation of the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0142] The memory 110 may be used to store applications and data. The applications stored in the memory 110 include executable codes. The applications may be composed of various functional modules. The processor 120 executes various functional applications and data processing by running the applications stored in the memory 110.
[0143] The processor 120 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. It performs various functions of the electronic device and processes data by running or executing applications stored in the memory 110 and calling data stored in the memory 110, thereby monitoring the electronic device as a whole.
[0144] The magnet 20 can generate a magnetic field when electricity is supplied to it.
[0145] The Hall sensor 40 can sense changes in the magnetic field.
[0146] The driving mechanism 70 can drive the second housing to move relative to the first housing.
[0147] In this embodiment, the electronic device includes a driving mechanism and a first housing and a second housing that are slidably connected. The driving mechanism is used to drive the second housing to move relative to the first housing. The processor 120 in the electronic device will load the executable code corresponding to the process of one or more application programs into the memory 110 according to the following instructions, and the processor 120 will run the application program stored in the memory 110, thereby realizing the process:
[0148] When the driving mechanism is in a non-working state, obtaining a first position of the second housing relative to the first housing;
[0149] Determine a second position according to the first position, where the second position is a position of the second housing relative to the first housing after the second housing moves a preset distance from the first position;
[0150] If the second housing moves from the first position to the second position relative to the first housing, the control driving mechanism drives the second housing to make a similar movement relative to the first housing.
[0151] See also Fig.12 The electronic device 100 may include components such as a memory 110, a processor 120, a magnet 20, a flexible display screen 30, a Hall sensor 40 and a driving mechanism 70.
[0152] The memory 110 may be used to store applications and data. The applications stored in the memory 110 include executable codes. The applications may be composed of various functional modules. The processor 120 executes various functional applications and data processing by running the applications stored in the memory 110.
[0153] The processor 120 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. It performs various functions of the electronic device and processes data by running or executing applications stored in the memory 110 and calling data stored in the memory 110, thereby monitoring the electronic device as a whole.
[0154] The magnet 20 can generate a magnetic field when electricity is supplied to it.
[0155] The flexible display screen 30 can be used to display information such as text and pictures.
[0156] The Hall sensor 40 can sense changes in the magnetic field.
[0157] The driving mechanism 70 can drive the second housing to move relative to the first housing.
[0158] In this embodiment, the electronic device includes a driving mechanism and a first housing and a second housing that are slidably connected. The driving mechanism is used to drive the second housing to move relative to the first housing. The processor 120 in the electronic device will load the executable code corresponding to the process of one or more application programs into the memory 110 according to the following instructions, and the processor 120 will run the application program stored in the memory 110, thereby realizing the process:
[0159] When the driving mechanism is in a non-working state, obtaining a first position of the second housing relative to the first housing;
[0160] Determine a second position according to the first position, where the second position is a position of the second housing relative to the first housing after the second housing moves a preset distance from the first position;
[0161] If the second housing moves from the first position to the second position relative to the first housing, the control driving mechanism drives the second housing to make a similar movement relative to the first housing.
[0162] In some embodiments, when the processor 120 executes to obtain the first position of the second shell relative to the first shell when the driving mechanism is in a non-working state, it can execute: when the driving mechanism is in a non-working state, obtaining the first Hall value of the Hall sensor; determining the first position of the second shell relative to the first shell according to the first Hall value; after the processor 120 determines the second position according to the first position, it can also execute: determining the second Hall value corresponding to the second position; when the processor 120 executes to control the driving mechanism to drive the second shell to make a similar movement relative to the first shell if the second shell moves from a first position to a second position relative to the first shell, it can execute: if the Hall value of the Hall sensor reaches the second Hall value from the first Hall value, then controlling the driving mechanism to drive the second shell to make a similar movement relative to the first shell.
[0163] In some embodiments, the electronic device also includes a magnet, the Hall sensor is arranged on the first shell, and the magnet is arranged on the second shell. When the processor 120 determines the first position of the second shell relative to the first shell based on the first Hall value, it can execute: determining the third position of the magnet relative to the Hall sensor based on the first Hall value and a preset mapping relationship between the Hall value and the position; determining the first position of the second shell relative to the first shell based on the third position; when the processor 120 determines the second Hall value corresponding to the second position, it can execute: determining the fourth position of the magnet relative to the Hall sensor based on the second position; determining the Hall value corresponding to the fourth position based on the mapping relationship; and using the Hall value corresponding to the fourth position as the second Hall value corresponding to the second position.
[0164] In some embodiments, the electronic device also includes a magnet and a plurality of Hall sensors, wherein the plurality of Hall sensors are arranged at intervals on the first shell along the movement direction of the second shell, and the magnet is arranged on the second shell. When the processor 120 executes the operation of obtaining the first position of the second shell relative to the first shell when the driving mechanism is in a non-working state, the following operations may be executed: when the driving mechanism is in a non-working state, obtaining the Hall value of each Hall sensor to obtain a plurality of third Hall values; determining a candidate Hall value from the plurality of third Hall values, wherein the value of the candidate Hall value is not zero; and determining the first position of the second shell relative to the first shell according to the candidate Hall value.
[0165] In some embodiments, when the processor 120 determines the first position of the second shell relative to the first shell based on the candidate Hall value, it can execute: when there are multiple candidate Hall values, determine the Hall value with the largest value among the multiple candidate Hall values as the target Hall value; and determine the first position of the second shell relative to the first shell based on the target Hall value.
[0166] In some embodiments, the target Hall value includes an x-axis Hall value component and a z-axis Hall value component. When the processor 120 determines the first position of the second shell relative to the first shell based on the target Hall value, it can execute: determining the fifth position of the magnet relative to the Hall sensor corresponding to the target Hall value based on the x-axis Hall value component and the preset mapping relationship between the x-axis Hall value component and the position; determining the sixth position of the magnet relative to the Hall sensor corresponding to the target Hall value based on the z-axis Hall value component and the preset mapping relationship between the z-axis Hall value component and the position; and determining the first position of the second shell relative to the first shell based on the fifth position and the sixth position.
[0167] In some embodiments, the processor 120 may further execute: when the second shell has not moved to the second position relative to the first shell and a telescopic operation is received, controlling the driving mechanism to drive the second shell to move relative to the first shell, and the telescopic operation is used to instruct the driving mechanism to drive the second shell to move relative to the first shell.
[0168] In some embodiments, the first shell and the second shell together form a accommodating space, and the electronic device also includes a flexible display screen, one end of the flexible display screen is arranged in the second shell, and the other end of the flexible display screen is arranged in the accommodating space, so that part of the flexible display screen is hidden in the accommodating space, and when the second shell moves relative to the first shell, it can drive the flexible display screen to expand or shrink.
[0169] In some embodiments, when the processor 120 executes the following command: if the second shell moves from a first position to a second position relative to the first shell, then the driving mechanism is controlled to drive the second shell to make a similar movement relative to the first shell; if the second shell moves from a first position to a second position relative to the first shell, and the moving speed of the second shell is greater than a preset speed, then the driving mechanism is controlled to drive the second shell to make a similar movement relative to the first shell.
[0170] In the above embodiments, the description of each embodiment has its own focus. For the part that is not described in detail in a certain embodiment, please refer to the detailed description of the device control method above, and will not be repeated here.
[0171] The device control apparatus provided in the embodiment of the present application belongs to the same concept as the device control method in the above embodiment. Any method provided in the device control method embodiment can be run on the device control apparatus. The specific implementation process is detailed in the device control method embodiment and will not be repeated here.
[0172] It should be noted that, for the device control method of the embodiment of the present application, ordinary technicians in this field can understand that all or part of the process of implementing the device control method of the embodiment of the present application can be completed by controlling the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, such as stored in a memory, and executed by at least one processor, and the execution process may include the process of the embodiment of the device control method. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), etc.
[0173] For the device control device of the embodiment of the present application, each functional module can be integrated into a processing chip, or each module can exist physically separately, or two or more modules can be integrated into one module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium, such as a read-only memory, a disk or an optical disk.
[0174] The above is a detailed introduction to a device control method, apparatus, storage medium and electronic device provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A device control method, applied to an electronic device, characterized in that: The electronic device comprises a driving mechanism, a first shell and a second shell connected in sliding connection, a magnet and a plurality of Hall sensors, wherein the driving mechanism is used to drive the second shell to move relative to the first shell, the plurality of Hall sensors are arranged at intervals on the first shell along the moving direction of the second shell, and the magnet is arranged on the second shell, and the method comprises: When the driving mechanism is in a non-working state, acquiring a Hall value of each Hall sensor to obtain a plurality of third Hall values; Determine a candidate Hall value from the plurality of third Hall values, wherein the value of the candidate Hall value is not zero; determining a first position of the second housing relative to the first housing according to the candidate Hall value; Determine a second position according to the first position, where the second position is a position of the second shell relative to the first shell after the second shell moves a preset distance from the first position; If it is detected that an external force controls the second housing to move from the first position to the second position relative to the first housing, the driving mechanism is controlled to drive the second housing to move relative to the first housing; When the driving mechanism is controlled to drive the second shell to make a similar movement relative to the first shell, if it is detected that the external force has not stopped controlling the movement of the second shell relative to the first shell, then when the movement direction of the second shell controlled by the external force to move relative to the first shell is the same as the movement direction of the second shell driven by the driving mechanism to move relative to the first shell, the driving mechanism continues to be controlled to drive the second shell to move relative to the first shell; when the movement direction of the second shell controlled by the external force to move relative to the first shell is different from the movement direction of the second shell driven by the driving mechanism to move relative to the first shell, the driving mechanism stops controlling the second shell to move relative to the first shell.
2. The device control method according to claim 1, characterized in that: The electronic device further includes a Hall sensor, and when the driving mechanism is in a non-working state, obtaining a first position of the second shell relative to the first shell includes: when the driving mechanism is in a non-working state, obtaining a first Hall value of the Hall sensor; and determining a first position of the second shell relative to the first shell according to the first Hall value; After determining the second position according to the first position, the method further includes: determining a second Hall value corresponding to the second position; If the second shell moves from the first position to the second position relative to the first shell, the driving mechanism is controlled to drive the second shell to make a similar movement relative to the first shell, including: if the Hall value of the Hall sensor reaches the second Hall value from the first Hall value, the driving mechanism is controlled to drive the second shell to make a similar movement relative to the first shell.
3. The device control method according to claim 2, characterized in that: The electronic device further includes a magnet, the Hall sensor is disposed on the first housing, the magnet is disposed on the second housing, and the determining the first position of the second housing relative to the first housing according to the first Hall value comprises: determining a third position of the magnet relative to the Hall sensor according to the first Hall value and a preset mapping relationship between the Hall value and the position; and determining the first position of the second housing relative to the first housing according to the third position; The determining of the second Hall value corresponding to the second position includes: determining a fourth position of the magnet relative to the Hall sensor based on the second position; determining the Hall value corresponding to the fourth position based on the mapping relationship; and using the Hall value corresponding to the fourth position as the second Hall value corresponding to the second position.
4. The device control method according to claim 1, characterized in that: The determining, according to the candidate Hall value, a first position of the second housing relative to the first housing comprises: When there are multiple candidate Hall values, the Hall value with the largest value among the multiple candidate Hall values is determined as the target Hall value; A first position of the second housing relative to the first housing is determined according to the target Hall value.
5. The device control method according to claim 4, characterized in that: The target Hall value includes an x-axis Hall value component and a z-axis Hall value component, and determining a first position of the second housing relative to the first housing according to the target Hall value includes: Determining a fifth position of the magnet relative to the Hall sensor corresponding to the target Hall value according to the x-axis Hall value component and a preset mapping relationship between the x-axis Hall value component and the position; Determining a sixth position of the magnet relative to the Hall sensor corresponding to the target Hall value according to the z-axis Hall value component and a preset mapping relationship between the z-axis Hall value component and the position; A first position of the second shell relative to the first shell is determined according to the fifth position and the sixth position.
6. The device control method according to claim 1, characterized in that: The method further comprises: When the movement distance of the second shell relative to the first shell is less than the preset distance, the control driving mechanism continues to maintain the non-working state.
7. The device control method according to any one of claims 1 to 6, characterized in that: The first shell and the second shell together form a accommodating space. The electronic device also includes a flexible display screen. One end of the flexible display screen is arranged in the second shell, and the other end of the flexible display screen is arranged in the accommodating space, so that part of the flexible display screen is hidden in the accommodating space. When the second shell moves relative to the first shell, it can drive the flexible display screen to expand or shrink.
8. The device control method according to claim 1, characterized in that: If the second housing moves from the first position to the second position relative to the first housing, controlling the driving mechanism to drive the second housing to move relative to the first housing comprises: If the second shell moves from the first position to the second position relative to the first shell, and the moving speed of the second shell is greater than a preset speed, the driving mechanism is controlled to drive the second shell to move similarly relative to the first shell.
9. A device control device, applied to electronic equipment, characterized in that: The electronic device comprises a driving mechanism, a first shell and a second shell connected in sliding connection, a magnet and a plurality of Hall sensors, wherein the driving mechanism is used to drive the second shell to move relative to the first shell, the plurality of Hall sensors are arranged at intervals on the first shell along the moving direction of the second shell, the magnet is arranged on the second shell, and the device comprises: an acquisition module, configured to acquire the Hall value of each Hall sensor when the driving mechanism is in a non-working state, and obtain a plurality of third Hall values; determine a candidate Hall value from the plurality of third Hall values, wherein the value of the candidate Hall value is not zero; and determine a first position of the second housing relative to the first housing according to the candidate Hall value; A determination module, configured to determine a second position according to the first position, wherein the second position is a position of the second shell relative to the first shell after the second shell moves a preset distance from the first position; A control module, for controlling the driving mechanism to drive the second shell to make a similar movement relative to the first shell if it is detected that an external force controls the second shell to move from the first position to the second position relative to the first shell; when controlling the driving mechanism to drive the second shell to make a similar movement relative to the first shell, if it is detected that the external force has not stopped controlling the movement of the second shell relative to the first shell, then when the movement direction of the second shell controlled by the external force to move relative to the first shell is the same as the movement direction of the second shell driven by the driving mechanism to make a similar movement relative to the first shell, continue to control the driving mechanism to drive the second shell to make a similar movement relative to the first shell, and when the movement direction of the second shell controlled by the external force to move relative to the first shell is different from the movement direction of the second shell driven by the driving mechanism to make a similar movement relative to the first shell, stop controlling the driving mechanism to drive the second shell to make a similar movement relative to the first shell.
10. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed on a computer, the computer is enabled to execute the device control method according to any one of claims 1 to 8.
11. An electronic device, characterized in that: The electronic device includes a processor, a memory, a driving mechanism, and a first shell and a second shell that are slidably connected. The driving mechanism is used to drive the first shell to move relative to the first shell. A computer program is stored in the memory. The processor executes the device control method described in any one of claims 1 to 8 by calling the computer program stored in the memory.
