• Hi!

    In a project I'm currently working on I need to update the current program on many Espruino boards. The Espruino IDE is very good, but because of what I presume is a Chrome-related bug I'm having unstable results when unplugging/replugging boards at the frequency I do.

    So, I made a quick solution for working with Sublime Text.
    Follow the instructions:

    Get the EspruinoUploader.exe. Either check out the project https://github.com/AlexanderBrevig/Subli­meTextEspruinoUploader or download the attached EspruinoUploader.exe.

    In Sublime Text go Tools -> Build System -> New Build System

    Paste this code (replace YOUR/PATH/TO with the actual path)

    {
    	"cmd": "C:/YOUR/PATH/TO/EspruinoUploader.exe $file_extension 9800 $file",
      	"working_dir": "$project_path",
    }
    

    Locate or create C:\Users\USER\AppData\Roaming\Sublime Text 3\Packages\User\JavaScript.sublime-setti­ngs and paste this (replace USER with the correct username for your Users folder).

    {
    	"extensions":
    	[
    		"com3",
    		"com4",
    		"com5",
    		"com6",
    		"com7",
    		"com8" //just continue for how many you need
    	]
    }
    

    Maybe you'll have a master on COM4 and a slave on COM5, then name your files master.com4 and slave.com5.

    Shut down Sublime Text, now open and navigate to master.com4 (make sure your Espruino is connected to COM4)

    Select Tools -> Build System -> espruino and hit Ctrl + Shift + B

    SUCCESS!

    One slight annoyance is if you want the same code uploaded to many different COM ports. Currently I use a simple Node.js file watcher thingy that simply writes the contents of one file to the others.
    I've not decided how to fix that. Any ideas?


    1 Attachment

  • That's great - thanks for posting it up :)

    I've been meaning to do a node command-line tool using EspruinoTools (the start of it is here) for a while, which would allow you to do this kind of thing while also doing some of the stuff that the Web IDE does behind the scenes (auto-loading modules, assembler, etc).

    There is also espruino-cli but it works by just reimplementing everything - so it only does very basic stuff.

    If you want to get it working quickly and easily for lots of boards, you may find Windows gets in the way (as I think it may want to allocate a new COM port for each new device).

    If you use something Linux-based (for example a raspberry pi) you can actually make it so you run a program as soon as the device is plugged in. It's what Seeed do when testing the Espruino boards after manufacture.

    If you're interested in that, let me know and I can give you some better example code.

  • I'm currently using a VirtualBox VM like you outline in the GitHub Wiki but I'm going to dualboot linux soon :)
    I'm still mostly working on the web backend for my project - and for that I need my beloved Visual Studio.

    The espruino-tools looks interesting. When I get a complete install I'll pull down the projects and have a look!

    I just posted this in case anyone else needed some quick and dirty way of working with many devices on windows through ST. Not really intended to become anything more than it already is (and let's be honest - that's close to nothing). When time comes to focus on the Espruino side of the project I'll see if I can make some contributions to espruino-tools project.

  • How does the instability show? - is chrome crashing like described in this thread 'WEB IDE closes when I hit reset on Espruino, where resetting or unplugging while connected brings chrome completely down?

  • Cool, was looking for something like this a while ago... to use eclipse (or any other IDE) for code development, where either on individual file save or - with more complex projects with multiple files - on build project the code an upload to the board happens.

    I assume your setup is for windows, even though sublime and node.js are not OS specific. I'm using Mac OS X.

  • Woah. Cool. I can't wait to try this out tonight. I already use Sublime Text.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Using Sublime Text to rapidly program x connected Espruino boards

Posted by Avatar for alexanderbrevig @alexanderbrevig

Actions