ardublockly implementation in modern version of blockly

350 views
Skip to first unread message

michele.0...@gmail.com

unread,
Jul 14, 2023, 10:13:17 AM7/14/23
to Blockly
Hello everyone,
I'm trying to implement the blocks of ardublockly inside my project.
Using its blockly version everything goes well but importing blockly using 
I get these errors in the console:
caught TypeError: Blockly.StaticTyping is not a constructor
    at arduino_compressed.js:8:79
(anonymous) @ arduino_compressed.js:8
logic.js:27 Uncaught ReferenceError: goog is not defined
    at logic.js:27:1
(anonymous) @ logic.js:27
loops.js:27 Uncaught ReferenceError: goog is not defined
    at loops.js:27:1
(anonymous) @ loops.js:27
math.js:27 Uncaught ReferenceError: goog is not defined
    at math.js:27:1
(anonymous) @ math.js:27
text.js:27 Uncaught ReferenceError: goog is not defined
    at text.js:27:1
(anonymous) @ text.js:27
lists.js:27 Uncaught ReferenceError: goog is not defined
    at lists.js:27:1
(anonymous) @ lists.js:27
colour.js:27 Uncaught ReferenceError: goog is not defined
    at colour.js:27:1
(anonymous) @ colour.js:27
variables.js:27 Uncaught ReferenceError: goog is not defined
    at variables.js:27:1
(anonymous) @ variables.js:27
procedures.js:27 Uncaught ReferenceError: goog is not defined
    at procedures.js:27:1
(anonymous) @ procedures.js:27
io.js:15 Uncaught ReferenceError: goog is not defined
    at io.js:15:1
(anonymous) @ io.js:15
map.js:15 Uncaught ReferenceError: goog is not defined
    at map.js:15:1
(anonymous) @ map.js:15
procedures.js:13 Uncaught ReferenceError: goog is not defined
    at procedures.js:13:1
(anonymous) @ procedures.js:13
serial.js:16 Uncaught ReferenceError: goog is not defined
    at serial.js:16:1
(anonymous) @ serial.js:16
servo.js:15 Uncaught ReferenceError: goog is not defined
    at servo.js:15:1
(anonymous) @ servo.js:15
spi.js:13 Uncaught ReferenceError: goog is not defined
    at spi.js:13:1
(anonymous) @ spi.js:13
stepper.js:16 Uncaught ReferenceError: goog is not defined
    at stepper.js:16:1
(anonymous) @ stepper.js:16
time.js:13 Uncaught ReferenceError: goog is not defined
    at time.js:13:1
(anonymous) @ time.js:13
tone.js:14 Uncaught ReferenceError: goog is not defined
    at tone.js:14:1
(anonymous) @ tone.js:14
variables.js:15 Uncaught ReferenceError: goog is not defined
    at variables.js:15:1
(anonymous) @ variables.js:15
arduino.js:13 Uncaught ReferenceError: goog is not defined
    at arduino.js:13:1
(anonymous) @ arduino.js:13
boards.js:12 Uncaught ReferenceError: goog is not defined
    at boards.js:12:1
(anonymous) @ boards.js:12
io.js:12 Uncaught ReferenceError: goog is not defined
    at io.js:12:1
(anonymous) @ io.js:12
lists.js:14 Uncaught ReferenceError: goog is not defined
    at lists.js:14:1
(anonymous) @ lists.js:14
logic.js:11 Uncaught ReferenceError: goog is not defined
    at logic.js:11:1
(anonymous) @ logic.js:11
loops.js:13 Uncaught ReferenceError: goog is not defined
    at loops.js:13:1
(anonymous) @ loops.js:13
map.js:12 Uncaught ReferenceError: goog is not defined
    at map.js:12:1
(anonymous) @ map.js:12
math.js:14 Uncaught ReferenceError: goog is not defined
    at math.js:14:1
(anonymous) @ math.js:14
procedures.js:14 Uncaught ReferenceError: goog is not defined
    at procedures.js:14:1
(anonymous) @ procedures.js:14
serial.js:15 Uncaught ReferenceError: goog is not defined
    at serial.js:15:1
(anonymous) @ serial.js:15
servo.js:14 Uncaught ReferenceError: goog is not defined
    at servo.js:14:1
(anonymous) @ servo.js:14
spi.js:12 Uncaught ReferenceError: goog is not defined
    at spi.js:12:1
(anonymous) @ spi.js:12
stepper.js:12 Uncaught ReferenceError: goog is not defined
    at stepper.js:12:1
(anonymous) @ stepper.js:12
text.js:18 Uncaught ReferenceError: goog is not defined
    at text.js:18:1
(anonymous) @ text.js:18
time.js:12 Uncaught ReferenceError: goog is not defined
    at time.js:12:1
(anonymous) @ time.js:12
tone.js:12 Uncaught ReferenceError: goog is not defined
    at tone.js:12:1
(anonymous) @ tone.js:12
variables.js:11 Uncaught ReferenceError: goog is not defined
    at variables.js:11:1
(anonymous) @ variables.js:11
en.js:5 Uncaught ReferenceError: goog is not defined
    at en.js:5:1
(anonymous) @ en.js:5
workspace.js:62 TypeError: Blockly.Xml.textToDom is not a function
XML: <xml xmlns="https://developers.google.com/blockly/xml"></xml>
s

