1
0
Fork 0

Cleaned up redundant if statements, spacing

Removed redundant if statements in hour button logic. Spacing is now in line with repo guidelines.
This commit is contained in:
Eli Weiss 2022-01-03 18:13:47 -05:00 committed by JF
parent 698288d822
commit 2bc338ceed
2 changed files with 43 additions and 47 deletions

View file

@ -161,7 +161,6 @@ void SettingSetTime::HandleButtonPress(lv_obj_t *object, lv_event_t event) {
else { else {
is24H = false; is24H = false;
} }
if (object == btnHoursPlus) { if (object == btnHoursPlus) {
hoursValue++; hoursValue++;
if (hoursValue > 23) if (hoursValue > 23)
@ -171,10 +170,8 @@ void SettingSetTime::HandleButtonPress(lv_obj_t *object, lv_event_t event) {
lv_label_set_text(lblampm, "AM"); lv_label_set_text(lblampm, "AM");
else else
lv_label_set_text(lblampm, "PM"); lv_label_set_text(lblampm, "PM");
}
if (!is24H)
lv_label_set_text_fmt(lblHours, "%02d", timeConvert(hoursValue)); lv_label_set_text_fmt(lblHours, "%02d", timeConvert(hoursValue));
else } else
lv_label_set_text_fmt(lblHours, "%02d", hoursValue); lv_label_set_text_fmt(lblHours, "%02d", hoursValue);
lv_btn_set_state(btnSetTime, LV_BTN_STATE_RELEASED); lv_btn_set_state(btnSetTime, LV_BTN_STATE_RELEASED);
} else if (object == btnHoursMinus) { } else if (object == btnHoursMinus) {
@ -186,10 +183,8 @@ void SettingSetTime::HandleButtonPress(lv_obj_t *object, lv_event_t event) {
lv_label_set_text(lblampm, "AM"); lv_label_set_text(lblampm, "AM");
else else
lv_label_set_text(lblampm, "PM"); lv_label_set_text(lblampm, "PM");
}
if (!is24H)
lv_label_set_text_fmt(lblHours, "%02d", timeConvert(hoursValue)); lv_label_set_text_fmt(lblHours, "%02d", timeConvert(hoursValue));
else } else
lv_label_set_text_fmt(lblHours, "%02d", hoursValue); lv_label_set_text_fmt(lblHours, "%02d", hoursValue);
lv_btn_set_state(btnSetTime, LV_BTN_STATE_RELEASED); lv_btn_set_state(btnSetTime, LV_BTN_STATE_RELEASED);
} else if (object == btnMinutesPlus) { } else if (object == btnMinutesPlus) {
@ -217,3 +212,4 @@ void SettingSetTime::HandleButtonPress(lv_obj_t *object, lv_event_t event) {
lv_btn_set_state(btnSetTime, LV_BTN_STATE_DISABLED); lv_btn_set_state(btnSetTime, LV_BTN_STATE_DISABLED);
} }
} }
}