bsiever / microbit-webusb

WebUSB Utils for Micro:bit
MIT License
29 stars 8 forks source link

DAPjs slow and buggy #5

Closed CaptainCredible closed 11 months ago

CaptainCredible commented 11 months ago

The new version using DAPjs is really slow and buggy. It seems the computer cant parse the messages very fast at all.

Here is an example that works great using your old ubitwebusb.js and a microbit v2.00: https://editor.p5js.org/CaptainCredible/sketches/O4Mgwza8x

Here is an example using the latest version of ubitwebusb.js and DAPjs that struggles to keep up with the same rate of messages and eventually begins to misread messages https://editor.p5js.org/CaptainCredible/sketches/6mia_JTNG

not sure if there is anything you can do with this, but the graph view in the makecode editor seems to work a lot faster than this and has no trouble parsing the messages in time.

bsiever commented 11 months ago

Thanks for the notice @CaptainCredible --- I'll try to look into it. I hadn't noticed any problems like that in my (limited) testing, but I wasn't really trying very high rate things. This time of year I'm pretty busy and will only have limited time to look into it on weekends.

bsiever commented 11 months ago

@CaptainCredible for clarification, do you know if the new version is slow/loses data on both the v2 and the v2.2?

The interface processor changed in the v2.2, which is what motivated the change to DAPjs. I focused most of my testing on a v2.2. I'm curious if there's a difference between the two, which may indicate there's something related to the interface processor to consider.

I wasn't relaly crazy about including DAPjs anyway. Hopefully I can do a little more study and revert to a stand alone library.

CaptainCredible commented 11 months ago

I tested with a v2.00 and 2.20 and both seem to have identical issues. The old standalone library is amazing with v2.00 I have used it both for this drummer robot orchestra controller thingy: https://www.captaincredible.com/MBORCH/ and this guitar hero style game for the same robot drummers with remote controls: https://captaincredible.com/MBOH/

On Wed, 13 Sep 2023 at 15:22, Bill Siever @.***> wrote:

@CaptainCredible https://github.com/CaptainCredible for clarification, do you know if the new version is slow/loses data on both the v2 and the v2.2?

The interface processor changed in the v2.2, which is what motivated the change to DAPjs. I focused most of my testing on a v2.2. I'm curious if there's a difference between the two, which may indicate there's something related to the interface processor to consider.

I wasn't relaly crazy about including DAPjs anyway. Hopefully I can do a little more study and revert to a stand alone library.

— Reply to this email directly, view it on GitHub https://github.com/bsiever/microbit-webusb/issues/5#issuecomment-1717628304, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADCDIFIIJCYSWUQALLJIJ2DX2GXSVANCNFSM6AAAAAA4WKQI2I . You are receiving this because you were mentioned.Message ID: @.***>

bsiever commented 11 months ago

@CaptainCredible First, I love the projects!

Second, I've made some updates and improved the speed quite a bit. If you have time, try out the current commit and let me know if you're still having problems.

In my tests it's a lot faster, but it can still lose data if the callback takes too long. I plan to do some additional testing/analysis as time permits. Perhaps I can improve it a bit more.

CaptainCredible commented 11 months ago

Wow!

This is amazing!

Did a quick test it with this sketch on macOS + chrome and it worked great with both v2.00 and v2.20 https://editor.p5js.org/CaptainCredible/sketches/6mia_JTNG

I will work it into my other projects and let you know if I come across any problems.

Cheers!!

Daniel Lacey / Captain Credible Artist, Musician, Maker University Lecturer at AHO, The Oslo School of Architecture and Design +4792464458 / www.captaincredible.com

On Mon, Sep 18, 2023 at 5:45 AM Bill Siever @.***> wrote:

@CaptainCredible https://github.com/CaptainCredible First, I love the projects!

Second, I've made some updates and improved the speed quite a bit. If you have time, try out the current commit and let me know if you're still having problems.

In my tests it's a lot faster, but it can still lose data if the callback takes too long. I plan to do some additional testing/analysis as time permits. Perhaps I can improve it a bit more.

— Reply to this email directly, view it on GitHub https://github.com/bsiever/microbit-webusb/issues/5#issuecomment-1722714255, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADCDIFIBIQNBDJE6A7KD6ETX267VZANCNFSM6AAAAAA4WKQI2I . You are receiving this because you were mentioned.Message ID: @.***>

bsiever commented 11 months ago

Great! Keep me posted. If I don't hear about any problems, I'll probably create a new release and close this issue in about.a week.

By the way, I have only tested on macOS+Chrome. I'm not sure if/when I'll have time to try Windows (Chrome and Edge).

CaptainCredible commented 11 months ago

I was working the new version into my projects and suddenly i started getting this cryptic error all the time "Bad response for 8 -> 17" I don't know what triggered it, but after triggering it it shows up every time i try to connect, including when trying to use your example [image: image.png] closing chrome completely and reopening fixed it though so no biggie.

Daniel Lacey / Captain Credible Artist, Musician, Maker University Lecturer at AHO, The Oslo School of Architecture and Design +4792464458 / www.captaincredible.com

On Mon, Sep 18, 2023 at 4:39 PM Bill Siever @.***> wrote:

Great! Keep me posted. If I don't hear about any problems, I'll probably create a new release and close this issue in about.a week.

By the way, I have only tested on macOS+Chrome. I'm not sure if/when I'll have time to try Windows (Chrome and Edge).

— Reply to this email directly, view it on GitHub https://github.com/bsiever/microbit-webusb/issues/5#issuecomment-1723579284, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADCDIFMUKNSSZIKZI2IG573X3BMKBANCNFSM6AAAAAA4WKQI2I . You are receiving this because you were mentioned.Message ID: @.***>

CaptainCredible commented 11 months ago

sorry, never mind, it was just me accidentally loading dap.umd.js twice ...

Daniel Lacey / Captain Credible Artist, Musician, Maker University Lecturer at AHO, The Oslo School of Architecture and Design +4792464458 / www.captaincredible.com

On Mon, Sep 18, 2023 at 9:12 PM Daniel Lacey-McDermott < @.***> wrote:

I was working the new version into my projects and suddenly i started getting this cryptic error all the time "Bad response for 8 -> 17" I don't know what triggered it, but after triggering it it shows up every time i try to connect, including when trying to use your example [image: image.png] closing chrome completely and reopening fixed it though so no biggie.

Daniel Lacey / Captain Credible Artist, Musician, Maker University Lecturer at AHO, The Oslo School of Architecture and Design +4792464458 / www.captaincredible.com

On Mon, Sep 18, 2023 at 4:39 PM Bill Siever @.***> wrote:

Great! Keep me posted. If I don't hear about any problems, I'll probably create a new release and close this issue in about.a week.

By the way, I have only tested on macOS+Chrome. I'm not sure if/when I'll have time to try Windows (Chrome and Edge).

— Reply to this email directly, view it on GitHub https://github.com/bsiever/microbit-webusb/issues/5#issuecomment-1723579284, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADCDIFMUKNSSZIKZI2IG573X3BMKBANCNFSM6AAAAAA4WKQI2I . You are receiving this because you were mentioned.Message ID: @.***>

bsiever commented 11 months ago

Thanks for the update...I encountered that message once with older micro:bits (V1), but not V2, and only when flooding with data. Let me know if you encounter it again, especially if it's under "non-flooding" circumstances.

bsiever commented 11 months ago

I think this has been resolved and a new release has been made (https://github.com/bsiever/microbit-webusb/releases/tag/v1.1.0). Please re-open or open a new issue as needed.