Index: firmware/App/Controllers/LoadCell.c =================================================================== diff -u -re0cdf49eb0f54239e5d765282e0952cea7ded1bd -r95eefee71702fbf031025dc35ebaf553dfb050b7 --- firmware/App/Controllers/LoadCell.c (.../LoadCell.c) (revision e0cdf49eb0f54239e5d765282e0952cea7ded1bd) +++ firmware/App/Controllers/LoadCell.c (.../LoadCell.c) (revision 95eefee71702fbf031025dc35ebaf553dfb050b7) @@ -155,6 +155,7 @@ void execLoadCell( void ) { U32 ii; + U32 a1 = getFPGALoadCellA1(); U32 a2 = getFPGALoadCellA2(); U32 b1 = getFPGALoadCellB1(); @@ -176,6 +177,8 @@ SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_LOAD_CELL_ADC_ERROR, ( a1 | a2 | b1 | b2 ) ) } + // TODO use ALARM_ID_DG_LOAD_CELL_FPGA_READ_ERROR for read error + // Check if a new calibration is available if ( TRUE == isNewCalibrationRecordAvailable() ) { @@ -301,16 +304,16 @@ F32 weight = getLoadCellSmallFilteredWeight( loadCellID ); // Check if the load cell is being tared for the first time - if ( fabs(loadcells[ loadCellID ].autoCalOffset ) < NEARLY_ZERO ) + if ( fabs( loadcells[ loadCellID ].autoCalOffset ) < NEARLY_ZERO ) { // For the first tare, the weight of the reservoir should be considered // The current weight of the load cell should not be greater than the weight of the reservoir + the extra weight - F32 deltaWeight = fabs( weight - EMPTY_RESERVOIR_WEIGHT_GRAMS ); + F32 deltaWeight = fabs( weight - EMPTY_RESERVOIR_WEIGHT_GRAMS ); isWeightOutOfRange = ( deltaWeight > MAX_ALLOWED_EXTRA_WEIGHT_BEFORE_FIRST_TARE_GRAMS ? TRUE : FALSE ); } else { - isWeightOutOfRange = ( fabs(weight) > MAX_ALLOWED_EXTRA_WEIGHT_BEFORE_TARE_GRAMS ? TRUE : FALSE ); + isWeightOutOfRange = ( fabs( weight ) > MAX_ALLOWED_EXTRA_WEIGHT_BEFORE_TARE_GRAMS ? TRUE : FALSE ); } if ( FALSE == isWeightOutOfRange )