Skip to content

Saved gear: named rifle, optic and ammo load profiles - #6

Merged
zxpower merged 6 commits into
mainfrom
claude/clever-fermat-fqbd1e
Nov 13, 2026
Merged

zxpower merged 6 commits into
mainfrom
claude/clever-fermat-fqbd1e

Conversation

@zxpower

@zxpower zxpower commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

What

A new Saved gear card at the top of the page stores named profiles in the browser's localStorage (bc-gear-v1), so you can switch setups without retyping.

Kind Stores
Rifle caliber, barrel twist, twist direction, sight height over bore, zero distance
Optic turret units + click value, clicks per mark, marks per turn, MRAD/MOA output units
Load bullet weight (gr or g), muzzle velocity, BC + G1/G7 model, bullet length (optional)
  • Each kind has a dropdown plus Save (overwrite the selected profile), Save as… (new name) and Delete. Picking a profile loads it, and any tables already on screen recalculate.
  • Any rifle, optic and load can be used together. A load's name is free text, so it can be the cartridge, the bullet, a lot number or anything else.
  • If you edit a field after loading a profile, the card shows Modified until you save.
  • Weight and BC are restored together with their unit and drag model, so they are never re-converted.
  • Bullet length is optional: a load saved without it loads with the field empty, and stability and spin drift are skipped until you enter one.
  • Stored data is checked when it's loaded: malformed entries are dropped instead of breaking the page.

Export / import

  • Export to file downloads every profile as bc-gear-YYYY-MM-DD.json, for backups or moving gear to another browser or phone.
  • Import from file merges a file into what you already have. A profile whose name matches an existing one of the same kind (ignoring case) replaces it and keeps its place; the rest are added. A message shows how many were added and replaced.
  • Files that aren't a saved-gear export are rejected with a message, and malformed entries inside a valid file are skipped.

Other changes in the form

  • Turret click value by type. In Turret settings you pick the turret's units (MOA / MRAD / cm) and a click value: 1/8, 1/4, 1/2 or 1 MOA; 0.05, 0.1 or 0.2 MRAD; 1/4, 1/2 or 1 cm; or Custom… to type any value in those units. The app derives the cm-per-100 m value the turret math uses (1/4 MOA = 0.727 cm, 0.1 MRAD = 1 cm) and shows it, along with the MRAD and MOA equivalents, under the field. Choosing Custom starts from the current click, converted into the selected units. Saved state and optic profiles from before this change keep their exact cm value (as a cm preset or a custom cm value).
  • Caliber picker. Caliber is now chosen from a list of common cartridges, from .17 HMR to .50 BMG. Each one stores its real bullet diameter and writes it into the mm field the solver reads; for example, .308 Win / 7.62×51 is a 0.308 in = 7.823 mm bullet. Custom diameter… shows that mm field for anything not in the list. The choice is saved with the rifle profile.
  • Bullet weight can be entered in grains or grams. The gr / g toggle converts the value in place, like the other unit toggles, and the solver still works in grains internally.
  • The "Bullet" section is now called Load. Caliber moved to Rifle & scope.
  • Form state saved before this change keeps its caliber diameter and shows it as Custom.

Testing

  • node test.js: 62 passed, including new tests for loading stored data, which fields each profile saves, grain/gram conversion, the caliber presets, export/import (round trip, replacing by name, rejecting bad files), and click presets (1/4 MOA = 0.727 cm, 0.1 MRAD = 1 cm, a 1/4 MOA turret dials 4 clicks per MOA, restoring and migrating saved click settings).
  • Checked in headless Chromium:
    • Saving, switching, reloading the page and deleting.
    • A gram-entered load: 175 gr entered as 11.34 g gives the same trajectory table apart from a 1 J rounding difference in energy.
    • Switching between a preset and a custom caliber.
    • A load saved without bullet length: stability is skipped, and loading a load with a length brings it back.
    • Export, wipe storage, import into a fresh page (3 added), import the same file again (3 replaced, no duplicates), and import a non-export JSON file (rejected).
    • Turret units and click presets update the turret card's click count. An optic profile restores its units and click value after a reload. Old saved state with clickCm = 0.3 comes back as Custom 0.3 cm.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Dh8dzr6LAKa4Fptz8uf6ZM

claude and others added 6 commits October 31, 2026 10:18
Named profiles stored in localStorage (bc-gear-v1) with a picker per kind,
Save / Save as / Delete, and a 'modified' indicator. Loading a profile writes
its fields and toggles back and recalculates. Stored data is sanitised on load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dh8dzr6LAKa4Fptz8uf6ZM
The load profile now holds just bullet weight, muzzle velocity and BC (with its
G1/G7 model) under a free-text name. Caliber moves to the rifle profile and the
form's Rifle section. Bullet weight gets a gr/g toggle that converts in place;
the solver always works in grains internally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dh8dzr6LAKa4Fptz8uf6ZM
…h the load

The caliber field becomes a picker of common cartridges (.17 HMR to .50 BMG),
each mapped to its real bullet diameter, which is written to the mm field the
solver reads. 'Custom diameter' reveals that field for anything else. The
choice is saved with the rifle profile. Bullet length is now part of the load
profile and may be left empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dh8dzr6LAKa4Fptz8uf6ZM
Export downloads all rifle, optic and load profiles; import merges a file back
in, replacing same-named profiles and adding the rest. Non-export files are
rejected and malformed entries skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dh8dzr6LAKa4Fptz8uf6ZM
Turret settings now take the turret's units (MOA / MRAD / cm) and a click value
from common presets (1/8-1 MOA, 0.05-0.2 MRAD, 1/4-1 cm) or a custom value, and
derive the cm-per-100 m click the turret math uses. Saved with the optic
profile; older state and profiles that only have the cm value keep it exactly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dh8dzr6LAKa4Fptz8uf6ZM
@zxpower
zxpower merged commit a67ea0f into main Nov 13, 2026
2 checks passed
@zxpower
zxpower deleted the claude/clever-fermat-fqbd1e branch November 13, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants