stoduk / PingSerial

Arduino library for using serial enabled ultrasonic distance modules (eg. US-100)
MIT License
16 stars 9 forks source link

Library Examples don't show in Arduino Ide 2 #12

Open ve3sjk opened 1 month ago

ve3sjk commented 1 month ago

I added the library to the library folder for Arduino IDE 2 and the examples never show up in the examples list.

stoduk commented 1 month ago

I'll need a lot more info to be able to help.

Either this is user error or they've changed what is expected from a library to work with the latest IDE

ve3sjk commented 1 month ago

It does not work in Arduino IDE 1.8.15 or Arduino IDE 2.3.2 under Win10 Ent.

I unzipped the file into the "library folder" of each ide installation as i do with all others, i also remove the -master on the tittle but have tried it both ways.

Always restart ide after installation.

Seems that the files don't conform to the new standareds for ide 18 or ide2.0

stoduk commented 1 month ago

have you tried to install a similar library in the same way and found it works? If so, please give details of which library and the version

If you know of a change required to libraries to work with newer IDE versions then send details. I wrote this donkeys years ago (8, it looks like) so probably not a great shock something underlying eventually changed to break it! I'll only fix it if there is demand - and TBH if someone else is keen to have it then I'm happy to accept patches to fix it to save me having to do it!

ve3sjk commented 1 month ago

I got arduino 2 to see the examples by doing the following.

Change the library.properties file to this, but it needs the valid email for the author where it says.

name=PingSerial version=1.0.0 author=Anthony Toole maintainer=Anthony Toole "authors email here inside less than and greater than symbols" sentence=Arduino library for using serial enabled ultrasonic distance modules (eg. US-100) paragraph=Arduino library for using serial enabled ultrasonic distance modules (eg. US-100) category=Communication url=https://github.com/stoduk/PingSerial architectures=*

I also changed the keywords.txt file to look like this with no spaces just tabs

#######################################

Datatypes (KEYWORD1)

#######################################

PingSerial KEYWORD1

#######################################

Methods and Functions (KEYWORD2)

#######################################

begin KEYWORD2 data_available KEYWORD2 get_distance KEYWORD2 get_temperature KEYWORD2 request_distance KEYWORD2 request_temperature KEYWORD2 display_debugging KEYWORD2

Then under the examples folder you need to create a folder for each ino file that matches the tittle of the ino file in which case it now has one folder called PingSerialDistance and another PinSerialDistanceTemperature with the corresponding ino files in each.

This gets the examples up in Ardiuno Ide 2 but now there is an issue with the "softwareserial", i had to add the line to the .h file but also had to add the espsoftwareserial library as well since i am working with and ESP32 chip.

The example don't compile due to the fact that the espsoftware serial does not have the matching functions used in the pingserial library. I tired using the latest version of espsoftwareserial installed using the library manager and the oldest avail version 5 and neither will compile.

Will need to dig into the cpp file and see what need to be changed in the calls using software serial as that is what i need since i have two of the sensors reading water tank levels.

Moving to the latest version of espsofware serial which is 8.1.0 these are the errors thrown after complile

`c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.cpp: In member function 'byte PingSerial::data_available()': c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.cpp:162:86: error: no matching function for call to 'max(long unsigned int, uint16_t&)' _max_op_duration_ms = max(millis() - _op_started, _max_op_duration_ms); ^ In file included from c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\algorithm:62, from C:\Users\sysop\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\cores\esp32/Arduino.h:172, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\EspSoftwareSerial\src/circular_queue/circular_queue.h:24, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\EspSoftwareSerial\src/SoftwareSerial.h:25, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.h:13, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.cpp:7: c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algo.h:3468:5: note: candidate: 'template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare)' max(initializer_list<_Tp> l, _Compare comp) ^~~ c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algo.h:3468:5: note: template argument deduction/substitution failed: c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.cpp:162:86: note: mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int' _max_op_duration_ms = max(millis() - _op_started, _max_op_duration_ms); ^ In file included from c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\algorithm:62, from C:\Users\sysop\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\cores\esp32/Arduino.h:172, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\EspSoftwareSerial\src/circular_queue/circular_queue.h:24, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\EspSoftwareSerial\src/SoftwareSerial.h:25, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.h:13, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.cpp:7: c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algo.h:3462:5: note: candidate: 'template _Tp std::max(std::initializer_list<_Tp>)' max(initializer_list<_Tp> l) ^~~ c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algo.h:3462:5: note: template argument deduction/substitution failed: c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.cpp:162:86: note: mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int' _max_op_duration_ms = max(millis() - _op_started, _max_op_duration_ms); ^ In file included from c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\algorithm:61, from C:\Users\sysop\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\cores\esp32/Arduino.h:172, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\EspSoftwareSerial\src/circular_queue/circular_queue.h:24, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\EspSoftwareSerial\src/SoftwareSerial.h:25, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.h:13, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.cpp:7: c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algobase.h:265:5: note: candidate: 'template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' max(const _Tp& a, const _Tp& b, _Compare __comp) ^~~ c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algobase.h:265:5: note: template argument deduction/substitution failed: c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.cpp:162:86: note: deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'uint16_t' {aka 'short unsigned int'}) _max_op_duration_ms = max(millis() - _op_started, _max_op_duration_ms); ^ In file included from c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\algorithm:61, from C:\Users\sysop\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\cores\esp32/Arduino.h:172, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\EspSoftwareSerial\src/circular_queue/circular_queue.h:24, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\EspSoftwareSerial\src/SoftwareSerial.h:25, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.h:13, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.cpp:7: c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algobase.h:219:5: note: candidate: 'template const _Tp& std::max(const _Tp&, const _Tp&)' max(const _Tp& a, const _Tp& b) ^~~ c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algobase.h:219:5: note: template argument deduction/substitution failed: c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.cpp:162:86: note: deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'uint16_t' {aka 'short unsigned int'}) _max_op_duration_ms = max(millis() - _op_started, _max_op_duration_ms); ^ c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.cpp:195:47: error: no matching function for call to 'max(uint16_t&, int)' _timeout_count = max(_timeout_count, 1); ^ In file included from c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\algorithm:62, from C:\Users\sysop\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\cores\esp32/Arduino.h:172, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\EspSoftwareSerial\src/circular_queue/circular_queue.h:24, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\EspSoftwareSerial\src/SoftwareSerial.h:25, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.h:13, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.cpp:7: c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algo.h:3468:5: note: candidate: 'template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare)' max(initializer_list<_Tp> __l, _Compare comp) ^~~ c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algo.h:3468:5: note: template argument deduction/substitution failed: c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.cpp:195:47: note: mismatched types 'std::initializer_list<_Tp>' and 'short unsigned int' _timeout_count = max(_timeout_count, 1); ^ In file included from c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\algorithm:62, from C:\Users\sysop\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\cores\esp32/Arduino.h:172, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\EspSoftwareSerial\src/circular_queue/circular_queue.h:24, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\EspSoftwareSerial\src/SoftwareSerial.h:25, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.h:13, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.cpp:7: c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algo.h:3462:5: note: candidate: 'template _Tp std::max(std::initializer_list<_Tp>)' max(initializer_list<_Tp> l) ^~~ c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algo.h:3462:5: note: template argument deduction/substitution failed: c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.cpp:195:47: note: mismatched types 'std::initializer_list<_Tp>' and 'short unsigned int' _timeout_count = max(_timeout_count, 1); ^ In file included from c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\algorithm:61, from C:\Users\sysop\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\cores\esp32/Arduino.h:172, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\EspSoftwareSerial\src/circular_queue/circular_queue.h:24, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\EspSoftwareSerial\src/SoftwareSerial.h:25, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.h:13, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.cpp:7: c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algobase.h:265:5: note: candidate: 'template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' max(const _Tp& __a, const _Tp& b, _Compare comp) ^~~ c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algobase.h:265:5: note: template argument deduction/substitution failed: c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.cpp:195:47: note: deduced conflicting types for parameter 'const _Tp' ('short unsigned int' and 'int') _timeout_count = max(_timeout_count, 1); ^ In file included from c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\algorithm:61, from C:\Users\sysop\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\cores\esp32/Arduino.h:172, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\EspSoftwareSerial\src/circular_queue/circular_queue.h:24, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\EspSoftwareSerial\src/SoftwareSerial.h:25, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.h:13, from c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.cpp:7: c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algobase.h:219:5: note: candidate: 'template const _Tp& std::max(const _Tp&, const _Tp&)' max(const _Tp& a, const _Tp& __b) ^~~ c:\users\sysop\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\include\c++\8.4.0\bits\stl_algobase.h:219:5: note: template argument deduction/substitution failed: c:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial\PingSerial.cpp:195:47: note: deduced conflicting types for parameter 'const _Tp' ('short unsigned int' and 'int') _timeout_count = max(_timeout_count, 1); ^

Using library PingSerial at version 1.0.0 in folder: C:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\PingSerial Using library EspSoftwareSerial at version 8.1.0 in folder: C:\Users\sysop\Documents\Arduino 2.0 Esp\libraries\EspSoftwareSerial exit status 1

Compilation error: exit status 1`

ve3sjk commented 1 month ago

I made the file changes as per the other "issue" can't compile for 8266 and it now compiles without errors, i report back if i get it talking to my sensors on software serial before the day is out.

ve3sjk commented 1 month ago

To update the status, i have had two instances running on ESP32 for a couple of days now after the changes and everything is working perfectly using the latest version of the espsoftware serial library installed via the IDE.