Skip to content

Afc weight - #33

Open
BastiMila wants to merge 6 commits into
TigerTag-Project:mainfrom
BastiMila:afc-weight
Open

BastiMila wants to merge 6 commits into
TigerTag-Project:mainfrom
BastiMila:afc-weight

Conversation

@BastiMila

Copy link
Copy Markdown

Klipper/AFC: send the spool's weight, temperatures and brand - still nothing to install

Follows up on #31 and the Klipper backend in 1.73.0. Builds on its object-list
detection and adds what the old TT_SET_LANE macro used to carry, using only
commands AFC and Klipper already have.

I know weight sharing is not in your main fokus

What an AFC lane now receives

After SET_MATERIAL / SET_COLOR, in the same printer.gcode.script:

SET_WEIGHT LANE=<lane> WEIGHT=<g>
AFC_SET_SPOOL_TEMP LANE=<lane> EXTRUDER_TEMP=<t> BED_TEMP=<t>
SAVE_VARIABLE VARIABLE=tt_<lane>_brand VALUE="'<brand>'"    # only with [save_variables]
SAVE_VARIABLE VARIABLE=tt_<lane>_total VALUE=<full g>       # only with [save_variables]
  • Weight comes from a source the user picks under Settings > Account,
    "Weight from: Chip / Cloud" (NVS wcloud, default Cloud). Cloud reads the
    spool's document users/{uid}/inventory/{chip uid} (weight_available,
    measure_gr) - what a TigerScale keeps current - on its own task, started
    the moment the tag is read. Chip uses what is written on the tag and needs no
    network. With no figure, no SET_WEIGHT is sent and the result screen says so
    in orange; the printer keeps its previous value.
  • Temperatures are the middle of the tag's windows.
  • Brand and full quantity have no field in AFC, and AFC keeps
    initial_weight at 1000 g. When printer.objects.list shows
    save_variables (Klipper's own section, present on OpenCreator), they go
    there and are read back. Without it they are simply not sent.
  • Happy Hare is unchanged: MMU_GATE_MAP takes no weight, and no warning is
    shown for it.

On the device

  • Slot grid: each colour block shows the grams left and is filled from the
    bottom to the percentage. Both are written into the existing widgets, so the
    grid is not rebuilt while a print consumes filament. The brand is shown under
    the slot again.
  • Result screen: the weight that was sent is added to the line under the spool
    ("Longer · 1.75 · 500 g").
  • Reader screen: the remaining weight from the chosen source.
  • If the first account read brings no figure (failed, could not start, or ran
    past its 8 s budget), the send asks once more and waits at most 5 s, with a
    line on the scan screen. A document that has no weight counts as an answer
    and is not asked again.
  • New strings in all eleven languages; the Chinese ones use only glyphs already
    in the compiled faces.
  • New previews: setacct-out, readcloud, readcloud-wait, scanweight,
    scanretry, resultweight, resultgrams.

PrinterBackend gains three defaulted virtuals (setWeightFromCloud,
weightSkipped, sentGrams) and SlotState two fields (grams,
percentKnown); no other backend changes behaviour. moonraker-ws-mock.py
understands the three new commands.

Tested

  • verify.sh: build passes.
  • On a FlashForge Creator 5 Pro with OpenCreator / AFC:
  • Against the mock: the exact script above parsed and stored.
  • Not tested: Happy Hare, a printer without [save_variables], the 5 s retry
    on a real failure.
image image image image

- Introduced new string identifiers for weight-related messages in i18n.
- Added weight tracking logic in main.cpp to handle weight source preferences.
- Updated UI components to display weight information from either the account or chip.
- Enhanced screen_read and screen_scan to show weight status and warnings.
- Modified account settings to allow users to choose weight source.

This branch has not been deployed

No deployments
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