Make low fuel color configurable
This commit is contained in:
+7
-2
@@ -54,10 +54,10 @@ static void batt_callback(BatteryChargeState state) {
|
||||
s_batt_level = state.charge_percent / 5;
|
||||
layer_mark_dirty(s_fuel_layer);
|
||||
if (!s_low_fuel_indicator && s_batt_level <= settings.LowFuelBars) {
|
||||
replace_gbitmap_color(s_applied_fg, GColorChromeYellow, s_e_icon, s_e_layer);
|
||||
replace_gbitmap_color(s_applied_fg, settings.ColorLowFuel, s_e_icon, s_e_layer);
|
||||
s_low_fuel_indicator = true;
|
||||
} else if (s_low_fuel_indicator && s_batt_level > settings.LowFuelBars) {
|
||||
replace_gbitmap_color(GColorChromeYellow, s_applied_fg, s_e_icon, s_e_layer);
|
||||
replace_gbitmap_color(settings.ColorLowFuel, s_applied_fg, s_e_icon, s_e_layer);
|
||||
s_low_fuel_indicator = false;
|
||||
}
|
||||
}
|
||||
@@ -307,6 +307,7 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) {
|
||||
Tuple *color_mg_bar_tuple = dict_find(iter, MESSAGE_KEY_CLAY_BAR_MG_COLOR);
|
||||
Tuple *color_mg_time_tuple = dict_find(iter, MESSAGE_KEY_CLAY_TIME_MG_COLOR);
|
||||
Tuple *color_fg_tuple = dict_find(iter, MESSAGE_KEY_CLAY_FG_COLOR);
|
||||
Tuple *color_low_fuel_tuple = dict_find(iter, MESSAGE_KEY_CLAY_LOW_FUEL_COLOR);
|
||||
if (show_time_mg_tuple) {
|
||||
settings.ShowTimeMG = show_time_mg_tuple->value->uint8;
|
||||
}
|
||||
@@ -328,6 +329,9 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) {
|
||||
if (color_fg_tuple) {
|
||||
settings.ColorFG = GColorFromHEX(color_fg_tuple->value->int32);
|
||||
}
|
||||
if (color_low_fuel_tuple) {
|
||||
settings.ColorLowFuel = GColorFromHEX(color_low_fuel_tuple->value->int32);
|
||||
}
|
||||
persist_write_data(STORAGE_KEY_SETTINGS, &settings, sizeof(settings));
|
||||
apply_settings(false);
|
||||
}
|
||||
@@ -344,6 +348,7 @@ static void init() {
|
||||
settings.ColorMGBars = GColorDarkGray;
|
||||
settings.ColorMGTime = GColorDarkGray;
|
||||
settings.ColorFG = GColorWhite;
|
||||
settings.ColorLowFuel = GColorChromeYellow;
|
||||
}
|
||||
|
||||
// load bitmaps
|
||||
|
||||
Reference in New Issue
Block a user