Totals.fit -- what the unnamed first record actually does

Most of the detailed measurement below is on an **Edge 530**, where I could change one
thing at a time. I also have an **840**, and I've since repeated the key result on it:
the tool reads and writes its Totals.fit correctly, I've confirmed an edit end to end
(written over MTP, restarted, new value showing on the Odometer field), and record 0
accumulates there exactly as it does on the 530. The cross-device behavior further down
needed both units.

### The file

`Totals.fit` holds `totals` records (mesg 33) — 11 of them on both of my devices, most
of them empty. On my 530, 8 carry profile names in field 10 and 3 are blank. Four fields
per record are meaningful:

```
f0 timer time uint32, seconds
f1 distance uint32, METRES
f2 calories uint32, kcal
f5 sessions uint16, ride count
```

Plus `sport` (f3), `sport_index` (f9), the 32-byte name (f10) and
`message_index` (f254), none of which I write.

**The field set is per-model, so don't assume the layout you see is the layout.** My 530's
records carry exactly the eight fields above. My 840's carry **two more** — field numbers
11 and 12, both uint32 — which is why the same 11-record file is 693 bytes on one device
and 795 on the other. I don't write either one and I don't know what they're for. f11 is
2 on every record including the empty ones. f12 is zero on every profile that has been
created since the device was set up, and non-zero — the same value on each — on the
profiles that were already there, which looks like something stamped at setup rather than
anything per-profile. If you parse these files, read the definition message rather than
assuming a field set.

Only **distance** has an on-device display, via the Odometer data
field. I can find no menu anywhere that shows the per-profile time,
calories or ride count — they are stored, they are writable, they
survive an import, and nothing I've found so far seems to surface them.

### What the first record is

Record 0 is unnamed and holds the largest numbers, at least initially, if the Totals.fit
file hasn't been manually modified. I assumed it was the sum of the other records. **It is
not** — it is a running total the device maintains across all profiles, and it moves by
exactly a ride when you ride.

I went back and forth on this more than once, so it's worth saying where I went wrong: at
one point I saw record 0 *decrease* and concluded it couldn't be an accumulator. That was
my own measurement error. I was comparing against a Totals.fit I had **written** to the
device rather than one I had **pulled off** it. Compared against two genuine pulls it all
reconciles, with a deleted profile accounting for the difference. If you go poking at these
files yourself, that's an easy trap — only ever diff two files that came off the device.

Here is what I measured.

**A ride lands in its profile record and in record 0 together**, identical in distance,
time, calories and session count. Seen four times now, on both devices — including once at
68 m / 94 s on the 530, a delta that small appearing identically in two records isn't
rounding, and once at 41,978 m / 11,292 s / 906 kcal / +1 session on the 840, where the
profile record and record 0 moved by those same four numbers and nothing else moved at all.

**Nothing I wrote into a profile record ever moved record 0.** Three separate
write-and-import cycles: 100 mi into one profile, four fields into another, four profiles
reset to zero. Record 0 didn't budge for any of them.

**Rides sync BOTH WAYS between two Edges on one Garmin Connect account**, and I only found
this because I own two. I rode ~10.8 miles on the 840. The 530 had been switched off for
two days; when I next powered it on, its `ROAD` record *and* its record 0 had both gained
exactly that ride — 17,387 m, 3,406 s, 469 kcal, +1 session, identical in both. Matching
was by **profile name**; both units have a profile called ROAD, and nothing else moved.

