In development. It changes without notice.
The command line
Every command of kleidos-meter: what it takes, what it exits with and an example. This page is written by scripts/
| Command | Does |
|---|---|
| kleidos-meter | Send program messages to the meter and print each response line. |
| kleidos-meter capture | One capture, recorded to a run directory, with no panel. |
| kleidos-meter serve | Hold the meter's port for the panel, and hand it back as found. |
| kleidos-meter calibrate | The shunt calibration, step by step, with the owner at the bench; it files a registry event. |
| kleidos-meter calibration | The instrument against the calibration registry: verify it, or restore its working copy. |
| kleidos-meter relay-timing | Measure the relays' operate and release times through the shunt (0.13.0). |
| kleidos-meter pins | The instrument's pin map: show it, stage a change, apply it, or put the rig's back. |
What every command shares
- The port is --port, or the environment's KLEIDOS_
METER_ PORT: the device node, or a pyserial URL (socket://127.0.0.1:5025, the passthrough of a running serve). - The port is opened exclusively. One that another program holds is refused at once; serve and capture name the holder when it left a note (“Start it” in the panel's guide).
- --sim takes the simulated instrument instead, with nothing plugged in. It speaks the same protocol and nothing it says is a measurement.
- Status 1 is also an error no command expects, its Python traceback on standard error: a port that does not exist, for one.
- -h, --help prints what the command takes and exits with 0.
An example's output is what the command printed; what a run makes its own (a version, a date, a directory, a count of real time) differs in yours, and [...] stands for lines left out. The examples are run by host/
kleidos-meter
Send program messages to the meter and print each response line.
Each message is one argument, its response one line of standard output: the units, ; between them, after any block they carried. A response is awaited for every message and commands have none, so end each message with ;:SYST:ERR:ALL?, which answers and says whether anything in it was refused. A stream record that comes meanwhile is printed behind a #. The messages are the SCPI command set's, and the usage guide says which to send.
| Argument | Default | What it is |
|---|---|---|
| messages [messages ...] | required | program messages, one per argument |
| --port PORT | KLEIDOS_ | the device node or URL |
| --sim | off | talk to the simulated instrument |
| --timeout TIMEOUT | 8.0 | seconds to wait for each response |
| Status | Says |
|---|---|
| 0 | every message was answered |
| 1 | the port is held elsewhere, the instrument did not answer the readiness check, or a message went unanswered within --timeout |
| 2 | a usage error (no message, or no port and no --sim) |
Example, on the simulator:
A refused message is answered like any other: the status says only that an answer came.
kleidos-meter capture
One capture, recorded to a run directory, with no panel.
The run is a directory of its own, readable by you alone, with what the instrument wrote and a meta.json. The settings the capture changed are written back, and Ctrl-C ends it early and still finishes the run. “Record a capture” in the usage guide says which profile to take and how to export a run.
| Argument | Default | What it is |
|---|---|---|
| --port PORT | KLEIDOS_ | the device node or URL |
| --sim | off | capture from the simulated instrument |
| --profile PROFILE | required | TRACE, STATE, SLEEP or BURST |
| --seconds SECONDS | – | how long (a ring profile may leave it out) |
| --channels CHANNELS | – | CURR,VOLT,POW,TEMP (comma-separated) or DEF; the instrument's own by default |
| --label LABEL | – | a note kept in the run's meta.json |
| --out OUT | – | the data directory ($XDG_ |
| --ready-timeout READY_TIMEOUT | 15.0 | seconds to wait for the instrument to answer (15) |
| Status | Says |
|---|---|
| 0 | the run is complete (every sample the instrument streamed is in it, or the dump holds the whole ring) and the settings were written back |
| 1 | the port is held elsewhere, the instrument does not answer or refuses the capture, the run is incomplete, or the settings could not be written back |
| 2 | a usage error (a data directory inside a git work tree among them) |
Example, on the simulator:
kleidos-meter serve
Hold the meter's port for the panel, and hand it back as found.
It is the port's one opener until it is stopped with Ctrl-C (or SIGTERM), and puts back the settings it changed on the way out. The panel's guide is how the panel is used and the HTTP API's reference what it answers.
| Argument | Default | What it is |
|---|---|---|
| --port PORT | KLEIDOS_ | the device node or URL |
| --sim | off | serve the simulated instrument |
| --sim-wiring PAIRS | Wiring(sda=4, scl=5, alert=6, address=64, relay1=7, relay1_ | where the simulated board's parts are, key=value pairs over the rig's (sda=18,addr=0x41); the rig by default |
| --bind BIND | 127.0.0.1 | the panel's address (127.0.0.1) |
| --http HTTP | 8040 | the panel's port (8040; 0: any) |
| --allow-remote | off | let –bind name an address beyond the loopback (the panel is unauthenticated) |
| --data-dir DATA_DIR | – | where recordings go ($XDG_ |
| --registry REGISTRY | – | the calibration registry (the repository's calibration/) |
| --elf ELF | this checkout's firmware/.pio/ | the build's firmware.elf the instrument's elf= is compared with (the repository's meter build) |
| --scpi-passthrough [PORT] | – | give the line to one SCPI client at a time on 127.0.0.1 (port 5025; 0: any) |
| --ready-timeout READY_TIMEOUT | 15.0 | seconds to wait for the instrument to answer (15) |
| Status | Says |
|---|---|
| 0 | a clean stop |
| 1 | the port is held elsewhere, the panel's or the passthrough's address cannot be bound, the instrument does not answer, or the settings could not be written back |
| 2 | a usage error (a data directory inside a git work tree among them) |
Example, on the simulator:
The last line is what Ctrl-C printed.
kleidos-meter calibrate
The shunt calibration, step by step, with the owner at the bench; it files a registry event.
It asks for each step at the bench, judges the session by the gates of its configuration and files it in the registry, accepted or refused. Nothing is committed. The calibration guide is the procedure: read it first. Without --registry the session is filed in this checkout, so a rehearsal names a copy.
| Argument | Default | What it is |
|---|---|---|
| --port PORT | KLEIDOS_ | the device node or URL |
| --sim | off | calibrate the simulated instrument |
| --registry REGISTRY | this checkout's calibration/ | the calibration/ directory |
| --configuration CONFIGURATION | – | the configuration of an instrument's first calibration |
| --reference {vpg-y0785-100r} | vpg-y0785-100r | the reference resistor fitted |
| --reference-ohm REFERENCE_OHM | – | another reference: its value |
| --reference-tolerance-ppm REFERENCE_ | – | another reference: its tolerance |
| --reference-tcr REFERENCE_TCR | – | another reference: its TCR, ppm/°C |
| --yes | off | answer every prompt (simulator, tests) |
| --null-seconds NULL_SECONDS | 60 | how long each null is |
| --samples SAMPLES | 600 | the samples of one point |
| Status | Says |
|---|---|
| 0 | the session was accepted and filed |
| 1 | it could not start, or the registry's check found problems with what it filed; or an error ended it, its traceback on stderr: the port is held elsewhere, the instrument did not answer or refused a step |
| 2 | a gate failed: the session was filed as refused and no working copy was written; or a usage error |
Example, on the simulator:
The simulator takes no time over the nulls, and what it measures is its own.
kleidos-meter calibration
The instrument against the calibration registry: verify it, or restore its working copy.
The registry is the calibration and the instrument holds a working copy of it, which a full erase loses. verify compares the two and changes neither; restore writes the registry's copy and verifies it. Run verify before the first number of a session (the usage guide); what each verdict means is in the calibration guide.
| Argument | Default | What it is |
|---|---|---|
| {verify,restore} | required | compare the instrument with the registry, or write it the registry's copy |
| --port PORT | KLEIDOS_ | the device node or URL |
| --sim | off | talk to the simulated instrument |
| --registry REGISTRY | this checkout's calibration/ | the calibration/ directory |
| --rev REV | – | read the registry at this git revision (git show) |
| --date DATE | – | as of this day (today) |
| --json | off | print the verdict as JSON (verify) |
| --yes | off | answer the confirmation (restore) |
| Status | Says |
|---|---|
| 0 | the instrument holds the registry's working copy (applied) |
| 1 | an error ended the run, its traceback or its message on stderr: the port is held elsewhere, the instrument did not answer or refused the copy, or --rev holds no index |
| 2 | a usage error (a KLEIDOS_ |
| 3 | it does not: the verdict says why |
Example, on the simulator:
The registry is the one calibrate filed above; each command starts a simulated instrument with nothing stored, so verify exits with 3.
kleidos-meter relay-timing
Measure the relays' operate and release times through the shunt (0.13.0).
It moves the relay under a TRACE capture and finds each step in the ring. k1 takes the DUT off its battery for --hold ms a move, so the DUT needs another supply or must stand it. What the rig's contacts measured is the relay timings.
| Argument | Default | What it is |
|---|---|---|
| --port PORT | KLEIDOS_ | the device node or URL |
| --sim | off | talk to the simulated instrument |
| --relay {k1,k2} | required | k1, the lead, or k2, the bypass; may be given again |
| --repeats REPEATS | 5 | moves per relay, 1 to 8 |
| --hold HOLD | 300 | ms between the two orders |
| --json | off | print every edge as JSON |
| Status | Says |
|---|---|
| 0 | every move was measured and the rig is back at rest |
| 1 | an error ended the run, its traceback on stderr: the port is held elsewhere, the instrument did not answer or refused an order, or the dump arrived damaged |
| 2 | a usage error |
Example, on the simulator:
The simulated DUT draws the same whatever the contact does, so its ring holds no step and these figures mean nothing; on the bench a delay is positive.
kleidos-meter pins
The instrument's pin map: show it, stage a change, apply it, or put the rig's back.
The pin map is which GPIO each of the instrument's five roles takes (the INA228's SDA, SCL and ALERT, Relay 1 and Relay 2), how each is pulled or driven, the INA228's address and the bus clock at boot (“The pin map” in the SCPI command set). show prints it; set stages a change on the instrument and prints the rules' verdict; apply stages the changes it is given and applies the staged map, which the instrument keeps only once the INA228 answers on it and puts back otherwise; defaults applies the rig's map and needs no INA228. With --sim, --sim-wiring says where the simulated board's parts are, so a map that is not the board's is reverted as the instrument would.
| Argument | Default | What it is |
|---|---|---|
| {show,set,apply,defaults} | required | print the map, stage a change, stage and apply it, or apply the rig's map |
| [KEY=VALUE ...] | – | the changes to stage (set, apply): sda=18, relay1_ |
| --port PORT | KLEIDOS_ | the device node or URL |
| --sim | off | talk to the simulated instrument |
| --sim-wiring PAIRS | Wiring(sda=4, scl=5, alert=6, address=64, relay1=7, relay1_ | where the simulated board's parts are, key=value pairs over the rig's (sda=18,addr=0x41); the rig by default |
| --pending | off | show the staged map (show) |
| Status | Says |
|---|---|
| 0 | the map was shown, staged valid, or applied and proved |
| 1 | the port is held elsewhere or the instrument did not answer |
| 2 | a usage error (a change that does not read, no port and no --sim) |
| 3 | the instrument refused the change or put the last good map back: what it said is on stderr |
Example, on the simulator:
Each command starts a simulated instrument with the rig's map: the second finds no INA228 on GPIO18 and keeps the rig's, the third is told the board has it there.