summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/Alarm.cpp
diff options
context:
space:
mode:
authorRiku Isokoski <riksu9000@gmail.com>2022-07-26 13:15:07 +0300
committerJF <JF002@users.noreply.github.com>2022-08-02 22:51:04 +0200
commit7a6ede112e2a777321db16f367a6e4429604e5d9 (patch)
tree0b4aabc03229ad2c7131f374843ce01bce6ac3e1 /src/displayapp/screens/Alarm.cpp
parent97048121b05abb2c51c09a4340fe0aa223f46182 (diff)
Remove clockType variable by checking for nullptr instead.
Saves a few bytes
Diffstat (limited to 'src/displayapp/screens/Alarm.cpp')
-rw-r--r--src/displayapp/screens/Alarm.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/displayapp/screens/Alarm.cpp b/src/displayapp/screens/Alarm.cpp
index d508dd39..bcb6eff8 100644
--- a/src/displayapp/screens/Alarm.cpp
+++ b/src/displayapp/screens/Alarm.cpp
@@ -43,12 +43,18 @@ Alarm::Alarm(DisplayApp* app,
Controllers::AlarmController& alarmController,
Controllers::Settings::ClockType clockType,
System::SystemTask& systemTask)
- : Screen(app), alarmController {alarmController}, clockType {clockType}, systemTask {systemTask} {
+ : Screen(app), alarmController {alarmController}, systemTask {systemTask} {
hourCounter.Create();
lv_obj_align(hourCounter.GetObject(), nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0);
if (clockType == Controllers::Settings::ClockType::H12) {
hourCounter.EnableTwelveHourMode();
+
+ lblampm = lv_label_create(lv_scr_act(), nullptr);
+ lv_obj_set_style_local_text_font(lblampm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20);
+ lv_label_set_text_static(lblampm, "AM");
+ lv_label_set_align(lblampm, LV_LABEL_ALIGN_CENTER);
+ lv_obj_align(lblampm, lv_scr_act(), LV_ALIGN_CENTER, 0, 30);
}
hourCounter.SetValue(alarmController.Hours());
hourCounter.SetValueChangedEventCallback(this, ValueChangedHandler);
@@ -63,12 +69,6 @@ Alarm::Alarm(DisplayApp* app,
lv_label_set_text_static(colonLabel, ":");
lv_obj_align(colonLabel, lv_scr_act(), LV_ALIGN_CENTER, 0, -29);
- lblampm = lv_label_create(lv_scr_act(), nullptr);
- lv_obj_set_style_local_text_font(lblampm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20);
- lv_label_set_text_static(lblampm, " ");
- lv_label_set_align(lblampm, LV_LABEL_ALIGN_CENTER);
- lv_obj_align(lblampm, lv_scr_act(), LV_ALIGN_CENTER, 0, 30);
-
btnStop = lv_btn_create(lv_scr_act(), nullptr);
btnStop->user_data = this;
lv_obj_set_event_cb(btnStop, btnEventHandler);
@@ -179,7 +179,7 @@ void Alarm::OnValueChanged() {
}
void Alarm::UpdateAlarmTime() {
- if (clockType == Controllers::Settings::ClockType::H12) {
+ if (lblampm != nullptr) {
if (hourCounter.GetValue() >= 12) {
lv_label_set_text_static(lblampm, "PM");
} else {