Positioning threshold calculation method and related device

By collecting and analyzing the difference in light-sensing data of the wrapped labels and calculating the positioning threshold, the problem of inaccurate positioning of the printer in the face paper and gap areas was solved, thus improving print quality and label paper utilization.

WO2026153304A1PCT designated stage Publication Date: 2026-07-23WUHAN JINGCHEN INTELLIGENT IDENTIFICATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
WUHAN JINGCHEN INTELLIGENT IDENTIFICATION TECH CO LTD
Filing Date
2026-01-13
Publication Date
2026-07-23

AI Technical Summary

Technical Problem

Existing printers have difficulty accurately positioning the face paper area and gap area when processing wrapped labels, resulting in decreased print quality and label paper waste.

Method used

By collecting first and second light-sensing data, it is detected whether their difference meets multiple preset segmentation conditions. The threshold calculation method corresponding to the target segmentation conditions is obtained, and the positioning threshold is calculated to determine the position on the label.

Benefits of technology

It improves print quality, prevents overlapping, blurring, or misalignment of colors or image elements, reduces label paper waste, and avoids print failures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2026072198_23072026_PF_FP_ABST
    Figure CN2026072198_23072026_PF_FP_ABST
Patent Text Reader

Abstract

A positioning threshold calculation method and a related device, relating to the field of printer control. The calculation method comprises: in response to a threshold calculation instruction, sequentially collecting first light sensing data and second light sensing data; detecting whether the difference between the first light sensing data and the second light sensing data satisfies a target segmentation condition among a plurality of preset segmentation conditions; when it is determined that the difference between the first light sensing data and the second light sensing data satisfies the target segmentation condition, acquiring a threshold calculation method corresponding to the target segmentation condition; and calculating the first light sensing data and the second light sensing data on the basis of the threshold calculation method to obtain a positioning threshold, wherein the positioning threshold is used for determining the position of a print head on a label paper in a printing process. The calculation method can improve the accuracy of the calculated positioning threshold. Only on the basis of an accurate positioning threshold can accurate positioning of a print head of a label printer on a label paper be ensured, thereby improving the printing quality.
Need to check novelty before this filing date? Find Prior Art

Description

Calculation method of positioning threshold and related equipment

[0001] Related applications

[0002] This application claims priority to Chinese patent application No. CN202510078858.8, filed on January 17, 2025, entitled "Method for Calculating Positioning Threshold and Related Device", the entire contents of which are incorporated herein by reference. Technical Field

[0003] This application relates to the field of printer control, and more particularly to a method for calculating a positioning threshold and related equipment. Background Technology

[0004] Printers produce a wide variety of label designs, among which wrap-around labels are widely used in daily life due to their aesthetic appeal and convenience. Wrap-around labels refer to a special type of transparent paper whose face paper is not completely transparent. Instead, special colored ink is printed between the seams and the transparent face paper. This ink, like the material in the seams, absorbs some light signals, resulting in lower light-sensing data compared to ordinary transparent paper.

[0005] In order to distinguish between the face paper and the gap during the printing process, the printer needs a standard to determine the current position of the sensor on the label. Generally, the printer will calculate the threshold between the face paper and the gap. This process is called threshold calibration.

[0006] The threshold calibration process for printers generally consists of three parts: paper detection, gap detection, and threshold calculation. Paper detection and gap detection collect stable paper and gap data during the label paper feeding process to obtain a unified value. Threshold calculation calculates the average of the unified paper and gap values ​​as the threshold. The purpose of the threshold is to distinguish between paper and gap data based on the relationship between the current photosensitive ADC and the threshold value.

[0007] Due to the complexity and variety of printed labels, layering often occurs on the label sheet. Accurately determining whether the label printer is in the label sheet area or the gap area during the printing process has become an urgent problem to be solved. Summary of the Invention

[0008] This application provides a method for calculating a positioning threshold and related equipment, which can solve the above-mentioned problems. The technical solution is as follows:

[0009] In a first aspect, embodiments of this application provide a method for calculating a positioning threshold, the method comprising:

[0010] In response to the threshold calculation command, the first light sensor data and the second light sensor data are collected sequentially.

[0011] Detect whether the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition among multiple preset segmentation conditions;

[0012] When it is determined that the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition, the threshold calculation method corresponding to the target segmentation condition is obtained.

[0013] The first light-sensing data and the second light-sensing data are calculated based on the threshold calculation method to obtain a positioning threshold, which is used to determine the position on the label paper during the printing process.

[0014] Secondly, embodiments of this application provide a device for calculating a positioning threshold, the device comprising:

[0015] The light-sensing data acquisition module is used to sequentially acquire first light-sensing data and second light-sensing data in response to the threshold calculation command.

[0016] The segmentation detection module is used to detect whether the difference between the first light-sensing data and the second light-sensing data meets the target segmentation condition among multiple preset segmentation conditions.

[0017] The calculation and determination module is used to obtain the threshold calculation method corresponding to the target segmentation condition when it is determined that the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition;

[0018] The result obtaining module is used to calculate the first light-sensing data and the second light-sensing data based on the threshold calculation method to obtain a positioning threshold, which is used to determine the position on the label paper during the printing process.

[0019] Thirdly, embodiments of this application provide a computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the above-described method steps.

[0020] Fourthly, embodiments of this application provide a computer program product that stores multiple instructions adapted for loading by a processor and executing the above-described method steps.

[0021] Fifthly, embodiments of this application provide a label printer, which may include: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to execute the above-described method steps.

[0022] The beneficial effects of the technical solutions provided in some embodiments of this application include at least the following:

[0023] In this embodiment, in response to a threshold calculation command, a first light-sensing data and a second light-sensing data are sequentially collected on the label paper using a light sensor. The first and second light-sensing data are obtained based on different material regions on the label paper. A matching threshold calculation method is then derived from the difference between the first and second light-sensing data. This threshold calculation method is used to calculate a positioning threshold from the first and second light-sensing data. Based on this positioning threshold, the label printer collects light-sensing data in real time during subsequent printing and compares the light-sensing data with the positioning threshold to determine whether the area on the label paper is currently a face paper area, a gap area, or another custom-defined area.

[0024] Because the label paper's surface area contains unique elements that cause it to separate into layers, each surface area corresponds to at least two photosensitive data points. Multiple photosensitive data points can affect the calculation of the positioning threshold. This application determines segmentation conditions and a preset threshold calculation method that matches these segmentation conditions by using multiple differences between different areas of the label paper and at least one photosensitive data point corresponding to each area. This allows for the accurate determination of the positioning threshold during printing through multiple threshold calculation methods. Only with an accurate positioning threshold can the print head of the label printer be accurately positioned on the label paper, improving print quality, preventing overlap, blurring, or misalignment of different colors or image elements, reducing label paper waste, and avoiding print failures due to offset or incorrect positioning. Attached Figure Description

[0025] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0026] Figure 1 is a schematic diagram of a label paper provided in an embodiment of this application;

[0027] Figure 2 is a flowchart illustrating a method for calculating a positioning threshold provided in an embodiment of this application;

[0028] Figure 3 is a waveform diagram of multiple light-sensing data provided in an embodiment of this application;

[0029] Figure 4 is a flowchart illustrating a method for calculating a positioning threshold provided in an embodiment of this application;

[0030] Figure 5 is a flowchart illustrating a method for calculating a positioning threshold provided in an embodiment of this application;

[0031] Figure 6 is a schematic diagram of the structure of a positioning threshold calculation device provided in an embodiment of this application;

[0032] Figure 7 is a schematic diagram of the structure of a label printer provided in an embodiment of this application. Detailed Implementation

[0033] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0034] In the description of this application, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. In the description of this application, it should be noted that, unless otherwise expressly specified and limited, "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances. Furthermore, in the description of this application, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist; for example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.

[0035] The present application will now be described in detail with reference to specific embodiments.

[0036] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in the embodiments of this specification are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the features, information, and data involved in this specification were all obtained under full authorization.

[0037] A label printer is a device specifically designed for printing various labels, barcodes, QR codes, RFID tags, etc. It is widely used in retail, warehousing, logistics, manufacturing, and medical fields, primarily for marking goods, items, documents, etc., to facilitate management, tracking, and identification.

[0038] Printers produce a wide variety of label designs, among which wrap-around labels are widely used in daily life due to their aesthetic appeal and convenience. Wrap-around labels refer to a special type of transparent paper whose face paper is not completely transparent. Instead, special colored ink is printed between the seams and the transparent face paper. This ink, like the material in the seams, absorbs some light signals, resulting in lower light-sensing data compared to ordinary transparent paper.

[0039] As shown in Figure 1, which is a schematic diagram of a label paper provided in an embodiment of this application, the label paper includes three face paper areas and two gap areas. The three face paper areas include a face paper area 101, a white ink area 1012 and a transparent paper area 1011 included in the face paper area, and a gap area 102 between two face paper areas.

[0040] In order to distinguish between the paper surface area and the gap area during the printing process, printers need a standard to determine the current position of the sensor on the label. Generally, printers calculate the threshold between the paper surface and the gap, a process called threshold calibration.

[0041] The threshold calibration process for printers generally consists of three parts: paper detection, gap detection, and threshold calculation. Paper detection and gap detection collect stable paper and gap data during the label paper feeding process to obtain a unified value. Threshold calculation calculates the average of the unified paper and gap values ​​as the threshold. The purpose of the threshold is to distinguish between paper and gap data based on the relationship between the current photosensitive ADC and the threshold value.

[0042] Because printed labels are now complex and diverse, there are often layers on the face paper. How can we determine whether the printer is in the face paper area or the gap area during the printing process?

[0043] In one embodiment, as shown in Figure 2, a flowchart illustrating a method for calculating a positioning threshold according to an embodiment of this application is presented. This method can be implemented using a computer program and can run on a positioning threshold calculation device based on the von Neumann architecture. The computer program can be integrated into an application or run as a standalone utility application.

[0044] Specifically, the method for calculating the positioning threshold includes:

[0045] S101, in response to the threshold calculation command, sequentially collect the first light sensor data and the second light sensor data.

[0046] Users interact with the label printer's communication interface via direct touch or remote control to receive threshold calculation instructions that instruct the printer to begin calculating positioning thresholds. For example, the label printer receives threshold calculation instructions sent by the user wirelessly, using technologies such as infrared remote control, Bluetooth, Wi-Fi, Zigbee, or NFC. Alternatively, the label printer receives threshold calculation instructions via a touchscreen or button trigger. In another embodiment, the label printer receives threshold calculation instructions when a specific condition is detected.

[0047] Light-sensing data can be collected using light sensors, such as photoresistors (LDRs), photodiodes, photovoltaic cells, and fiber optic sensors, depending on the application scenario and requirements of the label printer.

[0048] The difference between the first and second light-sensing data lies in the timing of their acquisition and the paper feeding operation of the label printer. The acquisition points for the first and second light-sensing data are located in different areas of the label paper. Understandably, the type of location of the first and second light-sensing data acquisition points may be the same; for example, both may be located in the face paper area or both in the gap area. By comparing the difference between the first and second light-sensing data, a determination can be made, and light-sensing data can be acquired again to calculate the positioning threshold.

[0049] S102. Detect whether the difference between the first light sensing data and the second light sensing data meets the target segmentation condition among multiple preset segmentation conditions.

[0050] Multiple segmentation conditions are distinguished based on differences, with different segmentation conditions corresponding to different difference ranges. For example, one segmentation condition corresponds to a difference range of [N1, N2), while another segmentation condition corresponds to a difference range of (N2, N3). The system detects whether the absolute value of the difference between the first and second light-sensing data falls within these multiple difference ranges. If it does, it indicates that the difference between the first and second light-sensing data satisfies the target segmentation condition corresponding to that difference range.

[0051] In one embodiment, based on the comparison results of comparing the difference between the first light-sensing data and the second light-sensing data with at least one segmentation standard value, it is detected whether the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition among multiple preset segmentation conditions.

[0052] Segmentation standard values ​​can be understood as numerical values ​​used to distinguish the range of differences corresponding to different segmentation conditions. For example, if the range of differences corresponding to one segmentation condition is [N1, N2), and the range of differences corresponding to another segmentation condition is (N2, N3), then the segmentation standard values ​​are N1, N2, and N3. Based on the comparison results of the difference X between the first and second light-sensing data and the segmentation standard values ​​N1, N2, and N3, the target segmentation condition satisfied by the difference between the first and second light-sensing data is determined.

[0053] In one embodiment, at least one segmentation standard value can be determined based on expert experience or user settings.

[0054] In another embodiment, the label paper includes at least two face paper areas and a gap area located between the two face paper areas. The face paper areas include at least a first sub-region and a second sub-region. The step of determining the segmentation standard value may be: acquiring light-sensitive data of the first sub-region, light-sensitive data of the second sub-region, and light-sensitive data of the gap area; wherein the light-sensitive data of the first sub-region is less than the light-sensitive data of the second sub-region; and determining the segmentation standard value based on the difference between the light-sensitive data of the second sub-region and the light-sensitive data of the gap area and the light-sensitive data of the first sub-region.

[0055] As shown in Figure 3, Figure 3 is a waveform diagram of multiple light-sensing data provided in an embodiment of this application. In the figure, area A refers to the gap portion of the label paper, area B refers to the white ink portion of the face paper, which is the first sub-region, area C refers to the ordinary transparent paper portion, which is the second sub-region, and area D refers to the gap portion of the next label paper.

[0056] Ideally, when a label printer performs a printing task, it should detect area B as the paper surface area and area D as the gap area. Therefore, before printing begins, light-sensing data of area B and area D are collected, and the average value of the two is calculated as the positioning threshold. During printing, the actual light-sensing data is compared with the above positioning threshold to determine the position of the label printer at this time.

[0057] However, in practice, there may be scenarios where light-sensing data from region C is used as light-sensing data for the paper area, and light-sensing data from region D is used as light-sensing data for the gap area. The average value of the light-sensing data from regions C and D is significantly larger than the average value mentioned above, and the positioning threshold used as this average value will be close to the light-sensing data from region B. This leads to the problem of incorrectly identifying region B as a gap area when light-sensing data from region B is collected during the printing process, when region B is actually the paper area.

