Changes to Serial.onData? #488
Replies: 4 comments
-
Posted at 2014-05-23 by Loop +1 |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-05-23 by Kalus Great idea. I suggest to initially add it to the existing Implementation. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-05-23 by DrAzzy This sounds good to me. With the new code, how would it decide when to call the callback? Right now, there's no ambiguity - it calls it after every byte (as I understand). What criteria will it use to decide when to call the callback, if it's receiving data a few bytes at a time. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-05-29 by @gfwilliams To be honest I might just change it right away and make sure I document it well - I think that might cause less trouble than having two changes. Calls will be made if any characters have been received since Espruino was last idle - and then it'll give you all of them in one go - so if Espruino isn't busy, you'll get single characters each time, but if it is then you'll get more. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2014-05-23 by @gfwilliams
I'm considering removing
Serial.onData
and moving to a more coherent node.js-like API. Your code would have been:And I'd like to change to:
I know this will break some stuff, but it'll be faster and more efficient. I'm also planning on adding some stuff at the same time so you'll be able to pipe Serial to other devices (such as files).
What does everyone think?
Beta Was this translation helpful? Give feedback.
All reactions