clach04 / pebble_watchface_framework

Working, ready to build Bare-Bones watch face for Pebble (OG/Classic, Time, and Round) Aplite, Basalt, Diorite, and Chalk. With configuration and settings support.
Apache License 2.0
20 stars 2 forks source link

Pebble Watchface Framework

https://github.com/clach04/pebble_watchface_framework

Working, ready to build Bare-Bones watch face for Pebble (OG/Classic, Time, Round, and Pebble 2) Aplite, Basalt, Chalk, and Diorite. With configuration and settings support via Clay.

Requires Pebble SDK of some kind (current code and WAF script is for SDK 4.5). Original instructions are for CloudPebble.

Current code works with local SDK, recommend using a Docker Container, for example:

GitHub Actions note, https://github.com/clach04/pebble_watchface_framework/blob/master/.github/workflows/main.yml includes a pebble build action that runs by default on every push to master! NOTE Downloads are ONLY available when logged into Github, otherwise, the Artifacts "PebblePBW" text is not a link (without any hint as to what is going on). Kudos to https://github.com/daktak for initial version that the action used here is based on. First seen in https://github.com/mattrossman/forecaswatch2/pull/50

Installation notes for PBW (Android specific, assuming Pebble/Rebble App is installed https://help.rebble.io/setup/):

All the examples below use the same framework.

NR7 Pebble Time color screenshot showing charging in progress NR7 Pebble Time Round color screenshot Capinion Pebble Time color screenshot Paragade Pebble Time color screenshot Paragade Original Pebble Mono screenshot Spawn Big Time  Pebble Time color screenshot Spawn Small Time  Pebble Time color screenshot Spawn Big Time and Info  Pebble Time color screenshot Spawn with date/time screenshot Spawn with date/time screenshot Spawn with date/time screenshot Spawn with date/time screenshot Aplite Simple Step (no steps) screenshot Basalt Mono Simple Step screenshot Chalk Mono Simple Step screenshot Colony Chalk screenshot Colony Basalt screenshot Colony Aplite screenshot StarWars Stormtrooper screenshot StarWars Stormtrooper screenshot

Instructions

  1. Copy (or clone) into your project. Click https://cloudpebble.net/ide/import/github/clach04/watchface_framework/ to import
  2. Create a new uuid (in CloudPebble generate one with a single button push under settings) - see appinfo.json
  3. Compile and run!

Then start adding options and resources. By default the empty framework will:

There is no default icon, add a 25x25 resource and declare it as an icon, see https://developer.rebble.io/developer.pebble.com/guides/migration/migration-guide-4/index.html Additional options

In an ideal situation, watchface.c and watchface.h should not need editing ever. There may be cases where main.c needs editing. Most of the time watch_config.h is the only file that will need editing. watch_config.h options:

Examples

Simple Tutorial 1

  1. Import into CloudPebble, click https://cloudpebble.net/ide/import/github/clach04/watchface_framework/ to import
  2. Edit watch_config.h at the bottom, add the following lines:

    #define TICK_HANDLER_INTERVAL SECOND_UNIT  // Update once per second
    #define TIME_FMT_STR_24H "%R:%S"  // Display seconds
    #define TIME_FMT_STR_12H "%I:%M:%S"  // Display seconds, produces leading zero for hour,minute, and seconds
    #define MAX_TIME_STR "00:00:00"  // Ensure space allocated for string representation of time
    #define FONT_SYSTEM_NAME FONT_KEY_ROBOTO_CONDENSED_21  // Use a medium sized system  font

This will show seconds (the %S in both formats) and update once a second (by setting TICK_HANDLER_INTERVAL to update once a second). MAX_TIME_STR is updated to ensure space is allocated for both the colon and the two digits.

Simple Tutorial 2

  1. Import into CloudPebble, click https://cloudpebble.net/ide/import/github/clach04/watchface_framework/ to import
  2. Add a Resource (lower left corner), load a TTF font, e.g. upload the .ttf files from https://www.fontsquirrel.com/fonts/permanent-marker
  3. Name the resource FONT_50 - 50 means scale to 50 (optional enter in the CHARACTERS field [0-9:.] to only use the characters needed for time, makes watchface smaller), Click Save.
  4. Edit watch_config.h add line #define FONT_NAME RESOURCE_ID_FONT_50 add after (or replace) '#undef FONT_NAME' to match resource name above
  5. Build and run :-)
  6. Try experimenting with different font sizes, make use of #define DEBUG_TIME to try wide fonts. For example using the permanent-marker font above with size 60 looks fine for some times but not all. DEBUG_TIME quickly tries a number of different times to check sizes. Also see USE_TIME_MACHINE notes.

NOTE there are limitations in the Pebble SDK/Firmware on maximum font size. 60 is the absolute maximum, and for some fonts even 60 is problematic. Very large fonts need to be converted into bitmaps, see https://github.com/pebble-examples/big-time

Notes and other resources

For suggestions on image options and conversion see https://www.reddit.com/r/pebble/comments/3ej5wf/pebble_time_image_conversion_contrast/

Multi-platform support https://developer.rebble.io/developer.pebble.com/guides/best-practices/index.html

SDK API https://developer.rebble.io/developer.pebble.com/docs/index.html

Pebble developer wiki https://github.com/pebble-dev/wiki/wiki