[0058] To address this, this application segments the two types of tissue paper data during the positioning threshold calculation to obtain a segmentation standard value, which is used to determine the two segmentation conditions. It is understood that this explanation uses the example of the two tissue paper regions including a first sub-region and a second sub-region. This application can also include cases where the tissue paper region includes more sub-regions, performing segmentation calculations based on two or more sub-regions and the gap region to obtain multiple segmentation standard values, as well as multiple segmentation conditions and the positioning threshold calculation method corresponding to each segmentation condition.

[0059] Specifically, before printing begins, light-sensing data of region B, which is the first sub-region, is collected as data1, and light-sensing data of region D, which is the gap region, is collected as data3. The difference between data1 and data3 (i.e., data1 - data3) is significantly smaller. At this point, a segmented standard value diff is defined, and a threshold calculation method is defined when the difference between the first and second light-sensing data collected in response to the threshold calculation command is less than the segmented standard value diff.

[0060] The light-sensing data collected from region C, which is the second sub-region, is designated as data2, and the light-sensing data collected from region D, which is the gap region, is designated as data3. The difference between data2 and data3 (i.e., data2 - data3) is significantly larger. Based on the above segmentation standard value diff, a threshold calculation method is formulated when the difference between the first and second light-sensing data collected in response to the threshold calculation command is greater than the segmentation standard value diff.

[0061] S103. When it is determined that the difference between the first light-sensing data and the second light-sensing data meets the target segmentation condition, obtain the threshold calculation method corresponding to the target segmentation condition.

[0062] In this embodiment, a threshold calculation method is preset for each target segmentation condition. Each threshold calculation method is used to calculate the positioning threshold according to a certain calculation rule based on the first light sensing data and the second light sensing data.

[0063] For example, when a label with layered face paper is detected, the light-sensing data for the face paper area is 2600 and 3000, respectively, while the light-sensing data for the gap area is 1800. When the label printer performs a printing task, considering face paper jitter and the error of the light-emitting sensor, in response to the threshold calculation command, the first light-sensing data is collected as 3000+X, and the second light-sensing data is collected as 1800+X. Based on existing technology, the first and second light-sensing data are averaged to obtain a positioning threshold of 2400+X. Further, when performing a printing task based on this positioning threshold, the collected light-sensing data 2600+X1 is compared with the positioning threshold of 2400+X. Because the two are too close, the accuracy in determining whether the area corresponding to the light-sensing data 2600+X1 is the face paper area or the gap area is low, which could very likely lead to abnormal printer positioning.

[0064] Therefore, in this embodiment, at least two segmentation conditions are preset, with a segmentation standard value of 800. In response to a threshold calculation command, if the first light-sensing data is 3000+X and the second light-sensing data is 1800+X, and the difference between the first and second light-sensing data satisfies the target segmentation condition of being greater than 800, a corresponding threshold calculation method is determined. Using this method, a positioning threshold of 2200+X is calculated for the first and second light-sensing data. Alternatively, in response to a threshold calculation command, if the first light-sensing data is 2600+X and the second light-sensing data is 1800+X, and the difference between the first and second light-sensing data satisfies the target segmentation condition of being less than 800, a corresponding threshold calculation method is determined. Using this method, a positioning threshold of 2200+X is calculated for the first and second light-sensing data.

[0065] According to the calculation results, the previous threshold has a high risk of location when the sampling segmentation processing scheme is not used. After adopting the threshold calculation method provided in this application, the location threshold is very close to the ideal threshold, avoiding the problem of locating part of the face paper area as a gap area.

[0066] S104 calculates the positioning threshold based on the first and second light-sensing data using a threshold calculation method. The positioning threshold is used to determine the position on the label paper during the printing process.

[0067] The positioning threshold is calculated based on the target segmentation conditions satisfied by the first and second light-sensing data using a threshold calculation method. This positioning threshold is used to determine the device's position on the label during the printing process.

[0068] In this embodiment, in response to a threshold calculation command, a first light-sensing data and a second light-sensing data are sequentially collected on the label paper using a light sensor. The first and second light-sensing data are obtained based on different material regions on the label paper. A matching threshold calculation method is then derived from the difference between the first and second light-sensing data. This threshold calculation method is used to calculate a positioning threshold from the first and second light-sensing data. Based on this positioning threshold, the label printer collects light-sensing data in real time during subsequent printing and compares the light-sensing data with the positioning threshold to determine whether the area on the label paper is currently a face paper area, a gap area, or another custom-defined area.

[0069] Because the label paper's surface area contains unique elements that cause it to separate into layers, each surface area corresponds to at least two photosensitive data points. Multiple photosensitive data points can affect the calculation of the positioning threshold. This application determines segmentation conditions and a preset threshold calculation method that matches these segmentation conditions by using multiple differences between different areas of the label paper and at least one photosensitive data point corresponding to each area. This allows for the accurate determination of the positioning threshold during printing through multiple threshold calculation methods. Only with an accurate positioning threshold can the print head of the label printer be accurately positioned on the label paper, improving print quality, preventing overlap, blurring, or misalignment of different colors or image elements, reducing label paper waste, and avoiding print failures due to offset or incorrect positioning.

[0070] Based on Figure 2, in one embodiment, multiple preset segmentation conditions include a first segmentation condition, which is that the difference between the first light-sensing data and the second light-sensing data is less than a segmentation standard value. S102 includes the step of: when it is determined that the difference between the first light-sensing data and the second light-sensing data satisfies the first segmentation condition, obtaining a first threshold calculation method corresponding to the first segmentation condition; wherein, the threshold calculation method includes a first threshold calculation method.

[0071] Specifically, based on the comparison results of comparing the difference between the first light-sensing data and the second light-sensing data with at least one segmentation standard value, it is determined that the first light-sensing data and the second light-sensing data satisfy the first segmentation condition that the difference is less than the segmentation standard value.

[0072] In other words, the difference between the first light-sensing data and the second light-sensing data is small, and the paper area corresponding to the first light-sensing data is the transparent paper area. Therefore, the positioning threshold calculated based on the first light-sensing data and the second light-sensing data will not affect the positioning failure of the white ink area included in the paper area during the printing process.

[0073] In this embodiment, the positioning threshold is obtained by calculating the first light-sensing data and the second light-sensing data based on the threshold calculation method, including: calculating the average value of the first light-sensing data and the second light-sensing data based on the first threshold calculation method to obtain the first positioning threshold; wherein, the positioning threshold includes the first positioning threshold.

[0074] For example, when a layered wrapping label for a certain type of facial tissue is detected, the light-sensing data for the tissue area is 2600 and 3000 respectively, the light-sensing data for the gap area is 1800, and the segmentation standard value is 800. In response to the threshold calculation command, the first light-sensing data is collected as 2600+X, and the second light-sensing data is collected as 1800+X. At this time, the first light-sensing data and the second light-sensing data meet the first segmentation condition of being less than the segmentation standard value. The first threshold calculation method corresponding to the first segmentation condition is determined to be the average value calculation, that is, the positioning threshold threshold1 = (first light-sensing data + second light-sensing data) / 2 = 2400+X.

