From dd1764dc99d9535d72e250f5284e5469315c44ab Mon Sep 17 00:00:00 2001 From: pgdalmeida Date: Mon, 28 Sep 2026 17:34:15 +0200 Subject: [PATCH] Show the build's progress during an install, and drop the centre-count note where it does not apply --- hardware/common/kit.sh | 3 +++ scripts/install-tower | 21 ++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/hardware/common/kit.sh b/hardware/common/kit.sh index 7c1b58c..27c64b9 100644 --- a/hardware/common/kit.sh +++ b/hardware/common/kit.sh @@ -288,6 +288,9 @@ center_note() { local steps="$1" ax="$2" [[ -z $steps ]] && return 0 local half=$(( steps / 2 )) + # Only when it matters: the 500000 default is fine for any travel under a + # million counts, and a note demanding a change nobody needs gets acted on. + (( half >= 500000 )) || return 0 echo "; NOTE: half this travel is $half counts, so config.ini needs" echo "; [Motor] ${ax}_center_count = $(kit_center_for "$steps") (or anything above $half)" echo "; The 500000 default would put the negative end at $(( 500000 - half ))." diff --git a/scripts/install-tower b/scripts/install-tower index 6138cef..1e595d2 100755 --- a/scripts/install-tower +++ b/scripts/install-tower @@ -865,10 +865,29 @@ if [[ ${DO[preconditions]} == change ]]; then hr preconditions; sudo "$KIT/insta if [[ ${DO[vimba]} == change ]]; then hr vimba; sudo "$KIT/install.sh" --vimba "$VIMBA_SRC"; done_step vimba; fi hr "host build" +build_start=$SECONDS +say "configuring (a first build also downloads the MQTT and dashboard libraries)" ( cd "$REPO" && GIT_REV="$S_SW_REV" cmake -S . -B build -DWITH_MQTT=ON \ -DWITH_VIMBA=$([[ -d /opt/VimbaX/cti ]] && echo ON || echo OFF) > "$WORK/cmake.log" 2>&1 ) || { tail -20 "$WORK/cmake.log" >&2; die "cmake configure failed"; } -( cd "$REPO" && cmake --build build -j"$(nproc)" 2>&1 | tail -3 ) +# Progress, not silence: a first build on a LattePanda takes 10-25 minutes, and a +# screen that says nothing for that long reads as a hang - someone pressed Ctrl-C +# on staeffelsberg. A line every 5 %, any error as it happens; the whole output +# is kept, and its tail shown if the build fails. +say "building on $(nproc) cores - a first build takes 10-25 minutes, a rebuild a few" +if ! ( cd "$REPO" && cmake --build build -j"$(nproc)" 2>&1 ) | tee "$WORK/build.log" | awk ' + match($0, /^\[ *[0-9]+%\]/) { + p = substr($0, 2, RLENGTH - 3) + 0 + if (p >= last + 5 || (p == 100 && last != 100)) { + printf " %3d%% %s\n", p, substr($0, RLENGTH + 2); last = p; fflush() + } + next + } + /[Ee]rror/ { print " " $0; fflush() }'; then + tail -30 "$WORK/build.log" >&2 + die "the build failed (the last lines are above)" +fi +say "built in $(( (SECONDS - build_start) / 60 )) min $(( (SECONDS - build_start) % 60 )) s" [[ -x $BIN && -x $FGC_CONFIG ]] || die "the build did not produce the program and fgc-config" done_step build