Strange BTN1 behaviour on Bangle.js 2

Posted on
  • I have a Bangle.js 2 which no longer wakes up at a BTN1 press. I've completely cleaned the watch ('Remove all Apps' and 'Install default Apps' from https://banglejs.com/apps/) , but to no extent.

    When in the Web IDE, I can indeed see that the BTN1 pin stays at zero, whether pressed or not.

    >reset()
    =undefined
     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v10.89 (c) 2021 G.Williams
    // BTN1 released
    >digitalRead(BTN1)
    =0
    // BTN1 pressed
    >digitalRead(BTN1)
    =0
    // BTN1 pressed
    >digitalRead(BTN1)
    =0
    

    One could assume hardware failure, but the strange thing is that after a 'pinMode(BTN1)' statement, a digitalRead does react as expected.

    >setInterval(function(){print(digitalRea­d(BTN1))},1000)
    =1
    0
    0
    // Various BTN1 presses following
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    >pinMode(BTN1)
    =undefined
    0
    0
    //BTN 1 detected !!!
    1
    0
    1
    1
    0
    1
    0
    1
    1
    >
    // Here the watch suddenly shows 'loading' and returns to the normal screen with non-functional BTN1
    

    Then after a few seconds, out of the blue, the watch shows 'loading...', the normal screen reappears and BTN1 is again disfunctional (!).
    So, I guess one of my previous experiments has 'destroyed' the normal functioning of BTN1 and I cannot restore it back to normal ?

    The 'settings.json' looks normal to me

    {"ble":true,"blerepl":true,"log":false,"­timeout":10,"vibrate":true,"beep":"vib",­"timezone":1,"HID":false,"clock":null,"1­2hour":false,"brightness":1,"options":{"­wakeOnBTN1":true,"wakeOnBTN2":true,"wake­OnBTN3":true,"wakeOnFaceUp":false,"wakeO­nTouch":false,"wakeOnTwist":true,"twistT­hreshold":819.2,"twistMaxY":-800,"twistT­imeout":1000}}
    

    Anything I can try ?

  • Wow, that is an odd one. You could try pinMode(BTN1,'pulldown') and see if that helps? When you do pinMode do the 0 and 1 correspond to your actual button presses or are they random?

    If you're pressing the button for >1 second then you'd expect the Loading screen to appear though as it tries to reload the default app - could that be it?

    If you have really used the 'remove all apps' it should clear all storage, so I'm surprised there are any issues there.

    Also when it's not working could you run getPinMode(BTN1) and see what it says? There was an issue where clearWatch would clear pin state, but that got fixed in firmware 2v10 which is seems you have

  • Wow, that is an odd one. You could try pinMode(BTN1,'pulldown') and see if that helps?

    No... Only the simple pinMode statetment seems to help. Odd...

    >setInterval(function(){print(digitalRea­d(BTN1))},1000)
    =4
    0
    0
    // Multiple BTN1 presses
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    >pinMode(BTN1,"input_pulldown")
    =undefined
    0
    // Multiple BTN1 presses
    0
    0
    0
    0
    0
    0
    0
    0
    0
    >pinMode(BTN1)
    =undefined
    0
    // 1 BTN1 press
    0
    1
    >
     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v10.89 (c) 2021 G.Williams
    > 
    

    Remark the Espruino prompt at the bottom : after a (detected) BTN1 press, I see the Settings/About/... screen, but no responses to BTN1 anymore. Also the setInterval seems to have stopped ??

    When you do pinMode do the 0 and 1 correspond to your actual button presses or are they random?

    The 0/1 values follow the BTN1 presses

    If you're pressing the button for >1 second then you'd expect the Loading screen to appear though as it tries to reload the default app - could that be it?

    I don't think so. I've tried to 'quickly' press BTN1. This is below 1 second, I guess

    Also when it's not working could you run getPinMode(BTN1) and...

    >
    >getPinMode(BTN1)
    ="input_pulldown"
    > 
    

    Strange...

    I continued my search after I discovered the factory reset function. This should really put everything back to a know state, I suppose. I then installed a simple setWatch :

    >
    >Bangle.factoryReset()
    Erasing Storage Area...
    Erase complete.
    Writing initial storage contents...
    Write complete.
    =undefined
    >setWatch(function(){print("Yes!")},BTN1­, {edge:"rising", debounce:50, repeat:true})
    =2
    >
    // BTN1 presses, no result
    >
    >
    >pinMode(BTN1)
    =undefined
    > 
    // BTN1 presses, no result !!!???
    

    Next I uploaded Espruino's RAM, where I found something strange - to me at least :

    //...
    setInterval(function (undefined) {return WIDGETS["bat"].draw()}, 60000); // 3
    // [native code]????
    setWatch(function () { [native code] }, D17, { repeat:true, edge:'falling', debounce : 24.99961853027 });
    setWatch(function () {print("Yes!")}, D17, { repeat:true, edge:'rising', debounce : 49.99923706054 });
    // Code saved with E.setBootCode
    //...
    
    

    Is that '[native code]' part supposed to be there ?

  • Hi - yes, I'm not too surprised about the 'native code' bit - it might just be the Bangle.showLauncher function.

    I'm starting to think that probably there actually is a hardware issue. My guess is that the connection to the button has become very high resistance... So when the pulldown resistor is enabled it is unable to pull the signal up to a '1'. With the resistor disabled it can do it, but then it never gets pulled back to a '0' and the watch refreshes :(

  • OK. Does that mean the bracelet is 'lost' or can I send it back, get it repaired, replaced ?

  • Yes, just send it back and we'll get a replacement out. We do sell them with a warranty and you'll be well within that.

    Out of interest, I can't remember but I think you had at least one of two of the developer units which weren't waterproof - although I think the bigger order you made was the proper ones in the Bangle-branded cases. Was it one of the early ones? I guess it could have had some water damage.

  • No, it was one of the last order. The 2 pre-production models are still going strong - been traveling to 3 trade-shows so far, without problems. Nice !

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

Strange BTN1 behaviour on Bangle.js 2

Posted by Avatar for jgw @jgw

Actions