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

embassy timer impl is very inaccurate #342

Closed
t-moe opened this issue Jan 12, 2024 · 1 comment
Closed

embassy timer impl is very inaccurate #342

t-moe opened this issue Jan 12, 2024 · 1 comment

Comments

@t-moe
Copy link

t-moe commented Jan 12, 2024

Starting with a fresh (template-generated) project, and adding
embassy-time = { version = "0.1.5", features = ["generic-queue"] } to my dependencies,
and with the following code:

use esp_idf_svc::hal::task::block_on;
use embassy_time::{Duration, Timer};

fn main() {
    esp_idf_svc::sys::link_patches();
    esp_idf_svc::log::EspLogger::initialize_default();

    block_on(async {
        for _ in 0..10 {
            log::info!("tick");
            Timer::after(Duration::from_secs(1)).await;
        }
    });
}


I get the output:

I (571) esp_idf_embassy_time: tick
I (2151) esp_idf_embassy_time: tick
I (5311) esp_idf_embassy_time: tick
I (11621) esp_idf_embassy_time: tick
I (24251) esp_idf_embassy_time: tick
I (49501) esp_idf_embassy_time: tick
I (100011) esp_idf_embassy_time: tick

which is very inaccurate.

The same code produces better results when using the esp-idf-svc/embassy-time-isr-queue feature and removing the embassy-time/generic-queue feature

ivmarkov added a commit that referenced this issue Jan 12, 2024
@ivmarkov
Copy link
Collaborator

Should be fine now.

@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants