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

Alarm: Simplify alarm alerting screen (and fix bug with alerting on time value change) #2211

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/components/alarm/AlarmController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ uint32_t AlarmController::SecondsToAlarm() const {

void AlarmController::DisableAlarm() {
xTimerStop(alarmTimer, 0);
isAlerting = false;
if (alarm.isEnabled) {
alarm.isEnabled = false;
alarmChanged = true;
Expand Down
12 changes: 10 additions & 2 deletions src/displayapp/screens/Alarm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Alarm::Alarm(Controllers::AlarmController& alarmController,
btnStop = lv_btn_create(lv_scr_act(), nullptr);
btnStop->user_data = this;
lv_obj_set_event_cb(btnStop, btnEventHandler);
lv_obj_set_size(btnStop, 115, 50);
lv_obj_set_size(btnStop, 240, 70);
lv_obj_align(btnStop, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
lv_obj_set_style_local_bg_color(btnStop, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED);
txtStop = lv_label_create(btnStop, nullptr);
Expand Down Expand Up @@ -203,6 +203,10 @@ void Alarm::UpdateAlarmTime() {

void Alarm::SetAlerting() {
lv_obj_set_hidden(enableSwitch, true);
lv_obj_set_hidden(btnRecur, true);
lv_obj_set_hidden(btnInfo, true);
hourCounter.HideControls();
minuteCounter.HideControls();
lv_obj_set_hidden(btnStop, false);
taskStopAlarm = lv_task_create(StopAlarmTaskCallback, pdMS_TO_TICKS(60 * 1000), LV_TASK_PRIO_MID, this);
motorController.StartRinging();
Expand All @@ -218,8 +222,12 @@ void Alarm::StopAlerting() {
taskStopAlarm = nullptr;
}
wakeLock.Release();
lv_obj_set_hidden(enableSwitch, false);
lv_obj_set_hidden(btnStop, true);
hourCounter.ShowControls();
minuteCounter.ShowControls();
lv_obj_set_hidden(btnInfo, false);
lv_obj_set_hidden(btnRecur, false);
lv_obj_set_hidden(enableSwitch, false);
}

void Alarm::SetSwitchState(lv_anim_enable_t anim) {
Expand Down
Loading