Light effect control method, apparatus, device, and storage medium

By decoupling the lighting effect control method from the embedded script and the underlying library, the problem of strong coupling between lighting effect parameters and control logic is solved, enabling rapid iteration and personalized customization of lighting effects, and improving update efficiency and device adaptability.

CN122227487APending Publication Date: 2026-06-16SHENZHEN LINKZONE IOT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN LINKZONE IOT TECH CO LTD
Filing Date
2026-03-30
Publication Date
2026-06-16

AI Technical Summary

Technical Problem

In existing technologies, adding or modifying lighting effects is difficult, and the lighting effect parameters are strongly coupled with the control logic, which cannot meet the needs of rapid iteration and dynamic adaptation.

Method used

The lighting effect control method adopts an embedded script and underlying library decoupling approach. The embedded script executes the lighting effect control logic, and the underlying library provides basic capability support, thereby decoupling the lighting effect control logic from the underlying firmware. The embedded script supports multiple languages, and the underlying library provides standardized interfaces and capability encapsulation.

Benefits of technology

It enables rapid iteration and personalized customization of lighting effects, improves update efficiency by more than 80%, lowers the technical threshold, and supports cross-device adaptation and flexible expansion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122227487A_ABST
    Figure CN122227487A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of light control, and particularly relates to a light effect control method, device, equipment and storage medium.The method comprises the following steps: obtaining an embedded script, the embedded script is used for executing light effect control logic and responding to a preset event corresponding to the embedded script; calling a bottom library, the bottom library is used for providing basic ability support for the embedded script and light effect scheduling, and realizing decoupling of the light effect control logic and the bottom firmware; reading and calling the embedded script through a light effect engine, and combining the bottom library to execute calculation and output of the light effect.The present application can solve the problems that in the prior art, when high-quality light effects are implemented, it is difficult to add or modify light effect operations, light effect parameters and control logic are strongly coupled, parameter adjustment requires modification of core code, and the problems that the requirements of rapid iteration and dynamic adaptation cannot be met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of lighting control technology, and in particular to a method, device, equipment and storage medium for controlling lighting effects. Background Technology

[0002] As the intelligentization of lighting equipment accelerates, users' demand for personalized and customizable lighting effects continues to rise. The richness and flexibility of lighting effects have become important indicators for measuring the competitiveness of lighting products, driving the industry to continuously explore more efficient lighting effect realization and control solutions.

[0003] Currently, lighting effects are mainly achieved in two ways: one is the basic effect configuration method, which generates lighting effects based on basic effects such as gradients and abrupt changes and parameter combinations; the other is the firmware low-level coding method, which creates lighting effects by using the low-level library in the firmware and hard coding methods.

[0004] The former has limited lighting effect variations, requires a large number of basic effects to support it, and has frequent equipment upgrades and large version differences; the latter can achieve high-quality lighting effects, but adding or modifying lighting effects requires updating firmware, which is difficult to operate and requires a lot of work. At the same time, the lighting effect parameters and control logic are strongly coupled, and parameter adjustments require modification of the core code, which cannot meet the needs of rapid iteration and dynamic adaptation. Summary of the Invention

[0005] This invention provides a method, apparatus, device, and storage medium for controlling lighting effects, in order to solve the problems in the prior art where it is difficult to add or modify lighting effects when achieving high-quality lighting effects, the lighting effect parameters are strongly coupled with the control logic, and parameter adjustments require modification of the core code, which cannot meet the needs of rapid iteration and dynamic adaptation.

[0006] In a first aspect, embodiments of the present invention provide a method for controlling lighting effects, including: Obtain an embedded script, which is used to execute lighting effect control logic and respond to preset events corresponding to the embedded script; The underlying library is called, which provides basic support for the embedded script and lighting effect scheduling, thereby decoupling the lighting effect control logic from the underlying firmware. The lighting effect engine reads and calls the embedded script, and in conjunction with the underlying library, performs the calculation and output of lighting effects.

[0007] In one possible implementation, obtaining the embedded script includes: Write the lighting effect control logic to obtain the embedded script; The embedded script supports at least one of the following languages: C, C++, Lua, JavaScript, Python, Rust, MicroPython, CircuitPython, mruby, JavaScript, Ada, assembly language, Gravity, LiteEmbed, Java, Go, and Forth. The preset events include lighting effect initialization, frame processing, and pixel rendering.

[0008] In one possible implementation, the basic capabilities include at least one of the following: system information provision capability, parameter acquisition capability, time and audio data acquisition capability, and color and waveform generation capability, wherein the system information includes the total number of LED beads, the current frame index, and the timestamp.

[0009] In one possible implementation, the step of reading and calling the embedded script through the lighting effect engine, and combining it with the underlying library to perform lighting effect calculations and output, includes: Read the embedded script; When the lighting effect initialization event is triggered, the initial state parameters of the lighting effect are obtained from the cloud, or the adjusted initial state parameters of the lighting effect in the embedded script are directly called, and system information is obtained through the underlying library to set the initial state of the lighting effect. The system obtains the frame duration parameters, integer adjustable parameters, and color palette parameters from the cloud, or directly calls the adjusted frame duration parameters, integer adjustable parameters, and color palette parameters from the embedded script. It then triggers a frame loop periodically according to the frame duration parameters, obtains frame control instructions, traverses the LED index, and calculates the red, green, and blue (RGB) color values ​​for each LED based on the integer adjustable parameters and color palette parameters, combined with the color and waveform generation capabilities of the underlying library. The system then caches the RGB color values ​​in the frame buffer and outputs them in batches to the lighting hardware.

[0010] In one possible implementation, the step of reading and calling the embedded script through the lighting effect engine, and combining it with the underlying library to perform lighting effect calculations and output, includes: Obtain the metadata file, which includes basic parameters of the lighting effect defined in a standardized format; the basic parameters include: a unique identifier for the lighting effect, the duration per frame, adjustable integer parameters, and color palette parameters; the adjustable integer parameters include: parameter name, minimum value, maximum value, and default value; the color palette parameters include: color palette name and a default color palette composed of RGB arrays; Read the metadata file, parse the unique identifier of the lighting effect, the duration of each frame and the value range of each parameter, obtain system information through the underlying library and set the initial state of the lighting effect; The frame loop is triggered periodically according to the duration of each frame. The frame control command is obtained, the LED bead index is traversed, and the RGB color value of each LED bead is calculated by combining the color and waveform generation capabilities of the underlying library. The RGB color values ​​are then cached in the frame buffer and output to the lighting hardware in batches.

