diff --git a/package.json b/package.json index 8148275..d97ad44 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "CLAY_BT_INDICATOR", "CLAY_SHOW_TIME_MG", "CLAY_DATE_TIMEOUT", - "CLAY_LOW_FUEL_BARS", + "CLAY_LOW_FUEL_PERCENT", "CLAY_LED_COLOR", "CLAY_BG_COLOR", "CLAY_BAR_MG_COLOR", diff --git a/src/c/main.c b/src/c/main.c index cc2f627..b81afa0 100644 --- a/src/c/main.c +++ b/src/c/main.c @@ -56,10 +56,10 @@ static const uint8_t s_bar_spacing = s_bar_height + 1; 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 && settings.LowFuelBars != 21) { + if (!s_low_fuel_indicator && state.charge_percent <= settings.LowFuelPercent) { replace_gbitmap_color(s_applied_fg, settings.ColorWarning, s_e_icon, s_e_layer); s_low_fuel_indicator = true; - } else if (s_low_fuel_indicator && s_batt_level > settings.LowFuelBars) { + } else if (s_low_fuel_indicator && state.charge_percent > settings.LowFuelPercent) { replace_gbitmap_color(settings.ColorWarning, s_applied_fg, s_e_icon, s_e_layer); s_low_fuel_indicator = false; } @@ -377,7 +377,7 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) { Tuple *track_bt_tuple = dict_find(iter, MESSAGE_KEY_CLAY_BT_INDICATOR); Tuple *show_time_mg_tuple = dict_find(iter, MESSAGE_KEY_CLAY_SHOW_TIME_MG); Tuple *date_timeout_tuple = dict_find(iter, MESSAGE_KEY_CLAY_DATE_TIMEOUT); - Tuple *low_fuel_bars_tuple = dict_find(iter, MESSAGE_KEY_CLAY_LOW_FUEL_BARS); + Tuple *low_fuel_percent_tuple = dict_find(iter, MESSAGE_KEY_CLAY_LOW_FUEL_PERCENT); Tuple *color_led_tuple = dict_find(iter, MESSAGE_KEY_CLAY_LED_COLOR); Tuple *color_bg_tuple = dict_find(iter, MESSAGE_KEY_CLAY_BG_COLOR); Tuple *color_mg_bar_tuple = dict_find(iter, MESSAGE_KEY_CLAY_BAR_MG_COLOR); @@ -395,8 +395,8 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) { if (date_timeout_tuple) { settings.DateTimeoutSecs = date_timeout_tuple->value->uint8; } - if (low_fuel_bars_tuple) { - settings.LowFuelBars = low_fuel_bars_tuple->value->uint8; + if (low_fuel_percent_tuple) { + settings.LowFuelPercent = low_fuel_percent_tuple->value->uint8; } if (color_led_tuple) { settings.ColorLED = GColorFromHEX(color_led_tuple->value->int32); @@ -434,7 +434,7 @@ static void init() { settings.TrackBTStatus = false; settings.ShowTimeMG = false; settings.DateTimeoutSecs = 3; - settings.LowFuelBars = 2; + settings.LowFuelPercent = 20; settings.ColorLED = GColorWhite; settings.ColorBG = GColorBlue; settings.ColorMGBars = GColorDarkGray; diff --git a/src/c/settings.h b/src/c/settings.h index d6e15a2..5b900d0 100644 --- a/src/c/settings.h +++ b/src/c/settings.h @@ -7,7 +7,7 @@ typedef struct ClaySettings { bool TrackBTStatus; bool ShowTimeMG; uint8_t DateTimeoutSecs; - uint8_t LowFuelBars; + uint8_t LowFuelPercent; GColor ColorLED; GColor ColorBG; GColor ColorMGBars; diff --git a/src/pkjs/config.js b/src/pkjs/config.js index ed939e0..9706042 100644 --- a/src/pkjs/config.js +++ b/src/pkjs/config.js @@ -46,37 +46,14 @@ module.exports = [ "description": "Default: -32°C

Measured in Celsius, this value sets the temperature that is considered the minimum on the watchface. When it is this temperature, 0 temperature bars will be displayed. The maximum is this value +80, making the default maximum 48°C." }, { - "type": "select", - "messageKey": "CLAY_LOW_FUEL_BARS", - "defaultValue": 2, + "type": "slider", + "messageKey": "CLAY_LOW_FUEL_PERCENT", + defaultValue: 20, + min: 0, + max: 100, + step: 10, "label": "Low fuel indicator percentage", - "description": "The low fuel indicator will appear at this battery percentage.", - "options": [ - { - "label": "disabled", - "value": 21, - }, - { - "label": "10%", - "value": 2, - }, - { - "label": "20%", - "value": 4, - }, - { - "label": "30%", - "value": 6, - }, - { - "label": "40%", - "value": 8, - }, - { - "label": "50%", - "value": 10, - } - ] + "description": "The low fuel indicator will appear at this battery percentage. Set to 0 to disable." } ] },