Control device
By employing JSON data format and binary tree data structure to manage commands in the control device, the problems of low code reusability and long development time in existing technologies are solved, achieving a highly compatible and fast-responding control device and reducing the development cost of smart home appliance projects.
Patent Information
- Application Number
- CN202211171333.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-26
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2042-09-26
AI Technical Summary
Existing control devices suffer from low code reusability, long development time, and high cost in terms of wireless communication and function development. This is especially true in smart home appliance projects, where developers need to spend a lot of time setting up the environment and learning how to use the control devices.
Data communication is performed using JSON data format, and commands are managed using a binary tree data structure. Custom commands can be passed through, and execution results are returned through message callback functions. The search algorithm is optimized using a balanced binary tree to improve response speed.
It achieves high compatibility and fast response of control devices, reduces project development time and cost, and allows users to implement complex functions through simple JSON commands, thus improving development efficiency.
Smart Images

Figure CN115510189B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of control equipment technology, and in particular to control equipment. Background Technology
[0002] With the development of the Internet of Things (IoT) and the improvement of people's living standards, IoT devices have entered thousands of households, leading to an increasing demand for the transformation of ordinary home appliances into smart home appliances.
[0003] Control devices typically integrate 2.4GHz WiFi and Bluetooth Low Energy to meet the growing demands of smart home appliances, such as Shanghai Espressif's ESP32 chip.
[0004] When control devices are used as communication modules, although the manufacturer provides open-standard application projects, some source code is not open, preventing developers or users from modifying the project to suit their specific use cases. Furthermore, most embedded engineers in the home appliance industry often lack expertise in wireless communication development. Therefore, when developers need to develop smart home appliance-related projects, even for a simple function, they need to spend a significant amount of time setting up the environment and learning how to use the control devices, or collaborating with other companies, greatly increasing project development time and costs.
[0005] When a control device is used as the main control chip, due to wireless communication and diverse requirements, developers may need to develop multiple versions of a single function, resulting in low code reusability. Furthermore, if the project involves complex and labor-intensive functions (such as UI design), it will lead to extended project timelines and unnecessary time costs. Summary of the Invention
[0006] This application provides a control device with JSON as the data communication format, which has good compatibility. Due to the characteristics of JSON data, additional custom data can be transmitted through commands.
[0007] One technical solution adopted in this application is to provide a control device, which includes: a main control unit; a hardware communication interface connected to the main control unit for communicating with external devices to perform data communication; and a wireless communication interface connected to the main control unit for communicating with external devices to perform data communication. The data communication format between the main control unit, the hardware communication interface, and the wireless communication interface is JSON format. When the control device is used as a communication module, the hardware communication interface is initialized, and the data received by the hardware communication interface is parsed using JSON. If the data is in JSON format, the main control unit calls the command execution interface and receives the corresponding command execution result in a pre-registered message callback function. When the control device is used as a main control chip, a command task is created, the command execution interface is called, the command to be executed is sent to the command task call, and the corresponding command execution result is received in a pre-registered message callback function.
[0008] The main control unit is used to receive a first control command sent by a hardware communication interface or a wireless communication interface, and return a first execution result after executing the first control command; or, the main control unit is used to send a second control command to an external device through a hardware communication interface or a wireless communication interface.
[0009] The main control unit is used to register message callback functions and create task call command execution interfaces. The target command is called through the task call command execution interface, and the corresponding command execution result is returned through the message callback function after the target command is executed.
[0010] When the control device starts, various commands and function pointers for executing each command are registered in a binary tree. When a target command is received, the function pointer corresponding to the target command is found by searching the binary tree. When the nodes of the binary tree are unevenly distributed, the time complexity of the search algorithm is between O(log₂N) and O(N).
[0011] Among them, when the control device registers multiple commands, it limits the height difference between the left and right subtrees of the binary tree to no more than 1, transforms the binary tree into a balanced binary tree, and the search algorithm has a time complexity of O(log2N).
[0012] The control device is equipped with a message notification chain mechanism, which separates the driver command layer and the user application layer. The message notification chain mechanism is constructed using a linked list data structure.
[0013] The control device includes: a memory that stores the probability of the call history corresponding to each command; and a control unit that assigns values to the nodes of the binary tree according to the probability of the call history corresponding to each command.
[0014] The process involves arranging multiple commands in ascending order of probability, using the probabilities of the first two commands as the left and right nodes of the binary tree, and adding the probabilities of the first two commands together to obtain the probability of the root node. The root node and the remaining commands are then arranged in ascending order of probability to obtain the final binary tree.
[0015] The wireless communication interfaces include Wi-Fi communication interfaces and Bluetooth communication interfaces.
[0016] The hardware communication interfaces include the IIC communication interface, the UART communication interface, and the SPI communication interface.
[0017] The beneficial effects of this application are as follows: Unlike existing technologies, the control device of this application includes: a main control unit; a hardware communication interface connected to the main control unit for communication with external devices, enabling data communication with a first external device; and a wireless communication interface connected to the main control unit for communication with external devices, enabling data communication with a second external device. The data communication format between the main control unit, the hardware communication interface, and the wireless communication interface is JSON format. When the control device is used as a communication module, the hardware communication interface is initialized, and the data received by the hardware communication interface is parsed using JSON. If the data is in JSON format, the main control unit calls the command execution interface and receives the corresponding command execution result in a pre-registered message callback function. When the control device is used as a main control chip, a command task is created, and the command to be executed is called to the command task call. The corresponding command execution result is received in a pre-registered message callback function. By setting the data communication format to JSON, it has excellent compatibility. Due to the characteristics of JSON data, additional custom data can be passed through commands. When developers or users need to use the control device to implement certain functions, they only need to send JSON commands with specific key-value pairs to the software interface. Since it receives commands through a software interface, this application can be used as both a communication module and a functional component, thereby reducing the time and development costs of the corresponding control equipment project. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein:
[0019] Figure 1 This is a schematic diagram of the structure of an embodiment of the control device provided in this application;
[0020] Figure 2This is a schematic diagram of the structure of an embodiment of the software module within the control device provided in this application;
[0021] Figure 3 This is a schematic diagram of the startup process of the software module within the control device provided in this application;
[0022] Figure 4 This is a schematic diagram of the structure of an embodiment of the balanced binary tree model provided in this application;
[0023] Figure 5 This is a schematic diagram of the AVL algorithm processing flow for command registration provided in this application;
[0024] Figure 6 This is a flowchart illustrating the command lookup process provided in this application;
[0025] Figure 7 This is a flowchart illustrating the command execution process provided in this application;
[0026] Figure 8 This is a flowchart illustrating the message callback registration process provided in this application;
[0027] Figure 9 This is a flowchart illustrating the callback execution process provided in this application;
[0028] Figure 10 This is a schematic diagram of another embodiment of the balanced binary tree model provided in this application. Detailed Implementation
[0029] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It is understood that the specific embodiments described herein are only for explaining this application and not for limiting it. Furthermore, it should be noted that, for ease of description, only the parts related to this application are shown in the accompanying drawings, not all structures. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0030] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0031] See Figure 1 , Figure 1This is a schematic diagram of an embodiment of the control device provided in this application. The control device 100 includes: a main control unit 10, a hardware communication interface 20, and a wireless communication interface 30.
[0032] The hardware communication interface 20 is connected to the main control unit 10 and is used to communicate with external devices to conduct data communication. The data communication format is JSON.
[0033] The wireless communication interface 30 is connected to the main control unit 10 and is used to communicate with external devices to conduct data communication. The data communication format is JSON.
[0034] The data communication format between the main control unit 10, the hardware communication interface 20, and the wireless communication interface 30 is JSON format.
[0035] The main control unit 10 is used to receive a first control command sent by the hardware communication interface 20 or the wireless communication interface 30, and return a first execution result after executing the first control command; or, the main control unit 10 is used to send a second control command to an external device through the hardware communication interface 20 or the wireless communication interface 30.
[0036] When the control device 100 is used as a communication module, it receives control commands in JSON format through the hardware communication interface 20 (such as UART) and sends them to the main control unit 10. After receiving the command, the main control unit 10 executes the corresponding function and returns the execution result asynchronously or synchronously through the hardware communication interface 20, that is, returns it to the external device.
[0037] Meanwhile, the control device 100 supports developers and users in adding custom commands.
[0038] When the control device 100 is used as the main control chip, the main control unit 10 registers a message callback function, creates a task call command execution interface, and returns the execution result through the registered message callback function after the command is executed.
[0039] The main control unit 10 is used to register message callback functions and create a task call command execution interface. The target command is called through the task call command execution interface, and the corresponding command execution result is returned through the message callback function after the target command is executed.
[0040] The control device 100 is implemented through the collaboration of hardware and software. The core technology is to use JSON data format for data interaction and binary tree data structure for command management.
[0041] In other embodiments, the control device 100 also includes a power supply and a memory.
[0042] In this manner, when the control device 100 is used as a communication module, the hardware communication interface 20 is initialized. Data received by the hardware communication interface is parsed using JSON. If the data is in JSON format, the main control unit 10 calls the command execution interface and receives the corresponding command execution result in a pre-registered message callback function. When the control device 100 is used as a main control chip, a command task is created and the command execution interface is called. The command to be executed is sent to the command task call, and the corresponding command execution result is received in a pre-registered message callback function. By setting the data communication format to JSON, it offers excellent compatibility. Due to the characteristics of JSON data, additional custom data can be passed through commands. When developers or users need to use the control device to implement certain functions, they only need to send JSON commands with specific key-value pairs to the software interface. Since commands are received through the software interface, this application can be used as both a communication module and a functional component, thereby reducing the time and development costs of the corresponding control device project.
[0043] The software in control device 100 is described below:
[0044] Software modules correspond to their respective hardware modules in function, but the software architecture is highly dependent on the operating system. The entire software architecture, such as... Figure 2 . Figure 2 This is the software architecture supported by the control device. The invention involves simple design and development of application software; the core is the design and development of the components mod and cmd. See [link / reference]. Figure 2 Application modules and component modules.
[0045] Figure 2 The software architecture uses C as its programming language. Its software modules consist of multiple tasks with relatively simple functions, internal isolation, and minimal interfaces. Depending on system reliability and load requirements, these tasks run on two parallel CPUs, or multiple tasks run on a single CPU (depending on the specific ESP32 model). Commands are executed by controlling each hardware module (such as controlling the WiFi radio frequency to send HTTP requests).
[0046] When the control device 100 is used for module communication and as a main control chip, there is little difference in the use of the software modules. The only difference is the way the command execution interface is called. When used for module communication, the command execution interface is called directly through the hardware interface; when used as a main control chip, a task is created and the command execution interface is called.
[0047] The software modules used in this application are highly dependent on the registration of their corresponding components. Only after registration can the corresponding command function be executed through the command execution interface. The software module startup flowchart for the entire device is as follows: Figure 3.
[0048] First, initialize the command management component (mod); then register callback functions, followed by initializing and registering basic commands, WiFi commands, Sockt commands, HTTP commands, Bluetooth commands, and other basic commands. Finally, associate it with the user application layer.
[0049] When the control device starts, various commands and function pointers for executing each command are registered in a binary tree. When a target command is received, the function pointer corresponding to the target command is found by searching the binary tree. When the nodes of the binary tree are unevenly distributed, the time complexity of the search algorithm is between O(log₂N) and O(N).
[0050] In a scenario where device 100 is an ESP32 microcontroller, the software controls the ESP32 peripheral using commands based on JSON data format and an application binary tree data structure. First, upon software startup, the commands and the function pointers executing those commands are registered in the binary tree. When a JSON command is received, the binary tree is searched to find the function pointer to be executed, thus controlling the ESP32 peripheral. Due to the characteristics of binary trees, a uniformly distributed binary search is equivalent to a binary search, while an unevenly distributed tree may result in a left-skewed or right-skewed tree, with a search algorithm time complexity between O(log₂N) and O(N). Therefore, to speed up the binary tree search, the height difference between the left and right subtrees is limited to no more than 1 during command registration, transforming the binary tree into a balanced binary tree (AVL algorithm). In this case, each subtree is a balanced binary tree with uniformly distributed nodes, and the search algorithm time complexity is O(log₂N), effectively reducing command search time and accelerating command response speed. Meanwhile, for thread safety, a message notification chain mechanism is added between driver-layer command execution and application-layer user usage. The message notification chain is constructed using a linked list data structure. Command execution results are returned via message callbacks. Multiple callbacks can be registered, and they are executed in the order of priority set during registration. When a message callback is triggered, a message is sent to the callback execution task via FreeRTOS's message queue mechanism. Finally, the user-registered callback function is called within the task to return the message. This ensures that blocking at the user application layer will not affect command execution at the driver layer. Balanced binary tree model. Figure 4 As shown.
[0051] That is, when the control device registers multiple commands, it limits the height difference between the left and right subtrees of the binary tree to no more than 1, transforming the binary tree into a balanced binary tree, with a search algorithm time complexity of O(log2N).
[0052] Specifically, the AVL algorithm processing flow for command registration is as follows: Figure 5 As shown:
[0053] First, register the name. Then, check if the root node is empty. If it is, insert the command into the root node. If not, compare it with the root node. If it is smaller than the root node, check if the left subtree is empty. If not, treat the left subtree as the root node. If it is, insert the node. If it is larger than the root node, check if the right subtree is empty. If not, treat the right subtree as the root node. If it is, insert the node. If it is equal to the root node, ignore the registration.
[0054] After inserting a node, determine if it is unbalanced. If so, rotate the initial root node to restore balance; otherwise, return the result.
[0055] Specifically, the process for searching commands is as follows: Figure 6 As shown:
[0056] The target command search retrieves the root node command name and compares it to the node name. If the name is smaller than the root node name, it checks if a left subtree exists. If so, the left subtree is taken as the root node; otherwise, NULL is returned. If the name is equal to the root node name, the node is found and returned. If the name is larger than the root node name, it checks if a right subtree exists. If so, the right subtree is taken as the root node; otherwise, NULL is returned.
[0057] Specifically, the command execution process is as follows: Figure 7 As shown: It receives a JSON command and checks if the command key-value pair exists. If so, it searches for the command, checks if the command exists, and if it does, executes the command function and returns the result via callback.
[0058] Specifically, the process for registering message callbacks is as follows: Figure 8 As shown: Register message callback, then determine priority. Specifically, compare the priority of the head node of the linked list. If the priority is lower, the head node of the linked list is moved to the right. If the priority is higher, it is inserted in front of the head node. Then return the result.
[0059] Specifically, the callback execution process is as follows: Figure 9 As shown: The command execution task includes: returning the result via callback, and then sending it to the message queue.
[0060] The callback execution tasks include: waiting for a message callback, determining whether a message callback has been received, and if so, executing the callback function in the linked list.
[0061] In some embodiments, a binary tree data structure is defined using C language software programming techniques, and a binary tree balanced using the AVL algorithm is inserted at command nodes. A command management component mod is developed based on the binary tree data structure.
[0062] Based on the Espressif ESP-IDF framework, write the ESP32 peripheral control component cmd.
[0063] Using C language software programming techniques, the system is built by programming and calling the initialization API of the command management component mod and the command initialization and registration API of the peripheral control component cmd.
[0064] When the communication module is used, it initializes the hardware communication interface (such as UART), parses the data received by the hardware communication interface using JSON, and if it is in JSON format, it calls the command execution interface and receives the result returned by the command execution in the pre-registered message callback function.
[0065] When the main control chip is in use, a command task is created to call the command execution interface, and the command to be executed is sent to the command task call. The result returned by the command execution is received in the pre-registered message callback function.
[0066] For example, based on the ESP32-D0WD chip, use the WT-ESP32_DevKiitc minimum system development board.
[0067] Using the C language, create a new project based on the ESP-IDF framework and port the command management component mod and the peripheral control component cmd.
[0068] Using the C language, the system is built by calling the initialization API of the command management component mod and the command initialization and registration API of the peripheral control component cmd in the new project.
[0069] When using the communication module, open the computer's serial port host computer and connect the WT-ESP32_DevKiitc. Initialize the hardware communication interface UART in code, use the data received from the UART to call the command execution interface, and view the result returned by the command execution in the pre-registered callback function.
[0070] When the main control chip is in use, a command task is created to call the command execution interface. The command to be executed is sent to the command task call through the FreeRTOS message queue. The result returned by the command execution is viewed in the pre-registered callback function.
[0071] To allow users to carry custom identifiers, command recognition only identifies the existence of specific JSON key-value pairs, while other key-value pairs are passed through and returned to the user. Compared to traditional AT commands that require strict adherence to format and parameter count, this allows users to effectively expand application scenarios.
[0072] The advantages and positive effects of this application are:
[0073] The method of controlling the ESP32 is provided in the form of commands, allowing users to drive the ESP32 peripherals directly through commands.
[0074] The command data format is JSON, which is widely used, simple, and highly compatible. Furthermore, due to the characteristics of JSON data, customers can pass in additional custom data through commands.
[0075] Command management uses a balanced binary tree data structure, and the search algorithm has a time complexity of O(log₂N), enabling fast command response.
[0076] The command registration interface is open, allowing users to freely choose which commands to register, saving system space and increasing running speed. Users can also register custom commands to add desired functionality.
[0077] Command execution results are returned via a message notification chain, separating the driver command layer and the user application layer to ensure thread safety. Users can register multiple message callback functions simultaneously and retrieve the required data based on the events returned by the callbacks. When multiple callback functions are registered, they will be executed according to their registration priority.
[0078] When users need to use the ESP32 chip for development projects, they do not need to spend a lot of time learning or developing peripheral functions. They only need to port or use this invention, which can save users a lot of development costs and speed up project implementation (for example, when UI development is involved, they only need to focus on UI design and development).
[0079] In some embodiments, the control device is provided with a message notification chain mechanism to separate the driver command layer and the user application layer. The message notification chain mechanism is constructed using a linked list data structure.
[0080] The control device includes: a memory that stores the probability of the call history corresponding to each command; and a control unit that assigns values to the nodes of the binary tree according to the probability of the call history corresponding to each command.
[0081] The process involves arranging multiple commands in ascending order of probability, using the probabilities of the first two commands as the left and right nodes of the binary tree, and adding the probabilities of the first two commands together to obtain the probability of the root node. The root node and the remaining commands are then arranged in ascending order of probability to obtain the final binary tree.
[0082] For example, the probability of registration commands is assigned based on the command call history stored in the flash memory. For instance, the probabilities of Wi-Fi, Bluetooth, basic, and HTTP registration commands are 0.125, 0.125, 0.5, and 0.25, respectively. These probabilities are then arranged in ascending order. The two probabilities with the lowest probabilities are extracted and used as the left and right child nodes (generally, the left child's path is set to "0" and the right child's path to "1"). These are added together to obtain the root node. The root node value is then added to a queue and re-queued. The same process is repeated, extracting the two lowest probabilities as child nodes and adding them together to obtain the root node. This process is continued until all probability elements in the queue are cleared, resulting in a binary tree.
[0083] Specifically, as shown in the table below:
[0084] Registration command Wifi Bluetooth Base http probability values 0.125 0.125 0.5 0.25 First sort 1 2 4 3 probability values 0.25 0.5 0.25 Second sorting 1 3 2 probability values 0.5 0.5 Third sorting 1 2
[0085] That is, firstly, the four probabilities are sorted, and wifi (0.125) and Bluetooth (0.125) are extracted and added together to form root node 1 (0.25). The root node (0.25) is then sorted again with the remaining base (0.5) and http (0.25). The two smallest values, root node 1 (0.25) and http (0.25), are taken as leaf nodes and added together to form root node 2 (0.5). Finally, the queue is left with root node 2 (0.5) and base (0.5), which are added together to form root node 3 (1), as shown below. Figure 10 As shown.
[0086] In a binary tree, the path length is the sum of the path lengths from the root to each node, denoted as WPL.
[0087] WPL=(W1*L1+W2*L2+W3*L3+...+Wn*Ln).
[0088] N weights Wi (i=1,2,…n) form a binary tree with N leaf nodes, and the path length of the corresponding leaf node is Li (i=1,2,…n).
[0089] Based on the command call history stored in flash, the probability of updating the registered command node will be used to update the balanced binary tree to the optimal binary tree, thereby achieving the optimal registration command call, improving data utilization efficiency, and enhancing the user experience.
[0090] The wireless communication interface 30 includes a Wi-Fi communication interface and a Bluetooth communication interface.
[0091] The hardware communication interface 20 includes an IIC communication interface, a UART communication interface, and an SPI communication interface.
[0092] In the several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
[0093] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0094] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0095] If the integrated units in the other embodiments described above are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0096] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A control device, characterized in that, The control device includes: Main control unit; A hardware communication interface, connected to the main control unit, is used to communicate with external devices to perform data communication with the external devices; A wireless communication interface is connected to the main control unit and is used to communicate with external devices to perform data communication with the external devices. The data communication format between the main control unit, the hardware communication interface, and the wireless communication interface is JSON format; When the communication module of the control device is used, the hardware communication interface is initialized, and the data received by the hardware communication interface is parsed using JSON. If it is in JSON format, the main control unit calls the command execution interface and receives the corresponding command execution result in the pre-registered message callback function. When the main control chip of the control device is in use, a command task is created to call the command execution interface, and the command to be executed is sent to the command task call. The corresponding command execution result is received in the pre-registered message callback function. The main control unit is used to receive a first control command sent by the hardware communication interface or the wireless communication interface, and return a first execution result after executing the first control command; or, the main control unit is used to send a second control command to an external device through the hardware communication interface or the wireless communication interface. The main control unit is used to register message callback functions and create task call command execution interfaces. The target command is called through the task call command execution interface, and the corresponding command execution result is returned through the message callback function after the target command is executed. When the control device starts, multiple commands and function pointers for executing each command are registered in a binary tree. When a target command is received, the function pointer corresponding to the target command is found by searching the binary tree. In the case that the nodes of the binary tree are unevenly distributed, the time complexity of the search algorithm is between O(log₂n) and O(n). When registering multiple commands, the control device limits the height difference between the left and right subtrees of the binary tree to no more than 1, transforming the binary tree into a balanced binary tree. The search algorithm has a time complexity of O(log₂n). The control device is equipped with a message notification chain mechanism, which separates the driver command layer and the user application layer. The message notification chain mechanism is constructed using a linked list data structure. The control device includes: a memory, which stores the call history probability corresponding to each command, and the control unit assigns values to the nodes of the binary tree according to the call history probability corresponding to each command; Arrange multiple commands in ascending order of probability, use the probabilities of the first two commands as the left and right nodes of the binary tree, and add the probabilities of the first two commands to get the probability of the root node; then arrange the root node and the remaining commands in ascending order of probability to obtain the final binary tree. The path length of the binary tree is the sum of the path lengths from the root to each node, denoted as WPL. WPL=(W1) L1+W2 L2+W3 L3+...+Wn Ln) , n weights Wi, i=1,2,…,n This forms a binary tree with n leaf nodes, where the path length of each leaf node is Li, i = 1, 2, ..., n; The balanced binary tree is updated to the optimal binary tree based on the probability of updating the registered command node according to the command call history stored in flash.
2. The control device according to claim 1, characterized in that, The wireless communication interface includes a Wi-Fi communication interface and a Bluetooth communication interface.
3. The control device according to claim 1, characterized in that, The hardware communication interfaces include an IIC communication interface, a UART communication interface, and an SPI communication interface.
Citation Information
Patent Citations
Multithreading real-time data processing device and method
CN102486740A
Method and apparatus for a hardware-implemented AVL tree module
US10095765B1
Vehicle-road collaboration apparatus and method, electronic device, and storage medium
US20210409917A1