Introduces watch/, a real Pebble watchapp (built via pebble build) that
build / build (push) Successful in 30s
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:
+14
-7
@@ -3,13 +3,6 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/* UI-label keys ("ui.*") are looked up here rather than in i18n.h/.c
|
||||
* because they're specific to these two renderers, not part of the
|
||||
* portable astro/tarot vocabulary. */
|
||||
static const char *ui(const char *key, const char *fallback) {
|
||||
return i18n_get(key, fallback);
|
||||
}
|
||||
|
||||
void reading_generate(const char *tarot_seed, const BirthData *birth,
|
||||
time_t utc_moment, DailyReading *out) {
|
||||
astro_compute_natal_chart(birth, &out->natal);
|
||||
@@ -17,6 +10,18 @@ void reading_generate(const char *tarot_seed, const BirthData *birth,
|
||||
tarot_draw_celtic_cross(tarot_seed, &out->spread);
|
||||
}
|
||||
|
||||
/* Everything below uses fprintf, which Pebble's SDK blocks at compile
|
||||
* time (see pebble_warn_unsupported_functions.h) - not compiled at all
|
||||
* for the watch, which only ever calls reading_generate() above. */
|
||||
#ifndef PBL_SDK_3
|
||||
|
||||
/* UI-label keys ("ui.*") are looked up here rather than in i18n.h/.c
|
||||
* because they're specific to these two renderers, not part of the
|
||||
* portable astro/tarot vocabulary. */
|
||||
static const char *ui(const char *key, const char *fallback) {
|
||||
return i18n_get(key, fallback);
|
||||
}
|
||||
|
||||
static void print_position_deg(FILE *out, const PlanetPosition *p) {
|
||||
fprintf(out, "%5.1f%s %-11s (%s %d)", p->degree_in_sign, "\xc2\xb0",
|
||||
astro_sign_name(p->sign), ui("ui.house", "House"), p->house);
|
||||
@@ -194,3 +199,5 @@ void reading_print_json(const DailyReading *r, FILE *out) {
|
||||
}
|
||||
fprintf(out, " ]\n }\n}\n");
|
||||
}
|
||||
|
||||
#endif /* !PBL_SDK_3 */
|
||||
|
||||
Reference in New Issue
Block a user