mirror of
https://github.com/Klipper4FlashForge/firmware.git
synced 2026-10-22 05:12:16 -05:00
The Moonraker component and the Klipper macros behind Mainsail's Timelapse
tab, pinned by commit because upstream has never cut a tag.
Upstream's scripts/install.sh is not used: it clones into a home directory,
symlinks into a Moonraker checkout, appends to live config and registers an
update_manager entry that re-clones itself over the network. All of those are
things this repo does differently, so the tarball is a source like any other
and the two files it contributes are placed by hand. timelapse.py lands
inside anvil-moonraker's directory because Moonraker resolves a component
with import_module(".components.<name>", "moonraker") and looks nowhere else.
No BUILD_TIMELAPSE flag, unlike every other optional piece here.
moonraker.conf carries a [timelapse] section and printer.base.cfg an
[include timelapse.cfg]; Moonraker dies on a section with no component behind
it and Klipper on an include it cannot find, so the off position of that flag
would not be a printer without timelapses -- it would be a printer that does
not come up.
The dependency arrow runs one way on purpose. anvil-timelapse does NOT depend
on anvil-moonraker, though it plainly needs it: anvil-moonraker already
depends on this package for the config section above, and declaring both
would be a cycle. Only the direction that is a hard failure is written down.
frame_path is /usr/data/anvil-timelapse rather than the default
/tmp/timelapse/: /tmp here is tmpfs, so a tall print's frames would be
hundreds of megabytes of RAM on the machine running that print.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TSmXJv47Wwq2J7FfgCgpCe
41 lines
1.9 KiB
Bash
Executable File
41 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# moonraker-timelapse -- two files out of the pinned tarball. Nothing is
|
|
# compiled, and the encoder is anvil-ffmpeg's problem, not this recipe's.
|
|
#
|
|
# UPSTREAM'S scripts/install.sh IS NOT USED: it clones into a home directory,
|
|
# symlinks into a Moonraker checkout, appends to live config and registers an
|
|
# update_manager entry that re-clones over the network -- all of which this
|
|
# repo does differently. The tarball is just a source, and the two files it
|
|
# actually contributes are placed by hand.
|
|
#
|
|
# GitHub wraps the archive in moonraker-timelapse-<sha>/; the paths reach
|
|
# through that rather than hiding the archive's shape behind --strip-components.
|
|
set -euo pipefail
|
|
. ./bin/common.sh
|
|
. pkgs/lib.sh
|
|
|
|
pkg_begin timelapse || exit 0
|
|
pkg_unpack "$TIMELAPSE_TGZ"
|
|
|
|
_src="$PKG_WORK/src/moonraker-timelapse-$TIMELAPSE_VERSION"
|
|
|
|
# pkgs/moonraker's guard, for the same reason: a tarball whose shape changed
|
|
# would stage nothing, which is a clean build and a tab that never appears.
|
|
[ -f "$_src/component/timelapse.py" ] || pkg_die \
|
|
"timelapse: no component/timelapse.py in $(basename "$TIMELAPSE_TGZ")"
|
|
[ -f "$_src/klipper_macro/timelapse.cfg" ] || pkg_die \
|
|
"timelapse: no klipper_macro/timelapse.cfg in $(basename "$TIMELAPSE_TGZ")"
|
|
|
|
# Inside anvil-moonraker's directory, because Moonraker resolves a component
|
|
# with import_module(".components.<name>", "moonraker") and looks nowhere else.
|
|
# Two packages, different files, one directory -- opkg is content, and
|
|
# anvil-moonraker's Depends orders the install.
|
|
pkg_stage "$_src/component/timelapse.py" "moonraker/components/timelapse.py"
|
|
|
|
# $MODDIR/config is a staging directory: runFirmwareExe.sh copies it into
|
|
# /usr/data/config, where printer.base.cfg's [include timelapse.cfg] resolves.
|
|
pkg_stage "$_src/klipper_macro/timelapse.cfg" "config/timelapse.cfg"
|
|
|
|
pkg_ship "moonraker/components/timelapse.py" "config/timelapse.cfg"
|
|
pkg_end
|