Skip to content

Limit divisors to prevent divide by zero #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions adafruit_tcs34725.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,11 @@ def _temperature_and_lux_dn40(self):
# Lux Calculation (DN40 3.2)
G1 = R_Coef * R2 + G_Coef * G2 + B_Coef * B2
CPL = (ATIME_ms * AGAINx) / (GA * DF)
CPL = 0.001 if CPL == 0 else CPL
lux = G1 / CPL

# CT Calculations (DN40 3.4)
R2 = 0.001 if R2 == 0 else R2
CT = CT_Coef * B2 / R2 + CT_Offset

return lux, CT
Expand Down