-
Notifications
You must be signed in to change notification settings - Fork 115
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
incorrect remaining time calculation (ESF-179) #121
Comments
Hi @nikitos1550, thanks for noticing this. You are right, calculation is incorrect. This reminded me the already opened issue here. Your solution fixes the issue you talk about, but another problem is that |
Hi! You are right about clock(), so I reworked it following way (added https://github.com/solemnwarning/timespec to submodules ) static struct timespec s_time_end;
// ...
void loader_port_start_timer(uint32_t ms)
{
struct timespec now, add;
clock_gettime(CLOCK_MONOTONIC, &now);
add = timespec_from_ms(ms);
s_time_end = timespec_add(now, add);
}
uint32_t loader_port_remaining_time(void)
{
struct timespec now, diff;
clock_gettime(CLOCK_MONOTONIC, &now);
if (timespec_ge(s_time_end, now)) {
diff = timespec_sub(s_time_end, now);
return timespec_to_ms(diff);
}
return 0;
} If you are ok with additional submodule dep I can make PR. |
anyway here you are |
I will close the PR and implement it directly without submodule if you are OK with that. Anyway thanks for noticing. |
I am ok, sure! I am using respberry based Linux port with custom utility, so it make no sense for me. |
Please also pay attention to open tty dev file flags, there is NONBLOCK flag that means VMIN, VTIME options will not work. P.S. I will provide log later, maybe you can help me figure out what is going on. |
I cannot reproduce it right now :( Maybe later I will have luck. |
Thanks for letting me know. It is planned to rewrite the Raspberry pi port completely in the future. Feel free to send the log later, I can take a look. |
Port
raspberry
Target chip
ESP32S3
Hardware Configuration
ESP32-S3-WROOM-1U based pcba connected via UART to custom mdm9207 (GNU/Linux OS) based pcba.
Log output
More Information
https://github.com/espressif/esp-serial-flasher/blob/f1183069e23ee89dbab9b411724e88e170dbd874/port/raspberry_port.c#L292C1-L297C1
Here if
(s_time_end - clock())
will be less then 1000, then we still have some time to wait, but function will return 0.I locally patched it
And now I can sucessfully burn esp32s3. Seems I faced some hardware compatibility issue, because our previous ESP32-S3-WROOM-1U based pcba did not have such issue, anyway I think my point is reasonable.
The text was updated successfully, but these errors were encountered: