Skip to content

blog 2015 04 05

Danny Staple edited this page Apr 5, 2016 · 1 revision

Packaging Bounce

A bit of background

Bounce depends on Blockly - a Google project which provides the visual blocks programming language. Blockly is browser based - using html, JS and CSS, and requires a relatively recent browser. Bounce also uses more of the google closure JS library that blockly uses (it seemed like a good idea to stick with one framework, a decision I have questioned a few times).

However, a fundamental part of this is that it generates Lua for the NodeMCU/ESP8266 microcontroller, and can send it code via serial. Serial support is not available inside a browser. So it needs to be packaged in some way that can:

  • Provide a reasonably recent browser component
  • Provide Native serial support
  • Read/Write Local files (to save/export programs)

History

Bounce started off life as an attempt in Electron (previously Atom), which runs Node.js natively on the computer with a page inside the chrome embedded framework. I ran then into trouble getting the native serialport extension to load properly.

The next package was using .net - which limited it to windows. This worked, but isn't particularly portable, and since it still used the CEF it was difficult to package. However, it was with this that I prepared a demo, which I was able to display to a few people - robotics teachers and club organisers. It was this version that was used in the video.

After publishing the video a few suggestions were made - Chrome App, and Electron. I experimented. I made a major mistake - and created a branch to experiment in, then committed my changes to master. Luckily - I've quickly gotten to a working chrome app - although need to make an exportable build for this.

I then started experimenting with Electron again - this is a rabbit hole, I spent nearly a week again, trying to get the serialport part to compile and load on Windows, in a way that would still work with older Windows machines (my laptop runs Windows 10). I installed the Windows 7.1 SDK (after many mis-steps with different Visual Studio Community editions and other SDK's), and used the CMD wrapper it provides to do the electron-rebuild thing. However, this always results in something unable to load a DLL.

For now - I've made a decision to go and polish, package the Chrome App, and then focus on providing more blocks and demoing them. I'll leave potential other packaging stuff as an open question, and try and keep the system clean enough that this shouldn't be a problem. The Chrome App and Electron will be quite similar.

If you do know how to get Electron building correctly on Windows - feel free to fork this, make it work, and provide a doc, or script or something to get from a Windows Laptop with internet to a working build set up. I'd love to revisit it.

Happy coding, Danny Staple

Clone this wiki locally