feat: support D1
This commit is contained in:
10
README.md
10
README.md
@@ -151,10 +151,10 @@ The project requires the following libraries:
|
|||||||
|
|
||||||
### Building
|
### Building
|
||||||
|
|
||||||
Build the firmware:
|
Build the firmware for specific chip:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./ctl.sh build
|
./ctl.sh build target esp01_1m
|
||||||
```
|
```
|
||||||
|
|
||||||
### Flashing
|
### Flashing
|
||||||
@@ -162,7 +162,7 @@ Build the firmware:
|
|||||||
Flash firmware to a connected device:
|
Flash firmware to a connected device:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./ctl.sh flash
|
./ctl.sh flash target esp01_1m
|
||||||
```
|
```
|
||||||
|
|
||||||
### Over-The-Air Updates
|
### Over-The-Air Updates
|
||||||
@@ -170,13 +170,13 @@ Flash firmware to a connected device:
|
|||||||
Update a specific node:
|
Update a specific node:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./ctl.sh ota update 192.168.1.100
|
./ctl.sh ota update 192.168.1.100 esp01_1m
|
||||||
```
|
```
|
||||||
|
|
||||||
Update all nodes in the cluster:
|
Update all nodes in the cluster:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./ctl.sh ota all
|
./ctl.sh ota all esp01_1m
|
||||||
```
|
```
|
||||||
|
|
||||||
### Cluster Management
|
### Cluster Management
|
||||||
|
|||||||
28
ctl.sh
28
ctl.sh
@@ -9,26 +9,40 @@ function info {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function build {
|
function build {
|
||||||
echo "Building project..."
|
function target {
|
||||||
pio run
|
echo "Building project for $1..."
|
||||||
|
pio run -e $1
|
||||||
|
}
|
||||||
|
function all {
|
||||||
|
target esp01_1m
|
||||||
|
target d1_mini
|
||||||
|
}
|
||||||
|
${@:-all}
|
||||||
}
|
}
|
||||||
|
|
||||||
function flash {
|
function flash {
|
||||||
echo "Flashing firmware..."
|
function target {
|
||||||
pio run --target upload
|
echo "Flashing firmware for $1..."
|
||||||
|
pio run --target upload -e $1
|
||||||
|
}
|
||||||
|
function all {
|
||||||
|
target esp01_1m
|
||||||
|
target d1_mini
|
||||||
|
}
|
||||||
|
${@:-all}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ota {
|
function ota {
|
||||||
function update {
|
function update {
|
||||||
echo "Updating node at $1"
|
echo "Updating node at $1 with $2... "
|
||||||
curl -X POST \
|
curl -X POST \
|
||||||
-F "file=@.pio/build/esp01_1m/firmware.bin" \
|
-F "file=@.pio/build/$2/firmware.bin" \
|
||||||
http://$1/api/node/update | jq -r '.status'
|
http://$1/api/node/update | jq -r '.status'
|
||||||
}
|
}
|
||||||
function all {
|
function all {
|
||||||
echo "Updating all nodes..."
|
echo "Updating all nodes..."
|
||||||
curl -s http://$API_NODE/api/cluster/members | jq -r '.members.[].ip' | while read -r ip; do
|
curl -s http://$API_NODE/api/cluster/members | jq -r '.members.[].ip' | while read -r ip; do
|
||||||
ota update $ip
|
ota update $ip $1
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
${@:-info}
|
${@:-info}
|
||||||
|
|||||||
@@ -8,6 +8,16 @@
|
|||||||
; Please visit documentation for the other options and examples
|
; Please visit documentation for the other options and examples
|
||||||
; https://docs.platformio.org/page/projectconf.html
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
|
[platformio]
|
||||||
|
default_envs = esp01_1m
|
||||||
|
|
||||||
|
[common]
|
||||||
|
monitor_speed = 115200
|
||||||
|
lib_deps =
|
||||||
|
esp32async/ESPAsyncWebServer@^3.8.0
|
||||||
|
bblanchon/ArduinoJson@^7.4.2
|
||||||
|
arkhipenko/TaskScheduler@^3.8.5
|
||||||
|
|
||||||
[env:esp01_1m]
|
[env:esp01_1m]
|
||||||
platform = platformio/espressif8266@^4.2.1
|
platform = platformio/espressif8266@^4.2.1
|
||||||
board = esp01_1m
|
board = esp01_1m
|
||||||
@@ -15,9 +25,16 @@ framework = arduino
|
|||||||
upload_speed = 115200
|
upload_speed = 115200
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
board_build.partitions = partitions_ota_1M.csv
|
board_build.partitions = partitions_ota_1M.csv
|
||||||
board_build.flash_mode = dout ; ESP‑01S uses DOUT on 1 Mbit flash
|
board_build.flash_mode = dout ; ESP‑01S uses DOUT on 1 Mbit flash
|
||||||
board_build.flash_size = 1M
|
board_build.flash_size = 1M
|
||||||
lib_deps =
|
lib_deps = ${common.lib_deps}
|
||||||
esp32async/ESPAsyncWebServer@^3.8.0
|
|
||||||
bblanchon/ArduinoJson@^7.4.2
|
[env:d1_mini]
|
||||||
arkhipenko/TaskScheduler@^3.8.5
|
platform = platformio/espressif8266@^4.2.1
|
||||||
|
board = d1_mini
|
||||||
|
framework = arduino
|
||||||
|
upload_speed = 115200
|
||||||
|
monitor_speed = 115200
|
||||||
|
board_build.flash_mode = dio ; D1 Mini uses DIO on 4 Mbit flash
|
||||||
|
board_build.flash_size = 4M
|
||||||
|
lib_deps = ${common.lib_deps}
|
||||||
Reference in New Issue
Block a user