Index: firmware/App/Controllers/DrainPump.c =================================================================== diff -u -r216bd924f989182e648ee5f33f4c91c43ac438ac -ra75923f40bea362b44fc082ce8eebde7bfa97c9a --- firmware/App/Controllers/DrainPump.c (.../DrainPump.c) (revision 216bd924f989182e648ee5f33f4c91c43ac438ac) +++ firmware/App/Controllers/DrainPump.c (.../DrainPump.c) (revision a75923f40bea362b44fc082ce8eebde7bfa97c9a) @@ -391,3 +391,104 @@ *************************************************************************/ +/*********************************************************************//** + * @brief + * The testSetDrainPumpDataPublishIntervalOverride function overrides the \n + * drain pump data publish interval. + * @details + * Inputs : none + * Outputs : drainPumpDataPublishInterval + * @param value : override RO pump data publish interval with (in ms) + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testSetDrainPumpDataPublishIntervalOverride( U32 value ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + U32 intvl = value / TASK_PRIORITY_INTERVAL; + + result = TRUE; + drainPumpDataPublishInterval.ovData = intvl; + drainPumpDataPublishInterval.override = OVERRIDE_KEY; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetDrainPumpDataPublishIntervalOverride function resets the override \n + * of the drain pump data publish interval. + * @details + * Inputs : none + * Outputs : drainPumpDataPublishInterval + * @return TRUE if override reset successful, FALSE if not + *************************************************************************/ +BOOL testResetDrainPumpDataPublishIntervalOverride( void ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + drainPumpDataPublishInterval.override = OVERRIDE_RESET; + drainPumpDataPublishInterval.ovData = drainPumpDataPublishInterval.ovInitData; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testSetTargetDrainPumpPressureOverride function overrides the target \n + * drain pump speed (in RPM). + * @details + * Inputs : none + * Outputs : targetDrainPumpSpeed + * @param value : override target drain pump speed (in RPM) + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testSetTargetDrainPumpPressureOverride( U32 value ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + targetDrainPumpSpeed.ovInitData = targetDrainPumpSpeed.data; // backup current target pressure + targetDrainPumpSpeed.ovData = value; + targetDrainPumpSpeed.override = OVERRIDE_KEY; + result = setDrainPumpTargetSpeed( value ); + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetTargetDrainPumpPressureOverride function resets the override of the \n + * target drain pump speed (in RPM). + * @details + * Inputs : none + * Outputs : targetDrainPumpSpeed + * @param none + * @return TRUE if override reset successful, FALSE if not + *************************************************************************/ +BOOL testResetTargetDrainPumpPressureOverride( void ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + targetDrainPumpSpeed.data = targetDrainPumpSpeed.ovInitData; // restore pre-override target speed + targetDrainPumpSpeed.override = OVERRIDE_RESET; + targetDrainPumpSpeed.ovInitData = 0; + targetDrainPumpSpeed.ovData = 0; + result = setDrainPumpTargetSpeed( targetDrainPumpSpeed.data ); + } + + return result; +} + + Index: firmware/App/Controllers/DrainPump.h =================================================================== diff -u -r416a8fba5774e6cd64c69513e082afbd79f75ccf -ra75923f40bea362b44fc082ce8eebde7bfa97c9a --- firmware/App/Controllers/DrainPump.h (.../DrainPump.h) (revision 416a8fba5774e6cd64c69513e082afbd79f75ccf) +++ firmware/App/Controllers/DrainPump.h (.../DrainPump.h) (revision a75923f40bea362b44fc082ce8eebde7bfa97c9a) @@ -45,6 +45,11 @@ DATA_GET_PROTOTYPE( U32, getTargetDrainPumpSpeed ); +BOOL testSetDrainPumpDataPublishIntervalOverride( U32 value ); +BOOL testResetDrainPumpDataPublishIntervalOverride( void ); +BOOL testSetTargetDrainPumpPressureOverride( U32 value ); +BOOL testResetTargetDrainPumpPressureOverride( void ); + /**@}*/ #endif Index: firmware/App/Controllers/LoadCell.c =================================================================== diff -u -rc48a99d2d1c852adcc986253b6c420a90dab7bfe -ra75923f40bea362b44fc082ce8eebde7bfa97c9a --- firmware/App/Controllers/LoadCell.c (.../LoadCell.c) (revision c48a99d2d1c852adcc986253b6c420a90dab7bfe) +++ firmware/App/Controllers/LoadCell.c (.../LoadCell.c) (revision a75923f40bea362b44fc082ce8eebde7bfa97c9a) @@ -33,13 +33,16 @@ // ********** private data ********** +static OVERRIDE_U32_T loadCellDataPublishInterval = { LOAD_CELL_REPORT_PERIOD, LOAD_CELL_REPORT_PERIOD, 0, 0 }; ///< Broadcast load cell data interval in ms/task interval. static U32 measuredLoadCellReadingsRaw[ NUM_OF_LOAD_CELLS ]; ///< Latest measured raw load cell readings. static U32 measuredLoadCellReadingsSum[ NUM_OF_LOAD_CELLS ]; ///< Raw load cell sums for averaging. static OVERRIDE_F32_T filteredLoadCellWeights[ NUM_OF_LOAD_CELLS ]; ///< Latest filtered load cell weights. static U32 loadCellDataPublicationTimerCounter = 0; ///< used to schedule load cell data publication to CAN bus. // ********** private function prototypes ********** +static U32 getLoadCellDataPublishInterval( void ); + /*********************************************************************//** * @brief * The initLoadCell function initializes the LoadCell module. @@ -87,7 +90,7 @@ measuredLoadCellReadingsSum[ LOAD_CELL_B2 ] += measuredLoadCellReadingsRaw[ LOAD_CELL_B2 ]; // broadcast load cell data if we are at scheduled interval. - if ( ++loadCellDataPublicationTimerCounter == LOAD_CELL_REPORT_PERIOD ) + if ( ++loadCellDataPublicationTimerCounter >= getLoadCellDataPublishInterval() ) // TODO - decouple averaging and conversion so that interval can be overridden { loadCellDataPublicationTimerCounter = 0; // calculate load cell average weights @@ -139,7 +142,28 @@ return result; } +/*********************************************************************//** + * @brief + * The getLoadCellDataPublishInterval function gets the load cell data \n + * publication interval. + * @details + * Inputs : loadCellDataPublishInterval + * Outputs : none + * @return the current load cell data publication interval (in ms/task interval). + *************************************************************************/ +static U32 getLoadCellDataPublishInterval( void ) +{ + U32 result = loadCellDataPublishInterval.data; + if ( OVERRIDE_KEY == loadCellDataPublishInterval.override ) + { + result = loadCellDataPublishInterval.ovData; + } + + return result; +} + + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -193,3 +217,52 @@ return result; } + +/*********************************************************************//** + * @brief + * The testSetLoadCellDataPublishIntervalOverride function overrides the \n + * load cell data publish interval. + * @details + * Inputs : none + * Outputs : loadCellDataPublishInterval + * @param value : override load cell data publish interval with (in ms) + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testSetLoadCellDataPublishIntervalOverride( U32 value ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + U32 intvl = value / TASK_PRIORITY_INTERVAL; + + result = TRUE; + loadCellDataPublishInterval.ovData = intvl; + loadCellDataPublishInterval.override = OVERRIDE_KEY; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetLoadCellDataPublishIntervalOverride function resets the override \n + * of the load cell data publish interval. + * @details + * Inputs : none + * Outputs : loadCellDataPublishInterval + * @return TRUE if override reset successful, FALSE if not + *************************************************************************/ +BOOL testResetLoadCellDataPublishIntervalOverride( void ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + loadCellDataPublishInterval.override = OVERRIDE_RESET; + loadCellDataPublishInterval.ovData = loadCellDataPublishInterval.ovInitData; + } + + return result; +} Index: firmware/App/Controllers/LoadCell.h =================================================================== diff -u -rc48a99d2d1c852adcc986253b6c420a90dab7bfe -ra75923f40bea362b44fc082ce8eebde7bfa97c9a --- firmware/App/Controllers/LoadCell.h (.../LoadCell.h) (revision c48a99d2d1c852adcc986253b6c420a90dab7bfe) +++ firmware/App/Controllers/LoadCell.h (.../LoadCell.h) (revision a75923f40bea362b44fc082ce8eebde7bfa97c9a) @@ -45,10 +45,12 @@ void initLoadCell( void ); // Initialize the LoadCell module. void execLoadCell( void ); // Execute the LoadCell monitor. -DATA_ARRAY_GET_PROTOTYPE( U32, getLoadCellFilteredWeight, loadCellID ); +U32 getLoadCellFilteredWeight( U32 loadCellID ); BOOL testSetLoadCellOverride( F32 value, U32 loadCellID ); BOOL testResetLoadCellOverride( U32 loadCellID ); +BOOL testSetLoadCellDataPublishIntervalOverride( U32 value ); +BOOL testResetLoadCellDataPublishIntervalOverride( void ); /**@}*/ Index: firmware/App/Controllers/Pressures.c =================================================================== diff -u -r216bd924f989182e648ee5f33f4c91c43ac438ac -ra75923f40bea362b44fc082ce8eebde7bfa97c9a --- firmware/App/Controllers/Pressures.c (.../Pressures.c) (revision 216bd924f989182e648ee5f33f4c91c43ac438ac) +++ firmware/App/Controllers/Pressures.c (.../Pressures.c) (revision a75923f40bea362b44fc082ce8eebde7bfa97c9a) @@ -254,17 +254,17 @@ broadcastPressureSensorsData( roIn, roOut, drainIn, drainOut ); pressuresDataPublicationTimerCounter = 0; - #ifdef DEBUG_ENABLED - { - // TODO - temporary debug code - remove later - F32 lc1 = getLoadCellFilteredWeight(LOAD_CELL_A1); - F32 lc2 = getLoadCellFilteredWeight(LOAD_CELL_B1); - char debugPresStr[ 256 ]; +#ifdef DEBUG_ENABLED +{ + // TODO - temporary debug code - remove later + F32 lc1 = getLoadCellFilteredWeight(LOAD_CELL_A1); + F32 lc2 = getLoadCellFilteredWeight(LOAD_CELL_B1); + char debugPresStr[ 256 ]; - sprintf( debugPresStr, "RO: %5d, %5d, Drain: %5d, %5d, Loads: %6d, %6d\n", (S32)roIn, (S32)roOut, (S32)drainIn, (S32)drainOut, (S32)lc1, (S32)lc2 ); - sendDebugData( (U08*)debugPresStr, strlen(debugPresStr) ); - } - #endif + sprintf( debugPresStr, "RO: %5d, %5d, Drain: %5d, %5d, Loads: %6d, %6d\n", (S32)roIn, (S32)roOut, (S32)drainIn, (S32)drainOut, (S32)lc1, (S32)lc2 ); + sendDebugData( (U08*)debugPresStr, strlen(debugPresStr) ); +} +#endif } } Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -rc48a99d2d1c852adcc986253b6c420a90dab7bfe -ra75923f40bea362b44fc082ce8eebde7bfa97c9a --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision c48a99d2d1c852adcc986253b6c420a90dab7bfe) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision a75923f40bea362b44fc082ce8eebde7bfa97c9a) @@ -512,7 +512,7 @@ * @param value : override target RO pressure (in PSI) * @return TRUE if override successful, FALSE if not *************************************************************************/ -BOOL testSetTargetROPumpPressureOverride( S32 value ) +BOOL testSetTargetROPumpPressureOverride( U32 value ) { BOOL result = FALSE; Index: firmware/App/Controllers/ROPump.h =================================================================== diff -u -rc48a99d2d1c852adcc986253b6c420a90dab7bfe -ra75923f40bea362b44fc082ce8eebde7bfa97c9a --- firmware/App/Controllers/ROPump.h (.../ROPump.h) (revision c48a99d2d1c852adcc986253b6c420a90dab7bfe) +++ firmware/App/Controllers/ROPump.h (.../ROPump.h) (revision a75923f40bea362b44fc082ce8eebde7bfa97c9a) @@ -48,7 +48,7 @@ BOOL testSetROPumpDataPublishIntervalOverride( U32 value ); BOOL testResetROPumpDataPublishIntervalOverride( void ); -BOOL testSetTargetROPumpPressureOverride( S32 value ); +BOOL testSetTargetROPumpPressureOverride( U32 value ); BOOL testResetTargetROPumpPressureOverride( void ); BOOL testSetMeasuredROFlowRateOverride( F32 value ); BOOL testResetMeasuredROFlowRateOverride( void ); Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -rc48a99d2d1c852adcc986253b6c420a90dab7bfe -ra75923f40bea362b44fc082ce8eebde7bfa97c9a --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision c48a99d2d1c852adcc986253b6c420a90dab7bfe) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision a75923f40bea362b44fc082ce8eebde7bfa97c9a) @@ -1044,6 +1044,10 @@ handleTestLoadCellOverrideRequest( message ); break; + case MSG_ID_LOAD_CELLL_SEND_INTERVAL_OVERRIDE: + handleTestLoadCellDataBroadcastIntervalOverrideRequest( message ); + break; + case MSG_ID_PRESSURE_OVERRIDE: handleTestPressureSensorOverrideRequest( message ); break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rc48a99d2d1c852adcc986253b6c420a90dab7bfe -ra75923f40bea362b44fc082ce8eebde7bfa97c9a --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision c48a99d2d1c852adcc986253b6c420a90dab7bfe) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision a75923f40bea362b44fc082ce8eebde7bfa97c9a) @@ -892,18 +892,6 @@ DATA_ARRAY_OVERRIDE_HANDLER_FUNC_U32( BOOL, handleTestAlarmStateOverrideRequest, testSetAlarmStateOverride, testResetAlarmStateOverride ) /************************************************************************* - * @brief - * The handleTestLoadCellOverrideRequest function handles a request to \n - * override the value read from the given load cell. - * @details - * Inputs : none - * Outputs : message handled - * @param message : a pointer to the message to handle - * @return none - *************************************************************************/ -DATA_ARRAY_OVERRIDE_HANDLER_FUNC_U32( BOOL, handleTestLoadCellOverrideRequest, testSetLoadCellOverride, testResetLoadCellOverride ) - -/************************************************************************* * @brief handleSetRTCTimestamp * The handleSetRTCTimestamp function handles a request to write time and * date to RTC @@ -933,44 +921,110 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -// MSG_ID_PRESSURE_OVERRIDE: -void handleTestPressureSensorOverrideRequest( MESSAGE_T *message ) -{ +/************************************************************************* + * @brief + * The handleTestLoadCellOverrideRequest function handles a request to \n + * override the value read from the given load cell. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +DATA_ARRAY_OVERRIDE_HANDLER_FUNC_F32( BOOL, handleTestLoadCellOverrideRequest, testSetLoadCellOverride, testResetLoadCellOverride ) -} +/************************************************************************* + * @brief + * The handleTestLoadCellDataBroadcastIntervalOverrideRequest function handles \n + * a request to override the broadcast interval for load cell data. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestLoadCellDataBroadcastIntervalOverrideRequest, testSetLoadCellDataPublishIntervalOverride, testResetLoadCellDataPublishIntervalOverride ) -// MSG_ID_PRESSURE_SEND_INTERVAL_OVERRIDE: -void handleTestPressureDataBroadcastIntervalOverrideRequest( MESSAGE_T *message ) -{ +/************************************************************************* + * @brief + * The handleTestPressureSensorOverrideRequest function handles a request to \n + * override the value read from the given pressure sensor. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +DATA_ARRAY_OVERRIDE_HANDLER_FUNC_F32( BOOL, handleTestPressureSensorOverrideRequest, testSetDGPressureSensorOverride, testResetDGPressureSensorOverride ) -} +/************************************************************************* + * @brief + * The handleTestPressureDataBroadcastIntervalOverrideRequest function handles \n + * a request to override the broadcast interval for load cell data. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestPressureDataBroadcastIntervalOverrideRequest, testSetPressuresDataPublishIntervalOverride, testResetPressuresDataPublishIntervalOverride ) -// MSG_ID_RO_PUMP_SET_PT_OVERRIDE: -void handleTestROPumpSetPointOverrideRequest( MESSAGE_T *message ) -{ +/************************************************************************* + * @brief + * The handleTestROPumpSetPointOverrideRequest function handles a request to \n + * override the RO pump pressure set point (in PSI). + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +DATA_OVERRIDE_HANDLER_FUNC_U32( BOOL, handleTestROPumpSetPointOverrideRequest, testSetTargetROPumpPressureOverride, testResetTargetROPumpPressureOverride ) -} +/************************************************************************* + * @brief + * The handleTestROMeasuredFlowOverrideRequest function handles a request to \n + * override the RO flow rate. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +DATA_OVERRIDE_HANDLER_FUNC_F32( BOOL, handleTestROMeasuredFlowOverrideRequest, testSetMeasuredROFlowRateOverride, testResetMeasuredROFlowRateOverride ) -// MSG_ID_RO_MEASURED_FLOW_OVERRIDE: -void handleTestROMeasuredFlowOverrideRequest( MESSAGE_T *message ) -{ +/************************************************************************* + * @brief + * The handleTestROPumpDataBroadcastIntervalOverrideRequest function handles \n + * a request to override the broadcast interval for RO pump data. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestROPumpDataBroadcastIntervalOverrideRequest, testSetROPumpDataPublishIntervalOverride, testResetROPumpDataPublishIntervalOverride ) -} +/************************************************************************* + * @brief + * The handleTestDrainPumpSetPointOverrideRequest function handles a request to \n + * override the drain pump speed set point (in RPM). + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +DATA_OVERRIDE_HANDLER_FUNC_U32( BOOL, handleTestDrainPumpSetPointOverrideRequest, testSetTargetDrainPumpPressureOverride, testResetTargetDrainPumpPressureOverride ) -// MSG_ID_RO_PUMP_SEND_INTERVAL_OVERRIDE: -void handleTestROPumpDataBroadcastIntervalOverrideRequest( MESSAGE_T *message ) -{ - -} - -// MSG_ID_DRAIN_PUMP_SET_PT_OVERRIDE: -void handleTestDrainPumpSetPointOverrideRequest( MESSAGE_T *message ) -{ - -} - -// MSG_ID_DRAIN_PUMP_SEND_INTERVAL_OVERRIDE: -void handleTestDrainPumpDataBroadcastIntervalOverrideRequest( MESSAGE_T *message ) -{ - -} +/************************************************************************* + * @brief + * The handleTestDrainPumpDataBroadcastIntervalOverrideRequest function handles \n + * a request to override the broadcast interval for drain pump data. + * @details + * Inputs : none + * Outputs : message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestDrainPumpDataBroadcastIntervalOverrideRequest, testSetDrainPumpDataPublishIntervalOverride, testResetDrainPumpDataPublishIntervalOverride ) Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -rc48a99d2d1c852adcc986253b6c420a90dab7bfe -ra75923f40bea362b44fc082ce8eebde7bfa97c9a --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision c48a99d2d1c852adcc986253b6c420a90dab7bfe) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision a75923f40bea362b44fc082ce8eebde7bfa97c9a) @@ -100,6 +100,9 @@ // MSG_ID_LOAD_CELL_OVERRIDE void handleTestLoadCellOverrideRequest( MESSAGE_T *message ); +// MSG_ID_LOAD_CELLL_SEND_INTERVAL_OVERRIDE: +void handleTestLoadCellDataBroadcastIntervalOverrideRequest( MESSAGE_T *message ); + // MSG_ID_SET_RTC_TIMESTAMP void handleSetRTCTimestamp( MESSAGE_T *message );