Update temperature every half hour

This commit is contained in:
2026-06-01 20:08:19 -04:00
parent 8a860b5377
commit 8717dcc6a4
2 changed files with 21 additions and 13 deletions
+1
View File
@@ -7,6 +7,7 @@
"civic", "civic",
"segment", "segment",
"display", "display",
"led",
"speedometer" "speedometer"
], ],
"private": true, "private": true,
+15 -8
View File
@@ -40,6 +40,7 @@ static GBitmap *s_e_icon;
static GBitmap *s_f_icon; static GBitmap *s_f_icon;
// tracking statics // tracking statics
static bool s_pkjs_ready = false;
static int s_batt_level; static int s_batt_level;
static uint8_t s_temp_level; static uint8_t s_temp_level;
@@ -252,14 +253,7 @@ static void update_minute_1() {
} }
} }
static void minute_handler(struct tm *tick_time, TimeUnits units_changed) { static void update_temperature() {
update_minute_1();
}
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; DictionaryIterator *out;
AppMessageResult result = app_message_outbox_begin(&out); AppMessageResult result = app_message_outbox_begin(&out);
if (result != APP_MSG_OK) { if (result != APP_MSG_OK) {
@@ -272,6 +266,19 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) {
s_temp_level = 0; // error; set to 0 bars to indicate TODO invert color and set to 20? s_temp_level = 0; // error; set to 0 bars to indicate TODO invert color and set to 20?
return; 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) {
update_temperature();
return; return;
} }