Introduces watch/, a real Pebble watchapp (built via pebble build) that
build / build (push) Successful in 30s

shows the daily tarot/astrology reading on-device: persistence, reading
computation, and UI screens, driven by the existing engine/interpreter
code linked in unchanged where possible.

Required engine-side changes to make that linking work:
- A compact low-precision ephemeris (lowprec_ephemeris.c) replacing the
  vendored ~127KB Astronomy Engine, which doesn't fit the watch's ~64KB
  app budget.
- Hand-rolled sqrt/atan2/sin/cos replacements for that ephemeris and
  astro.c's Ascendant calculation - Pebble's statically-linked libm
  hard-faults on real hardware under this app's -fPIE link for all four.
- narrative.c/guidance.c refactored from FILE*/fprintf onto snprintf-
  based buffers, since Pebble's SDK blocks fprintf at compile time.
This commit is contained in:
ml
2026-07-14 17:10:22 +02:00
parent d9b6e2889b
commit 1a654da3e9
44 changed files with 1920 additions and 182 deletions
+40
View File
@@ -0,0 +1,40 @@
#ifndef DECK_LOWPREC_EPHEMERIS_H
#define DECK_LOWPREC_EPHEMERIS_H
#include "astro.h"
/* A compact, self-contained low-precision ephemeris for the watch build
* only (PBL_SDK_3) - the vendored Astronomy Engine (astro.c's normal
* desktop path) compiles to ~127KB of code, well over a whole Pebble
* app's entire 64KB code+data+bss budget, so it can't be linked into the
* watchapp at all. This module replaces it there via classic Keplerian
* orbital-element formulas (the widely-published "low precision"
* planetary position method - see lowprec_ephemeris.c's own comment for
* accuracy and sourcing). Not used, and not compiled, on desktop - see
* astro.c's AstroTime typedef and the Makefile's ENGINE_SRCS, which never
* includes this file. */
/* Julian Date (TT and UT are treated as identical at this precision -
* their few-tens-of-seconds difference is far below this method's own
* ~1 arcminute-to-a-few-degrees accuracy) for the given UTC calendar
* date/time. */
double lowprec_julian_date(int year, int month, int day, int hour, int minute, double second);
/* Geocentric apparent ecliptic longitude of `body` at Julian Date `jd`,
* in degrees [0, 360). */
double lowprec_geocentric_longitude(Body body, double jd);
/* Greenwich Mean Sidereal Time at Julian Date `jd`, in hours [0, 24) -
* the watch's replacement for Astronomy_SiderealTime(), used the same
* way (RAMC = gmst*15 + geographic longitude) to compute the Ascendant. */
double lowprec_gmst_hours(double jd);
/* atan2()/sin()/cos() replacements for the watch build - see
* lowprec_ephemeris.c's file-level comment. Exported (not file-static)
* since astro.c's compute_ascendant() also needs them. Same signature/
* semantics as their libm counterparts, in radians. */
double lowprec_atan2(double y, double x);
double lowprec_sin(double rad);
double lowprec_cos(double rad);
#endif