Light control method and device, electronic equipment and storage medium
By detecting the timestamp of the second flicker request and calculating the phase difference, the problem of difficulty in achieving smooth transition and precise control during flicker frequency switching in the prior art is solved, and efficient and precise control of light flicker switching is achieved.
Patent Information
- Application Number
- CN202510238965.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-28
- Publication Date
- 2025-06-03
AI Technical Summary
The prior art is difficult to achieve smooth transition and precise control when flicker frequency switching, especially in scenarios where strict control is required.
By detecting the timestamp of the second flash request and determining the current pulse phase and time phase values based on the current flash parameters of the first flash request, the phase difference is calculated to control the flash of the light.
Accurate control of light flicker switching is achieved, ensuring smooth transition and efficient control, and avoiding the increase in embedded resource consumption.
Smart Images

Figure CN120091483A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of lighting control, and more particularly, to a method, device, electronic device, and storage medium for controlling a light. Background Art
[0002] In the prior art, for the method of controlling light flashing, generally, a finite state machine form is used, and the periodicity and counting range of a counter are utilized to generate a matrix wave for flashing control. However, this control method is often inapplicable in scenarios where the flashing frequency needs to be smoothly transitioned or there are strict requirements for controlling different flashing frequency switches, and it is impossible to achieve precise control of the instruction switching transition. Therefore, how to precisely control the flashing switch of the light has become an urgent problem to be solved. Summary of the Invention
[0003] In view of this, embodiments of the present application propose a method, device, electronic device, and storage medium for controlling a light to improve the above problems.
[0004] According to the first aspect of the embodiments of the present application, a method for controlling a light is provided. The method includes: if a second flashing request is detected during the flashing of the light in response to a first flashing request, obtaining a timestamp corresponding to the second flashing request; determining a current pulse phase based on the current flashing parameters corresponding to the first flashing request, and determining a current moment phase value based on the timestamp corresponding to the second flashing request and the current flashing parameters corresponding to the first flashing request; determining a phase difference according to the current moment phase value and the current pulse phase, where the phase difference is used to indicate the remaining phase value of the current pulse phase for executing the complete first flashing request.
[0005] According to the second aspect of the embodiments of the present application, a device for controlling a light is provided. The device includes: an obtaining module, configured to obtain a timestamp corresponding to the second flashing request if a second flashing request is detected during the flashing of the light in response to a first flashing request; a current moment phase value determining module, configured to determine a current pulse phase based on the current flashing parameters corresponding to the first flashing request, and determine a current moment phase value based on the timestamp corresponding to the second flashing request and the current flashing parameters corresponding to the first flashing request; a phase difference determining module, configured to determine a phase difference according to the current moment phase value and the current pulse phase, where the phase difference is used to indicate the remaining phase value of the current pulse phase for executing the complete first flashing request; and a control module, configured to control the light to perform light flashing according to the phase difference and the second flashing request.
[0006] According to a third aspect of the embodiments of the present application, an electronic device is provided, including: a processor; a memory, on which computer-readable instructions are stored, and when the computer-readable instructions are executed by the processor, the control method of the light as described above is implemented.
[0007] According to a fourth aspect of the embodiments of the present application, a computer-readable storage medium is provided, on which computer-readable instructions are stored, and when the computer-readable instructions are executed by a processor, the control method of the light as described above is implemented.
[0008] In the solution of the present application, during the process of the light flashing in response to the first flashing request, when the second flashing request is detected, first obtain the timestamp corresponding to the second flashing request, so as to determine the current pulse phase based on the current flashing parameters of the first flashing request, and determine the current moment phase value based on the timestamp of the second flashing request and the current flashing parameters of the first flashing request, and then determine the phase difference according to the current moment phase and the current pulse phase value. Based on this, the light can be controlled to perform light flashing based on the phase difference and the second flashing request. In the solution of the present application, by calculating the phase difference between the starting phase of the new request waveform and the phase switching moment of the old request waveform through a phase control method, and controlling by changing the phase according to the required form, the switching transition waveform of the required form can be realized. While ensuring no increase in the consumption of embedded resources, the control efficiency is greatly improved, and precise control of the light flashing switching is achieved.
[0009] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present invention. Description of the Drawings
[0010] The drawings here are incorporated into the specification and constitute a part of this specification, showing the embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application. Obviously, the drawings in the following description are only some embodiments of the present application, and those of ordinary skill in the art can obtain other drawings based on these drawings without creative efforts.
[0011] Figure 1 It is a schematic flowchart of the control method of the light shown according to an embodiment of the present application.
[0012] Figure 2 It is a schematic flowchart of the control method of the light shown according to an embodiment of the present application.
[0013] Figure 3 It is a schematic diagram of the smooth transition of the light flashing switching shown according to an embodiment of the present application.
[0014] Figure 4It is a schematic flowchart of a method for controlling lights shown in another embodiment of the present application.
[0015] Figure 5 It is a schematic flowchart of the specific steps of step 340 shown in an embodiment of the present application.
[0016] Figure 6 It is a schematic diagram showing the meanings of parameters such as the lighting duration and the extinguishing duration shown in an embodiment of the present application.
[0017] Figure 7 It is a schematic flowchart of the specific steps of step 420 shown in an embodiment of the present application.
[0018] Figure 8 It is a schematic flowchart of the specific steps of step 450 shown in an embodiment of the present application.
[0019] Figure 9 It is a block diagram of a lighting control device shown in an embodiment of the present application.
[0020] Figure 10 It is a hardware structure diagram of an electronic device shown in an embodiment of the present application.
[0021] Through the above-mentioned drawings, specific embodiments of the present invention have been shown. There will be more detailed descriptions hereinafter. These drawings and textual descriptions are not intended to limit the scope of the inventive concept in any way, but to illustrate the concept of the present invention to those skilled in the art through specific embodiments. Detailed Embodiments
[0022] Now, example embodiments will be described more fully with reference to the accompanying drawings. However, the example embodiments can be implemented in various forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more complete and comprehensive, and will fully convey the concept of the example embodiments to those skilled in the art.
[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and do not necessarily need to be used to describe a specific order or sequence. It should be understood that such used data can be interchanged under appropriate circumstances so that the embodiments of the present invention described herein can be implemented in an order different from those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0024] In addition, the described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, numerous specific details are provided to give a thorough understanding of the embodiments of the present application. However, those skilled in the art will realize that the technical solutions of the present application may be practiced without one or more of the specific details, or other methods, devices, steps, etc. may be adopted. In other cases, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the present application.
[0025] The block diagrams shown in the drawings are only functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices. The flowcharts shown in the drawings are only illustrative and do not necessarily include all the content and operations / steps, nor do they necessarily have to be executed in the described order. For example, some operations / steps may be decomposed, while some operations / steps may be combined or partially combined, so the actual execution order may change according to the actual situation.
[0026] Please refer to Figure 1 , Figure 1 which shows a method for controlling a light provided by an embodiment of the present application. In a specific embodiment, the method for controlling the light may be applied to a light control device 500 as shown in Figure 9 and an electronic device 600 configured with the light control device 500 ( Figure 10 ). The specific process of this embodiment will be described below. Of course, it can be understood that this method may be executed by a vehicle-mounted terminal with computing and processing capabilities. The following will elaborate in detail on the Figure 1 process shown. The method for controlling the light may specifically include the following steps:
[0027] Step 110, if a second flashing request is detected during the process of the light flashing in response to a first flashing request, obtain the timestamp corresponding to the second flashing request.
[0028] As a way, in the field of vehicle body electronics, whether it is external lighting or internal lighting, there is a need to turn on and flash, and different flash requests can be sent to the vehicle's lighting control system to achieve the flash control of the vehicle's external lighting or internal lighting. When a new flash request is detected while the lighting is flashing (i.e., a flash with a different frequency from the current flash), in order to ensure a smooth transition of the lighting flash, it is necessary to determine the current flash parameters corresponding to the currently executing flash request and determine the moment when the new flash request is detected (i.e., the timestamp corresponding to the second flash request).
[0029] Optionally, in order to determine whether to directly respond to the second flash request to control the lighting to flash, the timestamp corresponding to when the second flash request is received can be determined first, so as to determine whether to perform a flash switch at that timestamp.
[0030] Optionally, when sending the second flash request to the vehicle's lighting control system, the lighting control system can add a corresponding timestamp to the second flash request based on the time when the second flash request is received, so as to obtain the timestamp corresponding to the second flash request.
[0031] Step 120, determine the current pulse phase based on the current flash parameters corresponding to the first flash request, and determine the current moment phase value based on the timestamp corresponding to the second flash request and the current flash parameters corresponding to the first flash request.
[0032] As a way, after determining the current flash parameters corresponding to the first flash request, in order to determine whether to immediately switch the flash of the lighting, the current pulse phase corresponding to the first flash request can be determined first. Among them, during the process of the lighting flashing in response to the first flash request, the current flash parameters can be directly determined based on the first flash request. The current flash parameters can include the lighting duration corresponding to the first flash request, the extinguishing duration corresponding to the first flash request, and the number of flashes corresponding to the first flash request. And the current pulse phase corresponding to the first flash request can be determined through the lighting duration corresponding to the first flash request and the extinguishing duration corresponding to the first flash request. The current pulse phase can be determined by the formula t / ((OnDuration + OffDuration) / H), where t is the time, H is the discrete period corresponding to the lighting control system, OnDuration is the lighting duration corresponding to the first flash request, and OffDuration is the extinguishing duration corresponding to the first flash request, so as to obtain the current pulse phase.
[0033] Optionally, the current time can be determined according to the timestamp corresponding to the second flashing request, and then the time corresponding to the discrete period of the lighting control system can be determined based on the current time, so as to determine the current time phase value in the current pulse phase value σ0 = {0, 1, 2…(OnDuration+OffDuration) / H-1}.
[0034] Step 130, determine the phase difference according to the current time phase value and the current pulse phase, where the phase difference is used to indicate the remaining phase value of the current pulse phase for executing the complete first flashing request.
[0035] As a way, in order to make the flashing switch of the light more smooth, it can be first determined whether the current time phase value corresponding to the timestamp of the received second flashing request indicates that a cycle has been completed, so as to determine whether to immediately execute the second flashing request. Optionally, the phase difference between the current time phase and the current pulse phase value corresponding to the timestamp can be determined by subtracting, so as to determine whether a complete cycle of the light responding to the first flashing request has been completed at the current time.
[0036] Step 140, control the light to perform light flashing according to the phase difference and the second flashing request.
[0037] As a way, when it is determined that the phase difference indicates that the current time phase value is equal to (OnDuration+OffDuration) / H-1 in the current pulse phase, it can be determined that the light just completes a cycle of flashing of the first flashing request at the current time, so that the light can be directly controlled to perform light flashing based on the second flashing request.
[0038] Optionally, when the phase difference indicates that the current time phase value is not equal to (OnDuration+OffDuration) / H-1 in the current pulse phase value, the first flashing request can be continued to be executed, and the current time phase value can be accumulated and calculated by a timer until the current time phase value reaches (OnDuration+OffDuration) / H-1 again, and then the light is controlled to perform light flashing based on the second flashing request.
[0039] In an embodiment of the present application, during the process of the light flashing in response to the first flashing request, if a second flashing request is detected, first obtain the timestamp corresponding to the second flashing request, so as to determine the current pulse phase based on the current flashing parameters of the first flashing request, and determine the current moment phase value based on the timestamp of the second flashing request and the current flashing parameters of the first flashing request. Furthermore, determine the phase difference according to the current moment phase and the current pulse phase value. Based on this phase difference and the second flashing request, the light can be controlled to perform a light flash. The solution of the present application calculates the phase difference between the starting phase of the new request waveform and the phase switching moment of the old request waveform through a phase control-based method, and controls by changing the phase according to the required form to achieve the switching transition waveform of the required form. While ensuring no increase in the consumption of embedded resources, the control efficiency is greatly improved, and precise control of the light flashing switch is achieved.
[0040] Please refer to Figure 2 , Figure 2 which shows the control method of the light provided by an embodiment of the present application. The following will elaborate in detail on the Figure 2 process shown. The control method of the light may specifically include the following steps:
[0041] Step 210, if a second flashing request is detected during the process of the light flashing in response to the first flashing request, obtain the timestamp corresponding to the second flashing request.
[0042] Step 220, determine the current pulse phase based on the current flashing parameters corresponding to the first flashing request, and determine the current moment phase value based on the timestamp corresponding to the second flashing request and the current flashing parameters corresponding to the first flashing request.
[0043] Step 230, determine the phase difference according to the current moment phase value and the current pulse phase, where the phase difference is used to indicate the remaining phase value of the current pulse phase for executing the complete first flashing request.
[0044] Specifically, for the steps of Step 210 - Step 230, please refer to Step 110 - Step 130, and details will not be repeated here.
[0045] Step 240, if the phase difference is greater than zero, continue to control the light to perform a light flash according to the first flashing request.
[0046] As a way, when it is determined that the phase difference is greater than zero, it can be determined that the light is executing the first flashing request and has not completed a cycle of flashing. Therefore, in order to ensure a smooth transition of the light from the first flashing request to the second flashing request, maintain the current flashing parameters corresponding to the first flashing request to control the flashing of the light.
[0047] Step 250, determine the target duration for the light to change from the current moment phase value to the current pulse phase value according to the phase difference.
[0048] As a way, in order to accurately determine the timing for switching the blinking of the light, the duration required for the light to change from the current moment phase value to the current pulse phase value can be determined according to the phase difference. Optionally, the phase difference indicates the phase change corresponding to the blinking of the light, and the phase is related to the current blinking period. Furthermore, by multiplying the phase difference by the period, the duration required for the light to change from the current moment phase value to the current pulse phase value can be obtained.
[0049] Step 260, after the target duration, control the light to perform light blinking according to the second blinking request.
[0050] As a way, after determining the target duration, a timer can be used to accumulate the duration, so that after determining that the duration reaches the target duration, the light is controlled to perform light blinking through the second blinking request, thereby realizing a smooth transition of the light blinking switch. As Figure 3 shown, when the second blinking request is received during the process of the light responding to the first blinking request, it is necessary to wait until a complete cycle of the first blinking request is executed before executing the second blinking request, thereby realizing a smooth transition of the light blinking switch, where the light blinking control between receiving the second blinking request and executing the second blinking request is a smooth transition condition.
[0051] In this embodiment, when the phase difference is greater than zero, continue to control the light to perform light blinking according to the first blinking request, and determine the target duration corresponding to the light changing from the current moment phase value to the current pulse phase value according to the phase difference, so that after the target duration, the light can be controlled to perform light blinking according to the second blinking request, realizing a smooth transition of the light blinking control and improving the user experience.
[0052] Please refer to Figure 4 , Figure 4 shows a control method for a light provided by an embodiment of the present application. The following will elaborate in detail on the Figure 4 flow shown. The control method for the light may specifically include the following steps:
[0053] Step 310, if a second blinking request is detected during the process of the light blinking in response to the first blinking request, obtain the time stamp corresponding to the second blinking request.
[0054] Step 320: Determine the current pulse phase based on the current flashing parameter corresponding to the first flashing request, and determine the current moment phase value based on the timestamp corresponding to the second flashing request and the current flashing parameter corresponding to the first flashing request.
[0055] Step 330: Determine the phase difference according to the current moment phase value and the current pulse phase, where the phase difference is used to indicate the remaining phase value of the current pulse phase for executing the complete first flashing request.
[0056] Among them, for the specific step descriptions of steps 310 - 330, reference can be made to steps 110 - 130, and no further elaboration will be provided here.
[0057] Step 340: If the phase difference is equal to zero, control the light to perform light flashing according to the second flashing request.
[0058] As a way, when it is determined that the phase difference is equal to zero, it can be determined that when the second flashing request is received during the process of the light responding to the first flashing request, the light flashing just completes a complete flashing cycle of the first flashing request. Therefore, it can be determined that currently, the light can be directly controlled to perform flashing based on the second flashing request, so as to achieve the switching of the light flashing. Optionally, when it is determined that the light can be controlled to perform light flashing according to the second flashing request, the control parameters for controlling the light flashing can be determined first according to the second flashing request, and then the light can be controlled to flash based on these control parameters. Optionally, the control parameters can include the frequency of the light flashing and the cycle of the light flashing, etc., and the specific control parameters can be set according to actual needs, and no specific limitation will be made here.
[0059] In some embodiments, as Figure 5 shown, step 340 includes:
[0060] Step 410: Determine the lighting duration, extinguishing duration, high - level amplitude, and low - level amplitude according to the second flashing request.
[0061] As a way, during the process of the light flashing, it is necessary to determine the duration for which the light remains in the lit state (i.e., the lighting duration) and the duration for which the light remains in the extinguished state (i.e., the extinguishing duration), so as to control the light to achieve flashing based on the lighting duration and the extinguishing duration. And in order to make the light achieve lighting and extinguishing to realize flashing, as Figure 6 shown, it is necessary to set the high - level amplitude when lighting the light and the low - level amplitude when extinguishing the light. Furthermore, the light can be controlled to light up by controlling the level of the light to be at the high - level amplitude, and the light can be controlled to extinguish by making the level of the light in the empty box at the low level.
[0062] Step 420: Determine the pulse period and pulse width according to the lighting duration and the extinguishing duration.
[0063] As a way, in order to accurately control the light flashing, it is necessary to determine the pulse period of the light flashing and the time when the light flashing is at the high level amplitude within the pulse period (i.e., the pulse width). Therefore, the pulse width and pulse period can be determined by the lighting duration and the extinguishing duration. Among them, since one cycle can be considered completed when the light flashes once for lighting and once for extinguishing, the pulse period can be determined by adding the lighting duration and the extinguishing duration. Since the pulse width is the time when the light flashing is at the high level amplitude within the pulse period, the lighting duration can be determined as the pulse width.
[0064] In some embodiments, as Figure 7 shown, step 410 includes:
[0065] Step 421: Determine the sampling period.
[0066] As a way, since digital systems such as embedded systems for controlling the light flashing are discrete systems, it is necessary to discretize the pulse period and pulse width, so as to determine the control parameters for controlling the vehicle based on the discretized pulse period and pulse width. Optionally, in order to perform the discretization process, the sampling period of a digital system such as an embedded system for controlling the light flashing can be obtained. This sampling period is user-defined and set in the digital system, and can be directly obtained in the digital system.
[0067] Step 422: Determine the pulse width according to the sampling period and the lighting duration.
[0068] As a way, after determining the sampling period, since the lighting duration can be used as the pulse width before the discretization process, the pulse width can be directly obtained by dividing the lighting duration by the sampling period. The pulse width can be calculated by the formula W = OnDuration1 / H, where H is the sampling period, OnDuration1 is the lighting duration determined by the second flashing request, and W is the pulse width.
[0069] Step 423: Determine the pulse period according to the sampling period, the lighting duration and the extinguishing duration.
[0070] As a method, after determining the sampling period, since the pulse period before discretization is the sum of the lighting duration and the extinguishing duration, the sum of the lighting duration and the extinguishing duration can be divided by the sampling period to obtain the pulse period. The pulse period can be determined by the formula T = (OnDuration1 + OffDuration1) / H, where OffDuration1 is the extinguishing duration determined by the second flashing request and T is the pulse period.
[0071] Please continue to refer to Figure 5 , step 430, determine the target pulse phase value according to the pulse period.
[0072] As a method, after determining the pulse period, in order to accurately control the light flashing, the target pulse phase value of the light flashing based on the second flashing request can be determined based on the pulse period, the lighting duration, and the extinguishing duration. Optionally, in order to ensure that the light can be flashed according to the determined target pulse phase value, the target pulse phase value can be determined according to the pulse period and the sampling period. The target pulse phase value can be calculated by the formula σ = t % T = t % (OnDuration1 + OffDuration1) = t % ((OnDuration1 + OffDuration1) / H), where t is the time.
[0073] Step 440, determine the magnitude relationship between the target pulse phase value, the pulse width, and the pulse period.
[0074] As a method, since the light flashing is controlled by outputting a matrix wave through a state machine when controlling the light flashing, the rectangular wave signal value with the pulse phase of σ can be determined according to the magnitude relationship between the target pulse phase value, the pulse width, and the pulse period, so as to output the corresponding matrix wave to control the light flashing. Among them, the magnitude relationship can be that the target pulse phase value is greater than the pulse width, the target pulse phase value is equal to the pulse width, the target pulse phase value is less than the pulse period, the target pulse phase value is greater than the pulse period, etc. The specific magnitude relationship can be set according to actual needs.
[0075] Step 450, based on the magnitude relationship, determine the control parameter according to the high-level amplitude or the low-level amplitude, and control the light to perform light flashing according to the control parameter.
[0076] As a way, based on the magnitude relationship, a corresponding time-based control parameter can be determined based on the high-level amplitude or the low-level amplitude. This control parameter can be used to indicate that when the target pulse phase value is in a specific interval, the light is controlled to be at the corresponding high-level amplitude or low-level amplitude, so that the light is in the on state or the off state, thereby realizing controlling the light to perform light flashing according to the control parameter.
[0077] In some embodiments, as Figure 8 shown, step 450 includes:
[0078] Step 451, if the magnitude relationship indicates that the target pulse phase value is less than the pulse width, determine a first control parameter according to the high-level amplitude, where the first control parameter is used to control the light to turn on.
[0079] As a way, in order to accurately control the light to keep it on in a specific situation, it can be set that when the target pulse phase value is less than the pulse width and greater than or equal to 0, the light is controlled to be at the high-level amplitude, and the first control parameter is generated based on the high-level amplitude and this magnitude relationship, so that the light can be controlled to turn on based on the first control parameter. Optionally, the first control parameter can be expressed as f(t) = A, if 0 ≤ σ < W.
[0080] Step 452, if the magnitude relationship indicates that the target pulse phase value is greater than or equal to the pulse width and less than the pulse period, determine a second control parameter according to the low-level amplitude, where the second control parameter is used to control the light to turn off.
[0081] As a way, in order to accurately control the light to keep it off in a specific situation, it can be set that when the target pulse phase value is less than the pulse period and greater than or equal to the pulse width, the light is controlled to be at the low-level amplitude, and the second control parameter is generated based on the low-level amplitude and this magnitude relationship, so that the light can be controlled to turn off based on the second control parameter. Optionally, the second control parameter can be expressed as f(t) = B, if W ≤ σ < T.
[0082] In some embodiments, the first control parameter or the second control parameter includes the number of times the light flashes. This number of flashes can be used to control the number of times the light flashes within a control period. However, within one pulse period, the number of flashes is only once, that is, one turn-on and one turn-off is one flash.
[0083] In this embodiment, when the phase difference is equal to zero, the first and second control parameters for controlling the light to blink are directly determined in response to the second blink request. Based on the first control parameter, the light can be controlled to remain lit, and based on the second control parameter, the light can be controlled to remain off, thereby achieving precise control of the light blink.
[0084] Figure 9 is a block diagram of a lighting control device according to an embodiment of the present application, as Figure 9 shown. The lighting control device 500 includes: an acquisition module 510, a current time phase value determination module 520, a phase difference determination module 530, and a control module 540.
[0085] The acquisition module 510 is configured to, if a second blink request is detected during the process of the light blinking in response to the first blink request, acquire the timestamp corresponding to the second blink request; the current time phase value determination module 520 is configured to determine the current pulse phase based on the current blink parameter corresponding to the first blink request, and determine the current time phase value based on the timestamp corresponding to the second blink request and the current blink parameter corresponding to the first blink request; the phase difference determination module 530 is configured to determine the phase difference according to the current time phase value and the current pulse phase, where the phase difference is used to indicate the remaining phase value of the current pulse phase for executing the complete first blink request; the control module 540 is configured to control the light to perform a light blink according to the phase difference and the second blink request.
[0086] In some embodiments, the control module 540 includes: a first control sub-module configured to, if the phase difference is greater than zero, continue to control the light to perform a light blink according to the first blink request; a target duration determination sub-module configured to determine the target duration for the light to change from the current time phase value to the current pulse phase value according to the phase difference; a second control sub-module configured to, after the target duration, control the light to perform a light blink according to the second blink request.
[0087] In some embodiments, the control module 540 further includes: a third control sub-module configured to, if the phase difference is equal to zero, control the light to perform a light blink according to the second blink request.
[0088] In some embodiments, the second control sub-module or the third control sub-module includes: a first determination unit configured to determine a lighting duration, an extinguishing duration, a high-level amplitude, and a low-level amplitude according to the second flashing request; a second determination unit configured to determine a pulse period and a pulse width according to the lighting duration and the extinguishing duration; a third determination unit configured to determine a target pulse phase value according to the pulse period; a size relationship determination unit configured to determine the size relationship between the target pulse phase value, the pulse width, and the pulse period; and a control unit configured to determine a control parameter according to the high-level amplitude or the low-level amplitude based on the size relationship, and control the light to perform light flashing according to the control parameter.
[0089] In some embodiments, the control unit includes: a first control parameter determination sub-unit configured to determine a first control parameter according to the high-level amplitude if the size relationship indicates that the target pulse phase value is less than the pulse width, where the first control parameter is used to control the light to be lit; and a second control parameter determination sub-unit configured to determine a second control parameter according to the low-level amplitude if the size relationship indicates that the target pulse phase value is greater than or equal to the pulse width and less than the pulse period, where the second control parameter is used to control the light to be extinguished.
[0090] In some embodiments, the first determination unit includes: a sampling period determination sub-unit configured to determine a sampling period; a pulse width determination sub-unit configured to determine the pulse width according to the sampling period and the lighting duration; and a pulse period determination sub-unit configured to determine the pulse period according to the sampling period, the lighting duration, and the extinguishing duration.
[0091] In some embodiments, the first control parameter or the second control parameter includes the number of times the light flashes.
[0092] According to one aspect of the embodiments of the present application, an electronic device is further provided, as Figure 10 shown. The electronic device 600 includes a processor 610 and one or more memories 620. The one or more memories 620 are used to store program instructions to be executed by the processor 610. When the processor 610 executes the program instructions, the above-described control method for the light is implemented.
[0093] Further, the processor 610 may include one or more processing cores. The processor 610 runs or executes instructions, programs, code sets, or instruction sets stored in the memory 620, and calls data stored in the memory 620. Optionally, the processor 610 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). The processor 610 may integrate a combination of one or more of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, application programs, etc.; the GPU is responsible for rendering and drawing the display content; the modem is used to process wireless communication. It can be understood that the above modem may not be integrated into the processor and may be implemented separately through a communication chip.
[0094] According to one aspect of the present application, the present application further provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The above computer-readable storage medium carries computer-readable instructions, and when the computer-readable storage instructions are executed by a processor, the method in any of the above embodiments is implemented.
[0095] It should be noted that the computer-readable medium shown in the embodiments of the present application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, apparatus, or device. In the present application, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, and this computer-readable medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted by any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0096] The units involved in the embodiments described in the present application can be implemented in software or in hardware, and the described units can also be provided in a processor. Among them, the names of these units do not, in some cases, limit the units themselves.
[0097] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. Each block in the flowchart or block diagram may represent a module, a segment of a program, or a part of code, and the above-mentioned module, segment of a program, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, as well as the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0098] Those skilled in the art will readily conceive of other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. The present application is intended to cover any variations, uses, or adaptations of the present application, which follow the general principles of the present application and include known common knowledge or conventional technical means in the technical field not disclosed in the present application.
[0099] It should be understood that the present application is not limited to the exact structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the present application is only limited by the appended claims.
Claims
1. A method for controlling lighting, characterized in that: The method comprises: If a second flashing request is detected during the process of the light flashing in response to the first flashing request, obtaining a timestamp corresponding to the second flashing request; Determine a current pulse phase based on the current flicker parameter corresponding to the first flicker request, and determine a current phase value based on the timestamp corresponding to the second flicker request and the current flicker parameter corresponding to the first flicker request; Determine a phase difference according to the current phase value and the current pulse phase, wherein the phase difference is used to indicate a remaining phase value of the current pulse phase for executing a complete first flashing request; The light is controlled to perform light flashing according to the phase difference and the second flashing request.
2. The method according to claim 1, characterized in that The step of controlling the light to flash according to the phase difference and the second flashing request includes: If the phase difference is greater than zero, continuing to control the light to flash according to the first flashing request; Determine, according to the phase difference, the target duration corresponding to the change of the light from the phase value at the current moment to the current pulse phase value; After the target time period, the light is controlled to flash according to the second flashing request.
3. The method according to claim 1, characterized in that: The step of controlling the light to flash according to the phase difference and the second flashing request includes: If the phase difference is zero, the light is controlled to flash according to the second flashing request.
4. The method according to claim 2 or 3, characterized in that: The step of controlling the light to flash according to the second flashing request includes: Determine the lighting duration, the extinguishing duration, the high level amplitude and the low level amplitude according to the second flashing request; Determine a pulse period and a pulse width according to the lighting duration and the extinguishing duration; Determining a target pulse phase value according to the pulse period; Determine the magnitude relationship between the target pulse phase value and the pulse width and the pulse period; Based on the magnitude relationship, a control parameter is determined according to the high level amplitude or the low level amplitude, and the light is controlled to perform light flashing according to the control parameter.
5. The method according to claim 4, characterized in that The determining of a control parameter based on the magnitude relationship and the high level amplitude or the low level amplitude, and controlling the light to flash according to the control parameter, comprises: If the magnitude relationship indicates that the target pulse phase value is smaller than the pulse width, determining a first control parameter according to the high level amplitude, wherein the first control parameter is used to control the lighting of the light; If the magnitude relationship indicates that the target pulse phase value is greater than or equal to the pulse width and less than the pulse period, a second control parameter is determined according to the low level amplitude, wherein the second control parameter is used to control the light to turn off.
6. The method according to claim 4, characterized in that The step of determining the pulse period and the pulse width according to the lighting duration and the extinguishing duration includes: Determine the sampling period; Determine the pulse width according to the sampling period and the lighting duration; The pulse period is determined according to the sampling period, the lighting time length and the extinguishing time length.
7. The method according to any one of claims 4 to 6, characterized in that: The first control parameter or the second control parameter includes the number of flashes of the light.
8. A lighting control device, characterized in that: The device comprises: an acquisition module, configured to acquire a timestamp corresponding to a second flashing request if a second flashing request is detected during the process in which the light flashes in response to the first flashing request; a current moment phase value determination module, configured to determine a current pulse phase based on a current flicker parameter corresponding to the first flicker request, and to determine a current moment phase value based on a timestamp corresponding to the second flicker request and a current flicker parameter corresponding to the first flicker request; a phase difference determination module, configured to determine a phase difference according to the current phase value and the current pulse phase, wherein the phase difference is used to indicate a remaining phase value of the current pulse phase for executing a complete first flashing request; The control module is used to control the light to flash according to the phase difference and the second flashing request.
9. An electronic device, characterized in that: The electronic device comprises: processor; A memory having computer-readable instructions stored thereon, wherein when the computer-readable instructions are executed by the processor, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program codes, which can be called by a processor to execute the method according to any one of claims 1 to 7.