sparkfun / SparkFun_Qwiic_RFID_Arduino_Library

2 stars 1 forks source link

wire.h overloading, compiler unsure which requestFrom to use #3

Closed EEphdNPS closed 5 years ago

EEphdNPS commented 5 years ago

When compiling the examples (Example1_Read_Tag_Basics), I continue to get the warning below. It looks like wire.h has an overloaded method. When the method is called in function 'void Qwiic_Rfid::_readAllTagsTimes(uint8_t)':, the compiler isn't sure which one to use. When I send it to my Arduino Uno, the example doesn't work. I don't get anything intelligible over the serial connection. I haven't dug into the code to understand which candidate should be used. I will look today to see if I can make a recommendation.

/home/builder/opt/arduino-builder/arduino-builder -compile -core-api-version 10611 -hardware /home/builder/opt/arduino-builder/hardware -hardware /home/builder/.arduino15/packages -tools /home/builder/opt/arduino-builder/tools -tools /home/builder/.arduino15/packages -built-in-libraries /home/builder/opt/libraries/latest -logger humantags -fqbn arduino:avr:uno -build-cache /tmp -build-path /tmp/164904759/build -verbose -prefs runtime.tools.linuxuploader.path=/home/builder/.arduino15/packages/arduino/tools/linuxuploader/1.5.1 -prefs runtime.tools.avrdude.path=/home/builder/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino14 -prefs runtime.tools.mkspiffs.path=/home/builder/.arduino15/packages/esp8266/tools/mkspiffs/2.5.0-3-20ed2b9 -prefs runtime.tools.openocd.path=/home/builder/.arduino15/packages/arduino/tools/openocd/0.10.0-arduino9 -prefs runtime.tools.arc-elf32.path=/home/builder/.arduino15/packages/Intel/tools/arc-elf32/1.6.9+1.0.1 -prefs runtime.tools.arduino101load.path=/home/builder/.arduino15/packages/Intel/tools/arduino101load/2.0.1 -prefs runtime.tools.dfu-util.path=/home/builder/.arduino15/packages/arduino/tools/dfu-util/0.9.0-arduino1 -prefs runtime.tools.i586-poky-linux-uclibc.path=/home/builder/.arduino15/packages/Intel/tools/i586-poky-linux-uclibc/1.6.2+1.0 -prefs runtime.tools.arm-none-eabi-gcc.path=/home/builder/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4 -prefs runtime.tools.avr-gcc.path=/home/builder/.arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2 -prefs runtime.tools.nrf5x-cl-tools.path=/home/builder/.arduino15/packages/arduino/tools/nrf5x-cl-tools/9.3.1 -prefs runtime.tools.x86-linux-gcc.path=/home/builder/.arduino15/packages/arduino/tools/x86-linux-gcc/7.2.0 -prefs runtime.tools.arduinoOTA.path=/home/builder/.arduino15/packages/arduino/tools/arduinoOTA/1.2.1 -prefs runtime.tools.bossac.path=/home/builder/.arduino15/packages/arduino/tools/bossac/1.9.1-arduino1 -prefs runtime.tools.flashpack.path=/home/builder/.arduino15/packages/Intel/tools/flashpack/2.0.0 -prefs runtime.tools.CMSIS.path=/home/builder/.arduino15/packages/arduino/tools/CMSIS/4.5.0 -prefs runtime.tools.arm-linux-gcc.path=/home/builder/.arduino15/packages/arduino/tools/arm-linux-gcc/4.9.3 -prefs runtime.tools.CMSIS-Atmel.path=/home/builder/.arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0 -prefs runtime.tools.esptool.path=/home/builder/.arduino15/packages/esp8266/tools/esptool/2.5.0-3-20ed2b9 -prefs runtime.tools.xtensa-lx106-elf-gcc.path=/home/builder/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9 -prefs runtime.tools.core2-32-poky-linux.path=/home/builder/.arduino15/packages/Intel/tools/core2-32-poky-linux/1.6.2+1.0 -prefs runtime.tools.sketchUploader.path=/home/builder/.arduino15/packages/Intel/tools/sketchUploader/1.6.2+1.0 -libraries /tmp/164904759/custom -libraries /tmp/164904759/pinned /tmp/164904759/Example1_Read_Tag_Basics

Sketch uses 7726 bytes (23%) of program storage space. Maximum is 32256 bytes.

Global variables use 735 bytes (35%) of dynamic memory, leaving 1313 bytes for local variables. Maximum is 2048 bytes.

In file included from /home/builder/opt/libraries/latest/sparkfun_qwiic_rfid_arduino_library_1_1_5/src/SparkFun_Qwiic_Rfid.h:4:0,

from /home/builder/opt/libraries/latest/sparkfun_qwiic_rfid_arduino_library_1_1_5/src/SparkFun_Qwiic_Rfid.cpp:13:

/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/libraries/Wire/src/Wire.h: In member function 'void Qwiic_Rfid::_readAllTagsTimes(uint8_t)':

/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/libraries/Wire/src/Wire.h:64:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)

uint8_t requestFrom(int, int);

^

/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/libraries/Wire/src/Wire.h:61:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)

uint8_t requestFrom(uint8_t, uint8_t);

^

EEphdNPS commented 5 years ago

Digging in, in line 11 of SparkFun_Qwiic_Rfid.h you define the constant by "#define TAG_AND_TIME_REQUEST 10". When TAG_AND_TIME_REQUEST is used later by requestFrom, the data type isn't defined as an int or uint8, hence the confusion by the compiler. It looks like _address is a uint8_t so we'd want TAG_AND_TIME_REQUEST to be a uint8_t. There are a couple ways to fix it. It's been a while, but I think you can define a constant within a constructor then define the constant when you call the constructor.

edspark commented 5 years ago

Thanks for opening an issue. I've added a fix to that particular warning (commit here: https://github.com/sparkfun/SparkFun_Qwiic_RFID_Arduino_Library/commit/aa01edd2fb1cbd60677c9e718d02a0b7107ea71f) by casting the bytes parameter as uint8_t. This is a separate issue from an unintelligible serial data your reported. I've uploaded example three and it seems to be working fine. Let me know what you're seeing now that the compiler warning has been addressed.

EEphdNPS commented 5 years ago

The warning is fixed, but you're right my issue is different. I can't get it to work. With example 1, I'm not getting anything useful over the serial monitor. I get mostly a "?" or two. Sometimes other odd characters.

edspark commented 5 years ago

Did you check that the baud rate in the serial monitor is set to 115200?

EEphdNPS commented 5 years ago

The easiest answer is usually the right one.

edspark commented 5 years ago

It happened so often to me, that I never rule it out. 👍