Add rotation calibration and millimetre rulers on the calibration sheet

A new rotation setting turns the whole print about the sheet centre, in
steps of 0.01 degree, on card sheets and the calibration sheet. The
calibration sheet now has millimetre rulers at every card edge; the four
lettered ones (A to D) are typed into Settings, which converts them into
corrected offsets and rotation. A simulation test checks the conversion
against modelled printer errors.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-19 17:14:22 -07:00
1 parent 5dfb50f1a8
commit e23b6ee6c4
13 files changed
+410 -54

No files matched your search

+10 -4
View File
@@ -148,10 +148,16 @@ test('print passes cards in shelf order and honours start; confirm clears queue'
test('settings clamp and calibration pdf', async () => {
const { req } = setup();
assert.deepEqual(await (await req('GET', '/api/settings')).json(), { offsetXmm: 0, offsetYmm: 0 });
const s = await (await req('PUT', '/api/settings', { offsetXmm: 50, offsetYmm: -50 })).json();
assert.deepEqual(s, { offsetXmm: 10, offsetYmm: -10 });
assert.deepEqual(await (await req('GET', '/api/settings')).json(), { offsetXmm: 10, offsetYmm: -10 });
assert.deepEqual(await (await req('GET', '/api/settings')).json(), { offsetXmm: 0, offsetYmm: 0, rotationDeg: 0 });
const s = await (await req('PUT', '/api/settings', { offsetXmm: 50, offsetYmm: -50, rotationDeg: 9 })).json();
assert.deepEqual(s, { offsetXmm: 10, offsetYmm: -10, rotationDeg: 3 });
assert.deepEqual(await (await req('GET', '/api/settings')).json(), { offsetXmm: 10, offsetYmm: -10, rotationDeg: 3 });
assert.deepEqual(await (await req('PUT', '/api/settings', { offsetXmm: 0.05, offsetYmm: 0, rotationDeg: -0.01 })).json(),
{ offsetXmm: 0.05, offsetYmm: 0, rotationDeg: -0.01 });
assert.equal((await (await req('PUT', '/api/settings', { offsetXmm: 1, offsetYmm: 2, rotationDeg: -7 })).json() as any).rotationDeg, -3);
// a body without rotationDeg leaves the stored rotation alone
assert.deepEqual(await (await req('PUT', '/api/settings', { offsetXmm: 1, offsetYmm: 2 })).json(), { offsetXmm: 1, offsetYmm: 2, rotationDeg: -3 });
assert.equal((await req('PUT', '/api/settings', { offsetXmm: 1, offsetYmm: 1, rotationDeg: 'x' })).status, 400);
assert.equal((await req('PUT', '/api/settings', { offsetXmm: 'a', offsetYmm: 1 })).status, 400);
assert.equal(await (await req('GET', '/api/calibration.pdf')).text(), '%PDF-cal');
});