[0011] Secondly, embodiments of the present invention provide a lighting effect control device, comprising: The script module is used to acquire an embedded script, which is used to execute the lighting effect control logic and respond to preset events corresponding to the embedded script. The underlying library module is used to call the underlying library, which provides basic capabilities for the embedded script and lighting effect scheduling, and decouples the lighting effect control logic from the underlying firmware. The lighting effect engine module is used to read and call the embedded script through the lighting effect engine, and in conjunction with the underlying library, to perform lighting effect calculations and output.

[0012] Thirdly, embodiments of the present invention provide an apparatus including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the lighting effect control method as described in the first aspect or any possible implementation thereof.

[0013] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the lighting effect control method as described in the first aspect or any possible implementation thereof.

[0014] This invention provides a method, apparatus, device, and storage medium for controlling lighting effects. It involves acquiring an embedded script, which executes lighting effect control logic and responds to preset events corresponding to the embedded script; calling a low-level library, which provides basic support for the embedded script and lighting effect scheduling, thus decoupling the lighting effect control logic from the underlying firmware; and using a lighting effect engine to read and call the embedded script, combined with the low-level library, to perform lighting effect calculations and output. In this invention, the lighting effect control logic is implemented through an embedded script, eliminating the need to modify the underlying firmware. Adding or modifying lighting effects only requires updating files, offering greater flexibility and scalability, and improving update efficiency by over 80%. The embedded script allows users to customize the lighting effect control logic to meet individual needs and achieve personalized customization. Adding parameters only requires defining them in the embedded script, and the low-level library can expand interfaces as needed (e.g., adding an infrared sensing interface) without refactoring the core architecture. Attached Figure Description

[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0016] Figure 1 This is a flowchart illustrating the implementation of the lighting effect control method provided in this embodiment of the invention. Figure 2 This is a schematic diagram of the structure of the lighting effect control device provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the device provided in an embodiment of the present invention. Detailed Implementation

[0017] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of the invention. However, those skilled in the art will understand that the invention can be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods are omitted so as not to obscure the description of the invention with unnecessary detail.

[0018] To make the objectives, technical solutions, and advantages of the present invention clearer, specific embodiments will be described below in conjunction with the accompanying drawings.

[0019] Figure 1 This is a flowchart illustrating the implementation of a lighting effect control method according to an embodiment of the present invention. The present invention aims to provide a flexible and efficient lighting effect control method. Through a three-layer architecture of "embedded script - underlying library - lighting effect engine," it decouples the lighting effect control logic from the underlying firmware. This solves the problems in existing technologies where adding or modifying lighting effects is difficult when achieving high-quality lighting effects, lighting effect parameters are strongly coupled with control logic, and parameter adjustments require modification of core code, failing to meet the needs of rapid iteration and dynamic adaptation. It supports rapid iteration of lighting effects, as detailed below: Step 101: Obtain the embedded script. The embedded script is used to execute the lighting effect control logic and respond to the preset events corresponding to the embedded script.

[0020] The core purpose of this step is to encode the lighting effect control logic into an embedded script that can run independently of the underlying firmware. This allows the embedded script to accurately respond to various preset events during the lighting effect operation, achieving complete decoupling between the lighting effect control logic and the underlying firmware. This provides core support for DIY customization, rapid modification, and cross-device adaptation of lighting effects.

[0021] In one embodiment, obtaining the embedded script may include: writing lighting effect control logic to obtain the embedded script.

[0022] Embedded scripts support a variety of mainstream embedded scripting languages, including at least one of the following: C, C++, Lua, JavaScript, Python, Rust, MicroPython, CircuitPython, mruby, JavaScript, Ada, assembly language, Gravity, LiteEmbed, Java, Go, and Forth. These languages ​​are lightweight, easy to parse, and have concise syntax. They do not require complex compilation processes. Users or developers can directly write and upload script files to add new lighting effects or modify old ones, greatly reducing the technical threshold for lighting effect development and iteration, while adapting to the operating environment requirements of different embedded systems.

[0023] Optionally, the embedded script implements the lighting effect control logic through a set of pre-defined standardized functions. All functions interact based on a unified context object ctx, which contains system information (such as the total number of LEDs and the current frame index) and underlying library interfaces (such as parameter acquisition and color generation functions), ensuring consistency and compatibility of function calls. The standardized functions include: initialization functions, per-frame processing functions, and pixel rendering functions.

[0024] Optional, the initialization function `onInit(ctx)`: This function is automatically called when the lighting effect starts and is used to complete the initial configuration of the lighting effect. It obtains basic system information (such as the total number of LEDs by `ctx.pixelCount`) and parameters defined in the metadata (such as the speed parameter by `ctx.getNumber("speed")` and the color palette by `ctx.getCpt("cpt")`) through the `ctx` context object, and sets the initial running state of the lighting effect to prepare for subsequent frame loops and rendering.

[0025] The per-frame processing function `onFrame(ctx)` is called periodically according to the `frameDuration` (length of each frame) defined in the metadata, used to control the frame execution rhythm. The function returns a delay instruction (such as "delay 10ms" or no delay) or a frame skip instruction, which can adjust the frame progression speed according to the lighting effect requirements. For example, the delay can be dynamically adjusted to realize the speed of lighting effect changes, or the frame skip instruction can simplify the frame processing flow without complex logic.

[0026] The pixel rendering function `onRender(ctx, index)` is called for each LED during the frame loop, where `index` is the unique index of the current LED. The core function combines underlying library functions for color generation and waveform calculation to calculate and return the RGB color value of the current LED based on the lighting effect control logic. For example, through palette index looping and waveform data mapping, diverse visual effects such as gradients, flow, and flashing can be achieved.

[0027] The standardized functions may also include: the optional function onGetManifest(ctx): which returns the characteristic description information of the lighting effect, such as the duration of the lighting effect and the effect type (flowing, flashing, rhythm, etc.), so that the lighting effect engine or host computer can identify the lighting effect attributes and provide data support for users to display lighting effect descriptions or classify and manage them.

[0028] To more clearly demonstrate the practical application of the standardized functions mentioned above, the following example uses a "flowing light effect" to provide a complete embedded script implementation based on the Lua language. The script implements the light effect control logic by calling the underlying library interface and metadata parameters: local pixelCount, cpt, speed function onInit(ctx) pixelCount = ctx.pixelCount -- Get the total number of LEDs. cpt = ctx.getCpt("cpt") -- Get color palette parameters speed = ctx.getNumber("speed") -- Get the flow velocity parameter end function onFrame(ctx) -- Zero-delay progress per frame return 0 end function onRender(ctx, index) -- Calculate the palette index (Lua 1-based, down-line + 1) local n = #cpt local idx = math.floor((ctx.frameIndex * speed / 10 + index) % n) + 1 local rgb = cpt[idx] return Color.RGB(rgb[1], rgb[2], rgb[3]) end This example script strictly follows the standardized function specifications defined above. Global variables are used to store reusable data, and each function corresponds to the core logic of lighting effect initialization, parameter changes, frame processing, and pixel rendering. It works in conjunction with the "speed" and "cpt" parameters defined in the metadata and the underlying library interface.

