Skip to content

Commit de1d61a

Browse files
authored
Merge pull request #35 from Bond-009/invalid3band
Don't generate 3 band resistor when it can't represent the value
2 parents 43c3da8 + e567e7c commit de1d61a

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

LabelGenerator.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,9 @@ def draw_resistor_colorcode(
347347
num_codes: int,
348348
tolerance_value: Optional[float],
349349
) -> None:
350+
# Only display resistors that can accurately represent the given value
351+
if value.ohms_val % (10 ** (4 - num_codes)):
352+
return
350353

351354
resistance_values: List[int] = []
352355
for i in range(num_codes-1):

0 commit comments

Comments
 (0)