-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
52bb9fb
commit 5fdc005
Showing
9 changed files
with
640 additions
and
560 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
name: arduino | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
|
||
jobs: | ||
|
||
build: | ||
permissions: write-all | ||
|
||
strategy: | ||
matrix: | ||
arduino-platform: ["esp8266:esp8266"] | ||
include: | ||
- arduino-platform: "esp8266:esp8266" | ||
fqbn: "esp8266:esp8266:generic" | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Setup Arduino CLI | ||
uses: arduino/setup-arduino-cli@v1 | ||
|
||
- name: Install platform | ||
run: > | ||
arduino-cli core install | ||
--additional-urls=http://arduino.esp8266.com/stable/package_esp8266com_index.json | ||
${{ matrix.arduino-platform }} | ||
- name: Install time lib | ||
run: arduino-cli lib install time wifimanager ezTime | ||
|
||
- name: Make timezones | ||
run: python firmware/cities.py > firmware/cities.h | ||
|
||
- name: Compile Sketch | ||
run: > | ||
arduino-cli compile --fqbn ${{ matrix.fqbn }} -e | ||
firmware | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./firmware/build/esp8266.esp8266.generic/firmware.ino.bin | ||
asset_name: nixiesp12.bin | ||
asset_content_type: application/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
build | ||
cities.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,21 @@ | ||
NAME=esp8266-1m-20210618-v1.16.bin | ||
SKETCH_FOLDER := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) | ||
UPLOAD_PORT ?= /dev/ttyUSB0 | ||
|
||
flash: | ||
wget -c http://micropython.org/resources/firmware/${NAME} | ||
esptool.py -p /dev/ttyUSB0 write_flash --flash_size=1MB 0 ${NAME} | ||
all: $(SKETCH_FOLDER)/build/firmware.ino.bin | ||
|
||
erase: | ||
esptool.py -p /dev/ttyUSB0 erase_flash | ||
$(SKETCH_FOLDER)/cities.h: cities.py | ||
python3 cities.py > $(SKETCH_FOLDER)/cities.h | ||
|
||
upload: | ||
ampy -p /dev/ttyUSB0 put picoweb.py | ||
ampy -p /dev/ttyUSB0 put timezone.py | ||
ampy -p /dev/ttyUSB0 put main.py | ||
$(SKETCH_FOLDER)/build/firmware.ino.bin: $(SKETCH_FOLDER)/firmware.ino $(SKETCH_FOLDER)/cities.h | ||
arduino-cli compile -e -b esp8266:esp8266:generic $(SKETCH_FOLDER) | ||
|
||
console: | ||
echo "Ctrl-A + Ctrl-Q to close Picocom" | ||
picocom -b115200 /dev/ttyUSB0 | ||
deps: | ||
arduino-cli core install \ | ||
--additional-urls=http://arduino.esp8266.com/stable/package_esp8266com_index.json esp8266:esp8266 | ||
arduino-cli lib install wifimanager ESP8266TimerInterrupt ezTime | ||
|
||
clone_read: | ||
esptool.py -p /dev/ttyUSB0 read_flash 0 0x100000 clone.bin | ||
flash: $(SKETCH_FOLDER)/firmware.ino.bin | ||
arduino-cli upload -b esp8266:esp8266:generic -p $(UPLOAD_PORT) $(SKETCH_FOLDER) | ||
|
||
clone_write: | ||
esptool.py -p /dev/ttyUSB0 write_flash --flash_size=1MB 0 clone.bin | ||
console: | ||
picocom -b 9600 $(UPLOAD_PORT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import requests | ||
import csv | ||
|
||
# Looks like ESP-IDF pulls in whole POSIX stack | ||
# Some forums mention ESP-IDF uses this CSV | ||
|
||
coords = {} | ||
|
||
r = requests.get("https://gist.githubusercontent.com/erdem/8c7d26765831d0f9a8c62f02782ae00d/raw/248037cd701af0a4957cce340dabb0fd04e38f4c/countries.json") | ||
data = r.json() | ||
for j in data: | ||
for tz in j["timezones"]: | ||
coords[tz] = j["latlng"] | ||
|
||
|
||
r = requests.get("https://raw.githubusercontent.com/nayarsystems/posix_tz_db/master/zones.csv") | ||
cr = csv.reader(r.text.splitlines(), delimiter=',', quotechar='"') | ||
|
||
print("""const char cities[] = R"( | ||
<br/> | ||
<label for="city">Nearest city</label> | ||
<select name="city" id="city" onchange=" | ||
document.getElementById('timezone').value = this.value; | ||
document.getElementById('long').value = this.options[this.selectedIndex].dataset.long; | ||
document.getElementById('lat').value = this.options[this.selectedIndex].dataset.lat; | ||
">""") | ||
for name, code in cr: | ||
if name.startswith("Etc/"): | ||
continue | ||
if not name.startswith("Europe/"): | ||
continue | ||
longlat = coords.get(name) | ||
selected = name == "Europe/Tallinn" | ||
print("""<option value="%s" data-long="%s" data-lat="%s"%s>%s</option>""" % ( | ||
code, | ||
int(longlat[0]) if longlat else "", | ||
int(longlat[1]) if longlat else "", | ||
" selected" if selected else "", | ||
name)) | ||
print("""</select> | ||
)"; | ||
""") |
Oops, something went wrong.