fix: the touch-calibration section only on images with a touch panel - #190
Merged
Merged
Conversation
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
Merged
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.
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:
main, not yet released) they do not register/api/reset_touch_cal, so the button answers 404 and the page shows "Error".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.pyrefused a function or an element id that lives inside an@IFblock and is used outside it, but it did not look at routes. It now reads the routesregisterScreenRoutes( )registers, parsed from the C++ so the list cannot go stale, and refuses a call to one of them from outside an@IF tftblock. The check runs on everypio run.tools/test_webui_feature_routes.pypins 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 realWebUI.h. It is in thegatesjob.WebUI.h/api/reset_touch_caland only itProof that nothing else moved
Normalized page diff. I ran the
generate( )pipeline up to the gzip, each side with its ownbuild_webui_gz.pyand the?v=asset stamp fixed on both sides:maintftomittedCFG_PAGEdiffers, −1,057 B minified: exactly the section's markup (483 characters) andresetTouchCal( )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.mainflash_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):
/configanswers 200 without the section, its strings or the route, and still has Restart without saving;node --check;POST /api/reset_touch_calanswers 404;Gates run locally. Every
run:of thegatesjob: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
The comment above the cut in
build_webui_gz.pysaid the panel routes were registered underWebManager_Core.cpp's#if. Since refactor: features own their route registration (P2 seam: mirror + TLS) #169 and feat: P2 routes seam — /api/themes and /api/reset_touch_cal register TFT-only #184,registerScreenRoutes( )inWebManager_History.cppregisters them.tools/README.mdgains the new test's line and its counts are corrected:CLAUDE.mdsaid 104 scripts; it now says 141.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