Skip to content

fix: the touch-calibration section only on images with a touch panel - #190

Merged
angeloINTJ merged 1 commit into
mainfrom
fix/touch-cal-tft-only
Sep 26, 2026
Merged

angeloINTJ merged 1 commit into
mainfrom
fix/touch-cal-tft-only

Conversation

@angeloINTJ

Copy link
Copy Markdown
Owner

What

The Configuration page shows a Touch Calibration section, with a reset button, on every image. The alpha and the Air have no touch panel:

The section and resetTouchCal( ) now sit inside @IF tft, like the panel mirror and the theme picker. Found while documenting v2.7.4, before the release.

The gate that missed it

build_webui_gz.py refused a function or an element id that lives inside an @IF block and is used outside it, but it did not look at routes. It now reads the routes registerScreenRoutes( ) registers, parsed from the C++ so the list cannot go stale, and refuses a call to one of them from outside an @IF tft block. The check runs on every pio run.

tools/test_webui_feature_routes.py pins it. It has synthetic cases (outside is refused, inside passes, ? and a route prefix, a comment is not a call) and runs the check on the real WebUI.h. It is in the gates job.

WebUI.h result
before this change 8 ok, 1 failure, naming /api/reset_touch_cal and only it
after 9 ok

Proof that nothing else moved

  • Normalized page diff. I ran the generate( ) pipeline up to the gzip, each side with its own build_webui_gz.py and the ?v= asset stamp fixed on both sides:

    cut images result
    nothing omitted the four with the touch panel 12 of 12 blocks identical to main
    tft omitted alpha, Air only CFG_PAGE differs, −1,057 B minified: exactly the section's markup (483 characters) and resetTouchCal( )
  • Builds. All six pass their budgets. The asset stamp is the hash of WebUI.h, so every page is recompressed and moves by a byte or so.

    env used vs main
    release 997,980 0
    test 1,003,380 +8 (same arrays as release; linker layout)
    test_https 1,011,036 0
    asserts 1,000,156 0
    alpha 963,308 0 (−221 B gzipped, inside the 4 KiB pad)
    air 1,003,144 0 (same)

    flash_budget.json 'measured' is left for the v2.7.4 chore, which re-measures all six.

  • Bench. I flashed this branch's alpha image to a Pico W with an HD44780 wired in parallel (11 of 11 checks):

    • /config answers 200 without the section, its strings or the route, and still has Restart without saving;
    • its 4 script blocks pass node --check;
    • POST /api/reset_touch_cal answers 404;
    • the five sensors read.
  • Gates run locally. Every run: of the gates job: scan_secrets, gen_logcodes --check, check_authz (62 routes), check_license, check_angulo, check_fsguard, check_air_consistency, gen_features --check, check_features, check_feature_sprawl (233), test_configurator_rules, test_build_custom, test_configurator_page, test_webui_feature_routes, test_h5_day_merge. The eight native suites pass, 420 cases.

Also corrected

Security (the six failures)

Nothing new to report. Authorization stays on the server: on the panel images the handler still requires PERM_SYS_CONFIG, and on the alpha and the Air the route does not exist. Hiding the button is presentation, not access control. The change adds no storage, no secret and no user input, and the build script reads only files in the repository.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Jq4auDQppGzmAx1gLKn1z3

The Configuration page carried a "Touch Calibration" section, with its reset
button, on every image. The alpha and the Air have no touch panel, and since
#184 they do not register /api/reset_touch_cal, so on v2.7.4 main the button
answers 404 and the page shows "Error". Before #184 it failed more quietly:
the handler zeroed the stored calibration, wrote the config to flash and
answered "Reset done - calibration wizard is now running on the display" on a
device with no display.

The section and resetTouchCal( ) now sit inside `@IF tft`, like the panel
mirror and the theme picker, so the alpha and Air pages do not carry them.

What let it through: build_webui_gz.py refuses a function or an element id
that lives inside an @if block and is used outside it, but it did not look at
routes. It now reads the routes registerScreenRoutes( ) registers, from the
C++ so the list cannot go stale, and refuses a call to one of them from
outside an `@IF tft` block. tools/test_webui_feature_routes.py pins the check
with synthetic cases (outside refused, inside passes, '?' and a route prefix,
a comment is not a call) and runs it on the real WebUI.h. On WebUI.h before
this change it fails naming /api/reset_touch_cal and only it (8 ok, 1
failure); after it, 9 ok. It runs in the gates job.

Proof that nothing else moved:
- Normalized diff of the 12 page blocks: the generate( ) pipeline up to the
  gzip, each side with its own build_webui_gz.py, the ?v= asset stamp fixed
  on both. Nothing omitted (the four touch-panel images): 12 of 12 identical
  to main. tft omitted (alpha, Air): only CFG_PAGE differs, -1,057 B
  minified, and the difference is exactly the section's markup (483
  characters) and resetTouchCal( ).
- Six builds pass their budgets. used: release 997,980 (same as main),
  test 1,003,380 (+8), test_https 1,011,036, asserts 1,000,156, alpha 963,308
  and air 1,003,144 (all the same). The asset stamp is the hash of WebUI.h,
  so every page is recompressed and moves by a byte or so: gzipped total
  90,137 -> 90,131 on the panel images, 87,170 -> 86,949 on the alpha and the
  Air, where the 221 B fall inside the 4 KiB alignment pad before .data and
  neither .bin moves. test reuses the release header, so its +8 is linker
  layout. flash_budget.json 'measured' is left for the v2.7.4 chore, which
  re-measures all six.
- On the bench, the alpha image from this branch on a Pico W with an HD44780
  wired in parallel: /config answers 200 without the section, its strings or
  the route, and still has Restart without saving; its 4 script blocks pass
  node --check; POST /api/reset_touch_cal is 404; the five sensors read.
  11 of 11.
- Gates run locally, every run: of the gates job: scan_secrets,
  gen_logcodes --check, check_authz (62 routes), check_license, check_angulo,
  check_fsguard, check_air_consistency, gen_features --check, check_features,
  check_feature_sprawl (233), test_configurator_rules, test_build_custom,
  test_configurator_page, test_webui_feature_routes, test_h5_day_merge, and
  the eight native suites, 420 cases.

Also corrected here:
- build_webui_gz.py's comment on the cut said the panel routes were
  registered under WebManager_Core.cpp's #if SIMUT_DISPLAY_TFT. Since #169
  and #184, registerScreenRoutes( ) in WebManager_History.cpp registers them.
- tools/README.md gains the new test's line. Its counts had drifted: it
  listed 140 scripts under a "134 scripts" header and 23 under "Called by CI
  (17)". Now 141 and 24. CLAUDE.md said 104 scripts; now 141.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jq4auDQppGzmAx1gLKn1z3
@github-actions github-actions Bot added documentation Improvements or additions to documentation ci Continuous integration and automation tools Build tools, scripts, and developer tooling code Firmware source changes (src/, WebUI.h) labels Sep 26, 2026
@angeloINTJ
angeloINTJ merged commit 7824d95 into main Sep 26, 2026
10 checks passed
@angeloINTJ angeloINTJ mentioned this pull request Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continuous integration and automation code Firmware source changes (src/, WebUI.h) documentation Improvements or additions to documentation tools Build tools, scripts, and developer tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant