• Hey @Robin, you are right, I had been trying a lot of different things at once. Let me try to bring us back to a shared baseline. Here is process.env:

    >process.env
    ={
      VERSION: "2v04.378",
      GIT_COMMIT: "ca6e4731",
      BOARD: "ESPRUINOWIFI",
      FLASH: 524288, STORAGE: 65536, RAM: 131072,
      SERIAL: "41006e00-0b513532-39333638",
      CONSOLE: "USB",
      MODULES: "Flash,Storage,hea" ... ",neopixel,Wifi,AT",
      EXPTR: 536871212 }
    

    Here is the code - including the state checking:

    pinMode(A0, 'input_pulldown');
    
    function onInit() {
      A13.read();
    }
    
    function doStuff() {  
        console.log("doing stuff");
    	setTimeout(function(){       
          console.log("Going to sleep again");
          setDeepSleep(1);
        }, 2000);
    }
    
    setSleepIndicator(LED1);
    
    setWatch(function() {  
       console.log("A0 pressed");
       doStuff();  
    }, A0, {repeat: true, edge: 'rising', debounce: 10});
    
    
    console.log("A0 = ",getPinMode(A0));
    console.log("A1 = ",getPinMode(A1));
    console.log("A4 = ",getPinMode(A4));
    console.log("A5 = ",getPinMode(A5));
    console.log("A6 = ",getPinMode(A6));
    console.log("A7 = ",getPinMode(A7));
    console.log("B0 = ",getPinMode(B0));
    console.log("B1 = ",getPinMode(B1));
    console.log("B3 = ",getPinMode(B3));
    console.log("B4 = ",getPinMode(B4));
    console.log("B5 = ",getPinMode(B5));
    console.log("B6 = ",getPinMode(B6));
    console.log("B7 = ",getPinMode(B7));
    console.log("B8 = ",getPinMode(B8));
    console.log("B9 = ",getPinMode(B9));
    console.log("B10 = ",getPinMode(B10));
    console.log("B13 = ",getPinMode(B13));
    console.log("B14 = ",getPinMode(B14));
    
    console.log("Going to sleep");
    setDeepSleep(1);
    

    Here is the console output:

    >A0 =  input_pulldown
    A1 =  analog
    A4 =  analog
    A5 =  analog
    A6 =  analog
    A7 =  analog
    B0 =  analog
    B1 =  analog
    B3 =  analog
    B4 =  analog
    B5 =  analog
    B6 =  af_output
    B7 =  af_output
    B8 =  analog
    B9 =  analog
    B10 =  analog
    B13 =  analog
    B14 =  analog
    Going to sleep
    >save()
    =undefined
    Compacting Flash...
    Calculating Size...
    Writing..
    Compressed 114368 bytes to 4919
    Running onInit()...
    

    Here is the dump - after reset, upload, save and then reset:

    >dump()
    function onInit() {A13.read();}
    function doStuff() {
      console.log("doing stuff");
        setTimeout(function(){
          console.log("Going to sleep again");
          setDeepSleep(1);
        }, 2000);
    }
    setWatch(function () {
      console.log("A0 pressed");
       doStuff();
    }, A0, { repeat:true, edge:'rising', debounce : 9.99927520751 });
    setSleepIndicator(B2);
    E.setFlags({ "deepSleep": 1, "pretokenise": 0, "unsafeFlash": 0, "unsyncFiles": 0 });
    pinMode(A0, "input_pulldown");
    digitalWrite(B2, 1);
    =undefined
    
    

    And here is the power consumption: 2.4 mA again.

    I'd certainly welcome any ideas.

About

Avatar for narath @narath started