Ambient light detection method and electronic equipment
The ambient light sensor is triggered by the frame synchronization signal and the difference between the initial ambient light and the display area light is calculated, which solves the problem of low ambient light detection accuracy of the ambient light sensor under the OLED screen and achieves more accurate ambient light measurement.
Patent Information
- Application Number
- CN202310336166.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-24
- Publication Date
- 2024-09-24
AI Technical Summary
When the ambient light sensor is under the OLED screen, it is difficult to accurately measure the ambient light intensity. Screen refresh and PWM dimming cause the ambient light detection accuracy to decrease and jump problems occur.
By obtaining the frame synchronization signal of the display screen, the initial moment of the refresh cycle is determined, the ambient light sensor is triggered to collect the ambient light, and the light difference between the initial ambient light and the target display area is calculated, and the display area light is removed to ensure that within each detection cycle The black frame signal is consistent and suppresses the jump of ambient light detection.
It improves the accuracy of ambient light detection, reduces ambient light jumps caused by black frame signal interference, and enhances user experience.
Smart Images

Figure CN118692371A
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminals, and in particular to a method and electronic device for detecting ambient light. Background Art
[0002] With the development of full-screen technology in electronic devices, in order to increase the screen-to-body ratio of the display screen in electronic devices, sensors such as ambient light sensors are usually placed under the display screen. Since the ambient light sensor is placed under the OLED (Organic Light-Emitting Diode) screen, the light collected by the ambient light sensor includes: the light incident from the surrounding environment and the light emitted by the display screen, resulting in inaccurate ambient light intensity collected by the ambient light sensor.
[0003] At present, in order to accurately measure the ambient light, the ambient light is integrated and collected for a long time to obtain the display information of the display screen during the collection time. The target ambient light can be obtained by deducting the integral noise between the collection start time and the collection end time of the initial ambient light from the initial ambient light.
[0004] However, black stripes will appear on the screen when the screen is refreshed or PWM dimming is performed, causing the reported value of the ambient light sensor to jump to a certain extent, resulting in a decrease in the accuracy of the detected ambient light, affecting the user experience. Summary of the invention
[0005] In order to solve the above technical problems, the present application provides a method and electronic device for ambient light detection, which can improve the accuracy of ambient light detection.
[0006] In a first aspect, the present application provides a method for ambient light detection, which is applied to an electronic device, wherein the electronic device includes a display screen and an ambient light sensor located under the display screen, and the method includes: obtaining a frame synchronization signal generated by the display screen; obtaining a first moment in a refresh cycle of the frame synchronization signal; triggering the ambient light sensor at the first moment to start collecting ambient light; obtaining initial ambient light collected by the ambient light sensor in this detection cycle, the initial ambient light including target ambient light and light generated by a target display area, the target area being an area in the display screen located above the ambient light sensor; obtaining the difference between the initial ambient light collected in this detection cycle and the light generated by the target display area, and determining the target ambient light.
[0007] In this way, when the ambient light sensor is located under the display screen, the ambient light collected by the ambient light sensor (i.e., initial ambient light) includes external ambient light and light generated by the target display area in the display screen; the target ambient light can be obtained by removing the light generated by the target display area from the initial ambient light. Display screens usually use PWM dimming, which will generate black frame signals during display. Black frame signals (such as PWM signals) cause dark areas (i.e., black stripes) to appear on the display screen; the start time of each detection cycle of the ambient light sensor is the first moment of the refresh cycle of the frame synchronization signal (Tearing Effect Signal, TE signal), and the start time of each detection occurs after the screen TE signal, and the start time of each detection is fixed, so that the number of black frame signals in the display screen in each detection cycle remains consistent, thereby ensuring that the interference of black stripes on ambient light detection in each detection cycle is the same, suppressing the problem of drastic jumps in the target ambient light determined by two adjacent detection cycles, and improving the accuracy of target ambient light detection.
[0008] According to the first aspect, obtaining the frame synchronization signal generated by the display screen includes: the HWC module of the electronic device obtains the frame synchronization signal; the HWC module transmits the frame synchronization signal to the sensor hub; the sensor hub transmits the frame synchronization timing to the ambient light detection driver module; the ambient light detection driver module obtains the frame synchronization signal. In this way, the frame synchronization signal can be obtained by the ambient light detection driver module through the transmission channel between the HWC module and the ambient light detection driver module without changing the hardware structure of the electronic device. The method of obtaining the frame synchronization signal can be applied to existing electronic devices, increasing the applicable scenarios of the method.
[0009] According to the first aspect, obtaining the first moment in the refresh cycle of the frame synchronization signal includes: the ambient light detection driving module obtains the nth rising edge in the refresh cycle, or the nth falling edge in the refresh cycle as the first moment, where n is an integer greater than 0. In this way, when the ambient light detection driving module detects the nth rising edge or falling edge (such as the first rising edge or the first falling edge) in the refresh cycle, the ambient light sensor is triggered to detect the initial ambient light, and this method can quickly determine the first moment.
[0010] According to the first aspect, obtaining the first moment in the refresh cycle of the frame synchronization signal includes: when the ambient light detection driving module detects the rising edge or falling edge of the frame synchronization signal, the timing starts; the ambient light detection driving module obtains the moment when the preset time length is reached from the timing moment; and the obtained moment is determined to be the first moment. In this way, when the ambient light detection driving module detects the rising edge or falling edge, it delays the triggering of the ambient light sensor to detect the initial ambient light, rather than fixing the triggering of the ambient light detection at the rising edge or falling edge of the TE signal, thereby improving the flexibility of detection.
[0011] According to the first aspect, the output first pin of the system-on-chip (SOC) in the electronic device is electrically connected to the first end of the magnetic bead, the second end of the magnetic bead is electrically connected to the second pin of the ambient light sensor and the first end of the filter, and the second end of the filter is grounded; the frame synchronization signal generated by the display screen is obtained, including: the second pin of the ambient light sensor obtains the frame synchronization signal. In this way, by the electrical connection between the SOC and the ambient light sensor in the electronic device, the ambient light sensor can directly read the TE signal; at the same time, the magnetic bead and the filter capacitor are set between the SOC and the ambient light sensor, which can eliminate the interference in the TE signal transmission and improve the accuracy of the TE signal.
[0012] According to the first aspect, obtaining the first moment in the refresh cycle of the frame synchronization signal includes: the ambient light sensor obtains the nth rising edge in the refresh cycle, or the nth falling edge in the refresh cycle as the first moment, where n is an integer greater than 0. In this way, since the ambient light sensor is used directly for detection, the ambient light detection is triggered quickly and the delay is small.
[0013] According to the first aspect, obtaining the first moment in the refresh cycle of the frame synchronization signal includes: when the ambient light sensor detects the rising edge or falling edge of the frame synchronization signal, triggering the start of the first clock; when the ambient light sensor detects that the duration of the start of the first clock reaches a preset duration, determining the moment when the first clock is started for the preset duration as the first moment. In this way, the ambient light sensor delays the triggering of ambient light detection, thereby improving the flexibility of the triggering.
[0014] According to the first aspect, the preset duration is greater than 0 and less than the refresh period of the frame synchronization signal. In this way, the preset duration is any duration within the refresh period, which improves the flexibility of setting the preset duration.
[0015] According to the first aspect, before acquiring the frame synchronization signal generated by the display screen, the method further includes: the SOC of the electronic device detects the activation information and activates the ambient light sensor; and opens the transmission channel between the HWC module and the ambient light detection drive module. In this way, when the ambient light sensor is activated, the transmission channel between the HWC module and the ambient light detection drive module is opened, so that the ambient light detection drive module can quickly acquire the TE signal.
[0016] In a second aspect, the present application provides an electronic device comprising: one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and when the computer programs are executed by the one or more processors, the electronic device performs the method of ambient light detection corresponding to the first aspect and any one of the implementation methods of the first aspect.
[0017] The second aspect and any implementation of the second aspect correspond to the first aspect and any implementation of the first aspect respectively. The technical effects corresponding to the second aspect and any implementation of the second aspect can refer to the technical effects corresponding to the above-mentioned first aspect and any implementation of the first aspect, which will not be repeated here.
[0018] In a third aspect, the present application provides a computer-readable medium for storing a computer program. When the computer program is executed on an electronic device, the electronic device executes the method for ambient light detection corresponding to the first aspect and any one of the implementations of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0020] Figure 1 is a schematic diagram showing an exemplary positional relationship between an ambient light sensor and a display screen;
[0021] Figure 2 is a schematic diagram showing an exemplary black stripe in a display screen;
[0022] Figure 3 is a schematic diagram showing an example of external ambient light determined when a long-time integration acquisition method is used;
[0023] Figure 4 is a schematic diagram of the structure of an electronic device shown exemplarily;
[0024] Figure 5 is a schematic diagram of a software structure of an electronic device shown as an example;
[0025] Figure 6 is a flowchart of a method for exemplarily showing ambient light detection;
[0026] Figure 7 is a schematic diagram showing an exemplary start of an automatic dimming application;
[0027] Figure 8 is a schematic diagram showing an electronic device switching from screen off to screen on;
[0028] Fig. 9 is a schematic diagram showing an exemplary connection between an ambient light sensor and a SOC of a mobile phone;
[0029] Fig.10is a schematic diagram showing an exemplary method of obtaining a TE signal using software;
[0030] Fig.11 is a schematic diagram showing an exemplary alignment of an ambient light detection cycle with a TE signal;
[0031] Fig.12 exemplarily shows a comparison diagram of the ambient light determined by the ambient light detection method in the present application and the ambient light determined by the traditional ambient light detection method. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0033] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0034] The terms "first" and "second" in the description and claims of the embodiments of the present application are used to distinguish different objects rather than to describe a specific order of objects. For example, a first target object and a second target object are used to distinguish different target objects rather than to describe a specific order of target objects.
[0035] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0036] In the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more than two. For example, multiple processing units refer to two or more processing units; multiple systems refer to two or more systems.
[0037] Before describing the technical solution of the embodiment of the present application, the position of the ambient light sensor of the embodiment of the present application is first described in conjunction with the accompanying drawings. In order to increase the screen-to-body ratio of the full-screen display, the ambient light sensor is placed under the display screen, such as Figure 1As shown, the display screen includes: a glass cover plate 101, a display module 102 and a protective film 104. The display module 102 is located below the glass cover plate, and the protective film 104 is located below the display module 102. The glass cover plate 101 is placed in a direction away from the rear housing of the electronic device. In this example, the electronic device is placed on a support (such as a desktop), and the display screen is facing away from the desktop. The ambient light sensor 103 is located in the area below the display module 102, as shown in FIG. Figure 1 As shown, the ambient light sensor 103 is located below the active area ("AA") of the OLED screen display module 102. The AA area is the area in the display module 102 where image content can be displayed. Setting the ambient light sensor 103 below the display module 102 does not sacrifice the display area.
[0038] When the ambient light sensor 103 is activated, the ambient light sensor 103 starts to collect ambient light. The ambient light collected by the ambient light sensor 103 includes the external ambient light and the light emitted by the display screen (i.e. Figure 1 (the light of the display in the
[0039] The display screen needs to be constantly refreshed to ensure the update and display quality of the picture. The brightness of the display screen can be adjusted by inserting multiple black frame signals during the refresh time of the display screen. Black frame signals will cause black stripes to appear on the display screen. For example, when using a high-speed camera or shortening the exposure time of the camera to take a picture of the display screen of an electronic device, you can see that there are some areas of pixels in the display screen that do not emit light (also called black bars) during the refresh process, and the non-luminous area will move with the refresh. Figure 2 is a schematic diagram of a display screen shown as an example, Figure 2 As shown, the display screen display interface appears gray, and the black stripe 201 (ie, the non-luminous area 201) moves with the refresh.
[0040] In some embodiments, when the display screen displays a black frame signal, the electronic device instructs the ambient light sensor to collect ambient light. Since the display screen of the black stripe 201 is black, black does not leak light. If the ambient light sensor performs light sensing detection on the black stripe 201, the detected light intensity value obtained can be interference-free data, that is, the collected ambient light is not affected by the light emitted by the display screen. However, since most OLEDs currently use a high-frequency PWM dimming method, this method of collecting ambient light is no longer applicable.
[0041] In other embodiments, the electronic device can also collect ambient light from the outside by using a long-term integration collection method. That is, the electronic device can instruct the ambient light sensor to collect ambient light within the detection period, and the duration of the detection period can be 10 milliseconds, 20 milliseconds, 30 milliseconds, etc. The ambient light collected by the ambient light sensor is interfered by the light emitted by the display area above the ambient light sensor in the display screen and the light emitted by the display area above a certain range around the ambient light sensor. Based on this, the electronic device can calculate the light emitted by the display area above the ambient light sensor in the display screen during the detection period through a noise algorithm model. The electronic device removes the light emitted by the display area above the ambient light sensor in the display screen from the collected ambient light to obtain the ambient light from the outside. The method of long-term integration collection does not distinguish between black stripes in the display screen, so that even if the display screen is refreshed at a high frequency (such as a refresh rate of 1920Hz), the ambient light from the outside can be obtained, and it has strong versatility.
[0042] However, when the long-term integration acquisition method is adopted, the external ambient light determined in two adjacent detection cycles often undergoes drastic jumps, resulting in inaccurate operations based on the external environment. For example, when an electronic device adjusts the brightness of a display screen based on the external ambient light, if the external ambient light reported by the processor twice is very different, the display screen will continue to change brightness significantly, affecting user use. Figure 3 FIG. 2 shows a schematic diagram of determining the external ambient light when using a long-term integration acquisition method. Figure 3 As shown, the horizontal axis is used to indicate the number of times the electronic device collects light in a stable environment in one minute, and the vertical axis is used to indicate the external ambient light acquired by the electronic device. Figure 3 As shown, when the horizontal coordinates are 15 and 17, the difference in the external ambient light obtained is large.
[0043] In an embodiment of the present application, a method for detecting ambient light is provided, and the method is applied to an electronic device, which includes a display screen and an ambient light sensor located under the display screen. The electronic device obtains a TE signal, and when the TE signal is detected, the ambient light sensor is driven to start collecting ambient light. The electronic device obtains the difference between the ambient light collected in this round of detection cycle and the light emitted by the target display area, and the target area is the area above the ambient light sensor in the display screen. The method for detecting ambient light in the present application is adopted, and the ambient light sensor is driven by the TE signal to collect ambient light, so that during the detection cycle of collecting ambient light, the number of black frame signals generated by the display screen is the same, which reduces the influence of the black frame signal on the ambient light collection, and avoids the problem of drastic jumps in the determined external ambient light. In this example, the electronic device can be a mobile phone, a tablet computer, a bracelet, a smart watch, etc.
[0044] Figure 4This is a schematic diagram of the structure of an electronic device 100 shown in an embodiment of the present application. It should be understood that: Figure 4 The electronic device 100 shown is only one example of an electronic device, and the electronic device 100 may have more or fewer components than shown in the drawings, may combine two or more components, or may have a different configuration of components. Figure 4 The various components shown in the EMBODIMENTS 2000 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.
[0045] The electronic device 100 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, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.
[0046] Figure 5 It is a software structure block diagram of the electronic device 100 according to an embodiment of the present application.
[0047] The layered architecture of the electronic device 100 divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, namely, the application layer, the application framework layer, the hardware abstraction layer (HAL) and the kernel layer. It is understandable that Figure 5 The layers in the software structure and the components contained in each layer do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer layers than shown in the figure, and each layer may include more or fewer components, which is not limited in the present application.
[0048] like Figure 5As shown, the application layer can include a series of application packages. The application package can include automatic dimming application, camera, gallery, calendar, short message, call, navigation, Bluetooth and other applications. The application framework layer provides an application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some pre-defined functions.
[0049] After the automatic dimming application is started, the external ambient light can be obtained in real time, and the brightness value of the display screen can be adjusted according to the external ambient light.
[0050] like Figure 5 As shown, the application framework layer may include a window manager, a resource manager, a content provider, a view system, a phone manager, a notification manager, and the like.
[0051] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0052] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0053] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0054] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
[0055] The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including connecting, hanging up, etc.).
[0056] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
[0057] The HAL layer includes: HWC (hwcomposer) module and sensor hub SensorHub. The HWC module is a HAL layer module for window (Layer) synthesis and display in Android, usually completed by display device manufacturers (OEMs) to provide hardware support for SurfaceFlinger services. In this example, the HWC module can obtain the refresh information of the display screen, and the refresh information can include TE signals. The HWC module can transmit the TE signal to SensorHub.
[0058] SensorHub is used to process the signals detected by each sensor in the system and transmit them to the application processor for subsequent processing to optimize the operation of the overall system. In this example, SensorHub can transmit the acquired TE signal to the ambient light detection driver module.
[0059] The kernel layer is the layer between hardware and software. The kernel layer includes at least ambient light detection driver, display driver, Bluetooth driver, audio driver, Wi-Fi driver, etc.
[0060] In this example, the ambient light detection driver can be used to receive the TE signal transmitted by the SensorHub. The ambient light detection driver determines whether the preset trigger condition is met based on the TE signal; when the ambient light detection driver determines that the preset trigger condition is met, it drives the ambient light sensor to collect the initial ambient light within this detection cycle.
[0061] Understandably, Figure 5 The layers in the software structure shown and the components included in each layer do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer layers than shown, and each layer may include more or fewer components, which is not limited in the present application.
[0062] Figure 6 The following is a flow chart showing an exemplary method for detecting ambient light. The method for detecting ambient light includes the following steps:
[0063] Step 601: The electronic device obtains a frame synchronization TE signal generated by a display screen.
[0064] The method for detecting ambient light is applied to an electronic device, which may be a smart phone, a tablet computer, a watch, a bracelet, etc. In this example, the electronic device is described by taking a mobile phone as an example. After the first application of the electronic device is started, the ambient light sensor may be activated to detect the ambient light. The first application may be an application that needs to obtain the target ambient light, such as an automatic dimming application, a video application, etc.
[0065] Figure 7FIG. 1 is a schematic diagram showing an exemplary method of starting an automatic dimming application. Figure 7 As shown in 7a of FIG. 7, the user can slide down from the navigation bar of interface 701, as shown in the black arrow direction of 7a, and display the quick operation interface 702 on the display interface of the mobile phone, and 703 is a button for manually adjusting the screen brightness. When the user drags the button 703 to slide to the left, the brightness of the display screen will decrease. When the user drags the button 703 to slide to the right, the brightness of the display screen will increase. The user clicks button 7031 to start the automatic dimming application, which is used to obtain the target ambient light in real time to adjust the brightness of the display screen according to the target ambient light.
[0066] When the automatic dimming application is started, the automatic dimming application activates the ambient light sensor (it can also be called that the automatic dimming application registers the ambient light sensor). When the ambient light sensor is activated, the electronic device starts to execute steps 601 to 604.
[0067] After the automatic dimming application activates the ambient light sensor, the ambient light sensor in the electronic device can directly obtain the refresh information (ie, TE signal) generated by the display screen.
[0068] The following specifically describes the process in which the ambient light sensor obtains the TE signal.
[0069] Fig. 9 FIG. 1 is a schematic diagram showing an exemplary connection between an ambient light sensor and a SOC of a mobile phone. Fig. 9 As shown, the first pin of the SOC 901 in the mobile phone is electrically connected to the first end of the magnetic bead 902; the second end of the magnetic bead 902 is electrically connected to the second pin of the ambient light sensor 904 and the first end of the capacitor 903, and the second end of the capacitor 903 is grounded. Optionally, the magnetic bead 902 can be 0 ohms, and the magnetic bead 902 is used to suppress high-frequency noise and spike interference on the signal line and the power line, and has the ability to absorb electrostatic pulses. The capacitor 903 is a filter capacitor, and the filter capacitor 903 can be used to filter out noise in the signal. In this example, the magnetic bead 902 and the filter capacitor 903 are provided at the same time, which can eliminate the interference signal in the TE signal and improve the accuracy of the TE signal received by the ambient light sensor.
[0070] When the mobile phone's display is refreshed, the mobile phone's SOC will generate a TE signal; Fig. 9 In the hardware structure shown, the TE signal generated by the SOC 901 is transmitted to the input end of the ambient light sensor 904. After receiving the TE signal, the ambient light sensor 904 may execute step 602.
[0071] In this example, the electrical connection between the SOC and the ambient light sensor in the electronic device needs to be changed in advance so that the ambient light sensor can receive the TE signal in time when the SOC generates the TE signal. The TE signal is directly obtained by the ambient light sensor, and the speed of obtaining the TE signal is fast.
[0072] In other embodiments, when the SOC of the electronic device detects that the automatic dimming application has initiated an instruction to activate the ambient light sensor, the SOC activates the ambient light sensor. The SOC of the electronic device can also open up a transmission channel between the HWC module located at the HAL layer and the ambient light detection driver module located at the kernel layer, so that the HWC module can transmit the TE signal obtained in real time to the ambient light detection driver module.
[0073] When the electronic device is in the screen-off state, the electronic device does not generate a TE signal, the HWC module cannot obtain the TE signal, and thus the ambient light detection drive module cannot obtain the TE signal. Figure 8 As shown, 8a shows that the mobile phone is in a screen-off state, the display screen 801 of the mobile phone is in a screen-off state, the display screen does not generate a TE signal, the HWC module cannot obtain a TE signal, the ambient light detection drive module cannot obtain a TE signal, and the ambient light detection drive module cannot obtain a TE signal, that is, the ambient light sensor does not collect ambient light. When the user unlocks the mobile phone, or performs a screen-on operation on the mobile phone, as shown in 8b, the mobile phone interface 802 is in a screen-on state, the first application in the mobile phone is started, and the first application activates the ambient light sensor in the mobile phone. When the processor detects that the ambient light sensor is activated, the channel between the HWC module and the ambient light detection drive module can be opened.
[0074] Without changing the existing hardware structure of the mobile phone, you can use Fig.10 The software shown in the figure obtains the TE signal. When the ambient light sensor is activated, the SOC opens the channel between the HWC module and the ambient light detection driver module; the HWC module transmits the TE signal to the SensorHub; after the SensorHub obtains the TE signal, it transmits the TE signal to the ambient light detection driver module. After receiving the TE signal, the ambient light detection driver module can execute step 602.
[0075] Step 602: The electronic device obtains the first moment in a refresh period of the TE signal.
[0076] In one exemplary embodiment, when the ambient light sensor and SOC are used as Fig. 9When the electrical connection mode is shown, the TE signal is acquired by the ambient light sensor. The ambient light sensor can acquire the nth rising edge or the nth falling edge of the TE signal in the refresh cycle as the first moment, where n is an integer greater than 0. For example, when n=1, the ambient light sensor can detect whether the first rising edge or the first falling edge of the TE signal is received. If the first rising edge or the first falling edge of the TE signal is detected, step 603 is executed, that is, the operation of triggering the ambient light sensor to start collecting ambient light at the first moment is realized.
[0077] If the first rising edge and the first falling edge of the TE signal are not detected (such as Fig.11 If the TE signal has a non-rising edge or a non-falling edge, step 603 is not executed.
[0078] For example, the Fig.11 FIG. 4 shows the waveform of the TE signal and the detection period of the ambient light sensor. Fig.11 As shown, the black bold line is used to represent the TE signal, and the dotted line is used to represent the waveform of the ambient light sensor detection cycle. In this example, the sensor detects the falling edge of the TE signal 1101, and then determines that the ambient light sensor executes step 603. Among them, t represents the refresh time of the TE signal, and T represents an ambient light detection cycle.
[0079] Optionally, a first clock is provided in the ambient light sensor, and the ambient light sensor can trigger the first clock timing after detecting the rising edge or falling edge of the TE signal; when it is detected that the duration of the first clock timing reaches a preset duration, step 603 is executed. If the ambient light sensor does not detect the rising edge and the falling edge of the TE signal, it is determined that the trigger condition is not met, and step 603 is not executed. If the ambient light sensor detects the rising edge and the falling edge of the TE signal, the first clock timing is triggered; when the duration of the first clock timing does not reach the preset duration, step 603 is not executed.
[0080] The preset duration can be pre-set, and the preset duration is within the refresh period of the TE signal. For example, if the refresh period of the TE signal is 8.33ms, the preset duration can be 1ms, 2ms, 2.2ms, etc. Optionally, the preset duration can be determined according to the period of the TE signal and the detection period of the ambient light sensor. For example, the detection period of the ambient light is recorded as T, and the period of the TE signal is recorded as t; the remainder of T / t can be obtained; the preset duration can be a value greater than 0 and less than or equal to the remainder.
[0081] In this example, the ambient light sensor is triggered with a delay so that the start time of this detection cycle of the ambient light sensor is after the TE signal is detected. Since the delay duration is fixed, the start time of each detection cycle is the same, so that the number of black frame signals generated by the display screen in each detection cycle is the same. Since the number of black frame signals is the same, the impact of the black frames on the collected initial ambient light is the same, thereby avoiding the problem of drastic changes in the external ambient light collected in different detection cycles due to different black frame signals.
[0082] In an exemplary embodiment, without changing the existing hardware structure of the mobile phone, if the following can be adopted Fig.10 When the software shown obtains the TE signal, the ambient light detection driver module determines whether the trigger condition is currently met based on the TE signal.
[0083] The ambient light detection driving module can detect whether the nth rising edge or the nth falling edge of the TE signal in the refresh cycle is received, and if the nth rising edge or the nth falling edge of the TE signal is detected, the ambient light detection driving module can execute step 603. If the ambient light detection driving module does not detect the rising edge and the falling edge of the TE signal, it is determined not to execute step 603.
[0084] Optionally, after the ambient light detection driving module detects the rising edge or falling edge of the TE signal, the timer or timer start is triggered; when it is detected that the timer or the timer timing duration reaches a preset duration, the ambient light detection driving module can execute step 603. If the ambient light detection driving module does not detect the rising edge and the falling edge of the TE signal, it is determined that step 603 is not executed. If the ambient light detection driving module detects the rising edge and the falling edge of the TE signal, the timer or timer start is triggered; when the timer or the timer timing duration does not reach the preset duration, it is determined that step 603 is not executed. The preset duration can be pre-set, and the preset duration is within the refresh period of the TE signal. For example, the refresh period of the TE signal is 11.11ms, and the preset duration can be 3ms, 4ms, 6ms, etc.
[0085] Step 603: The electronic device triggers the ambient light sensor at the first moment to start collecting ambient light.
[0086] In one exemplary embodiment, when the ambient light sensor and SOC are used as Fig. 9 When the ambient light sensor determines to execute step 603, the ambient light sensor triggers to collect ambient light in this round of detection cycle, and obtains the collected initial ambient light, which includes external ambient light and light generated by the target display area.
[0087] In another example, without changing the hardware structure of the electronic device and using software to obtain the TE signal, when the ambient light detection driving module determines to execute step 603, the ambient light detection driving module drives the ambient light sensor to enable the ambient light sensor to start this round of initial ambient light detection.
[0088] Step 604: The electronic device obtains the initial ambient light collected by the ambient light sensor in this detection cycle.
[0089] Exemplarily, the ambient light sensor may send the collected initial ambient light to the SOC for processing by the SOC.
[0090] Step 604: The electronic device obtains the difference between the initial ambient light collected in this detection cycle and the light generated by the target display area to determine the target ambient light.
[0091] In some embodiments, the SOC may obtain the difference between the initial ambient light and the light generated by the target display area. The SOC may determine the target ambient light by a long-time integration method, which will not be described in detail here.
[0092] In this example, black stripes appear in the display screen because a PWM signal is inserted for dimming during the refresh process. That is to say, the inserted PWM signal can be understood as a black frame signal. The display screen refreshes when the TE signal is received. When the TE signal is detected, the TE signal is aligned with the detection cycle so that the number of PWM signals inserted in each detection cycle is the same, that is, the number of black stripes generated is the same, so that the number of black stripes generated in each detection cycle has the same effect on the ambient light detected by the ambient light sensor, thereby suppressing the jump of the determined external ambient light and making the determined external ambient light more accurate.
[0093] Fig.11 The following is a schematic diagram showing the alignment of the ambient light detection cycle with the TE signal. t represents the refresh duration of the TE signal 1101, and t can be 8.33ms, 11.11ms, or 16.67ms. T represents an ambient light detection cycle, also known as the ambient light integration time, and T is generally in the ms level, for example, T can be 50ms. m represents the number of PWM signals 1102 inserted between each frame refresh signal. For example, the mobile phone uses 1920Hz PWM frequency modulation, and m can be 32, 21, 16, etc.
[0094] In this example, the ambient light sensor determines whether to trigger ambient light detection based on the TE signal. Fig.11 When the rising edge of the TE signal 1101 is detected, the ambient light detection is triggered. Fig.11As shown, at this time, the start time of the ambient light detection cycle is after the arrival of the TE signal, and the start time of the ambient light detection cycle is aligned with the first rising edge of the TE signal. In this way, the number of black frame signals generated in the ambient light detection cycle can be determined to be N, as shown in formula (1):
[0095]
[0096] Where n represents the number of times the TE signal is refreshed in one ambient light detection cycle, which can be expressed as In this example, square brackets indicate rounding. n(1+m) represents the total number of PWMs in one ambient light detection cycle; Indicates the number of PWMs generated in the remaining time after T and t are rounded.
[0097] The t1 is the detection error time between two adjacent ambient light detection cycles, and the maximum value of the t1 is t. The error has no effect on the ambient light detection and can be ignored. After each ambient light detection cycle, there is a data reporting cycle, and the SOC can determine the target ambient light and report it to the application.
[0098] pass Fig.11 As can be seen from formula (1), by adopting the ambient light detection method in the present application, the number of black frame signals in each ambient light detection cycle is the same, thereby compressing the jump of ambient light data caused by PWM dimming and screen refresh black frame signals to a great extent, and the compression ratio can reach 88%. Fig.12 This is a comparison diagram of the ambient light reported using the ambient light detection method in the present application and the ambient light reported using the traditional ambient light detection method.
[0099] like Fig.12 As shown, the gray broken line indicates the ambient light reported by the conventional ambient light detection method, and the black broken line indicates the ambient light reported by the ambient light detection method in the present application; Fig.12 As shown, the ambient light collected in the present application tends to be stable without drastic jumps, thereby improving the accuracy of ambient light detection.
[0100] It is understandable that, in order to realize the above functions, the electronic device includes hardware and / or software modules corresponding to the execution of each function. In combination with the algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered to be beyond the scope of the present application.
[0101] This embodiment also provides a computer storage medium, in which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the method of ambient light detection in the above-mentioned embodiment. The storage medium includes: a U disk, a mobile hard disk, a read only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0102] This embodiment further provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement the ambient light detection method in the above-mentioned embodiment.
[0103] Among them, the electronic device, computer storage medium, computer program product or chip provided in this embodiment is used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above and will not be repeated here.
[0104] Any content of each embodiment of the present application, as well as any content of the same embodiment, can be freely combined. Any combination of the above content is within the scope of the present application.
[0105] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A method for ambient light detection, characterized in that: Applied to an electronic device, the electronic device includes a display screen and an ambient light sensor located below the display screen, the method includes: Acquire a frame synchronization signal generated by the display screen; Acquire a first moment in a refresh period of the frame synchronization signal; triggering the ambient light sensor at the first moment to start collecting ambient light; Acquire initial ambient light collected by the ambient light sensor in this detection cycle, wherein the initial ambient light includes target ambient light and light generated by a target display area, wherein the target area is an area of the display screen located above the ambient light sensor; The difference between the initial ambient light collected in this round of detection cycle and the light generated by the target display area is obtained to determine the target ambient light.
2. The method according to claim 1, characterized in that The step of acquiring the frame synchronization signal generated by the display screen comprises: The HWC module of the electronic device acquires the frame synchronization signal; The HWC module transmits the frame synchronization signal to the sensor hub; The sensor hub transmits the frame synchronization timing to the ambient light detection driving module; The ambient light detection driving module obtains the frame synchronization signal.
3. The method according to claim 2, characterized in that The obtaining of the first moment in the refresh period of the frame synchronization signal comprises: The ambient light detection driving module obtains the nth rising edge in the refresh cycle, or the nth falling edge in the refresh cycle as the first moment, where n is an integer greater than 0.
4. The method according to claim 2, characterized in that: The obtaining of the first moment in the refresh period of the frame synchronization signal comprises: When the ambient light detection driving module detects the rising edge or the falling edge of the frame synchronization signal, the timing starts; The ambient light detection driving module acquires the moment when a preset time length is reached from the timing moment; The acquired moment is determined as the first moment.
5. The method according to claim 1, characterized in that The first output pin of the system-on-chip (SOC) in the electronic device is electrically connected to the first end of the magnetic bead, the second end of the magnetic bead is electrically connected to the second pin of the ambient light sensor and the first end of the filter, and the second end of the filter is grounded; Acquiring a frame synchronization signal generated by the display screen includes: The second pin of the ambient light sensor obtains the frame synchronization signal.
6. The method according to claim 5, characterized in that The obtaining of the first moment in the refresh period of the frame synchronization signal comprises: The ambient light sensor acquires an nth rising edge in the refresh cycle, or an nth falling edge in the refresh cycle as the first moment, where n is an integer greater than 0.
7. The method according to claim 5, characterized in that The obtaining of the first moment in the refresh period of the frame synchronization signal comprises: When the ambient light sensor detects a rising edge or a falling edge of the frame synchronization signal, the first clock is triggered to start; When the ambient light sensor detects that the duration of the activation of the first clock reaches a preset duration, the moment when the first clock is activated for the preset duration is determined as the first moment.
8. The method according to claim 4 or 7, characterized in that: The preset duration is greater than 0 and less than a refresh period of the frame synchronization signal.
9. The method according to claim 2, characterized in that: Before acquiring the frame synchronization signal generated by the display screen, the method further includes: The SOC of the electronic device detects activation information and activates the ambient light sensor; Open up the transmission channel between the HWC module and the ambient light detection drive module.
10. An electronic device, characterized in that: include: a memory and a processor, the memory being coupled to the processor; The memory stores program instructions, and when the program instructions are executed by the processor, the electronic device executes the method for ambient light detection as described in any one of claims 1-9.
11. A computer-readable storage medium comprising a computer program, characterized in that: When the computer program is executed on an electronic device, the electronic device is enabled to execute the method for detecting ambient light according to any one of claims 1 to 9.
