Index: firmware/App/Drivers/ConductivityTeensy.c =================================================================== diff -u -r3fde11b3e67db8690667c7d96696b25e5108a395 -r31a1037056fb4d4c4705211302594e015036c86f --- firmware/App/Drivers/ConductivityTeensy.c (.../ConductivityTeensy.c) (revision 3fde11b3e67db8690667c7d96696b25e5108a395) +++ firmware/App/Drivers/ConductivityTeensy.c (.../ConductivityTeensy.c) (revision 31a1037056fb4d4c4705211302594e015036c86f) @@ -81,7 +81,6 @@ static U08 queueRearIndex; ///< Queue rear index. static U08 queueFrontIndex; ///< Queue front index. static TEENSY_CMD_INDEX_T currentCmd; -static CONDUCTIVITY_MST_PARAM_IDX_T currentSettingParam = CONDUCTIVITY_MST_PARAM_IDX_SINFREQ; // Conductivity DMA control records static g_dmaCTRL condDMAWriteControlRecord; ///< DMA record for controlling a DMA write command transmission from buffer. @@ -91,7 +90,7 @@ static CONDUCTIVITY_INIT_STATUS_T conductivityInitStatus; static CONDUCTIVITY_UPDATE_EEPROM_STATUS_T condUpdateEEPROMstatus; -static CONDUCTIVITY_UPDATE_MST_STATUS_T condUpdateSettingStatus[MAX_CONDUCTIVITY_MST_PARAM_IDX]; +static CONDUCTIVITY_UPDATE_MST_STATUS_T condUpdateSettingStatus[MAX_COND_MST_PARAM_IDX]; static CONDUCTIVITY_SENSOR_DATA_T rawConductivityValues[ MAX_TEENSY_SENSOR ]; static CONDUCTIVITY_CALCULATED_MEASUREMENTS_T calculatedMeasurement[ MAX_TEENSY_SENSOR ]; static CONDUCTIVITY_COEFFICIENTS_T conductivityCoeff[MAX_TEENSY_SENSOR]; @@ -111,16 +110,6 @@ { TEENSY_CMD_GET_SINGLE_MEASUREMENT , (U08*)"h" , RX_SIZE_GET_SINGLE_MEASUREMENT }, }; -static const U08* condSettingsParam = { - "sinfreq", - "dacpp", - "bias", - "rtia", - "pga", - "dftnum", - "avgnum" - }; - // Conductivity cmd data structs TEENSY_SENSOR_INDEX_T currentSelectedSensor; CONDUCTIVITY_EEPROM_DATA_T eePromDataTX; @@ -918,7 +907,7 @@ { // Read the sensor data temporarily CONDUCTIVITY_SENSOR_DATA_T tempSensor; - memcpy( &tempSensor, ( buffer + ( sensorIdx * expectedDataLength ) ), expectedDataLength ); + memcpy( &tempSensor, buffer, expectedDataLength ); // Check if the received sensor number is valid if ( ( tempSensor.sensorNum < 1 ) || ( tempSensor.sensorNum > MAX_TEENSY_SENSOR ) ) @@ -983,6 +972,9 @@ if ( written > 0 ) { + // Clear the DMA write comand buffer + memcpy( &condWriteCmdBuffer, 0, COND_WRITE_CMD_BUFFER_LEN ); + // Load the DMA write command buffer with contents of TX buffer. memcpy( &condWriteCmdBuffer, &condTxBuffer, written ); success = TRUE; } Index: firmware/App/Drivers/ConductivityTeensy.h =================================================================== diff -u -r3fde11b3e67db8690667c7d96696b25e5108a395 -r31a1037056fb4d4c4705211302594e015036c86f --- firmware/App/Drivers/ConductivityTeensy.h (.../ConductivityTeensy.h) (revision 3fde11b3e67db8690667c7d96696b25e5108a395) +++ firmware/App/Drivers/ConductivityTeensy.h (.../ConductivityTeensy.h) (revision 31a1037056fb4d4c4705211302594e015036c86f) @@ -23,7 +23,7 @@ // ********** public definitions ********** #define DOUBLE_COUNT 8 ///< Number of double values in Teensy EEPROM data #define FLOAT_COUNT 16 ///< Number of float values in Teensy EEPROM data - +#define MAX_COND_MST_PARAM_IDX 7 ///< Total number of parameters in measurement settings CONDUCTIVITY_MEASUREMENT_SETTINGS_T typedef enum TeensySensorIndex { TEENSY_SENSOR_0 = 0, ///< Maps to D17_COND @@ -99,19 +99,6 @@ COND_MST_STATUS_SUCCESS }CONDUCTIVITY_UPDATE_MST_STATUS_T; -// Update Measurement Settings Status -typedef enum mst_param_idx -{ - CONDUCTIVITY_MST_PARAM_IDX_SINFREQ = 0, ///< SinFreq : Frequency of excitation signal - CONDUCTIVITY_MST_PARAM_IDX_DACPP, ///< DacVoltPP : DAC output voltage in mV peak to peak. Maximum value is 800mVpp. Peak to peak voltage - CONDUCTIVITY_MST_PARAM_IDX_BIAS, ///< BiasVolt : The excitation signal is DC+AC. This parameter decides the DC value in mV unit. 0.0mV means no DC bias. - CONDUCTIVITY_MST_PARAM_IDX_RTIA, ///< HstiaRtiaSel : Valid param values ( 0, 1, 2, 3, 4, 5, 6, 7 ) - CONDUCTIVITY_MST_PARAM_IDX_PGA, ///< AdcPgaGain : Valid param values ( 1, 1.5, 2, 4, 9 ) i.e interpreted as ( 0, 1, 2, 3, 4 ) respectively in Teensy. - CONDUCTIVITY_MST_PARAM_IDX_DFTNUM, ///< DftNum : DFT number Valid param values ( 4096, 2048, 1024, 512, 256 ) i.e interpreted as ( 10, 9, 8, 7, 6 ) respectively in Teensy. - CONDUCTIVITY_MST_PARAM_IDX_AVGNUM, ///< ADCAvgNum : Valid param values ( 2, 4, 8, 16 )i.e interpreted as ( 0, 1, 2, 3 ) respectively in Teensy. - MAX_CONDUCTIVITY_MST_PARAM_IDX ///< Total number of Measurement settings parameters -}CONDUCTIVITY_MST_PARAM_IDX_T; - typedef struct { F64 A0;