GDP group 24 node core
Dependencies: EthernetInterface SDFileSystem mbed-rtos mbed snail MbedJSONValue
Revision 16:3ac37613f849, committed 2015-01-13
- Comitter:
- Trumple
- Date:
- Tue Jan 13 23:36:58 2015 +0000
- Parent:
- 14:bc0e2fa25f94
- Child:
- 17:215899ba8b8e
- Commit message:
- Separate readings in sensor interface
Changed in this revision
sensorinterface.cpp | Show annotated file Show diff for this revision Revisions of this file |
sensorinterface.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/sensorinterface.cpp Tue Jan 13 22:48:25 2015 +0000 +++ b/sensorinterface.cpp Tue Jan 13 23:36:58 2015 +0000 @@ -172,9 +172,15 @@ reply.type = currentSensor->second.type; - for (int i = 2; i < bufSize; i++) + for (int i = 2; i < bufSize; i += currentSensor->second.readingSize) { - reply.readings.push_back(buffer[i]); + int r = 0; + for (int j = 0; j < currentSensor->second.readingSize; j++) + { + r = r << 8; + r += buffer[i+j]; + } + reply.readings.push_back(r); } if (buffer[0] != 'D')
--- a/sensorinterface.h Tue Jan 13 22:48:25 2015 +0000 +++ b/sensorinterface.h Tue Jan 13 23:36:58 2015 +0000 @@ -24,7 +24,7 @@ struct d_reply { char type; - vector<char> readings; + vector<int> readings; };