[0029] In one embodiment, preset events constitute the complete event-driven flow of the lighting effect, ensuring that the embedded script can accurately respond to the entire lifecycle of the lighting effect from startup to operation and parameter adjustment. Preset events include lighting effect initialization, frame processing, and pixel rendering. Preset events can correspond one-to-one with the aforementioned standardized functions, or they can correspond to at least two standardized functions; this embodiment does not impose such limitations.

[0030] Optional, lighting effect initialization event: used to complete the initial state configuration, which can be executed by triggering the onInit(ctx) function; Frame processing events: These are used to control the frame execution rhythm. The frame execution rhythm can be controlled by triggering the onFrame(ctx) function at regular intervals using frameDuration. Pixel rendering event: The color of each LED is calculated individually during the frame loop. This can be done by triggering the onRender(ctx, index) function. Lighting effect feature query event (optional): Returns lighting effect description information, which can be returned by triggering the onGetManifest(ctx) function.

[0031] It should be noted that the embedded script does not run independently, but rather establishes a close working relationship with the underlying library configured in step 102 through the ctx context object: Embedded scripts can read basic parameters defined in metadata files, call basic parameters in the cloud, or directly call basic parameters adjusted in embedded scripts through the ctx interface, enabling the lighting effect control logic to run based on standardized parameters without hard-coding parameter values. Embedded scripts call the basic capabilities provided by the underlying library, such as system information interfaces, color functions, and waveform functions, which simplifies the coding difficulty of control logic. For example, color values ​​can be generated directly through Color.RGB(r, g, b), and waveform data can be obtained through WaveForm(type, phase). The execution of the embedded script is scheduled by the lighting effect engine. The engine is responsible for triggering various preset events, receiving instructions returned by the embedded script (such as delay and color values), and executing subsequent hardware output operations.

[0032] The embedded scripts written in this step are completely free from the constraints of the underlying firmware. Users or developers can achieve a wide variety of lighting effects simply by writing different script files without modifying the firmware code. At the same time, the standardized function and event definitions ensure that the scripts written by different developers are compatible and can be used on various lighting devices that support this solution, greatly improving the scalability of the lighting effect ecosystem.

[0033] Step 102: Call the underlying library. The underlying library is used to provide basic support for embedded scripts and lighting effect scheduling, and to decouple the lighting effect control logic from the underlying firmware.

[0034] The core purpose of this step is to configure a set of fully functional and standardized underlying libraries to provide comprehensive basic support for the scheduling process of embedded scripts and lighting effect engines. By encapsulating the underlying hardware operations and core system capabilities, the lighting effect control logic and underlying firmware are completely decoupled, allowing embedded script writing to be free from hardware details, while ensuring the system's scalability and compatibility.

[0035] In one embodiment, the underlying library provides an interface to the outside world through a unified context object ctx. All interfaces and functions are standardized and cover the core basic capabilities required for the operation of the lighting effects. The basic capabilities include at least one of the following: system information provision capability, parameter acquisition capability, time and audio data acquisition capability, and color and waveform generation capability.

[0036] Optional, system information provision capabilities: Provides embedded scripts with key information about the lighting hardware and operating environment, supporting dynamic adaptation of embedded scripts to different device configurations. System information includes the total number of LEDs, the current frame index, and the timestamp. Core interfaces may include: ctx.pixelCount: Returns the total number of LEDs in the lamp, which makes it easier for the script to iterate through all the LEDs for rendering calculations; ctx.frameIndex: Returns the frame index of the current lighting effect, used to control the inter-frame change logic of the lighting effect (such as color progression and dynamic effect evolution); ctx.pts: Returns the current timestamp, providing a time reference for time-related lighting effect control logic (such as timed flashing and rhythm synchronization).

[0037] Parameter retrieval capability: Provides a standardized parameter reading interface, supporting embedded scripts to easily retrieve various parameters defined in metadata without needing to concern themselves with parameter storage and parsing details. Core interfaces include: ctx.getNumber(paramKey): Retrieves the value of an adjustable integer parameter, such as reading the flow velocity parameter using ctx.getNumber("speed"). ctx.getColor(paramKey): Retrieves the value of a single color parameter, and supports directly reading a single RGB color parameter defined in the metadata; ctx.getCpt(paramKey): Gets the color palette parameter value and returns a collection of RGB arrays defined in the metadata (such as a multi-color gradient palette).

[0038] Time and audio data acquisition capabilities: Supports the implementation of time-controlled and audio-linked lighting effects. Core interfaces and functions include: ctx.Time(duration_ms): Generates a delay event of a specified duration, used to control the frame execution rhythm or the start / stop interval of lighting effects; ctx.getAudio(): Gets audio analysis data, including audio rhythm intensity, frequency distribution, etc., and supports scripts to synchronize lighting effects with music rhythm.

[0039] Color and waveform generation capabilities: Provides convenient color conversion and waveform data generation tools, simplifying lighting effect color calculations and dynamic effect design. Core functions include: Color.RGB(r, g, b): Generates an RGB color object based on the brightness values ​​(0-255) of the red, green, and blue channels, which can be directly used for LED rendering; Color.HSV(h, s, v): Converts the HSV (hue, saturation, value) color mode to RGB mode to meet diverse color matching needs; WaveForm(type, phase): Generates waveform data of the specified type, supporting common waveforms such as sine waves and square waves, and is used to implement dynamic lighting effects such as gradation, flashing, and undulation.

[0040] In one embodiment, the design of the underlying library follows the principles of standardized interface design, high cohesion and low coupling design, and scalable design: Standardized interface design principle: The naming, parameter format, and return value type of all interfaces and functions follow a unified standard to ensure compatibility when called by different embedded scripting languages ​​(Lua, JavaScript, Python, etc.), while reducing the learning and usage costs for developers; High cohesion and low coupling design principle: The underlying library encapsulates all operations related to the underlying firmware and hardware. The embedded script only calls the interface through the ctx context object, without having to directly manipulate the firmware code or hardware registers, thus decoupling the lighting effect control logic from the firmware. Scalable design principle: The underlying library supports the on-demand expansion of new interfaces and functions, such as adding an infrared sensing data acquisition interface, an ambient light sensor data interface, etc. During the expansion process, there is no need to reconstruct the core architecture; only the corresponding interface functions need to be added, which does not affect the normal operation of existing scripts.

