Tune light sensor parameters

This commit is contained in:
fruchti 2020-07-18 00:21:11 +02:00
parent a3da7c3803
commit d6a5ee1689
2 changed files with 6 additions and 6 deletions

View file

@ -1 +1 @@
425 434

View file

@ -6,23 +6,23 @@
#include "pinning.h" #include "pinning.h"
// ADC polling interval in milliseconds // ADC polling interval in milliseconds
#define LIGHTSENSOR_INTERVAL 250 #define LIGHTSENSOR_INTERVAL 500
// Resolution of the brightness output // Resolution of the brightness output
#define LIGHTSENSOR_BITS 12 #define LIGHTSENSOR_BITS 12
#define LIGHTSENSOR_MAX (1 << LIGHTSENSOR_BITS) #define LIGHTSENSOR_MAX (1 << LIGHTSENSOR_BITS)
// 'Forgetting factor' of the rolling brightness average // 'Forgetting factor' of the rolling brightness average
#define LIGHTSENSOR_LAMBDA_BITS 4 #define LIGHTSENSOR_LAMBDA_BITS 2
// Time until minimum and maximum value are completely reset (in seconds) // Time until minimum and maximum value are completely reset (in seconds)
#define LIGHTSENSOR_LIMIT_RESET_TIME \ #define LIGHTSENSOR_LIMIT_RESET_TIME \
(24 * 60 * 60) (48 * 60 * 60)
// Bounds for converting absolute to relative brightness: Consider everything // Bounds for converting absolute to relative brightness: Consider everything
// near the minimum or maximum 0.0 or 1.0, respectively // near the minimum or maximum 0.0 or 1.0, respectively
#define LIGHTSENSOR_LOW_BOUND ((unsigned int)(0.005 * LIGHTSENSOR_MAX)) #define LIGHTSENSOR_LOW_BOUND ((unsigned int)(0.013 * LIGHTSENSOR_MAX))
#define LIGHTSENSOR_HIGH_BOUND ((unsigned int)(0.9 * LIGHTSENSOR_MAX)) #define LIGHTSENSOR_HIGH_BOUND ((unsigned int)(1.0 * LIGHTSENSOR_MAX))
extern int LightSensor_RelativeBrightness; extern int LightSensor_RelativeBrightness;