diff --git a/firmware/cup.c b/firmware/cup.c index 832c37f..de52544 100644 --- a/firmware/cup.c +++ b/firmware/cup.c @@ -99,13 +99,12 @@ uint16_t linearize_temp(uint16_t temp_in) 65474, 1500, // 150 celsius 65535, 1520, // made-up, not from datasheet }; - uint8_t i=2; + uint8_t i=2; for (; i < (sizeof(coeffs)>>1)-2; i+=2) { - if ( temp_in < coeffs[i] ) + if ( temp_in < coeffs[i] ) { - temp_out = (uint16_t) ( coeffs[i-1] + (uint32_t) - ( (uint32_t) (temp_in-coeffs[i-2]) * (coeffs[i+1]-coeffs[i-1]) ) / (coeffs[i]-coeffs[i-2])); + temp_out = (uint16_t) ( coeffs[i-1] + (uint32_t) ( (uint32_t) (temp_in-coeffs[i-2]) * (coeffs[i+1]-coeffs[i-1]) ) / (coeffs[i]-coeffs[i-2])); break; } } @@ -182,7 +181,7 @@ int main(void) } if(setting_timeout) {led_set(target);} - else {led_set(temperature);}OB + else {led_set(temperature);} } return 0;