Compare commits
9 Commits
b36fd4c8bf
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 073dfc7274 | |||
| d45abc9595 | |||
| 2e124db4cb | |||
| c2d09342a1 | |||
| 0ef9e3c6c5 | |||
| 80a826a77f | |||
| f0b900027a | |||
| 1ee332af5d | |||
| 8b44eefd77 |
+11
-5
@@ -1,14 +1,19 @@
|
||||
{
|
||||
"name": "civic-segments",
|
||||
"author": "RandyTheSilly",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"keywords": [
|
||||
"honda",
|
||||
"civic",
|
||||
"segment",
|
||||
"display",
|
||||
"led",
|
||||
"speedometer"
|
||||
"speedometer",
|
||||
"car",
|
||||
"replica"
|
||||
],
|
||||
"capabilities": [
|
||||
"configurable"
|
||||
],
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
@@ -20,7 +25,8 @@
|
||||
"sdkVersion": "3",
|
||||
"enableMultiJS": true,
|
||||
"targetPlatforms": [
|
||||
"emery"
|
||||
"emery",
|
||||
"gabbro"
|
||||
],
|
||||
"watchapp": {
|
||||
"watchface": true
|
||||
@@ -29,7 +35,7 @@
|
||||
"PKJS_READY",
|
||||
"PKJS_TEMP_BAR_COUNT",
|
||||
"CLAY_ENABLE_PEEK",
|
||||
"CLAY_SHOW_TIME_MG",
|
||||
"CLAY_SHOW_DIGITS_MG",
|
||||
"CLAY_TRACK_BT_STATUS",
|
||||
"CLAY_DATE_TIMEOUT_SECS",
|
||||
"CLAY_LOW_FUEL_PERCENT",
|
||||
@@ -40,7 +46,7 @@
|
||||
"CLAY_COLOR_BAR_FILL",
|
||||
"CLAY_COLOR_BAR_COOL",
|
||||
"CLAY_COLOR_BAR_HOT",
|
||||
"CLAY_COLOR_TIME_MG",
|
||||
"CLAY_COLOR_DIGITS_MG",
|
||||
"CLAY_COLOR_LETTERS",
|
||||
"CLAY_COLOR_HOURS",
|
||||
"CLAY_COLOR_MINUTES",
|
||||
|
||||
+58
-93
@@ -17,7 +17,11 @@ static Layer *s_fuel_mg_layer;
|
||||
static Layer *s_fuel_layer;
|
||||
static const uint8_t s_x_r = (PBL_DISPLAY_WIDTH / 2) + 2;
|
||||
static const uint8_t s_x_l = (s_x_r - 2 * (69 / 2)) - 5;
|
||||
static const GRect s_digit_grects[4] = {GRect(s_x_l, 2, 69, 110), GRect(s_x_r, 2, 69, 110), GRect(s_x_l, 116, 69, 110), GRect(s_x_r, 116, 69, 110)}; // emery
|
||||
#if PBL_DISPLAY_WIDTH == 200
|
||||
static const GRect s_digit_grects[4] = {GRect(s_x_l, 2, 69, 110), GRect(s_x_r, 2, 69, 110), GRect(s_x_l, 116, 69, 110), GRect(s_x_r, 116, 69, 110)};
|
||||
#else
|
||||
static const GRect s_digit_grects[4] = {GRect(s_x_l, 18, 69, 110), GRect(s_x_r, 18, 69, 110), GRect(s_x_l, 132, 69, 110), GRect(s_x_r, 132, 69, 110)};
|
||||
#endif
|
||||
static const uint8_t s_temp_guage_x_pos = 6;
|
||||
static const uint16_t s_fuel_guage_x_pos = PBL_DISPLAY_WIDTH - 23;
|
||||
|
||||
@@ -108,7 +112,7 @@ static void recolor_digit_bitmaps(GBitmap **bitmaps, GColor *applied, GColor new
|
||||
static void bt_callback(bool connected) {
|
||||
GColor dst = connected ? settings.ColorHours : settings.ColorWarning;
|
||||
if (s_first_settings_application && connected && dst.argb == s_applied_hour.argb) {
|
||||
// at startup, s_applied_time_date.argb is GColorWhite
|
||||
// at startup, s_applied_hour.argb is GColorWhite
|
||||
// for those using white fg, do not pointlessly replace white at startup if that is the destination anyway
|
||||
return;
|
||||
}
|
||||
@@ -121,11 +125,7 @@ static void bt_callback(bool connected) {
|
||||
static void batt_callback(BatteryChargeState state) {
|
||||
s_batt_level = state.charge_percent / 5;
|
||||
layer_mark_dirty(s_fuel_layer);
|
||||
if (state.charge_percent <= settings.LowFuelPercent) {
|
||||
toggle_fuel_warning_state(true, false);
|
||||
} else {
|
||||
toggle_fuel_warning_state(false, false);
|
||||
}
|
||||
toggle_fuel_warning_state(state.charge_percent <= settings.LowFuelPercent, false);
|
||||
}
|
||||
|
||||
static void temp_update_proc(Layer *layer, GContext *ctx) {
|
||||
@@ -216,22 +216,20 @@ static void update_minute_1() {
|
||||
s_time_digits[2] = minute / 10;
|
||||
s_time_digits[3] = minute % 10;
|
||||
|
||||
bitmap_layer_set_bitmap(s_digit_fg_layers[0], s_hour_bitmaps[s_time_digits[0]]);
|
||||
bitmap_layer_set_bitmap(s_digit_fg_layers[1], s_hour_bitmaps[s_time_digits[1]]);
|
||||
if (!s_peek_active) {
|
||||
if (settings.ShowTimeMG) {
|
||||
if (settings.ShowDigitsMG) {
|
||||
bitmap_layer_set_bitmap(s_digit_mg_layers[2], s_digit_mg_super8);
|
||||
bitmap_layer_set_bitmap(s_digit_mg_layers[3], s_digit_mg_super8);
|
||||
}
|
||||
bitmap_layer_set_bitmap(s_digit_fg_layers[0], s_hour_bitmaps[s_time_digits[0]]);
|
||||
bitmap_layer_set_bitmap(s_digit_fg_layers[1], s_hour_bitmaps[s_time_digits[1]]);
|
||||
bitmap_layer_set_bitmap(s_digit_fg_layers[2], s_minute_bitmaps[s_time_digits[2]]);
|
||||
bitmap_layer_set_bitmap(s_digit_fg_layers[3], s_minute_bitmaps[s_time_digits[3]]);
|
||||
} else {
|
||||
if (settings.ShowTimeMG) {
|
||||
if (settings.ShowDigitsMG) {
|
||||
bitmap_layer_set_bitmap(s_digit_mg_layers[2], s_digit_mg_super8_mini);
|
||||
bitmap_layer_set_bitmap(s_digit_mg_layers[3], s_digit_mg_super8_mini);
|
||||
}
|
||||
bitmap_layer_set_bitmap(s_digit_fg_layers[0], s_hour_bitmaps[s_time_digits[0]]);
|
||||
bitmap_layer_set_bitmap(s_digit_fg_layers[1], s_hour_bitmaps[s_time_digits[1]]);
|
||||
bitmap_layer_set_bitmap(s_digit_fg_layers[2], s_minute_bitmaps_mini[s_time_digits[2]]);
|
||||
bitmap_layer_set_bitmap(s_digit_fg_layers[3], s_minute_bitmaps_mini[s_time_digits[3]]);
|
||||
}
|
||||
@@ -294,7 +292,7 @@ static void peek_change(AnimationProgress progress, void *context) {
|
||||
if (!s_peek_active) {
|
||||
layer_set_frame(bitmap_layer_get_layer(s_digit_fg_layers[2]), s_digit_grects[2]);
|
||||
layer_set_frame(bitmap_layer_get_layer(s_digit_fg_layers[3]), s_digit_grects[3]);
|
||||
if (settings.ShowTimeMG) {
|
||||
if (settings.ShowDigitsMG) {
|
||||
layer_set_frame(bitmap_layer_get_layer(s_digit_mg_layers[2]), s_digit_grects[2]);
|
||||
layer_set_frame(bitmap_layer_get_layer(s_digit_mg_layers[3]), s_digit_grects[3]);
|
||||
}
|
||||
@@ -302,7 +300,7 @@ static void peek_change(AnimationProgress progress, void *context) {
|
||||
uint8_t y = s_digit_grects[2].origin.y - 1;
|
||||
layer_set_frame(bitmap_layer_get_layer(s_digit_fg_layers[2]), GRect(s_digit_grects[2].origin.x, y, 69, 54));
|
||||
layer_set_frame(bitmap_layer_get_layer(s_digit_fg_layers[3]), GRect(s_digit_grects[3].origin.x, y, 69, 54));
|
||||
if (settings.ShowTimeMG) {
|
||||
if (settings.ShowDigitsMG) {
|
||||
layer_set_frame(bitmap_layer_get_layer(s_digit_mg_layers[2]), GRect(s_digit_grects[2].origin.x, y, 69, 54));
|
||||
layer_set_frame(bitmap_layer_get_layer(s_digit_mg_layers[3]), GRect(s_digit_grects[3].origin.x, y, 69, 54));
|
||||
}
|
||||
@@ -328,7 +326,7 @@ static void apply_settings() {
|
||||
window_set_background_color(s_main_window, settings.ColorBG);
|
||||
|
||||
// TIME MG
|
||||
if (settings.ShowTimeMG) {
|
||||
if (settings.ShowDigitsMG) {
|
||||
//// load bitmap if not already loaded
|
||||
if (!s_digit_mg_super8) {
|
||||
s_digit_mg_super8 = gbitmap_create_with_resource(RESOURCE_ID_SUPER8);
|
||||
@@ -354,14 +352,14 @@ static void apply_settings() {
|
||||
}
|
||||
}
|
||||
//// set bitmap color and mark layers dirty
|
||||
if (s_digit_mg_super8 && settings.ColorMGDigits.argb != s_applied_digits_mg.argb) {
|
||||
replace_gbitmap_color(s_applied_digits_mg, settings.ColorMGDigits, s_digit_mg_super8, NULL);
|
||||
if (s_digit_mg_super8 && settings.ColorDigitsMG.argb != s_applied_digits_mg.argb) {
|
||||
replace_gbitmap_color(s_applied_digits_mg, settings.ColorDigitsMG, s_digit_mg_super8, NULL);
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (s_digit_mg_layers[i]) {
|
||||
layer_mark_dirty(bitmap_layer_get_layer(s_digit_mg_layers[i]));
|
||||
}
|
||||
}
|
||||
s_applied_digits_mg = settings.ColorMGDigits;
|
||||
s_applied_digits_mg = settings.ColorDigitsMG;
|
||||
}
|
||||
} else {
|
||||
if (s_digit_mg_super8) {
|
||||
@@ -448,19 +446,19 @@ static void apply_settings() {
|
||||
force_update_minutes = true;
|
||||
|
||||
// mg handling
|
||||
if (settings.ShowTimeMG) {
|
||||
if (settings.ShowDigitsMG) {
|
||||
if (!s_digit_mg_super8_mini) {
|
||||
s_digit_mg_super8_mini = gbitmap_create_with_resource(RESOURCE_ID_SUPER8_M);
|
||||
s_applied_digits_mg_mini = GColorDarkGray;
|
||||
}
|
||||
if (settings.ColorMGDigits.argb != s_applied_digits_mg_mini.argb) {
|
||||
replace_gbitmap_color(s_applied_digits_mg_mini, settings.ColorMGDigits, s_digit_mg_super8_mini, NULL);
|
||||
if (settings.ColorDigitsMG.argb != s_applied_digits_mg_mini.argb) {
|
||||
replace_gbitmap_color(s_applied_digits_mg_mini, settings.ColorDigitsMG, s_digit_mg_super8_mini, NULL);
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (s_digit_mg_layers[i]) {
|
||||
layer_mark_dirty(bitmap_layer_get_layer(s_digit_mg_layers[i]));
|
||||
}
|
||||
}
|
||||
s_applied_digits_mg_mini = settings.ColorMGDigits;
|
||||
s_applied_digits_mg_mini = settings.ColorDigitsMG;
|
||||
}
|
||||
} else if (s_digit_mg_super8_mini) {
|
||||
gbitmap_destroy(s_digit_mg_super8_mini);
|
||||
@@ -568,6 +566,20 @@ static void main_window_unload() {
|
||||
}
|
||||
}
|
||||
|
||||
static void apply_uint8_from_tuple(DictionaryIterator *iter, uint32_t key, void *dest) {
|
||||
Tuple *t = dict_find(iter, key);
|
||||
if (!t)
|
||||
return;
|
||||
*(uint8_t *)dest = t->value->uint8;
|
||||
}
|
||||
|
||||
static void apply_color_from_tuple(DictionaryIterator *iter, uint32_t key, GColor *dest) {
|
||||
Tuple *t = dict_find(iter, key);
|
||||
if (!t)
|
||||
return;
|
||||
*dest = GColorFromHEX(t->value->int32);
|
||||
}
|
||||
|
||||
static void inbox_received_handler(DictionaryIterator *iter, void *context) {
|
||||
Tuple *ready_tuple = dict_find(iter, MESSAGE_KEY_PKJS_READY);
|
||||
if (ready_tuple) {
|
||||
@@ -591,74 +603,23 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) {
|
||||
}
|
||||
|
||||
// CLAY SETTINGS
|
||||
Tuple *enable_peek_tuple = dict_find(iter, MESSAGE_KEY_CLAY_ENABLE_PEEK);
|
||||
Tuple *show_time_mg_tuple = dict_find(iter, MESSAGE_KEY_CLAY_SHOW_TIME_MG);
|
||||
Tuple *track_bt_status_tuple = dict_find(iter, MESSAGE_KEY_CLAY_TRACK_BT_STATUS);
|
||||
Tuple *date_timeout_secs_tuple = dict_find(iter, MESSAGE_KEY_CLAY_DATE_TIMEOUT_SECS);
|
||||
Tuple *low_fuel_percent_tuple = dict_find(iter, MESSAGE_KEY_CLAY_LOW_FUEL_PERCENT);
|
||||
Tuple *use_custom_led_tuple = dict_find(iter, MESSAGE_KEY_CLAY_USE_CUSTOM_LED);
|
||||
Tuple *color_led_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_LED);
|
||||
Tuple *color_bg_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_BG);
|
||||
Tuple *color_bar_mg_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_BAR_MG);
|
||||
Tuple *color_bar_fill_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_BAR_FILL);
|
||||
Tuple *color_bar_cool_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_BAR_COOL);
|
||||
Tuple *color_bar_hot_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_BAR_HOT);
|
||||
Tuple *color_time_mg_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_TIME_MG);
|
||||
Tuple *color_letters_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_LETTERS);
|
||||
Tuple *color_hours_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_HOURS);
|
||||
Tuple *color_minutes_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_MINUTES);
|
||||
Tuple *color_warning_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_WARNING);
|
||||
if (enable_peek_tuple) {
|
||||
settings.EnablePeek = enable_peek_tuple->value->uint8;
|
||||
}
|
||||
if (show_time_mg_tuple) {
|
||||
settings.ShowTimeMG = show_time_mg_tuple->value->uint8;
|
||||
}
|
||||
if (track_bt_status_tuple) {
|
||||
settings.TrackBTStatus = track_bt_status_tuple->value->uint8;
|
||||
}
|
||||
if (date_timeout_secs_tuple) {
|
||||
settings.DateTimeoutSecs = date_timeout_secs_tuple->value->uint8;
|
||||
}
|
||||
if (low_fuel_percent_tuple) {
|
||||
settings.LowFuelPercent = low_fuel_percent_tuple->value->uint8;
|
||||
}
|
||||
if (use_custom_led_tuple) {
|
||||
settings.UseCustomLED = use_custom_led_tuple->value->uint8;
|
||||
}
|
||||
if (color_led_tuple) {
|
||||
settings.ColorLED = GColorFromHEX(color_led_tuple->value->int32);
|
||||
}
|
||||
if (color_bg_tuple) {
|
||||
settings.ColorBG = GColorFromHEX(color_bg_tuple->value->int32);
|
||||
}
|
||||
if (color_bar_mg_tuple) {
|
||||
settings.ColorBarsMG = GColorFromHEX(color_bar_mg_tuple->value->int32);
|
||||
}
|
||||
if (color_bar_fill_tuple) {
|
||||
settings.ColorBarsFill = GColorFromHEX(color_bar_fill_tuple->value->int32);
|
||||
}
|
||||
if (color_bar_cool_tuple) {
|
||||
settings.ColorBarsCool = GColorFromHEX(color_bar_cool_tuple->value->int32);
|
||||
}
|
||||
if (color_bar_hot_tuple) {
|
||||
settings.ColorBarsHot = GColorFromHEX(color_bar_hot_tuple->value->int32);
|
||||
}
|
||||
if (color_time_mg_tuple) {
|
||||
settings.ColorMGDigits = GColorFromHEX(color_time_mg_tuple->value->int32);
|
||||
}
|
||||
if (color_letters_tuple) {
|
||||
settings.ColorLetters = GColorFromHEX(color_letters_tuple->value->int32);
|
||||
}
|
||||
if (color_hours_tuple) {
|
||||
settings.ColorHours = GColorFromHEX(color_hours_tuple->value->int32);
|
||||
}
|
||||
if (color_minutes_tuple) {
|
||||
settings.ColorMinutes = GColorFromHEX(color_minutes_tuple->value->int32);
|
||||
}
|
||||
if (color_warning_tuple) {
|
||||
settings.ColorWarning = GColorFromHEX(color_warning_tuple->value->int32);
|
||||
}
|
||||
apply_uint8_from_tuple(iter, MESSAGE_KEY_CLAY_ENABLE_PEEK, &settings.EnablePeek);
|
||||
apply_uint8_from_tuple(iter, MESSAGE_KEY_CLAY_SHOW_DIGITS_MG, &settings.ShowDigitsMG);
|
||||
apply_uint8_from_tuple(iter, MESSAGE_KEY_CLAY_TRACK_BT_STATUS, &settings.TrackBTStatus);
|
||||
apply_uint8_from_tuple(iter, MESSAGE_KEY_CLAY_DATE_TIMEOUT_SECS, &settings.DateTimeoutSecs);
|
||||
apply_uint8_from_tuple(iter, MESSAGE_KEY_CLAY_LOW_FUEL_PERCENT, &settings.LowFuelPercent);
|
||||
apply_uint8_from_tuple(iter, MESSAGE_KEY_CLAY_USE_CUSTOM_LED, &settings.UseCustomLED);
|
||||
apply_color_from_tuple(iter, MESSAGE_KEY_CLAY_COLOR_LED, &settings.ColorLED);
|
||||
apply_color_from_tuple(iter, MESSAGE_KEY_CLAY_COLOR_BG, &settings.ColorBG);
|
||||
apply_color_from_tuple(iter, MESSAGE_KEY_CLAY_COLOR_BAR_MG, &settings.ColorBarsMG);
|
||||
apply_color_from_tuple(iter, MESSAGE_KEY_CLAY_COLOR_BAR_FILL, &settings.ColorBarsFill);
|
||||
apply_color_from_tuple(iter, MESSAGE_KEY_CLAY_COLOR_BAR_COOL, &settings.ColorBarsCool);
|
||||
apply_color_from_tuple(iter, MESSAGE_KEY_CLAY_COLOR_BAR_HOT, &settings.ColorBarsHot);
|
||||
apply_color_from_tuple(iter, MESSAGE_KEY_CLAY_COLOR_DIGITS_MG, &settings.ColorDigitsMG);
|
||||
apply_color_from_tuple(iter, MESSAGE_KEY_CLAY_COLOR_LETTERS, &settings.ColorLetters);
|
||||
apply_color_from_tuple(iter, MESSAGE_KEY_CLAY_COLOR_HOURS, &settings.ColorHours);
|
||||
apply_color_from_tuple(iter, MESSAGE_KEY_CLAY_COLOR_MINUTES, &settings.ColorMinutes);
|
||||
apply_color_from_tuple(iter, MESSAGE_KEY_CLAY_COLOR_WARNING, &settings.ColorWarning);
|
||||
persist_write_data(STORAGE_KEY_SETTINGS, &settings, sizeof(settings));
|
||||
apply_settings();
|
||||
}
|
||||
@@ -668,9 +629,13 @@ static void init() {
|
||||
if (persist_exists(STORAGE_KEY_SETTINGS)) {
|
||||
persist_read_data(STORAGE_KEY_SETTINGS, &settings, sizeof(settings));
|
||||
} else {
|
||||
#if PBL_RECT
|
||||
settings.EnablePeek = true;
|
||||
#else
|
||||
settings.EnablePeek = false;
|
||||
#endif
|
||||
settings.TrackBTStatus = false;
|
||||
settings.ShowTimeMG = false;
|
||||
settings.ShowDigitsMG = false;
|
||||
settings.UseCustomLED = false;
|
||||
settings.DateTimeoutSecs = 3;
|
||||
settings.LowFuelPercent = 20;
|
||||
@@ -680,7 +645,7 @@ static void init() {
|
||||
settings.ColorBarsFill = GColorWhite;
|
||||
settings.ColorBarsCool = GColorDukeBlue;
|
||||
settings.ColorBarsHot = GColorRed;
|
||||
settings.ColorMGDigits = GColorDarkGray;
|
||||
settings.ColorDigitsMG = GColorDarkGray;
|
||||
settings.ColorLetters = GColorWhite;
|
||||
settings.ColorHours = GColorWhite;
|
||||
settings.ColorMinutes = GColorWhite;
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@
|
||||
|
||||
typedef struct ClaySettings {
|
||||
bool EnablePeek;
|
||||
bool ShowTimeMG;
|
||||
bool ShowDigitsMG;
|
||||
bool TrackBTStatus;
|
||||
uint8_t DateTimeoutSecs;
|
||||
uint8_t LowFuelPercent;
|
||||
@@ -16,7 +16,7 @@ typedef struct ClaySettings {
|
||||
GColor ColorBarsFill;
|
||||
GColor ColorBarsCool;
|
||||
GColor ColorBarsHot;
|
||||
GColor ColorMGDigits;
|
||||
GColor ColorDigitsMG;
|
||||
GColor ColorLetters;
|
||||
GColor ColorHours;
|
||||
GColor ColorMinutes;
|
||||
|
||||
+3
-3
@@ -22,7 +22,7 @@ module.exports = [
|
||||
{
|
||||
"id": "time_mg_toggle",
|
||||
"type": "toggle",
|
||||
"messageKey": "CLAY_SHOW_TIME_MG",
|
||||
"messageKey": "CLAY_SHOW_DIGITS_MG",
|
||||
"defaultValue": false,
|
||||
"label": "Show time segments midground",
|
||||
"description": "Show or hide the unlit segments behind the time."
|
||||
@@ -33,7 +33,7 @@ module.exports = [
|
||||
"messageKey": "CLAY_TRACK_BT_STATUS",
|
||||
"defaultValue": false,
|
||||
"label": "BT disconnect indicator",
|
||||
"description": "Change the color of the digits to the configured warning color when the connection to the phone is lost."
|
||||
"description": "Change the color of the hour digits to the configured warning color when the app connection is lost."
|
||||
},
|
||||
{
|
||||
"type": "slider",
|
||||
@@ -172,7 +172,7 @@ module.exports = [
|
||||
{
|
||||
"id": "custom_color_mg_time",
|
||||
"type": "color",
|
||||
"messageKey": "CLAY_COLOR_TIME_MG",
|
||||
"messageKey": "CLAY_COLOR_DIGITS_MG",
|
||||
"defaultValue": "555555",
|
||||
"label": "Time segment midground color",
|
||||
"sunlight": true,
|
||||
|
||||
+18
-5
@@ -2,14 +2,27 @@ function weatherFailure() {
|
||||
Pebble.sendAppMessage({ PKJS_TEMP_BAR_COUNT: -1 });
|
||||
}
|
||||
|
||||
var xhrRequest = function (url, type, callback) {
|
||||
var xhrRequest = function (url, type, callback, retries) {
|
||||
if (retries === undefined) {
|
||||
retries = 2;
|
||||
}
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.timeout = 7500;
|
||||
xhr.onload = function () {
|
||||
if (xhr.status === 200) {
|
||||
callback(this.responseText);
|
||||
} else {
|
||||
weatherFailure();
|
||||
switch (xhr.status) {
|
||||
case 200:
|
||||
callback(this.responseText);
|
||||
break;
|
||||
case 503:
|
||||
if (retries > 0) {
|
||||
setTimeout(function () {
|
||||
xhrRequest(url, type, callback, retries - 1);
|
||||
}, 5000);
|
||||
break;
|
||||
}
|
||||
// fallthrough
|
||||
default:
|
||||
weatherFailure();
|
||||
}
|
||||
};
|
||||
xhr.onerror = function () {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 176 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 831 B |
Binary file not shown.
|
After Width: | Height: | Size: 890 B |
Binary file not shown.
|
After Width: | Height: | Size: 878 B |
@@ -1,42 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from subprocess import run
|
||||
|
||||
from bdfparser import Font
|
||||
from PIL import Image
|
||||
|
||||
font = Font("civic-segments.bdf")
|
||||
print(
|
||||
f"This font's global size is "
|
||||
f"{font.headers['fbbx']} x {font.headers['fbby']} (pixel), "
|
||||
f"it contains {len(font)} glyphs."
|
||||
)
|
||||
chars_to_export = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
|
||||
for char_str in chars_to_export:
|
||||
char = font.glyph(char_str)
|
||||
bitmap = char.draw()
|
||||
im = Image.frombytes(
|
||||
"RGBA",
|
||||
(bitmap.width(), bitmap.height()),
|
||||
bitmap.tobytes(
|
||||
"RGBA",
|
||||
bytesdict={
|
||||
0: b"\x00\x00\x00\x00", # transparent background
|
||||
1: b"\xff\xff\xff\xff", # white glyph
|
||||
},
|
||||
),
|
||||
)
|
||||
output_path = f"../resources/{char_str}.png"
|
||||
im.save(output_path, "PNG")
|
||||
run(
|
||||
[
|
||||
"zopflipng",
|
||||
"-y",
|
||||
"--iterations=500",
|
||||
"--filters=01234mepb",
|
||||
"--lossy_8bit",
|
||||
"--lossy_transparent",
|
||||
output_path,
|
||||
output_path,
|
||||
]
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user