#!/usr/bin/bash # # for capturing magnet readings during calibration and then # buildling 3D model # LOG=~/work/tbeam/ED_TEST_after_calibration_$(date +%Y%m%d_%H%M%S).log echo "Logging to: $LOG" pio device monitor -b 115200 -p /dev/ttytED | \ perl -MTime::HiRes=time -ne ' BEGIN { $t0 = time() } $elapsed = time() - $t0; $mm = int($elapsed / 60); $ss = int($elapsed % 60); $ms = int(($elapsed - int($elapsed)) * 1000); printf "%6d %02d:%02d.%03d %s", $. , $mm, $ss, $ms, $_; ' | tee "$LOG"