[0075] Based on Figure 2, in one embodiment, multiple preset segmentation conditions include a second segmentation condition, where the difference between the first light-sensing data and the second light-sensing data is greater than or equal to a segmentation standard value. S102 includes the step of: when it is determined that the difference between the first light-sensing data and the second light-sensing data satisfies the second segmentation condition, obtaining a second threshold calculation method corresponding to the second segmentation condition; wherein, the threshold calculation method includes a second threshold calculation method.

[0076] Specifically, based on the comparison results of comparing the difference between the first light-sensing data and the second light-sensing data with at least one segmentation standard value, it is determined that the first light-sensing data and the second light-sensing data satisfy the second segmentation condition that the difference is greater than or equal to the segmentation standard value.

[0077] In other words, if the difference between the first and second light-sensing data is large, and the area of ​​the paper corresponding to the first light-sensing data is the white ink area, the positioning threshold calculated based on the first and second light-sensing data may cause positioning failures in the paper area, including the transparent paper area, during the printing process.

[0078] In this embodiment, a positioning threshold is obtained by calculating the first light-sensing data and the second light-sensing data based on a threshold calculation method. This includes: obtaining the absolute value of the difference between the first light-sensing data and the second light-sensing data as an intermediate value based on a second threshold calculation method, and obtaining the second positioning threshold based on the intermediate value and the target light-sensing data; wherein the target light-sensing data is the smaller value between the first light-sensing data and the second light-sensing data, and the positioning threshold includes the second positioning threshold.

[0079] For example, when a layered wrapping label for a certain type of facial tissue is detected, the light-sensing data for the tissue area is 2600 and 3000 respectively, the light-sensing data for the gap area is 1800, and the segmentation standard value is 800. In response to the threshold calculation command, the first light-sensing data is collected as 2600+X, and the second light-sensing data is collected as 1800+X. At this time, the first and second light-sensing data satisfy the second segmentation condition of being greater than or equal to the segmentation standard value. Therefore, the second threshold calculation method corresponding to the second segmentation condition is determined to be average value calculation.

[0080] The absolute value of the difference between the first and second light-sensing data is used as the median value. The second positioning threshold is obtained based on the median value and the target light-sensing data. That is, the positioning threshold2 = (|first light-sensing data - second light-sensing data| + min(second light-sensing data, first light-sensing data)) / 2 = 2400 + X.

[0081] In another embodiment, a positioning threshold is obtained by calculating the first light-sensing data and the second light-sensing data based on a threshold calculation method, including: obtaining the absolute value of the difference between the first light-sensing data and the second light-sensing data as an intermediate value based on a second threshold calculation method, and summing the target light-sensing data with the intermediate value of the configured calculation coefficient to obtain the second positioning threshold; wherein the calculation coefficient is less than 1 and greater than 0, the target light-sensing data is the smaller value of the first light-sensing data and the second light-sensing data, and the positioning threshold includes the second positioning threshold.

[0082] The calculation coefficient can be any coefficient. For example, if the calculation coefficient is 1 / 3, then when calculating the threshold, take 1 / 3 of the difference and try to get as close as possible to the trough position. That is, the positioning threshold is: threshold = (|first light sensor data - second light sensor data| / 3 + min(second light sensor data, first light sensor data)) / 2 = 2400 + X.

[0083] This application determines segmentation conditions and a preset threshold calculation method that matches the segmentation conditions by using multiple differences between multiple light-sensing data points corresponding to different areas on the label paper. Thus, during printing, an accurate positioning threshold is obtained through multiple threshold calculation methods. Only by using an accurate positioning threshold can the accurate positioning of the print head of the label printer on the label paper be guaranteed, thereby improving print quality, preventing problems such as overlapping, blurring, or misalignment of different colors or image elements, reducing label paper waste, and avoiding printing failures due to offset or positional errors.

[0084] In one embodiment, as shown in Figure 4, a flowchart illustrating a method for calculating a positioning threshold according to an embodiment of this application is presented. This method can be implemented using a computer program and can run on a positioning threshold calculation device based on the von Neumann architecture. The computer program can be integrated into an application or run as a standalone utility application.

[0085] Specifically, the method for calculating the positioning threshold includes:

[0086] S201. In response to the threshold calculation command, the first light sensor data and the second light sensor data are collected sequentially.

[0087] See S101 above; it will not be repeated here.

[0088] S202. Detect whether the difference between the first light-sensing data and the second light-sensing data is less than the segmentation standard value.

[0089] Based on the comparison results of the difference between the first and second light-sensing data and the segmentation standard value, it is determined whether the difference between the first and second light-sensing data satisfies the first and second segmentation conditions. For example, specifically, the difference range corresponding to the first segmentation condition is [N1, N2), and the difference range corresponding to the other segmentation condition is (N2, N3), where the segmentation standard value is N2.

[0090] S203. When the difference between the first light-sensing data and the second light-sensing data is less than the segmentation standard value, determine that the difference between the first light-sensing data and the second light-sensing data meets the first segmentation condition, and obtain the first threshold calculation method corresponding to the first segmentation condition.

[0091] The difference between the first light-sensing data and the second light-sensing data satisfies the first segmentation condition, indicating that the difference between the first light-sensing data and the second light-sensing data is small, and the paper area corresponding to the first light-sensing data is the transparent paper area.

[0092] S204. Calculate the first light-sensing data and the second light-sensing data based on the first threshold calculation method to obtain the positioning threshold.

[0093] Based on the first threshold calculation method, the average value of the first light-sensing data and the second light-sensing data is calculated to obtain the first positioning threshold, which includes the first positioning threshold.

[0094] S205. When the difference between the first light-sensing data and the second light-sensing data is greater than or equal to the segmentation standard value, and the difference between the first light-sensing data and the second light-sensing data satisfies the second segmentation condition, the second threshold calculation method corresponding to the second segmentation condition is obtained.

[0095] The difference between the first light-sensing data and the second light-sensing data satisfies the second segmentation condition, indicating that the difference between the first light-sensing data and the second light-sensing data is relatively large, and the paper area corresponding to the first light-sensing data is a white ink area.

[0096] S206. The positioning threshold is obtained by calculating the first light-sensing data and the second light-sensing data based on the second threshold calculation method.

[0097] Based on the second threshold calculation method, the absolute value of the difference between the first and second light-sensing data is obtained as an intermediate value. The target light-sensing data is then summed with the intermediate value of the configured calculation coefficient to obtain the second positioning threshold. The calculation coefficient is less than 1 and greater than 0, the target light-sensing data is the smaller value between the first and second light-sensing data, and the positioning threshold includes the second positioning threshold.

[0098] Because the label paper's surface area contains unique elements that cause it to separate into layers, each surface area corresponds to at least two photosensitive data points. Multiple photosensitive data points can affect the calculation of the positioning threshold. This application determines segmentation conditions and a preset threshold calculation method that matches these segmentation conditions by using multiple differences between different areas of the label paper and at least one photosensitive data point corresponding to each area. This allows for the accurate determination of the positioning threshold during printing through multiple threshold calculation methods. Only with an accurate positioning threshold can the print head of the label printer be accurately positioned on the label paper, improving print quality, preventing overlap, blurring, or misalignment of different colors or image elements, reducing label paper waste, and avoiding print failures due to offset or incorrect positioning.

