Skip to content

Fix partial status updates breaking state info - #180

Open
Aptimex wants to merge 1 commit into
BambuTools:mainfrom
Aptimex:main
Open

Fix partial status updates breaking state info#180
Aptimex wants to merge 1 commit into
BambuTools:mainfrom
Aptimex:main

Conversation

@Aptimex

@Aptimex Aptimex commented Jul 27, 2026

Copy link
Copy Markdown

Description

After any command that changes AMS state (e.g. set_filament_printer), ams_hub() stops returning AMS data and never recovers on its own. On an A1 the hub becomes unavailable ~2.5s after a write and was still unavailable 30s later. The write itself succeeds, only the library's view of the printer breaks. This is caused by incremental push_status updates (that the printer publishes) being handled like full updates, causing some state data to be lost in the cache.

This PR fixes that by deeply merging most of the info from status updates over the cached data, rather than replacing top-level keys. This is only done for dict objects, so it's not a perfect solution, but is significantly better. Other objects like lists can't be trivially merged correctly and are still just overwritten if a new one is present.

Also added two tests to verify the corrected behavior.

Printer

  • [ X ] A1
  • [ X ] AMS

(probably applies to all printers with an AMS, but only tested on A1+AMS Lite)

Firmware Version

A1 v01.04.00.00
AMS Lite v00.00.07.94

Type of change

  • [ X ] Bug fix (a non-breaking change that resolves an issue)

@Aptimex

Aptimex commented Jul 27, 2026

Copy link
Copy Markdown
Author

Fixes #181

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