platformio / platformio-pkg-framework-arduinosam

Please forward all issues to https://github.com/platformio/platform-atmelsam
3 stars 15 forks source link

No `Adafruit_USBD_CDC ::dtr()` method breaks exising code #13

Closed terrillmoore closed 5 years ago

terrillmoore commented 5 years ago

Existing code uses Serial.dtr() as a way to avoid a huge delay when checking ! Serial on USB ports-- the old BSP had a blocking millisecond delay every time ! Serial was invoked. The new library doesn't provide a SerialUSB::dtr() method, and therefore old code no longer compiles. This causes CI to fail for libraries which use the Serial.dtr() idiom as a way to check connectivity (avoiding the delay).

ivankravets commented 5 years ago

Hi Terry,

You can downgrade Adafruit core. See releases https://github.com/platformio/platform-atmelsam/releases

So, just use platform = atmelsam@<3.8.0.

terrillmoore commented 5 years ago

Thanks Ivan -- I'm fixing the calling place in our code to use SFINAE to detect the situation and fall back to !! Serial; but others may run into this, so it's good to have a statement of how to fall back. "Search is our friend".

terrillmoore commented 5 years ago

The specific library problem is https://github.com/mcci-catena/arduino-lorawan/issues/118. The SFINAE workaround is in commit https://github.com/mcci-catena/arduino-lorawan/commit/02134194faa745861cc7c8d2f30829f876f431b3. I think this is still possibly an unintended consequence of the BSP update; but feel free to close this if you think this is not a problem to be fixed here.

ivankravets commented 5 years ago

Our mission is to support the latest stable software and we do these updates often. To avoid conflicts when some project depends on the old API, we provide an option to link projects with specific dev/platform version. In this case, the only specified version of the framework will be used. New updates to dev/platform will not affect these fixed projects to the oldest version.

This is actually the of cool features which PlatformIO provides. It allows developers to have isolated environments with different versions of toolchains, frameworks, etc. You can even mix them in the same platformio.ini. For example,


[env:develop]
# the latest version will be used for development purpose
platform = someplatform

[env:release]
platform = someplatform@~1.2.3