Skip to content

Comments

Fix filament usage aggregation and persistence#364

Merged
pumpCurry merged 1 commit intomainfrom
codex/fix-filament-management-issues
Jan 29, 2026
Merged

Fix filament usage aggregation and persistence#364
pumpCurry merged 1 commit intomainfrom
codex/fix-filament-management-issues

Conversation

@pumpCurry
Copy link
Owner

Motivation

  • Prevent filament remaining being reset to pre-print value when estimated length (materialLength) is initially NaN by changing progress-based estimation to an absolute calculation.
  • Survive page reloads during a print by persisting internal filament-tracking variables so accumulated state is not lost.
  • Avoid double/missing records and 0-length recordings by ensuring job ID resolution before finalizing and falling back to expected length when reported used length is empty.

Description

  • Switched progress-based estimation from a delta accumulation to an absolute calculation (accumulatedUsedMaterial = (est * progress) / 100) so a later-known est will correct the accumulated value immediately; updated delta handling to avoid double-counting. (modified 3dp_lib/dashboard_aggregator.js)
  • Persisted and restored filament-tracking internal variables to/from localStorage: accumulatedUsedMaterial, prevUsedMaterialLength, and prevUsageProgress via persistAggregatorState() and restoreAggregatorState(). (modified 3dp_lib/dashboard_aggregator.js)
  • Ensured job ID resolution via resolveFilamentJobId() is applied before calling finalizeFilamentUsage() in both ingest/aggregation completion paths to reduce ID race conditions. (modified 3dp_lib/dashboard_aggregator.js)
  • Hardened finalizeFilamentUsage() to guard against empty/zero recorded lengthMm by falling back to the spool's currentJobExpectedLength when available and logging a warning; uses the resolved value for history/logging. (modified 3dp_lib/dashboard_spool.js)
  • Bumped file header @version / @lastModified metadata in the affected files.

Testing

  • No automated tests were executed as part of this change.
  • Changes were saved and committed (git commit) and basic repository operations completed without error.
  • Manual runtime validation is recommended (start an external print, simulate delayed materialLength and page reloads, then finish/cancel) to confirm corrected aggregation and persistence behavior.

Codex Task

@pumpCurry pumpCurry merged commit 7ae4468 into main Jan 29, 2026
6 checks passed
@pumpCurry pumpCurry deleted the codex/fix-filament-management-issues branch January 29, 2026 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant