feat(drying): show active-cycle filament + target temperature on the AMS drying badge

Bambu's per-tick AMS push carries only the dry_time countdown — the
  filament name and target temperature the user chose are never echoed on
  the wire. The AMS card had no source of truth for them and rendered the
  bare "Drying · 11h 35m left". The badge now shows
  "Drying · PETG @ 65°C · 11h 35m left", matching the cycle the user
  actually started.

  BambuMQTTClient caches {ams_id: {filament, temp}} on send_drying_command
  (mode=1), clears on mode=0 and on the dry_time falling edge to 0 — the
  same per-AMS edge detector that drives the smart-plug-after-drying
  callback. PrinterManager.get_drying_targets exposes it, the four
  printer_state_to_dict call sites thread it through, AMS schema gains
  dry_target_temp + dry_filament, and routes/printers.py builds the same
  fields into the manually-constructed AMSUnit response.

  When no cached target exists (drying started in a previous backend
  lifetime, or initiated outside Bambuddy), the badge falls back to the
  first loaded tray's tray_type + RFID-recommended drying_temp — the
  heuristic the popover already uses to seed defaults.

  i18n: printers.drying.targetSummary = "{{filament}} @ {{temp}}°C" in
  all 11 locales. Parity check 5356 leaves per locale.

  Note: a user reported the H2D's own physical display still labels the
  cycle by the loaded tray's filament (e.g. "PLA" instead of the
  Bambuddy-requested "PETG"). The wire payload is correct end-to-end —
  journalctl shows filament: "PETG" sent and result: success ACKed — and
  the badge in Bambuddy's own UI now reflects what we actually sent,
  independent of the firmware's display choice.
This commit is contained in:
maziggy
2026-06-25 13:27:32 +02:00
parent 8d6f701f1d
commit fd61812d01
25 changed files with 337 additions and 53 deletions
+10
View File
@@ -168,6 +168,7 @@ const DE_COGNATES = [
'Avery 5160 — US Letter sheet (25.4 × 66.7 mm × 30)',
'China', 'Proxy', 'Start',
'Diagnose', // DE: same spelling/meaning as EN — camera diagnostic button label
'{{filament}} @ {{temp}}°C', // drying badge: filament code + universal °C
];
// French cognates — many UI labels overlap with English exactly.
@@ -207,6 +208,7 @@ const FR_COGNATES = [
'EC984C,#6CD4BC,A66EB9,D87694',
'Proxy', 'Navigation', 'Budget', 'Commit', 'Designer',
'ntfy, Pushover, Discord, etc.',
'{{filament}} @ {{temp}}°C', // drying badge: filament code + universal °C
];
// Italian cognates.
@@ -235,6 +237,7 @@ const IT_COGNATES = [
'Hex: #{{hex}}',
'EC984C,#6CD4BC,A66EB9,D87694',
'Proxy', 'Designer',
'{{filament}} @ {{temp}}°C', // drying badge: filament code + universal °C
];
// Japanese: very few cognates because of script difference. Almost
@@ -248,6 +251,7 @@ const JA_COGNATES = [
'Avery L7160 — A4 sheet (38.1 × 63.5 mm × 21)',
'Avery 5160 — US Letter sheet (25.4 × 66.7 mm × 30)',
'EC984C,#6CD4BC,A66EB9,D87694',
'{{filament}} @ {{temp}}°C', // drying badge: filament code + universal °C
];
// Portuguese (BR) cognates.
@@ -276,6 +280,7 @@ const PT_BR_COGNATES = [
'Expand dispatch details', 'Collapse dispatch details',
'e.g., Home Assistant, OctoPrint', 'ntfy, Pushover, Discord, etc.',
'Proxy', 'total: {{minutes}} min',
'{{filament}} @ {{temp}}°C', // drying badge: filament code + universal °C
];
// Chinese (Simplified): very few cognates beyond brand names.
@@ -287,6 +292,7 @@ const ZH_CN_COGNATES = [
'Avery L7160 — A4 sheet (38.1 × 63.5 mm × 21)',
'Avery 5160 — US Letter sheet (25.4 × 66.7 mm × 30)',
'EC984C,#6CD4BC,A66EB9,D87694',
'{{filament}} @ {{temp}}°C', // drying badge: filament code + universal °C
];
const ZH_TW_COGNATES = [
@@ -297,6 +303,7 @@ const ZH_TW_COGNATES = [
'Avery L7160 — A4 sheet (38.1 × 63.5 mm × 21)',
'Avery 5160 — US Letter sheet (25.4 × 66.7 mm × 30)',
'EC984C,#6CD4BC,A66EB9,D87694',
'{{filament}} @ {{temp}}°C', // drying badge: filament code + universal °C
];
// Korean: script difference means almost nothing is identical.
@@ -316,6 +323,7 @@ const KO_COGNATES = [
'{{printer}}: {{error}}', // pure placeholders
'{{name}} — {{stage}} ({{percent}}%) — {{elapsed}}', // pure placeholders
'Obico ML API URL', // product name (Obico)
'{{filament}} @ {{temp}}°C', // drying badge format
];
// Spanish cognates — words/phrases that are genuinely identical in Spanish.
@@ -334,6 +342,7 @@ const ES_COGNATES = [
'Box label (62 × 29 mm)',
'Avery L7160 — A4 sheet (38.1 × 63.5 mm × 21)',
'Avery 5160 — US Letter sheet (25.4 × 66.7 mm × 30)',
'{{filament}} @ {{temp}}°C', // drying badge: filament code + universal °C
];
// Turkish cognates — technical UI labels that Turkish speakers use verbatim
@@ -349,6 +358,7 @@ const TR_COGNATES = [
'{{count}} filament', '{{printer}}: {{error}}', '{{weight}}g',
'Filament {{index}} ({{type}})',
'EC984C,#6CD4BC,A66EB9,D87694',
'{{filament}} @ {{temp}}°C', // drying badge: filament code + universal °C
];
const IDENTICAL_TO_EN_ALLOWED = {