This commit is contained in:
Nils Schulte 2020-04-06 11:44:18 +02:00
parent e8b4d0384c
commit 77ce3a8064

View File

@ -1,5 +1,5 @@
---
title: "Scripts and Stuff"
title: "Upload script for uPython"
date: 2020-03-16T14:00:00+01:00
draft: false
summary: more on micropython
@ -7,7 +7,7 @@ summary: more on micropython
My university exams for this semester are mostly done by now. And with all the corona-virus-measures the new semester doesn't start for another month. Hopefully I will finish some of those procrastinated projects of mine ;)
Anyways. [Micropython](https://micropython.org/) is still on my Radar (I even used it in one university assignment and it really shined there).
Anyways. [Micropython](https://micropython.org/) is still on my radar (I even used it in one university assignment and it really shined there).
Here is a small script which uploads all files to the controller (when web-REPL is enables of course):
```bash
@ -29,9 +29,9 @@ do
fi
done
```
The script saves the md5 hashes of the uploaded files in a file called `.uploaded` so unchanged files don't get constantly uploaded again. The script doesn't check if the upload is successful, so only run the script when the upload is going to work ;)
You can provide the IP of the microcontroller as an argument, otherwise 192.168.222.31 is used (which is the IP my prototype ESP32 gets assigned, so you should probably change that ;) ).
The script also saves the md5 hashes of the uploaded files in a file called `.uploaded` so unchanged files don't get constantly uploaded again. The script doesn't check if the upload is successful, so only run the script when the upload is going to work ;)
It uses the `webrepl_cli.py` script from the official micropython [github page](https://github.com/micropython/webrepl).
As you can see my script is hacked together and i should probably feel bad for making it public here, but it works and im going to update it if i feel the need to[^1].
[^1]: which means if i have to `rm .uploaded` too often when the uploaded didn't work.
[^1]: which means i had to `rm .uploaded` too often, cause the upload didn't work but the md5-file is updated.