#!/bin/sh

SERIALDEVICE=/dev/ttyACM0

if [ ! -e "$SERIALDEVICE" ]; then
  echo "$0: device $SERIALDEVICE not found"
  exit 1
fi

if [ ! -w "$SERIALDEVICE" ]; then
  echo "$0: device $SERIALDEVICE not writable"
  exit 1
fi

# configure serial port
stty -F "$SERIALDEVICE" raw pass8 -echo -crtscts -cstopb

echo "D0: set digital delay line to 78 (0x4E)"
echo -en "D0:004E\n\0" > "$SERIALDEVICE"

echo "I0: set on-board switch position to 7"
echo -en "I0:0007\n\0" > "$SERIALDEVICE"

echo "K0: disable CAL-FO"
echo -en "K0:0000\n\0" > "$SERIALDEVICE"

echo "M0: disable reverse function algorithm"
echo -en "M0:0000\n\0" > "$SERIALDEVICE"

echo "T0: set average number of points to 1"
echo -en "T0:0001\n\0" > "$SERIALDEVICE"
