简体   繁体   English

ESP8266 和 ESP32 之间使设备进入深度睡眠的推荐代码有何不同?

[英]What is the difference in recommended code for putting device into deepsleep between ESP8266 and ESP32?

The following code is recommended to put an ESP8266 in deep sleep for 60 seconds:建议使用以下代码让 ESP8266 进入深度睡眠 60 秒:

ESP.deepSleep(60 * 1000000);

I use it on the ESP32 it also works, but the recommended code for ESP32 is:我在ESP32上使用它也可以,但 ESP32 的推荐代码是:

esp_sleep_enable_timer_wakeup(60 * 1000000);
esp_deep_sleep_start();

Is there a difference between the two for the ESP32? ESP32 两者之间有区别吗?

With ESP.deepsleep you can't use different wakeup sources – only a timer:使用ESP.deepsleep你不能使用不同的唤醒源——只能使用一个定时器:

void EspClass::deepSleep(uint32_t time_us)
{
    esp_deep_sleep(time_us);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM