Skip to content
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/live-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ jobs:
e2e-pipeline:
name: Slice -> p2pp -> lint -> P3 firmware
runs-on: ubuntu-latest
if: false # disabled until Xvfb + Flatpak + Docker runtime is validated
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down
4 changes: 4 additions & 0 deletions profiles/prusaslicer/Palette3-cli.ini
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,16 @@ wipe_tower_x = 170
wipe_tower_y = 140
wipe_tower_width = 60
wipe_tower_rotation_angle = 0
use_relative_e_distances = 1

# --- p2pp configuration -----------------------------------------------------
# Kept in sync with profiles/prusaslicer/Palette3.ini. Deliberately omits
# P3_UPLOADFILE / P3_HOSTNAME / P3_SHOWPRINTERPAGE: CI has no Palette to talk to
# and those directives would make p2pp attempt network I/O.
start_gcode = G28 ; home all axes\nG1 Z5 F5000\n;P2PP PALETTE3_PRO\n;P2PP PRINTERPROFILE=0123456789abcdef\n;P2PP LINEARPINGLENGTH=350\n;P2PP SPLICEOFFSET=30\n;P2PP MINSTARTSPLICE=100\n;P2PP MINSPLICE=70\n;P2PP EXTRAENDFILAMENT=200\n;P2PP MATERIAL_DEFAULT_0_0_0\n;P2PP MATERIAL_PLA_PLA_2_1_2

# Required for use_relative_e_distances=1: reset extruder position each layer
layer_gcode = G92 E0

# p2pp/psconfig.py:127 parses this block to recover the wipe tower position.
end_gcode = ; EXTRA_CONFIG_VARIABLES\n; wipe_tower_x = {wipe_tower_x}\n; wipe_tower_y = {wipe_tower_y}\nM104 S0 ; turn off temperature\nM140 S0\nG28 X0\nM84
27 changes: 23 additions & 4 deletions scripts/e2e_pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,25 @@ PROCESSED="${OUTDIR}/processed.gcode"

# --- stage 1: slice ---------------------------------------------------------
echo "==> [1/4] Slicing $(basename "${MODEL}") with ${SLICER}"
"${SLICER}" --export-gcode --load "${CONFIG}" --output "${RAW}" "${MODEL}"
# Flatpak PrusaSlicer needs a display even with QT_QPA_PLATFORM=offscreen —
# wrap in xvfb-run so it works headless in CI.
# The slicer may crash with Xlib errors after writing G-code (Flatpak sandbox
# cleanup), so don't use set -e for this command.
XVFB_WRAPPER=""
command -v xvfb-run >/dev/null 2>&1 && XVFB_WRAPPER="xvfb-run -a"
${XVFB_WRAPPER} "${SLICER}" --export-gcode --load "${CONFIG}" --output "${RAW}" "${MODEL}" || true

# Give the filesystem a moment to flush (Flatpak sandbox can be slow)
sleep 2

# If the slicer didn't write to the expected path, check /tmp
if [ ! -s "${RAW}" ]; then
echo "WARNING: G-code not at ${RAW}, checking alternatives..."
found=$(find /tmp -name "raw.gcode" -newer "${MODEL}" 2>/dev/null | head -1)
if [ -n "${found}" ]; then
cp "${found}" "${RAW}"
fi
fi
[ -s "${RAW}" ] || { echo "FAIL: slicer produced no G-code" >&2; exit 1; }

# p2pp/psconfig.py:160 keys off this string; without it p2pp will not recognise
Expand All @@ -46,10 +64,11 @@ echo " tool changes in raw G-code: ${TOOLCHANGES}"
# --- stage 2: p2pp ----------------------------------------------------------
# NOTE: P2PP.py takes positional args (p2pp/main.py:100-104). There is no -i flag.
echo "==> [2/4] Post-processing with p2pp"
XVFB=""
command -v xvfb-run >/dev/null 2>&1 && XVFB="xvfb-run -a"
# p2pp imports GUI modules that use Xlib; wrap in xvfb-run in CI
XVFB2=""
command -v xvfb-run >/dev/null 2>&1 && XVFB2="xvfb-run -a"
QT_QPA_PLATFORM="${QT_QPA_PLATFORM:-offscreen}" \
${XVFB} python3 "${REPO_ROOT}/P2PP.py" "${RAW}" "${PROCESSED}"
${XVFB2} python3 "${REPO_ROOT}/P2PP.py" "${RAW}" "${PROCESSED}"
[ -s "${PROCESSED}" ] || { echo "FAIL: p2pp produced no output" >&2; exit 1; }

# --- stage 3: lint ----------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion scripts/install_prusaslicer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ flatpak info "${APP_ID}" | sed -n 's/^ *\(Version\|Commit\|Date\):/\1:/p'
# read the model/config out of the workspace and write the G-code back.
sudo tee /usr/local/bin/prusa-slicer >/dev/null <<'SHIM'
#!/usr/bin/env bash
exec flatpak run --filesystem=host \
exec flatpak run --filesystem=host --filesystem=/tmp \
--env=QT_QPA_PLATFORM=offscreen \
--env=DISPLAY="${DISPLAY:-:99}" \
com.prusa3d.PrusaSlicer "$@"
SHIM
sudo chmod +x /usr/local/bin/prusa-slicer
Expand Down
Loading