-
• #2
+1
-
• #3
Great idea. I suggest to initially add it to the existing Implementation.
Buffersize @ .Setup ?
Some builds later you could remove the old.
I guess you would also add 'error' and/or 'break' later, right ? -
• #4
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.
-
• #5
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.
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?