Skip to content

Commit a097c83

Browse files
authored
Merge pull request #3 from sparkfun/v1.6.0
V1.6.0
2 parents 558548d + f9d8244 commit a097c83

13 files changed

+50
-5406
lines changed

.github/workflows/build-linux.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ jobs:
3333
# Setup python
3434
- name: System Setup
3535
run: |
36-
pip3 install pyinstaller pyqt5 darkdetect pyserial
36+
pip install pyinstaller pyqt5 darkdetect argparse intelhex esptool
3737
3838
# Build the installer
3939
- name: Build Linux Installer
4040
run: |
41-
pyinstaller --onefile --clean --name RTKUploader --noconsole --distpath=. --icon=RTK_Firmware_Uploader/resource/RTK.ico --add-binary="RTK_Firmware_Uploader/resource/RTK_Surveyor_Partitions_4MB.bin:." --add-binary="RTK_Firmware_Uploader/resource/RTK_Surveyor_Partitions_16MB.bin:." --add-binary="RTK_Firmware_Uploader/resource/RTK_Surveyor.ino.bootloader.bin:." --add-binary="RTK_Firmware_Uploader/resource/boot_app0.bin:." --add-binary="RTK_Firmware_Uploader/resource/RTK.png:." --add-data="RTK_Firmware_Uploader/resource/*:resource/" RTK_Firmware_Upload.py
41+
ESPTOOL_LOCATION=$(pip show esptool | grep "Location: " | cut -c 11- | tr -d '\n')
42+
ESPTOOL_TARGETS=$(echo "${ESPTOOL_LOCATION}/esptool/targets/stub_flasher/*.json:./esptool/targets/stub_flasher/")
43+
pyinstaller --onefile --clean --name RTKUploader --noconsole --distpath=. --icon=RTK_Firmware_Uploader/resource/RTK.ico --add-data="RTK_Firmware_Uploader/resource/*:resource/" --add-data="${ESPTOOL_TARGETS}" RTK_Firmware_Upload.py
4244
gzip RTKUploader
4345
mv RTKUploader.gz RTKUploader.linux.gz
4446

.github/workflows/build-macos.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@ jobs:
3333
# Setup python
3434
- name: System Setup
3535
run: |
36-
pip3 install pyserial pyinstaller Pillow pyqt5 darkdetect
36+
pip install pyinstaller Pillow pyqt5 darkdetect argparse intelhex esptool
3737
brew install create-dmg
3838
3939
# Build the installer
4040
- name: Build Mac Installer
4141
run: |
42-
pyinstaller --windowed -n RTKUploader --noconsole --distpath=. --icon=RTK_Firmware_Uploader/resource/RTK.ico --add-binary="RTK_Firmware_Uploader/resource/RTK_Surveyor_Partitions_4MB.bin:." --add-binary="RTK_Firmware_Uploader/resource/RTK_Surveyor_Partitions_16MB.bin:." --add-binary="RTK_Firmware_Uploader/resource/RTK_Surveyor.ino.bootloader.bin:." --add-binary="RTK_Firmware_Uploader/resource/boot_app0.bin:." --add-binary="RTK_Firmware_Uploader/resource/RTK.png:." --add-data="RTK_Firmware_Uploader/resource/*:resource/" RTK_Firmware_Upload.py
42+
ESPTOOL_LOCATION=$(pip show esptool | grep "Location: " | cut -c 11- | tr -d '\n')
43+
ESPTOOL_TARGETS=$(echo "${ESPTOOL_LOCATION}/esptool/targets/stub_flasher/*.json:./esptool/targets/stub_flasher/")
44+
pyinstaller --windowed -n RTKUploader --noconsole --distpath=. --icon=RTK_Firmware_Uploader/resource/RTK.ico --add-data="RTK_Firmware_Uploader/resource/*:resource/" --add-data="${ESPTOOL_TARGETS}" RTK_Firmware_Upload.py
4345
mkdir tmp
4446
mv "RTKUploader.app" "tmp/"
4547
create-dmg --volicon "RTK_Firmware_Uploader/resource/sparkdisk.icns" --background "RTK_Firmware_Uploader/resource/sfe_logo_med.png" --hide-extension "RTKUploader.app" --icon "RTKUploader.app" 100 100 --window-size 600 440 --app-drop-link 400 100 "RTKUploader.dmg" "tmp/"

.github/workflows/build-windows.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,16 @@ jobs:
3333
# Setup python
3434
- name: System Setup
3535
run: |
36-
pip3 install pyinstaller pyqt5 darkdetect pyserial
37-
36+
pip install pyinstaller pyqt5 darkdetect argparse intelhex esptool
37+
3838
# Build the installer
3939
- name: Build Windows Installer
40+
shell: powershell
4041
run: |
41-
pyinstaller --onefile --clean --name RTKUploader --noconsole --distpath=. --icon=RTK_Firmware_Uploader\resource\RTK.ico --add-binary="RTK_Firmware_Uploader\resource\RTK_Surveyor_Partitions_4MB.bin;." --add-binary="RTK_Firmware_Uploader\resource\RTK_Surveyor_Partitions_16MB.bin;." --add-binary="RTK_Firmware_Uploader\resource\RTK_Surveyor.ino.bootloader.bin;." --add-binary="RTK_Firmware_Uploader\resource\boot_app0.bin;." --add-binary="RTK_Firmware_Uploader\resource\RTK.png;." --add-data="RTK_Firmware_Uploader\resource\*;resource\" RTK_Firmware_Upload.py
42+
$ESPTOOL_TARGETS = echo "$(pip show esptool | findstr "Location: ")"
43+
$ESPTOOL_TARGETS = $ESPTOOL_TARGETS.Substring(10)
44+
$ESPTOOL_TARGETS = echo "${ESPTOOL_TARGETS}\esptool\targets\stub_flasher\*.json;.\esptool\targets\stub_flasher\"
45+
pyinstaller --onefile --clean --name RTKUploader --noconsole --distpath=. --icon=RTK_Firmware_Uploader\resource\RTK.ico --add-data="RTK_Firmware_Uploader\resource\*;resource\" --add-data="${ESPTOOL_TARGETS}" RTK_Firmware_Upload.py
4246
4347
- name: Compress Installer
4448
shell: powershell

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#Python
2+
__pycache__/
3+
*.py[co]
4+
15
#VSCode
26

37
/.vscode/*

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ The RTK Firmware Uploader is a simple, easy to use method for updating the firmw
77

88
If you need to install the application, see the [Installation Section](#installation) of this page.
99

10+
## Notes:
11+
12+
From v1.6.0, this GUI does not contain a copy of ```esptool.py```. Instead the latest ```esptool.py``` is installed and used by the build workflow. If you want to run ```RTK_Firmware_Uploader.py``` locally, you will need to ```pip install esptool``` first.
1013

1114
# Using the RTK Firmware Uploader
1215

RTK_Firmware_Uploader/RTK_Firmware_Uploader.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,8 @@ def update_baud_rates(self) -> None:
375375
# Highest speed first so code defaults to that
376376
# if settings.value(SETTING_BAUD_RATE) is None
377377
self.baud_combobox.clear()
378-
self.baud_combobox.addItem("921600", 921600)
378+
if (platform.system() != "Darwin"): # 921600 fails on MacOS
379+
self.baud_combobox.addItem("921600", 921600)
379380
self.baud_combobox.addItem("460800", 460800)
380381
self.baud_combobox.addItem("115200", 115200)
381382

RTK_Firmware_Uploader/au_act_esptool.py

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
from .au_action import AxAction, AxJob
2-
from .esptool import main as esptool_main
3-
from .esptool import ESPLoader
4-
from .esptool import UnsupportedCommandError
5-
from .esptool import NotSupportedError
6-
from .esptool import NotImplementedInROMError
7-
from .esptool import FatalError
82

3+
import esptool # pip install esptool
4+
5+
# # When I couldn't get the windowed executable to work on MacOS, I suspected that esptool still could not
6+
# # find the stub_flasher json files. Turns out it was actually the baud rate that was the issue...
7+
# # 921600 fails on my Mac Mini, but 460800 works fine...
8+
# # I'm leaving the following commented code for future reference. I really like the exec trick!
9+
#
10+
# from platform import system
11+
# import os.path
12+
# import sys
13+
# if (system() == "Darwin") and hasattr(sys, '_MEIPASS'): # Fix for MacOS pyinstaller windowed executable
14+
# head_tail = os.path.split(os.path.dirname(__file__))
15+
# base_path = os.path.abspath(head_tail[0])
16+
# STUBS_DIR = os.path.join(base_path, "esptool", "targets", "stub_flasher")
17+
# # Python hackiness: change the path to stub json files in the context of the esptool
18+
# # module, so it edits the esptool's global variables
19+
# exec(
20+
# "loader.STUBS_DIR = '{}'".format(STUBS_DIR),
21+
# esptool.__dict__,
22+
# esptool.__dict__,
23+
# )
924

1025
#--------------------------------------------------------------------------------------
1126
# action testing
@@ -20,7 +35,7 @@ def __init__(self) -> None:
2035
def run_job(self, job:AxJob):
2136

2237
try:
23-
esptool_main(job.command)
38+
esptool.main(job.command)
2439

2540
except Exception:
2641
return 1
@@ -38,7 +53,7 @@ def __init__(self) -> None:
3853
def run_job(self, job:AxJob):
3954

4055
try:
41-
esptool_main(job.command)
56+
esptool.main(job.command)
4257

4358
except Exception:
4459
return 1
@@ -56,7 +71,7 @@ def __init__(self) -> None:
5671
def run_job(self, job:AxJob):
5772

5873
try:
59-
esptool_main(job.command)
74+
esptool.main(job.command)
6075

6176
except Exception:
6277
return 1

0 commit comments

Comments
 (0)