Index: firmware/App/Services/Reservoirs.c =================================================================== diff -u -r05019ca03114d75099dd3ae6e09f776bd8a2c46e -r31aa23b12f37b9d16b5160369ccb7dab6c6eca4d --- firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 05019ca03114d75099dd3ae6e09f776bd8a2c46e) +++ firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 31aa23b12f37b9d16b5160369ccb7dab6c6eca4d) @@ -48,6 +48,7 @@ #define RESERVOIR_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< interval (ms/task time) at which the reservoir data is published on the CAN bus. #define MAX_REDUNDANT_LOAD_CELL_DIFF 50.0 ///< Maximum difference in redundant load cells when determining if fill completed. #define DRAIN_THRESHOLD_ML 30.0 ///< Drain threshold in milliliters. +#define DATA_PUBLISH_COUNTER_START_COUNT 5 ///< Data publish counter start count. // ********** private data ********** @@ -67,7 +68,7 @@ } HEATERS_TEMPERATURE_CALC_DATA_T; static HEATERS_TEMPERATURE_CALC_DATA_T heatersTempCalc; ///< Heaters temperature calculations data structure. -static U32 reservoirDataPublicationTimerCounter = 0; ///< used to schedule reservoir data publication to CAN bus. +static U32 dataPublishCounter; ///< used to schedule reservoir data publication to CAN bus. static OVERRIDE_U32_T activeReservoir = { 0, 0, 0, 0 }; ///< The active reservoir that the DG is filling/draining/etc. static OVERRIDE_U32_T fillVolumeTargetMl = { 0, 0, 0, 0 }; ///< The target reservoir fill volume (in mL). @@ -94,7 +95,7 @@ * @details Inputs: none * @details Outputs: activeReservoir.data, fillVolumeTargetMl.data, * drainVolumeTargetMl.data, targetFillFlowRateLPM, isThisTheFirstCycle, - * previousReservoiWeight + * previousReservoiWeight, dataPublishCounter * @return none *************************************************************************/ void initReservoirs( void ) @@ -104,6 +105,7 @@ drainVolumeTargetMl.data = DEFAULT_DRAIN_VOLUME_ML; targetFillFlowRateLPM = 0.0; isThisTheFirstCycle = TRUE; + dataPublishCounter = DATA_PUBLISH_COUNTER_START_COUNT; memset( &previousReservoiWeight, 0.0, sizeof( F32 ) * NUM_OF_DG_RESERVOIRS ); } @@ -130,7 +132,7 @@ } // publish active reservoir, fill/drain volume targets at 1 Hz. - if ( ++reservoirDataPublicationTimerCounter >= RESERVOIR_DATA_PUB_INTERVAL ) + if ( ++dataPublishCounter >= RESERVOIR_DATA_PUB_INTERVAL ) { RESERVOIR_DATA_T data; @@ -148,7 +150,7 @@ data.timereservoirFill = heatersTempCalc.timeReservoirFillMS; broadcastData( MSG_ID_DG_RESERVOIRS_DATA, COMM_BUFFER_OUT_CAN_DG_BROADCAST, (U08*)&data, sizeof( RESERVOIR_DATA_T ) ); - reservoirDataPublicationTimerCounter = 0; + dataPublishCounter = DATA_PUBLISH_COUNTER_START_COUNT; } }