Controller function updating method and device and storage medium
By introducing functional interfaces and external media into the controller, modular management and update of controller functions is solved, and the problem of shutdown of controller program updates in the prior art is solved, and the function update of non-stop is achieved.
Patent Information
- Application Number
- CN202411790912.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-04-15
AI Technical Summary
In the prior art, the controller program needs to be shut down when updating, resulting in the equipment not being able to operate normally, causing inconvenience to users and increasing the cumbersomeness of program testing and updates.
By introducing a functional interface into the controller, an external medium storing the executable file with corresponding functions is connected to the controller to load and update functions. Detect the connection status of the function interface, remove or modify functions based on user feedback, or add new functions without shutdown.
It realizes modular management of controller functions, facilitates function updates, and updates corresponding functions through connection and disconnection of external media without shutdown, improving update efficiency and convenience.
Smart Images

Figure CN119828636A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of program update technology, and in particular to a controller function update method, device and storage medium. Background Art
[0002] At present, the program update method of controllers in industrial systems is mainly to stop the controller for updating. That is, when updating, it is often necessary to stop the controlled device or switch the controller to local mode. In local mode, the controller enters the update state and cannot control the controlled device. The above method requires shutdown during program update, and the device cannot operate normally, which brings inconvenience to users and increases the complexity of program testing and updating.
[0003] With regard to the problem in the prior art that the controller needs to be shut down when updating the program, no effective solution has been proposed yet. Summary of the invention
[0004] The embodiments of the present invention provide a controller function update method, device and storage medium, so as to at least solve the problem in the prior art that the controller needs to be shut down when updating the program.
[0005] To solve the above technical problems, an embodiment of the present invention provides a controller function update method, wherein the controller includes at least one function interface corresponding to different functions, and the function interface is used to connect an external medium storing an executable file of the corresponding function. The controller loads an executable file of any function from the external medium into a memory and converts it into a process, and the process can run normally, indicating that the controller has the function. The method includes:
[0006] Check the connection status of each functional interface;
[0007] If it is detected that the external media is disconnected, remove the existing function or wait to modify the existing function based on user feedback;
[0008] If it is detected that an external medium is connected, the existing functions are modified or new functions are added according to the executable files in the connected external medium.
[0009] Optionally, remove existing features or wait for modifications based on user feedback, including:
[0010] Output prompt information to prompt the user to choose whether to remove or modify the existing function;
[0011] Receive user feedback;
[0012] A function update flag of a target function is assigned a value according to the user feedback, and a process of the target function is processed, wherein the target function is an existing function corresponding to the disconnected external medium.
[0013] Optionally, assigning a function update flag of the target function according to the user feedback includes:
[0014] If the user feedback is to modify an existing function, assigning a function update flag bit of the target function to a first value;
[0015] If the user feedback is to remove an existing function, the function update flag of the target function is assigned a second value.
[0016] Optionally, processing the process of the target function includes:
[0017] If the user feedback is to modify an existing function, retain the process of the target function;
[0018] If the user feedback is to remove an existing function, the communication connection between the process of the target function and the process of the controller main program is disconnected, the process of the target function is terminated, and the removal of the existing function is completed.
[0019] Optionally, modify existing functions or add new functions according to the executable files in the connected external media, including:
[0020] Obtaining the value of the function update flag corresponding to the connected external medium;
[0021] If the function update flag corresponding to the connected external medium is a first value, modifying the existing function according to the executable file in the connected external medium;
[0022] If the function update flag corresponding to the connected external medium is the second value, a new function is added according to the executable file in the connected external medium.
[0023] Optionally, modify existing functions according to executable files in the connected external media, including:
[0024] Reading an executable file from the connected external medium;
[0025] Loading the read executable file into the memory as a new executable file of the existing function, executing the new executable file and starting the corresponding process;
[0026] Establishing a communication connection between the process of the new executable file and the process of the controller main program;
[0027] When the process of the original executable file of the existing function in the memory does not interact with the controller main program for data, the communication connection between the process of the original executable file and the process of the controller main program is disconnected, the process of the original executable file is terminated, and the modification of the existing function is completed.
[0028] Optionally, new functions are added based on executable files in the connected external media, including:
[0029] Reading an executable file from the connected external medium;
[0030] Load the read executable file into the memory, execute the executable file and start the corresponding process;
[0031] A communication connection is established between the process of the executable file and the process of the controller main program to complete the addition of new functions.
[0032] Optionally, before loading the read executable file into memory, also include:
[0033] Determining whether the identifier of the read executable file matches the function identifier of the function interface to which the connected external medium is connected;
[0034] If they match, allowing the function update based on the read executable file;
[0035] If they do not match, an error message will be output.
[0036] The embodiment of the present invention further provides a controller function update device, wherein the controller includes at least one function interface corresponding to different functions, and the function interface is used to connect an external medium storing an executable file of the corresponding function. The controller loads an executable file of any function from the external medium into a memory and converts it into a process, and the process can run normally, indicating that the controller has the function. The device includes:
[0037] A detection module, used to detect the connection status of each functional interface;
[0038] A first update module is used to remove existing functions or wait for modification of existing functions according to user feedback if it is detected that an external medium is disconnected;
[0039] The second update module is used to modify existing functions or add new functions according to the executable files in the connected external medium if it is detected that an external medium is connected.
[0040] The embodiment of the present invention further provides a non-volatile computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the controller function updating method described in the embodiment of the present invention is implemented.
[0041] By applying the technical solution of the present invention, the functions of the controller are modularized, and the functions are externalized through functional interfaces and external media. The software functions can be separated by physical media, thereby enabling modular management and facilitating function updates. The corresponding functions are updated by connecting and disconnecting the external media without shutting down the machine. Even if an existing function is modified, the original executable file of the corresponding function in the memory can still run before the new executable file runs normally, thus realizing non-stop updates. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 is a flow chart of a controller function updating method provided by an embodiment of the present invention;
[0043] Figure 2 is a schematic diagram of the overall architecture of a controller provided by an embodiment of the present invention;
[0044] Figure 3 is a schematic diagram of a controller implementing a functional interface provided by an embodiment of the present invention;
[0045] Figure 4 is a schematic diagram of the operation of the controller provided by an embodiment of the present invention;
[0046] Figure 5 is a schematic diagram of the connection between the real-time operating system and the external medium provided by an embodiment of the present invention;
[0047] Figure 6 is an overall flow chart of controller function update provided by an embodiment of the present invention;
[0048] Figure 7 is a specific flow chart of old function update provided by an embodiment of the present invention;
[0049] Figure 8 It is a structural block diagram of a controller function updating device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0051] It should be noted that the terms "first", "second", etc. in the specification, claims and drawings of the present invention are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0052] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0053] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0054] The optional embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0055] Example 1
[0056] This embodiment provides a controller function update method, which can achieve non-stop update.
[0057] In this embodiment, the programs in the controller can be divided into: main program and other programs. The main program is a program that is always executed in the controller. Other programs can be further divided into different functions according to actual conditions, such as unit functions, valve functions, water pump functions, etc. These functions include essential functions and optional functions.
[0058] The controller includes at least one functional interface, which corresponds to different functions of the controller. The functional interface is used to connect an external medium storing an executable file of the corresponding function. The external medium has a storage function and can be a USB flash drive, a mobile phone, etc. The functional interface can be connected in a USB, WiFi, etc.
[0059] The controller loads the executable file of any function from the external medium into the memory and converts it into a process, and the process can run normally, which means that the controller has the function, that is, the function is an existing function of the controller. When the controller executes an existing function, it runs the process of the corresponding executable file in the memory, which does not depend on the external medium.
[0060] The corresponding functions are updated by connecting and disconnecting the external medium. Functional updates include deletion, addition and modification of functions. For example, the function interface is connected to the external medium, and the executable file in the external medium is loaded into the memory and made to run normally, thereby adding the corresponding functions; disconnecting a certain external medium can remove the corresponding functions; disconnecting a certain external medium, downloading a new executable file of the corresponding function to the external medium through the computer, and connecting the external medium to the corresponding function interface again, then the new executable file can be loaded into the memory to realize the function modification. This embodiment modularizes the functions of the controller and externalizes the functions to realize modular management, which is convenient for function updates.
[0061] For example, the controller includes four functional interfaces, namely: functional interface 1 (corresponding to function a), functional interface 2 (corresponding to function b), functional interface 3 (corresponding to function c), and functional interface 4 (extended interface, corresponding to extended function). External medium A stores the executable file of function a. When external medium A is connected to functional interface 1, the controller loads the executable file of function a from external medium A into the memory, and the executable file can run normally in the memory, so the controller has function a. If functional interface 2 has never been connected to an external medium, the controller does not have function b.
[0062] Figure 1 is a flow chart of a controller function updating method provided by an embodiment of the present invention, such as Figure 1 As shown, the method comprises the following steps:
[0063] S101, detecting the connection status of each functional interface.
[0064] S102: If it is detected that the external medium is disconnected, the existing function is removed or the existing function is waited to be modified according to the user feedback.
[0065] S103: If it is detected that an external medium is connected, modify the existing functions or add new functions according to the executable files in the connected external medium.
[0066] Among them, the user refers to the person who performs function updates, such as designers, staff, after-sales personnel, users, etc. Waiting for modification of an existing function means waiting for the function interface corresponding to the existing function to be connected to the external medium again to obtain a new executable file. An existing function refers to any function that the controller currently has, and a new function refers to a function that the controller does not currently have. In this embodiment, the existing function to be modified or removed is specifically the function corresponding to the currently disconnected external medium, and the new function to be added is specifically the function corresponding to the currently connected external medium. In essence, the function corresponding to the external medium is determined by the function interface to which the external medium is connected.
[0067] This embodiment modularizes the functions of the controller and implements external functions through functional interfaces and external media. Software functions can be separated by physical media, thereby enabling modular management and facilitating function updates. Corresponding functions are updated through the connection and disconnection of external media without shutting down the system. Even when modifying existing functions, the original executable file of the corresponding function in the memory can still run before the new executable file runs normally, thus realizing non-stop updates.
[0068] In an optional embodiment, removing an existing function or waiting to modify an existing function based on user feedback includes: outputting prompt information to prompt the user to choose whether to remove the existing function or modify the existing function; receiving user feedback; assigning a function update flag of a target function based on the user feedback, and processing the process of the target function, wherein the target function is an existing function corresponding to the disconnected external medium.
[0069] Each function has its own corresponding function update flag, which is used to mark specific update requirements to facilitate subsequent execution of corresponding operations.
[0070] When the present embodiment detects that an external medium is disconnected, it determines whether an existing function needs to be removed or modified based on user feedback, and processes the function update flag and process of the existing function accordingly according to the specific update requirements, so as to quickly complete the function update without shutting down the system.
[0071] Specifically, assigning a function update flag of the target function according to the user feedback includes:
[0072] If the user feedback is to modify an existing function, assigning a function update flag bit of the target function to a first value;
[0073] If the user feedback is to remove an existing function, the function update flag of the target function is assigned a second value.
[0074] The first value is not equal to the second value, for example, the first value is 1 and the second value is 0. For functions that the controller has never had, the function update flag bit defaults to the second value, that is, the function update flag bit of the removed function or the function that the controller has never had is the second value.
[0075] This embodiment assigns values to relevant function update flags according to specific update requirements, thereby facilitating subsequent execution of corresponding operations.
[0076] Specifically, the process of the target function is processed, including:
[0077] If the user feedback is to modify an existing function, retain the process of the target function;
[0078] If the user feedback is to remove an existing function, the communication connection between the process of the target function and the process of the controller main program is disconnected, the process of the target function is terminated, and the removal of the existing function is completed.
[0079] This embodiment processes the processes of related functions according to specific update requirements. When an existing function needs to be removed, the communication connection and process of the function are closed, and the function is removed in a timely manner while releasing controller resources. When an existing function needs to be modified, the process of the function is retained to ensure subsequent non-stop updates, prevent data loss during the period when the connection is disconnected from the external medium and the update is successful, and prevent update failure.
[0080] In an optional embodiment, modifying existing functions or adding new functions according to the executable file in the connected external medium includes:
[0081] Obtaining the value of the function update flag corresponding to the connected external medium;
[0082] If the function update flag corresponding to the connected external medium is a first value, modifying the existing function according to the executable file in the connected external medium;
[0083] If the function update flag corresponding to the connected external medium is the second value, a new function is added according to the executable file in the connected external medium.
[0084] If the function update flag corresponding to the connected external medium is the first value, it can be confirmed that the update requirement is to modify the existing function. If the function update flag corresponding to the connected external medium is the second value, it means that the controller currently does not have the function, and it can be confirmed that the update requirement is to add a new function.
[0085] This embodiment can simply and quickly determine specific update requirements based on the function update flag, facilitate subsequent execution of the corresponding update process, and improve function update efficiency.
[0086] The condition for the normal operation of the controller function is that the executable file corresponding to the function is loaded into the controller memory, and the process of the function (or the process of the executable file of the function) is successfully connected to the process of the controller main program. The communication connection between processes is the data transmission channel between programs, which can realize the data interaction between the main program and the function. The specific communication method can be TCP, UDP, etc.
[0087] Therefore, when adding new functions and modifying existing functions, the main operations that need to be completed are loading executable files, creating processes, and establishing communication connections.
[0088] Specifically, adding a new function according to an executable file in an external medium includes: reading an executable file from the external medium; loading the read executable file into a memory, executing the executable file and starting a corresponding process; establishing a communication connection between the process of the executable file and the process of the controller main program to complete the addition of the new function. This embodiment achieves the addition of new functions simply and efficiently without stopping the system by accessing an external medium.
[0089] Specifically, modifying an existing function according to an executable file in an accessed external medium includes: reading an executable file from the accessed external medium; loading the read executable file into a memory as a new executable file of the existing function, executing the new executable file and starting a corresponding process; establishing a communication connection between the process of the new executable file and the process of a controller main program; and when the process of the original executable file of the existing function in the memory does not interact with the controller main program for data, disconnecting the communication connection between the process of the original executable file and the process of the controller main program, terminating the process of the original executable file, and completing the modification of the existing function.
[0090] This embodiment first obtains a new executable file and makes it run normally by accessing an external medium, and then processes the original executable file in the memory, so that before the new executable file can run normally, the original executable file can continue to run, thereby simply and efficiently implementing the modification of existing functions without stopping the system. In addition, the communication connection between the original executable file and the main program is disconnected only when there is no data interaction between the original executable file and the main program, so as to avoid data interaction errors and ensure data accuracy.
[0091] When establishing a communication connection, if a successful communication connection message is not received within a preset time, a communication failure prompt is output to enable staff to conduct fault detection and repair in a timely manner.
[0092] The main program can set two communication ports for each function. For example, the original executable file of any function is connected to the main program process through one port, and the new executable file of the function is connected to the main program process through another port.
[0093] In an optional embodiment, before loading the read executable file into the memory, it also includes: judging whether the identifier of the read executable file matches the function identifier of the function interface connected to the connected external medium; if it matches, allowing the function update based on the read executable file, that is, the subsequent operation can be performed; if it does not match, outputting a file error prompt. In this way, the correspondence between the executable file and the function can be ensured, and the required executable file is obtained.
[0094] For extended functions, their function identifiers can be pre-set and assigned to corresponding extended interfaces. When an extended function needs to be added, its executable file is set to a matching identifier and stored in an external medium, which is then connected to the corresponding function interface to implement the addition of new functions. It is also possible not to set the function identifier of an extended function. For example, neither of the two extended interfaces has a corresponding function identifier. When the extended interface is connected to an external medium, if the identifier of the executable file in the external medium does not match any of the known function identifiers, it is considered to be an extended function. The function identifier of the extended function is determined based on the identifier of the executable file (for example, the identifier of the executable file is directly used as the identifier of the extended function). If the identifiers match, function updates based on the executable file are allowed.
[0095] In practical applications, the executable file in the external medium can be encrypted. When the controller reads the executable file from the external medium, it can obtain the executable file after decrypting it using a pre-agreed key, thereby ensuring the security of data transmission.
[0096] Example 2
[0097] Based on the above embodiment, this embodiment describes the controller function update method in combination with a specific embodiment. However, it is worth noting that this specific embodiment is only for better illustrating the present application and does not constitute an improper limitation on the present application. The explanation of terms that are the same or corresponding to the above embodiment will not be repeated in this embodiment.
[0098] Take cold storage group control products as an example. Figure 2The figure shows the architecture of the cold station control cabinet (i.e., controller). A real-time operating system, such as Linux, Windows, etc., is installed in the field control cabinet. The real-time operating system can act as a host to directly or indirectly control the operation of the equipment in the cold storage, or as a slave to respond to the communication needs of the BMS system. The control cabinet is a collection of modules with many functions for designers. Combined with actual needs, the software level can be divided into: cold machine function module, database function module, AI intelligent control function module, front-end and control architecture function module.
[0099] like Figure 3 As shown in FIG. 1 , it is a schematic diagram of a controller realizing a functional interface. The real-time operating system 10 may be a device integrated with a touch screen. The interface device 20 is connected to the real-time operating system 10 via a bus 30. The interface device 20 includes four functional interfaces 21 for connecting to an external medium. The four functional interfaces 21 correspond to Figure 2 The interface device further includes a bus interface 22 for connecting to the real-time operating system 10 via a bus 30. Designers can insert the corresponding hardware external medium into the corresponding function interface to increase, reduce or modify the controller function. By plugging and unplugging the external medium, combined with the controller function update method described in the above embodiment, non-stop update can be achieved.
[0100] like Figure 4 As shown, it is a schematic diagram of the controller operation. Through the bus interface circuit, multiple functions can be mounted on the bus. The real-time operating system application layer drives the bus interface circuit by calling the real-time operating system driver layer to access the executable file in the external medium, read the executable file in the external medium through the bus, load it into the memory, and implement multiple executable files in parallel on the application layer. The executable file controls the corresponding control system driver, and realizes the communication requirements with the other master and slave machines in the system through the communication bus. The real-time operating system application layer can call the real-time operating system driver layer or the control system driver to drive the corresponding device or function to perform the action of opening, writing, reading or controlling.
[0101] like Figure 5As shown, it is a connection diagram between the real-time operating system and the external medium. The main node is the main program. Different types of equipment in the water system correspond to different media. The front-end node corresponds to a medium. UDP is used to connect the various modules of the water system to the main node. Other interface modules are connected to the main node through the TCP network, and each independent function can correspond to an independent medium. The real-time operating system periodically detects the connection status with the external medium. For example, after the external medium 2 is inserted into the functional interface of the water pump function, the real-time operating system loads the executable file in the medium into the memory, executes the executable file in the memory and starts the corresponding process, and establishes a communication connection between the process and the main program process. Thus, the real-time operating system has the water pump function. After that, when the water pump function needs to be executed, the real-time operating system runs the executable file in the memory, that is, the operation of the function does not depend on the external medium. If the water pump function needs to be updated, the external medium 2 inserted into the functional interface of the water pump function is disconnected, and the new executable file of the water pump function is written into the external medium 2 through the computer. After that, the external medium 2 is inserted into the functional interface of the water pump function again. During this period, the original executable file of the water pump function in the memory can continue to run without stopping. When the new executable file is loaded into the memory, the new executable file is first run to replace the original executable file, and then the communication connection and process of the original executable file are closed to complete the update. The real-time operating system can naturally run new and old programs of the same function.
[0102] The database function can record operating data, which can be recorded synchronously in the controller memory and the corresponding external medium. If the controller does not have an Internet connection function but needs to transmit data, the external medium corresponding to the database function can be disconnected and connected to the computer to achieve data transmission. In other words, when the external medium corresponding to the database function is disconnected, in addition to removing and modifying existing functions, you can also choose to transmit data. Through modular management of controller functions, it is easy to obtain operating data, and it is also easy to debug the program during the controller function update process, determine whether the parameters are appropriate, and repeat the update verification, which simplifies the operation process.
[0103] like Figure 6 As shown, it is the overall flow chart of controller function update, which includes the following steps:
[0104] S601, the real-time operating system polls the external medium.
[0105] S602: It is detected that the external medium is disconnected.
[0106] S603, a pop-up window outputs prompt information, asking the user to update the old function or remove the old function. If the user chooses to update the old function (i.e., modify the existing function), enter S604; if the user chooses to remove the old function (i.e., remove the existing function), enter S605.
[0107] S604, the function update flag value of the old function is set to 1, the process of the old function is retained, and the function interface is waited for to be connected to the external medium again.
[0108] S605, setting the value of the function update flag of the old function to 0, disconnecting the communication connection between the process of the old function and the process of the main program, and terminating the process of the old function.
[0109] S606, complete the removal of old functions.
[0110] S607: Detect that an external medium is connected.
[0111] S608, determine whether the function update flag corresponding to the function interface of the access medium is 1, if so, it means that the old function needs to be updated, and enter S609, if not, it means that a new function needs to be added, and enter S613.
[0112] S609, read the file identifier in the medium, and determine whether the file in the medium matches the function of the connected functional interface. If so, it is the required file, and enter S610; if not, enter S612.
[0113] S610, loading the file in the medium into the memory and executing it, starting a new process of the old function, establishing a communication connection between the new process and the main program process, and closing the original process of the old function and its communication connection.
[0114] S611, completed the old function update.
[0115] S612, notifying the user of a file error.
[0116] S613, read the file identifier in the medium, and determine whether the file in the medium matches the function of the connected functional interface. If so, it is the required file and enter S614. If not, enter S612.
[0117] S614, loading the file in the medium into the memory and executing it, starting the process of the new function, and establishing a communication connection between the process of the new function and the main program process.
[0118] S615, complete the addition of new functions.
[0119] like Figure 7 As shown, the specific process of updating the old function includes the following steps (i.e., the specific steps of S610):
[0120] S701, the real-time operating system loads the new executable file in the inserted external medium into the memory, executes the new executable file and starts a new process, and uses the backup network path corresponding to the function for communication connection. For example, the main program reserves two communication ports for function a, which are port 1 and port 2. If the original executable file of function a communicates with the main program through port 1, then the new executable file of function a communicates with the main program through port 2. Specifically, the communication connection between programs can be established by establishing a socket.
[0121] S702, the main program detects whether the new executable file is successfully connected, if yes, enter S703, if not, enter S707. Specifically, the main program requests to establish a communication connection with the new executable file, if the connection is successful, the new executable file will send a connection success message to the main program, if the master node does not receive the message within a preset time, it indicates that the connection failed.
[0122] S703, detect whether the original executable file of the function is in an updateable state, if not, enter S704, if not, enter S705. Specifically, the original executable file is a running program, and it is determined whether the original executable file is exchanging data with the main program. If data is being exchanged, it means that the original executable file is in a non-updatable state. If the program is interrupted at this time, a data exchange error will occur; if no data exchange is performed, it means that the original executable file is in an updateable state.
[0123] S704, waiting for the original executable file to be in an updateable state.
[0124] S705, closing the communication connection between the process of the original executable file and the main program process, and closing the process of the original executable file.
[0125] S706, completing the old function update.
[0126] S707, waiting timeout, outputting a new executable file communication failure prompt.
[0127] This embodiment modularizes the functions of the controller and implements external functions through functional interfaces and external media. Software functions can be separated by physical media, thereby enabling modular management and facilitating function updates. Corresponding functions are updated through the connection and disconnection of external media without shutting down the system. Even when modifying existing functions, the original executable file of the corresponding function in the memory can still run before the new executable file runs normally, thus realizing non-stop updates.
[0128] This embodiment provides a plug-and-play controller function update solution. The software functions can be separated by physical media. Through the hardware-separated software layer module of the controller, the software functions are added, deleted, and modified by hardware plug-in and unplug, thereby realizing non-stop update of the controller functions. Different soft function modules are stored in corresponding external media respectively, and the controller operates the corresponding media to realize externalization of the controller function module, simplify the operation process, and facilitate modular management. By reading the executable file in the inserted external medium and linking and running it in the real-time operating system, the control system plug-in soft function component is realized.
[0129] Example 3
[0130] Based on the same inventive concept, this embodiment provides a controller function update device, which can be used to implement the controller function update method described in the above embodiment. The controller function update device can be implemented by software and / or hardware, and the controller function update device can generally be integrated into a controller. The controller includes at least one functional interface, which corresponds to different functions respectively. The functional interface is used to connect to an external medium storing an executable file of the corresponding function. The controller loads the executable file of any function from the external medium into the memory and converts it into a process, and the process can run normally, indicating that the controller has the function.
[0131] Figure 8 is a structural block diagram of a controller function updating device provided by an embodiment of the present invention, such as Figure 8 As shown, the controller function updating device includes:
[0132] A detection module 81 is used to detect the connection status of each functional interface;
[0133] A first updating module 82 is used to remove existing functions or wait for modification of existing functions according to user feedback if it is detected that an external medium is disconnected;
[0134] The second updating module 83 is used to modify existing functions or add new functions according to the executable files in the connected external medium if it is detected that an external medium is connected.
[0135] Optionally, the first updating module 82 includes:
[0136] The output unit is used to output prompt information to prompt the user to choose whether to remove the existing function or modify the existing function;
[0137] A receiving unit, used for receiving user feedback;
[0138] A processing unit is used to assign a function update flag of a target function according to the user feedback, and to process a process of the target function, wherein the target function is an existing function corresponding to the disconnected external medium.
[0139] Optionally, the processing unit includes:
[0140] A first processing subunit is configured to assign a function update flag bit of the target function to a first value if the user feedback is to modify an existing function;
[0141] The second processing subunit is configured to assign a function update flag of the target function to a second value if the user feedback is to remove an existing function.
[0142] Optionally, the processing unit includes:
[0143] A third processing subunit, configured to retain the process of the target function if the user feedback is to modify an existing function;
[0144] The fourth processing sub-unit is used to disconnect the communication connection between the process of the target function and the process of the controller main program if the user feedback is to remove the existing function, end the process of the target function, and complete the removal of the existing function.
[0145] Optionally, the second updating module 83 includes:
[0146] An acquiring unit, used for acquiring a value of a function update flag bit corresponding to the connected external medium;
[0147] A first updating unit, configured to modify an existing function according to an executable file in the connected external medium if the function update flag corresponding to the connected external medium is a first value;
[0148] The second updating unit is used to add a new function according to the executable file in the connected external medium if the function update flag corresponding to the connected external medium is a second value.
[0149] Optionally, the first updating unit includes:
[0150] A first reading subunit, used for reading an executable file from the connected external medium;
[0151] A first loading subunit is used to load the read executable file into the memory as a new executable file of the existing function, execute the new executable file and start the corresponding process;
[0152] A first establishing subunit is used to establish a communication connection between the process of the new executable file and the process of the controller main program;
[0153] The control subunit is used to disconnect the communication connection between the process of the original executable file with the existing function in the memory and the process of the controller main program when the process of the original executable file with the existing function does not interact with the controller main program, terminate the process of the original executable file, and complete the modification of the existing function.
[0154] Optionally, the second updating unit includes:
[0155] A second reading subunit, used for reading an executable file from the connected external medium;
[0156] A second loading subunit, used to load the read executable file into the memory, execute the executable file and start the corresponding process;
[0157] The second establishing subunit is used to establish a communication connection between the process of the executable file and the process of the controller main program to complete the addition of new functions.
[0158] Optionally, the first updating unit or the second updating unit further includes:
[0159] A judgment subunit, used for judging whether the identifier of the read executable file matches the function identifier of the function interface to which the connected external medium is connected before loading the read executable file into the memory;
[0160] an allowing subunit, for allowing function update based on the read executable file if a match is found;
[0161] The output subunit is used to output a file error prompt if there is a mismatch.
[0162] The controller function updating device can execute the controller function updating method provided by the embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. For technical details not described in detail in this embodiment, please refer to the controller function updating method provided by the embodiment of the present invention.
[0163] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0164] Example 4
[0165] This embodiment provides a controller, which includes at least one functional interface corresponding to different functions. The functional interface is used to connect to an external medium that stores executable files of corresponding functions. The controller loads the executable file of any function from the external medium into the memory and converts it into a process. The process can run normally, indicating that the controller has the function. The controller includes the controller function update device described in the above embodiment.
[0166] Example 5
[0167] This embodiment provides a non-volatile computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the controller function update method described in the above embodiment is implemented.
[0168] Example 6
[0169] This embodiment provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the controller function updating method described in the above embodiment when executing the computer program.
[0170] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0171] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A controller function update method, characterized in that: The controller includes at least one functional interface corresponding to different functions, and the functional interface is used to connect to an external medium storing an executable file of the corresponding function. The controller loads an executable file of any function from the external medium into the memory and converts it into a process, and the process can run normally, indicating that the controller has the function. The method includes: Check the connection status of each functional interface; If it is detected that the external media is disconnected, remove the existing function or wait to modify the existing function based on user feedback; If it is detected that an external medium is connected, the existing functions are modified or new functions are added according to the executable files in the connected external medium.
2. The method according to claim 1, characterized in that Remove existing features or wait for modification based on user feedback, including: Output prompt information to prompt the user to choose whether to remove or modify the existing function; Receive user feedback; A function update flag of a target function is assigned a value according to the user feedback, and a process of the target function is processed, wherein the target function is an existing function corresponding to the disconnected external medium.
3. The method according to claim 2, characterized in that Assigning a function update flag of the target function according to the user feedback includes: If the user feedback is to modify an existing function, assigning a function update flag bit of the target function to a first value; If the user feedback is to remove an existing function, the function update flag of the target function is assigned a second value.
4. The method according to claim 2, characterized in that: Processing the process of the target function includes: If the user feedback is to modify an existing function, retain the process of the target function; If the user feedback is to remove an existing function, the communication connection between the process of the target function and the process of the controller main program is disconnected, the process of the target function is terminated, and the removal of the existing function is completed.
5. The method according to claim 1, characterized in that Modify existing functions or add new functions based on the executable files in the connected external media, including: Obtaining the value of the function update flag corresponding to the connected external medium; If the function update flag corresponding to the connected external medium is a first value, modifying the existing function according to the executable file in the connected external medium; If the function update flag corresponding to the connected external medium is the second value, a new function is added according to the executable file in the connected external medium.
6. The method according to claim 5, characterized in that Modify existing functions based on executable files in external media, including: Reading an executable file from the connected external medium; Loading the read executable file into the memory as a new executable file of the existing function, executing the new executable file and starting the corresponding process; Establishing a communication connection between the process of the new executable file and the process of the controller main program; When the process of the original executable file of the existing function in the memory does not interact with the controller main program for data, the communication connection between the process of the original executable file and the process of the controller main program is disconnected, the process of the original executable file is terminated, and the modification of the existing function is completed.
7. The method according to claim 5, characterized in that Add new functions based on executable files in external media, including: Reading an executable file from the connected external medium; Load the read executable file into the memory, execute the executable file and start the corresponding process; A communication connection is established between the process of the executable file and the process of the controller main program to complete the addition of new functions.
8. The method according to claim 6 or 7, characterized in that: Before loading the read executable file into memory, it also includes: Determining whether the identifier of the read executable file matches the function identifier of the function interface to which the connected external medium is connected; If they match, allowing the function update based on the read executable file; If they do not match, an error message will be output.
9. A controller function updating device, characterized in that: The controller includes at least one functional interface corresponding to different functions, and the functional interface is used to connect to an external medium storing an executable file of the corresponding function. The controller loads an executable file of any function from the external medium into the memory and converts it into a process, and the process can run normally, indicating that the controller has the function. The device includes: A detection module, used to detect the connection status of each functional interface; A first update module is used to remove existing functions or wait for modification of existing functions according to user feedback if it is detected that an external medium is disconnected; The second update module is used to modify existing functions or add new functions according to the executable files in the connected external medium if it is detected that an external medium is connected.
10. A non-volatile computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the controller function updating method according to any one of claims 1 to 8 is implemented.