Skip to main content

Module watch

Module watch 

Source
Expand description

The drivers of the printer watch.

Core decides what a read of the machine means and writes it down (Supervisor::watch_printer, Supervisor::note_push, Supervisor::check_detector); this is what asks it to, and what holds the two things core may not: the printer’s push channel, and the one command the watch sends.

  • The reads, once per CoreConfig::printer_poll, whether or not a print is active, each turn they claimed run as an observation’s is.
  • The push reader, which opens the printer’s push channel, hands each reset and error to core as it arrives and keeps each terminal line for the position probe — and, when the channel drops or cannot be opened, tells core it is down and opens it again after REOPEN_AFTER.
  • The position probe, which core asks only once a read has found no job running: it sends PrinterCommand::ReportPosition and reads the reply off the push channel’s terminal lines, waiting up to POSITION_WAIT. With the channel down it sends nothing and answers no position.
  • The detector check, as the server starts and then once per observation interval, when obico.ml_api_url is configured: the detector’s status is one a status read made the moment the server is up answers from a check, rather than unchecked for a whole interval.
  • The sweep of the alignment records of every print that closed, after each read (crate::alignment). The alignment itself is judged on each check’s own frame, never on a frame fetched here.

send_command is called here and nowhere else in this program: no operation, agent or client can reach it.

Every core call is made on a blocking thread, as the observation driver makes its own, because the ports’ futures block the thread that polls them.

Structs§

Watching
The printer watch’s tasks, aborted together and when dropped.

Constants§

POSITION_WAIT
How long the position probe waits for the reply to its command.
REOPEN_AFTER
How long after the push channel drops, or refuses to open, it is opened again.

Functions§

start
Start the printer watch: its reads, its push reader and, when a detector check is given, that check.