Light temperature warning indicator for GPS timeout, API timeout, and API failure

This commit is contained in:
2026-06-13 17:48:15 -04:00
parent 0e44c32577
commit df3ec1cc72
2 changed files with 35 additions and 8 deletions
+17 -5
View File
@@ -44,7 +44,7 @@ static bool s_pkjs_ready = false;
static bool s_fuel_is_warning = false;
static int s_batt_level;
static bool s_temp_is_warning = false;
static uint8_t s_temp_level;
static int8_t s_temp_level;
// bar statics
static const uint8_t s_bar_height = 8;
@@ -52,8 +52,11 @@ static const uint8_t s_bar_width = 17;
static const uint8_t s_bar_spacing = s_bar_height + 1;
static void toggle_fuel_warning_state(bool enable_warning, bool force) {
if (!force && (enable_warning == s_fuel_is_warning)) {
return;
}
GColor dst = enable_warning ? settings.ColorWarning : settings.ColorFG;
if ((!force && (enable_warning == s_fuel_is_warning)) || (s_first_settings_application && !enable_warning && dst.argb == s_applied_e.argb)) {
if (s_first_settings_application && !enable_warning && dst.argb == s_applied_e.argb) {
// at startup, s_applied_e.argb is GColorWhite
// for those using white fg, do not pointlessly replace white at startup if that is the destination anyway
return;
@@ -64,8 +67,11 @@ static void toggle_fuel_warning_state(bool enable_warning, bool force) {
}
static void toggle_temp_warning_state(bool enable_warning, bool force) {
if (!force && (enable_warning == s_temp_is_warning)) {
return;
}
GColor dst = enable_warning ? settings.ColorWarning : settings.ColorFG;
if ((!force && (enable_warning == s_temp_is_warning)) || (s_first_settings_application && !enable_warning && dst.argb == s_applied_c_h.argb)) {
if (s_first_settings_application && !enable_warning && dst.argb == s_applied_c_h.argb) {
// at startup, s_applied_c_h.argb is GColorWhite
// for those using white fg, do not pointlessly replace white at startup if that is the destination anyway
return;
@@ -387,8 +393,14 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) {
// TEMPERATURE DATA
Tuple *temp_bar_count = dict_find(iter, MESSAGE_KEY_PKJS_TEMP_BAR_COUNT);
if (temp_bar_count) {
s_temp_level = temp_bar_count->value->uint8;
layer_mark_dirty(s_temp_layer);
int8_t new_temp_level = temp_bar_count->value->int8;
if (new_temp_level >= 0) {
s_temp_level = new_temp_level;
toggle_temp_warning_state(false, false);
layer_mark_dirty(s_temp_layer);
} else {
toggle_temp_warning_state(true, false);
}
return;
}