diff options
-rw-r--r-- | driver/als_tcs3400.c | 10 | ||||
-rw-r--r-- | driver/als_tcs3400.h | 6 |
2 files changed, 9 insertions, 7 deletions
diff --git a/driver/als_tcs3400.c b/driver/als_tcs3400.c index 7e867a606d..80bf837ad7 100644 --- a/driver/als_tcs3400.c +++ b/driver/als_tcs3400.c @@ -32,8 +32,8 @@ static const uint16_t range_atime[TCS_MAX_AGAIN - TCS_MIN_AGAIN + 1][TCS_MAX_ATIME_RANGES] = { {11200, 5600, 5600, 7200, 5500, 4500, 3800, 3800, 3300, 2900, 2575, 2275, 2075}, {11200, 5100, 2700, 1840, 1400, 1133, 981, 963, 833, 728, 650, 577, 525}, -{250, 1225, 643, 441, 337, 276, 237, 235, 203, 176, 150, 0, 0}, -{790, 311, 163, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }; +{250, 1225, 643, 441, 337, 276, 253, 235, 203, 176, 150, 0, 0}, +{790, 261, 163, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }; static void decrement_atime(struct tcs_saturation_t *sat_p, uint16_t cur_lux, int percent) @@ -217,11 +217,11 @@ tcs3400_adjust_sensor_for_saturation(struct motion_sensor_t *s, * is to adjust atime to reduce sensitivity so * that we may increase gain without saturation. * This combination effectively acts as a half - * gain increase (2x estimate) instead of a full - * gain increase of 4x that would result in + * gain increase (2.5x estimate) instead of a full + * gain increase of > 4x that would result in * saturation. */ - if (max_val < TCS_GAIN_SAT_UPSHIFT_LEVEL) { + if (max_val < TCS_GAIN_UPSHIFT_LEVEL) { sat_p->atime = TCS_GAIN_UPSHIFT_ATIME; sat_p->again++; } diff --git a/driver/als_tcs3400.h b/driver/als_tcs3400.h index 9681a39a56..08467028b0 100644 --- a/driver/als_tcs3400.h +++ b/driver/als_tcs3400.h @@ -128,8 +128,10 @@ enum tcs3400_mode { */ #define TCS_GAIN_ADJUST_FACTOR 5 #define TCS_GAIN_SAT_LEVEL (TCS_SATURATION_LEVEL / TCS_GAIN_ADJUST_FACTOR) -#define TCS_UPSHIFT_FACTOR 3 -#define TCS_GAIN_SAT_UPSHIFT_LEVEL (TCS_SATURATION_LEVEL / TCS_UPSHIFT_FACTOR) +#define TCS_UPSHIFT_FACTOR_N 25 /* upshift factor = 2.5 */ +#define TCS_UPSHIFT_FACTOR_D 10 +#define TCS_GAIN_UPSHIFT_LEVEL (TCS_SATURATION_LEVEL * TCS_UPSHIFT_FACTOR_D \ + / TCS_UPSHIFT_FACTOR_N) /* * Percentage of saturation level that the auto-adjusting anti-saturation |