demo project
Dependencies: AX-12A Dynamixel mbed iothub_client EthernetInterface NTPClient ConfigFile SDFileSystem iothub_amqp_transport mbed-rtos proton-c-mbed wolfSSL
MeasureBuf.cpp@17:0dbcbd8587fd, 2016-01-22 (annotated)
- Committer:
- henryrawas
- Date:
- Fri Jan 22 01:35:07 2016 +0000
- Revision:
- 17:0dbcbd8587fd
- Parent:
- 13:ffeff9b5e513
add all measures to circular buffer at once. Handle alert command
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
henryrawas | 4:36a4eceb1b7f | 1 | #include "mbed.h" |
henryrawas | 4:36a4eceb1b7f | 2 | |
henryrawas | 4:36a4eceb1b7f | 3 | #include "MeasureBuf.h" |
henryrawas | 4:36a4eceb1b7f | 4 | |
henryrawas | 4:36a4eceb1b7f | 5 | |
henryrawas | 4:36a4eceb1b7f | 6 | |
henryrawas | 17:0dbcbd8587fd | 7 | SafeCircBuf<MeasureSnapshot, MeasureBufSize, uint32_t> MeasureBuf; |
henryrawas | 4:36a4eceb1b7f | 8 | |
henryrawas | 17:0dbcbd8587fd | 9 | void MeasureGroup::SetMeasure(NodeMeasure mId, int numParts, float vals[]) |
henryrawas | 4:36a4eceb1b7f | 10 | { |
henryrawas | 4:36a4eceb1b7f | 11 | MeasId = mId; |
henryrawas | 7:6723f6887d00 | 12 | |
henryrawas | 13:ffeff9b5e513 | 13 | NumVals = NUMJOINTS < numParts ? NUMJOINTS : numParts; |
henryrawas | 4:36a4eceb1b7f | 14 | |
henryrawas | 4:36a4eceb1b7f | 15 | for (int ix = 0; ix < NumVals; ix++) |
henryrawas | 4:36a4eceb1b7f | 16 | { |
henryrawas | 4:36a4eceb1b7f | 17 | MeasVals[ix] = vals[ix]; |
henryrawas | 4:36a4eceb1b7f | 18 | } |
henryrawas | 4:36a4eceb1b7f | 19 | } |
henryrawas | 4:36a4eceb1b7f | 20 | |
henryrawas | 13:ffeff9b5e513 | 21 | MeasureGroup& MeasureGroup::operator=(const MeasureGroup& rhs) |
henryrawas | 13:ffeff9b5e513 | 22 | { |
henryrawas | 13:ffeff9b5e513 | 23 | MeasId = rhs.MeasId; |
henryrawas | 13:ffeff9b5e513 | 24 | NumVals = rhs.NumVals; |
henryrawas | 13:ffeff9b5e513 | 25 | for (int ix = 0; ix < NUMJOINTS; ix++) |
henryrawas | 13:ffeff9b5e513 | 26 | { |
henryrawas | 13:ffeff9b5e513 | 27 | MeasVals[ix] = rhs.MeasVals[ix]; |
henryrawas | 13:ffeff9b5e513 | 28 | } |
henryrawas | 13:ffeff9b5e513 | 29 | return *this; |
henryrawas | 13:ffeff9b5e513 | 30 | } |
henryrawas | 13:ffeff9b5e513 | 31 |