[0099] In one embodiment, as shown in Figure 5, a flowchart illustrating a method for calculating a positioning threshold provided in this application is presented. This method can be implemented using a computer program and can run on a positioning threshold calculation device based on the von Neumann architecture. The computer program can be integrated into an application or run as a standalone utility application.

[0100] Specifically, the method for calculating the positioning threshold includes:

[0101] S301. When the printer lid is detected to switch from closed to open, obtain the threshold calculation instruction.

[0102] When the label printer's cartridge cover is opened, the internal light-sensing data may change due to variations in lighting conditions, temperature, etc. This necessitates the label printer recalculating and updating its positioning thresholds to adapt to the new environmental conditions and ensure positioning accuracy and normal operation during printing. Lighting Changes: When the cover is opened, the lighting conditions inside the printer change, altering the light intensity received by the sensors.

[0103] When the label printer detects that the lid has switched from a closed state to an open state using the lid sensor, it determines that the threshold calculation instruction is met and obtains the threshold calculation instruction.

[0104] S302, in response to the threshold calculation command, the first light sensor data and the second light sensor data are collected sequentially.

[0105] See S101, which will not be repeated here.

[0106] S303. Detect whether the difference between the first light sensing data and the second light sensing data meets the target segmentation condition among multiple preset segmentation conditions.

[0107] See S102, which will not be repeated here.

[0108] S304. When it is determined that the difference between the first light-sensing data and the second light-sensing data meets the target segmentation condition, obtain the threshold calculation method corresponding to the target segmentation condition.

[0109] See S103, which will not be repeated here.

[0110] S305. The first and second light-sensing data are calculated based on the threshold calculation method to obtain the positioning threshold.

[0111] See S104, which will not be repeated here.

[0112] In one embodiment, third light-sensing data is acquired; it is detected whether the difference between the second and third light-sensing data meets the target segmentation condition; if it is determined that the difference between the second and third light-sensing data does not meet the target segmentation condition, a threshold calculation method corresponding to the segmentation condition matching the difference between the second and third light-sensing data is obtained; the second and third light-sensing data are calculated according to the threshold calculation method corresponding to the segmentation condition matching the difference between the second and third light-sensing data to obtain the positioning threshold to be calculated; the positioning threshold to be calculated and the positioning threshold are calculated to obtain the target positioning threshold; wherein, the target positioning threshold is used to replace the positioning threshold to determine the position on the label paper during the printing process.

[0113] In other words, in this embodiment, first light-sensing data, second light-sensing data, and third light-sensing data can be collected and calculated to obtain the final target positioning threshold used for positioning. When the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition and the positioning threshold is obtained based on the threshold calculation method of the target segmentation condition, the positioning threshold threshold3 is calculated.

[0114] Furthermore, based on the threshold calculation method corresponding to the segmentation conditions matching the difference between the second and third light-sensing data, the second and third light-sensing data are calculated to obtain the positioning threshold threshold4 to be calculated. The threshold calculation method for the second and third light-sensing data can be the same as or different from the threshold calculation method for the target segmentation conditions.

[0115] The target positioning threshold is obtained by calculating the two positioning thresholds, threshold4 and threshold3. For example, the average or weighted average of the two positioning thresholds can be calculated to obtain the final target threshold used for positioning in a given task.

[0116] In this embodiment, a positioning threshold is calculated using multiple light-sensing data. Specifically, the segmentation conditions and corresponding threshold calculation methods are determined by the difference between two sequentially collected light-sensing data, thereby obtaining at least two positioning thresholds. The target positioning threshold is then calculated using these at least two positioning thresholds, which can effectively improve the accuracy of the obtained target positioning threshold and enhance the positioning accuracy of the label printer when performing printing tasks.

[0117] S306. During the printing process, collect and detect light-sensing data;

[0118] During the printing process, label printers use optical sensors such as photoresistors (LDRs), photodiodes, photovoltaic cells, and fiber optic sensors to collect and detect light data in real time.

[0119] S307. Determine the position on the label based on the comparison result between the detected light sensing data and the positioning threshold.

[0120] Specifically, the label paper includes at least two face paper areas and a gap area between the two face paper areas; it is determined whether the detected light sensing data is less than or equal to the positioning threshold. If the detected light sensing data is less than or equal to the positioning threshold, it is determined that the label is in the gap area. If the detected light sensing data is greater than the positioning threshold, it is determined that the label is in the face paper area.

[0121] For example, by calculating the first and second light-sensing data using a threshold calculation method, the positioning threshold is determined to be 2200. When executing a printing task, if the detected light-sensing data is 2500, then the location of the detected light-sensing data is determined to be the paper area. If the detected light-sensing data is 1600, then the location of the detected light-sensing data is determined to be the gap area.

[0122] Because the label paper's surface area contains unique elements that cause it to separate into layers, each surface area corresponds to at least two photosensitive data points. Multiple photosensitive data points can affect the calculation of the positioning threshold. This application determines segmentation conditions and a preset threshold calculation method that matches these segmentation conditions by using multiple differences between different areas of the label paper and at least one photosensitive data point corresponding to each area. This allows for the accurate determination of the positioning threshold during printing through multiple threshold calculation methods. Only with an accurate positioning threshold can the print head of the label printer be accurately positioned on the label paper, improving print quality, preventing overlap, blurring, or misalignment of different colors or image elements, reducing label paper waste, and avoiding print failures due to offset or incorrect positioning.

[0123] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.

[0124] Please refer to Figure 6, which shows a schematic diagram of a positioning threshold calculation device provided in an exemplary embodiment of this application. This positioning threshold calculation device can be implemented as all or part of a device through software, hardware, or a combination of both. The device includes a light-sensing data acquisition module 401, a segmented detection module 402, a calculation and determination module 403, and a result acquisition module 404.

[0125] The light-sensing data acquisition module 401 is used to sequentially acquire first light-sensing data and second light-sensing data in response to a threshold calculation command.

[0126] The segmentation detection module 402 is used to detect whether the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition among multiple preset segmentation conditions.

[0127] The calculation and determination module 403 is used to obtain the threshold calculation method corresponding to the target segmentation condition when it is determined that the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition;

[0128] The result module 404 is used to calculate the first light-sensing data and the second light-sensing data based on the threshold calculation method to obtain a positioning threshold, which is used to determine the position on the label paper during the printing process.

[0129] In one embodiment, the plurality of preset segmentation conditions include a first segmentation condition, wherein the difference between the first light-sensing data and the second light-sensing data is less than a segmentation standard value.

[0130] The calculation and determination module 403 includes:

[0131] The first determining unit is configured to, when determining that the difference between the first light-sensing data and the second light-sensing data satisfies the first segmentation condition, obtain a first threshold calculation method corresponding to the first segmentation condition; wherein, the threshold calculation method includes the first threshold calculation method.

[0132] In one embodiment, the first determining unit includes:

[0133] The first determining subunit is used to calculate the average value of the first light-sensing data and the second light-sensing data based on the first threshold calculation method to obtain a first positioning threshold; wherein the positioning threshold includes the first positioning threshold.

[0134] In one embodiment, the plurality of preset segmentation conditions include a second segmentation condition, wherein the difference between the first photosensitive data and the second photosensitive data is greater than or equal to a segmentation standard value.

[0135] The calculation and determination module 403 includes:

[0136] The second determining unit is used to obtain a second threshold calculation method corresponding to the second segmentation condition when it is determined that the difference between the first light-sensing data and the second light-sensing data satisfies the second segmentation condition; wherein the threshold calculation method includes the second threshold calculation method.

[0137] In one embodiment, the second determining unit includes:

[0138] The second determining subunit is used to obtain the absolute value of the difference between the first light-sensing data and the second light-sensing data as an intermediate value based on the second threshold calculation method, and to obtain a second positioning threshold based on the intermediate value and the target light-sensing data; wherein the target light-sensing data is the smaller value between the first light-sensing data and the second light-sensing data, and the positioning threshold includes the second positioning threshold.

[0139] In one embodiment, the second determining unit includes:

[0140] The third determining subunit is used to obtain the absolute value of the difference between the first light-sensing data and the second light-sensing data as an intermediate value based on the second threshold calculation method, and to sum the target light-sensing data with the intermediate value of the configured calculation coefficient to obtain a second positioning threshold; wherein the calculation coefficient is less than 1 and greater than 0, the target light-sensing data is the smaller value between the first light-sensing data and the second light-sensing data, and the positioning threshold includes the second positioning threshold.

[0141] In one embodiment, the segmentation detection module 402 includes:

[0142] The comparison detection unit is used to detect whether the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition among multiple preset segmentation conditions, based on the comparison result of comparing the difference between the first light-sensing data and the second light-sensing data with at least one segmentation standard value.

[0143] In one embodiment, the label paper includes at least two face paper regions and a gap region located between the two face paper regions, wherein the face paper regions include at least a first sub-region and a second sub-region;

[0144] The segmented detection module 402 also includes:

[0145] The first detection unit is used to acquire light-sensing data of the first sub-region, light-sensing data of the second sub-region, and light-sensing data of the gap region; wherein the light-sensing data of the first sub-region is less than the light-sensing data of the second sub-region.

[0146] The second detection unit is used to determine the segmentation standard value based on the difference between the light-sensing data of the second sub-region and the light-sensing data of the gap region, as well as the light-sensing data of the first sub-region.

[0147] In one embodiment, the positioning threshold calculation module includes:

[0148] The instruction acquisition module is used to acquire the threshold calculation instruction when the printer lid is detected to switch from a closed state to an open state.

[0149] In one embodiment, the positioning threshold calculation module includes:

[0150] The data acquisition module is used to acquire third-party light sensor data;

[0151] The condition judgment module is used to detect whether the difference between the second light-sensing data and the third light-sensing data satisfies the target segmentation condition;

[0152] The rematching module is used to obtain a threshold calculation method corresponding to the segmentation condition that matches the difference between the second light-sensing data and the third light-sensing data when it is determined that the difference between the second light-sensing data and the third light-sensing data does not meet the target segmentation condition;

[0153] The threshold acquisition module is used to calculate the second light-sensing data and the third light-sensing data according to the threshold calculation method corresponding to the segmentation condition matching the difference between the second light-sensing data and the third light-sensing data, and obtain the positioning threshold to be calculated.

[0154] The target threshold acquisition module is used to calculate the positioning threshold to be calculated and the positioning threshold to obtain the target positioning threshold; wherein, the target positioning threshold is used to replace the positioning threshold to determine the position on the label paper during the printing process.

[0155] In one embodiment, the positioning threshold calculation module further includes:

[0156] The detection and acquisition module is used to acquire detection light-sensing data during the printing process;

[0157] The comparison module is used to determine the position on the label paper based on the comparison result of the detected light sensing data and the positioning threshold.

[0158] In one embodiment, the label paper includes at least two face paper areas and a gap area located between the two face paper areas;

[0159] The comparison module includes:

[0160] The first judgment unit is used to determine whether the detected light sensing data is less than or equal to the positioning threshold.

[0161] The second determination unit is used to determine that the location is in the gap region when the detected light sensing data is less than or equal to the positioning threshold.

[0162] Because the label paper's surface area contains unique elements that cause it to separate into layers, each surface area corresponds to at least two photosensitive data points. Multiple photosensitive data points can affect the calculation of the positioning threshold. This application determines segmentation conditions and a preset threshold calculation method that matches these segmentation conditions by using multiple differences between different areas of the label paper and at least one photosensitive data point corresponding to each area. This allows for the accurate determination of the positioning threshold during printing through multiple threshold calculation methods. Only with an accurate positioning threshold can the print head of the label printer be accurately positioned on the label paper, improving print quality, preventing overlap, blurring, or misalignment of different colors or image elements, reducing label paper waste, and avoiding print failures due to offset or incorrect positioning.

[0163] It should be noted that the positioning threshold calculation device provided in the above embodiments is only illustrated by the division of the above functional modules when executing the positioning threshold calculation method. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the positioning threshold calculation device and the positioning threshold calculation method embodiments provided in the above embodiments belong to the same concept, and the implementation process is detailed in the method embodiments, which will not be repeated here.

[0164] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0165] This application also provides a computer storage medium that can store multiple instructions. The instructions are adapted to be loaded and executed by a processor to calculate the positioning threshold as shown in the embodiments of Figures 1-5 above. For the specific execution process, please refer to the detailed description of the embodiments shown in Figures 1-5, which will not be repeated here.

[0166] This application also provides a computer program product that stores at least one instruction. The at least one instruction is loaded by a processor and executed to calculate the positioning threshold as shown in the embodiments of Figures 1-5 above. For the specific execution process, please refer to the detailed description of the embodiments shown in Figures 1-5, which will not be repeated here.

[0167] Please refer to Figure 7, which is a schematic diagram of the structure of a label printer provided in an embodiment of this application. As shown in Figure 7, the electronic device 500 may include: at least one processor 501, at least one network interface 504, a user interface 503, a memory 505, and at least one communication bus 502.

[0168] The communication bus 502 is used to enable communication between these components.

[0169] The user interface 503 may include a display screen and a camera. Optionally, the user interface 503 may also include a standard wired interface and a wireless interface.

[0170] The network interface 504 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

[0171] The processor 501 may include one or more processing cores. The processor 501 connects to various parts of the server 500 using various interfaces and lines, and performs various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 505, and by calling data stored in the memory 505. Optionally, the processor 501 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 501 may integrate one or a combination of several of the following: a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), and a modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content to be displayed on the screen; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 501 and may be implemented as a separate chip.

[0172] The memory 505 may include random access memory (RAM) or read-only memory. Optionally, the memory 505 may include a non-transitory computer-readable storage medium. The memory 505 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 505 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 505 may also be at least one storage device located remotely from the aforementioned processor 501. As shown in FIG7, the memory 505, as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a location threshold calculation application.

