diff --git a/demo/advanced.html b/demo/advanced.html
index 9ef27ae..768206f 100644
--- a/demo/advanced.html
+++ b/demo/advanced.html
@@ -446,18 +446,21 @@
${titleHtml}
Settings
@@ -487,6 +490,14 @@ ${titleHtml}
this.redrawPrinterButtonHighlights();
this.redrawTextCanvas();
});
+ document.getElementById(`printerStatus_${idx}`)!
+ .addEventListener('click', async (e) => {
+ e.preventDefault();
+ const printerIdx = (e.currentTarget as HTMLAnchorElement).dataset.printerIdx as unknown as number;
+ const printer = this.printers[printerIdx];
+ const doc = printer.getConfigDocument().queryStatus().finalize();
+ await printer.sendDocument(doc);
+ });
document.getElementById(`printtest_${idx}`)!
.addEventListener('click', async (e) => {
e.preventDefault();
@@ -709,12 +720,19 @@ ${titleHtml}
// And send the whole shebang to the printer!
await printer.sendDocument(doc);
+ // Then get the updated printer info..
+ await printer.sendDocument(WebLabel.ReadyToPrintDocuments.configDocument);
+
+ // Hide the config modal
form.modalWithAutosense.checked = false;
form.modalZplWithSensorGraph.checked = false;
form.modalSubmit.removeAttribute("disabled");
form.modalCancel.removeAttribute("disabled");
this.activePrinterIndex = printerIdx;
this.configModalHandle.hide();
+
+ // Redraw the buttons with the updated config
+ this.redrawPrinterButtons();
}
}
diff --git a/demo/editor.html b/demo/editor.html
index e47095a..d1ed73e 100644
--- a/demo/editor.html
+++ b/demo/editor.html
@@ -412,18 +412,21 @@ ${titleHtml}
Settings
@@ -453,6 +456,14 @@ ${titleHtml}
this.redrawPrinterButtonHighlights();
this.redrawLabelCanvas();
});
+ document.getElementById(`printerStatus_${idx}`)!
+ .addEventListener('click', async (e) => {
+ e.preventDefault();
+ const printerIdx = (e.currentTarget as HTMLAnchorElement).dataset.printerIdx as unknown as number;
+ const printer = this.printers[printerIdx];
+ const doc = printer.getConfigDocument().queryStatus().finalize();
+ await printer.sendDocument(doc);
+ });
document.getElementById(`printtest_${idx}`)!
.addEventListener('click', async (e) => {
e.preventDefault();
@@ -639,12 +650,19 @@ ${titleHtml}
// And send the whole shebang to the printer!
await printer.sendDocument(doc);
+ // Then get the updated printer info..
+ await printer.sendDocument(WebLabel.ReadyToPrintDocuments.configDocument);
+
+ // Hide the config modal
form.modalWithAutosense.checked = false;
form.modalZplWithSensorGraph.checked = false;
form.modalSubmit.removeAttribute("disabled");
form.modalCancel.removeAttribute("disabled");
this.activePrinterIndex = printerIdx;
this.configModalHandle.hide();
+
+ // Redraw the buttons with the updated config
+ this.redrawPrinterButtons();
}
}
diff --git a/demo/test_advanced.ts b/demo/test_advanced.ts
index df3f02f..e866794 100644
--- a/demo/test_advanced.ts
+++ b/demo/test_advanced.ts
@@ -377,18 +377,21 @@ class BasicLabelDesignerApp {
Settings
@@ -418,6 +421,14 @@ class BasicLabelDesignerApp {
this.redrawPrinterButtonHighlights();
this.redrawTextCanvas();
});
+ document.getElementById(`printerStatus_${idx}`)!
+ .addEventListener('click', async (e) => {
+ e.preventDefault();
+ const printerIdx = (e.currentTarget as HTMLAnchorElement).dataset.printerIdx as unknown as number;
+ const printer = this.printers[printerIdx];
+ const doc = printer.getConfigDocument().queryStatus().finalize();
+ await printer.sendDocument(doc);
+ });
document.getElementById(`printtest_${idx}`)!
.addEventListener('click', async (e) => {
e.preventDefault();
@@ -640,12 +651,19 @@ class BasicLabelDesignerApp {
// And send the whole shebang to the printer!
await printer.sendDocument(doc);
+ // Then get the updated printer info..
+ await printer.sendDocument(WebLabel.ReadyToPrintDocuments.configDocument);
+
+ // Hide the config modal
form.modalWithAutosense.checked = false;
form.modalZplWithSensorGraph.checked = false;
form.modalSubmit.removeAttribute("disabled");
form.modalCancel.removeAttribute("disabled");
this.activePrinterIndex = printerIdx;
this.configModalHandle.hide();
+
+ // Redraw the buttons with the updated config
+ this.redrawPrinterButtons();
}
}
diff --git a/demo/test_editor.ts b/demo/test_editor.ts
index 5dde19a..e35aa8a 100644
--- a/demo/test_editor.ts
+++ b/demo/test_editor.ts
@@ -348,18 +348,21 @@ class BasicLabelDesignerApp {
Settings
@@ -389,6 +392,14 @@ class BasicLabelDesignerApp {
this.redrawPrinterButtonHighlights();
this.redrawLabelCanvas();
});
+ document.getElementById(`printerStatus_${idx}`)!
+ .addEventListener('click', async (e) => {
+ e.preventDefault();
+ const printerIdx = (e.currentTarget as HTMLAnchorElement).dataset.printerIdx as unknown as number;
+ const printer = this.printers[printerIdx];
+ const doc = printer.getConfigDocument().queryStatus().finalize();
+ await printer.sendDocument(doc);
+ });
document.getElementById(`printtest_${idx}`)!
.addEventListener('click', async (e) => {
e.preventDefault();
@@ -575,12 +586,19 @@ class BasicLabelDesignerApp {
// And send the whole shebang to the printer!
await printer.sendDocument(doc);
+ // Then get the updated printer info..
+ await printer.sendDocument(WebLabel.ReadyToPrintDocuments.configDocument);
+
+ // Hide the config modal
form.modalWithAutosense.checked = false;
form.modalZplWithSensorGraph.checked = false;
form.modalSubmit.removeAttribute("disabled");
form.modalCancel.removeAttribute("disabled");
this.activePrinterIndex = printerIdx;
this.configModalHandle.hide();
+
+ // Redraw the buttons with the updated config
+ this.redrawPrinterButtons();
}
}
diff --git a/src/Documents/ConfigDocument.ts b/src/Documents/ConfigDocument.ts
index 24b4649..892cffd 100644
--- a/src/Documents/ConfigDocument.ts
+++ b/src/Documents/ConfigDocument.ts
@@ -26,10 +26,12 @@ export class ConfigDocumentBuilder
// to commit the changes to stored memory. EPL does this automatically, ZPL does not
// so to bring them closer to parity this is automatically implied.
private _doSave = false;
- // TODO: Consider whether this should move to a ZPL extended command.
override finalize() {
if (this._doSave) {
- this.andThen(new Cmds.SaveCurrentConfigurationCommand());
+ this.andThen(new Cmds.SaveCurrentConfigurationCommand())
+ .andThen(new Cmds.EndLabel())
+ .andThen(new Cmds.StartLabel())
+ .andThen(new Cmds.QueryConfigurationCommand());
}
return super.finalize();
}
diff --git a/src/Languages/Zpl/CmdHostConfig.ts b/src/Languages/Zpl/CmdHostConfig.ts
index 3ca805f..8c6ca8b 100644
--- a/src/Languages/Zpl/CmdHostConfig.ts
+++ b/src/Languages/Zpl/CmdHostConfig.ts
@@ -88,6 +88,8 @@ export function parseCmdHostConfig(
// Store these for disambiguation later on..
let markLed, ribbonLed: number | undefined;
let sawGain = false;
+ let sawNonCont = false;
+ let sawSensorType: string | undefined;
response
.split('\n')
@@ -125,19 +127,25 @@ export function parseCmdHostConfig(
update.printerMedia!.mediaGapDetectMode = Conf.MediaMediaGapDetectionMode.continuous;
break;
case "GAP/NOTCH":
- case "NON-CONTINUOUS":
update.printerMedia!.mediaGapDetectMode = Conf.MediaMediaGapDetectionMode.webSensing;
break;
+ case "NON-CONTINUOUS":
+ // Older printers use this for both mark and web, then use SENSOR TYPE
+ // to determine what type of non-continuous.
+ sawNonCont = true;
+ break;
}
break;
}
case "SENSOR SELECT": // TRANSMISSIVE, REFLECTIVE, MANUAL
+ // Seems to be present on newer firmware revisions
// This should be set automatically with MEDIA TYPE.
// TODO: Don't ignore this if it disagrees with MEDIA TYPE?
break;
case "SENSOR TYPE": // MARK, WEB
- // This should be set automatically with MEDIA TYPE. LP2844-Z units.
- // TODO: Don't ignore this if it disagrees with MEDIA TYPE?
+ // Seems to be present on older firmware revisions. Will still be set
+ // when in continuous mode, so disambiguate later on.
+ sawSensorType = l.value
break;
// Cases handled by XML.
@@ -360,6 +368,16 @@ export function parseCmdHostConfig(
update.printerZplSettings!.ribbonGain = ribbonLed;
}
+ // On older printers 'NON-CONTINOUS' media type is used for web and mark
+ // then the SENSOR TYPE is used to determine the gap mode.
+ if (sawNonCont && sawSensorType !== undefined) {
+ if (sawSensorType === "MARK") {
+ update.printerMedia!.mediaGapDetectMode = Conf.MediaMediaGapDetectionMode.markSensing;
+ } else if (sawSensorType === "WEB") {
+ update.printerMedia!.mediaGapDetectMode = Conf.MediaMediaGapDetectionMode.webSensing;
+ }
+ }
+
result.messages = [update];
return result
}
diff --git a/src/Languages/Zpl/test_files/LP2844_Z_CONF.ts.snap b/src/Languages/Zpl/test_files/LP2844_Z_CONF.ts.snap
index 9edb38c..b54f857 100644
--- a/src/Languages/Zpl/test_files/LP2844_Z_CONF.ts.snap
+++ b/src/Languages/Zpl/test_files/LP2844_Z_CONF.ts.snap
@@ -6,7 +6,7 @@
"messageType": "SettingUpdateMessage",
"printerHardware": {},
"printerMedia": {
- "mediaGapDetectMode": 1,
+ "mediaGapDetectMode": 2,
"mediaLengthDots": 235,
},
"printerSettings": {},