Files
bambuddy/backend
MartinNYHC 56f26cb013 Give a no-3MF archive the timelapse baseline it never took (issue #2957)
_capture_timelapse_baseline_at_start says in its own docstring that it must
    be called from every on_print_start path that proceeds to a real print, and
    what breaks otherwise: the completion scan falls back to snapshotting the
    card after the printer has written the video, so the new file lands inside
    the baseline and no diff can ever match. There are three such paths. The
    fallback branch was not calling it, and nothing else covered the gap --
    on_print_running_observed is restart-recovery only and is suppressed
    whenever on_print_start fires. Every no-3MF archive therefore reached
    completion with no baseline in memory and none on the row, and kept its
    timelapse only by accident.

    Not confined to the reported cool-off. The same branch serves the
    internal-storage verdict, so every H2C/H2D/P2S print that Bambu Studio's
    Print button sends to eMMC lost its timelapse the same way, off a card that
    was holding it the whole time. Measured on a live install: 0 of 9 fallback
    archives had a baseline, against 73 of 275 normal ones.

    The branch now takes one like the other two, and last like they are: it
    lists the printer's timelapse directory, so a slow card must not delay the
    active-print registration, the energy reading, the archive-created event or
    the start notification ahead of it.

    The other half is a print shorter than the five-minute cool-off, where the
    card is still unreadable at the one moment a baseline has to be taken.
    list_files_async answers [] when its connect fails rather than raising, so
    that is indistinguishable from a card holding no videos. When the cool-off
    expired inside the 900-second poll window every video on the card read as
    new, the first in listing order won, and a stale unclaimed video was
    attached to the print and then deleted off the printer.

    The empty baseline is still recorded rather than refused. Bambuddy deletes
    each video once it is attached, so the usual card holds exactly one at
    completion and an empty baseline resolves it correctly; refusing outright
    would lose that common case to protect a rare one, and persisting NULL
    instead would send completion to snapshot a card that by then has this
    print's video on it. Instead the scan marks such a baseline untrusted and
    the attach step declines to choose between several candidates, leaving them
    for the manual Scan for Timelapse button. require_unambiguous defaults to
    off, so the only caller whose behaviour changes is that scan.
2026-08-28 12:27:05 +02:00
..