From: Jan "Yenya" Kasprzak Date: Sun, 21 Jul 2013 21:45:35 +0000 (+0200) Subject: ambient.c: settings for my wife's bike X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?p=bike-lights.git;a=commitdiff_plain;h=a58c5b9c16ec9060c38a14446e5524b22ad8aea5 ambient.c: settings for my wife's bike --- diff --git a/firmware/ambient.c b/firmware/ambient.c index 7352f6d..9dbf600 100644 --- a/firmware/ambient.c +++ b/firmware/ambient.c @@ -26,10 +26,17 @@ typedef struct { * and having small overlaps in order to provide a bit of hysteresis. */ static ambient_zone_t ambient_zones[N_AMBIENT_ZONES] = { +#ifdef PAVLINA + { 0x0000, 0x0290 }, // dark + { 0x0278, 0x02f8 }, // evening + { 0x02d8, 0x0310 }, // dawn + { 0x0308, 0xffff }, // day +#else { 0x0000, 0x0250 }, // dark { 0x0240, 0x02e0 }, // evening { 0x02c0, 0x0300 }, // dawn { 0x02f8, 0xffff }, // day +#endif }; #define SHADOW_DROP_LIMIT 0x20 // in ADC units (0..0x3ff) @@ -65,7 +72,7 @@ void susp_ambient() void ambient_log_min_max() { if (ambient_log_offset >= AMBIENT_LOG_SIZE - 1) - return; + ambient_log_offset = 0; // start over ambient_max -= ambient_min; // ambient_max >>= 2; @@ -123,7 +130,7 @@ void ambient_adc(uint16_t adcval) slow_10bit = ambient_slow >> AMBIENT_SLOW_SHIFT; if (new_zone > 1 && ( - new_zone == ambient_zone-1 || new_zone == ambient_zone+1)) { + new_zone == ambient_zone-1 || new_zone > ambient_zone)) { // but change to the neighbouring zone is governed by _slow, // except to the darkest zone, where we want fast reaction. new_zone = val_to_zone(slow_10bit); diff --git a/firmware/lights.h b/firmware/lights.h index 72d7d33..49bb94c 100644 --- a/firmware/lights.h +++ b/firmware/lights.h @@ -2,6 +2,7 @@ #define LIGHTS_H__ 1 #define TESTING_FW 1 +#define PAVLINA 1 // settings for my wife's bike #define N_LEDS 4 #define N_STATUS_LED 1