Skip to content

Commit

Permalink
Merge pull request #2407 from supervillain101/bmp3_overflow_prevention
Browse files Browse the repository at this point in the history
This change adds protection against rollover at high altitudes.
  • Loading branch information
vrahane authored Nov 4, 2020
2 parents 7a52e0b + da1b9d3 commit a68da01
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hw/drivers/sensors/bmp388/src/bmp388.c
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,8 @@ compensate_pressure(const struct bmp3_uncomp_data *uncomp_data,
BMP388_LOG_ERROR("*****partial_data4 high32bit = 0x%x low32bit = 0x%x\n", (uint32_t)((partial_data4)>>32),(uint32_t)(partial_data4&0xffffffff));
#endif

partial_data5 = (partial_data4 * uncomp_data->pressure) / 512;
partial_data5 = (partial_data4 * (uncomp_data->pressure / 10)) / 512;
partial_data5 = partial_data5 * 10;

#if COMPENSTATE_DEBUG
BMP388_LOG_ERROR("*****partial_data5 high32bit = 0x%x low32bit = 0x%x\n", (uint32_t)((partial_data5)>>32),(uint32_t)(partial_data5&0xffffffff));
Expand Down

0 comments on commit a68da01

Please sign in to comment.