@@ -165,24 +165,27 @@ void process()
}
else if(temp_pre & 0b0000000000000001) {
ssd1306_DrawString("TC Fault", 3, 35);
else {
ssd1306_DrawString("TempSense OK", 3, 35);
uint8_t sign = temp >> 15;// top bit is sign
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) {
temp = -temp_pre;
temp = temp_pre;
// Deassert CS
Delay(1);
@@ -207,24 +210,27 @@ void process()
//////////////////////////
// Calc external temp //
if(temp > 0) {
GPIO_SetBits(LED_STAT);
char tempstr[9];
itoa(temp_pre, tempstr);
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))
{
ssd1306_DrawString("!TempCOMMS", 3, 35);
//return; // Comms error - this is happening right now
else if((temp & 0x4)!= 0)
ssd1306_DrawString("!OpenThermocouple", 3, 40);
//return; // Open thermocouple
Status change: