Skip to content

Commit 2c4f5ab

Browse files
authored
Fix: Correct mistake in ZPL sensor configs (#64)
Apparently my testing of ZPL sensor levels wasn't thorough enough, I needed to do more digging into various eras of manuals to sort out what was going wrong with setting some printer's values. This was only an issue if you were specifically setting sensors manually. I dragged a bunch of different information into the docs for this one because I had to re-learn some of these pieces for the third time. This also fixed a couple of issues with the demo UI.
1 parent 6e8aadf commit 2c4f5ab

36 files changed

+2443
-234
lines changed

demo/advanced.html

Lines changed: 60 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,13 @@
174174
// commands or configs specific to their printers.
175175
// Sensors
176176
modalZplRibbonTHold: HTMLInputElement
177-
modalZplRibbonLed : HTMLInputElement
177+
modalZplRibbonGain : HTMLInputElement
178178
modalZplWebTHold : HTMLInputElement
179179
modalZplWebMedia : HTMLInputElement
180-
modalZplWebLed : HTMLInputElement
180+
modalZplTransGain : HTMLInputElement
181181
modalZplMarkTHold : HTMLInputElement
182182
modalZplMarkMedia : HTMLInputElement
183-
modalZplMarkLed : HTMLInputElement
183+
modalZplMarkGain : HTMLInputElement
184184

185185
modalZplWithSensorGraph: HTMLInputElement
186186

@@ -388,16 +388,16 @@ <h4>${titleHtml}</h4>
388388
form.modalLabelOffsetLeft.value = config.mediaPrintOriginOffsetDots.left.toString();
389389
form.modalLabelOffsetTop.value = config.mediaPrintOriginOffsetDots.top.toString();
390390
form.modalBackfeedPercent.value = config.backfeedAfterTaken.toString();
391+
391392
if (isZpl) {
392-
const sensors = config.sensorLevels;
393-
form.modalZplRibbonTHold.value = sensors.ribbonThreshold.toString();
394-
form.modalZplRibbonLed.value = sensors.ribbonLedBrightness.toString();
395-
form.modalZplWebTHold.value = sensors.webThreshold.toString();
396-
form.modalZplWebMedia.value = sensors.mediaThreshold.toString();
397-
form.modalZplWebLed.value = sensors.mediaLedBrightness.toString();
398-
form.modalZplMarkTHold.value = sensors.markThreshold.toString();
399-
form.modalZplMarkMedia.value = sensors.markMediaThreshold.toString();
400-
form.modalZplMarkLed.value = sensors.markLedBrightness.toString();
393+
form.modalZplRibbonTHold.value = config.ribbonThreshold.toString();
394+
form.modalZplRibbonGain.value = config.ribbonGain.toString();
395+
form.modalZplWebTHold.value = config.webThreshold.toString();
396+
form.modalZplWebMedia.value = config.mediaThreshold.toString();
397+
form.modalZplTransGain.value = config.transGain.toString();
398+
form.modalZplMarkTHold.value = config.markThreshold.toString();
399+
form.modalZplMarkMedia.value = config.markMediaThreshold.toString();
400+
form.modalZplMarkGain.value = config.markGain.toString();
401401

402402
form.modalZplPowerUpAction.value = config.actionPowerUp.toString();
403403
form.modalZplHeadCloseAction.value = config.actionHeadClose.toString();
@@ -686,21 +686,21 @@ <h4>${titleHtml}</h4>
686686
actionPowerUp, actionHeadClose
687687
))
688688
.andThen(new WebLabel.ZPL.CmdSetSensorCalibration({
689-
markLedBrightness: Number(form.modalZplMarkLed.value),
689+
markGain : Number(form.modalZplMarkGain.value),
690690
markMediaThreshold: Number(form.modalZplMarkMedia.value),
691-
markThreshold: Number(form.modalZplMarkTHold.value),
692-
mediaLedBrightness: Number(form.modalZplWebLed.value),
693-
mediaThreshold: Number(form.modalZplWebMedia.value),
694-
ribbonLedBrightness: Number(form.modalZplRibbonLed.value),
695-
ribbonThreshold: Number(form.modalZplRibbonTHold.value),
696-
webThreshold: Number(form.modalZplWebTHold.value),
691+
markThreshold : Number(form.modalZplMarkTHold.value),
692+
transGain : Number(form.modalZplTransGain.value),
693+
mediaThreshold : Number(form.modalZplWebMedia.value),
694+
ribbonGain : Number(form.modalZplRibbonGain.value),
695+
ribbonThreshold : Number(form.modalZplRibbonTHold.value),
696+
webThreshold : Number(form.modalZplWebTHold.value),
697697
}));
698698
}
699699

