Light control method and device, vehicle and storage medium
By processing control events step by step and controlling the GPIO port of the light controller to generate analog PWM signals, the problem of unstable car light brightness is solved, achieving stable brightness control and cost reduction.
Patent Information
- Application Number
- CN202411066454.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-05
- Publication Date
- 2024-10-11
AI Technical Summary
Car light brightness control is prone to instability when external signal interference and small changes in duty cycle occur, causing lights to flicker and affecting the driving experience.
By processing the pending control events step by step, sub-events are obtained, and based on the processing results of the sub-events, the GPIO port of the lighting controller is controlled to flip and delay, and an analog PWM signal is generated to stabilize the light brightness and reduce the use of the lighting controller. Reduce costs.
It achieves stable control of light brightness, avoids brightness instability caused by long processing time or long data packet duration, improves event processing efficiency, and reduces lighting control costs.
Smart Images

Figure CN118753157A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of automobile communication technology, in particular to the field of lighting control technology, and specifically to a lighting control method, device, vehicle and storage medium. Background Art
[0002] With the advancement of automobile intelligence, the number of vehicle lights is increasing. Inside the vehicle, stable lighting effects have a great impact on users' driving of the vehicle.
[0003] When the car is driving, the brightness control of the lights is easily interfered by external signals. For example, the current in the light control circuit decreases due to low temperature. For example, when the light brightness is low, a slight change in the duty cycle will cause unstable light brightness control and light flickering. Summary of the invention
[0004] The present application provides a lighting control method, device, vehicle and storage medium to at least solve the technical problem of unstable lighting brightness in the related art. The technical solution of the present application is as follows:
[0005] According to the first aspect of the present application, a lighting control method is provided, which is applied to a lighting controller on a vehicle; comprising: receiving lighting control information of a target bulb from a vehicle control unit; the lighting control information comprises a plurality of data packets, and the data packets comprise at least one control instruction corresponding to a control event of the target bulb; determining a pending control event of the target bulb according to the lighting control information; the pending control event comprises a brightness control event and a power control event; the brightness control event is used to indicate the brightness of the target bulb; the power control event is used to indicate the power-on or power-off of the target bulb; processing the pending control event in steps according to the plurality of data packets to obtain at least one sub-event; processing at least one sub-event in at least one event processing cycle, and each event processing cycle corresponds to processing one or more of the at least one sub-event; and controlling the GPIO port in the lighting controller to flip and delay according to the sub-event processed in each event processing cycle to obtain an analog PWM signal to control the target bulb.
[0006] According to the above technical means, the present application can first process the control event to be processed step by step to obtain at least one sub-event, and then control the GPIO port in the light controller to flip and delay according to the processing result of at least one sub-event, to obtain an analog PWM signal and a duty cycle, and then control the brightness of the target bulb. Therefore, the brightness of the target bulb can be controlled by controlling the duty cycle of the PWM signal, and the duty cycle of the PWM signal can be controlled to ensure the stability of the brightness of the target bulb when an abnormality occurs. At the same time, the GPIO port is flipped and delayed to obtain an analog PWM signal, which reduces the use of the light controller and reduces the cost of light control.
[0007] In a possible implementation, the control event to be processed is processed step by step according to multiple data packets to obtain at least one sub-event, including: determining the processing time of each data packet in the multiple data packets according to a preset first correspondence; the first correspondence is used to represent the correspondence between the data packet and the processing time; when the processing time of each of the multiple data packets is less than the preset time, the control event to be processed is processed step by step according to the number of the multiple data packets to obtain M sub-events; the M sub-events correspond one-to-one to the multiple data packets.
[0008] According to the above technical means, the present application can divide the pending control event into multiple sub-events when the processing time of the pending control event is too long, so as to avoid affecting the duty cycle of the PWM signal due to the long processing time of the pending control event, thereby affecting the brightness of the target bulb. In addition, the processing time of the data packet is known, and the number of data packets is used as a standard to make the division of steps more accurate.
[0009] In a possible implementation, the method further includes: when there is a target data packet among the multiple data packets, splitting the sub-event corresponding to the target data packet into multiple secondary sub-events; and the processing time of the target data packet is greater than or equal to a preset time.
[0010] According to the above-mentioned technical means, the present application can split the sub-event corresponding to the data packet into multiple secondary sub-events when the data packet processing time is too long, so as to avoid affecting the processing time of the control event to be processed due to the long data packet processing time, thereby affecting the duty cycle of the PWM signal and the brightness of the target bulb.
[0011] In a possible implementation, for any first cycle in at least one event processing cycle; processing at least one sub-event in at least one event processing cycle, including: determining the execution duration of each sub-event in at least one sub-event; determining N sub-events executed within the preset duration based on the preset duration and the execution duration of each sub-event; the preset duration is less than the duration of the first cycle; N is a positive integer; the sum of the execution durations of the N sub-events is less than or equal to the preset duration; executing N sub-events within the first cycle.
[0012] According to the above technical means, the event processing time in this application is preset, and the processing time of each sub-event is different. Executing multiple sub-events within one event processing cycle can improve event processing efficiency.
[0013] In one possible implementation, determining the execution duration of each sub-event in at least one sub-event includes: determining a data packet corresponding to each sub-event; determining a processing duration of each data packet as the execution duration of the corresponding sub-event based on a preset first correspondence relationship; the first correspondence relationship is used to represent the correspondence between the data packet and the processing duration.
[0014] According to the above technical means, the present application determines the execution duration of the sub-event according to the second corresponding relationship, thereby avoiding the problem of incorrect determination of the execution duration of the sub-event, which in turn affects the processing of the pending control event.
[0015] In a possible implementation, determining a pending control event of a target bulb based on lighting control information includes: parsing the lighting control information to obtain at least one flag bit; different flag bits are used to represent different control events; the value of the flag bit is used to indicate whether to execute the control event; and determining the pending control event of the target bulb based on at least one flag bit and at least one flag bit value.
[0016] According to the above technical means, the present application determines the control event to be processed according to the flag bit, thereby avoiding the problem of event judgment error in the process of determining the control event to be processed.
[0017] In a possible implementation, the method further includes: when at least one flag bit includes a target flag bit, using a preset delay to replace the execution time occupied by the control event corresponding to the target flag bit in the processing cycle of at least one event; wherein the value of the target flag is a first value, and the first value is used to indicate that the control event is not executed.
[0018] According to the above technical means, when there is no communication event, the present application uses a preset delay time to occupy the time used for processing the control event, thereby ensuring the stability of the PWM signal duty cycle and further ensuring the stability of the light brightness.
[0019] According to a second aspect provided by the present application, a lighting control device is provided, which is applied to a lighting controller on a vehicle; it includes a receiving module, which is used to receive lighting control information of a target bulb from a vehicle control unit; the lighting control information includes multiple data packets, and the data packets include at least one control instruction corresponding to a control event of the target bulb; a first processing module, which is used to determine a pending control event of the target bulb according to the lighting control information; the pending control events include brightness control events and power control events; the brightness control event is used to indicate the brightness of the target bulb; the power control event is used to indicate the power-on or power-off of the target bulb; according to the multiple data packets, the pending control event is processed step by step to obtain at least one sub-event; at least one sub-event is processed in at least one event processing cycle, and each event processing cycle corresponds to processing one or more of the at least one sub-event; according to the sub-event processed corresponding to each event processing cycle, the GPIO port in the lighting controller is controlled to be flipped and delayed to obtain an analog PWM signal to control the target bulb.
[0020] In a possible implementation, the first processing module is specifically used to determine the processing time of each data packet in a plurality of data packets according to a preset first corresponding relationship; the first corresponding relationship is used to represent the corresponding relationship between the data packet and the processing time; when the processing time of each of the data packets in the plurality of data packets is less than the preset time, the control event to be processed is processed step by step according to the number of the plurality of data packets to obtain M sub-events; the M sub-events correspond one-to-one to the plurality of data packets.
[0021] In a possible implementation, the device further includes: a splitting module; a splitting module, used to split the sub-event corresponding to the target data packet into multiple secondary sub-events when there is a target data packet among multiple data packets; the processing time of the target data packet is greater than or equal to a preset time.
[0022] In a possible implementation, for any first cycle in at least one event processing cycle; the first processing module is specifically used to determine the execution duration of each sub-event in at least one sub-event; based on the preset duration and the execution duration of each sub-event, determine the N sub-events executed within the preset duration; the preset duration is less than the duration of the first cycle; N is a positive integer; the sum of the execution durations of the N sub-events is less than or equal to the preset duration; and execute N sub-events within the first cycle.
[0023] In a possible implementation, the first processing module is specifically used to determine the data packet corresponding to each sub-event; based on a preset first corresponding relationship, determine the processing time of each data packet as the execution time of the corresponding sub-event; the first corresponding relationship is used to represent the correspondence between the data packet and the processing time.
[0024] In a possible implementation, the first processing module is specifically used to parse the lighting control information to obtain at least one flag bit; different flag bits are used to represent different control events; the value of the flag bit is used to indicate whether to execute the control event; and based on at least one flag bit and at least one flag bit value, determine the control event to be processed of the target bulb.
[0025] In a possible implementation, the device also includes: a second processing module; the second processing module is specifically used to, when at least one flag bit includes a target flag bit, use a preset delay to replace the execution time occupied by the control event corresponding to the target flag bit in the processing cycle of at least one event; wherein the value of the target flag is a first value, and the first value is used to indicate that the control event is not executed.
[0026] According to the third aspect provided by the present application, a vehicle is provided, comprising: a processor; a memory for storing processor executable instructions; wherein the processor is configured to execute instructions to implement the method of the above-mentioned first aspect and any possible implementation manner thereof.
[0027] According to the fourth aspect provided by the present application, a computer-readable storage medium is provided. When the instructions in the computer-readable storage medium are executed by the processor of the vehicle, the vehicle is enabled to execute the method in the above-mentioned first aspect and any possible implementation method thereof.
[0028] According to the fifth aspect provided by the present application, a computer program product is provided, the computer program product comprising computer instructions, and when the computer instructions are executed on a vehicle, the vehicle executes the method of the above-mentioned first aspect and any possible implementation manner thereof.
[0029] Therefore, the above technical features of the present application have the following beneficial effects:
[0030] (1) The control event to be processed can be processed step by step to obtain at least one sub-event, and then the GPIO port in the light controller can be controlled to flip and delay according to the processing result of at least one sub-event to obtain an analog PWM signal and a duty cycle, thereby controlling the brightness of the target light bulb. Thus, the brightness of the target light bulb can be controlled by controlling the duty cycle of the PWM signal. When an abnormality occurs, the duty cycle of the PWM signal can be controlled to ensure the stability of the brightness of the target light bulb. At the same time, the GPIO port is flipped and delayed to obtain an analog PWM signal, thereby reducing the use of the light controller and the cost of light control.
[0031] (2) When the processing time of a pending control event is too long, the pending control event can be divided into multiple steps to avoid affecting the duty cycle of the PWM signal due to the long processing time of the pending control event, thereby affecting the brightness of the target bulb. The processing time of the data packet is known, and the number of data packets is used as a standard to make the division of steps more accurate.
[0032] (3) When the data packet processing time is too long, the sub-event corresponding to the data packet can be split into multiple secondary sub-events to avoid affecting the processing time of the control event to be processed due to the long data packet processing time, thereby affecting the duty cycle of the PWM signal and the brightness of the target bulb.
[0033] (4) Multiple sub-events can be executed within one event processing cycle, improving event processing efficiency.
[0034] (5) The execution duration of the sub-event can be determined according to the second corresponding relationship, thereby avoiding the problem of incorrect determination of the execution duration of the sub-event, which in turn affects the processing of the pending control event.
[0035] (6) The control event to be processed can be determined according to the flag bit, thereby avoiding the problem of event judgment error in the process of determining the control event to be processed.
[0036] (7) When there is no communication event, the time used for processing the sub-event can be occupied by a delay of a preset duration, thereby ensuring the stability of the PWM signal duty cycle and thus ensuring the stability of the light brightness.
[0037] It should be noted that the technical effects brought about by any implementation method in the second to fifth aspects can refer to the technical effects brought about by the corresponding implementation method in the first aspect, and will not be repeated here.
[0038] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application, and do not constitute an improper limitation on the present application.
[0040] Figure 1 is a structural schematic diagram of a lighting control system according to an exemplary embodiment;
[0041] Figure 2 is a lighting control wiring diagram according to an exemplary embodiment;
[0042] Figure 3is a flow chart of a lighting control method according to an exemplary embodiment;
[0043] Figure 4 is a flow chart of another lighting control method according to an exemplary embodiment;
[0044] Figure 5 is a flow chart of another lighting control method according to an exemplary embodiment;
[0045] Figure 6 is a software architecture diagram of a lighting control method according to an exemplary embodiment;
[0046] Figure 7 is a block diagram of a lighting control device according to an exemplary embodiment;
[0047] Figure 8 is a block diagram of a vehicle according to an exemplary embodiment. DETAILED DESCRIPTION
[0048] In order to enable ordinary persons in the art to better understand the technical solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0049] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.
[0050] First, the terms involved in the embodiments of the present application are introduced.
[0051] 1. Microcontroller Unit (MCU) appropriately reduces the frequency and specifications of the central processing unit, and integrates peripheral interfaces such as memory, timer, universal serial bus (USB), A / D conversion, universal asynchronous receiver / transmitter (UART), programmable logic controller (PLC), direct memory access (DMA), and even liquid crystal display (LCD) drive circuit on a single chip to form a chip-level computer, which can perform different combination controls for different application scenarios.
[0052] 2. Pulse Width Modulation (PWM) is an analog control method that modulates the bias of the transistor base or MOS tube gate according to the change of the corresponding load to achieve the change of the transistor or MOS tube conduction time, thereby achieving the change of the output of the switching regulated power supply.
[0053] 3. General Purpose Input Output (GPIO), whose pins can be freely used by users through program control.
[0054] 4. Controller Area Network (CAN) is a serial communication protocol bus used for real-time applications.
[0055] 5. Local Interconnect Network (LIN) is a low-cost serial communication network defined for automotive distributed electronic systems. It is a supplement to other automotive multi-channel networks such as controller area networks.
[0056] 6. Driver is an electronic component used for control. It can adjust parameters such as voltage, current and frequency to achieve the purpose of controlling the brightness of the light bulb.
[0057] Other terms: In the following, the terms "first", "second", etc. are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second", etc. may explicitly or implicitly include one or more of the features.
[0058] With the advancement of automobile intelligence, the number of vehicle lights is increasing. A stable and rich lighting effect has a great impact on the user's driving of the vehicle. As the number of lights inside the vehicle increases, the demand for the controller's PWM port increases. The PWM port of a controller is limited. The increase in the demand for PWM ports means that the number of controllers must also increase, which will increase the cost of lighting control.
[0059] When the car is driving, the PWM signal is easily disturbed by the interrupt signal, causing the duty cycle to change and thus affecting the brightness control of the light. For example, when the light brightness is low, a slight change in the duty cycle will lead to unstable light brightness control and light flickering. The change of current in the light control circuit will also affect the light brightness. For example, when the temperature drops, the current in the light control circuit decreases, and the light brightness decreases.
[0060] Based on the above problems, the present application provides a lighting control method, device, vehicle and storage medium, which can first process the control event to be processed step by step to obtain at least one sub-event, and then control the GPIO port in the lighting controller to flip and delay according to the processing result of at least one sub-event, to obtain an analog PWM signal and a duty cycle, and then control the brightness of the target bulb. Therefore, the brightness of the target bulb can be controlled by controlling the duty cycle of the PWM signal, and the brightness of the target bulb can be controlled to be stable when an abnormal situation occurs, so as to at least solve the technical problem of unstable light brightness in the related art.
[0061] The following is an introduction with reference to the accompanying drawings.
[0062] Figure 1 FIG. 1 is a schematic diagram showing a structure of a lighting control system according to an exemplary embodiment. Figure 1 As shown, the lighting control system includes: a vehicle control unit 100 and a lighting controller 200 .
[0063] The vehicle control unit 100 may be an electronic control unit for controlling the vehicle body electrical system in automobile engineering, or a connector for various control devices in the vehicle to communicate, such as a gateway, a vehicle body controller, etc.
[0064] The vehicle control unit 100 is used to send light control information to the light controller 200 to control the brightness change of the target bulb. The specific process can be referred to the light control method described below and will not be repeated here.
[0065] The light controller 200 can be any chip with a GPIO port that can realize the light control function in the vehicle, such as a single-chip microcomputer or a field programmable gate array.
[0066] The light controller receives the light control information sent by the vehicle control unit 100, and simulates the GPIO port as a PWM port according to the control instruction to control the brightness of the light bulb. The specific process can be referred to the following light control method, which will not be repeated here.
[0067] The execution subject of the lighting control method provided in the embodiment of the present application is a lighting control device, which may be the above-mentioned lighting controller. Optionally, the lighting control device may also be a vehicle including the above-mentioned lighting controller; or, the lighting control device may also be a functional module in the above-mentioned lighting controller for executing the lighting control method, etc. The embodiment of the present application does not limit this.
[0068] For ease of understanding, the lighting control method provided in the present application is specifically introduced below with reference to the accompanying drawings.
[0069] Figure 2 This is a wiring diagram of a lighting control according to an exemplary embodiment. The MCU in the figure is the lighting controller 200, which is connected to the vehicle control unit 100 through the CAN / LIN port, and supports the vehicle control unit 100 and the MCU to communicate based on the CAN bus protocol or the LIN communication protocol; the PWM port directly outputs the PWM signal, and the GPIO port needs to be delayed and flipped to simulate the PWM port to output the PWM signal; the Driver is the driver of the LED lamp, and the Driver is connected to the LED lamp, the PWM port and the GPIO port respectively, and is used to control the light according to the PWM signal output by the PWM port or the GPIO port. At the same time, in addition to adjusting the PWM duty cycle to control the brightness of the light, the current limiting resistor in the Driver can also be adjusted to adjust the current passing through the LED lamp to control the brightness of the light.
[0070] Figure 3 is a flow chart of a lighting control method according to an exemplary embodiment. Figure 3 As shown, the lighting control method comprises the following steps:
[0071] S301, receiving lighting control information of a target light bulb from a vehicle control unit.
[0072] The lighting control information includes a plurality of data packets, each of which includes at least one control instruction corresponding to a control event of a target light bulb.
[0073] The lighting control information includes information such as the serial number of the target bulb, the brightness of the target bulb, the working mode of the target bulb, etc. In the present application, the working mode of the target bulb includes a day mode and a night mode.
[0074] As a possible implementation method, the vehicle control unit and the lighting control device communicate based on the CAN bus protocol or the LIN communication protocol. The vehicle control unit collects the driver's intention or the driver's operation of the vehicle to generate lighting control information for the target bulb, and sends it to the lighting control device. The lighting control device receives the lighting control information and then controls the lighting of the target bulb.
[0075] S302: Determine a control event to be processed of a target light bulb according to the lighting control information.
[0076] The control events to be processed include brightness control events and power control events; the brightness control event is used to indicate the brightness of the target bulb to be controlled; the power control event is used to indicate whether the target bulb is powered on or off.
[0077] As a possible implementation manner, the lighting control information includes control instructions for controlling the target light bulb. The lighting control device parses the lighting control information to obtain at least one control instruction, and determines a control event to be processed for the target light bulb based on the control instruction.
[0078] S303: Process the control event to be processed step by step according to the multiple data packets to obtain at least one sub-event.
[0079] As a possible implementation, when the control event to be processed is a brightness control event, the lighting control device processes the brightness control event in steps according to the number of data packets or the processing time to obtain at least one sub-event, and each sub-event corresponds to a data packet.
[0080] As another possible implementation, when the control event to be processed is a power control event, due to the characteristics of the power control event, the lighting control device does not need to process the power control event in steps, that is, the power control event is also a sub-event of the power control event.
[0081] S304: Process at least one sub-event in at least one event processing cycle, where each event processing cycle corresponds to processing one or more of the at least one sub-event.
[0082] As a possible implementation, when the control event to be processed is a brightness control event, due to the preset event processing time, for example, 50 microseconds, the processing time of each sub-event is fixed and less than the event processing time. When there is only one sub-event, the lighting control device processes the sub-event within one event processing cycle. When there is at least one sub-event, the lighting control device processes one sub-event within one event processing cycle, and completes the event processing after multiple event processing cycles.
[0083] Or the lighting control device processes multiple sub-events in one event processing cycle, and completes the event processing after multiple event processing cycles. The number of sub-events processed in one event processing cycle is determined by the event processing duration and the processing duration of each sub-event. The event processing duration in one event processing cycle should be greater than or equal to the sum of the sub-event processing durations to ensure that the sub-event processing does not affect the event processing cycle.
[0084] As another possible implementation, when the control event to be processed is a power control event, since the power control event has no sub-events, the processing of the power control event is completed in one event processing cycle.
[0085] S305, according to the sub-events processed in each event processing cycle, the GPIO port in the light controller is controlled to flip and delay, and an analog PWM signal is obtained to control the target light bulb.
[0086] As a possible implementation, when the control event to be processed is a brightness control event, after at least one sub-event is processed, the light controller can read the light control information and control the GPIO port to delay and flip. There can be multiple GPIO ports, and the minimum number of GPIO flips is 1. For example, when the event processing time is 50 microseconds and the delay and flip processing time is 950 microseconds, the GPIO port is controlled to flip after the event processing is completed, and the duty cycle of the obtained PWM is the smallest, which is 50 / 1000.
[0087] As a possible implementation method, when the control event to be processed is a power control event, after the event processing is completed, the control GPIO port is flipped only once, the PWM output changes from a high level to a low level, and the target light bulb is powered off.
[0088] The lighting control method of the embodiment of the present application can first process the control event to be processed step by step to obtain at least one sub-event, and then control the GPIO port in the lighting controller to flip and delay according to the processing result of at least one sub-event to obtain an analog PWM signal and a duty cycle, thereby controlling the brightness of the target bulb. Thus, the brightness of the target bulb can be controlled by controlling the duty cycle of the PWM signal, and the duty cycle of the PWM signal can be controlled to ensure the stability of the brightness of the target bulb when an abnormality occurs. At the same time, the GPIO port is flipped and delayed to obtain an analog PWM signal, which reduces the use of the lighting controller and reduces the lighting control cost.
[0089] In some embodiments, in order to avoid affecting the duty cycle of the PWM signal due to a long event processing time, the control event to be processed is divided into at least one sub-event to reduce the event processing time of at least one event processing cycle. The embodiment of the present application provides a method for processing the control event to be processed step by step according to multiple data packets to obtain at least one sub-event. Figure 4 is a flow chart of another lighting control method according to an exemplary embodiment. Figure 4 As shown, the control event to be processed is processed step by step to obtain at least one sub-event, including the following steps:
[0090] S401, determining the processing time of each data packet in a plurality of data packets according to a preset first corresponding relationship; the first corresponding relationship is used to represent the corresponding relationship between the data packets and the processing time.
[0091] In a possible implementation, the lighting control device may be configured with a database, the preset first correspondence may be stored in the database, and the lighting control device may query the database using the name of the data packet as an index to determine the processing time of each data packet.
[0092] Exemplarily, the first corresponding relationship may be specifically as shown in the following Table 1:
[0093] Table 1
[0094] Data Pack address Packet 1 Processing time 1 Packet 2 Processing time 2 Data Pack 3 Processing time 3
[0095] The processing time of each data packet is fixed, as shown in Table 1. The data packets include: data packet 1, data packet 2, and data packet 3. The processing time includes: processing time 1, processing time 2, and processing time 3. Data packet 1 corresponds to processing time 1, data packet 2 corresponds to processing time 2, and data packet 3 corresponds to processing time 3. If there are multiple data packets, there are also multiple processing times, and the corresponding relationship between the two is analogous.
[0096] S402, when the processing time of each of the multiple data packets is less than the preset time, the control event to be processed is processed step by step according to the number of the multiple data packets to obtain M sub-events; the M sub-events correspond to the multiple data packets one by one.
[0097] For example, the control event to be processed includes M data packets, and accordingly, the control event to be processed is divided into M sub-events. Sub-event 1 corresponds to data packet 1, sub-event 2 corresponds to data packet 2, and so on.
[0098] In some embodiments, when the processing time of a data packet is greater than or equal to a preset time, the embodiment of the present application provides a method for processing a control event to be processed in steps according to multiple data packets to obtain at least one sub-event, further comprising the following steps:
[0099] Step 1a: when there is a target data packet among multiple data packets, split the sub-event corresponding to the target data packet into multiple secondary sub-events; the processing time of the target data packet is greater than or equal to the preset time.
[0100] In a possible implementation, when the processing time of the target data packet is greater than or equal to the preset time, the lighting control device divides the data in the target data packet into high 8 bits and low 8 bits, and processes the high 8 bits corresponding to one secondary sub-event, and processes the low 8 bits corresponding to one secondary sub-event, that is, the sub-event corresponding to the target data packet is split into two secondary sub-events. The division of the number of data bits in the specific target data packet is not specifically limited here.
[0101] In some embodiments, the number of sub-events that can be executed in an event processing cycle is determined so that enough sub-events are processed in the event processing cycle to reduce the event processing cycle and thus improve the efficiency of event processing. The processing of at least one sub-event in at least one event processing cycle provided in the embodiment of the present application further includes the following steps:
[0102] Step 2a: determining the execution time of each sub-event in at least one sub-event.
[0103] In a possible implementation, the lighting control device can determine the data packet corresponding to each sub-event; according to a preset first corresponding relationship, determine the processing time of each data packet as the execution time of the corresponding sub-event; the first corresponding relationship is used to represent the correspondence between the data packet and the processing time.
[0104] Step 2b, determining N sub-events executed within the preset duration according to the preset duration and the execution duration of each sub-event; the preset duration is less than the duration of the first cycle; N is a positive integer; the sum of the execution durations of the N sub-events is less than or equal to the preset duration.
[0105] The number of executed sub-events is the maximum number of sub-events that can be executed under the condition of satisfying the preset time length.
[0106] Step 2c: execute N sub-events in the first cycle.
[0107] In some embodiments, in order to accurately determine the pending control events of the target bulb, Figure 5 is a flow chart of another lighting control method according to an exemplary embodiment. Figure 5 As shown, determining the pending control events of the target light bulb includes the following steps:
[0108] S501, parsing lighting control information to obtain at least one flag bit.
[0109] There is a one-to-one correspondence between flag bits and control events, different flag bits are used to represent different control events, and the value of the flag bit is used to indicate whether to execute the control event.
[0110] S502: Determine a control event to be processed of a target light bulb according to at least one flag bit and at least one flag bit value.
[0111] In one possible implementation, the lighting control device may be configured with a database, and the name and value of the flag may be stored in the database. The lighting control device may query the database using the name and value of the flag as an index to determine a pending control event for the target bulb.
[0112] Among them, the flag bits correspond one-to-one to the control events. For example, the first flag bit value of 1 corresponds to executing the brightness control event, the first flag bit value of 0 corresponds to not executing the brightness control event, the second flag bit value of 1 corresponds to executing the power control event, and the second flag bit value of 0 corresponds to executing the power control event.
[0113] For another example, a first flag bit value of 1 corresponds to an increase in the brightness of the target bulb in a brightness control event, a first flag bit value of 0 corresponds to an increase in the brightness of the target bulb in a brightness control event that is not executed, a second flag bit value of 1 corresponds to a decrease in the brightness of the target bulb in a brightness control event, a second flag bit value of 0 corresponds to a decrease in the brightness of the target bulb in a brightness control event that is not executed, a third flag bit value of 1 corresponds to an execution of a power control event, and a third flag bit value of 0 corresponds to not executing a power control event.
[0114] For another example, the first flag bit value of 1 corresponds to an increase in the brightness of the target bulb in the day mode of the brightness control event, the first flag bit value of 2 corresponds to a decrease in the brightness of the target bulb in the day mode of the brightness control event, the first flag bit value of 0 corresponds to not executing the brightness control event in the day mode, the second flag bit value of 1 corresponds to an increase in the brightness of the target bulb in the night mode of the brightness control event, the second flag bit value of 2 corresponds to a decrease in the brightness of the target bulb in the night mode of the brightness control event, the second flag bit value of 0 corresponds to not executing the brightness control event in the night mode, the third flag bit value of 1 corresponds to a power control event, and the third flag bit value of 0 corresponds to not executing the power control event. No specific limitation is made here.
[0115] In some embodiments, when there is no event to be processed between the vehicle control unit and the light controller, the light control method further includes:
[0116] Step 3a, when at least one flag bit includes a target flag bit, a preset delay is used to replace the execution time occupied by the control event corresponding to the target flag bit in the processing cycle of at least one event; wherein the value of the target flag is a first value, and the first value is used to indicate that the control event is not executed.
[0117] As a possible implementation, when the target flag bit is obtained by parsing the control information and the target flag bit is set to the first value, it is determined that there is no control event at present, that is, the brightness of the target light bulb is not adjusted. The light controller uses a preset delay in at least one event processing cycle to replace the event processing time in at least one event processing cycle. The value of the target flag bit value is an agreed value and is not specifically limited here.
[0118] As another possible implementation, when no flag bit is obtained by parsing the control information, the lighting controller uses a preset delay in at least one event processing cycle to replace the event processing time in at least one event processing cycle.
[0119] Based on the understanding of the above embodiments, Figure 6 FIG. 1 is a software architecture diagram of a lighting control method according to an exemplary embodiment. Figure 6 As shown, the software architecture of the lighting control method provided in the embodiment of the present application includes the following contents:
[0120] For example, taking a frequency of 1000 Hz as an example, assuming a period of 1000 microseconds, wherein the preset duration of event processing is 50 microseconds, the delay, i.e., the duty cycle processing, is 950 microseconds, and if there is an interrupt event, the interrupt event is 10 microseconds.
[0121] The software architecture has three stages: interrupt event, event processing, delay and duty cycle processing. Interrupts are mainly responsible for allocating pending control events. In the case of an interrupt event, the duty cycle of PWM will be affected, with an error of 10 / 1000. Since the error is small, the impact on the light brightness is small.
[0122] Event processing is to process pending control events in steps. In order to reduce the number of running events within an event cycle, an event is divided into several sub-events. One or more sub-events are run in a single cycle, and finally the light control data is read. When there is no event, a delay of 50 microseconds is used to occupy this time.
[0123] When running delay and duty cycle, PWM is simulated by delay, GPIO flip, delay, and GPIO flip. The duty cycle is controlled by controlling the delay time. When a cycle is completed, a PWM is executed to achieve light control. When controlling multiple GPIOs for multiple flips, it is necessary to flip the GPIOs to a fixed time to achieve multiple PWM simulations.
[0124] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. In order to achieve the above functions, the lighting control device or vehicle includes a hardware structure and / or software module corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.
[0125] The embodiment of the present application can divide the functional modules of the lighting control device or vehicle according to the above method. For example, the lighting control device or vehicle can include various functional modules corresponding to the functional divisions, or two or more functions can be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical functional division. There may be other division methods in actual implementation.
[0126] Figure 7 is a block diagram of a lighting control device according to an exemplary embodiment. Figure 7 The lighting control device includes: a receiving module 710 and a first processing module 720.
[0127] The receiving module 710 is used to receive the lighting control information of the target light bulb from the vehicle control unit; the lighting control information includes a plurality of data packets, and the data packets include at least one control instruction corresponding to the control event of the target light bulb.
[0128] The first processing module 720 is used to determine the pending control events of the target bulb according to the lighting control information; the pending control events include brightness control events and power control events; the brightness control event is used to indicate the brightness of the target bulb; the power control event is used to indicate the power on or off of the target bulb; according to multiple data packets, the pending control events are processed step by step to obtain at least one sub-event; at least one sub-event is processed in at least one event processing cycle, and each event processing cycle corresponds to processing one or more of the at least one sub-event; according to the sub-event processed in each event processing cycle, the GPIO port in the lighting controller is controlled to flip and delay to obtain an analog PWM signal to control the target bulb.
[0129] In a possible implementation, the first processing module 720 is specifically used to determine the processing time of each data packet in a plurality of data packets according to a preset first corresponding relationship; the first corresponding relationship is used to represent the corresponding relationship between the data packet and the processing time; when the processing time of each of the data packets in the plurality of data packets is less than the preset time, the control event to be processed is processed step by step according to the number of the plurality of data packets to obtain M sub-events; the M sub-events correspond one-to-one to the plurality of data packets.
[0130] In a possible implementation, the above-mentioned device also includes: a splitting module; a splitting module, which is used to split the sub-event corresponding to the target data packet into multiple secondary sub-events when there is a target data packet among multiple data packets; the processing time of the target data packet is greater than or equal to the preset time.
[0131] In a possible implementation, for any first cycle in at least one event processing cycle; the first processing module 720 is specifically used to determine the execution duration of each sub-event in at least one sub-event; based on the preset duration and the execution duration of each sub-event, determine the N sub-events executed within the preset duration; the preset duration is less than the duration of the first cycle; N is a positive integer; the sum of the execution durations of the N sub-events is less than or equal to the preset duration; and execute N sub-events within the first cycle.
[0132] In a possible implementation, the first processing module 720 is specifically used to determine the data packet corresponding to each sub-event; based on a preset first corresponding relationship, determine the processing time of each data packet as the execution time of the corresponding sub-event; the first corresponding relationship is used to represent the correspondence between the data packet and the processing time.
[0133] In a possible implementation, the first processing module 720 is specifically used to parse the lighting control information to obtain at least one flag bit; different flag bits are used to represent different control events; the value of the flag bit is used to indicate whether to execute the control event; and based on at least one flag bit and at least one flag bit value, determine the control event to be processed of the target bulb.
[0134] In a possible implementation, the above-mentioned device also includes: a second processing module; the second processing module is specifically used to, when at least one flag bit includes a target flag bit, use a preset delay to replace the execution time occupied by the control event corresponding to the target flag bit in the processing cycle of at least one event; wherein the value of the target flag is a first value, and the first value is used to indicate that the control event is not executed.
[0135] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0136] Figure 8 FIG. 1 is a block diagram of a vehicle according to an exemplary embodiment. Figure 8 As shown, vehicle 800 includes, but is not limited to, a processor 801 and a memory 802 .
[0137] The memory 802 is used to store executable instructions of the processor 801. It can be understood that the processor 801 is configured to execute instructions to implement the lighting control method in the above embodiment.
[0138] It should be noted that those skilled in the art can understand that Figure 8 The vehicle structure shown in the figure does not constitute a limitation on the vehicle, and the vehicle may include Figure 8 More or fewer components may be shown, or certain components may be combined, or the components may be arranged differently.
[0139] The processor 801 is the control center of the vehicle, which uses various interfaces and lines to connect various parts of the entire vehicle, and executes various functions of the vehicle and processes data by running or executing software programs and / or modules stored in the memory 802, and calling data stored in the memory 802, so as to monitor the vehicle as a whole. The processor 801 may include one or more processing units. Optionally, the processor 801 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 801.
[0140] The memory 802 may be used to store software programs and various data. The memory 802 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one functional module (such as a determination unit, a processing unit, etc.), etc. In addition, the memory 802 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0141] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 802 including instructions, and the instructions can be executed by the processor 801 of the vehicle 800 to implement the method in the above embodiment.
[0142] In actual implementation, Figure 7 The functions of the receiving module 710 and the first processing module 720 in Figure 8 The processor 801 in the embodiment calls the computer program stored in the memory 802. The specific execution process can refer to the description of the method part in the above embodiment, which will not be repeated here.
[0143] Optionally, the computer-readable storage medium may be a non-temporary computer-readable storage medium, for example, the non-temporary computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0144] In an exemplary embodiment, the present application also provides a computer program product including one or more instructions, which can be executed by the processor 801 of the vehicle to complete the method in the above embodiment.
[0145] It should be noted that when the instructions in the above-mentioned computer-readable storage medium or one or more instructions in the computer program product are executed by the vehicle's processor, the various processes of the above-mentioned method embodiment are implemented, and the same technical effect as the above-mentioned method can be achieved. To avoid repetition, they will not be repeated here.
[0146] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0147] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0148] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0149] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0150] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or the full classification part or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including a number of instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute the full classification part or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, ROM, RAM, disk or CD and other media that can store program code.
[0151] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto, and any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A lighting control method, It is characterized in that The method is applied to a light controller on a vehicle; the method comprises: Receiving light control information of a target light bulb from a vehicle control unit; the light control information includes a plurality of data packets, and the data packets include at least one control instruction corresponding to a control event of the target light bulb; Determine the pending control event of the target light bulb according to the lighting control information; the pending control event includes a brightness control event and a power control event; the brightness control event is used to indicate the control of the brightness of the target light bulb; the power control event is used to indicate the control of powering on or off the target light bulb; According to the multiple data packets, the control event to be processed is processed step by step to obtain at least one sub-event; Processing the at least one sub-event in at least one event processing cycle, each event processing cycle corresponding to processing one or more of the at least one sub-event; According to the sub-events processed in each event processing cycle, the GPIO port in the light controller is controlled to be flipped and delayed to obtain an analog PWM signal to control the target light bulb.
2. The method according to claim 1, It is characterized in that The step of processing the control event to be processed according to the multiple data packets to obtain at least one sub-event includes: Determine the processing time of each of the plurality of data packets according to a preset first corresponding relationship; the first corresponding relationship is used to represent the corresponding relationship between the data packet and the processing time; When the processing time of each of the multiple data packets is less than the preset time, the control event to be processed is processed step by step according to the number of the multiple data packets to obtain M sub-events; the M sub-events correspond one-to-one to the multiple data packets.
3. The method according to claim 2, It is characterized in that The method further comprises: In the case that there is a target data packet among the multiple data packets, the sub-event corresponding to the target data packet is split into multiple secondary sub-events; and the processing time length of the target data packet is greater than or equal to the preset time length.
4. The method according to claim 1, It is characterized in that For any first cycle of the at least one event processing cycle; The processing of the at least one sub-event in at least one event processing cycle comprises: Determining the execution duration of each sub-event in the at least one sub-event; According to the preset duration and the execution duration of each sub-event, determine N sub-events executed within the preset duration; the preset duration is less than the duration of the first cycle; N is a positive integer; the sum of the execution durations of the N sub-events is less than or equal to the preset duration; The N sub-events are executed within the first cycle.
5. The method according to claim 4, It is characterized in that The determining the execution duration of each sub-event in the at least one sub-event includes: Determine the data packets corresponding to each of the sub-events; According to a preset first corresponding relationship, the processing duration of each data packet is determined as the execution duration of the corresponding sub-event; the first corresponding relationship is used to represent the corresponding relationship between the data packet and the processing duration.
6. The method according to claim 1, It is characterized in that The step of determining the control event to be processed of the target light bulb according to the lighting control information includes: Parsing the lighting control information to obtain at least one flag bit; different flag bits are used to represent different control events; the value of the flag bit is used to indicate whether to execute the control event; According to the at least one flag bit and the value of the at least one flag bit, a control event to be processed of the target light bulb is determined.
7. The method according to claim 6, It is characterized in that The method further comprises: In the case where the at least one flag bit includes a target flag bit, a preset delay is used to replace the execution time occupied by the control event corresponding to the target flag bit in the processing cycle of the at least one event; wherein the value of the target flag is a first value, and the first value is used to indicate that the control event is not executed.
8. A lighting control device, It is characterized in that The device is applied to a light controller on a vehicle; the device comprises: A receiving module, used for receiving light control information of a target light bulb from a vehicle control unit; the light control information includes a plurality of data packets, and the data packets include at least one control instruction corresponding to a control event of the target light bulb; The first processing module is used to determine the pending control events of the target bulb according to the light control information; the pending control events include brightness control events and power control events; the brightness control event is used to indicate the control of the brightness of the target bulb; the power control event is used to indicate the control of powering on or off the target bulb; according to the multiple data packets, the pending control events are processed step by step to obtain at least one sub-event; the at least one sub-event is processed in at least one event processing cycle, and each event processing cycle corresponds to processing one or more of the at least one sub-event; according to the sub-event processed in each event processing cycle, the GPIO port in the light controller is controlled to flip and delay to obtain an analog PWM signal to control the target bulb.
9. A vehicle, It is characterized in that include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, It is characterized in that When the computer-executable instructions stored in the computer-readable storage medium are executed by a processor of a vehicle, the vehicle is capable of performing the method of any one of claims 1 to 7.
11. A computer program product, It is characterized in that When the computer program product is executed in a vehicle, the vehicle is caused to implement the method according to any one of claims 1 to 7.
