-
-
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
Deep sleep using timer limited to 2 minutes #230
Comments
I think the problem is on this part: uint64_t duration_math = 32768 * sleep_duration; Looks like the variable is not capable (?) of holding a 64 bit unsigned int, not sure how to probe this in a better way but I tried testing with this piece of code: void setup() {
Serial.println("Boot");
for(int s = 0; s < 300; s++){
uint32_t sleep_duration = s*1000; //ms
uint32_t sleep_time; // From manual_ps_pub.h as UINT32
uint64_t duration_math = 32768 * sleep_duration;
if (duration_math / 1000 > 0xFFFFFFFF) {
// Sleep forever
sleep_time = 0xFFFFFFFF;
} else {
sleep_time = (duration_math / 1000) & 0xFFFFFFFF;
}
Serial.print("Seconds: ");
Serial.print(s);
Serial.print(" duration_math: ");
Serial.print(duration_math);
Serial.print(" sleep_time: ");
Serial.println(sleep_time);
}
} And at about 131 seconds the variable for sleep_time overflow:
Using seconds and not milliseconds works fine, at least tested up to 15 minutes, but some precision is lost... Working on a PR |
Since |
Hello, How did you fix this? Do you use any external components or how? Thanks |
hello, I use bk72xx boards in esphome home assistant integration. how I can add deep sleep to my bk72xx boards. could you provide ,yaml example? or maybe something must be added before? Ed |
Fixed in #253. |
Looks like setting the wake up timer for deep sleep only works as expected up to about 120 seconds (~2 min). Setting a longer sleep time results on sleeping only for about 15 ~ 20 seconds.
With 150 seconds
With 120 seconds
Is in deep sleep in both cases, tested checking power consumption using a lab PSU.
Code:
The text was updated successfully, but these errors were encountered: