Avatar for user106328

user106328

Member since Dec 2019 • Last active Feb 2020
  • 2 conversations
  • 3 comments

Most recent activity

  • in ESP32
    Avatar for user106328

    I flashed the latest firmware for ESP32 2v04
    https://www.espruino.com/binaries/espruino_2v04_esp32/

    I would like to use setDesetDeepSleep(1); function but I got Uncaught ReferenceError: "setDeepSleep" is not defined exception.

    Question is> is possible to use setDesetDeepSleep function in version of firmware for ESP32? And if Yes, which require should be used?

  • in ESP32
    Avatar for user106328

    Thanks. I tried it in the following way but with the same result (even without deep sleep):

    var WIFI_NAME = "";
    var WIFI_OPTIONS = { password : "" };
    
    function onInit() {
      wifi = require("Wifi");
     // Call to an function that kicks off my code
      setInterval(function() {
      connectToWifi();
      //setDeepSleep(1);
      }, 10000);
    }
    
    function connectToWifi(){
      console.log("connectToWifi");
      var wifi = require("Wifi");
      wifi.connect(WIFI_NAME, WIFI_OPTIONS, function(err) {
      if (err) {
        console.log("Connection error: "+err);
        return;
      } else {
        console.log("Connected!");
        getPage();
      }
        console.log("End");
      });
    }
    
    function getPage() {
      require("http").get("http://www.pur3.co.uk/hello.txt", function(res) {
        console.log("Response: ",res);
        res.on('data', function(d) {
          console.log("--->"+d);
        });
      });
    }
    
    
    
    
    

    Calculating Size...
    Writing..
    Compressed 36800 bytes to 2742
    Running onInit()...
    connectToWifi
    connectToWifi
    connectToWifi
    connectToWifi
    connectToWifi
    connectToWifi
    connectToWifi
    connectToWifi
    connectToWifi
    connectToWifi
    save();

  • in ESP32
    Avatar for user106328

    Hi,

    I'm trying to connect to wifi after deep sleep wakeup on ESP32. The initial run work, but after wake from deep sleep the code wifi.connect is not executed. It does not fall into error or success branch.

    I would like to ask how to do it in the right way:

    Firmware version:
    espruino_2v03_esp32
    device is connected throught the USB cable

    var WIFI_NAME = "";
    var WIFI_OPTIONS = { password : "" };
    var wifi = require("Wifi");
    
    
    function connectToWifi(){
      console.log("connectToWifi");
      wifi.connect(WIFI_NAME, WIFI_OPTIONS, function(err) {
      if (err) {
        console.log("Connection error: "+err);
        return;
      } else {
        console.log("Connected!");
        getPage();
      }
        console.log("End");
      });
    };
    
    function getPage() {
      require("http").get("http://www.pur3.co.uk/hello.txt", function(res) {
        console.log("Response: ",res);
        res.on('data', function(d) {
          console.log("--->"+d);
        });
      });
    }
    
    
    
    setInterval(function() {
      connectToWifi();
    }, 10000);
    setDeepSleep(1);
    
Actions