[0041] When decoupling the lighting effect control logic from the underlying firmware, the underlying library achieves this through a combination of "capability encapsulation and interface isolation": The underlying library interacts directly with the underlying firmware and hardware, encapsulating low-level operations such as LED driver, parameter storage, audio acquisition, and time synchronization, forming a standardized upper-level interface. Embedded scripts only call the interfaces provided by the underlying library through the ctx context object, without needing to care about the firmware implementation details behind the interface; When the underlying firmware needs to be upgraded (such as hardware iteration or adding hardware functions), as long as the upper-level interface of the underlying library remains unchanged, the embedded script can run normally without any modification. Conversely, when adding or modifying the lighting effect control logic, only the embedded script needs to be adjusted, without modifying the underlying firmware and underlying library, which completely solves the problem of strong coupling between lighting effect control logic and firmware in traditional technology.

[0042] The underlying library provides a "capability support base" for embedded scripts. Embedded scripts call the utility functions and data of the underlying library through the ctx interface to implement the coding of lighting effect control logic without having to worry about hardware and firmware details. The underlying library provides basic capabilities for the scheduling process of the lighting engine. For example, the lighting engine obtains the total number of LEDs through the system information interface of the underlying library, controls the frame loop rhythm through the time interface, and processes rendering data through color functions. The underlying library's parameter retrieval interface directly connects to the metadata file. Embedded scripts can read the basic parameters defined in the metadata file through the underlying library interface without having to parse the JSON file themselves, ensuring the accuracy and efficiency of reading the basic parameters.

[0043] By calling the underlying library in this step, not only is a stable and comprehensive basic capability support provided for the lighting effect control system, but more importantly, an "isolation layer" is built between the lighting effect control logic and the underlying firmware, providing core technical support for rapid iteration of lighting effects, DIY customization and cross-device adaptation.

[0044] Step 103: The lighting effect engine reads and calls the embedded script, and in conjunction with the underlying library, performs the calculation and output of the lighting effect.

[0045] The core purpose of this step is to use the lighting effect engine as a unified scheduling core, connect the embedded scripts and the underlying library, complete the initialization of lighting effects, frame loop calculation and dynamic parameter interaction according to the preset process, and finally achieve stable output of lighting effects. The whole process does not rely on the modification of the underlying firmware, completely decoupling the lighting effect control logic from the firmware, and ensuring rapid iteration, personalized customization and high smoothness of lighting effects.

[0046] The scheduling process of the lighting effect engine is divided into an initialization phase, a frame loop phase, and a parameter interaction phase. These three phases are sequentially linked and executed in a loop, covering the entire lifecycle of the lighting effect from startup to operation and adjustment.

[0047] In one embodiment, the lighting effect engine reads and calls the embedded script, and in conjunction with the underlying library, performs the calculation and output of the lighting effect, including: Read embedded scripts; When the lighting effect initialization event is triggered, the initial state parameters of the lighting effect are obtained from the cloud, or the adjusted initial state parameters of the lighting effect are directly called from the embedded script, and the system information is obtained through the underlying library to set the initial state of the lighting effect. The system retrieves frame duration parameters, integer adjustable parameters, and color palette parameters from the cloud, or directly calls the adjusted frame duration parameters, integer adjustable parameters, and color palette parameters from the embedded script. It then triggers a frame loop periodically according to the frame duration parameters, retrieves frame control commands, iterates through the LED indexes, and calculates the RGB color value of each LED based on the integer adjustable parameters and color palette parameters, combined with the color and waveform generation capabilities of the underlying library. Finally, it caches the RGB color values ​​in the frame buffer and outputs them in batches to the lighting hardware.

[0048] As the core scheduling unit of the entire lighting effect control system, the lighting effect engine reads embedded scripts and coordinates with underlying library capabilities to complete the entire execution chain of lighting effects from logical calculation to visual presentation, following the process of initialization-frame loop-hardware output. The specific steps are as follows: The lighting engine first loads a pre-written embedded script, which contains lighting control logic and can respond to preset events such as lighting initialization, frame processing, and pixel rendering. It can be parsed and executed by the engine without compilation, providing a basis for flexible adjustment of lighting effects.

[0049] When a lighting effect start command is detected, the lighting effect engine triggers a lighting effect initialization event and performs the following operations: Get the initial state parameters of the lighting effect; there are two parameter acquisition paths to choose from: one is to download the latest configured initial state parameters of the lighting effect from the cloud, and the other is to directly call the local initial state parameters that have been adjusted in the embedded script.

[0050] Obtain system information; through the system information interface provided by the underlying library, obtain the core parameters of the lighting hardware, including the total number of LEDs, the current frame index, timestamp, etc., to provide hardware environment data for the operation of the lighting effect.

[0051] Complete the initial state setting; combine the acquired initial parameters and system information to initialize the variables and running logic in the script, determine the basic state when the lighting effect is started, and prepare for subsequent frame loop calculations.

[0052] After the lighting effects initialization is complete, the lighting effects engine performs frame loop calculations for the lighting effects according to the following steps: The system retrieves runtime parameters, supporting both cloud and local retrieval methods. The retrieved parameters include three core categories: frame duration parameters, adjustable integer parameters, and color palette parameters. The adjustable integer parameters include the parameter name, minimum value, maximum value, and default value; the color palette parameters include the palette name and a default color palette composed of an RGB array.

[0053] The system triggers a frame loop at regular intervals. Based on the acquired frame duration parameter, the time interval for the frame loop is set to achieve a stable lighting effect refresh rate. For example, if the frame duration is set to 50ms, the lighting effect will update at a frequency of 20 frames per second.

[0054] The lighting engine iterates through all the LEDs to calculate their RGB values ​​after receiving frame control commands. Combining adjustable integer parameters and color palette parameters, it calls the underlying library's color and waveform generation capabilities and calculates the RGB color value of each LED individually through pixel rendering logic in the embedded script.

[0055] Cache and batch output to the lighting hardware.

[0056] The lighting effect engine caches the calculated RGB color values ​​of all LEDs in a unified frame buffer to avoid display flickering or delay caused by outputting the data for each LED individually. Once the color data of all LEDs within a frame has been cached, the lighting effect engine outputs the data from the frame buffer in batches to the LED driver module, driving the lighting hardware to display the corresponding lighting effect.

[0057] Through the above process, the lighting effect engine enables the collaborative operation of embedded scripts and underlying libraries. No modification to the underlying firmware is required throughout the process; lighting effects can be adjusted simply by updating scripts or parameters, greatly improving the efficiency and flexibility of lighting effect iteration.

