Index: firmware/App/Services/TxParams.c =================================================================== diff -u -r482b7687783895cd75bbbf1756f724952bcfcaf6 -rb235eaec221c0e56482f640cf374111daa34119f --- firmware/App/Services/TxParams.c (.../TxParams.c) (revision 482b7687783895cd75bbbf1756f724952bcfcaf6) +++ firmware/App/Services/TxParams.c (.../TxParams.c) (revision b235eaec221c0e56482f640cf374111daa34119f) @@ -1146,34 +1146,40 @@ /*********************************************************************//** * @brief - * The testSetTreatmentParameterOverride function overrides the value of a - * given treatment parameter. - * @details Inputs: none - * @details Outputs: treatment parameter set to given value - * @param param ID of treatment parameter to set value of - * @param value value to set for given treatment parameter - * @return TRUE if override successful, FALSE if not + * The testSetTreatmentParameter function sets a given treatment parameter + * to a given value. + * @details \b Inputs: none + * @details \b Outputs: treatmentParameters[] + * @param message Set treatment parameter message from Dialin which includes + * the ID of the treatment parameter to be set and the value to set it to. + * @return TRUE if set request is successful, FALSE if not *************************************************************************/ -BOOL testSetTreatmentParameter( TREATMENT_PARAM_T param, CRITICAL_DATAS_T value ) +BOOL testSetTreatmentParameter( MESSAGE_T *message ) { BOOL result = FALSE; - if ( param < NUM_OF_TREATMENT_PARAMS ) + // Verify payload length is valid + if ( message->hdr.payloadLen == sizeof( DIALIN_SET_TX_PARAM_PAYLOAD_T ) ) { - if ( TRUE == isTestingActivated() ) + DIALIN_SET_TX_PARAM_PAYLOAD_T payload; + + memcpy( (U08*)&payload, &message->payload[0], sizeof( DIALIN_SET_TX_PARAM_PAYLOAD_T ) ); + + // Verify treatment parameter ID is valid + if ( (TREATMENT_PARAM_T)payload.paramID < NUM_OF_TREATMENT_PARAMS ) { - // Set parameter per its type - if ( CRITICAL_DATA_TYPE_U32 == TREAT_PARAMS_PROPERTIES[ param ].dataType ) + // Set the given Tx param to the given value + if ( (TREATMENT_PARAM_T)payload.paramID <= TREATMENT_PARAM_LAST_UINT ) { - result = setTreatmentParameterU32( param, value.uInt ); + result = setTreatmentParameterU32( (TREATMENT_PARAM_T)payload.paramID, payload.value.uInt ); } - else if ( CRITICAL_DATA_TYPE_S32 == TREAT_PARAMS_PROPERTIES[ param ].dataType ) + else if ( (TREATMENT_PARAM_T)payload.paramID >= TREATMENT_PARAM_FIRST_F32 ) { - result = setTreatmentParameterS32( param, value.sInt ); + result = setTreatmentParameterF32( (TREATMENT_PARAM_T)payload.paramID, payload.value.sFlt ); } else { - result = setTreatmentParameterF32( param, value.sFlt ); + result = setTreatmentParameterS32( (TREATMENT_PARAM_T)payload.paramID, payload.value.sInt ); } } } @@ -1216,4 +1222,5 @@ return result; } + /**@}*/