Closed JonGordon123 closed 1 year ago
Sounds like you may be running into issues similar to #11
Maybe try out one of these options to work around the SoftwareSerial library issue:
Also, don't forget about the logic-level conversion for the hardware.
I disagree.
This is obviously not an issue with the SoftwareSerial library but an issue of return types. Both of these functions are non-void, yet they have an execution path with no return value. This, as per the C++ standard, results in undefined behavior, which only incidentally does not crash most embedded boards.
It's possible Jon's interpretation of what should be returned is wrong - I'm not sure of the intent behind some of these return values either - but something needs to be returned. Otherwise, RFID::begin()
might as well be void
.
@asendotsinski Nice catch, thanks for pointing that issue as well. The return mismatch is might be new, I could have sworn that the serial libraries used to return a bool
.
For now, I would recommend users follow the example hardware setup in the hookup guide to avoid potential logic-level and power issues. The example still seems to compile with the Arduino AVR core (i.e. for boards like the Arduino Uno).
Compiling libraries...
Compiling library "SparkFun Simultaneous RFID Tag Reader Library"
"C:\\Users\\<username>\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Users\\<username>\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\<username>\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\standard" "-Ic:\\Users\\<username>\\Documents\\Arduino\\libraries\\SparkFun_Simultaneous_RFID_Tag_Reader_Library\\src" "c:\\Users\\<username>\\Documents\\Arduino\\libraries\\SparkFun_Simultaneous_RFID_Tag_Reader_Library\\src\\SparkFun_UHF_RFID_Reader.cpp" -o "C:\\Users\\<username>\\AppData\\Local\\Temp\\arduino-sketch-0AC93B035618789504040DCC686C1B6A\\libraries\\SparkFun_Simultaneous_RFID_Tag_Reader_Library\\SparkFun_UHF_RFID_Reader.cpp.o"
c:\Users\<username>\Documents\Arduino\libraries\SparkFun_Simultaneous_RFID_Tag_Reader_Library\src\SparkFun_UHF_RFID_Reader.cpp: In member function 'bool RFID::begin(Stream&)':
c:\Users\<username>\Documents\Arduino\libraries\SparkFun_Simultaneous_RFID_Tag_Reader_Library\src\SparkFun_UHF_RFID_Reader.cpp:55:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
c:\Users\<username>\Documents\Arduino\libraries\SparkFun_Simultaneous_RFID_Tag_Reader_Library\src\SparkFun_UHF_RFID_Reader.cpp: In member function 'void RFID::printMessageArray()':
c:\Users\<username>\Documents\Arduino\libraries\SparkFun_Simultaneous_RFID_Tag_Reader_Library\src\SparkFun_UHF_RFID_Reader.cpp:891:20: warning: comparison is always false due to limited range of data type [-Wtype-limits]
if (amtToPrint > MAX_MSG_SIZE)
c:\Users\<username>\Documents\Arduino\libraries\SparkFun_Simultaneous_RFID_Tag_Reader_Library\src\SparkFun_UHF_RFID_Reader.cpp: In member function 'uint8_t RFID::parseResponse()':
c:\Users\<username>\Documents\Arduino\libraries\SparkFun_Simultaneous_RFID_Tag_Reader_Library\src\SparkFun_UHF_RFID_Reader.cpp:754:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
Compiling core...
I'll pass this issue over to the engineering team to test the EspSoftwareSerial library, add it as a dependecy for Espressif boards, and fix the return mismatch.
Notes:
README
and hookup guide would need to be updated.
Board: Sparkfun ESP32 Thing Plus Arduino: 1.8.19 Library: 1.0.7 Example Code: Example1_HardwareSerial_Constant_Read.ino (Using Serial2 instead of Serial5)
Made the following changes in SparkFun_UHF_RFID_Reader.cpp, and the compiler stopped complaining.
Added "return true;" after line 52 (not sure if this is the best idea, but it works.... not sure what it is actually supposed to be returning)
and, added "return (RESPONSE_IS_UNKNOWN);" after line 709