X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?p=bike-lights.git;a=blobdiff_plain;f=firmware%2Fambient.c;h=143ffc49e1bf98d8ad5c5ae42566aac38c907e52;hp=c6c6a654ab67e1bd974366feefd575e98af95f55;hb=1e3c9f876c88582e3da20a51f43d340c40c372ab;hpb=20177f823fc0effcc9c5c389a629294c5ed367a1 diff --git a/firmware/ambient.c b/firmware/ambient.c index c6c6a65..143ffc4 100644 --- a/firmware/ambient.c +++ b/firmware/ambient.c @@ -15,10 +15,10 @@ typedef struct { * and having small overlaps in order to provide a bit of hysteresis. */ static ambient_zone_t ambient_zones[] = { - { 0x0000, 0x3120 }, // dark - { 0x30f0, 0x5000 }, - { 0x4c00, 0x8000 }, - { 0x7800, 0xffff } + { 0x0000, 0xa400 }, // dark + { 0xa000, 0xc000 }, + { 0xbe00, 0xc800 }, + { 0xc600, 0xffff } }; #define N_AMBIENT_ZONES (sizeof(ambient_zones)/sizeof(ambient_zones[0])) @@ -46,7 +46,7 @@ void ambient_adc(uint16_t adcval) { unsigned char old_zone = ambient_zone; - ambient_val += adcval - (ambient_val >> 6); + ambient_val += adcval - (ambient_val >> 3); while (ambient_zones[ambient_zone].lo > ambient_val) ambient_zone--;