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

How to not receive the same message again after restart? #333

Open
dmikushin opened this issue Jul 11, 2023 · 3 comments
Open

How to not receive the same message again after restart? #333

dmikushin opened this issue Jul 11, 2023 · 3 comments

Comments

@dmikushin
Copy link

I'm doing ESP.restart() in response to a restart message sent by Telegram client. However, after device reboots, it get the same restart message, and eventually restarts forever. How do I avoid executing the same message again after restart?

@Dilbao
Copy link

Dilbao commented Jul 26, 2023

If you restart from within the function that processes messages, the processing of the current message will be incomplete. Instead do something like this:

  • Make a global variable: bool RestartTriggered = false;
  • Change the variable instead at where the ESP.restart() is currently: RestartTriggered = true;
  • Add a check in your loop() for restart: if (RestartTriggered == true) {ESP.restart();}

@robedua
Copy link

robedua commented Apr 27, 2024

Boa tarde isso não funciona !!!!!

@ldijkman
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants