feat: NFC tag spool_id for Spoolman integration#173
Conversation
- Extract optional spool_id field from OpenSpool JSON payload - Call ON_NFC_SPOOL_READ macro when spool_id is present - Add Spoolman Integration section to documentation - Enables automatic spool tracking via NFC tags - Backward compatible: tags without spool_id work as before Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
83071a4 to
b27829b
Compare
|
Not entirely sure, but I believe this implementation has more 'read nfc and spoolman' features built in. #163 |
Indeed. |
| + if spool_id is not None: | ||
| + try: | ||
| + gcode = self.printer.lookup_object('gcode') | ||
| + gcode.run_script_from_command( |
There was a problem hiding this comment.
https://en.wikipedia.org/wiki/Separation_of_concerns
This is probably not the place to deal with this.
There was a problem hiding this comment.
Cool that you picked up on that! Do you have software development experience? Seems like you know what you're doing. Whereas I am trusting the magnificent Opus 😄 I appreciate you taking a look and letting me know!
There was a problem hiding this comment.
Cool that you picked up on that! Do you have software development experience? Seems like you know what you're doing. Whereas I am trusting the magnificent Opus 😄 I appreciate you taking a look and letting me know!
I might have a bit of experience in the SW/IT field, and pondered this "problem" and its solution for a bit before implementing it 😄
I have no idea what Opus is
There was a problem hiding this comment.
Ah, with Opus I refer to the almighty Claude Opus 4.5. The state of the art AI model from Anthropic.
Summary
Thanks for building the extended firmware - it's made the U1 so much more usable.
I added an optional
spool_idfield to the OpenSpool parsing so users with Spoolman can get automatic spool tracking when they load filament. Tags without spool_id still work exactly as before.Changes
spool_idfield from OpenSpool JSON intoinfo['SPOOL_ID']ON_NFC_SPOOL_READ CHANNEL=<n> SPOOL_ID=<id>macro when spool_id is presentTag Format
Users add
spool_idto their existing OpenSpool tags:{ "protocol": "openspool", "version": "1.0", "brand": "Elegoo", "type": "PLA", "color_hex": "#FF5733", "spool_id": 42 }Backward Compatibility
spool_idwork exactly as beforespool_idis presentExample Macro
Users create
extended/klipper/nfc_spoolman.cfg:[gcode_macro ON_NFC_SPOOL_READ] gcode: {% set channel = params.CHANNEL|int %} {% set spool_id = params.SPOOL_ID|int %} {% set tool = "T" ~ channel %} SET_GCODE_VARIABLE MACRO={tool} VARIABLE=spool_id VALUE={spool_id} RESPOND PREFIX="NFC" MSG="Spool {spool_id} assigned to {tool}"Testing