Skip to content

Commit

Permalink
Fix abs() overload for mcu lms7002m calibrations
Browse files Browse the repository at this point in the history
on ubuntu yakkety (gcc 6.2.0) abs(int8_t) had some resolution issue,
it was picking up a double type which it could not or with 0x40.
The fix was to force the integer version of abs with a cast.
  • Loading branch information
guruofquality committed Jan 1, 2017
1 parent ceb5762 commit fd7b8c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Release 16.12.1 (pending)
==========================

- Fix abs() overload for mcu lms7002m calibrations

Release 16.12.0 (2016-12-31)
==========================

Expand Down
2 changes: 1 addition & 1 deletion mcu_program/common_src/lms7002m_calibrations.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static uint8_t toDCOffset(const int8_t offset)
{
if(offset >= 0)
return offset;
return abs(offset) | 0x40;
return (uint8_t)(abs((int)offset) | 0x40);
}

static void FlipRisingEdge(const uint16_t addr, const uint8_t bits)
Expand Down

0 comments on commit fd7b8c7

Please sign in to comment.