Revision:
1:d37117275b0b
Parent:
0:313c9e399e12
Child:
2:0306beaf5ff7
--- a/VBus.cpp	Thu Dec 30 16:02:59 2010 +0000
+++ b/VBus.cpp	Thu Dec 30 18:04:45 2010 +0000
@@ -23,10 +23,10 @@
 #include "VBus.h"
 #include "DebugTrace.h"
 
-#define DEBUG 0
+#define DEBUG 1
 
 #if DEBUG
-DebugTrace pc_VBus(OFF, TO_SERIAL);
+DebugTrace pc_VBus(ON, TO_SERIAL);
 #endif
 
 static uint8_t CalcCrc(const unsigned char *Buffer, int Offset, int Length);
@@ -113,7 +113,7 @@
 #if DEBUG
 
     pc_VBus.traceOut("\r\nBuffer %i \r\n",Bufferlength);
-    for (i=0; i<Bufferlength;i++) {
+    for (int i=0; i<Bufferlength;i++) {
         pc_VBus.traceOut("%X ",Buffer[i]);
     }
     pc_VBus.traceOut("\r\n");
@@ -254,6 +254,10 @@
 float CalcTemp(char Byte1, char Byte2) {
     int v;
     v = Byte1 << 8 | Byte2;
+    
+    if (Byte1 == 0xFF)  // negatief value
+      v = v - 0x10000;  
+      
     if (v==SENSORNOTCONNECTED)
         v=0;
     return (float)((float) v * 0.1);