Skip to content

Commit

Permalink
Fix issues setting black mark tracking (#53)
Browse files Browse the repository at this point in the history
At some point the parameters were reversed for configuring black line
sense with ZPL.
  • Loading branch information
Cellivar authored Oct 5, 2024
1 parent 0ad5c39 commit 52e123a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions demo/advanced.html
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@
const form = formElement.elements as ConfigModalForm;
const printerIdx = parseInt((formElement.querySelector('#modalPrinterIndexText') as HTMLInputElement)!.innerText);
const printer = this.printers[printerIdx];
if (printer == undefined) {
if (printer === undefined) {
return;
}

Expand Down Expand Up @@ -516,10 +516,11 @@

configDoc
.setPrintDirection()
.setLabelHomeOffsetDots(0, 0)
.setLabelPrintOriginOffsetCommand(offsetLeft, offsetTop)
.setPrintSpeed(rawSpeed)
.setDarknessConfig(darkness)
.setLabelDimensions(labelWidthInches);
.setLabelDimensions(labelWidthInches, autosense ? undefined : labelHeightInches);
const doc = autosense
? configDoc.autosenseLabelLength()
: configDoc.finalize();
Expand All @@ -544,10 +545,10 @@

// Make the TypeScript type system happy by adding a property to the Window object.
declare global {
interface Window { label_app: BasicLabelDesignerApp }
interface Window { printer_app: BasicLabelDesignerApp }
}
// Now we can access our printer in the dev console if we want to mess with it!
window.label_app = app;
window.printer_app = app;


await printerMgr.forceReconnect();
Expand Down
2 changes: 1 addition & 1 deletion src/Printers/Languages/ZplPrinterCommandSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ export class ZplPrinterCommandSet extends PrinterCommandSet {
): Uint8Array {
const length = Math.trunc(cmd.labelLengthInDots);
const lineOffset = Math.trunc(cmd.blackLineOffset);
return this.encodeCommand(`^MNM,${length}^LL${lineOffset}`);
return this.encodeCommand(`^MNM,${lineOffset}\n^LL${length}`);
}

private printCommand(
Expand Down

0 comments on commit 52e123a

Please sign in to comment.