Index: firmware/App/Controllers/LoadCell.c =================================================================== diff -u -radeea598350354a833fff375526b888d0e6b6d48 -r7ce76ebd80b818d51dc61fd7f0c0fe94a242d182 --- firmware/App/Controllers/LoadCell.c (.../LoadCell.c) (revision adeea598350354a833fff375526b888d0e6b6d48) +++ firmware/App/Controllers/LoadCell.c (.../LoadCell.c) (revision 7ce76ebd80b818d51dc61fd7f0c0fe94a242d182) @@ -52,13 +52,14 @@ #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 0 ///< Data publish counter start count. /// Load cell data structure. typedef struct { - U32 rawReading; ///< Latest raw load cell reading - OVERRIDE_F32_T weight; ///< Latest load cell weight - F32 autoCalOffset; ///< Load cell auto-calibration offset + U32 rawReading; ///< Latest raw load cell reading. + OVERRIDE_F32_T weight; ///< Latest load cell weight. + F32 autoCalOffset; ///< Load cell auto-calibration offset. F32 loadCellVelocity_g_min; ///< Velocity (in g/min) of load cell. F32 smallFilterReadings[ SIZE_OF_SMALL_LOAD_CELL_AVG ]; ///< Load cell samples for small load cell moving average. @@ -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 @@ -262,7 +264,7 @@ * It gets the calibration record from NVDataMgmt and checks whether the * values have a calibration date. * @details Inputs: none - * @details Outputs: + * @details Outputs: loadCellsCalRecord * @return result of the load cell self test *************************************************************************/ SELF_TEST_STATUS_T execLoadCellsSelfTest ( void )