Index: firmware/App/Controllers/LoadCell.c =================================================================== diff -u -r025612ad77fe630889a364586de54bffe5262d56 -r31aa23b12f37b9d16b5160369ccb7dab6c6eca4d --- firmware/App/Controllers/LoadCell.c (.../LoadCell.c) (revision 025612ad77fe630889a364586de54bffe5262d56) +++ firmware/App/Controllers/LoadCell.c (.../LoadCell.c) (revision 31aa23b12f37b9d16b5160369ccb7dab6c6eca4d) @@ -52,6 +52,7 @@ #define MAX_ALLOWED_EXTRA_WEIGHT_BEFORE_FIRST_TARE_GRAMS 300 ///< Max allowed extra weight before first tare in grams. #define MAX_ALLOWED_EXTRA_WEIGHT_BEFORE_TARE_GRAMS 60 ///< Max allowed extra weight before tare in grams. #define LOAD_CELL_PRIMARY_BACKUP_MAX_ALLOWED_DRIFT_GRAMS 60.0 ///< Load cell primary and backup maximum allowed weight drift in grams. +#define DATA_PUBLISH_COUNTER_START_COUNT 15 ///< Data publish counter start count. /// Load cell data structure. typedef struct @@ -76,7 +77,7 @@ LOAD_CELL_REPORT_PERIOD, 0, 0 }; ///< Broadcast load cell data publish interval. static LOADCELL_T loadcells[ NUM_OF_LOAD_CELLS ]; ///< Load cell data structures. static U32 loadCellFilterTimerCount = 0; ///< Load cell filtering timer count. -static U32 loadCellDataPublicationTimerCounter = 0; ///< Load cell data publication timer counter to CAN bus. +static U32 loadCellDataPublicationTimerCounter; ///< Load cell data publication timer counter to CAN bus. static U32 smallReadingsIdx; ///< Index for next sample in load cell small rolling average sample array. static U32 largeReadingsIdx; ///< Index for next sample in load cell large rolling average sample array. @@ -99,8 +100,9 @@ U32 i; U32 j; - smallReadingsIdx = 0; - largeReadingsIdx = 0; + smallReadingsIdx = 0; + largeReadingsIdx = 0; + loadCellDataPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; for ( i = 0; i < NUM_OF_LOAD_CELLS; i++ ) { @@ -249,7 +251,7 @@ // Broadcast small filtered load cell data broadcastData( MSG_ID_LOAD_CELL_READINGS, COMM_BUFFER_OUT_CAN_DG_BROADCAST, (U08*)&loadCellData, sizeof( LOAD_CELL_DATA_T ) ); - loadCellDataPublicationTimerCounter = 0; + loadCellDataPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; } // Monitor the load cells drift