700700
let doc: WebLabel.IDocument;
701701
if (form.modalWithAutosense.checked) {
702702
doc = configDoc.autosenseLabelLength();
703-
} else if (isZpl && form.modalZplWithSensorGraph) {
703+
} else if (isZpl && form.modalZplWithSensorGraph.checked) {
704704
doc = configDoc.andThen(new WebLabel.ZPL.CmdGraphSensorCalibration()).finalize();
705705
} else {
706706
doc = configDoc.finalize();
@@ -1005,47 +1005,48 @@ <h5>Sensor Settings</h5>
10051005
<input id="modalZplWithSensorGraph" type="checkbox" class="btn-check"
10061006
aria-label="Run sensor graph" autocomplete="off">
10071007
<label for="modalZplWithSensorGraph" class="btn btn-outline-primary"
1008-
data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="right" title="SET LABEL LENGTH FIRST. Will graph sensor values on labels.<br/><b>Make sure to unspool peeler first!</b>"
1008+
data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="right"
1009+
title="SET LABEL LENGTH FIRST. Will graph sensor values on labels.<br/><b>Make sure to unspool peeler first!</b>"
10091010
>Print graph on save</label>
10101011
</div>
10111012
</div>
10121013
</div>
10131014
<div class="row">
1014-
<div class="col-md-4"
1015-
data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="top"
1016-
title="Sensor level, run graph calibrate to check.<br>Only relevant for printers with ribbon."
1017-
>
1015+
<div class="col-md-4">
10181016
<p class="h5">Ribbon</p>
10191017
</div>
1020-
<div class="col-md-4"
1021-
data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="top"
1022-
title="Sensor level, run graph calibrate to check.<br>Only active for web/gap sense mode."
1023-
>
1018+
<div class="col-md-4">
10241019
<p class="h5">Web sense</p>
10251020
</div>
1026-
<div class="col-md-4"
1027-
data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="top"
1028-
title="Sensor level, run graph calibrate to check.<br>Only active for mark/reflective sense mode."
1029-
>
1021+
<div class="col-md-4">
10301022
<p class="h5">Mark sense</p>
10311023
</div>
10321024
</div>
10331025
<div class="row">
10341026
<div class="col-md-4">
10351027
<div class="form-floating">
1036-
<input class="form-control" id="modalZplRibbonTHold" value="50" />
1028+
<input class="form-control" id="modalZplRibbonTHold" value="50"
1029+
data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="left"
1030+
title="Below this the ribbon is 'out'. OUT line on newer printer graphs, RIBBON line on older.<br>Should be at least 10 lower than the graphed value when loaded.<br>Ignored on direct-only printers."
1031+
/>
10371032
<label for="modalZplRibbonTHold">Threshold</label>
10381033
</div>
10391034
</div>
10401035
<div class="col-md-4">
10411036
<div class="form-floating">
1042-
<input class="form-control" id="modalZplWebTHold" value="50" />
1037+
<input class="form-control" id="modalZplWebTHold" value="50"
1038+
data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="left"
1039+
title="The WEB line on the graph. The sensor value should reliably cross this at every web.<br>Only used in gap sense."
1040+
/>
10431041
<label for="modalZplWebTHold">Threshold</label>
10441042
</div>
10451043
</div>
10461044
<div class="col-md-4">
10471045
<div class="form-floating">
1048-
<input class="form-control" id="modalZplMarkTHold" value="50" />
1046+
<input class="form-control" id="modalZplMarkTHold" value="50"
1047+
data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="right"
1048+
title="The WEB line on the graph. The sensor value should reliably cross this at every mark.<br>Only used in mark sense."
1049+
/>
10491050
<label for="modalZplMarkTHold">Threshold</label>
10501051
</div>
10511052
</div>
@@ -1054,34 +1055,49 @@ <h5>Sensor Settings</h5>
10541055
<div class="col-md-4"></div>
10551056
<div class="col-md-4">
10561057
<div class="form-floating">
1057-
<input class="form-control" id="modalZplWebMedia" value="50" />
1058+
<input class="form-control" id="modalZplWebMedia" value="50"
1059+
data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="right"
1060+
title="Above this the media is 'out'. OUT line on newer printer graphs, MEDIA line on older.<br>Should be 15 above the higest sensor spike.<br>Only used in web sense."
1061+
/>
10581062
<label for="modalZplWebMedia">Media</label>
10591063
</div>
10601064
</div>
10611065
<div class="col-md-4">
10621066
<div class="form-floating">
1063-
<input class="form-control" id="modalZplMarkMedia" value="50" />
1067+
<input class="form-control" id="modalZplMarkMedia" value="50"
1068+
data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="right"
1069+
title="Below this line hte media is 'out'. OUT line on newer printer graphs, MEDIA line on older.<br>Should be 15 below the lowest sensor spike.<br>Only used in mark sense."
1070+
/>
10641071
<label for="modalZplMarkMedia">Media</label>
10651072
</div>
10661073
</div>
10671074
</div>
10681075
<div class="row">
10691076
<div class="col-md-4">
10701077
<div class="form-floating">
1071-
<input class="form-control" id="modalZplRibbonLed" value="50" />
1072-
<label for="modalZplRibbonLed">LED</label>
1078+
<input class="form-control" id="modalZplRibbonGain" value="50"
1079+
data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="left"
1080+
title="Adjust lower or higher to increase or decrease the range of the ribbon sensor graph. Aim for a large difference between ribbon loaded and unloaded. Ignored on direct-only printers."
1081+
/>
1082+
<label for="modalZplRibbonGain">Gain</label>
10731083
</div>
10741084
</div>
10751085
<div class="col-md-4">
10761086
<div class="form-floating">
1077-
<input class="form-control" id="modalZplWebLed" value="50" />
1078-
<label for="modalZplWebLed">LED</label>
1087+
<input class="form-control" id="modalZplTransGain" value="50"
1088+
data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="right"
1089+
title="Adjust lower or higher to increase or decrease the range of the media sensor graph.<br>Aim for a large clear spike in the web, with low noise over the label.<br>Only used in web sense."
1090+
/>
1091+
<label for="modalZplTransGain">Gain</label>
10791092
</div>
10801093
</div>
10811094
<div class="col-md-4">
10821095
<div class="form-floating">
1083-
<input class="form-control" id="modalZplMarkLed" value="50" />
1084-
<label for="modalZplMarkLed">LED</label>
1096+
<input class="form-control" id="modalZplMarkGain" value="50"
1097+
data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="right"
1098+
title="Adjust lower or higher to increase or decrease the range of the media sensor graph.<br>Aim for a large clear spike in the mark, with low noise over the label.<br>Only used in mark sense."
1099+
/>
1100+
<label for="modalZplMarkGain">Gain</label>
10851101
</div>
10861102
</div>
10871103
</div>

demo/test_advanced.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -318,16 +318,16 @@ class BasicLabelDesignerApp {
318318
form.modalLabelOffsetLeft.value = config.mediaPrintOriginOffsetDots.left.toString();
319319
form.modalLabelOffsetTop.value = config.mediaPrintOriginOffsetDots.top.toString();
320320
form.modalBackfeedPercent.value = config.backfeedAfterTaken.toString();
321+
321322
if (isZpl) {
322-
const sensors = config.sensorLevels;
323-
form.modalZplRibbonTHold.value = sensors.ribbonThreshold.toString();
324-
form.modalZplRibbonLed.value = sensors.ribbonLedBrightness.toString();
325-
form.modalZplWebTHold.value = sensors.webThreshold.toString();
326-
form.modalZplWebMedia.value = sensors.mediaThreshold.toString();
327-
form.modalZplWebLed.value = sensors.mediaLedBrightness.toString();
328-
form.modalZplMarkTHold.value = sensors.markThreshold.toString();
329-
form.modalZplMarkMedia.value = sensors.markMediaThreshold.toString();
330-
form.modalZplMarkLed.value = sensors.markLedBrightness.toString();
323+
form.modalZplRibbonTHold.value = config.ribbonThreshold.toString();
324+
form.modalZplRibbonLed.value = config.ribbonGain.toString();
325+
form.modalZplWebTHold.value = config.webThreshold.toString();
326+
form.modalZplWebMedia.value = config.mediaThreshold.toString();
327+
form.modalZplWebLed.value = config.transGain.toString();
328+
form.modalZplMarkTHold.value = config.markThreshold.toString();
329+
form.modalZplMarkMedia.value = config.markMediaThreshold.toString();
330+
form.modalZplMarkLed.value = config.markGain.toString();
331331

332332
form.modalZplPowerUpAction.value = config.actionPowerUp.toString();
333333
form.modalZplHeadCloseAction.value = config.actionHeadClose.toString();
@@ -616,21 +616,21 @@ class BasicLabelDesignerApp {
616616
actionPowerUp, actionHeadClose
617617
))
618618
.andThen(new WebLabel.ZPL.CmdSetSensorCalibration({
619-
markLedBrightness: Number(form.modalZplMarkLed.value),
619+
markGain : Number(form.modalZplMarkLed.value),
620620
markMediaThreshold: Number(form.modalZplMarkMedia.value),
621-
markThreshold: Number(form.modalZplMarkTHold.value),
622-
mediaLedBrightness: Number(form.modalZplWebLed.value),
623-
mediaThreshold: Number(form.modalZplWebMedia.value),
624-
ribbonLedBrightness: Number(form.modalZplRibbonLed.value),
625-
ribbonThreshold: Number(form.modalZplRibbonTHold.value),
626-
webThreshold: Number(form.modalZplWebTHold.value),
621+
markThreshold : Number(form.modalZplMarkTHold.value),
622+
transGain : Number(form.modalZplWebLed.value),
623+
mediaThreshold : Number(form.modalZplWebMedia.value),
624+
ribbonGain : Number(form.modalZplRibbonLed.value),
625+
ribbonThreshold : Number(form.modalZplRibbonTHold.value),
626+
webThreshold : Number(form.modalZplWebTHold.value),
627627
}));
628628
}
629629

630630
let doc: WebLabel.IDocument;
631631
if (form.modalWithAutosense.checked) {
632632
doc = configDoc.autosenseLabelLength();
633-
} else if (isZpl && form.modalZplWithSensorGraph) {
633+
} else if (isZpl && form.modalZplWithSensorGraph.checked) {
634634
doc = configDoc.andThen(new WebLabel.ZPL.CmdGraphSensorCalibration()).finalize();
635635
} else {
636636
doc = configDoc.finalize();

docs/label_directions.png

498 KB
Loading

docs/zpl/ZM400_Trans_Sensor1.jpg

47.5 KB
Loading

docs/zpl/continuous_medias.gif

2.31 KB
Loading

0 commit comments

Comments
 (0)