uploading files (not apps)

Posted on
  • I'm writing a small app for my bangle to allow scrolling through a list of items (e.g. navigation directions, but this could apply to shopping lists as well).
    For that I am looking for a way to upload the directions file (or shopping list).
    Is that possible?

    Below is a simplified example, but that one uses a static array.
    I know how to read the info from a file, but it is not clear to me what the best way is to upload the file.

    (BTW: I also considered a small generator that creates a dedicated app, but I feel that is more cumbersome).

    Thanks, Frans

    PS: and pardon me if this is the wrong forum, but I felt none of the forums was really applicable.

    const vals = [
      "",
      "1st left", 
      "2nd right",
      "cross railroad",
      "stop at #17",
      ""
    ];
    
    
    let ix = 1;
    
    function draw()
    {
      g.clear();
      g.setFontVector(20);
      //g.setColor(passivColor);
      g.setFontAlign(0, -1, 0);
      g.drawString(vals[ix-1], 120, 0);
      g.drawString(vals[ix+1], 120, 200);
      g.setFontVector(30);
      g.drawString(vals[ix], 120, 100);
    }
    
    function next() {
      if (ix < vals.length - 2) ix = ix + 1;
      draw();
    }
    function prev() {
      if (ix > 1)  ix = ix - 1;
      draw();
    }
    
    setWatch(next, BTN5, { repeat: true });
    setWatch(prev, BTN4, { repeat: true });
    
    draw();
    
  • I am looking for a way to upload the directions file (or shopping list).

    There's some stuff in the App Loader for this. For example the Custom QR Code app at https://banglejs.com/apps/#

    That works with an HTML file that creates and uploads an app on demand: https://github.com/espruino/BangleApps/b­lob/master/apps/qrcode/qrcode.html

    There's something called Grocery (a shopping list) that might be a better fit as well.

    Right now you have to call that before uploading your app - it can create a separate file, or a static list in an app.

    There's also 'interface' (eg as used for the Stopwatch) which allows your to communicate with the watch once your app is installed (eg https://github.com/espruino/BangleApps/b­lob/master/apps/swatch/interface.html) but that might be a step too far in this case?

    (by the way, if you highlight your code and click the </> code button it makes it render more nicely - just did this for you)

  • Thanks Gordon!

    Actually the primary use case I had in mind was cycling directions.
    In the Netherlands and Belgium there is a bicycle route network with nodes indicated by numbers .
    What I wanted to do is instead of keeping a list with number on paper, have this list on my bangle.

    The grocery example looks pretty straightforward although probably I prefer to use BTN4 and 5. Maybe easier to use while cycling.

    A few maybe not too related questions:
    Is there an easy way to view the sourcecode from an app (e.g. grocery) directly from the store?
    Currently I can view the code by downloading it to the bangle and in the IDE browse the filesystem and examine the js file, but I figured there should be a better way.

    And is there a way to upload a regular file directly (I'm running linux if that matters and can launch a web app if needed). So I can just push the file towards my bangle.

    Thanks, Frans.

    PS: and if these are silly questions or the answer is already somewhere just point me to it. I'm still in the process of finding my way.

  • is there an easy way to view the sourcecode from an app (e.g. grocery) directly from the store?

    Yep - there's a little GitHub cat logo just below each app's icon. Click on it and you go to the source :)

    And is there a way to upload a regular file directly (I'm running linux if that matters and can launch a web app if needed). So I can just push the file towards my bangle.

    There's no command-line way of doing it at the moment I'm afraid. You'd have to use the IDE.

    It's possible that the Espruino CLI could be updated to allow Storage uploads, but that hasn't been done yet.

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

uploading files (not apps)

Posted by Avatar for FransM @FransM

Actions