Skip to content

Commit

Permalink
The value when closed was too high when light was present for percentage
Browse files Browse the repository at this point in the history
  • Loading branch information
jbeker committed Jun 11, 2019
1 parent 2c197fa commit beabdd6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Source/LightEvidenceSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ - (double)levelFromRawLeft:(uint64_t)left andRight:(uint64_t)right {
// COMMENTS(jbeker) below is the observed max value on a 15" Late 2013 Macbook Pro
// This value is ridiculous and results in a much smaller
// useful value range.
const double kMaxLightValue = 4294967295.0;
const double kClosedLightValue = 4294967295.0;
const double kMaxLightValue = 67092480.0;;

const double avg = (left + right) / 2; // determine average value from the two sensors

if (avg == kMaxLightValue) {
if (avg == kClosedLightValue) {
return 0; // COMMENTS(jbeker) on a 15" Late 2013 Macbook Pro it returns max value when the laptop is shut
} else {
return (avg / kMaxLightValue); // normalize
Expand Down

0 comments on commit beabdd6

Please sign in to comment.