@@ -76,18 +76,7 @@ export function parseCmdHostConfig(
7676 update . printerHardware ??= { } ;
7777 update . printerMedia ??= { } ;
7878 update . printerSettings ??= { } ;
79- update . printerZplSettings ??= {
80- sensorLevels : {
81- markLedBrightness : 50 ,
82- markThreshold : 50 ,
83- markMediaThreshold : 50 ,
84- mediaLedBrightness : 50 ,
85- mediaThreshold : 50 ,
86- ribbonLedBrightness : 50 ,
87- ribbonThreshold : 50 ,
88- webThreshold : 50 ,
89- }
90- } ;
79+ update . printerZplSettings ??= { } ;
9180
9281 if ( window . location . hostname === "localhost" ) {
9382 console . debug (
@@ -96,6 +85,10 @@ export function parseCmdHostConfig(
9685 ) ;
9786 }
9887
88+ // Store these for disambiguation later on..
89+ let markLed , ribbonLed : number | undefined ;
90+ let sawGain = false ;
91+
9992 response
10093 . split ( '\n' )
10194 . map ( ( s ) => {
@@ -109,7 +102,7 @@ export function parseCmdHostConfig(
109102 if ( value . length === 12 && key === "" ) {
110103 // There's at least one exception: old ZPL versions will include the serial
111104 // at the top with no key.
112- key = "SERIAL" ;
105+ key = "SERIAL NUMBER " ;
113106 }
114107 return { key, value } ;
115108 } )
@@ -150,7 +143,13 @@ export function parseCmdHostConfig(
150143 // Cases handled by XML.
151144 // TODO: Handle them here too, eventually deprecate XML for performance?
152145 case "FIRMWARE" :
153- case "SERIAL" :
146+ // The firmware value should match that of the USB info. Here though
147+ // it's displayed with a <- appended, to make it easier to find. Strip
148+ // it before returning.
149+ break ;
150+ case "SERIAL NUMBER" :
151+ // This is often not present on newer printers.
152+ break ;
154153 case "HARDWARE ID" :
155154 case "DARKNESS" :
156155 case "DARKNESS SWITCH" : // Physical hardware must be present
@@ -197,56 +196,113 @@ export function parseCmdHostConfig(
197196 case "RFID VERSION" :
198197 break ;
199198
200- // Sensor levels, also in XML. These have synonyms
201- // in old config formats
199+ case "TAKE LABEL" :
200+ update . printerZplSettings ! . takeLabelThreshold = Number ( l . value ) ;
201+ break ;
202+
203+ // These next values are special depending on the vintage of the printer.
204+ // Somewhere beteween the ZP505 and the ZD410 the XML values for
205+ // "LED-INTENSITY" became "GAIN", and a new "LED-BRIGHTNESS" was added
206+ // for the ribbon and mark sensors. The MEDIA-LED-INTENSITY became
207+ // TRANSMISSIVE-GAIN, and a new command ^SI was added to set the LED
208+ // brightness itself. There are also separate SET-GET-DO commands.
209+
210+ // The LP2824Plus seems to be part of this migration, having no "LED"
211+ // values and no "TRANS" config lines.
212+
213+ // My R2844-Z has "LED" lines, LP2824Plus has "GAIN", ZD410 has BOTH!
214+ // The "MARK LED" and "RIBBON LED" lines on newer printers are not the same
215+ // so we must store them here and figure out which one they mean later.
216+ // Yay backwards incompatible changes!
217+ // Ribbon sensor is consistent, if present.
218+ case "RIBBON SENSOR" :
219+ case "RIBBON S." : //older synonym
220+ update . printerZplSettings ! . ribbonThreshold = Number ( l . value ) ;
221+ break ;
222+ case "RIBBON GAIN" :
223+ sawGain = true ;
224+ update . printerZplSettings ! . ribbonGain = Number ( l . value ) ;
225+ break ;
226+ case "RIBBON LED" :
227+ // May be gain or brightness, defer disambiguation
228+ ribbonLed = Number ( l . value ) ;
229+ break ;
230+
231+ // Web sense
232+ // Web threshold
202233 case "WEB SENSOR" :
203234 case "WEB S." : // older synonym
204- update . printerZplSettings ! . sensorLevels ! . webThreshold = Number ( l . value ) ;
235+ update . printerZplSettings ! . webThreshold = Number ( l . value ) ;
205236 break ;
237+ case "WEB GAIN" : // 2824Plus synonym?
238+ case "TRANS GAIN" : // whos lives matter yo
239+ sawGain = true ;
240+ update . printerZplSettings ! . transGain = Number ( l . value ) ;
241+ break ;
242+ case "MEDIA LED" : // Older name for same setting???
243+ // My kingdom for an hour with a Zebra firmware architect...
244+ update . printerZplSettings ! . transGain = Number ( l . value ) ;
245+ break ;
246+ // Media out threshold
206247 case "MEDIA SENSOR" :
207248 case "MEDIA S." : // older synonym
208- update . printerZplSettings ! . sensorLevels ! . mediaThreshold = Number ( l . value ) ;
249+ update . printerZplSettings ! . mediaThreshold = Number ( l . value ) ;
250+ break ;
251+ case "TRANS LED" :
252+ update . printerZplSettings ! . transBrightness = Number ( l . value ) ;
209253 break ;
254+
255+ // Mark sense
256+ // Web threshold
210257 case "MARK SENSOR" :
211258 case "MARK S." : // older synonym
212- update . printerZplSettings ! . sensorLevels ! . markThreshold = Number ( l . value ) ;
259+ update . printerZplSettings ! . markThreshold = Number ( l . value ) ;
213260 break ;
214- case "MARK MED SENSOR " :
215- case "MARK MED S." : // older synonym
216- update . printerZplSettings ! . sensorLevels ! . markMediaThreshold = Number ( l . value ) ;
261+ case "MARK GAIN " :
262+ sawGain = true ;
263+ update . printerZplSettings ! . markGain = Number ( l . value ) ;
217264 break ;
218265 case "MARK LED" :
219- update . printerZplSettings ! . sensorLevels ! . markLedBrightness = Number ( l . value ) ;
266+ // May be gain or brightness, defer disambiguation
267+ markLed = Number ( l . value ) ;
220268 break ;
221- case "MEDIA LED" :
222- case "RIBBON LED" :
223- update . printerZplSettings ! . sensorLevels ! . ribbonLedBrightness = Number ( l . value ) ;
269+ // Media out threshold
270+ case "MARK MED SENSOR" :
271+ case "MARK MED S." : // older synonym
272+ update . printerZplSettings ! . markMediaThreshold = Number ( l . value ) ;
224273 break ;
225- case "RIBBON SENSOR" :
226- case "RIBBON S." : //older synonym
227- update . printerZplSettings ! . sensorLevels ! . ribbonThreshold = Number ( l . value ) ;
274+ case "MARK MEDIA GAIN" :
275+ // Only shows on ZP505 and LP2824Plus..?
276+ sawGain = true ;
277+ update . printerZplSettings ! . markMediaGain = Number ( l . value ) ;
228278 break ;
229279
230- // These values don't correspond to ones that can be set via ^SS, so
231- // I'm not sure what they're for .
232- // TODO: Figure out what these sense and how to change them.
233- case "TRANS GAIN" : // whos lives matter yo
234- case "TRANS LED" :
235- case "MARK GAIN" :
236- case "TAKE LABEL" :
280+ // These are on a ZP505 and an LP2824Plus, I don't know what they're
281+ // for or how to configure them. .
282+ case 'CONT MEDIA SENSOR' :
283+ case 'CONT MEDIA S.' : // Older synonym
284+ break ;
285+ case "CONT MEDIA GAIN" :
286+ sawGain = true ;
237287 break ;
238288
239289 // Time and counters, maybe useful?
240290 case "RTC DATE" :
241291 case "RTC TIME" :
242292 break ;
243- // There is one nonresettable counter and two resettable ones
293+
294+ // There is one non-resettable counter and two resettable ones
244295 // like a car odometer and trip, haha.
245296 // Unfortunately, they use the same key! You have to split by suffix.
246297 // LABELS, IN, CM
247298 case "NONRESET CNTR" :
248299 case "RESET CNTR1" :
249300 case "RESET CNTR2" :
301+ case "LAST CLEANED" :
302+ case "HEAD USAGE" :
303+ case "TOTAL USAGE" :
304+ case "HEAD CLEANING" :
305+ case "HEAD LIFE" :
250306 break ;
251307
252308 // Comm modes flags that might not be needed ever?
@@ -264,7 +320,8 @@ export function parseCmdHostConfig(
264320 case "MASS STORAGE COUNT" :
265321 case "HID COUNT" :
266322 case "USB HOST LOCK OUT" :
267- case "XML SCHEMA" :
323+ case "XML SCHEMA" : // Validate?
324+ case "HEXDUMP" : // Fedex only?
268325 case "IDLE DISPLAY" :
269326 case "CONFIGURATION" : // CUSTOMIZED, older?
270327 case "FORMAT CONVERT" :
@@ -280,17 +337,29 @@ export function parseCmdHostConfig(
280337 case "ZEBRA NET II" :
281338 break ;
282339
283- // TODO: Sanity check these, throw a fit if they're set differntly
340+ // TODO: Sanity check these, throw a fit if they're set differently
284341 case "CONTROL PREFIX" :
342+ case "CONTROL CHAR" : // old synonym
285343 case "FORMAT PREFIX" :
344+ case "COMMAND CHAR" : // old synonym
286345 case "DELIMITER CHAR" :
346+ case "DELIM. CHAR" : // old synonym
287347 case "ZPL MODE" :
288348 case "COMMAND OVERRIDE" :
289349 break ;
290350 }
291-
292351 } ) ;
293352
353+ // If any 'GAIN' lines were observed the LED values are for brightness,
354+ // otherwise the values are for 'intensity' which is synonymous with 'gain'.
355+ if ( sawGain ) {
356+ update . printerZplSettings ! . markBrightness = markLed ;
357+ update . printerZplSettings ! . ribbonBrightness = ribbonLed ;
358+ } else {
359+ update . printerZplSettings ! . markGain = markLed ;
360+ update . printerZplSettings ! . ribbonGain = ribbonLed ;
361+ }
362+
294363 result . messages = [ update ] ;
295364 return result
296365}
0 commit comments