diff --git a/34_write_byhash.sh b/34_write_byhash.sh index 872eee7..045f394 100755 --- a/34_write_byhash.sh +++ b/34_write_byhash.sh @@ -1,5 +1,39 @@ #!/bin/bash +if [ -z "$1" ]; then + echo "Usage: $0 " + + read -p "Enter the hash: " hash + if [ -z "$hash" ]; then + echo "No hash entered." + exit 1 + fi +else + hash=$1 +fi + +# ダウンロードURL +URL="https://lattr.istlab.info/inobin/dl/${hash}" + +RESPONCE_CODE=$(curl -s -o byhash.bin -w "%{http_code}" $URL) +if [ $RESPONCE_CODE -ne 200 ]; then + echo "Error: $RESPONCE_CODE" + exit 1 +fi + +curl -o byhash.partitions.bin -s ${URL}/partitions +curl -o byhash.bootloader.bin -s ${URL}/bootloader +echo "Downloaded ${hash} as [byhash.bin], [byhash.partitions.bin], [byhash.bootloader.bin]" + +# もし、hashがp1ではじまっていたら、注意喚起する +if [[ $hash =~ ^p1 ]]; then + echo "注:Plus2(黄色)ではなく、Plus(オレンジ色)用のプログラムです。" + board="plus" +else + board="plus2" +fi + + source ./lib.sh # Get esptool command diff --git a/Readme.html b/Readme.html new file mode 100644 index 0000000..cf94ad2 --- /dev/null +++ b/Readme.html @@ -0,0 +1,52 @@ + + + + + + ファイルの説明 + + + +

ファイルの説明

+
+
概要
+
これは IoTプログラミング実験 用のファイル群です。
+
Sample.ino
+
M5StickCPlus2を使用したサンプルコードです。ランダムな背景色を設定し、コントラストの良い文字色で「SampleProject」と表示します。
+
Readme.html
+
このファイルはプロジェクトの説明を提供します。
+
01_download_factorytest.sh
+
このシェルスクリプトはファクトリーテストのファームウェアイメージのダウンロードを行います。
+
11_write_factorytest.sh
+
このシェルスクリプトはダウンロードしたファクトリーテストのファームウェアイメージをM5StickCPlus2にアップロードします。
+
34_write_byhash.sh
+
このシェルスクリプトはハッシュ値を使用してファームウェアイメージを書き込みます。
+
44_write_latest.sh
+
このシェルスクリプトは、学習者(あなた)が講義システムで最後に編集・ビルドしたファームウェアイメージを書き込みます。
+
53_compile_sample.sh
+
このシェルスクリプトはSampleフォルダにあるサンプルコードのコンパイルを行います。
+
54_write_sample.sh
+
このシェルスクリプトはコンパイルしたサンプルコードをM5StickCPlus2に書き込みます。
+
91_install_cli.sh
+
このシェルスクリプトはarduino-cliツールのインストールを行います。
+
92_install_cli_lib.sh
+
このシェルスクリプトはarduino-cli用のライブラリのインストールを行います。
+
93_compile_factorytest.sh
+
このシェルスクリプトはファクトリーテストのコンパイルを行います。
+
94_write_factorytest.sh
+
このシェルスクリプトはコンパイルしたファクトリーテストをM5StickCPlus2に書き込みます。
+
99_latest_setup.sh
+
このシェルスクリプトは44_write_latest.shに、学習者(あなた)の講義システム情報を書き込みます。
+
+ + \ No newline at end of file