# HG changeset patch # User Ethan Zonca # Date 2014-08-23 22:28:17 # Node ID 255811a3e69cf20fe87bbfe6f047acfb3b749a2a # Parent 297213e62b1d7c533994b8f16c8bf506938fbbe1 Get fractional part diff --git a/main.c b/main.c --- a/main.c +++ b/main.c @@ -174,6 +174,9 @@ void process() temp_pre = temp_pre >> 2; // Drop 2 lowest bits + uint8_t frac = temp_pre & 0b11; // get fractional part + frac *= 25; // each bit is .25 a degree, up to fixed point + temp_pre = temp_pre >> 2; // Drop 2 fractional bits int16_t temp = 0; if(sign) { @@ -216,6 +219,9 @@ void process() ssd1306_DrawString("Temp: ", 1, 40); ssd1306_DrawString(" ", 1, 70); ssd1306_DrawString(tempstr, 1, 70); + itoa(frac, tempstr); + ssd1306_DrawString(" ", 1, 90); + ssd1306_DrawString(tempstr, 1, 90); /* if((!retval || (temp & 0x2) != 0))