Repository navigation
Treat uppercase M as mega when grouping component values - #584
Merged
Merged
Conversation
compMatch lowercased the value before parsing, so a single letter M prefix was always read as milli. 1M, 1m and 1MOhm resistors were grouped into one BOM row (all shown as 1M), and values like 4M7 or 10M were misinterpreted. Keep matching case-insensitively but resolve a single letter m prefix to mega when it was written as uppercase M. Other prefixes and spellings like Meg or mega are unaffected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
units.compMatch(used bycomponentValueto build the BOM grouping key for the Value column) lowercased the whole value before parsing. A single-letterMprefix was therefore always read as milli, sincePREFIX_MILLIcontains"m"andPREFIX_MEGAonly has"mega"/"meg".As a result, a 1 MΩ resistor and a 1 mΩ current-sense shunt with the same footprint were grouped into one BOM row, and the row was labelled with the first part's value (e.g. "1M"). Values like
4M7(4.7 MΩ) or2.2MΩwere also treated as milli.This change still matches case-insensitively, but when the parsed prefix is the single letter
mit checks the original character: uppercaseMresolves to mega. Nothing else changes:Meg/MEG/mega, all other prefixes, the4M7style and the decimal/thousands separator handling behave as before.Testing
componentValue()on master vs this branch:1M,1MOhm(R)4M7(R)2.2MΩ(R)10M(C)1m,1mR,1mOhm,4m7,2.2mΩ,10mH1Meg,1MEG,1meg,1mega,4k7,4K7,0R1,100n,1,000End to end, an Eagle test board with three parts in the same package with values
1M,1mand1MOhm:[R1, R2, R3], all shown as "1M"[R1, R3]("1M") and[R2]("1m")Note: this follows the SI prefix letter strictly, so a value like
10Mon a capacitor now parses as megafarads rather than millifarads. Neither is a realistic capacitor value. Legacy notations like10MFDfor microfarads were not recognized before and still aren't.🤖 Generated with Claude Code