Attempting to make a standalone env

Posted on
  • Hello! I've just started learning how to develop for Bangle and I'm attempting to set up an environment using vscode, since it's absolutely painful to use a web ide for that. So I'm having some trouble with it, and getting some answers on the following would help immensely:

    1. For bridging with the Bangle, I'm using the Espruino CLI (from npm), but I couldn't find any way to get some IDE functionality such as uploading files to storage (there's a "--storage" flag, but I can't find much in terms of what do I have to pass to it to get files to storage).
    2. Is there a way to send multiple files to the device simultaneously? This is so I could just "deploy" the whole app: info file, js files, img file, at the same time.
    3. The IDE appears to hold a BLE connection active across multiple commands, but each command via CLI creates and stops a connection, and when that happens it takes some time for it to be able to pair again which makes developing slower.
    4. Is there a standalone emulator that I can use outside of the web ide?

    Many thanks!

  • I'm using the Espruino CLI (from npm), but I couldn't find any way to get some IDE functionality such as uploading files to storage (there's a "--storage" flag, but I can't find much in terms of what do I have to pass to it to get files to storage).

    https://github.com/espruino/EspruinoTools#readme shows:

    # Write mycode.js to the first Bangle.js device found as a Storage file named app.js
    espruino -d Bangle.js mycode.js --storage app.js:-
    
    # As above, but also write app_image.bin to the device as a Storage file named app.img
    espruino -d Bangle.js mycode.js --storage app.js:- --storage app.img:app_image.bin
    

    I think that should do you? I'm not 100% sure how it works uploading files to storage without also uploading JS though.

    Is there a way to send multiple files to the device simultaneously?

    Yes - see above. Just you can't convert multiple JS files at once, but if you're happy copying them verbatim it's fine.

    The IDE appears to hold a BLE connection active across multiple commands, but each command via CLI creates and stops a connection

    Have you tried the 'remote connection' option which uses your phone for the connection?

    But since the CLI is an app that has to start and stop, if you're using it to connect then the connection will drop.

    You can just use the IDE and set the IDE to watch a file for changes - then it'll keep the connection open and every time you save the file it'll re-upload it.

    Is there a standalone emulator that I can use outside of the web ide?

    I think someone did do something, but there is also https://github.com/espruino/BangleApps/blob/master/bin/runapptests.js which you can use to run an app in an emulator from the CLI, then perform tests on it.

  • Thanks for the answers. I will give that command a try. It was just not very intuitive from the man help:

    --storage fn:data.bin : Load 'data.bin' from disk and write it to Storage as 'fn'
    --storage .boot0:- : Store program code in the given Storage file (not .bootcde)
    (it makes much more sense now with context)

    I tried the remote connection thing, but my end goal would be to not really need a chrome instance running. After all, the web IDE should be running the actual juicy stuff under the hood anyway.
    In terms of accessibility to new contributors, this seems like a big hindrance instead of easing it (which I guess was the goal of making a web ide in the first place).

    As for tests, I was looking to get something that I could test Bangles APIs on or to fine tune graphics, etc. Not even bothering writing unit tests right now haha

  • which I guess was the goal of making a web ide in the first place

    I guess another reason was that support for Bluetooth Low Energy is/was not that great across various OSes but as long as Chrome is running on the platform the Web Bluetooth is relatively painless.

    It got better though. Just year or two ago Windows was not that great for connecting over BLE from espruino command line, now with using noble-winrt it sort of works on Windows 10/11. Not sure how well it works on Linux or Mac but I guess it can still have various issues when you also use Bluetooth for other stuff (see https://www.npmjs.com/package/@abandonware/noble), so Chrome (possibly on Android) is good fallback when everything else fails.

  • yes, that makes sense. I've been using an M1 Mac and it's doing alright in general (using noble as well). I guess it's more a BLE limitation than anything, and that's because of that process of connecting/disconnecting continuously.

  • In terms of accessibility to new contributors, this seems like a big hindrance instead of easing it (which I guess was the goal of making a web ide in the first place).

    I'm not sure I really understand what you're getting at here. So if you're using the Web IDE direct it 'just works', right? And allows you to access storage and do everything else.

    You can also just set it to watch a file that you then write with your favourite IDE, and upload it when it changes (Ctrl-F will make the IDE show just the terminal fullscreen).

    The friction you're having is when trying to connect with the CLI?

    I think there could definitely be some work done to make the CLI app work better, but my time is a bit stretched, and generally it does appear to work well enough for most. If someone wanted to contribute code to improve it that'd be awesome though.

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

Attempting to make a standalone env

Posted by Avatar for arvere @arvere

Actions