mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-09-30 11:12:35 +02:00
The print-queue "auto off after this job" trigger used a second, inline auto-off implementation (main.py, print_scheduler.py, print_queue.py) that hardcoded wait_for_cooldown(50C, 600s) — ignoring each plug's configured off_delay_mode / off_delay_minutes / off_temp_threshold — and ignored the return value, powering off on the 600s timeout regardless of print state. A print that failed and was reprinted from the touchscreen got its power cut mid-print. The inline tasks were also uncancellable, so a reprint couldn't abort a pending off. Consolidate all three into SmartPlugManager.schedule_off_after_queue_job, which schedules via the plug's configured strategy (shared with on_print_complete through _schedule_off_per_mode) and is cancellable via _pending_off. Add printer_manager.is_print_active() and guard the actual power-off in _delayed_off and _temp_based_off so no path cuts power on a loaded print. Move the on_print_start cancellation ahead of the auto_on gate so a reprint always aborts a pending off.