Vybhav Kadaba
/
EV-PRO-MW1001_Development_updateFW
Bumped Mbed FW version to 01.20.0080
Diff: common/utils.c
- Revision:
- 70:420fac5132f5
- Parent:
- 69:4305ac772a66
- Child:
- 71:7b5ebd969aa7
--- a/common/utils.c Mon Apr 20 06:23:42 2020 +0000 +++ b/common/utils.c Thu Apr 23 08:30:42 2020 +0000 @@ -48,7 +48,7 @@ ADMW_STATUS *pStatus) { ADMW_LOG_INFO("Status Summary:"); - + if (pStatus->deviceStatus == 0) { ADMW_LOG_INFO("\tNo errors detected"); } else { @@ -59,12 +59,12 @@ if (pStatus->deviceStatus & ADMW_DEVICE_STATUS_ERROR) ADMW_LOG_INFO("\tActive Errors - RESET REQUIRED"); if (pStatus->deviceStatus & ADMW_DEVICE_STATUS_FIFO_ERROR) + { ADMW_LOG_INFO("\tActive FIFO Errors - ATTENTION REQUIRED"); ADMW_LOG_INFO("\tFIFO buffer full"); - ADMW_LOG_INFO("\tExceeding measurements per cycle limit of %d",MAXIMUM_MEASUREMENTS_PER_CYCLE); + } if (pStatus->deviceStatus & ADMW_DEVICE_STATUS_CONFIG_ERROR) ADMW_LOG_INFO("\tActive Configuration Errors - ATTENTION REQUIRED"); - if (pStatus->deviceStatus & ADMW_DEVICE_STATUS_ALERT) { ADMW_LOG_INFO("\tActive Alerts - ATTENTION REQUIRED:"); @@ -89,6 +89,13 @@ ADMW_LOG_INFO("\t\t\tChannel sensor hardfault alert detected"); } } + + if ((pStatus->deviceStatus & ADMW_DEVICE_STATUS_ERROR) || + (pStatus->deviceStatus & ADMW_DEVICE_STATUS_ALERT)) { + ADMW_LOG_INFO("\t\tLast Debug Code: %u-%u", + (pStatus->debugCode >> 16) & 0xFFFF, + (pStatus->debugCode >> 0) & 0xFFFF); + } } } @@ -254,25 +261,22 @@ uint32_t nSampleCount = 0; uint32_t nReturned; while (true) { - ADMW_STATUS status; + ADMW_STATUS status; /* * Wait until the next batch of 1 or more samples is ready, continuously * checking DATAREADY until it is asserted */ - //Checking if FIFO error is set - res = admw_GetStatus(hDevice, &status); - if (res != ADMW_SUCCESS) - { - ADMW_LOG_ERROR("Failed to retrieve device status"); - } - if (status.deviceStatus & ADMW_DEVICE_STATUS_FIFO_ERROR) - { - utils_printStatus(&status); - break; - } - while (! (bDataReady || bError)); - + res = admw_GetStatus(hDevice, &status); + if (res != ADMW_SUCCESS) { + ADMW_LOG_ERROR("Failed to retrieve device status"); + } + if (status.deviceStatus & ADMW_DEVICE_STATUS_FIFO_ERROR) + { + utils_printStatus(&status); + break; + } + while (! (bDataReady || bError)); if (!bError) { /* * Get data samples from the measurement cycle, if no error has occurred