Commit graph

24 commits

Author SHA1 Message Date
Adriano Caloiaro
8e529d3419 Add migration notice to README 2026-07-19 09:32:30 -06:00
Adriano Caloiaro
338d63d9fe
perf(webdav): buffer entries in memory, flush every 4 hours
Instead of GET+PUT on every Append call, cache the day's entries in memory
and flush to WebDAV every 4 hours. On a day rollover, buffered entries are
flushed to the outgoing day's file before the new day is loaded, ensuring
no entries are written to the wrong day's URL.
2026-04-25 11:30:22 -06:00
Adriano Caloiaro
1c8ab19426
feat: log GPS fixes every poll, geocode only on significant movement
Remove the in-memory cache from geocode/nominatim.go (cacheTTL, cacheMu,
cachedLoc, cacheExpiry) so CityCenter always makes a live request when called.
Call frequency is now controlled by the caller rather than a time-based TTL.

In the poll goroutine, log the raw GPS coordinates on every cycle. Track the
last geocoded position and only call CityCenter on the first fix or when the
device has moved more than 5 miles (haversine). WebDAV snapshots are written
every poll cycle using the cached city centroid with fresh weather data.
2026-04-25 11:19:06 -06:00
Adriano Caloiaro
fe5fb08fb9
feat: use local gps module instead of starlink for location 2026-04-25 10:58:36 -06:00
Adriano Caloiaro
567845f88e
fix(weather): apply Beer-Lambert extinction to clear-sky model
The simple atmosphericCeiling*sin(elevation) model overestimates clear-sky
radiation at low sun angles because it ignores the longer atmospheric path
light travels near the horizon. At 5° elevation the path is ~11x vertical,
making the real clear-sky ceiling ~26 W/m² rather than the 83 W/m² the
naive model predicts — causing sunny low-angle readings to be misclassified
as mostly cloudy.

Replace with the Beer-Lambert correction:
  expectedClearSky = 950 * exp(-opticalDepth / sin(elevation)) * sin(elevation)

opticalDepth=0.1 (clear atmosphere) produces accurate values across all
angles: ~26 W/m² at 5°, ~93 W/m² at 10°, ~715 W/m² at solar noon.
2026-04-12 07:39:31 -06:00
Adriano Caloiaro
367ab3ec98
refactor(weather): derive conditions from solar elevation angle
Replace the sinusoidal day model with solarPosition(), which computes the
actual solar elevation and hour angle from latitude, longitude, and UTC time.
Expected clear-sky radiation at any moment is simply atmosphericCeiling *
sin(elevation), eliminating all hardcoded or approximated sunrise/sunset
windows.

Dawn/dusk is now detected when the sun is geometrically below the horizon
but the sensor still reads positive (scattered twilight), and morning vs.
afternoon is determined from the sign of the hour angle rather than a
clock-time comparison.
2026-04-11 19:48:53 -06:00
Adriano Caloiaro
7099961ba3
fix(weather): derive clear-sky peak from latitude and date, use current time for sun-angle
Replace the hardcoded peakSolarRadiation constant with solarNoonPeak(), which
scales the atmospheric ceiling (950 W/m²) by sin(solar elevation angle). Elevation
is computed from the current latitude and solar declination (function of day-of-year),
so the normalization is accurate across seasons and locations rather than assuming
equatorial/summer-solstice conditions.

Also switch the sun-angle time calculation from d.LastUpdated to time.Now() so
that a stale cache entry (e.g. after a Starlink connectivity gap) doesn't cause the
wrong time-of-day to be used when inferring conditions.
2026-04-11 19:15:09 -06:00
Adriano Caloiaro
5dae01b00f
feat(weather): log temperature and station type on data report push 2026-04-11 12:42:24 -06:00
Adriano Caloiaro
ef7c36af37
feat(weather): add dawn and dusk conditions based on solar sensor
Detect twilight by checking when the solar radiation sensor reads low but
positive values (< 30 W/m²) while the sun is geometrically near the horizon
(sinusoidal fraction < 0.2 or outside model daylight hours). Morning/afternoon
local time distinguishes dawn from dusk without hard-coding sunrise/sunset times.
2026-04-11 12:28:38 -06:00
Adriano Caloiaro
47f7dad290
Merge pull request #1 from acaloiaro/starlink-location
feat: append location snapshots to WebDAV JSON log on each poll
2026-04-11 09:42:08 -06:00
Adriano Caloiaro
2aa59c57b0
feat: append location snapshots to WebDAV JSON log on each poll 2026-04-10 08:45:50 -06:00
Adriano Caloiaro
e61d2eeb1e Move NMEA sentence parsing from the first to the second sentence received 2022-03-26 09:32:05 -07:00
Adriano
1af4956990
Update README.md 2021-07-27 08:01:59 -07:00
Adriano Caloiaro
1fa9095cdf
Extract nmea sentence parsing from service 2020-08-11 18:57:09 -06:00
Adriano Caloiaro
7a7acd4e29
Don't log unknown locations 2020-08-11 18:56:27 -06:00
Adriano Caloiaro
a601d21edc
Document how to run 2020-08-11 18:08:56 -06:00
Adriano Caloiaro
35b16835c2
Only return valid locations 2020-08-09 19:28:40 -06:00
Adriano
74fa787fb0
Update README.md 2020-07-23 14:43:41 -04:00
Adriano Caloiaro
bfe265e71e
A relatively functional v0.1 2020-07-16 17:07:47 -06:00
Adriano Caloiaro
0c1093519d
Initial commit 2020-07-15 21:37:30 -06:00
Adriano
9ff96140b5
Update README.md 2020-07-15 21:36:00 -06:00
Adriano
8af4d6dc6d
Update README.md 2020-07-15 21:35:24 -06:00
Adriano
5ce6b4d355
Update README.md 2020-07-15 21:35:13 -06:00
Adriano
5f9dcb9017
Initial commit 2020-07-15 21:31:09 -06:00