X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=firmware%2Fambient.c;h=48a752d4b35bf744fcf11992684a2b1fef521e44;hb=94524330d5709845fe0bbe8562fd68deedcb818c;hp=b8397532026fed989d06ff6454974be46e043850;hpb=1dcbf67055a7a51031a57db46d899ade790b2d30;p=bike-lights.git diff --git a/firmware/ambient.c b/firmware/ambient.c index b839753..48a752d 100644 --- a/firmware/ambient.c +++ b/firmware/ambient.c @@ -24,10 +24,10 @@ typedef struct { * and having small overlaps in order to provide a bit of hysteresis. */ static ambient_zone_t ambient_zones[] = { - { 0x0000 , 0x0280<= AMBIENT_LOG_SIZE - 1) return; - eeprom_write_byte(&ambient_log[ambient_log_offset++], ambient_min); - // eeprom_write_byte(&ambient_log[ambient_log_offset++], ambient_max); + // eeprom_write_byte(&ambient_log[ambient_log_offset++], ambient_min); + eeprom_write_byte(&ambient_log[ambient_log_offset++], ambient_max); eeprom_write_byte(&ambient_log[ambient_log_offset++], ambient_16drop); ambient_min = 0xFF; @@ -72,18 +72,10 @@ void ambient_log_min_max() ambient_16drop = 0; } -void ambient_zone_changed() +static inline void ambient_zone_changed() { -#if 1 - log_byte(0xab); - log_byte(ambient_zone); - log_word(ambient_val); - log_flush(); -#endif - - // led_set_pattern(N_PWMLEDS, status_led_pattern_select()); - // led_set_pattern(N_PWMLEDS+1, illumination_led_pattern_select()); - // pattern_reload(); + pwmled_select_brightness(); + pattern_reload(); } void ambient_adc(uint16_t adcval) @@ -116,14 +108,14 @@ void ambient_adc(uint16_t adcval) if (ambient_max < byte_val) ambient_max = byte_val; -#if 0 if (old_zone != ambient_zone) { +#if 0 log_byte(0xab); log_byte(ambient_zone); log_word(adcval); log_flush(); - } - // ambient_zone_changed(); #endif + ambient_zone_changed(); + } }