fix elevation_gain_m null for modern Garmin FIT files; fix map flash
FIT parser: try enhanced_altitude before altitude. Barometric altimeters on modern Garmins (Edge 540, 840, etc.) write enhanced_altitude in record messages and total_ascent in lap messages. The old code read only altitude, producing null elevation_m per point → null elevation_gain_m at the activity root while laps had correct values from total_ascent. ActivityMap: use preview_coords (passed from ActivitySummary) to initialise the map at the activity's location on mount, eliminating the flash of world-view before the async detail JSON / bbox arrives.
This commit is contained in:
@@ -57,12 +57,17 @@ class FitParser:
|
||||
lat = _semicircles_to_deg(_get(frame, "position_lat"))
|
||||
lon = _semicircles_to_deg(_get(frame, "position_long"))
|
||||
speed_raw = _get(frame, "speed") # m/s
|
||||
# enhanced_altitude is written by barometric altimeters (most
|
||||
# modern Garmins). Fall back to GPS-derived altitude if absent.
|
||||
_alt = _get(frame, "enhanced_altitude")
|
||||
if _alt is None:
|
||||
_alt = _get(frame, "altitude")
|
||||
|
||||
dp = DataPoint(
|
||||
timestamp=ts,
|
||||
lat=lat,
|
||||
lon=lon,
|
||||
elevation_m=_get(frame, "altitude"),
|
||||
elevation_m=_alt,
|
||||
hr_bpm=_get(frame, "heart_rate"),
|
||||
cadence_rpm=_get(frame, "cadence"),
|
||||
speed_kmh=speed_raw * 3.6 if speed_raw is not None else None,
|
||||
|
||||
Reference in New Issue
Block a user