and as soon as I click somewhere in the toolbox I get these types of errors:
caught TypeError: Invalid block definition for type: time_delay
    at new Block$$module$build$src$core$block (javascript.js:33:14)
    at new BlockSvg$$module$build$src$core$block_svg (javascript.js:33:14)
    at WorkspaceSvg$$module$build$src$core$workspace_svg.newBlock (javascript.js:33:14)
    at domToBlockHeadless$$module$build$src$core$xml (math.js:273:68)
    at $.domToBlock$$module$build$src$core$xml (math.js:273:68)
    at VerticalFlyout$$module$build$src$core$flyout_vertical.createFlyoutBlock (javascript.js:33:14)
    at VerticalFlyout$$module$build$src$core$flyout_vertical.createFlyoutInfo (javascript.js:33:14)
    at VerticalFlyout$$module$build$src$core$flyout_vertical.show (javascript.js:33:14)
    at Toolbox$$module$build$src$core$toolbox$toolbox.updateFlyout_ (javascript.js:33:14)
    at Toolbox$$module$build$src$core$toolbox$toolbox.setSelectedItem (javascript.js:33:14)
Block$$module$build$src$core$block @ javascript.js:33
BlockSvg$$module$build$src$core$block_svg @ javascript.js:33
WorkspaceSvg$$module$build$src$core$workspace_svg.newBlock @ javascript.js:33
domToBlockHeadless$$module$build$src$core$xml @ math.js:273
$.domToBlock$$module$build$src$core$xml @ math.js:273
createFlyoutBlock @ javascript.js:33
createFlyoutInfo @ javascript.js:33
show @ javascript.js:33
updateFlyout_ @ javascript.js:33
setSelectedItem @ javascript.js:33
onClick_ @ javascript.js:33
f @ math.js:171
javascript.js:33 Uncaught TypeError: Invalid block definition for type: io_tone
    at new Block$$module$build$src$core$block (javascript.js:33:14)
    at new BlockSvg$$module$build$src$core$block_svg (javascript.js:33:14)
    at WorkspaceSvg$$module$build$src$core$workspace_svg.newBlock (javascript.js:33:14)
    at domToBlockHeadless$$module$build$src$core$xml (math.js:273:68)
    at $.domToBlock$$module$build$src$core$xml (math.js:273:68)
    at VerticalFlyout$$module$build$src$core$flyout_vertical.createFlyoutBlock (javascript.js:33:14)
    at VerticalFlyout$$module$build$src$core$flyout_vertical.createFlyoutInfo (javascript.js:33:14)
    at VerticalFlyout$$module$build$src$core$flyout_vertical.show (javascript.js:33:14)
    at Toolbox$$module$build$src$core$toolbox$toolbox.updateFlyout_ (javascript.js:33:14)
    at Toolbox$$module$build$src$core$toolbox$toolbox.setSelectedItem (javascript.js:33:14)
B

Thank you in advance

Neil Fraser

unread,
Jul 14, 2023, 10:25:51 AM7/14/23
to blo...@googlegroups.com
Ardublockly is a project that apparently hasn't been updated in 6 years. In the past couple of years Blockly has endured many changes which are not backwards compatible.  Since it's probably infeasible for you to update that repo, the next best suggestion would be to pull down a 6 year old version of Blockly.  Here's one:
That's from 19 July 2017, which is the exact date of the last (meaningful) update of Ardublockly.  And the good news is that back then our repo had pre-compiled binaries included, so you can just download that version and blockly_compressed.js is right there.

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/6981781f-2ecd-4d5a-873e-5fc5e974ab46n%40googlegroups.com.


--
Neil Fraser, Switzerland
https://neil.fraser.name

michele.0...@gmail.com

unread,
Jul 14, 2023, 10:56:13 AM7/14/23
to Blockly
Thank you for the quick answer,
I was trying to update blockly because I encountered huge performance issues when trying to move blocks with open warnings like this one:
immagine_2023-07-14_165412135.png

Could it be a blockly problem (of the older version of course)?
Or is it an ardublockly issue?
How can i discriminate between these two options?
I am running my code using the blockly compressed present in the ardublockly repo

Thank you
Michele

Neil Fraser

unread,
Jul 14, 2023, 12:43:19 PM7/14/23
to blo...@googlegroups.com
Despite the fact that ardublockly advertises that they have forked Blockly, I can't see any evidence of that.  They seem to have simply copied the code and added their own blocks and generators.  That's actually great news.  When I first looked, their use of 'fork' and some misleading GitHub commit history made me assume it would be a nightmare to upgrade in any way.  And while we'd work with a 3rd party project maintainer to upgrade, it would likely be out of scope for a 3rd party project user to manage such an upgrade.

Since their copy of Blockly is apparently unmodified, and you are encountering performance issues, my suggestion would be to do a binary search through the history of our Blockly repo dropping in newer versions of Blockly.  At some point Blockly will become incompatible (most likely around two years ago).  But if you are lucky, the performance issues you see will go away before then.  Should be relatively simple and definitely worth a try.

All you need to test is to swap in new compressed files (*_compressed.js), and if you find a version you like, then copy in the rest of the files.  If you are successful, do submit an update patch to ardublockly.  Let us know if we can help.

michele.0...@gmail.com

unread,
Jul 18, 2023, 4:01:53 AM7/18/23
to Blockly
I tried to update to the latest version before the closure library got removed (2.20190722.1 as far as I understand) but I still get the following errors:

caught TypeError: Blockly.StaticTyping is not a constructor
    at arduino_compressed.js:8:79
arduino.js:24 Uncaught TypeError: Blockly.StaticTyping is not a constructor
    at arduino.js:24:32
blockly_compressed.js:1826 Blockly.Blocks.logic.HUE has been removed. Use Blockly.Msg["LOGIC_HUE"].
Blockly.checkBlockColourConstant_ @ blockly_compressed.js:1826
blockly_compressed.js:1826 Blockly.Blocks.loops.HUE has been removed. Use Blockly.Msg["LOOPS_HUE"].
Blockly.checkBlockColourConstant_ @ blockly_compressed.js:1826
blockly_compressed.js:1826 Blockly.Blocks.math.HUE has been removed. Use Blockly.Msg["MATH_HUE"].
Blockly.checkBlockColourConstant_ @ blockly_compressed.js:1826
blockly_compressed.js:1826 Blockly.Blocks.texts.HUE has been removed. Use Blockly.Msg["TEXTS_HUE"].
Blockly.checkBlockColourConstant_ @ blockly_compressed.js:1826
blockly_compressed.js:1826 Blockly.Blocks.lists.HUE has been removed. Use Blockly.Msg["LISTS_HUE"].
Blockly.checkBlockColourConstant_ @ blockly_compressed.js:1826
blockly_compressed.js:1826 Blockly.Blocks.colour.HUE has been removed. Use Blockly.Msg["COLOUR_HUE"].
Blockly.checkBlockColourConstant_ @ blockly_compressed.js:1826
blockly_compressed.js:1826 Blockly.Blocks.variables.HUE has been removed. Use Blockly.Msg["VARIABLES_HUE"].
Blockly.checkBlockColourConstant_ @ blockly_compressed.js:1826
blockly_compressed.js:1826 Blockly.Blocks.procedures.HUE has been removed. Use Blockly.Msg["PROCEDURES_HUE"].
Blockly.checkBlockColourConstant_ @ blockly_compressed.js:1826

blockly_compressed.js:1669 Uncaught TypeError: Expecting valid order from block: io_analogwrite
    at Blockly.Generator.valueToCode (blockly_compressed.js:1669:75)
    at Blockly.Arduino.io_analogwrite (io.js:89:37)
    at Blockly.Generator.blockToCode (blockly_compressed.js:1667:288)
    at Blockly.Generator.workspaceToCode (blockly_compressed.js:1665:246)
    at workspace.js:85:26
    at Blockly.Workspace.fireChangeListener (blockly_compressed.js:1017:447)
    at Blockly.Events.fireNow_ (blockly_compressed.js:917:374)
loops.js:50 Uncaught TypeError: Cannot read properties of undefined (reading 'NUMBER')
    at Blockly.BlockSvg.init (loops.js:50:34)
    at Blockly.Block (blockly_compressed.js:1430:432)
    at new Blockly.BlockSvg (blockly_compressed.js:1494:163)
    at Blockly.WorkspaceSvg.newBlock (blockly_compressed.js:1317:69)
    at Blockly.Xml.domToBlockHeadless_ (blockly_compressed.js:976:176)
    at Blockly.Xml.domToBlock (blockly_compressed.js:973:237)
    at Blockly.Flyout.show (blockly_compressed.js:1703:151)
    at Blockly.Toolbox.TreeControl.setSelectedItem (blockly_compressed.js:1757:420)
    at goog.ui.tree.BaseNode.select (blockly_compressed.js:788:237)
    at Blockly.Toolbox.TreeNode.onClick_ (blockly_compressed.js:1759:301)
init @ loops.js:50
Blockly.Block @ blockly_compressed.js:1430
Blockly.BlockSvg @ blockly_compressed.js:1494
Blockly.WorkspaceSvg.newBlock @ blockly_compressed.js:1317
Blockly.Xml.domToBlockHeadless_ @ blockly_compressed.js:976
Blockly.Xml.domToBlock @ blockly_compressed.js:973
Blockly.Flyout.show @ blockly_compressed.js:1703
Blockly.Toolbox.TreeControl.setSelectedItem @ blockly_compressed.js:1757
goog.ui.tree.BaseNode.select @ blockly_compressed.js:788
Blockly.Toolbox.TreeNode.onClick_ @ blockly_compressed.js:1759
goog.ui.tree.TreeControl.handleMouseEvent_ @ blockly_compressed.js:878
goog.events.fireListener @ blockly_compressed.js:373
goog.events.handleBrowserEvent_ @ blockly_compressed.js:376
b @ blockly_compressed.js:365
math.js:51 Uncaught TypeError: Cannot read properties of undefined (reading 'NUMBER')
    at Blockly.BlockSvg.init (math.js:51:40)
    at Blockly.Block (blockly_compressed.js:1430:432)
    at new Blockly.BlockSvg (blockly_compressed.js:1494:163)
    at Blockly.WorkspaceSvg.newBlock (blockly_compressed.js:1317:69)
    at Blockly.Xml.domToBlockHeadless_ (blockly_compressed.js:976:176)
    at Blockly.Xml.domToBlock (blockly_compressed.js:973:237)
    at Blockly.Flyout.show (blockly_compressed.js:1703:151)
    at Blockly.Toolbox.TreeControl.setSelectedItem (blockly_compressed.js:1757:420)
    at goog.ui.tree.BaseNode.select (blockly_compressed.js:788:237)
    at Blockly.Toolbox.TreeNode.onClick_ (blockly_compressed.js:1759:301)
init @ math.js:51
Blockly.Block @ blockly_compressed.js:1430
Blockly.BlockSvg @ blockly_compressed.js:1494
Blockly.WorkspaceSvg.newBlock @ blockly_compressed.js:1317
Blockly.Xml.domToBlockHeadless_ @ blockly_compressed.js:976
Blockly.Xml.domToBlock @ blockly_compressed.js:973
Blockly.Flyout.show @ blockly_compressed.js:1703
Blockly.Toolbox.TreeControl.setSelectedItem @ blockly_compressed.js:1757
goog.ui.tree.BaseNode.select @ blockly_compressed.js:788
Blockly.Toolbox.TreeNode.onClick_ @ blockly_compressed.js:1759
goog.ui.tree.TreeControl.handleMouseEvent_ @ blockly_compressed.js:878
goog.events.fireListener @ blockly_compressed.js:373
goog.events.handleBrowserEvent_ @ blockly_compressed.js:376
b @ blockly_compressed.js:365
variables.js:34 Uncaught TypeError: Cannot read properties of undefined (reading 'getValidTypeArray')
    at Blockly.BlockSvg.init (variables.js:34:40)
    at Blockly.Block (blockly_compressed.js:1430:432)
    at new Blockly.BlockSvg (blockly_compressed.js:1494:163)
    at Blockly.WorkspaceSvg.newBlock (blockly_compressed.js:1317:69)
    at Blockly.Xml.domToBlockHeadless_ (blockly_compressed.js:976:176)
    at Blockly.Xml.domToBlockHeadless_ (blockly_compressed.js:978:144)
    at Blockly.Xml.domToBlock (blockly_compressed.js:973:237)
    at Blockly.Flyout.show (blockly_compressed.js:1703:151)
    at Blockly.Toolbox.TreeControl.setSelectedItem (blockly_compressed.js:1757:420)
    at goog.ui.tree.BaseNode.select (blockly_compressed.js:788:237)
init @ variables.js:34
Blockly.Block @ blockly_compressed.js:1430
Blockly.BlockSvg @ blockly_compressed.js:1494
Blockly.WorkspaceSvg.newBlock @ blockly_compressed.js:1317
Blockly.Xml.domToBlockHeadless_ @ blockly_compressed.js:976
Blockly.Xml.domToBlockHeadless_ @ blockly_compressed.js:978
Blockly.Xml.domToBlock @ blockly_compressed.js:973
Blockly.Flyout.show @ blockly_compressed.js:1703
Blockly.Toolbox.TreeControl.setSelectedItem @ blockly_compressed.js:1757
goog.ui.tree.BaseNode.select @ blockly_compressed.js:788
Blockly.Toolbox.TreeNode.onClick_ @ blockly_compressed.js:1759
goog.ui.tree.TreeControl.handleMouseEvent_ @ blockly_compressed.js:878
goog.events.fireListener @ blockly_compressed.js:373
goog.events.handleBrowserEvent_ @ blockly_compressed.js:376
b @ blockly_compressed.js:365
io.js:36 Uncaught TypeError: Cannot read properties of undefined (reading 'BOOLEAN')
    at Blockly.BlockSvg.init (io.js:36:33)
    at Blockly.Block (blockly_compressed.js:1430:432)
    at new Blockly.BlockSvg (blockly_compressed.js:1494:163)
    at Blockly.WorkspaceSvg.newBlock (blockly_compressed.js:1317:69)
    at Blockly.Xml.domToBlockHeadless_ (blockly_compressed.js:976:176)
    at Blockly.Xml.domToBlock (blockly_compressed.js:973:237)
    at Blockly.Flyout.show (blockly_compressed.js:1703:151)
    at Blockly.Toolbox.TreeControl.setSelectedItem (blockly_compressed.js:1757:420)
    at goog.ui.tree.BaseNode.select (blockly_compressed.js:788:237)
    at Blockly.Toolbox.TreeNode.onClick_ (blockly_compressed.js:1759:301)
init @ io.js:36
Blockly.Block @ blockly_compressed.js:1430
Blockly.BlockSvg @ blockly_compressed.js:1494
Blockly.WorkspaceSvg.newBlock @ blockly_compressed.js:1317
Blockly.Xml.domToBlockHeadless_ @ blockly_compressed.js:976
Blockly.Xml.domToBlock @ blockly_compressed.js:973
Blockly.Flyout.show @ blockly_compressed.js:1703
Blockly.Toolbox.TreeControl.setSelectedItem @ blockly_compressed.js:1757
goog.ui.tree.BaseNode.select @ blockly_compressed.js:788
Blockly.Toolbox.TreeNode.onClick_ @ blockly_compressed.js:1759
goog.ui.tree.TreeControl.handleMouseEvent_ @ blockly_compressed.js:878
goog.events.fireListener @ blockly_compressed.js:373
goog.events.handleBrowserEvent_ @ blockly_compressed.js:376
b @ blockly_compressed.js:365
blockly_compressed.js:1669 Uncaught TypeError: Expecting valid order from block: io_analogwrite
    at Blockly.Generator.valueToCode (blockly_compressed.js:1669:75)
    at Blockly.Arduino.io_analogwrite (io.js:89:37)
    at Blockly.Generator.blockToCode (blockly_compressed.js:1667:288)
    at Blockly.Generator.workspaceToCode (blockly_compressed.js:1665:246)
    at workspace.js:85:26
    at Blockly.Workspace.fireChangeListener (blockly_compressed.js:1017:447)
    at Blockly.Events.fireNow_ (blockly_compressed.js:917:374)
Blockly.Generator.valueToCode @ blockly_compressed.js:1669
Blockly.Arduino.io_analogwrite @ io.js:89
Blockly.Generator.blockToCode @ blockly_compressed.js:1667
Blockly.Generator.workspaceToCode @ blockly_compressed.js:1665
(anonymous) @ workspace.js:85
Blockly.Workspace.fireChangeListener @ blockly_compressed.js:1017
Blockly.Events.fireNow_ @ blockly_compressed.js:917
setTimeout (async)
Blockly.Events.fire @ blockly_compressed.js:917
Blockly.Toolbox.TreeControl.setSelectedItem @ blockly_compressed.js:1758
Blockly.Toolbox.clearSelection @ blockly_compressed.js:1751
Blockly.hideChaff @ blockly_compressed.js:1816
Blockly.Gesture.doStart @ blockly_compressed.js:1179
Blockly.TouchGesture.doStart @ blockly_compressed.js:1229
Blockly.Gesture.handleWsStart @ blockly_compressed.js:1187
Blockly.WorkspaceSvg.onMouseDown_ @ blockly_compressed.js:1337
h @ blockly_compressed.js:1819


All the errors are related to the ardublockly code, so it's nothing related to my code.
Do you suggest to revert to a previous version or otherwise to try to correct all the errors?

Again I'm trying to update just because of the lag when a warning opens

Thnk you

michele.0...@gmail.com

unread,
Jul 18, 2023, 5:02:49 AM7/18/23
to Blockly
I just tried to use  1.20180831.0 (the oldest I can find on GitHub) but it still gives me all these errors:


arduino_compressed.js:8 Uncaught TypeError: Blockly.StaticTyping is not a constructor

    at arduino_compressed.js:8:79
(anonymous) @ arduino_compressed.js:8
arduino.js:24 Uncaught TypeError: Blockly.StaticTyping is not a constructor
    at arduino.js:24:32
(anonymous) @ arduino.js:24
blockly_compressed.js:1708 Blockly.Blocks.logic.HUE has been removed. Use Blockly.Msg["LOGIC_HUE"].
Blockly.checkBlockColourConstant_ @ blockly_compressed.js:1708
Blockly.checkBlockColourConstants @ blockly_compressed.js:1705
Blockly.inject @ blockly_compressed.js:1681
start @ workspace.js:55
onload @ index.html:362
blockly_compressed.js:1708 Blockly.Blocks.loops.HUE has been removed. Use Blockly.Msg["LOOPS_HUE"].
Blockly.checkBlockColourConstant_ @ blockly_compressed.js:1708
Blockly.checkBlockColourConstants @ blockly_compressed.js:1705
Blockly.inject @ blockly_compressed.js:1681
start @ workspace.js:55
onload @ index.html:362
blockly_compressed.js:1708 Blockly.Blocks.math.HUE has been removed. Use Blockly.Msg["MATH_HUE"].
Blockly.checkBlockColourConstant_ @ blockly_compressed.js:1708
Blockly.checkBlockColourConstants @ blockly_compressed.js:1705
Blockly.inject @ blockly_compressed.js:1681
start @ workspace.js:55
onload @ index.html:362
blockly_compressed.js:1708 Blockly.Blocks.texts.HUE has been removed. Use Blockly.Msg["TEXTS_HUE"].
Blockly.checkBlockColourConstant_ @ blockly_compressed.js:1708
Blockly.checkBlockColourConstants @ blockly_compressed.js:1706
Blockly.inject @ blockly_compressed.js:1681
start @ workspace.js:55
onload @ index.html:362
blockly_compressed.js:1708 Blockly.Blocks.lists.HUE has been removed. Use Blockly.Msg["LISTS_HUE"].
Blockly.checkBlockColourConstant_ @ blockly_compressed.js:1708
Blockly.checkBlockColourConstants @ blockly_compressed.js:1706
Blockly.inject @ blockly_compressed.js:1681
start @ workspace.js:55
onload @ index.html:362
blockly_compressed.js:1708 Blockly.Blocks.colour.HUE has been removed. Use Blockly.Msg["COLOUR_HUE"].
Blockly.checkBlockColourConstant_ @ blockly_compressed.js:1708
Blockly.checkBlockColourConstants @ blockly_compressed.js:1706
Blockly.inject @ blockly_compressed.js:1681
start @ workspace.js:55
onload @ index.html:362
blockly_compressed.js:1708 Blockly.Blocks.variables.HUE has been removed. Use Blockly.Msg["VARIABLES_HUE"].
Blockly.checkBlockColourConstant_ @ blockly_compressed.js:1708
Blockly.checkBlockColourConstants @ blockly_compressed.js:1706
Blockly.inject @ blockly_compressed.js:1681
start @ workspace.js:55
onload @ index.html:362
blockly_compressed.js:1708 Blockly.Blocks.procedures.HUE has been removed. Use Blockly.Msg["PROCEDURES_HUE"].
Blockly.checkBlockColourConstant_ @ blockly_compressed.js:1708
Blockly.checkBlockColourConstants @ blockly_compressed.js:1707
Blockly.inject @ blockly_compressed.js:1681
start @ workspace.js:55
onload @ index.html:362
3blockly_compressed.js:1193 Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD
Blockly.WorkspaceAudio.preload @ blockly_compressed.js:1193
e @ blockly_compressed.js:1692
h @ blockly_compressed.js:1701

