A control method for an event-driven vehicle light state machine
By introducing a variety of stable and transition states into the headlight state machine, combining timers and counters, smooth switching of the headlight state and response to multiple complex scenarios, the problem of low code scalability in the existing technology is solved, and the problem of improving the Development efficiency and state machine complexity.
Patent Information
- Application Number
- CN202411375849.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-09-30
AI Technical Summary
The existing car light state machine has low code scalability and cannot effectively respond to multiple complex vehicle control requests, resulting in the need to add complex function code when adding new control requests, which affects development efficiency.
The event-driven car light state machine control method is adopted. By setting multiple stable states and transition states, combining timers and counters, the smooth switching of car light states and coping with multiple complex scenarios is achieved, and the complexity of the state machine is improved to simplify the Algorithm, enhances the scalability of the code.
It improves the scalability of software code, simplifies algorithms, helps developers to track and debug system behavior more easily, improves development efficiency, and makes the state switching of the headlight state machine smoother, and can cope with various complex scenarios.
Smart Images

Figure CN118890753B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of vehicle control, and in particular relates to a control method for an event-driven vehicle light state machine. Background Art
[0002] A vehicle is equipped with multiple lights, such as indicator lights of various electronic control systems of the vehicle. Usually the lights have three working modes, including always on, always off, and flashing at a certain frequency, and the lights need to be controlled to switch between the above three working modes. In the prior art, a state machine is used to represent the state of the light, and the state machine includes two states: on and off. When the lights are required to be always on, keep the state machine in the on state. When the lights are required to be always off, keep the state machine in the off state. During the actual operation of the vehicle, the lights will receive different control requests from various modules, and the types of control requests are varied. And with the development of vehicle technology, the types of control requests for lights are increasing. When a new type of control request needs to be added, for a state machine with only two states, it is necessary to add complex function code, which is not conducive to implementation and the scalability of the code is low. Summary of the invention
[0003] An object of the present invention is to provide a control method for an event-driven vehicle light state machine, which can solve the technical problem of low scalability of vehicle light state machine codes in the prior art.
[0004] According to a first aspect of the present invention, there is provided a method for controlling an event-driven vehicle light state machine, comprising:
[0005] Obtain target events of the vehicle light state machine, wherein the target events include a light on event, a light off event, a flashing event, a timer reset, a timer reset and a counter reset;
[0006] Determining a target state of the headlight state machine according to the target event and a current state of the headlight state machine;
[0007] Switching the vehicle light state machine to the target state;
[0008] Execute an action function corresponding to a target state of the headlight state machine;
[0009] The state of the vehicle light state machine includes a stable state and a transition state, the stable state includes a first stable state, a second stable state, a third stable state, and a fourth stable state, and the transition state includes a first transition state, a second transition state, a third transition state, a fourth transition state, a fifth transition state, a sixth transition state, a seventh transition state, an eighth transition state, a ninth transition state, a tenth transition state, and an eleventh transition state;
[0010] The first stable state is that the vehicle lights are always off, and the content of the action function corresponding to the first stable state includes turning off the lights and clearing the timer and counter;
[0011] The second stable state is a state where the vehicle lights are always on, and the content of the action function corresponding to the second stable state includes lighting the lights and clearing the timer and counter;
[0012] The third stable state is a state where the vehicle lights are flashing and on, and the content of the action function corresponding to the third stable state includes lighting up the lights and setting a timer and a counter;
[0013] The fourth stable state is a state where the vehicle lights are flashing and off, and the content of the action function corresponding to the fourth stable state includes turning off the lights and setting a timer and a counter;
[0014] In the first transition state, the light is on and there is a timer and a counter, and the content of the action function corresponding to the first transition state includes lighting the light and setting the timer and the counter;
[0015] In the second transition state, the light is on and there is a timer and a counter, and the content of the action function corresponding to the second transition state includes lighting the light and setting the timer and the counter;
[0016] In the third transition state, the light is off and there is a timer and a counter, and the content of the action function corresponding to the third transition state includes turning off the light and setting the timer and the counter;
[0017] In the fourth transition state, the fifth transition state, and the sixth transition state, the on and off of the light remain in the state before switching, and the corresponding action function is empty;
[0018] In the seventh transition state, the light is off and there is a timer and a counter, and the content of the action function corresponding to the seventh transition state includes turning off the light and setting the timer and the counter;
[0019] In the eighth transition state, the light is on and there is a timer and a counter, and the content of the action function corresponding to the eighth transition state includes lighting the light and setting the timer and the counter;
[0020] In the ninth transition state, the light is off and there is a timer and a counter, and the content of the action function corresponding to the ninth transition state includes turning off the light and setting the timer and the counter;
[0021] In the tenth transition state, the light is on and there is a timer and a counter, and the content of the action function corresponding to the tenth transition state includes lighting the light and setting the timer and the counter;
[0022] In the eleventh transition state, the light is off and there is a timer and a counter. The content of the action function corresponding to the eleventh transition state includes turning off the light and setting the timer and the counter.
[0023] Optionally, the current state of the headlight state machine is a first stable state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes:
[0024] When the target event is a light-on event, determining the target state of the vehicle light state machine to be a first transition state;
[0025] When the target event is a flashing event, determining the target state of the vehicle light state machine to be a second transition state;
[0026] In the case that the target event is any one of a light-off event, a timer clearing event, a timer clearing event and a counter clearing event, the target event is ignored.
[0027] Optionally, the current state of the headlight state machine is a second stable state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes:
[0028] When the target event is a light-off event, determining that the target state of the vehicle light state machine is a first stable state;
[0029] When the target event is a flashing event, determining the target state of the vehicle light state machine to be a second transition state;
[0030] When the target event is any one of a light-on event, a timer clearing event, a timer clearing event and a counter clearing event, the target event is ignored.
[0031] Optionally, the current state of the headlight state machine is a third stable state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes:
[0032] When the target event is a light-on event, determining the target state of the vehicle light state machine to be a fourth transition state;
[0033] When the target event is a light-off event, determining the target state of the vehicle light state machine to be a sixth transition state;
[0034] When the target event is that the timer is reset and the counter is reset, determining that the target state of the vehicle light state machine is a fourth stable state;
[0035] In case the target event is a flashing event or the timer is reset, the target event is ignored.
[0036] Optionally, the current state of the headlight state machine is a fourth stable state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes:
[0037] When the target event is a light-on event, determining the target state of the vehicle light state machine to be a fourth transition state;
[0038] When the target event is a light-off event, determining the target state of the vehicle light state machine to be a fifth transition state;
[0039] When the target event is that the timer is reset and the counter is reset, determining that the target state of the vehicle light state machine is a third stable state;
[0040] In case the target event is a flashing event or the timer is reset, the target event is ignored.
[0041] Optionally, the current state of the headlight state machine is a first transition state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes:
[0042] When the target event is a light-off event, determining the target state of the vehicle light state machine to be a fifth transition state;
[0043] When the target event is a flashing event, determining the target state of the vehicle light state machine to be a second transition state;
[0044] When the target event is that the timer is reset and the counter is reset, determining that the target state of the vehicle light state machine is a second stable state;
[0045] When the target event is a light-on event or a timer clearing event, the target event is ignored.
[0046] Optionally, the current state of the headlight state machine is a second transition state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes:
[0047] When the target event is a light-on event, determining the target state of the vehicle light state machine to be an eighth transition state;
[0048] When the target event is a light-off event, determining the target state of the vehicle light state machine to be a tenth transition state;
[0049] When the target event is a flickering event, ignoring the target event;
[0050] When the target event is a timer reset, determining that the target state of the vehicle light state machine is a third transition state;
[0051] When the target event is that the timer is cleared and the counter is cleared, the target state of the vehicle light state machine is determined to be a fourth stable state.
[0052] Optionally, the current state of the headlight state machine is a third transition state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes:
[0053] When the target event is a light-on event, determining the target state of the vehicle light state machine to be a ninth transition state;
[0054] When the target event is a light-off event, determining the target state of the vehicle light state machine to be an eleventh transition state;
[0055] When the target event is a flickering event, ignoring the target event;
[0056] When the target event is a timer reset, determining the target state of the vehicle light state machine to be a second transition state;
[0057] When the target event is that the timer is cleared and the counter is cleared, the target state of the vehicle light state machine is determined to be a third stable state.
[0058] Optionally, the current state of the headlight state machine is a fourth transition state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes:
[0059] When the target event is a light-off event, determining the target state of the vehicle light state machine to be a fifth transition state;
[0060] When the target event is a flickering event, determining that the target state of the vehicle light state machine is a third stable state;
[0061] When the target event is that the timer is reset and the counter is reset, determining that the target state of the vehicle light state machine is a second stable state;
[0062] When the target event is a light-on event or a timer clearing event, the target event is ignored.
[0063] Optionally, the current state of the headlight state machine is a fifth transition state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes:
[0064] When the target event is a light-on event, determining the target state of the vehicle light state machine to be a fourth transition state;
[0065] When the target event is a flickering event, determining the target state of the vehicle light state machine to be a fourth stable state;
[0066] When the target event is that the timer is reset and the counter is reset, determining that the target state of the vehicle light state machine is a first stable state;
[0067] When the target event is a light-off event or a timer is reset, the target event is ignored.
[0068] Optionally, the current state of the headlight state machine is a sixth transition state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes:
[0069] When the target event is a light-on event, determining the target state of the vehicle light state machine to be a fourth transition state;
[0070] When the target event is a flickering event, determining that the target state of the vehicle light state machine is a third stable state;
[0071] When the target event is that the timer is reset and the counter is reset, determining that the target state of the vehicle light state machine is the seventh transition state;
[0072] When the target event is a light-off event or a timer is reset, the target event is ignored.
[0073] Optionally, the current state of the headlight state machine is the seventh transition state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes:
[0074] When the target event is a light-on event, determining the target state of the vehicle light state machine to be a fourth transition state;
[0075] When the target event is a flickering event, determining the target state of the vehicle light state machine to be a fourth stable state;
[0076] When the target event is that the timer is reset and the counter is reset, determining that the target state of the vehicle light state machine is a first stable state;
[0077] When the target event is a light-off event or a timer is reset, the target event is ignored.
[0078] Optionally, the current state of the headlight state machine is an eighth transition state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes:
[0079] When the target event is a light-on event, ignoring the target event;
[0080] When the target event is a light-off event, determining the target state of the vehicle light state machine to be a tenth transition state;
[0081] When the target event is a flashing event, determining the target state of the vehicle light state machine to be a second transition state;
[0082] When the target event is a timer reset, determining that the target state of the vehicle light state machine is a ninth transition state;
[0083] When the target event is that the timer is cleared and the counter is cleared, the target state of the vehicle light state machine is determined to be a ninth transition state.
[0084] Optionally, the current state of the headlight state machine is a ninth transition state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes:
[0085] When the target event is a light-on event, ignoring the target event;
[0086] When the target event is a light-off event, determining the target state of the vehicle light state machine to be an eleventh transition state;
[0087] When the target event is a flashing event, determining the target state of the vehicle light state machine to be a third transition state;
[0088] When the target event is a timer reset, determining that the target state of the vehicle light state machine is an eighth transition state;
[0089] When the target event is that the timer is cleared and the counter is cleared, the target state of the vehicle light state machine is determined to be a first transition state.
[0090] Optionally, the current state of the headlight state machine is a tenth transition state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes:
[0091] When the target event is a light-on event, determining the target state of the vehicle light state machine to be an eighth transition state;
[0092] When the target event is a light-off event, ignoring the target event;
[0093] When the target event is a flashing event, determining the target state of the vehicle light state machine to be a second transition state;
[0094] When the target event is timer reset, determining the target state of the vehicle light state machine to be an eleventh transition state;
[0095] When the target event is that the timer is cleared and the counter is cleared, the target state of the vehicle light state machine is determined to be an eleventh transition state.
[0096] Optionally, the current state of the headlight state machine is an eleventh transition state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes:
[0097] When the target event is a light-on event, determining the target state of the vehicle light state machine to be a ninth transition state;
[0098] When the target event is a light-off event, ignoring the target event;
[0099] When the target event is a flashing event, determining the target state of the vehicle light state machine to be a third transition state;
[0100] When the target event is a timer reset, determining the target state of the vehicle light state machine to be a tenth transition state;
[0101] When the target event is that the timer is cleared and the counter is cleared, the target state of the vehicle light state machine is determined to be a first stable state.
[0102] The beneficial effects of the present invention are as follows: the present invention increases the complexity of the state machine by setting multiple stable states and multiple transition states, simplifies the algorithm by complicating the data structure, and improves the scalability of the software code. In addition, in the program development stage, the use of more detailed states can help developers track and debug system behaviors more easily, thereby improving development efficiency. In addition, the present invention sets multiple transition states, and for each transition state, automatically switches to other states when the timer and counter are reset, so that the state switching of the headlight state machine is smoother, and the multiple transition states can cope with various complex scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0103] Figure 1 The present invention is a flowchart of a method for controlling an event-driven vehicle light state machine according to an embodiment of the present invention. DETAILED DESCRIPTION
[0104] Various exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present invention unless otherwise specifically stated.
[0105] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses.
[0106] The techniques, methods and devices known to those of ordinary skill in the relevant art may not be discussed in detail, but where appropriate, the techniques, methods and devices should be considered as part of the specification. In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not as limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0107] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0108] In the specification and claims of the present invention, if the term "first" or "second" is involved, it may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "plurality" means two or more. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / " generally means that the related objects are in an "or" relationship.
[0109] like Figure 1 As shown, this embodiment introduces a control method of an event-driven vehicle light state machine, including steps 1100-1400.
[0110] Step 1100: Obtain target events of the vehicle light state machine, where the target events include a light on event, a light off event, a flashing event, a timer reset, a timer reset and a counter reset.
[0111] Step 1200: Determine a target state of the vehicle light state machine according to the target event and the current state of the vehicle light state machine.
[0112] Step 1300: Switch the vehicle light state machine to the target state.
[0113] Step 1400: Execute the action function corresponding to the target state of the vehicle light state machine.
[0114] Among them, the states of the vehicle light state machine include a stable state and a transition state, the stable state includes a first stable state, a second stable state, a third stable state, and a fourth stable state, and the transition state includes a first transition state, a second transition state, a third transition state, a fourth transition state, a fifth transition state, a sixth transition state, a seventh transition state, an eighth transition state, a ninth transition state, a tenth transition state, and an eleventh transition state.
[0115] The first stable state is a state where the vehicle lamp is always off, and the content of the action function corresponding to the first stable state includes turning off the lamp and clearing the timer and counter. The first stable state is recorded as LAMP_OFF_STATE.
[0116] The second stable state is a state where the vehicle lamp is always on, and the content of the action function corresponding to the second stable state includes lighting the lamp and clearing the timer and counter. The second stable state is recorded as LAMP_ON_STATE.
[0117] The third stable state is a state where the vehicle lamp is flashing and on, and the content of the action function corresponding to the third stable state includes lighting the lamp and setting a timer. The third stable state is recorded as LAMP_PULSE_ON_STATE.
[0118] The fourth stable state is a state where the vehicle lamp is flashing and off, and the content of the action function corresponding to the fourth stable state includes turning off the lamp and setting a timer. The fourth stable state is recorded as LAMP_PULSE_OFF_STATE.
[0119] In the first transition state, the lamp is on and there is a timer and a counter, and the content of the action function corresponding to the first transition state includes lighting the lamp and setting the timer and the counter. The first transition state is recorded as LAMP_INIT_ON_STATE.
[0120] In the second transition state, the lamp is on and there is a timer and a counter, and the content of the action function corresponding to the second transition state includes lighting the lamp and setting the timer and the counter. For example, the second transition state can be recorded as LAMP_INIT_PULSE_ON_STATE.
[0121] In the third transition state, the lamp is off and there is a timer and a counter, and the content of the action function corresponding to the third transition state includes turning off the lamp and setting the timer and the counter. For example, the third transition state can be recorded as LAMP_INIT_PULSE_OFF_STATE.
[0122] In the fourth transition state, the fifth transition state, and the sixth transition state, the on and off of the light remain in the state before switching, and the corresponding action function is empty. For example, if the light is on before switching to the fourth transition state, then the light is still on after switching to the fourth transition state. For another example, if the light is off before switching to the fourth transition state, then the light is still off after switching to the fourth transition state.
[0123] The fourth transition state may be recorded as LAMP_REQUESTED_ON_STATE, the fifth transition state may be recorded as LAMP_REQUESTED_OFF_STATE, and the sixth transition state may be recorded as LAMP_REQ_PULSE_OFF_STATE.
[0124] In the seventh transition state, the lamp is off and there is a timer and a counter, and the content of the action function corresponding to the seventh transition state includes turning off the lamp and setting the timer and the counter. For example, the seventh transition state can be recorded as LAMP_PULSE_OFF_DELAY_STATE.
[0125] In the eighth transition state, the lamp is on and there is a timer and a counter, and the content of the action function corresponding to the eighth transition state includes lighting the lamp and setting the timer and the counter. For example, the eighth transition state can be recorded as LAMP_ON_REQ_PULSE_ON_STATE.
[0126] In the ninth transition state, the light is off and there is a timer and a counter, and the content of the action function corresponding to the ninth transition state includes turning off the light and setting the timer and the counter. For example, the ninth transition state can be recorded as LAMP_ON_REQ_PULSE_OFF_STATE.
[0127] In the tenth transition state, the lamp is on and there is a timer and a counter, and the content of the action function corresponding to the tenth transition state includes lighting the lamp and setting the timer and the counter. For example, the tenth transition state can be recorded as LAMP_OFF_REQ_PULSE_ON_STATE.
[0128] In the eleventh transition state, the lamp is off and there is a timer and a counter, and the content of the action function corresponding to the eleventh transition state includes turning off the lamp and setting the timer and the counter. For example, the eleventh transition state can be recorded as LAMP_OFF_REQ_PULSE_OFF_STATE.
[0129] The present invention defines five events of the vehicle lamp state machine, including LAMP_COMMAND_ON_EVENT, LAMP_COMMAND_OFF_EVENT, LAMP_PULSE_EVENT, LAMP_TIMEOUT_EVENT, and LAMP_COUNTER_AND_TIMEOUT_REACHED_EVENT. Among them, LAMP_COMMAND_ON_EVENT is a light-on event, LAMP_COMMAND_OFF_EVENT is a light-off event, LAMP_PULSE_EVENT is a flashing event, LAMP_TIMEOUT_EVENT timer is reset, and LAMP_COUNTER_AND_TIMEOUT_REACHED_EVENT is a timer reset and a counter reset.
[0130] In addition, four control requests for lights are defined, including always on request, always off request, always on request after delay, and flashing request. Various control requests will trigger corresponding events. For example, always on request and always on request after delay will trigger a light on event. For always on request and always on request after delay, the difference in the state machine's response to the two is that the always on request after delay will have an extra waiting time, but the target state of the switch is the same. Always off request will trigger a light off event. Flashing request will trigger a flashing event. Control requests are issued by other modules of the vehicle. When the state machine receives a control request, it triggers the corresponding target event and switches the state according to the triggered target event and the current state.
[0131] For the state of the vehicle light state machine, four stable states and eleven transition states are defined in this embodiment. When a control request is received, the corresponding transition state is entered first, and the final state will remain in the stable state. For example, after receiving a constant light request or a delay constant light request, it will eventually remain in the second stable state. After receiving a constant off request, it will eventually remain in the first stable state. After receiving a flashing request, it will eventually switch back and forth between the third stable state and the fourth stable state.
[0132] In the above eleven transition states, timers and counters are involved. When switching to the transition state, the counter will be checked first to see if it is zero. If it is zero, it means that it is the value after the previous transition phase, which means that the current transition phase has just begun and needs to be reinitialized to a specific value, such as 10. If it is not zero, it means that the counter has not been decremented to zero, which means that the current transition phase has not yet ended, so the counter initialization operation is not performed and the counter starts counting directly. Similarly, the timer is also judged in the same way whether it needs to be initialized.
[0133] In the present invention, the timer and counter are global variables, and all states share the same timer and counter. The timer and counter are decremented in the timing task. In the transition state, it is necessary to determine whether the transition phase is over according to the timer and counter. When the timer is reset and the counter is reset, it means that the transition phase is over and switches to other states.
[0134] As for the first stable state and the second stable state, since the first stable state means that it is always off and the second stable state means that it is always on, the state will not switch when there is no new control request in these two stable states, so the timer and counter are not needed in these two stable states, so the content of the action function of these two stable states includes clearing the timer and clearing the counter, and the timer and counter are cleared when switching to these two stable states. Then, when a control request is received later and switched to the transition state, since the timer and counter have been cleared, the timer and counter will be initialized and the transition phase will be re-entered.
[0135] After the timers and counters corresponding to the transition states perform the corresponding timing and counting, the corresponding events are triggered according to the timing and counting results, and then the state is switched according to the triggered events. In the fourth transition state, the fifth transition state, and the sixth transition state, since the action functions of these three transition states are empty, the timers and counters cannot be set after switching to these three transition states, and the existing timers and counters will continue to time and count.
[0136] When the state machine has only two states, on and off, when a new control request is needed, it is necessary to add complex function codes, and the scalability is low. Since multiple states have been defined in the present invention, only a small number of states need to be added according to the function of the new control request, and the new control request can be realized by combining the existing states. Compared with the previous method, it is easier to implement and has high scalability. In addition, the present invention sets multiple transition states. For each transition state, it automatically switches to other states when the timer and counter are reset, so that the state switching of the headlight state machine is smoother, and the multiple transition states can cope with various complex scenarios.
[0137] In addition, the present invention sets a variety of transition states, each of which has a timer and a counter, and in some of the transition states, the light is off, in another part of the transition state, the light is on, and in another part of the transition state, the light remains on and off in the state before the switch. When the state is switched, the target state to be switched will be determined based on the current state and the event. Triggering the same event in different states will switch to different states. This method can help developers track and debug system behavior more easily and improve development efficiency.
[0138] For example, when a lighting event is triggered in the first stable state, the system switches to the first transition state, and when a lighting event is triggered in the third stable state, the system switches to the fourth transition state.
[0139] The present invention increases the complexity of the state machine by setting multiple stable states and multiple transition states, simplifies the algorithm by complicating the data structure, and improves the scalability of the software code. In addition, in the program development stage, using more detailed states can help developers track and debug system behaviors more easily, thereby improving development efficiency.
[0140] In this embodiment, the current state of the vehicle light state machine is a first stable state, and step 1200 includes: when the target event is a light-on event, determining that the target state of the vehicle light state machine is a first transition state; when the target event is a flashing event, determining that the target state of the vehicle light state machine is a second transition state; when the target event is any one of a light-off event, timer reset, and timer reset and counter reset, ignoring the target event.
[0141] In the first stable state, the lights are off. When the light-on event is triggered in this case, the first transition state will be entered, and timing and counting will begin. When the timer and counter are cleared, the second stable state will be entered from the first transition state, and the lights will remain on.
[0142] When a flashing event is triggered in the first stable state, the second transition state is entered, and the second transition state and the third transition state are switched back and forth, and the third stable state and the fourth stable state are switched after the counter is cleared.
[0143] Ignoring the target event means that the state machine does not respond to the target event. For example, when the light-off event is triggered in the first stable state, since the lights are already off in the first stable state, the state machine does not need to change and can continue to stay in the first stable state.
[0144] In this embodiment, the current state of the vehicle light state machine is the second stable state, and the step 1200 includes: when the target event is a light-off event, determining that the target state of the vehicle light state machine is the first stable state; when the target event is a flashing event, determining that the target state of the vehicle light state machine is the second transitional state; when the target event is any one of a light-on event, timer reset, and timer reset and counter reset, ignoring the target event.
[0145] In the second stable state, the vehicle lights are on. In this case, when the light-off event is triggered, the vehicle directly enters the first stable state.
[0146] When a flashing event is triggered in the second stable state, the second transition state is entered, and the second transition state and the third transition state are switched back and forth, and the third stable state and the fourth stable state are switched after the counter is cleared.
[0147] When the lighting event is triggered, since the vehicle lights are already in a constant lighting state in the second stable state, the state machine does not need to change and can continue to remain in the second stable state.
[0148] In this embodiment, the current state of the headlight state machine is the third stable state, and step 1200 includes: when the target event is a light-on event, determining the target state of the headlight state machine to be the fourth transition state; when the target event is a light-off event, determining the target state of the headlight state machine to be the sixth transition state; when the target event is a timer reset and a counter reset, determining the target state of the headlight state machine to be the fourth stable state; when the target event is a flashing event or a timer reset, ignoring the target event.
[0149] The third stable state indicates that the vehicle lights are flashing and the lights are on. When the lighting event is triggered in this case, the fourth transition state is entered. In the fourth transition state, after the timer is reset and the counter is reset, the second stable state is entered.
[0150] When the light-off event is triggered in the third stable state, the sixth transition state is entered, and the vehicle light remains on. After the timer and the counter are reset in the sixth transition state, the seventh transition state is entered, and the light is off in the seventh transition state. After the timer and the counter are reset in the seventh transition state, the first stable state is entered.
[0151] When a flashing event is triggered in the third stable state, since the vehicle light is already in the flashing state, the state machine does not need to change and can continue to maintain the third stable state.
[0152] In this embodiment, the current state of the headlight state machine is the fourth stable state, and step 1200 includes: when the target event is a light-on event, determining the target state of the headlight state machine to be the fourth transition state; when the target event is a light-off event, determining the target state of the headlight state machine to be the fifth transition state; when the target event is a timer reset and a counter reset, determining the target state of the headlight state machine to be the third stable state; when the target event is a flashing event or a timer reset, ignoring the target event.
[0153] The fourth stable state indicates that the vehicle lights are flashing and the lights are off. When the lighting event is triggered in this case, the fourth transition state is entered. In the fourth transition state, after the timer is reset and the counter is reset, the second stable state is entered.
[0154] When the light-off event is triggered in the fourth stable state, the fifth transition state is entered, and the vehicle light remains off. In the fifth transition state, after the trigger timer is reset and the counter is reset, the first stable state is entered.
[0155] When a flashing event is triggered in the fourth stable state, since the vehicle light is already in the flashing state, the state machine does not need to change and can continue to maintain the fourth stable state.
[0156] For the third stable state and the fourth stable state, when the lights-off event is triggered, they will switch to different transition states respectively. After the lights-off event is triggered in the third stable state, it is necessary to switch to the sixth transition state and the seventh transition state in sequence before switching to the first stable state. After the lights-off event is triggered in the fourth stable state, it is only necessary to switch to the fifth transition state to switch to the first stable state, and the number of switches is less. The reason for this design is that the third stable state means flashing and the light is on. Since the light-off event is triggered, the light needs to be kept in the first stable state in the end, so the light needs to be turned from on to off. The fourth stable state means flashing and the light is off, and ultimately the light is kept in the first stable state without the process of changing from on to off.
[0157] In this embodiment, the current state of the headlight state machine is the first transition state, and step 1200 includes: when the target event is a lights-off event, determining the target state of the headlight state machine to be the fifth transition state; when the target event is a flashing event, determining the target state of the headlight state machine to be the second transition state; when the target event is a timer reset and a counter reset, determining the target state of the headlight state machine to be the second stable state; when the target event is a lights-on event or a timer reset, ignoring the target event.
[0158] When a permanent light request or a delayed permanent light request is received in a partial state, the light is switched to the first transition state first. In the first transition state, the light is on, and there is a timer and a counter. When the timer is reset and the counter is reset, the light is switched to the second stable state.
[0159] In this embodiment, the current state of the headlight state machine is the second transition state, and step 1200 includes: when the target event is a light-on event, determining the target state of the headlight state machine to be the eighth transition state; when the target event is a light-off event, determining the target state of the headlight state machine to be the tenth transition state; when the target event is a flashing event, ignoring the target event; when the target event is a timer reset, determining the target state of the headlight state machine to be the third transition state; when the target event is a timer reset and a counter reset, determining the target state of the headlight state machine to be the fourth stable state.
[0160] In the second transition state, the light is on, and there are timers and counters. When a flashing request is received in the partial state, it will first switch to the second transition state, and switch between the second transition state and the third transition state. When the timer and counter are cleared, it will switch to the third stable state and the fourth stable state.
[0161] In this embodiment, the current state of the headlight state machine is the third transition state, and step 1200 includes: when the target event is a light-on event, determining the target state of the headlight state machine to be the ninth transition state; when the target event is a light-off event, determining the target state of the headlight state machine to be the eleventh transition state; when the target event is a flashing event, ignoring the target event; when the target event is timer reset, determining the target state of the headlight state machine to be the second transition state; when the target event is timer reset and counter reset, determining the target state of the headlight state machine to be the third stable state.
[0162] In the third transition state, the light is off, and there are also timers and counters. When a flashing request is received in some states, it will first switch to the third transition state and switch between the second transition state and the third transition state. When the timer and counter are cleared, it will switch to the third stable state and the fourth stable state.
[0163] In this embodiment, the current state of the headlight state machine is the fourth transition state, and step 1200 includes: when the target event is a lights-off event, determining the target state of the headlight state machine to be the fifth transition state; when the target event is a flashing event, determining the target state of the headlight state machine to be the third stable state; when the target event is a timer reset and a counter reset, determining the target state of the headlight state machine to be the second stable state; when the target event is a lights-on event or a timer reset, ignoring the target event.
[0164] When a permanent light request is received in some states, it will switch to the fourth transition state, and the light on and off in the fourth transition state will remain unchanged before the switch. For example, if a permanent light request is received in the third stable state and the fourth stable state, it will switch to the fourth transition state. The light is on in the third stable state and off in the fourth stable state. Then, after receiving a permanent light request in the third stable state, it will switch to the fourth transition state and keep the light on. If a permanent light request is received in the fourth stable state, it will also switch to the fourth transition state and keep the light off.
[0165] In this embodiment, the current state of the headlight state machine is the fifth transition state, and step 1200 includes: when the target event is a light-on event, determining the target state of the headlight state machine to be the fourth transition state; when the target event is a flashing event, determining the target state of the headlight state machine to be the fourth stable state; when the target event is a timer reset and a counter reset, determining the target state of the headlight state machine to be the first stable state; when the target event is a light-off event or a timer reset, ignoring the target event.
[0166] When a request for always turning off is received in some states, the system will switch to the fifth transition state, and the light on and off of the light in the fifth transition state will remain unchanged before the switch. For example, when a request for always turning off is received in the first transition state, the system will switch to the fifth transition state. Since the light is on in the first transition state, the light will still be on after switching from the first transition state to the fifth transition state. For another example, when a request for always turning off is received in the fourth stable state, the system will switch to the fifth transition state. Since the light is off in the fourth stable state, the light will still be off after switching from the fourth stable state to the fifth transition state.
[0167] In this embodiment, the current state of the headlight state machine is the sixth transition state, and step 1200 includes: when the target event is a light-on event, determining the target state of the headlight state machine to be the fourth transition state; when the target event is a flashing event, determining the target state of the headlight state machine to be the third stable state; when the target event is a timer reset and a counter reset, determining the target state of the headlight state machine to be the seventh transition state; when the target event is a light-off event or a timer reset, ignoring the target event.
[0168] In this embodiment, the current state of the headlight state machine is the seventh transition state, and step 1200 includes: when the target event is a light-on event, determining the target state of the headlight state machine to be the fourth transition state; when the target event is a flashing event, determining the target state of the headlight state machine to be the fourth stable state; when the target event is a timer reset and a counter reset, determining the target state of the headlight state machine to be the first stable state; when the target event is a light-off event or a timer reset, ignoring the target event.
[0169] In this embodiment, the current state of the headlight state machine is the eighth transition state, and step 1200 includes: when the target event is a light-on event, ignoring the target event; when the target event is a light-off event, determining the target state of the headlight state machine to be the tenth transition state; when the target event is a flashing event, determining the target state of the headlight state machine to be the second transition state; when the target event is a timer reset, determining the target state of the headlight state machine to be the ninth transition state; when the target event is a timer reset and a counter reset, determining the target state of the headlight state machine to be the ninth transition state.
[0170] In this embodiment, the current state of the headlight state machine is the ninth transition state, and step 1200 includes: when the target event is a light-on event, ignoring the target event; when the target event is a light-off event, determining the target state of the headlight state machine to be the eleventh transition state; when the target event is a flashing event, determining the target state of the headlight state machine to be the third transition state; when the target event is timer reset, determining the target state of the headlight state machine to be the eighth transition state; when the target event is timer reset and counter reset, determining the target state of the headlight state machine to be the first transition state.
[0171] In this embodiment, the current state of the headlight state machine is the tenth transition state, and step 1200 includes: when the target event is a light-on event, determining that the target state of the headlight state machine is the eighth transition state; when the target event is a light-off event, ignoring the target event; when the target event is a flashing event, determining that the target state of the headlight state machine is the second transition state; when the target event is timer reset, determining that the target state of the headlight state machine is the eleventh transition state; when the target event is timer reset and counter reset, determining that the target state of the headlight state machine is the eleventh transition state.
[0172] In this embodiment, the current state of the headlight state machine is the eleventh transition state, and step 1200 includes: when the target event is a light-on event, determining the target state of the headlight state machine to be the ninth transition state; when the target event is a light-off event, ignoring the target event; when the target event is a flashing event, determining the target state of the headlight state machine to be the third transition state; when the target event is timer reset, determining the target state of the headlight state machine to be the tenth transition state; when the target event is timer reset and counter reset, determining the target state of the headlight state machine to be the first stable state.
[0173] The present invention designs a state transfer table, which contains target states that need to be switched when corresponding events are triggered in various states.
[0174] Table 1 State transition table
[0175]
[0176] When the state needs to be switched, the target state is queried from the state transition table according to the current state of the state machine and the target event, and then the state is switched. The specific content of the state transition table is as follows. IGNORE in the state transition table means ignoring the corresponding event.
[0177] Although some specific embodiments of the present invention have been described in detail by way of example, it will be appreciated by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present invention. It will be appreciated by those skilled in the art that the above embodiments may be modified without departing from the scope and spirit of the present invention. The scope of the present invention is defined by the appended claims.
[0178] Those of ordinary skill in the art will appreciate that the modules and algorithm steps 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 performed in hardware or software 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 invention.
[0179] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and equipment can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0180] In the 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 the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, 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 modules, which can be electrical, mechanical or other forms.
[0181] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the embodiments of the present invention.
[0182] In addition, each functional module in the embodiment of the present invention may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0183] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of various embodiments of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical disks.
[0184] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with (but not limited to) technical features with similar functions disclosed in the present application.
[0185] It should be understood that the size of the sequence number of each step in the content of the invention and the embodiments of the present invention does not absolutely mean 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 embodiment of the present invention. For the purpose of example and description, the foregoing description of the implementation of the present disclosure has been given. The foregoing description is not exhaustive and is not intended to limit the present disclosure to the exact form disclosed. Various deformations and modifications may exist according to the above teachings, or various deformations and modifications may be obtained from the practice of the present disclosure. These embodiments are selected and described to illustrate the principles of the present disclosure and its practical application, so that those skilled in the art can use the present disclosure in various embodiments and various modifications suitable for the specific purpose conceived.
Claims
1. A control method for an event-driven vehicle light state machine, characterized in that: include: Obtain target events of the vehicle light state machine, wherein the target events include a light on event, a light off event, a flashing event, a timer reset, a timer reset and a counter reset; Determining a target state of the headlight state machine according to the target event and a current state of the headlight state machine; Switching the vehicle light state machine to the target state; Execute an action function corresponding to a target state of the headlight state machine; The state of the vehicle light state machine includes a stable state and a transition state, the stable state includes a first stable state, a second stable state, a third stable state, and a fourth stable state, and the transition state includes a first transition state, a second transition state, a third transition state, a fourth transition state, a fifth transition state, a sixth transition state, a seventh transition state, an eighth transition state, a ninth transition state, a tenth transition state, and an eleventh transition state; The first stable state is that the vehicle lights are always off, and the content of the action function corresponding to the first stable state includes turning off the lights and clearing the timer and counter; The second stable state is a state where the vehicle lights are always on, and the content of the action function corresponding to the second stable state includes lighting the lights and clearing the timer and counter; The third stable state is a state where the vehicle lights are flashing and on, and the content of the action function corresponding to the third stable state includes lighting up the lights and setting a timer and a counter; The fourth stable state is a state where the vehicle lights are flashing and off, and the content of the action function corresponding to the fourth stable state includes turning off the lights and setting a timer and a counter; In the first transition state, the light is on and there is a timer and a counter. The content of the action function corresponding to the first transition state includes lighting the light and setting the timer and the counter. When the timer and the counter are reset, the state switches to the second stable state. In the second transition state, the light is on and there is a timer and a counter. The content of the action function corresponding to the second transition state includes lighting the light and setting the timer and the counter. When the timer and the counter are reset, the state switches to the fourth stable state. In the third transition state, the light is off and there is a timer and a counter. The content of the action function corresponding to the third transition state includes turning off the light and setting the timer and the counter. When the timer and the counter are reset, the state switches to the third stable state. In the fourth transition state, the fifth transition state, and the sixth transition state, the light is kept on and off in the state before the switch, and the corresponding action function is empty; when a permanent light request is received in the partial state, the light is switched to the fourth transition state; when a permanent light request is received in the partial state, the light is switched to the fifth transition state; in the third stable state, a light off event is triggered, and the light is switched to the sixth transition state; In the seventh transition state, the light is off and there is a timer and a counter, and the content of the action function corresponding to the seventh transition state includes turning off the light and setting the timer and the counter, and when the timer and the counter are reset to zero, switching to the first stable state; In the eighth transition state, the light is on and there is a timer and a counter, and the content of the action function corresponding to the eighth transition state includes lighting the light and setting the timer and the counter; In the ninth transition state, the light is off and there is a timer and a counter, and the content of the action function corresponding to the ninth transition state includes turning off the light and setting the timer and the counter; In the tenth transition state, the light is on and there is a timer and a counter, and the content of the action function corresponding to the tenth transition state includes lighting the light and setting the timer and the counter; In the eleventh transition state, the light is off and there is a timer and a counter, and the content of the action function corresponding to the eleventh transition state includes turning off the light and setting the timer and the counter; When the current state of the headlight state machine is the eighth transition state, determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes: When the target event is a light-on event, ignoring the target event; When the target event is a light-off event, determining the target state of the vehicle light state machine to be a tenth transition state; When the target event is a flashing event, determining the target state of the vehicle light state machine to be a second transition state; When the target event is a timer reset, determining that the target state of the vehicle light state machine is a ninth transition state; When the target event is that the timer is reset and the counter is reset, determining that the target state of the vehicle light state machine is a ninth transition state; When the current state of the headlight state machine is the ninth transition state, determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes: When the target event is a light-on event, ignoring the target event; When the target event is a light-off event, determining the target state of the vehicle light state machine to be an eleventh transition state; When the target event is a flashing event, determining the target state of the vehicle light state machine to be a third transition state; When the target event is a timer reset, determining that the target state of the vehicle light state machine is an eighth transition state; When the target event is that the timer is cleared and the counter is cleared, the target state of the vehicle light state machine is determined to be a first transition state.
2. The method according to claim 1, characterized in that The current state of the headlight state machine is a first stable state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes: When the target event is a light-on event, determining the target state of the vehicle light state machine to be a first transition state; When the target event is a flashing event, determining the target state of the vehicle light state machine to be a second transition state; In the case that the target event is any one of a light-off event, a timer clearing event, a timer clearing event and a counter clearing event, the target event is ignored.
3. The method according to claim 1, characterized in that: The current state of the headlight state machine is a second stable state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes: When the target event is a light-off event, determining that the target state of the vehicle light state machine is a first stable state; When the target event is a flashing event, determining the target state of the vehicle light state machine to be a second transition state; When the target event is any one of a light-on event, a timer clearing event, a timer clearing event and a counter clearing event, the target event is ignored.
4. The method according to claim 1, characterized in that: The current state of the headlight state machine is a third stable state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes: When the target event is a light-on event, determining the target state of the vehicle light state machine to be a fourth transition state; When the target event is a light-off event, determining the target state of the vehicle light state machine to be a sixth transition state; When the target event is that the timer is reset and the counter is reset, determining that the target state of the vehicle light state machine is a fourth stable state; In case the target event is a flashing event or the timer is reset, the target event is ignored.
5. The method according to claim 1, characterized in that The current state of the headlight state machine is a fourth stable state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes: When the target event is a light-on event, determining the target state of the vehicle light state machine to be a fourth transition state; When the target event is a light-off event, determining the target state of the vehicle light state machine to be a fifth transition state; When the target event is that the timer is reset and the counter is reset, determining that the target state of the vehicle light state machine is a third stable state; In case the target event is a flashing event or the timer is reset, the target event is ignored.
6. The method according to claim 1, characterized in that The current state of the headlight state machine is a first transition state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes: When the target event is a light-off event, determining the target state of the vehicle light state machine to be a fifth transition state; When the target event is a flashing event, determining the target state of the vehicle light state machine to be a second transition state; When the target event is that the timer is reset and the counter is reset, determining that the target state of the vehicle light state machine is a second stable state; When the target event is a light-on event or a timer clearing event, the target event is ignored.
7. The method according to claim 1, characterized in that The current state of the headlight state machine is a second transition state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes: When the target event is a light-on event, determining the target state of the vehicle light state machine to be an eighth transition state; When the target event is a light-off event, determining the target state of the vehicle light state machine to be a tenth transition state; When the target event is a flickering event, ignoring the target event; When the target event is a timer reset, determining that the target state of the vehicle light state machine is a third transition state; When the target event is that the timer is cleared and the counter is cleared, the target state of the vehicle light state machine is determined to be a fourth stable state.
8. The method according to claim 1, characterized in that The current state of the headlight state machine is a third transition state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes: When the target event is a light-on event, determining the target state of the vehicle light state machine to be a ninth transition state; When the target event is a light-off event, determining the target state of the vehicle light state machine to be an eleventh transition state; When the target event is a flickering event, ignoring the target event; When the target event is a timer reset, determining the target state of the vehicle light state machine to be a second transition state; When the target event is that the timer is cleared and the counter is cleared, the target state of the vehicle light state machine is determined to be a third stable state.
9. The method according to claim 1, characterized in that: The current state of the headlight state machine is a fourth transition state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes: When the target event is a light-off event, determining the target state of the vehicle light state machine to be a fifth transition state; When the target event is a flickering event, determining that the target state of the vehicle light state machine is a third stable state; When the target event is that the timer is reset and the counter is reset, determining that the target state of the vehicle light state machine is a second stable state; When the target event is a light-on event or a timer clearing event, the target event is ignored.
10. The method according to claim 1, characterized in that The current state of the headlight state machine is a fifth transition state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes: When the target event is a light-on event, determining the target state of the vehicle light state machine to be a fourth transition state; When the target event is a flickering event, determining the target state of the vehicle light state machine to be a fourth stable state; When the target event is that the timer is reset and the counter is reset, determining that the target state of the vehicle light state machine is a first stable state; When the target event is a light-off event or a timer is reset, the target event is ignored.
11. The method according to claim 1, characterized in that: The current state of the headlight state machine is a sixth transition state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes: When the target event is a light-on event, determining the target state of the vehicle light state machine to be a fourth transition state; When the target event is a flickering event, determining that the target state of the vehicle light state machine is a third stable state; When the target event is that the timer is reset and the counter is reset, determining that the target state of the vehicle light state machine is the seventh transition state; When the target event is a light-off event or a timer is reset, the target event is ignored.
12. The method according to claim 1, characterized in that The current state of the headlight state machine is the seventh transition state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes: When the target event is a light-on event, determining the target state of the vehicle light state machine to be a fourth transition state; When the target event is a flickering event, determining the target state of the vehicle light state machine to be a fourth stable state; When the target event is that the timer is reset and the counter is reset, determining that the target state of the vehicle light state machine is a first stable state; When the target event is a light-off event or a timer is reset, the target event is ignored.
13. The method according to claim 1, characterized in that The current state of the headlight state machine is a tenth transition state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes: When the target event is a light-on event, determining the target state of the vehicle light state machine to be an eighth transition state; When the target event is a light-off event, ignoring the target event; When the target event is a flashing event, determining the target state of the vehicle light state machine to be a second transition state; When the target event is timer reset, determining the target state of the vehicle light state machine to be an eleventh transition state; When the target event is that the timer is cleared and the counter is cleared, the target state of the vehicle light state machine is determined to be an eleventh transition state.
14. The method according to claim 1, characterized in that The current state of the headlight state machine is an eleventh transition state, and determining the target state of the headlight state machine according to the target event and the current state of the headlight state machine includes: When the target event is a light-on event, determining the target state of the vehicle light state machine to be a ninth transition state; When the target event is a light-off event, ignoring the target event; When the target event is a flashing event, determining the target state of the vehicle light state machine to be a third transition state; When the target event is a timer reset, determining the target state of the vehicle light state machine to be a tenth transition state; When the target event is that the timer is cleared and the counter is cleared, the target state of the vehicle light state machine is determined to be a first stable state.
