Change in new Teensyduino version breaks existing code

Elmue

Well-known member
Hello Paul

In Teensyduino 1.85 you made a change which breaks exsiting sketch code.
In previous TeensyDuino versions the function Keyboard.send_now() had a bool return value and I wrote in my sketch:

Code:
if (!Keyboard.send_now())
{
     Serial.println("Error pressing USB key");
     return false;
}

This results in a compiler error now because you changed

Code:
bool send_now(void) { return usb_keyboard_send(); }

into

Code:
void send_now(void) { usb_keyboard_send(); }

You also changed usb_keyboard_send() so that it returns integer 0 and -1 instead of true and false as before.

But I cannot see any reason why this return value is not passed through in send_now().

Please think that with this kind of changes you will always break existing code unnecessarily.
 
Hello

Maybe that this has been changed a longer time before 1.85.
I noticed it recently when I updated Teensyduino from an older version.

But the fact stays that this change is unnecessary and breaks existing code.
 
There is no Teensyduino version 1.85. At the rate we're going, currently 1.41 released and 1.42 in beta and about 5 releases per year, we ought to get there around 2026. Well, except for some major ideas I've had on the back burner for years, which would become version 2.0, if I ever get the time....

There is Arduino 1.8.5. But that's only the IDE, not Teensy's support.
 
FWIW, I do try to maintain backwards compatibility. There have been some exceptions, like the recent updates to USB MIDI support, but those are only done when there's a very compelling reason.
 
I just looked in my very old backups. The very first version of cores/teensy3/usb_keyboard.h came in Teensyduino 1.10. Keyboard.send_now() returned void in that very first version.

That installer supported Arduino versions 0022, 0023, 1.0, 1.0.1 and 1.0.2 (the most recent at the time). The timestamp on the files says that was Nov 6, 2012.
 
Back
Top