LilyGo-LoRa-Series/examples/run_calibration.sh

19 lines
630 B
Bash
Executable file

#!/usr/bin/bash
#
# for capturing magnet readings during calibration and then
# buildling 3D model
#
CURRENT_UNIT=${CURRENT_UNIT}
LOG=~/work/tbeam/${CURRENT_UNIT}_calibration_$(date +%Y%m%d_%H%M%S).log
echo "Logging to: $LOG"
pio run -e T_BEAM_S3_SUPREME_SX1262 -t upload --upload-port /dev/ttyt${CURRENT_UNIT} && \
pio device monitor -b 115200 -p /dev/ttyt${CURRENT_UNIT} | \
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"