Confirm the light and the upload on a real P1P
Four things were shipped unverified because the printer was off when they
were written. Three are now confirmed first-hand (P1P, 2026-10-15), and one
is settled in the opposite direction from what was assumed.
**`set_light` had never once reached a printer**, and `completion::run`
blinks a finished print's chamber light with it. It works - but "accepted" is
not "it changed": `ledctrl` answers `result: "success"` as soon as the
command parses, exactly like the print-control verbs. So `lights_report` is
now modelled on `PrintReport`, which is the only read-back there is, and the
probe polls it rather than printing a reassuring message. Setting the light
on and off reads `[{"node":"chamber_light","mode":"on"}]` / `"off"` back,
about 3s later. The field was observed on v1 even though only the v2 schema
declares it.
**The blink itself works at the rate it ships at.** `completion::celebrate`
is now public so the probe runs the real function instead of a copy: twenty
`ledctrl` commands half a second apart, which a printer is entitled to
refuse. None were refused, it returned after 10.35s, and the light ended
`off` as specified - a blink that leaves the light on would look like a
printer still working.
**The firmware's own `flashing` mode is not the better option.** It is
accepted, and the reply echoes all four parameters back
(`led_on_time`, `led_off_time`, `loop_times`, `interval_time`), so the
printer does parse them. But `lights_report` never reports `flashing` - it
stayed on the previous mode for 12s of polling. A firmware blink is therefore
unobservable: nothing can confirm it happened or tell when it ended, while
the self-driven blink is built from a call that reads back. That is a better
reason to keep `celebrate` than the one in the comment it replaces, which was
that `loop_times` semantics were unconfirmed. Whether the light physically
blinks is still unwitnessed - nobody was watching the machine.
**Multi-MB FTPS upload works, and is slow.** A 4.96 MB project archive went
up with an exact byte count and came back byte-identical (sha256). But it
took 31.3s - about 0.2 MiB/s - so the 62 MB project already on that card
would take six and a half minutes. Anything that uploads a job needs a
timeout budgeted in minutes, not seconds. The claim in `download`'s comment
that these files are "a few hundred KB" is gone; the card disproves it.
Also adds `delete`, because the probe left a 5 MB file on a real SD card and
there was no way to remove it. One explicit path, no globbing: the convenient
version of this deletes something somebody printed from last week. Used to
clean up, and the card is back as it was.
New probe steps: `light on|off|flash`, `blink`, `upload <local> [name]`,
`delete <path>`. 51 tests still pass.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -142,9 +142,15 @@ pub fn download(
|
||||
ftp.transfer_type(FileType::Binary)?;
|
||||
|
||||
// `retr_as_buffer` rather than `retr_as_stream`: suppaftp 12's
|
||||
// `TransferStream` finalizes itself on drop, and the files being read
|
||||
// here are project archives of a few hundred KB, so there is nothing to
|
||||
// gain from streaming them.
|
||||
// `TransferStream` finalizes itself on drop, and a project archive is
|
||||
// read whole anyway - `plate_filaments` needs the central directory at
|
||||
// its end before it can read anything.
|
||||
//
|
||||
// Confirmed fine at 4.96 MB on the P1P (2026-10-15, byte-identical
|
||||
// round trip). The qualifier here used to be "a few hundred KB", which
|
||||
// the card itself disproves - the largest project on it is 62 MB, and
|
||||
// that one would be held in memory twice during a round trip. Streaming
|
||||
// is the answer if that ever matters; it has not yet.
|
||||
let bytes = ftp.retr_as_buffer(path)?.into_inner();
|
||||
|
||||
let _ = ftp.quit();
|
||||
@@ -152,6 +158,38 @@ pub fn download(
|
||||
Ok(bytes)
|
||||
}
|
||||
|
||||
/// Blocking: removes one file from the card.
|
||||
///
|
||||
/// The counterpart to `upload`, and the only reason it did not exist before
|
||||
/// is that nothing had uploaded anything worth removing. It is needed now:
|
||||
/// the P1P's card already holds 45 project archives and 47 extracted
|
||||
/// `cache/` entries, so a gateway that uploads a project per job and never
|
||||
/// removes one is a gateway that eventually fills a customer's SD card and
|
||||
/// starts failing prints for a reason nobody will connect to this code.
|
||||
///
|
||||
/// Deliberately takes one explicit path and does no globbing or recursion:
|
||||
/// the obvious convenience here ("clear the old ones") is also the obvious
|
||||
/// way to delete a file somebody printed from last week.
|
||||
pub fn delete(
|
||||
host: &str,
|
||||
access_code: &str,
|
||||
connector: native_tls::TlsConnector,
|
||||
path: &str,
|
||||
) -> anyhow::Result<()> {
|
||||
let mut ftp = NativeTlsFtpStream::connect_secure_implicit(
|
||||
(host, FTPS_PORT),
|
||||
NativeTlsConnector::from(connector),
|
||||
host,
|
||||
)?;
|
||||
|
||||
ftp.login(FTPS_USER, access_code)?;
|
||||
ftp.rm(path)?;
|
||||
|
||||
let _ = ftp.quit();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Blocking: lists `cache/` on the printer.
|
||||
///
|
||||
/// Read-only, and the counterpart to `upload`. The previous version of this
|
||||
|
||||
Reference in New Issue
Block a user