Ambient light detection method, electronic equipment and readable storage medium
During the refresh process of the electronic device's display screen, the ambient light sensor is updated in the black area to detect ambient light near the installation position, which solves the problem of inaccurate ambient light data, improves detection accuracy and efficiency, and reduces power consumption. Consumption.
Patent Information
- Application Number
- CN202410608094.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-28
- Publication Date
- 2024-08-30
AI Technical Summary
When existing electronic equipment collects data from ambient light sensors, the preset time is inappropriate, resulting in inaccurate ambient light data collected, affecting the accuracy of display brightness adjustment, and increasing data processing complexity and power consumption.
During the display refresh process, the ambient light sensor detects ambient light when the black area is updated to near the installation position, reducing the impact of the brightness of the display on detection. By adjusting the detection starting time point and delay length, ambient light detection is improved. accuracy and efficiency.
It improves the accuracy and detection efficiency of ambient light data, reduces power consumption, and avoids the loss of battery life of electronic devices.
Smart Images

Figure CN118565629A
Abstract
Description
[0001] This application is based on a divisional application with application number 202310230133.7, application date February 28, 2023, and invention name “Method for detecting ambient light, electronic device and readable storage medium”. The entire contents of the original application are incorporated into this application by reference. Technical Field
[0002] The present application relates to the field of terminal technology, and in particular to a method for detecting ambient light, an electronic device, and a readable storage medium. Background Art
[0003] With the development of society, users are becoming more and more dependent on electronic devices. In order to alleviate the eye fatigue caused by users when using electronic devices, ambient light sensors are usually installed in electronic devices. Electronic devices can detect the ambient light of the current environment through ambient light sensors, and adjust the brightness of the electronic device display screen according to the detection results, so that the brightness of the electronic device display screen adapts to the brightness of the ambient light.
[0004] At present, when receiving a screen-on operation, the electronic device controls the display screen to turn on the screen. After the screen is turned on, in order to allow the user to see a smooth picture on the display screen, the electronic device needs to refresh the display screen frame by frame. In addition, after the screen is turned on, the ambient light sensor will be triggered to perform ambient light detection within a preset time.
[0005] However, since the ambient light sensor continuously collects data within a preset time period starting from the refresh of the display screen, if the preset time period is not set appropriately, the ambient light data collected by the ambient light sensor will include not only the ambient light data of the real environment, but also the brightness interference data of the display screen, thereby causing the ambient light data collected by the ambient light sensor to be inaccurate, thereby reducing the accuracy of adjusting the brightness of the display screen. Summary of the invention
[0006] The present application provides an ambient light detection method, an electronic device and a readable storage medium, which can solve the problem in the related art that the ambient light data collected by the ambient light sensor is inaccurate, resulting in low accuracy in adjusting the brightness of the display screen. The technical solution is as follows:
[0007] In a first aspect, a method for detecting ambient light is provided, which is applied to an electronic device, and the method comprises:
[0008] After the display screen of the electronic device is lit up, refreshing the display screen frame by frame;
[0009] In the process of refreshing each frame, after the black insertion area in the display screen is updated to the target position, the ambient light sensor of the electronic device is controlled to perform ambient light detection to obtain an ambient light detection result, wherein the black insertion area is an area in the display screen where the backlight is turned off during the process of refreshing the display screen, and the black insertion area is updated and displayed from top to bottom in the display screen, and the target position is a specified position in the display screen near the installation position of the ambient light sensor;
[0010] The ambient light data of the current environment is determined according to the ambient light detection result.
[0011] In this way, the ambient light sensor detects ambient light when the black area is updated to the vicinity of the installation position of the ambient light sensor, which means that the ambient light sensor detects ambient light in the area where the backlight is turned off. In this way, the brightness data of the display screen is rarely included in the obtained ambient light detection result, that is, the influence of the brightness of the display screen on the ambient light detection by the ambient light sensor is reduced, so that the ambient light sensor detects the ambient light data of the real environment, thereby improving the accuracy of the detected ambient light data. At the same time, because the electronic device detects through ambient light data when the black area is updated to the vicinity of the installation position of the ambient light sensor, the data detection amount is reduced and the efficiency of ambient light detection is improved.
[0012] As an example of the present application, in the process of refreshing each frame, after the black insertion area in the display screen is updated to the target position, controlling the ambient light sensor of the electronic device to perform ambient light detection includes:
[0013] In the process of refreshing any one display frame, according to the detection reference time point and the delay duration corresponding to the any one display frame, determine the detection starting time point for performing ambient light detection in the process of refreshing the any one display frame, the detection reference time point is the time point when the black insertion area is updated to the target position, the detection reference time point is determined according to the display starting position, the display starting time point of the black insertion area, the specified update rate of the black insertion area and the target position, and the delay duration is the delay relative to the detection reference time point;
[0014] The ambient light sensor is controlled to perform ambient light detection at the determined detection start time point to obtain the ambient light detection result.
[0015] In this way, after the black insertion area is updated to the target position, the corresponding detection start time point is determined by the delay time corresponding to the currently refreshed display frame, and the ambient light detection is performed at the determined detection start time point, thereby not only reducing the amount of data for ambient light detection, but also improving the accuracy of ambient light detection. In addition, different display frames correspond to different delay times, so that in the process of refreshing each display frame, the ambient light detection is more targeted and the accuracy of ambient light detection is improved.
[0016] As an example of the present application, the ambient light detection result includes at least one detection result;
[0017] In the process of refreshing any one display frame, determining the detection starting time point for performing ambient light detection in the process of refreshing any one display frame according to the detection reference time point and the delay time length corresponding to the any one display frame, comprises:
[0018] In the case where any one of the display frames is the first display frame, at least one detection start time point is determined according to the detection reference time point and at least one delay time threshold corresponding to the first display frame, the first display frame is the first display frame refreshed when the display screen is initially lit, each of the at least one detection start time point is a time point at which an ambient light detection is performed once during the process of refreshing the first display frame, and the at least one extended time threshold corresponds one-to-one to the at least one detection result;
[0019] In the case that any one of the display frames is the second display frame, the detection starting time point for performing ambient light detection in the process of refreshing the second display frame is determined according to the detection reference time point and the reference delay duration corresponding to the second display frame, the second display frame is any one of the display frames except the first display frame, and the reference delay duration is determined according to a delay duration threshold corresponding to a detection result including a minimum light intensity value in at least one detection result.
[0020] In this way, by setting at least one delay time threshold, the ambient light sensor can perform multiple ambient light detections, thereby improving the accuracy of ambient light detection and alleviating the impact of installation errors of the ambient light sensor.
[0021] As an example of the present application, the method further includes:
[0022] From the at least one delay duration threshold, determine the target delay duration threshold corresponding to the detection result including the minimum light intensity value as the reference delay duration corresponding to the second display frame.
[0023] In this way, by determining the target delay time threshold, a reliable basis is provided for the subsequent ambient light detection by the ambient light sensor during the process of refreshing the second display frame, thereby improving the efficiency of the ambient light detection.
[0024] As an example of the present application, the method further includes:
[0025] Determine, from the at least one delay duration threshold, a target delay duration threshold corresponding to the detection result including the minimum light intensity value;
[0026] Determine N-1 delay duration thresholds according to the target delay duration threshold and the preset delay error, where N is a positive integer greater than 2;
[0027] The N-1 delay duration thresholds and the target delay duration are determined as reference delay durations corresponding to the second display frame.
[0028] In this way, by optimizing the timing of the ambient light sensor detecting ambient light based on the target delay duration threshold, the accuracy of the ambient light sensor detecting ambient light is further improved.
[0029] As an example of the present application, the method further includes:
[0030] After the display screen is lit up, determining the number of rows between the display start position of the black insertion area and the target position;
[0031] Multiplying the number of rows by the specified update rate to obtain an update duration of the black insertion area from the display start position to the target position;
[0032] The display start time of the black insertion area is added to the update duration to obtain a time point when the black insertion area is updated from the display start position to the target position, and the detection reference time point is the determined time.
[0033] In this way, since the update duration of the black insertion area from the display start position to the target position is fixed, the detection reference time point is determined by the update duration, thereby improving the accuracy of determining the detection reference time point.
[0034] As an example of the present application, the target signal pin of the display screen is connected to the signal input pin of the ambient light sensor, and the target signal pin is any signal output pin of the display screen;
[0035] The method further comprises:
[0036] Before refreshing any one of the display frames, the display screen sends a first screen refresh message to the ambient light sensor through the target signal pin, wherein the first screen refresh message carries the detection reference time point and a delay time length corresponding to any one of the display frames;
[0037] In the process of refreshing any one display frame, determining the detection starting time point for performing ambient light detection in the process of refreshing any one display frame according to the detection reference time point and the delay time length corresponding to the any one display frame, comprises:
[0038] During the process of refreshing any one display frame, when the ambient light sensor receives the first screen refresh message, the ambient light sensor determines the detection starting time point for ambient light detection during the process of refreshing any one display frame based on the detection reference time point and the delay length corresponding to the any one display frame.
[0039] In this way, by sending the first screen refresh message to the ambient light sensor, the ambient light sensor can be quickly triggered. At the same time, since the first screen refresh message carries the detection reference time point and the delay length corresponding to any display frame, the ambient light sensor will not perform ambient light detection immediately after being triggered, and will perform ambient light detection when the corresponding detection start time point is reached, thereby reducing the number of detections by the ambient light sensor and improving the detection efficiency of the ambient light sensor.
[0040] As an example of the present application, the target signal pin of the display screen is also connected to a microcontroller unit MCU; the method further includes:
[0041] The display screen sends the first screen refresh message to the MCU via the target signal pin, so that the MCU stops updating data in the refresh area of the display screen.
[0042] In this way, by sending the first screen refresh message to the MCU through the display screen, the MCU can be prevented from updating data in the refresh area of the display screen, thereby avoiding the occurrence of a screen distortion problem on the display screen.
[0043] As an example of the present application, determining ambient light data of the current environment according to the ambient light detection result includes:
[0044] In the case where the ambient light detection result includes multiple detection results, determining the detection result including the minimum light intensity value among the multiple detection results as the ambient light data of the current environment; or
[0045] In a case where the ambient light detection results include one detection result, the detection result is determined as the ambient light data.
[0046] It is worth noting that the detection result including the minimum light intensity value among the multiple detection results is the detection result closest to the current ambient light. Therefore, the electronic device determines it as the ambient light data of the current environment to improve the accuracy of subsequent display brightness adjustment.
[0047] In a second aspect, an electronic device is provided, wherein the structure of the electronic device includes a processor and a memory, wherein the memory is used to store a program that supports the electronic device to execute the ambient light detection method provided in the first aspect, and to store data involved in implementing the ambient light detection method described in the first aspect. The processor is configured to execute the program stored in the memory. The electronic device may also include a communication bus, wherein the communication bus is used to establish a connection between the processor and the memory.
[0048] The processor is configured to:
[0049] After the display screen of the electronic device is lit up, refreshing the display screen frame by frame;
[0050] In the process of refreshing each frame, after the black insertion area in the display screen is updated to the target position, the ambient light sensor of the electronic device is controlled to perform ambient light detection to obtain an ambient light detection result, wherein the black insertion area is an area in the display screen where the backlight is turned off during the process of refreshing the display screen, and the black insertion area is updated and displayed from top to bottom in the display screen, and the target position is a specified position in the display screen near the installation position of the ambient light sensor;
[0051] The ambient light data of the current environment is determined according to the ambient light detection result.
[0052] As an example of the present application, the processor is configured to:
[0053] In the process of refreshing any one display frame, according to the detection reference time point and the delay duration corresponding to the any one display frame, determine the detection starting time point for performing ambient light detection in the process of refreshing the any one display frame, the detection reference time point is the time point when the black insertion area is updated to the target position, the detection reference time point is determined according to the display starting position, the display starting time point of the black insertion area, the specified update rate of the black insertion area and the target position, and the delay duration is the delay relative to the detection reference time point;
[0054] The ambient light sensor is controlled to perform ambient light detection at the determined detection start time point to obtain the ambient light detection result.
[0055] As an example of the present application, the ambient light detection result includes at least one detection result;
[0056] The processor is configured to:
[0057] In the case where any one of the display frames is the first display frame, at least one detection start time point is determined according to the detection reference time point and at least one delay time threshold corresponding to the first display frame, the first display frame is the first display frame refreshed when the display screen is initially lit, each of the at least one detection start time point is a time point at which an ambient light detection is performed once during the process of refreshing the first display frame, and the at least one extended time threshold corresponds one-to-one to the at least one detection result;
[0058] In the case that any one of the display frames is the second display frame, the detection starting time point for performing ambient light detection in the process of refreshing the second display frame is determined according to the detection reference time point and the reference delay duration corresponding to the second display frame, the second display frame is any one of the display frames except the first display frame, and the reference delay duration is determined according to a delay duration threshold corresponding to a detection result including a minimum light intensity value in at least one detection result.
[0059] As an example of the present application, the processor is further configured to:
[0060] From the at least one delay duration threshold, determine the target delay duration threshold corresponding to the detection result including the minimum light intensity value as the reference delay duration corresponding to the second display frame.
[0061] As an example of the present application, the processor is further configured to:
[0062] Determine, from the at least one delay duration threshold, a target delay duration threshold corresponding to the detection result including the minimum light intensity value;
[0063] Determine N-1 delay duration thresholds according to the target delay duration threshold and the preset delay error, where N is a positive integer greater than 2;
[0064] The N-1 delay duration thresholds and the target delay duration are determined as reference delay durations corresponding to the second display frame.
[0065] As an example of the present application, the processor is further configured to:
[0066] After the display screen is lit up, determining the number of rows between the display start position of the black insertion area and the target position;
[0067] Multiplying the number of rows by the specified update rate to obtain an update duration of the black insertion area from the display start position to the target position;
[0068] The display start time of the black insertion area is added to the update duration to obtain a time point when the black insertion area is updated from the display start position to the target position, and the detection reference time point is the determined time.
[0069] As an example of the present application, the target signal pin of the display screen is connected to the signal input pin of the ambient light sensor, and the target signal pin is any signal output pin of the display screen;
[0070] The processor is further configured to:
[0071] Before refreshing any one of the display frames, control the display screen to send a first screen refresh message to the ambient light sensor through the target signal pin, wherein the first screen refresh message carries the detection reference time point and a delay time length corresponding to any one of the display frames;
[0072] The processor is configured to:
[0073] During the process of refreshing any one display frame, when the ambient light sensor receives the first screen refresh message, the ambient light sensor is controlled to determine the detection starting time point for ambient light detection during the process of refreshing any one display frame based on the detection reference time point and the delay length corresponding to the any one display frame.
[0074] As an example of the present application, the target signal pin of the display screen is also connected to the microcontroller unit MCU; the processor is also configured to: control the display screen to send the first screen refresh message to the MCU through the target signal pin, so that the MCU stops updating data in the display screen refresh area.
[0075] As an example of the present application, the processor is configured to:
[0076] In the case where the ambient light detection result includes multiple detection results, determining the detection result including the minimum light intensity value among the multiple detection results as the ambient light data of the current environment; or
[0077] In a case where the ambient light detection results include one detection result, the detection result is determined as the ambient light data.
[0078] In a third aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer executes the ambient light detection method described in the first aspect.
[0079] In a fourth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the ambient light detection method described in the first aspect.
[0080] The technical effects obtained by the above-mentioned second aspect, third aspect and fourth aspect are similar to the technical effects obtained by the corresponding technical means in the above-mentioned first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0081] Figure 1 is a schematic diagram of the structure of a smart watch provided in an embodiment of the present application;
[0082] Figure 2 is a schematic diagram of stacking an ambient light sensor in a smart watch provided by an embodiment of the present application;
[0083] Figure 3 It is a schematic diagram of an application scenario provided by an embodiment of the present application;
[0084] Figure 4 This is a flow chart of a method for detecting ambient light provided in an embodiment of the present application;
[0085] Figure 5 It is a schematic diagram of the layout of the operability area of a smart watch provided in an embodiment of the present application;
[0086] Figure 6 This is a timing diagram of collecting ambient light data provided by an embodiment of the present application;
[0087] Figure 7 This is a schematic diagram of an application scenario of updating and displaying a black area provided by an embodiment of the present application;
[0088] Figure 8 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application;
[0089] Fig. 9 It is a block diagram of a software system of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0090] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0091] It should be understood that the "multiple" mentioned in this application refers to two or more. In the description of this application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in order to facilitate the clear description of the technical solution of this application, the words "first" and "second" are used to distinguish between the same items or similar items with basically the same functions and effects. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not limit them to be different.
[0092] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0093] With the development of technology, users are becoming more and more dependent on electronic devices, and users usually stare at the display screen of the electronic device for a long time when using the electronic device, so the brightness of the display screen will cause eye fatigue of the user. Therefore, in order to alleviate the eye fatigue of the user when using the electronic device, the electronic device usually needs to adjust the brightness of the display screen according to the surrounding ambient light, so that the brightness of the display screen adapts to the brightness of the surrounding ambient light.
[0094] At present, when an electronic device receives a screen-lighting operation, it can light up the display screen. After lighting up the display screen, in order to allow the user to observe a smooth picture on the display screen, the electronic device can refresh the display screen and trigger the ambient light sensor to detect the ambient light. Among them, when the ambient light sensor is triggered, it can continuously detect multiple sets of ambient light data within a preset time period, and determine the ambient light data with the smallest light intensity among the multiple sets of ambient light data, so that the electronic device can adjust the brightness of the display screen according to the ambient light data with the smallest light intensity.
[0095] However, since the ambient light sensor continuously collects data within a preset time period starting from the refresh of the display screen, if the preset time period is not set appropriately, the ambient light data collected by the ambient light sensor will include not only the ambient light data of the real environment, but also the brightness interference data of the display screen, which will cause the ambient light data collected by the ambient light sensor to be inaccurate, thereby reducing the accuracy of adjusting the brightness of the display screen. At the same time, since the ambient light sensor continuously collects data within a preset time period starting from the refresh of the display screen, a large amount of ambient light data will be collected, resulting in more complicated processing of the ambient light data, thereby reducing the efficiency of ambient light detection, and at the same time generating greater power consumption, reducing the battery life of the electronic device.
[0096] In order to improve the accuracy of detecting ambient light data and the efficiency of ambient light detection, an embodiment of the present application provides an ambient light detection method, in which after the display screen of the electronic device is lit, the display screen can be refreshed frame by frame, and in the process of refreshing each frame, after the black insertion area is updated to a position near the installation position of the environmental sensor, the ambient light sensor of the electronic device is controlled to perform ambient light detection to obtain an ambient light detection result, and then the ambient light data of the current environment is determined according to the ambient light detection result. Since the black insertion area is the area where the backlight of the display screen is turned off during the refresh process of the display screen, and the black insertion area can be updated from top to bottom in the display screen, therefore, the ambient light sensor performs ambient light detection when the black insertion area is updated to the vicinity of the installation position of the ambient light sensor, indicating that the ambient light sensor performs ambient light detection in the area where the backlight is turned off, then the obtained ambient light detection result rarely contains the brightness data of the display screen, that is, the influence of the brightness of the display screen on the ambient light detection of the ambient light sensor is reduced, so that the ambient light sensor detects the ambient light data of the real environment, thereby improving the accuracy of the detection of ambient light data. At the same time, since the electronic device detects through ambient light data when the black area is updated to near the installation position of the ambient light sensor, the data detection amount is reduced, the efficiency of ambient light detection is improved, and at the same time, large power consumption is avoided, thereby avoiding the loss of the battery life of the electronic device.
[0097] Before explaining in detail the ambient light detection method provided in the embodiment of the present application, the electronic device involved in the embodiment of the present application is first described.
[0098] As an example, the electronic device may be a device equipped with a display screen, and an ambient light sensor is installed in the electronic device. The electronic device may support a pulse width modulation (PWM) dimming mode, and may also support a DC dimming mode (level dimming mode). As an example and not a limitation, the electronic device may be, but is not limited to, a mobile sports camera (GoPro), a digital camera, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, a vehicle-mounted device, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), an augmented reality (AR)\virtual reality (VR) device, a mobile phone, a smart watch, etc., and the embodiments of the present application are not limited to this.
[0099] As an example, in the case where the electronic device is a smart watch, different smart watches may have different layouts of ambient light sensors. Figure 1 In Figure (a), the ambient light sensor 1 of the smart watch can be arranged on the flexible and rigid-flex (FPC) 2 of the display screen of the smart watch through foam. In another possible way, the ambient light sensor of the smart watch is arranged on the main board 3 (also called the rigid printed circuit board (PCB)), and in order to ensure the field of view (FOV) of the electronic device, there are certain requirements for the distance between the ambient light sensor 1 and the display screen. Therefore, see Figure 1 As shown in Figure (b), an elevated board 4 may be provided on the main board 3, and the ambient light sensor 1 is mounted on the elevated board 4. The elevated board may reduce the distance between the ambient light sensor 1 and the display screen, so that the distance between the ambient light sensor and the display screen meets the FOV design specification requirements.
[0100] In order to facilitate understanding of the position of the ambient light sensor 1 in a smart watch with different layouts, the present application embodiment provides a schematic diagram of stacking the ambient light sensor in a smart watch. In the case where the ambient light sensor 1 is arranged on the flexible circuit board 2 of the display screen of the smart watch, the stacking method of the ambient light sensor 1 in the smart watch can be as follows: Figure 2 In the case where the ambient light sensor 1 is arranged on the mainboard 3 of the smart watch, the stacking method of the ambient light sensor in the smart watch can be as follows: Figure 2 As shown in Figure (b).
[0101] It should be noted that, in order to ensure that the ambient light sensor can collect ambient light data of the environment, the installation position of the ambient light sensor corresponds to the opening of the super clean foam (SCF) in the display screen, that is, there is a part of the display screen without SCF attached, and the area without SCF attached is called the SCF opening. The ambient light sensor is installed at the position corresponding to the SCF opening, so that the ambient light sensor can collect ambient light data through the SCF opening.
[0102] In some embodiments, the ambient light sensor may be a sensor that supports a short integration function, which refers to the short integration time capability of the ambient light sensor in milliseconds (ms) or even microseconds (us), that is, the ambient light sensor can complete ambient light detection within milliseconds or even microseconds.
[0103] In some embodiments, the smart watch may include not only an ambient light sensor 1 and a display screen, but may also include other devices, for example, a micro controller unit (MCU) (not shown in the figure), and the embodiments of the present application do not impose specific limitations on this.
[0104] In addition, when the ambient light sensor is set in the smart watch, the ambient light sensor is not visible, but in order to understand the embodiments of the present application, the ambient light sensor is shown in the drawings of the embodiments of the present application. Figure 1 or Figure 2 The illustrated layout of the ambient light sensor is provided for illustration only and does not constitute a limitation to the embodiments of the present application.
[0105] For ease of understanding, before introducing the method provided in the embodiment of the present application in detail, based on the execution subject provided in the above embodiment, the application scenario involved in the embodiment of the present application is introduced by taking the electronic device being a smart watch as an example.
[0106] Please refer to Figure 3 , Figure 3 is a schematic diagram of an application scenario according to an exemplary embodiment. In a possible scenario, when a user wears a smart watch, the user may need to check the time through the smart watch. In this case, see Figure 3 In Figure (a), the user can raise the wrist wearing the smart watch; if the smart watch is provided with a function of lighting up the screen by raising the wrist, the smart watch can light up the display screen of the smart watch in response to the user's wrist raising operation. After lighting up the display screen, see Figure 3In Figure (b), the smart watch refreshes the display screen frame by frame. During the refresh process, the black area 5 in the display screen is updated from top to bottom. When the black area is updated to the vicinity of the installation position of the ambient light sensor 1, the ambient light sensor 1 can perform ambient light detection and obtain an ambient light detection result. The smart watch can determine the ambient light data of the current environment based on the ambient light detection result, see Figure 3 As shown in Figure (c), the smart watch can adjust the brightness of the display screen according to the ambient light data of the current environment (in the drawings of the embodiments of the present application, adding a background pattern to the display screen indicates reducing the brightness of the display screen).
[0107] It should be noted that the black insertion area is the area where the backlight of the display screen is turned off during the refresh process, that is, the display screen will turn off some backlights from top to bottom in turn during the refresh process, and when the backlight of one area is turned off, the backlights of other areas are all lit, and the area with the backlight turned off is the black insertion area in the display screen. Since the backlights are turned off and lit in turn, a black insertion area that is updated and displayed from top to bottom in the display screen can be formed in the display screen. In addition, since the update display of the black insertion area in the display screen is very fast, and the update of the black insertion area cannot be captured by the human eye, therefore, when the black insertion area is updated in the display screen, the user still sees a full-screen lit picture, and will not observe the black insertion area. Therefore, the drawings of the embodiments of the present application only illustrate the black insertion area as an example, and it does not mean that the user can observe the black insertion area shown in the drawings.
[0108] In some embodiments, when the user needs to view the display screen of the smart watch, he can not only Figure 3 The wrist-raising operation can be performed in the manner shown, and the display screen of the smart watch can also be lit up in other ways. For example, the user can click the display screen, double-click the display screen, or press the watch hand rotation button of the smart watch. The embodiment of the present application does not specifically limit the operation of the user lighting up the smart watch.
[0109] It should be noted that, in the embodiments of the present application, only the above Figure 3 The application scenario shown is used as an example for illustration and does not constitute a limitation on the embodiments of the present application.
[0110] Based on the execution subjects and application scenarios provided in the above embodiments, the detection method of ambient light provided in the embodiments of the present application is introduced below. Figure 4 , Figure 4 The present invention is a flow chart of a method for detecting ambient light according to an exemplary embodiment. Here, the method is described by taking the application of the method in an electronic device as an example. The method may include some or all of the following contents:
[0111] Step 401: Receive a screen-lighting operation triggered by a user.
[0112] When the electronic device is in the screen-off state, if the user needs to use the electronic device, it is usually necessary to turn the display of the electronic device into the screen-on state. Therefore, the user can perform a screen-on operation on the electronic device, and the electronic device can receive the screen-on operation triggered by the user.
[0113] It should be noted that the screen-lighting operation of the user on the electronic device is different depending on the type of electronic device. For example, in the case where the electronic device is a smart watch, the screen-lighting operation may be single-clicking or double-clicking the display screen, pressing the watch hand rotation button, or raising the wrist when wearing a smart watch. Figure 3 The application scenario shown.
[0114] Step 402: In response to the screen light-up operation, light up the display screen.
[0115] It should be noted that a display screen controller is usually installed in the display screen, so the electronic device responds to the screen lighting operation, and the operation of lighting up the display screen may include: the display screen controller responds to the screen lighting operation and lights up the display screen.
[0116] Step 403: After the display screen is turned on, the display screen is refreshed frame by frame.
[0117] After the display screen is turned on, in order to play the picture smoothly on the display screen, the electronic device can refresh the display screen frame by frame.
[0118] As an example, the refresh of the display screen by the electronic device includes updating and displaying the black area in the display screen, wherein the black area refers to the area in the display screen where the backlight is turned off, and the black area is updated and displayed from top to bottom in the display screen. After the black area is updated from top to bottom once, it indicates that the current frame of the picture has been updated.
[0119] It should be noted that updating the black area from top to bottom in the display screen means that the backlights in the display screen are turned off in turn from top to bottom, and the shape of the black area is related to the shape of the display screen. When the shape of the display screen is a rectangle, the shape of the black area is also a rectangle. When the shape of the display screen is a circle, the shape of the black area is an irregular shape with the upper and lower bottom sides perpendicular to the update direction.
[0120] In some embodiments, the width of the black insertion area in the display screen is a specified ratio to the width of the display screen, and the specified ratio may be 15% or 16%, etc. The present application embodiment does not impose any specific limitation on this, and the width of the display screen and the width of the black insertion area are both parallel to the update direction of the black insertion area.
[0121] It should be noted that the width of the display screen is generally the width of the active area (AA) of the display screen. For example, when the electronic device is a smart watch, the AA area of the smart watch can be as follows: Figure 5 As shown in (schematic diagram of internal layout of display screen), the width of the black area in the display screen of the smart watch accounts for 15% of the width of the display screen. When the diameter of the display screen of the smart watch is 37.95 mm (millimeter), the width of the black area is about 5.69 mm. Or, from the perspective of pixels, when the resolution of the display screen of the smart watch is 466*466, the width of the display screen includes 466 rows of pixels, and the width of the black area occupies 70 rows of pixels.
[0122] As can be seen from the above, an electronic device may include an MCU and a display screen, wherein the target signal pin of the display screen can be connected to the MCU of the electronic device, and the target signal pin is any signal output pin in the display screen. Because usually, during the process of refreshing the display screen, if the MCU of the electronic device writes data in the area where the display screen is being refreshed, it will cause the display screen to be distorted. Therefore, in order to avoid this situation, the display screen can send a first screen refresh message to the MCU through the target signal output pin after it is lit. The first screen refresh message can prompt the MCU that the display screen has started to refresh from the first row, so that the MCU stops updating data in the refresh area of the display screen. The display screen is refreshed frame by frame after sending the first screen refresh message.
[0123] It should be noted that the target signal pin may be a TE (Tearing effect) signal pin or an EM signal pin (transmitting signal pin) of a display screen (or a display screen controller).
[0124] It is worth noting that by sending the first screen refresh message to the MCU through the display screen, the MCU can be prevented from updating data in the refresh area of the display screen, thereby avoiding the occurrence of a screen distortion problem on the display screen.
[0125] Step 404: in the process of refreshing each frame, after the black insertion area in the display screen is updated to the target position, the ambient light sensor is controlled to perform ambient light detection to obtain an ambient light detection result.
[0126] It should be noted that the target position is a designated position in the display screen that is near the installation position of the ambient light sensor.
[0127] As can be seen from the above, the ambient light sensor is usually installed at the position corresponding to the SCF opening. If the black area is updated to display at the SCF opening, it means that the backlight near the SCF opening is turned off. If the ambient light sensor starts to detect ambient light in this case, the effect of the brightness of the display screen on the ambient light detection will be greatly reduced. Therefore, the designated position can be the starting position of the SCF opening or the center point of the SCF opening, etc., and the embodiments of the present application do not impose specific restrictions on this.
[0128] As an example, updating the black insertion area to the target position may refer to updating the horizontal center line of the black insertion area to the target position, or may refer to updating the upper bottom edge or the lower bottom edge of the black insertion area to the target position, which is not specifically limited in the embodiments of the present application. The horizontal center line is perpendicular to the update direction of the black insertion area.
[0129] In some embodiments, during the process of refreshing each frame of the electronic device, after the black area in the display screen is updated to the target position, the operation of controlling the ambient light sensor of the electronic device to perform ambient light detection includes: during the process of refreshing any display frame, determining the detection starting time point for performing ambient light detection during the process of refreshing any display frame according to the detection reference time point and the delay duration corresponding to any display frame, the detection reference time point is the time point when the black area is updated to the target position, the detection reference time point is determined based on the display starting position, the display starting time point of the black area, the specified update rate of the black area and the target position, and the delay duration is the delay relative to the detection reference time point; controlling the ambient light sensor to perform ambient light detection at the determined detection starting time point to obtain the ambient light detection result.
[0130] It is worth noting that after the black area is updated to the target position, the corresponding detection start time point is determined by the delay time corresponding to the currently refreshed display frame, and the ambient light detection is performed at the determined detection start time point, thereby not only reducing the amount of data for ambient light detection, but also improving the accuracy of ambient light detection. In addition, different display frames correspond to different delay times, so that in the process of refreshing each display frame, the ambient light detection is more targeted and the accuracy of ambient light detection is improved.
[0131] For example, see Figure 6 , Figure 6 In the timing diagram in , a high level indicates that the backlight at the location of the ambient light sensor is on, and a low level indicates that the backlight at the location of the ambient light sensor is off. Figure 6It can be seen that in the process of ambient light detection in the related technology, no attention is paid to whether the ambient light detection is performed after the black insertion area reaches the target position, which results in a large amount of data that needs to be detected. In the embodiment of the present application, the ambient light detection is performed after the black insertion area is updated to the target position, thereby reducing the amount of data that can be detected by ambient light.
[0132] Since the timing of users using electronic devices is different, the timing of lighting up the display screen is also different, and thus the detection reference time point is also different each time. Therefore, after the display screen is lit, the electronic device needs to determine the detection reference time point based on the display starting position, the display starting time point of the black insertion area, the specified update rate of the black insertion area, and the target position.
[0133] As an example, the operation of an electronic device determining a detection reference time point based on a display starting position, a display starting time point of a black inserted area, a specified update rate of the black inserted area, and a target position includes: determining the number of rows between the display starting position and the target position of the black inserted area; multiplying the number of rows by the specified update rate to obtain an update duration for the black inserted area to be updated from the display starting position to the target position; adding the display starting time of the black inserted area to the update duration to obtain a time point for the black inserted area to be updated from the display starting position to the target position, and the detection reference time point is the determined time.
[0134] It should be noted that the specified update rate is related to the refresh time of a frame of the display screen. Therefore, the electronic device can divide the refresh time of the display screen by the number of pixel rows of the display screen to obtain the refresh rate of each row, and the refresh rate of each row is the specified update rate. For example, when the refresh rate of the display screen is 60Hz (hertz), the refresh time of each frame of the display screen is 1 / 60ms (milliseconds), that is, 16.67ms; when the resolution of the display screen is 466*466, it means that the number of pixel rows of the display screen is 466 rows, so the specified update rate is 16.67 / 466us (microseconds), that is, 35.8us.
[0135] Since the display starting position, target position and update duration of the black area from the display starting position to the target position are fixed, the electronic device can determine the number of rows between the display starting position and the target position of the black area, and multiply the number of rows by the specified update rate to obtain the update duration.
[0136] For example, the ambient light sensor is installed near the SCF opening of the display screen, then in the AA area of the display screen, Figure 5As shown in FIG. 1 , when the diameter of the AA area is 37.95 mm and the resolution of the display is 466*466, the distance between the center line of the SCF opening (perpendicular to the update direction of the black insertion area) and the upper edge of the AA area is 31.18 mm; when the refresh rate of the display is 60 Hz, the update time from the black insertion area to the center point of the SCF is about 13.693 ms. The scenario where the black insertion area is updated to the center point of the SCF can be as follows Figure 7 shown.
[0137] It is worth noting that, since the update duration of the black insertion area from the display start position to the target position is fixed, the detection reference time point is determined by the update duration, thereby improving the accuracy of determining the detection reference time point.
[0138] Since the update duration is fixed, the electronic device can directly store the update duration. In this case, when the electronic device refreshes each frame, the electronic device can directly add the display start time of the black area to the update duration to obtain the time for the black area to be updated from the display start position to the target position. There is no need to determine the number of rows between the display start position and the target position of the black area and the update duration again, thereby improving the efficiency of determining the detection reference time point.
[0139] In order to enable the ambient light sensor to perform ambient light detection during the display screen refresh process, the target signal pin of the display screen is not only connected to the MCU, but also connected to the signal input pin of the ambient light sensor. In this case, after the display screen is lit and before refreshing any display frame, the display screen can send a first screen refresh message to the ambient light sensor through the target signal pin, and the first screen refresh message carries the detection reference time point and the delay length corresponding to any display frame; in the process of refreshing any display frame, when the ambient light sensor receives the first screen refresh message, the ambient light sensor can determine the detection start time point for performing ambient light detection during the process of refreshing any display frame based on the detection reference time point and the delay length corresponding to any display frame, and perform ambient light detection at the determined detection start time point to obtain the ambient light detection result.
[0140] It should be noted that the signal input pin of the ambient light sensor may be a VSYNC signal pin (frame synchronization signal pin).
[0141] It is worth noting that by sending the first screen refresh message to the ambient light sensor, the ambient light sensor can be quickly triggered. At the same time, since the first screen refresh message carries the detection reference time point and the delay length corresponding to any display frame, the ambient light sensor will not immediately perform ambient light detection after being triggered, and will perform ambient light detection when the corresponding detection start time point is reached, thereby reducing the number of detections by the ambient light sensor and improving the detection efficiency of the ambient light sensor. In addition, since the target signal pin of the display screen is connected to the signal input pins of the MCU and the ambient light sensor at the same time, the signal output by the display screen can be sent to the MCU and the ambient light sensor at the same time. For example, the above-mentioned first screen refresh message can be sent to the MCU and the ambient light sensor at the same time, so that the ambient light sensor and the display screen are synchronized in timing, improving the accuracy of ambient light collection.
[0142] In some embodiments, when the target signal pin of the display screen is connected to the signal input pin of the ambient light sensor, after the display screen is lit and before refreshing any display frame, the display screen can not only send a first screen refresh message to the ambient light sensor, but the message sent by the display screen can also be other messages. Exemplarily, after the display screen is lit and before refreshing any display frame, the display screen can send a second screen refresh message to the ambient light sensor through the target signal pin, and any display frame in the second screen refresh message corresponds to a detection start time point. In the process of refreshing any display frame, when the ambient light sensor receives the second screen refresh message, the ambient light sensor can perform ambient light detection at the detection start time point carried in the second screen refresh message to obtain an ambient light detection result.
[0143] It should be noted that since the target signal pin of the display screen is connected to the signal input pin of the ambient light sensor and the MCU at the same time, the second screen refresh message will not only be sent to the ambient light sensor, but also to the MCU. The second screen refresh message can also cause the MCU to stop updating data in the display screen refresh area.
[0144] Since the electronic device determines the detection start time point in different ways according to different refreshed display frames when the display screen is refreshed frame by frame, the following is an explanation of the method for determining the detection start time point corresponding to different display frames.
[0145] In one possible implementation, when any display frame is the first display frame, at least one detection start time point is determined based on the detection reference time point and at least one delay duration threshold corresponding to the first display frame. The first display frame is the first display frame refreshed when the display screen is initially lit. Each of the at least one detection start time point is a time point at which an ambient light detection is performed during the process of refreshing the first display frame.
[0146] For the same electronic device, the installation position of the ambient light sensor in the electronic device is fixed, but due to differences in installation processes, there may be some installation errors in the installation position of the ambient light sensor. If the ambient light sensor is set to detect ambient light after a fixed time after the display is turned on, the ambient light detection of some electronic devices may be inaccurate due to installation errors. Therefore, in order to enable each electronic device to detect accurate ambient light data, it is usually necessary to calibrate the ambient light sensor.
[0147] Furthermore, since the calibration of the ambient light sensor is usually performed when the display screen of the electronic device is first lit and in the process of refreshing the first display frame, that is, the calibration of the ambient light sensor is performed in the process of refreshing the first display frame, therefore, at least one delay time threshold can be set for the first display frame, so that the electronic device can determine at least one detection start time point according to the detection reference time point and at least one delay time threshold corresponding to the first display frame when any display frame is the first display frame.
[0148] As an example, the electronic device may add the detection reference time point to each delay duration in at least one delay duration threshold, respectively, to obtain at least one detection start time point.
[0149] It should be noted that the display screen is lit up for the first time means that the display screen has never been lit up before. At least one extended time threshold can be set in advance, for example, the at least one delayed time threshold can include 300 microseconds, 600 microseconds, 900 microseconds and 1200 microseconds.
[0150] It is worth noting that by setting at least one delay time threshold, the ambient light sensor can perform multiple ambient light detections, thereby improving the accuracy of ambient light detection and alleviating the impact of installation errors of the ambient light sensor.
[0151] It should be noted that the ambient light sensor can be calibrated before or after the electronic device leaves the factory. If the electronic device is calibrated before leaving the factory, the electronic device calibration environment can also be arranged in order to calibrate the ambient light sensor more accurately. That is, when the electronic device lights up the display screen for the first time and refreshes the first display frame, the brightness of the display screen of the electronic device can be set to the highest brightness through an external driving device, and the display screen of the electronic device can be set to a pure white screen. At the same time, the electronic device is placed in a dark room environment (an environment without external ambient light) or a stable brightness environment.
[0152] In some embodiments, since the electronic device determines at least one detection start time point when refreshing the first display frame, the electronic device can perform ambient light detection at each of the at least one detection start time point during the process of refreshing the first display frame to obtain ambient light detection results, which include at least one detection result, and the at least one extended duration threshold corresponds one-to-one to the at least one detection result.
[0153] In another possible implementation, when any one display frame is the second display frame, the detection start time point for ambient light detection during the refresh of the second display frame is determined based on the detection reference time point and the reference delay duration corresponding to the second display frame, the second display frame is any display frame other than the first display frame, and the reference delay duration is determined based on a delay duration threshold corresponding to a detection result including a minimum light intensity value in at least one detection result.
[0154] Since the ambient light sensor is usually calibrated during the process of refreshing the first display frame, and the ambient light sensor has been calibrated when refreshing display frames other than the first display frame, the electronic device can determine the detection start time point for ambient light detection during the process of refreshing the second display frame in different ways. That is, the electronic device determines the detection start time point for ambient light detection during the process of refreshing the second display frame based on the detection reference time point and the reference delay time length corresponding to the second display frame.
[0155] In some embodiments, since the reference delay duration is determined based on a delay duration threshold corresponding to a detection result including a minimum light intensity value in at least one detection result, after the electronic device determines at least one detection result in the process of refreshing the first display frame, the electronic device can also determine, from at least one delay duration threshold, a target delay duration threshold corresponding to the detection result including the minimum light intensity value as the reference delay duration corresponding to the second display frame.
[0156] It should be noted that the detection result including the minimum light intensity value in at least one detection result is the detection result closest to the current ambient light, that is, it is more accurate for the ambient light sensor to detect the ambient light at the detection starting time point of the detection result including the minimum light intensity value. Therefore, the electronic device can determine the target delay duration threshold from at least one delay duration threshold, and determine the target delay duration threshold as the reference delay duration corresponding to the second display frame.
[0157] It is worth noting that by determining the target delay time threshold, a reliable basis is provided for the subsequent ambient light detection by the ambient light sensor during the process of refreshing the second display frame, thereby improving the efficiency of the ambient light detection.
[0158] Since the electronic device can perform ambient light detection at each detection start time point during the process of refreshing the first display frame, and the at least one detection start time point is determined based on the detection reference time point and at least one delay time threshold, the at least one delay time threshold may also include a negative value. In this case, the electronic device does not need to wait until the black insertion area reaches the target position to perform ambient light detection, and the electronic device may start ambient light detection before the black insertion area reaches the target position.
[0159] Exemplarily, referring to Table 1, when at least one delay duration threshold is within the range of (-900us to 300us) and the ambient light sensor is installed at the SCF opening, the electronic device can determine that the target delay duration threshold is -300us.
[0160] Table 1
[0161] Serial number Delay duration threshold Ambient light data 1 -1800 10556 2 -1500 6067 3 -1200 4239 4 -900 425 5 -600 304 6 -300 224 7 0 264 8 300 304 9 600 3800 10 900 5100 11 1200 8000 12 1500 13000 13 1800 17728
[0162] It should be noted that the embodiments of the present application only use the data in Table 1 as an example for illustration, and the embodiments of the present application do not impose any specific limitations on this.
[0163] In some embodiments, since the ambient light sensor can receive the first screen refresh message sent by the display screen, and the first screen refresh message carries the detection reference time point corresponding to the first display frame and at least one delay duration threshold corresponding to the first display frame, the ambient light sensor can send at least one detection result to the display screen after detecting at least one detection result, and each detection result can carry the corresponding delay duration threshold, so that the display screen can quickly determine the target delay duration threshold when receiving at least one detection result.
[0164] As an example, after determining the target delay duration threshold, the electronic device may store the target delay duration. Exemplarily, the electronic device may store the target delay duration threshold in a non-volatile area of the display screen.
[0165] It should be noted that after the target delay duration threshold is determined as the reference delay duration corresponding to the second display frame, in the subsequent process of refreshing the second display frame, the electronic device can determine the detection reference time point of the black area in the refreshed second display frame, and directly determine the detection starting time point for ambient light detection in the process of refreshing the second display frame based on the detection reference time point and the reference delay duration.
[0166] Since at least one delay duration threshold is a preset value, the target delay duration threshold is at least one delay duration threshold that enables the ambient light sensor to detect relatively accurate ambient light data, but the target delay duration threshold is not necessarily the optimal delay duration threshold of the electronic device. Therefore, the electronic device can also further optimize the timing of the ambient light sensor detecting ambient light during the process of refreshing the second display frame based on the target delay duration threshold.
[0167] In some embodiments, the electronic device can determine a target delay duration threshold corresponding to a detection result including a minimum light intensity value from at least one delay duration threshold; determine N-1 delay duration thresholds based on the target delay duration threshold and a preset delay error, where N is a positive integer greater than 2; and determine the N-1 delay duration thresholds and the target delay duration as the reference delay duration corresponding to the display frame.
[0168] It should be noted that the preset delay error is an error that makes the determined N-1 delay duration thresholds different from the at least one delay duration threshold.
[0169] It is worth noting that by optimizing the timing of the ambient light sensor detecting ambient light based on the target delay duration threshold, the accuracy of the ambient light sensor detecting ambient light is further improved.
[0170] It should be noted that the above method reflects whether the black area is updated to the target position by the timing of ambient light detection by the ambient light sensor. The electronic device can also determine whether the black area is updated to the target position by other methods.
[0171] As an example of the present application, since the black area refers to the area in the display screen where the backlight is turned off, and the black area is updated and displayed from top to bottom in the display screen, the electronic device can detect the backlight off position during the process of refreshing any display frame, and when it is detected that the position where the backlight is turned off is the target position, determine that the black area is updated to the target position; when the black area is updated to the target position, the electronic device can obtain the updated display time point when the black area is updated to the target position; determine the detection starting time point for ambient light detection during the process of refreshing any display frame according to the updated display time point and the delay duration corresponding to any display frame; control the ambient light sensor to perform ambient light detection at the determined detection starting point to obtain the ambient light detection result.
[0172] It should be noted that the operation of the electronic device determining the detection starting time point for performing ambient light detection in the process of refreshing any display frame based on the update display time point and the delay time corresponding to any display frame can refer to the operation of the electronic device determining the detection starting time point for performing ambient light detection in the process of refreshing any display frame based on the detection reference time point and the delay time corresponding to any display frame, and the embodiments of the present application will not elaborate on this one by one.
[0173] Since the backlight is the backlight of the display screen, the electronic device can detect the position where the backlight is turned off through the display screen. When the display screen detects the position where the backlight is turned off, a detection message can be sent to the ambient light sensor through the target signal pin. The detection message carries the update display time point and the delay duration corresponding to any display pin. When the ambient light sensor receives the detection message, it can determine the detection start time point for ambient light detection during the refresh of any display frame based on the update display time point and the delay duration corresponding to any display frame, and perform ambient light detection at the determined detection start point to obtain the ambient light detection result.
[0174] Step 405: Determine ambient light data of the current environment according to the ambient light detection result.
[0175] Since the ambient light detection result may include at least one detection result, the electronic device may determine the ambient light data of the current environment in different ways depending on the number of detection results included in the ambient light detection result.
[0176] In some embodiments, when the ambient light detection result includes multiple detection results, the detection result including the minimum light intensity value among the multiple detection results is determined as the ambient light data of the current environment; or, when the ambient light detection result includes one detection result, the detection result is determined as the ambient light data.
[0177] Since the ambient light sensor is installed at the position corresponding to the SCF opening, and the ambient light sensor performs ambient light detection when the black area is updated to near the SCF opening position, when the ambient light detection result includes multiple detection results, the detection result including the minimum light intensity value among the multiple detection results is the detection result closest to the current ambient light. Therefore, the electronic device can determine it as the ambient light data of the current environment.
[0178] In the embodiment of the present application, since the black area is the area where the backlight of the display screen is turned off during the refresh process of the display screen, and the black area can be updated from top to bottom in the display screen, the ambient light sensor performs ambient light detection when the black area is updated to the vicinity of the installation position of the ambient light sensor, which means that the ambient light sensor performs ambient light detection in the area where the backlight is turned off. Then, there is almost no brightness data of the display screen in the obtained ambient light detection result, that is, the influence of the brightness of the display screen on the ambient light detection by the ambient light sensor is reduced, so that the ambient light sensor detects the ambient light data of the real environment, thereby improving the accuracy of the detection of ambient light data. At the same time, since the electronic device performs detection through ambient light data when the black area is updated to the vicinity of the installation position of the ambient light sensor, the data detection amount is reduced and the efficiency of ambient light detection is improved.
[0179] Since the electronic device may be a smart watch or may not be a smart watch, and when it is not a smart watch, the electronic device may have other structures, the structure of the electronic device will be described below.
[0180] Figure 8 is a schematic diagram of the structure of another electronic device provided in an embodiment of the present application. Figure 8 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. Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor, a bone conduction sensor 180M, etc.
[0181] It is to be understood that the structure illustrated in the embodiment of the present application does 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 components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0182] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0183] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0184] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0185] In some embodiments, the processor 110 may include one or more interfaces, such as an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0186] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0187] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0188] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0189] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is an integer greater than 1.
[0190] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0191] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0192] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created by the electronic device 100 during use (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0193] The electronic device 100 can implement audio functions, such as music playback, recording, etc., through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D and the application processor.
[0194] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the touch operation intensity according to the pressure sensor 180A. The electronic device 100 can also calculate the touch position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than a pressure threshold acts on a short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the pressure threshold acts on a short message application icon, an instruction to create a new short message is executed.
[0195] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. The acceleration sensor 180E can also be used to identify the posture of the electronic device 100, and is applied to applications such as horizontal and vertical screen switching, pedometers, etc.
[0196] The proximity light sensor 180G may include a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outward through the light emitting diode. The electronic device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, the electronic device 100 may determine that there is an object near the electronic device 100. When insufficient reflected light is detected, it may be determined that there is no object near the electronic device 100. The electronic device 100 may use the proximity light sensor 180G to detect when a user holds the electronic device 100 close to their ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G may also be used in leather case mode and pocket mode to automatically unlock and lock the screen.
[0197] The ambient light sensor is used to sense the brightness of the ambient light. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
[0198] The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor 180K can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0199] The bone conduction sensor 180M can obtain a vibration signal. In some embodiments, the bone conduction sensor 180M can obtain a vibration signal of a vibrating bone block of the vocal part of the human body. The bone conduction sensor 180M can also contact the human pulse to receive a blood pressure beat signal. In some embodiments, the bone conduction sensor 180M can also be set in an earphone and combined into a bone conduction earphone. The audio module 170 can parse out a voice signal based on the vibration signal of the vibrating bone block of the vocal part obtained by the bone conduction sensor 180M to realize a voice function. The application processor can parse the heart rate information based on the blood pressure beat signal obtained by the bone conduction sensor 180M to realize a heart rate detection function.
[0200] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.
[0201] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. Touch operations acting on different areas of the display screen 194 can also correspond to different vibration feedback effects. Different application scenarios (such as: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
[0202] Next, the software system of the electronic device 100 will be described.
[0203] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software system of the electronic device 100.
[0204] Fig. 91 is a block diagram of a software system of an electronic device 100 provided in an embodiment of the present application. Fig. 9 The layered architecture divides the software into several layers, each with clear roles 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 Android runtime (Android runtime) and the system layer, and the kernel layer.
[0205] The application layer can include a series of application packages. Fig. 9 As shown, the application package may include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.
[0206] The application framework layer provides application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions. Figure 4 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, etc. The window manager is used to manage window programs. The window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, capture the screen, etc. The content provider is used to store and obtain data and make these data accessible to applications. These data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc. The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build the display interface of the application, and the display interface can be composed of one or more views, for example, including a view for displaying a text message notification icon, including a view for displaying text, and including a view for displaying pictures. 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.). The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, etc. The notification manager enables the application to display notification information in the status bar, which 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 an icon or scroll bar text, such as a notification of an application running in the background. The notification manager can also be a notification that appears on the screen in the form of a dialog window, such as a text message in the status bar, a reminder sound, an electronic device vibrating, an indicator light flashing, etc.
[0207] Android Runtime includes core libraries and virtual machines. Android Runtime is responsible for scheduling and management of the Android system. The core library consists of two parts: one is the function that the Java language needs to call, and the other is the Android core library. The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0208] The system library can include multiple functional modules, such as: surface manager, media library, 3D graphics processing library (such as: OpenGL ES), 2D graphics engine (such as: SGL), etc. The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications. The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc. The 2D graphics engine is a drawing engine for 2D drawing.
[0209] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
[0210] The following is an illustrative description of the workflow of the software and hardware of the electronic device 100 in conjunction with capturing a photo scene.
[0211] When the touch sensor 180K receives a touch operation, the corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes the touch operation into a raw input event (including touch coordinates, timestamp of the touch operation, and other information). The raw input event is stored in the kernel layer. The application framework layer obtains the raw input event from the kernel layer and identifies the control corresponding to the raw input event. For example, if the touch operation is a single-click operation and the control corresponding to the single-click operation is the control of the camera application icon, the camera application calls the interface of the application framework layer, starts the camera application, and then calls the kernel layer to start the camera driver to capture static images or videos through the camera 193.
[0212] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (such as: coaxial cable, optical fiber, data subscriber line (Digital Subscriber Line, DSL)) or wireless (such as: infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access, or a data storage device such as a server or data center that includes one or more available media integrations. The available medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a digital versatile disc (DVD)), or a semiconductor medium (such as a solid state disk (SSD)).
[0213] The above are optional embodiments provided for the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the technical scope disclosed in the present application shall be included in the protection scope of the present application.
Claims
1. A method for detecting ambient light, characterized in that: Applied to an electronic device having a display screen, the electronic device having an ambient light sensor located below the display screen, the method comprising: When the display screen of the electronic device is turned on, refreshing the display screen frame by frame; In the process of refreshing each frame, the black area is updated and displayed from top to bottom in the display screen; wherein, When the black insertion area reaches the target position, the ambient light sensor detects the ambient light and obtains ambient light data; wherein, The black insertion area is an area formed by turning off the backlight in the display screen; The target position is a position in the display screen that is near the installation position of the ambient light sensor; The brightness of the display screen is adjusted according to the ambient light data.
2. The method according to claim 1, characterized in that In the process of refreshing each frame, the black insertion area is updated and displayed from top to bottom in the display screen, including: In the process of refreshing any one display frame, according to the detection reference time point and the delay duration corresponding to the any one display frame, determine the detection starting time point for performing ambient light detection in the process of refreshing the any one display frame, the detection reference time point is the time point when the black insertion area is updated to the target position, the detection reference time point is determined according to the display starting position, the display starting time point of the black insertion area, the specified update rate of the black insertion area and the target position, and the delay duration is the delay relative to the detection reference time point; The ambient light sensor is controlled to perform ambient light detection at the determined detection start time point to obtain an ambient light detection result.
3. The method according to claim 2, characterized in that The ambient light detection result includes at least one detection result; In the process of refreshing any one display frame, determining the detection starting time point for performing ambient light detection in the process of refreshing any one display frame according to the detection reference time point and the delay time length corresponding to the any one display frame, comprises: In the case where any one of the display frames is the first display frame, at least one detection start time point is determined according to the detection reference time point and at least one delay time threshold corresponding to the first display frame, the first display frame is the first display frame refreshed when the display screen is initially lit, each of the at least one detection start time point is a time point at which an ambient light detection is performed once during the process of refreshing the first display frame, and the at least one extended time threshold corresponds one-to-one to the at least one detection result; In the case that any one of the display frames is the second display frame, the detection starting time point for performing ambient light detection in the process of refreshing the second display frame is determined according to the detection reference time point and the reference delay duration corresponding to the second display frame, the second display frame is any one of the display frames except the first display frame, and the reference delay duration is determined according to a delay duration threshold corresponding to a detection result including a minimum light intensity value in at least one detection result.
4. The method according to claim 3, characterized in that The method further comprises: From the at least one delay duration threshold, determine the target delay duration threshold corresponding to the detection result including the minimum light intensity value as the reference delay duration corresponding to the second display frame.
5. The method according to claim 3, characterized in that The method further comprises: Determine, from the at least one delay duration threshold, a target delay duration threshold corresponding to the detection result including the minimum light intensity value; Determine N-1 delay duration thresholds according to the target delay duration threshold and the preset delay error, where N is a positive integer greater than 2; The N-1 delay duration thresholds and the target delay duration are determined as reference delay durations corresponding to the second display frame.
6. The method according to any one of claims 2 to 5, characterized in that: The method further comprises: After the display screen is lit up, determining the number of rows between the display start position of the black insertion area and the target position; Multiplying the number of rows by the specified update rate to obtain an update duration of the black insertion area from the display start position to the target position; The display start time of the black insertion area is added to the update duration to obtain a time point when the black insertion area is updated from the display start position to the target position, and the detection reference time point is the determined time.
7. The method according to any one of claims 2 to 6, characterized in that: The target signal pin of the display screen is connected to the signal input pin of the ambient light sensor, and the target signal pin is any signal output pin of the display screen; The method further comprises: Before refreshing any one of the display frames, the display screen sends a first screen refresh message to the ambient light sensor through the target signal pin, wherein the first screen refresh message carries the detection reference time point and a delay time length corresponding to any one of the display frames; In the process of refreshing any one display frame, determining the detection starting time point for performing ambient light detection in the process of refreshing any one display frame according to the detection reference time point and the delay time length corresponding to the any one display frame, comprises: During the process of refreshing any one display frame, when the ambient light sensor receives the first screen refresh message, the ambient light sensor determines the detection starting time point for ambient light detection during the process of refreshing any one display frame based on the detection reference time point and the delay length corresponding to the any one display frame.
8. The method according to claim 7, characterized in that The target signal pin of the display screen is also connected to a microcontroller unit MCU; the method further comprises: The display screen sends the first screen refresh message to the MCU via the target signal pin, so that the MCU stops updating data in the refresh area of the display screen.
9. The method according to any one of claims 3, 4 or 5, characterized in that: The ambient light sensor detects ambient light, and obtaining ambient light data includes: In the case where the ambient light detection result includes multiple detection results, determining the detection result including the minimum light intensity value among the multiple detection results as the ambient light data of the current environment; or In a case where the ambient light detection results include one detection result, the detection result is determined as the ambient light data.
10. An electronic device, characterized in that: The structure of the electronic device includes a processor and a memory; The memory is used to store a program that supports the electronic device to execute the method according to any one of claims 1 to 9.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the method according to any one of claims 1 to 9.
Citation Information
Cited By
Backlight adjusting method and display system
CN121938314A
A backlight adjustment method and display system
CN121938314B