It goes the other direction too, and this is the part I found most interesting. A 68 m test
ride I'd done on the 530, on a profile called `ROAD A2`, later turned up in the **840's
record 0** — and the 840 has no profile by that name. So it landed in record 0 alone, with
no profile record to hold it. (Confirmed by the time, calorie and session residuals between
two 840 pulls, which are straight subtraction and don't depend on any assumption.)

**Arrivals are additive, not authoritative.** A 68 m ride already sitting in another profile
was untouched. So an odometer reset is not silently undone by a later sync.

**I can't tell you the mechanism, and I have three facts that don't fit together.**
Garmin's Edge 530 manual documents Physio TrueUp pulling activities from other
devices via Connect — a real, named pathway. But Garmin's support page listing
what TrueUp syncs does *not* include per-profile lifetime totals ("Weekly and Monthly
Totals" is listed, which is a different thing). And **no activity file appeared** in the
530's Activities folder for that ride, so the device didn't simply ingest an activity and
count it locally.

If anyone knows how this actually works, that's the part I'd most like to hear.

Next part in first reply

  • ### The rule that says the first row must equal the sum

    There's a thread on the Edge 530 forum where someone couldn't get a profile's
    odometer to stick, and the accepted answer is:

    > "The first row has to equal the total of all profiles in the rest of
    > the rows."

    I don't think that's the mechanism. I captured five consecutive working device
    states while testing — every one pulled after a successful import, with the device
    behaving normally throughout:

    | state | first record vs sum of the rest |
    |---|---|
    | before any edits | sum ~64 mi **lower** |
    | after edit 1 | sum ~36 mi **higher** |
    | after edit 2 | sum **236 mi higher** |
    | after edit 3 | sum ~64 mi lower |
    | after a ride | sum ~64 mi lower |

    They're never equal, and the sign of the difference flips depending on
    what I'd just written. In the middle state the profile records summed
    to 236 miles *more* than record 0 — and the device accepted that file,
    imported the next one cleanly, and carried on accumulating correctly.

    So the device doesn't appear to validate that relationship, recompute
    from it, or reject a file that breaks it.

    **I think the real cause in that thread is in the original poster's
    own follow-up.** He was going FIT → CSV → FIT with the SDK, and said
    of the file that worked (made with a different tool) that his own
    had fields "in other orders" with "some hex mess" in some cells. The
    responder's *other* piece of advice is the one I'd keep:

    > "Also, do not change the file structure."

    That matches what I see. I edit these files by overwriting the field
    payloads in place at their byte offsets and recomputing the trailing
    CRC — field order, field widths, record count and message definitions
    are never touched. Every import has been accepted. A round-trip
    through CSV rebuilds the file, and that's where a structural
    difference can creep in without being obvious in the CSV.

    Not a criticism of the answer — it solved the poster's problem and the
    structural advice in it was right. I just don't think the arithmetic part is
    load-bearing, and it's the part everyone quotes.

    For anyone searching, the thread I am referring to is here:
    forums.garmin.com/.../ride-profile-details-resetting-after-editing-totals-fit

    It is locked, which is why this is a separate post rather than a reply
    there. Worth reading first -- the structural half of that answer is
    right and it did solve the original poster's problem.

    ### Three more things the testing settled

    **A multi-record edit imports fine.** I rewrote two records in one file and imported it;
    both landed exactly as written, and every other record came back unchanged in all four
    fields, with names and sport values intact. Nothing I found said whether that had
    previously worked for anyone else.

    **The device resumes from what you write, it doesn't restore its own
    number.** After zeroing a profile and importing, riding it counted up
    from zero. That was the failure mode I was most worried about.

    **The empty records are a pre-allocated pool, not padding.** I created three new activity
    profiles on the 840 from its own on-device templates, then pulled `Totals.fit` again. The
    file was still 795 bytes with still exactly 11 records — the three new profiles had claimed
    three of the existing blank slots. Nothing was appended and the message definition didn't
    change.

    Two things follow from that. Claiming a slot sets its `sport` field from **255 to 2**, so
    255 appears to be the "unused slot" marker rather than a missing value — which is worth
    knowing if you're tempted to key anything off `sport`. And the pool is **1 unnamed record
    plus 10 named slots**, which would be a neat explanation for a ten-profile ceiling. I
    haven't tried to create an eleventh profile to see what happens, so treat that last part as
    a guess with a suspiciously round number behind it.

    Creating profiles didn't move record 0 on any field, incidentally — it really does look
    like only rides touch it.

    ### Caveats

    - Two devices, current firmware, one account. The step-by-step edit-and-import sequence is
    530; on the 840 I've confirmed read/write, the cross-device behaviour, record 0
    accumulating from a ride, and the record-pool behaviour above — but not the full five-state
    sequence. The two models don't even carry the same field set, so I'd be genuinely
    interested whether a 540/1040/1050 matches either of them.
    - `Garmin/NewFiles/` is the only route that works for writing this file back — dropping it
    into its own folder does nothing. And keep a copy of the original: there is no undo.
    - I don't know what *reads* record 0. No screen I can find shows a lifetime total.
    - I don't know why per-profile time, calories and sessions are stored when nothing
    displays them. If anyone knows what consumes them I'd like to hear it. Physio TrueUp is
    the obvious guess, but as above, Garmin's own list of what TrueUp syncs doesn't mention
    per-profile totals — so I'm not going to claim it.

    The tooling I used is a small Python CLI, part of a larger Edge
    profile editor I've been building:
    github.com/.../Activity-Profile-Editor