From: Jan "Yenya" Kasprzak Date: Sun, 11 Nov 2012 20:10:47 +0000 (+0100) Subject: Ambient light values for 300K/1M5 resistors X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=69ef9776904e9f3018d340a794cf8427bdc728ff;p=bike-lights.git Ambient light values for 300K/1M5 resistors --- diff --git a/firmware/ambient.c b/firmware/ambient.c index ab28a20..21c2a66 100644 --- a/firmware/ambient.c +++ b/firmware/ambient.c @@ -7,7 +7,7 @@ volatile unsigned char ambient_zone; static unsigned char ambient_zone_set; static uint16_t ambient_zones[] = { - 0x60, 0x68, 0x70, 0xa0, 0x100, 0x1c0, 0x270, 0x290, 0xffff + 0x0b70, 0x0b80, 0x1000, 0x1800, 0x2800, 0x2f80, 0xffff }; #define N_AMBIENT_ZONES (sizeof(ambient_zones)/sizeof(ambient_zones[0])) @@ -20,9 +20,10 @@ void ambient_init() void ambient_zone_changed() { - log_byte(0xCC); + log_byte(0xab); log_byte(ambient_zone); log_word(ambient_val); + log_flush(); } void ambient_adc(uint16_t adcval) @@ -39,6 +40,7 @@ void ambient_adc(uint16_t adcval) && ambient_zones[newzone] < ambient_val) newzone++; + // TODO: implement hysteresis? if (!ambient_zone_set || newzone != ambient_zone) { ambient_zone = newzone; ambient_zone_set = 1;