-
Notifications
You must be signed in to change notification settings - Fork 145
Description
Description
Simple compilation of the example sketch fails with the below error.
Workaround:
Install older board package version < 3.0.0
esp8266 by ESP8266 Community Version 2.7.4
Steps To Reproduce Problem
Open example sketch and verify (compile) it.
Hardware & Software
IDE: Arduino 1.8.16 OR Arudino IDE 2.0.0-beta.12
Board: Generic ESP8266
Board: esp8266 by ESP8266 Community Version 3.0.2
ESP01-S
Win11
Arduino Sketch
#include <CapacitiveSensor.h>
/*
* CapitiveSense Library Demo Sketch
* Paul Badger 2008
* Uses a high value resistor e.g. 10M between send pin and receive pin
* Resistor effects sensitivity, experiment with values, 50K - 50M. Larger resistor values yield larger sensor values.
* Receive pin is the sensor pin - try different amounts of foil/metal on this pin
*/
CapacitiveSensor cs_4_2 = CapacitiveSensor(0,2); // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired
//CapacitiveSensor cs_4_6 = CapacitiveSensor(4,6); // 10M resistor between pins 4 & 6, pin 6 is sensor pin, add a wire and or foil
//CapacitiveSensor cs_4_8 = CapacitiveSensor(4,8); // 10M resistor between pins 4 & 8, pin 8 is sensor pin, add a wire and or foil
void setup()
{
cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF); // turn off autocalibrate on channel 1 - just as an example
Serial.begin(9600);
}
void loop()
{
long start = millis();
long total1 = cs_4_2.capacitiveSensor(30);
// long total2 = cs_4_6.capacitiveSensor(30);
// long total3 = cs_4_8.capacitiveSensor(30);
Serial.print(millis() - start); // check on performance in milliseconds
Serial.print("\t"); // tab character for debug windown spacing
Serial.print(total1); // print sensor output 1
//Serial.print("\t");
//Serial.print(total2); // print sensor output 2
//Serial.print("\t");
//Serial.println(total3); // print sensor output 3
delay(10); // arbitrary delay to limit data to serial port
}
Errors or Incorrect Output
Compiling library "CapacitiveSensor-master" "C:\\Users\\xyz\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\3.0.4-gcc10.3-1757bed/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -D_GNU_SOURCE "-IC:\\Users\\xyz\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2/tools/sdk/include" "-IC:\\Users\\xyz\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2/tools/sdk/lwip2/include" "-IC:\\Users\\xyz\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\\Users\\xyz\\AppData\\Local\\Temp\\arduino-sketch-D98C7FED0C5F5F9EA38B42012BE2DB9B/core" -c -Werror=return-type -Os -g -free -fipa-pta -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++17 -MMD -ffunction-sections -fdata-sections -fno-exceptions -DMMU_IRAM_SIZE=0x8000 -DMMU_ICACHE_SIZE=0x8000 -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10607 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_GENERIC\"" -DLED_BUILTIN=2 -DFLASHMODE_DOUT -DESP8266 "-IC:\\Users\\xyz\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2\\cores\\esp8266" "-IC:\\Users\\xyz\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2\\variants\\generic" "-Ie:\\Stuff\\Arduino\\projects\\libraries\\CapacitiveSensor-master" "e:\\Stuff\\Arduino\\projects\\libraries\\CapacitiveSensor-master\\CapacitiveSensor.cpp" -o "C:\\Users\\xyz\\AppData\\Local\\Temp\\arduino-sketch-D98C7FED0C5F5F9EA38B42012BE2DB9B\\libraries\\CapacitiveSensor-master\\CapacitiveSensor.cpp.o" e:\Stuff\Arduino\projects\libraries\CapacitiveSensor-master\CapacitiveSensor.cpp: In member function 'long int CapacitiveSensor::capacitiveSensor(uint8_t)': e:\Stuff\Arduino\projects\libraries\CapacitiveSensor-master\CapacitiveSensor.cpp:94:75: error: call of overloaded 'abs(long unsigned int)' is ambiguous 94 | if ( (millis() - lastCal > CS_AutocaL_Millis) && abs(total - leastTotal) < (int)(.10 * (float)leastTotal) ) { | ^ In file included from c:\users\xyz\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\cstdlib:75, from c:\users\xyz\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\stdlib.h:36, from C:\Users\xyz\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:27, from e:\Stuff\Arduino\projects\libraries\CapacitiveSensor-master\CapacitiveSensor.cpp:30: c:\users\xyz\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\stdlib.h:74:5: note: candidate: 'int abs(int)' 74 | int abs (int); | ^~~ In file included from c:\users\xyz\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\cstdlib:77, from c:\users\xyz\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\stdlib.h:36, from C:\Users\xyz\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:27, from e:\Stuff\Arduino\projects\libraries\CapacitiveSensor-master\CapacitiveSensor.cpp:30: c:\users\xyz\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ c:\users\xyz\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ c:\users\xyz\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ c:\users\xyz\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ c:\users\xyz\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ Using library CapacitiveSensor-master at version 0.5.1 in folder: E:\Stuff\Arduino\projects\libraries\CapacitiveSensor-master Compilation error: Error: 13 INTERNAL: exit status 1