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

Alarms don't ring after first time! #9

Closed
chathura-de-silva opened this issue Apr 27, 2024 · 0 comments
Closed

Alarms don't ring after first time! #9

chathura-de-silva opened this issue Apr 27, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@chathura-de-silva
Copy link
Owner

When any alarm is set for the first time on the device (When the EEPROM has no data) it does ring.
But if the same alarm is set again for any other time, it doesn't ring.

Turns out that in the code, the variable alarm_triggered[relavant_alarm] is not being set to false when ever alarm_enabled = true is the issue.

Have to correct the code snippet below by putting the line alarm_triggered[alarm] = false; below and out of the if statement.

   {
            delay(50);
            alarm_minutes[alarm] = temp_minute;
            if (!alarm_enabled)
            {
                alarm_enabled = true;
                save_is_alarm_enabled();
                for (int i = 0; i < n_alarms; i++)
                {
                    alarm_triggered[i] = true;
                }
            }
            alarm_triggered[alarm] = false;

            show_modal_page(alarm_ring, 1000, "Alarm set to " + formatNumber(temp_hour) + ":" + formatNumber(temp_minute), 10);
            save_alarm(alarm);
            break;
        }

Code snippet is inside the function set_alarm(int alarm) inside alarms.cpp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant