Index: firmware/App/Drivers/ConductivityTeensy.c =================================================================== diff -u -r4954a58fad7d100068baed367ae074ca6c132813 -r0276993257b238c4056da818d241205ae0c30a56 --- firmware/App/Drivers/ConductivityTeensy.c (.../ConductivityTeensy.c) (revision 4954a58fad7d100068baed367ae074ca6c132813) +++ firmware/App/Drivers/ConductivityTeensy.c (.../ConductivityTeensy.c) (revision 0276993257b238c4056da818d241205ae0c30a56) @@ -23,6 +23,7 @@ #include "Comm.h" #include "ConductivityTeensy.h" +#include "Messaging.h" #include "Timers.h" // ********** private definitions ********** @@ -182,7 +183,7 @@ static COND_PARSE_STATUS parseConductivityMeasurements( const U08 *buffer, U32 len ); static U32 getTeensyCondId( CONDUCTIVITY_SENSORS_T sensorId ); -static void calculateConductivity( TEENSY_SENSOR_INDEX_T sensorNum, BOOL isFPSensor ); +static void calculateConductivity( TEENSY_SENSOR_INDEX_T sensorNum ); static void calculateConductivityAly( TEENSY_SENSOR_INDEX_T sensorNum, BOOL isFPSensor ); static void calculateConductivityUpdatedStandard( TEENSY_SENSOR_INDEX_T sensorNum, BOOL isFPSensor ); static void calculateConductivityStandard( TEENSY_SENSOR_INDEX_T sensorNum, BOOL isFPSensor ); @@ -424,20 +425,23 @@ } else { - // If queue is empty, q automated polling data cmd - // otherwise, we are already polling data, move to recv next data packet - if ( ( condAutomatedDataPolling == TRUE ) && ( currentCmd != TEENSY_CMD_STOP_MEASUREMENT ) ) + if( FALSE == eepromInit ) { - condWriteCommandInProgress = TRUE; // set to TRUE for recv interrupt to trigger with no sent msg - setupConductivityDMAForWriteResp( teensyCmdMap[ currentCmd ].rxSize ); - startConductivityDMAReceiptOfWriteResp(); - state = COND_COMM_STATE_RX; + // If queue is empty and we are done with init, q automated polling data cmd + // otherwise, we are already polling data, move to recv next data packet + if ( ( condAutomatedDataPolling == TRUE ) && ( currentCmd != TEENSY_CMD_STOP_MEASUREMENT ) ) + { + condWriteCommandInProgress = TRUE; // set to TRUE for recv interrupt to trigger with no sent msg + setupConductivityDMAForWriteResp( teensyCmdMap[ currentCmd ].rxSize ); + startConductivityDMAReceiptOfWriteResp(); + state = COND_COMM_STATE_RX; + } + else + { + condWriteCommandInProgress = TRUE; + enqueue( TEENSY_CMD_START_MEASUREMENT ); + } } - else - { - condAutomatedDataPolling = TRUE; - enqueue( TEENSY_CMD_START_MEASUREMENT ); - } } return state; @@ -588,6 +592,8 @@ break; case TEENSY_CMD_GET_SINGLE_MEASUREMENT: break; + case TEENSY_CMD_SELECT_SENSOR: + break; default: break; } @@ -876,7 +882,7 @@ } // Should not be any data received at this time - consumeUnexpectedConductivityData(); + //consumeUnexpectedConductivityData(); return success; } @@ -1194,7 +1200,6 @@ { COND_COMM_STATE_T state = COND_COMM_STATE_RX; COND_PARSE_STATUS parseStatus = COND_PARSE_NONE; - state = COND_COMM_STATE_IDLE; // Check if a response is received in the RX buffer BOOL recvComplete = rxTeensyReadRsp( TEENSY_CMD_GET_EEPROM_DATA ); @@ -1220,7 +1225,7 @@ else { eepromInit = FALSE; - currentSelectedSensor = 0; + currentSelectedSensor = TEENSY_SENSOR_0; } // Go to the idle state to execute next cmd in the queue state = COND_COMM_STATE_IDLE; @@ -1910,10 +1915,10 @@ condRawMeasurement[ tempSensor.sensorNum - 1 ] = tempSensor; // Calculate and store Conductivity from raw values - calculateConductivity( tempSensor.sensorNum - 1 ); + calculateConductivity( (TEENSY_SENSOR_INDEX_T)tempSensor.sensorNum - 1 ); // Calculate and store Temperature from raw values. - calculateTemperature( tempSensor.sensorNum - 1 ); + calculateTemperature( (TEENSY_SENSOR_INDEX_T)tempSensor.sensorNum - 1 ); parseStatus = COND_PARSE_SUCCESS; } @@ -2203,3 +2208,35 @@ /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ + + +/*********************************************************************//** + * @brief + * The testSetTeenyConductivityModel function sets the given conductivity model + * @details \b Inputs: none + * @details \b Outputs: currentConductivityModel[] + * @param message Override message from Dialin which includes an ID of + * the conductivity model to switch to. + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testSetTeenyConductivityModel( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + if ( sizeof( U32 ) == message->hdr.payloadLen ) + { + COND_MODELS_T newCondModel; + + memcpy( &newCondModel, &message->payload[0], sizeof( U32 ) ); + if ( newCondModel < NUM_OF_MODELS ) + { + currentConductivityModel = newCondModel; + result = TRUE; + } + } + } + + return result; +} Index: firmware/App/Drivers/ConductivityTeensy.h =================================================================== diff -u -r4954a58fad7d100068baed367ae074ca6c132813 -r0276993257b238c4056da818d241205ae0c30a56 --- firmware/App/Drivers/ConductivityTeensy.h (.../ConductivityTeensy.h) (revision 4954a58fad7d100068baed367ae074ca6c132813) +++ firmware/App/Drivers/ConductivityTeensy.h (.../ConductivityTeensy.h) (revision 0276993257b238c4056da818d241205ae0c30a56) @@ -221,5 +221,6 @@ void addToConductivityCmdQ(TEENSY_CMD_INDEX_T teensyCmd); F32 getTeensyConductivityValue( CONDUCTIVITY_SENSORS_T sensorId ); F32 getTeensyConductivityTemperatureValue( CONDUCTIVITY_SENSORS_T sensorId ); +BOOL testSetTeenyConductivityModel( MESSAGE_T *message ); #endif /* _CONDUCTIVITY_TEENSY_H_ */ Index: firmware/App/Services/Messaging.c =================================================================== diff -u -r91e5add90c92b7795acfe981a2f87b3f682e5202 -r0276993257b238c4056da818d241205ae0c30a56 --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision 91e5add90c92b7795acfe981a2f87b3f682e5202) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision 0276993257b238c4056da818d241205ae0c30a56) @@ -264,6 +264,9 @@ { MSG_ID_FP_DEF_PRE_GEN_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testPreGenPermeateDefDataPublishIntervalOverride}, { MSG_ID_FP_DEF_GEN_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testGenPermeateDefDataPublishIntervalOverride}, { MSG_ID_FP_DEF_STATUS_REQUEST, &testGetFPDefeaturedStatus }, +#ifdef __TEENSY_CONDUCTIVITY_DRIVER__ + { MSG_ID_DD_SET_CONDUCTIVITY_MODEL_REQUEST, &testSetTeenyConductivityModel }, +#endif }; /// Calculation for number of entries in the incoming message function handler look-up table.