Skip to content
Open
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: 1 addition & 1 deletion Adafruit_TSL2591.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ float Adafruit_TSL2591::calculateLux(uint16_t ch0, uint16_t ch1) {

// Alternate lux calculation 1
// See: https://github.com/adafruit/Adafruit_TSL2591_Library/issues/14
lux = (((float)ch0 - (float)ch1)) * (1.0F - ((float)ch1 / (float)ch0)) / cpl;
lux = (((float)ch0 - (float)ch1)) * (1.0F - ((float)ch1 / (float)((ch0 != 0) ? ch0 : 1.0F))) / cpl;

// Alternate lux calculation 2
// lux = ( (float)ch0 - ( 1.7F * (float)ch1 ) ) / cpl;
Expand Down