shibosoftwaredev/f1c100s-linux-nema17-stepper-controller

A four-layer NEMA 17 motor-controller PCB combining an Allwinner F1C100S Linux computer, USB‑PD/buck power system, W5500 Ethernet, STM32 real-time motion control, DRV8825 stepper driver, protection/temperature/current telemetry, USB interfaces, and local LED/buzzer diagnostics.

Version
0.4.56
License
unset
Stars
0

scripts/fabrication_handoff.py

"""Promote an already validated handoff without deleting its predecessor."""
from pathlib import Path
from datetime import datetime, timezone
import uuid


def promote_handoff(staged: Path, destination: Path):
    assert staged.is_dir(), "Validated staging directory is missing"
    assert staged.resolve() != destination.resolve()
    backup = None
    if destination.exists():
        history = destination.parent / "fabrication-history"
        history.mkdir(exist_ok=True)
        stamp = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")
        backup = history / f"{stamp}-{uuid.uuid4().hex[:8]}"
        destination.replace(backup)
    try:
        staged.replace(destination)
    except BaseException:
        if backup is not None:
            backup.replace(destination)
        raise
    return backup