Experimental browser for the Atmosphere
{ "uri": "at://did:plc:by3jhwdqgbtrcc7q4tkkv3cf/com.whtwnd.blog.entry/3lo3fmodnav2s", "cid": "bafyreidk27dom753gkcb32xpg2msvgromjvrxkb5ee3ww5wonru4cz44vu", "value": { "$type": "com.whtwnd.blog.entry", "theme": "github-light", "title": "Creating a Pebble watchface in 2025", "content": "# Introduction\n\nSo the ahoy.eu conference was coming up, and Pebble was coming back and I had the idea of creating a watchface that displayed the time in `tid`. And then one thing led to another and by the end I had the Moderately Useful Watchface.\n\n# Pebble\n\nDo you remember Pebble? It was the OG hackable smartwatch, years before the Apple Watch (a lot less hackable). Several successful Kickstaters starting in 2013 [citation needed], and a final one that never fully shipped—company went bankrupt, sold for parts to FitBit, purchased by Google and shut down last year. In the meantime the community banded together under the name/service Rebble that resurrected and have been keeping the watches going ever since.\n\nAnd then this January the founder of Pebble announced he's launching new devices, not long after people got Google to open-source the Firmware and now you can pre-order not one but two Pebble models and we are so back.\n\n# Getting Started\n\nThe bad news is that the Pebble toolchain is—until the new devices come out—frozen in time in 2015. It depends on Python 2.7, for example, which is hard to find on modern computers these days.\n\nThe good news is that the community has created several solutions to this problem: There is a pre-configured x86 VM; a Docker image; a nix flake and finally `rebbletool`, which is what I used. It takes mere minutes to get it up and running on an M1 Pro Mac. \n\n# How is Pebble watchface formed\n\nPebble watchfaces are written in C (the code running on the watch) and JS (the code running inside a RockyJS VM in the companion app). JS can be used for configuration options as well as things like fetching things from the internet and sending it to the C code (or vice versa).\n\n`rebbletool new-project <projectname>` will get you a starter template with a very simple Pebble app. Pebbles have two kinds of apps: apps and watchfaces. Changing it, in a way is as simple as setting `watchface: true` in `package.json`. Watchfaces are a subset of apps [citation needed] but have benefits like ???.\n\nAll that's left is writing a bunch of C code and a bit of JS.\n\n# Vibecoding a Pebble watchface for fun and profit\n\n99% of the code of my watchface was written by my juniors: gemini-2.5-pro, o3 and o4-mini. The initial version was primarily gemini, with subsequent code reviews, revisions and new features from mostly the latter two models. LLMs can write surprisingly not-bad C. Is it *good* C? At times. At certain places. But they're far more capable than many would initially assume.\n\nI started out by simply copy-pasting mary's TID code to gemini and asking it to translate it to C, which it did a fairly good job at.\n\nThen I decided I want more than just the current TID displayed. What other Moderately Useful time formats exist? The next obvious one was Swatch Internet Time, for which code already existed mostly needed to be copy-pasted from this project. \n\nThe French Decimal time was next to implement, though once working, it turned out to be redundant given it's fundamentally the same logic as @ time, so I didn't keep it around too long.\n\nThe centerface, the hero of the watchface comes from an idea years ago that a few friends and I worked on: \"where in the world is it [just past] noon right now?\" o'clock. So if it's 3:41:00 in NYC, then the time is Los Angeles:41:00, and so on.\n\nFor this I had to somehow squeeze a subset of tzdata (the timezone database) in the very limited memory of the pebble. My juniors wrote me a gnarly python script that extracted the relevant data with all cities in timezones (like America/New York, Europe/London etc.) and then calculates the DST offsets for the current year (2025) as a compromise. I have later had them rewrite it into TypeScript because I vastly prefer TS over Python. The rewrite it also unearthed some subtle bugs in the Python code so it was beneficial in many ways.\n\nAfter I got this working, an idea arose from a conversation with a friend: let's go one step further, one step more interesting: *at which airport is [just past] noon right now* o'clock.\n\nI already had the timezone/DST-calculating code; all I needed was data about airports and their timezones and I cobbled together enough data to cover all timezones. Data primarily comes from a 2017 list of the 1000 busiest airports; we fill in the gaps with other data sources, using route count as a rough proxy for business. \n\n", "createdAt": "2025-05-01T04:28:26.179Z", "visibility": "author" } }