From: Jan "Yenya" Kasprzak Date: Wed, 27 Feb 2013 22:27:46 +0000 (+0100) Subject: battery.c: priority of operations X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?p=bike-lights.git;a=commitdiff_plain;h=c919c204874b9455471744eb6b802534ed629fcc battery.c: priority of operations ... in order to fit to an 8-bit value. --- diff --git a/firmware/battery.c b/firmware/battery.c index 284c096..01337db 100644 --- a/firmware/battery.c +++ b/firmware/battery.c @@ -23,8 +23,8 @@ void battery_adc(uint16_t adcval) * is coarse (0.1 V). */ battery_100mv = (unsigned char) - ((uint16_t)(adcval * 11 // 1.1V + ((uint16_t)(adcval * (11 // 1.1V * (RESISTOR_HI+RESISTOR_LO)/RESISTOR_LO // resistor ratio - / 4) >> 8); // divide by 1024 + / 4)) >> 8); // divide by 1024 }