浏览代码

fw: fix all remaining warnings

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Gerard Marull-Paretas 5 月之前
父节点
当前提交
6dc0655756
共有 56 个文件被更改,包括 125 次插入187 次删除
  1. 0 4
      src/fw/applib/accel_service.c
  2. 2 0
      src/fw/applib/graphics/gpath.c
  3. 5 1
      src/fw/applib/graphics/graphics_circle.c
  4. 2 0
      src/fw/applib/graphics/graphics_circle_private.h
  5. 0 29
      src/fw/applib/graphics/graphics_line.c
  6. 2 0
      src/fw/applib/graphics/perimeter.c
  7. 0 3
      src/fw/applib/graphics/text_layout.c
  8. 2 0
      src/fw/applib/graphics/text_render.c
  9. 2 0
      src/fw/applib/health_service.c
  10. 6 0
      src/fw/applib/ui/action_menu_layer.c
  11. 2 0
      src/fw/applib/ui/crumbs_layer.c
  12. 2 0
      src/fw/applib/ui/layer.c
  13. 0 9
      src/fw/applib/ui/number_window.c
  14. 2 0
      src/fw/apps/prf_apps/mfg_als_app.c
  15. 2 11
      src/fw/apps/prf_apps/mfg_display_app.c
  16. 6 0
      src/fw/apps/prf_apps/mfg_menu_app.c
  17. 0 15
      src/fw/apps/system_apps/health/health_data.c
  18. 5 4
      src/fw/apps/system_apps/health/health_sleep_summary_card.c
  19. 2 3
      src/fw/apps/system_apps/notifications_app.c
  20. 4 1
      src/fw/apps/system_apps/send_text/send_text.c
  21. 2 0
      src/fw/apps/system_apps/settings/settings_activity_tracker.c
  22. 0 4
      src/fw/apps/system_apps/settings/settings_quick_launch_setup_menu.c
  23. 4 0
      src/fw/apps/system_apps/settings/settings_system.c
  24. 8 1
      src/fw/apps/system_apps/timeline/timeline.c
  25. 4 0
      src/fw/apps/system_apps/timeline/timeline_layer.c
  26. 0 2
      src/fw/apps/system_apps/timeline/timeline_relbar.c
  27. 2 0
      src/fw/apps/system_apps/watchfaces.c
  28. 2 0
      src/fw/comm/ble/gatt_client_subscriptions.c
  29. 2 0
      src/fw/comm/ble/kernel_le_client/ancs/ancs.c
  30. 2 0
      src/fw/comm/ble/kernel_le_client/kernel_le_client.c
  31. 1 1
      src/fw/console/pulse_bulkio_pfs.c
  32. 2 0
      src/fw/kernel/util/standby.c
  33. 2 0
      src/fw/popups/notifications/notification_window.c
  34. 0 1
      src/fw/popups/phone_ui.c
  35. 2 0
      src/fw/process_management/app_manager.c
  36. 0 1
      src/fw/services/common/bluetooth/local_id.c
  37. 5 1
      src/fw/services/common/compositor/compositor.c
  38. 2 0
      src/fw/services/common/compositor/default/compositor_dot_transitions.c
  39. 2 0
      src/fw/services/common/put_bytes/put_bytes.c
  40. 2 2
      src/fw/services/normal/activity/activity.c
  41. 0 17
      src/fw/services/normal/activity/activity_insights.c
  42. 0 24
      src/fw/services/normal/activity/activity_sessions.c
  43. 4 17
      src/fw/services/normal/activity/kraepelin/kraepelin_algorithm.c
  44. 1 1
      src/fw/services/normal/activity/workout_service.c
  45. 0 12
      src/fw/services/normal/alarms/alarm.c
  46. 0 7
      src/fw/services/normal/blob_db/contacts_db.c
  47. 6 1
      src/fw/services/normal/protobuf_log/protobuf_log_activity_sessions.c
  48. 0 10
      src/fw/services/normal/protobuf_log/protobuf_log_test.c
  49. 2 0
      src/fw/services/normal/timeline/calendar_layout.c
  50. 4 3
      src/fw/services/normal/timeline/notification_layout.c
  51. 6 2
      src/fw/services/normal/timeline/timeline_actions.c
  52. 2 0
      src/fw/services/normal/voice_endpoint.c
  53. 4 0
      src/fw/services/normal/weather/weather_types.c
  54. 1 0
      src/fw/vendor/nrf5-sdk-uarte-backport/haly/nrfy_uarte.h
  55. 3 0
      src/libbtutil/sm_util.c
  56. 2 0
      stored_apps/golf/src/golf.c

+ 0 - 4
src/fw/applib/accel_service.c

@@ -342,10 +342,6 @@ AccelServiceState * accel_session_create(void) {
 
 
 // -----------------------------------------------------------------------------------------------
-static void prv_cleanup_accel_session_cb(void *session) {
-  kernel_free(session);
-}
-
 void accel_session_delete(AccelServiceState * session) {
   prv_assert_session_task();
 

+ 2 - 0
src/fw/applib/graphics/gpath.c

@@ -83,6 +83,7 @@ static void sort16(int16_t *values, size_t length) {
   }
 }
 
+#if PBL_COLOR
 static void swapIntersections(Intersection *a, Intersection *b) {
   Intersection t = *a;
   *a = *b;
@@ -98,6 +99,7 @@ static void sortIntersections(Intersection *values, size_t length) {
     }
   }
 }
+#endif
 
 static inline bool prv_is_in_range(int16_t min_a, int16_t max_a, int16_t min_b, int16_t max_b) {
   return (max_a >= min_b) && (min_a <= max_b);

+ 5 - 1
src/fw/applib/graphics/graphics_circle.c

@@ -24,6 +24,7 @@
 #include "util/size.h"
 #include "util/trig.h"
 
+#if PBL_COLOR
 static Fixed_S16_3 prv_get_circle_border(int16_t y, uint16_t radius) {
   // Match to the precision we need here
   y *= FIXED_S16_3_ONE.raw_value;
@@ -31,6 +32,7 @@ static Fixed_S16_3 prv_get_circle_border(int16_t y, uint16_t radius) {
 
   return (Fixed_S16_3){.raw_value = radius - integer_sqrt(radius * radius - y * y)};
 }
+#endif
 
 static Fixed_S16_3 prv_get_ellipsis_border(Fixed_S16_3 offset, uint32_t offset_radius_sq,
                                            uint32_t opposite_radius_sq) {
@@ -164,6 +166,7 @@ T_STATIC void graphics_circle_quadrant_draw_1px_non_aa(GContext* ctx, GPoint p,
   }
 }
 
+#if PBL_COLOR
 static void prv_plot4(GBitmap *fb, GRect *clip_box, GPoint center, GPoint offset, int8_t brightness,
                       GColor stroke_color, GCornerMask quadrant) {
   /*
@@ -223,7 +226,6 @@ static void prv_plot8(GBitmap *fb, GRect *clip_box, GPoint center, GPoint offset
   prv_plot4(fb, clip_box, center, GPoint(offset.y, offset.x), brightness, stroke_color, quadrant);
 }
 
-#if PBL_COLOR
 T_STATIC void graphics_circle_quadrant_draw_1px_aa(GContext* ctx, GPoint p, uint16_t radius,
                                                    GCornerMask quadrant) {
   /* This will draw antialiased circle with width of 1px, can be drawn in quadrants
@@ -348,6 +350,7 @@ T_STATIC void graphics_circle_quadrant_draw_1px_aa(GContext* ctx, GPoint p, uint
 }
 #endif // PBL_COLOR
 
+/*
 static void prv_circle_arc_draw_1px(GContext* ctx, GPoint center, uint16_t radius,
                                     int32_t angle_start, int32_t angle_end) {
   // TODO: PBL-23119 Write non-aa function
@@ -362,6 +365,7 @@ static void prv_circle_arc_draw_1px(GContext* ctx, GPoint center, uint16_t radiu
 //    graphics_circle_quadrant_draw_1px_aa(ctx, center, radius, config.full_quadrants);
 //  }
 }
+*/
 
 inline void prv_vline_quadrant(GCornerMask quadrant, GCornerMask desired, GContext *ctx, int16_t x,
                                Fixed_S16_3 start, Fixed_S16_3 end) {

+ 2 - 0
src/fw/applib/graphics/graphics_circle_private.h

@@ -41,12 +41,14 @@ typedef struct {
   int8_t y_mul;
 } GCornerMultiplier;
 
+#if PBL_COLOR
 static GCornerMultiplier quadrant_mask_mul[] = {
   {GCornerTopRight,     1, -1},
   {GCornerBottomRight,  1,  1},
   {GCornerBottomLeft,  -1,  1},
   {GCornerTopLeft,     -1, -1}
 };
+#endif
 
 T_STATIC EllipsisDrawConfig prv_calc_draw_config_ellipsis(int32_t angle_start, int32_t angle_end);
 

+ 0 - 29
src/fw/applib/graphics/graphics_line.c

@@ -23,26 +23,6 @@
 
 #define MINIMUM_PRECISE_STROKE_WIDTH 2
 
-// Precomputed lookup table with quadrant of the circle for the caps on stroked lines
-// table of y-coordinates expressed as Fixed_S16_3.raw_value
-// for each x-coordinate (array index) of first quadrant of unit circle
-// see prv_calc_quadrant_lookup()
-static const uint16_t s_circle_table[] = {
-  8,
-  16, 3,
-  24, 7, 2,
-  32, 11, 5, 2,
-  40, 16, 8, 4, 1,
-  48, 22, 13, 7, 3, 1,
-  56, 28, 17, 11, 6, 3, 1,
-  64, 34, 22, 15, 9, 5, 3, 1,
-  72, 40, 27, 19, 13, 8, 5, 2, 1,
-  80, 46, 32, 23, 16, 11, 7, 4, 2, 1,
-  88, 52, 38, 28, 21, 15, 10, 7, 4, 2, 1,
-  96, 58, 43, 33, 25, 19, 13, 9, 6, 4, 2, 1,
-  104, 64, 49, 38, 29, 23, 17, 12, 8, 6, 3, 2, 1
-};
-
 MOCKABLE void graphics_line_draw_1px_non_aa(GContext* ctx, GPoint p0, GPoint p1) {
   p0.x += ctx->draw_state.drawing_box.origin.x;
   p1.x += ctx->draw_state.drawing_box.origin.x;
@@ -280,15 +260,6 @@ static void prv_calc_cap_vert(GPointPrecise *line_end_point, Fixed_S16_3 cap_rad
                         cap_radius, progress, top_margin, bottom_margin);
 }
 
-// TODO: test me
-static void prv_calc_quadrant_lookup(Fixed_S16_3 lookup[], uint8_t radius) {
-  int n = ((radius - 1) * radius) / 2;
-
-  for (int i=0; i < radius; i++) {
-    lookup[i].raw_value = s_circle_table[n + i];
-  }
-}
-
 // Finds edge points of the rectangle and returns true if line is vertically dominant
 static bool prv_calc_far_points(GPointPrecise *p0, GPointPrecise *p1, Fixed_S16_3 radius,
                      GPointPrecise *far_top, GPointPrecise *far_bottom,

+ 2 - 0
src/fw/applib/graphics/perimeter.c

@@ -19,6 +19,7 @@
 #include "system/passert.h"
 #include "util/math.h"
 
+#if PBL_ROUND
 static uint16_t prv_triangle_side(uint16_t hypotenuse, uint16_t side) {
   // third side of triangle based on pythagorean theorem
   return integer_sqrt(ABS(((uint32_t)hypotenuse * hypotenuse) - ((uint32_t)side * side)));
@@ -67,6 +68,7 @@ T_STATIC GRangeHorizontal perimeter_for_display_round(const GPerimeter *perimete
   const int32_t radius = grect_shortest_side(frame) / 2 - inset;
   return perimeter_for_circle(vertical_range, center, radius);
 }
+#endif
 
 T_STATIC GRangeHorizontal perimeter_for_display_rect(const GPerimeter *perimeter,
                                                      const GSize *ctx_size,

+ 0 - 3
src/fw/applib/graphics/text_layout.c

@@ -756,9 +756,6 @@ static inline void prv_walk_lines_down(Iterator* const line_iter, TextLayout* co
       }
     }
 
-    // PBL-23045 Eventually remove perimeter debugging
-    GRangeHorizontal debug_perimeter_horizontal_range = {};
-
     // If we are restricting the perimeter of the draw box, restrict per line region here
     if (uses_perimeter) {
       GRangeHorizontal text_horizontal_range = {.origin_x = line_in_perimeter_space.x,

+ 2 - 0
src/fw/applib/graphics/text_render.c

@@ -39,6 +39,7 @@ static GRect get_glyph_rect(const GlyphData* glyph) {
   return r;
 }
 
+#if SCREEN_COLOR_DEPTH_BITS == 8
 /// This function returns the x coordinate of where to write the contents of a given word (32-bits)
 /// of data from the 1-bit frame buffer into the 8-bit framebuffer
 /// @param dest_bitmap 8-bit destination frame buffer bitmap
@@ -58,6 +59,7 @@ T_STATIC int32_t prv_convert_1bit_addr_to_8bit_x(GBitmap *dest_bitmap, uint32_t
   // Calculate just the offset from the start of the target row in the 8-bit bitmap (i.e. "x")
   return bitmap_offset_8bit - (dest_bitmap->bounds.size.w * y_offset);
 }
+#endif
 
 // PRO TIP: if you have to modify this function, expect to waste the rest of your day on it
 void render_glyph(GContext* const ctx, const uint32_t codepoint, FontInfo* const font,

+ 2 - 0
src/fw/applib/health_service.c

@@ -750,6 +750,7 @@ static void prv_init_metric_alert(HealthServiceState *state, HealthMetric metric
   info->threshold = threshold;
 }
 
+#if !defined(RECOVERY_FW)
 // ---------------------------------------------------------------------------------------------
 // Determine if we should generate a health metric alert event
 static void prv_check_and_generate_metric_alert(HealthServiceState *state, HealthMetric metric,
@@ -770,6 +771,7 @@ static void prv_check_and_generate_metric_alert(HealthServiceState *state, Healt
     info->prior_reading = value;
   }
 }
+#endif
 
 // ----------------------------------------------------------------------------------------------
 T_STATIC void prv_health_event_handler(PebbleEvent *e, void *context) {

+ 6 - 0
src/fw/applib/ui/action_menu_layer.c

@@ -40,16 +40,20 @@ static const int VERTICAL_PADDING = PBL_IF_COLOR_ELSE(2, 4);
 static const int EXTRA_PADDING_1_BIT = 2;
 static const int SHORT_COL_COUNT = 3;
 static const int MAX_NUM_VISIBLE_LINES = 2;
+#if PBL_ROUND
 static const int SHORT_ITEM_MAX_ROWS_SPALDING = 3;
+#endif
 
 static GFont prv_get_item_font(void) {
   return system_theme_get_font(TextStyleFont_MenuCellTitle);
 }
 
+#if PBL_ROUND
 //! Only used on round displays to achieve a fish-eye effect
 static GFont prv_get_unfocused_item_font(void) {
   return system_theme_get_font(TextStyleFont_Header);
 }
+#endif
 
 static uint16_t prv_get_num_rows(MenuLayer *menu_layer, uint16_t section_index,
                                  void *callback_context) {
@@ -331,6 +335,7 @@ static void prv_cell_item_content_draw_rect(GContext *ctx, const Layer *cell_lay
   mutable_cell_layer->bounds = saved_bounds;
 }
 
+#if PBL_ROUND
 static void prv_cell_item_content_draw_round(GContext *ctx, const Layer *cell_layer,
                                              const ActionMenuLayer *aml, const ActionMenuItem *item,
                                              bool selected, GRect *content_box) {
@@ -379,6 +384,7 @@ static void prv_draw_indicator_round(GContext *ctx, const ActionMenuLayer *aml,
   graphics_draw_text(ctx, INDICATOR, aml->layout_cache.font, indicator_frame,
                      GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL);
 }
+#endif
 
 static void prv_cell_item_draw(GContext *ctx, const Layer *cell_layer,
                                ActionMenuLayer *aml, const ActionMenuItem *item,

+ 2 - 0
src/fw/applib/ui/crumbs_layer.c

@@ -113,6 +113,7 @@ static void prv_crumbs_layer_update_proc_rect(Layer *layer, GContext *ctx) {
   }
 }
 
+#if PBL_ROUND
 static void prv_crumbs_layer_update_proc_round(Layer *layer, GContext *ctx) {
   CrumbsLayer *cl = (CrumbsLayer *)layer;
 
@@ -127,6 +128,7 @@ static void prv_crumbs_layer_update_proc_round(Layer *layer, GContext *ctx) {
   graphics_fill_radial(ctx, grect_inset(layer->bounds, GEdgeInsets(-overdraw)),
                        GOvalScaleModeFillCircle, crumbs_layer_width(), 0, TRIG_MAX_ANGLE);
 }
+#endif
 
 void crumbs_layer_set_level(CrumbsLayer *crumbs_layer, int level) {
   const int max_crumbs = prv_crumb_maximum_count();

+ 2 - 0
src/fw/applib/ui/layer.c

@@ -61,12 +61,14 @@ Layer* layer_create_with_data(GRect frame, size_t data_size) {
   return layer;
 }
 
+#if CAPABILITY_HAS_TOUCHSCREEN
 static bool prv_destroy_recognizer(Recognizer *recognizer, void *context) {
   Layer *layer = context;
   layer_detach_recognizer(layer, recognizer);
   recognizer_destroy(recognizer);
   return true;
 }
+#endif
 
 void layer_deinit(Layer *layer) {
   if (!layer) {

+ 0 - 9
src/fw/applib/ui/number_window.c

@@ -37,15 +37,6 @@ static void update_output_value(NumberWindow *nf) {
   layer_mark_dirty(&nf->window.layer);
 }
 
-// implemented from: http://stackoverflow.com/questions/707370/clean-efficient-algorithm-for-wrapping-integers-in-c
-// answered by: Eddie Parker, <http://stackoverflow.com/users/56349/eddie-parker>
-static int wrap(int num, int const lower_bound, int const upper_bound) {
-  int range_size = upper_bound - lower_bound + 1;
-  if (num < lower_bound)
-    num += range_size * ((lower_bound - num) / range_size + 1);
-  return lower_bound + (num - lower_bound) % range_size;
-}
-
 static void up_click_handler(ClickRecognizerRef recognizer, NumberWindow *nf) {
   bool is_increased = false;
   int32_t new_val = nf->value + nf->step_size;

+ 2 - 0
src/fw/apps/prf_apps/mfg_als_app.c

@@ -56,10 +56,12 @@ static void prv_timer_callback(void *cb_data) {
   app_timer_register(500, prv_timer_callback, NULL);
 }
 
+#if MFG_INFO_RECORDS_TEST_RESULTS
 static void prv_record_als_reading(void) {
   AmbientLightAppData *data = app_state_get_user_data();
   mfg_info_write_als_result(data->latest_als_value);
 }
+#endif
 
 static void prv_handle_init(void) {
   AmbientLightAppData *data = task_zalloc_check(sizeof(AmbientLightAppData));

+ 2 - 11
src/fw/apps/prf_apps/mfg_display_app.c

@@ -74,17 +74,6 @@ static void prv_draw_solid(Layer *layer, GContext *ctx, GColor color) {
   graphics_fill_rect(ctx, &layer->bounds);
 }
 
-static void prv_fill_cols(GContext *ctx, uint8_t color, int16_t *row, int16_t column,
-                          uint8_t num_pixels) {
-  const GRect rect = { { column, *row }, { 1, num_pixels } };
-
-  // Set alpha bits to make it opaque
-  graphics_context_set_fill_color(ctx, (GColor) { .argb = (0b11000000 | color) });
-  graphics_fill_rect(ctx, &rect);
-
-  *row += num_pixels;
-}
-
 #if PBL_ROUND
 
 static void prv_draw_round_border(Layer *layer, GContext *ctx, uint8_t radial_padding_size) {
@@ -152,11 +141,13 @@ static void prv_draw_crosshair_screen(Layer *layer, GContext *ctx, uint8_t radia
   prv_draw_border(layer, ctx, radial_padding_size);
 }
 
+#if PBL_COLOR
 static void prv_draw_bitmap(struct Layer *layer, GContext *ctx, uint32_t res) {
   GBitmap *bitmap = gbitmap_create_with_resource(res);
   graphics_draw_bitmap_in_rect(ctx, bitmap, &layer->bounds);
   gbitmap_destroy(bitmap);
 }
+#endif
 
 static void prv_update_proc(struct Layer *layer, GContext* ctx) {
   AppData *app_data = app_state_get_user_data();

+ 6 - 0
src/fw/apps/prf_apps/mfg_menu_app.c

@@ -96,21 +96,27 @@ static void prv_select_als(int index, void *context) {
   launcher_task_add_callback(prv_launch_app_cb, (void*) mfg_als_app_get_info());
 }
 
+#if !PLATFORM_SILK
 static void prv_select_bt_sig_rf(int index, void *context) {
   launcher_task_add_callback(prv_launch_app_cb, (void*) mfg_bt_sig_rf_app_get_info());
 }
+#endif
 
+#if CAPABILITY_HAS_BUILTIN_HRM
 static void prv_select_hrm(int index, void *context) {
   launcher_task_add_callback(prv_launch_app_cb, (void*) mfg_hrm_app_get_info());
 }
+#endif
 
 static void prv_select_certification(int index, void *context) {
   launcher_task_add_callback(prv_launch_app_cb, (void*) mfg_certification_app_get_info());
 }
 
+#if BT_CONTROLLER_DA14681
 static void prv_select_btle(int index, void *context) {
   launcher_task_add_callback(prv_launch_app_cb, (void*) mfg_btle_app_get_info());
 }
+#endif
 
 static void prv_select_reset(int index, void *context) {
   system_reset();

+ 0 - 15
src/fw/apps/system_apps/health/health_data.c

@@ -56,21 +56,6 @@ T_STATIC void prv_merge_adjacent_sessions(ActivitySession *current,
   }
 }
 
-static void prv_mitsuta_mean_loop_itr(int64_t new_value, int64_t *sum, int64_t *D) {
-  int64_t delta = new_value - *D;
-
-  if (delta < SECONDS_PER_DAY * -1 / 2) {
-    *D = *D + delta + SECONDS_PER_DAY;
-  } else if (delta < SECONDS_PER_DAY / 2) {
-    *D = *D + delta;
-  } else {
-    *D = *D + delta - SECONDS_PER_DAY;
-  }
-
-  *sum = *sum + *D;
-}
-
-
 // API Functions
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 

+ 5 - 4
src/fw/apps/system_apps/health/health_sleep_summary_card.c

@@ -94,17 +94,18 @@ static void prv_render_sleep_sessions(GContext *ctx, HealthSleepSummaryCardData
 static void prv_render_typical_markers(GContext *ctx, HealthSleepSummaryCardData *data) {
   // Some time fuzz is applied to a couple values to ensure that typical fill touches the sleep
   // sessions (needed because of how our fill algorithms work)
-  const int time_fuzz = (2 * SECONDS_PER_MINUTE);
-
   const int sleep_start_24h = health_data_sleep_get_start_time(data->health_data);
-  const int sleep_start_12h = (sleep_start_24h) % TWELVE_HOURS;
 
   const int sleep_end_24h = health_data_sleep_get_end_time(data->health_data);
-  const int sleep_end_12h = (sleep_end_24h - time_fuzz) % TWELVE_HOURS;
 
   if (sleep_start_24h || sleep_end_24h) {
+#if PBL_COLOR
+    const int time_fuzz = (2 * SECONDS_PER_MINUTE);
+    const int sleep_start_12h = (sleep_start_24h) % TWELVE_HOURS;
+    const int sleep_end_12h = (sleep_end_24h - time_fuzz) % TWELVE_HOURS;
     const int sleep_start = (sleep_start_12h * HEALTH_PROGRESS_BAR_MAX_VALUE / TWELVE_HOURS);
     const int sleep_end = (sleep_end_12h * HEALTH_PROGRESS_BAR_MAX_VALUE / TWELVE_HOURS);
+#endif
 
     const int typical_sleep_start_24h = health_data_sleep_get_typical_start_time(data->health_data);
     const int typical_sleep_start_12h = typical_sleep_start_24h % TWELVE_HOURS;

+ 2 - 3
src/fw/apps/system_apps/notifications_app.c

@@ -337,9 +337,6 @@ static void prv_draw_pdc_bw_inverted(GContext *ctx, GDrawCommandImage *image, GP
 //////////////
 // MenuLayer callbacks
 
-static const uint8_t BAR_PX = 9;
-static const uint8_t BAR_SELECTED_PX = 12;
-
 static void prv_draw_notification_cell_rect(GContext *ctx, const Layer *cell_layer,
                                             const char *title, const char *subtitle,
                                             GDrawCommandImage *icon) {
@@ -437,6 +434,7 @@ void prv_draw_notification_cell_round(GContext *ctx, const Layer *cell_layer, GR
   }
 }
 
+#if PBL_ROUND
 static void prv_draw_notification_cell_round_selected(GContext *ctx, const Layer *cell_layer,
                                                       const char *title, const char *subtitle,
                                                       GDrawCommandImage *icon) {
@@ -473,6 +471,7 @@ static void prv_draw_notification_cell_round_unselected(GContext *ctx, const Lay
   const GFont font = system_theme_get_font_for_default_size(TextStyleFont_Header);
   prv_draw_notification_cell_round(ctx, cell_layer, &frame, font, title, NULL, NULL, NULL);
 }
+#endif
 
 static void prv_select_callback(MenuLayer *menu_layer, MenuIndex *cell_index,
                                 void *data) {

+ 4 - 1
src/fw/apps/system_apps/send_text/send_text.c

@@ -245,11 +245,13 @@ static uint16_t prv_contact_list_get_num_rows_callback(MenuLayer *menu_layer,
   return (uint16_t)list_count((ListNode *)data->contact_list_head);
 }
 
+#if PBL_ROUND
 static int16_t prv_contact_list_get_header_height_callback(MenuLayer *menu_layer,
                                                            uint16_t section_index,
                                                            void *callback_context) {
   return MENU_CELL_ROUND_UNFOCUSED_SHORT_CELL_HEIGHT;
 }
+#endif
 
 static int16_t prv_contact_list_get_cell_height_callback(MenuLayer *menu_layer,
                                                          MenuIndex *cell_index,
@@ -260,10 +262,10 @@ static int16_t prv_contact_list_get_cell_height_callback(MenuLayer *menu_layer,
                            MENU_CELL_ROUND_UNFOCUSED_TALL_CELL_HEIGHT));
 }
 
+#if PBL_ROUND
 static void prv_contact_list_draw_header_callback(GContext *ctx, const Layer *cell_layer,
                                                   uint16_t section_index, void *callback_context) {
   SendTextAppData *data = callback_context;
-  const MenuIndex menu_index = menu_layer_get_selected_index(&data->menu_layer);
   const GFont font = fonts_get_system_font(FONT_KEY_GOTHIC_14);
   GRect box = cell_layer->bounds;
   box.origin.y -= 2;
@@ -271,6 +273,7 @@ static void prv_contact_list_draw_header_callback(GContext *ctx, const Layer *ce
   graphics_draw_text(ctx, i18n_get("Select Contact", data), font, box, GTextOverflowModeFill,
                      GTextAlignmentCenter, NULL);
 }
+#endif
 
 static void prv_contact_list_draw_row_callback(GContext *ctx, const Layer *cell_layer,
                                                MenuIndex *cell_index, void *callback_context) {

+ 2 - 0
src/fw/apps/system_apps/settings/settings_activity_tracker.c

@@ -153,10 +153,12 @@ static void prv_draw_no_activities_cell_rect(GContext *ctx, const Layer *cell_la
   graphics_draw_text(ctx, no_activities_string, font, box, overflow, alignment, NULL);
 }
 
+#if PBL_ROUND
 static void prv_draw_no_activities_cell_round(GContext *ctx, const Layer *cell_layer,
                                               const char *no_activities_string) {
   menu_cell_basic_draw(ctx, cell_layer, no_activities_string, NULL, NULL);
 }
+#endif
 
 static uint16_t prv_get_num_rows_cb(OptionMenu *option_menu, void *context) {
   SettingsActivityTrackerData *data = context;

+ 0 - 4
src/fw/apps/system_apps/settings/settings_quick_launch_setup_menu.c

@@ -61,10 +61,6 @@ static void prv_handle_quick_launch_confirm(ClickRecognizerRef recognizer, void
   prv_push_settings_menu();
 }
 
-static void prv_quick_launch_app_set_select_handler(ClickRecognizerRef recognizer, void *context) {
-  expandable_dialog_pop(context);
-}
-
 static void prv_push_first_use_dialog(void) {
   const void *i18n_owner = prv_push_first_use_dialog; // Use this function as the i18n owner
   /// Title for the Quick Launch first use dialog.

+ 4 - 0
src/fw/apps/system_apps/settings/settings_system.c

@@ -439,6 +439,7 @@ static void prv_draw_rt_cell_rect(GContext *ctx, const Layer *cell_layer, GBitma
   graphics_draw_text(ctx, text, font, box, GTextOverflowModeFill, GTextAlignmentLeft, NULL);
 }
 
+#if PBL_ROUND
 static void prv_draw_rt_cell_round(GContext *ctx, const Layer *cell_layer, GBitmap *mark,
                                    const char *text, bool is_selected) {
   GRect rt_rect = cell_layer->bounds;
@@ -467,6 +468,7 @@ static void prv_draw_rt_cell_round(GContext *ctx, const Layer *cell_layer, GBitm
                        NULL);
   }
 }
+#endif
 
 static void prv_draw_rt_cell(
     GContext *ctx, const Layer *cell_layer, SystemCertificationData *cd,
@@ -477,6 +479,7 @@ static void prv_draw_rt_cell(
                    prv_draw_rt_cell_round)(ctx, cell_layer, mark, text, is_selected);
 }
 
+#if PBL_ROUND
 static void prv_draw_fcc_cell_round(
     GContext *ctx, const GRect *cell_layer_bounds, const char *fcc_title,
     const char *fcc_number_subtitle, GBitmap *fcc_mark_icon,
@@ -526,6 +529,7 @@ static void prv_draw_fcc_cell_round(
   grect_align(&box, &container_rect, GAlignTopRight, true /* clip */);
   prv_draw_mark_with_inversion(ctx, fcc_mark_icon, &box, cell_is_highlighted);
 }
+#endif
 
 static void prv_draw_fcc_cell(
     GContext *ctx, const Layer *cell_layer, SystemCertificationData *cd,

+ 8 - 1
src/fw/apps/system_apps/timeline/timeline.c

@@ -86,7 +86,6 @@ static const TimelineAppStyle * const s_styles[NumPreferredContentSizes] = {
 static TimelineAppData *s_app_data;
 
 static const uint32_t TIMELINE_SLIDE_ANIMATION_MS = 150;
-static const uint32_t PEEK_SLIDE_ANIMATION_MS = 300;
 static const uint32_t PEEK_SHOW_TIME_MS = 660;
 
 
@@ -193,22 +192,26 @@ static void prv_cleanup_timer(EventedTimerID *timer) {
   }
 }
 
+#if ANIMATION_DOT
 static void prv_exit_timer_callback(void *context) {
   TimelineAppData *data = context;
   data->timeline_layer.animating_intro_or_exit = false;
   launcher_task_add_callback(prv_launch_watchface, data);
 }
+#endif
 
 static void prv_intro_or_exit_anim_started(Animation *anim, void *context) {
   TimelineAppData *data = context;
   data->timeline_layer.animating_intro_or_exit = true;
 }
 
+#if ANIMATION_DOT
 static void prv_exit_anim_stopped(Animation *animation, bool finished, void *context) {
   // we must use a timer to allow the last frame to render
   const int exit_timeout_ms = 2 * ANIMATION_TARGET_FRAME_INTERVAL_MS;
   evented_timer_register(exit_timeout_ms, false, prv_exit_timer_callback, context);
 }
+#endif
 
 //! Used for setting the animation frame source and/or destination of the peek layer.
 //! If use_pin is true, the animation frame size and position will be that of the first pin icon.
@@ -249,6 +252,7 @@ static void prv_get_icon_animation_frame(TimelineAppData *data, GRect *icon_fram
 #endif
 }
 
+#if ANIMATION_DOT
 static Animation *prv_create_peek_exit_anim(TimelineAppData *data, TimelineAppState prev_state,
                                             uint32_t duration) {
   PeekLayer *peek_layer = &data->peek_layer;
@@ -291,6 +295,7 @@ static Animation *prv_create_peek_exit_anim(TimelineAppData *data, TimelineAppSt
   return (Animation *)peek_layer_create_play_section_animation(&data->peek_layer, 0, duration);
 #endif
 }
+#endif
 
 static Animation *prv_create_sidebar_animation(TimelineAppData *data, bool open) {
   int16_t to_sidebar_width;
@@ -997,6 +1002,7 @@ static void NOINLINE prv_setup_peek(TimelineAppData *data) {
   event_service_client_subscribe(&s_app_data->focus_event_info);
 }
 
+#if PBL_COLOR
 static GColor prv_get_sidebar_color(TimelineAppData *data) {
   if (s_app_data->timeline_model.direction == TimelineIterDirectionPast) {
     return TIMELINE_PAST_COLOR;
@@ -1004,6 +1010,7 @@ static GColor prv_get_sidebar_color(TimelineAppData *data) {
     return TIMELINE_FUTURE_COLOR;
   }
 }
+#endif
 
 T_STATIC void prv_init_peek_layer(TimelineAppData *data) {
   Window *window = &data->timeline_window;

+ 4 - 0
src/fw/apps/system_apps/timeline/timeline_layer.c

@@ -208,12 +208,14 @@ static void prv_get_icon_frame_exact(TimelineLayer *layer, int index, GRect *ico
   timeline_layout_get_icon_frame(&frame, layer->scroll_direction, icon_frame);
 }
 
+#if PBL_ROUND
 static void prv_get_icon_frame_centered(TimelineLayer *layer, int index, GRect *icon_frame) {
   const int center_index = 1;
   const GRect *bounds = &((Layer *)layer)->bounds;
   prv_get_icon_frame_exact(layer, center_index, icon_frame);
   icon_frame->origin.y += prv_get_scroll_delta(layer) * (index - center_index) * bounds->size.h / 2;
 }
+#endif
 
 void timeline_layer_get_icon_frame(TimelineLayer *layer, int index, GRect *icon_frame) {
   return PBL_IF_RECT_ELSE(prv_get_icon_frame_exact,
@@ -592,6 +594,7 @@ Animation *timeline_layer_create_up_down_animation(TimelineLayer *layer, uint32_
   return animation_spawn_create(animation, mode_change, NULL);
 }
 
+#if PBL_ROUND
 static void prv_draw_round_flip(GContext *ctx, const GRect *layer_bounds, const int sidebar_x) {
   // Use a radius larger than the screen's radius so we don't see the top/bottom of the circle
   int16_t circle_radius = DISP_COLS * 3 / 4;
@@ -616,6 +619,7 @@ static void prv_draw_round_flip(GContext *ctx, const GRect *layer_bounds, const
                                   0, TRIG_MAX_ANGLE);
   }
 }
+#endif
 
 static void prv_update_proc(struct Layer *layer, GContext* ctx) {
   TimelineLayer *timeline_layer = (TimelineLayer *)layer;

+ 0 - 2
src/fw/apps/system_apps/timeline/timeline_relbar.c

@@ -27,8 +27,6 @@
 #define TIMELINE_FAT_PIN_SIZE (timeline_layer_get_fat_pin_height())
 #define SIDEBAR_WIDTH (timeline_layer_get_ideal_sidebar_width())
 
-static const int TOP_MARGIN = TIMELINE_TOP_MARGIN;
-
 ///////////////////////////////////////////////////////////
 // Private functions
 ///////////////////////////////////////////////////////////

+ 2 - 0
src/fw/apps/system_apps/watchfaces.c

@@ -85,11 +85,13 @@ static void select_callback(MenuLayer *menu_layer, MenuIndex *cell_index, Settin
   });
 }
 
+#if PBL_ROUND
 static int16_t get_cell_height_callback(struct MenuLayer *menu_layer, MenuIndex *cell_index,
                                         SettingsWatchfacesData *data) {
   return menu_layer_is_index_selected(menu_layer, cell_index) ?
          MENU_CELL_ROUND_FOCUSED_TALL_CELL_HEIGHT : MENU_CELL_ROUND_UNFOCUSED_SHORT_CELL_HEIGHT;
 }
+#endif
 
 static uint16_t get_num_rows_callback(struct MenuLayer *menu_layer, uint16_t section_index, SettingsWatchfacesData *data) {
   return app_menu_data_source_get_count(&data->data_source);

+ 2 - 0
src/fw/comm/ble/gatt_client_subscriptions.c

@@ -809,10 +809,12 @@ void gatt_client_subscription_boot(void) {
   PBL_ASSERTN(s_gatt_client_subscriptions_semphr);
 }
 
+#if UNITTEST
 //! Only for unit tests
 T_STATIC bool gatt_client_get_event_pending_state(GAPLEClient client) {
   return s_is_notification_event_pending[client];
 }
+#endif
 
 //! Only for unit tests
 SemaphoreHandle_t gatt_client_subscription_get_semaphore(void) {

+ 2 - 0
src/fw/comm/ble/kernel_le_client/ancs/ancs.c

@@ -162,9 +162,11 @@ static void prv_set_state(ANCSClientState new_state) {
   s_ancs_client->state = new_state;
 }
 
+#if UNITTEST
 T_STATIC ANCSClientState prv_get_state(void) {
   return s_ancs_client->state;
 }
+#endif
 
 // -----------------------------------------------------------------------------
 // Notification Queue Logic

+ 2 - 0
src/fw/comm/ble/kernel_le_client/kernel_le_client.c

@@ -182,6 +182,7 @@ static const KernelLEClient s_clients[KernelLEClientNum] = {
 #endif // UNITTEST
 };
 
+#if 0  // TODO: PBL-21864 - Disconnect BT Classic when PPoGATT is used
 // Disconnect BT Classic (for iAP) if connected and make this LE device the active gateway,
 // to prevent that iAP gets reconnected in the future:
 static void prv_set_active_gateway_and_disconn_bt_classic(const BTDeviceInternal *gateway_device) {
@@ -206,6 +207,7 @@ static void prv_set_active_gateway_and_disconn_bt_classic(const BTDeviceInternal
   bt_driver_classic_disconnect(NULL);
   bt_unlock();
 }
+#endif
 
 static void prv_handle_services_removed(PebbleBLEGATTClientServicesRemoved *services_removed) {
   PebbleBLEGATTClientServiceHandles *service_remove_info = &services_removed->handles[0];

+ 1 - 1
src/fw/console/pulse_bulkio_pfs.c

@@ -39,6 +39,7 @@ typedef struct PACKED PFSOpenOptions {
   char filename[0];
 } PFSOpenOptions;
 
+#if !RECOVERY_FW
 static int prv_open_file(void *packet_data, size_t length) {
   PFSOpenOptions *options = packet_data;
 
@@ -105,7 +106,6 @@ static status_t pfs_domain_close(void *context) {
   return pfs_close(fd);
 }
 
-#if !RECOVERY_FW
 PulseBulkIODomainHandler pulse_bulkio_domain_pfs = {
   .id = PulseBulkIODomainType_PFS,
   .open_proc = pfs_domain_open,

+ 2 - 0
src/fw/kernel/util/standby.c

@@ -59,6 +59,7 @@ static NORETURN prv_enter_standby_non_pmic(BootBitValue boot_bit) {
   system_hard_reset();
 }
 
+#if CAPABILITY_HAS_PMIC
 static NORETURN prv_enter_standby_pmic(void) {
   reboot_reason_set_restarted_safely();
 
@@ -80,6 +81,7 @@ static NORETURN prv_enter_standby_pmic(void) {
   pmic_power_off();
   PBL_CROAK("PMIC didn't shut us down!");
 }
+#endif
 
 NORETURN enter_standby(RebootReasonCode reason) {
   PBL_LOG(LOG_LEVEL_ALWAYS, "Preparing to enter standby mode.");

+ 2 - 0
src/fw/popups/notifications/notification_window.c

@@ -1077,6 +1077,7 @@ static void prv_layout_did_appear_handler(SwapLayer *swap_layer, LayoutLayer *la
   kino_layer_play(&((NotificationLayout *)layout)->icon_layer);
 }
 
+#if PBL_COLOR
 static void prv_update_colors_handler(SwapLayer *swap_layer, GColor bg_color,
                                       bool status_bar_filled, void *context) {
   NotificationWindowData *data = context;
@@ -1085,6 +1086,7 @@ static void prv_update_colors_handler(SwapLayer *swap_layer, GColor bg_color,
   status_bar_layer_set_colors(&data->status_layer, PBL_IF_ROUND_ELSE(GColorClear, status_color),
                               gcolor_legible_over(status_color));
 }
+#endif
 
 static void prv_interaction_handler(SwapLayer *swap_layer, void *context) {
   NotificationWindowData *data = context;

+ 0 - 1
src/fw/popups/phone_ui.c

@@ -107,7 +107,6 @@ static const int16_t DURATION_ANIMATION_START_OFFSET = 30;
 static const int16_t SINGLE_LINE_BOUND_OFFSET = 5;
 static const int16_t SINGLE_LINE_BOUND_HEIGHT = 30;
 static const int16_t DOUBLE_LINE_BOUND_OFFSET = 0;
-static const int16_t DOUBLE_LINE_BOUND_HEIGHT = 40;
 
 //! Enumeration for the various action bar items in the phone ui
 typedef enum {

+ 2 - 0
src/fw/process_management/app_manager.c

@@ -714,6 +714,7 @@ void app_manager_handle_app_fetch_request_event(const PebbleAppFetchRequestEvent
 }
 
 // -----------------------------------------------------------------------------------------
+#if !RECOVERY_FW
 static AppInstallId prv_get_app_exit_reason_destination_install_id_override(void) {
   switch (s_app_task_context.exit_reason) {
     case APP_EXIT_NOT_SPECIFIED:
@@ -729,6 +730,7 @@ static AppInstallId prv_get_app_exit_reason_destination_install_id_override(void
   }
   WTF;
 }
+#endif
 
 // -----------------------------------------------------------------------------------------
 void app_manager_close_current_app(bool gracefully) {

+ 0 - 1
src/fw/services/common/bluetooth/local_id.c

@@ -110,7 +110,6 @@ void bt_local_id_copy_address_mac_string(char addr_mac_str_out[BT_DEVICE_ADDRESS
 T_STATIC void prv_generate_address(BTDeviceAddress *addr_out) {
   const char *serial = mfg_get_serial_number();
   const uint32_t full_len = strlen(serial);
-  const uint32_t half_len = (full_len / 2);
 
   // Hash of the normal serial
   const uint32_t serial_hash = hash((uint8_t *)serial, full_len);

+ 5 - 1
src/fw/services/common/compositor/compositor.c

@@ -42,7 +42,9 @@
 // The number of pixels for a given row which get set to black to round the corner. These numbers
 // are for the top-left corner, but can easily be translated to the other corners. This is used by
 // bezel mode to replicate the behavior of the FPGA.
+#if PBL_COLOR
 static const uint32_t s_rounded_corner_width[6] = { 6, 4, 3, 2, 1, 1 };
+#endif
 
 //! This is our root framebuffer that everything gets composited into.
 static FrameBuffer DMA_BSS s_framebuffer;
@@ -141,6 +143,7 @@ void compositor_app_framebuffer_fill_callback(GContext *ctx, int16_t y,
                             GCompOpAssign, GColorWhite);
 }
 
+#if PBL_COLOR
 static int prv_get_rounded_corner_width(int row_index, int num_rows) {
   if (row_index >= num_rows) {
     return 0;
@@ -152,6 +155,7 @@ static int prv_get_rounded_corner_width(int row_index, int num_rows) {
   }
   return 0;
 }
+#endif
 
 void compositor_set_modal_transition_offset(GPoint modal_offset) {
   s_animation_state.modal_offset = modal_offset;
@@ -165,10 +169,10 @@ void compositor_render_app(void) {
   // Don't trust the size field within the app framebuffer as the app could modify it.
   GSize app_framebuffer_size;
   app_manager_get_framebuffer_size(&app_framebuffer_size);
-  const FrameBuffer *app_framebuffer = app_state_get_framebuffer();
 
   if (gsize_equal(&app_framebuffer_size, &s_framebuffer.size)) {
 #if CAPABILITY_COMPOSITOR_USES_DMA && !TARGET_QEMU && !UNITTEST
+    const FrameBuffer *app_framebuffer = app_state_get_framebuffer();
     compositor_dma_run(s_framebuffer.buffer, app_framebuffer->buffer, FRAMEBUFFER_SIZE_BYTES);
 #else
     GBitmap src_bitmap = compositor_get_app_framebuffer_as_bitmap();

+ 2 - 0
src/fw/services/common/compositor/default/compositor_dot_transitions.c

@@ -244,6 +244,7 @@ void compositor_dot_transitions_collapsing_ring_animation_update(GContext *ctx,
                                 TRIG_MAX_ANGLE);
 }
 
+#if PBL_ROUND
 static void prv_collapse_animation_update_round(GContext *ctx,
                                                 DotTransitionAnimationConfiguration config,
                                                 uint32_t distance_normalized) {
@@ -258,6 +259,7 @@ static void prv_collapse_animation_update_round(GContext *ctx,
                                                               config.background_color,
                                                               config.collapse_dot_color);
 }
+#endif
 
 static void prv_collapse_animation_update(GContext *ctx,
                                           DotTransitionAnimationConfiguration config,

+ 2 - 0
src/fw/services/common/put_bytes/put_bytes.c

@@ -1312,6 +1312,8 @@ uint32_t put_bytes_get_index(void) {
   return s_pb_state.index;
 }
 
+#ifdef UNITTEST
 T_STATIC uint8_t prv_put_bytes_get_max_batched_pb_ops(void) {
   return MAX_BATCHED_PB_PUT_OPS;
 }
+#endif

+ 2 - 2
src/fw/services/normal/activity/activity.c

@@ -140,8 +140,8 @@ static void prv_heart_rate_subscription_update(uint32_t now_ts) {
 
 // ------------------------------------------------------------------------------------------------
 // Kernel BG callback called by the Heart Rate Manager when new data arrives
-T_STATIC void prv_hrm_subscription_cb(PebbleHRMEvent *hrm_event, void *context) {
 #if CAPABILITY_HAS_BUILTIN_HRM
+T_STATIC void prv_hrm_subscription_cb(PebbleHRMEvent *hrm_event, void *context) {
   if (!s_hrm_present) {
     return;
   }
@@ -198,8 +198,8 @@ T_STATIC void prv_hrm_subscription_cb(PebbleHRMEvent *hrm_event, void *context)
     //   `activity_metrics_prv_add_median_hr_sample`
     prv_heart_rate_subscription_update(now_uptime_ts);
   }
-#endif // CAPABILITY_HAS_BUILTIN_HRM
 }
+#endif // CAPABILITY_HAS_BUILTIN_HRM
 
 
 // ---------------------------------------------------------------------------------------

+ 0 - 17
src/fw/services/normal/activity/activity_insights.c

@@ -1237,23 +1237,6 @@ static void prv_push_nap_session(time_t now_utc, ActivitySession *session) {
   }
 }
 
-
-// -----------------------------------------------------------------------------------------
-static void prv_do_nap_session(time_t now_utc, ActivitySession *session) {
-  if (s_nap_pin_state.last_triggered_utc >= session->start_utc) {
-    INSIGHTS_LOG_DEBUG("Not adding nap pin - already added");
-    return;
-  }
-
-  s_nap_pin_state.last_triggered_utc = session->start_utc;
-
-  prv_save_state(ActivitySettingsKeyInsightNapSessionTime,
-                 &s_nap_pin_state.last_triggered_utc,
-                 sizeof(s_nap_pin_state.last_triggered_utc));
-
-  prv_push_nap_session(now_utc, session);
-}
-
 // -----------------------------------------------------------------------------------------
 static void prv_do_sleep_notification(time_t now_utc, time_t sleep_exit_utc,
                                       int32_t sleep_total_seconds) {

+ 0 - 24
src/fw/services/normal/activity/activity_sessions.c

@@ -253,30 +253,6 @@ unlock:
   mutex_unlock_recursive(state->mutex);
 }
 
-
-
-// --------------------------------------------------------------------------------------------
-// Compute the total number of restful sleep seconds within a range of time
-static uint32_t prv_sleep_restful_seconds(uint32_t num_sessions, ActivitySession *sessions,
-                                          time_t start_utc, time_t end_utc) {
-  // Iterate through the sleep sessions, accumulating the total restful seconds seen between
-  // start_utc and end_utc
-  ActivitySession *session = sessions;
-  uint32_t restful_sec = 0;
-  for (uint32_t i = 0; i < num_sessions; i++, session++) {
-    if ((session->type != ActivitySessionType_RestfulSleep)
-        && (session->type != ActivitySessionType_RestfulNap)) {
-      continue;
-    }
-    if ((session->start_utc >= start_utc)
-        && ((time_t)(session->start_utc + (session->length_min * SECONDS_PER_MINUTE)) <= end_utc)) {
-      restful_sec += session->length_min * SECONDS_PER_MINUTE;
-    }
-  }
-  return restful_sec;
-}
-
-
 // --------------------------------------------------------------------------------------------
 // Send an activity session (including sleep sessions) to data logging
 void activity_sessions_prv_send_activity_session_to_data_logging(ActivitySession *session) {

+ 4 - 17
src/fw/services/normal/activity/kraepelin/kraepelin_algorithm.c

@@ -416,21 +416,6 @@ static int32_t prv_integral_abs(int16_t *d, int16_t start, int16_t end) {
   return int_abs;
 }
 
-
-// -------------------------------------------------------------------------------------------
-// Integrate the d^2 between given start and end index
-static int32_t prv_integral_l2(int16_t *d, int16_t start, int16_t end) {
-  /* Integrate the absolute values between given srti and endi index*/
-  int32_t int_l2 = 0;
-
-  for (int16_t i = start; i <= end; i++) {
-    int_l2 += d[i] * d[i];
-  }
-  // to prevent nasty divide by 0 problems
-  return int_l2;
-}
-
-
 // -----------------------------------------------------------------------------------------
 // Return the sum(abs(x-mean)) for each x in the array
 static uint32_t prv_pim_filter(KAlgState *state, int16_t *d, int16_t dlen, int16_t axis) {
@@ -611,10 +596,10 @@ static void prv_fft_mag(int16_t *d, int16_t width) {
 }
 
 
+#if LOG_DOMAIN_ACTIVITY && KALG_LOG_AXIS_MAGNITUDES
 // -------------------------------------------------------------------------------------------
 // Print a text graph of the values in the d array
 static void prv_text_graph(const char *type_str, int16_t *d, int16_t start, int16_t end) {
-#if LOG_DOMAIN_ACTIVITY
 #ifdef UNITTEST
   // Log the values to facilitate plotting
   printf("\nRaw values for plotting: [");
@@ -649,8 +634,8 @@ static void prv_text_graph(const char *type_str, int16_t *d, int16_t start, int1
     KALG_LOG_DEBUG("%s: %3"PRIi16": mag: %+3"PRIi16": %s", type_str, i, d[i], stars_str);
     stars_str[num_stars] = '*';
   }
-#endif
 }
+#endif
 
 
 // -------------------------------------------------------------------------------------------
@@ -1950,11 +1935,13 @@ static const KAlgActivityAttributes *prv_get_step_activity_attributes(KAlgActivi
   return &k_attributes[activity];
 }
 
+#if CAPABILITY_HAS_BUILTIN_HRM
 // ------------------------------------------------------------------------------------------
 static void prv_hrm_subscription_cb(PebbleHRMEvent *hrm_event, void *context) {
   // The algorithm doesn't care about these events. It only subscribed so the activity service
   // gets events.
 }
+#endif
 
 // ------------------------------------------------------------------------------------------
 // Process the minute data for walk or run activity detection

+ 1 - 1
src/fw/services/normal/activity/workout_service.c

@@ -316,6 +316,7 @@ void workout_service_frontend_closed(void) {
   PBL_ASSERT_TASK(PebbleTask_App);
   prv_lock();
   {
+#if CAPABILITY_HAS_BUILTIN_HRM
     int32_t hr_time_left;
 
     if (workout_service_is_workout_ongoing()) {
@@ -337,7 +338,6 @@ void workout_service_frontend_closed(void) {
       hr_time_left = WORKOUT_ENDED_HR_SUBSCRIPTION_TS_EXPIRE - time_since_workout;
     }
 
-#if CAPABILITY_HAS_BUILTIN_HRM
     if (hr_time_left > 0) {
       // Still some time left. Set a subscription with an expiration
       s_workout_data.hrm_session =

+ 0 - 12
src/fw/services/normal/alarms/alarm.c

@@ -165,17 +165,6 @@ static ActivitySleepState prv_get_sleep_state(void) {
 #endif
 }
 
-// ----------------------------------------------------------------------------------------------
-static int prv_get_sleep_seconds(void) {
-#if CAPABILITY_HAS_HEALTH_TRACKING
-  int32_t sleep_seconds;
-  const bool rv = activity_get_metric(ActivityMetricSleepStateSeconds, 1, &sleep_seconds);
-  return rv ? sleep_seconds : 0;
-#else
-  return 0;
-#endif
-}
-
 // ----------------------------------------------------------------------------------------------
 static int32_t prv_get_vmc(void) {
 #if CAPABILITY_HAS_HEALTH_TRACKING
@@ -193,7 +182,6 @@ static bool prv_should_smart_alarm_trigger(const AlarmConfig *config) {
     // The smart alarm has reached the end of its time range
     return true;
   }
-  const int sleep_seconds = prv_get_sleep_seconds();
   switch (prv_get_sleep_state()) {
     case ActivitySleepStateUnknown:
     case ActivitySleepStateAwake:

+ 0 - 7
src/fw/services/normal/blob_db/contacts_db.c

@@ -88,8 +88,6 @@ int contacts_db_get_serialized_contact(const Uuid *uuid, SerializedContact **con
     return 0;
   }
 
-  SerializedContact *serialized_contact = (SerializedContact *)*contact_out;
-
   return (contact_len - sizeof(SerializedContact));
 }
 
@@ -111,9 +109,6 @@ status_t contacts_db_insert(const uint8_t *key, int key_len, const uint8_t *val,
     return E_INVALID_ARGUMENT;
   }
 
-  // TODO: Verify the serialized_contact data before storing it
-  SerializedContact *serialized_contact = (SerializedContact *)val;
-
   status_t rv = prv_lock_mutex_and_open_file();
   if (rv != S_SUCCESS) {
     return rv;
@@ -154,8 +149,6 @@ status_t contacts_db_read(const uint8_t *key, int key_len, uint8_t *val_out, int
   rv = settings_file_get(&s_contacts_db.settings_file, key, key_len, val_out, val_out_len);
   prv_close_file_and_unlock_mutex();
 
-  SerializedContact *serialized_contact = (SerializedContact *)val_out;
-
   return rv;
 }
 

+ 6 - 1
src/fw/services/normal/protobuf_log/protobuf_log_activity_sessions.c

@@ -57,6 +57,7 @@ static ActivitySessionType prv_proto_type_to_activity_type(ProtobufLogActivityTy
 
 // -----------------------------------------------------------------------------------------
 // Convert ActivitySessionType to the internal protobuf representation.
+/*
 static ProtobufLogActivityType prv_activity_type_to_proto_type(ActivitySessionType type) {
   switch (type) {
     case ActivitySessionType_None:
@@ -80,11 +81,12 @@ static ProtobufLogActivityType prv_activity_type_to_proto_type(ActivitySessionTy
   }
   WTF;
 }
-
+*/
 
 // -----------------------------------------------------------------------------------------
 // Callback used to stuff in the sender.type field of a payload
 // TODO: Don't force it to be one interval
+/*
 static bool prv_encode_intervals(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) {
   if (!pb_encode_tag(stream, PB_WT_STRING, pebble_pipeline_ActivitySession_intervals_tag)) {
     return false;
@@ -97,6 +99,7 @@ static bool prv_encode_intervals(pb_ostream_t *stream, const pb_field_t *field,
   };
   return pb_encode_submessage(stream, pebble_pipeline_ActivityInterval_fields, &msg);
 }
+*/
 
 ProtobufLogRef protobuf_log_activity_sessions_create(void) {
   ProtobufLogConfig log_config = {
@@ -110,6 +113,7 @@ ProtobufLogRef protobuf_log_activity_sessions_create(void) {
 // TODO: Actually make sense of this. It is completely wrong.
 bool protobuf_log_activity_sessions_add(ProtobufLogRef ref, time_t sample_utc,
                                         ActivitySession *session) {
+  /*
   pebble_pipeline_Event event = {
     .type = pebble_pipeline_Event_Type_ActivitySessionEvent,
     .created_time_utc = sample_utc,
@@ -131,6 +135,7 @@ bool protobuf_log_activity_sessions_add(ProtobufLogRef ref, time_t sample_utc,
       }
     }
   };
+  */
 
   return true;
 }

+ 0 - 10
src/fw/services/normal/protobuf_log/protobuf_log_test.c

@@ -40,16 +40,6 @@ static bool prv_decode_uuid(pb_istream_t *stream, const pb_field_t *field, void
   return pb_read(stream, (uint8_t *)ret_uuid, uuid_len);
 }
 
-
-// -----------------------------------------------------------------------------------------
-// Callback used to decode ActivitySession
-static bool prv_decode_activity_session(pb_istream_t *stream, const pb_field_t *field, void **arg) {
-  ActivitySession *ret_uuid = *(ActivitySession **)arg;
-  // TODO: Do something here
-  return true;
-}
-
-
 // -----------------------------------------------------------------------------------------
 // Callback used to decode types
 typedef struct PLogTypesDecoderArg {

+ 2 - 0
src/fw/services/normal/timeline/calendar_layout.c

@@ -158,6 +158,7 @@ static void prv_format_glance_end_time(const TimelineLayout *layout, char *buffe
   }
 }
 
+#if PBL_ROUND
 static void prv_set_glance_time_line_round(const TimelineLayout *layout, char *buffer,
                                            size_t buffer_size) {
   prv_format_glance_start_time(layout, buffer, buffer_size);
@@ -172,6 +173,7 @@ static void prv_set_glance_time_line_round(const TimelineLayout *layout, char *b
   }
   prv_format_glance_end_time(layout, buffer + pos, buffer_size - pos);
 }
+#endif
 
 static void prv_image_node_callback(GContext *ctx, const GRect *box,
                                     const GTextNodeDrawConfig *config, bool render,

+ 4 - 3
src/fw/services/normal/timeline/notification_layout.c

@@ -67,9 +67,6 @@
 static void prv_card_render(NotificationLayout *layout, GContext *ctx, bool render);
 static const LayoutColors *prv_layout_get_colors(const LayoutLayer *layout);
 
-static const GTextAlignment prv_alignment =
-  PBL_IF_RECT_ELSE(GTextAlignmentLeft, GTextAlignmentCenter);
-
 static time_t prv_get_parent_timestamp(TimelineItem *reminder) {
   TimelineItem pin;
   if (S_SUCCESS != pin_db_get(&reminder->header.parent_id, &pin)) {
@@ -411,6 +408,7 @@ static void NOINLINE prv_init_view(NotificationLayout *layout) {
 #endif
 }
 
+#if PBL_ROUND
 static void prv_hide_or_show_banner_icon(KinoLayer *icon_layer,
                                          const GRect *notification_layout_frame) {
   const int32_t frame_too_high_for_icon_threshold = -2;
@@ -420,7 +418,9 @@ static void prv_hide_or_show_banner_icon(KinoLayer *icon_layer,
       (notification_layout_frame->origin.y > top_banner_not_visible_threshold);
   layer_set_hidden(&icon_layer->layer, icon_hidden);
 }
+#endif
 
+#if PBL_ROUND
 static CONST_FUNC int32_t prv_interpolate_linear(int32_t out_min, int32_t out_max, int32_t in_min,
                                                  int32_t in_max, int32_t progress) {
   return out_min + (out_max - out_min) * (progress - in_min) / (in_max - in_min);
@@ -458,6 +458,7 @@ static void prv_draw_banner_round(NotificationLayout *notification_layout, GCont
   ctx->draw_state.clip_box.origin.y = saved_clip_box_origin_y;
   ctx->draw_state.clip_box.size.h = saved_clip_box_size_h;
 }
+#endif
 
 static NOINLINE void prv_card_render_internal(NotificationLayout *layout, GContext *ctx,
                                               bool render) {

+ 6 - 2
src/fw/services/normal/timeline/timeline_actions.c

@@ -776,6 +776,7 @@ static void prv_action_menu_cb(ActionMenu *action_menu, const ActionMenuItem *it
   prv_invoke_action(action_menu, action, pin, item->label);
 }
 
+#if CAPABILITY_HAS_MICROPHONE
 static void prv_invoke_voice_response(VoiceResponseData *voice_data, char *transcription) {
   // This is a bit of a hack, but we need all the behaviour of timeline_actions_invoke_action and
   // this allows voice responses to be used for other types of responses (i.e. ANCS in the future)
@@ -796,6 +797,7 @@ static void prv_invoke_voice_response(VoiceResponseData *voice_data, char *trans
     prv_cleanup_voice_data(voice_data);
   }
 }
+#endif
 
 static ActionMenuLevel *prv_create_level(uint16_t num_items, ActionMenuLevel *parent_level) {
   ActionMenuLevel *level = action_menu_level_create(num_items);
@@ -859,6 +861,7 @@ static ActionMenuLevel *prv_create_emoji_level_from_action(ActionMenuLevel *pare
   return emoji_level;
 }
 
+#if CAPABILITY_HAS_MICROPHONE
 static void prv_handle_voice_transcription_result(PebbleEvent *e, void *context) {
   DictationSessionStatus status = e->dictation.result;
   char *transcription = e->dictation.text;
@@ -872,11 +875,12 @@ static void prv_handle_voice_transcription_result(PebbleEvent *e, void *context)
     prv_cleanup_voice_data(data);
   }
 }
+#endif
 
+#if CAPABILITY_HAS_MICROPHONE
 static void prv_start_voice_reply(ActionMenu *action_menu,
                                   const ActionMenuItem *item,
                                   void *context) {
-#if CAPABILITY_HAS_MICROPHONE
   TimelineActionMenu *timeline_action_menu = context;
   action_menu_freeze(action_menu);
 
@@ -899,8 +903,8 @@ static void prv_start_voice_reply(ActionMenu *action_menu,
   voice_window_transcription_dialog_keep_alive_on_select(data->voice_window, true);
 
   voice_window_push(data->voice_window);
-#endif
 }
+#endif
 
 typedef enum ReplyOption {
   ReplyOption_Voice,

+ 2 - 0
src/fw/services/normal/voice_endpoint.c

@@ -31,6 +31,7 @@
 
 #define VOICE_CONTROL_ENDPOINT (11000)
 
+#if CAPABILITY_HAS_MICROPHONE
 static bool prv_handle_result_common(VoiceEndpointResult result,
                                      bool app_initiated,
                                      AudioEndpointSessionId session_id,
@@ -137,6 +138,7 @@ static void prv_handle_nlp_result(VoiceSessionResultMsg *msg, size_t size) {
   voice_handle_nlp_result(msg->result, msg->session_id, reminder_str, timestamp);
   kernel_free(reminder_str);
 }
+#endif
 
 #if CAPABILITY_HAS_MICROPHONE
 void voice_endpoint_protocol_msg_callback(CommSession *session, const uint8_t* data, size_t size) {

+ 4 - 0
src/fw/services/normal/weather/weather_types.c

@@ -27,10 +27,12 @@ static const char *s_weather_type_names[] = {
 #include "services/normal/weather/weather_type_tuples.def"
 };
 
+#if PBL_COLOR
 static uint8_t s_weather_type_bg_colors[] = {
 #define WEATHER_TYPE_TUPLE(id, numeric_id, bg_color, text_color, timeline_resource_id) bg_color,
 #include "services/normal/weather/weather_type_tuples.def"
 };
+#endif
 
 static uint8_t s_weather_type_text_colors[] = {
 #define WEATHER_TYPE_TUPLE(id, numeric_id, bg_color, text_color, timeline_resource_id) text_color,
@@ -54,7 +56,9 @@ const char *weather_type_get_name(WeatherType weather_type) {
 };
 
 GColor weather_type_get_bg_color(WeatherType weather_type) {
+#if PBL_COLOR
   const size_t index = prv_get_array_index_of_type(weather_type);
+#endif
   return PBL_IF_COLOR_ELSE((GColor) {.argb = s_weather_type_bg_colors[index]}, GColorClear);
 };
 

+ 1 - 0
src/fw/vendor/nrf5-sdk-uarte-backport/haly/nrfy_uarte.h

@@ -695,6 +695,7 @@ uint32_t __nrfy_internal_uarte_events_process(NRF_UARTE_Type *            p_reg,
     else if (mask & NRFY_EVENT_TO_INT_BITMASK(NRF_UARTE_EVENT_RXTO))
     {
         size_t size = nrf_uarte_rx_amount_get(p_reg);
+	(void)size;
         nrf_barrier_rw();
         NRFY_CACHE_INV(p_xfer->p_buffer, size);
     }

+ 3 - 0
src/libbtutil/sm_util.c

@@ -23,12 +23,15 @@
 #include <string.h>
 
 // -------------------------------------------------------------------------------------------------
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
 bool sm_is_pairing_info_equal_identity(const SMPairingInfo *a, const SMPairingInfo *b) {
   return (a->is_remote_identity_info_valid &&
           b->is_remote_identity_info_valid &&
           bt_device_equal(&a->identity.opaque, &b->identity.opaque) &&
           memcmp(&a->irk, &b->irk, sizeof(SMIdentityResolvingKey)) == 0);
 }
+#pragma GCC diagnostic pop
 
 // -------------------------------------------------------------------------------------------------
 bool sm_is_pairing_info_empty(const SMPairingInfo *p) {

+ 2 - 0
stored_apps/golf/src/golf.c

@@ -286,7 +286,9 @@ static void window_load(Window *window) {
   const int16_t disconnected_text_y_offset = mid_value_y_offset + PBL_IF_ROUND_ELSE(-5, 8);
 
   const int16_t stroke_box_width = PBL_IF_ROUND_ELSE(54, background_width / 2);
+#if PBL_ROUND
   const int16_t stroke_box_height = PBL_IF_ROUND_ELSE(53, 50);
+#endif
   const int16_t hole_box_x_offset = PBL_IF_ROUND_ELSE(73, 0);
   const int16_t hole_label_y_offset = STATUS_BAR_LAYER_HEIGHT + PBL_IF_ROUND_ELSE(18, 104);
   const int16_t hole_value_y_offset = hole_label_y_offset + PBL_IF_ROUND_ELSE(5, 2);