mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-22 03:49:18 +02:00
fix(jog): send the nozzle-bed gap the API promises on every model (issue #1334)
POST /printers/{id}/bed-jog takes a signed nozzle-bed gap, documented since it
was written: positive asks for more room between the nozzle and the plate. On
an A1 it did the opposite. The reporter sent distance=5 for clearance and
watched the toolhead come down.
The sign had been flipped on A1 models since the original report on this issue,
where an A1 Mini owner clicked an arrow labelled "move the plate up" and watched
the nozzle dive. That is a labelling problem -- a bed-slinger's plate does not
move in Z at all, so closing the gap shows up as the toolhead descending -- and
it was solved in the transport layer, which turned a parameter documented as
model-independent into one that meant the opposite thing on part of the fleet.
Z is the nozzle-to-bed distance on every Bambu model, by definition of the
coordinate system rather than by convention: G1 Z+ opens the gap whether the bed
drops away from a fixed nozzle (X1/P1/H2, whose end G-code parks with
G1 Z{max_layer_z + 100}) or the nozzle rises off a fixed bed (A1/A2L). The
finish-photo plate restore already relies on exactly that and carries no model
branch. So distance goes onto the wire unchanged and one call means one physical
outcome everywhere: positive is the safe direction on every printer.
Which way an arrow points is a different question, about the machine in front of
the user rather than about G-code, so the printer card answers it and asks for
the gap it wants. The buttons move what you would expect them to move, exactly
as before; on a bed-slinger they now say toolhead rather than plate.
The A2L never had the old fix. It slings its bed the same way the A1 does, but
the inversion listed the A1 names and the A2L was not among them, so its up
arrow has been sending the toolhead at the plate for as long as the machine has
been supported. The new classifier also covers the alternate internal codes
A04 / A11 / A12, which LINEAR_RAIL_MODELS and SINGLE_NOZZLE_FLOW_MODELS both
carry and the old gate did not.
is_bed_slinger is gone from the backend rather than widened: with the route
model-independent it had no caller, and a kinematics helper sitting unused in
the service layer invites the next person to assume the backend handles
direction. It does not, deliberately.
Separately, the soft-endstop comments on both jog routes claimed the firmware
clamps a bare move at the travel limit. It does not, and #2579 measured that:
an H2D at its Z limit ran straight past a clean G91/G1 Z-1.00/G90, while its own
touchscreen refuses the identical move. What #2579 removed was M211 S0, which
disabled the limits globally and took the touchscreen's protection with them.
The jog popover has warned about this correctly the whole time; only the code
comments disagreed with it.
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Which part of the printer the Z axis actually moves.
|
||||
*
|
||||
* This is a question about the machine standing in front of the user, not
|
||||
* about G-code. `G1 Z+` opens the nozzle-bed gap on every Bambu model — that
|
||||
* is what the axis means — so nothing on the wire depends on the answer, and
|
||||
* `POST /printers/{id}/bed-jog` takes a signed gap that means one physical
|
||||
* thing everywhere (see its docstring for the #1334 history).
|
||||
*
|
||||
* The answer is needed anyway, because a jog button carries an arrow, and an
|
||||
* arrow promises the user a direction of *motion*. On an X1 / P1 / H2 the
|
||||
* plate itself rides the Z axis, so "up" is the plate climbing toward the
|
||||
* nozzle and the gap closing. On the A1 family and the A2L the plate only
|
||||
* moves in Y; Z carries the toolhead, so "up" is the toolhead lifting off the
|
||||
* plate and the gap opening. Same arrow, opposite gap.
|
||||
*
|
||||
* The model list mirrors the A-series entries in the backend registries
|
||||
* (`LINEAR_RAIL_MODELS` / `SINGLE_NOZZLE_FLOW_MODELS` in
|
||||
* `backend/app/utils/printer_models.py`, and `PRINTER_MODEL_ID_MAP` for the
|
||||
* codes). A new bed-slinger has to be added here too.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Models whose Z axis carries the toolhead, normalised (upper-case, letters
|
||||
* and digits only) so display names, internal MQTT/SSDP codes and Bambu's
|
||||
* terser cloud renames all land on the same entry.
|
||||
*
|
||||
* Kept as an explicit list rather than a prefix match: "A2L" and "A1" share a
|
||||
* letter with nothing else today, but "A" would sweep in whatever the next
|
||||
* A-series machine turns out to be, and the wrong answer here points an arrow
|
||||
* at someone's plate.
|
||||
*/
|
||||
const BED_SLINGER_MODELS: ReadonlySet<string> = new Set([
|
||||
// Display names
|
||||
'A1',
|
||||
'A1MINI',
|
||||
'A2L',
|
||||
// Bambu cloud short code for the A1 Mini (#1649)
|
||||
'A1M',
|
||||
// Internal MQTT / SSDP codes
|
||||
'N1', // A1 Mini
|
||||
'N2S', // A1
|
||||
'N9', // A2L
|
||||
'A04', // A1 Mini (alternate)
|
||||
'A11', // A1
|
||||
'A12', // A1 Mini
|
||||
]);
|
||||
|
||||
/** True when this printer's Z axis moves the toolhead rather than the plate. */
|
||||
export function isBedSlinger(model: string | null | undefined): boolean {
|
||||
if (!model) return false;
|
||||
return BED_SLINGER_MODELS.has(model.toUpperCase().replace(/[^A-Z0-9]/g, ''));
|
||||
}
|
||||
Reference in New Issue
Block a user