A method, system, device and storage medium for segmented heating of a printer
By presetting the maximum number of supported dots and block parameters in the printer, the printing data is processed in batches dynamically, which solves the problem of excessive resource consumption in the segmented heating method of the printer, and achieves the effect of saving memory and reducing hardware costs, while ensuring the uniformity of printing effect.
Patent Information
- Application Number
- CN202311335304.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-16
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2043-10-16
AI Technical Summary
Existing segmented heating methods for printers consume excessive chip resources while improving print quality, leading to increased hardware costs and unreasonable resource allocation.
By preset the maximum number of supported dots and block parameters, the ideal number of print blocks is dynamically determined, print data is processed in batches, and the number of print blocks is obtained through indexing for hot printing, thus avoiding excessive cache space usage.
It effectively saves memory, improves chip space utilization, reduces hardware costs, and at the same time ensures the uniformity and accuracy of printing results.
Smart Images

Figure CN117453160B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of printing equipment technology, specifically to a method, system, device, and storage medium for segmented heating of a printer. Background Technology
[0002] Print quality is a crucial factor for users. With similar hardware resources, software tuning plays a vital role in printer performance. Using segmented heating to process data for each line to achieve better print quality is the most widely used software algorithm for printers. However, the resource space required for each algorithm varies, and further research is needed on the understanding of printers and chip resource allocation among different manufacturers to refine the algorithm.
[0003] Currently, most mainstream printers process the data of the current line by dynamically or fixedly segmenting it based on the ratio of the current number of dots to the total number of dots. However, they generally require pre-reserving a buffer space that supports the maximum number of segments to store the data of the current line that has been processed but not yet released for printing. However, this means that the more detailed the printing, the higher the number of segments needed, and the more space resources are consumed. Therefore, this processing method has an unreasonable aspect in the resource allocation of a single chip.
[0004] Due to the scarcity of existing chip resources, optimizing resource space has become a priority for R&D personnel in many industries. For the line data already processed and sent to the printer, the mainstream approach is to divide it into a combination of maximum segment number and maximum line point number. The larger the segment number, the more space resources it consumes, which negatively impacts the developer experience, unless a higher-specification model or external chip is used, but this will correspondingly increase hardware costs.
[0005] In view of this, this application proposes a printer segmented heating method, system, device and storage medium that can effectively save memory. Summary of the Invention
[0006] To address the issue that existing printers occupy more space resources as the number of printing segments increases, this application provides a printer segmented heating method, system, device, and storage medium to solve the aforementioned technical defects.
[0007] According to one aspect of the present invention, a method for segmented heating of a printer is provided, the method comprising the following steps:
[0008] S1. Preset the maximum number of supported points for the current print line and the maximum block parameter for the current print line;
[0009] S2. In response to detecting that there is data to be printed in the current print line, determine the ideal number of print blocks B for the data to be printed based on the maximum number of supported points and the maximum block parameter, and store the ideal number of print blocks B in the block array.
[0010] S3. In response to determining that there is data to be printed in the current print line, the ideal print block number B is obtained through the index.
[0011] S4. Process the data to be printed in batches, obtain and store the current print data and the current print sequence number P, and control the heating module on the print head to heat and print the current print data.
[0012] S5. In response to determining that the current print sequence number P is greater than the ideal number of print blocks B, return to the operation of steps S2-S5.
[0013] Through the above technical solution, this application can easily detect which batch of data needs to be processed by using several arrays with row number indices, and then perform data conversion and heat processing, without having to process the data in advance, open a large buffer to store all the data to be printed in the current row, and then heat all the data.
[0014] In a specific embodiment, the method further includes sending the current print data along with the preset parameters to the printer head if the current print sequence number P is less than or equal to the ideal print block number B.
[0015] Through the above technical solution, this application can guarantee a uniform printing effect.
[0016] In a specific embodiment, in step S4, the current print data is stored in the current data generation array, and data interaction is performed with the printer head through the serial peripheral interface to transmit the current print data to the printer head.
[0017] In a specific embodiment, in step S2, the ideal number of printable blocks B of the data to be printed is determined based on the maximum number of supported points and the maximum block size parameter. The specific calculation method is as follows:
[0018] B = P / (max - dot / N)
[0019] In the formula, P represents the number of dots of the data to be printed, B represents the ideal number of print blocks, max-dot represents the maximum number of supported dots, and N represents the maximum block parameter.
[0020] In a specific embodiment, in response to determining that the ideal number of printable blocks B contains a decimal part, the ideal number of printable blocks B is rounded up.
[0021] Since the remaining data also needs to be printed, the above technical solution can avoid printing omissions.
[0022] Secondly, this application provides a printer segmented heating system, characterized in that it includes:
[0023] The parameter setting module configures the maximum number of supported points for the current print line and the maximum block size for the current print line.
[0024] The ideal print block number calculation module is configured to determine the ideal print block number B of the data to be printed based on the maximum supported number of points and the maximum block parameter when it is detected that there is data to be printed in the current print line, and to store the ideal print block number B in the block array.
[0025] The ideal print block number acquisition module is configured to acquire the ideal print block number B by index when it is determined that there is data to be printed in the current print line.
[0026] The heating module is configured to process the data to be printed in batches, obtain and store the current print data and the current print sequence number P, and control the heating module on the print head to heat and print the current print data.
[0027] The judgment module is configured to return to the operation of the ideal print block number calculation module, the ideal print block number acquisition module, the heating module, and the judgment module in response to the determination that the current print sequence number P is greater than the ideal print block number B.
[0028] Thirdly, this application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the steps of the printer segmented heating method as described in any of the above claims.
[0029] Fourthly, this application provides a computer-readable storage medium storing a computer program, characterized in that, when executed by a processor, the computer program implements the steps of the printer segmented heating method described above.
[0030] Compared with the prior art, the beneficial results of the present invention are as follows:
[0031] (1) This invention can easily detect which batch of data needs to be processed by several arrays with row number indices, and then perform data conversion and heating processing, without having to process the data in advance and then open a large buffer area to store all the data to be printed in the current row, and finally heat all the data.
[0032] (2) This invention greatly reduces memory usage and enhances chip space utilization; it makes reasonable use of hardware resources and reduces resource investment; it optimizes printing effect by dividing the blocks, so the printing effect is not limited. Attached Figure Description
[0033] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments, taken with reference to the accompanying drawings:
[0034] Figure 1 This is a flowchart of the printer segmented heating method according to this application;
[0035] Figure 2 This is a structural diagram of the printer segmented heating system according to this application;
[0036] Figure 3 This is a schematic diagram of the structure of a computer system suitable for implementing the electronic devices of the present application embodiments. Detailed Implementation
[0037] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.
[0038] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0039] This application pre-defines several indexed arrays to store the data before and after processing, as well as the corresponding information content, as follows:
[0040] Data[max_line][max_dot]], final_data[max_dot], block[max_line][B];
[0041] Where max_line represents the maximum height of the supported lines that can be stored, max_dot is the maximum number of supported dots for the current printed line, Data is the original data of the current printed line, final_data is the final data to be generated for the current line and the current batch, and block is the array of suitable batches.
[0042] Figure 1 A flowchart of the printer segmented heating method of this application is shown. Please refer to it. Figure 1 The method includes the following steps:
[0043] S1. Preset the maximum supported number of points for the current print line, and preset the maximum block parameter of the current print line.
[0044] S2. In response to detecting that there is data to be printed in the current print line, determine the ideal number of print blocks B of the data to be printed according to the maximum supported number of points and the maximum block parameter, and store the ideal number of print blocks B in a block array.
[0045] In this embodiment, the specific calculation manner for determining the ideal number of print blocks B of the data to be printed according to the maximum supported number of points and the maximum block parameter is as follows:
[0046] B=P / (max-dot / N)
[0047] In the formula, P represents the number of points of the data to be printed, B represents the ideal number of print blocks, max-dot represents the maximum supported number of points, and N represents the maximum block parameter.
[0048] Preferably, in response to determining that the ideal number of print blocks B includes a fractional part, upward rounding is performed on the ideal number of print blocks B.
[0049] That is, when the parameter that can be divided into N blocks for transmission is defined, it can be considered that every time the value is greater than (max_dot / N), it is considered that one more block of data can be divided from the current line, and a maximum of N blocks is supported. After acquiring the data Data to be printed of the current print line and knowing the print points of the current print line, the ideal number of print blocks can be calculated through the above expression, where (1<B≤N), and the block number information of the ideal number of print blocks is stored into the block[][] array, so as to perform subsequent indexing to obtain the block number for processing.
[0050] With continued reference to Figure 1 , the segmented heating method for a printer provided by the present application further includes the following steps:
[0051] S3. In response to determining that the transmission of the data to be printed of the current print line is detected, acquire the ideal number of print blocks B through indexing.
[0052] After the preprocessing of the current print line information is completed, that is, after the printer receives an instruction and generates the current line information to be printed through internal conversion, the maximum block parameter N of the current print line is indexed in the task, and one line of data is printed in several times according to the known maximum block parameter N. In this way, the cost of the hardware structure is reduced while the printing effect is ensured.
[0053] S4. Process the data to be printed in batches, acquire the current print data and the current print sequence number P through an algorithm and store them, and control the heating module on the print head to perform heating printing on the current print data.
[0054] Specifically, before batching, all the data to be printed in the current row is known (i.e., the heating point data to be printed after the conversion of the current row information data mentioned above). Using the batching logic formula B = P / (max-dot / N), it can be determined how many batches the heating points in the current row can be divided into. Then, the current batch is recorded. Based on the current batch, the current row data is combined with the parameter value (e.g., if it is divided into 4 batches, the data of a certain batch can be combined with 0x88, and only 1 / 4 of the data is printed) to obtain the data to be printed in the current batch, and then it is stored and printed.
[0055] In this embodiment, the current print data is stored in the current data generation array final_data[], and the current print data is transmitted to the printer head via a serial peripheral interface.
[0056] S5. In response to determining that the current print sequence number P is greater than the ideal number of print blocks B, return to the operation of steps S2-S5.
[0057] Under the final task (i.e., the current data occurrence array final_data[]), if it is detected that there is data that has not been printed on the printer head, the final_data[] data is heated. After heating B times, the data of the current print line is heated and displayed, and then the paper is fed to complete the printing of the current print line. If it is not completed, return to step S2 and send the unprocessed subsequent data of the current line to the printer head for heating again.
[0058] After the above-described printing block process, in order to solve the problem that uneven density on the left and right sides of the current line can easily occur if heating is done block by block from left to right, the selection and processing of each block after block heating is optimized to ensure the printing uniformity of the printer to the greatest extent. This invention provides another embodiment.
[0059] In another embodiment, if the current print sequence number P is less than or equal to the ideal number of print blocks B, then the current print data, along with the preset parameters, is sent to the printer head.
[0060] L1. When it is detected that there is data to be printed in the current print line and it needs to be sent to the printer head for printing, the ideal number of print blocks B for the current print line is obtained through the array index mentioned above. The array index is block[][].
[0061] L2. After indexing the array, the data to be printed is divided into blocks for printing. Assuming a total of B blocks are needed, the data of the current line is printed through B data sending and receiving cycles. If the value of the current print sequence number P is less than the ideal number of print blocks B, the current data is directly processed and divided. If the value of the current print sequence number P is greater than or equal to the ideal number of print blocks B, the data of the next line is processed.
[0062] L3. The current print sequence number P is less than the ideal print block number B, assuming B = 4. This means the data to be printed needs to be sent out in 4 batches. The conventional method is to print the data from the leftmost position 1 first, then the data from the leftmost position 2, then the rightmost position 2, and so on. However, this method easily leads to significant uneven density. This application uses an AND logical operation to handle this. Specifically, the entire line of data is ANDed with an appropriate parameter, such as ANDing the first segment with 0x88, and then printing the entire line. This effectively ensures the uniformity of the printing effect. For example, if the data to be printed consists of a hexadecimal number, and one of the data is 0xFF, then this number is 1111 1111 in binary. With B = 4, the data is sent out in 4 batches. To achieve a uniform printing effect, the first batch sends 10001000, which is 0x88. The second batch sends 0100 0100, which is 0x44. The third batch sends 0010 0010, which is 0x22. The fourth transmission is 0001 0001, which is 0x11. In this way, the data 11111111 is transmitted in four separate transmissions, ensuring the uniformity of the printed data each time.
[0063] The above assumes the data is distributed in 4 installments. Similarly, it can be distributed in X installments based on the number of different heating points in the current row. X=1 means the entire current row is printed at once. X=2 means it's distributed in 2 installments, with the first installment being 0XAA and the second being 0X55 (both in hexadecimal). Using this as an example, for different number of installments, the goal is simply to ensure the total sum of the multiple installments is 0XFF.
[0064] L3: After detecting that data has been sent, the data is latched and heated, and then the process returns to the beginning to prepare for heating and printing the next data sent.
[0065] Further reference Figure 2 As a implementation of the above method, in a second aspect, this application provides an embodiment of a printer segmented heating system 200, which can be specifically applied to various electronic devices. The system 200 includes the following modules:
[0066] The parameter setting module 210 is configured to preset the maximum number of supported points for the current print line and the maximum block parameter for the current print line;
[0067] The ideal print block number calculation module 220 is configured to determine the ideal print block number B of the data to be printed based on the maximum supported number of points and the maximum block parameter when it is detected that there is data to be printed in the current print line, and to store the ideal print block number B in the block array.
[0068] The ideal print block number acquisition module 230 is configured to acquire the ideal print block number B by means of an index when it is determined that there is data to be printed in the current print line.
[0069] The heating module 240 is configured to process the data to be printed in batches, acquire and store the current print data and the current print sequence number P, and control the heating module on the print head to heat and print the current print data.
[0070] The judgment module 250 is configured to return to the operation of the ideal print block number calculation module, the ideal print block number acquisition module, the heating module, and the judgment module in response to determining that the current print sequence number P is greater than the ideal print block number B.
[0071] Thirdly, this application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the steps of the printer segmented heating method as described in any of the above claims.
[0072] Fourthly, this application provides a computer-readable storage medium storing a computer program, characterized in that, when executed by a processor, the computer program implements the steps of the printer segmented heating method described above.
[0073] The following is for reference. Figure 3 It shows a schematic diagram of the structure of a computer system 300 suitable for implementing terminal devices or servers in the embodiments of this application. Figure 3 The terminal device or server shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0074] like Figure 3 As shown, the computer system 300 includes a central processing unit (CPU) 301, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 302 or programs loaded from storage section 308 into random access memory (RAM) 303. The RAM 303 also stores various programs and data required for the operation of the system 300. The CPU 301, ROM 302, and RAM 303 are interconnected via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0075] The following components are connected to I / O interface 305: an input section 306 including a keyboard, mouse, etc.; an output section 307 including a liquid crystal display (LCD) and speakers, etc.; a storage section 308 including a hard disk, etc.; and a communication section 309 including a network interface card such as a LAN card and a modem, etc. The communication section 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to I / O interface 305 as needed. A removable medium 311, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 310 as needed so that computer programs read from it can be installed into storage section 308 as needed.
[0076] Specifically, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 309, and / or installed from removable medium 311. When the computer program is executed by central processing unit (CPU) 301, it performs the functions defined in the methods of this application. It should be noted that the computer-readable medium described in this application can be a computer-readable signal medium or a computer-readable medium or any combination thereof. The computer-readable medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, a computer-readable medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable medium that can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. Program code contained on a computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0077] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0078] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0079] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described inventive concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.
Claims
1. A method for segmented heating of a printer, characterized in that, Includes the following steps: S1. Preset the maximum number of supported points for the current print line, and preset the maximum block parameter for the current print line; S2. In response to detecting that there is data to be printed in the current print line, determine the ideal number of print blocks B of the data to be printed according to the maximum number of supported points and the maximum block parameter, and store the ideal number of print blocks B in the block array; S3. In response to determining that there is data to be printed in the current print line, the ideal number of print blocks B is obtained through the index; S4. Process the data to be printed in batches, obtain and store the current print data and the current print sequence number P, and control the heating module on the print head to heat and print the current print data. S5. In response to determining that the current print sequence number P is greater than the ideal number of print blocks B, return to the operation of steps S2-S5.
2. The printer segmented heating method according to claim 1, characterized in that, It also includes sending the current print data to the printer head after performing a bitwise AND operation with preset parameters if the current print sequence number P is less than or equal to the ideal print block number B.
3. The printer segmented heating method according to claim 1, characterized in that, In step S4, the current print data is stored in the current data generation array, and data interaction is performed with the printer head via the serial peripheral interface to transmit the current print data to the printer head.
4. The printer segmented heating method according to claim 1, characterized in that, In step S2, the ideal number of printable blocks B of the data to be printed is determined based on the maximum number of supported points and the maximum block size parameter. The specific calculation method is as follows: B = P / (max - dot / N) In the formula, P represents the number of dots in the data to be printed, B represents the ideal number of printable blocks, max-dot represents the maximum number of supported dots, and N represents the maximum block size parameter.
5. The printer segmented heating method according to claim 1, characterized in that, In response to the determination that the ideal number of printable blocks B contains a decimal part, the ideal number of printable blocks B is rounded up.
6. A printer segmented heating system, characterized in that, include: The parameter setting module is configured to preset the maximum number of supported points for the current print line and the maximum block parameter for the current print line; An ideal print block number calculation module is configured to, in response to detecting that there is data to be printed in the current print line, determine the ideal print block number B of the data to be printed based on the maximum supported points and the maximum block parameter, and store the ideal print block number B in a block array; The ideal print block number acquisition module is configured to acquire the ideal print block number B by means of an index when it is determined that there is data to be printed in the current print line. The heating control module is configured to process the data to be printed in batches, acquire and store the current print data and the current print sequence number P, and control the heating module on the print head to heat and print the current print data. The judgment module is configured to return to the operation of the ideal print block number calculation module, the ideal print block number acquisition module, the heating control module, and the judgment module in response to determining that the current print sequence number P is greater than the ideal print block number B.
7. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the printer segmented heating method as described in any one of claims 1 to 5.
8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the printer segmented heating method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Printing control method and device, printer and computer readable storage medium
CN112214183A
Direct printing method using ram storage for spooled printer files
US20080231885A1
