ftduino icon indicating copy to clipboard operation
ftduino copied to clipboard

Scratch3] Input hat seems to be broken

Open intrigus opened this issue 4 years ago • 6 comments

Used scratch file:

image

Expected behaviour:

I drag the input hat to the stage. When I press the green flag the (hypothetical) code after the hat is exectued.

Actual behaviour:

As soon as I begin to drag the hat to the stage an exception is thrown.

Error:

lib.min.js:270125 Uncaught (in promise) TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at Scratch3FtduinoBlocks.parse (lib.min.js:270125)
    at serial.Port.port.onReceive (lib.min.js:270200)
    at lib.min.js:269660
parse @ lib.min.js:270125
port.onReceive @ lib.min.js:270200
(anonymous) @ lib.min.js:269660
Promise.then (async)
readLoop @ lib.min.js:269659
(anonymous) @ lib.min.js:269662
Promise.then (async)
readLoop @ lib.min.js:269659
(anonymous) @ lib.min.js:269685
Promise.then (async)
serial.Port.connect @ lib.min.js:269684
connect @ lib.min.js:270179
(anonymous) @ lib.min.js:270233
Promise.then (async)
autoConnect @ lib.min.js:270226
Scratch3FtduinoBlocks @ lib.min.js:269853
loadExtensionURL @ lib.min.js:265657
handleItemSelect @ lib.min.js:328425
wrapper @ lib.min.js:71256
handleSelect @ lib.min.js:316886
wrapper @ lib.min.js:71256
handleClick @ lib.min.js:329111
wrapper @ lib.min.js:71256
callCallback @ lib.min.js:83398
invokeGuardedCallbackDev @ lib.min.js:83437
invokeGuardedCallback @ lib.min.js:83294
invokeGuardedCallbackAndCatchFirstError @ lib.min.js:83308
executeDispatch @ lib.min.js:83692
executeDispatchesInOrder @ lib.min.js:83711
executeDispatchesAndRelease @ lib.min.js:83812
executeDispatchesAndReleaseTopLevel @ lib.min.js:83823
forEachAccumulated @ lib.min.js:83791
processEventQueue @ lib.min.js:83968
runEventQueueInBatch @ lib.min.js:86463
handleTopLevel @ lib.min.js:86472
handleTopLevelImpl @ lib.min.js:86203
batchedUpdates @ lib.min.js:93938
batchedUpdates @ lib.min.js:85186
dispatchEvent @ lib.min.js:86277

image

intrigus avatar Sep 22 '19 18:09 intrigus

Which version did you use? The "offline" version or the online version available at https://harbaum.github.io/ftduino/webusb/scratch3/ ?

The current online version works for me. If it still fails for you please report which version you use on which OS and which browser you are using.

Edit. Ok, from the screenshot you seem to be using the online version. However, for me the hat works as expected. So please retry with the current version.

harbaum avatar Oct 17 '19 07:10 harbaum

It still fails for me. In the console I can still see the exception despite the scratch ui looking normal. Google Chrome: Version 77.0.3865.120 (Offizieller Build) (64-Bit) OS: Linux debian 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3.1 (2019-02-19) x86_64 GNU/Linux

intrigus avatar Oct 17 '19 15:10 intrigus

Still not reproducible here on Ubuntu 18.04 and Chromium 77.0.3865.90

I open the url in chromium with the ftduino already connected, select the ftDuino extension, drag the hat into the main area ... and it just works ...

harbaum avatar Oct 18 '19 07:10 harbaum

Ah ... i see. I can trigger that problem by clicking the hat. Otherwise it just works as expected. But when clicking it something goes wrong.

harbaum avatar Oct 18 '19 08:10 harbaum

Please try again ... The fact that HATs in scratch don't support promises really doesn't make asynchronous USB io easier to deal with ....

harbaum avatar Oct 18 '19 11:10 harbaum

For reference. This is related to https://github.com/LLK/scratch-vm/issues/2129 and the fact that HATs don't support async processing which requires a lot of nasty hacks.

harbaum avatar Oct 18 '19 11:10 harbaum