Confirm the print path on a real P1P, and stop discarding its answer
Print control (pause/resume/stop) and print start are now both confirmed
against the P1P on the LAN, and doing that turned up three real defects.
`start_uploaded_file` published fire-and-forget, so the printer's reply was
thrown away. Asking it to print a file it does not have returned `Ok(())`,
and watching `print.push_status` could not tell that apart from a successful
start, since both leave the machine IDLE for a while. The printer does in
fact answer - `{"command":"gcode_file","param":"...","reason":"error
string","result":"fail"}` - and it echoes the `sequence_id` we send, so
`request` correlates it. Both this and `control_print` now go out as
correlated requests and run the reply through `print_command_outcome`.
The upload and the print command disagreed about where files live. `upload`
cwd'd into `cache/` while the printable projects are in the card's root: the
root holds 43 `<name>.gcode.3mf` archives, `cache/` holds the printer's own
extracted `<project>_plate_N.gcode` working copies with `.gcode.bbl`
sidecars. Those extracted copies are not independently printable -
`gcode_file` with `param: "/cache/Cube_plate_1.gcode"` was rejected for a
file the FTPS listing shows is right there - while `project_file` with
`url: "ftp:///Cube.gcode.3mf"` started a print. So the destination is now a
parameter and both halves point at `SD_ROOT`.
What the hardware settled, recorded in the doc comments: the `ftp:///` url
spelling is right, `param: "Metadata/plate_1.gcode"` works for a
single-plate project, `use_ams: false` + `ams_mapping: ""` is accepted, and
a stop during PREPARE/RUNNING moves the printer to FAILED, which is how
Bambu reports an operator cancellation. What it did not settle: all three
control verbs answer `result: "success"` on an *idle* printer, so the reply
means "accepted", not "the state changed" - callers still have to read
`gcode_state` back.
`PrinterCommand::ControlPrint` makes this reachable from the cloud at all;
until now pause/resume/stop existed in the proxy with no way to send them.
Still no start-print variant, now for a different reason: the path around it
is missing, not the hardware proof.
Also: `list_dir` for any directory (how the layout above was found, without
sending a print command to guess), `request_raw` for probing an unconfirmed
command shape, and two examples - `bambu_cache_list` (read-only) and
`bambu_print_probe` (gated steps, `start` needing both IDLE and
--yes-start-a-real-print).
This commit is contained in:
@@ -224,5 +224,8 @@ async fn dispatch(fleet: &SharedFleet, printer_id: &str, command: PrinterCommand
|
||||
PrinterCommand::SendGcodeLine { line } => {
|
||||
printer.send_gcode_line(line).await.map_err(|err| err.to_string())
|
||||
}
|
||||
PrinterCommand::ControlPrint { control } => {
|
||||
printer.control_print(control).await.map_err(|err| err.to_string())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+19
-4
@@ -1,5 +1,7 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::printer::PrintControl;
|
||||
|
||||
/// What this gateway sends up to `continuum-backend`'s `/ws/edge/v1` route.
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[serde(tag = "type", rename_all = "snake_case")]
|
||||
@@ -105,10 +107,12 @@ pub enum ServerMessage {
|
||||
/// The closed set of things the cloud is allowed to ask a printer to do.
|
||||
///
|
||||
/// Deliberately small, and deliberately missing the obvious one: there is no
|
||||
/// "start a print" variant. `BambuPrinter::start_uploaded_file` exists but
|
||||
/// has never been run against real hardware, and the first thing to exercise
|
||||
/// it should be a human watching the machine - not a message arriving from
|
||||
/// the internet. Add it here once it's been confirmed by hand.
|
||||
/// "start a print" variant. `BambuPrinter::start_uploaded_file` has now been
|
||||
/// confirmed by hand on a real P1P (2026-10-11), so the original reason for
|
||||
/// leaving it out - never having been run against hardware - is spent. What
|
||||
/// is still missing is the path around it: nothing uploads a sliced file to a
|
||||
/// gateway, and nothing decides which printer should run which job. A start
|
||||
/// variant belongs here once there is something to start.
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
#[serde(tag = "action", rename_all = "snake_case")]
|
||||
pub enum PrinterCommand {
|
||||
@@ -118,4 +122,15 @@ pub enum PrinterCommand {
|
||||
/// A single raw gcode line. The most powerful variant by far, and the
|
||||
/// one to be most careful about ever exposing to a UI.
|
||||
SendGcodeLine { line: String },
|
||||
/// Pause, resume or stop whatever the printer is currently running.
|
||||
///
|
||||
/// One variant carrying an action rather than three variants, matching
|
||||
/// `PrintControl` and `GenericPrinter::control_print` - the alternative
|
||||
/// was three near-identical arms here and three near-identical methods
|
||||
/// across four vendor implementations.
|
||||
///
|
||||
/// `Stop` is a cancel and is not undoable. Confirmed live on a P1P: a
|
||||
/// stop during `PREPARE`/`RUNNING` moves the printer to `FAILED`, which
|
||||
/// is how Bambu reports an operator-cancelled print.
|
||||
ControlPrint { control: PrintControl },
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user