diff options
author | Ben V. Brown <[email protected]> | 2017-08-30 21:42:01 +1000 |
---|---|---|
committer | Ben V. Brown <[email protected]> | 2017-09-12 12:59:06 +1000 |
commit | 347968e4ef601b810a2c65d3d106b756f2e9a98e (patch) | |
tree | 89ade8f32aa91652e990f5d5ececd9b4740d994e /Flashing | |
parent | a766d1d779e805f24d90427f71c6a6fa82dc394f (diff) | |
download | IronOS-347968e4ef601b810a2c65d3d106b756f2e9a98e.tar.gz IronOS-347968e4ef601b810a2c65d3d106b756f2e9a98e.zip |
Fillout settings functions
Settings menu works
Movement working & TMP calibrated
Tip reading sensibily
Accuracy seems ok
Trimmed down overshoot by biasing integral
Saving to flash working, detailed idle
Sleep mode
Description scrolls
Building for DFU working
Motion detection update
Use manual alg instead, using highpass filter, then sum current change vs rolling average
Re-shuffle the pwm code organisation
Diffstat (limited to 'Flashing')
-rw-r--r-- | Flashing/flash_ts100_linux.sh | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/Flashing/flash_ts100_linux.sh b/Flashing/flash_ts100_linux.sh new file mode 100644 index 00000000..5fac37ba --- /dev/null +++ b/Flashing/flash_ts100_linux.sh @@ -0,0 +1,130 @@ +#!/bin/bash +# TS100 Flasher for Linux by Alex Wigen (https://github.com/awigen) + +DIR_TMP="/tmp/ts100" + +function usage() { + echo + echo "#################" + echo "# TS100 Flasher #" + echo "#################" + echo + echo " Usage: $0 <HEXFILE>" + echo + echo "This script has been tested to work on Fedora." + echo "If you experience any issues please open a ticket at:" + echo "https://github.com/Ralim/ts100/issues/new" + echo +} + +GAUTOMOUNT=0 +function disable_gautomount { + GSETTINGS=`which gsettings` + if [ $? -ne 0 ]; then + return 1 + fi + gsettings get org.gnome.desktop.media-handling automount | grep true > /dev/null + if [ $? -eq 0 ]; then + GAUTOMOUNT=1 + gsettings set org.gnome.desktop.media-handling automount false + fi +} + +function enable_gautomount { + if [ "$GAUTOMOUNT" -ne 0 ]; then + gsettings set org.gnome.desktop.media-handling automount true + fi +} + +function is_attached { + output=`lsblk -b --raw --output NAME,MODEL | grep 'DFU\\\\x20Disk'` + if [ $? -ne 0 ]; then + return 1 + fi + DEVICE=`echo $output | awk '{print "/dev/"$1}'` +} + +instructions="not printed" +function wait_for_ts100 { + is_attached + while [ $? -ne 0 ]; do + if [ "$instructions" = "not printed" ]; then + echo + echo "#####################################################" + echo "# Waiting for TS100 config disk device to appear #" + echo "# #" + echo "# Connect the soldering iron with a USB cable while #" + echo "# holding the button closest to the tip pressed #" + echo "#####################################################" + echo + instructions="printed" + fi + sleep 0.1 + is_attached + done +} + +function mount_ts100 { + mkdir -p "$DIR_TMP" + sudo mount -t msdos -o uid=$UID "$DEVICE" "$DIR_TMP" + if [ $? -ne 0 ]; then + echo "Failed to mount $DEVICE on $DIR_TMP" + exit 1 + fi +} + +function umount_ts100 { + mountpoint "$DIR_TMP" > /dev/null && sudo umount "$DIR_TMP" + if [ $? -ne 0 ]; then + echo "Failed to unmount $DIR_TMP" + exit 1 + fi + rmdir "$DIR_TMP" +} + +function cleanup { + enable_gautomount + if [ -d "$DIR_TMP" ]; then + umount_ts100 + fi +} +trap cleanup EXIT + +if [ "$#" -ne 1 ]; then + echo "Please provide a HEX file to flash" + usage + exit 1 +fi + +if [ ! -f "$1" ]; then + echo "'$1' is not a regular file, please provide a HEX file to flash" + usage + exit 1 +fi + +if [ `head -c1 "$1"` != ":" ] || [ `tail -n1 "$1" | head -c1` != ":" ]; then + echo "'$1' doesn't look like a valid HEX file. Please provide a HEX file to flash" + usage + exit 1 +fi + +disable_gautomount + +wait_for_ts100 +echo "Found TS100 config disk device on $DEVICE" + +mount_ts100 +echo "Mounted config disk drive, flashing..." +cp -v "$1" "$DIR_TMP/ts100.hex" +sync + +echo "Waiting for TS100 to flash" +sleep 5 + +echo "Remounting config disk drive" +umount_ts100 +wait_for_ts100 +mount_ts100 + +echo "Flash result: " +ls "$DIR_TMP"/ts100* |