Tidy defines

This commit is contained in:
2026-07-21 23:37:10 -04:00
parent 7d556b025b
commit cc141961c6
+19 -13
View File
@@ -25,22 +25,30 @@ static NeatBarLayer *s_neat_bar_layer;
static Layer *s_sleep_bar_layer; static Layer *s_sleep_bar_layer;
static BitmapLayer *s_logo_layer; static BitmapLayer *s_logo_layer;
static const uint8_t s_logo_width = 25; static const uint8_t s_logo_width = 25;
// defines
#define MARGIN 8 #define MARGIN 8
////
#if PBL_ROUND #if PBL_ROUND
//
#define NEAT_BAR_WIDTH 30 #define NEAT_BAR_WIDTH 30
#if PBL_DISPLAY_WIDTH >= 260 #define SLEEP_BAR_HEIGHT (PBL_DISPLAY_HEIGHT >= 260 ? 54 : 50)
static const uint8_t s_sleep_bar_drop = 54; //
#else
static const uint8_t s_sleep_bar_drop = 50;
#endif
#else #else
//
#define NEAT_BAR_WIDTH 25 #define NEAT_BAR_WIDTH 25
static const uint8_t s_sleep_bar_drop = 37; #define SLEEP_BAR_HEIGHT 37
//
#endif #endif
////
#if PBL_DISPLAY_WIDTH >= 200 #if PBL_DISPLAY_WIDTH >= 200
//
#define LW_FONT_SIZE 28 #define LW_FONT_SIZE 28
//
#else #else
//
#define LW_FONT_SIZE 24 #define LW_FONT_SIZE 24
//
#endif #endif
// declare animation statics // declare animation statics
@@ -53,7 +61,7 @@ static bool s_sleep_session_found;
static bool s_sleep_data_accessible; static bool s_sleep_data_accessible;
static const uint8_t s_wasted_top_text_pixels = 10; // 10 blank pixels above each line of text static const uint8_t s_wasted_top_text_pixels = 10; // 10 blank pixels above each line of text
static const uint16_t s_available_height = PBL_DISPLAY_HEIGHT - s_sleep_bar_drop - MARGIN / 2 + s_wasted_top_text_pixels; static const uint16_t s_available_height = PBL_DISPLAY_HEIGHT - SLEEP_BAR_HEIGHT - MARGIN / 2 + s_wasted_top_text_pixels;
// static const uint8_t s_max_rows = s_available_height / LW_FONT_SIZE; // static const uint8_t s_max_rows = s_available_height / LW_FONT_SIZE;
static const uint16_t s_screen_center_y = PBL_DISPLAY_HEIGHT / 2; static const uint16_t s_screen_center_y = PBL_DISPLAY_HEIGHT / 2;
static const uint16_t s_base_shift = s_screen_center_y - (LW_FONT_SIZE / 2) - (s_wasted_top_text_pixels / 2); // base - perfect if there is one row static const uint16_t s_base_shift = s_screen_center_y - (LW_FONT_SIZE / 2) - (s_wasted_top_text_pixels / 2); // base - perfect if there is one row
@@ -68,8 +76,8 @@ static void write_last_watched(const char *text) {
// if the top extends above the sleep bar, force it below it; // if the top extends above the sleep bar, force it below it;
// account for blank pixels above text to avoid forcing position when not visually necessary // account for blank pixels above text to avoid forcing position when not visually necessary
if (y + s_wasted_top_text_pixels < s_sleep_bar_drop + MARGIN / 2) { if (y + s_wasted_top_text_pixels < SLEEP_BAR_HEIGHT + MARGIN / 2) {
y = s_sleep_bar_drop + MARGIN / 2 - s_wasted_top_text_pixels; y = SLEEP_BAR_HEIGHT + MARGIN / 2 - s_wasted_top_text_pixels;
#if PBL_DISPLAY_WIDTH >= 260 && PBL_ROUND #if PBL_DISPLAY_WIDTH >= 260 && PBL_ROUND
y += 3; y += 3;
#endif #endif
@@ -188,8 +196,6 @@ static void main_window_load(Window *window) {
s_logo_layer = bitmap_layer_create(s_logo_start); s_logo_layer = bitmap_layer_create(s_logo_start);
#if PBL_COLOR #if PBL_COLOR
bitmap_layer_set_compositing_mode(s_logo_layer, GCompOpSet); bitmap_layer_set_compositing_mode(s_logo_layer, GCompOpSet);
#else
bitmap_layer_set_background_color(s_logo_layer, s_color_primary);
#endif #endif
bitmap_layer_set_bitmap(s_logo_layer, s_logo_icon); bitmap_layer_set_bitmap(s_logo_layer, s_logo_icon);
@@ -340,9 +346,9 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) {
#define r_x 15 #define r_x 15
#define r_w 150 #define r_w 150
#endif #endif
PropertyAnimation *sleep_bar_prop = property_animation_create_layer_frame(s_sleep_bar_layer, &s_sleep_bar_start, &GRect(r_x, 0, r_w, s_sleep_bar_drop)); PropertyAnimation *sleep_bar_prop = property_animation_create_layer_frame(s_sleep_bar_layer, &s_sleep_bar_start, &GRect(r_x, 0, r_w, SLEEP_BAR_HEIGHT));
#else #else
PropertyAnimation *sleep_bar_prop = property_animation_create_layer_frame(s_sleep_bar_layer, &s_sleep_bar_start, &GRect(4, 4, PBL_DISPLAY_WIDTH - 8, s_sleep_bar_drop - 4)); PropertyAnimation *sleep_bar_prop = property_animation_create_layer_frame(s_sleep_bar_layer, &s_sleep_bar_start, &GRect(4, 4, PBL_DISPLAY_WIDTH - 8, SLEEP_BAR_HEIGHT - 4));
#endif #endif
Animation *sleep_bar_anim = property_animation_get_animation(sleep_bar_prop); Animation *sleep_bar_anim = property_animation_get_animation(sleep_bar_prop);
animation_set_duration(sleep_bar_anim, 512); animation_set_duration(sleep_bar_anim, 512);