MCPcopy Create free account
hub / github.com/FastLED/FastLED / validate

Method validate

ci/tools/led_timing_conversions.py:51–79  ·  view source on GitHub ↗

Validate datasheet timing against specifications. Args: ds: Datasheet timing to validate Returns: Tuple of (is_valid, list of error messages)

(self, ds: "TimingDatasheet")

Source from the content-addressed store, hash-verified

49 T1L_max: int
50
51 def validate(self, ds: "TimingDatasheet") -> tuple[bool, list[str]]:
52 """Validate datasheet timing against specifications.
53
54 Args:
55 ds: Datasheet timing to validate
56
57 Returns:
58 Tuple of (is_valid, list of error messages)
59 """
60 errors: list[str] = []
61
62 if not (self.T0H_min <= ds.T0H <= self.T0H_max):
63 errors.append(
64 f"T0H={ds.T0H}ns out of spec (valid: {self.T0H_min}-{self.T0H_max}ns)"
65 )
66 if not (self.T0L_min <= ds.T0L <= self.T0L_max):
67 errors.append(
68 f"T0L={ds.T0L}ns out of spec (valid: {self.T0L_min}-{self.T0L_max}ns)"
69 )
70 if not (self.T1H_min <= ds.T1H <= self.T1H_max):
71 errors.append(
72 f"T1H={ds.T1H}ns out of spec (valid: {self.T1H_min}-{self.T1H_max}ns)"
73 )
74 if not (self.T1L_min <= ds.T1L <= self.T1L_max):
75 errors.append(
76 f"T1L={ds.T1L}ns out of spec (valid: {self.T1L_min}-{self.T1L_max}ns)"
77 )
78
79 return (len(errors) == 0, errors)
80
81
82class TimingDatasheet:

Callers 1

handle_interactiveFunction · 0.95

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected