mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-05-09 08:25:54 +02:00
[GH-ISSUE #942] 3 P1S bugs: spurious print-start notifications on restart, missing auto_switch_filament, weight tracking fails after restart #651
Labels
No labels
A1
automated
automated
bug
bug
Closed due to inactivity
contrib
dependencies
dependencies
duplicate
enhancement
feedback
hold
invalid
Notes
P1S
pull-request
security
ThumbsUp
user-report
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/bambuddy-maziggy-1#651
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @rahulrana21 on GitHub (Apr 11, 2026).
Original GitHub issue: https://github.com/maziggy/bambuddy/issues/942
Originally assigned to: @maziggy on GitHub.
Summary
Three related bugs found while using Bambuddy exclusively (no BambuStudio) for P1S printing. All three were root-caused from MQTT/code analysis.
Bug 1 — Spurious "Print Started" notifications and phantom archives on Bambuddy restart
File:
backend/app/services/bambu_mqtt.pyWhen Bambuddy restarts while a print is in progress, the printer sends a
pushallresponse. Theis_new_printdetection fires because_previous_gcode_stateis reset toNoneon startup, soNone != "RUNNING"isTrue.This causes:
PrintArchiverecord created in the DB with no filament slot dataRoot cause:
Fix — mirror the guard already present in
is_file_change:Bug 2 — AMS auto-switch (backup spool) never enabled
File:
backend/app/services/bambu_mqtt.py—start_print()BambuStudio sends
{"print": {"command": "print_option", "auto_switch_filament": true}}when starting a print with AMS. This enables the printer to automatically switch to a backup slot when one slot runs out (requires matchingtray_info_idxon both slots).Bambuddy never sends this command. The printer either keeps its last BambuStudio setting (unreliable) or defaults to
false. Result: printer pauses and asks for manual filament reload instead of switching to the backup slot.Bambuddy already has
_set_print_option()infrastructure for exactly this pattern (used forauto_recovery_step_loss).Fix — add after
_client.publish()at the end ofstart_print():Bug 3 — Filament weight tracking fails for P1S after Bambuddy restart
Files:
backend/app/services/background_dispatch.py,backend/app/services/usage_tracker.py_print_ams_mappingsinmain.pyis an in-memory dict mappingarchive_id → ams_mapping. It is wiped on every Bambuddy restart. For P1S prints (which don't includeams_mappingin MQTT print-start events unlike P2S withdeveloper_mode=true), this mapping is the only source for_track_from_3mf.After a restart,
_track_from_3mffalls through to the final fallback:slot_id - 1 = global_tray_id, which is wrong for multi-colour prints and charges the wrong spools.Fix — Part A: persist
ams_mappingtoarchive.extra_dataat dispatch time (in both_run_reprint_archiveand_run_print_library_file, right afterregister_expected_print):Fix — Part B: add step 3.5 in
_track_from_3mfbetween the queue-item check (step 3) and color-match (step 4):Notes
ams_mappingin MQTT print-start events (nodeveloper_mode)@maziggy commented on GitHub (Apr 11, 2026):
What version are we talking about?