Skip to content

Read the remaining filament weight (TigerTag and OpenTag3D) - #35

Open
TigerTag-Project wants to merge 1 commit into
suchmememanyskill:mainfrom
TigerTag-Project:remaining-weight
Open

TigerTag-Project wants to merge 1 commit into
suchmememanyskill:mainfrom
TigerTag-Project:remaining-weight

Conversation

@TigerTag-Project

Copy link
Copy Markdown

Smart scales such as Tiger Scale weigh a spool and write the remaining quantity back to its tag. Several projects already read this value. OpenRFID did not expose it, so this PR adds a shared field and fills it for the two supported formats that store it.

GenericFilament.remaining_weight_grams

  • Measured remaining filament, in grams. 0 means unknown, like td and the other optional fields, so processors that don't support it are unaffected.
  • Exported in to_dict(), so it is available to the webhook and to templates ({{ filament.remaining_weight_grams }}). pretty_text() shows it when known.

TigerTag

  • Reads Measure Available (+76, u24 BE, page 0x17; see the TigerTag spec). It is converted to grams with the same unit as the initial measure.
  • Factory-written tags leave this field at 0. That means "not weighed yet", not "empty", which is why 0 maps to unknown. All the real TigerTag dumps in test/tags have 0 here.

OpenTag3D

  • Exports Measured Filament Weight (0xA4). The schema already decoded it, but it was not exported. weight_grams stays the target weight, as before. The processor README is updated.

Tests

  • eSun PLA Basic Refill Cold White TigerTag+ Weighed 742g: a copy of the existing eSun dump with 742 g written at +76, as a scale would do. Page 0x17 is outside the signed region, so the TigerTag+ signature still verifies.
  • The original eSun dump checks the unknown case (0.0).
  • OpenTag3D: a new test covers the measured weight, and the Polar fixture checks the unknown case.

98 passed, 1 skipped.

Note: #32 and #34 also add fields at the end of GenericFilament and to_dict(). Whichever is merged later will need a trivial conflict resolution there; happy to rebase.

Add a shared remaining_weight_grams field to GenericFilament for the
measured remaining filament, as written back by smart scales. 0 means
unknown, like the other optional fields. It is exported in to_dict(), so
webhooks and templates can use it, and shown in pretty_text() when known.

- TigerTag: read Measure Available (+76, u24 BE), converted with the same
  unit as the measure. Factory-written tags leave it at 0 (not weighed).
- OpenTag3D: export Measured Filament Weight, which was decoded but not
  exported.
- Tests: an eSun TigerTag+ copy with 742 g written at +76 (outside the
  signed region, so the signature stays valid), the original dump as the
  unknown case, and an OpenTag3D measured-weight case.
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.

1 participant