[0173] In the electronic device 500 shown in Figure 7, the user interface 503 is mainly used to provide an input interface for the user and to acquire user input data; while the processor 501 can be used to call the positioning threshold calculation application stored in the memory 505 and specifically perform the following operations:

[0174] In response to the threshold calculation command, the first light sensor data and the second light sensor data are collected sequentially.

[0175] Detect whether the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition among multiple preset segmentation conditions;

[0176] When it is determined that the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition, the threshold calculation method corresponding to the target segmentation condition is obtained.

[0177] The first light-sensing data and the second light-sensing data are calculated based on the threshold calculation method to obtain a positioning threshold, which is used to determine the position on the label paper during the printing process.

[0178] In one embodiment, the plurality of preset segmentation conditions include a first segmentation condition, wherein the difference between the first light-sensing data and the second light-sensing data is less than a segmentation standard value.

[0179] Processor 501 executes the step of obtaining the threshold calculation method corresponding to the target segmentation condition when it is determined that the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition. Specifically, the following steps are performed:

[0180] When it is determined that the difference between the first light-sensing data and the second light-sensing data satisfies the first segmentation condition, a first threshold calculation method corresponding to the first segmentation condition is obtained; wherein, the threshold calculation method includes the first threshold calculation method.

[0181] In one embodiment, the processor 501 executes the threshold calculation method to calculate the positioning threshold based on the first light-sensing data and the second light-sensing data, specifically executing:

[0182] Based on the first threshold calculation method, the average value of the first light-sensing data and the second light-sensing data is calculated to obtain a first positioning threshold; wherein, the positioning threshold includes the first positioning threshold.

[0183] In one embodiment, the plurality of preset segmentation conditions include a second segmentation condition, wherein the difference between the first photosensitive data and the second photosensitive data is greater than or equal to a segmentation standard value.

[0184] Processor 501 executes the step of obtaining the threshold calculation method corresponding to the target segmentation condition when it is determined that the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition. Specifically, the following steps are performed:

[0185] When it is determined that the difference between the first light-sensing data and the second light-sensing data satisfies the second segmentation condition, a second threshold calculation method corresponding to the second segmentation condition is obtained; wherein, the threshold calculation method includes the second threshold calculation method.

[0186] In one embodiment, the processor 501 performs calculations on the first light-sensing data and the second light-sensing data based on the threshold calculation method to obtain a positioning threshold, specifically:

[0187] Based on the second threshold calculation method, the absolute value of the difference between the first light-sensing data and the second light-sensing data is obtained as an intermediate value, and a second positioning threshold is obtained based on the intermediate value and the target light-sensing data; wherein, the target light-sensing data is the smaller value between the first light-sensing data and the second light-sensing data, and the positioning threshold includes the second positioning threshold.

[0188] In one embodiment, the processor 501 executes the threshold calculation method to calculate the positioning threshold based on the first light-sensing data and the second light-sensing data, specifically executing:

[0189] Based on the second threshold calculation method, the absolute value of the difference between the first light-sensing data and the second light-sensing data is obtained as an intermediate value. The target light-sensing data is summed with the intermediate value of the configured calculation coefficient to obtain the second positioning threshold. The calculation coefficient is less than 1 and greater than 0. The target light-sensing data is the smaller value between the first light-sensing data and the second light-sensing data. The positioning threshold includes the second positioning threshold.

[0190] In one embodiment, the processor 501 performs the action of detecting whether the difference between the first light-sensing data and the second light-sensing data satisfies a target segmentation condition among multiple preset segmentation conditions, specifically by:

[0191] Based on the comparison results of comparing the difference between the first light-sensing data and the second light-sensing data with at least one segmentation standard value, it is detected whether the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition among multiple preset segmentation conditions.

[0192] In one embodiment, the label paper includes at least two face paper regions and a gap region located between the two face paper regions, wherein the face paper regions include at least a first sub-region and a second sub-region;

[0193] Before processor 501 executes the step of detecting whether the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition among multiple preset segmentation conditions, it also executes:

[0194] Acquire the light-sensing data of the first sub-region, the light-sensing data of the second sub-region, and the light-sensing data of the gap region; wherein the light-sensing data of the first sub-region is less than the light-sensing data of the second sub-region;

[0195] The segmentation standard value is determined based on the difference between the light-sensing data of the second sub-region and the light-sensing data of the gap region, as well as the light-sensing data of the first sub-region.

[0196] In one embodiment, before the processor 501 executes the threshold calculation instruction and sequentially acquires the first and second light-sensing data, it also executes:

[0197] When the printer lid is detected to switch from closed to open, the threshold calculation instruction is obtained.

[0198] In one embodiment, after the processor 501 executes the threshold calculation method to calculate the first light-sensing data and the second light-sensing data to obtain the positioning threshold, it further executes:

[0199] Collect third-party light sensor data;

[0200] Detect whether the difference between the second light-sensing data and the third light-sensing data satisfies the target segmentation condition;

[0201] If the difference between the second light-sensing data and the third light-sensing data does not meet the target segmentation condition, a threshold calculation method corresponding to the segmentation condition that matches the difference between the second light-sensing data and the third light-sensing data is obtained.

[0202] The second and third optical data are calculated based on the threshold calculation method corresponding to the segmentation condition of the difference between the second and third optical data to obtain the positioning threshold to be calculated.

[0203] The target positioning threshold is obtained by calculating the positioning threshold to be calculated and the positioning threshold; wherein the target positioning threshold is used to replace the positioning threshold to determine the position on the label paper during the printing process.

[0204] In one embodiment, after the processor 501 calculates the positioning threshold based on the threshold calculation method on the first light-sensing data and the second light-sensing data, it further performs the following:

[0205] During the printing process, light-sensing data is collected and detected.

[0206] The position on the label is determined based on the comparison result between the detected light-sensing data and the positioning threshold.

[0207] In one embodiment, the label paper includes at least two face paper areas and a gap area located between the two face paper areas;

[0208] The processor 501 executes the comparison result based on the comparison between the detected light-sensing data and the positioning threshold to determine the position on the label paper, specifically by:

[0209] Determine whether the detected light-sensing data is less than or equal to the positioning threshold;

[0210] When the detected light-sensing data is determined to be less than or equal to the positioning threshold, it is determined that the location is in the gap region.

[0211] Because the label paper's surface area contains unique elements that cause it to separate into layers, each surface area corresponds to at least two photosensitive data points. Multiple photosensitive data points can affect the calculation of the positioning threshold. This application determines segmentation conditions and a preset threshold calculation method that matches these segmentation conditions by using multiple differences between different areas of the label paper and at least one photosensitive data point corresponding to each area. This allows for the accurate determination of the positioning threshold during printing through multiple threshold calculation methods. Only with an accurate positioning threshold can the print head of the label printer be accurately positioned on the label paper, improving print quality, preventing overlap, blurring, or misalignment of different colors or image elements, reducing label paper waste, and avoiding print failures due to offset or incorrect positioning.

[0212] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The storage medium can be a magnetic disk, optical disk, read-only memory, or random access memory, etc.

[0213] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0214] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application are still within the scope of this application.

Claims

1. A method for calculating a positioning threshold, characterized in that, The method includes: In response to the threshold calculation command, the first light sensor data and the second light sensor data are collected sequentially. Detect whether the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition among multiple preset segmentation conditions; When it is determined that the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition, the threshold calculation method corresponding to the target segmentation condition is obtained. The first light-sensing data and the second light-sensing data are calculated based on the threshold calculation method to obtain a positioning threshold, which is used to determine the position on the label paper during the printing process.

2. The method for calculating the positioning threshold according to claim 1, characterized in that, The plurality of preset segmentation conditions include a first segmentation condition, wherein the difference between the first light-sensing data and the second light-sensing data is less than a segmentation standard value. The method for calculating the threshold corresponding to the target segmentation condition when determining that the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition includes: When it is determined that the difference between the first light-sensing data and the second light-sensing data satisfies the first segmentation condition, a first threshold calculation method corresponding to the first segmentation condition is obtained; wherein, the threshold calculation method includes the first threshold calculation method.

3. The method for calculating the positioning threshold according to claim 2, characterized in that, The step of calculating the positioning threshold based on the threshold calculation method using the first light-sensing data and the second light-sensing data includes: Based on the first threshold calculation method, the average value of the first light-sensing data and the second light-sensing data is calculated to obtain a first positioning threshold; wherein, the positioning threshold includes the first positioning threshold.

4. The method for calculating the positioning threshold according to claim 1, characterized in that, The plurality of preset segmentation conditions include a second segmentation condition, wherein the difference between the first photosensitive data and the second photosensitive data is greater than or equal to a segmentation standard value. The method for calculating the threshold corresponding to the target segmentation condition when determining that the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition includes: When it is determined that the difference between the first light-sensing data and the second light-sensing data satisfies the second segmentation condition, a second threshold calculation method corresponding to the second segmentation condition is obtained; wherein, the threshold calculation method includes the second threshold calculation method.

5. The method for calculating the positioning threshold according to claim 4, characterized in that, Based on the threshold calculation method, the first light-sensing data and the second light-sensing data are calculated to obtain a positioning threshold, including: Based on the second threshold calculation method, the absolute value of the difference between the first light-sensing data and the second light-sensing data is obtained as an intermediate value, and a second positioning threshold is obtained based on the intermediate value and the target light-sensing data; wherein, the target light-sensing data is the smaller value between the first light-sensing data and the second light-sensing data, and the positioning threshold includes the second positioning threshold.

6. The method for calculating the positioning threshold according to claim 4, characterized in that, The step of calculating the positioning threshold based on the threshold calculation method using the first light-sensing data and the second light-sensing data includes: Based on the second threshold calculation method, the absolute value of the difference between the first light-sensing data and the second light-sensing data is obtained as an intermediate value. The target light-sensing data is summed with the intermediate value of the configured calculation coefficient to obtain the second positioning threshold. The calculation coefficient is less than 1 and greater than 0. The target light-sensing data is the smaller value between the first light-sensing data and the second light-sensing data. The positioning threshold includes the second positioning threshold.

7. The method for calculating the positioning threshold according to claim 1, characterized in that, The step of detecting whether the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition among multiple preset segmentation conditions includes: Based on the comparison results of comparing the difference between the first light-sensing data and the second light-sensing data with at least one segmentation standard value, it is detected whether the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition among multiple preset segmentation conditions.

8. The method for calculating the positioning threshold according to claim 7, characterized in that, The label paper includes at least two face paper areas and a gap area located between the two face paper areas, wherein the face paper areas include at least a first sub-area and a second sub-area; Before detecting whether the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition among multiple preset segmentation conditions, the method further includes: Acquire the light-sensing data of the first sub-region, the light-sensing data of the second sub-region, and the light-sensing data of the gap region; wherein the light-sensing data of the first sub-region is less than the light-sensing data of the second sub-region; The segmentation standard value is determined based on the difference between the light-sensing data of the second sub-region and the light-sensing data of the gap region, as well as the light-sensing data of the first sub-region.

9. The method for calculating the positioning threshold according to claim 1, characterized in that, Before sequentially acquiring the first and second light-sensing data in response to the threshold calculation command, the method further includes: When the printer lid is detected to switch from closed to open, the threshold calculation instruction is obtained.

10. The method for calculating the positioning threshold according to claim 1, characterized in that, After calculating the positioning threshold based on the threshold calculation method using the first light-sensing data and the second light-sensing data, the method further includes: Collect third-party light sensor data; Detect whether the difference between the second light-sensing data and the third light-sensing data satisfies the target segmentation condition; If the difference between the second light-sensing data and the third light-sensing data does not meet the target segmentation condition, a threshold calculation method corresponding to the segmentation condition that matches the difference between the second light-sensing data and the third light-sensing data is obtained. The second and third optical data are calculated based on the threshold calculation method corresponding to the segmentation condition of the difference between the second and third optical data to obtain the positioning threshold to be calculated. The target positioning threshold is obtained by calculating the positioning threshold to be calculated and the positioning threshold; wherein the target positioning threshold is used to replace the positioning threshold to determine the position on the label paper during the printing process.

11. The method for calculating the positioning threshold according to claim 1, characterized in that, After calculating the positioning threshold based on the first light-sensing data and the second light-sensing data using the threshold calculation method, the method further includes: During the printing process, light-sensing data is collected and detected. The position on the label is determined based on the comparison result between the detected light-sensing data and the positioning threshold.

12. The method for calculating the positioning threshold according to claim 11, characterized in that, The label paper includes at least two face paper areas and a gap area located between the two face paper areas; Determining the position on the label based on the comparison result between the detected light-sensing data and the positioning threshold includes: Determine whether the detected light-sensing data is less than or equal to the positioning threshold; When the detected light-sensing data is determined to be less than or equal to the positioning threshold, it is determined that the location is in the gap region.

13. A device for calculating a positioning threshold, characterized in that, The device includes: The light-sensing data acquisition module is used to sequentially acquire first light-sensing data and second light-sensing data in response to the threshold calculation command. The segmentation detection module is used to detect whether the difference between the first light-sensing data and the second light-sensing data meets the target segmentation condition among multiple preset segmentation conditions. The calculation and determination module is used to obtain the threshold calculation method corresponding to the target segmentation condition when it is determined that the difference between the first light-sensing data and the second light-sensing data satisfies the target segmentation condition; The result obtaining module is used to calculate the first light-sensing data and the second light-sensing data based on the threshold calculation method to obtain a positioning threshold, which is used to determine the position on the label paper during the printing process.

14. A computer storage medium, characterized in that, The computer storage medium stores a plurality of instructions, which are adapted to be loaded by a processor and executed as method steps as claimed in any one of claims 1 to 12.

15. A computer program product, characterized in that, The computer program product stores multiple instructions adapted for loading by a processor and executing the method steps as claimed in any one of claims 1 to 12.

16. A label printer, characterized in that, include: A processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and executed the method steps as claimed in any one of claims 1 to 12.