Use --nosave and --output to get the value needed to reflash the device.
Signed-off-by: Keith Packard <keithp@keithp.com>
-SERIAL=$SERIAL ./cal-freq $dev
+CALFILE=cal-$SERIAL.txt
+
+../ao-tools/ao-cal-freq/ao-cal-freq --verbose --nosave --output=$CALFILE --tty=$dev
-CAL_VALUE=`grep "^$SERIAL," cal_values | tail -1 | sed 's/^[^,]*,//'`
+CAL_VALUE=`cat $CALFILE`
case "$CAL_VALUE" in
[1-9]*)
case "$CAL_VALUE" in
[1-9]*)
+echo $SERIAL","$CAL_VALUE >> cal_values
+
echo "Reflashing with calibration: $CAL_VALUE"
$USBLOAD --cal=$CAL_VALUE --tty=$dev $ALTOS || exit 1
echo "Reflashing with calibration: $CAL_VALUE"
$USBLOAD --cal=$CAL_VALUE --tty=$dev $ALTOS || exit 1