io.js:36 Uncaught TypeError: Cannot read properties of undefined (reading 'BOOLEAN')
    at Blockly.BlockSvg.init (io.js:36:33)
    at Blockly.Block (blockly_compressed.js:1362:6)
    at new Blockly.BlockSvg (blockly_compressed.js:1418:142)
    at Blockly.WorkspaceSvg.newBlock (blockly_compressed.js:1267:146)
    at Blockly.Xml.domToBlockHeadless_ (blockly_compressed.js:1235:176)
    at Blockly.Xml.domToBlock (blockly_compressed.js:1232:237)
    at Blockly.Flyout.show (blockly_compressed.js:1599:135)
    at Blockly.Toolbox.TreeControl.setSelectedItem (blockly_compressed.js:1648:420)
    at goog.ui.tree.BaseNode.select (blockly_compressed.js:802:237)
    at Blockly.Toolbox.TreeNode.onClick_ (blockly_compressed.js:1650:301)
init @ io.js:36
Blockly.Block @ blockly_compressed.js:1362
Blockly.BlockSvg @ blockly_compressed.js:1418
Blockly.WorkspaceSvg.newBlock @ blockly_compressed.js:1267
Blockly.Xml.domToBlockHeadless_ @ blockly_compressed.js:1235
Blockly.Xml.domToBlock @ blockly_compressed.js:1232
Blockly.Flyout.show @ blockly_compressed.js:1599
Blockly.Toolbox.TreeControl.setSelectedItem @ blockly_compressed.js:1648
goog.ui.tree.BaseNode.select @ blockly_compressed.js:802
Blockly.Toolbox.TreeNode.onClick_ @ blockly_compressed.js:1650
goog.ui.tree.TreeControl.handleMouseEvent_ @ blockly_compressed.js:867
goog.events.fireListener @ blockly_compressed.js:437
goog.events.handleBrowserEvent_ @ blockly_compressed.js:440
b @ blockly_compressed.js:429
blockly_compressed.js:1441 Uncaught TypeError: Cannot read properties of null (reading 'removeChild')
    at Blockly.BlockSvg.dispose (blockly_compressed.js:1441:173)
    at Blockly.Flyout.clearOldBlocks_ (blockly_compressed.js:1601:145)
    at Blockly.Flyout.show (blockly_compressed.js:1598:98)
    at Blockly.Toolbox.TreeControl.setSelectedItem (blockly_compressed.js:1648:420)
    at goog.ui.tree.BaseNode.select (blockly_compressed.js:802:237)
    at Blockly.Toolbox.TreeNode.onClick_ (blockly_compressed.js:1650:301)
    at goog.ui.tree.TreeControl.handleMouseEvent_ (blockly_compressed.js:867:266)
    at goog.events.fireListener (blockly_compressed.js:437:126)
    at goog.events.handleBrowserEvent_ (blockly_compressed.js:440:231)
    at HTMLDivElement.b (blockly_compressed.js:429:190)
Blockly.BlockSvg.dispose @ blockly_compressed.js:1441
Blockly.Flyout.clearOldBlocks_ @ blockly_compressed.js:1601
Blockly.Flyout.show @ blockly_compressed.js:1598
Blockly.Toolbox.TreeControl.setSelectedItem @ blockly_compressed.js:1648
goog.ui.tree.BaseNode.select @ blockly_compressed.js:802
Blockly.Toolbox.TreeNode.onClick_ @ blockly_compressed.js:1650
goog.ui.tree.TreeControl.handleMouseEvent_ @ blockly_compressed.js:867
goog.events.fireListener @ blockly_compressed.js:437
goog.events.handleBrowserEvent_ @ blockly_compressed.js:440
b @ blockly_compressed.js:429

Neil Fraser

unread,
Jul 18, 2023, 9:02:53 AM7/18/23
to blo...@googlegroups.com
Aha, there are modifications to the Blockly core library in that project.  These files are not ours:
Also, I notice that "Blockly.Types" has been added to several block definition files, such as:

I don't know if those are the only lurking changes or not.  There doesn't seem to be any log to indicate what changes the maintainers made to Blockly.  Their initial checkin of Blockly came with the above-mentioned modifications.  Are the maintainers of that project still responsive?

Christopher Allen

unread,
Jul 18, 2023, 9:58:20 AM7/18/23
to blo...@googlegroups.com
Hi Michele,

I see that Neil has beaten me to a reply, but as I'd already written most of the below I thought I should send it along too.

I was curious about this so I did a bit of digging.

I just tried to use  1.20180831.0 (the oldest I can find on GitHub)

A great place to start—but I should note that that is the earliest recorded release on GitHub, but I'm pretty sure that's just because we didn't have a formal release process before that.  You can find every previous version of Blockly back to 2014 (when it was moved from Google Code to GitHub) by working your way back through the commit history.
 
but it still gives me all these errors:


arduino_compressed.js:8 Uncaught TypeError: Blockly.StaticTyping is not a constructor
    at arduino_compressed.js:8:79

I was curious about this because I've not heard of Blockly.StaticTyping before, and I couldn't find any reference to it in the Blockly repository, so I went digging.  Looking through the GitHub history for ardublockly, it's pretty clear that the earliest version checked-in was already pretty developed; there is no history of how it developed as a fork of Blockly, so I thought I would at least try to figure out where in Blockly's history it had been forked.  Here's how I did that:
  1. I cloned the Ardublockly repository locally and checked out the earliest recorded commit, b06e8f4, made on May 11 2017.
  2. I found a pull request in the Blockly repository from roughly around the same time (PR #1000, merged as b0856b8 on March 23rd 2017), and checked out that commit in my local Blockly repository.

  3. Using meld (but any diff will do), I compared the two repositories.

  4. Looking at core/block.js, it was clear that some of the differences were due to additions made by Ardublockly, and some were due to commits made in the Blockly repository after Ardublockly was forked.

  5. Looking at one of the made-by-Blockly changes, I looked at the blame for that line and used the "view blame prior to this change" button to rewind to the commit before that change was made.

  6. I then checked out that version of Blockly locally.

  7. Then I repeated steps 3–6 until all the remaining changes I could see looked like they were made by Arudblockly rather than us.

That took me to Blockly commit 28188d8bf, made on April 9, 2016.  Checking the change in that commit, I could see that it had been made to Ardublockly, so I am therefore pretty sure that Ardublockly's copy of Blockly is forked from Blockly commit 28188d8bf.

It turns out that there are some fairly substantial modifications made between Blockly@28188d8bf and Ardublockly@b06e8f4, including the addition of all of (all in blockly/core/:) field_instance.js, instance.js, static_typing.js, type.js, and types.js, in addition to quite a number of changes to other files.

So it looks like Ardublockly really did fork blockly, not just make some trivial additions to the blocks and generators.

If you want to update Blockly within Ardublockly you're going to have to figure out how to port those changes to a newer version.  But what version?
  • The basic organisation of Blockly didn't change too much between 2016 and summer of 2021, when the long migration to TypeScript began.  It should be reasonably easy to update to the last pre-migration version, v6.20210701.0—but on the other hand this will leave you stuck without an easy path forward if you wanted to do further updates of Blockly.
  • If you want all the latest features and the ability to keep updating Blockly as we release new versions, you're eventually going to need to update to the current version (v10.0.2 as of yesterday).  That will be more difficult because Blockly is now written in TypeScript instead of Closure-flavoured JavaScript and uses a completely different module system; as a result the easy path is probably to reimplement Ardublockly using Blockly v10.  Ideally this should be done using an unmodified copy of the Blockly NPM:
    • The changes in blocks/ and generators/, and the addition of a new field type definitely don't require forking Blockly, since we have well documented ways of creating custom fields, blocks and generators.
    • Similarly, several of Ardublockly's changes are simple configuration constant adjustments.
    • The other changes Ardublockly made in core/, however, are potentially more challenging to deal with.  I've only skimmed them, but it looks like they have to do with creating statically typed variables and values; since Blockly now has some support for typed variables it may now be possible to use our implementation instead.
Either way you'll also need to make changes to the other parts of Ardublockly (outside of the blockly/ subdirectory) to adjust to various API changes made in Blockly.

If you opt to update to v6, there are two approaches you could use:
  1. Use git to apply changes made to Blockly after commit 28188d8bf to the blockly/ subdirectory of Ardublockly.  Looking at the earliest version of the README.md file for Ardublockly I see that it had originally made use of git submodules to track changes in Blockly, but even by this first commit the README seems to be out of date.  Still, with sufficient knowledge of git and enough patience it should be possible to get this set up and then gradually apply all 4909 commits we made to Blockly between 28188d8bf and 6.20210701.0.
  2. You could manually, or using diff+patch (and some manual fix-up), directly apply the Ardublockly changes to Blockly v6.20210701.0.  Given that most of the changes are trivial this will probably be faster, but fixing any incompatibility will be harder since you won't have the relevant Blockly history immediately to hand.
In any case you will want to study and fully understand the changes made between Blockly@28188d8bf and Ardublockly@b06e8f4 before diving into this project too deeply.

Unfortunately we don't have the capacity to help you with such a large undertaking, but we will still do our best to answer any specific questions you might have about how to do things in modern versions of Blockly (at least where the answer is not already well-documented).

For instance:

(anonymous) @ arduino.js:24
blockly_compressed.js:1708 Blockly.Blocks.logic.HUE has been removed. Use Blockly.Msg["LOGIC_HUE"].

This is pretty straight-forward: it used to be that the colour (HUE, in particular) of blocks in each cateogry was specified by a configuration constant Blockly.<category>.HUE, but later this was changed so that they could be localised (since different colours have different meanings in different cultures), so at the time this version of Blockly was created the hues were set via Blockly.Msg["<category>_HUE"] instead.


Best wishes,

Christopher

michele.0...@gmail.com

unread,
Jul 18, 2023, 12:04:09 PM7/18/23
to Blockly
Thank you for your commitment from both of you,
I'm more of an electronics guy and so I sadly don't have the skill and the time to try what you suggested, this issue came to me as I am trying to make a webpage that eases the programming of an Arduino connected to a particular shield I designed to communicate to a LIN network (automotive stuff) so it isn't even my main job and I cnnot invest too much time in this activity.

Having said that I would ask to anyone who could help me to understand if I may have some major issues in the future using the old version of blockly which Ardublockly implements, and if anyone could help me analyze the single issue I encountered up to now (the slowing of the page when opening a warning).

If you want to reproduce the error, you can download Ardublockly and put an analogwrite block (from  Input/Output group in the toolbox) with a value higher than 255

Thank you

Michele

Neil Fraser

unread,
Jul 18, 2023, 1:36:20 PM7/18/23
to blo...@googlegroups.com
There are a couple of alternative Arduino-Blockly projects:


They both appear to be three years old, but at least that's more recent than six.  Would either of these work for you?

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.

Mario Pesch

unread,
Jul 19, 2023, 2:28:58 AM7/19/23
to Blockly
Hi Michele, 

we used the original ardublockly for several years in our project and did some update, but at some point it was like Neil said a real struggle to keep it updated. 

We did a complete rewrite of Arduino Blockly for our Project in React. 


It might be a starting point for your work?!

Seb Seb

unread,
Jul 19, 2023, 6:50:57 AM7/19/23
to Blockly
Hi,
thanks for sharing your React-Ardublockly, it's great!!!! Really well done.
I think that all "Blockly for Arduino" reboot use the same automatic typing variable from Ardublockly. But as Blockly evolved, nobody tried to enhance this original code from Calosperate and now it breaks. I see that you choosed to force type variable when user creates one. For BlocklyDuino, as for Studio4Education, I'm stuck to a v6 of Blockly because I need this automatic typing mechanism.
That you would be a real fantastic third party plugin to Blockly, as well as the lexical variable one.
But as I'm totally newbie in typescript, I need to find spare time to learn it by myself...

michele.0...@gmail.com

unread,
Jul 19, 2023, 9:26:36 AM7/19/23
to Blockly
Hi,
to @Neil:
Thank you for the suggestion but it seems that it doesn't really suit my needs and it isn't even working properly on the online webpage as far as I can see

to @Mariop:
thank you for what you shared, I analyzed better what senseBox does (to find the simplest solution, I never used React and I'm already having issues trying to run ardublockly-React on my pc right now) and I saw this: https://sensebox.github.io/blockly/ and I was surprised to see that despite it looks very similar to ardublockly app, it doesn't have the issue about warning text I described in previous messages, so I was wondering if the code to run this page is public on github and if you know the difference between it and ardublockly app.

In general to solve the warning text issue I saw that it is implemented inside the block generator instead of in a listener function as it is described inside blockly documentation, is the recomended way to implement warning text changed over blockly versions? Any further help on this would be appreciated.

Thank you,
Michele

fu6...@gmail.com

unread,
Jul 20, 2023, 8:41:35 AM7/20/23
to Blockly
Hi  Michele,

I  have a similar project and will update the core to v10.0.0 during the summer vacation. Hope this helps.

Best wishes.

fu6...

michele.0...@gmail.com 在 2023年7月19日 星期三晚上9:26:36 [UTC+8] 的信中寫道:

michele.0...@gmail.com

unread,
Jul 20, 2023, 10:59:34 AM7/20/23
to Blockly
Hi fu6...,
it looks very interesting! The only issues i encounter are that when I try to download your repo and run webduino-master/SpBlocklyF1/index.html it doesn't work, the errors in the console are the following:

simpleWorker.ts:34 Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/microsoft/monaco-editor#faq
logOnceWebWorkerWarning @ simpleWorker.ts:34
simpleWorker.ts:36 Failed to construct 'Worker': Script at 'file:///C:/Users/.../Downloads/webduino-master/SpBlocklyF1/vs/base/worker/workerMain.js#editorWorkerService' cannot be accessed from origin 'null'.
logOnceWebWorkerWarning @ simpleWorker.ts:36
jquery.min.js:6 Access to XMLHttpRequest at 'file:///C:/Users/.../Downloads/webduino-master/SpBlocklyF1/category/category.xml' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, isolated-app, ipns, https, chrome-untrusted, ipfs, data, chrome-extension, chrome.
send @ jquery.min.js:6
jquery.min.js:6     Failed to load resource: net::ERR_FAILED
send @ jquery.min.js:6
blockly_compressed.js:4477 Uncaught TypeError: Cannot read properties of undefined (reading 'clientWidth')
    at Blockly.Trashcan.position (blockly_compressed.js:4477:31)
    at Blockly.WorkspaceSvg.resize (blockly_compressed.js:2765:294)
    at Blockly.svgResize (blockly_compressed.js:3127:361)
    at Blockly.inject (blockly_compressed.js:2834:166)
    at index.js:63:29
blockly_compressed.js:4477 Uncaught TypeError: Cannot read properties of undefined (reading 'clientWidth')
    at Blockly.Trashcan.position (blockly_compressed.js:4477:31)
    at Blockly.WorkspaceSvg.resize (blockly_compressed.js:2765:294)
    at Blockly.svgResize (blockly_compressed.js:3127:361)
    at blockly_compressed.js:2842:299
    at h (blockly_compressed.js:1836:168)
2blockly_compressed.js:4477 Uncaught TypeError: Cannot read properties of undefined (reading 'clientWidth')
    at Blockly.Trashcan.position (blockly_compressed.js:4477:31)
    at Blockly.WorkspaceSvg.resize (blockly_compressed.js:2765:294)
    at Blockly.svgResize (blockly_compressed.js:3127:361)
    at blockly_compressed.js:2842:299
    at h (blockly_compressed.js:1836:168)
Blockly.Trashcan.position @ blockly_compressed.js:4477
Blockly.WorkspaceSvg.resize @ blockly_compressed.js:2765
Blockly.svgResize @ blockly_compressed.js:3127
(anonymous) @ blockly_compressed.js:2842
h @ blockly_compressed.js:1836

Running the version from your link it looks so interesting, if I can give you a suggestion the only thing I would add (seeing that you are very skilled) is implementing something similar to blockMirror

Thank you
Reply all
Reply to author
Forward
0 new messages