10000 Supporting PT-P910BT / Cube XP · Issue #60 · ryankurte/rust-ptouch · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Supporting PT-P910BT / Cube XP #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
aschmitz opened this issue Jan 20, 2025 · 1 comment · May be fixed by #61
Open

Supporting PT-P910BT / Cube XP #60

aschmitz opened this issue Jan 20, 2025 · 1 comment · May be fixed by #61

Comments

@aschmitz
Copy link
Contributor
aschmitz commented Jan 20, 2025

The raster command reference for the 900 series (https://download.brother.com/welcome/docp100407/cv_ptp900_eng_raster_102.pdf) looks remarkably similar to that for the 700 series, but the PT-P910BT doubles the resolution of the PT-P710BT (360 DPI versus 180 DPI).

From some very rudimentary editing of the existing code (adding the relevant device entry, increasing the tape pixel size and margins, and increasing the 16 byte line size to 70 as documented in the 900-series PDF), I'm able to get a PT-P910BT to print at least some intelligible content (a QR code and text, although the printer doesn't send a printing completed status - even though we've explicitly enabled status notifications, so rust-ptouch doesn't realize the print has finished and times out rather than ejecting the label).

This is a promising start, but because a bunch of constants would have to change for the PT-P910BT to be supported, I wanted to file an issue and see if you had suggestions or preferences on how best to handle such an addition. (I am relatively experienced with programming in general, but am an extreme novice in Rust, so I am unlikely to have particularly idiomatic suggestions.)

(Regarding status notifications, rust-ptouch does send the [1b 69 21 00] command to enable automatic status notifications, but all I see is a single status notification saying that the printer is printing, not that it has finished. I'm not sure if that means the printer is expecting more content before it finishes somehow, or if it somehow doesn't queue status notifications, or what happened. I don't have a Windows/Mac machine particularly handy to test out with the official software, but I might be able to do so if appropriate.)

@ryankurte
Copy link
Owner

neat! i really appreciate that they seem to keep a consistent protocol (and publish the spec).

This is a promising start, but because a bunch of constants would have to change for the PT-P910BT to be supported, I wanted to file an issue and see if you had suggestions or preferences on how best to handle such an addition.

ahh fun. without a deep look into the spec i'd probably try to differentiate by DPI (assuming new models may also be 360), and use a marker trait / type constraints on the methods that need it. then you can hang other methods off those definitions, eg. fn print<D: Dpi>(&mut self, buff: &[<D as Dpi>Line], ..), something like:

trait Dpi {
    /// Buffer line type
    type Line;
    // Any the other constant-ish's that vary by DPI
    .. 
    // Any methods you need that're consistent for any DPI
    ..
}

pub struct Dpi180;

impl Dpi for Dpi180 {
    type Line = u16;
    ..
}

one thing to consider is that in the end we do need to be able to hold a printer object regardless of DPI so it probably is better to avoid a generic on the PTouch type itself, so the end state would be a Ptouch instance with a print method for each DPI that will error if you call the wrong one for the actually connected device. happy to give more guidance if you run into any rust-specific gremlins / feedback on a PR if you're up for giving it a shot.

Regarding status notifications, rust-ptouch does send the [1b 69 21 00] command to enable automatic status notifications, but all I see is a single status notification saying that the printer is printing

[..] times out rather than ejecting the label

i think these are related... the printer should automatically feed and cut the label once it's finished receiving the buffer. in the past i have seen this when the configuration (maybe buffer length calculation?) was not quite correct so the device was still waiting for more data / didn't realise it was done.

aschmitz added a commit to aschmitz/rust-ptouch that referenced this issue Apr 6, 2025
This is about as minimal an implementation as I can manage at the
moment, though it still passes around the resolution more than I might
like. Tested on both a PT-P910BT and a PT-P710BT.

Closes ryankurte#60.

(Also adds debug logging of data read from the USB device alongside
logging of data written.)
@aschmitz aschmitz linked a pull request Apr 6, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0