| ... | ... |
@@ -36,6 +36,7 @@ static uint16_t minute_data_size = 0; |
| 36 | 36 |
static uint16_t minute_index = 0; |
| 37 | 37 |
static time_t minute_first = 0, minute_last = 0; |
| 38 | 38 |
static bool modal_displayed = false; |
| 39 |
+static bool display_dirty = false; |
|
| 39 | 40 |
static char global_buffer[1024]; |
| 40 | 41 |
|
| 41 | 42 |
static struct widget {
|
| ... | ... |
@@ -93,6 +94,7 @@ static void |
| 93 | 94 |
update_progress(void) {
|
| 94 | 95 |
update_half_progress(&phone); |
| 95 | 96 |
update_half_progress(&web); |
| 97 |
+ display_dirty = false; |
|
| 96 | 98 |
} |
| 97 | 99 |
|
| 98 | 100 |
#define PROGRESS_HEIGHT 10 |
| ... | ... |
@@ -299,7 +301,7 @@ send_minute_data(HealthMinuteData *data, HealthActivityMask activity_mask, |
| 299 | 301 |
|
| 300 | 302 |
if (!phone.first_key) phone.first_key = int_key; |
| 301 | 303 |
phone.current_key = int_key; |
| 302 |
- update_progress(); |
|
| 304 |
+ display_dirty = true; |
|
| 303 | 305 |
} |
| 304 | 306 |
|
| 305 | 307 |
static bool |
| ... | ... |
@@ -418,7 +420,7 @@ inbox_received_handler(DictionaryIterator *iterator, void *context) {
|
| 418 | 420 |
if (tuple) {
|
| 419 | 421 |
web.current_key = tuple_uint(tuple); |
| 420 | 422 |
if (!web.first_key) web.first_key = web.current_key; |
| 421 |
- update_progress(); |
|
| 423 |
+ display_dirty = true; |
|
| 422 | 424 |
} |
| 423 | 425 |
|
| 424 | 426 |
tuple = dict_find(iterator, MSG_KEY_UPLOAD_START); |
| ... | ... |
@@ -443,6 +445,13 @@ outbox_failed_handler(DictionaryIterator *iterator, AppMessageResult reason, |
| 443 | 445 |
APP_LOG(APP_LOG_LEVEL_ERROR, "Outbox failed: 0x%x", (unsigned)reason); |
| 444 | 446 |
} |
| 445 | 447 |
|
| 448 |
+static void |
|
| 449 |
+tick_handler(struct tm *tick_time, TimeUnits units_changed) {
|
|
| 450 |
+ (void)tick_time; |
|
| 451 |
+ (void)units_changed; |
|
| 452 |
+ if (display_dirty) update_progress(); |
|
| 453 |
+} |
|
| 454 |
+ |
|
| 446 | 455 |
static void |
| 447 | 456 |
init(void) {
|
| 448 | 457 |
app_message_register_inbox_received(inbox_received_handler); |
| ... | ... |
@@ -457,6 +466,7 @@ init(void) {
|
| 457 | 466 |
.unload = window_unload, |
| 458 | 467 |
}); |
| 459 | 468 |
window_stack_push(window, true); |
| 469 |
+ tick_timer_service_subscribe(SECOND_UNIT, &tick_handler); |
|
| 460 | 470 |
} |
| 461 | 471 |
|
| 462 | 472 |
static void deinit(void) {
|