-
-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[beken-72xx] Fix duration rollover in deep sleep #253
Conversation
0518e21
to
6117f35
Compare
// Sleep forever | ||
deep_sleep_param.sleep_time = 0xFFFFFFFF; | ||
uint64_t sleep_ticks = 32.768 * sleep_duration_ms; | ||
if (sleep_ticks >= 0xFFFFFFFF) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should still be >
instead of >=
in case some actually does want to sleep forever (like rely fully on GPIO wakeup).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense! Just fix the rollover.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, if someone wants it to sleep forever, they won't call lt_deep_sleep_config_timer()
in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about it more it wouldn't make sense to call lt_deep_sleep_config_timer()
if you want to wait forever for another wake reason. My ESPHome deep_sleep changes only call the lt_deep_sleep_config_timer()
function if a sleep_duration
is defined in the YAML.
6117f35
to
67ea94f
Compare
67ea94f
to
d3fc945
Compare
per #230
Tested on several BK7231N devices with ESPHome 2024.1.0-dev.