Removed unwanted enums and unused functions

Revision:
63:6d048b2f3f32
Parent:
56:38b36e947602
--- a/common/utils.c	Wed Apr 08 10:05:08 2020 +0000
+++ b/common/utils.c	Thu Apr 09 12:01:25 2020 +0000
@@ -71,59 +71,44 @@
             ADMW_LOG_INFO("\t\tLast Error Code: %u (0x%X)",
                           pStatus->errorCode, pStatus->errorCode);
 
-            if (pStatus->diagnosticsStatus == 0) {
-                ADMW_LOG_INFO("\t\tNo diagnostics faults detected");
-            } else {
-                ADMW_LOG_INFO("\t\tActive diagnostics faults:");
-
-                if (pStatus->diagnosticsStatus & ADMW_DIAGNOSTICS_STATUS_CHECKSUM_ERROR)
-                    ADMW_LOG_INFO("\t\t\tInternal Checksum fault detected");
-
-
+        }
+    }
 
-                if (pStatus->diagnosticsStatus & ADMW_DIAGNOSTICS_STATUS_CONVERSION_ERROR)
-                    ADMW_LOG_INFO("\t\t\tInternal ADC Conversions fault detected");
-                if (pStatus->diagnosticsStatus & ADMW_DIAGNOSTICS_STATUS_CALIBRATION_ERROR)
-                    ADMW_LOG_INFO("\t\t\tInternal Device Calibrations fault detected");
-            }
-        }
+    if (pStatus->deviceStatus & ADMW_DEVICE_STATUS_ALERT) {
+        ADMW_LOG_INFO("\tActive Alerts - ATTENTION REQUIRED:");
+        ADMW_LOG_INFO("\t\tLast Alert Code: %u (0x%X)",
+                      pStatus->alertCode, pStatus->alertCode);
 
-        if (pStatus->deviceStatus & ADMW_DEVICE_STATUS_ALERT) {
-            ADMW_LOG_INFO("\tActive Alerts - ATTENTION REQUIRED:");
-            ADMW_LOG_INFO("\t\tLast Alert Code: %u (0x%X)",
-                          pStatus->alertCode, pStatus->alertCode);
-
-            for (unsigned i = 0; i < ADMW1001_MAX_CHANNELS; i++) {
-                if (pStatus->channelAlerts[i] == 0)
-                    continue;
+        for (unsigned i = 0; i < ADMW1001_MAX_CHANNELS; i++) {
+            if (pStatus->channelAlerts[i] == 0)
+                continue;
 
-                ADMW_LOG_INFO("\t\tChannel #%u:", i);
-                ADMW_LOG_INFO("\t\t\tLast Alert Code: %u (0x%X)",
-                              pStatus->channelAlertCodes[i],
-                              pStatus->channelAlertCodes[i]);
-                if (pStatus->channelAlerts[i] & ADMW_ALERT_DETAIL_CH_ADC_NEAR_OVERRANGE)
-                    ADMW_LOG_INFO("\t\t\ADC near overrange detected");
-                if (pStatus->channelAlerts[i] & ADMW_ALERT_DETAIL_CH_SENSOR_UNDERRANGE)
-                    ADMW_LOG_INFO("\t\t\tSensor underrange detected");
-                if (pStatus->channelAlerts[i] & ADMW_ALERT_DETAIL_CH_SENSOR_OVERRANGE)
-                    ADMW_LOG_INFO("\t\t\tSensor overrange detected");
-                if (pStatus->channelAlerts[i] & ADMW_ALERT_DETAIL_CH_CJ_SOFT_FAULT)
-                    ADMW_LOG_INFO("\t\t\tCJC soft fault alert detected");
-                if (pStatus->channelAlerts[i] & ADMW_ALERT_DETAIL_CH_CJ_HARD_FAULT)
-                    ADMW_LOG_INFO("\t\t\tCJC hard fault alert detected");
-                if (pStatus->channelAlerts[i] & ADMW_ALERT_DETAIL_CH_ADC_INPUT_OVERRANGE)
-                    ADMW_LOG_INFO("\t\t\tADC input overranage alert detected");
-                if (pStatus->channelAlerts[i] & ADMW_ALERT_DETAIL_CH_SENSOR_HARDFAULT)
-                    ADMW_LOG_INFO("\t\t\tChannel sensor hardfault alert detected");
-            }
+            ADMW_LOG_INFO("\t\tChannel #%u:", i);
+            ADMW_LOG_INFO("\t\t\tLast Alert Code: %u (0x%X)",
+                          pStatus->channelAlertCodes[i],
+                          pStatus->channelAlertCodes[i]);
+            if (pStatus->channelAlerts[i] & ADMW_ALERT_DETAIL_CH_ADC_NEAR_OVERRANGE)
+                ADMW_LOG_INFO("\t\t\ADC near overrange detected");
+            if (pStatus->channelAlerts[i] & ADMW_ALERT_DETAIL_CH_SENSOR_UNDERRANGE)
+                ADMW_LOG_INFO("\t\t\tSensor underrange detected");
+            if (pStatus->channelAlerts[i] & ADMW_ALERT_DETAIL_CH_SENSOR_OVERRANGE)
+                ADMW_LOG_INFO("\t\t\tSensor overrange detected");
+            if (pStatus->channelAlerts[i] & ADMW_ALERT_DETAIL_CH_CJ_SOFT_FAULT)
+                ADMW_LOG_INFO("\t\t\tCJC soft fault alert detected");
+            if (pStatus->channelAlerts[i] & ADMW_ALERT_DETAIL_CH_CJ_HARD_FAULT)
+                ADMW_LOG_INFO("\t\t\tCJC hard fault alert detected");
+            if (pStatus->channelAlerts[i] & ADMW_ALERT_DETAIL_CH_ADC_INPUT_OVERRANGE)
+                ADMW_LOG_INFO("\t\t\tADC input overranage alert detected");
+            if (pStatus->channelAlerts[i] & ADMW_ALERT_DETAIL_CH_SENSOR_HARDFAULT)
+                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);
-        }
+    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);
     }
 }
 
@@ -297,42 +282,42 @@
          */
         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);           
-                        continue;
-                    } 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