-
-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is no backward compatibility of V2 #817
Comments
This is the reason for release versions, renaming the library is not necessary or warranted, just use the release that works for you. |
Are you using Platformio for dependency management? Might be worth locking to major versions for libraries that implement semantic versioning as most do these days. A lot of libraries implement backwards incompatible changes at major version increments. The uplift for NimBLE-Arduino 2.x was nothing compared to ArduinoJSON 7.x |
A main issue is that V1 functions compile without a warning with version V2 but do not function anymore. |
@ednieuw That was surprising to hear so I had to have a look for myself. It is indeed possible to change the version of the library used in Arduino IDE 2.0: |
@h2zero Unfortunately you can not lock a library version to a sketch in the Arduino IDE. An upgrade to NimBLE V2 is possible but many of my sketches, also used by other people, are using the NimBLE library. I tried to copy to 1.4.3 library to my sketch folder and "#include "NimBLE-Arduino\src\NimBLEDevice.h" but then many header files can not be found.
|
That is unfortunate indeed, but you can switch back and forth depending on the project you're working on.
The changes required to use v2.x should not be too burdensome.
Not sure how I would go about including a warning, and I'm sure most users would not appreciate a compiler warning every time they build their projects.
You would have to copy just the src folder to your sketch folder for this to possibly build due to the include paths. |
The compiler warning can just be a comment to upgrade. Then there is some kind of warning. Is it possible to overload the depreciated functions? I now apply the same approach to the Arduino Nano ESP32 version 2.0.18, supported by Arduino, and the Espressif core 3.0.7, which support new features.
Ah, that works. You have to place the contents of the src folder beside the ino sketch. That is too messy for me; too many tabs in the IDE and files in my sketch folder. |
This seems like a major oversight in the Arduino IDE rather than an issue with this library. Semantic versioning is pretty standard — it’s wild that there isn’t a way to lock to a specific version - major or minor - given the possibility for any of your dependencies to make incompatible changes even between revisions. Have you considered switching to a better IDE such as Platformio? |
Yes, several times. But there is so much installed I loose control what's happening. The people I write my software for are often not very experienced programmers. More builders of machines, soldering electronics and so on. The Arduino IDE is because of its simplicity preferable to use and to help with. |
I would recommend in this case that the users and the code be updated to use v2. That said there are some new config options in v2 that you can use to check the existence of and know that v2 is in use.
|
Thanks. |
My proposal is to allow conditional compilation by adding some defines to a library header, for example: // @file NimBLEVersion.h
#define H2ZERO_NIMBLE_MAJOR_VERSION 2
#define H2ZERO_NIMBLE_MINOR_VERSION 1 I know, this requires manual updating before each release, but maybe GitHub Actions could automate this. |
The new release is not backward compatible with V1 and does not raise any warning when compiling with the new version. Functions compile without warning but simply do not work anymore.
User of my sketches complain Bluetooth is not working after an new upload because they automatically upgraded their library versions.
I can of course fork V1.4.3 and rename the library but then I have to change all my sketches I made the last years. That will cause a lot of unexpected work.
Please rename the V2 NimBLE library to NimBLE2 or similar and replace 1.4.3 in the NimBLE library as Version 3.0 so the original NimBLE library automatically use V1 again.
The text was updated successfully, but these errors were encountered: