Method, device, electronic device and storage medium for determining altitude
By obtaining the pace cycle and extrusion method when the electronic device moves and calculating the altitude value, the problem of inaccurate altitude value during the electronic device is solved, and the accuracy is improved.
Patent Information
- Application Number
- CN202211048885.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-30
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2042-08-30
AI Technical Summary
In the prior art, when the electronic device is squeezed during motion, the accuracy of the altitude value is low, resulting in errors between the calculation results and the real height.
By obtaining at least two pace cycles when the electronic device is in a moving state and being squeezed, determining the extrusion method, and calculating the altitude value of the electronic device based on the extrusion method and the altitude average, improving the accuracy of the altitude value. .
The impact of extrusion on altitude value calculation is effectively avoided, and the accuracy of electronic equipment in determining altitude value is improved.
Smart Images

Figure CN115355877B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of communication technology, and specifically relates to a method, device, electronic device and storage medium for determining altitude. Background Art
[0002] At present, when users go up and down stairs or up and down slopes, the altitude value of the electronic device will change; however, when the screen or back shell of the electronic device is squeezed during the movement of the electronic device, the air pressure inside the electronic device will increase, and the altitude value of the electronic device will also change. For example, when the air pressure inside the electronic device increases, the altitude value of the electronic device becomes lower; at this time, the altitude value of the electronic device calculated will be affected by the squeezing, so that there is an error between the calculated result and the altitude value corresponding to the actual height of the electronic device. As a result, the accuracy of determining the altitude value of the electronic device in the prior art is low. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a method, device, electronic device and storage medium for determining altitude, which can solve the problem of low accuracy in determining the altitude value of an electronic device in the prior art.
[0004] In order to solve the above technical problems, this application is implemented as follows:
[0005] In a first aspect, an embodiment of the present application provides a method for determining altitude, which includes: when the electronic device is in a target state, obtaining at least two step cycles within a preset time period, the target state is used to indicate that the electronic device is in motion and is squeezed, and the at least two step cycles are step cycles of the user when the electronic device is in motion; based on the at least two step cycles, determining the squeezing mode in which the electronic device is squeezed; based on the squeezing mode in which the electronic device is squeezed and at least two altitude averages, determining the altitude value of the electronic device, each altitude average being the average of the altitude values of the electronic device within one step cycle.
[0006] In a second aspect, an embodiment of the present application provides an altitude determination device, which includes: an acquisition module and a determination module. The acquisition module is used to acquire at least two step cycles within a preset time period when the electronic device is in a target state, the target state is used to indicate that the electronic device is in motion and is squeezed, and the at least two step cycles are the step cycles of the user when the electronic device is in motion. The determination module is used to determine the squeezing mode of the electronic device based on the at least two step cycles; and determine the altitude value of the electronic device based on the squeezing mode of the electronic device and at least two altitude averages, each altitude average being the average value of the altitude value of the electronic device within one step cycle.
[0007] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.
[0008] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0009] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0010] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.
[0011] In an embodiment of the present application, when the electronic device is in motion and squeezed (i.e., in a target state), at least two step cycles can be obtained to determine the squeezing mode of the electronic device based on the at least two step cycles, and then the altitude value of the electronic device can be determined based on the squeezing mode of the electronic device and at least two altitude averages, where each altitude average is the average of the altitude values of the electronic device within one step cycle. In this solution, since when the electronic device is in motion and squeezed, the electronic device can determine the squeezing mode of the electronic device based on at least two step cycles of the user during the movement of the electronic device, the electronic device can obtain the current altitude value of the electronic device based on the squeezing mode of the electronic device and at least two altitude averages, so that when the electronic device determines the altitude value, it is not affected by the squeezing of the electronic device, thereby improving the accuracy of determining the altitude value of the electronic device. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 is a schematic diagram of a method for determining altitude provided in an embodiment of the present application;
[0013] Figure 2 is a structural schematic diagram of an altitude determination device provided in an embodiment of the present application;
[0014] Figure 3 This is one of the hardware structure diagrams of an electronic device provided in an embodiment of the present application;
[0015] Figure 4 This is the second schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0016] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0017] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0018] The following is a detailed description of the altitude determination method provided by the embodiment of the present application through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0019] The altitude determination method in the embodiment of the present application can be applied to a scenario where an electronic device determines an altitude value.
[0020] At present, when the screen or battery cover of an electronic device is squeezed during movement, the screen and battery cover will deform to a certain extent, causing the air pressure inside the electronic device to increase and the altitude value to decrease. The sudden change in air pressure caused by squeezing will affect the application of air pressure sensors in electronic devices, such as making the altitude value calculation inaccurate or causing the electronic device to miscalculate the climb when the user is walking on flat ground with the electronic device in hand.
[0021] In the prior art, electronic devices can use low-pass filtering algorithms to process data caused by squeezing, so that the air pressure inside and outside the electronic device is balanced. However, when users go up and down stairs or up and down slopes, the altitude value of the electronic device will also increase or decrease; at this time, if the electronic device is squeezed at the same time, the use of a low-pass filtering algorithm will process the data generated by the actual altitude change of the electronic device at once, thereby affecting all applications using air pressure sensors in the electronic device. As a result, the accuracy of determining the altitude value of the electronic device in the prior art is low.
[0022] In the solution provided in the embodiment of the present application, when the electronic device is in motion and squeezed (i.e., in the target state), at least two step cycles can be obtained to determine the squeezing mode of the electronic device based on the at least two step cycles, and then the altitude value of the electronic device can be determined based on the squeezing mode of the electronic device and at least two altitude averages, where each altitude average is the average of the altitude values of the electronic device within one step cycle. In this solution, since when the electronic device is in motion and squeezed, the electronic device can determine the squeezing mode of the electronic device based on at least two step cycles of the user during the movement of the electronic device, the electronic device can obtain the current altitude value of the electronic device based on the squeezing mode of the electronic device and at least two altitude averages, so that the electronic device is not affected by the squeezing of the electronic device when determining the altitude value, thereby improving the accuracy of determining the altitude value of the electronic device.
[0023] The present application provides a method for determining altitude. Figure 1 FIG. 1 is a flowchart of a method for determining altitude provided by an embodiment of the present application, which can be applied to electronic devices. Figure 1 As shown, the altitude determination method provided in the embodiment of the present application may include the following steps 201 to 203.
[0024] Step 201: When the electronic device is in a target state, the electronic device obtains at least two step cycles within a preset time period.
[0025] In the embodiment of the present application, the above-mentioned target state is used to indicate that the electronic device is in motion and is squeezed, and the at least two step cycles are the step cycles of the user when the electronic device is in motion.
[0026] Optionally, in an embodiment of the present application, each of the at least two step cycles mentioned above is a time period for a user to take a complete step (i.e., one step for each of the left foot and the right foot) during the movement of the electronic device.
[0027] For example, if the user starts to step with his left foot at 10:01 and ends with his right foot at 10:05, then 10:01 to 10:05 is called a step cycle.
[0028] It can be understood that each step cycle varies with the user's step speed.
[0029] Step 202: The electronic device determines a squeezing mode in which the electronic device is squeezed according to at least two step cycles.
[0030] In the embodiment of the present application, the electronic device can obtain at least two step cycles of the user when the electronic device is in motion, and thereby determine the squeezing mode in which the electronic device is squeezed based on the at least two step cycles.
[0031] Optionally, in the embodiment of the present application, the above step 202 can be specifically implemented by the following steps 202a and 202b.
[0032] Step 202a: The electronic device determines a target extreme value based on at least two step cycles.
[0033] In an embodiment of the present application, the above-mentioned target extreme difference value is the difference between a first value and a second value in at least two step cycles, the first value is the average altitude of the step cycle with the largest average altitude in at least two step cycles, and the second value is the average altitude of the step cycle with the smallest average altitude in at least two step cycles.
[0034] Specifically, the electronic device can calculate the average altitude within each of at least two step cycles to obtain an average altitude corresponding to each step cycle, and then the electronic device can calculate the difference between the maximum average altitude and the minimum average altitude among the at least two average altitudes, so as to determine the target extreme difference value.
[0035] It is understandable that the altitude values in one step cycle are not the same, so the average altitude value in each step cycle of at least two step cycles can be calculated first to determine the target range value.
[0036] Step 202b: The electronic device determines the squeezing mode in which the electronic device is squeezed according to the target extreme difference value.
[0037] In the embodiment of the present application, the electronic device can determine the squeezing mode when the electronic device is squeezed in a moving state according to the target extreme difference value.
[0038] Optionally, in the embodiment of the present application, the above step 202b can be specifically implemented by the following step 202b1 or step 202b2.
[0039] Step 202b1: When the target range value is less than or equal to the first threshold value, the electronic device determines that the squeezing mode in which the electronic device is squeezed is the first squeezing mode.
[0040] In the embodiment of the present application, the first squeezing mode is a squeezing mode in which the electronic device is squeezed when it moves in a horizontal direction.
[0041] Optionally, in an embodiment of the present application, the above-mentioned first threshold is determined by the electronic device according to the user's movement habits. If the user's horizontal movement is relatively stable, a lower first threshold can be set; if the user's horizontal movement fluctuates greatly, a higher first threshold can be set.
[0042] It can be understood that when the user's horizontal movement is relatively stable, the altitude of the electronic device changes less, so a lower threshold can be set; when the user's horizontal movement fluctuates greatly, the altitude of the electronic device changes more greatly, so a higher threshold can be set to avoid false detection of the electronic device due to the large fluctuations in the user's horizontal movement, which causes the altitude of the electronic device to change.
[0043] It can be understood that when the target range value is less than or equal to the first threshold value, that is, when the altitude change of the electronic device is small, the electronic device can determine that the electronic device is squeezed when moving in the horizontal direction.
[0044] Optionally, in the embodiment of the present application, the movement of the electronic device in the horizontal direction can be understood as the user driving the electronic device to move in the horizontal direction when moving on a flat road.
[0045] Step 202b2: When the target extreme difference value is greater than the first threshold value, the electronic device determines that the squeezing mode in which the electronic device is squeezed is the second squeezing mode or the third squeezing mode.
[0046] In an embodiment of the present application, the above-mentioned second extrusion mode is a extrusion mode in which the electronic device is squeezed when it moves in a direction perpendicular to the horizontal direction, and the third extrusion mode is a extrusion mode in which the electronic device is squeezed when it moves in the horizontal direction. The extrusion force of the third extrusion mode is different from the extrusion force of the first extrusion mode.
[0047] Optionally, in the embodiment of the present application, the third squeezing manner may be a squeezing manner in which the squeezing force of the electronic device suddenly increases or decreases when the electronic device moves in the horizontal direction.
[0048] It can be understood that when the target extreme difference value is greater than the first threshold, that is, when the altitude of the electronic device changes significantly, the electronic device can determine that the electronic device is squeezed when moving in a direction perpendicular to the horizontal direction, or that the squeezing force changes significantly when moving in the horizontal direction.
[0049] Optionally, in the embodiment of the present application, the movement of the electronic device in a direction perpendicular to the horizontal direction can be understood as the user driving the electronic device to move in a direction perpendicular to the horizontal direction when walking up or down a slope or stairs.
[0050] In the embodiment of the present application, since some users have large fluctuations in horizontal movement, the electronic device can set a higher threshold to avoid false detection by the electronic device when the altitude of the electronic device changes due to large fluctuations in horizontal movement of the user.
[0051] Optionally, in the embodiment of the present application, the preset time period includes: at least two time periods, one time period corresponds to one step cycle; the above step 202b2 can be specifically implemented by the following steps 301 and 302, or steps 301 and 303.
[0052] Step 301: When the target extreme difference value is greater than a first threshold value, the electronic device obtains a target force change and a target altitude change.
[0053] In an embodiment of the present application, the above-mentioned target force change is the difference between the maximum value of the extrusion force of a step cycle in the first time period and the maximum value of the extrusion force of a step cycle in the second time period, and the target altitude change is the difference between the average altitude of a step cycle in the first time period and the average altitude of a step cycle in the second time period.
[0054] In the embodiment of the present application, the first time period is the time period closest to the current moment among at least two time periods, the second time period is the time period before the first time period, and the second time period is one of the at least two time periods.
[0055] In an embodiment of the present application, when the electronic device determines the target extreme difference value and the target extreme difference value is greater than the first threshold value, the electronic device can obtain the target force change and the target altitude change to further determine whether the squeezing mode in which the electronic device is squeezed is the second squeezing mode or the third squeezing mode.
[0056] Optionally, in an embodiment of the present application, the electronic device can obtain the maximum value of the squeezing force of a step cycle in the first time period and the maximum value of the squeezing force of a step cycle in the second time period, and then calculate the difference between the maximum values of the squeezing force of the two step cycles to determine the target force change.
[0057] Optionally, in an embodiment of the present application, the electronic device may obtain an average altitude of a step cycle within a first time period and an average altitude of a step cycle within a second time period, and then calculate the difference between the average altitudes of the two step cycles to determine a target altitude change.
[0058] Optionally, in an embodiment of the present application, after the electronic device calculates the target force change and the target altitude change, it can compare the target force change and the target altitude change with a preset relationship to determine whether the squeezing mode in which the electronic device is squeezed is the second squeezing mode or the third squeezing mode based on the comparison result.
[0059] Step 302: When the target force variation matches the preset force variation, if the target altitude variation matches the altitude variation corresponding to the preset force variation, the electronic device determines that the squeezing mode in which the electronic device is squeezed is the third squeezing mode.
[0060] Optionally, in the embodiment of the present application, the electronic device may set in advance the correspondence between the change in the squeezing force and the change in the altitude when the electronic device moves in the horizontal direction according to the structure and material of the electronic device.
[0061] Optionally, in an embodiment of the present application, after the electronic device finds a preset force change that matches the target force change in the corresponding relationship, if the target altitude change matches the altitude change corresponding to the preset force change, it can be determined that the electronic device is squeezed when moving horizontally.
[0062] Specifically, the electronic device can search for a force change that matches the target force change in the above-mentioned correspondence based on the target force change; when the target force change matches a preset force change in the correspondence, the calculated target altitude change is matched with the altitude change corresponding to the preset force change; when the match is successful, the electronic device can determine that the squeezing mode in which the electronic device is squeezed is the third squeezing mode (i.e., the electronic device is squeezed when it moves horizontally).
[0063] Exemplarily, as shown in Table 1, the table includes the correspondence between 5 force changes and altitude changes; after the electronic device calculates the target force change (for example: force change 1), it can search for the force change corresponding to the force change 1 in Table 1, and then after finding the preset force change 1, match the target altitude change (for example: altitude change -2) with the altitude change -2 corresponding to the preset force change 1. When the match is successful, the electronic device can determine that the electronic device is squeezed when moving horizontally.
[0064] Table 1
[0065] Velocity Variation Altitude change 1 1 -2 2 2 -4 3 3 -6 4 4 -8 5 5 -10
[0066] Step 303: When the target force variation matches the preset force variation, if the target altitude variation does not match the altitude variation corresponding to the preset force variation, the electronic device determines that the squeezing mode in which the electronic device is squeezed is the second squeezing mode.
[0067] Optionally, in an embodiment of the present application, after the electronic device finds a preset force change that matches the target force change in the corresponding relationship, if the target altitude change does not match the altitude change corresponding to the preset force change, it can be determined that the electronic device is squeezed when moving in a direction perpendicular to the horizontal direction.
[0068] Specifically, the electronic device can search for a force change that matches the target force change in the above-mentioned correspondence based on the target force change; when the target force change matches a preset force change in the correspondence, the calculated target altitude change is matched with the altitude change corresponding to the preset force change; if the match is not successful, the electronic device can determine that the squeezing mode in which the electronic device is squeezed is the second squeezing mode (i.e., the electronic device is squeezed when it moves in a direction perpendicular to the horizontal direction).
[0069] Exemplarily, as shown in Table 1, after calculating the target force change (for example, force change 1), the electronic device can search for the force change corresponding to the force change 1 in Table 1, and then after finding the preset force change 1, match the target altitude change (for example, altitude change -4) with the altitude change -2 corresponding to the preset force change 1. If the match is not successful, the electronic device determines that the electronic device is squeezed when moving in a direction perpendicular to the horizontal direction.
[0070] Optionally, in an embodiment of the present application, when the target altitude change is greater than the altitude change corresponding to the preset force change, the electronic device determines that the squeezing mode in which the electronic device is squeezed is the second squeezing mode, which is the squeezing mode in which the electronic device is squeezed when it moves upward in a direction perpendicular to the horizontal direction.
[0071] Optionally, in the embodiment of the present application, the upward movement of the electronic device in a direction perpendicular to the horizontal direction can be understood as the user driving the electronic device to move upward in a direction perpendicular to the horizontal direction when going uphill or stairs.
[0072] Optionally, in an embodiment of the present application, after the electronic device finds a preset force change that matches the target force change in the corresponding relationship, it matches the calculated target altitude change with the altitude change corresponding to the preset force change. When the target altitude change is greater than the altitude change corresponding to the preset force change, the electronic device can determine that the electronic device is squeezed when moving upward in a direction perpendicular to the horizontal direction.
[0073] It can be understood that when the actual target altitude change is greater than the altitude change corresponding to the preset force change, it means that the electronic device moves upward in a direction perpendicular to the horizontal direction while being squeezed, causing the actual altitude value of the electronic device to increase. In this way, the target altitude change is greater than the altitude change corresponding to the preset force change.
[0074] Exemplarily, as shown in Table 1, after calculating the target force change (for example, force change 1), the electronic device can search for the force change corresponding to force change 1 in Table 1, and then after finding the preset force change 1, the target altitude change (for example, altitude change 1) can be matched with the altitude change -2 corresponding to the preset force change 1. At this time, if the actual target altitude change is greater than the altitude change corresponding to the preset force change, the electronic device moves upward in a direction perpendicular to the horizontal direction while being squeezed.
[0075] Optionally, in an embodiment of the present application, when the target altitude change is less than the altitude change corresponding to the preset force change, the electronic device determines that the squeezing mode in which the electronic device is squeezed is the second squeezing mode, which is the squeezing mode in which the electronic device is squeezed when it moves downward in a direction perpendicular to the horizontal direction.
[0076] Optionally, in the embodiment of the present application, the downward movement of the electronic device in a direction perpendicular to the horizontal direction can be understood as the user driving the electronic device to move downward in a direction perpendicular to the horizontal direction when going downhill or down stairs.
[0077] Optionally, in an embodiment of the present application, after the electronic device finds a preset force change that matches the target force change in the corresponding relationship, it matches the calculated target altitude change with the altitude change corresponding to the preset force change. When the target altitude change is less than the altitude change corresponding to the preset force change, the electronic device can determine that the electronic device is squeezed when moving downward in a direction perpendicular to the horizontal direction.
[0078] It can be understood that when the actual target altitude change is smaller than the altitude change corresponding to the preset force change, it means that the electronic device moves downward in a direction perpendicular to the horizontal direction while being squeezed, so that the actual altitude value of the electronic device becomes smaller, so the target altitude change is smaller than the altitude change corresponding to the preset force change.
[0079] Exemplarily, as shown in Table 1, after calculating the target force change (for example, force change 1), the electronic device can search for the force change corresponding to force change 1 in Table 1, and then after finding the preset force change 1, the target altitude change (for example, altitude change -4) can be matched with the altitude change -2 corresponding to the preset force change 1. At this time, if the actual target altitude change is less than the altitude change corresponding to the preset force change, the electronic device moves downward in a direction perpendicular to the horizontal direction while being squeezed.
[0080] Step 203: The electronic device determines an altitude value of the electronic device according to the squeezing mode in which the electronic device is squeezed and at least two average altitude values.
[0081] In the embodiment of the present application, each altitude mean is the average value of the altitude values of the electronic device within a step cycle.
[0082] In the embodiment of the present application, after determining the squeezing mode in which the electronic device is squeezed, the electronic device can determine the altitude value of the electronic device according to the squeezing mode in which the electronic device is squeezed and at least two altitude averages.
[0083] Optionally, in the embodiment of the present application, the above step 203 can be specifically implemented by the following step 203a or step 203b.
[0084] Step 203a: When the squeezing mode is the first squeezing mode or the third squeezing mode, the electronic device determines the average of the altitude means of the target step cycles in at least two step cycles as the altitude value of the electronic device.
[0085] In an embodiment of the present application, the above-mentioned target step cycle includes: a step cycle within a first time period, a step cycle within a second time period, and a step cycle within a third time period, the third time period is the time period before the second time period, and the third time period is one of the at least two time periods.
[0086] Optionally, in an embodiment of the present application, when the electronic device determines that the squeezing mode in which the electronic device is squeezed is the squeezing mode in which the electronic device is squeezed when moving in a horizontal direction, the average altitude of each step cycle in the three step cycles closest to the current moment can be calculated, and then the average of the three altitude averages can be calculated to use the average as the current altitude value of the electronic device.
[0087] Specifically, the altitude value=(Height_Mean1+Height_Mean2+Height_Mean3) / 3.
[0088] Among them, Height_Mean1 is the average altitude of a step cycle in the first time period, Height_Mean2 is the average altitude of a step cycle in the second time period, and Height_Mean3 is the average altitude of a step cycle in the third time period.
[0089] Step 203b: When the squeezing mode is the second squeezing mode, the electronic device determines the average altitude of a step cycle within the first time period as the altitude value of the electronic device.
[0090] Optionally, in an embodiment of the present application, when the electronic device determines that the electronic device is squeezed in a manner when the electronic device moves in a direction perpendicular to the horizontal direction, the average altitude of a step cycle closest to the current moment can be used as the current altitude value of the electronic device.
[0091] Specifically, the altitude value=Height_Mean1.
[0092] The embodiment of the present application provides a method for determining altitude. When an electronic device is in motion and squeezed (i.e., in a target state), at least two step cycles can be obtained to determine the squeezing mode of the electronic device based on the at least two step cycles, and then the altitude value of the electronic device can be determined based on the squeezing mode of the electronic device and at least two altitude averages, each altitude average being the average value of the altitude value of the electronic device within one step cycle. In this solution, since when the electronic device is in motion and squeezed, the electronic device can determine the squeezing mode of the electronic device based on at least two step cycles of the user during the movement of the electronic device, the electronic device can obtain the current altitude value of the electronic device based on the squeezing mode of the electronic device and at least two altitude averages, so that when the electronic device determines the altitude value, it is not affected by the squeezing of the electronic device, thereby improving the accuracy of determining the altitude value of the electronic device.
[0093] Optionally, in the embodiment of the present application, the altitude determination method provided in the embodiment of the present application further includes the following step 401 or step 402.
[0094] Step 401: When the electronic device is squeezed in a manner that the electronic device moves in a horizontal direction, the electronic device processes first data.
[0095] In the embodiment of the present application, the first data is data generated when the electronic device is squeezed when the electronic device moves in the horizontal direction.
[0096] Optionally, in an embodiment of the present application, when the electronic device determines that the squeezing mode is the squeezing when the electronic device moves in a horizontal direction, the electronic device can use a low-pass filtering algorithm to process data generated by the squeezing when the electronic device moves in a horizontal direction.
[0097] Step 402: When the electronic device is squeezed in a manner that the electronic device moves in a direction perpendicular to the horizontal direction, the electronic device processes target data in the second data.
[0098] In the embodiment of the present application, the second data includes data generated by the change in altitude of the electronic device during movement and target data, where the target data is data generated when the electronic device is squeezed when it moves in a direction perpendicular to the horizontal direction.
[0099] It can be understood that when the electronic device determines that the squeezing mode is that the electronic device is squeezed when it moves in a direction perpendicular to the horizontal direction, the data generated by the electronic device includes data generated by the change in altitude of the electronic device during the movement and data generated by the squeezing of the electronic device during the movement.
[0100] Optionally, in an embodiment of the present application, the electronic device may only use a low-pass filtering algorithm to process data generated when the electronic device is squeezed during movement, thereby improving the accuracy of data processing by the electronic device.
[0101] In this way, since the electronic device can accurately process the data generated when the electronic device is squeezed, the accuracy of determining the altitude value of the electronic device is improved.
[0102] Optionally, in an embodiment of the present application, before the above-mentioned step 201, the altitude determination method provided in the embodiment of the present application further includes the following steps 501 and 502, or steps 501 and 503.
[0103] Step 501: An electronic device obtains first information.
[0104] In the embodiment of the present application, the first information includes acceleration data of the electronic device in three directions and a change in altitude of the electronic device.
[0105] Optionally, in the embodiment of the present application, the acceleration data of the electronic device in three directions may be acceleration data in the directions of X, Y, and Z coordinate axes in a spatial rectangular coordinate system.
[0106] Exemplarily, the electronic device may sample 25 acceleration values per second.
[0107] Step 502: When the first information meets a preset condition, the electronic device determines that the electronic device is in a target state.
[0108] It can be understood that when the acceleration data of the electronic device in three directions and the altitude change of the electronic device meet preset conditions, the electronic device can determine that the electronic device is in motion and squeezed (ie, in the target state).
[0109] Optionally, in an embodiment of the present application, when the acceleration data of the electronic device in three directions are respectively within a preset range, and extreme point impulses of the electronic device in a first positive direction and extreme point impulses in a first negative direction appear alternately, the electronic device determines that the electronic device is in motion.
[0110] In the embodiment of the present application, the first positive direction is the positive direction in the first horizontal direction among the three directions, the first negative direction is the negative direction in the direction perpendicular to the horizontal direction among the three directions, and the extreme point impulse is used to indicate the fluctuation of the acceleration data.
[0111] Exemplarily, the acceleration data in the three directions may be acceleration data in a first horizontal direction, a second horizontal direction, and a direction perpendicular to the horizontal direction.
[0112] Exemplarily, the first horizontal direction may be the X-axis direction, the second horizontal direction may be the Y-axis direction, the direction perpendicular to the horizontal direction may be the Z-axis direction, the first positive direction may be the positive direction on the X-axis, and the first negative direction may be the negative direction on the Z-axis.
[0113] For example, when the average value of the acceleration data of the electronic device in the second horizontal direction is around -9.8 or 9.8, it can be determined that the electronic device is in motion and is placed upward or downward during the motion.
[0114] Exemplarily, when the mean values of acceleration data of the electronic device in a first horizontal direction and in a direction perpendicular to the horizontal direction periodically oscillate around zero, it can be determined that the electronic device is in motion, and the motion state is within the normal walking frequency range of the user.
[0115] Optionally, in the embodiment of the present application, when the altitude change of the electronic device satisfies a value greater than or equal to a second threshold, the electronic device determines that the electronic device is squeezed.
[0116] Exemplarily, the electronic device may detect whether the altitude change within a preset time period is continuously greater than or equal to a second threshold value. When the altitude change within the preset time period is greater than or equal to the second threshold value, the electronic device may determine that the electronic device is squeezed.
[0117] For example, if the electronic device detects that the altitude of the electronic device changes suddenly by more than 3 meters within ten consecutive seconds, it can be determined that the electronic device is squeezed during the movement.
[0118] Exemplarily, the second threshold is proportional to the magnitude of the combined acceleration of the electronic device.
[0119] Optionally, in an embodiment of the present application, when the fluctuation amplitude of the acceleration data of the electronic device in the first negative direction is greater than the fluctuation amplitude of the acceleration data in the second positive direction, the electronic device determines that the screen of the electronic device is squeezed.
[0120] In the embodiment of the present application, the second positive direction is a positive direction perpendicular to the horizontal direction among the three directions.
[0121] Exemplarily, the second positive direction may be a positive direction on the Z coordinate axis.
[0122] It can be understood that when the fluctuation amplitude of the acceleration data of the electronic device in the negative direction on the Z coordinate axis (i.e., the first negative direction) is greater than the fluctuation amplitude of the acceleration data in the positive direction on the Z coordinate axis (i.e., the second positive direction), that is, the impulse amplitude that periodically appears in the negative direction of the electronic device on the Z coordinate axis is greater than the impulse amplitude that periodically appears in the positive direction on the Z coordinate axis, the electronic device can determine that the screen of the electronic device is squeezed.
[0123] Optionally, in an embodiment of the present application, when the fluctuation amplitude of the acceleration data of the electronic device in the first negative direction is smaller than the fluctuation amplitude of the acceleration data in the second positive direction, the electronic device may determine that the rear shell of the electronic device is squeezed.
[0124] Step 503: When the first information does not satisfy a preset condition, the electronic device determines that the electronic device is not in a target state.
[0125] In an embodiment of the present application, the electronic device can obtain acceleration data of the electronic device in three directions and the altitude change of the electronic device (i.e., first information), and then compare the first information obtained by the electronic device with preset conditions. When the first information does not meet the preset conditions, the electronic device can determine that the electronic device is not in the target state.
[0126] In the embodiment of the present application, since the electronic device can obtain the acceleration data of the electronic device in three directions and the altitude change of the electronic device in real time, it can determine in real time whether the electronic device is in motion and squeezed, thereby improving the flexibility of the electronic device in determining the state of the electronic device.
[0127] It should be noted that the altitude determination method provided in the embodiment of the present application can be executed by an electronic device, or an altitude determination device, or a control module in an altitude determination device. In the embodiment of the present application, an electronic device executing the altitude determination method is taken as an example to illustrate the altitude determination device provided in the embodiment of the present application.
[0128] Figure 2 FIG. 2 shows a possible structural diagram of an altitude determination device involved in an embodiment of the present application. Figure 2 As shown, the altitude determination device 70 may include: an acquisition module 71 and a determination module 72 .
[0129] The acquisition module 71 is used to acquire at least two step cycles within a preset time period when the electronic device is in a target state, and the target state is used to indicate that the electronic device is in motion and is squeezed, and the at least two step cycles are the step cycles of the user during the motion of the electronic device. The determination module 72 is used to determine the squeezing mode of the electronic device according to the at least two step cycles; and determine the altitude value of the electronic device according to the squeezing mode of the electronic device and at least two altitude averages, and each altitude average is the average value of the altitude value of the electronic device within one step cycle.
[0130] An embodiment of the present application provides an altitude determination device. When an electronic device is in motion and is squeezed, the electronic device can determine the squeezing mode of the electronic device based on at least two step cycles of the user during the motion of the electronic device. Therefore, the electronic device can obtain the current altitude value of the electronic device based on the squeezing mode of the electronic device and at least two altitude averages, so that the electronic device is not affected by the squeezing of the electronic device when determining the altitude value, thereby improving the accuracy of determining the altitude value of the electronic device.
[0131] In one possible implementation, the determination module 72 is specifically used to determine a target extreme difference value based on at least two step cycles, where the target extreme difference value is the difference between a first value and a second value in at least two step cycles, the first value being the average altitude of the step cycle with the largest average altitude in at least two step cycles, and the second value being the average altitude of the step cycle with the smallest average altitude in at least two step cycles; and based on the target extreme difference value, determine the squeezing mode in which the electronic device is squeezed.
[0132] In a possible implementation, the determination module 72 is specifically used to determine that the squeezing mode in which the electronic device is squeezed is the first squeezing mode when the target extreme difference value is less than or equal to the first threshold value, and the first squeezing mode is the squeezing mode in which the electronic device is squeezed when it moves in the horizontal direction; or, when the target extreme difference value is greater than the first threshold value, determine that the squeezing mode in which the electronic device is squeezed is the second squeezing mode or the third squeezing mode, the second squeezing mode is the squeezing mode in which the electronic device is squeezed when it moves in a direction perpendicular to the horizontal direction, the third squeezing mode is the squeezing mode in which the electronic device is squeezed when it moves in the horizontal direction, and the squeezing force of the third squeezing mode is different from the squeezing force of the first squeezing mode.
[0133] In a possible implementation, the preset time period includes: at least two time periods, one time period corresponds to a step cycle; the acquisition module 71 is also used to acquire the target force change and the target altitude change when the target extreme difference value is greater than the first threshold value, the target force change is the difference between the maximum value of the squeezing force of a step cycle in the first time period and the maximum value of the squeezing force of a step cycle in the second time period, and the target altitude change is the difference between the average altitude of a step cycle in the first time period and the average altitude of a step cycle in the second time period. The determination module 72 is specifically used to: when the target force change matches the preset force change, if the target altitude change matches the altitude change corresponding to the preset force change, determine that the squeezing mode of the electronic device is the third squeezing mode; or, if the target altitude change does not match the altitude change corresponding to the preset force change, determine that the squeezing mode of the electronic device is the second squeezing mode; wherein the first time period is the time period closest to the current moment among the at least two time periods, the second time period is the time period before the first time period, and the second time period is one of the at least two time periods.
[0134] In a possible implementation, the determination module 72 is specifically used to determine the average value of the altitude average values of target step cycles in at least two step cycles as the altitude value of the electronic device when the extrusion method is the first extrusion method or the third extrusion method, the target step cycle includes: a step cycle within a first time period, a step cycle within a second time period, and a step cycle within a third time period, the third time period is the previous time period of the second time period, and the third time period is one of the at least two time periods; or, the determination module is specifically used to determine the average value of the altitude of a step cycle within the first time period as the altitude value of the electronic device when the extrusion method is the second extrusion method.
[0135] In a possible implementation, the altitude determination device 70 further includes: a processing module. The processing module is used to process the first data when the electronic device is squeezed in a horizontal direction, and the first data is data generated when the electronic device is squeezed in a horizontal direction; or the processing module is also used to process the target data in the second data when the electronic device is squeezed in a direction perpendicular to the horizontal direction, and the second data includes data generated when the electronic device changes in altitude during movement and the target data, and the target data is data generated when the electronic device is squeezed in a direction perpendicular to the horizontal direction.
[0136] The altitude determination device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in an electronic device. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a car-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0137] The altitude determination device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0138] The altitude determination device provided in the embodiment of the present application can implement each process implemented in the above method embodiment, and will not be described again here to avoid repetition.
[0139] Alternatively, if Figure 3 As shown, an embodiment of the present application also provides an electronic device 900, including a processor 901 and a memory 902, wherein the memory 902 stores programs or instructions that can be executed on the processor 901, and when the program or instructions are executed by the processor 901, the various steps of the above-mentioned method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not described here.
[0140] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0141] Figure 4 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0142] The electronic device 100 includes but is not limited to components such as a radio frequency unit 101, a network module 102, an audio output unit 103, an input unit 104, a sensor 105, a display unit 106, a user input unit 107, an interface unit 108, a memory 109, and a processor 110.
[0143] Those skilled in the art will appreciate that the electronic device 100 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 110 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 4 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0144] The processor 110 is used to obtain at least two step cycles within a preset time period when the electronic device is in a target state, the target state is used to indicate that the electronic device is in a moving state and is squeezed, and the at least two step cycles are the step cycles of the user when the electronic device is in motion. The processor 110 is also used to determine the squeezing mode of the electronic device according to the at least two step cycles; and determine the altitude value of the electronic device according to the squeezing mode of the electronic device and at least two altitude averages, each altitude average being the average value of the altitude value of the electronic device in one step cycle.
[0145] An embodiment of the present application provides an electronic device. When the electronic device is in motion and is squeezed, the electronic device can determine the squeezing mode of the electronic device based on at least two step cycles of the user during the motion of the electronic device. Therefore, the electronic device can obtain the current altitude value of the electronic device based on the squeezing mode of the electronic device and at least two altitude averages, so that the electronic device is not affected by the squeezing of the electronic device when determining the altitude value, thereby improving the accuracy of determining the altitude value of the electronic device.
[0146] Optionally, in an embodiment of the present application, the processor 110 is specifically used to determine a target extreme difference value based on at least two step cycles, the target extreme difference value being the difference between a first value and a second value in the at least two step cycles, the first value being the average altitude of the step cycle with the largest average altitude in the at least two step cycles, and the second value being the average altitude of the step cycle with the smallest average altitude in the at least two step cycles; and determine the squeezing mode in which the electronic device is squeezed based on the target extreme difference value.
[0147] Optionally, in an embodiment of the present application, the processor 110 is specifically used to determine that the squeezing mode in which the electronic device is squeezed is the first squeezing mode when the target extreme difference value is less than or equal to the first threshold value, and the first squeezing mode is a squeezing mode in which the electronic device is squeezed when it moves in the horizontal direction; or, when the target extreme difference value is greater than the first threshold value, determine that the squeezing mode in which the electronic device is squeezed is the second squeezing mode or the third squeezing mode, the second squeezing mode is a squeezing mode in which the electronic device is squeezed when it moves in a direction perpendicular to the horizontal direction, and the third squeezing mode is a squeezing mode in which the electronic device is squeezed when it moves in the horizontal direction, and the squeezing force of the third squeezing mode is different from the squeezing force of the first squeezing mode.
[0148] Optionally, in an embodiment of the present application, the preset time period includes: at least two time periods, one time period corresponding to a step cycle; the processor 110 is also used to obtain a target force change and a target altitude change when the target extreme difference value is greater than a first threshold value, the target force change being the difference between the maximum value of the squeezing force of a step cycle in the first time period and the maximum value of the squeezing force of a step cycle in the second time period, and the target altitude change being the difference between the average altitude of a step cycle in the first time period and the average altitude of a step cycle in the second time period.
[0149] Processor 110 is specifically used to, when a target force change matches a preset force change: if the target altitude change matches the altitude change corresponding to the preset force change, determine that the electronic device is squeezed in the third squeeze mode; or, if the target altitude change does not match the altitude change corresponding to the preset force change, determine that the electronic device is squeezed in the second squeeze mode; wherein the first time period is the time period closest to the current moment among at least two time periods, the second time period is the time period before the first time period, and the second time period is one of the at least two time periods.
[0150] Optionally, in an embodiment of the present application, the processor 110 is specifically used to determine the average value of the altitude average values of target step cycles in at least two step cycles as the altitude value of the electronic device when the extrusion method is the first extrusion method or the third extrusion method, the target step cycle includes: a step cycle within a first time period, a step cycle within a second time period, and a step cycle within a third time period, the third time period is the previous time period of the second time period, and the third time period is one of the at least two time periods; or, the processor 110 is specifically used to determine the average value of the altitude of a step cycle within a first time period as the altitude value of the electronic device when the extrusion method is the second extrusion method.
[0151] Optionally, in an embodiment of the present application, the processor 110 is further used to process first data when the electronic device is squeezed in a manner that the electronic device is squeezed when it moves in a horizontal direction, and the first data is data generated when the electronic device is squeezed in a horizontal direction; or, the processor 110 is further used to process target data in second data when the electronic device is squeezed in a manner that the electronic device is squeezed when it moves in a direction perpendicular to the horizontal direction, and the second data includes data generated by a change in altitude of the electronic device during movement and target data, and the target data is data generated when the electronic device is squeezed in a direction perpendicular to the horizontal direction.
[0152] The electronic device provided in the embodiment of the present application can implement each process implemented in the above method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described here.
[0153] The beneficial effects of various implementations in this embodiment can be specifically referred to the beneficial effects of the corresponding implementations in the above method embodiment. To avoid repetition, they will not be described again here.
[0154] It should be understood that in the embodiment of the present application, the input unit 104 may include a graphics processor (Graphics Processing Unit, GPU) 1041 and a microphone 1042, and the graphics processor 1041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 106 may include a display panel 1061, and the display panel 1061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 107 includes a touch panel 1071 and at least one of other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include two parts: a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
[0155] The memory 109 can be used to store software programs and various data. The memory 109 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 109 may include a volatile memory or a non-volatile memory, or the memory 109 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 109 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0156] The processor 110 may include one or more processing units; optionally, the processor 110 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 110.
[0157] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0158] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0159] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0160] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0161] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0162] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0163] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0164] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A method for determining altitude, characterized in that: The method comprises: When the electronic device is in a target state, obtaining at least two step cycles within a preset time period, wherein the target state is used to indicate that the electronic device is in a moving state and is squeezed, and the at least two step cycles are the step cycles of the user during the movement of the electronic device; Determine a target extreme value according to the at least two step cycles, the target extreme value being a difference between a first value and a second value in the at least two step cycles, the first value being the average value of the altitude of the step cycle with the largest average value of the altitude in the at least two step cycles, and the second value being the average value of the altitude of the step cycle with the smallest average value of the altitude in the at least two step cycles; Determining, according to the target extreme value, a squeezing mode in which the electronic device is squeezed; The altitude value of the electronic device is determined according to the squeezing mode in which the electronic device is squeezed and at least two altitude averages, each altitude average being an average value of the altitude values of the electronic device within a step cycle.
2. The method according to claim 1, characterized in that The step of determining the squeezing mode in which the electronic device is squeezed according to the target extreme difference value includes: When the target extreme difference value is less than or equal to the first threshold value, determining that the squeezing mode in which the electronic device is squeezed is a first squeezing mode, where the first squeezing mode is a squeezing mode in which the electronic device is squeezed when moving in a horizontal direction; or When the target extreme difference value is greater than the first threshold value, it is determined that the squeezing mode in which the electronic device is squeezed is the second squeezing mode or the third squeezing mode, the second squeezing mode is a squeezing mode in which the electronic device is squeezed when it moves in a direction perpendicular to the horizontal direction, the third squeezing mode is a squeezing mode in which the electronic device is squeezed when it moves in the horizontal direction, and the squeezing force of the third squeezing mode is different from the squeezing force of the first squeezing mode.
3. The method according to claim 2, characterized in that The preset time period includes: at least two time periods, one time period corresponds to one step cycle; when the target extreme difference value is greater than the first threshold value, determining that the squeezing mode of the electronic device is the second squeezing mode or the third squeezing mode includes: When the target extreme difference value is greater than the first threshold value, a target force change and a target altitude change are obtained, wherein the target force change is the difference between the maximum value of the squeezing force of a step cycle in the first time period and the maximum value of the squeezing force of a step cycle in the second time period, and the target altitude change is the difference between the average value of the altitude of a step cycle in the first time period and the average value of the altitude of a step cycle in the second time period; When the target force variation matches the preset force variation: If the target altitude change matches the altitude change corresponding to the preset force change, it is determined that the squeezing mode in which the electronic device is squeezed is the third squeezing mode; or, If the target altitude change does not match the altitude change corresponding to the preset force change, determining that the squeezing mode in which the electronic device is squeezed is the second squeezing mode; The first time period is the time period closest to the current moment among the at least two time periods, the second time period is the time period before the first time period, and the second time period is one of the at least two time periods.
4. The method according to claim 3, characterized in that The step of determining the altitude value of the electronic device according to the squeezing mode in which the electronic device is squeezed and at least two altitude averages includes: In the case where the squeezing method is the first squeezing method or the third squeezing method, the average of the altitude averages of the target step cycles in the at least two step cycles is determined as the altitude value of the electronic device, and the target step cycle includes: a step cycle in the first time period, a step cycle in the second time period, and a step cycle in a third time period, the third time period is the time period before the second time period, and the third time period is one of the at least two time periods; or, In a case where the squeezing method is the second squeezing method, the average altitude of a step cycle within the first time period is determined as the altitude value of the electronic device.
5. A device for determining altitude, characterized in that: The altitude determination device comprises: an acquisition module and a determination module; The acquisition module is used to acquire at least two step cycles within a preset time period when the electronic device is in a target state, the target state is used to indicate that the electronic device is in a moving state and is squeezed, and the at least two step cycles are the step cycles of the user when the electronic device is in motion; The determination module is used to determine a target extreme difference value according to the at least two step cycles, the target extreme difference value is the difference between a first value and a second value in the at least two step cycles, the first value is the average altitude of the step cycle with the largest average altitude in the at least two step cycles, and the second value is the average altitude of the step cycle with the smallest average altitude in the at least two step cycles; and determine a squeezing mode in which the electronic device is squeezed according to the target extreme difference value; and determine an altitude value of the electronic device according to the squeezing mode in which the electronic device is squeezed and at least two altitude averages, each altitude average being an average value of the altitude values of the electronic device within one step cycle.
6. The device according to claim 5, characterized in that The determination module is specifically used to determine that the squeezing mode in which the electronic device is squeezed is a first squeezing mode when the target range value is less than or equal to a first threshold value, and the first squeezing mode is a squeezing mode in which the electronic device is squeezed when it moves in a horizontal direction; or The determination module is specifically used to determine, when the target extreme difference value is greater than a first threshold value, that the squeezing mode in which the electronic device is squeezed is the second squeezing mode or the third squeezing mode, the second squeezing mode is a squeezing mode in which the electronic device is squeezed when it moves in a direction perpendicular to the horizontal direction, the third squeezing mode is a squeezing mode in which the electronic device is squeezed when it moves in the horizontal direction, and the squeezing force of the third squeezing mode is different from the squeezing force of the first squeezing mode.
7. The device according to claim 6, characterized in that The preset time period includes: at least two time periods, one time period corresponds to one step cycle; The acquisition module is further configured to acquire a target force change and a target altitude change when the target extreme difference value is greater than a first threshold value, wherein the target force change is the difference between the maximum value of the squeezing force of a step cycle in the first time period and the maximum value of the squeezing force of a step cycle in the second time period, and the target altitude change is the difference between the average value of the altitude of a step cycle in the first time period and the average value of the altitude of a step cycle in the second time period; The determination module is specifically configured to: when the target force variation matches the preset force variation: If the target altitude change matches the altitude change corresponding to the preset force change, it is determined that the squeezing mode in which the electronic device is squeezed is the third squeezing mode; or, If the target altitude change does not match the altitude change corresponding to the preset force change, determining that the squeezing mode in which the electronic device is squeezed is the second squeezing mode; The first time period is the time period closest to the current moment among the at least two time periods, the second time period is the time period before the first time period, and the second time period is one of the at least two time periods.
8. The device according to claim 7, characterized in that The determination module is specifically used to determine the average of the altitude averages of the target step cycles in the at least two step cycles as the altitude value of the electronic device when the extrusion method is the first extrusion method or the third extrusion method, the target step cycle includes: a step cycle in the first time period, a step cycle in the second time period and a step cycle in a third time period, the third time period is the time period before the second time period, and the third time period is one of the at least two time periods; or, The determination module is specifically configured to determine, when the squeezing method is the second squeezing method, an average altitude value of a step cycle within the first time period as the altitude value of the electronic device.
9. An electronic device, characterized in that: The method comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method for determining altitude as claimed in any one of claims 1 to 4.
10. A readable storage medium, characterized in that: The readable storage medium stores a program or an instruction, and when the program or the instruction is executed by the processor, the steps of the method for determining the altitude as claimed in any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Processing method and device of altitudes
CN106441218A
Altitude data monitoring and displaying method and device, equipment and storage medium
CN113703007A