Skip to content

Warn when a profile id clashes with a stock filament - #28

Open
bdog720 wants to merge 1 commit into
HurricanePrint:mainfrom
bdog720:warn-on-reserved-ids
Open

Warn when a profile id clashes with a stock filament#28
bdog720 wants to merge 1 commit into
HurricanePrint:mainfrom
bdog720:warn-on-reserved-ids

Conversation

@bdog720

@bdog720 bdog720 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

The notes template asks for a unique 5-digit id but doesn't say unique against what, so it's easy to pick one the built in filaments already use. When that happens your filament takes that slot and the built in one stops showing on the printer, which reads like a sync failure. Nothing warned about it. Two profiles sharing an id went unnoticed too.

Adds tools/id-check.js, called from main.js after initData():

These profiles use an id that a stock filament already owns:
  00001  "PLA Matte" replaces Generic PLA
The stock filament will not show on the printer while that id is in use.
To get it back, give your profile an unused id (90000 and up is free) and sync again.
If you already wrote this id to an RFID tag, the tag keeps pointing at the old id.

Sync anyway? [y/N]

It only prompts when there's a terminal attached. Run headless as a slicer post processing script there's no TTY, so it prints the warning and carries on rather than hanging the slice. Declining stops before anything is written or uploaded.

It runs before addProfiles because convertToPrinterFormat rewrites the presets in place, so afterwards the original shape is gone.

README now lists the ids the built in filaments use, suggests 90000 and up, and notes the RFID tag caveat.

Sits on top of #27 — without that fix, choosing to override still empties the database, so the warning would be describing behaviour that doesn't work yet.

Tested against a real OrcaSlicer install: clean ids pass silently, a simulated collision warns and prompts correctly, and declining aborts the sync.

The notes template asks for a unique 5 digit id but never says unique
against what, so it is easy to pick one the built in filaments already use.
Doing that hands your filament that slot and the built in one stops showing
on the printer, which is easy to mistake for a sync failure. Nothing warned
about it. Two profiles sharing an id went unnoticed as well.

Check the ids after initData and before anything is written or uploaded,
listing each clash and the stock filament it replaces, plus any id used
twice. Ask before continuing when there is a terminal attached, and carry
on with a warning when there is not, since the tool usually runs headless
as a slicer post processing script and a prompt there would hang the slice.

The check has to run before addProfiles because convertToPrinterFormat
rewrites the presets in place.

README lists the ids the built in filaments use, suggests 90000 and up, and
notes that an RFID tag keeps pointing at the old id if you change it later.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@HurricanePrint

Copy link
Copy Markdown
Owner

Could you add a check to skip the warning if the id matches a stock profile id while also containing the same vendor and/or type as it's most likely to be intended an update to the stock profile, rather than a new profile accidentally sharing the id.

So if it reads a profile with the block {id:"00001", vendor:"Generic", type:"PLA",name:"Generic PLA"} it will continue without warning and overwrite with the new settings, but if the block is different such as {id:"00001", vendor:"PolyMaker", type:"PLA",name:"PolyMaker PLA"} it will show the warning.

The name field could maybe be used in the check, but it would depend on the slicer profile being saved as the same name listed in the notes block. From previous issues reported some people leave in the "@creality k2 0.4..." when they save their changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants