Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 1:d37117275b0b, committed 2010-12-30
- Comitter:
- Wimpie
- Date:
- Thu Dec 30 18:04:45 2010 +0000
- Parent:
- 0:313c9e399e12
- Child:
- 2:0306beaf5ff7
- Commit message:
- negative values
Changed in this revision
| VBus.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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);