Data processing method and electronic device

By using secondary accelerometers, secondary gyroscopes, and magnetometers for data fusion processing in foldable electronic devices, and performing axial switching during screen switching, the problem of data inaccuracy caused by changes in the overall coordinate system and device coordinate system is solved, and the accuracy and stability of sensor output data are achieved.

CN120762492BActive Publication Date: 2026-05-01HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HONOR DEVICE CO LTD
Filing Date
2024-05-17
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

In foldable electronic devices, due to the relative positional changes between the overall coordinate system and the device coordinate system, the data output by the sensors cannot accurately reflect the state of the terminal device, especially when the screen is switched, resulting in inaccurate data.

Method used

When a screen switch is detected, data collected by the secondary accelerometer, secondary gyroscope, and magnetometer set in the first plate are fused and processed, and axial switching is performed to ensure that the sensor output data accurately reflects the device status in the second coordinate system.

Benefits of technology

This effectively avoids the problem of inaccurate output data after virtual sensor algorithm fusion, ensuring the accuracy and stability of sensor output data, and accurately reflecting the position and orientation of the terminal device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120762492B_ABST
    Figure CN120762492B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a data processing method and an electronic device, and relate to the technical field of terminals. The method comprises: collecting device state data based on a data collection device arranged in a first board, wherein a coordinate system corresponding to the device state data is a first coordinate system, and the first coordinate system is a whole-machine coordinate system of the terminal device in the case that a first screen is lit. The device state data is processed according to a sensor algorithm corresponding to a first sensor, so as to obtain output data corresponding to the first sensor. In the case that a screen switch is detected, a coordinate system corresponding to the output data is a second coordinate system, and the second coordinate system is a whole-machine coordinate system of the terminal device in the case that a second screen is lit. In this way, the output data corresponding to the first sensor can be ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Data processing methods and electronic equipment Technical Field

[0001] This application relates to the field of terminal technology, and in particular to a data processing method and an electronic device. Background Technology

[0002] By performing axial mapping between the device coordinate system of the electronic sensor and the overall coordinate system of the terminal device, the data collected by the electronic sensor can be located in the overall coordinate system, thereby ensuring that the collected data can accurately reflect the device status of the terminal device.

[0003] However, with the continuous development of technology, the emergence of foldable electronic devices may cause changes in the axial mapping relationship between the overall coordinate system and the device coordinate system. In most current foldable electronic devices, the electronic device is usually placed in a plate on the side with the battery back panel. Because the positions of the device coordinate system and the overall coordinate system do not change in this case, the original axial mapping method can still be used.

[0004] However, with the changes in the overall architecture, some electronic sensors can only be placed in one side panel that contains two screens at the same time. In this case, the relative position of the device coordinate system and the overall coordinate system will change, which will cause the data output by the sensor to not accurately reflect the device status of the terminal device. Summary of the Invention

[0005] This application provides a data processing method and an electronic device, applied in the field of terminal technology, to ensure that the data output by the sensor does not accurately reflect the device status of the terminal device.

[0006] In a first aspect, embodiments of this application propose a data processing method applied to a terminal device. The terminal device includes a first screen and a second screen, and further includes a first board and a second board connected by a connector. At least one data acquisition device is disposed in the first board, and the first screen and the second screen are simultaneously distributed in the first board. The method includes:

[0007] The device status data is collected based on the data acquisition device, wherein the coordinate system corresponding to the device status data is the first coordinate system, which is the overall coordinate system of the terminal device when the first screen is lit.

[0008] The device status data is processed according to the sensor algorithm corresponding to the first sensor to obtain the output data corresponding to the first sensor. When a screen switch is detected, the coordinate system corresponding to the output data is the second coordinate system, which is the overall coordinate system of the terminal device when the second screen is lit.

[0009] In this implementation, data collected by the secondary accelerometer, secondary gyroscope, and magnetometer, all located on the first plate, are fused to obtain the output result corresponding to the first sensor. This effectively avoids the problem of inaccurate output data from the virtual sensor's sensor algorithm fusion when the terminal device is in an intermediate state, caused by the accelerometer, gyroscope, and magnetometer being distributed on different plates. Furthermore, upon detecting a screen switch, this embodiment performs an axial switch on the data to ensure that the output data corresponding to the first sensor is located in the second coordinate system, which is the overall coordinate system of the terminal device after the screen switch. This ensures that the sensor output data accurately reflects the device status, which can be the device's position or orientation.

[0010] In one possible implementation, processing the device status data according to the sensor algorithm corresponding to the first sensor to obtain the output data corresponding to the first sensor includes:

[0011] When a screen switch is detected, the coordinate system corresponding to the device status data is switched from the first coordinate system to the second coordinate system to obtain the device status data after the coordinate system switch.

[0012] The device status data after the coordinate system switch is input into the sensor algorithm to obtain the output data corresponding to the first sensor.

[0013] In this implementation, when a screen switch is detected, the underlying data acquisition device directly performs axial switching on the acquired device status data. This effectively ensures that the output data output by the subsequent sensor algorithm has undergone axial switching, thereby ensuring that the corresponding sensor output data can accurately reflect the device status of the terminal device.

[0014] In one possible implementation, processing the device status data according to the sensor algorithm corresponding to the first sensor to obtain the output data corresponding to the first sensor includes:

[0015] The device status data is input into the sensor algorithm to obtain the initial output data of the first sensor;

[0016] Upon detecting a screen switch, the coordinate system corresponding to the initial output data is switched from the first coordinate system to the second coordinate system to obtain the output data corresponding to the first sensor.

[0017] In this implementation, when a screen switch is detected, the underlying data acquisition device does not switch the axis of the acquired device status data. Instead, after the sensor algorithm processes the data, it switches the axis of the initial output data of the sensor algorithm to ensure that the device status data provided to the sensor algorithm is continuous, thereby improving the accuracy and stability of the initial data obtained by the sensor algorithm.

[0018] In one possible implementation, switching the coordinate system corresponding to the first data from the first coordinate system to the second coordinate system includes:

[0019] When the folding type of the terminal device is left and right folding, the coordinate values ​​corresponding to the first coordinate axis and the coordinate values ​​corresponding to the second coordinate axis in the first data are inverted.

[0020] Wherein, the first coordinate axis is a horizontal coordinate axis parallel to the screen with the upper left corner of the first screen as the origin; the second coordinate axis is an outward coordinate axis perpendicular to the screen with the upper left corner of the first screen as the origin.

[0021] The first data is either the device status data or the initial output data.

[0022] In this implementation, axial switching can be efficiently and effectively handled for terminal devices with a left-right folding type.

[0023] In one possible implementation, switching the coordinate system corresponding to the first data from the first coordinate system to the second coordinate system includes:

[0024] Switching the coordinate system corresponding to the first data from the first coordinate system to the second coordinate system includes:

[0025] When the folding type of the terminal device is vertical folding, the coordinate values ​​corresponding to the third coordinate axis and the coordinate values ​​corresponding to the fourth coordinate axis in the first data are inverted.

[0026] The third coordinate axis is a vertical coordinate axis parallel to the screen, with the top left corner of the first screen as the origin; the fourth coordinate axis is an outward coordinate axis perpendicular to the screen, with the top left corner of the first screen as the origin.

[0027] The first data is either the device status data or the initial output data.

[0028] In this implementation, axial switching can be efficiently and effectively handled for terminal devices with a vertical folding type.

[0029] In one possible implementation, the first coordinate axis is the X-axis, and the second coordinate axis is the Z-axis;

[0030] When the first data contains three-axis coordinate values, the coordinate value corresponding to the first coordinate axis is the X value among the three-axis coordinate values, and the coordinate value corresponding to the second coordinate axis is the Z value among the three-axis coordinate values;

[0031] When the first data contains quaternions, the coordinate value corresponding to the first coordinate axis is the Z value in the quaternion, and the coordinate value corresponding to the second coordinate axis is the Y value in the quaternion.

[0032] In this implementation, whether the first data is in the form of a three-axis coordinate system or a quaternion, the axis switching can be handled accurately and effectively.

[0033] In one possible implementation, the third coordinate axis is the Y-axis, and the fourth coordinate axis is the Z-axis;

[0034] When the first data contains three-axis coordinate values, the coordinate value corresponding to the third coordinate axis is the Y value among the three-axis coordinate values, and the coordinate value corresponding to the fourth coordinate axis is the Z value among the three-axis coordinate values;

[0035] When the first data contains quaternions, the coordinate value corresponding to the third coordinate axis is the X value in the quaternion, and the coordinate value corresponding to the second coordinate axis is the Y value in the quaternion.

[0036] In this implementation, whether the first data is in the form of a three-axis coordinate system or a quaternion, the axis switching can be handled accurately and effectively.

[0037] In one possible implementation, the detection of screen switching includes:

[0038] Obtain the folding state of the terminal device, and / or obtain the folding angle of the terminal device;

[0039] Based on the folding state and / or folding angle, the screen illuminated in the terminal device is switched from the first screen to the second screen. The folding state can also be referred to as the physical state.

[0040] In this implementation, it is possible to accurately and effectively detect whether the terminal device's screen has switched from the first screen to the second screen.

[0041] In one possible implementation, after acquiring device status data based on the data acquisition device, the method further includes:

[0042] The coordinate system corresponding to the device status data is switched from the first coordinate system to the second coordinate system to obtain the device status data after the coordinate system is switched;

[0043] The device status data after the coordinate system switch is sent to the second sensor.

[0044] In this implementation, even for a second sensor that only needs to collect data and does not require algorithm processing, axial switching can be effectively achieved to ensure the accuracy of the device status data provided to the second sensor.

[0045] In one possible implementation, the at least one data acquisition device includes: a compass, an accelerometer, and a gyroscope;

[0046] The acquisition of device status data based on the data acquisition device includes:

[0047] The system acquires compass data based on the compass; and / or acquires acceleration data based on the accelerometer; and / or acquires gyroscope data based on the gyroscope.

[0048] Secondly, embodiments of this application provide an electronic device, including a processor and a memory. The memory stores code instructions, and the processor executes the code instructions to perform the methods described in the first aspect or any possible implementation thereof. The electronic device in this application can be a terminal device, specifically a foldable electronic device.

[0049] In one implementation, the foldable electronic device includes a first screen and a second screen, and the foldable electronic device also includes a first plate and a second plate connected by a connector, wherein at least one data acquisition device is disposed in the first plate, and the first screen and the second screen are simultaneously distributed in the first plate.

[0050] The at least one data acquisition device includes an accelerometer, a gyroscope, and a magnetometer;

[0051] The foldable electronic device is used to perform the methods described in the first aspect or any possible implementation thereof.

[0052] Thirdly, embodiments of this application provide a computer-readable storage medium storing a computer program or instructions that, when executed on a computer, cause the computer to perform the methods described in the first aspect or any possible implementation thereof.

[0053] Fourthly, embodiments of this application provide a computer program product including a computer program, which, when run on a computer, causes the computer to perform the methods described in the first aspect or any possible implementation of the first aspect.

[0054] Fifthly, this application provides a chip or chip system including at least one processor and a communication interface. The communication interface and the at least one processor are interconnected via a circuit. The at least one processor is used to run computer programs or instructions to perform the methods described in the first aspect or any possible implementation thereof. The communication interface in the chip can be an input / output interface, pins, or circuits, etc.

[0055] In one possible implementation, the chip or chip system described above in this application further includes at least one memory storing instructions. The memory can be an internal storage unit of the chip, such as a register or cache, or it can be a storage unit of the chip itself (e.g., read-only memory, random access memory, etc.).

[0056] It should be understood that the second to fifth aspects of this application correspond to the technical solutions of the first aspect of this application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation are similar, and will not be repeated here. Attached Figure Description

[0057] Figure 1 is a schematic diagram illustrating the implementation of the whole machine coordinate system and the device coordinate system provided in the embodiments of this application;

[0058] Figure 2 is a schematic diagram of the structure of the foldable electronic device provided in an embodiment of this application;

[0059] Figure 3 is a second structural schematic diagram of the foldable electronic device provided in an embodiment of this application;

[0060] Figure 4 is a schematic diagram of the mapping relationship of the coordinate system provided in this application;

[0061] Figure 5 is a schematic diagram of the mapping relationship of the coordinate system provided in this application (II);

[0062] Figure 6 is a schematic diagram of the implementation of the sensor in the foldable electronic device provided in this application embodiment;

[0063] Figure 7 is a schematic diagram of the implementation of the sensor in the foldable electronic device provided in this application embodiment;

[0064] Figure 8 is a schematic diagram of the mapping relationship of the coordinate system provided in this application;

[0065] Figure 9 is a schematic diagram of the mapping relationship of the coordinate system provided in this application;

[0066] Figure 10 is a software architecture diagram of the terminal device provided in an embodiment of this application;

[0067] Figure 11 is a second software architecture diagram of the terminal device provided in the embodiment of this application;

[0068] Figure 12 is a software architecture diagram of the terminal device provided in the embodiment of this application;

[0069] Figure 13 is a software architecture diagram of the terminal device provided in the embodiment of this application;

[0070] Figure 14 is a schematic diagram of the hardware structure of a terminal device provided in an embodiment of this application. Detailed Implementation

[0071] To facilitate a clear description of the technical solutions in the embodiments of this application, some terms and technologies involved in the embodiments of this application will be briefly introduced below:

[0072] 1. Accelerometer

[0073] An accelerometer is an electronic sensor used to measure the acceleration of an object. It can detect the magnitude and direction of the object's acceleration, thereby determining the object's position in space and monitoring its motion.

[0074] For example, an accelerometer can return the acceleration values ​​of an object on the three coordinate axes of x, y, and z. Taking the object as a terminal device as an example, the coordinate axes described here can be the coordinate axes in the overall coordinate system of the terminal device.

[0075] 2. Gyroscope

[0076] A gyroscope is an electronic sensor used to measure the angular velocity (i.e., rotational speed) of an object. It can detect the rotation of an object around various axes, thereby monitoring the object's rotation and tilt.

[0077] For example, a gyroscope can return the angular velocity data of an object on the three coordinate axes of x, y, and z. Taking the object as a terminal device as an example, the coordinate axes described here can be the coordinate axes in the overall coordinate system of the terminal device.

[0078] 3. Magnetometer

[0079] A magnetometer is an electronic sensor used to measure the strength and direction of a magnetic field. It detects changes in the Earth's magnetic field or the surrounding magnetic field and converts this information into electrical signals. Magnetometers are commonly used in applications such as navigation, positioning, attitude control, and augmented reality.

[0080] For example, a magnetometer can return the environmental magnetic field data of an object along the x, y, and z coordinate axes. Taking the object as a terminal device as an example, the coordinate axes described here can be the coordinate axes in the overall coordinate system of the terminal device. The environmental magnetic field data can be, for example, magnetic field strength, and the unit can be, for example, μT.

[0081] In terminal devices, a magnetometer can also be understood as a compass, a sensor that measures the direction of the Earth's magnetic field and is typically used for orientation and navigation. For example, a compass can be understood as a specific type of magnetometer.

[0082] In one implementation, the three sensors described above are often used in combination. For example, in a terminal device, accelerometers and gyroscopes are typically used to detect the motion and attitude of the device, while magnetometers are used to determine the orientation of the device, thereby providing the terminal device with more accurate motion and orientation information.

[0083] 4. Rotation Vector Sensor

[0084] A rotation vector (RV) sensor is a virtual sensor in a terminal device that is used to detect the rotation vector of the terminal device.

[0085] The rotation vector represents the orientation of the terminal device in the form of a combination of angles and coordinate axes. Assuming that the terminal device rotates by an angle θ around the coordinate axes of the Northeast-Eastern Celestial Coordinate System (ENU, also known as the station center coordinate system or station coordinate system), the RV sensor will output three data points: x*sin(θ / 2), y*sin(θ / 2), and z*sin(θ / 2).

[0086] Where x*sin(θ / 2) is the rotation vector component of the terminal device along the x-axis of the ENU, y*sin(θ / 2) is the rotation vector component of the terminal device along the y-axis of the ENU, and z*sin(θ / 2) is the rotation vector component of the terminal device along the z-axis of the ENU.

[0087] sin(θ / 2) is used to represent the order of magnitude of the rotation vector (which can also be understood as the size of the rotation vector), and the direction of the rotation vector is the direction of the rotation axis, that is, the direction of the rotation vector is the same as the direction of rotation of the axis.

[0088] Thus, the three data points mentioned above, together with cos(θ / 2), form a quaternion. This quaternion is used to reflect the rotation amplitude of the terminal equipment's overall coordinate system relative to the Northeast-Upper-Heaven coordinate system (ENU, also known as the station center coordinate system or station coordinate system). This quaternion can be represented, for example, as (x, y, z, w), where x corresponds to x*sin(θ / 2), y corresponds to y*sin(θ / 2), z corresponds to z*sin(θ / 2), and w corresponds to sin(θ / 2).

[0089] Therefore, the RV sensor can detect the orientation information of the terminal device. It should be noted that the elements in the rotation vector are unitless.

[0090] Based on the above introduction, it can be understood that a rotation vector uses a combination of angle and axis to express the orientation information of the device. For example, a rotation vector can express that the device has rotated by an angle θ around a certain axis.

[0091] 5. Magnetometer sensor calibration

[0092] The magnetometer calibrate (mag_cal) sensor is also a virtual sensor in the terminal device. Based on the above introduction, it can be determined that the magnetometer is used to return the environmental magnetic field data of an object on the x, y, and z coordinate axes. The mag_cal sensor introduced here is used to calibrate the environmental magnetic field data on the x, y, and z coordinate axes, thereby outputting the offset values ​​of the environmental magnetic field data on the x, y, and z coordinate axes, respectively.

[0093] 6. Geomagnetic Rotation Vector Sensor

[0094] The geomagnetic rotation vector (geomag_RV) sensor is also a virtual sensor in the terminal device. Its function and output data are similar to the rotation vector sensor described above, but the difference lies in:

[0095] Rotational vector sensors process acceleration data, gyroscope data, and magnetometer data to output a quaternion that reflects the device's orientation. However, geomagnetic rotational vector sensors do not use data collected by gyroscopes; instead, they process data collected by magnetometers and accelerometers. Therefore, geomagnetic rotational vector sensors have lower accuracy than ordinary rotational vector sensors, but they also consume less energy.

[0096] Therefore, in actual implementation, the choice of which sensor to use to collect the rotation information of the terminal device can be made based on the actual accuracy and energy consumption requirements.

[0097] It should also be noted that the concept of virtual sensors mentioned above refers to sensors that are not actual hardware entities, but rather pseudo-sensors at the software level that execute a series of sensor algorithms based on data collected by hardware sensors to output corresponding data.

[0098] 7. Uncalibrated magnetic field sensor

[0099] An uncalibrated magnetic field sensor is used to output environmental magnetic field data of the terminal device. For example, an uncalibrated magnetic field sensor is used to output magnetic field strength data of the terminal device in the x-axis, y-axis and z-axis directions.

[0100] 8. Magnetic field sensor

[0101] A magnetic field sensor is similar to the uncalibrated magnetic field sensor described above and is used to output environmental magnetic field data for terminal devices. For example, a magnetic field sensor is used to output magnetic field strength data for the terminal device in the x-axis, y-axis and z-axis directions.

[0102] Meanwhile, the magnetic field sensor is also used to estimate the offset of the output magnetic field strength data in the x-axis direction, the y-axis direction, and the z-axis direction.

[0103] 9. Other terms

[0104] In the embodiments of this application, terms such as "first" and "second" are used to distinguish identical or similar items with substantially the same function and purpose. For example, "first chip" and "second chip" are used only to distinguish different chips and do not limit their order of execution. Those skilled in the art will understand that terms such as "first" and "second" do not limit the quantity or execution order, and that "first" and "second" do not necessarily imply that they are different.

[0105] It should be noted that, in the embodiments of this application, the terms "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design scheme described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.

[0106] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, a--c, bc, or abc, where a, b, and c can be single or multiple.

[0107] 10. Electronic equipment

[0108] The electronic devices in this application embodiment may include handheld devices with foldable screens, vehicle-mounted devices, etc. For example, some electronic devices include: mobile phones, tablets, PDAs, laptops, mobile internet devices (MIDs), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, wireless terminals in industrial control, wireless terminals in self-driving vehicles, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, cellular phones, cordless phones, session initiation protocol (SIP) phones, wireless local loop (WLL) stations, personal digital assistants (PDAs), handheld devices with wireless communication capabilities, computing devices or other processing devices connected to wireless modems, in-vehicle devices, wearable devices, terminal devices in 5G networks, or future evolution of public land mobile communication networks. Terminal devices in a network (PLMN), etc., are not limited to this in the embodiments of this application.

[0109] By way of example and not limitation, in this embodiment, the electronic device may also be a wearable device. Furthermore, in this embodiment, the electronic device may also be a terminal device in an Internet of Things (IoT) system. IoT is an important component of future information technology development, and its main technical feature is connecting objects to networks through communication technologies, thereby realizing an intelligent network of human-machine interconnection and object-to-object interconnection.

[0110] The electronic devices in the embodiments of this application may also be referred to as: terminal equipment, user equipment (UE), mobile station (MS), mobile terminal (MT), access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication equipment, user agent, or user device, etc.

[0111] In this embodiment, the electronic device or various network devices include a hardware layer, an operating system layer running on top of the hardware layer, and an application layer running on top of the operating system layer. The hardware layer includes hardware such as a central processing unit (CPU), a memory management unit (MMU), and memory (also called main memory). The operating system can be any one or more computer operating systems that implement business processing through processes, such as Linux, Unix, Android, iOS, or Windows. The application layer includes applications such as browsers, address books, word processing software, and instant messaging software.

[0112] Based on the above introduction, the relevant technical background involved in this application will be further described in detail below.

[0113] Terminal devices typically incorporate multiple sensors to collect relevant device information. For example, they may include electronic sensors such as accelerometers, gyroscopes, and magnetometers, as described above, to collect motion and orientation information. The sensors used in a terminal device are not limited to those described herein; the specific sensor configuration can be selected based on actual needs, and this embodiment does not impose any restrictions.

[0114] It is also understandable that defining a clear coordinate system is crucial before collecting motion and direction information. Only when the coordinate system is determined can motion and direction information be effectively represented based on coordinate data.

[0115] In one implementation, a coordinate system for the terminal device and a device coordinate system for the electronic sensor are typically defined. The coordinate system for the terminal device and the device coordinate system for the electronic sensor are usually set independently, meaning that these two coordinate systems may not overlap.

[0116] In order to ensure that the data collected by the sensor can accurately reflect the relevant information of the terminal device, it is usually necessary to map the sensor's device coordinate system and the terminal device's overall coordinate system. This mapping process maps the data collected by the sensor into the terminal device's overall coordinate system, thereby effectively representing the relevant information of the terminal device.

[0117] The following is a brief introduction to the overall coordinate system of the terminal device and the device coordinate system of the sensor, as well as the mapping relationship between the coordinate systems, with reference to Figure 1. Figure 1 is a schematic diagram of the implementation of the overall coordinate system and the device coordinate system provided in the embodiment of this application.

[0118] Referring to Figure 1, a terminal device 10 and a sensor 101 disposed in the terminal device are shown. Figure 1 also shows that the front side of the terminal device 10 is a screen, and the rear side is a back panel.

[0119] In the current Android architecture, the overall coordinate system of the terminal device is clearly defined. Specifically, the origin of the overall coordinate system is the top left corner of the terminal device screen. In the example in Figure 1, O_ue represents the origin of the overall coordinate system of the terminal device 10.

[0120] Furthermore, the horizontal direction parallel to the screen is defined as the X-axis. More specifically, the direction to the right of the origin of the coordinate system is defined as the positive direction of the X-axis. In the example in Figure 1, X_ue represents the X-axis of the overall coordinate system of the terminal device 10.

[0121] Furthermore, the vertical direction parallel to the screen is defined as the Y-axis. More specifically, the direction downward from the origin of the coordinate system is defined as the positive direction of the Y-axis. In the example in Figure 1, Y_ue represents the Y-axis of the overall coordinate system of the terminal device 10.

[0122] Furthermore, the direction perpendicular to the screen is defined as the Z-axis. More specifically, the direction facing outward from the screen is defined as the positive direction of the Z-axis (which can also be understood as the direction from the back panel to the screen). In the example in Figure 1, Z_ue represents the Z-axis of the overall coordinate system of the terminal device 10.

[0123] The sensor's device coordinate system will now be introduced in conjunction with Figure 1.

[0124] The sensor's device coordinate system can be defined by the developer or the manufacturer; this embodiment does not impose any restrictions. In short, the sensor's device coordinate system can be flexibly defined according to actual needs. In one implementation, the device coordinate system defined for the sensor can be as shown in Figure 1.

[0125] Referring to Figure 1, for example, the upper right corner of the sensor can be taken as the origin of the device coordinate system. In the example of Figure 1, O_sen represents the origin of the device coordinate system of sensor 101. In Figure 1, sen represents sensor.

[0126] Furthermore, the horizontal direction parallel to the target plane of the sensor is defined as the X-axis. More specifically, the direction to the left of the origin of the coordinate system is defined as the positive direction of the X-axis. In the example of Figure 1, X_sen represents the X-axis of the device coordinate system of sensor 101.

[0127] Furthermore, the vertical direction parallel to the target plane of the sensor is defined as the Y-axis. More specifically, the direction downward from the origin of the coordinate system is defined as the positive direction of the Y-axis. In the example of Figure 1, Y_sen represents the Y-axis of the device coordinate system of sensor 101.

[0128] Furthermore, the direction perpendicular to the target plane of the sensor is defined as the Z-axis. More specifically, the direction facing outward from the screen is defined as the positive direction of the Z-axis (which can also be understood as the direction from the back panel to the screen). In the example of Figure 1, Z_sen represents the Z-axis of the device coordinate system of sensor 101.

[0129] Further explanation of the target plane follows. In the example of Figure 1, assuming the six planes of the sensor are sequentially named the front, back, left side, right side, top side, and bottom side, the target plane of the sensor can be understood as either the front or the back. In actual implementation, the specific definition of the target plane can be set according to actual needs; this embodiment does not impose any restrictions on this.

[0130] As can be seen from the above introduction, the coordinate system of the terminal device has a standard definition, while the coordinate system of the sensor can be flexibly set according to actual needs. This means that the coordinate system of the sensor and the coordinate system of the terminal device may not coincide.

[0131] Therefore, it is necessary to determine the mapping relationship between the sensor's device coordinate system and the terminal device's overall coordinate system. For example, in the example in Figure 1, the mapping relationship between these two coordinate systems can be determined as follows: -X_sen = X_ue, Y_sen = Y_ue, and -Z_sen = Z_ue.

[0132] In actual implementation, the mapping relationship between the overall coordinate system of the terminal device and the device coordinate system of the sensor can be determined according to the actual situation, and this embodiment does not impose any restrictions on this. The application process of the mapping relationship between coordinate systems will be introduced below.

[0133] When sensors collect data, they typically do so based on the sensor's device coordinate system. Therefore, the raw data collected by the sensor is data in the device coordinate system. For example, the raw data collected by the sensor can be represented as (a, b, c), where a is the data on the X-sen axis, b is the data on the Y-sen axis, and c is the data on the Z-sen axis.

[0134] Subsequently, in order to ensure that the data collected by the sensor can effectively represent the device information of the terminal device, it is also necessary to map the raw data collected by the sensor from the device coordinate system to the overall coordinate system. Referring to the mapping relationship introduced in Figure 1 above, the data after axial mapping can be determined as (-a, b, -c), where -a is the data on the X_ue axis, b is the data on the Y_ue axis, and -c is the data on the Z_ue axis.

[0135] Therefore, it can be understood that the data after axial mapping is located in the overall coordinate system of the terminal device, thus effectively indicating the device information of the terminal device. Typically, sensors perform axial mapping on the collected data before outputting it to ensure that the sensor outputs device information of the terminal device located in the overall coordinate system.

[0136] The above, together with Figure 1, illustrates the mapping relationship between the overall coordinate system of the terminal device and the device coordinate system of the sensor. However, Figure 1 is based on a traditional terminal device. In a traditional terminal device, the mapping relationship between the overall coordinate system and the device coordinate system is fixed. By directly performing axial mapping according to the fixed mapping relationship, the sensor can correctly output the device information of the terminal device.

[0137] However, with the continuous development of technology, the emergence of flexible screens has broken the original display method of display devices. Foldable electronic devices can improve the efficiency of information interaction many times over by simply folding once or multiple times. In the future, multiple folding and roll-up designs can completely subvert the way information is interacted. Foldable electronic displays can not only flexibly change and switch modes according to different usage scenarios, but also provide high screen ratio and clarity, gradually becoming a hot research topic.

[0138] In foldable electronic devices, the mapping relationship between the overall coordinate system and the device coordinate system presents another issue that needs to be considered. Therefore, the coordinate system mapping relationship in foldable electronic devices will be explained below.

[0139] First, let's briefly explain foldable electronic devices with reference to the illustrations. The folding types of foldable electronic devices can include left and right folding (also known as vertical folding, vertical folding, or large folding) and up and down folding (also known as horizontal folding, horizontal folding, or small folding).

[0140] The following description, in conjunction with Figures 2 and 3, illustrates the two folding types respectively. Figure 2 is a schematic diagram of the structure of the foldable electronic device provided in the embodiment of this application, and Figure 3 is a schematic diagram of the structure of the foldable electronic device provided in the embodiment of this application.

[0141] First, let's introduce foldable devices with a left-right folding type, referring to Figure 2:

[0142] As shown in Figure 2, the foldable electronic device includes a first plate 201 and a second plate 202, which are connected by a connector. The first plate 201 and the second plate 202 are typically hinged, allowing them to rotate relative to each other, thus enabling them to be folded or unfolded.

[0143] During the opening and closing process of the foldable electronic device, the first plate 201 and the second plate 202 can rotate relative to each other along the arrow directions in (a) and (b) of Figure 2, thereby changing the included angle between the first plate 201 and the second plate 202. The foldable electronic device can go through three physical states, namely the folded state, the intermediate state and the unfolded state.

[0144] Referring to Figure 2(a), when the angle between the first plate 201 and the second plate 202 is 180°, the foldable electronic device can be understood to be in an unfolded state. Referring to Figure 2(b), when the angle between the first plate 201 and the second plate 202 is within the range of 0° to 180°, the foldable electronic device can be understood to be in an intermediate state. Referring to Figure 2(c), when the angle between the first plate 201 and the second plate 202 is 0°, the foldable electronic device can be understood to be in a folded state.

[0145] As can be seen from Figure 2, the first plate 201 and the second plate 202 are respectively distributed on the left and right sides of the foldable electronic device, so this folding type can be called left-right folding.

[0146] The foldable electronic device also includes a first screen 203 and a second screen 204. Referring to Figure 2(a), the screens distributed on the first plate 201 and the second plate 202 can be understood as the first screen 203. When the foldable electronic device is in the unfolded state, the first screen 203 is lit. When the foldable electronic device is in the folded state, the first screen 203 is folded between the first plate 201 and the second plate 202, and at this time the first screen 203 is in the off state. Therefore, the first screen 203 can also be called the inner screen.

[0147] Furthermore, referring to Figure 2(c), the screen distributed on the other side of the first panel 201 can be understood as the second screen 204. Because the second screen 204 is not folded between the two panels and is always located on the outside of the terminal device, it can also be called the outer screen. It can be understood that when the foldable electronic device is in the unfolded state, the second screen 204 is located on the back of the electronic device and is usually in an off state. When the foldable electronic device is in the folded state, the second screen rotates with the second panel 202 to the front of the electronic device, thereby illuminating the second screen 304.

[0148] Next, referring to Figure 3, we will introduce foldable devices with a vertical folding type:

[0149] As shown in Figure 3, the foldable electronic device includes a first plate 301 and a second plate 302, wherein the first plate 301 and the second plate 302 are connected by a connector. The specific implementation of the first plate and the second plate is similar to that described in the above embodiment, and will not be repeated here.

[0150] Similarly, during the opening and closing process of the foldable electronic device, the first plate 301 and the second plate 302 can rotate relative to each other along the arrow directions in (a) and (b) of Figure 3, thereby changing the included angle between the first plate 301 and the second plate 302. The foldable electronic device can then experience three physical states: folded state, intermediate state, and unfolded state.

[0151] The correspondence between the physical state of the foldable electronic device and the included angle between the two plates is similar to that described in the above embodiments, and will not be repeated here.

[0152] As can be seen from Figure 3, the first plate 301 and the second plate 302 are respectively distributed on the upper and lower sides of the foldable electronic device, so this type of folding can be called vertical folding.

[0153] The foldable electronic device also includes a first screen 303 and a second screen 304. The implementation of the first screen and the second screen is similar to that described in the above embodiments, and will not be repeated here.

[0154] Based on the descriptions in Figures 2 and 3 above, this embodiment can further define the first plate and the second plate. In this embodiment, the plate on one side where the terminal device is mounted on both sides is referred to as the first plate, and the plate on one side where the terminal device is mounted on the screen and the back plate opposite the screen is mounted on the back plate is referred to as the second plate.

[0155] For example, in the example of Figure 2 above, the first plate 201 has a first screen 203 of the terminal device on one side and a second screen 204 of the terminal device on the other side. The second plate 202 has the first screen 203 of the terminal device on one side and typically has the back panel of the terminal device on the other side.

[0156] Similarly, in the example of Figure 3, the first panel 301 has a first screen 303 of the terminal device on one side and a second screen 304 of the terminal device on the other side. The second panel 302 has the first screen 303 of the terminal device on one side and typically has the back panel of the terminal device on the other side.

[0157] Furthermore, in the examples described in Figures 2 and 3 above, the first screen represents the inner screen and the second screen represents the outer screen. Alternatively, the outer screen can be represented as the first screen and the inner screen as the second screen. This embodiment will not describe this approach. In other words, the concepts of the first screen and the second screen in this application are not bound to the concepts of inner screen and outer screen, and can be arbitrarily adjusted according to actual needs.

[0158] Based on the above introduction to foldable electronic devices, it can be determined that as the physical state of the foldable electronic device changes, the illuminated screen in the foldable electronic device may switch. That is to say, in different physical states, the illuminated screen may be the inner screen or the outer screen.

[0159] The overall coordinate system of the terminal device is defined with the top left corner of the screen as the origin. Therefore, the overall coordinate system of the terminal device is different when the inner screen is lit and when the outer screen is lit. However, the device coordinate system is always fixed. This means that when the screen of the terminal device is switched, the mapping relationship between the overall coordinate system and the device coordinate system may change.

[0160] To address the potential changes in axial mapping introduced by foldable electronic devices, the commonly used technical solution is to place the sensor in the second plate of the foldable electronic device. This is because when the sensor is placed in the second plate, the axial mapping of the two coordinate systems does not change. The reason for the unchanged mapping relationship will be analyzed below with reference to Figures 4 and 5.

[0161] First, we will explain the folding type of the foldable electronic device as a left-right folding, referring to Figure 4. Figure 4 is a schematic diagram of the coordinate system mapping relationship provided in this application. The meanings of the various symbols in Figure 4 are similar to those described in the above embodiments, and will not be repeated here.

[0162] As shown in Figure 4, assuming the sensor is located in the second plate 202, and to clearly indicate the change in the sensor's position, different filling effects are used to represent the two surfaces of the sensor.

[0163] When the foldable electronic device is in the unfolded state shown in Figure 4(a), the lit screen is the first screen 203 (i.e., the inner screen). At this time, the origin of the overall coordinate system is the upper left corner of the first screen 203, and the coordinate axes of the overall coordinate system are determined as described above. The mapping relationship between the overall coordinate system of the electronic device and the device coordinate system of the sensor is: -X_sen = X_ue, Y_sen = Y_ue, and -Z_sen = Z_ue.

[0164] Furthermore, when the foldable electronic device is in the folded state shown in Figure 4(b), the lit screen has already switched to the second screen 204 (that is, the outer screen). Then the origin of the whole coordinate system becomes the upper left corner of the second screen 204, and the coordinate axes of the whole coordinate system are still determined in the manner described above, thus presenting the whole coordinate system shown in Figure 4(b).

[0165] At this time, the screen switching will cause the terminal device to use another screen as a reference to determine the overall coordinate system, and the axial mapping relationship between the device coordinate system and the overall coordinate system may change.

[0166] However, when the sensor is set in the second plate 202, although the terminal device re-determines the overall coordinate system according to the newly lit screen when switching from the inner screen display to the outer screen display, the overall coordinate system before and after the change actually coincides. The device coordinate system of the sensor set in the second plate 202 remains unchanged. Therefore, the axial mapping relationship between the device coordinate system and the overall coordinate system remains unchanged.

[0167] As shown in Figure 4(b), the mapping relationship between the overall coordinate system of the electronic device and the device coordinate system of the sensor is still: -X_sen=X_ue, Y_sen=Y_ue, and -Z_sen=Z_ue.

[0168] Next, referring to Figure 5, we will explain the folding type of the foldable electronic device as a vertical fold. Figure 5 is a schematic diagram of the coordinate system mapping relationship provided in this application. The meanings of the various symbols in Figure 5 are similar to those described in the above embodiments, and will not be repeated here.

[0169] As shown in Figure 5, assuming the sensor is located in the second plate 302, when the foldable electronic device is in the unfolded state shown in Figure 5(a), the lit screen is the first screen 303 (i.e., the inner screen). At this time, the origin of the overall coordinate system is the upper left corner of the first screen 303, and the coordinate axes of the overall coordinate system are still determined as described above. The mapping relationship between the overall coordinate system of the electronic device and the device coordinate system of the sensor is: -X_sen = X_ue, Y_sen = Y_ue, and -Z_sen = Z_ue.

[0170] Furthermore, when the foldable electronic device is in the folded state shown in Figure 5(b), the lit screen has already switched to the second screen 304 (that is, the outer screen). The origin of the coordinate system of the whole device becomes the upper left corner of the second screen 304, and the coordinate axes of the whole device coordinate system are still determined in the manner described above, thus presenting the whole device coordinate system shown in Figure 5(b).

[0171] Similar to the embodiments described above, as shown in Figure 5(b), the mapping relationship between the overall coordinate system of the electronic device and the device coordinate system of the sensor is still: -X_sen=X_ue, Y_sen=Y_ue, and -Z_sen=Z_ue.

[0172] Referring to Figures 4 and 5, it can be confirmed that if the sensor is placed in the second plate, the coordinate axis mapping relationship between the device coordinate system and the overall machine coordinate system will not change. Therefore, this is the setting in most folding machine projects.

[0173] The sensors set in the foldable electronic device will be briefly explained below with reference to Figure 6. Figure 6 is a schematic diagram of the implementation of setting sensors in the foldable electronic device provided in the embodiment of this application.

[0174] As shown in Figure 6, a first accelerometer, a second gyroscope, and a first magnetometer can typically be installed in the second board 202. The first accelerometer can also be called the main accelerometer, and the first gyroscope can also be called the main gyroscope. The accelerometer and gyroscope can be two separate devices. Alternatively, in one implementation, the accelerometer and gyroscope installed in the second board can be a single device coupled together, for example, it can be called a main A+G device, used to simultaneously perform the functions of an accelerometer and a gyroscope.

[0175] Furthermore, a second accelerometer and a second gyroscope are also provided in the first board 201, wherein the second accelerometer can also be referred to as a secondary accelerometer, and the second gyroscope can also be referred to as a secondary gyroscope. Similarly, the accelerometer and the gyroscope can be two separate devices. Alternatively, in one implementation, the accelerometer and gyroscope provided in the first board can also be a single device coupled together, for example, it can be referred to as a secondary A+G device, used to simultaneously implement the functions of an accelerometer and a gyroscope.

[0176] The first and second accelerometers serve the same purpose: one acts as the primary sensor for data acquisition, while the other serves as a backup to improve the stability and completeness of the data collected. The first and second gyroscopes are similarly designed.

[0177] As can be confirmed from the above description, when the sensor is set on the second motherboard, the axial mapping relationship between the device coordinate system and the global coordinate system will not change. Therefore, in current traditional solutions, the main accelerometer, main gyroscope and magnetometer set on the second motherboard are usually used for data acquisition.

[0178] However, with the changes in the overall architecture of foldable electronic devices, the magnetic field environment has become more complex. Therefore, in some current foldable device projects, the magnetometer can only be set in the first motherboard. For example, you can refer to Figure 7 for understanding. Figure 7 is a schematic diagram of the implementation of setting sensors in foldable electronic devices provided in this application embodiment.

[0179] The accelerometer and gyroscope in Figure 7 are similar to those described in the above embodiments, except that the magnetometer is located in the first motherboard 201.

[0180] It should also be noted that Figures 6 and 7 are based on an example of an electronic device that folds horizontally. The sensor setup is similar for electronic devices that fold vertically, so it will not be repeated in this embodiment.

[0181] It's important to understand that if the sensor is placed on the first motherboard, the axial mapping issue described above will occur. This will be explained in detail below with specific illustrations.

[0182] First, we will explain the folding type of the foldable electronic device as a left-right folding, referring to Figure 8. Figure 8 is a schematic diagram of the coordinate system mapping relationship provided in this application. The meanings of the various symbols in Figure 8 are similar to those described in the above embodiments, and will not be repeated here.

[0183] As shown in Figure 8, assuming the sensor is placed in the first plate 201, and to clearly indicate the change in the sensor's position, different filling effects are used to represent the two surfaces of the sensor.

[0184] When the foldable electronic device is in the unfolded state shown in Figure 8(a), the lit screen is the first screen 203 (i.e., the inner screen). At this time, the origin of the overall coordinate system is the upper left corner of the first screen 203, and the coordinate axes of the overall coordinate system are determined as described above. The mapping relationship between the overall coordinate system of the electronic device and the device coordinate system of the sensor is: -X_sen = X_ue, Y_sen = Y_ue, and -Z_sen = Z_ue.

[0185] Furthermore, when the foldable electronic device is in the intermediate state shown in Figure 8(b), assuming that the screen that is lit up at this time is still the first screen 203, the origin of the coordinate system is still the upper left corner of the first screen 203, and the coordinate axes of the whole coordinate system are still determined in the manner described above, which presents the whole coordinate system shown in Figure 4(b).

[0186] Furthermore, when the sensor is placed on the first plate, the relative position between the sensor and the first plate is fixed. If the position of the whole coordinate system changes with the movement of the first plate, then the position of the device coordinate system also changes in the same way with the movement of the first plate. Therefore, the whole coordinate system and the device coordinate system still maintain the same mapping relationship.

[0187] In other words, as long as the screen that is lit is still the first screen 203, the mapping relationship between the overall coordinate system of the electronic device and the device coordinate system of the sensor is still: -X_sen=X_ue, Y_sen=Y_ue, and -Z_sen=Z_ue.

[0188] Furthermore, when the foldable electronic device is in the folded state shown in Figure 8(c), the lit screen has already switched to the second screen 204 (that is, the outer screen). The origin of the whole coordinate system becomes the upper left corner of the second screen 204, and the coordinate axes of the whole coordinate system are still determined in the manner described above, thus presenting the whole coordinate system shown in Figure 8(c).

[0189] At this time, the screen switching will cause the terminal device to use another screen as a reference to determine the overall coordinate system, and the axial mapping relationship between the device coordinate system and the overall coordinate system may change.

[0190] Referring to Figure 8, when the terminal device switches from the inner screen display to the outer screen display, the terminal device re-determines the overall coordinate system according to the newly lit screen. However, the overall coordinate system before and after the change actually coincides. But because the sensor is set in the first plate 201, the sensor rotates synchronously with the rotation of the first plate. Therefore, the corresponding sensor device coordinate system also rotates accordingly, while the overall coordinate system actually remains in its original direction. This causes a change in the axial mapping relationship between the device coordinate system and the overall coordinate system.

[0191] As shown in Figure 8(c), the mapping relationship -X_sen=X_ue, Y_sen=Y_ue, and -Z_sen=Z_ue is no longer correct. The mapping relationship between the device coordinate system and the whole machine coordinate system becomes: X_sen=X_ue, Y_sen=Y_ue, and Z_sen=Z_ue.

[0192] Next, referring to Figure 9, we will explain the folding type of the foldable electronic device as a vertical fold. Figure 9 is a schematic diagram of the coordinate system mapping relationship provided in this application. The meanings of the various symbols in Figure 9 are similar to those described in the above embodiments, and will not be repeated here.

[0193] As shown in Figure 9, assuming the sensor is placed in the first plate 301, and to clearly indicate the change in the sensor's position, different filling effects are used to represent the two surfaces of the sensor.

[0194] When the foldable electronic device is in the unfolded state shown in Figure 9(a), the lit screen is the first screen 303 (i.e., the inner screen). At this time, the origin of the overall coordinate system is the upper left corner of the first screen 303, and the coordinate axes of the overall coordinate system are determined as described above. The mapping relationship between the overall coordinate system of the electronic device and the device coordinate system of the sensor is: -X_sen = X_ue, Y_sen = Y_ue, and -Z_sen = Z_ue.

[0195] Furthermore, when the foldable electronic device is in the intermediate state shown in Figure 9(b), assuming that the screen that is lit up at this time is still the first screen 303, similar to the description in Figure 8 above, as long as the screen that is lit up is still the first screen 303, the mapping relationship between the overall coordinate system of the electronic device and the device coordinate system of the sensor is still: -X_sen=X_ue, Y_sen=Y_ue, and -Z_sen=Z_ue.

[0196] Furthermore, when the foldable electronic device is in the folded state shown in Figure 9(c), the screen that is lit up has already switched to the second screen 304 (that is, the outer screen). Then the origin of the coordinate system of the whole device becomes the upper left corner of the second screen 204, and the coordinate axes of the whole device coordinate system are still determined in the manner described above, thus presenting the whole device coordinate system shown in Figure 9(c).

[0197] Referring to Figure 9, when the terminal device switches from the inner screen display to the outer screen display, the terminal device re-determines the overall coordinate system according to the newly lit screen. However, the overall coordinate system before and after the change actually coincides. But because the sensor is set in the first plate 301, the sensor rotates synchronously with the rotation of the first plate. Therefore, the corresponding sensor device coordinate system also rotates accordingly, while the overall coordinate system actually remains in its original direction. This causes a change in the axial mapping relationship between the device coordinate system and the overall coordinate system.

[0198] As shown in Figure 9(c), the mapping relationship of -X_sen=X_ue, Y_sen=Y_ue, and -Z_sen=Z_ue is no longer correct. The mapping relationship between the device coordinate system and the whole machine coordinate system becomes: -X_sen=X_ue, -Y_sen=Y_ue, and Z_sen=Z_ue.

[0199] Referring to Figures 8 and 9, it can be determined that if the sensor is placed in the first plate, the coordinate axis mapping relationship between the device coordinate system and the overall coordinate system will change.

[0200] The above describes the mapping relationship between the device coordinate system of the electronic sensor and the overall coordinate system of the terminal device when an electronic sensor is set in the terminal device. In addition to the physical electronic sensor, the terminal device typically also has multiple virtual sensors. These virtual sensors require data fusion processing from the data collected by multiple electronic sensors to output the calculation results corresponding to the virtual sensors.

[0201] For example, the virtual sensors such as the RV sensor, mag_cal sensor, geomag_RV sensor, uncalibrated magnetic field sensor, and magnetic field sensor mentioned above need to be fused based on the data collected by at least one of the devices, such as magnetometer, accelerometer, and gyroscope, in order to output their respective corresponding data calculation results.

[0202] For foldable electronic devices with magnetometers integrated into the first plate, since accelerometers and gyroscopes are located in both the first and second plates, the fusion processing of virtual sensors requires careful consideration of which electronic sensor's data to use. Furthermore, after selecting a particular electronic sensor for data acquisition, it's necessary to consider how to perform axial mapping on the acquired data to ensure accurate device data is obtained.

[0203] To address this problem, the inventors proposed several solutions during the research process, as follows:

[0204] Firstly, we propose Option 1: Combine data collected by the magnetometer in the first plate and the accelerometer and gyroscope in the second plate for fusion processing.

[0205] In other words, the data collected by the magnetometer in the first plate, the main accelerometer in the second plate, and the main gyroscope in the second plate are fused together. The data fusion of the virtual sensors can be understood in conjunction with Figure 10, which is a software architecture diagram of the terminal device provided in this embodiment.

[0206] As shown in Figure 10, the software architecture of a terminal device may include a driver layer, an algorithm layer, a HAL layer (hardware abstraction layer), a framework layer, and an application layer.

[0207] The drive layer includes the main accelerometer, main gyroscope, and magnetometer described above. As can be understood from the above, the main accelerometer and main gyroscope are located in the first plate; therefore, the device status data collected by the main accelerometer and main gyroscope does not require axial switching, and can directly output the collected device status data.

[0208] In this embodiment, the magnetometer is installed in the first plate. Therefore, the coordinate axis mapping relationship between the magnetometer's device coordinate system and the terminal device's overall coordinate system will change. Thus, for the device status data collected by the magnetometer, the axial mapping relationship needs to be adjusted. In this embodiment, the operation of adjusting the axial mapping relationship is called axial switching.

[0209] Referring to Figure 10, the magnetometer can switch the axis based on the collected equipment status data, and then output the equipment status data after the axis switch (the collected data and equipment status data shown in Figure 10 are the same concept).

[0210] Furthermore, the device status data collected by the accelerometer is specifically acceleration data, the device status data collected by the gyroscope is specifically gyroscope data, and the device status data collected by the magnetometer is specifically magnetic field data.

[0211] After the electronic sensor in the driving layer outputs the collected device status data, the algorithm corresponding to the virtual sensor will perform fusion processing based on the device status data output by the electronic sensor to obtain the output data corresponding to the virtual sensor.

[0212] Referring to Figure 10, the algorithm layer includes algorithm a corresponding to the geomag_RV sensor, algorithm b corresponding to the RV sensor, and algorithm c corresponding to the mag_cal sensor. In one implementation, algorithm b corresponding to the RV sensor and algorithm a corresponding to the mag_cal sensor can also be coupled together in the algorithm layer to jointly output the output data corresponding to the RV sensor and the mag_cal sensor.

[0213] For example, algorithms a, b, and c shown in Figure 10 all take acceleration data, gyroscope data, and magnetic field data as input, and after performing their respective fusion processing, output the output data corresponding to each virtual sensor. For example, algorithms a, b, and c can also use at least one of acceleration data, gyroscope data, and magnetic field data as input to perform the corresponding fusion processing.

[0214] Referring to Figure 10, it can also be understood that algorithm c corresponding to the mag_cal sensor is used to process the offset value of the obtained magnetic field data. In one implementation, the offset output by algorithm c can also be used as the input to algorithm a corresponding to the geomag_RV sensor, so that algorithm a achieves its corresponding purpose. In actual implementation, the specific input and output of the algorithm can be set according to actual needs, and this embodiment does not impose any restrictions on this.

[0215] In one implementation, when performing fusion processing, the algorithm can, for example, use a nine-axis fusion algorithm to fuse the data collected by the three electronic sensors to obtain the output results corresponding to the virtual sensor.

[0216] As shown in Figure 10, the specific virtual sensors are deployed in the HAL layer of the terminal device. After the virtual sensors in the algorithm layer calculate the output data corresponding to each virtual sensor, each virtual sensor in the HAL layer can obtain its corresponding output data, thereby obtaining the data calculation results corresponding to the virtual sensors.

[0217] Referring to Figure 10, it can also be determined that a magnetic field sensor and an uncalibrated magnetic field sensor are deployed in the HAL layer. The magnetic field sensor and the uncalibrated magnetic field sensor do not need to rely on the algorithm for data fusion, so they can directly obtain the output of the driving layer and thus obtain the output data corresponding to each of the two sensors.

[0218] As shown in Figure 10, uncalibrated magnetic field data can be obtained by directly using the data provided by the magnetometer as its output data, and magnetic field data can be obtained by using the data provided by the magnetometer and the offs output by algorithm c as its output data.

[0219] After the virtual sensor in the HAL layer acquires the corresponding output data, it can further provide the output data of the virtual sensor to the sensor service in the framework layer. Then, the sensor service in the framework layer can further provide the output data of the virtual sensor to the application in the application layer, thereby providing the application with the location and orientation information of the terminal device.

[0220] The application in the application layer can be any application that needs to obtain the location and direction information of the terminal device, such as the compass application, navigation application, etc. of the terminal device. This embodiment does not limit this.

[0221] Referring to Figure 10 above, it can be understood that the current approach in Scheme 1 involves fusing data collected from the main accelerometer, main gyroscope, and magnetometer to obtain the output data corresponding to the virtual sensor. Simultaneously, the magnetometer performs axial switching at the drive layer; therefore, the magnetometer output is the data collected after axial switching.

[0222] This implementation only requires the magnetometer to switch axes at the underlying level for the acquired data, making it relatively simple. However, the inventors discovered some flaws in this approach. Specifically, the algorithm corresponding to the virtual sensor requires that the coordinate systems corresponding to the data acquired by the electronic sensors be in the same direction when fusing the data. In other words, the coordinate systems corresponding to the data acquired by each electronic sensor should overlap.

[0223] However, when the foldable electronic device is in an intermediate state, there are angles between the coordinate systems of the magnetometer in the first plate, the main accelerometer in the second plate, and the main gyroscope in the second plate. This causes inaccurate output results from the virtual sensor algorithm after data fusion processing. To solve this problem, rotation of the device coordinate systems may be required, making the implementation of the solution more complex.

[0224] After analyzing Scheme 1, the inventor found that the problem with Scheme 1 was that there was an angle between the coordinate system of the magnetometer and the coordinate systems of the main accelerometer and the main gyroscope. The root cause was that the magnetometer was set in the first plate, while the main accelerometer and the main gyroscope were set in the second plate, so the above-mentioned problem was unavoidable.

[0225] Based on this analysis, the inventors further proposed the following second solution: fusing data collected by the magnetometer and accelerometer in the first plate with the gyroscope.

[0226] In other words, the data collected by the magnetometer in the first plate, the secondary accelerometer in the first plate, and the secondary gyroscope in the second plate are fused together. In this case, since the magnetometer, the secondary accelerometer, and the secondary gyroscope are all located in the first plate, the coordinate systems of these three devices do not have any included angles, thus avoiding the problem that exists in Scheme 1.

[0227] The data fusion of virtual sensors in the current solution can be understood in conjunction with Figure 11, which is the second software architecture diagram of the terminal device provided in the embodiment of this application.

[0228] The parts shown in Figure 11 are similar to those in Figure 10. The difference is that Figure 11 uses data collected by the secondary accelerometer, secondary gyroscope and magnetometer in the driving layer for algorithm fusion processing, which can effectively avoid the problem of inaccurate data in the intermediate state.

[0229] Meanwhile, since the secondary accelerometer, secondary gyroscope, and magnetometer are all located in the first motherboard, as shown in Figure 11, the secondary accelerometer, secondary gyroscope, and magnetometer all need to switch axes according to the collected device status data.

[0230] Based on Figure 11, the steps of the current scheme two can be understood as follows:

[0231] S1101. Collect device status data based on data acquisition device, wherein the coordinate system corresponding to the device status data is the first coordinate system, which is the overall coordinate system of the terminal device when the first screen is lit.

[0232] The data acquisition devices may include the accelerometer, gyroscope, and magnetometer described above. In this embodiment, the data acquisition devices are specifically a secondary accelerometer, a secondary gyroscope, and a magnetometer disposed in the first plate.

[0233] In one implementation, the terminal device can collect device status data based on a data acquisition device. Specifically, when the data acquisition device is a secondary accelerometer, the collected device status data is acceleration data; when the data acquisition device is a secondary gyroscope, the collected device status data is gyroscope data; and when the data acquisition device is a magnetometer, the collected device status data is magnetic field data.

[0234] As can be determined with reference to the above embodiments, electronic sensors such as accelerometers, gyroscopes, and magnetometers will perform axial mapping on the collected data. Therefore, the device status data output by the data acquisition device is specifically data in the first coordinate system, which is the overall coordinate system of the terminal device.

[0235] Meanwhile, since the terminal device in this embodiment is a foldable electronic device, the overall coordinate system of the terminal device will also change accordingly when the screen of the foldable electronic device is switched. Therefore, the first coordinate system in this embodiment is specifically the overall coordinate system of the terminal device determined by taking the upper left corner of the first screen as the origin when the first screen is lit.

[0236] In this embodiment, axial switching is performed only when a screen switch is detected. In one implementation, for example, a screen can be selected as the default screen (referred to as the first screen in this embodiment). When the lit screen remains the first screen, and when the lit screen switches from another screen (referred to as the second screen in this embodiment) to the default screen, axial mapping can be performed according to the original mapping relationship.

[0237] The "existing mapping relationship" here can be understood as the mapping relationship between the overall coordinate system and the device coordinate system corresponding to the default screen. In other words, as long as the screen that is lit is the first screen, the axis mapping can be performed according to the existing mapping relationship without the need for axis switching.

[0238] When the illuminated screen changes from the default screen to another screen, the overall coordinate system is redefined based on this new screen. Therefore, the mapping between the overall coordinate system and the device coordinate system is no longer the same. Consequently, the axial switching process (described later) needs to be performed on the data after axial mapping to ensure the correctness of the axial mapping relationship.

[0239] For example, the first screen can be an inner screen, then the corresponding second screen after switching is the outer screen. Alternatively, the first screen can also be an outer screen, then the corresponding second screen after switching can be an inner screen. This embodiment does not limit the specific selection of the first and second screens; they can be selected according to actual needs.

[0240] S1102. When a screen switch is detected, the coordinate system corresponding to the device status data is switched from the first coordinate system to the second coordinate system to obtain the device status data after the coordinate system switch.

[0241] Subsequently, if the terminal device detects a screen switch, it can, for example, perform axial switching processing on the collected device status data based on the data acquisition device. Specifically, it switches the coordinate system corresponding to the device status data from the first coordinate system to the second coordinate system, thereby obtaining the device status data after the coordinate system switch. The second coordinate system is the overall coordinate system of the terminal device, determined with the upper left corner of the second screen as the origin when the second screen is lit.

[0242] Referring to Figure 11, the device status data after coordinate system switching is the data acquired after axial switching, as shown in Figure 11. Specifically, each electronic sensor in the drive layer directly performs axial switching processing on its acquired device status data to switch the coordinate system of the device status data from the first coordinate system to the second coordinate system, thereby obtaining the device status data after axial switching.

[0243] S1103. Input the device status data after switching coordinate systems into the sensor algorithm to obtain the output data corresponding to the first sensor.

[0244] After performing axial switching and obtaining the device status data after the coordinate system is switched, the switched device status data can be input into the sensor algorithm corresponding to the virtual sensor. In this embodiment, the virtual sensor is referred to as the first sensor. In the example of Figure 11, the first sensor can be, for example, the geomag_RV sensor, the RV sensor, and the mag_cal sensor.

[0245] Among them, the sensor algorithm corresponding to the geomag_RV sensor is the algorithm a in the example of Figure 11, the sensor algorithm corresponding to the RV sensor is the algorithm b in the example of Figure 11, and the sensor algorithm corresponding to the mag_cal sensor is the algorithm c in the example of Figure 11.

[0246] Therefore, based on the implementation method described above, data collected by the secondary accelerometer, secondary gyroscope, and magnetometer are fused to obtain the output results corresponding to the virtual sensor. This effectively avoids the problem of inaccurate output data after sensor algorithm fusion when the terminal device is in an intermediate state, caused by the accelerometer + gyroscope and magnetometer being distributed on different boards. Furthermore, the secondary accelerometer, secondary gyroscope, and magnetometer perform axial switching based on the collected device state data, effectively ensuring the correctness of the axial mapping relationship between the overall coordinate system and the device coordinate system. This ensures that the device state data provided to the sensor algorithm is data located in the correct overall coordinate system of the current terminal device, thus guaranteeing the accuracy of the data output by the virtual sensor.

[0247] Furthermore, the data processing method provided in this application also proposes the following scheme three: data collected by the magnetometer and accelerometer in the first plate and the gyroscope are fused together, but the axis switching processing is placed after the algorithm output.

[0248] It can be understood that Scheme 3 is similar to Scheme 2 described above. It uses the data collected by the magnetometer in the first plate, the secondary accelerometer in the first plate, and the secondary gyroscope in the second plate for fusion processing, which can effectively avoid the problems existing in Scheme 1.

[0249] The data fusion of virtual sensors in the current solution can be understood in conjunction with Figure 12, which is the third software architecture diagram of the terminal device provided in the embodiment of this application.

[0250] The parts shown in Figure 12 are similar to those described in Figure 11. The difference between Scheme 2 and Scheme 3 is that Scheme 2 involves the data acquisition device directly performing axial switching processing at the driving layer. In this case, the data acquisition device outputs the device status data after axial switching.

[0251] In Scheme 3, the data acquisition device does not perform axial switching. The data acquisition device outputs the original acquired device status data. Then, the sensor algorithm performs fusion processing based on the original device status data. After the sensor algorithm outputs the initial output data corresponding to the virtual sensor, the axial switching is performed on the initial output data. This can also ensure that the output data corresponding to the virtual sensor is located in the second coordinate system. Therefore, this implementation method can also effectively solve the problem of changes in axial mapping relationship caused by screen switching.

[0252] Meanwhile, the advantage of this approach is that, during the axial switching process, some coordinate values ​​may need to be negative, which could lead to a sudden change in data from 1000 to -1000. By placing the axial switching processing after the sensor algorithm output, the data abruptness caused by axial switching is avoided. This effectively ensures that the device status data output to the sensor algorithm is continuous, thereby improving the processing stability of the sensor algorithm and the accuracy of the output data obtained after processing by the sensor algorithm.

[0253] Based on Figure 12, the steps of the current scheme three can be understood as follows:

[0254] S1201. Collect device status data based on data acquisition device, wherein the coordinate system corresponding to the device status data is the first coordinate system, which is the overall coordinate system of the terminal device when the first screen is lit.

[0255] The implementation of S1201 is similar to that of S1101, and will not be described in detail here.

[0256] S1202. Input the device status data into the sensor algorithm to obtain the initial output data of the first sensor.

[0257] In this implementation, after the data acquisition device acquires the device status data, the data acquisition device does not need to perform axial switching processing and directly provides the acquired device status data (that is, the acquired data in Figure 12) to the sensor algorithm of the virtual sensor.

[0258] The sensor algorithm directly fuses the original device status data to obtain the initial output data corresponding to the first sensor shown in Figure 12.

[0259] S1203. When a screen switch is detected, the coordinate system corresponding to the initial output data is switched from the first coordinate system to the second coordinate system to obtain the output data corresponding to the first sensor.

[0260] Subsequently, if the terminal device detects a screen switch, it can, for example, use the axis switching unit deployed in the HAL layer or algorithm layer to perform axis switching processing on the initial output data. Specifically, the coordinate system corresponding to the initial output data is switched from the first coordinate system to the second coordinate system, thereby obtaining the output data of the first sensor after axis switching. The second coordinate system is the overall coordinate system of the terminal device, determined with the upper left corner of the second screen as the origin when the second screen is lit.

