Index: firmware/App/Controllers/SensorProcess.c =================================================================== diff -u -ra24665c05496241e5ba9a73e0b1831a85dfbc3c9 -r85e0c91a9f375fcf709289ec767d00e4d61e7e6f --- firmware/App/Controllers/SensorProcess.c (.../SensorProcess.c) (revision a24665c05496241e5ba9a73e0b1831a85dfbc3c9) +++ firmware/App/Controllers/SensorProcess.c (.../SensorProcess.c) (revision 85e0c91a9f375fcf709289ec767d00e4d61e7e6f) @@ -31,44 +31,5 @@ *************************************************************************/ void execSensorProcess() { -#ifdef DEBUG_ENABLED - char debugStr[ 256 ]; -#endif - static U32 Counter = 0; - static U32 Load_cell_a1 = 0; - static U32 Load_cell_a2 = 0; - static U32 Load_cell_b1 = 0; - static U32 Load_cell_b2 = 0; - F32 load_cell_a1_f; - F32 load_cell_a2_f; - F32 load_cell_b1_f; - F32 load_cell_b2_f; - BOOL result; - - Load_cell_a1 += getFPGALoadCellA1(); // No overflow since ADC output is 24 bits. - Load_cell_a2 += getFPGALoadCellA2(); - Load_cell_b1 += getFPGALoadCellB1(); - Load_cell_b2 += getFPGALoadCellB2(); - - Counter++; - if (Counter == LOAD_CELL_REPORT_PERIOD) - { - Counter = 0; - - load_cell_a1_f = (F32)(Load_cell_a1)*ADC2GRAM; // division for averaging folded into ADC2GRAM - load_cell_a2_f = (F32)(Load_cell_a2)*ADC2GRAM; - load_cell_b1_f = (F32)(Load_cell_b1)*ADC2GRAM; - load_cell_b2_f = (F32)(Load_cell_b2)*ADC2GRAM; - result = broadcastLoadCellData( load_cell_a1_f, load_cell_a2_f, load_cell_b1_f, load_cell_b2_f ); -#ifdef DEBUG_ENABLED - if (result == FALSE) - sprintf( debugStr, "Adding load cell data to CAN buffer failed" ); -#else - (void)result; -#endif - Load_cell_a1 = 0; - Load_cell_a2 = 0; - Load_cell_b1 = 0; - Load_cell_b2 = 0; - } + execLoadCell(); }