From 66d732476a9a94fce396e31a23188ed37132d77b Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Sat, 16 May 2026 21:58:48 -0400 Subject: [PATCH] Add E/F icons --- README.md | 2 +- package.json | 14 ++++++++++++++ resources/E.png | Bin 0 -> 112 bytes resources/F.png | Bin 0 -> 107 bytes src/c/main.c | 39 +++++++++++++++++++++++++++++---------- 5 files changed, 44 insertions(+), 11 deletions(-) create mode 100644 resources/E.png create mode 100644 resources/F.png diff --git a/README.md b/README.md index e3619a1..731917b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # Civic-Segments -PT2/PR2 watchface clone of the beautiful 8th gen Honda Civic digital speedometer segmented display. +PT2/PR2 watchface clone of the beautiful 8th gen Honda Civic driver display assembly. diff --git a/package.json b/package.json index 7a645a4..b705d3e 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,20 @@ ], "resources": { "media": [ + { + "file": "E.png", + "memoryFormat": "Smallest", + "name": "E", + "spaceOptimization": "storage", + "type": "bitmap" + }, + { + "file": "F.png", + "memoryFormat": "Smallest", + "name": "F", + "spaceOptimization": "storage", + "type": "bitmap" + }, { "file": "0.png", "memoryFormat": "Smallest", diff --git a/resources/E.png b/resources/E.png new file mode 100644 index 0000000000000000000000000000000000000000..10fbd8e7a3547e71b9af6445380b91ce97216a71 GIT binary patch literal 112 zcmeAS@N?(olHy`uVBq!ia0vp^f{{kYGq>+OZu-F_i@Q1v4;|O+IS@ // window statics static Window *s_main_window; static BitmapLayer *s_time_mg_layers[4]; static BitmapLayer *s_time_fg_layers[4]; +static BitmapLayer *s_e_layer; +static BitmapLayer *s_f_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; #if PBL_DISPLAY_HEIGHT == 260 @@ -16,17 +19,16 @@ static const GRect s_time_grects[4] = {GRect(s_x_l, 2, 69, 110), GRect(s_x_r, 2, #endif // persist statics&defines -static GColor8 s_led_color; -static GColor8 s_bg_color; -static GColor8 s_mg_color; -static GColor8 s_fg_color; -#define storage_key_led_color 0 -#define storage_key_bg_color 1 -#define storage_key_mg_color 2 -#define storage_key_fg_color 3 +#define storage_key_show_time_mg 0 +#define storage_key_led_color 1 +#define storage_key_bg_color 2 +#define storage_key_mg_color 3 +#define storage_key_fg_color 4 -// font +// bitmaps static GBitmap *s_font_bitmaps[10]; +static GBitmap *s_e_icon; +static GBitmap *s_f_icon; static void main_window_load() { Layer *window_layer = window_get_root_layer(s_main_window); @@ -51,18 +53,31 @@ static void main_window_load() { } } + s_e_layer = bitmap_layer_create(GRect(PBL_DISPLAY_WIDTH - 23, PBL_DISPLAY_HEIGHT - 17, 17, 15)); + s_f_layer = bitmap_layer_create(GRect(PBL_DISPLAY_WIDTH - 23, 2, 17, 13)); + bitmap_layer_set_bitmap(s_e_layer, s_e_icon); + bitmap_layer_set_bitmap(s_f_layer, s_f_icon); + bitmap_layer_set_compositing_mode(s_e_layer, GCompOpSet); + bitmap_layer_set_compositing_mode(s_f_layer, GCompOpSet); + if (persist_exists(storage_key_fg_color)) { for (int i = 0; i < 10; ++i) { replace_gbitmap_color(GColorWhite, (GColor8){.argb = persist_read_int(storage_key_fg_color)}, s_font_bitmaps[i], NULL); } + replace_gbitmap_color(GColorWhite, (GColor8){.argb = persist_read_int(storage_key_fg_color)}, s_e_icon, NULL); + replace_gbitmap_color(GColorWhite, (GColor8){.argb = persist_read_int(storage_key_fg_color)}, s_e_icon, NULL); } for (int i = 0; i < 4; ++i) { layer_add_child(window_layer, bitmap_layer_get_layer(s_time_fg_layers[i])); } + layer_add_child(window_layer, bitmap_layer_get_layer(s_e_layer)); + layer_add_child(window_layer, bitmap_layer_get_layer(s_f_layer)); } static void main_window_unload() { + bitmap_layer_destroy(s_f_layer); + bitmap_layer_destroy(s_e_layer); for (int i = 0; i < 4; ++i) { if (s_time_mg_layers[i]) { bitmap_layer_destroy(s_time_mg_layers[i]); @@ -111,7 +126,7 @@ static void soft_reload(bool first_load) { } static void init() { - // initialize font array + // load bitmaps s_font_bitmaps[0] = gbitmap_create_with_resource(RESOURCE_ID_0); s_font_bitmaps[1] = gbitmap_create_with_resource(RESOURCE_ID_1); s_font_bitmaps[2] = gbitmap_create_with_resource(RESOURCE_ID_2); @@ -122,6 +137,8 @@ static void init() { s_font_bitmaps[7] = gbitmap_create_with_resource(RESOURCE_ID_7); s_font_bitmaps[8] = gbitmap_create_with_resource(RESOURCE_ID_8); s_font_bitmaps[9] = gbitmap_create_with_resource(RESOURCE_ID_9); + s_e_icon = gbitmap_create_with_resource(RESOURCE_ID_E); + s_f_icon = gbitmap_create_with_resource(RESOURCE_ID_F); for (int i = 0; i < 4; ++i) { s_time_fg_layers[i] = bitmap_layer_create(s_time_grects[i]); @@ -135,6 +152,8 @@ static void init() { static void deinit() { tick_timer_service_unsubscribe(); + gbitmap_destroy(s_f_icon); + gbitmap_destroy(s_e_icon); for (int i = 0; i < 4; ++i) { bitmap_layer_destroy(s_time_fg_layers[i]); }