Files

2.1 KiB
Raw Permalink Blame History

SUNDIAL — sun-path dial for Xiaomi Watch S4

A round watch face-style app: an amber sun orbits the upper arc during daylight (sunrise left → sunset right), a grey moon traces the lower arc at night. Center shows the clock, DAYLIGHT/NIGHT phase, and a countdown to the next sunrise/sunset. Location is hardcoded (Paris by default — edit LAT/LON in src/pages/index/index.ux).

Status: WORKING ON WATCH (user-confirmed since v0.2).

Features

  • NOAA solar-position algorithm (Meeus), fully offline — no GPS/network
  • Two-tone day/night dial with horizon line, bezel ring, and hour ticks
  • Sun halo glow; moon marker at night
  • 30s refresh; timer cleared on hide/destroy (battery-friendly)
  • designWidth 466 = 1:1 mapping to the S4 41mm round screen

Project layout

src/
├── app.ux                  # app lifecycle (must wrap JS in <script>export default…)
├── manifest.json           # com.ilias.sundial, watch, designWidth 466
├── common/
│   ├── solar.js            # pure solar math (no Vela APIs) — unit-tested
│   └── icon.png            # 192×192 circular app icon
└── pages/index/index.ux    # dial page: template + logic + styles
tests/                      # Node test harnesses (plain `node`, no framework)
sign/                       # private.pem + certificate.pem (NOT committed)

Build & release

npm ci                 # installs locked aiot-toolkit 2.0.5
npm run release        # signed .rpk → dist/
node tests/solar.cjs   # math tests
node tests/visual.cjs  # geometry/contrast tests parsed from the .ux

Install

Side-load dist/com.ilias.sundial.release.*.rpk onto the watch via AstroBox. Releases: https://gitea.oimcloud.myaddr.tools/codex-bot/vela-sundial

Version history

  • 0.1 — first build; black-screened + soft-rebooted on watch (crash suspect: chained percentage transforms on a zero-size container)
  • 0.2 — replaced % transforms with bound px coordinates (markerStyle); WORKS
  • 0.3 — designWidth 480→466 (fixed off-center sky disc), bezel ring, hour ticks, two-tone dial, sun halo, orbit r=150
  • 0.5 — user-supplied circular icon