Expand description
tag-cal: put an IDLE tag in sensor-calibration mode and stream its raw
samples until Ctrl-C.
Port of host/commandline/tag-calibrate.cc (built as tag-cal). Syncs
the clock, starts calibration, then repeatedly fetches the calibration
log and prints each sample as Raw:ax,ay,az,0,0,0,mx,my,mz (CRLF line
ends), the format calibration front ends read. Ctrl-C ends the stream and
the tag is stopped.
Exits 0 after streaming; 1 if the tag is not IDLE, or the attach, the first status read, the clock sync, the calibrate request or the final stop fails.
Usage: tag-cal [-d] [-b BUS:DEVICE]. The clap command name is
tag-calibrate, the C++ name, so help and errors print that.
§Hardware side effects
The attach resets the tag; SetRtc sets its clock from the host;
Calibrate moves it into calibration mode, and Stop takes it out on
the way out. The Ctrl-C handler is installed only after the attach, so a
Ctrl-C during the attach kills the process; one after it, even before the
stream starts, still ends with the stop. A tag left in calibration mode
(a killed process or a failed stop) must be stopped with tag-stop. A
tag family without a calibration mode refuses (BitTag, for example).
Structs§
- Cli 🔒
- starts calibration mode
Statics§
- EXECUTE 🔒
- Cleared by Ctrl-C to end the sample stream.
Functions§
- fail 🔒
- Prints
messageto stderr and returns exit status 1. - main 🔒
- Attaches, checks the tag is IDLE, syncs its clock, starts calibration, streams until Ctrl-C and stops the tag.
- stream_
samples 🔒 - Streams the calibration log until Ctrl-C or a failed fetch, printing one
Raw:line per sample. The firmware buffers samples between requests, so requests are 100 ms apart, qtcalibrate’s streaming interval. Floats print with two decimals, as the C++ setsstd::fixedwith precision 2; a missing sensor prints as zeros.