Control method for printer, printer and storage medium
By designing a modular structure of the control motherboard and multiple functional daughterboards in the printer, the problem of existing printers needing to replace the motherboard when expanding functional modules is solved, efficient resource utilization and cost reduction are achieved, and the printer's scalability and communication stability are improved.
Patent Information
- Application Number
- CN202411785459.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2044-12-06
AI Technical Summary
Existing printers need to replace the motherboard when expanding functional modules, resulting in waste of motherboard resources and increased equipment costs, and the inability to flexibly configure multiple functional modules.
Design a control method to modularize the printer's functions into pieces by controlling the motherboard and multiple functional daughterboards, so as to expand new functional modules without replacing the motherboard, and improve the scalability of the printer through flexible communication configurations.
Avoid waste of motherboard resources, reduce the cost of expanding new functional modules, and improve the scalability and communication stability of the printer.
Smart Images

Figure CN119937944A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a control method for a printer, a printer and a storage medium. Background Art
[0002] In the workflow of card-making printers, the coordinated control of multiple functional modules is often involved. Currently, there are two conventional collaborative control methods. The first is to use a PLC automation control system for collaborative control. However, the collaborative control of PLC automation slows down the processing speed between multiple functional modules and is not suitable for complex data processing.
[0003] The second method is to use a highly integrated single motherboard system with an MCU for collaborative control. Although this method can speed up the processing of the peripherals of the certificate-making equipment, it is limited by the hardware resources of the motherboard. When the certificate-making equipment has more functional modules, it is necessary to replace the motherboard with a larger one, which results in a waste of motherboard resources and an increase in equipment costs. At the same time, it is impossible to flexibly configure multiple functional modules. Summary of the invention
[0004] The main purpose of the embodiments of the present application is to propose a control method, a printer and a storage medium for a printer. Through the design of a control main board and multiple functional sub-boards, the functional modules of the printer are modularized into parts, so that new functional modules can be expanded without replacing the main board, thereby avoiding the waste of main board resources. At the same time, the flexible communication configuration between the control main board and multiple functional sub-boards improves the scalability of the printer and reduces the cost of expanding the printer with new functional modules.
[0005] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present application provides a control method for a printer, wherein the printer comprises a control main board and at least one functional sub-board, wherein the control main board is communicatively connected with the at least one functional sub-board, and the method comprises:
[0006] In response to receiving the print service instruction, the control main board determines a target function sub-board in at least one function sub-board according to the print service instruction, and determines a target communication protocol for communication interaction with the target function sub-board;
[0007] The control mainboard generates a printing control instruction corresponding to the printing service instruction according to the target communication protocol;
[0008] The control main board communicates and interacts with the target functional sub-board based on the printing control instruction;
[0009] When the communication interaction is successful, the target functional sub-board executes the corresponding printing operation according to the printing control instruction.
[0010] In some embodiments, the control mainboard generates a printing control instruction corresponding to the printing service instruction according to the target communication protocol, including:
[0011] The control main board parses the printing service instruction to obtain first identification information of the target function sub-board, control parameters for controlling the target function sub-board, and second identification information of the control function for controlling the target function sub-board;
[0012] The control mainboard generates a blank control instruction according to the target communication protocol, wherein the blank control instruction includes an instruction header field and an instruction content field;
[0013] The control main board encapsulates the first identification information and the second identification information into the instruction header field, and encapsulates the control parameter into the instruction content field, to obtain a printing control instruction corresponding to the printing service instruction.
[0014] In some embodiments, when the communication interaction is successful, the target functional sub-board performs a corresponding printing operation according to the printing control instruction, including:
[0015] When the communication interaction is successful, the target function sub-board calls the control function for controlling the target function sub-board according to the second identification information encapsulated in the instruction header field in the print control instruction;
[0016] The target function sub-board inputs the control parameters encapsulated in the instruction content field in the print control instruction into the control function, and runs the control function to perform the corresponding printing operation.
[0017] In some embodiments, the process of controlling the main board to communicate and interact with the target functional sub-board based on the print control instruction includes the following steps:
[0018] The control main board sends a print control instruction to the target functional sub-board;
[0019] If the control main board does not receive the response information sent by the target functional sub-board according to the print control instruction, the control main board re-sends the print control instruction to the target functional sub-board;
[0020] If the control main board still does not receive the response information sent by the target function sub-board, the control main board determines that the target function sub-board is in a control no response state, and sends an interaction cancellation notification message for instructing to cancel the current communication interaction to the target function sub-board;
[0021] The target functional sub-board receives the interaction cancellation notification information, and sends interaction cancellation response information to the control main board according to the interaction cancellation notification information, so as to cancel the current communication interaction with the control main board.
[0022] In some embodiments, the process of controlling the main board to communicate and interact with the target functional sub-board based on the print control instruction includes the following steps:
[0023] The control main board sends a print control instruction to the target functional sub-board;
[0024] If the control main board receives the response information sent by the target functional sub-board according to the print control instruction, the control main board sends the target functional sub-board an interaction end notification information for indicating the end of the current communication interaction;
[0025] If the control main board does not receive the interaction end response information sent by the target function sub-board according to the interaction end notification information, the control main board determines that the target function sub-board is in a control unresponsive state, and sends an interaction cancellation notification information for instructing to cancel the current communication interaction to the target function sub-board;
[0026] The target functional sub-board receives the interaction cancellation notification information, and sends interaction cancellation response information to the control main board according to the interaction cancellation notification information, so as to cancel the current communication interaction with the control main board.
[0027] In some embodiments, the process of controlling the main board to communicate and interact with the target functional sub-board based on the print control instruction includes the following steps:
[0028] The control main board sends a print control instruction to the target functional sub-board;
[0029] If the target function sub-board determines that there is an information group verification error in the print control instruction after receiving the print control instruction, the target function sub-board sends a communication abnormality notification message to the control main board;
[0030] The control main board regenerates a new printing control instruction according to the communication abnormality notification information, and sends the new printing control instruction to the target functional sub-board;
[0031] When the target function sub-board receives the new print control instruction and determines that there is no information group verification error in the new print control instruction, the target function sub-board sends a response message to the control main board;
[0032] The control main board sends interaction end notification information for indicating the end of the current communication interaction to the target functional sub-board according to the response information;
[0033] The target functional sub-board sends an interaction end response message to the control main board according to the interaction end notification message, so as to end the current communication interaction with the control main board.
[0034] In some embodiments, the control main board stores a first communication protocol set supported by the control main board, and the target function sub-board stores a second communication protocol set supported by the target function sub-board.
[0035] In some embodiments, the process of controlling the main board and the target functional sub-board to determine the target communication protocol for communication interaction includes the following steps:
[0036] The control main board traverses and obtains the first protocol identifier of each communication protocol in the first communication protocol set, and sends the obtained first protocol identifier to the target functional sub-board;
[0037] The target functional sub-board determines a candidate communication protocol in the second communication protocol set according to the first protocol identifier, and determines whether a communication protocol bus used to carry the candidate communication protocol is idle;
[0038] When the target function sub-board determines that the communication protocol bus is idle, the target function sub-board determines the candidate communication protocol as the target communication protocol, and informs the control main board of the determined target communication protocol.
[0039] In some embodiments, the control mainboard stores a third communication protocol set supported by the control mainboard; the first communication protocol set is obtained by the following steps:
[0040] The control mainboard acquires the second protocol identifier of each communication protocol in the third communication protocol set, and generates a protocol identifier set according to the acquired second protocol identifiers;
[0041] The control main board sends the protocol identification set to the target functional sub-board;
[0042] The target functional sub-board determines a plurality of target protocol identifiers in the protocol identifier set according to the protocol identifier of the communication protocol supported by the target functional sub-board, and sends the plurality of target protocol identifiers to the control main board;
[0043] The control mainboard screens out communication protocols corresponding to multiple target protocol identifiers in the third communication protocol set, and obtains the first communication protocol set according to the screened communication protocols.
[0044] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application provides a printer, comprising:
[0045] one or more processors;
[0046] A memory stores one or more programs, and when the one or more programs are executed by one or more processors, the one or more processors implement the control method of the first aspect.
[0047] To achieve the above-mentioned purpose, the third aspect of an embodiment of the present application proposes a storage medium, which is a computer-readable storage medium. The storage medium stores a computer program, and when the computer program is executed by a processor, the control method of the above-mentioned first aspect is implemented.
[0048] The present application proposes a control method for a printer, a printer and a storage medium. In response to receiving a printing service instruction, a control main board determines a target function sub-board in at least one function sub-board according to the printing service instruction, and determines a target communication protocol for communication interaction with the target function sub-board. Then, the control main board generates a printing control instruction corresponding to the printing service instruction according to the target communication protocol. Then, the control main board communicates and interacts with the target function sub-board based on the printing control instruction. Finally, when the communication interaction is successful, the target function sub-board executes the corresponding printing operation according to the printing control instruction. Then, through the design of a control main board and multiple function sub-boards, the functional modules of the printer are integrated into zero, so that when a new function module is expanded, there is no need to replace the main board, thereby avoiding the waste of main board resources. At the same time, the flexible communication configuration between the control main board and multiple function sub-boards improves the scalability of the printer and reduces the cost of expanding the printer with new function modules. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 A schematic diagram of a printer provided in an embodiment of the present application;
[0050] Figure 2 is an optional flow chart of a control method for a printer provided in an embodiment of the present application;
[0051] Figure 3 yes Figure 2 Flow chart of step S202 in FIG.
[0052] Figure 4 yes Figure 2 Flow chart of step S204 in FIG.
[0053] Figure 5 yes Figure 2 Flow chart of step S203 in FIG.
[0054] Figure 6 yes Figure 2 Flow chart of step S203 in FIG.
[0055] Figure 7 yes Figure 2 Flow chart of step S203 in FIG.
[0056] Figure 8 It is a flow chart of the control main board and the target functional sub-board determining the target communication protocol provided by the embodiment of the present application;
[0057] Fig. 9 is a flowchart of obtaining a first communication protocol set provided in an embodiment of the present application;
[0058] Fig.10It is a schematic diagram of the hardware structure of the printer provided in the embodiment of the present application. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0060] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0061] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0062] Based on this, the embodiments of the present application provide a control method, a printer and a storage medium for a printer. Through the design of a control main board and multiple functional sub-boards, the functional modules of the printer are modularized into small units, so that new functional modules can be expanded without replacing the main board, thus avoiding the waste of main board resources. At the same time, the flexible communication configuration between the control main board and multiple functional sub-boards improves the scalability of the printer and reduces the cost of expanding new functional modules of the printer.
[0063] The control method for a printer, the printer, and the storage medium provided in the embodiments of the present application are specifically described through the following embodiments. First, the control method for a printer in the embodiments of the present application is described.
[0064] Reference Figure 1 , Figure 1 A schematic diagram of a printer provided in an embodiment of the present application, the printer comprises a control main board 101 and at least one functional sub-board 102 , and the control main board 101 is communicatively connected with the at least one functional sub-board 102 .
[0065] Figure 2 is an optional flow chart of a control method for a printer provided in an embodiment of the present application. Figure 2 The method may include but is not limited to steps S201 to S204.
[0066] Step S201, in response to receiving a printing service instruction, the control main board determines a target function sub-board in at least one function sub-board according to the printing service instruction, and determines a target communication protocol for communication interaction with the target function sub-board.
[0067] The printing service instruction is an instruction transmitted by an application corresponding to the printer.
[0068] Specifically, first, the control main board responds to receiving a printing business instruction and parses the printing business instruction to extract relevant information such as operation requirements, target tasks, and functional modules contained in the printing business content in the printing business instruction. Then, the control main board analyzes the functions of each functional sub-board based on the parsed results of the printing business instruction, and identifies which functional sub-board has the ability to execute the printing business instruction. For example, if the printing business instruction involves image processing or typesetting operations, the control main board will look for sub-boards with these functions. Next, the control main board quickly locates the target functional sub-board that meets the instruction requirements in the existing functional sub-board list based on the specific identifier in the business instruction. Finally, the control main board and the target functional sub-board determine the target communication protocol for communication interaction through handshake negotiation.
[0069] It should be noted that the communication protocol is a communication protocol pre-set by the printer, which includes CAN bus communication protocol, RS485 bus communication protocol, RS232 bus communication protocol, RS 422 bus communication protocol, Ethernet communication protocol, etc.
[0070] Step S202: The control mainboard generates a printing control instruction corresponding to the printing service instruction according to the target communication protocol.
[0071] Specifically, the control mainboard generates a printing control instruction corresponding to the printing service instruction according to the target communication protocol, wherein the data format of the printing control instruction includes a sending instruction packet format and a receiving instruction packet format.
[0072] Furthermore, the sending instruction packet format is configured with an instruction header field SendCmdHead, an instruction content field Data and a checksum field Checksum, wherein the instruction header field SendCmdHead is provided with a field ST1, a field ST2, a field LEN_L, a field LEN_H, a field PID_L, a field PID_H, a field CMD_L and a field CMD_H.
[0073] Furthermore, the received instruction packet format is configured with an instruction header field RespCmdHead, an instruction content field Data and a checksum field Checksum, wherein the instruction header field RespCmdHead is provided with a field ST1, a field ST2, a field LEN_L, a field LEN_H, a field PID_L, a field PID_H, a field CMD_L and a field CMD_H.
[0074] It should be noted that field ST1 and field ST2 are both used for the head node field of the sending instruction packet format or the receiving instruction packet format, and field LEN_L and field LEN_H are both used to indicate the length of the sending instruction packet format or the receiving instruction packet format constituting 2 bytes.
[0075] Among them, the data formats of the field LEN_L, the field LEN_H, the field PID_L, the field PID_H, the field CMD_L, and the field CMDH are all low-order first and high-order last.
[0076] Step S203, the control main board communicates and interacts with the target functional sub-board based on the print control instruction.
[0077] Specifically, the control main board establishes a communication connection with the target functional sub-board and performs communication interaction according to the printing control instruction.
[0078] Step S204: When the communication interaction is successful, the target functional sub-board executes a corresponding printing operation according to the printing control instruction.
[0079] Specifically, when the communication interaction is successful, the target functional sub-board parses the printing control instructions transmitted by the control main board to obtain the corresponding printing operation content (for example: black and white or color printing, setting print margins, setting print resolution, etc.).
[0080] In the steps S201 to S204 shown in the embodiment of the present application, the functional modules of the printer are modularized into parts through the design of a control main board and multiple functional sub-boards, so that the main board does not need to be replaced when a new functional module is expanded, thus avoiding the waste of main board resources. At the same time, the flexible communication configuration between the control main board and the multiple functional sub-boards is improved, the scalability of the printer is improved, and the cost of expanding the new functional module of the printer is reduced.
[0081] It should also be noted that steps S201 to S204 shown in the embodiment of the present application can also determine the communication protocols of multiple functional sub-boards under the requirements of multiple communication application scenarios, and then based on the communication protocols of the multiple functional sub-boards, the control main board of the printer can synchronously communicate and interact with the multiple functional sub-boards, so that the printer can operate stably and reliably under the requirements of multiple communication application scenarios.
[0082] See also Figure 3 In some embodiments, step S202 may include but is not limited to steps S301 to S303:
[0083] Step S301, the control main board parses the printing service instruction to obtain the first identification information of the target function sub-board, the control parameters for controlling the target function sub-board, and the second identification information of the control function for controlling the target function sub-board.
[0084] In step S301 of some embodiments, the control main board verifies the printing business instruction to ensure that the instruction is complete and complies with the preset protocol format, and then performs structural analysis on the printing business instruction to obtain the first identification information of the target function sub-board, the control parameters for controlling the target function sub-board, and the second identification information of the control function for controlling the target function sub-board.
[0085] The first identification information may be the address information of the target functional sub-board or the serial number information of the target functional sub-board, which is not specifically limited in this application. Preferably, the first identification information is the serial number information of the target functional sub-board, because the number of bits required for the serial number information is less than the number of bits required for the address information, thus saving bit resources and achieving higher efficiency in serial number identification.
[0086] Furthermore, the second identification information is the code number information of the corresponding control function in the target function sub-board, wherein the control function in the target function sub-board can be a laser scanning function, a first-level laser printing function, a first-level UV inkjet printing function, a second-level laser scanning + a first-level UV inkjet printing function, a certificate medium page turning function, or a certificate issuance function, which is not specifically limited in this application.
[0087] Step S302, the control mainboard generates a blank control instruction according to the target communication protocol.
[0088] The blank control instruction includes an instruction header field SendCmdHead, an instruction content field Data, and a checksum field Checksum.
[0089] In step S302 of some embodiments, the control mainboard generates a blank control instruction according to the target communication protocol, that is, the instruction header field, the instruction content field and the check code field are all empty data.
[0090] Step S303: The control mainboard encapsulates the first identification information and the second identification information into the instruction header field, and encapsulates the control parameter into the instruction content field, to obtain a printing control instruction corresponding to the printing service instruction.
[0091] It should be noted that the field P ID_L and the field P ID_H in the command header field SendCmdHead are both used to indicate the first identification information consisting of 2 bytes, and the field CMD_L and the field CMDH are both used to indicate the second identification information consisting of 2 bytes.
[0092] In step S303 of some embodiments, the control main board encapsulates the first identification information into the fields PID_L and PID_H of the instruction header field, encapsulates the second identification information into the fields CMD_L and CMDH of the instruction header field, and then encapsulates the control parameters into the instruction content field Data, and also encapsulates the check code into the check code field Checksum to obtain a printing control instruction corresponding to the printing business instruction.
[0093] See also Figure 4 In some embodiments, step S204 may include but is not limited to steps S401 to S402:
[0094] Step S401, when the communication interaction is successful, the target function sub-board calls the control function for controlling the target function sub-board according to the second identification information encapsulated in the instruction header field in the print control instruction.
[0095] In step S401 of some embodiments, when the communication interaction with the target function sub-board is successful, the target function sub-board performs a structural analysis on the received printing control instruction to obtain the second identification information encapsulated in the instruction header field of the printing control instruction, and then calls the control function for controlling the target function sub-board based on the second identification information.
[0096] Step S402, the target function sub-board inputs the control parameters encapsulated in the instruction content field in the print control instruction into the control function, and runs the control function to perform the corresponding print operation.
[0097] In step S402 of some embodiments, the target function sub-board reads and parses the control parameters in the instruction content field, identifies the specific settings for controlling the printing operation, such as printing speed, printing direction, temperature setting, etc., and then inputs the parsed control parameters into the corresponding control function module, such as the drive motor, temperature control unit or other execution module, to ensure that the sub-board can operate according to the predetermined printing requirements, and finally, according to the input control parameters, starts or adjusts the various control functions of the sub-board to perform the corresponding printing operation. The corresponding printing operation includes motor control (adjusting the position or speed of the print head), temperature control (heating or cooling the print head), or other related functions.
[0098] See also Figure 5In some embodiments, step S203 may include but is not limited to steps S501 to S504:
[0099] Step S501, the control main board sends a print control instruction to the target functional sub-board.
[0100] In step S401 of some embodiments, the control main board encapsulates the printing control instruction into a corresponding sending instruction packet COMMAND_DATA, and then sends the sending instruction packet COMMAND_DATA to the target functional sub-board, wherein the sending instruction packet COMMAND_DATA includes a series of control links such as the device executing the certificate production action, querying the device status, reading and writing chip data, and collecting image vision module data.
[0101] Step S502: If the control main board does not receive the response information sent by the target functional sub-board according to the print control instruction, the control main board re-sends the print control instruction to the target functional sub-board.
[0102] In step S502 of some embodiments, if the control main board does not receive the response information sent by the target functional sub-board according to the print control instruction, the control main board re-encapsulates the print control instruction into a corresponding send instruction packet COMMAND_DATA and sends the send instruction packet COMMAND_DATA to the target functional sub-board.
[0103] Step S503, if the control mainboard still does not receive the response information sent by the target functional sub-board, the control mainboard determines that the target functional sub-board is in a control no-response state, and sends an interaction cancellation notification message to the target functional sub-board to indicate cancellation of the current communication interaction.
[0104] In step S503 of some embodiments, if the control main board still does not receive the response information sent by the target functional sub-board, the control main board determines that the target functional sub-board is in a control no-response state, and the control main board encapsulates the interaction cancellation notification information used to indicate the cancellation of the current communication interaction into a corresponding sending instruction packet EOT_DATA, and sends the sending instruction packet EOT_DATA to the target functional sub-board.
[0105] Step S504: the target functional sub-board receives the interaction cancellation notification information, and sends interaction cancellation response information to the control main board according to the interaction cancellation notification information, so as to cancel the current communication interaction with the control main board.
[0106] In step S504 of some embodiments, the target functional sub-board receives the sending instruction packet EOT_DATA, and parses the sending instruction packet EOT_DATA to obtain the interaction cancellation notification information, and then encapsulates the interaction cancellation response information into the corresponding response instruction packet EOT_DATA according to the interaction cancellation notification information, and sends the response instruction packet EOT_DATA to the control main board to cancel the current communication interaction with the control main board.
[0107] It should be noted that the encapsulation form of the response instruction packet EOT_DATA is a handshake data packet agreed upon by the control main board and the target functional sub-board to indicate that each of them cancels the current communication interaction.
[0108] Steps S501 to S504 shown in the embodiment of the present application can reduce the occurrence of communication packet loss during data communication between the target functional sub-board and the control main board, add a communication retransmission mechanism between the target functional sub-board and the control main board, and improve the stability, integrity and adaptability of the communication between the target functional sub-board and the control main board to the communication environment.
[0109] See also Figure 6 In some embodiments, step S203 may also include but is not limited to steps S601 to S604:
[0110] Step S601, the control main board sends a print control instruction to the target functional sub-board.
[0111] In step S601 of some embodiments, the control main board encapsulates the printing control instruction into a corresponding sending instruction packet COMMAND_DATA, and then sends the sending instruction packet COMMAND_DATA to the target function sub-board.
[0112] Step S602: If the control main board receives the response information sent by the target functional sub-board according to the print control instruction, the control main board sends the target functional sub-board an interaction end notification information for indicating the end of the current communication interaction.
[0113] In step S602 of some embodiments, if the control main board receives response information sent by the target functional sub-board according to the printing control instruction, the control main board sends an interaction end notification information to the target functional sub-board to indicate the end of the current communication interaction, encapsulates the interaction end notification information to indicate the end of the current communication interaction into a corresponding sending instruction packet ENQ_DATA, and sends the sending instruction packet ENQ_DATA to the control main board.
[0114] Among them, the process of the target function sub-board sending response information according to the printing control instruction is described as follows: the target function sub-board generates corresponding response information according to the printing control instruction, and then encapsulates the response information into a response instruction packet ACK_DATA, and finally sends the response instruction packet ACK_DATA to the control main board.
[0115] Step S603, if the control main board does not receive the interaction end response information sent by the target functional sub-board according to the interaction end notification information, the control main board determines that the target functional sub-board is in a control unresponsive state, and sends an interaction cancellation notification information to the target functional sub-board to indicate the cancellation of the current communication interaction.
[0116] In step S603 of some embodiments, if the control main board does not receive the interaction end response information sent by the target function sub-board according to the interaction end notification information, the control main board determines that the target function sub-board is in a control unresponsive state (that is, the control main board believes that the target function sub-board has not successfully received the print control instruction), and then encapsulates the interaction cancellation notification information used to indicate the cancellation of the current communication interaction into a corresponding sending instruction packet EOT_DATA, and sends the sending instruction packet EOT_DATA to the control main board.
[0117] Step S604: the target functional sub-board receives the interaction cancellation notification information, and sends interaction cancellation response information to the control main board according to the interaction cancellation notification information, so as to cancel the current communication interaction with the control main board.
[0118] In step S604 of some embodiments, the target functional sub-board receives the sending instruction packet EOT_DATA, and parses the sending instruction packet EOT_DATA to obtain the interaction cancellation notification information, and then encapsulates the interaction cancellation response information into the corresponding response instruction packet EOT_DATA according to the interaction cancellation notification information, and sends the response instruction packet EOT_DATA to the control main board to cancel the current communication interaction with the control main board.
[0119] In steps S601 to S604 shown in the embodiment of the present application, after the control main board establishes a link with the target function sub-board, the control main board sends a confirmation command. When the target function sub-board has no response data, the control main board considers that an abnormality has occurred in the target function sub-board, abandons retransmission, and needs to re-establish the communication connection, thereby providing communication capabilities between the control main board and the target function sub-board, reducing the loss of valid data, avoiding invalid communication transmission, and increasing the stability of the printer.
[0120] See also Figure 7 In some embodiments, step S203 includes but is not limited to steps S701 to S706:
[0121] Step S701, the control main board sends a print control instruction to the target functional sub-board.
[0122] In step S701 of some embodiments, the control main board encapsulates the printing control instruction into a corresponding sending instruction packet COMMAND_DATA, and then sends the sending instruction packet COMMAND_DATA to the target function sub-board.
[0123] Step S702: If the target function sub-board determines that there is an information group verification error in the print control instruction after receiving the print control instruction, the target function sub-board sends communication abnormality notification information to the control main board.
[0124] In step S702 of some embodiments, if the target functional sub-board receives a sending instruction packet COMMAND_DATA and parses the sending instruction packet COMMAND_DATA, and determines based on the parsed structure that the printing control instruction corresponding to the sending instruction packet COMMAND_DATA has an information group check error (i.e., confirms that a BCC check code error occurs in the check code field Checksum in the sending instruction packet COMMAND_DATA), then the communication abnormality notification information is encapsulated into a corresponding response instruction packet NAK_DATA, and the response instruction packet NAK_DATA is sent to the control main board.
[0125] Step S703: The control main board regenerates a new print control instruction according to the communication abnormality notification information, and sends the new print control instruction to the target functional sub-board.
[0126] In step S703 of some embodiments, the control main board receives the response instruction packet NAK_DATA and parses it to obtain the communication abnormality notification information, then regenerates a new printing control instruction based on the communication abnormality notification information, and finally encapsulates the new printing control instruction into a new sending instruction packet COMMAND_DATA, and sends the sending instruction packet COMMAND_DATA to the target functional sub-board.
[0127] Step S704: When the target function sub-board receives the new print control instruction and determines that the new print control instruction does not have an information group verification error, the target function sub-board sends a response message to the control main board.
[0128] In step S704 of some embodiments, the target functional sub-board receives a new sending instruction packet COMMAND_DATA and parses the sending instruction packet COMMAND_DATA to obtain a new printing control instruction, and then, when it is determined that there is no information group check error in the printing control instruction (i.e., confirming that there is no BCC check code error in the check code field Checksum in the sending instruction packet COMMAND_DATA), encapsulates the response information into a corresponding response instruction packet ACK_DATA, and sends the response instruction packet ACK_DATA to the control main board.
[0129] Step S705: The control main board sends interaction end notification information indicating the end of the current communication interaction to the target functional sub-board according to the response information.
[0130] In step S705 of some embodiments, the control main board receives the response instruction packet ACK_DATA and parses it to obtain the response information, and then generates the interaction end notification information indicating the end of the current communication interaction based on the response information, and finally encapsulates the interaction end notification information into a new sending instruction packet ENQ_DATA, and sends the sending instruction packet ENQ_DATA to the target functional sub-board.
[0131] Step S706: the target functional sub-board sends interaction end response information to the control main board according to the interaction end notification information, so as to end the current communication interaction with the control main board.
[0132] In step S706 of some embodiments, the target functional sub-board receives the sending instruction packet EOT_DATA, and parses the sending instruction packet EOT_DATA to obtain the interaction cancellation notification information, and then encapsulates the interaction cancellation response information into the corresponding response instruction packet EOT_DATA according to the interaction cancellation notification information, and sends the response instruction packet EOT_DATA to the control main board to cancel the current communication interaction with the control main board.
[0133] In steps S701 to S706 shown in the embodiment of the present application, BCC check code is performed on the communication instruction packet to detect errors sent during data transmission, thereby avoiding printer abnormalities or business logic errors caused by data errors, and improving the reliability and stability of the printer.
[0134] In some embodiments, the control main board stores a first communication protocol set supported by the control main board, and the target function sub-board stores a second communication protocol set supported by the target function sub-board.
[0135] See also Figure 8 In some embodiments, the process of controlling the main board and the target functional sub-board to determine the target communication protocol may include but is not limited to steps S801 to S803:
[0136] Step S801: The control main board traverses and obtains the first protocol identifier of each communication protocol in the first communication protocol set, and sends the obtained first protocol identifier to the target functional sub-board.
[0137] It should be noted that the first communication protocol set is preset in the printer, and the first communication protocol set includes a plurality of communication protocols, and each communication protocol is provided with a first protocol identifier.
[0138] In step S801 of some embodiments, the control main board traverses each communication protocol in the first communication protocol set to obtain a first protocol identifier of each communication protocol, and then sends the obtained first protocol identifier to the target functional sub-board during each traversal process.
[0139] Step S802: The target functional sub-board determines a candidate communication protocol in the second communication protocol set according to the first protocol identifier, and determines whether a communication protocol bus used to carry the candidate communication protocol is idle.
[0140] In step S802 of some embodiments, after the target functional sub-board receives the first protocol identifier provided by the control main board, it first searches for a candidate communication protocol that matches the protocol identifier in the second communication protocol set. If a protocol that matches the first protocol identifier is found, the target functional sub-board will determine the protocol as a candidate communication protocol, that is, a protocol that may currently be used for communication operations. After determining the candidate communication protocol, the target functional sub-board needs to check whether the communication protocol bus used to carry the protocol (such as an RS485 bus, an I2C bus, an SPI bus, etc.) is currently idle.
[0141] It should be noted that the idle state of the communication protocol bus can be determined by checking the bus occupancy state: when the bus is idle, it means that new data transmission can be performed; otherwise, it is necessary to wait for the bus to be released or use other communication strategies (such as queuing, retrying, etc.).
[0142] Step S803: When the target function sub-board determines that the communication protocol bus is idle, the target function sub-board determines the candidate communication protocol as the target communication protocol, and informs the control main board of the determined target communication protocol.
[0143] In step S803 of some embodiments, after confirming that the communication protocol bus is idle, the target function sub-board formally selects the current candidate communication protocol as the target communication protocol, and then the target function sub-board packages the information of the target communication protocol (such as protocol type, ID, etc.) into a confirmation message and sends it to the control main board through a preset communication mechanism (such as interrupt signal, message passing, etc.).
[0144] It should be noted that the control mainboard stores a set of third communication protocols supported by the control mainboard. Fig. 9 In some embodiments, the process of acquiring the first communication protocol set may include but is not limited to steps S901 to S904:
[0145] Step S901: The control mainboard obtains the second protocol identifier of each communication protocol in the third communication protocol set, and generates a protocol identifier set according to the obtained second protocol identifiers.
[0146] In step S901 of some embodiments, the control main board traverses each communication protocol in the third communication protocol set to obtain the second protocol identifier of each communication protocol, and then adds the obtained first protocol identifier to the protocol identifier set during each traversal process. When the third communication protocol set is traversed, the protocol identifier set is obtained.
[0147] Step S902: The control main board sends the protocol identification set to the target functional sub-board.
[0148] Step S903: The target functional sub-board determines a plurality of target protocol identifiers in the protocol identifier set according to the protocol identifier of the communication protocol supported by the target functional sub-board, and sends the plurality of target protocol identifiers to the control main board.
[0149] In step S903 of some embodiments, the control main board traverses each protocol identifier in the protocol identifier set to match each protocol identifier with the protocol identifier of the communication protocol supported by the target functional sub-board itself. When the protocol identifier in the protocol identifier set is the same as the protocol identifier of the communication protocol supported by the target functional sub-board itself, the protocol identifier in the protocol identifier set is determined as the target protocol identifier, until the protocol identifier set is traversed to obtain multiple target protocol identifiers, and finally the multiple target protocol identifiers are sent to the control main board.
[0150] Step S904: The control mainboard filters out communication protocols corresponding to multiple target protocol identifiers in the third communication protocol set, and obtains the first communication protocol set according to the filtered communication protocols.
[0151] In step S904 of some embodiments, the control main board receives multiple target protocol identifiers supported by the target functional sub-board, and then filters out the communication protocol consistent with the target protocol identifier by comparing the protocol identifiers in the third communication protocol set, and encapsulates the filtered communication protocol into the first communication protocol set.
[0152] In steps S901 to S904 shown in the embodiment of the present application, the communication protocol pairing between the control main board and the target functional sub-board can quickly screen out a first communication protocol set, and then in the subsequent determination of candidate communication protocols, there is no need to traverse all communication protocols in the control main board, and only the first communication protocol set needs to be traversed to complete the task of determining the candidate communication protocols, thereby reducing the amount of computational complexity of communication protocol matching and improving matching speed.
[0153] An embodiment of the present application also provides a printer that can implement the above-mentioned control method. The printer includes: one or more processors; a memory on which one or more programs are stored. When the one or more programs are executed by one or more processors, the one or more processors implement the above-mentioned control method.
[0154] See also Fig.10 , Fig.10 The hardware structure of a printer of another embodiment is illustrated, and the printer comprises:
[0155] The processor 1001 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0156] The memory 1002 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1002 can store an operating system and other application programs. When the technical solution provided in the embodiments of this specification is implemented by software or firmware, the relevant program code is stored in the memory 1002, and the processor 1001 calls and executes the control method of the embodiment of this application;
[0157] Input / output interface 1003, used to implement information input and output;
[0158] The communication interface 1004 is used to realize the communication interaction between the device and other devices. The communication can be realized through a wired manner (such as USB, network cable, etc.) or a wireless manner (such as mobile network, WI FI, Bluetooth, etc.);
[0159] A bus 1005 , which transmits information between various components of the device (e.g., the processor 1001 , the memory 1002 , the input / output interface 1003 , and the communication interface 1004 );
[0160] The processor 1001 , the memory 1002 , the input / output interface 1003 and the communication interface 1004 are connected to each other in communication within the device via the bus 1005 .
[0161] An embodiment of the present application further provides a storage medium, which is a computer-readable storage medium and stores a computer program. When the computer program is executed by a processor, the above-mentioned control method is implemented.
[0162] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0163] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0164] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0165] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, 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.
[0166] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0167] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0168] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0169] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0170] The units described above 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 units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0171] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0172] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially 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, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0173] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A control method for a printer, characterized in that: The printer comprises a control main board and at least one functional sub-board, wherein the control main board is communicatively connected with the at least one functional sub-board; The method comprises: In response to receiving a print service instruction, the control main board determines a target function sub-board in the at least one function sub-board according to the print service instruction, and determines a target communication protocol for communication interaction with the target function sub-board; The control mainboard generates a printing control instruction corresponding to the printing service instruction according to the target communication protocol; The control main board communicates and interacts with the target function sub-board based on the print control instruction; When the communication interaction is successful, the target functional sub-board executes the corresponding printing operation according to the printing control instruction.
2. The method according to claim 1, characterized in that The control mainboard generates a printing control instruction corresponding to the printing service instruction according to the target communication protocol, including: The control main board parses the printing service instruction to obtain the first identification information of the target function sub-board, the control parameters for controlling the target function sub-board, and the second identification information of the control function for controlling the target function sub-board; The control mainboard generates a blank control instruction according to the target communication protocol, wherein the blank control instruction includes an instruction header field and an instruction content field; The control main board encapsulates the first identification information and the second identification information into the instruction header field, and encapsulates the control parameter into the instruction content field, to obtain a printing control instruction corresponding to the printing service instruction.
3. The method according to claim 2, characterized in that When the communication interaction is successful, the target function sub-board performs a corresponding printing operation according to the printing control instruction, including: When the communication interaction is successful, the target function sub-board calls the control function for controlling the target function sub-board according to the second identification information encapsulated in the instruction header field in the print control instruction; The target function sub-board inputs the control parameter encapsulated in the instruction content field in the print control instruction into the control function, and runs the control function to perform a corresponding print operation.
4. The method according to claim 1, characterized in that: The process of the control main board communicating and interacting with the target function sub-board based on the print control instruction includes the following steps: The control main board sends the print control instruction to the target function sub-board; If the control main board does not receive the response information sent by the target functional sub-board according to the print control instruction, the control main board re-sends the print control instruction to the target functional sub-board; If the control main board still does not receive the response information sent by the target function sub-board, the control main board determines that the target function sub-board is in a control no-response state, and sends an interaction cancellation notification message for instructing to cancel the current communication interaction to the target function sub-board; The target function sub-board receives the interaction cancellation notification information, and sends interaction cancellation response information to the control main board according to the interaction cancellation notification information, so as to cancel the current communication interaction with the control main board.
5. The method according to claim 1, characterized in that: The process of the control main board communicating and interacting with the target function sub-board based on the print control instruction includes the following steps: The control main board sends the print control instruction to the target function sub-board; If the control main board receives the response information sent by the target function sub-board according to the print control instruction, the control main board sends the target function sub-board an interaction end notification information for indicating the end of the current communication interaction; If the control main board does not receive the interaction end response information sent by the target function sub-board according to the interaction end notification information, the control main board determines that the target function sub-board is in a control unresponsive state, and sends an interaction cancellation notification information for instructing the target function sub-board to cancel the current communication interaction; The target function sub-board receives the interaction cancellation notification information, and sends interaction cancellation response information to the control main board according to the interaction cancellation notification information, so as to cancel the current communication interaction with the control main board.
6. The method according to claim 1, characterized in that The process of the control main board communicating and interacting with the target function sub-board based on the print control instruction includes the following steps: The control main board sends the print control instruction to the target function sub-board; If the target function sub-board determines that there is an information group verification error in the print control instruction after receiving the print control instruction, the target function sub-board sends communication abnormality notification information to the control main board; The control main board regenerates a new printing control instruction according to the communication abnormality notification information, and sends the new printing control instruction to the target functional sub-board; When the target function sub-board receives the new print control instruction and determines that the new print control instruction does not have an information group verification error, the target function sub-board sends a response message to the control main board; The control main board sends interaction end notification information for indicating the end of the current communication interaction to the target function sub-board according to the response information; The target functional sub-board sends interaction end response information to the control main board according to the interaction end notification information, so as to end the current communication interaction with the control main board.
7. The method according to claim 1, characterized in that The control main board stores a first communication protocol set supported by the control main board, and the target function sub-board stores a second communication protocol set supported by the target function sub-board; The process of the control main board and the target functional sub-board determining the target communication protocol for communication interaction includes the following steps: The control main board traverses and obtains a first protocol identifier of each communication protocol in the first communication protocol set, and sends the obtained first protocol identifier to the target function sub-board; The target functional sub-board determines a candidate communication protocol in the second communication protocol set according to the first protocol identifier, and determines whether a communication protocol bus used to carry the candidate communication protocol is idle; When the target function sub-board determines that the communication protocol bus is idle, the target function sub-board determines the candidate communication protocol as the target communication protocol, and informs the control main board of the determined target communication protocol.
8. The method according to claim 7, characterized in that The control mainboard stores a third communication protocol set supported by the control mainboard; the first communication protocol set is obtained by the following steps: The control mainboard acquires a second protocol identifier of each communication protocol in the third communication protocol set, and generates a protocol identifier set according to the acquired second protocol identifiers; The control main board sends the protocol identification set to the target function sub-board; The target functional sub-board determines a plurality of target protocol identifiers in the protocol identifier set according to the protocol identifier of the communication protocol supported by the target functional sub-board, and sends the plurality of target protocol identifiers to the control main board; The control main board filters out communication protocols corresponding to the plurality of target protocol identifiers in the third communication protocol set, and obtains the first communication protocol set according to the filtered communication protocols.
9. A printer, characterized in that: include: one or more processors; A memory having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the control method for a printer as claimed in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the program is executed by a processor, the control method for a printer as claimed in any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Printing task distributed processing method, device and equipment and storage medium
CN111443878A
Performing print job according to format of print job acquired based on metadata
CN112055844A
Printing method and device, electronic equipment and computer readable storage medium
CN113190187A
Computer board
CN116112307A
Printing method, printing device, equipment and medium based on wireless connection mode
CN116820361A