feat: JSONC templates, schema alignment, and N-stage redline support - #25
Draft
mikeev261 wants to merge 30 commits into
Draft
feat: JSONC templates, schema alignment, and N-stage redline support#25mikeev261 wants to merge 30 commits into
mikeev261 wants to merge 30 commits into
Conversation
mikeev261
added a commit
to mikeev261/lovely-car-data
that referenced
this pull request
Apr 5, 2026
mikeev261
marked this pull request as draft
May 9, 2026 12:29
…errari 296 GT3 example
This commit captures the recent schema documentation update (ledNrpm Int|Str ranges) and refactors LMU profiles to eliminate duplication. Templates are maintained in src_data/lmu/ and build_profiles.py generates the downstream data/lmu files.
Removed custom array compression and disabled ensure_ascii so that output exactly matches pre-commit's pretty-format-json tool.
The repo's convention is to use inline arrays for telemetry thresholds to save space. However, pre-commit-hooks' pretty-format-json expands them. We added a custom format_json.py script to handle this properly, excluded these directories from pretty-format-json, and integrated it directly into build_profiles.py.
…to variants - Renamed all src_data/lmu templates to reflect the actual base car being profiled rather than an arbitrary team variant. - Updated build_profiles.py so that any property defined in a variant overrides the root template. - Pushed 'carClass' from the template roots down to their individual variants. - Merged the ELMS LMP2 Custom Team profile directly into the ELMS LMP2 group since its differing carClass is now properly overridden at the variant level. - Merged redundant Glickenhaus and Vanwall templates.
Added a script (rpm_shadow.py) with options to add, refresh, and remove visual shadow tables containing RPM percentage values directly inside the src_data templates. The tables use mock-keys (//GEAR) which keeps JSON strictly valid while simulating comments. They are grouped coherently below the original arrays. Updated format_json.py to compress these mock-keys natively, and updated build_profiles.py to actively strip them out during generation so downstream data/lmu profiles remain entirely clean.
…cision calculation - Updated rpm_shadow.py to algorithmically determine the minimum precision required to flawlessly round-trip the RPM percentages back to the original integers per-car. - Replaced the mock-key workaround with true JSONC comments (// ...) for the shadow tables. - Updated build_profiles.py to strip true comments before parsing templates so generated output remains perfectly valid JSON. - Excluded src_data from the check-json pre-commit hook.
Renamed all src_data/lmu templates from .json to .jsonc to natively support JSON with Comments across all major IDEs. This globally eliminates the syntax errors flagged by local language servers regarding the true comments injected by rpm_shadow.py. Updated build_profiles.py, rpm_shadow.py, and format_json.py to gracefully handle the new .jsonc extensions while ensuring standard .json files are still correctly output to data/lmu for SimHub consumption.
Merged lmp3-ligier-js-p320.jsonc and lmp3-duqueine-d09-p3-2025-397.jsonc into a single lmp3.jsonc template. Since all 3 LMP3 cars share the identical RPM mappings and settings, it's cleaner to maintain a single file. The only divergence is the ledColor array (Ligier uses #FF00c6fd while Duqueine/Ginetta use #FF0080FF), which is cleanly handled by overriding ledColor inside the Duqueine/Ginetta variants.
Merged 14 redundant LMU car templates down to 7 canonical base templates. Found 7 groups of completely identical cars (or seasons of the same car) and consolidated them, storing any minor differences directly into their variant mappings. This dramatically reduces maintenance overhead and clutter. Additionally, fixed a major data bug where the hyper-alpine-2024.jsonc file was accidentally using LMP2 RPM values instead of the correct A424 Hypercar RPM values. The Alpine variants have now been correctly relocated into hyper-a424-2024.jsonc.
…pts documentation
…d include comprehensive manifest generation tests
…e Peugeot/Genesis redline templates
feat: add Toyota status LED configuration for hybrid deploy and update Peugeot/Genesis redline templates
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.
Overview
This PR significantly reduces maintenance overhead for the LMU car database by introducing a JSONC templating system to deduplicate identical cars. It also introduces major schema updates to support N-stage redlines, string-based RPM ranges, and pattern overrides.
Schema Changes
redlineBlinkInterval(Int|Array) to better reflect complex dash displays (e.g., used by the Corvette Z06 GT3.R)."6600-7015") in theledRpmconfiguration, allowing a single LED to map to a dynamic RPM band (e.g., used extensively by the BMW M Hybrid V8)."redline2") mapped to an array of colors, allowing complex per-LED redline color animations (e.g., used to create the sweeping redline on the BMW M Hybrid V8).variantsarray to the base templates. Cars that share identical RPM profiles but have different visual properties (such asledColor) or team names can now be grouped into a single base template, with their differences cleanly overridden inside the variants array (e.g., grouping dozens of individual LMP2 Oreca 07 and GT3 Aston Martin team profiles under single respective templates).{ "ledNumber": 8, "ledColor": ["#FFFF0000", "#FF00FF00", "#FFFFFF00"], "variants": [ { "carName": "GT3_TF Sport 2025", "carId": "GT3_TF Sport 2025", "fileName": "gt3-tf-sport-2025.json", "carClass": "GT3", "ledColor": ["#FF0000FF", "#FFFFFF00", "#FFFF0000"] // Cleanly overrides base color } ] }Templating & Tooling
lmusource files from.jsonto.jsonc, allowing the use of//comments.hyper-alpine-2024.jsonfile was incorrectly using the LMP2 Oreca RPM limits. This has been corrected by moving the team entry into thehyper-a424-2024.jsoncfile.scripts/build_profiles.py: New compiler script that processes the.jsonctemplates, expands all variants, drops comments, and natively exports the final.jsonfiles todata/lmu/.scripts/rpm_shadow.py: Upgraded helper script that maintains shadow tables. Added a--logflag that allows maintainers to snapshot RPM data to track BOP updates over time.All 245 original profiles in
data/lmu/continue to build accurately without regressions.