diff --git a/package.json b/package.json index acab3e1..26adc57 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "civic", "segment", "display", + "led", "speedometer" ], "private": true, diff --git a/src/c/main.c b/src/c/main.c index fd45b7d..f466e05 100644 --- a/src/c/main.c +++ b/src/c/main.c @@ -40,6 +40,7 @@ static GBitmap *s_e_icon; static GBitmap *s_f_icon; // tracking statics +static bool s_pkjs_ready = false; static int s_batt_level; static uint8_t s_temp_level; @@ -252,26 +253,32 @@ static void update_minute_1() { } } +static void update_temperature() { + DictionaryIterator *out; + AppMessageResult result = app_message_outbox_begin(&out); + if (result != APP_MSG_OK) { + s_temp_level = 0; // error; set to 0 bars to indicate TODO invert color and set to 20? + return; + } + dict_write_int8(out, MESSAGE_KEY_PKJS_TEMP_BAR_COUNT, 1); + result = app_message_outbox_send(); + if (result != APP_MSG_OK) { + s_temp_level = 0; // error; set to 0 bars to indicate TODO invert color and set to 20? + return; + } +} + static void minute_handler(struct tm *tick_time, TimeUnits units_changed) { update_minute_1(); + if (s_pkjs_ready && tick_time->tm_min % 30 == 0) { + update_temperature(); + } } static void inbox_received_handler(DictionaryIterator *iter, void *context) { Tuple *ready_tuple = dict_find(iter, MESSAGE_KEY_PKJS_READY); if (ready_tuple) { - // request temp bars from PKJS - DictionaryIterator *out; - AppMessageResult result = app_message_outbox_begin(&out); - if (result != APP_MSG_OK) { - s_temp_level = 0; // error; set to 0 bars to indicate TODO invert color and set to 20? - return; - } - dict_write_int8(out, MESSAGE_KEY_PKJS_TEMP_BAR_COUNT, 1); - result = app_message_outbox_send(); - if (result != APP_MSG_OK) { - s_temp_level = 0; // error; set to 0 bars to indicate TODO invert color and set to 20? - return; - } + update_temperature(); return; }