[0058] In one embodiment, the lighting effect engine reads and calls the embedded script, and in conjunction with the underlying library, performs the calculation and output of the lighting effect, including: Obtain the metadata file, which includes the basic parameters of the lighting effect defined in a standardized format. The basic parameters include: unique identifier of the lighting effect, duration per frame, adjustable integer parameters, and color palette parameters. The adjustable integer parameters include: parameter name, minimum value, maximum value, and default value. The color palette parameters include: color palette name and default color palette composed of RGB arrays. Read the metadata file, parse the unique identifier of the lighting effect, the duration of each frame, and the value range of each parameter, obtain system information through the underlying library, and set the initial state of the lighting effect; The system triggers a frame loop at regular intervals based on the duration of each frame, obtains frame control instructions, iterates through the LED bead indexes, and calculates the RGB color value of each LED bead by combining the color and waveform generation capabilities of the underlying library. The RGB color values ​​are then cached in the frame buffer and output in batches to the lighting hardware.

[0059] Optionally, the metadata file can be written in Text-Based Markup Languages ​​(TBML) or Binary Serialization Languages ​​(BSL). The metadata file can be efficiently read by the embedded system, and at the same time, it is easy for users or developers to intuitively understand and modify parameters without relying on complex compilation tools, thus lowering the threshold for parameter configuration.

[0060] The metadata file contains four core fields, each with a clearly defined function and collaborative structure, comprehensively covering the basic parameters required for the lighting effects to operate.

[0061] Basic parameters include: unique identifier for lighting effects, duration per frame, adjustable integer parameters, and color palette parameters; Adjustable integer parameters include: parameter name, minimum value, maximum value, and default value; The color palette parameters include: the palette name and the default palette consisting of an RGB array.

[0062] Optional, applicationId (unique identifier for lighting effects): used to uniquely distinguish different lighting effect types, such as "ad.flame" representing flame lighting effect and "ad.flow.light" representing flow lighting effect, to avoid conflicts when calling different lighting effects and to ensure that the lighting effect engine can accurately identify and load the target lighting effect.

[0063] frameDuration (frame duration): Measured in milliseconds (ms), this defines the refresh rate of the lighting effect and directly affects the smoothness of the display. For example, setting it to 50ms / frame corresponds to a refresh rate of 20 frames per second, which meets the visual requirements of typical dynamic lighting effects. For a smoother display, it can be adjusted to 33ms / frame (approximately 30 frames per second) or 16ms / frame (approximately 60 frames per second).

[0064] sliderInt8 (integer adjustable parameter): Used to define dynamically adjustable integer parameters in the lighting effect, containing four sub-fields: paramKey: Parameter name, such as "speed" (flow speed) or "brightness" (brightness), serving as a unique identifier for parameter calls; minValue: Minimum value, limits the lower limit of parameter adjustment, and avoids abnormal lighting effects due to parameters being too small; maxValue: Maximum value, limits the upper limit of parameter adjustment, and prevents the parameter from exceeding the hardware's capacity due to excessive size; defaultValue: The default value is automatically loaded when the lighting effect is started to ensure that the initial state of the lighting effect is stable.

[0065] colorPalette (color palette parameter): Used to define the color set for lighting effects, supporting effects such as multi-color cycling and gradients, and contains two core subfields: paramKey: Palette name, such as "cpt", used to call palette data in the script; defaultCpt: The default color palette consists of a set of RGB color arrays. Each RGB array contains three integers from 0 to 255, which correspond to the brightness values ​​of the red, green, and blue channels, respectively. For example, [[255,90,20],[255,180,60]] represents two gradient oranges.

[0066] In one embodiment, the following is an example of a metadata file for the flame lighting effect, which fully presents the specific configuration of the aforementioned core fields: json { "applicationId": "ad.flame", "frameDuration": 50, "sliderInt8": [ { "paramKey": "speed", "minValue": 1, "maxValue": 20, "defaultValue": 5 } ], "colorPalette": [ { "paramKey": "cpt", "defaultCpt": [ [255, 90, 20], [255, 180, 60], [255, 240, 120] ] } ] } In this example, the lighting effect is uniquely identified as "ad.flame", with a duration of 50ms per frame (20 frames / second). The adjustable integer parameter "speed" has an adjustment range of 1-20, with a default value of 5. The color palette "cpt" contains three shades of orange to support the color transition requirements of the flame lighting effect.

[0067] Through the defined metadata file, the embedded script can directly call the corresponding parameter value by parameter name. The lighting effect engine can automatically parse the parameter range, default value and other rules, and the parameter can be adjusted without modifying the core code, which effectively solves the problem of strong coupling between parameters and control logic in traditional technology.

[0068] Optionally, the lighting effect engine first reads the metadata file and parses the core parameters, including the unique identifier of the lighting effect (applicationId), the duration per frame (frameDuration), the value range of the integer adjustable parameters (minValue / maxValue), the color palette (defaultCpt), and the default values ​​of each parameter (defaultValue), to ensure that the engine clearly understands the operating rules and boundary constraints of the lighting effect.

[0069] The lighting effects engine passes the basic capabilities of the underlying library (such as system information interfaces and parameter acquisition interfaces) to the embedded script through the context object ctx. The embedded script obtains the total number of LEDs (ctx.pixelCount) and the default parameters defined in the metadata (such as obtaining the default speed through ctx.getNumber("speed") and obtaining the default color palette through ctx.getCpt("cpt")) through the ctx interface, and completes the initialization of internal variables to prepare for subsequent frame loops.

[0070] Example scenario: If it is a "flowing light effect", after the light effect engine parses the metadata, it can get frameDuration=50ms, speed parameter default value 5, color palette contains 8 RGB colors. The embedded script reads the total number of LEDs=100, speed=5, cpt=default 8 color palette through onInit (ctx) and completes the initialization configuration.

[0071] During the frame loop phase, the lighting effect engine strictly triggers the frame loop according to the frame duration defined in the metadata file, ensuring a stable lighting effect refresh rate (e.g., 50ms / frame corresponds to 20 frames / second, 16ms / frame corresponds to 60 frames / second), providing a foundation for smooth lighting effects. Then, the lighting effect engine obtains frame control instructions returned by the embedded script, such as delay instructions ("delay 10ms") or frame skipping instructions. If a return value of 0 indicates no additional delay, the process proceeds directly to the next step, ensuring that the frame execution rhythm meets the lighting effect design requirements. The lighting effect engine iterates through the indices of all LEDs (index from 0 to pixelCount-1), rendering each pixel individually. The embedded script, combined with underlying library functions for color generation and waveform calculation (e.g., Color.RGB, WaveForm), calculates the RGB color value of the current LED based on the lighting effect control logic (e.g., the color index progression formula for flowing lighting effects) and returns it to the lighting effect engine.

[0072] Finally, the lighting engine caches the RGB color values ​​of all LEDs in a unified manner into the frame buffer to avoid flickering or delay caused by outputting each LED individually. Then, it outputs the cached color data in batches to the LED driver module, which controls the hardware lighting fixtures to present the corresponding lighting effects.

[0073] Example scenario: In the frame loop of the "flowing light effect", the engine triggers a loop every 50ms, and onFrame (ctx) returns 0 (no additional delay); when iterating from index=0 to 99, the embedded script calculates the color palette index using the formula "idx = floor((ctx.frameIndex*speed / 10+index)%8)+1" to obtain the corresponding RGB color value; after caching the color data of 100 LED beads, the engine outputs the data in batches to the LED driver to present a continuous flowing visual effect.

[0074] In one embodiment, the lighting effect engine reads the metadata file, calls the embedded script, and combines it with the underlying library to perform lighting effect calculations and output, which may include: Read the metadata file, parse the unique identifier of the lighting effect, the duration of each frame and the value range of each parameter, call the initialization function, obtain system information through the underlying library and set the initial state of the lighting effect; The frame loop is triggered periodically according to the duration of each frame. The processing function of each frame is called to obtain the frame control instructions. The LED index is traversed and the pixel rendering function is called. Combined with the color and waveform generation capabilities of the underlying library, the RGB color value of each LED is calculated. The RGB color values ​​are cached in the frame buffer and then output to the lighting hardware in batches.

[0075] The difference in processing the lighting effect calculation and output flow between cases where the embedded script contains standardized functions and those where standardized functions are not included lies in the following: The lighting effect engine calls the initialization function (onInit(ctx)) in the embedded script, passing the basic capabilities of the underlying library (such as system information interface and parameter acquisition interface) to the embedded script through the context object ctx. The embedded script obtains the total number of LEDs (ctx.pixelCount) and the default parameters defined in the metadata (such as obtaining the default speed through ctx.getNumber("speed") and obtaining the default color palette through ctx.getCpt("cpt")) through the ctx interface, and completes the initialization of internal variables to prepare for subsequent frame loops.

[0076] During the frame loop phase, the lighting effect engine strictly triggers the frame loop according to the frame duration defined in the metadata file, ensuring a stable lighting effect refresh rate (e.g., 50ms / frame corresponds to 20 frames / second, 16ms / frame corresponds to 60 frames / second), providing a foundation for smooth lighting effects. Then, the lighting effect engine calls the frame processing function (onFrame(ctx)) of the embedded script to obtain frame control instructions returned by the embedded script, such as delay instructions ("delay 10ms") or frame skipping instructions. If a return value of 0 indicates no additional delay, the process proceeds directly to the next step, ensuring that the frame execution rhythm meets the lighting effect design requirements. The lighting effect engine iterates through the indices of all LEDs (index from 0 to pixelCount-1), calling the pixel rendering function (onRender(ctx, index)) of the embedded script for each LED. The embedded script, combined with the underlying library's color generation and waveform calculation utility functions (such as Color.RGB, WaveForm), calculates the RGB color value of the current LED based on the lighting effect control logic (such as the color index progression formula for flowing lighting effects) and returns it to the lighting effect engine.

[0077] In one embodiment, the present invention can also support dynamic adjustment of lighting effects in order to solve the technical problem that personalized lighting effects cannot be achieved in the prior art.

[0078] Standardized functions may also include: parameter change callback functions; The parameter change callback function `onParamChanged(ctx)` is triggered when the user adjusts the lighting effect parameters via a knob, the app, or other means. The function retrieves the updated parameter values ​​(such as the adjusted speed and the new color palette) through the `ctx` interface and synchronously updates the control logic variables within the script. This ensures that subsequent frames can adjust the lighting effect performance in real time according to the new parameters, achieving dynamic parameter response.

[0079] Code example: function onParamChanged(ctx) -- Called by the engine when speed or color palette changes. speed = ctx.getNumber("speed") cpt = ctx.getCpt("cpt") end Preset events also include: parameter changes; Parameter change event: The onParamChanged(ctx) function is triggered when the user adjusts the parameters, updating the script's runtime parameters.

[0080] The methods for controlling lighting effects also include: When a user's parameter adjustment operation is detected, it is verified whether the adjusted parameter is within the value range of the corresponding parameter as defined in the metadata file; If the adjusted parameters are within the range of values ​​specified in the metadata file, the parameter change callback function is called to update the parameter values ​​that the embedded script depends on during runtime, so that subsequent frames execute the lighting effect control logic according to the updated parameter values.

[0081] Optionally, the lighting effect engine monitors user parameter adjustment operations in real time. Adjustment methods include knob adjustment, APP operation, etc., and the adjustment objects are adjustable parameters defined in the metadata file (such as speed, color palette, etc.). After obtaining the adjusted parameter values ​​from the user, the lighting effect engine performs a validity check against the parameter value range (minValue / maxValue) defined in the metadata file. If the parameter value is within the range, it is considered valid; otherwise, the adjustment is rejected to avoid lighting effect errors or excessive hardware load due to abnormal parameters.

[0082] For legitimate parameter adjustments, the lighting engine calls the parameter change callback function (onParamChanged (ctx)) of the embedded script, retrieves the updated parameter values ​​(such as the updated speed and the new color palette) through the ctx interface, and synchronously updates the internal lighting control logic variables to ensure that subsequent frame loops can perform calculations according to the new parameters.

[0083] After the parameters are updated, starting from the next frame, the lighting engine schedules the embedded script to execute rendering according to the updated parameter values. The entire response latency is less than 100ms, enabling rapid real-time dynamic adjustment of the lighting effects.

[0084] Example scenario: The user adjusts the speed parameter of "flowing light effect" from 5 to 10 using a knob. The light effect engine verifies that 10 is within the range of [1,20] and calls onParamChanged(ctx). The embedded script updates speed=10. From the next frame, the color advancement item changes from "frameIndex*5 / 10" to "frameIndex*10 / 10", the color index advancement speed doubles, and the visual speed of the flowing light effect doubles synchronously.

[0085] In this embodiment, the lighting effect engine is the executor of metadata rules. By parsing metadata, it clarifies the running boundaries and default configurations of lighting effects, ensuring that all scheduling behaviors comply with preset rules and avoiding parameter out-of-bounds or logical conflicts.

[0086] The lighting effect engine is the "scheduling trigger" of the embedded script. It triggers various standardized functions of the script according to the life cycle. At the same time, it provides low-level capability support for the embedded script through the ctx interface, so that the embedded script can implement complex lighting effect control logic without having to pay attention to hardware details.

[0087] The lighting engine acts as a "transmitter" of the underlying library's basic capabilities. It encapsulates the underlying library's system information, parameter acquisition, color generation, and other capabilities in the ctx context object and passes them to the script. At the same time, it uses the underlying library's time interface (ctx.Time) to control the frame loop rhythm and ensure the accuracy of scheduling.

[0088] In this embodiment of the invention, the lighting effect engine achieves collaboration between metadata files, embedded scripts, and the underlying library through unified scheduling. The lighting effect control logic is completely encapsulated in the metadata files and embedded scripts, and has no direct association with the underlying firmware. When adding or modifying lighting effects, only the metadata files or scripts need to be updated, without modifying the firmware code.

[0089] The batch output design of the frame buffer avoids the delay of pixel-by-pixel output, and the stable frame loop triggering mechanism ensures that the lighting effect frame rate is maintained at the preset frame rate, meeting the visual needs of various dynamic lighting effects.

[0090] Fast dynamic response: The response latency after parameter adjustment is less than 100ms, and users can see the changes in lighting effects immediately after operation, improving the interactive experience.

[0091] Through the lighting effect engine scheduling in this step, the entire process of lighting effect execution, from rule definition and logic coding to hardware output, is automated. This not only ensures the flexibility and customizability of lighting effects, but also solves the problems of difficult firmware updates and cumbersome parameter adjustments in traditional technologies, providing core support for lighting effect innovation in smart lighting devices.

[0092] This invention provides a method for controlling lighting effects. It involves acquiring an embedded script, which executes lighting effect control logic and responds to preset events corresponding to the script; calling a low-level library, which provides basic support for the embedded script and lighting effect scheduling, thus decoupling the lighting effect control logic from the underlying firmware; and using a lighting effect engine to read and call the embedded script, combined with the low-level library, to perform lighting effect calculations and output. In this invention, the lighting effect control logic is implemented through a script, eliminating the need to modify the underlying firmware. Adding / modifying lighting effects only requires updating files, offering greater flexibility and scalability, and improving update efficiency by over 80%. The embedded script allows users to customize the lighting effect control logic (e.g., generating rhythmic lighting effects by combining audio), meeting individual needs and enabling personalized customization. Adding parameters only requires defining them in the embedded script, and the low-level library can expand interfaces as needed (e.g., adding an infrared sensing interface) without refactoring the core architecture.

[0093] In this embodiment of the invention, a parameter change callback function is also set. After the parameter adjustment triggers the parameter change callback function, the new parameters can be applied in the next frame with a response latency of less than 100ms. The frame buffer batch output design ensures the smoothness of lighting effects at high frame rates.

[0094] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0095] The following are device embodiments of the present invention. For details not described in detail, please refer to the corresponding method embodiments described above.

[0096] Figure 2 A schematic diagram of a lighting effect control device according to an embodiment of the present invention is shown. For ease of explanation, only the parts related to the embodiment of the present invention are shown, and are described in detail below: like Figure 2 As shown, the lighting effect control device includes: script module 21, underlying library module 22 and lighting effect engine module 23.

[0097] Script module 21 is used to obtain embedded scripts, which are used to execute lighting effect control logic and respond to preset events corresponding to the embedded scripts. The underlying library module 22 is used to call the underlying library, which provides basic support for embedded scripts and lighting effect scheduling, and decouples the lighting effect control logic from the underlying firmware. The lighting effect engine module 23 is used to read and call embedded scripts through the lighting effect engine, and in conjunction with the underlying library, to perform lighting effect calculations and output.

[0098] In one possible implementation, when script module 21 acquires the embedded script, it is used for: Write the lighting effect control logic to obtain the embedded script; The embedded script supports at least one of the following languages: C, C++, Lua, JavaScript, Python, Rust, MicroPython, CircuitPython, mruby, JavaScript, Ada, assembly language, Gravity, LiteEmbed, Java, Go, and Forth. Preset events include lighting effect initialization, frame processing, and pixel rendering.

[0099] In one possible implementation, the basic capabilities include at least one of the following: system information provision capability, parameter acquisition capability, time and audio data acquisition capability, and color and waveform generation capability. The system information includes the total number of LEDs, the current frame index, and the timestamp.

[0100] In one possible implementation, the lighting effect engine module 23 reads and calls the embedded script through the lighting effect engine, and in conjunction with the underlying library, performs lighting effect calculations and outputs for the following purposes: Read embedded scripts; When the lighting effect initialization event is triggered, the initial state parameters of the lighting effect are obtained from the cloud, or the adjusted initial state parameters of the lighting effect are directly called from the embedded script, and the system information is obtained through the underlying library to set the initial state of the lighting effect. The system retrieves frame duration parameters, integer adjustable parameters, and color palette parameters from the cloud, or directly calls the adjusted frame duration parameters, integer adjustable parameters, and color palette parameters from the embedded script. It then triggers a frame loop periodically according to the frame duration parameters, retrieves frame control commands, iterates through the LED indexes, and calculates the RGB color value of each LED based on the integer adjustable parameters and color palette parameters, combined with the color and waveform generation capabilities of the underlying library. Finally, it caches the RGB color values ​​in the frame buffer and outputs them in batches to the lighting hardware.

[0101] In one possible implementation, the lighting effect engine module 23 reads and calls the embedded script through the lighting effect engine, and in conjunction with the underlying library, performs lighting effect calculations and outputs for the following purposes: Obtain the metadata file, which includes the basic parameters of the lighting effect defined in a standardized format. The basic parameters include: unique identifier of the lighting effect, duration per frame, adjustable integer parameters, and color palette parameters. The adjustable integer parameters include: parameter name, minimum value, maximum value, and default value. The color palette parameters include: color palette name and default color palette composed of RGB arrays. Read the metadata file, parse the unique identifier of the lighting effect, the duration of each frame, and the value range of each parameter, obtain system information through the underlying library, and set the initial state of the lighting effect; The system triggers a frame loop at regular intervals based on the duration of each frame, obtains frame control instructions, iterates through the LED bead indexes, and calculates the RGB color value of each LED bead by combining the color and waveform generation capabilities of the underlying library. The RGB color values ​​are then cached in the frame buffer and output in batches to the lighting hardware.

