Fetch PA calibration (K-factor) history right after connecting to the printer - #11518
Fetch PA calibration (K-factor) history right after connecting to the printer#11518ClusterM wants to merge 1 commit into
Conversation
Signed-off-by: Alexey Cluster <cluster@cluster.wtf>
|
Hi! @ClusterM We have fixed this issue in the latest version. Please try using the latest version. |
|
Hi! @ClusterM we were triggering the update check based on AMS data pushes; once the device connected, an AMS data packet would arrive, which we used to initiate the PA data request. The reason it wasn't triggering correctly was due to a bug in is_security_control_ready, which we have already fixed in the latest version. |
Yes, seems like it's fixed. Thank you! |
Summary
The PA calibration table (per-filament K-factor / pressure advance, shown as
K 0.035on the Device tab) was only requested from the printer when the user opened the
Calibration tab. As a result, opening Device first showed empty K values, and they
only appeared after visiting Calibration and switching back.
This PR makes the client request the PA calibration history automatically as soon as the
printer reports a (new) calibration version — i.e. right after connecting and the first
pushall— so the K-factor is populated regardless of which tab is opened first.Root cause
The K-factor data is not part of the regular push status; it has to be requested explicitly
via the
extrusion_cali_getcommand. Only two places triggered that request:PressureAdvanceWizard::update()requests onIsVersionExpired()with no extra gating, so it always worked.
StatusPanel::update_ams()requested only whenIsVersionExpired() && is_security_control_ready(), and only while the Status sub-page wasvisible.
The extra
is_security_control_ready()gate (device certificate readiness) frequentlyprevented the request on the Device tab, so the data appeared only after the Calibration tab
issued the (ungated) request.
Change
Move the request into the model layer. In
MachineObject::parse_json, right after thecalibration version is parsed (
DevCalib::ParseCalibVersion), trigger a PA history requestwhen the version is initialized, expired, and no request is already in flight:
Design notes:
IsVersionExpired()mechanism: the requestfires on the first reported version and re-fires only when the printer announces a new
calibration version.
SyncCalibVersion()is called synchronously so subsequent pushmessages arriving before the deferred call runs do not enqueue duplicate requests; the
REQUEST/WAITINGstatus check adds a second guard.is_security_control_ready()gate, matching the working Calibration-tab path — thisis what fixes the "empty on Device" behavior.
CallAfterdispatches the command on the GUI thread, consistent with the existingcommand_request_push_all/command_get_versioncalls in the sameparse_json.Display code (
AMSLib::render_generic_text→CalibUtils::get_pa_k_n_value_by_cali_idxoverGetPAHistory()) is unchanged; it already worked once the data was present.Test plan
K-factor values (
K x.xxx) are shown for calibrated filament slots.K values (calibration version change triggers a refresh).
extrusion_cali_gettraffic (request is sent once per version, noton every push).