diff --git a/tools/re-capture/menu_blend_capture.sh b/tools/re-capture/menu_blend_capture.sh index 9caaf984..13d26346 100755 --- a/tools/re-capture/menu_blend_capture.sh +++ b/tools/re-capture/menu_blend_capture.sh @@ -84,15 +84,33 @@ try: print("%.1f" % ring_row.ring_row(Image.open("/tmp/mbc_row.png"))) except Exception: print("nan") PY } + # 🔴 The first version of this loop broke on its FIRST comparison -- one DOWN + # was dropped, the row read the same twice, it concluded "the cursor has + # stopped" and pressed (A) on NEW GAME. A stop test that cannot tell "at the + # end" from "the press was lost" is the counting bug wearing a different hat. + # So: a non-move only ends the walk AFTER at least one move has been seen, a + # run of dropped presses aborts instead of pressing (A), and (A) is pressed + # only if the cursor demonstrably moved. prev="$(row)"; echo " cursor row $prev" - for _ in 1 2 3 4 5 6 7 8; do - python3 "$SD/pad.py" tap DOWN 0.2; sleep 2 + moved=0; stalls=0 + for _ in 1 2 3 4 5 6 7 8 9 10; do + python3 "$SD/pad.py" tap DOWN 0.2; sleep 3 cur="$(row)"; echo " cursor row $cur" - [ "$cur" = "$prev" ] && break - prev="$cur" + if [ "$cur" = "$prev" ]; then + if [ "$moved" = 1 ]; then echo " cursor stopped -- at the last item"; break; fi + stalls=$((stalls+1)) + [ "$stalls" -ge 4 ] && { echo "NO CURSOR MOVEMENT after 4 presses -- not pressing (A)"; exit 3; } + else + moved=1; stalls=0; prev="$cur" + fi done + [ "$moved" = 1 ] || { echo "CURSOR NEVER MOVED -- not pressing (A)"; exit 3; } python3 "$SD/pad.py" tap A 0.3; sleep 5 s="$(screen)"; echo " after EXTRAS attempt: $s"; shot "$OUT/extras.png" + # The blend map needs to know WHICH screen it is looking at, and screen_id + # calls both of these "menu". Ⓑ is advertised on EXTRAS and not on the main + # menu, so the footer is the discriminator a human would use; here the element + # count in the capture is checked instead, after the fact. fi # 3. arm, then dismiss the menu bar F10 opened