Skip to content

EspClass::deepSleep only accepts 32bit Integer instead of 64bit #9074

Closed
@juepi

Description

@juepi

Board

WEMOS S2 Mini (occurs probably on any ESP32)

Device Description

no other hardware involved

Hardware Configuration

Nothing special, just testing DeepSleep

Version

latest master (checkout manually)

IDE Name

PlatformIO

Operating System

Windows 11

Flash frequency

default

PSRAM enabled

no

Upload speed

115200

Description

I'm really not sure if this is by intention as it's a so obvious bug to me that i really wonder why no one else has stumbled over it, but
according to file Esp.cpp:

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

Where esp_deep_sleep expects a uint64_t value (which makes much more sense, as the 32bit value limits sleep time to ~4300 seconds).

Sketch

uint32_t SleepTime = (7200 * 1000 * 1000); //µs -> overflow!
ESP.deepSleep(SleepTime); // -> actual sleep time ~2900sec

Debug Message

none

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions