Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

set -euo pipefail

# node-gyp uses npm_config_devdir for its cache; npm 10+ warns because "devdir" is not an npm core
# config key (see https://github.com/nodejs/node-gyp/issues/3192). Cursor's sandbox and some other
# environments inject it — unset so Pebble's npm/npx steps don't spam the log.
unset npm_config_devdir NPM_CONFIG_DEVDIR 2>/dev/null || true

profile="dev"

if [[ "${1:-}" == "release" || "${1:-}" == "dev" ]]; then
Expand Down
3 changes: 3 additions & 0 deletions scripts/prepare-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

set -euo pipefail

# Same as build.sh: npm_config_devdir is for node-gyp, not npm — see scripts/build.sh comment.
unset npm_config_devdir NPM_CONFIG_DEVDIR 2>/dev/null || true

profile="${1:-dev}"

if [[ "$profile" != "release" && "$profile" != "dev" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion src/c/appendix/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "persist.h"
#include "math.h"

// NOTE: g_config is a global config variable
Config *g_config;

static const Config s_config_defaults = (Config) {
.celsius = false,
Expand Down
2 changes: 1 addition & 1 deletion src/c/appendix/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ typedef struct {
bool day_night_shading;
} Config;

Config *g_config;
extern Config *g_config;

void config_load();

Expand Down
2 changes: 2 additions & 0 deletions src/c/layers/battery_layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ static void battery_state_handler(BatteryChargeState charge) {
battery_layer_refresh();
}

#ifdef PBL_COLOR
static GColor get_battery_color(int level) {
if (level >= 50)
return GColorGreen;
Expand All @@ -24,6 +25,7 @@ static GColor get_battery_color(int level) {
else
return GColorRed;
}
#endif

static void draw_power_icon(GContext *ctx, int h, GBitmap *icon_bitmap) {
GRect icon_bounds = gbitmap_get_bounds(icon_bitmap);
Expand Down
20 changes: 8 additions & 12 deletions src/c/layers/calendar_layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ static struct tm *relative_tm(int days_from_today)
return localtime(&timestamp);
}

static int relative_day_of_month(int days_from_today) {
// What is the day of the month n days from today?
tm *local_time = relative_tm(days_from_today);
return local_time->tm_mday;
}

static bool is_us_federal_holiday(struct tm *t)
{
// No holidays on weekends (ensures we don't register a false positive for special cases)
Expand Down Expand Up @@ -72,6 +66,7 @@ static bool is_us_federal_holiday(struct tm *t)
return false;
}

#ifdef PBL_COLOR
static GColor date_color(struct tm *t) {
// Get color for a date, considering weekends and holidays
if (is_us_federal_holiday(t))
Expand All @@ -82,14 +77,15 @@ static GColor date_color(struct tm *t) {
return g_config->color_saturday;
return GColorWhite;
}
#endif

static GColor today_color() {
// Either follow the date color or override to configured value
static GColor today_color(void) {
#ifdef PBL_COLOR
struct tm *t = relative_tm(0);
return PBL_IF_COLOR_ELSE(
gcolor_equal(g_config->color_today, GColorBlack) ? date_color(t) : g_config->color_today,
GColorWhite
);
return gcolor_equal(g_config->color_today, GColorBlack) ? date_color(t) : g_config->color_today;
#else
return GColorWhite;
#endif
}

static void calendar_update_proc(Layer *layer, GContext *ctx) {
Expand Down
2 changes: 0 additions & 2 deletions src/c/layers/calendar_status_layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

static Layer *s_calendar_status_layer;
static TextLayer *s_calendar_month_layer;
static TextLayer *s_calendar_month_layer;
static GBitmap *s_mute_bitmap;
static GBitmap *s_bt_bitmap;
static GBitmap *s_bt_disconnect_bitmap;
Expand All @@ -31,7 +30,6 @@ void calendar_status_layer_create(Layer* parent_layer, GRect frame) {
s_calendar_status_layer = layer_create(frame);
GRect bounds = layer_get_bounds(s_calendar_status_layer);
int w = bounds.size.w;
int h = bounds.size.h;

// Set up icons
s_mute_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_MUTE);
Expand Down
2 changes: 0 additions & 2 deletions src/c/layers/weather_status_layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ static void sun_event_layer_refresh() {
static void weather_status_layer_init(GRect bounds) {
// Set up the city text layer properties
int w = bounds.size.w;
int h = bounds.size.h;

// Current temperature
s_current_temp_layer = text_layer_create(GRect(MARGIN, -FONT_18_OFFSET, 40, 25));
Expand Down Expand Up @@ -121,7 +120,6 @@ static void weather_status_layer_init(GRect bounds) {
static void weather_status_update_proc(Layer *layer, GContext *ctx) {
GRect bounds = layer_get_bounds(layer);
int w = bounds.size.w;
int h = bounds.size.h;
s_arrow_path = gpath_create(&ARROW_PATH_INFO);
// Translate to correct location in layer
if (persist_get_sun_event_start_type() == 0)
Expand Down
5 changes: 5 additions & 0 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ def build(ctx):
cached_env = ctx.env
for platform in ctx.env.TARGET_PLATFORMS:
ctx.env = ctx.all_envs[platform]
if platform == 'aplite':
# Hides GCC nag about strftime in Pebble's headers (aplite only).
ctx.env.append_unique('CFLAGS', ['-Wno-builtin-declaration-mismatch'])
# Hides linker nag about "this binary has a read+write+exec memory region" (SDK default layout).
ctx.env.append_unique('LINKFLAGS', ['-Wl,--no-warn-rwx-segments'])
ctx.set_group(ctx.env.PLATFORM_NAME)
app_elf = '{}/pebble-app.elf'.format(ctx.env.BUILD_DIR)
ctx.pbl_build(source=ctx.path.ant_glob('src/c/**/*.c'), target=app_elf, bin_type='app')
Expand Down