Repository navigation
Feat/printer modal tab3 sl clock mode - #109
Merged
Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements support for the ZPL ^SL command to configure clock mode, tolerance, and language in the printer settings. It introduces schema validation to couple clock tolerance with the TOL mode, updates the ZPL parser and setup script generator, refactors the UI with a new reusable ZplEnumSubSelect component, and adds localized strings and unit tests. Feedback highlights two key improvements: clearing clockTolerance when parsing a mode change to S or T to avoid validation failures, and adding a defensive fallback to CLOCK_TOLERANCE_DEFAULT in the setup script emitter to prevent generating invalid ZPL if tolerance is undefined under TOL mode.
Tab 3 (Clock & Time, Setup-Script channel) gains the third RTC
command, with the spec-correct three-shape mode slot and the
1-13 language enum.
Schema (ObjectType.ts):
- CLOCK_MODE_VALUES ['S', 'T', 'TOL'] (S = time at format start,
T = time at print, TOL = time at print with tolerance seconds)
- CLOCK_TOLERANCE_RANGE {1, 999} + CLOCK_TOLERANCE_DEFAULT = 60
- CLOCK_LANGUAGE_VALUES ['1'..'13'] (English, Spanish, French,
German, Italian, Norwegian, Portuguese, Swedish, Danish,
Spanish 2, Dutch, Finnish, Japanese — separate enum from ^KL
because the two commands use different code systems)
- isClockMode, isClockLanguage type guards
- 3 new schema fields plus a superRefine cross-field rule that
pairs clockMode=TOL bidirectionally with clockTolerance
Generator + parser:
- SETUP_SCRIPT_EMITTERS gains 3 entries; clockMode is the
anchor, clockTolerance / clockLanguage ride along via the
fold-in pattern. Emitter is fallback-free — the cross-field
rule guarantees tolerance is set whenever mode is TOL, so
no UI default leaks back into persisted state through the
parser
- SL handler in zplParser uses strParam, splits the wire mode
slot (S/T enum vs numeric tolerance), and gates language
assignment on a successful mode parse so an orphan language
cannot land in the store
UI (ClockAndTimeTab):
- All three ^SL inputs sit under one shared command tag —
mode select, conditional tolerance row when mode='TOL',
language sub-select. Mode-switch onChange seeds the
CLOCK_TOLERANCE_DEFAULT on transition into TOL and clears
the tolerance on transition out, so the store never
observes the half-set combo the schema rejects.
- Persistence hint surfaces the on-board-battery semantic
("persists on printer until overwritten") so users know
^SL is sticky once sent
- Language options render as "1 – English" so the code and
the label read as two pieces
Primitive:
- ZplEnumSubSelect extracts the "select sharing a parent
command tag" pattern. FeedSubSelect in MediaFeedTab is
replaced by direct calls; ClockAndTimeTab language uses
it; mode-select stays hand-rolled because the cross-field
seeding makes its onChange non-trivial
Locales: 20 new keys (mode + 3 mode-labels, tolerance,
language + 13 language-labels, persistence-hint) in all 32
locales. Language names reuse the existing per-locale
printer-locale translations for consistency.
Memory closeout: project_ticket_sl_clock_formatting removed
(done). Epic project_ticket_printer_settings_modal is fully
shipped.
u8array
force-pushed
the
feat/printer-modal-tab3-sl-clock-mode
branch
from
May 29, 2026 21:58
7abaccd to
0b3f301
Compare
PR #109 Gemini-finding: when an earlier ^SL60,1 set clockMode=TOL and clockTolerance=60, a subsequent ^SLS in the same stream left the tolerance in place — the (mode=S, tolerance=60) combo then fails the schema cross-field rule and the persisted state cannot round-trip through save. Plus dropped the redundant isClockMode guard (a was already statically narrowed to 'S'|'T') and the now-unused import. The other Gemini finding (defensive ?? CLOCK_TOLERANCE_DEFAULT fallback in the emitter) was intentionally NOT applied — that fallback was removed earlier this PR after a clean-architecture review found it leaked the UI default back into persisted state via the parser. The schema cross-field rule already guarantees tolerance is set whenever mode is TOL, making the fallback defensive validation outside a system boundary.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.