Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b73934d
Add $PMTXTS per-PPS host timestamping (opt-in)
peterlewis Jul 4, 2026
5ba7320
SOF-correlation timestamping: latch (USB frame, DWT) for sub-ms PPS o…
peterlewis Jul 7, 2026
1fdbf33
SOF timestamping: audit fixes — valid-gated tail, latch only when pps=on
peterlewis Jul 7, 2026
4d62738
Add astro pack: sun / moon / Maidenhead / lat-lon display modes
peterlewis Jun 30, 2026
e1eeeb8
astro: give LAT/LON a sign slot so negatives keep the label gap
peterlewis Jul 5, 2026
02c9823
astro: configurable per-screen page dwell (page_ms, default 5500 ms)
peterlewis Jul 5, 2026
54d560e
Harden firmware: bounds + ISR-safety fixes from broad audit
peterlewis Jun 30, 2026
aff121d
Fix charger-only-power CDC hard-fault and date-board CMD_LOAD_TEXT OOB
peterlewis Jul 4, 2026
bd112bc
tz: distance-gate the ZoneDetect lookup — kill the 300 ms/second main…
peterlewis Jul 12, 2026
01663f9
Add sidereal (LST) and apparent-solar time-row modes
peterlewis Jul 5, 2026
67f2dfb
sidereal: rename config key alt_colon_mode -> colon_alt_mode
peterlewis Jul 12, 2026
f998de6
astro: subsolar-point helper (sun_subsolar) + shared-series comments
peterlewis Jul 7, 2026
5c8160e
Add self-learning holdover temperature compensation
peterlewis Jul 5, 2026
311e031
Holdover significance-fade + persistent, evolving warm-start temp model
peterlewis Jul 6, 2026
78e0534
Fix significance_fade boot flash: digit_bright defaults to 0 (dashed)…
peterlewis Jul 7, 2026
bfb784a
significance_fade: compute per-digit dash thresholds (duty-mirror wir…
peterlewis Jul 10, 2026
171fef0
tempcomp: MODE_TEMPCOMP pages on page_ms + final enum position
peterlewis Jul 12, 2026
7b5a173
seg_balance: equalise per-segment brightness by duty (config-gated, d…
peterlewis Jul 10, 2026
cccdfe4
seg_balance: power-law overdrive (101..300) — linear duty can't out-s…
peterlewis Jul 10, 2026
d3e81b1
seg_balance_bright: track the rail — dim and full-brightness strength…
peterlewis Jul 10, 2026
1a7e7f5
seg_balance: date-board port + duty-table forwarding + adaptive dithe…
peterlewis Jul 10, 2026
4ca44d1
seg_balance = on: the calibrated auto curve — one key, correct at eve…
peterlewis Jul 10, 2026
80aaa09
date board: restore version 0.0.2 — version trains are not the featur…
peterlewis Jul 10, 2026
cc35b16
Brightness: exponential seg_balance AUTO curve + colon_balance (dim c…
peterlewis Jul 11, 2026
2874bdd
seg_balance/colon_balance: anchor the exponential AUTO curve at 4095,…
peterlewis Jul 11, 2026
a131447
emu: bake the measured brightness curve as the compiled-in default
peterlewis Jul 12, 2026
6390261
colon_balance: 2-anchor AUTO colon curve baked from HW sweep
peterlewis Jul 12, 2026
1c9369c
seg_balance: gradual significance-fade via the duty mirror
peterlewis Jul 12, 2026
6b1d7b3
segbal: nested bit-reversed dither order — duty steps stop re-phasing…
peterlewis Jul 12, 2026
19bf902
segbal: per-digit phase rotation of the nested dither — restore cross…
peterlewis Jul 12, 2026
5eb5851
segbal: ISR-fresh mirrors — the once-per-second freeze was refill sta…
peterlewis Jul 12, 2026
269a2cc
ADEV: free-running Allan-deviation engine (RAM2 ring + overlapping ADEV)
peterlewis Jul 11, 2026
84980b5
ADEV: MODE_ADEV date-row display + $PMADEV serial dump
peterlewis Jul 11, 2026
3baad34
adev: review fix bundle — overflow UB, gap honesty, missed-second tol…
peterlewis Jul 12, 2026
990f14a
adev: self-describing $PMADEV (epoch+tau0) + $PMHDEV Hadamard dump
peterlewis Jul 12, 2026
d6813f0
adev: document MODE_ADEV in the golden config
peterlewis Jul 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,641 changes: 1,372 additions & 1,269 deletions mk4-date/Core/Src/main.c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mk4-date/Core/Src/version.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// in pre-build steps: rm -f Core/Src/version.o

#define VERSION_STRING "Version 0.0.1 "
#define VERSION_STRING "Version 0.0.2 "
#include "../../../version.h"
55 changes: 55 additions & 0 deletions mk4-time/Core/Inc/astro.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* astro.h — minimal solar/lunar/grid astronomy for the Precision Clock Mk IV.
*
* Self-contained C99 + <math.h>; NO firmware dependencies, so it compiles and
* unit-tests natively (see test_astro.c). All angles in degrees at the API
* boundary; UTC instants are passed as a double of Unix seconds.
*
* Algorithms are low-precision (NOAA/Meeus-class) approximations — accurate to a
* fraction of a degree / a minute or two, which is all a 7-segment readout shows,
* and cheap enough to evaluate once per mode entry on the STM32's soft-double.
*/
#ifndef ASTRO_H
#define ASTRO_H

/* (a) Sun apparent alt/az for an observer at (lat, lon) decimal degrees, N+/E+,
* at the given UTC instant. Writes azimuth in [0,360) measured from North
* clockwise, and elevation in [-90,90] (negative = below the horizon).
* No refraction or parallax correction. */
void sun_az_el(double lat, double lon, double unix_s, double *az, double *el);

/* (b) Sun event times for the UTC calendar day containing unix_s.
* Every output is a decimal UTC hour and MAY be < 0 or > 24 (the event falls
* on the previous/next day) — callers add the local offset and wrap, they do
* NOT clamp. solar_noon is always written. Returns 0 normally; returns
* nonzero on polar day/night (sun never crosses -0.833 deg), in which case
* sunrise/sunset are left untouched and only solar_noon is meaningful.
* Any of the optional twilight pointers may be NULL. */
int sun_times(double lat, double lon, double unix_s,
double *sunrise, double *sunset, double *solar_noon,
double *civil_dusk, double *nautical_dusk, double *golden_dusk);

/* (c) Moon. phase is the synodic fraction [0,1): 0=new, .25=first quarter,
* .5=full, .75=last quarter. */
double moon_phase(double unix_s);
double moon_illuminated_fraction(double phase); /* (1 - cos(2*pi*phase)) / 2 */
int moon_phase_index(double phase); /* 0..7, see ASTRO_MOON_NAMES */

/* (d) Equation of time in minutes (+ = apparent sun ahead of mean/clock sun). */
double equation_of_time(double unix_s);

double local_sidereal_time(double unix_s, double lon); /* LMST, hours [0,24), lon E+ */
double local_solar_time(double unix_s, double lon); /* apparent solar, hours [0,24) */

/* (d2) Subsolar point at the given UTC instant: latitude = solar declination,
* longitude in [-180,180] (E+). Time-only — needs no observer position. */
void sun_subsolar(double unix_s, double *lat, double *lon);

/* (e) 6-character Maidenhead locator for (lat, lon). out must hold >= 7 bytes.
* Writes "----\0" if either coordinate is non-finite. */
void maidenhead(double lat, double lon, char out[7]);

/* Phase-index -> short name. Index from moon_phase_index(). */
extern const char *const ASTRO_MOON_NAMES[8];

#endif /* ASTRO_H */
Loading