|
@@ -60,7 +60,7 @@
|
60
|
60
|
#define LDR_CHECK_MS 100
|
61
|
61
|
#define LDR_DARK_VALUE 1200
|
62
|
62
|
#define LDR_BRIGHT_VALUE 0
|
63
|
|
-#define LDR_LOWPASS_FACT 0.025f
|
|
63
|
+#define LDR_LOWPASS_FACT 0.01f
|
64
|
64
|
|
65
|
65
|
#define STANDBY_BRIGHTNESS 10
|
66
|
66
|
#define LCD_MIN_BRIGHTNESS (STANDBY_BRIGHTNESS * 2)
|
|
@@ -101,7 +101,7 @@ enum ui_pages {
|
101
|
101
|
static enum ui_pages ui_page = UI_START;
|
102
|
102
|
static bool is_touched = false;
|
103
|
103
|
static unsigned long last_ldr = 0;
|
104
|
|
-static int ldr_value = 0;
|
|
104
|
+static float ldr_value = 0;
|
105
|
105
|
static unsigned long last_touch_time = 0;
|
106
|
106
|
static int curr_brightness = LCD_MAX_BRIGHTNESS;
|
107
|
107
|
static int set_max_brightness = LCD_MAX_BRIGHTNESS;
|
|
@@ -464,7 +464,7 @@ void ui_run(void) {
|
464
|
464
|
// read out LDR in regular intervals
|
465
|
465
|
if (now >= (last_ldr + LDR_CHECK_MS)) {
|
466
|
466
|
last_ldr = now;
|
467
|
|
- int ldr = analogRead(LDR_PIN);
|
|
467
|
+ float ldr = analogRead(LDR_PIN);
|
468
|
468
|
|
469
|
469
|
ldr_value = (ldr_value * (1.0f - LDR_LOWPASS_FACT)) + (ldr * LDR_LOWPASS_FACT);
|
470
|
470
|
|