Printer paper out detection methods, devices, electronic equipment, media, and software products
By employing a combined detection method of transmission and reflection detection modes in the printer, the problem of low reliability in traditional printer paper shortage detection is solved, enabling accurate identification of different paper types and reducing false alarm rate.
Patent Information
- Application Number
- CN202611515565.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-28
- Publication Date
- 2026-11-17
AI Technical Summary
Traditional printers use a single method for paper shortage detection. The differences in light transmission and reflectivity of different types of paper can lead to detection values that are close to a paperless state, easily causing false paper shortage alarms and reducing the reliability of the detection.
A combined detection method using transmission and reflection detection modes is employed. First detection information is obtained through the first detection mode. If the paper shortage condition is met, the system switches to the second detection mode for verification. The system then determines whether the second detection information meets the paper shortage condition and ultimately determines the paper shortage status of the printer.
It improves the accuracy and reliability of paper shortage detection and reduces misjudgments caused by special paper such as translucent thin paper and black label paper.
Smart Images

Figure CN123104255A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of printer technology, and in particular to a printer paper out detection method, device, electronic equipment, media, and program product. Background Technology
[0002] Printers typically use optical sensors located in the paper path to detect the presence of paper, stopping the printing job and displaying a paper out warning when paper is out. Traditional paper out detection methods usually employ a single detection method. However, different types of paper have significantly different light transmission and reflective properties. When using a single detection mode, the detection value for some special types of paper may be very close to the detection value when there is no paper, leading to inaccurate paper status judgment, false paper out alarms, and consequently, low reliability of the printer's paper out detection. Summary of the Invention
[0003] This application provides a method, apparatus, electronic device, media, and program product for detecting paper out of a printer, which can improve the reliability of paper out of paper detection and reduce the probability of false alarms caused by special paper types. The above technical solution is as follows: In a first aspect, embodiments of this application provide a method for detecting a printer paper shortage, including: Upon detecting a paper out detection request for the current printer, optical detection is performed on the paper path of the current printer based on the first detection mode to obtain the first detection information; If the first detection information meets the first paper shortage condition, the first detection mode is switched to the second detection mode, and optical detection is performed on the paper channel of the current printer based on the second detection mode to obtain the second detection information. The first detection mode and the second detection mode are both one of the transmission detection mode and the reflection detection mode, and the first detection mode is different from the second detection mode. Determine whether the above second detection information meets the second paper shortage condition corresponding to the above second detection mode; If the second detection information meets the second paper shortage condition, the printer is determined to be in a preliminary paper shortage state.
[0004] In one possible implementation, the first detection information includes a first detection value, and the second detection information includes a second detection value; The first paper shortage condition includes: when the first detection mode is the transmission detection mode, the first detection value is greater than a preset transmission paper shortage threshold; or, when the first detection mode is the reflection detection mode, the first detection value is less than a preset reflection paper shortage threshold. The second paper shortage condition includes: when the second detection mode is the transmission detection mode, the second detection value is greater than the transmission paper shortage threshold; or, when the second detection mode is the reflection detection mode, the second detection value is less than the reflection paper shortage threshold.
[0005] In one possible implementation, the first detection information includes a plurality of first detection values obtained by continuous detection, and the second detection information includes a plurality of second detection values obtained by continuous detection. The aforementioned first paper shortage condition includes: when the first detection mode is the transmission detection mode, all of the aforementioned first detection values are greater than a preset transmission paper shortage threshold, and the duration for which the aforementioned first detection values are continuously greater than the transmission paper shortage threshold reaches a first preset duration; or, when the first detection mode is the reflection detection mode, all of the aforementioned first detection values are less than a preset reflection paper shortage threshold, and the duration for which the aforementioned first detection values are continuously less than the reflection paper shortage threshold reaches a second preset duration. The aforementioned second paper shortage condition includes: when the second detection mode is the transmission detection mode, all of the aforementioned second detection values are greater than the transmission paper shortage threshold, and the duration for which the aforementioned second detection values are continuously greater than the transmission paper shortage threshold reaches a third preset duration; or, when the second detection mode is the reflection detection mode, all of the aforementioned second detection values are less than the reflection paper shortage threshold, and the duration for which the aforementioned second detection values are continuously less than the reflection paper shortage threshold reaches a fourth preset duration.
[0006] In one possible implementation, the above method also includes: The transmission sampling value when the paper channel is in a paperless state is obtained as the first transmission reference value; The transmission sampling value of the target paper when it is set in the paper channel is obtained as the second transmission reference value; wherein the transmission sampling value of the target paper is greater than the transmission sampling value corresponding to the preset reference paper and less than the first transmission reference value. A transmission paper shortage threshold is determined based on the first transmission reference value and the second transmission reference value, wherein the transmission paper shortage threshold is greater than the second transmission reference value and less than the first transmission reference value.
[0007] In one possible implementation, the above method also includes: Obtain the reflection sample value when the paper channel is in a paperless state, and use it as the first reflection reference value; The reflection sample value of the printing medium with the target reflection area in the paper channel and the target reflection area is located at the reflective optical detection position is obtained as the second reflection reference value; wherein the reflection sample value of the target reflection area is less than the reflection sample value corresponding to the preset reference paper and greater than the first reflection reference value. The paper shortage threshold is determined based on the first reflection reference value and the second reflection reference value. The paper shortage threshold is greater than the first reflection reference value and less than the second reflection reference value.
[0008] In one possible implementation, determining the transmission paper shortage threshold based on the first transmission reference value and the second transmission reference value includes: The first transmission reference value and the second transmission reference value are averaged to obtain the intermediate transmission value. The preset first bias is added to the above-mentioned transmission intermediate value to obtain the above-mentioned transmission paper shortage threshold. Wherein, the first bias is a positive value and is less than half the difference between the first transmission reference value and the second transmission reference value, so that the transmission paper shortage threshold is located between the first transmission reference value and the second transmission reference value, and shifts towards the transmission sampling value corresponding to the paperless state.
[0009] In one possible implementation, determining the reflective paper shortage threshold based on the first reflective reference value and the second reflective reference value includes: The first reflection reference value and the second reflection reference value are averaged to obtain the intermediate reflection value; The preset second bias is subtracted from the above intermediate reflection value to obtain the above reflection paper shortage threshold. Wherein, the second bias is a positive value and is less than half the difference between the second reflection reference value and the first reflection reference value, so that the paper shortage threshold is located between the first reflection reference value and the second reflection reference value, and is shifted towards the reflection sampling value corresponding to the paperless state.
[0010] In one possible implementation, the above method also includes: If the first detection information does not meet the first paper shortage condition, the printer is determined to be in a paper-ready state; or, If the second detection information does not meet the second paper shortage condition, the printer is determined to be in a paper-ready state.
[0011] In one possible implementation, before performing optical detection on the paper path of the current printer based on the first detection mode to obtain the first detection information, the method further includes: If a paper out detection request is detected for the current printer, obtain the current default detection mode of the current printer; The default detection mode is set as the first detection mode.
[0012] In one possible implementation, before performing optical detection on the paper path of the current printer based on the first detection mode to obtain the first detection information, the method further includes: According to the first detection mode, obtain the target calibration luminescence intensity corresponding to the first detection mode; Adjust the light intensity of the optical sensor of the current printer to the target calibration light intensity; After the luminous intensity of the aforementioned optical sensor meets the preset stability condition, the step of performing optical detection on the paper channel of the current printer based on the first detection mode to obtain the first detection information is executed.
[0013] In one possible implementation, the above method also includes: Based on the above paper out detection request, determine the event type that triggered this paper out detection. The above event type is any one of the following: a first event type that indicates that the printer cover has switched from an open state to a closed state, and a second event type that indicates that the printing task has been completed or the printing failure has been resolved. If the event type is the first event type, the first preset duration and / or the second preset duration will be adjusted to the first duration. If the event type is the second event type, the first preset duration and / or the second preset duration will be adjusted to the second duration. The first duration mentioned above is longer than the second duration mentioned above.
[0014] In one possible implementation, both the first preset duration and the second preset duration are not less than a preset duration threshold, which is used to characterize the time required for the paper to naturally sink from its initial state in the paper channel to a state of contact with the paper channel.
[0015] In one possible implementation, the aforementioned current printer includes a light emitting unit, a transmitted light receiver, and a reflected light receiver; Before performing optical detection on the paper path of the current printer based on the first detection mode to obtain the first detection information, the method further includes: With the aforementioned light emitting unit in the off state, the first ambient light sampling value of the aforementioned transmitted light receiver and the second ambient light sampling value of the aforementioned reflected light receiver are acquired. With the aforementioned light emitting unit in the turned-on state, the first light sample value of the aforementioned transmitted light receiver and the second light sample value of the aforementioned reflected light receiver are acquired. When the first detection mode is the transmission detection mode, the first detection value in the first detection information is the difference between the first illuminated sample value and the first ambient light sample value. When the first detection mode is the reflection detection mode, the first detection value in the first detection information is the difference between the second illuminated sample value and the second ambient light sample value. When the second detection mode is the transmission detection mode, the second detection value in the second detection information is the difference between the first illuminated sampling value and the first ambient light sampling value. When the second detection mode is the reflection detection mode, the second detection value in the second detection information is the difference between the second illuminated sample value and the second ambient light sample value.
[0016] In one possible implementation, the above method also includes: After determining that the printer is in a preliminary paper shortage state, and after confirming that the paper path of the printer is in a paperless state and detecting that the top cover of the printer is closed, the transmission reference value and reflection reference value in the current paperless state are obtained. The above transmission reference value is compared with the historical transmission reference value, and the above reflection reference value is compared with the historical reflection reference value to determine the optical path attenuation amplitude; If the optical path attenuation exceeds a preset attenuation threshold, the driving intensity of the current printer's light emitting unit is compensated, and / or an optical path cleaning prompt is output.
[0017] In one possible implementation, the printing medium used by the aforementioned printer is perforated label paper, which includes a plurality of positioning holes spaced apart along the paper feed direction; after determining that the aforementioned printer is in a preliminary paper shortage state, the method further includes: Obtain the diameter length of the positioning hole in the paper feed direction, and the minimum distance between the opposite edges of two adjacent positioning holes in the paper feed direction. When the minimum spacing is greater than the aperture length, the paper feed motor of the current printer is controlled to drive the hole positioning label paper to move a preset micro-motion distance along the paper output direction or paper return direction, wherein the preset micro-motion distance is greater than the aperture length and less than the minimum spacing. After moving the preset micro-motion distance, the current detection mode is switched to the first detection mode, and optical detection is performed on the paper channel based on the first detection mode to obtain the third detection information. If the third detection information meets the first paper shortage condition, the first detection mode is switched to the second detection mode, and optical detection is performed on the paper channel based on the second detection mode to obtain the fourth detection information. If the third detection information meets the first paper shortage condition and the fourth detection information meets the second paper shortage condition, it is determined that the printer is currently in a paper shortage state. If the third detection information does not meet the first paper shortage condition, or if the third detection information meets the first paper shortage condition but the fourth detection information does not meet the second paper shortage condition, then the printer is determined to be in a paper-ready state.
[0018] In one possible implementation, the printing medium used by the aforementioned printer is perforated label paper, which includes a plurality of positioning holes spaced apart along the paper feed direction; after determining that the aforementioned printer is in a preliminary paper shortage state, the method further includes: Obtain the diameter length of the positioning hole in the paper feed direction, and the minimum distance between the opposite edges of two adjacent positioning holes in the paper feed direction. When the minimum spacing is less than or equal to the aperture length, the paper feed motor of the current printer is controlled to drive the hole positioning label paper along the paper output direction or paper return direction to perform continuous micro-motion with a preset micro-motion step size. After each micro-motion, the current detection mode is switched to the first detection mode mentioned above, and optical detection is performed on the paper channel based on the first detection mode to obtain the first re-inspection detection information. If the first re-inspection information meets the first paper shortage condition, the first detection mode is switched to the second detection mode, and optical detection is performed on the paper channel based on the second detection mode to obtain the second re-inspection information. After any micro-motion, if the first re-inspection information does not meet the first paper shortage condition, or if the first re-inspection information meets the first paper shortage condition and the second re-inspection information does not meet the second paper shortage condition, then it is determined that the printer is currently in a paper-ready state. If the number of consecutive micro-movements reaches the preset maximum number of micro-movements, and the first re-inspection detection information obtained after each micro-movement satisfies the first paper shortage condition, and the second re-inspection detection information satisfies the second paper shortage condition, then the printer is determined to be in a paper shortage state.
[0019] In one possible implementation, the preset micro-motion step size is determined based on the aperture length and the minimum spacing, wherein the preset micro-motion step size is less than or equal to the aperture length and less than or equal to the minimum spacing.
[0020] In one possible implementation, the preset micro-motion step size is greater than or equal to the preset minimum resolution step size.
[0021] Secondly, embodiments of this application provide a printer paper out detection device, comprising: The first detection module is used to perform optical detection on the paper channel of the current printer based on the first detection mode when a paper out detection request for the current printer is detected, so as to obtain the first detection information. The second detection module is used to switch the first detection mode to the second detection mode when the first detection information meets the first paper shortage condition, and to perform optical detection on the paper channel of the current printer based on the second detection mode to obtain the second detection information. The first detection mode and the second detection mode are both one of the transmission detection mode and the reflection detection mode, and the first detection mode is different from the second detection mode. The judgment module is used to determine whether the above-mentioned second detection information meets the second paper shortage condition corresponding to the above-mentioned second detection mode. The first determining module is used to determine that the printer is in a preliminary paper shortage state when the second detection information meets the second paper shortage condition.
[0022] Thirdly, embodiments of this application provide an electronic device, including: a processor and a memory; wherein the memory stores a computer program, and the processor executes the computer program to implement the method steps provided in the first aspect of embodiments of this application.
[0023] Fourthly, embodiments of this application provide a computer storage medium storing multiple instructions adapted for loading and executing the method steps provided in the first aspect of embodiments of this application by a processor.
[0024] Fifthly, embodiments of this application provide a computer program product containing instructions that, when run on a computer or processor, cause the computer or processor to execute the method steps provided in the first aspect of embodiments of this application.
[0025] This embodiment of the application, upon detecting a paper out detection request for the current printer, performs optical detection on the paper path of the current printer based on a first detection mode to obtain first detection information; subsequently, if the first detection information meets a first paper out condition, the first detection mode is switched to a second detection mode, and optical detection is performed on the paper path of the current printer based on the second detection mode to obtain second detection information. Both the first and second detection modes are one of a transmission detection mode and a reflection detection mode, and the first detection mode is different from the second detection mode; it also determines whether the second detection information meets a second paper out condition corresponding to the second detection mode; and if the second detection information meets the second paper out condition, it determines that the printer is in a preliminary paper out state. Therefore, by using a combination of transmission and reflection detection modes to detect the paper state, and switching to another detection mode for verification when the first detection mode shows paper out characteristics, it avoids determining the paper out state based solely on a single optical detection result, reduces false paper outages caused by special printing media such as translucent thin paper and black mark paper, and improves the accuracy and reliability of paper outage detection. Attached Figure Description
[0026] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1 This is a schematic diagram illustrating an application scenario of a printer paper out detection method provided in an embodiment of this application; Figure 2 A flowchart illustrating a printer paper out detection method provided in an embodiment of this application; Figure 3 A flowchart illustrating another printer paper out detection method provided in this application embodiment; Figure 4 A flowchart illustrating another printer paper out detection method provided in this application embodiment; Figure 5 This is a schematic diagram of the structure of a printer paper out detection device provided in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0028] To make the features and advantages of the embodiments of this application more apparent and understandable, 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 protection scope of the embodiments of this application.
[0029] In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this application as detailed in the appended claims. Furthermore, in the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B; the word "and / or" in the text is merely a description of the association 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. Additionally, in the description of the embodiments of this application, "multiple" refers to two or more.
[0030] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.
[0031] Printers typically use optical sensors located in the paper path to detect the presence of paper, stopping the printing job and displaying a paper out warning when paper is out. Traditional paper out detection methods usually employ a single detection method. However, different types of paper have significantly different light transmission and reflective properties. When using a single detection mode, the detection value for some special types of paper may be very close to the detection value when there is no paper, leading to inaccurate paper status judgment, false paper out alarms, and consequently, low reliability of the printer's paper out detection.
[0032] Therefore, this application provides a printer paper out detection method to solve the technical problem of low reliability of the above-mentioned printer paper out detection.
[0033] Please see Figure 1 , Figure 1 This is a schematic diagram illustrating an application scenario of a printer paper shortage detection method provided in an embodiment of this application.
[0034] like Figure 1As shown, this application scenario can include a printer, which has a paper path, and an optical sensor located in the paper path. The paper path allows printing media to move within the printer, and the optical sensor performs optical detection on the printing media passing through the paper path to determine whether printing media is present in the paper path.
[0035] The optical sensor supports both transmission and reflection detection modes. In transmission detection mode, transmission detection information is determined based on the transmitted light signal formed after light passes through the paper path or printing medium. In reflection detection mode, reflection detection information is determined based on the reflected light signal formed after light is reflected from the printing medium in the paper path. The printer can determine the paper status in the paper path based on at least one of the transmission and reflection detection information.
[0036] Optionally, the printing media used by the printer can have different optical properties. For example, such as Figure 1 As shown in the paper illustration on the right, the printing medium can include plain white paper, semi-transparent thin paper, and black mark paper. Plain white paper typically has low light transmittance and high reflectivity; semi-transparent thin paper has relatively high light transmittance, and its transmission detection results may be close to those in a paperless state; black mark paper can include black marked areas. When the optical sensor detects these black marked areas, their reflectivity is low, and their reflection detection results may be close to those in a paperless state.
[0037] In some embodiments, when a paper out detection request for the current printer is detected, optical detection is performed on the paper path of the current printer based on a first detection mode to obtain first detection information; if the first detection information meets a first paper out condition, the first detection mode is switched to a second detection mode, and optical detection is performed on the paper path of the current printer based on the second detection mode to obtain second detection information. Both the first and second detection modes are one of a transmission detection mode and a reflection detection mode, and the first detection mode is different from the second detection mode; then it can be determined whether the second detection information meets the second paper out condition corresponding to the second detection mode; and if the second detection information meets the second paper out condition, it is determined that the printer is in a preliminary paper out state.
[0038] Please see Figure 2 , Figure 2 This is a flowchart illustrating a printer paper out detection method provided in an embodiment of this application. Figure 2 As shown, a printer paper out detection method may include at least: S201: When a paper shortage detection request for the current printer is detected, optical detection is performed on the paper path of the current printer based on the first detection mode to obtain first detection information.
[0039] The printer can be a label printer, thermal printer, receipt printer, or other printing device that delivers printing media via a paper path. For example, in Figure 1 In the application scenario shown, the current printer can be a printer that is equipped with a paper path and an optical sensor.
[0040] Optionally, a paper out detection request can be used to trigger the current printer to perform a paper status detection, specifically to instruct the current printer to detect whether printing media is present in the paper path. The paper out detection request can be generated by the printer's internal control program or in response to a specific printer event. For example, a paper out detection request can be generated when the printer lid changes from open to closed, a print job is completed, or a printing error process ends.
[0041] In some embodiments, the printer may generate a paper out detection request after the lid is closed to determine whether the user has correctly placed the paper into the paper path; it may also generate a paper out detection request after the printing job is completed to determine whether there is still printing media in the paper path.
[0042] Understandably, the paper path can be the channel used to transport printing media in a current printer, and can be formed by a paper guide structure, paper feed rollers, rubber rollers, and other structures. Printing media such as paper and labels can move along the paper path from the paper feed position to the printing position or the paper output position. Optical sensors can be set at detection positions corresponding to the paper path to detect printing media passing through those detection positions.
[0043] It should be noted that optical inspection can be a process of emitting detection light into the paper path and determining detection information based on the optical signal formed after the detection light passes through the paper path or printing medium. Optical inspection can include transmissive optical inspection and reflective optical inspection. For example, the transmissive detection value can be determined by detecting the light intensity after passing through the paper path, and the reflective detection value can be determined by detecting the light intensity reflected back from the printing medium.
[0044] Optionally, the first detection mode can be the optical detection mode initially used in this paper out detection process, and can be either a transmission detection mode or a reflection detection mode. For example, if the optical sensor is currently in transmission detection mode when the printer receives a paper out detection request, the transmission detection mode can be directly used as the first detection mode; in other cases, the reflection detection mode can also be used as the first detection mode.
[0045] Among them, the transmission detection mode can detect paper status based on the change in light intensity after light passes through the paper channel or printing medium. When there is no paper in the paper channel, the emitted light is less blocked, so the transmission detection value is usually large; when there is ordinary paper in the paper channel, the paper blocks the emitted light, so the transmission detection value is usually small. Conversely, the reflection detection mode can detect paper status based on the intensity of reflected light formed after the emitted light is reflected by the printing medium. When there is no paper in the paper channel, the light reflected to the light receiver is usually small, so the reflection detection value is usually small; when there is ordinary white paper in the paper channel, the paper reflects more detection light, so the reflection detection value is usually large.
[0046] Optionally, the first detection information can be information obtained after optically detecting the paper path of the current printer based on the first detection mode. This information can be used to characterize the optical features of the paper path in the first detection mode and serve as the basis for determining whether the current paper state meets the first paper shortage condition. The first detection information can include a single first detection value or multiple first detection values obtained through continuous detection. The first detection value can be an optical detection value collected by the optical sensor in the first detection mode. For example, when the first detection mode is a transmission detection mode, the first detection value can be a transmission detection value; when the first detection mode is a reflection detection mode, the first detection value can be a reflection detection value.
[0047] S202: When the first detection information meets the first paper shortage condition, the first detection mode is switched to the second detection mode, and optical detection is performed on the paper channel of the current printer based on the second detection mode to obtain the second detection information. The first detection mode and the second detection mode are both one of the transmission detection mode and the reflection detection mode, and the first detection mode is different from the second detection mode.
[0048] The first paper shortage condition can be a judgment condition corresponding to the first detection mode, used to determine whether the first detection information exhibits paperless optical characteristics. The first paper shortage condition can be different for different detection modes.
[0049] Optionally, the second detection mode can be another optical detection mode adopted after the first detection mode. The second detection mode is different from the first detection mode. That is, when the first detection mode is a transmission detection mode, the second detection mode is a reflection detection mode; when the first detection mode is a reflection detection mode, the second detection mode is a transmission detection mode. The first and second detection modes employ different optical detection mechanisms, allowing the same special printing medium exhibiting suspected paper shortage characteristics in one detection mode to be further verified through the other detection mode.
[0050] Understandably, detection mode switching can be a process of controlling the optical sensor to switch from the currently used optical detection method to another. Furthermore, given that different detection modes correspond to different calibrated luminous intensities, the luminous intensity of the optical sensor can be adjusted to the calibrated luminous intensity corresponding to the second detection mode.
[0051] For example, when the first detection mode is the transmission detection mode, after the first detection information meets the first paper shortage condition, the light intensity of the optical sensor can be adjusted to the calibrated light intensity corresponding to the reflection detection, and the reflected light signal can be collected by the reflected light receiver, thereby completing the switch from the transmission detection mode to the reflection detection mode.
[0052] Optionally, the second detection information can be used to characterize the optical features of the paper channel in the second detection mode, and serve as a basis for determining whether the current paper state meets the second paper shortage condition. The second detection information may include a single second detection value, or multiple second detection values obtained through continuous detection. The second detection value can be an optical detection value acquired by the optical sensor in the second detection mode. For example, when the second detection mode is a transmission detection mode, the second detection value can be a transmission detection value; when the second detection mode is a reflection detection mode, the second detection value can be a reflection detection value.
[0053] It should be noted that the first detection information meeting the first paper shortage condition only indicates that the current optical detection result in the first detection mode exhibits characteristics similar to a paperless state, and does not necessarily mean that the printer is actually out of paper. For example, when the first detection mode is transmission detection mode, if there is a semi-transparent thin paper in the paper channel, the light transmittance of this semi-transparent thin paper is relatively high, and its transmission detection value may be greater than the transmission paper shortage threshold, thus meeting the first paper shortage condition. As another example, when the first detection mode is reflection detection mode, if the optical sensor is currently corresponding to the black marked area of the black mark paper, the reflectivity of this area is relatively low, and its reflection detection value may be less than the reflection paper shortage threshold, thus meeting the first paper shortage condition. Therefore, after the first detection information meets the first paper shortage condition, it is not directly determined that the printer is currently out of paper; instead, the detection mode is further switched for verification.
[0054] S203: Determine whether the above second detection information meets the second paper shortage condition corresponding to the above second detection mode.
[0055] The second paper shortage condition can be a judgment condition corresponding to the second detection mode, used to determine whether the second detection information exhibits paperless optical characteristics. Since the second detection mode differs from the first detection mode, the second paper shortage condition can be used to further confirm the current paper state from another optical detection dimension. For example, when the second detection mode is a transmission detection mode, the second paper shortage condition can be determined based on the relationship between the transmission detection value and the transmission paper shortage threshold; when the second detection mode is a reflection detection mode, the second paper shortage condition can be determined based on the relationship between the reflection detection value and the reflection paper shortage threshold.
[0056] S204: If the second detection information meets the second paper shortage condition, the printer is determined to be in a preliminary paper shortage state.
[0057] The initial paper shortage status can be determined when both detection results show paperless characteristics after sequential detection in the first detection mode and the second detection mode. This status can be used to indicate that the printer has a high probability of being out of paper.
[0058] Specifically, if the first detection information meets the first paper shortage condition, and the second detection information further meets the second paper shortage condition, it indicates that the paper channel exhibits optical characteristics corresponding to the paperless state in both different optical detection modes. Therefore, the current printer can be determined to be in a preliminary paper shortage state.
[0059] For example, when the first detection mode is the transmission detection mode and the second detection mode is the reflection detection mode, if the transmission detection value is greater than the transmission paper shortage threshold and the reflection detection value is less than the reflection paper shortage threshold, it can be determined that the printer is currently in a preliminary paper shortage state.
[0060] It should be noted that the initial paper shortage state can serve as an intermediate state for further determining the final paper condition. For example, for perforated label paper, when the optical sensor's detection position is exactly at the perforation, it may simultaneously exhibit a high transmittance and a low reflectance. Therefore, the initial paper shortage state can be further confirmed by controlling the paper's micro-movements and re-performing the optical detection.
[0061] In one specific embodiment, taking a transmission detection mode as the first detection mode and a reflection detection mode as the second detection mode as an example, after detecting a paper shortage detection request, the light intensity of the optical sensor can be adjusted to the calibrated light intensity corresponding to transmission detection, and after the light adjustment stabilizes, the transmission detection value is acquired at a detection period of 1ms. If the transmission detection value is continuously greater than the transmission paper shortage threshold for 300ms, it can be determined that the first detection information meets the first paper shortage condition, and the system switches to the reflection detection mode. Subsequently, the light intensity of the optical sensor can be adjusted to the calibrated light intensity corresponding to reflection detection, and after the light adjustment stabilizes, the reflection detection value is acquired at a detection period of 1ms. If the reflection detection value is continuously less than the reflection paper shortage threshold for 300ms, it can be determined that the second detection information meets the second paper shortage condition, and thus the printer is in a preliminary paper shortage state. If the transmission detection value does not meet the corresponding first paper shortage condition, or the reflection detection value does not meet the corresponding second paper shortage condition, it can be determined that the printer is in a paper-ready state.
[0062] In this embodiment, upon detecting a paper out detection request for the current printer, optical detection is performed on the paper path of the current printer based on a first detection mode to obtain first detection information. Subsequently, if the first detection information meets a first paper out condition, the first detection mode is switched to a second detection mode, and optical detection is performed on the paper path of the current printer based on the second detection mode to obtain second detection information. Both the first and second detection modes are one of transmission detection and reflection detection modes, and the first detection mode is different from the second detection mode. It is then determined whether the second detection information meets the second paper out condition corresponding to the second detection mode. Finally, if the second detection information meets the second paper out condition, the printer is determined to be in a preliminary paper out state. Therefore, by using a combination of transmission and reflection detection modes to detect the paper state, and switching to another detection mode for verification when the first detection mode shows paper out characteristics, the paper out state can be avoided by relying solely on a single optical detection result, reducing false paper outages caused by special printing media such as translucent thin paper and black mark paper, and improving the accuracy and reliability of paper outage detection.
[0063] In one embodiment, when the first detection information includes a first detection value and the second detection information includes a second detection value, the first paper shortage condition includes: when the first detection mode is the transmission detection mode, the first detection value is greater than a preset transmission paper shortage threshold; or, when the first detection mode is the reflection detection mode, the first detection value is less than a preset reflection paper shortage threshold. Correspondingly, the second paper shortage condition may include: when the second detection mode is the transmission detection mode, the second detection value is greater than the transmission paper shortage threshold; or, when the second detection mode is the reflection detection mode, the second detection value is less than the reflection paper shortage threshold.
[0064] In this embodiment, the paper condition can be determined based on the first and second detection values obtained from a single detection.
[0065] Optionally, the transmission paper shortage threshold can be a reference threshold used to determine whether the transmission detection result exhibits paperless characteristics. Since the detection light is less obstructed in the paperless state, the transmission detection value is usually larger. Therefore, when the first detection mode or the second detection mode is a transmission detection mode, the corresponding detection information can be determined to meet the paper shortage condition if the corresponding detection value is greater than the transmission paper shortage threshold.
[0066] Accordingly, the reflection paper shortage threshold can be used as a reference threshold to determine whether the reflection detection result shows paperless characteristics. Since the amount of light that can be reflected to the light receiver in a paperless state is usually small, the reflection detection value is usually small. Therefore, when the first detection mode or the second detection mode is the reflection detection mode, it can be determined that the corresponding detection information meets the paper shortage condition if the corresponding detection value is less than the reflection paper shortage threshold.
[0067] Specifically, taking the first detection mode as the transmission detection mode and the second detection mode as the reflection detection mode as an example, the first detection value can be compared with the transmission paper shortage threshold first; if the first detection value is greater than the transmission paper shortage threshold, the second detection value is further obtained and compared with the reflection paper shortage threshold; if the second detection value is further less than the reflection paper shortage threshold, it indicates that both transmission detection and reflection detection show paperless characteristics.
[0068] In this embodiment, by comparing the first detection value and the second detection value with the paper shortage threshold in the corresponding detection mode, the paper status can be judged by combining the transmission detection features and the reflection detection features. When a paper shortage feature is presented in one detection mode, another detection mode is used for further verification, thereby reducing false judgments of paper shortage caused by special printing media such as semi-transparent thin paper and black mark areas, and improving the accuracy of paper shortage detection results.
[0069] In another embodiment, when the first detection information includes multiple first detection values obtained through continuous detection, and the second detection information includes multiple second detection values obtained through continuous detection, the first paper shortage condition may include: when the first detection mode is the transmission detection mode, all of the multiple first detection values are greater than a preset transmission paper shortage threshold, and the duration for which the multiple first detection values are continuously greater than the transmission paper shortage threshold reaches a first preset duration; or, when the first detection mode is the reflection detection mode, all of the multiple first detection values are less than a preset reflection paper shortage threshold, and the duration for which the multiple first detection values are continuously greater than the transmission paper shortage threshold reaches a first preset duration; The duration for which a first detection value is continuously less than the aforementioned reflective paper shortage threshold reaches a second preset duration; correspondingly, the aforementioned second paper shortage condition includes: when the aforementioned second detection mode is the aforementioned transmission detection mode, all of the aforementioned second detection values are greater than the aforementioned transmission paper shortage threshold, and the duration for which the aforementioned second detection values are continuously greater than the aforementioned transmission paper shortage threshold reaches a third preset duration; or, when the aforementioned second detection mode is the aforementioned reflection detection mode, all of the aforementioned second detection values are less than the aforementioned reflective paper shortage threshold, and the duration for which the aforementioned second detection values are continuously less than the aforementioned reflective paper shortage threshold reaches a fourth preset duration.
[0070] The multiple first detection values can be multiple optical detection values continuously acquired in the first detection mode according to a preset detection cycle, and the multiple second detection values can be multiple optical detection values continuously acquired in the second detection mode according to a preset detection cycle. For example, the corresponding detection values can be continuously acquired at a detection cycle of 1ms. By continuously acquiring multiple detection values, it can be determined whether the detection result continuously presents the optical characteristics corresponding to the paperless state over a period of time, rather than judging based solely on the detection result at a single moment.
[0071] Optionally, the first preset duration can be the duration for which the transmission detection value needs to be continuously greater than the transmission paper shortage threshold when the first detection mode is transmission detection mode; the second preset duration can be the duration for which the reflection detection value needs to be continuously less than the reflection paper shortage threshold when the first detection mode is reflection detection mode. Correspondingly, the third preset duration can be the duration for which the corresponding transmission paper shortage feature needs to be continuously satisfied when the second detection mode is transmission detection mode; the fourth preset duration can be the duration for which the corresponding reflection paper shortage feature needs to be continuously satisfied when the second detection mode is reflection detection mode.
[0072] Specifically, when the first detection mode is the transmission detection mode, multiple first detection values can be continuously acquired. When all first detection values are greater than the transmission paper shortage threshold, and this state continues for a first preset duration, it is determined that the first detection information meets the first paper shortage condition. If, during this duration, a first detection value is less than or equal to the transmission paper shortage threshold, it is determined that the first detection information does not meet the first paper shortage condition. Correspondingly, when the first detection mode is the reflection detection mode, when multiple first detection values are continuously less than the reflection paper shortage threshold and continue for a second preset duration, it is determined that the first detection information meets the first paper shortage condition. After the first detection information meets the first paper shortage condition and the system switches to the second detection mode, the second detection information can be judged in the same way. For example, when the second detection mode is the reflection detection mode, if multiple second detection values are all less than the reflection paper shortage threshold, and the duration of the continuous values being less than the reflection paper shortage threshold reaches a fourth preset duration, then it can be determined that the second detection information meets the second paper shortage condition; if the second detection mode is the transmission detection mode, then it can be determined that the second detection information meets the second paper shortage condition when the duration of the continuous values being greater than the transmission paper shortage threshold reaches a third preset duration.
[0073] For example, the corresponding preset duration can be set to 300ms. For instance, during transmission detection, continuous detection is performed at a detection cycle of 1ms. When the transmission detection value is continuously greater than the transmission paper shortage threshold for 300ms, the transmission paper shortage condition can be considered met. During reflection detection, when the reflection detection value is continuously less than the reflection paper shortage threshold for 300ms, the reflection paper shortage condition can be considered met.
[0074] In this embodiment, by continuously acquiring multiple detection values within a preset time period, and determining that the corresponding paper shortage condition is met only when multiple detection values continuously meet the corresponding paper shortage threshold condition, the misjudgment caused by instantaneous light signal fluctuations, sensor noise, or paper shaking can be reduced, thereby improving the stability and reliability of the paper shortage detection results.
[0075] In one embodiment, the method for determining the aforementioned transmission paper shortage threshold further includes: acquiring a transmission sampling value when the paper channel is in a paperless state, as a first transmission reference value; acquiring a transmission sampling value when a target paper is placed in the paper channel, as a second transmission reference value; wherein the transmission sampling value of the target paper is greater than the transmission sampling value corresponding to a preset reference paper, and less than the first transmission reference value; determining a transmission paper shortage threshold based on the first transmission reference value and the second transmission reference value, wherein the transmission paper shortage threshold is greater than the second transmission reference value and less than the first transmission reference value.
[0076] The first transmission reference value can be the transmission sampling value obtained through transmission detection when the paper channel is in a paperless state. Since the detection light is less obstructed in the paperless state, the first transmission reference value is usually relatively large. The second transmission reference value can be the transmission sampling value obtained through transmission detection when the target paper is placed in the paper channel. The target paper can be a printing medium with strong light transmittance, such as semi-transparent thin paper. The transmission ability of the target paper can be higher than that of ordinary white paper. Therefore, the transmission sampling value corresponding to the target paper can be greater than the transmission sampling value corresponding to the preset reference paper. However, since it will still block the detection light to a certain extent, its transmission sampling value can be less than the first transmission reference value corresponding to the paperless state.
[0077] Optionally, the preset reference paper can be a reference paper used to characterize the transmission properties of ordinary paper, such as plain white paper. If the transmission sampling value of the target paper is greater than the corresponding transmission sampling value of the preset reference paper, it can be used to indicate that the target paper has relatively high light transmittance.
[0078] Specifically, the first transmission reference value in the paperless state and the second transmission reference value when the target paper is set can be obtained separately, and a transmission paper shortage threshold can be determined between the two. Even if the transmission paper shortage threshold meets the following condition: second transmission reference value < transmission paper shortage threshold < first transmission reference value, in this way, even if there is a semi-transparent thin paper with strong light transmission in the paper channel, its transmission sampling value will usually not reach the judgment range corresponding to the paperless state. This can reduce the possibility of misjudging the semi-transparent thin paper as paper shortage based solely on transmission detection and improve the accuracy of transmission paper shortage detection.
[0079] Optionally, determining the transmission paper shortage threshold based on the first transmission reference value and the second transmission reference value may include the following steps: averaging the first transmission reference value and the second transmission reference value to obtain a transmission median value; adding a preset first bias to the transmission median value to obtain the transmission paper shortage threshold; wherein the first bias is a positive value and less than half the difference between the first transmission reference value and the second transmission reference value, so that the transmission paper shortage threshold is located between the first transmission reference value and the second transmission reference value, and shifted towards the direction of the transmission sampling value corresponding to the paperless state.
[0080] The intermediate transmission value is the average of the first and second transmission reference values, which can be used as the basis for determining the paper shortage threshold. The first bias can be a preset parameter used to adjust the offset of the intermediate transmission value. Since the first transmission reference value corresponding to the paperless state is relatively large, adding a positive first bias to the intermediate transmission value can shift the obtained paper shortage threshold towards the direction of the transmission sampling value corresponding to the paperless state.
[0081] In one specific embodiment, the transmission paper shortage threshold can be determined according to the following formula: .in, This is the first transmission reference value. This is the second transmission reference value. This is the first bias amount. To ensure that the transmission paper shortage threshold remains between the first and second transmission reference values, the first bias amount can be less than half the difference between the two, i.e.: .
[0082] In this embodiment, by determining the intermediate transmission value based on the average of the first transmission reference value and the second transmission reference value, and further superimposing a first bias amount shifted towards the paperless state, the transmission paper shortage threshold can be located between the transmission sampling value corresponding to the paperless state and the target paper, and shifted towards the paperless state side, thereby forming a certain decision safety margin between the two states, reducing the possibility of high-transmittance papers such as semi-transparent thin paper being misjudged as paper shortage, and improving the accuracy and stability of transmission paper shortage detection.
[0083] In one embodiment, the method for determining the aforementioned reflective paper shortage threshold further includes: acquiring a reflective sampling value when the paper channel is in a paperless state, as a first reflective reference value; acquiring a reflective sampling value when a printing medium with a target reflective area is provided in the paper channel and the target reflective area is located at a reflective optical detection position, as a second reflective reference value; wherein the reflective sampling value of the target reflective area is less than the reflective sampling value corresponding to a preset reference paper, and greater than the first reflective reference value; determining a reflective paper shortage threshold based on the first reflective reference value and the second reflective reference value, wherein the reflective paper shortage threshold is greater than the first reflective reference value and less than the second reflective reference value.
[0084] The first reflection reference value can be a reflection sample value obtained through reflection detection when the paper channel is in a paperless state. Since the amount of detection light reflected to the light receiver is usually small in the paperless state, the first reflection reference value is usually relatively small. The second reflection reference value can be a reflection sample value obtained when a printing medium with a target reflection area is set in the paper channel, and the target reflection area is located at the reflective optical detection position. The target reflection area can be an area with lower reflectivity than ordinary paper, such as the black marking area on black mark paper. Since this target reflection area can still reflect a certain amount of detection light, its reflection sample value can be greater than the first reflection reference value corresponding to the paperless state; in addition, since its reflectivity is lower than that of a preset reference paper such as ordinary white paper, its reflection sample value can be less than the reflection sample value corresponding to the preset reference paper.
[0085] It is understandable that if the reflection sample value of the target reflection area is less than the reflection sample value corresponding to the preset reference paper, it can be used to indicate that the target reflection area has a relatively low reflection capability.
[0086] Specifically, a first reflection reference value corresponding to the paperless state and a second reflection reference value corresponding to the target reflection area can be obtained separately. A reflection paper shortage threshold is then determined between these two values, provided that the reflection paper shortage threshold satisfies the following condition: first reflection reference value < reflection paper shortage threshold < second reflection reference value. In this way, even if the detection position of the optical sensor happens to correspond to the black marked area of the black mark paper, the reflection sampling value corresponding to that area is usually still higher than the reflection paper shortage threshold. This reduces the possibility of misjudging the black mark area as a paperless state, thereby improving the accuracy of reflection paper shortage detection.
[0087] In this embodiment, the paper shortage threshold is determined based on the first reflection reference value corresponding to the paperless state and the second reflection reference value corresponding to the target reflection area. This makes the paper shortage threshold fall between the reflection sampling values corresponding to the paperless state and the low reflection area, which can enhance the distinction between the two in the reflection detection results and reduce the possibility of low reflection areas such as black mark areas being misjudged as paper shortage areas, thereby improving the accuracy and reliability of reflection paper shortage detection.
[0088] Optionally, determining the reflective paper shortage threshold based on the first reflective reference value and the second reflective reference value may include the following steps: averaging the first reflective reference value and the second reflective reference value to obtain an intermediate reflective value; subtracting a preset second bias from the intermediate reflective value to obtain the reflective paper shortage threshold; wherein the second bias is a positive value and less than half the difference between the second reflective reference value and the first reflective reference value, so that the reflective paper shortage threshold is located between the first reflective reference value and the second reflective reference value, and shifted towards the reflective sampling value direction corresponding to the paperless state.
[0089] The intermediate reflection value can be the average of the first and second reflection reference values, and can serve as the basis for determining the paper shortage threshold. Since the first reflection reference value corresponds to the paperless state and its value is less than the second reflection reference value, the intermediate reflection value lies between the two.
[0090] Optionally, the second bias can be a preset parameter used to offset the intermediate reflection value. Since the first reflection reference value corresponding to the paperless state is small, subtracting the positive second bias from the intermediate reflection value can shift the obtained paperless reflection threshold towards the reflection sampling value corresponding to the paperless state.
[0091] Specifically, the reflective paper shortage threshold can be determined using the following formula: .in, This is the first reflection reference value. This is the second reflection reference value. This is the second bias value. To ensure that the reflective paper shortage threshold remains between the first and second reflective reference values, the second bias value can satisfy the following condition: Therefore, a certain safety margin can be created in the decision-making for the paper shortage threshold between the paperless state and the low-reflectivity target area.
[0092] In this embodiment, by determining the intermediate reflection value based on the average of the first reflection reference value and the second reflection reference value, and further subtracting the second bias amount shifted towards the paperless state, the paper shortage threshold can be located between the paperless state and the corresponding reflection sampling value of the target reflection area, and shifted towards the paperless state side, thereby reducing the possibility of low-reflection areas such as black mark areas being misjudged as paper shortage, and improving the accuracy and stability of reflection paper shortage detection.
[0093] In one embodiment, before S201: performing optical detection on the paper channel of the current printer based on the first detection mode to obtain the first detection information, the method further includes: when a paper out detection request for the current printer is detected, obtaining the default detection mode currently in which the current printer is located; and determining the default detection mode as the first detection mode.
[0094] The default detection mode can be the detection mode that the optical sensor was in before the printer entered the current paper out detection process. It can be either a transmission detection mode or a reflection detection mode. In other words, the detection mode that the optical sensor was in when the printer triggered the current paper out detection can be used as the default detection mode.
[0095] Optionally, upon detecting a paper out detection request for the current printer, the current operating state of the optical sensor can be read to determine its current default detection mode, and this default detection mode can be designated as the first detection mode. For example, if the optical sensor is currently in transmission detection mode, then transmission detection mode can be designated as the first detection mode; if the optical sensor is currently in reflection detection mode, then reflection detection mode can be designated as the first detection mode.
[0096] Specifically, after setting the default detection mode as the first detection mode, the first round of paper shortage detection can be performed directly using the current detection state of the optical sensor; after the first detection information meets the first paper shortage condition, the system can switch to another detection mode for further detection.
[0097] In this embodiment, by determining the default detection mode of the optical sensor when paper shortage detection is initiated as the first detection mode, unnecessary detection mode switching at the beginning of paper shortage detection can be reduced, thereby reducing the time overhead caused by mode switching and improving the response efficiency of paper shortage detection.
[0098] In one embodiment, before S201: performing optical detection on the paper channel of the current printer based on the first detection mode to obtain first detection information, the method further includes: obtaining the target calibration luminous intensity corresponding to the first detection mode according to the first detection mode; adjusting the luminous intensity of the optical sensor of the current printer to the target calibration luminous intensity; and performing the step of performing optical detection on the paper channel of the current printer based on the first detection mode to obtain first detection information after the luminous intensity of the optical sensor meets the preset stability condition.
[0099] The target calibration luminous intensity can be a preset luminous intensity used for performing paper shortage detection. Different detection modes can correspond to different target calibration luminous intensities. For example, when the first detection mode is transmission detection mode, the target calibration luminous intensity can be the calibration luminous intensity corresponding to transmission detection; when the first detection mode is reflection detection mode, the target calibration luminous intensity can be the calibration luminous intensity corresponding to reflection detection.
[0100] Optionally, after determining the first detection mode, the target calibration luminous intensity corresponding to the first detection mode can be obtained, and the optical sensor can be controlled to adjust the light intensity so that the luminous intensity of the optical sensor reaches the corresponding target calibration luminous intensity.
[0101] It is understood that the preset stability condition can be a condition used to determine that the light emission state of the optical sensor has stabilized and optical sampling can be performed. For example, the preset stability condition can be that the dimming duration reaches a preset stable duration. In a specific embodiment, after the dimming state lasts for more than 10ms, it can be determined that the light emission intensity of the optical sensor meets the preset stability condition, and the acquisition of the first detection information can begin.
[0102] Specifically, after a paper shortage detection request is detected, the corresponding target calibration light intensity can be determined according to the first detection mode, and the optical sensor can be adjusted to the light intensity. After the light emission state is stable, the paper channel can be optically detected based on the first detection mode to obtain the first detection information.
[0103] In this embodiment, by adjusting the luminous intensity of the optical sensor to the target calibration luminous intensity corresponding to the first detection mode before performing optical detection, and sampling is performed after the luminous state is stable, the influence of luminous intensity changes and dimming transients on the detection results can be reduced, making the detection results more stable, thereby improving the accuracy and reliability of paper shortage detection.
[0104] In one embodiment, the method further includes: determining that the printer is in a paper-ready state when the first detection information does not meet the first paper-out condition; or determining that the printer is in a paper-ready state when the second detection information does not meet the second paper-out condition.
[0105] The paper-on status refers to the state in which printing media is present in the paper path of the printer, as determined by the paper shortage detection process. In other words, when the detection result does not show the optical characteristics corresponding to the paperless status, the printer can be considered to be in a paper-on status.
[0106] Specifically, during the first detection mode detection, the first detection information can be used to determine whether the first paper shortage condition is met. If the first detection information does not meet the first paper shortage condition, it means that the current paper channel does not exhibit the optical characteristics corresponding to the paperless state in the first detection mode. In this case, there is no need to continue with the second detection mode detection, and it can be directly determined that the printer is currently in a paper-containing state.
[0107] Furthermore, if the first detection information meets the first paper shortage condition, the system can switch to the second detection mode for verification. In the second detection mode, the system can determine whether the second paper shortage condition is met based on the second detection information. If the second detection information does not meet the second paper shortage condition, it means that the current paper channel only exhibits suspected paper shortage characteristics in the first detection mode, but does not exhibit the corresponding paperless characteristics in the other detection mode. Therefore, it can be determined that the printer is currently in a paper-ready state.
[0108] For example, when the first detection mode is the transmission detection mode, if the transmission detection value does not reach the transmission paper shortage threshold, it can be directly determined that there is paper; if the transmission detection value meets the transmission paper shortage condition, but the subsequent reflection detection value does not meet the reflection paper shortage condition, it can also be determined that there is paper.
[0109] In this embodiment, by promptly determining that the printer is in a paper-ready state when the corresponding paper-out condition is not met in any detection mode, the detection process can be avoided without further detection, thus reducing resource consumption during the detection process. At the same time, by requiring both detection modes to meet the corresponding paper-out condition before proceeding to the paper-out judgment, the false judgment of paper-out caused by an abnormality in a single detection mode can be reduced, thereby improving the accuracy of paper status judgment.
[0110] In one embodiment, when the first detection information includes a plurality of first detection values obtained by continuous detection, and the second detection information includes a plurality of second detection values obtained by continuous detection, both the first preset duration and the second preset duration are not less than a preset duration threshold. The preset duration threshold is used to characterize the time required for the paper to naturally sink from its initial state when placed in the paper channel to a state of being in contact with the paper channel.
[0111] The preset time threshold can be used to characterize the time required for the paper to gradually move from its initial state and stably adhere to the corresponding position in the paper channel after being placed in it. Since the paper may be tilted, curled up, or not fully adhered after being placed in by the user, it needs a certain amount of time to stabilize in the optical detection position.
[0112] Optionally, when both the first and second detection information are judged using multiple consecutive detection values, the first and second preset durations can be set to be no less than a preset duration threshold, so that after the paper has completed natural settling and reached a stable state, the paper shortage condition can be judged based on the continuous detection results.
[0113] Specifically, when a user places the printing media into the paper channel, the paper may not be fully adhered to the paper guide structure or rollers immediately, causing short-term fluctuations in the detection values collected by the optical sensor. For example, when the paper is first placed in, changes in the paper's position may cause the transmission or reflection detection values to briefly approach the paper shortage judgment condition. By setting a first preset duration and a second preset duration that are not less than the time required for the paper to stably adhere, the transient detection results during the paper placement process can be avoided from being mistaken for a paper shortage state.
[0114] For example, if it usually takes a certain amount of time for the paper to settle naturally to a stable and adhered state, the first preset time and the second preset time can be set to be greater than or equal to that time; only when the paper stabilizes and the detection value continues to meet the corresponding paper shortage condition can the corresponding detection information be determined to meet the paper shortage condition.
[0115] In this embodiment of the application, by ensuring that the first preset duration and the second preset duration are not less than the time required for the paper to go from the insertion state to the stable bonding state, the influence of factors such as position changes and vibrations during the paper insertion process on the optical detection results can be reduced, avoiding false judgments of paper shortage due to the paper not yet being stable, and improving the accuracy and stability of paper shortage detection.
[0116] In one embodiment, the method for determining the first preset duration and the second preset duration may further include the following steps: determining the event type that triggers the paper out detection based on the paper out detection request, wherein the event type is any one of the following: a first event type characterizing the printer cover switching from an open state to a closed state, and a second event type characterizing the completion of a printing task or the recovery of a printing fault; if the event type is the first event type, adjusting the first preset duration and / or the second preset duration to the first duration; if the event type is the second event type, adjusting the first preset duration and / or the second preset duration to the second duration; wherein the first duration is longer than the second duration.
[0117] The event type can be used to characterize the specific printer event that triggered the paper out detection. Since the paper's state may differ depending on the event triggering the paper out detection, different detection durations can be set for different event types.
[0118] Optionally, the first event type can be used to represent an event where the printer cover changes from an open state to a closed state. For example, after a user opens the printer cover, inserts paper, and then closes it, the printer can generate a paper out detection request and perform a paper out detection. Since the paper may have just been inserted into the paper path and its position may not yet be stable, a longer waiting time is required before a paper out detection is performed. Alternatively, the second event type can be used to represent events after a print job is completed or a print fault is resolved. For example, when the printer completes a print job or resumes operation after troubleshooting a paper jam, a paper out detection can be triggered. Since the paper is usually already in a feeding state or in a stable position at this time, a longer waiting time is not required to determine if a paper out is detected.
[0119] Specifically, the event type triggering the paper out detection can be determined based on the information carried in the paper out detection request or the current operating status of the printer. When the event type is determined to be the first event type, the first preset duration and / or the second preset duration can be adjusted to the first duration, allowing the continuous detection process to last longer; when the event type is determined to be the second event type, the first preset duration and / or the second preset duration can be adjusted to the second duration. The first duration is longer than the second duration.
[0120] For example, when performing a paper out detection after the printer lid is closed, a longer first preset time and a longer second preset time can be set to allow the paper to settle and stabilize before making a judgment; when performing a paper out detection after the printing job is completed, a shorter first preset time and a shorter second preset time can be set to quickly determine whether there is still printing media.
[0121] It should be noted that the first preset duration and the second preset duration correspond to the continuous judgment duration when the first detection mode is the transmission detection mode or the reflection detection mode, respectively. Dynamically adjusting these two preset durations can make the duration of the first round of optical detection cover the time required for the paper to go from the placed state to the stable state. After the first round of detection is completed, the paper is in a relatively stable state, so the duration of the second round of detection can be the preset duration.
[0122] In this embodiment, by dynamically adjusting the duration of the paper shortage judgment based on the type of event triggering the paper shortage detection, both detection accuracy and response speed can be considered in different detection scenarios. Using a longer detection duration in scenarios where the paper condition changes significantly can reduce false judgments caused by unstable paper; using a shorter detection duration in scenarios where the paper condition is relatively stable can improve paper shortage detection efficiency.
[0123] In one embodiment, the aforementioned printer may include a light emitting unit, a transmitted light receiver, and a reflected light receiver. The light emitting unit may be a light source device, such as a light-emitting diode (LED), for emitting detection light into the paper path or printing medium. The transmitted light receiver may be a detection device for receiving the light signal after it has passed through the paper path or printing medium. The reflected light receiver may be a detection device for receiving the light signal reflected by the printing medium.
[0124] It is understandable that during actual testing, factors such as ambient light and stray light inside the equipment may affect the results acquired by the optical sensor. For example, even when the light emitting unit is off, the receiver may still collect a certain light signal; if the sampled value after the light emitting unit is turned on is used directly for judgment, it may lead to deviations in the detection results. Therefore, it is advisable to first obtain the ambient light sampled value and then use the sampled value under the light condition for compensation.
[0125] In some embodiments, the first ambient light sampling value, the second ambient light sampling value, the first illuminated sampling value, and the second illuminated sampling value can be pre-collected and stored before executing S201, so that the corresponding first detection value and second detection value can be determined subsequently according to the first detection mode and the second detection mode.
[0126] Further, in S201 above: before optically detecting the paper path of the current printer based on the first detection mode to obtain the first detection information, the method further includes: acquiring a first ambient light sample value of the transmitted light receiver and a second ambient light sample value of the reflected light receiver when the light emitting unit is in a closed state; acquiring a first illuminated sample value of the transmitted light receiver and a second illuminated sample value of the reflected light receiver when the light emitting unit is in a turned-on state; and when the first detection mode is the transmitted detection mode, the first detection value in the first detection information is the first illuminated sample value. The difference obtained by subtracting the first ambient light sampling value; when the first detection mode is the reflection detection mode, the first detection value in the first detection information is the difference obtained by subtracting the second ambient light sampling value from the second illuminated sampling value; when the second detection mode is the transmission detection mode, the second detection value in the second detection information is the difference obtained by subtracting the first ambient light sampling value from the first illuminated sampling value; when the second detection mode is the reflection detection mode, the second detection value in the second detection information is the difference obtained by subtracting the second ambient light sampling value from the second illuminated sampling value.
[0127] Specifically, before executing S201, the light emitting unit can be pre-disabling to prevent it from actively emitting detection light. The light signals corresponding to the current ambient light are then collected via a transmitted light receiver and a reflected light receiver. The value collected by the transmitted light receiver is used as the first ambient light sample value, and the value collected by the reflected light receiver is used as the second ambient light sample value. Subsequently, the light emitting unit can be turned on, and the light signals including the influence of the detection light are collected via the transmitted light receiver and the reflected light receiver. The value collected by the transmitted light receiver is used as the first illuminated sample value, and the value collected by the reflected light receiver is used as the second illuminated sample value. These first ambient light sample values, second ambient light sample values, first illuminated sample values, and second illuminated sample values can be stored after acquisition for later use when executing the first and second detection modes.
[0128] Understandably, after acquiring and storing the aforementioned sampled values in advance, the corresponding sampled values can be called according to the currently executed detection mode to determine the first detection value or the second detection value. Specifically, when the first detection mode is a transmission detection mode, the difference between the pre-acquired first illuminated sampled value and the first ambient light sampled value can be processed, and the processing result can be used as the first detection value; when the first detection mode is a reflection detection mode, the difference between the pre-acquired second illuminated sampled value and the second ambient light sampled value can be processed, and the processing result can be used as the first detection value.
[0129] Accordingly, after switching to the second detection mode, it is not necessary to reacquire the aforementioned ambient light sampling values and illuminated sampling values. Instead, the sampling values corresponding to the second detection mode can be retrieved from the pre-stored sampling values to determine the second detection value. When the second detection mode is a transmission detection mode, the difference between the first illuminated sampling value and the first ambient light sampling value can be processed, and the processing result can be used as the second detection value. When the second detection mode is a reflection detection mode, the difference between the second illuminated sampling value and the second ambient light sampling value can be processed, and the processing result can be used as the second detection value.
[0130] In this embodiment, the first detection mode and the second detection mode can be used to characterize the selection and processing method of sampling data corresponding to different optical receiving channels. Switching the detection mode can include switching from calling the sampling data corresponding to one optical receiving channel to calling the sampling data corresponding to another optical receiving channel.
[0131] In this embodiment, by pre-acquiring and storing the ambient light sampling values when the light emitting unit is off and the illuminated sampling values when it is on before performing paper out detection, and by using the ambient light sampling values to compensate for the illuminated sampling values, the influence of external ambient light, stray light inside the printer, and other factors on the optical detection results can be reduced. Simultaneously, by pre-acquiring and storing the sampling values corresponding to different light receivers, the corresponding sampling data can be directly called for processing when switching between the first and second detection modes, eliminating the need to repeatedly perform ambient light sampling. This improves detection accuracy while reducing the repetitive sampling process, thereby increasing paper out detection efficiency.
[0132] In one embodiment, the method further includes: after determining that the current printer is in a preliminary paper-out state, and after confirming that the paper path of the current printer is in a paperless state and detecting that the top cover of the current printer is in a closed state, acquiring the transmission reference value and reflection reference value in the current paperless state; comparing the transmission reference value with the historical transmission reference value, and comparing the reflection reference value with the historical reflection reference value, to determine the optical path attenuation amplitude; and if the optical path attenuation amplitude is greater than a preset attenuation threshold, performing a compensation operation on the driving intensity of the light emitting unit of the current printer, and / or outputting optical path cleaning prompt information.
[0133] Since the initial paper-out state only indicates that both transmission and reflection detection results show paperless characteristics, it does not necessarily mean that the paper channel is actually in a paperless state. Therefore, before performing optical path attenuation detection, it is necessary to further confirm whether the paper channel is actually in a paperless state. For example, for hole-positioned label paper, when the detection position of the optical sensor happens to be at the positioning hole, it may also exhibit optical characteristics similar to a paperless state. In this case, after ruling out misjudgments caused by the positioning hole, it is possible to determine whether the paper channel is in a paperless state.
[0134] Optionally, the transmission reference value can be a detection value obtained through transmission detection when it is confirmed that the current paper path of the printer is in a paperless state; the reflection reference value can be a detection value obtained through reflection detection when it is confirmed that the current paper path of the printer is in a paperless state. The aforementioned historical transmission reference value and historical reflection reference value can be transmission detection reference values and reflection detection reference values pre-recorded by the printer under normal optical path conditions, such as the corresponding detection values saved during the printer's factory calibration.
[0135] Specifically, after determining that the printer is in a preliminary paper-out state, it can be further confirmed whether the paper path is actually paperless. When it is confirmed that the paper path is paperless and the top cover is closed, the transmission and reflection reference values for this paperless state can be obtained. Since the detection environment of the optical sensor is relatively stable when the top cover is closed, the reference values obtained at this time can be used to characterize the current optical path state. Subsequently, the currently obtained transmission reference value can be compared with historical transmission reference values, and the currently obtained reflection reference value can be compared with historical reflection reference values. The degree of change between the two can be used to determine the optical path attenuation amplitude.
[0136] The optical path attenuation amplitude can be used to characterize the degree of optical signal attenuation in the current printer optical detection link relative to its historical normal state. When the optical path attenuation amplitude exceeds a preset attenuation threshold, the current optical path state can be considered abnormal.
[0137] Specifically, after determining that the optical path attenuation exceeds the preset attenuation threshold, the driving intensity of the optical emitting unit can be compensated. For example, the driving parameters of the optical emitting unit can be increased to enhance the emitted light intensity, thereby offsetting the reduction in detection signal caused by optical path attenuation; or an optical path cleaning prompt message can be output to remind the user to clean the optical detection area; or the above compensation operation and prompt operation can be performed simultaneously.
[0138] In this embodiment, after initially determining that there is no paper, the paper channel is further confirmed to be in a paperless state. The current transmission and reflection reference values are then compared with historical reference values. This avoids using suspected paperless conditions caused by the positioning holes of the hole-positioning label as the paperless reference, thus improving the accuracy of optical path attenuation judgment. Simultaneously, by compensating for light intensity or outputting cleaning prompts based on the degree of optical path attenuation, the impact of optical path contamination on the paperless detection results can be reduced, improving the detection stability of the optical sensor during long-term operation.
[0139] In one embodiment, the printing medium used by the aforementioned printer can be a perforated positioning label paper, which includes a plurality of positioning holes spaced apart along the paper feed direction. The perforated positioning label paper can be a printing medium used for paper position detection or transport positioning via the positioning holes. The perforated positioning label paper can include a plurality of positioning holes spaced apart along the paper feed direction, and an optical sensor can assist in determining the paper position by detecting the optical differences between the corresponding positioning hole areas and the physical areas of the paper.
[0140] It should be noted that in some perforated positioning labels, when the optical sensor's detection position happens to be within the positioning hole area, the transmission detection value may be high because there is no paper obstruction at the positioning hole. Simultaneously, since there is no paper reflection in the hole area, the reflection detection value may be low. This results in both transmission and reflection detection values simultaneously meeting the paper shortage condition, causing the printer to mistakenly identify a paper shortage. Therefore, after determining the initial paper shortage status, further elimination checks can be performed on perforated positioning labels.
[0141] Optionally, see Figure 3 After determining that the printer is currently in a preliminary paper shortage state, the above method may further include: S301: Obtain the diameter length of the positioning hole in the paper feeding direction, and the minimum distance between the opposite edges of two adjacent positioning holes in the paper feeding direction.
[0142] The aperture length can be the dimension of the positioning hole along the paper feeding direction, which is used to characterize the coverage area of the positioning hole in the paper moving direction; the minimum spacing can be the shortest distance between the opposite edges of two adjacent positioning holes along the paper feeding direction, which is used to characterize the length of the paper solid area between the two positioning holes.
[0143] Specifically, the aforementioned hole diameter length and minimum spacing can be obtained by reading pre-configured hole positioning label paper parameters. For example, different specifications of hole positioning label paper can correspond to different positioning hole size parameters.
[0144] S302: When the minimum spacing is greater than the aperture length, control the paper feed motor of the current printer to drive the hole positioning label paper to move a preset micro-motion distance along the paper output direction or paper return direction, wherein the preset micro-motion distance is greater than the aperture length and less than the minimum spacing.
[0145] Optionally, if the minimum spacing is determined to be greater than the aperture length, it can be assumed that there exists a paper solid area with a length greater than the size of a single positioning hole between two adjacent positioning holes. In this case, the paper feed motor can be controlled to drive the hole positioning label paper to move a preset micro-motion distance along the paper output direction or the paper return direction. The preset micro-motion distance is greater than the aperture length but less than the minimum spacing.
[0146] It is understandable that by setting a preset micro-motion distance to meet the above conditions, the detection position originally located in the positioning hole area can be moved to the paper physical area between adjacent positioning holes after the paper is moved, thereby avoiding the optical sensor from being continuously in the positioning hole area.
[0147] For example, when the initial detection position of the optical sensor is inside the positioning hole, controlling the paper to move a distance greater than the hole diameter can make the detection position leave the current positioning hole; at the same time, since the moving distance is less than the length of the solid area between adjacent positioning holes, the detection position will not enter the next positioning hole.
[0148] S303: After moving the preset micro-motion distance, switch the current detection mode to the first detection mode, and perform optical detection on the paper channel based on the first detection mode to obtain third detection information.
[0149] In other words, after the paper micro-movement is completed, the current detection mode can be switched to the first detection mode, and the paper channel can be optically detected again based on the first detection mode to obtain the third detection information.
[0150] The third detection information can be used to represent the optical detection result of the paper channel in the first detection mode after the paper has moved. Since the paper position has changed, the third detection information can be used to determine whether the current detection position still exhibits the optical characteristics corresponding to the initial paper shortage.
[0151] S304: If the third detection information meets the first paper shortage condition, the first detection mode is switched to the second detection mode, and optical detection is performed on the paper channel based on the second detection mode to obtain the fourth detection information.
[0152] Understandably, if the third detection information meets the first paper shortage condition, it indicates that the detection position after the move still shows the suspected paper shortage characteristics corresponding to the first detection mode. At this time, it is possible to further switch to the second detection mode for verification.
[0153] Specifically, the first detection mode can be switched to the second detection mode, and optical detection can be performed again based on the second detection mode to obtain the fourth detection information.
[0154] S305: If the third detection information meets the first paper shortage condition and the fourth detection information meets the second paper shortage condition, it is determined that the current printer is in a paper shortage state.
[0155] It is understandable that the third detection information satisfies the first paper shortage condition, and the fourth detection information satisfies the second paper shortage condition. This indicates that after the paper is moved, both the first and second detection modes exhibit a paperless characteristic. Therefore, it can be concluded that the current detection position is not due to abnormal detection caused solely by the positioning hole, but rather because there is genuinely no paper, thus confirming that the printer is currently in a paperless state.
[0156] S306: If the third detection information does not meet the first paper shortage condition, or if the third detection information meets the first paper shortage condition but the fourth detection information does not meet the second paper shortage condition, the printer is determined to be in a paper-ready state.
[0157] Understandably, if the third detection information does not meet the first paper shortage condition, it means that the detection position has entered the paper's physical area after the paper has moved, and the detection result returns to the paper-present characteristic. Therefore, it can be determined that the printer is currently in a paper-present state. Alternatively, if the third detection information meets the first paper shortage condition, but the fourth detection information does not meet the second paper shortage condition, it means that only one detection mode exhibits a paper shortage characteristic, and the two detection modes do not simultaneously meet the paper shortage condition. Therefore, it can be determined that the detection result may be caused by factors such as the positioning hole or paper characteristics, rather than a true paper shortage state. In this case, it can also be determined that the printer is currently in a paper-present state.
[0158] In this embodiment, after the perforated label paper shows an initial paper shortage, the paper is micro-moved according to the size of the positioning hole, and transmission and reflection detection are used for verification. This avoids false paper shortage detection caused by the optical sensor being located exactly in the positioning hole area. Simultaneously, by using the size of the positioning hole to constrain the micro-movement distance, the detection position can be moved to the actual paper area, improving the accuracy and reliability of paper shortage detection in perforated label paper scenarios.
[0159] In one embodiment, see Figure 4 In the case where the printing medium used by the printer is perforated positioning label paper, and the perforated positioning label paper includes a plurality of positioning holes spaced apart along the paper feed direction; after determining that the printer is in a preliminary paper shortage state, the method may further include: S401: Obtain the diameter length of the positioning hole in the paper feeding direction, and the minimum distance between the opposite edges of two adjacent positioning holes in the paper feeding direction.
[0160] The aperture length can be the dimension of the positioning hole along the paper feeding direction, which is used to characterize the coverage area of the positioning hole in the paper moving direction; the minimum spacing can be the shortest distance between the opposite edges of two adjacent positioning holes along the paper feeding direction, which is used to characterize the length of the paper solid area between the two positioning holes.
[0161] Specifically, the aforementioned hole diameter length and minimum spacing can be obtained by reading pre-configured hole positioning label paper parameters. For example, different specifications of hole positioning label paper can correspond to different positioning hole size parameters.
[0162] S402: When the minimum spacing is less than or equal to the aperture length, control the paper feed motor of the current printer to drive the hole positioning label paper along the paper output direction or paper return direction to perform continuous micro-motion with a preset micro-motion step size.
[0163] The preset micro-motion step size is determined based on the aperture length and the minimum spacing. The preset micro-motion step size is less than or equal to the aperture length and less than or equal to the minimum spacing. This limitation ensures that each micro-motion distance does not traverse an excessively large area of paper, improving the coverage of changes in the positioning hole position during the detection process.
[0164] Optionally, the preset micro-motion step size is greater than or equal to the preset minimum resolution step size. The preset minimum resolution step size can be the minimum moving distance that the paper feed motor can effectively control. By setting the micro-motion step size to be no less than this minimum resolution step size, it is possible to avoid the motor failing to execute accurately due to an excessively small moving distance, while simultaneously balancing detection accuracy and moving efficiency.
[0165] It is understandable that if the minimum spacing is less than or equal to the aperture length, it indicates that the solid area of paper between two adjacent positioning holes is short, and may even be smaller than the size of a single positioning hole. In this case, even if the paper is moved a large fixed distance, it is difficult to guarantee that the optical sensor will be able to move to the solid area of paper between the positioning holes. Therefore, the paper feed motor can be controlled to drive the positioning label paper to make continuous micro-movements along the paper output or return direction, and the optical detection can be re-performed after each micro-movement.
[0166] S403: After each micro-motion, switch the current detection mode to the first detection mode mentioned above, and perform optical detection on the paper channel based on the first detection mode to obtain the first re-inspection detection information.
[0167] The first re-inspection information can be the detection result obtained again in the first detection mode after the paper is moved, which is used to determine whether the current detection position still shows the paper shortage feature corresponding to the first detection mode.
[0168] For example, when the first detection mode is the transmission detection mode, the transmission detection value can be reacquired, and it can be determined whether the transmission detection value meets the first paper shortage condition.
[0169] S404: If the first re-inspection information meets the first paper shortage condition, the first detection mode is switched to the second detection mode, and optical detection is performed on the paper channel based on the second detection mode to obtain the second re-inspection information.
[0170] Understandably, if the first re-inspection information meets the first paper shortage condition, it means that after the paper is moved, the current detection position still shows the suspected paper shortage characteristics corresponding to the first detection mode. At this time, it is possible to further switch to the second detection mode for verification.
[0171] Specifically, the first detection mode can be switched to the second detection mode, and the second re-inspection information can be re-acquired based on the second detection mode. For example, when the second detection mode is the reflection detection mode, the reflection detection value can be re-acquired, and it can be determined whether the reflection detection value meets the second paper shortage condition.
[0172] S405: After any micro-motion, if the first re-inspection detection information does not meet the first paper shortage condition, or if the first re-inspection detection information meets the first paper shortage condition and the second re-inspection detection information does not meet the second paper shortage condition, then it is determined that the current printer is in a paper-ready state.
[0173] In other words, after any micro-movement, if either of the following situations occurs: the first re-inspection detection information does not meet the first paper shortage condition; or: the first re-inspection detection information meets the first paper shortage condition, but the second re-inspection detection information does not meet the second paper shortage condition; then it indicates that after the paper movement, the detection results did not continuously show the dual-mode paper shortage characteristics. At this time, it can be considered that the previous preliminary paper shortage state may have been caused by the optical sensor being located in the positioning hole area, rather than a true paper shortage, and therefore it is determined that the printer is currently in a paper-ready state.
[0174] S406: If the number of consecutive micro-movements reaches the preset maximum number of micro-movements, and the first re-inspection detection information obtained after each micro-movement satisfies the first paper shortage condition, and the second re-inspection detection information satisfies the second paper shortage condition, then the printer is determined to be in a paper shortage state.
[0175] It is understandable that if, after continuous micro-motion reaching the preset maximum number of micro-motions, the detection result after each micro-motion satisfies the following conditions: the first re-inspection detection information satisfies the first paper shortage condition; the second re-inspection detection information satisfies the second paper shortage condition; then it can be said that even if the paper position keeps changing, the optical sensor detection result will still continuously show the paper shortage characteristic. Therefore, abnormal detection caused by a single positioning hole can be ruled out, and the current printer can be determined to be in a true paper shortage state.
[0176] In this embodiment, when the spacing between the positioning holes on the perforated label paper is small and it is impossible to avoid the positioning hole area with a single micro-motion, the paper is controlled to perform continuous micro-motion. After each micro-motion, the results of transmission and reflection detection are combined for verification, which can improve the reliability of paper shortage judgment in complex perforated label paper scenarios. In addition, by setting the micro-motion step size according to the hole diameter length and the spacing between the positioning holes, the detection process can cover different paper position states, reducing false paper shortage judgments caused by the sensor being exactly in the positioning hole area, and improving the printer's adaptability to special printing media.
[0177] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps.
[0178] Based on the inventive concept of the above-mentioned printer paper out detection method, such as Figure 5 As shown, this application embodiment also provides a printer paper out detection device 500 for implementing the printer paper out detection method described above. The printer paper out detection device 500 includes: The first detection module 501 is used to perform optical detection on the paper channel of the current printer based on a first detection mode when a paper out detection request for the current printer is detected, so as to obtain first detection information. The second detection module 502 is used to switch the first detection mode to the second detection mode when the first detection information meets the first paper shortage condition, and to perform optical detection on the paper channel of the current printer based on the second detection mode to obtain the second detection information. The first detection mode and the second detection mode are both one of the transmission detection mode and the reflection detection mode, and the first detection mode is different from the second detection mode. The judgment module 503 is used to determine whether the above second detection information meets the second paper shortage condition corresponding to the above second detection mode. The first determining module 504 is used to determine that the printer is in a preliminary paper shortage state when the second detection information meets the second paper shortage condition.
[0179] In one possible implementation, the first detection information includes a first detection value, and the second detection information includes a second detection value; The first paper shortage condition includes: when the first detection mode is the transmission detection mode, the first detection value is greater than a preset transmission paper shortage threshold; or, when the first detection mode is the reflection detection mode, the first detection value is less than a preset reflection paper shortage threshold. The second paper shortage condition includes: when the second detection mode is the transmission detection mode, the second detection value is greater than the transmission paper shortage threshold; or, when the second detection mode is the reflection detection mode, the second detection value is less than the reflection paper shortage threshold.
[0180] In one possible implementation, the first detection information includes a plurality of first detection values obtained by continuous detection, and the second detection information includes a plurality of second detection values obtained by continuous detection. The aforementioned first paper shortage condition includes: when the first detection mode is the transmission detection mode, all of the aforementioned first detection values are greater than a preset transmission paper shortage threshold, and the duration for which the aforementioned first detection values are continuously greater than the transmission paper shortage threshold reaches a first preset duration; or, when the first detection mode is the reflection detection mode, all of the aforementioned first detection values are less than a preset reflection paper shortage threshold, and the duration for which the aforementioned first detection values are continuously less than the reflection paper shortage threshold reaches a second preset duration. The aforementioned second paper shortage condition includes: when the second detection mode is the transmission detection mode, all of the aforementioned second detection values are greater than the transmission paper shortage threshold, and the duration for which the aforementioned second detection values are continuously greater than the transmission paper shortage threshold reaches a third preset duration; or, when the second detection mode is the reflection detection mode, all of the aforementioned second detection values are less than the reflection paper shortage threshold, and the duration for which the aforementioned second detection values are continuously less than the reflection paper shortage threshold reaches a fourth preset duration.
[0181] In one possible implementation, the device 500 further includes: The first acquisition module is used to acquire the transmission sampling value when the paper channel is in a paperless state, as the first transmission reference value. The second acquisition module is used to acquire the transmission sampling value when the target paper is set in the paper channel, as the second transmission reference value; wherein the transmission sampling value of the target paper is greater than the transmission sampling value corresponding to the preset reference paper, and less than the first transmission reference value. The second determining module is used to determine a transmission paper shortage threshold based on the first transmission reference value and the second transmission reference value, wherein the transmission paper shortage threshold is greater than the second transmission reference value and less than the first transmission reference value.
[0182] In one possible implementation, the device 500 further includes: The third acquisition module is used to acquire the reflection sampling value when the paper channel is in a paperless state, as the first reflection reference value; The fourth acquisition module is used to acquire the reflection sampling value of the printing medium with the target reflection area in the paper channel and the target reflection area is located at the reflective optical detection position, as the second reflection reference value; wherein the reflection sampling value of the target reflection area is less than the reflection sampling value corresponding to the preset reference paper and greater than the first reflection reference value. The third determining module is used to determine a reflective paper shortage threshold based on the first reflective reference value and the second reflective reference value, wherein the reflective paper shortage threshold is greater than the first reflective reference value and less than the second reflective reference value.
[0183] In one possible implementation, the second determining module described above is specifically used for: The first transmission reference value and the second transmission reference value are averaged to obtain the intermediate transmission value. The preset first bias is added to the above-mentioned transmission intermediate value to obtain the above-mentioned transmission paper shortage threshold. Wherein, the first bias is a positive value and is less than half the difference between the first transmission reference value and the second transmission reference value, so that the transmission paper shortage threshold is located between the first transmission reference value and the second transmission reference value, and shifts towards the transmission sampling value corresponding to the paperless state.
[0184] In one possible implementation, the aforementioned third determining module is specifically used for: The first reflection reference value and the second reflection reference value are averaged to obtain the intermediate reflection value; The preset second bias is subtracted from the above intermediate reflection value to obtain the above reflection paper shortage threshold. Wherein, the second bias is a positive value and is less than half the difference between the second reflection reference value and the first reflection reference value, so that the paper shortage threshold is located between the first reflection reference value and the second reflection reference value, and is shifted towards the reflection sampling value corresponding to the paperless state.
[0185] In one possible implementation, the device 500 further includes: The fourth determining module is used to determine that the printer is in a paper-ready state when the first detection information does not meet the first paper-out condition; or, to determine that the printer is in a paper-ready state when the second detection information does not meet the second paper-out condition.
[0186] In one possible implementation, the aforementioned device 500 further includes: The fifth acquisition module is used to acquire the default detection mode of the current printer before optically detecting the paper channel of the current printer based on the first detection mode to obtain the first detection information, when a paper out detection request for the current printer is detected. The fifth determining module is used to determine the above default detection mode as the first detection mode.
[0187] In one possible implementation, the aforementioned device 500 further includes: The sixth acquisition module is used to acquire the target calibration luminous intensity corresponding to the first detection mode before optically detecting the paper channel of the current printer based on the first detection mode to obtain the first detection information. The adjustment module is used to adjust the light intensity of the optical sensor of the current printer to the target calibration light intensity. After the light intensity of the optical sensor meets the preset stability condition, the first detection module 501 performs the above-mentioned step of optically detecting the paper channel of the current printer based on the first detection mode to obtain the first detection information.
[0188] In one possible implementation, the aforementioned device 500 further includes: The sixth determining module is used to determine the event type that triggers the paper out detection based on the above paper out detection request. The above event type is any one of the following: a first event type that characterizes the printer cover switching from an open state to a closed state, and a second event type that characterizes the completion of the printing task or the recovery of the printing fault. The first adjustment module is used to adjust the first preset duration and / or the second preset duration to the first duration when the event type is the first event type. The second adjustment module is used to adjust the first preset duration and / or the second preset duration to the second duration when the event type is the second event type; wherein the first duration is longer than the second duration.
[0189] In one possible implementation, both the first preset duration and the second preset duration are not less than a preset duration threshold, which is used to characterize the time required for the paper to naturally sink from its initial state in the paper channel to a state of contact with the paper channel.
[0190] In one possible implementation, the aforementioned current printer includes a light emitting unit, a transmitted light receiver, and a reflected light receiver; the aforementioned device 500 further includes: The seventh acquisition module is used to acquire the first ambient light sampling value of the transmitted light receiver and the second ambient light sampling value of the reflected light receiver before optical detection of the paper channel of the current printer based on the first detection mode is performed and the first detection information is obtained, while the light emitting unit is in the off state. The eighth acquisition module is used to acquire the first light sample value of the transmitted light receiver and the second light sample value of the reflected light receiver when the light emitting unit is in the turned-on state. When the first detection mode is the transmission detection mode, the first detection value in the first detection information is the difference between the first illuminated sample value and the first ambient light sample value. When the first detection mode is the reflection detection mode, the first detection value in the first detection information is the difference between the second illuminated sample value and the second ambient light sample value. When the second detection mode is the transmission detection mode, the second detection value in the second detection information is the difference between the first illuminated sampling value and the first ambient light sampling value. When the second detection mode is the reflection detection mode, the second detection value in the second detection information is the difference between the second illuminated sample value and the second ambient light sample value.
[0191] In one possible implementation, the aforementioned device 500 further includes: The ninth acquisition module is used to acquire the transmission reference value and reflection reference value in the current paperless state after determining that the current printer is in a preliminary paperless state, and after confirming that the paper channel of the current printer is in a paperless state and detecting that the top cover of the current printer is in a closed state. The comparison module is used to compare the above-mentioned transmission reference value with the historical transmission reference value, and to compare the above-mentioned reflection reference value with the historical reflection reference value, so as to determine the optical path attenuation amplitude; The compensation module is used to compensate the driving intensity of the light emitting unit of the current printer when the attenuation amplitude of the above-mentioned optical path is greater than a preset attenuation threshold, and / or output optical path cleaning prompt information.
[0192] In one possible implementation, the printing medium used by the aforementioned printer is perforated label paper, which includes a plurality of positioning holes spaced apart along the paper feed direction; the aforementioned device 500 further includes: The tenth acquisition module is used to acquire, after determining that the current printer is in a preliminary paper shortage state, the aperture length of the positioning hole in the paper feed direction, and the minimum distance between the opposite edges of two adjacent positioning holes in the paper feed direction. The first control module is used to control the paper feed motor of the current printer to drive the hole positioning label paper to move a preset micro-motion distance along the paper output direction or paper return direction when the minimum spacing is greater than the hole diameter length. The preset micro-motion distance is greater than the hole diameter length and less than the minimum spacing. The third detection module is used to switch the current detection mode to the first detection mode after moving the preset micro-motion distance, and to perform optical detection on the paper channel based on the first detection mode to obtain the third detection information. The fourth detection module is used to switch the first detection mode to the second detection mode when the third detection information meets the first paper shortage condition, and to perform optical detection on the paper channel based on the second detection mode to obtain the fourth detection information. The seventh determining module is used to determine that the printer is currently in a paper shortage state when the third detection information meets the first paper shortage condition and the fourth detection information meets the second paper shortage condition. The eighth determining module is used to determine that the current printer is in a paper-ready state when the third detection information does not meet the first paper shortage condition, or when the third detection information meets the first paper shortage condition and the fourth detection information does not meet the second paper shortage condition.
[0193] In one possible implementation, the printing medium used by the aforementioned printer is perforated label paper, which includes a plurality of positioning holes spaced apart along the paper feed direction; the aforementioned device 500 further includes: The eleventh acquisition module is used to acquire, after determining that the printer is in a preliminary paper shortage state, the aperture length of the positioning hole in the paper feed direction, and the minimum distance between the opposite edges of two adjacent positioning holes in the paper feed direction. The second control module is used to control the paper feed motor of the current printer to drive the hole positioning label paper along the paper output direction or paper return direction when the minimum spacing is less than or equal to the hole diameter length, so as to perform continuous micro-motion with a preset micro-motion step size. The fifth detection module is used to switch the current detection mode to the first detection mode mentioned above after each micro-motion, and to perform optical detection on the paper channel based on the first detection mode to obtain the first re-inspection detection information. The sixth detection module is used to switch the first detection mode to the second detection mode when the first re-inspection detection information meets the first paper shortage condition, and to perform optical detection on the paper channel based on the second detection mode to obtain the second re-inspection detection information. The ninth determining module is used to determine that the printer is currently in a paper-ready state if, after any micro-motion, the first re-inspection detection information does not meet the first paper shortage condition, or the first re-inspection detection information meets the first paper shortage condition and the second re-inspection detection information does not meet the second paper shortage condition. The tenth determining module is used to determine that the printer is currently in a paper shortage state when the number of consecutive micro-movements reaches a preset maximum number of micro-movements, and the first re-inspection detection information obtained after each micro-movement satisfies the first paper shortage condition and the second re-inspection detection information satisfies the second paper shortage condition.
[0194] In one possible implementation, the preset micro-motion step size is determined based on the aperture length and the minimum spacing, wherein the preset micro-motion step size is less than or equal to the aperture length and less than or equal to the minimum spacing.
[0195] In one possible implementation, the preset micro-motion step size is greater than or equal to the preset minimum resolution step size.
[0196] The division of modules in the printer paper out detection device described above is for illustrative purposes only. In other embodiments, the printer paper out detection device can be divided into different modules as needed to complete all or part of the functions of the printer paper out detection device. The implementation of each module in the printer paper out detection device provided in this application embodiment can be in the form of a computer program. This computer program can run on a terminal or server. The program modules constituted by this computer program can be stored in the memory of the terminal or server. When the computer program is executed by a processor, it implements all or part of the steps of the printer paper out detection method described in this application embodiment.
[0197] This application also provides an electronic device, which can be a server, and its internal structure diagram can be as follows: Figure 6As shown, this electronic device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. The processor executes a computer program to implement a printer paper out detection method.
[0198] Those skilled in the art will understand that Figure 6 The structures shown are merely block diagrams of some structures related to the embodiments of this application and do not constitute a limitation on the electronic devices to which the embodiments of this application are applied. Specific electronic devices may include more or fewer components than those shown in the figures, or combine certain components, or have different component arrangements.
[0199] In one possible implementation, a computer storage medium is provided that stores instructions, which, when executed on a computer or processor, cause the computer or processor to perform one or more steps in the above embodiments. If the constituent modules of the above-described electronic device are implemented as software functional units and sold or used as independent products, they can be stored in the aforementioned computer-readable storage medium.
[0200] In one possible implementation, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0201] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When these computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer storage medium or transmitted through the computer storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The aforementioned available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., Digital Versatile Discs (DVDs)), or semiconductor media (e.g., Solid State Disks (SSDs)).
[0202] 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. This 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 aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks. Unless otherwise specified, the technical features of this embodiment and its implementation can be combined arbitrarily.
[0203] The above-described embodiments are merely preferred embodiments of the present application and are not intended to limit the scope of the present application. Various modifications and improvements made by those skilled in the art to the technical solutions of the present application without departing from the design spirit of the present application should fall within the protection scope defined by the claims.
[0204] The foregoing has described specific embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
Claims
1. A method for detecting paper shortage in a printer, characterized in that, include: Upon detecting a paper out detection request for the current printer, optical detection is performed on the paper path of the current printer based on a first detection mode to obtain first detection information; When the first detection information meets the first paper shortage condition, the first detection mode is switched to the second detection mode, and optical detection is performed on the paper channel of the current printer based on the second detection mode to obtain the second detection information. The first detection mode and the second detection mode are both one of the transmission detection mode and the reflection detection mode, and the first detection mode is different from the second detection mode. Determine whether the second detection information meets the second paper shortage condition corresponding to the second detection mode; If the second detection information meets the second paper shortage condition, the printer is determined to be in a preliminary paper shortage state.
2. The method as described in claim 1, characterized in that, The first detection information includes a first detection value, and the second detection information includes a second detection value; The first paper shortage condition includes: when the first detection mode is the transmission detection mode, the first detection value is greater than a preset transmission paper shortage threshold; or, when the first detection mode is the reflection detection mode, the first detection value is less than a preset reflection paper shortage threshold. The second paper shortage condition includes: when the second detection mode is the transmission detection mode, the second detection value is greater than the transmission paper shortage threshold; or, when the second detection mode is the reflection detection mode, the second detection value is less than the reflection paper shortage threshold.
3. The method as described in claim 1, characterized in that, The first detection information includes multiple first detection values obtained through continuous detection, and the second detection information includes multiple second detection values obtained through continuous detection; The first paper shortage condition includes: when the first detection mode is the transmission detection mode, all of the plurality of first detection values are greater than a preset transmission paper shortage threshold, and the duration for which the plurality of first detection values are continuously greater than the transmission paper shortage threshold reaches a first preset duration; or, when the first detection mode is the reflection detection mode, all of the plurality of first detection values are less than a preset reflection paper shortage threshold, and the duration for which the plurality of first detection values are continuously less than the reflection paper shortage threshold reaches a second preset duration. The second paper shortage condition includes: when the second detection mode is the transmission detection mode, all of the plurality of second detection values are greater than the transmission paper shortage threshold, and the duration for which the plurality of second detection values are continuously greater than the transmission paper shortage threshold reaches a third preset duration; or, when the second detection mode is the reflection detection mode, all of the plurality of second detection values are less than the reflection paper shortage threshold, and the duration for which the plurality of second detection values are continuously less than the reflection paper shortage threshold reaches a fourth preset duration.
4. The method as described in claim 2 or 3, characterized in that, The method further includes: The transmission sampling value when the paper channel is in a paperless state is obtained as the first transmission reference value; The transmission sampling value of the target paper when it is set in the paper channel is obtained as the second transmission reference value; wherein the transmission sampling value of the target paper is greater than the transmission sampling value corresponding to the preset reference paper and less than the first transmission reference value. A transmission paper shortage threshold is determined based on the first transmission reference value and the second transmission reference value, wherein the transmission paper shortage threshold is greater than the second transmission reference value and less than the first transmission reference value.
5. The method as described in claim 2 or 3, characterized in that, The method further includes: The reflection sample value when the paper channel is in a paperless state is obtained as the first reflection reference value; The reflection sampling value of a printing medium with a target reflective area is obtained within the paper channel, and the target reflective area is located at a reflective optical detection position, and is used as a second reflection reference value; wherein, the reflection sampling value of the target reflective area is less than the reflection sampling value corresponding to a preset reference paper, and greater than the first reflection reference value; A reflective paper shortage threshold is determined based on the first reflective reference value and the second reflective reference value, wherein the reflective paper shortage threshold is greater than the first reflective reference value and less than the second reflective reference value.
6. The method as described in claim 4, characterized in that, The step of determining the transmission paper shortage threshold based on the first transmission reference value and the second transmission reference value includes: The first transmission reference value and the second transmission reference value are averaged to obtain the intermediate transmission value; The preset first bias is added to the transmission intermediate value to obtain the transmission paper shortage threshold. Wherein, the first bias is a positive value and is less than half the difference between the first transmission reference value and the second transmission reference value, so that the transmission paper shortage threshold is located between the first transmission reference value and the second transmission reference value, and is offset towards the transmission sampling value corresponding to the paperless state.
7. The method as described in claim 5, characterized in that, Determining the reflective paper shortage threshold based on the first reflective reference value and the second reflective reference value includes: The first reflection reference value and the second reflection reference value are averaged to obtain the intermediate reflection value; The preset second bias is subtracted from the intermediate reflection value to obtain the reflection paper shortage threshold; The second bias is a positive value and is less than half the difference between the second reflection reference value and the first reflection reference value, so that the paper shortage threshold is located between the first reflection reference value and the second reflection reference value, and is offset towards the reflection sampling value corresponding to the paperless state.
8. The method as described in claim 1, characterized in that, The method further includes: If the first detection information does not meet the first paper shortage condition, the printer is determined to be in a paper-ready state; or... If the second detection information does not meet the second paper shortage condition, the printer is determined to be in a paper-ready state.
9. The method as described in claim 1, characterized in that, Before performing optical detection on the paper path of the current printer based on the first detection mode to obtain the first detection information, the method further includes: If a paper out detection request is detected for the current printer, the current default detection mode of the current printer is obtained; The default detection mode is set as the first detection mode.
10. The method as described in claim 1, characterized in that, Before performing optical detection on the paper path of the current printer based on the first detection mode to obtain the first detection information, the method further includes: According to the first detection mode, obtain the target calibration luminescence intensity corresponding to the first detection mode; Adjust the light intensity of the optical sensor of the current printer to the target calibrated light intensity; After the luminous intensity of the optical sensor meets the preset stability condition, the step of performing optical detection on the paper channel of the current printer based on the first detection mode to obtain the first detection information is executed.
11. The method as described in claim 3, characterized in that, The method further includes: Based on the paper out detection request, determine the event type that triggered this paper out detection. The event type is any one of the following: a first event type that characterizes the printer cover switching from an open state to a closed state, and a second event type that characterizes the completion of a printing task or the recovery of a printing fault. When the event type is the first event type, the first preset duration and / or the second preset duration are adjusted to the first duration; When the event type is the second event type, the first preset duration and / or the second preset duration is adjusted to the second duration; Wherein, the first duration is longer than the second duration.
12. The method as described in claim 3, characterized in that, Both the first preset duration and the second preset duration are not less than a preset duration threshold. The preset duration threshold is used to characterize the time required for the paper to naturally sink from its initial state when placed in the paper channel to a state of being in contact with the paper channel.
13. The method as described in claim 2 or 3, characterized in that, The current printer includes a light emitting unit, a transmitted light receiver, and a reflected light receiver; Before performing optical detection on the paper path of the current printer based on the first detection mode to obtain the first detection information, the method further includes: With the light emitting unit in the off state, the first ambient light sampling value of the transmitted light receiver and the second ambient light sampling value of the reflected light receiver are acquired; When the light emitting unit is in the turned-on state, the first light sample value of the transmitted light receiver and the second light sample value of the reflected light receiver are acquired. When the first detection mode is the transmission detection mode, the first detection value in the first detection information is the difference obtained by subtracting the first ambient light sampling value from the first illuminated sampling value. When the first detection mode is the reflection detection mode, the first detection value in the first detection information is the difference between the second illuminated sample value and the second ambient light sample value. When the second detection mode is the transmission detection mode, the second detection value in the second detection information is the difference obtained by subtracting the first ambient light sampling value from the first illuminated sampling value. When the second detection mode is the reflection detection mode, the second detection value in the second detection information is the difference between the second illuminated sample value and the second ambient light sample value.
14. The method as described in claim 1, characterized in that, The method further includes: After determining that the current printer is in a preliminary paper shortage state, and after confirming that the paper path of the current printer is in a paperless state and detecting that the top cover of the current printer is in a closed state, the transmission reference value and reflection reference value in the current paperless state are obtained. The optical path attenuation amplitude is determined by comparing the transmission reference value with the historical transmission reference value and the reflection reference value with the historical reflection reference value. If the optical path attenuation exceeds a preset attenuation threshold, the driving intensity of the current printer's light emitting unit is compensated, and / or an optical path cleaning prompt is output.
15. The method as described in claim 1, characterized in that, The printing medium used by the current printer is hole positioning label paper, which includes a plurality of positioning holes spaced apart along the paper feed direction. After determining that the current printer is in a preliminary paper shortage state, the method further includes: Obtain the diameter length of the positioning hole in the paper feed direction, and the minimum distance between the opposite edges of two adjacent positioning holes in the paper feed direction; When the minimum spacing is greater than the aperture length, the paper feed motor of the current printer is controlled to drive the hole positioning label paper to move a preset micro-motion distance along the paper output direction or paper return direction, wherein the preset micro-motion distance is greater than the aperture length and less than the minimum spacing; After moving the preset micro-motion distance, the current detection mode is switched to the first detection mode, and optical detection is performed on the paper channel based on the first detection mode to obtain the third detection information; If the third detection information satisfies the first paper shortage condition, the first detection mode is switched to the second detection mode, and optical detection is performed on the paper channel based on the second detection mode to obtain the fourth detection information. If the third detection information satisfies the first paper shortage condition and the fourth detection information satisfies the second paper shortage condition, it is determined that the current printer is in a paper shortage state. If the third detection information does not meet the first paper shortage condition, or if the third detection information meets the first paper shortage condition but the fourth detection information does not meet the second paper shortage condition, the printer is determined to be in a paper-ready state.
16. The method as described in claim 1, characterized in that, The printing medium used by the current printer is hole positioning label paper, which includes a plurality of positioning holes spaced apart along the paper feed direction. After determining that the current printer is in a preliminary paper shortage state, the method further includes: Obtain the diameter length of the positioning hole in the paper feed direction, and the minimum distance between the opposite edges of two adjacent positioning holes in the paper feed direction; When the minimum spacing is less than or equal to the aperture length, the paper feed motor of the current printer is controlled to drive the hole positioning label paper along the paper output direction or paper return direction to perform continuous micro-motion with a preset micro-motion step size; After each micro-motion, the current detection mode is switched to the first detection mode, and optical detection is performed on the paper channel based on the first detection mode to obtain the first re-inspection detection information; If the first re-inspection detection information meets the first paper shortage condition, the first detection mode is switched to the second detection mode, and optical detection is performed on the paper channel based on the second detection mode to obtain the second re-inspection detection information. After any micro-motion, if the first re-inspection detection information does not meet the first paper shortage condition, or if the first re-inspection detection information meets the first paper shortage condition and the second re-inspection detection information does not meet the second paper shortage condition, then it is determined that the current printer is in a paper-ready state. If the number of consecutive micro-movements reaches the preset maximum number of micro-movements, and the first re-inspection detection information obtained after each micro-movement satisfies the first paper shortage condition, and the second re-inspection detection information satisfies the second paper shortage condition, then the printer is determined to be in a paper shortage state.
17. The method as described in claim 16, characterized in that, The preset micro-motion step size is determined based on the aperture length and the minimum spacing. The preset micro-motion step size is less than or equal to the aperture length and less than or equal to the minimum spacing.
18. The method as described in claim 17, characterized in that, The preset micro-motion step size is greater than or equal to the preset minimum resolution step size.
19. A printer paper out detection device, characterized in that, include: The first detection module is used to perform optical detection on the paper channel of the current printer based on a first detection mode when a paper out detection request for the current printer is detected, so as to obtain first detection information. The second detection module is used to switch the first detection mode to the second detection mode when the first detection information meets the first paper shortage condition, and to perform optical detection on the paper channel of the current printer based on the second detection mode to obtain the second detection information. The first detection mode and the second detection mode are both one of the transmission detection mode and the reflection detection mode, and the first detection mode is different from the second detection mode. The judgment module is used to determine whether the second detection information meets the second paper shortage condition corresponding to the second detection mode; The first determining module is used to determine that the printer is in a preliminary paper shortage state when the second detection information meets the second paper shortage condition.
20. An electronic device, characterized in that, include: Processor and memory; The processor is connected to the memory; The memory is used to store executable program code; The processor runs a program corresponding to the executable program code stored in the memory to perform the method as described in any one of claims 1-18.
21. A computer storage medium, characterized in that, The computer storage medium stores a plurality of instructions adapted for loading by a processor and executing the method steps as claimed in any one of claims 1-18.
22. A computer program product containing instructions, characterized in that, When the computer program product is run on a computer or processor, it causes the computer or processor to perform the steps of the method as described in any one of claims 1-18.
