- hackable smart watch?!?

Posted on
of 3
First Prev
/ 3
  • You can now play t-rex as well!­ml?codeurl=https://raw.githubusercontent­.com/espruino/BangleApps/master/apps/tre­x/trex.js

    I'll check about the reconnect. I guess I may need to reset the VM

    edit: fixed now!

  • Wow! Just tested and play Clotris! Nice.

  • Wrote a small test program for the bangle.js emulator testing the buttons... pretty neat!

    Proceed as follows:

    • start emulator­ml
    • paste code into emulator editor pane (right-hand pane)
    • upload code
    • run it with typing r() into console (left-hand pane)
    • click on button 1,2,3 -to the right of the graphics area
    • click into the left or right half side of the graphics

      var btns = [BTN1,BTN2,BTN3,BTN4,BTN5], wIds;
      function onInit() {
      if (wIds) return;
      wIds = [];
      btns.forEach(function(btn,i) {
        var lab = "BTN"+(i+1);
        wIds.push(setWatch(function(e) {
      Bangle.on("swipe",function(dir) { // ???
      console.log((dir) ? "-->" : "<--"); });
      function h() {
      if (wIds) wIds.forEach(function(wId) {
          clearWatch(wId); });
      wIds = null;
      function r() { onInit(); } // r() : run
      function h() { halt();   } // h() : halt


    • a) activities on BTN5 also falsely(?) reports BTN4 activities
    • b) 'swipe' - moving pointer with mousedown not supported

    Would be nice to see the swipe working... with setWatche()-s on the buttons 4 and 5 AND with - for example - Bangle.on("swipe",function(dir){...} (or alike).

    Output 'formatted' to fit:

    { "state": true,  "lastTime": undefined, "time": ...721999, "btn": "BTN1" }
    { "state": false, "lastTime": ...721999, "time": ...946000, "btn": "BTN1" }
    { "state": true,  "lastTime": undefined, "time": ...456000, "btn": "BTN2" }
    { "state": false, "lastTime": ...456000, "time": ...673000, "btn": "BTN2" }
    { "state": true,  "lastTime": undefined, "time": ...539999, "btn": "BTN3" }
    { "state": false, "lastTime": ...539999, "time": ...747999, "btn": "BTN3" }
    { "state": true,  "lastTime": undefined, "time": ...798000, "btn": "BTN4" }
    { "state": false, "lastTime": ...798000, "time": ...990999, "btn": "BTN4" }
    { "state": true,  "lastTime": undefined, "time": ...267999, "btn": "BTN5" }
    { "state": true,  "lastTime": ...990999, "time": ...267999, "btn": "BTN4" }
    { "state": false, "lastTime": ...267999, "time": ...460000, "btn": "BTN5" }
    { "state": false, "lastTime": ...267999, "time": ...460999, "btn": "BTN4" }

    1 Attachment

    • bangleEmul_Btn_Test.png
  • Thanks - yes, I figured out about the BTN5 issue - I'll push the changes tomorrow.

    The swipe stuff is bangle specific and not compiled in on the emulator build - I think right now that's probably not a high priority though. Much better that I get the actual hardware working well! :)

  • @Gordon, about the swipe... np. Detection of the moving pointer w/ mousedown - in/out of touch area triggering the button watch would be cool though, since this allows to devleop / validate - at least partially some swipe/tap module.

  • Ahh - sorry. I thought you meant the functionality in Espruino in the Emulator rather than the emulator itself. Yes, mousein/out functionality would make a great deal of sense.

    If there's stuff you want to add then it's actually pretty easy to make changes on the WebIDE part of the emulator:­DE/blob/gh-pages/js/plugins/emulator.js#­L98

    Just fork the EspruinoWebIDE github repo, go into settings and enable github pages. You should then have­oWebIDE/emulator.html where you can test the emulator (eg­E/emulator.html)

  • Right, well that's my weekend sorted :D

  • And one more question, the SWD test pads is available on the PCB?

  • SWD test pads is available on the PCB?

    They are, yes! You have to peel off a bit of double-sided sticky and kapton tape, but it's not hard to get to them and it doesn't require anything irreversible to be done :)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About - hackable smart watch?!?

Posted by Avatar for ChristianW @ChristianW