ESP32 SetWatch?

Posted on
  • Has anyone gotten an interrupt or setWatch to work on the ESP32? And if so which pin(s)?

    I see a few comments online about issues with this feature. When I try on different pins it sometimes works or the device freezes. Is it maybe a wiring issue on my part? I tried a pullup & pulldown solution and no luck.

    Here's my code:

    setWatch(function(){
    console.log('trigger');
    },D14,{repeat:true,debounce:200});
    
  • In actual branch for ESP32 is a change in jshGetSystemTime() to fix problems with ESP32 internal time routine

  • Could you get it to master via a separate PR if that helps with the basic setWatch() stuff? It seems like quite some number of people are hitting this problem.

  • @wilberforce already did

  • Cool! Thank you! :)

  • https://github.com/espruino/Espruino/iss­ues/1176.

    This issue has been fixed.

    It will be in version 1v95, so for now a latest travis build will work:
    http://www.espruino.com/binaries/travis/­master/

  • Thank you all.

    I can confirm this now works using the latest Travis build for at least these pins: D0, D12, D13, D14, D15, using this code:

    var count=0;
    function button_down() {
      print('button',count++);
    }
    setWatch(button_down,D0, {repeat:true, edge:"rising", debounce:50});
    

    One question, when I do this I get "New interpreter error: FIFO_FULL". It still works but should I be concerned?

     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v94 Copyright 2017 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate
    >
    =undefined
    New interpreter error: FIFO_FULL
    button 0
    button 1
    button 2
    button 3
    button 4
    button 5
    
  • Realistically that probably means that so many input events have been put in the input queue (because of switch bouncing?) that the FIFO have has to drop some.

  • Hardware wise how are you triggering the pin? Using D0. The inbuilt flash button, I don't get this message.

  • You're right. If I use the onboard button to trigger D0 it works without the error. However, if I add a button to D0 and pull it up I get the FIFO_FULL error. This sounds like a hardware problem which I can work through.

    Thanks again for the help on this.

  • @cmo you can just stick a small capacitor across the button and it should sort you out. It sounds like a very noisy button though!

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

ESP32 SetWatch?

Posted by Avatar for cmo @cmo

Actions