Files
bambuddy/backend/app/core
maziggy 268940573d Stop a drying cycle reporting itself finished a minute in (#2759)
Starting the dryer on an AMS 2 Pro holding two PETG and two PLA spools
    and picking PLA showed "PLA @ 45°C" for about a minute and then switched
    to "PETG @ 65°C" for the remaining twelve hours.

    Bambu never echoes back which filament or temperature a cycle is
    running, so the badge reads the target cached when the command went out,
    and that cache had been dropped. Between accepting the command and
    settling its countdown the firmware publishes one update with the
    remaining time at zero while the unit is still in its Checking phase --
    the reporter's log has 720, then 0, then 719, and four seconds later the
    same unit's info hex decodes to dry_status 2, Drying. The falling-edge
    detector read that zero as the cycle ending. Losing the cached target
    left the badge to guess from the first loaded slot, which was PETG, and
    its RFID-recommended 65°C. The same false ending fired
    on_drying_complete, so anyone with smart-plug auto-off-after-drying
    switched on had power scheduled to cut one minute into a twelve-hour
    dry; the reporter had it off, which is the only reason this reads as a
    cosmetic bug.

    A remaining time of zero now ends a cycle only when the unit is not also
    reporting an active phase. dry_status comes from the same info hex
    already parsed a few lines above, so this costs nothing to check.
    Stopping and Error are deliberately not treated as active -- those
    should end it -- and a unit that reports no phase at all still ends its
    cycles, so the gate can only ever suppress on positive evidence that the
    cycle is live. A suppressed edge leaves the remembered dry_time alone,
    exactly as the #1462 absent-value skip does, so the push that really
    ends the cycle still sees a non-zero previous.

    The fallback guess is tightened to match. On a mixed unit the first tray
    is evidence of nothing, and naming a temperature the cycle is not using
    is worse than naming none, so it now answers only when every loaded
    spool is the same filament and otherwise leaves the badge showing the
    countdown alone. Both the websocket and REST status builders carried
    their own copy of that loop; they now share one helper, which also takes
    the temperature from the first slot that carries an RFID one rather than
    giving up when slot 1 holds a third-party spool.
2026-08-15 14:07:01 +02:00
..