Hi all,
With arduino-1.6.3 and Teensyduino 124 the return value of calls usb_serial_write() is -1 on error and 0 on success. This matches what it says here: https://www.pjrc.com/teensy/usb_serial.html
Now I've upgraded to arduino-1.8.4 and Teensyduino 139. I saw my Teensy code behave badly because the return value of usb_serial_write() has been changed (I tested for error by checking ret!=0 in stead of ret==-1). The function still yields -1 on error but on success it now yields the number of bytes passed to the method. So the documentation for usb_serial_write() on https://www.pjrc.com/teensy/usb_serial.html is incorrect.
On https://www.pjrc.com/teensy/td_download.html I see under Version 1.36: "Hardware serial write() compatibility fix". I assume that's the change I'm seeing. Are there a more detailed release notes available? That would have saved me some debugging.
Another thing. Would it be possible to have the arduino/teensyduino version numbers available somewhere in a header file? That would allow one to work around incompatible changes between versions.
With arduino-1.6.3 and Teensyduino 124 the return value of calls usb_serial_write() is -1 on error and 0 on success. This matches what it says here: https://www.pjrc.com/teensy/usb_serial.html
Now I've upgraded to arduino-1.8.4 and Teensyduino 139. I saw my Teensy code behave badly because the return value of usb_serial_write() has been changed (I tested for error by checking ret!=0 in stead of ret==-1). The function still yields -1 on error but on success it now yields the number of bytes passed to the method. So the documentation for usb_serial_write() on https://www.pjrc.com/teensy/usb_serial.html is incorrect.
On https://www.pjrc.com/teensy/td_download.html I see under Version 1.36: "Hardware serial write() compatibility fix". I assume that's the change I'm seeing. Are there a more detailed release notes available? That would have saved me some debugging.
Another thing. Would it be possible to have the arduino/teensyduino version numbers available somewhere in a header file? That would allow one to work around incompatible changes between versions.