Skip to content
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

Merged
merged 1 commit into from
Feb 22, 2024

Conversation

cap9qd
Copy link
Contributor

@cap9qd cap9qd commented Feb 21, 2024

per #230

Tested on several BK7231N devices with ESPHome 2024.1.0-dev.

cores/beken-72xx/base/api/lt_sleep.c Outdated Show resolved Hide resolved
// Sleep forever
deep_sleep_param.sleep_time = 0xFFFFFFFF;
uint64_t sleep_ticks = 32.768 * sleep_duration_ms;
if (sleep_ticks >= 0xFFFFFFFF) {
Copy link
Collaborator

@Cossid Cossid Feb 21, 2024

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).

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

@kuba2k2 kuba2k2 changed the title Fix rollover in sleep functions [beken-72xx] Fix duration rollover in deep sleep Feb 22, 2024
@kuba2k2 kuba2k2 added bug Something isn't working BK7231 Beken BK72xx family labels Feb 22, 2024
@kuba2k2 kuba2k2 merged commit b78c938 into libretiny-eu:master Feb 22, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BK7231 Beken BK72xx family bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants