0 votes
in Touch Interface by (230 points)

In sketch, line 256 how to activate this code ?
(My ESP8266 WiFi Color Display Kit don't go to sleep after 2 minutes)

  if (SLEEP_INTERVAL_SECS && millis() - timerPress >= SLEEP_INTERVAL_SECS * 1000){ // after 2 minutes go to sleep
    drawProgress(25,"Going to Sleep!");
    drawProgress(50,"Going to Sleep!");
    drawProgress(75,"Going to Sleep!");
    drawProgress(100,"Going to Sleep!");
    // go to deepsleep for xx minutes or 0 = permanently
    ESP.deepSleep(0,  WAKE_RF_DEFAULT);      // 0 delay = permanently to sleep

Thanks for your help

1 Answer

+1 vote
by (230 points)

After search, I found this:

In settings tab:

  const int SLEEP_INTERVAL_SECS = 5 * 60; // After 5 * 60s go to deepSleep

In esp8266-weather-station-color tab:

  ESP.deepSleep(60*1000000,  WAKE_RF_DEFAULT);// After 60 * 1000000ms wake WiFi up

Only to turn the screen back on you have to press reset button which restarts the program

I wanted to turn off the device at night

by (15.7k points)
Without external circuitry the ESP8266 cannot sleep for more than ~3.5h at the time. Also, to enable wake from deep sleep you need to connect GPIO 16 to RST. See https://thingpulse.com/max-deep-sleep-for-esp8266/ for details.

Welcome to ThingPulse Q&A, where you can ask questions and receive answers from other members of the community.