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

updateTime() keeps firing the callback #310

Open
jberezin opened this issue Jul 26, 2024 · 1 comment
Open

updateTime() keeps firing the callback #310

jberezin opened this issue Jul 26, 2024 · 1 comment

Comments

@jberezin
Copy link

jberezin commented Jul 26, 2024

First I have a button which triggers the updateTime function:

   switch (type)
    {
    case B_DOWN:
        Serial.println("Button DOWN");

        if (sender->id == accuSet)
        {
            // fire the time call back
            // Request an update to the time
            Serial.println("Triggering time callback");
            ESPUI.updateTime(timeId);

            // Will trigger timeCallback
        }
        break;

I have checked and that code is only called once but the timeCallback fires least once a second. So my code is working and the timeUpdate is working but I only want it to occur once. I didn't know this was happening until I put in some serial print statements because my code seemed to be working fine:

Select: ID: 4, Value: 2024-07-26T08:01:40.864Z
utc time: 2024-07-26T08:01:40.864Z
Select: ID: 4, Value: 2024-07-26T08:01:40.913Z
utc time: 2024-07-26T08:01:40.913Z
Select: ID: 4, Value: 2024-07-26T08:01:40.995Z
utc time: 2024-07-26T08:01:40.995Z
Select: ID: 4, Value: 2024-07-26T08:01:41.101Z
utc time: 2024-07-26T08:01:41.101Z
Select: ID: 4, Value: 2024-07-26T08:01:41.146Z
utc time: 2024-07-26T08:01:41.146Z
Select: ID: 4, Value: 2024-07-26T08:01:41.199Z
utc time: 2024-07-26T08:01:41.199Z

I would like to know how to turn this off until the button which triggers the updateTime() is pressed again.

Thank you for any help here.

@jberezin
Copy link
Author

I worked around this problem by creating a new variable and testing it in the callback and simply returning if I don't really need the current time of day. I also tried disabling the time control but that didn't work.

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

1 participant