CN113312506B - Lighting device control method, storage medium, and electronic apparatus - Google Patents

Lighting device control method, storage medium, and electronic apparatus Download PDF

Info

Publication number
CN113312506B
CN113312506B CN202110597375.0A CN202110597375A CN113312506B CN 113312506 B CN113312506 B CN 113312506B CN 202110597375 A CN202110597375 A CN 202110597375A CN 113312506 B CN113312506 B CN 113312506B
Authority
CN
China
Prior art keywords
rgb value
period
lighting device
color
timing parameter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110597375.0A
Other languages
Chinese (zh)
Other versions
CN113312506A (en
Inventor
刘宇康
张振华
王晓彪
杜超喜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Dongfeng Nissan Passenger Vehicle Co
Original Assignee
Dongfeng Nissan Passenger Vehicle Co
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Dongfeng Nissan Passenger Vehicle Co filed Critical Dongfeng Nissan Passenger Vehicle Co
Priority to CN202110597375.0A priority Critical patent/CN113312506B/en
Publication of CN113312506A publication Critical patent/CN113312506A/en
Application granted granted Critical
Publication of CN113312506B publication Critical patent/CN113312506B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/51Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/58Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • G06F16/583Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content
    • G06F16/5838Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content using colour
    • HELECTRICITY
    • H05ELECTRIC TECHNIQUES NOT OTHERWISE PROVIDED FOR
    • H05BELECTRIC HEATING; ELECTRIC LIGHT SOURCES NOT OTHERWISE PROVIDED FOR; CIRCUIT ARRANGEMENTS FOR ELECTRIC LIGHT SOURCES, IN GENERAL
    • H05B47/00Circuit arrangements for operating light sources in general, i.e. where the type of light source is not relevant
    • H05B47/10Controlling the light source
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02BCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO BUILDINGS, e.g. HOUSING, HOUSE APPLIANCES OR RELATED END-USER APPLICATIONS
    • Y02B20/00Energy efficient lighting technologies, e.g. halogen lamps or gas discharge lamps
    • Y02B20/40Control techniques providing energy savings, e.g. smart controller or presence detection

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Library & Information Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Circuit Arrangement For Electric Light Sources In General (AREA)

Abstract

The invention provides a lighting device control method, a storage medium and an electronic device, wherein the method comprises the following steps: receiving a control instruction for controlling the color of a lighting device to be controlled, and acquiring a first RGB value of a first color, a second RGB value of a second color, a functional period T1 and a response frequency T2 of the lighting device to be controlled according to the control instruction; in a preset period, obtaining a timing parameter k corresponding to each moment, and calculating a current moment RGB value corresponding to each moment according to the timing parameter k, the first RGB value, the second RGB value, the functional period T1 and the response frequency T2; and controlling the lighting device by using the RGB value at the current moment. The invention realizes the breath control of all colors without storing a color index table in advance, and when the breath control of more colors is needed, only new colors and corresponding RGB values are needed to be added in the system, the development period is short, the requirement of rapid iteration is met, and the expansibility is good.

Description

Lighting device control method, storage medium, and electronic apparatus
Technical Field
The present invention relates to the field of automotive technologies, and in particular, to a lighting device control method, a storage medium, and an electronic apparatus.
Background
The atmosphere lamp is a lighting lamp with decorative effect, is usually red, blue, green and the like, and mainly aims to make a carriage more gorgeous, bake the atmosphere and create indoor feelings.
Currently, the existing atmosphere lamp breathing control method mainly adopts a color index table mode, in each control breathing period, the RGB values of each color at each moment need to be stored in the color index table in advance, as shown in the following table 1, when the color index table is built, the RGB values of the vermilion colors under the conditions of different time and different brightness at day and night need to be stored in advance. When the atmosphere lamp breathing control is carried out, the controller controls the atmosphere lamp to display different brightness and different colors according to the RGB value corresponding to each color by searching the RGB value corresponding to each color stored in the color index table.
TABLE 1
However, the inventor finds that in the process of implementing the invention, the existing atmosphere lamp breathing control method needs to pre-establish and store color index tables, so that each breathing control process needs to store hundreds of color index tables, the memory occupation is large, the response speed is slow, meanwhile, the effect that the atmosphere lamp displays the color index tables is not pre-stored cannot be controlled, and the color index tables need to be updated again according to the color and period changes in the development process. Meanwhile, because the function is externally closed, only the original developer can modify the function effect, the customization cannot be realized, the development period is long, the requirement of quick iteration cannot be met, and the expansibility is poor.
Disclosure of Invention
The invention aims to overcome the defects of the prior art, and provides a lighting device control method, a storage medium and electronic equipment, which are used for realizing the breathing control of all color atmosphere lamps, and have the advantages of no need of pre-storing a color index table, short development period, adaptability to the requirement of rapid iteration and good expansibility.
The technical scheme of the invention provides a lighting device control method, which comprises the following steps:
Receiving a control instruction for controlling the color of a lighting device to be controlled, and acquiring a first RGB value of a first color, a second RGB value of a second color, a functional period T1 and response time T2 of the lighting device to be controlled according to the control instruction;
in a preset period, obtaining a timing parameter k corresponding to each moment, and calculating a current moment RGB value corresponding to each moment according to the timing parameter k, the first RGB value, the second RGB value, the functional period T1 and the response time T2;
and controlling the lighting device by using the RGB value at the current moment.
Further, the obtaining the timing parameter k corresponding to each time in the preset period, and calculating the current time RGB value corresponding to each time according to the timing parameter k, the first RGB value, the second RGB value, the functional period T1 and the response time T2 includes:
Updating the timing parameter k when the current time RGB value is calculated once, verifying whether the timing parameter k is in the preset period, and stopping calculating the current time RGB value when the timing parameter k exceeds the preset period;
the controlling the lighting device by using the current time RGB value comprises the following steps:
And controlling the lighting device by using the first RGB value or the second RGB value or the current time RGB value corresponding to the time when the timing parameter k exceeds the preset time period.
Further, the controlling the lighting device with the first RGB value or the second RGB value or the current time RGB value corresponding to the time when the timing parameter k exceeds the previous time of the preset period includes:
And judging the position of the timing parameter k in the functional period T1 at the previous moment when the timing parameter k exceeds the preset period, if the timing parameter k is in a first sub-period of the functional period T1, controlling the lighting device by using the first RGB value, and if the timing parameter k is in a second sub-period of the functional period T1, controlling the lighting device by using the second RGB value, wherein the first sub-period is a period of changing from the first color to the second color, and the second sub-period is a period of changing from the second color to the first color.
Further, the controlling the lighting device with the first RGB value or the second RGB value or the current time RGB value corresponding to the time when the timing parameter k exceeds the previous time of the preset period includes:
And when the timing parameter K exceeds the preset period, if the difference value between the timing parameter K value and the timing parameter K' at the end of the first sub-period is within a preset difference value threshold, controlling the lighting device according to the second RGB value, otherwise, controlling the lighting device according to the first RGB value.
Further, in the first sub-period, the current time RGB value is calculated by using the following method:
Wherein R' is an R value corresponding to the RGB value at the current moment in the first sub-period; g' is a G value corresponding to the RGB value at the current moment in the first sub-period; b' is a B value corresponding to the RGB value at the current moment in the first sub-period; r 2 is the R value corresponding to the second RBG value; r 1 is the R value corresponding to the first RBG value; g 2 is the G value corresponding to the second RBG value; g 1 is a G value corresponding to the first RBG value; b 2 is the B value corresponding to the second RBG value; b 1 is a B value corresponding to the first RBG value; k is the counting parameter; t 1 is the functional period; t 2 is the response time.
Further, in the second sub-period, the current time RGB value is calculated by using the following method:
wherein R' is an R value corresponding to the RGB value at the current time in the second sub-period; g' is a G value corresponding to the RGB value at the current time in the second sub-period; b' is the B value corresponding to the RGB value at the current moment in the second sub-period.
Further, the calculating the current time RGB value by using the first RGB value, the second RGB value, the functional period T1 and the response time T2 further includes:
and carrying out floating point number removal processing on the RGB value at the current moment.
Further, the processing for removing floating point numbers from the current time RGB value specifically includes:
and processing the RGB value at the current moment by using an integer four-rule operation.
The technical solution of the present invention also provides a storage medium storing computer instructions for performing all the steps of the lighting device control method as described above when the computer executes the computer instructions.
The technical scheme of the invention also provides electronic equipment, which comprises:
at least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores instructions executable by the at least one processor to enable the at least one processor to:
Receiving a control instruction for controlling the color of a lighting device to be controlled, and acquiring a first RGB value of a first color, a second RGB value of a second color, a functional period T1 and response time T2 according to the control instruction;
in a preset period, obtaining a timing parameter k corresponding to each moment, and calculating a current moment RGB value corresponding to each moment according to the timing parameter k, the first RGB value, the second RGB value, the functional period T1 and the response time T2;
and controlling the lighting device by using the RGB value at the current moment.
After the technical scheme is adopted, the method has the following beneficial effects: when a control instruction for controlling the color of the lighting device to be controlled is received, a first RGB value of the first color, a second RGB value of the second color, a functional period T1 and a response time T2 of the lighting device to be controlled are obtained according to the control instruction, a timing parameter k corresponding to each moment is obtained in a preset period, a current moment RGB value corresponding to each moment is calculated according to the timing parameter k, the first RGB value, the second RGB value, the functional period T1 and the response time T2, the lighting device to be controlled is controlled according to the current moment RGB value, and therefore breathing control of all color atmosphere lamps is achieved, a color index table does not need to be stored in advance, when breathing control of more color atmosphere lamps is needed, new colors and corresponding RGB values need to be added in a system, the development period is short, the requirement of quick iteration can be met, and the expansibility is good.
Drawings
The present disclosure will become more readily understood with reference to the accompanying drawings. It should be understood that: the drawings are for illustrative purposes only and are not intended to limit the scope of the present invention. In the figure:
Fig. 1 is a flowchart of a lighting device control method according to a first embodiment of the present invention;
fig. 2 is a flowchart of a lighting device control method according to a second embodiment of the present invention;
fig. 3 is a schematic hardware structure of an electronic device for controlling a lighting device according to a fourth embodiment of the present invention.
Detailed Description
Specific embodiments of the present invention will be further described below with reference to the accompanying drawings.
It is to be readily understood that, according to the technical solutions of the present invention, those skilled in the art may replace various structural modes and implementation modes with each other without changing the true spirit of the present invention. Accordingly, the following detailed description and drawings are merely illustrative of the invention and are not intended to be exhaustive or to limit the invention to the precise form disclosed.
Terms of orientation such as up, down, left, right, front, rear, front, back, top, bottom, etc. mentioned or possible to be mentioned in the present specification are defined with respect to the configurations shown in the drawings, which are relative concepts, and thus may be changed according to different positions and different use states thereof. These and other directional terms should not be construed as limiting terms.
Example 1
As shown in fig. 1, fig. 1 is a flowchart of a lighting device control method according to a first embodiment of the present invention, including:
step S101: receiving a control instruction for controlling the color of the lighting device to be controlled;
step S102: acquiring a first RGB value of a first color, a second RGB value of a second color, a functional period T1 and response time T2 of a lighting device to be controlled according to a control instruction;
step S103: in a preset period, obtaining a timing parameter k corresponding to each moment, and calculating a current moment RGB value corresponding to each moment according to the timing parameter k, the first RGB value, the second RGB value, the functional period T1 and the response time T2;
step S104: and controlling the lighting device by using the RGB value at the current moment.
Specifically, when the lighting device needs to be controlled, such as a guest-welcome mode triggered when the door is opened, a control instruction for controlling the color of the lighting device to be controlled is input by a user, firstly, the controller executes step S101 to receive the control instruction input by the user; secondly, the controller executes step S102 to obtain a first RGB value of a first color, a second RGB value of a second color, a functional period T1 and a response time T2 of the lighting device to be controlled according to the control instruction, taking the current color breathing, the breathing process being that the lighting is changed from bright to dark, as an example, the current color of the lighting device to be controlled is taken as the first color, the RGB value corresponding to the current color is taken as the first RGB value, the RGB value corresponding to the current color is extinguished as the second color, the RGB value corresponding to the second color is taken as the second RGB value, the color of the lighting device to be controlled and the corresponding RGB value can be stored in the system in advance, the types of the colors can be set according to the requirements, for example, the colors can be the conventional red, orange, yellow, green, cyan, blue and purple seven colors, or the current popular 64 colors, because the colors can be directly extracted through the setting interface, the change of the corresponding color setting can be achieved without inquiring the color index table; then, the controller executes step S103 to obtain a timing parameter k corresponding to each moment in a preset period, and calculates a current moment RGB value corresponding to each moment according to the timing parameter k, the first RGB value, the second RGB value, the functional period T1 and the response time T2, where the timing parameter k can clock the output color according to the response time T2 by a timer, for example, when the response time T2 is 0.1S, the timer counts once every 0.1S, and the timing parameter k is increased by 0.1S, so that the current moment RGB value changes along with the change of the timing parameter k, thereby obtaining RGB values of all colors; finally, the controller performs step S104 to control the color change of the lighting device to be controlled by using the RGB value at the current time.
The color control method of the lighting device to be controlled is the same as the existing color control method of the LED lamp, and is not described herein.
The response time refers to a time interval of color change of the lamp to be controlled, for example, when the control time interval is 0.1s, the color is displayed every 0.1 s. The functional period T1 refers to the time required for the light color to be changed from the first color to the second color and back to the first color in equal proportion according to a specified control rule, for example, the time required for the welcome mode to be red-black-red when the vehicle door is opened is 4s, and the functional period T1 is 4s.
Wherein the controller is preferably an electronic control unit (Electronic Control Unit, ECU).
According to the lighting device control method, when the control instruction for controlling the colors of the lighting device to be controlled is received, the first RGB value of the first color, the second RGB value of the second color, the functional period T1 and the response time T2 of the lighting device to be controlled are obtained according to the control instruction, the timing parameter k corresponding to each moment is obtained in the preset period, the current moment RGB value corresponding to each moment is calculated according to the timing parameter k, the first RGB value, the second RGB value, the functional period T1 and the response time T2, and the lighting device to be controlled is controlled according to the current moment RGB value, so that breathing control of all color atmosphere lamps is achieved, a color index table does not need to be stored in advance, when breathing control of more color atmosphere lamps is needed, only new colors and corresponding RGB values need to be added in a system, the development period is short, the requirement of rapid iteration can be met, and the expansibility is good.
Example two
As shown in fig. 2, fig. 2 is a flowchart of a lighting device control method according to a second embodiment of the present invention, including:
Step S201: receiving a control instruction for controlling the color of the lighting device to be controlled;
Step S202: acquiring a first RGB value of a first color, a second RGB value of a second color, a functional period T1 and response time T2 of a lighting device to be controlled according to a control instruction;
Step S203: in a preset period, obtaining a timing parameter k corresponding to each moment, and calculating a current moment RGB value corresponding to each moment according to the timing parameter k, the first RGB value, the second RGB value, the functional period T1 and the response time T2;
step S204: updating a timing parameter k when calculating the RGB value of the current moment once;
step S205: judging whether the timing parameter k is within a preset period;
step S206: stopping calculating the RGB value at the current moment;
step S207: judging the position of the timing parameter k in the functional period T1 at the previous moment when the timing parameter k exceeds the preset period;
Step S208: if the timing parameter k is in the first sub-period of the functional period T1, controlling the lighting device by using the first RGB value;
step S209: if the timing parameter k is in the second sub-period of the functional period T1, controlling the lighting device by using a second RGB value;
step S210: judging whether the difference value between the timing parameter K value and the timing parameter K' at the end of the first sub-period is within a preset difference value threshold;
step S211: controlling the lighting device according to the second RGB value;
Step S212: the lighting device is controlled according to the first RGB value.
Specifically, when it is necessary to control the lighting device, first, the controller executes step 201 to receive a control instruction.
Next, the controller executes step S202 to obtain a first RGB value of a first color, a second RGB value of a second color, a functional period T1 and a response time T2 of the lighting device to be controlled;
Next, the controller executes step S203 to obtain a timing parameter k corresponding to each time within a preset period, and calculates a current time RGB value corresponding to each time according to the timing parameter k, the first RGB value, the second RGB value, the functional period T1 and the response time T2. Then, the controller performs step S204 to update the timing parameter k each time the current time RGB value is calculated;
finally, the controller executes step S205 to determine whether the timing parameter k is within the preset period, if yes, executes step S204, otherwise executes steps S206-S207 to stop calculating the RGB value at the current time, and determines the position of the timing parameter k in the functional period T1 at the previous time beyond the preset period, if the timing parameter k is in the first sub-period of the functional period T1, executes step S208 to control the lighting device with the first RGB value, and if the timing parameter k is in the second sub-period of the functional period T1, executes step S208 to control the lighting device with the second RGB value.
Meanwhile, the controller executes step S210 to determine whether the difference between the timing parameter K value and the timing parameter K' at the end of the first sub-period is within the preset difference threshold, if yes, step S211 is executed, otherwise step S212 is executed.
The functional period T1 includes a first sub-period and a second sub-period, where the first color and the second color controlled by the first sub-period are opposite to the first color and the second color controlled by the second sub-period, for example, when the color controlled by the first sub-period is red-black, the color controlled by the second sub-period is black-red, and the first sub-period and the second sub-period form a complete functional period T1, and when an atmosphere effect of multiple functional periods is needed, only the atmosphere effect of one functional period is needed to be executed in a circulating manner, so that occupied memory is further reduced, and operation efficiency is improved. The preset difference threshold is the number of response times T2 in a complete functional period T1. Preferably, the preset difference threshold is + -T1/4T 2.
According to the lighting device control method, when the control instruction for controlling the colors of the lighting device to be controlled is received, the first RGB value of the first color, the second RGB value of the second color, the functional period T1 and the response time T2 of the lighting device to be controlled are obtained according to the control instruction, the timing parameter k corresponding to each moment is obtained in the preset period, the current moment RGB value corresponding to each moment is calculated according to the timing parameter k, the first RGB value, the second RGB value, the functional period T1 and the response time T2, and the lighting device to be controlled is controlled according to the current moment RGB value, so that breathing control of all color atmosphere lamps is achieved, a color index table does not need to be stored in advance, when breathing control of more color atmosphere lamps is needed, only new colors and corresponding RGB values need to be added in a system, the development period is short, the requirement of rapid iteration can be met, and the expansibility is good.
In one embodiment, to adapt to the linear variation law, when the control law is a linear function, in the first sub-period, the current time RGB value is calculated by the following equation (1):
Wherein R' is an R value corresponding to the RGB value at the current moment in the first sub-period; g' is a G value corresponding to the RGB value at the current moment in the first sub-period; b' is a B value corresponding to the RGB value at the current moment in the first sub-period; r 2 is the R value corresponding to the second RGB value; r 1 is the R value corresponding to the first RGB value; g 2 is a G value corresponding to the second RGB value; g 1 is a G value corresponding to the first RGB value; b 2 is a B value corresponding to the second RGB value; b 1 is a B value corresponding to the first RGB value; k is a timing parameter; t 1 is a functional period; t 2 is the response time.
In one embodiment, to adapt to the linear variation rule, when the control rule is a linear function, the current time RGB value is calculated in the second sub-period by using the following equation (2):
Wherein R' is the R value corresponding to the RGB value at the current time in the second sub-period; g' is a G value corresponding to the RGB value at the current time in the second sub-period; b' is the B value corresponding to the RGB value at the current time in the second sub-period.
Preferably, in order to adapt to the nonlinear variation law, when the control law is a quadratic function, the current time RGB value is calculated by using the following expression (3) instead of the expression (1):
preferably, in order to adapt to the nonlinear variation law, when the control law is a quadratic function, the current time RGB value is calculated by using the following expression (4) instead of the expression (2):
In one embodiment, in order to improve the operation efficiency, the calculating the current time RGB value by using the first RGB value, the second RGB value, the functional period T1 and the response time T2 further includes:
and performing floating point number removal processing on the RGB value at the current moment.
In one embodiment, the removing floating point number processing on the current time RGB value specifically includes:
The current time RGB values are processed using integer four operations.
Specifically, in the first sub-period, the above equation (1) is multiplied by an integer variable which can make the operation result an integer at the same time on both sides, and preferably, in order to improve the operation efficiency, the integer variable is cT 1, where c is a constant which is multiplied by the control frequency to an integer, and therefore, the above equation (1) is converted into the following equation (5):
Similarly, in the second sub-period, the two sides of the formula (2) are multiplied by an integer variable which can make the operation result an integer, preferably, in order to improve the operation efficiency, the integer variable is cT 1, where c is a constant which is multiplied by the control frequency to an integer, and therefore, the formula (2) is converted into the following formula (6):
As can be seen from the above equations (5) and (6), the RGB output values obtained by processing the RGB output values by the integer four-way operation are all integer values, and floating point numbers are eliminated, so that the operation process does not include floating point operation, the operation efficiency is improved, and the method is suitable for a common controller and improves universality.
Similarly, when the control rule is a quadratic function, the floating point number removal process may be performed on the above formulas (3) and (4) by the same method, and will not be described here again.
Example III
A third embodiment of the present invention provides a storage medium for storing computer instructions which, when executed by a computer, are adapted to carry out all the steps of the lighting device control method of any of the method embodiments described above.
Example IV
As shown in fig. 3, a hardware structure diagram of an electronic device for controlling a lighting device according to a fourth embodiment of the present invention includes:
At least one processor 301; and
A memory 302 communicatively coupled to the at least one processor 301; wherein,
The memory 302 stores instructions executable by the at least one processor 301, the instructions being executable by the at least one processor 301 to enable the at least one processor 301 to:
Receiving a control instruction for controlling the color of a lighting device to be controlled, and acquiring a first RGB value of a first color, a second RGB value of a second color, a functional period T1 and response time T2 according to the control instruction;
in a preset period, obtaining a timing parameter k corresponding to each moment, and calculating a current moment RGB value corresponding to each moment according to the timing parameter k, the first RGB value, the second RGB value, the functional period T1 and the response time T2;
and controlling the lighting device by using the RGB value at the current moment.
One processor 301 is illustrated in fig. 3.
The electronic device is preferably an electronic control unit (Electronic Control Unit, ECU).
The electronic device may further include: an input device 303 and an output device 304.
The processor 301, memory 302, input device 303, and output device 304 may be connected by a bus or other means, the connection being illustrated as a bus.
The memory 302 is used as a non-volatile computer readable storage medium for storing non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions/modules corresponding to the lighting device control method in the embodiment of the present application, for example, the method flows shown in fig. 1-2. The processor 301 executes various functional applications and data processing by running nonvolatile software programs, instructions, and modules stored in the memory 302, that is, implements the lighting device control method in the above-described embodiment.
Memory 302 may include a storage program area that may store an operating system, at least one application program required for functionality, and a storage data area; the storage data area may store data created according to the use of the lighting device control method, and the like. In addition, memory 302 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 302 may optionally include memory remotely located with respect to the processor 301, which may be connected to the device performing the lighting device control method via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 303 may receive input user clicks and generate signal inputs related to user settings and function controls of the lighting device control method. The output device 304 may include a display device such as a display screen.
The lighting device control method of any of the method embodiments described above is performed when executed by the one or more processors 301, in the one or more modules stored in the memory 302.
The product can execute the method provided by the embodiment of the application, and has the corresponding functional modules and beneficial effects of the execution method. Technical details not described in detail in this embodiment may be found in the methods provided in the embodiments of the present application.
The electronic device of the embodiments of the present invention exists in a variety of forms including, but not limited to:
(1) The electronic control unit (Electronic Control Unit, ECU) is also called "car running computer", "car carrying computer", etc. The device mainly comprises a microprocessor (CPU), a memory (ROM, RAM), an input/output interface (I/O), an analog-to-digital converter (A/D), and large-scale integrated circuits such as shaping and driving.
(2) Mobile communication devices, which are characterized by mobile communication functionality and are aimed at providing voice, data communication. Such terminals include smart phones (e.g., iPhone), multimedia phones, functional phones, and low-end phones, among others.
(3) Ultra mobile personal computer equipment, which belongs to the category of personal computers, has the functions of calculation and processing and generally has the characteristic of mobile internet surfing. Such terminals include PDA, MID, and UMPC devices, etc.
(4) Portable entertainment devices such devices can display and play multimedia content. Such devices include audio, video players (e.g., iPod), palm game consoles, electronic books, and smart toys and portable car navigation devices.
(5) The server is similar to a general computer architecture in that the server is provided with high-reliability services, and therefore, the server has high requirements on processing capacity, stability, reliability, safety, expandability, manageability and the like.
(6) Other electronic devices with data interaction function.
Further, the logic instructions in memory 302 described above may be implemented in the form of software functional units and stored in a computer readable storage medium when sold or used as a stand alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing a mobile terminal (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment of the invention. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the embodiments of the present invention, and are not limited thereto; although embodiments of the present invention have been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (8)

1. A lighting device control method, characterized by comprising:
Receiving a control instruction for controlling the color of a lighting device to be controlled, acquiring a first RGB value of a first color, a second RGB value of a second color, a functional period T1 and response time T2 of the lighting device to be controlled according to the control instruction, wherein the functional period T1 is the time required for changing the light color of the lighting device to be controlled from the first color to the second color and back to the first color in equal proportion according to a specified control rule, and the response time T2 is the time interval for changing the color of the light to be controlled;
In a preset period, obtaining a timing parameter k corresponding to each moment, and calculating a current moment RGB value corresponding to each moment according to the timing parameter k, the first RGB value, the second RGB value, the functional period T1 and the response time T2: in a first sub-period, the current time RGB value is calculated using the following:
Wherein R is an R value corresponding to the current time RGB value in the first sub-period; g is a G value corresponding to the RGB value at the current time in the first sub-period; b is a B value corresponding to the RGB value at the current moment in the first sub-period; r 2 is the R value corresponding to the second RGB value; r 1 is the R value corresponding to the first RGB value; g 2 is the G value corresponding to the second RGB value; g 1 is a G value corresponding to the first RGB value; b 2 is a B value corresponding to the second RGB value; b 1 is a B value corresponding to the first RGB value; k is the timing parameter; t 1 is the functional period; t 2 is the response time;
In a second sub-period, the current time RGB value is calculated using the following:
Wherein R' is an R value corresponding to the RGB value at the current time in the second sub-period; g' is a G value corresponding to the RGB value at the current time in the second sub-period; b' is a B value corresponding to the RGB value at the current moment in the second sub-period;
and controlling the lighting device by using the RGB value at the current moment.
2. The method for controlling a lighting device as recited in claim 1, wherein said obtaining a timing parameter k corresponding to each time within a predetermined period of time, and calculating a current time RGB value corresponding to each time based on said timing parameter k, said first RGB value, said second RGB value, said functional period T1 and said response time T2 comprises:
Updating the timing parameter k when the current time RGB value is calculated once, verifying whether the timing parameter k is in the preset period, and stopping calculating the current time RGB value when the timing parameter k exceeds the preset period;
the controlling the lighting device by using the current time RGB value comprises the following steps:
And controlling the lighting device by using the first RGB value or the second RGB value or the current time RGB value corresponding to the time when the timing parameter k exceeds the preset time period.
3. A lighting device control method as recited in claim 2, wherein said controlling said lighting device with said first RGB value or said second RGB value or said current time instant RGB value corresponding to a previous time instant when said timing parameter k exceeded said preset period comprises:
And judging the position of the timing parameter k in the functional period T1 at the previous moment when the timing parameter k exceeds the preset period, if the timing parameter k is in a first sub-period of the functional period T1, controlling the lighting device by using the first RGB value, and if the timing parameter k is in a second sub-period of the functional period T1, controlling the lighting device by using the second RGB value, wherein the first sub-period is a period of changing from the first color to the second color, and the second sub-period is a period of changing from the second color to the first color.
4. A lighting device control method as recited in claim 2, wherein said controlling said lighting device with said first RGB value or said second RGB value or said current time instant RGB value corresponding to a previous time instant when said timing parameter k exceeded said preset period comprises:
And when the timing parameter K exceeds the preset period, if the difference value between the timing parameter K value and the timing parameter K' at the end of the first sub-period is within a preset difference value threshold, controlling the lighting device according to the second RGB value, otherwise, controlling the lighting device according to the first RGB value.
5. The lighting device control method according to claim 1, wherein the calculating the current time RGB value using the first RGB value, the second RGB value, the functional period T1, and the response time T2 further comprises:
and carrying out floating point number removal processing on the RGB value at the current moment.
6. The method for controlling a lighting device as recited in claim 5, wherein said removing floating point number from said current time RGB values comprises:
and removing floating point numbers from the RGB value at the current moment by using integer four arithmetic.
7. A storage medium storing computer instructions which, when executed by a computer, are adapted to carry out all the steps of the lighting device control method of any one of claims 1-6.
8. An electronic device, comprising:
at least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the lighting device control method of any one of claims 1-6.
CN202110597375.0A 2021-05-28 2021-05-28 Lighting device control method, storage medium, and electronic apparatus Active CN113312506B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110597375.0A CN113312506B (en) 2021-05-28 2021-05-28 Lighting device control method, storage medium, and electronic apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110597375.0A CN113312506B (en) 2021-05-28 2021-05-28 Lighting device control method, storage medium, and electronic apparatus

Publications (2)

Publication Number Publication Date
CN113312506A CN113312506A (en) 2021-08-27
CN113312506B true CN113312506B (en) 2024-07-05

Family

ID=77376162

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110597375.0A Active CN113312506B (en) 2021-05-28 2021-05-28 Lighting device control method, storage medium, and electronic apparatus

Country Status (1)

Country Link
CN (1) CN113312506B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108664136A (en) * 2018-05-17 2018-10-16 珠海市学思电子科技有限公司 Keyboard light imitates control method, computer installation and computer readable storage medium

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102307413B (en) * 2011-06-07 2013-08-21 青岛海信宽带多媒体技术有限公司 Method and device for displaying any color by using RGB (Red, Green and Blue) three-color indicating lamps
JP5937329B2 (en) * 2011-10-12 2016-06-22 株式会社中野エンジニアリング Toning type LED lighting fixture
JP2013218153A (en) * 2012-04-10 2013-10-24 Sharp Corp Illumination control device, control system, and illumination control method
CN108882440B (en) * 2018-05-17 2019-05-24 珠海市学思电子科技有限公司 Keyboard light imitates control method, computer installation and computer readable storage medium
CN108898917A (en) * 2018-06-28 2018-11-27 深圳市乾乾编程科技有限公司 Terminal control method, device and computer equipment based on color identification
KR102192336B1 (en) * 2019-04-05 2020-12-17 한국과학기술원 User interface for controlling chroma and luminance of multi-color light source
CN111954334B (en) * 2020-08-12 2023-03-10 宁波视睿迪光电有限公司 Breathing lamp control method and device, electronic equipment and readable storage medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108664136A (en) * 2018-05-17 2018-10-16 珠海市学思电子科技有限公司 Keyboard light imitates control method, computer installation and computer readable storage medium

Also Published As

Publication number Publication date
CN113312506A (en) 2021-08-27

Similar Documents

Publication Publication Date Title
CN105487780B (en) Control display method and device
CN106649586A (en) Playing method of audio files and device of audio files
EP3106981A1 (en) Mobile terminal and method of processing loadable content
JP2023011794A (en) Sound source determination method and device therefor, computer program, and electronic device
CN112672464B (en) Lamp light control method and device of lamp and computer equipment
CN112616225A (en) Color light lamp illumination control method and terminal equipment
CN113312506B (en) Lighting device control method, storage medium, and electronic apparatus
CN112803547B (en) Charging method, charging device, electronic equipment and storage medium
CN109272944B (en) Backlight adjusting method and device, terminal equipment and computer readable storage medium
CN109564751A (en) The automatic adjusting method of user interface
CN109637437A (en) Image display control method, device, medium and display screen control system
US20240244729A1 (en) Lighting-effect control method, apparatus, lighting device, electronic device, and storage medium
CN111683445A (en) Dynamic control method and system for lighting equipment and related equipment
CN113853047A (en) Light control method and device, storage medium and electronic equipment
CN114407775A (en) Atmosphere lamp control method, device and system and vehicle
CN111083834B (en) LED calibration method, device, equipment and system
CN110715369B (en) Air purifier control method and device, storage medium and air purifier
CN102447913B (en) Color migration processing method and system
CN114449704B (en) Light control method, system, electronic equipment and computer readable storage device
CN106993044B (en) Terminal, lamp-based carbon compensation processing system and method
CN107678567A (en) Charging method and device, computer installation and computer-readable recording medium
CN115426748A (en) Atmosphere lamp control method, device, equipment and storage medium
CN203444653U (en) Story machine
CN114698207A (en) Light adjusting method and device, electronic equipment and storage medium
KR102109063B1 (en) Method and cluster server for providing character motion image according to battery charge level

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant