Fix low fuel indicator configuration

This commit is contained in:
2026-06-06 17:36:20 -04:00
parent 38f17cfabf
commit c1287e628a
4 changed files with 15 additions and 38 deletions
+1 -1
View File
@@ -31,7 +31,7 @@
"CLAY_BT_INDICATOR", "CLAY_BT_INDICATOR",
"CLAY_SHOW_TIME_MG", "CLAY_SHOW_TIME_MG",
"CLAY_DATE_TIMEOUT", "CLAY_DATE_TIMEOUT",
"CLAY_LOW_FUEL_BARS", "CLAY_LOW_FUEL_PERCENT",
"CLAY_LED_COLOR", "CLAY_LED_COLOR",
"CLAY_BG_COLOR", "CLAY_BG_COLOR",
"CLAY_BAR_MG_COLOR", "CLAY_BAR_MG_COLOR",
+6 -6
View File
@@ -56,10 +56,10 @@ static const uint8_t s_bar_spacing = s_bar_height + 1;
static void batt_callback(BatteryChargeState state) { static void batt_callback(BatteryChargeState state) {
s_batt_level = state.charge_percent / 5; s_batt_level = state.charge_percent / 5;
layer_mark_dirty(s_fuel_layer); 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); replace_gbitmap_color(s_applied_fg, settings.ColorWarning, s_e_icon, s_e_layer);
s_low_fuel_indicator = true; 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); replace_gbitmap_color(settings.ColorWarning, s_applied_fg, s_e_icon, s_e_layer);
s_low_fuel_indicator = false; 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 *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 *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 *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_led_tuple = dict_find(iter, MESSAGE_KEY_CLAY_LED_COLOR);
Tuple *color_bg_tuple = dict_find(iter, MESSAGE_KEY_CLAY_BG_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); 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) { if (date_timeout_tuple) {
settings.DateTimeoutSecs = date_timeout_tuple->value->uint8; settings.DateTimeoutSecs = date_timeout_tuple->value->uint8;
} }
if (low_fuel_bars_tuple) { if (low_fuel_percent_tuple) {
settings.LowFuelBars = low_fuel_bars_tuple->value->uint8; settings.LowFuelPercent = low_fuel_percent_tuple->value->uint8;
} }
if (color_led_tuple) { if (color_led_tuple) {
settings.ColorLED = GColorFromHEX(color_led_tuple->value->int32); settings.ColorLED = GColorFromHEX(color_led_tuple->value->int32);
@@ -434,7 +434,7 @@ static void init() {
settings.TrackBTStatus = false; settings.TrackBTStatus = false;
settings.ShowTimeMG = false; settings.ShowTimeMG = false;
settings.DateTimeoutSecs = 3; settings.DateTimeoutSecs = 3;
settings.LowFuelBars = 2; settings.LowFuelPercent = 20;
settings.ColorLED = GColorWhite; settings.ColorLED = GColorWhite;
settings.ColorBG = GColorBlue; settings.ColorBG = GColorBlue;
settings.ColorMGBars = GColorDarkGray; settings.ColorMGBars = GColorDarkGray;
+1 -1
View File
@@ -7,7 +7,7 @@ typedef struct ClaySettings {
bool TrackBTStatus; bool TrackBTStatus;
bool ShowTimeMG; bool ShowTimeMG;
uint8_t DateTimeoutSecs; uint8_t DateTimeoutSecs;
uint8_t LowFuelBars; uint8_t LowFuelPercent;
GColor ColorLED; GColor ColorLED;
GColor ColorBG; GColor ColorBG;
GColor ColorMGBars; GColor ColorMGBars;
+7 -30
View File
@@ -46,37 +46,14 @@ module.exports = [
"description": "Default: -32°C<br><br>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." "description": "Default: -32°C<br><br>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", "type": "slider",
"messageKey": "CLAY_LOW_FUEL_BARS", "messageKey": "CLAY_LOW_FUEL_PERCENT",
"defaultValue": 2, defaultValue: 20,
min: 0,
max: 100,
step: 10,
"label": "Low fuel indicator percentage", "label": "Low fuel indicator percentage",
"description": "The low fuel indicator will appear at this battery percentage.", "description": "The low fuel indicator will appear at this battery percentage. Set to 0 to disable."
"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,
}
]
} }
] ]
}, },