Skip to content

Commit 6c5eacd

Browse files
author
Aaron Züger
committed
finalize 24h style analog watchface; remove development comments
1 parent 57c696e commit 6c5eacd

2 files changed

Lines changed: 104 additions & 175 deletions

File tree

src/displayapp/screens/WatchFaceAnalog.cpp

Lines changed: 100 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,13 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController,
6767
minor_scales = lv_linemeter_create(lv_scr_act(), nullptr);
6868
if (settingsController.GetAClockStyle() == Pinetime::Controllers::Settings::AClockStyle::H24) {
6969
lv_linemeter_set_scale(minor_scales, 360, 61);
70+
lv_linemeter_set_angle_offset(minor_scales, 180);
71+
lv_obj_set_size(minor_scales, 236, 236);
7072
} else {
7173
lv_linemeter_set_scale(minor_scales, 300, 51);
74+
lv_linemeter_set_angle_offset(minor_scales, 180);
75+
lv_obj_set_size(minor_scales, 240, 240);
7276
}
73-
lv_linemeter_set_angle_offset(minor_scales, 180);
74-
lv_obj_set_size(minor_scales, 240, 240);
7577
lv_obj_align(minor_scales, nullptr, LV_ALIGN_CENTER, 0, 0);
7678
lv_obj_set_style_local_bg_opa(minor_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
7779
lv_obj_set_style_local_scale_width(minor_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4);
@@ -82,140 +84,95 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController,
8284
if (settingsController.GetAClockStyle() == Pinetime::Controllers::Settings::AClockStyle::H24) {
8385
lv_linemeter_set_scale(major_scales, 360, 13);
8486
lv_linemeter_set_angle_offset(major_scales, 30);
85-
lv_obj_set_style_local_scale_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4);
86-
lv_obj_set_style_local_scale_end_line_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 2);
8787
} else {
8888
lv_linemeter_set_scale(major_scales, 300, 11);
8989
lv_linemeter_set_angle_offset(major_scales, 180);
90-
lv_obj_set_style_local_scale_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 6);
91-
lv_obj_set_style_local_scale_end_line_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4);
9290
}
91+
lv_obj_set_style_local_scale_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 6);
92+
lv_obj_set_style_local_scale_end_line_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4);
9393
lv_obj_set_size(major_scales, 240, 240);
9494
lv_obj_align(major_scales, nullptr, LV_ALIGN_CENTER, 0, 0);
9595
lv_obj_set_style_local_bg_opa(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
9696
lv_obj_set_style_local_scale_end_color(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
9797

98+
// create 12 hour style scales
99+
large_scales_12 = lv_linemeter_create(lv_scr_act(), nullptr);
100+
lv_linemeter_set_scale(large_scales_12, 180, 3);
101+
lv_linemeter_set_angle_offset(large_scales_12, 180);
102+
lv_obj_set_size(large_scales_12, 240, 240);
103+
lv_obj_align(large_scales_12, nullptr, LV_ALIGN_CENTER, 0, 0);
104+
lv_obj_set_style_local_scale_width(large_scales_12, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 20);
105+
lv_obj_set_style_local_scale_end_line_width(large_scales_12, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4);
106+
lv_obj_set_style_local_bg_opa(large_scales_12, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
107+
lv_obj_set_style_local_scale_end_color(large_scales_12, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA);
108+
109+
// create 24 hour style left hand scales
110+
large_scales_24_a = lv_linemeter_create(lv_scr_act(), nullptr);
111+
lv_linemeter_set_scale(large_scales_24_a, 150, 11);
112+
lv_linemeter_set_angle_offset(large_scales_24_a, 270);
113+
lv_obj_set_size(large_scales_24_a, 200, 200);
114+
lv_obj_align(large_scales_24_a, nullptr, LV_ALIGN_CENTER, 0, 0);
115+
lv_obj_set_style_local_scale_width(large_scales_24_a, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 10);
116+
lv_obj_set_style_local_scale_end_line_width(large_scales_24_a, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 2);
117+
lv_obj_set_style_local_bg_opa(large_scales_24_a, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
118+
lv_obj_set_style_local_scale_end_color(large_scales_24_a, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA);
119+
120+
// create 24 hour style right hand scales
121+
large_scales_24_b = lv_linemeter_create(lv_scr_act(), nullptr);
122+
lv_linemeter_set_scale(large_scales_24_b, 150, 11);
123+
lv_linemeter_set_angle_offset(large_scales_24_b, 90);
124+
lv_obj_set_size(large_scales_24_b, 200, 200);
125+
lv_obj_align(large_scales_24_b, nullptr, LV_ALIGN_CENTER, 0, 0);
126+
lv_obj_set_style_local_scale_width(large_scales_24_b, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 10);
127+
lv_obj_set_style_local_scale_end_line_width(large_scales_24_b, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 2);
128+
lv_obj_set_style_local_bg_opa(large_scales_24_b, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
129+
lv_obj_set_style_local_scale_end_color(large_scales_24_b, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA);
98130

99-
large_scales = lv_linemeter_create(lv_scr_act(), nullptr);
100131
if (settingsController.GetAClockStyle() == Pinetime::Controllers::Settings::AClockStyle::H24) {
101-
lv_linemeter_set_scale(large_scales, 360, 13);
102-
lv_linemeter_set_angle_offset(large_scales, 15);
103-
lv_obj_set_size(large_scales, 225, 225);
104-
lv_obj_align(large_scales, nullptr, LV_ALIGN_CENTER, 0, 0);
105-
lv_obj_set_style_local_scale_width(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 10);
106-
lv_obj_set_style_local_scale_end_line_width(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 3);
132+
lv_obj_set_hidden(large_scales_24_a, false);
133+
lv_obj_set_hidden(large_scales_24_b, false);
134+
lv_obj_set_hidden(large_scales_12, true);
107135
} else {
108-
lv_linemeter_set_scale(large_scales, 180, 3);
109-
lv_linemeter_set_angle_offset(large_scales, 180);
110-
lv_obj_set_size(large_scales, 240, 240);
111-
lv_obj_align(large_scales, nullptr, LV_ALIGN_CENTER, 0, 0);
112-
lv_obj_set_style_local_scale_width(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 20);
113-
lv_obj_set_style_local_scale_end_line_width(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4);
136+
lv_obj_set_hidden(large_scales_24_a, true);
137+
lv_obj_set_hidden(large_scales_24_b, true);
138+
lv_obj_set_hidden(large_scales_12, false);
114139
}
115-
lv_obj_set_style_local_bg_opa(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
116-
lv_obj_set_style_local_scale_end_color(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA);
117140

141+
// create minute scales separation circle
142+
circle = lv_obj_create(lv_scr_act(), nullptr);
143+
lv_obj_set_style_local_bg_opa(circle, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
144+
lv_obj_set_style_local_radius(circle, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 102);
145+
lv_obj_set_size(circle, 204, 204);
146+
lv_obj_align(circle, nullptr, LV_ALIGN_CENTER, 0, 0);
147+
lv_obj_set_style_local_border_width(circle, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 1);
148+
lv_obj_set_style_local_border_color(circle, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
149+
150+
// create digits
118151
zero = lv_label_create(lv_scr_act(), nullptr);
119152
lv_label_set_align(zero, LV_LABEL_ALIGN_CENTER);
120-
lv_label_set_text_static(zero, "24");
121-
lv_obj_set_pos(zero, 107, 17);
153+
lv_label_set_text_static(zero, "0");
154+
lv_obj_set_pos(zero, 113, 25);
122155
lv_obj_set_style_local_text_color(zero, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA);
123156

124-
/* two = lv_label_create(lv_scr_act(), nullptr); */
125-
/* lv_label_set_align(two, LV_LABEL_ALIGN_CENTER); */
126-
/* lv_label_set_text_static(two, "2"); */
127-
/* lv_obj_set_pos(two, 160, 30); */
128-
/* lv_obj_set_style_local_text_color(two, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); */
129-
130-
/* four = lv_label_create(lv_scr_act(), nullptr); */
131-
/* lv_label_set_align(four, LV_LABEL_ALIGN_CENTER); */
132-
/* lv_label_set_text_static(four, "4"); */
133-
/* lv_obj_set_pos(four, 192, 60); */
134-
/* lv_obj_set_style_local_text_color(four, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); */
135-
136-
/* six = lv_label_create(lv_scr_act(), nullptr); */
137-
/* lv_label_set_align(six, LV_LABEL_ALIGN_CENTER); */
138-
/* lv_label_set_text_static(six, "6"); */
139-
/* lv_obj_set_pos(six, 206, 107); */
140-
/* lv_obj_set_style_local_text_color(six, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); */
141-
142-
/* eight = lv_label_create(lv_scr_act(), nullptr); */
143-
/* lv_label_set_align(eight, LV_LABEL_ALIGN_CENTER); */
144-
/* lv_label_set_text_static(eight, "8"); */
145-
/* lv_obj_set_pos(eight, 192, 154); */
146-
/* lv_obj_set_style_local_text_color(eight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); */
147-
148-
/* ten = lv_label_create(lv_scr_act(), nullptr); */
149-
/* lv_label_set_align(ten, LV_LABEL_ALIGN_CENTER); */
150-
/* lv_label_set_text_static(ten, "10"); */
151-
/* lv_obj_set_pos(ten, 153, 184); */
152-
/* lv_obj_set_style_local_text_color(ten, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); */
153-
154157
twelve = lv_label_create(lv_scr_act(), nullptr);
155158
lv_label_set_align(twelve, LV_LABEL_ALIGN_CENTER);
156159
lv_label_set_text_static(twelve, "12");
157160
if (settingsController.GetAClockStyle() == Pinetime::Controllers::Settings::AClockStyle::H24) {
158-
lv_obj_set_pos(twelve, 107, 198);
161+
lv_obj_set_pos(twelve, 107, 188);
159162
} else {
160163
lv_obj_set_pos(twelve, 107, 10);
161164
}
162165
lv_obj_set_style_local_text_color(twelve, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA);
163166

164-
/* fourteen = lv_label_create(lv_scr_act(), nullptr); */
165-
/* lv_label_set_align(fourteen, LV_LABEL_ALIGN_CENTER); */
166-
/* lv_label_set_text_static(fourteen, "14"); */
167-
/* lv_obj_set_pos(fourteen, 62, 184); */
168-
/* lv_obj_set_style_local_text_color(fourteen, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); */
169-
170-
/* sixteen = lv_label_create(lv_scr_act(), nullptr); */
171-
/* lv_label_set_align(sixteen, LV_LABEL_ALIGN_CENTER); */
172-
/* lv_label_set_text_static(sixteen, "16"); */
173-
/* lv_obj_set_pos(sixteen, 32, 152); */
174-
/* lv_obj_set_style_local_text_color(sixteen, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); */
175-
176-
/* eighteen = lv_label_create(lv_scr_act(), nullptr); */
177-
/* lv_label_set_align(eighteen, LV_LABEL_ALIGN_CENTER); */
178-
/* lv_label_set_text_static(eighteen, "18"); */
179-
/* lv_obj_set_pos(eighteen, 20, 107); */
180-
/* lv_obj_set_style_local_text_color(eighteen, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); */
181-
182-
/* twenty = lv_label_create(lv_scr_act(), nullptr); */
183-
/* lv_label_set_align(twenty, LV_LABEL_ALIGN_CENTER); */
184-
/* lv_label_set_text_static(twenty, "20"); */
185-
/* lv_obj_set_pos(twenty, 32, 62); */
186-
/* lv_obj_set_style_local_text_color(twenty, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); */
187-
188-
/* twentytwo = lv_label_create(lv_scr_act(), nullptr); */
189-
/* lv_label_set_align(twentytwo, LV_LABEL_ALIGN_CENTER); */
190-
/* lv_label_set_text_static(twentytwo, "22"); */
191-
/* lv_obj_set_pos(twentytwo, 62, 30); */
192-
/* lv_obj_set_style_local_text_color(twentytwo, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); */
193-
194167
if (settingsController.GetAClockStyle() == Pinetime::Controllers::Settings::AClockStyle::H24) {
168+
lv_obj_set_hidden(circle, false);
195169
lv_obj_set_hidden(zero, false);
196-
/* lv_obj_set_hidden(two, false); */
197-
/* lv_obj_set_hidden(four, false); */
198-
/* lv_obj_set_hidden(six, false); */
199-
/* lv_obj_set_hidden(eight, false); */
200-
/* lv_obj_set_hidden(ten, false); */
201-
/* lv_obj_set_hidden(fourteen, false); */
202-
/* lv_obj_set_hidden(sixteen, false); */
203-
/* lv_obj_set_hidden(eighteen, false); */
204-
/* lv_obj_set_hidden(twenty, false); */
205-
/* lv_obj_set_hidden(twentytwo, false); */
170+
lv_obj_set_pos(twelve, 107, 188);
206171
tfHourEnable = true;
207172
} else {
173+
lv_obj_set_hidden(circle, true);
208174
lv_obj_set_hidden(zero, true);
209-
/* lv_obj_set_hidden(two, true); */
210-
/* lv_obj_set_hidden(four, true); */
211-
/* lv_obj_set_hidden(six, true); */
212-
/* lv_obj_set_hidden(eight, true); */
213-
/* lv_obj_set_hidden(ten, true); */
214-
/* lv_obj_set_hidden(fourteen, true); */
215-
/* lv_obj_set_hidden(sixteen, true); */
216-
/* lv_obj_set_hidden(eighteen, true); */
217-
/* lv_obj_set_hidden(twenty, true); */
218-
/* lv_obj_set_hidden(twentytwo, true); */
175+
lv_obj_set_pos(twelve, 107, 10);
219176
tfHourEnable = false;
220177
}
221178

@@ -236,17 +193,18 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController,
236193
lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0);
237194

238195
// Date - Day / Week day
239-
240196
label_date_day = lv_label_create(lv_scr_act(), nullptr);
241197
lv_obj_set_style_local_text_color(label_date_day, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::orange);
242198
lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day());
243199
lv_label_set_align(label_date_day, LV_LABEL_ALIGN_CENTER);
244-
lv_obj_align(label_date_day, nullptr, LV_ALIGN_CENTER, 50, 0);
200+
if (settingsController.GetAClockStyle() == Pinetime::Controllers::Settings::AClockStyle::H24) {
201+
lv_obj_align(label_date_day, nullptr, LV_ALIGN_CENTER, 40, 0);
202+
} else {
203+
lv_obj_align(label_date_day, nullptr, LV_ALIGN_CENTER, 50, 0);
204+
}
245205

246206
minute_body = lv_line_create(lv_scr_act(), nullptr);
247-
/* minute_body_trace = lv_line_create(lv_scr_act(), nullptr); */
248207
hour_body = lv_line_create(lv_scr_act(), nullptr);
249-
/* hour_body_trace = lv_line_create(lv_scr_act(), nullptr); */
250208
second_body = lv_line_create(lv_scr_act(), nullptr);
251209

252210
lv_style_init(&second_line_style);
@@ -266,24 +224,12 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController,
266224
lv_style_set_line_rounded(&minute_line_style, LV_STATE_DEFAULT, true);
267225
lv_obj_add_style(minute_body, LV_LINE_PART_MAIN, &minute_line_style);
268226

269-
/* lv_style_init(&minute_line_style_trace); */
270-
/* lv_style_set_line_width(&minute_line_style_trace, LV_STATE_DEFAULT, 3); */
271-
/* lv_style_set_line_color(&minute_line_style_trace, LV_STATE_DEFAULT, LV_COLOR_WHITE); */
272-
/* lv_style_set_line_rounded(&minute_line_style_trace, LV_STATE_DEFAULT, false); */
273-
/* lv_obj_add_style(minute_body_trace, LV_LINE_PART_MAIN, &minute_line_style_trace); */
274-
275227
lv_style_init(&hour_line_style);
276228
lv_style_set_line_width(&hour_line_style, LV_STATE_DEFAULT, 5);
277229
lv_style_set_line_color(&hour_line_style, LV_STATE_DEFAULT, LV_COLOR_WHITE);
278230
lv_style_set_line_rounded(&hour_line_style, LV_STATE_DEFAULT, true);
279231
lv_obj_add_style(hour_body, LV_LINE_PART_MAIN, &hour_line_style);
280232

281-
/* lv_style_init(&hour_line_style_trace); */
282-
/* lv_style_set_line_width(&hour_line_style_trace, LV_STATE_DEFAULT, 3); */
283-
/* lv_style_set_line_color(&hour_line_style_trace, LV_STATE_DEFAULT, LV_COLOR_WHITE); */
284-
/* lv_style_set_line_rounded(&hour_line_style_trace, LV_STATE_DEFAULT, false); */
285-
/* lv_obj_add_style(hour_body_trace, LV_LINE_PART_MAIN, &hour_line_style_trace); */
286-
287233
btnClose = lv_btn_create(lv_scr_act(), nullptr);
288234
btnClose->user_data = this;
289235
lv_obj_set_size(btnClose, 60, 60);
@@ -323,15 +269,12 @@ WatchFaceAnalog::~WatchFaceAnalog() {
323269
lv_task_del(taskRefresh);
324270

325271
lv_style_reset(&hour_line_style);
326-
/* lv_style_reset(&hour_line_style_trace); */
327272
lv_style_reset(&minute_line_style);
328-
/* lv_style_reset(&minute_line_style_trace); */
329273
lv_style_reset(&second_line_style);
330274

331275
lv_obj_clean(lv_scr_act());
332276
}
333277

334-
/* Begin Settings */
335278
bool WatchFaceAnalog::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
336279
if ((event == Pinetime::Applications::TouchEvents::LongTap) && lv_obj_get_hidden(btnClose)) {
337280
lv_obj_set_hidden(btnClose, false);
@@ -360,7 +303,6 @@ bool WatchFaceAnalog::OnButtonPushed() {
360303
}
361304
return false;
362305
}
363-
/* End Settings */
364306

365307
void WatchFaceAnalog::UpdateClock() {
366308
uint8_t hour = dateTimeController.Hours();
@@ -372,11 +314,7 @@ void WatchFaceAnalog::UpdateClock() {
372314
minute_point[0] = CoordinateRelocate(-15, angle);
373315
minute_point[1] = CoordinateRelocate(MinuteLength, angle);
374316

375-
/* minute_point_trace[0] = CoordinateRelocate(5, angle); */
376-
/* minute_point_trace[1] = CoordinateRelocate(31, angle); */
377-
378317
lv_line_set_points(minute_body, minute_point, 2);
379-
/* lv_line_set_points(minute_body_trace, minute_point_trace, 2); */
380318
}
381319

382320
if (sHour != hour || sMinute != minute || sTfHourEnable != tfHourEnable) {
@@ -393,11 +331,7 @@ void WatchFaceAnalog::UpdateClock() {
393331
hour_point[0] = CoordinateRelocate(-10, angle);
394332
hour_point[1] = CoordinateRelocate(HourLength, angle);
395333

396-
/* hour_point_trace[0] = CoordinateRelocate(5, angle); */
397-
/* hour_point_trace[1] = CoordinateRelocate(31, angle); */
398-
399334
lv_line_set_points(hour_body, hour_point, 2);
400-
/* lv_line_set_points(hour_body_trace, hour_point_trace, 2); */
401335
}
402336

403337
if (sSecond != second) {
@@ -468,48 +402,56 @@ void WatchFaceAnalog::UpdateSelected(lv_obj_t* object, lv_event_t event) {
468402

469403
if (object == btnClockStyle) {
470404
if (tfHourEnable == false) {
471-
// set mode to 24 hours
405+
// set clockstyle to 24 hours
472406
tfHourEnable = true;
473-
// digits
474-
lv_obj_set_pos(twelve, 107, 198);
407+
408+
// (un)hide clockstyle elements
409+
lv_obj_set_hidden(large_scales_12, true);
410+
lv_obj_set_hidden(large_scales_24_a, false);
411+
lv_obj_set_hidden(large_scales_24_b, false);
412+
lv_obj_set_hidden(circle, false);
475413
lv_obj_set_hidden(zero, false);
476-
// scales
414+
415+
// reposition 12
416+
lv_obj_set_pos(twelve, 107, 188);
417+
// reposition date
418+
lv_obj_align(label_date_day, nullptr, LV_ALIGN_CENTER, 40, 0);
419+
420+
// changes to minor and major scales
477421
lv_linemeter_set_scale(minor_scales, 360, 61);
422+
lv_obj_set_size(minor_scales, 236, 236);
423+
lv_obj_align(minor_scales, nullptr, LV_ALIGN_CENTER, 0, 0);
478424

479425
lv_linemeter_set_scale(major_scales, 360, 13);
480426
lv_linemeter_set_angle_offset(major_scales, 30);
481-
lv_obj_set_style_local_scale_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4);
482-
lv_obj_set_style_local_scale_end_line_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 2);
483-
484-
lv_linemeter_set_scale(large_scales, 360, 13);
485-
lv_linemeter_set_angle_offset(large_scales, 15);
486-
lv_obj_set_size(large_scales, 225, 225);
487-
lv_obj_align(large_scales, nullptr, LV_ALIGN_CENTER, 0, 0);
488-
lv_obj_set_style_local_scale_width(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 10);
489-
lv_obj_set_style_local_scale_end_line_width(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 3);
490427

428+
// save settings
491429
settingsController.SetAClockStyle(Controllers::Settings::AClockStyle::H24);
492430
} else {
493-
// set mode to 12 hours
431+
// set clockstyle to 12 hours
494432
tfHourEnable = false;
495-
// digits
496-
lv_obj_set_pos(twelve, 107, 10);
433+
434+
// (un)hide clockstyle elements
435+
lv_obj_set_hidden(large_scales_12, false);
436+
lv_obj_set_hidden(large_scales_24_a, true);
437+
lv_obj_set_hidden(large_scales_24_b, true);
438+
lv_obj_set_hidden(circle, true);
497439
lv_obj_set_hidden(zero, true);
498-
// scales
440+
441+
// reposition 12
442+
lv_obj_set_pos(twelve, 107, 10);
443+
// reposition date
444+
lv_obj_align(label_date_day, nullptr, LV_ALIGN_CENTER, 50, 0);
445+
446+
// changes to minor and major scales
499447
lv_linemeter_set_scale(minor_scales, 300, 51);
448+
lv_obj_set_size(minor_scales, 240, 240);
449+
lv_obj_align(minor_scales, nullptr, LV_ALIGN_CENTER, 0, 0);
500450

501451
lv_linemeter_set_scale(major_scales, 300, 11);
502452
lv_linemeter_set_angle_offset(major_scales, 180);
503-
lv_obj_set_style_local_scale_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 6);
504-
lv_obj_set_style_local_scale_end_line_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4);
505-
506-
lv_linemeter_set_scale(large_scales, 180, 3);
507-
lv_linemeter_set_angle_offset(large_scales, 180);
508-
lv_obj_set_size(large_scales, 240, 240);
509-
lv_obj_align(large_scales, nullptr, LV_ALIGN_CENTER, 0, 0);
510-
lv_obj_set_style_local_scale_width(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 20);
511-
lv_obj_set_style_local_scale_end_line_width(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4);
512453

454+
// save settings
513455
settingsController.SetAClockStyle(Controllers::Settings::AClockStyle::H12);
514456
}
515457
}

0 commit comments

Comments
 (0)