Skip to content

Commit 1baed55

Browse files
committed
Fix std::abs() usage
Call of overloaded 'abs(unsigned int&)' is ambiguous See https://gcc.gnu.org/gcc-6/porting_to.html#overloaded-abs Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 650f9e9 commit 1baed55

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libraries/CapacitiveSensor-0.5.1/CapacitiveSensor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ long CapacitiveSensor::capacitiveSensor(uint8_t samples)
6161
// only calibrate if time is greater than CS_AutocaL_Millis and total is less than 10% of baseline
6262
// this is an attempt to keep from calibrating when the sensor is seeing a "touched" signal
6363

64-
if ( (millis() - lastCal > CS_AutocaL_Millis) && abs(total - leastTotal) < (int)(.10 * (float)leastTotal) ) {
64+
if ( (millis() - lastCal > CS_AutocaL_Millis) &&
65+
abs((signed long)total - (signed long)leastTotal) < (int)(.10 * (float)leastTotal) ) {
6566

6667
// Serial.println(); // debugging
6768
// Serial.println("auto-calibrate");

0 commit comments

Comments
 (0)