Skip to content

Commit

Permalink
pico: allow setting a compensation factor for LTR-559ALS
Browse files Browse the repository at this point in the history
  • Loading branch information
Daft-Freak committed Feb 5, 2025
1 parent c01cfd8 commit 36904a6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion 32blit-pico/sensor/ltr_559als.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
#define LTR_559ALS_ADDR 0x23
#endif

#ifndef LTR_559ALS_COMPENSATION
#define LTR_559ALS_COMPENSATION 1.0f
#endif

static bool ltr_559_present = true;

static blit::SensorDataFloat light_data(blit::SensorType::LIGHT);
Expand Down Expand Up @@ -95,7 +99,7 @@ static void update_ltr_559(uint32_t time) {
else if(ratio < 0.85f)
lux = (0.5926f * ch0 + 0.1185f * ch1) / gain / int_time;

// TODO: compensation for window/aperture?
lux /= LTR_559ALS_COMPENSATION;

light_data.data = lux;
}
Expand Down

0 comments on commit 36904a6

Please sign in to comment.