Skip to content

Race timer sets DVR filenames to the heat you flew, e.g. hdz_0042-WinterCup-Mains-A-R5-H1.mp4#613

Open
bob9 wants to merge 2 commits into
hd-zero:mainfrom
bob9:dvr-recording-name
Open

Race timer sets DVR filenames to the heat you flew, e.g. hdz_0042-WinterCup-Mains-A-R5-H1.mp4#613
bob9 wants to merge 2 commits into
hd-zero:mainfrom
bob9:dvr-recording-name

Conversation

@bob9

@bob9 bob9 commented Jul 14, 2026

Copy link
Copy Markdown

Summary

Lets a race timer name the next DVR recording (e.g. WinterCup-Mains-A-R5-H1) by sending a new MSP_SET_DVR_NAME (0x030F) message through the ELRS backpack.

  • elrs.c handles the new MSP command and hands the payload to dvr_set_race_label().
  • dvr.c stores a filename-safe copy of the label (alnum kept, spaces become -, everything else dropped) with a 5-minute TTL so a recording made well after the heat doesn't inherit the race's name; an empty payload clears it. The label is written to the record conf on every update so a stale value never survives.
  • The record process (record/) appends -label to the stock filename, just before the extension, for both naming modes — hdz_0042-WinterCup-Mains-A-R5-H1.mp4 (contiguous) or 20260718-141502-WinterCup-Mains-A-R5-H1.mp4 (date). Snapshot .jpg previews and split segments share the name. Because the stock prefix and index position are untouched, the existing contiguous file counter handles labelled names with no changes.

Labels are capped at 43 chars (REC_labelMAXLEN 44) — the worst case (date naming + label + .mp4) is 63 chars, still inside the playback list's 64-char name buffer. Over-long labels are silently truncated at both entry points (MSP payload and record conf), never rejected.

Additive only — recordings without a label are named exactly as before.

Related PRs

A race timer can push a label for the next DVR recording through the ELRS
backpack (e.g. "WinterCup-Qual1-H2"). While a label is set, recordings are
named YYYY-MM-DD-NNNN-label.ext - date and file index lead so a plain
filename sort lists the day in recording order; NNNN is the existing
contiguous DVR counter, which now also scans labelled files so indexes
never collide. Snapshot .jpg previews and split segments share the name.

The label is sanitised to filename-safe characters, capped at 32 chars
(names stay under the playback list's 64-char buffer), expires 5 minutes
after it was set so later non-race recordings fall back to the standard
naming, and an empty payload clears it. With no label, nothing changes.
Labelled recordings now keep whatever name the user's naming setting
would have produced and just append -label before the extension:
hdz_0042-WinterCup-Mains-A-R5-H1.mp4 (contiguous) or
20260713-141502-WinterCup-Mains-A-R5-H1.mp4 (date naming). Previously
a label switched recordings to a separate YYYY-MM-DD-NNNN-label scheme.

Because labelled names keep the hdz_ prefix and index position, the
stock contiguous counter sees them natively and disk_maxLabeledIndex
is no longer needed.

The label cap rises from 32 to 43 chars (REC_labelMAXLEN 44) so the
race description can be as long as possible: worst case is date naming
at 15 + 1 + 43 + 4 = 63 chars, still inside the playback list's 64-char
name buffer. Longer labels are silently truncated at both entry points
(backpack MSP and record conf), never rejected.
@bob9

bob9 commented Jul 15, 2026

Copy link
Copy Markdown
Author

Pushed a follow-up commit that changes how the label lands in the filename, after trying the first cut at a race meet on paper.

Originally a label switched recordings to a separate YYYY-MM-DD-NNNN-label scheme. That reinvented naming the goggles already do and needed a second index scanner to keep the counter contiguous. Now the label is simply appended to whatever the stock naming produces — hdz_0042-WinterCup-Mains-A-R5-H1.mp4, or the same with a date-naming prefix — so a pilot's card sorts exactly as it always has, labelled and plain recordings interleaved in recording order. The extra scanner is deleted; the diff got 48 lines smaller.

Also raised the label cap from 32 to 43 chars so the race description can carry the meeting name properly. 43 is the exact budget: worst case is date naming (15) + dash + label + .mp4 = 63, one under the playback list's 64-char name buffer. Over-long labels truncate silently at both entry points rather than being rejected.

Description updated to match.

@bob9 bob9 changed the title Name DVR recordings after the race via MSP_SET_DVR_NAME (0x030F) Auto-name DVR recordings after the race you flew, e.g. hdz_0042-WinterCup-Mains-A-R5-H1.mp4 Jul 15, 2026
@bob9 bob9 changed the title Auto-name DVR recordings after the race you flew, e.g. hdz_0042-WinterCup-Mains-A-R5-H1.mp4 DVR filenames named after the race you flew, e.g. hdz_0042-WinterCup-Mains-A-R5-H1.mp4 Jul 15, 2026
@bob9 bob9 changed the title DVR filenames named after the race you flew, e.g. hdz_0042-WinterCup-Mains-A-R5-H1.mp4 DVR filenames based on the race you flew, e.g. hdz_0042-WinterCup-Mains-A-R5-H1.mp4 Jul 15, 2026
@bob9 bob9 changed the title DVR filenames based on the race you flew, e.g. hdz_0042-WinterCup-Mains-A-R5-H1.mp4 Race timer sets DVR filenames to the heat you flew, e.g. hdz_0042-WinterCup-Mains-A-R5-H1.mp4 Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant