Utils: Introduce utils and animation helpers
The next commit implements the LCD and animation support. To enable an easy way to create animations for it, add details in the README regarding the way the SD card is used and how the files need to be formatted. Create the Utils directory and add a Rust project to do the bit flipping and a script that automates all the steps described in the README. Add a README for Utils explaining how to use them.
This commit is contained in:
parent
7d3d109a3a
commit
92a186f752
8 changed files with 274 additions and 0 deletions
52
Utils/convertAnimGif.sh
Executable file
52
Utils/convertAnimGif.sh
Executable file
|
@ -0,0 +1,52 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [[ $# -eq 0 ]]; then
|
||||
echo "This script expects the name of the files to convert as arguments"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! $(command -v convert) ]]; then
|
||||
echo "Could not find 'convert' utility, cannot proceed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get the absolute path to the source of the script
|
||||
scriptSrcDir="$(dirname -- "$0")"
|
||||
pushd "$scriptSrcDir"
|
||||
scriptSrcDir="$(pwd)"
|
||||
popd
|
||||
|
||||
if [[ $(command -v bitmap_helper) ]]; then
|
||||
bmp_help="$(command -v bitmap_helper)"
|
||||
elif [[ $(command -v "$scriptSrcDir"/bitmap_helper/target/debug/bitmap_helper) ]]; then
|
||||
bmp_help="$scriptSrcDir"/bitmap_helper/target/debug/bitmap_helper
|
||||
elif [[ $(command -v "$scriptSrcDir"/bitmap_helper) ]]; then
|
||||
bmp_help="$scriptSrcDir"/bitmap_helper
|
||||
else
|
||||
echo "Could not find 'bitmap_helper'."
|
||||
echo "Have you compiled it or placed it in the same directory as the script ?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for gifToConvert in "$@"; do
|
||||
if [[ -z "$(echo "$gifToConvert" | grep -e 'gif')" ]]; then
|
||||
echo "Cannot convert $gifToConvert : not a gif."
|
||||
continue
|
||||
fi
|
||||
|
||||
animDir=ANIM_"${gifToConvert//.gif//}"
|
||||
mkdir "$animDir"
|
||||
pushd "$animDir"
|
||||
|
||||
convert -resize 84x48 -coalesce ../"$gifToConvert" -threshold 50% %02d.mono
|
||||
"$bmp_help" ./*.mono
|
||||
# Clean up and remove the extension
|
||||
rm -f ./*.mono
|
||||
for f in ./*.bin; do
|
||||
mv "$f" "${f//.bin/}"
|
||||
done
|
||||
|
||||
popd
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue