summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2022-01-24 15:31:47 +0100
committerxengineering <me@xengineering.eu>2022-01-24 15:31:47 +0100
commitcbb1f59715f180fcf32434af379aea180522bae2 (patch)
treeb7adbd1cf01b0e388f920c36b92b188ef0a81f05
parent5a4d2121ca4af4c1d505a9b93016490191266c0b (diff)
downloadledcontrol-cbb1f59715f180fcf32434af379aea180522bae2.tar
ledcontrol-cbb1f59715f180fcf32434af379aea180522bae2.tar.zst
ledcontrol-cbb1f59715f180fcf32434af379aea180522bae2.zip
Add download script
-rw-r--r--pcb/.gitignore1
-rwxr-xr-xpcb/download.sh31
-rw-r--r--pcb/parts.tsv4
3 files changed, 34 insertions, 2 deletions
diff --git a/pcb/.gitignore b/pcb/.gitignore
new file mode 100644
index 0000000..06cf653
--- /dev/null
+++ b/pcb/.gitignore
@@ -0,0 +1 @@
+cache
diff --git a/pcb/download.sh b/pcb/download.sh
new file mode 100755
index 0000000..dfe1be9
--- /dev/null
+++ b/pcb/download.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+
+# constants
+DOCUMENTS_FILE='documents.tsv'
+CACHE='./cache' # target folder for all downloads
+
+
+# strip first line of table file
+TABLE=$(sed '1d' "${DOCUMENTS_FILE}")
+
+# create chache folder
+mkdir -p ${CACHE}
+
+# download each document and save it to the cache directory
+echo "${TABLE}" | while read -r line # read each line of table
+do
+
+ FILENAME=$(echo "$line" | awk -F '\t' '{print $1}') # column 1 -> filename
+ URL=$(echo "$line" | awk -F '\t' '{print $2}') # column 2 -> URL
+
+ # actual download of one document
+ printf 'Downloading %s/%s ...' "${CACHE}" "${FILENAME}"
+ if wget -qO "${CACHE}/${FILENAME}" "${URL}" 2> /dev/null
+ then
+ printf " ok\n" # if wget returned with exit code 0
+ else
+ printf " error!\n" # in any other case
+ fi
+
+done
diff --git a/pcb/parts.tsv b/pcb/parts.tsv
index 4d26904..6db039f 100644
--- a/pcb/parts.tsv
+++ b/pcb/parts.tsv
@@ -1,5 +1,5 @@
Name Quantity Type Manufacturer
-STM32F103C8T6 1 MCU ST
-L7805CV 1 Power converter ST
+STM32F103C8T6 1 MCU STMicroelectronics
+L7805CV 1 Power converter STMicroelectronics
IRF840A 1 MOSFET Infineon Technologies
IR2127 1 MOSFET Driver Infineon Technologies