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

about Timers and relaunching (IDFGH-12883) #13845

Closed
3 tasks done
diplfranzhoepfinger opened this issue May 24, 2024 · 3 comments
Closed
3 tasks done

about Timers and relaunching (IDFGH-12883) #13845

diplfranzhoepfinger opened this issue May 24, 2024 · 3 comments
Assignees
Labels
Resolution: Won't Do This will not be worked on Status: Done Issue is done internally

Comments

@diplfranzhoepfinger
Copy link
Contributor

diplfranzhoepfinger commented May 24, 2024

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

using this:

https://github.com/diplfranzhoepfinger/esp_timer_example

it is the Example:

https://github.com/espressif/esp-idf-cxx/blob/main/examples/esp_timer_cxx/main/esp_timer_example.cpp

and modify it like this:

        timer.start(chrono::microseconds(200 * 1000));
        this_thread::sleep_for(std::chrono::milliseconds(550));
        timer.start(chrono::microseconds(200 * 1000));

and it works, the Timer can be started 2 times.

but in another Application i get this:

Exception with error: 259 ESP_ERR_INVALID_STATE
ESP_ERR_INVALID_STATE if the timer is already running

@espressif-bot espressif-bot added the Status: Opened Issue is new label May 24, 2024
@github-actions github-actions bot changed the title about Timers and relaunching about Timers and relaunching (IDFGH-12883) May 24, 2024
@igrr
Copy link
Member

igrr commented May 24, 2024

and it works, the Timer can be started 2 times.

I think it makes sense, because the timer is first started for 200 ms, so after a 550 ms delay, it is not running. Hence, we can start it again without getting an error.

If you want to start an already-running timer, you first need to call esp_timer_stop to cancel it.

@diplfranzhoepfinger
Copy link
Contributor Author

this is my Error.

i wanted to test a Timer started 2 times which is still running.

@Dazza0
Copy link
Contributor

Dazza0 commented May 28, 2024

@diplfranzhoepfinger Closing this issue as it's not a bug. ESP Timer start APIs are designed to return ESP_ERR_INVALID_STATE if the timer is already running.

@Dazza0 Dazza0 closed this as not planned Won't fix, can't repro, duplicate, stale May 28, 2024
@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: Won't Do This will not be worked on and removed Status: Opened Issue is new labels May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Won't Do This will not be worked on Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

4 participants