From ce63d33a577bb5562c14d9a93b0c1b8aac9f341a Mon Sep 17 00:00:00 2001 From: KemoNine Date: Mon, 7 Sep 2020 22:10:48 -0400 Subject: [PATCH] Update tools to simplify compile/upload ; note them in the readme --- README.md | 4 ++++ build.ps1 | 1 + make.ps1 | 9 ++++++++- upload.ps1 | 5 ++++- 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 build.ps1 diff --git a/README.md b/README.md index c75759a..e6eed6d 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,10 @@ A debug console for serial TTL. This can be used to work with serial TTL directl - Battery level on feather neopixel (green = >80% ; yellow >=40% ; orange >= 25% ; red < 25%) - User LED (red) always on when feather is running +## Building / Uploading + +The ```make.ps1```, ```build.ps1``` and ```upload.ps1``` scripts can be used to build/upload this project. These scripts call the ```arduino-cli``` commands programatically. + ## Licensing Unless otherwise stated all source code is licensed under the [Apache 2 License](LICENSE-APACHE-2.0.txt). diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..ef8fa18 --- /dev/null +++ b/build.ps1 @@ -0,0 +1 @@ +arduino-cli compile --log-level=warn --fqbn adafruit:nrf52:feather52840 serial_debugger.ino diff --git a/make.ps1 b/make.ps1 index ef8fa18..fc2a375 100644 --- a/make.ps1 +++ b/make.ps1 @@ -1 +1,8 @@ -arduino-cli compile --log-level=warn --fqbn adafruit:nrf52:feather52840 serial_debugger.ino +# Ensure this script fails if either build or upload fails +$ErrorActionPreference = "Stop" + +# Ensure we actually build before upload (common mistake) +& .\build.ps1 + +# Upload to board +& .\upload.ps1 diff --git a/upload.ps1 b/upload.ps1 index aea5204..d6cf8e5 100644 --- a/upload.ps1 +++ b/upload.ps1 @@ -1 +1,4 @@ -arduino-cli upload --fqbn adafruit:nrf52:feather52840 -p COM5 +# Get list of boards +$COM_PORT=$(arduino-cli board list | Select-String -Pattern "adafruit:nrf52:feather52840" | %{ $_.ToString().Split(' ')[0]; }) +Write-Host "Using serial port $($COM_PORT)" +arduino-cli upload --fqbn adafruit:nrf52:feather52840 -p $COM_PORT