
initial commit
Revision 39:e255f52072fc, committed 2019-11-21
- Comitter:
- Vkadaba
- Date:
- Thu Nov 21 13:36:43 2019 +0000
- Parent:
- 38:7604d3b44dd5
- Child:
- 40:bc626b6918d0
- Commit message:
- added continue in utils.c to fix the wrong measurement from being displayed
Changed in this revision
--- 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 */
--- a/main.cpp Thu Nov 21 09:40:32 2019 +0000 +++ b/main.cpp Thu Nov 21 13:36:43 2019 +0000 @@ -57,7 +57,7 @@ extern ADMW_CONFIG multichannel_singlecycle_config; extern ADMW_CONFIG i2c0_sensirionSHT3X_config; /* Change the following pointer to select any of the configurations above */ -static ADMW_CONFIG *pSelectedConfig = &thermocouple_typeK_cjc0_config; +static ADMW_CONFIG *pSelectedConfig = &multichannel_continuous_config; static ADMW_CONNECTION connectionInfo = PLATFORM_CONNECTION_INFO;
--- a/multichannel_continuous_config.c Thu Nov 21 09:40:32 2019 +0000 +++ b/multichannel_continuous_config.c Thu Nov 21 13:36:43 2019 +0000 @@ -133,7 +133,7 @@ }, }, [ADMW1001_CH_ID_DIG_I2C_0] = { - .enableChannel = true, + .enableChannel = false, .disablePublishing = false, .compensationChannel = ADMW1001_CH_ID_NONE, .measurementsPerCycle = 1,
--- a/thermocouple_typeK_cjc0_config.c Thu Nov 21 09:40:32 2019 +0000 +++ b/thermocouple_typeK_cjc0_config.c Thu Nov 21 13:36:43 2019 +0000 @@ -78,7 +78,7 @@ .offsetAdjustment = 0.0, .gainAdjustment = 0.0, .sensorParameter = 0.0, - .measurementsPerCycle = 1, + .measurementsPerCycle = 10, .cycleSkipCount = 0, .extraSettlingTime = 0, .priority = 0, @@ -113,7 +113,7 @@ .offsetAdjustment = 0.0, .gainAdjustment = 0.0, .sensorParameter = 0.0, - .measurementsPerCycle = 1, + .measurementsPerCycle = 10, .cycleSkipCount = 0, .extraSettlingTime = 4499.99986449257, .priority = 0,