Debug Bangle code using VS code

Posted on
  • hello,
    i have a Bangle.js from few days, i'd like to write and debug my code using VS code. I saw the possibility to do it with espruino board but i didn't understand if it is possible with bangle.js. Espruino web IDE is very usefull with simple code, but when the code becomes bigger and complex it is difficult to figure out with it mostly when there is something unexpected in the behaviour. if someone has some tips i'm very glad to hear them.

  • Hi! You can definitely program Bangle.js with VS Code - the simplest way is just to clone https://github.com/espruino/BangleApps and then run bin/apploader.js to push your code to the Bangle.

    However Bangle.js also offers line by line debug, and for that I'm afraid you need the Espruino IDE as there's no integration with VS code.

  • Thank's for the answer, i tried to run apploader.js but i think i'm doing something wrong. If i'd use espruino IDE, how can i use line by line debug?

  • how can i use line by line debug?

    https://www.google.com/search?q=espruino­+debugger

    This result perhaps answers your question
    https://www.youtube.com/watch?v=2ODoIpnT­DA4

  • @fanoush thank's very much, it was very usefull. Regarding vsCode, i did what you @Gordon said, but when i clone the repositories , the folder core remains empty and this cause an error when i run the apploader. How can i solve this?

  • This might help: https://stackoverflow.com/questions/3796­927/how-to-git-clone-including-submodule­s

    Were you following some docs written somewhere because if so I should probably update them to include git clone --recurse-submodules --remote-submodules

  • Were you following some docs written somewhere because if so I should
    probably update them to include git clone --recurse-submodules
    --remote-submodules

    Using GitHub exstension in vsCode, i cloned bangle app using the link u gave me in previous answer. Then i ran the bin/apploader.js and this caused an error. Checking it, i saw that was core folder that after clonation remain empty. I don't if i answered well to your question, in any case thank's for the help, i'm using stackoverflow link to solve the problem and if you need more info i'll give you them.

  • The latest vscode (October 2020 update) now has support for recursive clones

    https://code.visualstudio.com/updates/v1­_51#_git-recursive-clone-command

    Git: Recursive clone command
    With the Git: Clone (Recursive) command,
    you can now recursively clone Git repositories, including its nested
    Git submodules.

  • @parasquid thank you, now i can run apploader.js, but actually i have problems with noble, when i run it i only see in the debug console messages that are visible in the image. But i can't find a list of device in order to connect my bangle. Am i missing something?@Gordon


    1 Attachment

    • espriono_help.JPG
  • Did you try running apploader.js list as the help message implies?

  • i have to run these commands using javascript terminal? if i'm right, i'm trying to do that but it doesn't work.

  • You would have to execute them in a shell terminal (so probably bash, not JavaScript). apploader.js is a command-line tool.

  • thank you very much now i finally understand how to do it. I'm getting this error caused by noble, that is very common. I searched how to solve it, so i used zadig to add in USB file my ble device :

    usb.findByIds(0x8087, 0x07dc)
    

    but i still get the same error.


    1 Attachment

    • imm3.JPG
  • Ok i solved all problems, now i can list the devices, but i can't install an app through it, i'm getting an exception in heatshrink.js, it is difficult to understand due to the way is written. I will attach an image with the exception underlined, if it persists i think i will leave the idea to use vscode.
    Thank's a lot anyway.


    1 Attachment

    • Cattura.JPG
  • Hmm, I have no idea what the error could be I'm afraid.

    You could try editing core/js/appinfo.js and removing the line heatshrink = require("../lib/heatshrink.js"); - that should disable heatshrink, which might help you.

  • Thank you very much @Gordon, i solved that problem thanks to your tip but i still can't install apps using vscode there are other errors. I think i'm gonna learn to use Espruino WEB IDE.

  • Ok, I think to get started, the Espruino IDE is definitely the best bet. I know it's not as shiny as VS Code, but it's designed to 'just work'.

    Maybe after you've used it for a bit you can revisit the apploader and it might make more sense?

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

Debug Bangle code using VS code

Posted by Avatar for valap95 @valap95

Actions