[0102] The above embodiments provide a lighting effect control device. An embedded script is obtained through a script module. This embedded script executes the lighting effect control logic and responds to preset events corresponding to the embedded script. A low-level library module calls a low-level library, which provides basic support for the embedded script and lighting effect scheduling, decoupling the lighting effect control logic from the underlying firmware. A lighting effect engine module reads and calls the embedded script through the lighting effect engine and, in conjunction with the low-level library, performs lighting effect calculations and outputs. In this embodiment, the lighting effect control logic is implemented through a script, eliminating the need to modify the underlying firmware. Lighting effects can be added / modified simply by updating files, offering greater flexibility and scalability, and improving update efficiency by over 80%. The embedded script allows users to customize the lighting effect control logic (e.g., generating rhythmic lighting effects by combining audio), meeting individual needs and enabling personalized customization. New parameters only need to be defined in the embedded script, and the low-level library can expand interfaces as needed (e.g., adding an infrared sensing interface) without refactoring the core architecture.

[0103] In this embodiment of the invention, a parameter change callback function is also set. After the parameter adjustment triggers the parameter change callback function, the new parameters can be applied in the next frame with a response latency of less than 100ms. The frame buffer batch output design ensures the smoothness of lighting effects at high frame rates.

[0104] Figure 3 This is a schematic diagram of the device provided in an embodiment of the present invention. Figure 3 As shown, the device 3 in this embodiment includes a processor 30, a memory 31, and a computer program 32 stored in the memory 31 and executable on the processor 30. When the processor 30 executes the computer program 32, it implements the steps in the various lighting effect control method embodiments described above, for example... Figure 1 Steps 101 to 104 are shown. Alternatively, when processor 30 executes computer program 32, it implements the functions of each module / unit in the above-described device embodiments, for example... Figure 2 The functions of each module / unit are shown.

[0105] For example, computer program 32 can be divided into one or more modules / units, one or more of which are stored in memory 31 and executed by processor 30 to complete the present invention. One or more modules / units can be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of computer program 32 in device 3. For example, computer program 32 can be divided into... Figure 2 The modules / units shown are shown.

[0106] Device 3 may include, but is not limited to, processor 30 and memory 31. Those skilled in the art will understand that... Figure 3 This is merely an example of device 3 and does not constitute a limitation on device 3. It may include more or fewer components than shown, or combine certain components, or different components. For example, the device may also include input / output devices, network access devices, buses, etc.

[0107] The processor 30 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0108] The memory 31 can be an internal storage unit of the device 3, such as a hard disk or RAM of the device 3. The memory 31 can also be an external storage device of the device 3, such as a plug-in hard disk, Smart MediaCard (SMC), Secure Digital (SD) card, or Flash Card equipped on the device 3. Furthermore, the memory 31 can include both internal and external storage units of the device 3. The memory 31 is used to store computer programs and other programs and data required by the device. The memory 31 can also be used to temporarily store data that has been output or will be output.

[0109] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0110] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0111] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0112] In the embodiments provided by this invention, it should be understood that the disclosed apparatus / device and method can be implemented in other ways. For example, the apparatus / device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0113] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0114] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0115] If integrated modules / units are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the above-described lighting effect control method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.

[0116] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A method for controlling lighting effects, characterized in that, include: Obtain an embedded script, which is used to execute lighting effect control logic and respond to preset events corresponding to the embedded script; The underlying library is called, which provides basic support for the embedded script and lighting effect scheduling, thereby decoupling the lighting effect control logic from the underlying firmware. The lighting effect engine reads and calls the embedded script, and in conjunction with the underlying library, performs the calculation and output of lighting effects.

2. The lighting effect control method according to claim 1, characterized in that, The acquisition of the embedded script includes: Write the lighting effect control logic to obtain the embedded script; The embedded script supports at least one of the following languages: C, C++, Lua, JavaScript, Python, Rust, MicroPython, CircuitPython, mruby, JavaScript, Ada, assembly language, Gravity, LiteEmbed, Java, Go, and Forth. The preset events include lighting effect initialization, frame processing, and pixel rendering.

3. The lighting effect control method according to claim 2, characterized in that, The basic capabilities include at least one of the following: system information provision capability, parameter acquisition capability, time and audio data acquisition capability, and color and waveform generation capability. The system information includes the total number of LED beads, the current frame index, and the timestamp.

4. The lighting effect control method according to claim 3, characterized in that, The process of reading and calling the embedded script through the lighting effect engine, and combining it with the underlying library to perform lighting effect calculations and output, includes: Read the embedded script; When the lighting effect initialization event is triggered, the initial state parameters of the lighting effect are obtained from the cloud, or the adjusted initial state parameters of the lighting effect in the embedded script are directly called, and system information is obtained through the underlying library to set the initial state of the lighting effect. The system obtains the frame duration parameters, integer adjustable parameters, and color palette parameters from the cloud, or directly calls the adjusted frame duration parameters, integer adjustable parameters, and color palette parameters from the embedded script. It then triggers a frame loop periodically according to the frame duration parameters, obtains frame control instructions, traverses the LED bead index, calculates the RGB color value of each LED bead based on the integer adjustable parameters and color palette parameters, and combines the color and waveform generation capabilities of the underlying library. Finally, it caches the RGB color values ​​in the frame buffer and outputs them in batches to the lighting hardware.

5. The lighting effect control method according to claim 3, characterized in that, The process of reading and calling the embedded script through the lighting effect engine, and combining it with the underlying library to perform lighting effect calculations and output, includes: Obtain the metadata file, which includes basic parameters of the lighting effect defined in a standardized format; the basic parameters include: a unique identifier for the lighting effect, the duration per frame, adjustable integer parameters, and color palette parameters; the adjustable integer parameters include: parameter name, minimum value, maximum value, and default value; the color palette parameters include: color palette name and a default color palette composed of RGB arrays; Read the metadata file, parse the unique identifier of the lighting effect, the duration of each frame and the value range of each parameter, obtain system information through the underlying library and set the initial state of the lighting effect; The frame loop is triggered periodically according to the duration of each frame. The frame control command is obtained, the LED bead index is traversed, and the RGB color value of each LED bead is calculated by combining the color and waveform generation capabilities of the underlying library. The RGB color values ​​are then cached in the frame buffer and output to the lighting hardware in batches.

6. The lighting effect control method according to claim 5, characterized in that, The metadata file is written in either Text-Based Markup Languages ​​or Binary Serialization Languages.

7. A lighting effect control device, characterized in that, include: The script module is used to acquire an embedded script, which is used to execute the lighting effect control logic and respond to preset events corresponding to the embedded script. The underlying library module is used to call the underlying library, which provides basic capabilities for the embedded script and lighting effect scheduling, and decouples the lighting effect control logic from the underlying firmware. The lighting effect engine module is used to read and call the embedded script through the lighting effect engine, and in conjunction with the underlying library, to perform lighting effect calculations and output.

8. A device, characterized in that, It includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1 to 6.

10. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the method as described in any one of claims 1 to 6.