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.
Diff: common/utils.c
- Revision:
- 39:e255f52072fc
- Parent:
- 32:52445bef314d
diff -r 7604d3b44dd5 -r e255f52072fc common/utils.c
--- a/common/utils.c Thu Nov 21 09:40:32 2019 +0000
+++ b/common/utils.c Thu Nov 21 13:36:43 2019 +0000
@@ -297,44 +297,44 @@
* Wait until the next batch of 1 or more samples is ready, continuously
* checking DATAREADY until it is asserted
*/
- while (! (bDataReady || bError))
- ;
+ while (! (bDataReady || bError));
- if (!bError) {
- /*
- * Get data samples from the measurement cycle, if no error has occurred
- */
- bDataReady = false;
- res = admw_GetData(hDevice, eMeasurementMode, pSampleBuffer,
- nBytesPerSample, nSamplesPerDataready,
- &nReturned);
- if (res != ADMW_SUCCESS) {
- if (res == ADMW_INCOMPLETE) {
- /*
- * This is expected in cases where cycleSkipCount may
- * be non-zero for some channels, resulting in
- * variable-length sequences
- */
- ADMW_LOG_DEBUG("Retrieved %u of %u requested data samples",
- nReturned, nSamplesPerDataready);
- } else {
- ADMW_LOG_WARN("Failed to get data samples from device");
- return res;
+ if (!bError) {
+ /*
+ * Get data samples from the measurement cycle, if no error has occurred
+ */
+ bDataReady = false;
+ res = admw_GetData(hDevice, eMeasurementMode, pSampleBuffer,
+ nBytesPerSample, nSamplesPerDataready,
+ &nReturned);
+ if (res != ADMW_SUCCESS) {
+ if (res == ADMW_INCOMPLETE) {
+ /*
+ * This is expected in cases where cycleSkipCount may
+ * be non-zero for some channels, resulting in
+ * variable-length sequences
+ */
+ ADMW_LOG_DEBUG("Retrieved %u of %u requested data samples",
+ nReturned, nSamplesPerDataready);
+ continue;
+ } else {
+ ADMW_LOG_WARN("Failed to get data samples from device");
+ return res;
+ }
}
+
+ /*
+ * Display the data samples.
+ *
+ * NOTE: this requires a sufficient idle time between subsequent
+ * DATAREADY pulses to allow printing to occur. Otherwise,
+ * subsequent samples may be missed if not retrieved promptly when
+ * the next DATAREADY assertion occurs.
+ */
+ utils_printSamples(pSampleBuffer, nReturned, eMeasurementMode);
+ nSampleCount += nReturned;
}
- /*
- * Display the data samples.
- *
- * NOTE: this requires a sufficient idle time between subsequent
- * DATAREADY pulses to allow printing to occur. Otherwise,
- * subsequent samples may be missed if not retrieved promptly when
- * the next DATAREADY assertion occurs.
- */
- utils_printSamples(pSampleBuffer, nReturned, eMeasurementMode);
- nSampleCount += nReturned;
- }
-
/*
* Check and print device status if errors/alerts have been triggered
*/