[0261] Similarly, in this embodiment, the virtual sensor is referred to as the first sensor. In the example of Figure 12, the first sensor can be, for example, the geomag_RV sensor, the RV sensor, and the mag_cal sensor.

[0262] Among them, the sensor algorithm corresponding to the geomag_RV sensor is the algorithm a in the example of Figure 12, the sensor algorithm corresponding to the RV sensor is the algorithm b in the example of Figure 12, and the sensor algorithm corresponding to the mag_cal sensor is the algorithm c in the example of Figure 12.

[0263] As shown in Figure 12, after algorithm a outputs the initial output data, the axis switching unit performs axis switching processing on the initial output data to obtain the output data corresponding to the geomag_RV sensor. At this time, the output data corresponding to the geomag_RV sensor is located in the second coordinate system, thus effectively ensuring that the data output by the virtual sensor can correctly reflect the position and orientation information of the terminal device.

[0264] Therefore, based on the implementation method described above, in addition to the beneficial effects of Scheme 2, the continuity of the device status data provided to the sensor algorithm can be further guaranteed, avoiding the problem of discontinuous algorithm input caused by data mutation, which in turn leads to inaccurate calculation results of the sensor algorithm output. Thus, Scheme 3 can effectively improve the stability and correctness of the output results of the virtual sensor.

[0265] Referring to Figures 11 and 12, it can also be understood that for the two virtual sensors, the magnetic field sensor and the uncalibrated magnetic field sensor, there is no need for corresponding sensor algorithms to fuse the collected data. Instead, it is sufficient to directly acquire the data collected by the magnetometer and the data output by algorithm c. In other words, this type of sensor only needs to collect the corresponding data and does not require its own corresponding sensor algorithm to fuse the data collected by the electronic sensor. In this embodiment, this type of virtual sensor that collects data is referred to as the second sensor. For example, in the examples of Figures 11 and 12, both the magnetic field sensor and the uncalibrated magnetic field sensor can be understood as the second sensor.

[0266] For the second sensor, in order to ensure the accuracy of the collected equipment status data, it is also necessary to perform axial switching processing on the equipment status data.

[0267] In one implementation, referring to Figure 11, for example, the data acquisition device in the driving layer can perform axial switching processing on the acquired device status data, and then provide the device status data with the switched coordinate system after axial switching processing to the second sensor.

[0268] In another implementation, referring to Figure 12, for example, the axial switching unit deployed in the HAL layer or algorithm layer can perform axial switching processing on the collected device status data, and then provide the device status data with the switched coordinate system after axial switching processing to the second sensor.

[0269] Therefore, the technical solution of this application can ensure that the data output by each virtual sensor is axially switched, thereby ensuring that the data output by the virtual sensor can effectively and accurately reflect the current device status (such as position and orientation) of the terminal device.

[0270] Based on the various schemes described above, the implementation of axial switching in this application will be further described in detail below. Based on the above description, it can be determined that in Scheme 2, the equipment status data requires axial switching, and in Scheme 3, the initial output data requires axial switching. For ease of explanation below, the equipment status data and the initial output data will be collectively referred to as the first data.

[0271] It is understandable that the relative rotation of the first and second boards causes the screen to switch, and the overall coordinate system of the terminal device is actually coincident before and after the screen switch. However, for the data acquisition device, which is located in the first board, the data acquisition device will rotate synchronously with the rotation of the first board, and the corresponding device coordinate system of the data acquisition device will also rotate synchronously.

[0272] In other words, the overall coordinate system coincides before and after the screen switch, but the device coordinate system rotates. Therefore, the axial mapping relationship between the overall coordinate system and the device coordinate system will inevitably change. So, to obtain the correct axial mapping relationship through axial switching, it is necessary to clarify exactly how the device coordinate system has rotated.

[0273] As can be determined from the above embodiments, when the folding type of the terminal device is left-right folding and up-down folding, the relative rotation of the first plate and the second plate is different, and therefore the rotation of the device coordinate system is also different. Therefore, the following will describe the two folding types of left-right folding and up-down folding respectively.

[0274] For example, you can refer to Figure 8 to understand the case where the folding type of the terminal device is left and right folding.

[0275] As shown in Figure 8, when the terminal device folds horizontally, the rotation of the first plate can be understood as causing the X and Z axes of the device coordinate system to rotate. Specifically, the X and Z axes of the device coordinate system rotate directly to the opposite direction. Since the overall coordinate system coincides before and after the screen switch, the mapping relationship changes so that the X and Z axes become opposite directions. Therefore, when performing axial switching, it is necessary to invert the X and Z axes in the first data to achieve the purpose of axial switching and ensure the accuracy of the axial mapping relationship after switching.

[0276] Based on the above-described logic for determining the overall coordinate system, the specific processing method for axial switching can be summarized as follows:

[0277] Invert the coordinate values ​​corresponding to the first coordinate axis and the second coordinate axis in the first data.

[0278] The first coordinate axis is a horizontal axis parallel to the screen with the top left corner of the first screen as the origin; the second coordinate axis is an outward coordinate axis perpendicular to the screen with the top left corner of the first screen as the origin.

[0279] Specifically, since both the collected data and the initial output data (that is, the first data in this embodiment) are located in the first coordinate system, the first coordinate axis and the second coordinate axis introduced here can be understood as coordinate axes in the first coordinate system. The origin of the coordinates corresponding to the first coordinate axis and the second coordinate axis is the upper left corner of the first screen.

[0280] According to the above-described logic for determining the overall coordinate system, the coordinate axis in the horizontal direction parallel to the screen (i.e., the first coordinate axis) with the upper left corner of the first screen as the origin is actually the X-axis in the overall coordinate system; and the coordinate axis in the direction perpendicular to the screen and pointing outward (i.e., the second coordinate axis) with the upper left corner of the first screen as the origin is actually the Z-axis in the overall coordinate system.

[0281] Therefore, when switching axes, you can simply invert the coordinate values ​​corresponding to the X-axis and Z-axis in the first set of data.

[0282] It's also important to note that the device status data collected by data acquisition devices typically contains three-axis coordinate values, meaning it's presented in the form of (x, y, z). However, after the sensor algorithm processes the device status data, the output data may be presented in the form of quaternions, meaning it's presented in the form of (x, y, z, w). Therefore, it's necessary to further explain what the specific coordinate values ​​corresponding to the X and Z axes are in the first set of data under different data formats.

[0283] In the case where the first data includes three-axis coordinate values, the coordinate value corresponding to the first coordinate axis is the X value in the three-axis coordinate system, and the coordinate value corresponding to the second coordinate axis is the Z value in the three-axis coordinate system. Therefore, when performing axial mapping, for example, if the first data is (x, y, z), then the first data after axial mapping will be (-x, y, -z).

[0284] Furthermore, when the first data includes quaternions, there is a clear mapping relationship between the three-axis coordinate values ​​and the quaternions. Specific mapping relationships can be found in relevant technical documentation and will not be elaborated upon here. In short, the coordinate value corresponding to the first axis is the Z-value of the quaternion, and the coordinate value corresponding to the second axis is the Y-value of the quaternion. Therefore, when performing axial mapping, for example, if the first data is (x, y, z, w), then the first data after axial mapping will be (-z, w, x, -y).

[0285] Next, refer to Figure 9 to understand the case where the terminal device folds vertically.

[0286] As shown in Figure 9, when the terminal device is folded vertically, the rotation of the first plate can be understood as causing the Y-axis and Z-axis of the device coordinate system to rotate. Specifically, the Y-axis and Z-axis of the device coordinate system rotate directly to the opposite direction. Since the overall coordinate system coincides before and after the screen switch, the mapping relationship changes so that the Y-axis and Z-axis become reversed. Therefore, when performing axial switching, it is necessary to invert the Y-axis and Z-axis in the first data to achieve the purpose of axial switching and ensure the accuracy of the axial mapping relationship after switching.

[0287] Based on the above-described logic for determining the overall coordinate system, the specific processing method for axial switching can be summarized as follows:

[0288] Invert the coordinate values ​​corresponding to the third and fourth axes in the first data.

[0289] The third coordinate axis is a vertical axis parallel to the screen, with the top left corner of the first screen as the origin; the fourth coordinate axis is an outward coordinate axis perpendicular to the screen, with the top left corner of the first screen as the origin.

[0290] Specifically, since both the collected data and the initial output data (that is, the first data in this embodiment) are located in the first coordinate system, the third and fourth coordinate axes introduced here can be understood as coordinate axes in the first coordinate system. The origin of the coordinates corresponding to the third and fourth coordinate axes is the upper left corner of the first screen.

[0291] According to the above-described logic for determining the overall coordinate system, the coordinate axis in the vertical direction parallel to the screen (i.e., the third coordinate axis) with the upper left corner of the first screen as the origin is actually the Y-axis in the overall coordinate system; and the coordinate axis in the direction perpendicular to the screen and pointing outward (i.e., the fourth coordinate axis) with the upper left corner of the first screen as the origin is actually the Z-axis in the overall coordinate system.

[0292] Therefore, when switching axes, you can simply invert the coordinate values ​​corresponding to the Y-axis and Z-axis in the first data.

[0293] Similarly, it is also necessary to explain what the coordinate values ​​of the Y-axis and Z-axis are in the first data under different data formats.

[0294] In the case where the first data includes three-axis coordinate values, the coordinate value corresponding to the third coordinate axis is the Y value among the three-axis coordinate values, and the coordinate value corresponding to the fourth coordinate axis is the Z value among the three-axis coordinate values. Therefore, when performing axial mapping, for example, if the first data is (x, y, z), then the first data after axial mapping will be (x, -y, -z).

[0295] Furthermore, when the first data includes quaternions, there is a clear mapping relationship between the three-axis coordinate values ​​and the quaternions. Specific mapping relationships can be found in relevant technical documentation and will not be elaborated upon here. In short, the coordinate value corresponding to the third axis is the X value in the quaternion, and the coordinate value corresponding to the fourth axis is the Y value in the quaternion. Therefore, when performing axial mapping, for example, if the first data is (x, y, z, w), then the first data after axial mapping will be (-x, w, z, -y).

[0296] Based on the above introduction, it can be determined that in this embodiment, by analyzing the changes in the coordinate axis mapping relationship between the device coordinate system and the whole machine coordinate system, the specific switching method in the axial switching process can be clarified. By inverting the coordinate values ​​corresponding to the corresponding coordinate axes, the axial switching process can be achieved efficiently and quickly.

[0297] Based on the descriptions of the above embodiments, the implementation of screen switching detection in the data processing method provided by this application will be described in detail below with reference to Figure 13. Figure 13 is a software architecture diagram of the terminal device provided in the embodiment of this application.

[0298] As shown in Figure 13, the various software layers in the software architecture are similar to those described in the above embodiments.

[0299] In one implementation, the driver layer may include an extended hall sensor and a hinge angle sensor, and the HAL layer may include software service units corresponding to the extended hall sensor and the hinge angle sensor.

[0300] The closure sensor is used to detect the physical state of the terminal device, which can be a folded state, an unfolded state, or an intermediate state. The angle sensor is used to detect the folding angle of the terminal device, which can also be understood as the angle between the first plate and the second plate.

[0301] In one implementation, the data acquisition device described in the above embodiments can, for example, register a closure sensor. The closure sensor can then send the physical state of the terminal device to the data acquisition device, which then determines whether the screen has switched based on the physical state of the terminal device.

[0302] For example, when the physical state of the terminal device changes from an unfolded state to a folded state, the data acquisition device determines that the screen has switched, and thus performs the subsequent axis-switching process. The specific axis-switching process can be performed by the data acquisition device, or it can also be performed by the axis-switching unit; this embodiment does not limit this.

[0303] In another implementation, the data acquisition device described in the above embodiments can, for example, register an angle sensor. The angle sensor can then send the folding angle of the terminal device to the data acquisition device, and the data acquisition device can then determine whether the screen has switched based on the folding angle of the terminal device.

[0304] For example, when the folding angle is less than a first threshold, the data acquisition device determines that the screen has switched, and then performs the subsequent axis-switching process. The specific axis-switching process can be performed by the data acquisition device or by the axis-switching unit; this embodiment does not limit this.

[0305] Based on the two implementation methods described above, the screen state can be determined simply and efficiently, thereby determining whether to perform subsequent axis-switching processing.

[0306] Another implementation, referring to Figure 12, could involve the DeviceState Manager unit in the framework layer collecting the physical state from the closure sensor and the folding angle from the angle sensor. Then, based on the physical state and folding angle, it could determine whether the current display is on the inner or outer screen. For example, if the physical state is determined to be folded (or intermediate) and the folding angle is less than a preset threshold, the current display is determined to be on the inner screen; if the physical state is determined to be unfolded (or intermediate) and the folding angle is greater than a preset threshold, the current display is determined to be on the outer screen.

[0307] Once DeviceStateManager determines the screen display state (whether it's the inner or outer screen), it can notify the HWC (Hardware Composer) module. The HWC module will then transmit the current screen display state to the SensorHub's DMD (Data Management and Distribution) module. The DMD module will then send the screen display state to the data acquisition device. Therefore, the data acquisition device can decide whether to switch axes based on the screen display state.

[0308] For example, if the data acquisition device determines that the lit screen has switched from the first screen to the second screen based on the screen display status, the data acquisition device triggers the execution of axial switching processing.

[0309] Because the axis switching is deeply tied to the screen display state, this implementation method can effectively ensure the necessity and correctness of axis switching processing.

[0310] It should be noted that the module names involved in the embodiments of this application can all be defined as other names, as long as they can achieve the function of each module, and no specific restrictions are placed on the module names.

[0311] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the embodiments of this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0312] The data processing method provided in this application can be applied to electronic devices with foldable functionality. The electronic device includes a terminal device, which can specifically be a foldable electronic device. The specific device form of the foldable electronic device can be referred to the above-described related features, and will not be repeated here.

[0313] In one implementation, this application provides an electronic device. For example, FIG14 is a schematic diagram of the hardware structure of a terminal device provided in this application.

[0314] The terminal device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.

[0315] The processor 110 may include one or more processing units. These processing units may be independent devices or integrated within one or more processors. The processor 110 may also include memory for storing instructions and data.

[0316] Furthermore, the sensor module may include, for example, the accelerometer, gyroscope, magnetometer, angle sensor, closure sensor, etc. described above. This embodiment does not limit the specific sensors included in the sensor module, which can be determined according to actual needs.

[0317] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a structural limitation on the terminal device. In other embodiments of this application, the terminal device may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.

[0318] This application provides a chip. The chip includes a processor, which is used to call a computer program in memory to execute the technical solutions in the above embodiments. Its implementation principle and technical effects are similar to those in the related embodiments described above, and will not be repeated here.

[0319] This application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, it implements the methods described above. The methods described in the above embodiments can be implemented wholly or partially by software, hardware, firmware, or any combination thereof. If implemented in software, the functionality can be stored as one or more instructions or code on or transmitted over the computer-readable medium. The computer-readable medium can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium accessible by a computer.

[0320] In one possible implementation, a computer-readable medium may include RAM, ROM, compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage or other magnetic storage devices, or any other medium targeted to carry or to store the required program code in the form of instructions or data structures, and accessible by a computer. Furthermore, any connection is appropriately referred to as a computer-readable medium. For example, if software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave, then coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. As used herein, disks and optical discs include optical discs, laser discs, optical discs, Digital Versatile Discs (DVDs), floppy disks, and Blu-ray discs, where disks typically reproduce data magnetically, while optical discs optically reproduce data using lasers. Combinations of the above should also be included within the scope of computer-readable media.

[0321] This application provides a computer program product, which includes a computer program that, when run, causes a computer to perform the above-described method.

[0322] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, special-purpose computer, embedded processor, or other programmable device to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable data processing device, create means for implementing the functions specified in one or more flowchart illustrations and / or one or more block diagrams.

[0323] The above specific embodiments further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made on the basis of the technical solution of the present invention should be included within the scope of protection of the present invention.

Claims

1. A data processing method, characterized in that, The method is applied to a terminal device, which includes a first screen and a second screen, and further includes a first plate and a second plate connected by a connector. At least one data acquisition device is disposed in the first plate, and the first screen and the second screen are simultaneously distributed in the first plate. The data acquisition device is disposed in the first plate, and when the terminal device is folded or unfolded, changing the relative position of the first plate and the second plate, the relative position between the device coordinate system of the data acquisition device and the overall coordinate system of the terminal device changes. The method includes: acquiring device status data based on the data acquisition device, wherein the coordinate system corresponding to the device status data is a first coordinate system, and the first coordinate system is defined by the coordinate system at the point on the first screen. When the screen is lit, the coordinate system of the terminal device is defined as follows: The device status data is processed according to the sensor algorithm corresponding to the first sensor to obtain the output data corresponding to the first sensor; wherein, the first sensor is a virtual sensor, which is implemented based on the device status data collected by the at least one data acquisition device and through a sensor algorithm; when a screen switching is detected, a coordinate axis transformation operation is performed on the first data based on the folding type of the terminal device, so that the coordinate system corresponding to the output data is the second coordinate system; wherein, the first data is the device status data or the initial output data of the first sensor obtained based on the device status data, and the second coordinate system is the coordinate system of the terminal device when the second screen is lit.

2. The method according to claim 1, characterized in that, The step of performing coordinate axis transformation on the first data based on the folding type of the terminal device includes: when the folding type of the terminal device is horizontal folding, inverting the coordinate values ​​corresponding to the first coordinate axis and the second coordinate axis in the first data; wherein, the first coordinate axis is a horizontal coordinate axis parallel to the screen with the upper left corner of the first screen as the origin; the second coordinate axis is a coordinate axis pointing outwards in a direction perpendicular to the screen with the upper left corner of the first screen as the origin; or, when the folding type of the terminal device is vertical folding, inverting the coordinate values ​​corresponding to the third coordinate axis and the fourth coordinate axis in the first data; wherein, the third coordinate axis is a vertical coordinate axis parallel to the screen with the upper left corner of the first screen as the origin; the fourth coordinate axis is a coordinate axis pointing outwards in a direction perpendicular to the screen with the upper left corner of the first screen as the origin.

3. The method according to claim 2, characterized in that, The first coordinate axis is the X-axis, and the second coordinate axis is the Z-axis; when the first data contains three-axis coordinate values, the coordinate value corresponding to the first coordinate axis is the X value among the three-axis coordinate values, and the coordinate value corresponding to the second coordinate axis is the Z value among the three-axis coordinate values; when the first data contains quaternions, the coordinate value corresponding to the first coordinate axis is the Z value among the quaternions, and the coordinate value corresponding to the second coordinate axis is the Y value among the quaternions.

4. The method according to claim 2, characterized in that, The third coordinate axis is the Y-axis, and the fourth coordinate axis is the Z-axis; when the first data contains three coordinate values, the coordinate value corresponding to the third coordinate axis is the Y value among the three coordinate values, and the coordinate value corresponding to the fourth coordinate axis is the Z value among the three coordinate values; when the first data contains quaternions, the coordinate value corresponding to the third coordinate axis is the X value among the quaternions, and the coordinate value corresponding to the second coordinate axis is the Y value among the quaternions.

5. The method according to any one of claims 1-4, characterized in that, The detection of screen switching includes: obtaining the folding state of the terminal device, and / or obtaining the folding angle of the terminal device; and determining, based on the folding state and / or folding angle, that the lit screen in the terminal device is switched from the first screen to the second screen.

6. The method according to claim 5, characterized in that, After acquiring device status data based on the data acquisition device, the method further includes: switching the coordinate system corresponding to the device status data from the first coordinate system to the second coordinate system to obtain device status data after the coordinate system is switched; and sending the device status data after the coordinate system is switched to the second sensor.

7. The method according to claim 6, characterized in that, The at least one data acquisition device includes: a compass, an accelerometer, and a gyroscope; the acquisition of device status data based on the data acquisition device includes: acquiring compass data based on the compass; and / or, acquiring acceleration data based on the accelerometer; and / or, acquiring gyroscope data based on the gyroscope.

8. An electronic device, characterized in that, The electronic device includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, and the one or more processors invoking the computer instructions to cause the electronic device to perform the method as described in any one of claims 1 to 7.

9. A foldable electronic device, characterized in that, The foldable electronic device includes a first screen and a second screen, and further includes a first plate and a second plate connected by a connector. The first plate is provided with at least one data acquisition device, and the first screen and the second screen are distributed in the first plate. The at least one data acquisition device includes an accelerometer, a gyroscope, and a magnetometer. The foldable electronic device is used to perform the method as described in any one of claims 1 to 7.

10. A chip system, characterized in that, The chip system is applied to an electronic device, the chip system including one or more processors, the one or more processors being used to invoke computer instructions to cause the electronic device to perform the method as described in any one of claims 1 to 7.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1 to 7.

12. A computer program product, characterized in that, The computer program product includes computer program code that, when run on an electronic device, causes the electronic device to perform the method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Gravity sensing data correction method and system

    CN106445083A

  • Mobile terminal and processing method of motion sensor data

    CN107465817A