Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sensor/vl53l0x/api/core/src/vl53l0x_api_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1861,8 +1861,8 @@ VL53L0X_Error VL53L0X_calc_sigma_estimate(VL53L0X_DEV Dev,
* 500 is added to ensure rounding when integer division
* truncates.
*/
diff1_mcps = (((peakSignalRate_kcps << 16) -
2 * xTalkCompRate_kcps) + 500)/1000;
diff1_mcps = abs((int32_t) ((((peakSignalRate_kcps << 16) -
2 * xTalkCompRate_kcps) + 500)/1000));

/* vcselRate + xtalkCompRate */
diff2_mcps = ((peakSignalRate_kcps << 16) + 500)/1000;
Expand All @@ -1872,7 +1872,7 @@ VL53L0X_Error VL53L0X_calc_sigma_estimate(VL53L0X_DEV Dev,
diff1_mcps <<= 8;

/* FixPoint0824/FixPoint1616 = FixPoint2408 */
xTalkCorrection = abs(diff1_mcps/diff2_mcps);
xTalkCorrection = diff1_mcps/diff2_mcps;

/* FixPoint2408 << 8 = FixPoint1616 */
xTalkCorrection <<= 8;
Expand Down