mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-11-17 19:32:21 +01:00
Compare commits
128
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9db47174f6 | ||
|
|
8fb5135746 | ||
|
|
23f042c83d | ||
|
|
2b6012a0ca | ||
|
|
a79c78d0e3 | ||
|
|
ba3069480b | ||
|
|
e1313dbd7e | ||
|
|
3efa333df4 | ||
|
|
aab05be49f | ||
|
|
f2f0d1725e | ||
|
|
ef7d38e940 | ||
|
|
ac3ff04f46 | ||
|
|
51537e24a8 | ||
|
|
9c1181e7c6 | ||
|
|
1591d9f7fe | ||
|
|
1747922036 | ||
|
|
37afd9a659 | ||
|
|
f9439704f7 | ||
|
|
e2ebd09eec | ||
|
|
9314bf10ba | ||
|
|
a045599df1 | ||
|
|
9930603e99 | ||
|
|
470dbe1907 | ||
|
|
07d21515f5 | ||
|
|
37d73133b3 | ||
|
|
9157d44976 | ||
|
|
1d98b5ae2a | ||
|
|
ad6c813e39 | ||
|
|
dc2e988b57 | ||
|
|
0eaf538cbd | ||
|
|
9a8bbc2a99 | ||
|
|
c0d67acffd | ||
|
|
075ed0e6b4 | ||
|
|
8ded0e96df | ||
|
|
d13227c519 | ||
|
|
8c39abfce9 | ||
|
|
2d2152cdd9 | ||
|
|
b9de2a54b7 | ||
|
|
6280846afb | ||
|
|
662b2e2a2e | ||
|
|
9556eabd80 | ||
|
|
d75c88fc91 | ||
|
|
1257e5d9e0 | ||
|
|
bfeb0f13eb | ||
|
|
9bddbdf20a | ||
|
|
e6f8953da2 | ||
|
|
1876016509 | ||
|
|
7717fb5d6a | ||
|
|
5e133e9f11 | ||
|
|
2e2921bac0 | ||
|
|
37224200b4 | ||
|
|
504d89c8cc | ||
|
|
206d831941 | ||
|
|
b2ba3d992a | ||
|
|
683bc7fe1a | ||
|
|
e692ce2729 | ||
|
|
90b18ef088 | ||
|
|
477df390e1 | ||
|
|
fd9df47bd3 | ||
|
|
a763200220 | ||
|
|
e47a97491e | ||
|
|
5036c20ca9 | ||
|
|
aa17b8ded1 | ||
|
|
228a3dde25 | ||
|
|
7f195e1725 | ||
|
|
48538a6162 | ||
|
|
023f76e8e3 | ||
|
|
c2f23cd8f0 | ||
|
|
bcaef66d5d | ||
|
|
50be6da1cb | ||
|
|
2d3d287e56 | ||
|
|
a8a13a45ee | ||
|
|
8ab104acb7 | ||
|
|
d6f056cf9c | ||
|
|
8b3a59ed90 | ||
|
|
55979696a0 | ||
|
|
1429dc910d | ||
|
|
c91907523e | ||
|
|
82f9881db4 | ||
|
|
f5d98fa83d | ||
|
|
a4af59c793 | ||
|
|
16e878f8ba | ||
|
|
1904e2ea5b | ||
|
|
59a99e2295 | ||
|
|
07f113f6d1 | ||
|
|
cbde35ae27 | ||
|
|
f7d7502a8f | ||
|
|
3a2241883b | ||
|
|
76d0909639 | ||
|
|
5ef40ce62f | ||
|
|
47807dc8ce | ||
|
|
e83b32534d | ||
|
|
45d0c3c5ed | ||
|
|
67b1f9480a | ||
|
|
5d0bb25251 | ||
|
|
3041c649ca | ||
|
|
190ff6a8f2 | ||
|
|
997e70b462 | ||
|
|
e0268516f1 | ||
|
|
a86cb897b9 | ||
|
|
4e9ce85fd9 | ||
|
|
7b39a0f0ef | ||
|
|
e1177fa521 | ||
|
|
f811ea20b9 | ||
|
|
b29370ef0d | ||
|
|
c5e65e74c1 | ||
|
|
ab6a60d97b | ||
|
|
3cbcff921b | ||
|
|
b36fc813b7 | ||
|
|
76cf3ad89a | ||
|
|
851d178bac | ||
|
|
8dde08c501 | ||
|
|
0292c89246 | ||
|
|
feb9aa711d | ||
|
|
e33e163aa6 | ||
|
|
28088b4035 | ||
|
|
c7742ea793 | ||
|
|
80da843af2 | ||
|
|
a464f909a8 | ||
|
|
76cc11555c | ||
|
|
fe3d001c56 | ||
|
|
ffcd998ed7 | ||
|
|
fda6589fb8 | ||
|
|
7a57e9f667 | ||
|
|
4083f20664 | ||
|
|
3de37e312c | ||
|
|
dbd30c9b18 | ||
|
|
98b041e406 |
No files matched your search
+86
-24
@@ -71,6 +71,8 @@ jobs:
|
||||
chip: esp32s3
|
||||
- name: ttgo_t_beam_s3_SUPREME_v3
|
||||
chip: esp32s3
|
||||
- name: ttgo-t-beam-1W
|
||||
chip: esp32s3
|
||||
- name: ESP32_DIY_LoRa_A7670_SX1278
|
||||
chip: esp32
|
||||
- name: ESP32_DIY_LoRa_A7670_915_SX1276
|
||||
@@ -118,11 +120,14 @@ jobs:
|
||||
- name: ESP32_9M2IBR_1W_LoRa_GPS_E22_400M30S
|
||||
chip: esp32
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: actions/setup-python@v4
|
||||
- uses: actions/setup-python@v7
|
||||
with:
|
||||
python-version: "3.9"
|
||||
python-version: "3.13"
|
||||
|
||||
- name: Install esptool
|
||||
run: pip install "esptool>=5,<6"
|
||||
|
||||
- name: Install PlatformIO Core
|
||||
run: pip install --upgrade platformio
|
||||
@@ -148,44 +153,44 @@ jobs:
|
||||
- name: Merge for web flashing
|
||||
run: |
|
||||
if [ "${{ matrix.target.chip }}" == "esp32" ]; then
|
||||
python installer/bin/esptool/esptool.py --chip esp32 merge_bin \
|
||||
esptool --chip esp32 merge-bin \
|
||||
-o installer/web_factory.bin \
|
||||
--flash_mode dio \
|
||||
--flash_freq 40m \
|
||||
--flash_size 4MB \
|
||||
--flash-mode dio \
|
||||
--flash-freq 40m \
|
||||
--flash-size 4MB \
|
||||
0x1000 installer/firmware/bootloader.bin \
|
||||
0x8000 installer/firmware/partitions.bin \
|
||||
0xe000 installer/firmware/boot_app0.bin \
|
||||
0x10000 installer/firmware/firmware.bin \
|
||||
0x3D0000 installer/firmware/spiffs.bin
|
||||
elif [ "${{ matrix.target.chip }}" == "esp32s2" ]; then
|
||||
python installer/bin/esptool/esptool.py --chip esp32s2 merge_bin \
|
||||
esptool --chip esp32s2 merge-bin \
|
||||
-o installer/web_factory.bin \
|
||||
--flash_mode dio \
|
||||
--flash_freq 40m \
|
||||
--flash_size 4MB \
|
||||
--flash-mode dio \
|
||||
--flash-freq 40m \
|
||||
--flash-size 4MB \
|
||||
0x1000 installer/firmware/bootloader.bin \
|
||||
0x8000 installer/firmware/partitions.bin \
|
||||
0xe000 installer/firmware/boot_app0.bin \
|
||||
0x10000 installer/firmware/firmware.bin \
|
||||
0x3D0000 installer/firmware/spiffs.bin
|
||||
elif [ "${{ matrix.target.chip }}" == "esp32s3" ]; then
|
||||
python installer/bin/esptool/esptool.py --chip esp32s3 merge_bin \
|
||||
esptool --chip esp32s3 merge-bin \
|
||||
-o installer/web_factory.bin \
|
||||
--flash_mode dio \
|
||||
--flash_freq 40m \
|
||||
--flash_size 8MB \
|
||||
--flash-mode dio \
|
||||
--flash-freq 40m \
|
||||
--flash-size 8MB \
|
||||
0x0000 installer/firmware/bootloader.bin \
|
||||
0x8000 installer/firmware/partitions.bin \
|
||||
0xe000 installer/firmware/boot_app0.bin \
|
||||
0x10000 installer/firmware/firmware.bin \
|
||||
0x3D0000 installer/firmware/spiffs.bin
|
||||
elif [ "${{ matrix.target.chip }}" == "esp32c3" ]; then
|
||||
python installer/bin/esptool/esptool.py --chip esp32c3 merge_bin \
|
||||
esptool --chip esp32c3 merge-bin \
|
||||
-o installer/web_factory.bin \
|
||||
--flash_mode dio \
|
||||
--flash_freq 40m \
|
||||
--flash_size 4MB \
|
||||
--flash-mode dio \
|
||||
--flash-freq 40m \
|
||||
--flash-size 4MB \
|
||||
0x1000 installer/firmware/bootloader.bin \
|
||||
0x8000 installer/firmware/partitions.bin \
|
||||
0xe000 installer/firmware/boot_app0.bin \
|
||||
@@ -199,12 +204,69 @@ jobs:
|
||||
- name: Archive Files
|
||||
run: zip -r installer.zip installer/
|
||||
|
||||
- name: Rename zip for upload
|
||||
run: mv installer.zip ${{ matrix.target.name }}.zip
|
||||
|
||||
- name: Upload Release Asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
uses: softprops/action-gh-release@v3
|
||||
with:
|
||||
files: ${{ matrix.target.name }}.zip
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
build-rp2350:
|
||||
# RP2350 boards (src/rp2350/, maintained by @cvaldess): one zip per board with
|
||||
# firmware.uf2 for the first install (BOOTSEL USB drive) and ota_update.bin
|
||||
# for the web OTA. If one does not build, the release goes on without its zip
|
||||
# and this run stays green with a warning.
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write # upload the zips to the release
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target:
|
||||
- name: pico2_w5500_e22
|
||||
- name: wiznet_5500_evb_pico2_e22p
|
||||
- name: wiznet_5100s_evb_pico2_e22p
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: actions/setup-python@v7
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: ./installer.zip
|
||||
asset_name: ${{ matrix.target.name }}.zip
|
||||
asset_content_type: application/zip
|
||||
python-version: "3.13"
|
||||
|
||||
- name: Install PlatformIO Core
|
||||
run: pip install --upgrade platformio
|
||||
|
||||
- name: Build target
|
||||
id: build
|
||||
continue-on-error: true
|
||||
run: pio run -e ${{ matrix.target.name }}
|
||||
|
||||
- name: Report
|
||||
if: steps.build.outcome == 'failure'
|
||||
run: echo "::warning title=RP2350::${{ matrix.target.name }} did not build, so this release has no zip for it. The RP2350 boards (src/rp2350/) are maintained by @cvaldess."
|
||||
|
||||
- name: Move Files
|
||||
if: steps.build.outcome == 'success'
|
||||
run: |
|
||||
mkdir -p installer/firmware
|
||||
cp .pio/build/${{ matrix.target.name }}/firmware.bin installer/ota_update.bin
|
||||
cp .pio/build/${{ matrix.target.name }}/firmware.uf2 installer/firmware/
|
||||
|
||||
- name: Install Zip
|
||||
if: steps.build.outcome == 'success'
|
||||
run: sudo apt-get install zip
|
||||
|
||||
- name: Archive Files
|
||||
if: steps.build.outcome == 'success'
|
||||
run: zip -r ${{ matrix.target.name }}.zip installer/
|
||||
|
||||
- name: Upload Release Asset
|
||||
if: steps.build.outcome == 'success'
|
||||
uses: softprops/action-gh-release@v3
|
||||
with:
|
||||
files: ${{ matrix.target.name }}.zip
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -15,11 +15,11 @@ jobs:
|
||||
- name: ttgo-lora32-v21
|
||||
chip: esp32
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: actions/setup-python@v4
|
||||
- uses: actions/setup-python@v7
|
||||
with:
|
||||
python-version: "3.9"
|
||||
python-version: "3.13"
|
||||
|
||||
- name: Install PlatformIO Core
|
||||
run: pip install --upgrade platformio
|
||||
@@ -28,4 +28,34 @@ jobs:
|
||||
run: pio run -e ${{ matrix.target.name }}
|
||||
|
||||
- name: Build FS
|
||||
run: pio run --target buildfs -e ${{ matrix.target.name }}
|
||||
run: pio run --target buildfs -e ${{ matrix.target.name }}
|
||||
|
||||
build-rp2350:
|
||||
# RP2350 boards (src/rp2350/, maintained by @cvaldess). The W5500 and W5100S
|
||||
# boards cover both Ethernet drivers. Informative only: if one does not
|
||||
# build, this run stays green and leaves a warning.
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target:
|
||||
- name: wiznet_5500_evb_pico2_e22p
|
||||
- name: wiznet_5100s_evb_pico2_e22p
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: actions/setup-python@v7
|
||||
with:
|
||||
python-version: "3.13"
|
||||
|
||||
- name: Install PlatformIO Core
|
||||
run: pip install --upgrade platformio
|
||||
|
||||
- name: Build target
|
||||
id: build
|
||||
continue-on-error: true
|
||||
run: pio run -e ${{ matrix.target.name }}
|
||||
|
||||
- name: Report
|
||||
if: steps.build.outcome == 'failure'
|
||||
run: echo "::warning title=RP2350::${{ matrix.target.name }} did not build. The RP2350 boards (src/rp2350/) are maintained by @cvaldess."
|
||||
@@ -37,7 +37,7 @@ ____________________________________________________
|
||||
|
||||
- TTGO Lilygo LoRa32 LoRa32 V2.1 (V1.6 is the same) and T3S3 V1.2.
|
||||
|
||||
- TTGO T-Beam V1.0 , V1.1, V1.2 (also variations with SX1262 and SX1268 LoRa Modules) and Supreme V3.
|
||||
- TTGO T-Beam V1.0 , V1.1, V1.2 (also variations with SX1262 and SX1268 LoRa Modules), Supreme V3 and T-Beam 1W.
|
||||
|
||||
- T-Deck Plus (and also regular T-Deck with/without GPS).
|
||||
|
||||
@@ -59,11 +59,16 @@ ____________________________________________________
|
||||
|
||||
- Wemos Lolin32 Oled + SX1278 DIY Version.
|
||||
|
||||
- RP2350 (Raspberry Pi Pico 2) + WIZnet W5500 Ethernet + Ebyte E22 LoRa Module, wired DIY version (see [Wiznet_5500_EVB_Pico2_E22P](https://github.com/cvaldess/Wiznet_5500_EVB_Pico2_E22P)).
|
||||
|
||||
- and many more...
|
||||
|
||||
<br />
|
||||
|
||||
# Timeline (Versions):
|
||||
- 2026-10-14 T-Beam 1W board added (with fan control and Tx over-temperature protection).
|
||||
- 2026-10-05 Fix for stored XSS in received packets, Wifi warning with bad password, date on Rx packets, mDNS kiss-tnc for phone apps, APRSPacketLib V1.0.10 update.
|
||||
- 2026-09-30 GPS baud rate auto-detection, CAD timeout (packet dropped after 10s of busy channel)
|
||||
- 2026-09-23 APRSPacketLib V1.0.7 update and many code cleaning with this.
|
||||
- 2026-09-17 Real APRS Symbols added to map and TNC2 output as a posibility in TNC mode.
|
||||
- 2026-08-16 New UI (Web) and also Live View over a Map to see Rx stations.
|
||||
|
||||
+4
-4
@@ -34,10 +34,10 @@ lib_deps =
|
||||
bblanchon/ArduinoJson @ 7.4.3
|
||||
jgromes/RadioLib @ 7.6.0
|
||||
knolleary/PubSubClient @ 2.8
|
||||
ESP32Async/AsyncTCP @ 3.4.10
|
||||
ESP32Async/ESPAsyncWebServer @ 3.11.1
|
||||
mikalhart/TinyGPSPlus @ 1.0.3
|
||||
richonguzman/APRSPacketLib @ 1.0.7
|
||||
ESP32Async/AsyncTCP @ 3.5.0
|
||||
ESP32Async/ESPAsyncWebServer @ 3.12.1
|
||||
mikalhart/TinyGPSPlus @ 1.1.0
|
||||
richonguzman/APRSPacketLib @ 1.0.10
|
||||
display_libs =
|
||||
adafruit/Adafruit GFX Library @ 1.12.6
|
||||
adafruit/Adafruit SSD1306 @ 2.5.17
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
"active": false,
|
||||
"messagesToRF": false,
|
||||
"objectsToRF": false,
|
||||
"is2Metadata": false,
|
||||
"server": "rotate.aprs2.net",
|
||||
"passcode": "XYZVW",
|
||||
"port": 14580,
|
||||
@@ -47,8 +48,8 @@
|
||||
"rxSignalBandwidth": 125000,
|
||||
"txActive": false,
|
||||
"txFreq": 433775000,
|
||||
"txSpreadingFactor": 9,
|
||||
"txCodingRate4": 7,
|
||||
"txSpreadingFactor": 12,
|
||||
"txCodingRate4": 5,
|
||||
"txSignalBandwidth": 125000,
|
||||
"power": 20,
|
||||
"cadActive": true
|
||||
|
||||
+242
-15
@@ -61,8 +61,17 @@ body{background:var(--msh-bg);color:var(--msh-text);font-family:"Inter",system-u
|
||||
#received-packets{max-width:none;padding-left:0;padding-right:0;}
|
||||
#received-packets .table{--bs-table-color:var(--msh-text);--bs-table-border-color:var(--msh-border);color:var(--msh-text);}
|
||||
#received-packets th{white-space:nowrap;}
|
||||
#received-packets td:nth-child(1),#received-packets td:nth-child(3),#received-packets td:nth-child(4){white-space:nowrap;}
|
||||
#received-packets td:nth-child(1),#received-packets td:nth-child(2),#received-packets td:nth-child(4),#received-packets td:nth-child(5){white-space:nowrap;}
|
||||
#received-packets th:nth-child(1){width:calc(10ch + 1rem);min-width:calc(10ch + 1rem);}
|
||||
#received-packets th:nth-child(2){width:calc(8ch + 1rem);min-width:calc(8ch + 1rem);}
|
||||
#received-packets th:nth-child(4){width:calc(4ch + 1rem);min-width:calc(4ch + 1rem);}
|
||||
#received-packets th:nth-child(5){width:calc(6ch + 1rem);min-width:calc(6ch + 1rem);}
|
||||
#received-packets td:nth-child(1),#received-packets td:nth-child(2),#received-packets td:nth-child(4),#received-packets td:nth-child(5){font-variant-numeric:tabular-nums;}
|
||||
#received-packets td:nth-child(3){overflow-wrap:anywhere;}
|
||||
@media(max-width:768px){.app-sidebar{width:60px;padding:12px 6px;}.side-link .label,.nav-group-label{display:none;}.app-main{padding:14px;}}
|
||||
/* phones: the fixed Date/Time/RSSI/SNR widths left Packet ~90 px wide (and made the page scroll sideways):
|
||||
each packet becomes two lines, date/time/RSSI/SNR on top and the packet across the full width below */
|
||||
@media(max-width:768px){#received-packets table,#received-packets tbody{display:block;}#received-packets thead{display:none;}#received-packets tr{display:flex;flex-wrap:wrap;column-gap:.6rem;row-gap:.15rem;padding:.6rem 0;border-bottom:var(--bs-border-width) solid var(--msh-border);}#received-packets td{border:0;padding:0;font-size:.8rem;color:var(--msh-text-dim);}#received-packets td:nth-child(3){flex-basis:100%;order:1;font-size:.95rem;color:var(--msh-text);}#received-packets td:nth-child(4)::after{content:" dBm";}#received-packets td:nth-child(5)::after{content:" dB";}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -186,6 +195,8 @@ body{background:var(--msh-bg);color:var(--msh-text);font-family:"Inter",system-u
|
||||
<button class="side-link" type="button" data-target="sec-maps"><span class="side-ico"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" viewBox="0 0 16 16"><path d="M15.817.113A.5.5 0 0 1 16 .5v14a.5.5 0 0 1-.402.49l-5 1a.5.5 0 0 1-.196 0L5.5 15.01l-4.902.98A.5.5 0 0 1 0 15.5v-14a.5.5 0 0 1 .402-.49l5-1a.5.5 0 0 1 .196 0L10.5.99l4.902-.98a.5.5 0 0 1 .415.103M10 1.91l-4-.8v12.98l4 .8zm1 12.98 4-.8V1.11l-4 .8zm-6-.8V1.11l-4 .8v12.98z"/></svg></span><span class="label">Map</span></button>
|
||||
<button class="side-link" type="button" id="rpToggle"><span class="side-ico"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M5 11.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5m-3 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2m0 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2m0 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2"/></svg></span><span class="label">Received Packets</span></button>
|
||||
<a href="/received-packets" id="rpDummy" style="display:none" aria-hidden="true"></a>
|
||||
<button class="side-link rp2350-only" type="button" data-target="sec-messages" style="display:none"><span class="side-ico"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" viewBox="0 0 16 16"><path d="M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm2-1a1 1 0 0 0-1 1v.217l7 4.2 7-4.2V4a1 1 0 0 0-1-1zm13 2.383-4.708 2.825L15 11.105zm-.034 6.876-5.64-3.471L8 9.583l-1.326-.795-5.64 3.47A1 1 0 0 0 2 13h12a1 1 0 0 0 .966-.741M1 11.105l4.708-2.897L1 5.383z"/></svg></span><span class="label">Messages</span></button>
|
||||
<button class="side-link rp2350-only" type="button" data-target="sec-ota" style="display:none"><span class="side-ico"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" viewBox="0 0 16 16"><path d="M8 2a5.53 5.53 0 0 0-3.594 1.342c-.766.66-1.321 1.52-1.464 2.383C1.266 6.095 0 7.555 0 9.318 0 11.366 1.708 13 3.781 13h8.906C14.502 13 16 11.57 16 9.773c0-1.636-1.242-2.969-2.834-3.194C12.923 3.999 10.69 2 8 2m2.354 5.146a.5.5 0 0 1-.708.708L8.5 6.707V10.5a.5.5 0 0 1-1 0V6.707L6.354 7.854a.5.5 0 1 1-.708-.708l2-2a.5.5 0 0 1 .708 0z"/></svg></span><span class="label">Firmware Update</span></button>
|
||||
<a class="side-link side-ota" href="/update"><span class="side-ico"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" viewBox="0 0 16 16"><path d="M8 2a5.53 5.53 0 0 0-3.594 1.342c-.766.66-1.321 1.52-1.464 2.383C1.266 6.095 0 7.555 0 9.318 0 11.366 1.708 13 3.781 13h8.906C14.502 13 16 11.57 16 9.773c0-1.636-1.242-2.969-2.834-3.194C12.923 3.999 10.69 2 8 2m2.354 5.146a.5.5 0 0 1-.708.708L8.5 6.707V10.5a.5.5 0 0 1-1 0V6.707L6.354 7.854a.5.5 0 1 1-.708-.708l2-2a.5.5 0 0 1 .708 0z"/></svg></span><span class="label">Update OTA</span></a>
|
||||
</aside>
|
||||
<main class="app-main">
|
||||
@@ -196,8 +207,9 @@ body{background:var(--msh-bg);color:var(--msh-text);font-family:"Inter",system-u
|
||||
<table class="table mt-4">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Date</th>
|
||||
<th scope="col">Time</th>
|
||||
<th scope="col">Frame</th>
|
||||
<th scope="col">Packet</th>
|
||||
<th scope="col">RSSI</th>
|
||||
<th scope="col">SNR</th>
|
||||
</tr>
|
||||
@@ -213,6 +225,102 @@ body{background:var(--msh-bg);color:var(--msh-text);font-family:"Inter",system-u
|
||||
<hr>
|
||||
</div>
|
||||
<div id="configuration">
|
||||
<section class="panel-section" id="sec-messages">
|
||||
<div class="row my-5 d-flex align-items-top">
|
||||
<div class="col-lg-10 col-sm-12">
|
||||
<h3>Send APRS Message</h3>
|
||||
<small>Send an APRS text message to another station. Tip: send <code>?APRSV</code>, <code>?APRSP</code>, <code>?APRSL</code> or <code>?APRSSR</code> to query another iGate.</small>
|
||||
<div class="row mt-4">
|
||||
<div class="col-lg-4 col-sm-12">
|
||||
<label for="message.to" class="form-label">To (callsign)</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="message.to"
|
||||
placeholder="EA4XXX-7"
|
||||
oninput="this.value = this.value.toUpperCase();"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-lg-8 col-sm-12">
|
||||
<label for="message.text" class="form-label">Message</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="message.text"
|
||||
placeholder="Hello world"
|
||||
maxlength="67"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-3 align-items-center">
|
||||
<div class="col-lg-3 col-6">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" id="message.viaRF" checked />
|
||||
<label class="form-check-label" for="message.viaRF">Send via RF</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4 col-6">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" id="message.viaTCP" />
|
||||
<label class="form-check-label" for="message.viaTCP">Send via APRS-IS (TCP)</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4 col-sm-12 mt-2 mt-lg-0">
|
||||
<button class="btn btn-primary form-control" type="button" id="send-message">Send message now</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h5 class="mt-5">Received messages</h5>
|
||||
<small>Messages addressed to this iGate's callsign. Refreshes every 10 seconds.</small>
|
||||
<table class="table mt-3">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Ago</th>
|
||||
<th scope="col">From</th>
|
||||
<th scope="col">Via</th>
|
||||
<th scope="col">Message</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="received-messages"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="panel-section" id="sec-ota">
|
||||
<div class="row my-5 d-flex align-items-top">
|
||||
<div class="col-lg-8 col-sm-12">
|
||||
<h3>Firmware Update (OTA)</h3>
|
||||
<small>Upload a new <code>firmware.bin</code> over the network. The device flashes it and reboots into the new firmware automatically.</small>
|
||||
<div class="alert alert-secondary mt-3 mb-0" id="ota.current">Current firmware: …</div>
|
||||
<div class="row mt-4">
|
||||
<div class="col-12">
|
||||
<label for="ota.file" class="form-label">Firmware file (firmware.bin)</label>
|
||||
<input type="file" class="form-control" id="ota.file" accept=".bin" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-3">
|
||||
<div class="col-lg-6 col-sm-12">
|
||||
<label for="ota.user" class="form-label">OTA user <small>(only if configured)</small></label>
|
||||
<input type="text" class="form-control" id="ota.user" placeholder="(optional)" />
|
||||
</div>
|
||||
<div class="col-lg-6 col-sm-12">
|
||||
<label for="ota.pass" class="form-label">OTA password</label>
|
||||
<input type="password" class="form-control" id="ota.pass" placeholder="(optional)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-3">
|
||||
<div class="col-lg-4 col-sm-12">
|
||||
<button class="btn btn-primary form-control" type="button" id="ota.upload">Upload firmware</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="progress mt-4 d-none" id="ota.progresswrap" style="height: 1.6rem;">
|
||||
<div class="progress-bar" id="ota.progress" role="progressbar" style="width: 0%;">0%</div>
|
||||
</div>
|
||||
<div id="ota.status" class="mt-3"></div>
|
||||
<small class="d-block mt-2 text-muted">Do not power off during the update. The connection will drop when the device reboots — that is normal.</small>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="panel-section" id="sec-maps">
|
||||
<div class="row my-5">
|
||||
<div class="col-12">
|
||||
@@ -284,7 +392,7 @@ body{background:var(--msh-bg);color:var(--msh-text);font-family:"Inter",system-u
|
||||
oninput="this.value = this.value.toUpperCase();"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12 mt-3">
|
||||
<div class="col-12 col-md-9 mt-3">
|
||||
<label
|
||||
for="beacon.comment"
|
||||
class="form-label"
|
||||
@@ -298,6 +406,30 @@ body{background:var(--msh-bg);color:var(--msh-text);font-family:"Inter",system-u
|
||||
placeholder=""
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12 col-md-3 mt-3">
|
||||
<label
|
||||
for="beacon.rfCommentEveryXBeacons"
|
||||
class="form-label"
|
||||
>RF Comment every</label
|
||||
>
|
||||
<div class="input-group">
|
||||
<input
|
||||
type="number"
|
||||
name="beacon.rfCommentEveryXBeacons"
|
||||
id="beacon.rfCommentEveryXBeacons"
|
||||
class="form-control"
|
||||
value="1"
|
||||
min="1"
|
||||
max="100"
|
||||
step="1"
|
||||
required
|
||||
/>
|
||||
<span class="input-group-text"
|
||||
>beacons
|
||||
</span>
|
||||
</div>
|
||||
<small>(1 = every beacon, RF only)</small>
|
||||
</div>
|
||||
<div class="col-12 mt-3">
|
||||
<label
|
||||
for="beacon.path"
|
||||
@@ -570,6 +702,63 @@ body{background:var(--msh-bg);color:var(--msh-text);font-family:"Inter",system-u
|
||||
</section>
|
||||
<section class="panel-section" id="sec-connectivity">
|
||||
|
||||
<div class="row my-5 align-items-top d-none" id="ip-config-section">
|
||||
<div class="col-lg-3 col-sm-12">
|
||||
<h5>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="20"
|
||||
height="20"
|
||||
fill="currentColor"
|
||||
class="bi bi-diagram-3"
|
||||
viewBox="0 0 16 16"
|
||||
>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
d="M6 3.5A1.5 1.5 0 0 1 7.5 2h1A1.5 1.5 0 0 1 10 3.5v1A1.5 1.5 0 0 1 8.5 6v1H14a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-1 0V8h-5v.5a.5.5 0 0 1-1 0V8h-5v.5a.5.5 0 0 1-1 0v-1A.5.5 0 0 1 2 7h5.5V6A1.5 1.5 0 0 1 6 4.5zM8.5 5a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5zM0 11.5A1.5 1.5 0 0 1 1.5 10h1A1.5 1.5 0 0 1 4 11.5v1A1.5 1.5 0 0 1 2.5 14h-1A1.5 1.5 0 0 1 0 12.5zm1.5-.5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5zm4.5.5A1.5 1.5 0 0 1 7.5 10h1a1.5 1.5 0 0 1 1.5 1.5v1A1.5 1.5 0 0 1 8.5 14h-1A1.5 1.5 0 0 1 6 12.5zm1.5-.5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5zm4.5.5a1.5 1.5 0 0 1 1.5-1.5h1a1.5 1.5 0 0 1 1.5 1.5v1a1.5 1.5 0 0 1-1.5 1.5h-1a1.5 1.5 0 0 1-1.5-1.5zm1.5-.5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5z"
|
||||
/>
|
||||
</svg>
|
||||
IP Config
|
||||
</h5>
|
||||
<small>Wired Ethernet: choose DHCP (automatic) or a static IP address.</small>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-12">
|
||||
<div class="form-check form-switch">
|
||||
<input
|
||||
type="checkbox"
|
||||
name="network.dhcp"
|
||||
id="network.dhcp"
|
||||
class="form-check-input"
|
||||
checked
|
||||
/>
|
||||
<label for="network.dhcp" class="form-label">Use DHCP (automatic IP)</label>
|
||||
</div>
|
||||
<div id="static-ip-config" class="mt-3" style="display: none;">
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-sm-12">
|
||||
<label for="network.ip" class="form-label">IP Address</label>
|
||||
<input type="text" class="form-control" name="network.ip" id="network.ip" placeholder="192.168.1.50" />
|
||||
</div>
|
||||
<div class="col-lg-6 col-sm-12">
|
||||
<label for="network.gateway" class="form-label">Default Gateway</label>
|
||||
<input type="text" class="form-control" name="network.gateway" id="network.gateway" placeholder="192.168.1.1" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-3">
|
||||
<div class="col-lg-6 col-sm-12">
|
||||
<label for="network.subnet" class="form-label">Subnet Mask</label>
|
||||
<input type="text" class="form-control" name="network.subnet" id="network.subnet" placeholder="255.255.255.0" />
|
||||
</div>
|
||||
<div class="col-lg-6 col-sm-12">
|
||||
<label for="network.dns" class="form-label">DNS Server(s) <small>(space-separated for multiple)</small></label>
|
||||
<input type="text" class="form-control" name="network.dns" id="network.dns" placeholder="8.8.8.8 1.1.1.1" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr id="ip-config-hr" style="display:none">
|
||||
|
||||
|
||||
<div class="row my-5 d-flex align-items-top">
|
||||
<div class="col-lg-3 col-sm-12">
|
||||
@@ -906,6 +1095,22 @@ body{background:var(--msh-bg);color:var(--msh-text);font-family:"Inter",system-u
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="form-check form-switch">
|
||||
<input
|
||||
type="checkbox"
|
||||
name="aprs_is.is2Metadata"
|
||||
id="aprs_is.is2Metadata"
|
||||
class="form-check-input"
|
||||
/>
|
||||
<label
|
||||
for="aprs_is.is2Metadata"
|
||||
class="form-label"
|
||||
>Send IS2 Metadata
|
||||
(RSSI/SNR) to APRS-IS</label
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<label
|
||||
for="aprs_is.server"
|
||||
@@ -1282,10 +1487,10 @@ body{background:var(--msh-bg);color:var(--msh-text);font-family:"Inter",system-u
|
||||
<option value="6">SF6</option>
|
||||
<option value="7">SF7</option>
|
||||
<option value="8">SF8</option>
|
||||
<option value="9" selected>SF9</option>
|
||||
<option value="9">SF9</option>
|
||||
<option value="10">SF10</option>
|
||||
<option value="11">SF11</option>
|
||||
<option value="12">SF12 - Highest sensitivity</option>
|
||||
<option value="12" selected>SF12 - Highest sensitivity</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-6 mt-3">
|
||||
@@ -1304,10 +1509,10 @@ body{background:var(--msh-bg);color:var(--msh-text);font-family:"Inter",system-u
|
||||
<option value="6">SF6</option>
|
||||
<option value="7">SF7</option>
|
||||
<option value="8">SF8</option>
|
||||
<option value="9" selected>SF9</option>
|
||||
<option value="9">SF9</option>
|
||||
<option value="10">SF10</option>
|
||||
<option value="11">SF11</option>
|
||||
<option value="12">SF12 - Highest sensitivity</option>
|
||||
<option value="12" selected>SF12 - Highest sensitivity</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-6 mt-3">
|
||||
@@ -1322,9 +1527,9 @@ body{background:var(--msh-bg);color:var(--msh-text);font-family:"Inter",system-u
|
||||
id="lora.rxCodingRate4"
|
||||
required=""
|
||||
>
|
||||
<option value="5">5</option>
|
||||
<option value="5" selected>5</option>
|
||||
<option value="6">6</option>
|
||||
<option value="7" selected>7</option>
|
||||
<option value="7">7</option>
|
||||
<option value="8">8</option>
|
||||
</select>
|
||||
</div>
|
||||
@@ -1340,9 +1545,9 @@ body{background:var(--msh-bg);color:var(--msh-text);font-family:"Inter",system-u
|
||||
id="lora.txCodingRate4"
|
||||
required=""
|
||||
>
|
||||
<option value="5">5</option>
|
||||
<option value="5" selected>5</option>
|
||||
<option value="6">6</option>
|
||||
<option value="7" selected>7</option>
|
||||
<option value="7">7</option>
|
||||
<option value="8">8</option>
|
||||
</select>
|
||||
</div>
|
||||
@@ -1390,7 +1595,7 @@ body{background:var(--msh-bg);color:var(--msh-text);font-family:"Inter",system-u
|
||||
<label
|
||||
for="lora.power"
|
||||
class="form-label">
|
||||
Power
|
||||
Power <small>(SX127X Max 20dBm / SX126X Max 22dBm)</small>
|
||||
</label>
|
||||
<div class="input-group">
|
||||
<input
|
||||
@@ -1398,8 +1603,8 @@ body{background:var(--msh-bg);color:var(--msh-text);font-family:"Inter",system-u
|
||||
name="lora.power"
|
||||
id="lora.power"
|
||||
placeholder="20"
|
||||
min="0"
|
||||
max="20"
|
||||
min="2"
|
||||
max="22"
|
||||
step="1"
|
||||
class="form-control"
|
||||
required=""
|
||||
@@ -2323,6 +2528,28 @@ body{background:var(--msh-bg);color:var(--msh-text);font-family:"Inter",system-u
|
||||
>:
|
||||
LoRa APRS iGate Firmware.
|
||||
</p>
|
||||
<p class="mb-1 small rp2350-only" style="display: none">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="16"
|
||||
height="16"
|
||||
fill="currentColor"
|
||||
class="bi bi-cc-circle-fill"
|
||||
viewBox="0 0 16 16"
|
||||
>
|
||||
<path
|
||||
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0M5.408 5.89c.681 0 1.138.47 1.187 1.107h1.147v-.11c-.053-1.187-1.024-2-2.343-2-1.604 0-2.518 1.05-2.518 2.751v.747c0 1.7.906 2.73 2.518 2.73 1.314 0 2.285-.792 2.343-1.939v-.114H6.595c-.049.615-.497 1.05-1.187 1.05-.84 0-1.318-.62-1.318-1.727v-.742c0-1.112.488-1.754 1.318-1.754Zm5.404 0c.68 0 1.138.47 1.186 1.107h1.147v-.11c-.053-1.187-1.024-2-2.342-2-1.604 0-2.518 1.05-2.518 2.751v.747c0 1.7.905 2.73 2.518 2.73 1.314 0 2.285-.792 2.342-1.939v-.114h-1.147c-.048.615-.496 1.05-1.186 1.05-.84 0-1.319-.62-1.319-1.727v-.742c0-1.112.488-1.754 1.319-1.754Z"
|
||||
/>
|
||||
</svg>
|
||||
2026
|
||||
<b
|
||||
><a
|
||||
href="https://ea4glo.cvaldess.com"
|
||||
target="_blank"
|
||||
>EA4GLO</a
|
||||
></b
|
||||
>: RP2350 port.
|
||||
</p>
|
||||
<br />
|
||||
<p class="mt-4 small">
|
||||
Support this project<br />
|
||||
@@ -2436,7 +2663,7 @@ body{background:var(--msh-bg);color:var(--msh-text);font-family:"Inter",system-u
|
||||
if(window.fetchReceivedPackets)window.fetchReceivedPackets();
|
||||
});
|
||||
var bi=document.getElementById("buildInfo");
|
||||
if(bi){var h=bi.innerHTML; if(/Version date/i.test(h)){h=h.replace(/(<br\s*\/?>)[\s\S]*?(?=Version date)/i,"$1");bi.innerHTML="Board / Environment = "+h;}}
|
||||
if(bi){var h=bi.innerHTML; if(/Version date/i.test(h)){h=h.replace(/(<br\s*\/?>)[\s\S]*?(?=Version: )/i,"$1");bi.innerHTML="Board / Environment = "+h;}}
|
||||
if(window.loadReceivedPackets){var _o=window.loadReceivedPackets;window.loadReceivedPackets=function(p){if(p&&p.slice){p=p.slice().reverse();}return _o(p);};}
|
||||
})();
|
||||
</script>
|
||||
+303
-14
@@ -36,11 +36,19 @@ document.querySelector("input[type=file]").onchange = function () {
|
||||
};
|
||||
};
|
||||
|
||||
function fetchSettings() {
|
||||
function fetchSettings(retries = 2) {
|
||||
fetch("/configuration.json")
|
||||
.then((response) => response.json())
|
||||
.then((settings) => {
|
||||
loadSettings(settings);
|
||||
}, (err) => {
|
||||
// fetch or JSON failed: a board short of sockets (RP2350 + W5100S) refuses
|
||||
// connections while it serves another one, so try again before giving up
|
||||
if (retries > 0) {
|
||||
setTimeout(() => fetchSettings(retries - 1), 1000);
|
||||
return;
|
||||
}
|
||||
throw err;
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
@@ -56,6 +64,7 @@ function loadSettings(settings) {
|
||||
document.getElementById("callsign").value = settings.callsign;
|
||||
document.getElementById("tacticalCallsign").value = settings.tacticalCallsign;
|
||||
document.getElementById("beacon.comment").value = settings.beacon.comment;
|
||||
document.getElementById("beacon.rfCommentEveryXBeacons").value = settings.beacon.rfCommentEveryXBeacons;
|
||||
document.getElementById("beacon.path").value = settings.beacon.path;
|
||||
document.getElementById("beacon.symbol").value = settings.beacon.symbol;
|
||||
document.getElementById("beacon.overlay").value = settings.beacon.overlay;
|
||||
@@ -102,6 +111,7 @@ function loadSettings(settings) {
|
||||
document.getElementById("aprs_is.active").checked = settings.aprs_is.active;
|
||||
document.getElementById("aprs_is.messagesToRF").checked = settings.aprs_is.messagesToRF;
|
||||
document.getElementById("aprs_is.objectsToRF").checked = settings.aprs_is.objectsToRF;
|
||||
document.getElementById("aprs_is.is2Metadata").checked = settings.aprs_is.is2Metadata;
|
||||
document.getElementById("aprs_is.server").value = settings.aprs_is.server;
|
||||
document.getElementById("aprs_is.port").value = settings.aprs_is.port;
|
||||
document.getElementById("aprs_is.filter").value = settings.aprs_is.filter;
|
||||
@@ -109,6 +119,7 @@ function loadSettings(settings) {
|
||||
APRSISCheckbox.checked = settings.aprs_is.active;
|
||||
APRSISGateMessages.disabled = !APRSISCheckbox.checked;
|
||||
APRSISGateObjects.disabled = !APRSISCheckbox.checked;
|
||||
APRSISMetadata.disabled = !APRSISCheckbox.checked;
|
||||
APRSISServer.disabled = !APRSISCheckbox.checked;
|
||||
APRSISPort.disabled = !APRSISCheckbox.checked;
|
||||
APRSISPasscode.disabled = !APRSISCheckbox.checked;
|
||||
@@ -277,7 +288,8 @@ function loadSettings(settings) {
|
||||
document.getElementById("ntp.server").value = settings.ntp.server;
|
||||
document.getElementById("ntp.gmtCorrection").value = settings.ntp.gmtCorrection;
|
||||
|
||||
clampOutOfRangeInputs();
|
||||
applyWiredBuildUi(settings); // RP2350 + Ethernet build (see bottom of this file)
|
||||
clampOutOfRangeInputs(); // keep the form submittable (see bottom of this file)
|
||||
|
||||
updateImage();
|
||||
}
|
||||
@@ -349,6 +361,7 @@ StatusCheckbox.addEventListener("change", function() {
|
||||
const APRSISCheckbox = document.querySelector('input[name="aprs_is.active"]');
|
||||
const APRSISGateMessages = document.querySelector('input[name="aprs_is.messagesToRF"]');
|
||||
const APRSISGateObjects = document.querySelector('input[name="aprs_is.objectsToRF"]');
|
||||
const APRSISMetadata = document.querySelector('input[name="aprs_is.is2Metadata"]');
|
||||
const APRSISServer = document.querySelector('input[name="aprs_is.server"]');
|
||||
const APRSISPort = document.querySelector('input[name="aprs_is.port"]');
|
||||
const APRSISPasscode = document.querySelector('input[name="aprs_is.passcode"]');
|
||||
@@ -356,6 +369,7 @@ const APRSISFilter = document.querySelector('input[name="aprs_is.fi
|
||||
APRSISCheckbox.addEventListener("change", function() {
|
||||
APRSISGateMessages.disabled = !this.checked;
|
||||
APRSISGateObjects.disabled = !this.checked;
|
||||
APRSISMetadata.disabled = !this.checked;
|
||||
APRSISServer.disabled = !this.checked;
|
||||
APRSISPort.disabled = !this.checked;
|
||||
APRSISPasscode.disabled = !this.checked;
|
||||
@@ -606,12 +620,11 @@ function loadReceivedPackets(packets) {
|
||||
packets.forEach((packet) => {
|
||||
const element = document.createElement("tr");
|
||||
|
||||
element.innerHTML = `
|
||||
<td>${packet.rxTime}</td>
|
||||
<td>${packet.packet}</td>
|
||||
<td>${packet.RSSI}</td>
|
||||
<td>${packet.SNR}</td>
|
||||
`;
|
||||
['rxDate', 'rxTime', 'packet', 'RSSI', 'SNR'].forEach((field) => {
|
||||
const cell = document.createElement("td");
|
||||
cell.textContent = String(packet[field]);
|
||||
element.appendChild(cell);
|
||||
});
|
||||
|
||||
container.appendChild(element);
|
||||
})
|
||||
@@ -654,6 +667,15 @@ let mapTileErrShown = false;
|
||||
let iGateLatLng = null;
|
||||
let mapAutoFitDone = false;
|
||||
|
||||
function escapeHtml(value) { // shows received data as text inside HTML strings (map popups / icons)
|
||||
return String(value ?? "")
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'");
|
||||
}
|
||||
|
||||
function setMapMessage(text) {
|
||||
const el = document.getElementById("map");
|
||||
if (el) {
|
||||
@@ -832,7 +854,7 @@ function getAprsSymbolIcon(symbol, callsign = "") {
|
||||
-1px 1px 0 #fff,
|
||||
1px 1px 0 #fff;
|
||||
pointer-events:none;
|
||||
">${callsign}</span>
|
||||
">${escapeHtml(callsign)}</span>
|
||||
</div>
|
||||
`,
|
||||
iconSize: [24, 24],
|
||||
@@ -934,12 +956,12 @@ function loadMapStations(stations) {
|
||||
(stations || []).forEach((s) => {
|
||||
if (s.lat === 0 && s.lon === 0) return; // descartar estaciones sin fix
|
||||
|
||||
const popup = `<b>${s.callsign}</b>`
|
||||
+ (s.lastHeard ? `<br>Last: ${s.lastHeard}` : "")
|
||||
const popup = `<b>${escapeHtml(s.callsign)}</b>`
|
||||
+ (s.lastHeard ? `<br>Last: ${escapeHtml(s.lastHeard)}` : "")
|
||||
+ `<br>RSSI ${s.RSSI} / SNR ${s.SNR}`
|
||||
+ `<br>Packets: ${s.count}`
|
||||
+ `<br><b>${describeMapPath(s)}</b>`
|
||||
+ (s.path ? `<br><small>Path: ${s.path}</small>` : "");
|
||||
+ `<br><b>${escapeHtml(describeMapPath(s))}</b>`
|
||||
+ (s.path ? `<br><small>Path: ${escapeHtml(s.path)}</small>` : "");
|
||||
|
||||
const aprsIcon =
|
||||
getAprsSymbolIcon(s.symbol, s.callsign);
|
||||
@@ -1107,6 +1129,273 @@ window.showMap = function () {
|
||||
}
|
||||
|
||||
|
||||
/* --------------------------------------------------------------- wired (RP2350) build
|
||||
* The RP2350 + WIZnet W5500 port serves this same page, but that board has no
|
||||
* WiFi, no display and no ElegantOTA page, and it adds a wired IP configuration,
|
||||
* an APRS "Messages" view and its own OTA uploader. All of it is feature-detected
|
||||
* from the configuration ("network" only exists on the wired build), so on ESP32
|
||||
* boards nothing below changes the UI.
|
||||
*/
|
||||
function isWiredBuild(settings) {
|
||||
return !!(settings && settings.network);
|
||||
}
|
||||
|
||||
function markUnavailable(id, note) {
|
||||
const el = document.getElementById(id);
|
||||
if (!el) return;
|
||||
el.disabled = true;
|
||||
el.title = note || "Not available on this board";
|
||||
}
|
||||
|
||||
// Replace the description of the settings block a control belongs to.
|
||||
function describeSection(id, html) {
|
||||
const el = document.getElementById(id);
|
||||
if (!el) return;
|
||||
const row = el.closest(".row.my-5") || el.closest(".row");
|
||||
if (!row) return;
|
||||
const small = row.querySelector("small");
|
||||
if (small && !small.dataset.wiredNote) {
|
||||
small.innerHTML = html;
|
||||
small.dataset.wiredNote = "1";
|
||||
}
|
||||
}
|
||||
|
||||
function applyWiredBuildUi(settings) {
|
||||
if (!isWiredBuild(settings)) return;
|
||||
|
||||
// --- wired IP configuration (DHCP or static), shown only on this build
|
||||
const net = settings.network;
|
||||
document.getElementById("network.dhcp").checked = net.dhcp;
|
||||
document.getElementById("network.ip").value = net.ip || "";
|
||||
document.getElementById("network.gateway").value = net.gateway || "";
|
||||
document.getElementById("network.subnet").value = net.subnet || "255.255.255.0";
|
||||
document.getElementById("network.dns").value = net.dns || "";
|
||||
document.getElementById("ip-config-section").classList.remove("d-none"); // d-flex would override an inline display:none (!important), so the row hides with d-none
|
||||
document.getElementById("ip-config-hr").style.display = "";
|
||||
document.getElementById("static-ip-config").style.display = net.dhcp ? "none" : "";
|
||||
|
||||
// --- sidebar: this build has its own Messages + OTA views, and no ElegantOTA;
|
||||
// the footer credits the port
|
||||
document.querySelectorAll(".rp2350-only").forEach(function (el) {
|
||||
el.style.display = "";
|
||||
});
|
||||
const elegantOta = document.querySelector(".side-link.side-ota");
|
||||
if (elegantOta) elegantOta.style.display = "none";
|
||||
|
||||
// --- APRS-IS -> RF gating is not ported: this build is a receive-only iGate (qAO).
|
||||
// Kept disabled when "Enable APRS-IS connection" is toggled, too.
|
||||
const disableGateToRf = function () {
|
||||
["aprs_is.messagesToRF", "aprs_is.objectsToRF"].forEach(function (id) {
|
||||
const el = document.getElementById(id);
|
||||
if (el) el.checked = false;
|
||||
markUnavailable(id, "Not available on this board: it only gates RF to APRS-IS");
|
||||
});
|
||||
};
|
||||
disableGateToRf();
|
||||
document.getElementById("aprs_is.active").addEventListener("change", disableGateToRf);
|
||||
describeSection("aprs_is.active",
|
||||
"Enter your APRS-IS server and credentials.<br><br>This board only gates RF → APRS-IS "
|
||||
+ "(receive-only iGate): <b>Gate APRS-IS Messages / Objects to RF</b> are not available.");
|
||||
|
||||
// --- WiFi: not present on this board
|
||||
["wifi.autoAP.enabled", "wifi.autoAP.password", "wifi.autoAP.timeout"].forEach(function (id) {
|
||||
markUnavailable(id, "This board connects over Ethernet, it has no WiFi");
|
||||
});
|
||||
const addAp = document.querySelector('[data-bs-target="#add-ap"]');
|
||||
if (addAp) addAp.disabled = true;
|
||||
describeSection("wifi.autoAP.enabled", "<b>Not available</b> — this board connects via Ethernet (W5500), it has no WiFi.");
|
||||
|
||||
// --- Display: headless iGate
|
||||
["display.alwaysOn", "display.turn180", "display.timeout"].forEach(function (id) {
|
||||
markUnavailable(id, "Headless build, no display");
|
||||
});
|
||||
describeSection("display.alwaysOn", "<b>Not available</b> — this is a headless iGate (no display).");
|
||||
|
||||
// --- Battery: only the internal (VSYS) reading exists here
|
||||
["battery.monitorInternalVoltage", "battery.internalSleepVoltage", "battery.sendExternalVoltage",
|
||||
"battery.useExternalI2CSensor", "battery.monitorExternalVoltage", "battery.externalSleepVoltage",
|
||||
"battery.externalVoltagePin", "battery.voltageDividerR1", "battery.voltageDividerR2"].forEach(function (id) {
|
||||
markUnavailable(id, "Needs hardware this iGate does not have");
|
||||
});
|
||||
describeSection("battery.sendInternalVoltage",
|
||||
"Supply-voltage (VSYS) monitor.<br><br>Only <b>Send Internal Voltage</b> (adds <code>Batt=</code> to the beacon) "
|
||||
+ "and <b>Send Voltage As Telemetry</b> are available — the external-voltage / health-sleep options need "
|
||||
+ "hardware this iGate does not have and are disabled.");
|
||||
}
|
||||
|
||||
const dhcpCheckbox = document.getElementById("network.dhcp");
|
||||
if (dhcpCheckbox) {
|
||||
dhcpCheckbox.addEventListener("change", function () {
|
||||
document.getElementById("static-ip-config").style.display = this.checked ? "none" : "";
|
||||
});
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------- Messages view */
|
||||
let receivedMessagesTimer = null;
|
||||
|
||||
function loadReceivedMessages() {
|
||||
fetch("/messages.json")
|
||||
.then((r) => r.json())
|
||||
.then((msgs) => {
|
||||
const tbody = document.getElementById("received-messages");
|
||||
if (!tbody) return;
|
||||
if (!msgs.length) {
|
||||
tbody.innerHTML = '<tr><td colspan="4" class="text-muted">No messages received yet.</td></tr>';
|
||||
return;
|
||||
}
|
||||
tbody.innerHTML = msgs.map((m) => {
|
||||
const ago = m.age < 60 ? m.age + "s" : Math.floor(m.age / 60) + "m";
|
||||
const esc = (t) => t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
||||
return "<tr><td>" + ago + "</td><td>" + esc(m.from) + "</td><td>" + esc(m.via || "") + "</td><td>" + esc(m.text) + "</td></tr>";
|
||||
}).join("");
|
||||
})
|
||||
.catch((err) => console.error("Failed to load messages", err));
|
||||
}
|
||||
|
||||
const sendMessageButton = document.getElementById("send-message");
|
||||
if (sendMessageButton) {
|
||||
sendMessageButton.addEventListener("click", function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const to = document.getElementById("message.to").value.trim();
|
||||
const text = document.getElementById("message.text").value.trim();
|
||||
const viaRF = document.getElementById("message.viaRF").checked;
|
||||
const viaTCP = document.getElementById("message.viaTCP").checked;
|
||||
if (!to || !text) {
|
||||
showToast("Enter both a destination callsign and a message.");
|
||||
return;
|
||||
}
|
||||
if (!viaRF && !viaTCP) {
|
||||
showToast("Pick at least one path: RF and/or APRS-IS.");
|
||||
return;
|
||||
}
|
||||
|
||||
const params = "to=" + encodeURIComponent(to) + "&text=" + encodeURIComponent(text)
|
||||
+ "&rf=" + (viaRF ? "1" : "0") + "&tcp=" + (viaTCP ? "1" : "0");
|
||||
// the iGate answers with what really went out, e.g. "queued (RF); not sent: APRS-IS (not connected)"
|
||||
fetch("/action?type=send-message&" + params, { method: "POST" })
|
||||
.then((r) => r.text().then((reply) => {
|
||||
showToast("Message to <b>" + escapeHtml(to) + "</b>: " + escapeHtml(reply) + ".");
|
||||
if (r.ok) document.getElementById("message.text").value = "";
|
||||
}))
|
||||
.catch(() => showToast("Could not reach the iGate: message not sent."));
|
||||
});
|
||||
}
|
||||
|
||||
const messagesLink = document.querySelector('.side-link[data-target="sec-messages"]');
|
||||
if (messagesLink) {
|
||||
messagesLink.addEventListener("click", function () {
|
||||
loadReceivedMessages();
|
||||
if (!receivedMessagesTimer) {
|
||||
receivedMessagesTimer = setInterval(function () { // refresh only while visible
|
||||
const section = document.getElementById("sec-messages");
|
||||
if (section && section.classList.contains("active")) loadReceivedMessages();
|
||||
}, 10000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ OTA (firmware update) */
|
||||
let otaPrevBuild = "";
|
||||
|
||||
function loadOtaStatus() {
|
||||
const el = document.getElementById("ota.current");
|
||||
if (!el) return;
|
||||
fetch("/status", { cache: "no-store" })
|
||||
.then((r) => r.text())
|
||||
.then((text) => { otaPrevBuild = text.trim(); el.innerHTML = "Current firmware: <b>" + otaPrevBuild + "</b>"; })
|
||||
.catch(() => { el.textContent = "Current firmware: (could not read /status)"; });
|
||||
}
|
||||
|
||||
// after an update: poll /status until the device is back, then confirm
|
||||
function waitForReboot(prev, attempt) {
|
||||
attempt = attempt || 0;
|
||||
const status = document.getElementById("ota.status");
|
||||
const el = document.getElementById("ota.current");
|
||||
if (attempt > 25) {
|
||||
status.innerHTML = '<span class="text-warning">Device did not respond after the update — please check it manually.</span>';
|
||||
return;
|
||||
}
|
||||
const controller = new AbortController();
|
||||
const t = setTimeout(() => controller.abort(), 1500);
|
||||
fetch("/status", { cache: "no-store", signal: controller.signal })
|
||||
.then((r) => r.text())
|
||||
.then((text) => {
|
||||
clearTimeout(t);
|
||||
const now = text.trim();
|
||||
el.innerHTML = "Current firmware: <b>" + now + "</b>";
|
||||
if (now !== prev) {
|
||||
status.innerHTML = '<span class="text-success"><b>✓ Update complete.</b> Now running the new firmware.</span>';
|
||||
} else {
|
||||
status.innerHTML = '<span class="text-success"><b>✓ Device is back online</b> (firmware version unchanged).</span>';
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
clearTimeout(t);
|
||||
status.textContent = "Waiting for the device to reboot... (" + (attempt + 1) + ")";
|
||||
setTimeout(() => waitForReboot(prev, attempt + 1), 2000);
|
||||
});
|
||||
}
|
||||
|
||||
const otaLink = document.querySelector('.side-link[data-target="sec-ota"]');
|
||||
if (otaLink) otaLink.addEventListener("click", loadOtaStatus);
|
||||
|
||||
const otaUploadButton = document.getElementById("ota.upload");
|
||||
if (otaUploadButton) {
|
||||
otaUploadButton.addEventListener("click", function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const file = document.getElementById("ota.file").files[0];
|
||||
if (!file) { showToast("Pick a firmware.bin file first."); return; }
|
||||
|
||||
const user = document.getElementById("ota.user").value.trim();
|
||||
const pass = document.getElementById("ota.pass").value;
|
||||
const wrap = document.getElementById("ota.progresswrap");
|
||||
const bar = document.getElementById("ota.progress");
|
||||
const status = document.getElementById("ota.status");
|
||||
|
||||
wrap.classList.remove("d-none");
|
||||
bar.style.width = "0%"; bar.textContent = "0%";
|
||||
status.textContent = "Uploading " + file.name + " (" + file.size + " bytes)...";
|
||||
|
||||
let bodySent = false;
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "/update", true);
|
||||
if (user) xhr.setRequestHeader("Authorization", "Basic " + btoa(user + ":" + pass));
|
||||
|
||||
xhr.upload.onprogress = function (ev) {
|
||||
if (ev.lengthComputable) {
|
||||
const pct = Math.round(ev.loaded * 100 / ev.total);
|
||||
bar.style.width = pct + "%"; bar.textContent = pct + "%";
|
||||
}
|
||||
};
|
||||
xhr.upload.onload = function () { bodySent = true; };
|
||||
|
||||
xhr.onload = function () {
|
||||
if (xhr.status === 200) {
|
||||
bar.style.width = "100%"; bar.textContent = "100%";
|
||||
status.innerHTML = "Update staged — waiting for the device to reboot...";
|
||||
setTimeout(() => waitForReboot(otaPrevBuild, 0), 4000);
|
||||
} else if (xhr.status === 401) {
|
||||
status.innerHTML = '<span class="text-danger">Unauthorized — check the OTA user/password.</span>';
|
||||
} else {
|
||||
status.innerHTML = '<span class="text-danger">Update failed: ' + xhr.status + " " + xhr.responseText + "</span>";
|
||||
}
|
||||
};
|
||||
xhr.onerror = function () {
|
||||
if (bodySent) { // socket dropped after the full upload = device rebooting
|
||||
bar.style.width = "100%"; bar.textContent = "100%";
|
||||
status.innerHTML = "Update sent — waiting for the device to reboot...";
|
||||
setTimeout(() => waitForReboot(otaPrevBuild, 0), 4000);
|
||||
} else {
|
||||
status.innerHTML = '<span class="text-danger">Upload failed (connection error before the firmware was fully sent).</span>';
|
||||
}
|
||||
};
|
||||
xhr.send(file);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------- keeping the form submittable
|
||||
* A control that fails HTML5 validation blocks the whole form, and when it sits in
|
||||
* a panel that is not the visible one the browser cannot show its bubble either:
|
||||
@@ -1171,4 +1460,4 @@ form.addEventListener("invalid", function (event) {
|
||||
el.scrollIntoView({ block: "center", behavior: "smooth" });
|
||||
}, 0);
|
||||
}
|
||||
}, true);
|
||||
}, true);
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
double latitude;
|
||||
double longitude;
|
||||
String comment;
|
||||
int rfCommentEveryXBeacons;
|
||||
int interval;
|
||||
String overlay;
|
||||
String symbol;
|
||||
@@ -64,6 +65,7 @@ public:
|
||||
String filter;
|
||||
bool messagesToRF;
|
||||
bool objectsToRF;
|
||||
bool is2Metadata;
|
||||
};
|
||||
|
||||
class DIGI {
|
||||
@@ -171,6 +173,15 @@ public:
|
||||
bool beaconOverMqtt;
|
||||
};
|
||||
|
||||
class NETWORK { // IP configuration (Ethernet boards)
|
||||
public:
|
||||
bool dhcp; // true = DHCP, false = static IP below
|
||||
String ip;
|
||||
String gateway;
|
||||
String subnet;
|
||||
String dns; // one or more servers, space/comma-separated
|
||||
};
|
||||
|
||||
class Configuration {
|
||||
public:
|
||||
String callsign;
|
||||
@@ -197,6 +208,7 @@ public:
|
||||
NTP ntp;
|
||||
REMOTE_MANAGEMENT remoteManagement;
|
||||
MQTT mqtt;
|
||||
NETWORK network;
|
||||
|
||||
void setup();
|
||||
void setDefaultValues();
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
namespace GPS_Utils {
|
||||
|
||||
String getiGateLoRaBeaconPacket();
|
||||
void generateBeacons();
|
||||
String buildDistanceAndComment(float latitude, float longitude, const String& comment);
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
namespace LoRa_Utils {
|
||||
|
||||
int validPower(int requested);
|
||||
void setup();
|
||||
void sendNewPacket(const String& newPacket);
|
||||
String receivePacketFromSleep();
|
||||
|
||||
@@ -43,9 +43,12 @@ private:
|
||||
|
||||
String _hostName = "";
|
||||
std::vector<WiFiNetwork> _wifiNetworks;
|
||||
volatile uint8_t _lastWiFiDisconnectReason = 0;
|
||||
String _wifiAuthFailSSID = "";
|
||||
|
||||
int _findWiFiNetworkIndex(const String& ssid) const;
|
||||
bool _connectWiFi(const WiFiNetwork& network);
|
||||
bool _isWiFiAuthFailure() const;
|
||||
void _processAPTimeout();
|
||||
void _onNetworkEvent(arduino_event_id_t event, arduino_event_info_t /*info*/);
|
||||
|
||||
@@ -75,6 +78,7 @@ public:
|
||||
bool disconnectWiFi();
|
||||
String getWiFiSSID() const;
|
||||
String getWiFiAPSSID() const;
|
||||
String getWiFiAuthFailSSID() const;
|
||||
IPAddress getWiFiIP() const;
|
||||
IPAddress getWiFiAPIP() const;
|
||||
wifi_mode_t getWiFiMode() const;
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace NTP_Utils {
|
||||
bool setup();
|
||||
void update();
|
||||
String getFormatedTime();
|
||||
String getFormatedDate();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
|
||||
namespace QUERY_Utils {
|
||||
|
||||
String process(const String& query, const String& station, bool queryFromAPRSIS, bool thirdParty);
|
||||
bool isQuery(const String& message);
|
||||
String process(const String& query, const String& station, bool queryFromAPRSIS, bool thirdParty);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/* Copyright (C) 2026 Ricardo Guzman - CA2RXU
|
||||
*
|
||||
* This file is part of LoRa APRS iGate.
|
||||
*
|
||||
* LoRa APRS iGate is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* LoRa APRS iGate is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with LoRa APRS iGate. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Fan / thermal control adapted from KJ7NYE's LoRa_FieldOps_APRS_Tracker (GPLv3)
|
||||
|
||||
#ifndef THERMAL_UTILS_H_
|
||||
#define THERMAL_UTILS_H_
|
||||
|
||||
#include "board_pinout.h"
|
||||
|
||||
#ifdef FAN_CTRL_PIN
|
||||
|
||||
namespace THERMAL_Utils {
|
||||
|
||||
void setup();
|
||||
void monitor();
|
||||
void onTxStart();
|
||||
void onTxEnd();
|
||||
void turnOffFan();
|
||||
bool isTxBlocked();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
class ReceivedPacket {
|
||||
public:
|
||||
String rxDate;
|
||||
String rxTime;
|
||||
String packet;
|
||||
int RSSI;
|
||||
@@ -39,6 +40,7 @@ namespace Utils {
|
||||
void checkBeaconInterval();
|
||||
void checkDisplayInterval();
|
||||
void validateFreqs();
|
||||
String padForDisplay(const String& text);
|
||||
void updateLoRaPacketDisplayInfo(APRSPacket& aprsPacket, const uint8_t packetType);
|
||||
void updateAPRSISPacketDisplayInfo(const String& packet);
|
||||
void print(const String& text);
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2014-2022 Fredrik Ahlberg, Angus Gratton,
|
||||
# Espressif Systems (Shanghai) CO LTD, other contributors as noted.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# This executable script is a thin wrapper around the main functionality
|
||||
# in the esptool Python package
|
||||
|
||||
# When updating this script, please also update espefuse.py and espsecure.py
|
||||
|
||||
import contextlib
|
||||
import os
|
||||
import sys
|
||||
|
||||
if os.name != "nt":
|
||||
# Linux/macOS: remove current script directory to avoid importing this file
|
||||
# as a module; we want to import the installed esptool module instead
|
||||
with contextlib.suppress(ValueError):
|
||||
if sys.path[0].endswith("/bin"):
|
||||
sys.path.pop(0)
|
||||
sys.path.remove(os.path.dirname(sys.executable))
|
||||
|
||||
# Linux/macOS: delete imported module entry to force Python to load
|
||||
# the module from scratch; this enables importing esptool module in
|
||||
# other Python scripts
|
||||
with contextlib.suppress(KeyError):
|
||||
del sys.modules["esptool"]
|
||||
|
||||
import esptool
|
||||
|
||||
if __name__ == "__main__":
|
||||
esptool._main()
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,9 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2014-2022 Fredrik Ahlberg, Angus Gratton,
|
||||
# Espressif Systems (Shanghai) CO LTD, other contributors as noted.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import esptool
|
||||
|
||||
if __name__ == "__main__":
|
||||
esptool._main()
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,92 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2014-2023 Espressif Systems (Shanghai) CO LTD,
|
||||
# other contributors as noted.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import configparser
|
||||
import os
|
||||
|
||||
CONFIG_OPTIONS = [
|
||||
"timeout",
|
||||
"chip_erase_timeout",
|
||||
"max_timeout",
|
||||
"sync_timeout",
|
||||
"md5_timeout_per_mb",
|
||||
"erase_region_timeout_per_mb",
|
||||
"erase_write_timeout_per_mb",
|
||||
"mem_end_rom_timeout",
|
||||
"serial_write_timeout",
|
||||
"connect_attempts",
|
||||
"write_block_attempts",
|
||||
"reset_delay",
|
||||
"custom_reset_sequence",
|
||||
]
|
||||
|
||||
|
||||
def _validate_config_file(file_path, verbose=False):
|
||||
if not os.path.exists(file_path):
|
||||
return False
|
||||
|
||||
cfg = configparser.RawConfigParser()
|
||||
try:
|
||||
cfg.read(file_path, encoding="UTF-8")
|
||||
# Only consider it a valid config file if it contains [esptool] section
|
||||
if cfg.has_section("esptool"):
|
||||
if verbose:
|
||||
unknown_opts = list(set(cfg.options("esptool")) - set(CONFIG_OPTIONS))
|
||||
unknown_opts.sort()
|
||||
no_of_unknown_opts = len(unknown_opts)
|
||||
if no_of_unknown_opts > 0:
|
||||
suffix = "s" if no_of_unknown_opts > 1 else ""
|
||||
print(
|
||||
"Ignoring unknown config file option{}: {}".format(
|
||||
suffix, ", ".join(unknown_opts)
|
||||
)
|
||||
)
|
||||
return True
|
||||
except (UnicodeDecodeError, configparser.Error) as e:
|
||||
if verbose:
|
||||
print(f"Ignoring invalid config file {file_path}: {e}")
|
||||
return False
|
||||
|
||||
|
||||
def _find_config_file(dir_path, verbose=False):
|
||||
for candidate in ("esptool.cfg", "setup.cfg", "tox.ini"):
|
||||
cfg_path = os.path.join(dir_path, candidate)
|
||||
if _validate_config_file(cfg_path, verbose):
|
||||
return cfg_path
|
||||
return None
|
||||
|
||||
|
||||
def load_config_file(verbose=False):
|
||||
set_with_env_var = False
|
||||
env_var_path = os.environ.get("ESPTOOL_CFGFILE")
|
||||
if env_var_path is not None and _validate_config_file(env_var_path):
|
||||
cfg_file_path = env_var_path
|
||||
set_with_env_var = True
|
||||
else:
|
||||
home_dir = os.path.expanduser("~")
|
||||
os_config_dir = (
|
||||
f"{home_dir}/.config/esptool"
|
||||
if os.name == "posix"
|
||||
else f"{home_dir}/AppData/Local/esptool/"
|
||||
)
|
||||
# Search priority: 1) current dir, 2) OS specific config dir, 3) home dir
|
||||
for dir_path in (os.getcwd(), os_config_dir, home_dir):
|
||||
cfg_file_path = _find_config_file(dir_path, verbose)
|
||||
if cfg_file_path:
|
||||
break
|
||||
|
||||
cfg = configparser.ConfigParser()
|
||||
cfg["esptool"] = {} # Create an empty esptool config for when no file is found
|
||||
|
||||
if cfg_file_path is not None:
|
||||
# If config file is found and validated, read and parse it
|
||||
cfg.read(cfg_file_path)
|
||||
if verbose:
|
||||
msg = " (set with ESPTOOL_CFGFILE)" if set_with_env_var else ""
|
||||
print(
|
||||
f"Loaded custom configuration from "
|
||||
f"{os.path.abspath(cfg_file_path)}{msg}"
|
||||
)
|
||||
return cfg, cfg_file_path
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,178 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2014-2023 Fredrik Ahlberg, Angus Gratton,
|
||||
# Espressif Systems (Shanghai) CO LTD, other contributors as noted.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import os
|
||||
import struct
|
||||
import time
|
||||
|
||||
from .util import FatalError
|
||||
|
||||
# Used for resetting into bootloader on Unix-like systems
|
||||
if os.name != "nt":
|
||||
import fcntl
|
||||
import termios
|
||||
|
||||
# Constants used for terminal status lines reading/setting.
|
||||
# Taken from pySerial's backend for IO:
|
||||
# https://github.com/pyserial/pyserial/blob/master/serial/serialposix.py
|
||||
TIOCMSET = getattr(termios, "TIOCMSET", 0x5418)
|
||||
TIOCMGET = getattr(termios, "TIOCMGET", 0x5415)
|
||||
TIOCM_DTR = getattr(termios, "TIOCM_DTR", 0x002)
|
||||
TIOCM_RTS = getattr(termios, "TIOCM_RTS", 0x004)
|
||||
|
||||
DEFAULT_RESET_DELAY = 0.05 # default time to wait before releasing boot pin after reset
|
||||
|
||||
|
||||
class ResetStrategy(object):
|
||||
def __init__(self, port, reset_delay=DEFAULT_RESET_DELAY):
|
||||
self.port = port
|
||||
self.reset_delay = reset_delay
|
||||
|
||||
def __call__():
|
||||
pass
|
||||
|
||||
def _setDTR(self, state):
|
||||
self.port.setDTR(state)
|
||||
|
||||
def _setRTS(self, state):
|
||||
self.port.setRTS(state)
|
||||
# Work-around for adapters on Windows using the usbser.sys driver:
|
||||
# generate a dummy change to DTR so that the set-control-line-state
|
||||
# request is sent with the updated RTS state and the same DTR state
|
||||
self.port.setDTR(self.port.dtr)
|
||||
|
||||
def _setDTRandRTS(self, dtr=False, rts=False):
|
||||
status = struct.unpack(
|
||||
"I", fcntl.ioctl(self.port.fileno(), TIOCMGET, struct.pack("I", 0))
|
||||
)[0]
|
||||
if dtr:
|
||||
status |= TIOCM_DTR
|
||||
else:
|
||||
status &= ~TIOCM_DTR
|
||||
if rts:
|
||||
status |= TIOCM_RTS
|
||||
else:
|
||||
status &= ~TIOCM_RTS
|
||||
fcntl.ioctl(self.port.fileno(), TIOCMSET, struct.pack("I", status))
|
||||
|
||||
|
||||
class ClassicReset(ResetStrategy):
|
||||
"""
|
||||
Classic reset sequence, sets DTR and RTS lines sequentially.
|
||||
"""
|
||||
|
||||
def __call__(self):
|
||||
self._setDTR(False) # IO0=HIGH
|
||||
self._setRTS(True) # EN=LOW, chip in reset
|
||||
time.sleep(0.1)
|
||||
self._setDTR(True) # IO0=LOW
|
||||
self._setRTS(False) # EN=HIGH, chip out of reset
|
||||
time.sleep(self.reset_delay)
|
||||
self._setDTR(False) # IO0=HIGH, done
|
||||
|
||||
|
||||
class UnixTightReset(ResetStrategy):
|
||||
"""
|
||||
UNIX-only reset sequence with custom implementation,
|
||||
which allows setting DTR and RTS lines at the same time.
|
||||
"""
|
||||
|
||||
def __call__(self):
|
||||
self._setDTRandRTS(False, False)
|
||||
self._setDTRandRTS(True, True)
|
||||
self._setDTRandRTS(False, True) # IO0=HIGH & EN=LOW, chip in reset
|
||||
time.sleep(0.1)
|
||||
self._setDTRandRTS(True, False) # IO0=LOW & EN=HIGH, chip out of reset
|
||||
time.sleep(self.reset_delay)
|
||||
self._setDTRandRTS(False, False) # IO0=HIGH, done
|
||||
self._setDTR(False) # Needed in some environments to ensure IO0=HIGH
|
||||
|
||||
|
||||
class USBJTAGSerialReset(ResetStrategy):
|
||||
"""
|
||||
Custom reset sequence, which is required when the device
|
||||
is connecting via its USB-JTAG-Serial peripheral.
|
||||
"""
|
||||
|
||||
def __call__(self):
|
||||
self._setRTS(False)
|
||||
self._setDTR(False) # Idle
|
||||
time.sleep(0.1)
|
||||
self._setDTR(True) # Set IO0
|
||||
self._setRTS(False)
|
||||
time.sleep(0.1)
|
||||
self._setRTS(True) # Reset. Calls inverted to go through (1,1) instead of (0,0)
|
||||
self._setDTR(False)
|
||||
self._setRTS(True) # RTS set as Windows only propagates DTR on RTS setting
|
||||
time.sleep(0.1)
|
||||
self._setDTR(False)
|
||||
self._setRTS(False) # Chip out of reset
|
||||
|
||||
|
||||
class HardReset(ResetStrategy):
|
||||
"""
|
||||
Reset sequence for hard resetting the chip.
|
||||
Can be used to reset out of the bootloader or to restart a running app.
|
||||
"""
|
||||
|
||||
def __init__(self, port, uses_usb_otg=False):
|
||||
super().__init__(port)
|
||||
self.uses_usb_otg = uses_usb_otg
|
||||
|
||||
def __call__(self):
|
||||
self._setRTS(True) # EN->LOW
|
||||
if self.uses_usb_otg:
|
||||
# Give the chip some time to come out of reset,
|
||||
# to be able to handle further DTR/RTS transitions
|
||||
time.sleep(0.2)
|
||||
self._setRTS(False)
|
||||
time.sleep(0.2)
|
||||
else:
|
||||
time.sleep(0.1)
|
||||
self._setRTS(False)
|
||||
|
||||
|
||||
class CustomReset(ResetStrategy):
|
||||
"""
|
||||
Custom reset strategy defined with a string.
|
||||
|
||||
CustomReset object is created as "rst = CustomReset(port, seq_str)"
|
||||
and can be later executed simply with "rst()"
|
||||
|
||||
The seq_str input string consists of individual commands divided by "|".
|
||||
Commands (e.g. R0) are defined by a code (R) and an argument (0).
|
||||
|
||||
The commands are:
|
||||
D: setDTR - 1=True / 0=False
|
||||
R: setRTS - 1=True / 0=False
|
||||
U: setDTRandRTS (Unix-only) - 0,0 / 0,1 / 1,0 / or 1,1
|
||||
W: Wait (time delay) - positive float number
|
||||
|
||||
e.g.
|
||||
"D0|R1|W0.1|D1|R0|W0.05|D0" represents the ClassicReset strategy
|
||||
"U1,1|U0,1|W0.1|U1,0|W0.05|U0,0" represents the UnixTightReset strategy
|
||||
"""
|
||||
|
||||
format_dict = {
|
||||
"D": "self.port.setDTR({})",
|
||||
"R": "self.port.setRTS({})",
|
||||
"W": "time.sleep({})",
|
||||
"U": "self._setDTRandRTS({})",
|
||||
}
|
||||
|
||||
def __call__(self):
|
||||
exec(self.constructed_strategy)
|
||||
|
||||
def __init__(self, port, seq_str):
|
||||
super().__init__(port)
|
||||
self.constructed_strategy = self._parse_string_to_seq(seq_str)
|
||||
|
||||
def _parse_string_to_seq(self, seq_str):
|
||||
try:
|
||||
cmds = seq_str.split("|")
|
||||
fn_calls_list = [self.format_dict[cmd[0]].format(cmd[1:]) for cmd in cmds]
|
||||
except Exception as e:
|
||||
raise FatalError(f'Invalid "custom_reset_sequence" option format: {e}')
|
||||
return "\n".join(fn_calls_list)
|
||||
@@ -1,31 +0,0 @@
|
||||
from .esp32 import ESP32ROM
|
||||
from .esp32c2 import ESP32C2ROM
|
||||
from .esp32c3 import ESP32C3ROM
|
||||
from .esp32c6 import ESP32C6ROM
|
||||
from .esp32c6beta import ESP32C6BETAROM
|
||||
from .esp32h2 import ESP32H2ROM
|
||||
from .esp32h2beta1 import ESP32H2BETA1ROM
|
||||
from .esp32h2beta2 import ESP32H2BETA2ROM
|
||||
from .esp32s2 import ESP32S2ROM
|
||||
from .esp32s3 import ESP32S3ROM
|
||||
from .esp32s3beta2 import ESP32S3BETA2ROM
|
||||
from .esp8266 import ESP8266ROM
|
||||
|
||||
|
||||
CHIP_DEFS = {
|
||||
"esp8266": ESP8266ROM,
|
||||
"esp32": ESP32ROM,
|
||||
"esp32s2": ESP32S2ROM,
|
||||
"esp32s3beta2": ESP32S3BETA2ROM,
|
||||
"esp32s3": ESP32S3ROM,
|
||||
"esp32c3": ESP32C3ROM,
|
||||
"esp32c6beta": ESP32C6BETAROM,
|
||||
"esp32h2beta1": ESP32H2BETA1ROM,
|
||||
"esp32h2beta2": ESP32H2BETA2ROM,
|
||||
"esp32c2": ESP32C2ROM,
|
||||
"esp32c6": ESP32C6ROM,
|
||||
"esp32h2": ESP32H2ROM,
|
||||
}
|
||||
|
||||
CHIP_LIST = list(CHIP_DEFS.keys())
|
||||
ROM_LIST = list(CHIP_DEFS.values())
|
||||
@@ -1,393 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2014-2022 Fredrik Ahlberg, Angus Gratton,
|
||||
# Espressif Systems (Shanghai) CO LTD, other contributors as noted.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import struct
|
||||
import time
|
||||
|
||||
from ..loader import ESPLoader
|
||||
from ..util import FatalError, NotSupportedError
|
||||
|
||||
|
||||
class ESP32ROM(ESPLoader):
|
||||
"""Access class for ESP32 ROM bootloader"""
|
||||
|
||||
CHIP_NAME = "ESP32"
|
||||
IMAGE_CHIP_ID = 0
|
||||
IS_STUB = False
|
||||
|
||||
FPGA_SLOW_BOOT = True
|
||||
|
||||
CHIP_DETECT_MAGIC_VALUE = [0x00F01D83]
|
||||
|
||||
IROM_MAP_START = 0x400D0000
|
||||
IROM_MAP_END = 0x40400000
|
||||
|
||||
DROM_MAP_START = 0x3F400000
|
||||
DROM_MAP_END = 0x3F800000
|
||||
|
||||
# ESP32 uses a 4 byte status reply
|
||||
STATUS_BYTES_LENGTH = 4
|
||||
|
||||
SPI_REG_BASE = 0x3FF42000
|
||||
SPI_USR_OFFS = 0x1C
|
||||
SPI_USR1_OFFS = 0x20
|
||||
SPI_USR2_OFFS = 0x24
|
||||
SPI_MOSI_DLEN_OFFS = 0x28
|
||||
SPI_MISO_DLEN_OFFS = 0x2C
|
||||
EFUSE_RD_REG_BASE = 0x3FF5A000
|
||||
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG = EFUSE_RD_REG_BASE + 0x18
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT = 1 << 7 # EFUSE_RD_DISABLE_DL_ENCRYPT
|
||||
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_REG = EFUSE_RD_REG_BASE # EFUSE_BLK0_WDATA0_REG
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_MASK = 0x7F << 20 # EFUSE_FLASH_CRYPT_CNT
|
||||
|
||||
EFUSE_RD_ABS_DONE_REG = EFUSE_RD_REG_BASE + 0x018
|
||||
EFUSE_RD_ABS_DONE_0_MASK = 1 << 4
|
||||
EFUSE_RD_ABS_DONE_1_MASK = 1 << 5
|
||||
|
||||
DR_REG_SYSCON_BASE = 0x3FF66000
|
||||
APB_CTL_DATE_ADDR = DR_REG_SYSCON_BASE + 0x7C
|
||||
APB_CTL_DATE_V = 0x1
|
||||
APB_CTL_DATE_S = 31
|
||||
|
||||
SPI_W0_OFFS = 0x80
|
||||
|
||||
UART_CLKDIV_REG = 0x3FF40014
|
||||
|
||||
XTAL_CLK_DIVIDER = 1
|
||||
|
||||
RTCCALICFG1 = 0x3FF5F06C
|
||||
TIMERS_RTC_CALI_VALUE = 0x01FFFFFF
|
||||
TIMERS_RTC_CALI_VALUE_S = 7
|
||||
|
||||
FLASH_SIZES = {
|
||||
"1MB": 0x00,
|
||||
"2MB": 0x10,
|
||||
"4MB": 0x20,
|
||||
"8MB": 0x30,
|
||||
"16MB": 0x40,
|
||||
"32MB": 0x50,
|
||||
"64MB": 0x60,
|
||||
"128MB": 0x70,
|
||||
}
|
||||
|
||||
FLASH_FREQUENCY = {
|
||||
"80m": 0xF,
|
||||
"40m": 0x0,
|
||||
"26m": 0x1,
|
||||
"20m": 0x2,
|
||||
}
|
||||
|
||||
BOOTLOADER_FLASH_OFFSET = 0x1000
|
||||
|
||||
OVERRIDE_VDDSDIO_CHOICES = ["1.8V", "1.9V", "OFF"]
|
||||
|
||||
MEMORY_MAP = [
|
||||
[0x00000000, 0x00010000, "PADDING"],
|
||||
[0x3F400000, 0x3F800000, "DROM"],
|
||||
[0x3F800000, 0x3FC00000, "EXTRAM_DATA"],
|
||||
[0x3FF80000, 0x3FF82000, "RTC_DRAM"],
|
||||
[0x3FF90000, 0x40000000, "BYTE_ACCESSIBLE"],
|
||||
[0x3FFAE000, 0x40000000, "DRAM"],
|
||||
[0x3FFE0000, 0x3FFFFFFC, "DIRAM_DRAM"],
|
||||
[0x40000000, 0x40070000, "IROM"],
|
||||
[0x40070000, 0x40078000, "CACHE_PRO"],
|
||||
[0x40078000, 0x40080000, "CACHE_APP"],
|
||||
[0x40080000, 0x400A0000, "IRAM"],
|
||||
[0x400A0000, 0x400BFFFC, "DIRAM_IRAM"],
|
||||
[0x400C0000, 0x400C2000, "RTC_IRAM"],
|
||||
[0x400D0000, 0x40400000, "IROM"],
|
||||
[0x50000000, 0x50002000, "RTC_DATA"],
|
||||
]
|
||||
|
||||
FLASH_ENCRYPTED_WRITE_ALIGN = 32
|
||||
|
||||
""" Try to read the BLOCK1 (encryption key) and check if it is valid """
|
||||
|
||||
def is_flash_encryption_key_valid(self):
|
||||
"""Bit 0 of efuse_rd_disable[3:0] is mapped to BLOCK1
|
||||
this bit is at position 16 in EFUSE_BLK0_RDATA0_REG"""
|
||||
word0 = self.read_efuse(0)
|
||||
rd_disable = (word0 >> 16) & 0x1
|
||||
|
||||
# reading of BLOCK1 is NOT ALLOWED so we assume valid key is programmed
|
||||
if rd_disable:
|
||||
return True
|
||||
else:
|
||||
# reading of BLOCK1 is ALLOWED so we will read and verify for non-zero.
|
||||
# When ESP32 has not generated AES/encryption key in BLOCK1,
|
||||
# the contents will be readable and 0.
|
||||
# If the flash encryption is enabled it is expected to have a valid
|
||||
# non-zero key. We break out on first occurance of non-zero value
|
||||
key_word = [0] * 7
|
||||
for i in range(len(key_word)):
|
||||
key_word[i] = self.read_efuse(14 + i)
|
||||
# key is non-zero so break & return
|
||||
if key_word[i] != 0:
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_flash_crypt_config(self):
|
||||
"""For flash encryption related commands we need to make sure
|
||||
user has programmed all the relevant efuse correctly so before
|
||||
writing encrypted write_flash_encrypt esptool will verify the values
|
||||
of flash_crypt_config to be non zero if they are not read
|
||||
protected. If the values are zero a warning will be printed
|
||||
|
||||
bit 3 in efuse_rd_disable[3:0] is mapped to flash_crypt_config
|
||||
this bit is at position 19 in EFUSE_BLK0_RDATA0_REG"""
|
||||
word0 = self.read_efuse(0)
|
||||
rd_disable = (word0 >> 19) & 0x1
|
||||
|
||||
if rd_disable == 0:
|
||||
"""we can read the flash_crypt_config efuse value
|
||||
so go & read it (EFUSE_BLK0_RDATA5_REG[31:28])"""
|
||||
word5 = self.read_efuse(5)
|
||||
word5 = (word5 >> 28) & 0xF
|
||||
return word5
|
||||
else:
|
||||
# if read of the efuse is disabled we assume it is set correctly
|
||||
return 0xF
|
||||
|
||||
def get_encrypted_download_disabled(self):
|
||||
return (
|
||||
self.read_reg(self.EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG)
|
||||
& self.EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT
|
||||
)
|
||||
|
||||
def get_flash_encryption_enabled(self):
|
||||
flash_crypt_cnt = (
|
||||
self.read_reg(self.EFUSE_SPI_BOOT_CRYPT_CNT_REG)
|
||||
& self.EFUSE_SPI_BOOT_CRYPT_CNT_MASK
|
||||
)
|
||||
# Flash encryption enabled when odd number of bits are set
|
||||
return bin(flash_crypt_cnt).count("1") & 1 != 0
|
||||
|
||||
def get_secure_boot_enabled(self):
|
||||
efuses = self.read_reg(self.EFUSE_RD_ABS_DONE_REG)
|
||||
rev = self.get_chip_revision()
|
||||
return efuses & self.EFUSE_RD_ABS_DONE_0_MASK or (
|
||||
rev >= 300 and efuses & self.EFUSE_RD_ABS_DONE_1_MASK
|
||||
)
|
||||
|
||||
def get_pkg_version(self):
|
||||
word3 = self.read_efuse(3)
|
||||
pkg_version = (word3 >> 9) & 0x07
|
||||
pkg_version += ((word3 >> 2) & 0x1) << 3
|
||||
return pkg_version
|
||||
|
||||
def get_chip_revision(self):
|
||||
return self.get_major_chip_version() * 100 + self.get_minor_chip_version()
|
||||
|
||||
def get_minor_chip_version(self):
|
||||
return (self.read_efuse(5) >> 24) & 0x3
|
||||
|
||||
def get_major_chip_version(self):
|
||||
rev_bit0 = (self.read_efuse(3) >> 15) & 0x1
|
||||
rev_bit1 = (self.read_efuse(5) >> 20) & 0x1
|
||||
apb_ctl_date = self.read_reg(self.APB_CTL_DATE_ADDR)
|
||||
rev_bit2 = (apb_ctl_date >> self.APB_CTL_DATE_S) & self.APB_CTL_DATE_V
|
||||
combine_value = (rev_bit2 << 2) | (rev_bit1 << 1) | rev_bit0
|
||||
|
||||
revision = {
|
||||
0: 0,
|
||||
1: 1,
|
||||
3: 2,
|
||||
7: 3,
|
||||
}.get(combine_value, 0)
|
||||
return revision
|
||||
|
||||
def get_chip_description(self):
|
||||
pkg_version = self.get_pkg_version()
|
||||
major_rev = self.get_major_chip_version()
|
||||
minor_rev = self.get_minor_chip_version()
|
||||
rev3 = major_rev == 3
|
||||
single_core = self.read_efuse(3) & (1 << 0) # CHIP_VER DIS_APP_CPU
|
||||
|
||||
chip_name = {
|
||||
0: "ESP32-S0WDQ6" if single_core else "ESP32-D0WDQ6",
|
||||
1: "ESP32-S0WD" if single_core else "ESP32-D0WD",
|
||||
2: "ESP32-D2WD",
|
||||
4: "ESP32-U4WDH",
|
||||
5: "ESP32-PICO-V3" if rev3 else "ESP32-PICO-D4",
|
||||
6: "ESP32-PICO-V3-02",
|
||||
7: "ESP32-D0WDR2-V3",
|
||||
}.get(pkg_version, "unknown ESP32")
|
||||
|
||||
# ESP32-D0WD-V3, ESP32-D0WDQ6-V3
|
||||
if chip_name.startswith("ESP32-D0WD") and rev3:
|
||||
chip_name += "-V3"
|
||||
|
||||
return f"{chip_name} (revision v{major_rev}.{minor_rev})"
|
||||
|
||||
def get_chip_features(self):
|
||||
features = ["WiFi"]
|
||||
word3 = self.read_efuse(3)
|
||||
|
||||
# names of variables in this section are lowercase
|
||||
# versions of EFUSE names as documented in TRM and
|
||||
# ESP-IDF efuse_reg.h
|
||||
|
||||
chip_ver_dis_bt = word3 & (1 << 1)
|
||||
if chip_ver_dis_bt == 0:
|
||||
features += ["BT"]
|
||||
|
||||
chip_ver_dis_app_cpu = word3 & (1 << 0)
|
||||
if chip_ver_dis_app_cpu:
|
||||
features += ["Single Core"]
|
||||
else:
|
||||
features += ["Dual Core"]
|
||||
|
||||
chip_cpu_freq_rated = word3 & (1 << 13)
|
||||
if chip_cpu_freq_rated:
|
||||
chip_cpu_freq_low = word3 & (1 << 12)
|
||||
if chip_cpu_freq_low:
|
||||
features += ["160MHz"]
|
||||
else:
|
||||
features += ["240MHz"]
|
||||
|
||||
pkg_version = self.get_pkg_version()
|
||||
if pkg_version in [2, 4, 5, 6]:
|
||||
features += ["Embedded Flash"]
|
||||
|
||||
if pkg_version == 6:
|
||||
features += ["Embedded PSRAM"]
|
||||
|
||||
word4 = self.read_efuse(4)
|
||||
adc_vref = (word4 >> 8) & 0x1F
|
||||
if adc_vref:
|
||||
features += ["VRef calibration in efuse"]
|
||||
|
||||
blk3_part_res = word3 >> 14 & 0x1
|
||||
if blk3_part_res:
|
||||
features += ["BLK3 partially reserved"]
|
||||
|
||||
word6 = self.read_efuse(6)
|
||||
coding_scheme = word6 & 0x3
|
||||
features += [
|
||||
"Coding Scheme %s"
|
||||
% {0: "None", 1: "3/4", 2: "Repeat (UNSUPPORTED)", 3: "Invalid"}[
|
||||
coding_scheme
|
||||
]
|
||||
]
|
||||
|
||||
return features
|
||||
|
||||
def read_efuse(self, n):
|
||||
"""Read the nth word of the ESP3x EFUSE region."""
|
||||
return self.read_reg(self.EFUSE_RD_REG_BASE + (4 * n))
|
||||
|
||||
def chip_id(self):
|
||||
raise NotSupportedError(self, "chip_id")
|
||||
|
||||
def read_mac(self):
|
||||
"""Read MAC from EFUSE region"""
|
||||
words = [self.read_efuse(2), self.read_efuse(1)]
|
||||
bitstring = struct.pack(">II", *words)
|
||||
bitstring = bitstring[2:8] # trim the 2 byte CRC
|
||||
return tuple(bitstring)
|
||||
|
||||
def get_erase_size(self, offset, size):
|
||||
return size
|
||||
|
||||
def override_vddsdio(self, new_voltage):
|
||||
new_voltage = new_voltage.upper()
|
||||
if new_voltage not in self.OVERRIDE_VDDSDIO_CHOICES:
|
||||
raise FatalError(
|
||||
"The only accepted VDDSDIO overrides are '1.8V', '1.9V' and 'OFF'"
|
||||
)
|
||||
RTC_CNTL_SDIO_CONF_REG = 0x3FF48074
|
||||
RTC_CNTL_XPD_SDIO_REG = 1 << 31
|
||||
RTC_CNTL_DREFH_SDIO_M = 3 << 29
|
||||
RTC_CNTL_DREFM_SDIO_M = 3 << 27
|
||||
RTC_CNTL_DREFL_SDIO_M = 3 << 25
|
||||
# RTC_CNTL_SDIO_TIEH = (1 << 23)
|
||||
# not used here, setting TIEH=1 would set 3.3V output,
|
||||
# not safe for esptool.py to do
|
||||
RTC_CNTL_SDIO_FORCE = 1 << 22
|
||||
RTC_CNTL_SDIO_PD_EN = 1 << 21
|
||||
|
||||
reg_val = RTC_CNTL_SDIO_FORCE # override efuse setting
|
||||
reg_val |= RTC_CNTL_SDIO_PD_EN
|
||||
if new_voltage != "OFF":
|
||||
reg_val |= RTC_CNTL_XPD_SDIO_REG # enable internal LDO
|
||||
if new_voltage == "1.9V":
|
||||
reg_val |= (
|
||||
RTC_CNTL_DREFH_SDIO_M | RTC_CNTL_DREFM_SDIO_M | RTC_CNTL_DREFL_SDIO_M
|
||||
) # boost voltage
|
||||
self.write_reg(RTC_CNTL_SDIO_CONF_REG, reg_val)
|
||||
print("VDDSDIO regulator set to %s" % new_voltage)
|
||||
|
||||
def read_flash_slow(self, offset, length, progress_fn):
|
||||
BLOCK_LEN = 64 # ROM read limit per command (this limit is why it's so slow)
|
||||
|
||||
data = b""
|
||||
while len(data) < length:
|
||||
block_len = min(BLOCK_LEN, length - len(data))
|
||||
r = self.check_command(
|
||||
"read flash block",
|
||||
self.ESP_READ_FLASH_SLOW,
|
||||
struct.pack("<II", offset + len(data), block_len),
|
||||
)
|
||||
if len(r) < block_len:
|
||||
raise FatalError(
|
||||
"Expected %d byte block, got %d bytes. Serial errors?"
|
||||
% (block_len, len(r))
|
||||
)
|
||||
# command always returns 64 byte buffer,
|
||||
# regardless of how many bytes were actually read from flash
|
||||
data += r[:block_len]
|
||||
if progress_fn and (len(data) % 1024 == 0 or len(data) == length):
|
||||
progress_fn(len(data), length)
|
||||
return data
|
||||
|
||||
def get_rom_cal_crystal_freq(self):
|
||||
"""
|
||||
Get the crystal frequency calculated by the ROM
|
||||
"""
|
||||
# - Simulate the calculation in the ROM to get the XTAL frequency
|
||||
# calculated by the ROM
|
||||
|
||||
cali_val = (
|
||||
self.read_reg(self.RTCCALICFG1) >> self.TIMERS_RTC_CALI_VALUE_S
|
||||
) & self.TIMERS_RTC_CALI_VALUE
|
||||
clk_8M_freq = self.read_efuse(4) & (0xFF) # EFUSE_RD_CK8M_FREQ
|
||||
rom_calculated_freq = cali_val * 15625 * clk_8M_freq / 40
|
||||
return rom_calculated_freq
|
||||
|
||||
def change_baud(self, baud):
|
||||
# It's a workaround to avoid esp32 CK_8M frequency drift.
|
||||
rom_calculated_freq = self.get_rom_cal_crystal_freq()
|
||||
valid_freq = 40000000 if rom_calculated_freq > 33000000 else 26000000
|
||||
false_rom_baud = int(baud * rom_calculated_freq // valid_freq)
|
||||
|
||||
print(f"Changing baud rate to {baud}")
|
||||
self.command(self.ESP_CHANGE_BAUDRATE, struct.pack("<II", false_rom_baud, 0))
|
||||
print("Changed.")
|
||||
self._set_port_baudrate(baud)
|
||||
time.sleep(0.05) # get rid of garbage sent during baud rate change
|
||||
self.flush_input()
|
||||
|
||||
|
||||
class ESP32StubLoader(ESP32ROM):
|
||||
"""Access class for ESP32 stub loader, runs on top of ROM."""
|
||||
|
||||
FLASH_WRITE_SIZE = 0x4000 # matches MAX_WRITE_BLOCK in stub_loader.c
|
||||
STATUS_BYTES_LENGTH = 2 # same as ESP8266, different to ESP32 ROM
|
||||
IS_STUB = True
|
||||
|
||||
def __init__(self, rom_loader):
|
||||
self.secure_download_mode = rom_loader.secure_download_mode
|
||||
self._port = rom_loader._port
|
||||
self._trace_enabled = rom_loader._trace_enabled
|
||||
self.cache = rom_loader.cache
|
||||
self.flush_input() # resets _slip_reader
|
||||
|
||||
def change_baud(self, baud):
|
||||
ESPLoader.change_baud(self, baud)
|
||||
|
||||
|
||||
ESP32ROM.STUB_CLASS = ESP32StubLoader
|
||||
@@ -1,165 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2014-2022 Fredrik Ahlberg, Angus Gratton,
|
||||
# Espressif Systems (Shanghai) CO LTD, other contributors as noted.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import struct
|
||||
import time
|
||||
|
||||
from .esp32c3 import ESP32C3ROM
|
||||
from ..loader import ESPLoader
|
||||
|
||||
|
||||
class ESP32C2ROM(ESP32C3ROM):
|
||||
CHIP_NAME = "ESP32-C2"
|
||||
IMAGE_CHIP_ID = 12
|
||||
|
||||
IROM_MAP_START = 0x42000000
|
||||
IROM_MAP_END = 0x42400000
|
||||
DROM_MAP_START = 0x3C000000
|
||||
DROM_MAP_END = 0x3C400000
|
||||
|
||||
# Magic value for ESP32C2 ECO0 and ECO1 respectively
|
||||
CHIP_DETECT_MAGIC_VALUE = [0x6F51306F, 0x7C41A06F]
|
||||
|
||||
EFUSE_BASE = 0x60008800
|
||||
EFUSE_BLOCK2_ADDR = EFUSE_BASE + 0x040
|
||||
MAC_EFUSE_REG = EFUSE_BASE + 0x040
|
||||
|
||||
EFUSE_SECURE_BOOT_EN_REG = EFUSE_BASE + 0x30
|
||||
EFUSE_SECURE_BOOT_EN_MASK = 1 << 21
|
||||
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_REG = EFUSE_BASE + 0x30
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_MASK = 0x7 << 18
|
||||
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG = EFUSE_BASE + 0x30
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT = 1 << 6
|
||||
|
||||
EFUSE_XTS_KEY_LENGTH_256_REG = EFUSE_BASE + 0x30
|
||||
EFUSE_XTS_KEY_LENGTH_256 = 1 << 10
|
||||
|
||||
EFUSE_BLOCK_KEY0_REG = EFUSE_BASE + 0x60
|
||||
|
||||
EFUSE_RD_DIS_REG = EFUSE_BASE + 0x30
|
||||
EFUSE_RD_DIS = 3
|
||||
|
||||
FLASH_FREQUENCY = {
|
||||
"60m": 0xF,
|
||||
"30m": 0x0,
|
||||
"20m": 0x1,
|
||||
"15m": 0x2,
|
||||
}
|
||||
|
||||
MEMORY_MAP = [
|
||||
[0x00000000, 0x00010000, "PADDING"],
|
||||
[0x3C000000, 0x3C400000, "DROM"],
|
||||
[0x3FCA0000, 0x3FCE0000, "DRAM"],
|
||||
[0x3FC88000, 0x3FD00000, "BYTE_ACCESSIBLE"],
|
||||
[0x3FF00000, 0x3FF50000, "DROM_MASK"],
|
||||
[0x40000000, 0x40090000, "IROM_MASK"],
|
||||
[0x42000000, 0x42400000, "IROM"],
|
||||
[0x4037C000, 0x403C0000, "IRAM"],
|
||||
]
|
||||
|
||||
def get_pkg_version(self):
|
||||
num_word = 1
|
||||
return (self.read_reg(self.EFUSE_BLOCK2_ADDR + (4 * num_word)) >> 22) & 0x07
|
||||
|
||||
def get_chip_description(self):
|
||||
chip_name = {
|
||||
0: "ESP32-C2",
|
||||
1: "ESP32-C2",
|
||||
}.get(self.get_pkg_version(), "unknown ESP32-C2")
|
||||
major_rev = self.get_major_chip_version()
|
||||
minor_rev = self.get_minor_chip_version()
|
||||
return f"{chip_name} (revision v{major_rev}.{minor_rev})"
|
||||
|
||||
def get_minor_chip_version(self):
|
||||
num_word = 1
|
||||
return (self.read_reg(self.EFUSE_BLOCK2_ADDR + (4 * num_word)) >> 16) & 0xF
|
||||
|
||||
def get_major_chip_version(self):
|
||||
num_word = 1
|
||||
return (self.read_reg(self.EFUSE_BLOCK2_ADDR + (4 * num_word)) >> 20) & 0x3
|
||||
|
||||
def get_crystal_freq(self):
|
||||
# The crystal detection algorithm of ESP32/ESP8266 works for ESP32-C2 as well.
|
||||
return ESPLoader.get_crystal_freq(self)
|
||||
|
||||
def change_baud(self, baud):
|
||||
rom_with_26M_XTAL = not self.IS_STUB and self.get_crystal_freq() == 26
|
||||
if rom_with_26M_XTAL:
|
||||
# The code is copied over from ESPLoader.change_baud().
|
||||
# Probably this is just a temporary solution until the next chip revision.
|
||||
|
||||
# The ROM code thinks it uses a 40 MHz XTAL. Recompute the baud rate
|
||||
# in order to trick the ROM code to set the correct baud rate for
|
||||
# a 26 MHz XTAL.
|
||||
false_rom_baud = baud * 40 // 26
|
||||
|
||||
print(f"Changing baud rate to {baud}")
|
||||
self.command(
|
||||
self.ESP_CHANGE_BAUDRATE, struct.pack("<II", false_rom_baud, 0)
|
||||
)
|
||||
print("Changed.")
|
||||
self._set_port_baudrate(baud)
|
||||
time.sleep(0.05) # get rid of garbage sent during baud rate change
|
||||
self.flush_input()
|
||||
else:
|
||||
ESPLoader.change_baud(self, baud)
|
||||
|
||||
def _post_connect(self):
|
||||
# ESP32C2 ECO0 is no longer supported by the flasher stub
|
||||
if self.get_chip_revision() == 0:
|
||||
self.stub_is_disabled = True
|
||||
self.IS_STUB = False
|
||||
|
||||
""" Try to read (encryption key) and check if it is valid """
|
||||
|
||||
def is_flash_encryption_key_valid(self):
|
||||
key_len_256 = (
|
||||
self.read_reg(self.EFUSE_XTS_KEY_LENGTH_256_REG)
|
||||
& self.EFUSE_XTS_KEY_LENGTH_256
|
||||
)
|
||||
|
||||
word0 = self.read_reg(self.EFUSE_RD_DIS_REG) & self.EFUSE_RD_DIS
|
||||
rd_disable = word0 == 3 if key_len_256 else word0 == 1
|
||||
|
||||
# reading of BLOCK3 is NOT ALLOWED so we assume valid key is programmed
|
||||
if rd_disable:
|
||||
return True
|
||||
else:
|
||||
# reading of BLOCK3 is ALLOWED so we will read and verify for non-zero.
|
||||
# When chip has not generated AES/encryption key in BLOCK3,
|
||||
# the contents will be readable and 0.
|
||||
# If the flash encryption is enabled it is expected to have a valid
|
||||
# non-zero key. We break out on first occurance of non-zero value
|
||||
key_word = [0] * 7 if key_len_256 else [0] * 3
|
||||
for i in range(len(key_word)):
|
||||
key_word[i] = self.read_reg(self.EFUSE_BLOCK_KEY0_REG + i * 4)
|
||||
# key is non-zero so break & return
|
||||
if key_word[i] != 0:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
class ESP32C2StubLoader(ESP32C2ROM):
|
||||
"""Access class for ESP32C2 stub loader, runs on top of ROM.
|
||||
|
||||
(Basically the same as ESP32StubLoader, but different base class.
|
||||
Can possibly be made into a mixin.)
|
||||
"""
|
||||
|
||||
FLASH_WRITE_SIZE = 0x4000 # matches MAX_WRITE_BLOCK in stub_loader.c
|
||||
STATUS_BYTES_LENGTH = 2 # same as ESP8266, different to ESP32 ROM
|
||||
IS_STUB = True
|
||||
|
||||
def __init__(self, rom_loader):
|
||||
self.secure_download_mode = rom_loader.secure_download_mode
|
||||
self._port = rom_loader._port
|
||||
self._trace_enabled = rom_loader._trace_enabled
|
||||
self.cache = rom_loader.cache
|
||||
self.flush_input() # resets _slip_reader
|
||||
|
||||
|
||||
ESP32C2ROM.STUB_CLASS = ESP32C2StubLoader
|
||||
@@ -1,210 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2014-2022 Fredrik Ahlberg, Angus Gratton,
|
||||
# Espressif Systems (Shanghai) CO LTD, other contributors as noted.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import struct
|
||||
|
||||
from .esp32 import ESP32ROM
|
||||
from ..loader import ESPLoader
|
||||
from ..util import FatalError, NotImplementedInROMError
|
||||
|
||||
|
||||
class ESP32C3ROM(ESP32ROM):
|
||||
CHIP_NAME = "ESP32-C3"
|
||||
IMAGE_CHIP_ID = 5
|
||||
|
||||
FPGA_SLOW_BOOT = False
|
||||
|
||||
IROM_MAP_START = 0x42000000
|
||||
IROM_MAP_END = 0x42800000
|
||||
DROM_MAP_START = 0x3C000000
|
||||
DROM_MAP_END = 0x3C800000
|
||||
|
||||
SPI_REG_BASE = 0x60002000
|
||||
SPI_USR_OFFS = 0x18
|
||||
SPI_USR1_OFFS = 0x1C
|
||||
SPI_USR2_OFFS = 0x20
|
||||
SPI_MOSI_DLEN_OFFS = 0x24
|
||||
SPI_MISO_DLEN_OFFS = 0x28
|
||||
SPI_W0_OFFS = 0x58
|
||||
|
||||
BOOTLOADER_FLASH_OFFSET = 0x0
|
||||
|
||||
# Magic value for ESP32C3 eco 1+2 and ESP32C3 eco3 respectivly
|
||||
CHIP_DETECT_MAGIC_VALUE = [0x6921506F, 0x1B31506F]
|
||||
|
||||
UART_DATE_REG_ADDR = 0x60000000 + 0x7C
|
||||
|
||||
UART_CLKDIV_REG = 0x60000014
|
||||
|
||||
EFUSE_BASE = 0x60008800
|
||||
EFUSE_BLOCK1_ADDR = EFUSE_BASE + 0x044
|
||||
MAC_EFUSE_REG = EFUSE_BASE + 0x044
|
||||
|
||||
EFUSE_RD_REG_BASE = EFUSE_BASE + 0x030 # BLOCK0 read base address
|
||||
|
||||
EFUSE_PURPOSE_KEY0_REG = EFUSE_BASE + 0x34
|
||||
EFUSE_PURPOSE_KEY0_SHIFT = 24
|
||||
EFUSE_PURPOSE_KEY1_REG = EFUSE_BASE + 0x34
|
||||
EFUSE_PURPOSE_KEY1_SHIFT = 28
|
||||
EFUSE_PURPOSE_KEY2_REG = EFUSE_BASE + 0x38
|
||||
EFUSE_PURPOSE_KEY2_SHIFT = 0
|
||||
EFUSE_PURPOSE_KEY3_REG = EFUSE_BASE + 0x38
|
||||
EFUSE_PURPOSE_KEY3_SHIFT = 4
|
||||
EFUSE_PURPOSE_KEY4_REG = EFUSE_BASE + 0x38
|
||||
EFUSE_PURPOSE_KEY4_SHIFT = 8
|
||||
EFUSE_PURPOSE_KEY5_REG = EFUSE_BASE + 0x38
|
||||
EFUSE_PURPOSE_KEY5_SHIFT = 12
|
||||
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG = EFUSE_RD_REG_BASE
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT = 1 << 20
|
||||
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_REG = EFUSE_BASE + 0x034
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_MASK = 0x7 << 18
|
||||
|
||||
EFUSE_SECURE_BOOT_EN_REG = EFUSE_BASE + 0x038
|
||||
EFUSE_SECURE_BOOT_EN_MASK = 1 << 20
|
||||
|
||||
PURPOSE_VAL_XTS_AES128_KEY = 4
|
||||
|
||||
SUPPORTS_ENCRYPTED_FLASH = True
|
||||
|
||||
FLASH_ENCRYPTED_WRITE_ALIGN = 16
|
||||
|
||||
UARTDEV_BUF_NO = 0x3FCDF07C # Variable in ROM .bss which indicates the port in use
|
||||
UARTDEV_BUF_NO_USB_JTAG_SERIAL = 3 # The above var when USB-JTAG/Serial is used
|
||||
|
||||
RTC_CNTL_WDT_WKEY = 0x50D83AA1
|
||||
RTCCNTL_BASE_REG = 0x60008000
|
||||
RTC_CNTL_WDTCONFIG0_REG = RTCCNTL_BASE_REG + 0x0090
|
||||
RTC_CNTL_WDTWPROTECT_REG = RTCCNTL_BASE_REG + 0x00A8
|
||||
|
||||
MEMORY_MAP = [
|
||||
[0x00000000, 0x00010000, "PADDING"],
|
||||
[0x3C000000, 0x3C800000, "DROM"],
|
||||
[0x3FC80000, 0x3FCE0000, "DRAM"],
|
||||
[0x3FC88000, 0x3FD00000, "BYTE_ACCESSIBLE"],
|
||||
[0x3FF00000, 0x3FF20000, "DROM_MASK"],
|
||||
[0x40000000, 0x40060000, "IROM_MASK"],
|
||||
[0x42000000, 0x42800000, "IROM"],
|
||||
[0x4037C000, 0x403E0000, "IRAM"],
|
||||
[0x50000000, 0x50002000, "RTC_IRAM"],
|
||||
[0x50000000, 0x50002000, "RTC_DRAM"],
|
||||
[0x600FE000, 0x60100000, "MEM_INTERNAL2"],
|
||||
]
|
||||
|
||||
def get_pkg_version(self):
|
||||
num_word = 3
|
||||
return (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * num_word)) >> 21) & 0x07
|
||||
|
||||
def get_minor_chip_version(self):
|
||||
hi_num_word = 5
|
||||
hi = (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * hi_num_word)) >> 23) & 0x01
|
||||
low_num_word = 3
|
||||
low = (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * low_num_word)) >> 18) & 0x07
|
||||
return (hi << 3) + low
|
||||
|
||||
def get_major_chip_version(self):
|
||||
num_word = 5
|
||||
return (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * num_word)) >> 24) & 0x03
|
||||
|
||||
def get_chip_description(self):
|
||||
chip_name = {
|
||||
0: "ESP32-C3",
|
||||
}.get(self.get_pkg_version(), "unknown ESP32-C3")
|
||||
major_rev = self.get_major_chip_version()
|
||||
minor_rev = self.get_minor_chip_version()
|
||||
return f"{chip_name} (revision v{major_rev}.{minor_rev})"
|
||||
|
||||
def get_chip_features(self):
|
||||
return ["WiFi", "BLE"]
|
||||
|
||||
def get_crystal_freq(self):
|
||||
# ESP32C3 XTAL is fixed to 40MHz
|
||||
return 40
|
||||
|
||||
def override_vddsdio(self, new_voltage):
|
||||
raise NotImplementedInROMError(
|
||||
"VDD_SDIO overrides are not supported for ESP32-C3"
|
||||
)
|
||||
|
||||
def read_mac(self):
|
||||
mac0 = self.read_reg(self.MAC_EFUSE_REG)
|
||||
mac1 = self.read_reg(self.MAC_EFUSE_REG + 4) # only bottom 16 bits are MAC
|
||||
bitstring = struct.pack(">II", mac1, mac0)[2:]
|
||||
return tuple(bitstring)
|
||||
|
||||
def get_flash_crypt_config(self):
|
||||
return None # doesn't exist on ESP32-C3
|
||||
|
||||
def get_secure_boot_enabled(self):
|
||||
return (
|
||||
self.read_reg(self.EFUSE_SECURE_BOOT_EN_REG)
|
||||
& self.EFUSE_SECURE_BOOT_EN_MASK
|
||||
)
|
||||
|
||||
def get_key_block_purpose(self, key_block):
|
||||
if key_block < 0 or key_block > 5:
|
||||
raise FatalError("Valid key block numbers must be in range 0-5")
|
||||
|
||||
reg, shift = [
|
||||
(self.EFUSE_PURPOSE_KEY0_REG, self.EFUSE_PURPOSE_KEY0_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY1_REG, self.EFUSE_PURPOSE_KEY1_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY2_REG, self.EFUSE_PURPOSE_KEY2_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY3_REG, self.EFUSE_PURPOSE_KEY3_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY4_REG, self.EFUSE_PURPOSE_KEY4_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY5_REG, self.EFUSE_PURPOSE_KEY5_SHIFT),
|
||||
][key_block]
|
||||
return (self.read_reg(reg) >> shift) & 0xF
|
||||
|
||||
def is_flash_encryption_key_valid(self):
|
||||
# Need to see an AES-128 key
|
||||
purposes = [self.get_key_block_purpose(b) for b in range(6)]
|
||||
|
||||
return any(p == self.PURPOSE_VAL_XTS_AES128_KEY for p in purposes)
|
||||
|
||||
def change_baud(self, baud):
|
||||
ESPLoader.change_baud(self, baud)
|
||||
|
||||
def uses_usb_jtag_serial(self):
|
||||
"""
|
||||
Check the UARTDEV_BUF_NO register to see if USB-JTAG/Serial is being used
|
||||
"""
|
||||
if self.secure_download_mode:
|
||||
return False # Can't detect USB-JTAG/Serial in secure download mode
|
||||
return self.get_uart_no() == self.UARTDEV_BUF_NO_USB_JTAG_SERIAL
|
||||
|
||||
def disable_rtc_watchdog(self):
|
||||
# When USB-JTAG/Serial is used, the RTC watchdog is not reset
|
||||
# and can then reset the board during flashing. Disable it.
|
||||
if self.uses_usb_jtag_serial():
|
||||
self.write_reg(self.RTC_CNTL_WDTWPROTECT_REG, self.RTC_CNTL_WDT_WKEY)
|
||||
self.write_reg(self.RTC_CNTL_WDTCONFIG0_REG, 0)
|
||||
self.write_reg(self.RTC_CNTL_WDTWPROTECT_REG, 0)
|
||||
|
||||
def _post_connect(self):
|
||||
if not self.sync_stub_detected: # Don't run if stub is reused
|
||||
self.disable_rtc_watchdog()
|
||||
|
||||
|
||||
class ESP32C3StubLoader(ESP32C3ROM):
|
||||
"""Access class for ESP32C3 stub loader, runs on top of ROM.
|
||||
|
||||
(Basically the same as ESP32StubLoader, but different base class.
|
||||
Can possibly be made into a mixin.)
|
||||
"""
|
||||
|
||||
FLASH_WRITE_SIZE = 0x4000 # matches MAX_WRITE_BLOCK in stub_loader.c
|
||||
STATUS_BYTES_LENGTH = 2 # same as ESP8266, different to ESP32 ROM
|
||||
IS_STUB = True
|
||||
|
||||
def __init__(self, rom_loader):
|
||||
self.secure_download_mode = rom_loader.secure_download_mode
|
||||
self._port = rom_loader._port
|
||||
self._trace_enabled = rom_loader._trace_enabled
|
||||
self.cache = rom_loader.cache
|
||||
self.flush_input() # resets _slip_reader
|
||||
|
||||
|
||||
ESP32C3ROM.STUB_CLASS = ESP32C3StubLoader
|
||||
@@ -1,189 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2022 Fredrik Ahlberg, Angus Gratton,
|
||||
# Espressif Systems (Shanghai) CO LTD, other contributors as noted.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import struct
|
||||
|
||||
from .esp32c3 import ESP32C3ROM
|
||||
from ..util import FatalError, NotImplementedInROMError
|
||||
|
||||
|
||||
class ESP32C6ROM(ESP32C3ROM):
|
||||
CHIP_NAME = "ESP32-C6"
|
||||
IMAGE_CHIP_ID = 13
|
||||
|
||||
FPGA_SLOW_BOOT = False
|
||||
|
||||
IROM_MAP_START = 0x42000000
|
||||
IROM_MAP_END = 0x42800000
|
||||
DROM_MAP_START = 0x42800000
|
||||
DROM_MAP_END = 0x43000000
|
||||
|
||||
BOOTLOADER_FLASH_OFFSET = 0x0
|
||||
|
||||
# Magic value for ESP32C6
|
||||
CHIP_DETECT_MAGIC_VALUE = [0x2CE0806F]
|
||||
|
||||
SPI_REG_BASE = 0x60003000
|
||||
SPI_USR_OFFS = 0x18
|
||||
SPI_USR1_OFFS = 0x1C
|
||||
SPI_USR2_OFFS = 0x20
|
||||
SPI_MOSI_DLEN_OFFS = 0x24
|
||||
SPI_MISO_DLEN_OFFS = 0x28
|
||||
SPI_W0_OFFS = 0x58
|
||||
|
||||
UART_DATE_REG_ADDR = 0x60000000 + 0x7C
|
||||
|
||||
EFUSE_BASE = 0x600B0800
|
||||
EFUSE_BLOCK1_ADDR = EFUSE_BASE + 0x044
|
||||
MAC_EFUSE_REG = EFUSE_BASE + 0x044
|
||||
|
||||
EFUSE_RD_REG_BASE = EFUSE_BASE + 0x030 # BLOCK0 read base address
|
||||
|
||||
EFUSE_PURPOSE_KEY0_REG = EFUSE_BASE + 0x34
|
||||
EFUSE_PURPOSE_KEY0_SHIFT = 24
|
||||
EFUSE_PURPOSE_KEY1_REG = EFUSE_BASE + 0x34
|
||||
EFUSE_PURPOSE_KEY1_SHIFT = 28
|
||||
EFUSE_PURPOSE_KEY2_REG = EFUSE_BASE + 0x38
|
||||
EFUSE_PURPOSE_KEY2_SHIFT = 0
|
||||
EFUSE_PURPOSE_KEY3_REG = EFUSE_BASE + 0x38
|
||||
EFUSE_PURPOSE_KEY3_SHIFT = 4
|
||||
EFUSE_PURPOSE_KEY4_REG = EFUSE_BASE + 0x38
|
||||
EFUSE_PURPOSE_KEY4_SHIFT = 8
|
||||
EFUSE_PURPOSE_KEY5_REG = EFUSE_BASE + 0x38
|
||||
EFUSE_PURPOSE_KEY5_SHIFT = 12
|
||||
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG = EFUSE_RD_REG_BASE
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT = 1 << 20
|
||||
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_REG = EFUSE_BASE + 0x034
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_MASK = 0x7 << 18
|
||||
|
||||
EFUSE_SECURE_BOOT_EN_REG = EFUSE_BASE + 0x038
|
||||
EFUSE_SECURE_BOOT_EN_MASK = 1 << 20
|
||||
|
||||
PURPOSE_VAL_XTS_AES128_KEY = 4
|
||||
|
||||
SUPPORTS_ENCRYPTED_FLASH = True
|
||||
|
||||
FLASH_ENCRYPTED_WRITE_ALIGN = 16
|
||||
|
||||
UARTDEV_BUF_NO = 0x4087F580 # Variable in ROM .bss which indicates the port in use
|
||||
UARTDEV_BUF_NO_USB_JTAG_SERIAL = 3 # The above var when USB-JTAG/Serial is used
|
||||
|
||||
DR_REG_LP_WDT_BASE = 0x600B1C00
|
||||
RTC_CNTL_WDTCONFIG0_REG = DR_REG_LP_WDT_BASE + 0x0 # LP_WDT_RWDT_CONFIG0_REG
|
||||
RTC_CNTL_WDTWPROTECT_REG = DR_REG_LP_WDT_BASE + 0x0018 # LP_WDT_RWDT_WPROTECT_REG
|
||||
|
||||
FLASH_FREQUENCY = {
|
||||
"80m": 0x0, # workaround for wrong mspi HS div value in ROM
|
||||
"40m": 0x0,
|
||||
"20m": 0x2,
|
||||
}
|
||||
|
||||
MEMORY_MAP = [
|
||||
[0x00000000, 0x00010000, "PADDING"],
|
||||
[0x42800000, 0x43000000, "DROM"],
|
||||
[0x40800000, 0x40880000, "DRAM"],
|
||||
[0x40800000, 0x40880000, "BYTE_ACCESSIBLE"],
|
||||
[0x4004AC00, 0x40050000, "DROM_MASK"],
|
||||
[0x40000000, 0x4004AC00, "IROM_MASK"],
|
||||
[0x42000000, 0x42800000, "IROM"],
|
||||
[0x40800000, 0x40880000, "IRAM"],
|
||||
[0x50000000, 0x50004000, "RTC_IRAM"],
|
||||
[0x50000000, 0x50004000, "RTC_DRAM"],
|
||||
[0x600FE000, 0x60100000, "MEM_INTERNAL2"],
|
||||
]
|
||||
|
||||
def get_pkg_version(self):
|
||||
num_word = 3
|
||||
return (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * num_word)) >> 21) & 0x07
|
||||
|
||||
def get_minor_chip_version(self):
|
||||
hi_num_word = 5
|
||||
hi = (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * hi_num_word)) >> 23) & 0x01
|
||||
low_num_word = 3
|
||||
low = (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * low_num_word)) >> 18) & 0x07
|
||||
return (hi << 3) + low
|
||||
|
||||
def get_major_chip_version(self):
|
||||
num_word = 5
|
||||
return (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * num_word)) >> 24) & 0x03
|
||||
|
||||
def get_chip_description(self):
|
||||
chip_name = {
|
||||
0: "ESP32-C6",
|
||||
}.get(self.get_pkg_version(), "unknown ESP32-C6")
|
||||
major_rev = self.get_major_chip_version()
|
||||
minor_rev = self.get_minor_chip_version()
|
||||
return f"{chip_name} (revision v{major_rev}.{minor_rev})"
|
||||
|
||||
def get_chip_features(self):
|
||||
return ["WiFi 6", "BT 5", "IEEE802.15.4"]
|
||||
|
||||
def get_crystal_freq(self):
|
||||
# ESP32C6 XTAL is fixed to 40MHz
|
||||
return 40
|
||||
|
||||
def override_vddsdio(self, new_voltage):
|
||||
raise NotImplementedInROMError(
|
||||
"VDD_SDIO overrides are not supported for ESP32-C6"
|
||||
)
|
||||
|
||||
def read_mac(self):
|
||||
mac0 = self.read_reg(self.MAC_EFUSE_REG)
|
||||
mac1 = self.read_reg(self.MAC_EFUSE_REG + 4) # only bottom 16 bits are MAC
|
||||
bitstring = struct.pack(">II", mac1, mac0)[2:]
|
||||
return tuple(bitstring)
|
||||
|
||||
def get_flash_crypt_config(self):
|
||||
return None # doesn't exist on ESP32-C6
|
||||
|
||||
def get_secure_boot_enabled(self):
|
||||
return (
|
||||
self.read_reg(self.EFUSE_SECURE_BOOT_EN_REG)
|
||||
& self.EFUSE_SECURE_BOOT_EN_MASK
|
||||
)
|
||||
|
||||
def get_key_block_purpose(self, key_block):
|
||||
if key_block < 0 or key_block > 5:
|
||||
raise FatalError("Valid key block numbers must be in range 0-5")
|
||||
|
||||
reg, shift = [
|
||||
(self.EFUSE_PURPOSE_KEY0_REG, self.EFUSE_PURPOSE_KEY0_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY1_REG, self.EFUSE_PURPOSE_KEY1_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY2_REG, self.EFUSE_PURPOSE_KEY2_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY3_REG, self.EFUSE_PURPOSE_KEY3_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY4_REG, self.EFUSE_PURPOSE_KEY4_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY5_REG, self.EFUSE_PURPOSE_KEY5_SHIFT),
|
||||
][key_block]
|
||||
return (self.read_reg(reg) >> shift) & 0xF
|
||||
|
||||
def is_flash_encryption_key_valid(self):
|
||||
# Need to see an AES-128 key
|
||||
purposes = [self.get_key_block_purpose(b) for b in range(6)]
|
||||
|
||||
return any(p == self.PURPOSE_VAL_XTS_AES128_KEY for p in purposes)
|
||||
|
||||
|
||||
class ESP32C6StubLoader(ESP32C6ROM):
|
||||
"""Access class for ESP32C6 stub loader, runs on top of ROM.
|
||||
|
||||
(Basically the same as ESP32StubLoader, but different base class.
|
||||
Can possibly be made into a mixin.)
|
||||
"""
|
||||
|
||||
FLASH_WRITE_SIZE = 0x4000 # matches MAX_WRITE_BLOCK in stub_loader.c
|
||||
STATUS_BYTES_LENGTH = 2 # same as ESP8266, different to ESP32 ROM
|
||||
IS_STUB = True
|
||||
|
||||
def __init__(self, rom_loader):
|
||||
self.secure_download_mode = rom_loader.secure_download_mode
|
||||
self._port = rom_loader._port
|
||||
self._trace_enabled = rom_loader._trace_enabled
|
||||
self.cache = rom_loader.cache
|
||||
self.flush_input() # resets _slip_reader
|
||||
|
||||
|
||||
ESP32C6ROM.STUB_CLASS = ESP32C6StubLoader
|
||||
@@ -1,26 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2014-2022 Fredrik Ahlberg, Angus Gratton,
|
||||
# Espressif Systems (Shanghai) CO LTD, other contributors as noted.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
from .esp32c3 import ESP32C3ROM
|
||||
|
||||
|
||||
class ESP32C6BETAROM(ESP32C3ROM):
|
||||
CHIP_NAME = "ESP32-C6(beta)"
|
||||
IMAGE_CHIP_ID = 7
|
||||
|
||||
CHIP_DETECT_MAGIC_VALUE = [0x0DA1806F]
|
||||
|
||||
UART_DATE_REG_ADDR = 0x00000500
|
||||
|
||||
def get_chip_description(self):
|
||||
chip_name = {
|
||||
0: "ESP32-C6",
|
||||
}.get(self.get_pkg_version(), "unknown ESP32-C6")
|
||||
major_rev = self.get_major_chip_version()
|
||||
minor_rev = self.get_minor_chip_version()
|
||||
return f"{chip_name} (revision v{major_rev}.{minor_rev})"
|
||||
|
||||
def _post_connect(self):
|
||||
pass
|
||||
@@ -1,65 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2022 Fredrik Ahlberg, Angus Gratton,
|
||||
# Espressif Systems (Shanghai) CO LTD, other contributors as noted.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
from .esp32c6 import ESP32C6ROM
|
||||
|
||||
|
||||
class ESP32H2ROM(ESP32C6ROM):
|
||||
CHIP_NAME = "ESP32-H2"
|
||||
IMAGE_CHIP_ID = 16
|
||||
|
||||
# Magic value for ESP32H2
|
||||
CHIP_DETECT_MAGIC_VALUE = [0xD7B73E80]
|
||||
|
||||
FLASH_FREQUENCY = {
|
||||
"48m": 0xF,
|
||||
"24m": 0x0,
|
||||
"16m": 0x1,
|
||||
"12m": 0x2,
|
||||
}
|
||||
|
||||
def get_pkg_version(self):
|
||||
num_word = 3
|
||||
block1_addr = self.EFUSE_BASE + 0x044
|
||||
word3 = self.read_reg(block1_addr + (4 * num_word))
|
||||
pkg_version = (word3 >> 21) & 0x0F
|
||||
return pkg_version
|
||||
|
||||
def get_chip_description(self):
|
||||
chip_name = {
|
||||
0: "ESP32-H2",
|
||||
}.get(self.get_pkg_version(), "unknown ESP32-H2")
|
||||
major_rev = self.get_major_chip_version()
|
||||
minor_rev = self.get_minor_chip_version()
|
||||
return f"{chip_name} (revision v{major_rev}.{minor_rev})"
|
||||
|
||||
def get_chip_features(self):
|
||||
return ["BLE"]
|
||||
|
||||
def get_crystal_freq(self):
|
||||
# ESP32H2 XTAL is fixed to 32MHz
|
||||
return 32
|
||||
|
||||
|
||||
class ESP32H2StubLoader(ESP32H2ROM):
|
||||
"""Access class for ESP32H2 stub loader, runs on top of ROM.
|
||||
|
||||
(Basically the same as ESP32StubLoader, but different base class.
|
||||
Can possibly be made into a mixin.)
|
||||
"""
|
||||
|
||||
FLASH_WRITE_SIZE = 0x4000 # matches MAX_WRITE_BLOCK in stub_loader.c
|
||||
STATUS_BYTES_LENGTH = 2 # same as ESP8266, different to ESP32 ROM
|
||||
IS_STUB = True
|
||||
|
||||
def __init__(self, rom_loader):
|
||||
self.secure_download_mode = rom_loader.secure_download_mode
|
||||
self._port = rom_loader._port
|
||||
self._trace_enabled = rom_loader._trace_enabled
|
||||
self.cache = rom_loader.cache
|
||||
self.flush_input() # resets _slip_reader
|
||||
|
||||
|
||||
ESP32H2ROM.STUB_CLASS = ESP32H2StubLoader
|
||||
@@ -1,164 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2014-2022 Fredrik Ahlberg, Angus Gratton,
|
||||
# Espressif Systems (Shanghai) CO LTD, other contributors as noted.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import struct
|
||||
|
||||
from .esp32c3 import ESP32C3ROM
|
||||
from ..util import FatalError, NotImplementedInROMError
|
||||
|
||||
|
||||
class ESP32H2BETA1ROM(ESP32C3ROM):
|
||||
CHIP_NAME = "ESP32-H2(beta1)"
|
||||
IMAGE_CHIP_ID = 10
|
||||
|
||||
IROM_MAP_START = 0x42000000
|
||||
IROM_MAP_END = 0x42800000
|
||||
DROM_MAP_START = 0x3C000000
|
||||
DROM_MAP_END = 0x3C800000
|
||||
|
||||
SPI_REG_BASE = 0x60002000
|
||||
SPI_USR_OFFS = 0x18
|
||||
SPI_USR1_OFFS = 0x1C
|
||||
SPI_USR2_OFFS = 0x20
|
||||
SPI_MOSI_DLEN_OFFS = 0x24
|
||||
SPI_MISO_DLEN_OFFS = 0x28
|
||||
SPI_W0_OFFS = 0x58
|
||||
|
||||
BOOTLOADER_FLASH_OFFSET = 0x0
|
||||
|
||||
CHIP_DETECT_MAGIC_VALUE = [0xCA26CC22]
|
||||
|
||||
UART_DATE_REG_ADDR = 0x60000000 + 0x7C
|
||||
|
||||
EFUSE_BASE = 0x6001A000
|
||||
EFUSE_BLOCK1_ADDR = EFUSE_BASE + 0x044
|
||||
MAC_EFUSE_REG = EFUSE_BASE + 0x044
|
||||
|
||||
EFUSE_RD_REG_BASE = EFUSE_BASE + 0x030 # BLOCK0 read base address
|
||||
|
||||
EFUSE_PURPOSE_KEY0_REG = EFUSE_BASE + 0x34
|
||||
EFUSE_PURPOSE_KEY0_SHIFT = 24
|
||||
EFUSE_PURPOSE_KEY1_REG = EFUSE_BASE + 0x34
|
||||
EFUSE_PURPOSE_KEY1_SHIFT = 28
|
||||
EFUSE_PURPOSE_KEY2_REG = EFUSE_BASE + 0x38
|
||||
EFUSE_PURPOSE_KEY2_SHIFT = 0
|
||||
EFUSE_PURPOSE_KEY3_REG = EFUSE_BASE + 0x38
|
||||
EFUSE_PURPOSE_KEY3_SHIFT = 4
|
||||
EFUSE_PURPOSE_KEY4_REG = EFUSE_BASE + 0x38
|
||||
EFUSE_PURPOSE_KEY4_SHIFT = 8
|
||||
EFUSE_PURPOSE_KEY5_REG = EFUSE_BASE + 0x38
|
||||
EFUSE_PURPOSE_KEY5_SHIFT = 12
|
||||
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG = EFUSE_RD_REG_BASE
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT = 1 << 20
|
||||
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_REG = EFUSE_BASE + 0x034
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_MASK = 0x7 << 18
|
||||
|
||||
EFUSE_SECURE_BOOT_EN_REG = EFUSE_BASE + 0x038
|
||||
EFUSE_SECURE_BOOT_EN_MASK = 1 << 20
|
||||
|
||||
PURPOSE_VAL_XTS_AES128_KEY = 4
|
||||
|
||||
SUPPORTS_ENCRYPTED_FLASH = True
|
||||
|
||||
FLASH_ENCRYPTED_WRITE_ALIGN = 16
|
||||
|
||||
MEMORY_MAP = []
|
||||
|
||||
FLASH_FREQUENCY = {
|
||||
"48m": 0xF,
|
||||
"24m": 0x0,
|
||||
"16m": 0x1,
|
||||
"12m": 0x2,
|
||||
}
|
||||
|
||||
def get_pkg_version(self):
|
||||
num_word = 3
|
||||
return (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * num_word)) >> 21) & 0x0F
|
||||
|
||||
def get_minor_chip_version(self):
|
||||
hi_num_word = 5
|
||||
hi = (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * hi_num_word)) >> 23) & 0x01
|
||||
low_num_word = 3
|
||||
low = (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * low_num_word)) >> 18) & 0x07
|
||||
return (hi << 3) + low
|
||||
|
||||
def get_major_chip_version(self):
|
||||
num_word = 5
|
||||
return (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * num_word)) >> 24) & 0x03
|
||||
|
||||
def get_chip_description(self):
|
||||
chip_name = {
|
||||
0: "ESP32-H2",
|
||||
}.get(self.get_pkg_version(), "unknown ESP32-H2")
|
||||
major_rev = self.get_major_chip_version()
|
||||
minor_rev = self.get_minor_chip_version()
|
||||
return f"{chip_name} (revision v{major_rev}.{minor_rev})"
|
||||
|
||||
def get_chip_features(self):
|
||||
return ["BLE", "IEEE802.15.4"]
|
||||
|
||||
def get_crystal_freq(self):
|
||||
return 32
|
||||
|
||||
def override_vddsdio(self, new_voltage):
|
||||
raise NotImplementedInROMError(
|
||||
"VDD_SDIO overrides are not supported for ESP32-H2"
|
||||
)
|
||||
|
||||
def read_mac(self):
|
||||
mac0 = self.read_reg(self.MAC_EFUSE_REG)
|
||||
mac1 = self.read_reg(self.MAC_EFUSE_REG + 4) # only bottom 16 bits are MAC
|
||||
bitstring = struct.pack(">II", mac1, mac0)[2:]
|
||||
return tuple(bitstring)
|
||||
|
||||
def get_flash_crypt_config(self):
|
||||
return None # doesn't exist on ESP32-H2
|
||||
|
||||
def get_key_block_purpose(self, key_block):
|
||||
if key_block < 0 or key_block > 5:
|
||||
raise FatalError("Valid key block numbers must be in range 0-5")
|
||||
|
||||
reg, shift = [
|
||||
(self.EFUSE_PURPOSE_KEY0_REG, self.EFUSE_PURPOSE_KEY0_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY1_REG, self.EFUSE_PURPOSE_KEY1_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY2_REG, self.EFUSE_PURPOSE_KEY2_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY3_REG, self.EFUSE_PURPOSE_KEY3_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY4_REG, self.EFUSE_PURPOSE_KEY4_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY5_REG, self.EFUSE_PURPOSE_KEY5_SHIFT),
|
||||
][key_block]
|
||||
return (self.read_reg(reg) >> shift) & 0xF
|
||||
|
||||
def is_flash_encryption_key_valid(self):
|
||||
# Need to see an AES-128 key
|
||||
purposes = [self.get_key_block_purpose(b) for b in range(6)]
|
||||
|
||||
return any(p == self.PURPOSE_VAL_XTS_AES128_KEY for p in purposes)
|
||||
|
||||
def _post_connect(self):
|
||||
pass
|
||||
|
||||
|
||||
class ESP32H2BETA1StubLoader(ESP32H2BETA1ROM):
|
||||
"""Access class for ESP32H2BETA1 stub loader, runs on top of ROM.
|
||||
|
||||
(Basically the same as ESP32StubLoader, but different base class.
|
||||
Can possibly be made into a mixin.)
|
||||
"""
|
||||
|
||||
FLASH_WRITE_SIZE = 0x4000 # matches MAX_WRITE_BLOCK in stub_loader.c
|
||||
STATUS_BYTES_LENGTH = 2 # same as ESP8266, different to ESP32 ROM
|
||||
IS_STUB = True
|
||||
|
||||
def __init__(self, rom_loader):
|
||||
self.secure_download_mode = rom_loader.secure_download_mode
|
||||
self._port = rom_loader._port
|
||||
self._trace_enabled = rom_loader._trace_enabled
|
||||
self.cache = rom_loader.cache
|
||||
self.flush_input() # resets _slip_reader
|
||||
|
||||
|
||||
ESP32H2BETA1ROM.STUB_CLASS = ESP32H2BETA1StubLoader
|
||||
@@ -1,43 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2014-2022 Fredrik Ahlberg, Angus Gratton,
|
||||
# Espressif Systems (Shanghai) CO LTD, other contributors as noted.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
from .esp32h2beta1 import ESP32H2BETA1ROM
|
||||
|
||||
|
||||
class ESP32H2BETA2ROM(ESP32H2BETA1ROM):
|
||||
CHIP_NAME = "ESP32-H2(beta2)"
|
||||
IMAGE_CHIP_ID = 14
|
||||
|
||||
CHIP_DETECT_MAGIC_VALUE = [0x6881B06F]
|
||||
|
||||
def get_chip_description(self):
|
||||
chip_name = {
|
||||
1: "ESP32-H2(beta2)",
|
||||
}.get(self.get_pkg_version(), "unknown ESP32-H2")
|
||||
major_rev = self.get_major_chip_version()
|
||||
minor_rev = self.get_minor_chip_version()
|
||||
return f"{chip_name} (revision v{major_rev}.{minor_rev})"
|
||||
|
||||
|
||||
class ESP32H2BETA2StubLoader(ESP32H2BETA2ROM):
|
||||
"""Access class for ESP32H2BETA2 stub loader, runs on top of ROM.
|
||||
|
||||
(Basically the same as ESP32StubLoader, but different base class.
|
||||
Can possibly be made into a mixin.)
|
||||
"""
|
||||
|
||||
FLASH_WRITE_SIZE = 0x4000 # matches MAX_WRITE_BLOCK in stub_loader.c
|
||||
STATUS_BYTES_LENGTH = 2 # same as ESP8266, different to ESP32 ROM
|
||||
IS_STUB = True
|
||||
|
||||
def __init__(self, rom_loader):
|
||||
self.secure_download_mode = rom_loader.secure_download_mode
|
||||
self._port = rom_loader._port
|
||||
self._trace_enabled = rom_loader._trace_enabled
|
||||
self.cache = rom_loader.cache
|
||||
self.flush_input() # resets _slip_reader
|
||||
|
||||
|
||||
ESP32H2BETA2ROM.STUB_CLASS = ESP32H2BETA2StubLoader
|
||||
@@ -1,305 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2014-2023 Fredrik Ahlberg, Angus Gratton,
|
||||
# Espressif Systems (Shanghai) CO LTD, other contributors as noted.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import os
|
||||
import struct
|
||||
|
||||
from .esp32 import ESP32ROM
|
||||
from ..loader import ESPLoader
|
||||
from ..reset import HardReset
|
||||
from ..util import FatalError, NotImplementedInROMError
|
||||
|
||||
|
||||
class ESP32S2ROM(ESP32ROM):
|
||||
CHIP_NAME = "ESP32-S2"
|
||||
IMAGE_CHIP_ID = 2
|
||||
|
||||
FPGA_SLOW_BOOT = False
|
||||
|
||||
IROM_MAP_START = 0x40080000
|
||||
IROM_MAP_END = 0x40B80000
|
||||
DROM_MAP_START = 0x3F000000
|
||||
DROM_MAP_END = 0x3F3F0000
|
||||
|
||||
CHIP_DETECT_MAGIC_VALUE = [0x000007C6]
|
||||
|
||||
SPI_REG_BASE = 0x3F402000
|
||||
SPI_USR_OFFS = 0x18
|
||||
SPI_USR1_OFFS = 0x1C
|
||||
SPI_USR2_OFFS = 0x20
|
||||
SPI_MOSI_DLEN_OFFS = 0x24
|
||||
SPI_MISO_DLEN_OFFS = 0x28
|
||||
SPI_W0_OFFS = 0x58
|
||||
|
||||
MAC_EFUSE_REG = 0x3F41A044 # ESP32-S2 has special block for MAC efuses
|
||||
|
||||
UART_CLKDIV_REG = 0x3F400014
|
||||
|
||||
SUPPORTS_ENCRYPTED_FLASH = True
|
||||
|
||||
FLASH_ENCRYPTED_WRITE_ALIGN = 16
|
||||
|
||||
# todo: use espefuse APIs to get this info
|
||||
EFUSE_BASE = 0x3F41A000
|
||||
EFUSE_RD_REG_BASE = EFUSE_BASE + 0x030 # BLOCK0 read base address
|
||||
EFUSE_BLOCK1_ADDR = EFUSE_BASE + 0x044
|
||||
EFUSE_BLOCK2_ADDR = EFUSE_BASE + 0x05C
|
||||
|
||||
EFUSE_PURPOSE_KEY0_REG = EFUSE_BASE + 0x34
|
||||
EFUSE_PURPOSE_KEY0_SHIFT = 24
|
||||
EFUSE_PURPOSE_KEY1_REG = EFUSE_BASE + 0x34
|
||||
EFUSE_PURPOSE_KEY1_SHIFT = 28
|
||||
EFUSE_PURPOSE_KEY2_REG = EFUSE_BASE + 0x38
|
||||
EFUSE_PURPOSE_KEY2_SHIFT = 0
|
||||
EFUSE_PURPOSE_KEY3_REG = EFUSE_BASE + 0x38
|
||||
EFUSE_PURPOSE_KEY3_SHIFT = 4
|
||||
EFUSE_PURPOSE_KEY4_REG = EFUSE_BASE + 0x38
|
||||
EFUSE_PURPOSE_KEY4_SHIFT = 8
|
||||
EFUSE_PURPOSE_KEY5_REG = EFUSE_BASE + 0x38
|
||||
EFUSE_PURPOSE_KEY5_SHIFT = 12
|
||||
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG = EFUSE_RD_REG_BASE
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT = 1 << 19
|
||||
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_REG = EFUSE_BASE + 0x034
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_MASK = 0x7 << 18
|
||||
|
||||
EFUSE_SECURE_BOOT_EN_REG = EFUSE_BASE + 0x038
|
||||
EFUSE_SECURE_BOOT_EN_MASK = 1 << 20
|
||||
|
||||
EFUSE_RD_REPEAT_DATA3_REG = EFUSE_BASE + 0x3C
|
||||
EFUSE_RD_REPEAT_DATA3_REG_FLASH_TYPE_MASK = 1 << 9
|
||||
|
||||
PURPOSE_VAL_XTS_AES256_KEY_1 = 2
|
||||
PURPOSE_VAL_XTS_AES256_KEY_2 = 3
|
||||
PURPOSE_VAL_XTS_AES128_KEY = 4
|
||||
|
||||
UARTDEV_BUF_NO = 0x3FFFFD14 # Variable in ROM .bss which indicates the port in use
|
||||
UARTDEV_BUF_NO_USB_OTG = 2 # Value of the above indicating that USB-OTG is in use
|
||||
|
||||
USB_RAM_BLOCK = 0x800 # Max block size USB-OTG is used
|
||||
|
||||
GPIO_STRAP_REG = 0x3F404038
|
||||
GPIO_STRAP_SPI_BOOT_MASK = 0x8 # Not download mode
|
||||
RTC_CNTL_OPTION1_REG = 0x3F408128
|
||||
RTC_CNTL_FORCE_DOWNLOAD_BOOT_MASK = 0x1 # Is download mode forced over USB?
|
||||
|
||||
MEMORY_MAP = [
|
||||
[0x00000000, 0x00010000, "PADDING"],
|
||||
[0x3F000000, 0x3FF80000, "DROM"],
|
||||
[0x3F500000, 0x3FF80000, "EXTRAM_DATA"],
|
||||
[0x3FF9E000, 0x3FFA0000, "RTC_DRAM"],
|
||||
[0x3FF9E000, 0x40000000, "BYTE_ACCESSIBLE"],
|
||||
[0x3FF9E000, 0x40072000, "MEM_INTERNAL"],
|
||||
[0x3FFB0000, 0x40000000, "DRAM"],
|
||||
[0x40000000, 0x4001A100, "IROM_MASK"],
|
||||
[0x40020000, 0x40070000, "IRAM"],
|
||||
[0x40070000, 0x40072000, "RTC_IRAM"],
|
||||
[0x40080000, 0x40800000, "IROM"],
|
||||
[0x50000000, 0x50002000, "RTC_DATA"],
|
||||
]
|
||||
|
||||
def get_pkg_version(self):
|
||||
num_word = 4
|
||||
return (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * num_word)) >> 0) & 0x0F
|
||||
|
||||
def get_minor_chip_version(self):
|
||||
hi_num_word = 3
|
||||
hi = (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * hi_num_word)) >> 20) & 0x01
|
||||
low_num_word = 4
|
||||
low = (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * low_num_word)) >> 4) & 0x07
|
||||
return (hi << 3) + low
|
||||
|
||||
def get_major_chip_version(self):
|
||||
num_word = 3
|
||||
return (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * num_word)) >> 18) & 0x03
|
||||
|
||||
def get_flash_version(self):
|
||||
num_word = 3
|
||||
return (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * num_word)) >> 21) & 0x0F
|
||||
|
||||
def get_psram_version(self):
|
||||
num_word = 3
|
||||
return (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * num_word)) >> 28) & 0x0F
|
||||
|
||||
def get_block2_version(self):
|
||||
# BLK_VERSION_MINOR
|
||||
num_word = 4
|
||||
return (self.read_reg(self.EFUSE_BLOCK2_ADDR + (4 * num_word)) >> 4) & 0x07
|
||||
|
||||
def get_chip_description(self):
|
||||
chip_name = {
|
||||
0: "ESP32-S2",
|
||||
1: "ESP32-S2FH2",
|
||||
2: "ESP32-S2FH4",
|
||||
102: "ESP32-S2FNR2",
|
||||
100: "ESP32-S2R2",
|
||||
}.get(
|
||||
self.get_flash_version() + self.get_psram_version() * 100,
|
||||
"unknown ESP32-S2",
|
||||
)
|
||||
major_rev = self.get_major_chip_version()
|
||||
minor_rev = self.get_minor_chip_version()
|
||||
return f"{chip_name} (revision v{major_rev}.{minor_rev})"
|
||||
|
||||
def get_chip_features(self):
|
||||
features = ["WiFi"]
|
||||
|
||||
if self.secure_download_mode:
|
||||
features += ["Secure Download Mode Enabled"]
|
||||
|
||||
flash_version = {
|
||||
0: "No Embedded Flash",
|
||||
1: "Embedded Flash 2MB",
|
||||
2: "Embedded Flash 4MB",
|
||||
}.get(self.get_flash_version(), "Unknown Embedded Flash")
|
||||
features += [flash_version]
|
||||
|
||||
psram_version = {
|
||||
0: "No Embedded PSRAM",
|
||||
1: "Embedded PSRAM 2MB",
|
||||
2: "Embedded PSRAM 4MB",
|
||||
}.get(self.get_psram_version(), "Unknown Embedded PSRAM")
|
||||
features += [psram_version]
|
||||
|
||||
block2_version = {
|
||||
0: "No calibration in BLK2 of efuse",
|
||||
1: "ADC and temperature sensor calibration in BLK2 of efuse V1",
|
||||
2: "ADC and temperature sensor calibration in BLK2 of efuse V2",
|
||||
}.get(self.get_block2_version(), "Unknown Calibration in BLK2")
|
||||
features += [block2_version]
|
||||
|
||||
return features
|
||||
|
||||
def get_crystal_freq(self):
|
||||
# ESP32-S2 XTAL is fixed to 40MHz
|
||||
return 40
|
||||
|
||||
def override_vddsdio(self, new_voltage):
|
||||
raise NotImplementedInROMError(
|
||||
"VDD_SDIO overrides are not supported for ESP32-S2"
|
||||
)
|
||||
|
||||
def read_mac(self):
|
||||
mac0 = self.read_reg(self.MAC_EFUSE_REG)
|
||||
mac1 = self.read_reg(self.MAC_EFUSE_REG + 4) # only bottom 16 bits are MAC
|
||||
bitstring = struct.pack(">II", mac1, mac0)[2:]
|
||||
return tuple(bitstring)
|
||||
|
||||
def flash_type(self):
|
||||
return (
|
||||
1
|
||||
if self.read_reg(self.EFUSE_RD_REPEAT_DATA3_REG)
|
||||
& self.EFUSE_RD_REPEAT_DATA3_REG_FLASH_TYPE_MASK
|
||||
else 0
|
||||
)
|
||||
|
||||
def get_flash_crypt_config(self):
|
||||
return None # doesn't exist on ESP32-S2
|
||||
|
||||
def get_secure_boot_enabled(self):
|
||||
return (
|
||||
self.read_reg(self.EFUSE_SECURE_BOOT_EN_REG)
|
||||
& self.EFUSE_SECURE_BOOT_EN_MASK
|
||||
)
|
||||
|
||||
def get_key_block_purpose(self, key_block):
|
||||
if key_block < 0 or key_block > 5:
|
||||
raise FatalError("Valid key block numbers must be in range 0-5")
|
||||
|
||||
reg, shift = [
|
||||
(self.EFUSE_PURPOSE_KEY0_REG, self.EFUSE_PURPOSE_KEY0_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY1_REG, self.EFUSE_PURPOSE_KEY1_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY2_REG, self.EFUSE_PURPOSE_KEY2_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY3_REG, self.EFUSE_PURPOSE_KEY3_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY4_REG, self.EFUSE_PURPOSE_KEY4_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY5_REG, self.EFUSE_PURPOSE_KEY5_SHIFT),
|
||||
][key_block]
|
||||
return (self.read_reg(reg) >> shift) & 0xF
|
||||
|
||||
def is_flash_encryption_key_valid(self):
|
||||
# Need to see either an AES-128 key or two AES-256 keys
|
||||
purposes = [self.get_key_block_purpose(b) for b in range(6)]
|
||||
|
||||
if any(p == self.PURPOSE_VAL_XTS_AES128_KEY for p in purposes):
|
||||
return True
|
||||
|
||||
return any(p == self.PURPOSE_VAL_XTS_AES256_KEY_1 for p in purposes) and any(
|
||||
p == self.PURPOSE_VAL_XTS_AES256_KEY_2 for p in purposes
|
||||
)
|
||||
|
||||
def uses_usb_otg(self):
|
||||
"""
|
||||
Check the UARTDEV_BUF_NO register to see if USB-OTG console is being used
|
||||
"""
|
||||
if self.secure_download_mode:
|
||||
return False # can't detect native USB in secure download mode
|
||||
return self.get_uart_no() == self.UARTDEV_BUF_NO_USB_OTG
|
||||
|
||||
def _post_connect(self):
|
||||
if self.uses_usb_otg():
|
||||
self.ESP_RAM_BLOCK = self.USB_RAM_BLOCK
|
||||
|
||||
def _check_if_can_reset(self):
|
||||
"""
|
||||
Check the strapping register to see if we can reset out of download mode.
|
||||
"""
|
||||
if os.getenv("ESPTOOL_TESTING") is not None:
|
||||
print("ESPTOOL_TESTING is set, ignoring strapping mode check")
|
||||
# Esptool tests over USB-OTG run with GPIO0 strapped low,
|
||||
# don't complain in this case.
|
||||
return
|
||||
strap_reg = self.read_reg(self.GPIO_STRAP_REG)
|
||||
force_dl_reg = self.read_reg(self.RTC_CNTL_OPTION1_REG)
|
||||
if (
|
||||
strap_reg & self.GPIO_STRAP_SPI_BOOT_MASK == 0
|
||||
and force_dl_reg & self.RTC_CNTL_FORCE_DOWNLOAD_BOOT_MASK == 0
|
||||
):
|
||||
print(
|
||||
"WARNING: {} chip was placed into download mode using GPIO0.\n"
|
||||
"esptool.py can not exit the download mode over USB. "
|
||||
"To run the app, reset the chip manually.\n"
|
||||
"To suppress this note, set --after option to 'no_reset'.".format(
|
||||
self.get_chip_description()
|
||||
)
|
||||
)
|
||||
raise SystemExit(1)
|
||||
|
||||
def hard_reset(self):
|
||||
uses_usb_otg = self.uses_usb_otg()
|
||||
if uses_usb_otg:
|
||||
self._check_if_can_reset()
|
||||
|
||||
print("Hard resetting via RTS pin...")
|
||||
HardReset(self._port, uses_usb_otg)()
|
||||
|
||||
def change_baud(self, baud):
|
||||
ESPLoader.change_baud(self, baud)
|
||||
|
||||
|
||||
class ESP32S2StubLoader(ESP32S2ROM):
|
||||
"""Access class for ESP32-S2 stub loader, runs on top of ROM.
|
||||
|
||||
(Basically the same as ESP32StubLoader, but different base class.
|
||||
Can possibly be made into a mixin.)
|
||||
"""
|
||||
|
||||
FLASH_WRITE_SIZE = 0x4000 # matches MAX_WRITE_BLOCK in stub_loader.c
|
||||
STATUS_BYTES_LENGTH = 2 # same as ESP8266, different to ESP32 ROM
|
||||
IS_STUB = True
|
||||
|
||||
def __init__(self, rom_loader):
|
||||
self.secure_download_mode = rom_loader.secure_download_mode
|
||||
self._port = rom_loader._port
|
||||
self._trace_enabled = rom_loader._trace_enabled
|
||||
self.cache = rom_loader.cache
|
||||
self.flush_input() # resets _slip_reader
|
||||
|
||||
if rom_loader.uses_usb_otg():
|
||||
self.ESP_RAM_BLOCK = self.USB_RAM_BLOCK
|
||||
self.FLASH_WRITE_SIZE = self.USB_RAM_BLOCK
|
||||
|
||||
|
||||
ESP32S2ROM.STUB_CLASS = ESP32S2StubLoader
|
||||
@@ -1,315 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2014-2023 Fredrik Ahlberg, Angus Gratton,
|
||||
# Espressif Systems (Shanghai) CO LTD, other contributors as noted.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import os
|
||||
import struct
|
||||
|
||||
from .esp32 import ESP32ROM
|
||||
from ..loader import ESPLoader
|
||||
from ..reset import HardReset
|
||||
from ..util import FatalError, NotImplementedInROMError
|
||||
|
||||
|
||||
class ESP32S3ROM(ESP32ROM):
|
||||
CHIP_NAME = "ESP32-S3"
|
||||
|
||||
IMAGE_CHIP_ID = 9
|
||||
|
||||
CHIP_DETECT_MAGIC_VALUE = [0x9]
|
||||
|
||||
FPGA_SLOW_BOOT = False
|
||||
|
||||
IROM_MAP_START = 0x42000000
|
||||
IROM_MAP_END = 0x44000000
|
||||
DROM_MAP_START = 0x3C000000
|
||||
DROM_MAP_END = 0x3E000000
|
||||
|
||||
UART_DATE_REG_ADDR = 0x60000080
|
||||
|
||||
SPI_REG_BASE = 0x60002000
|
||||
SPI_USR_OFFS = 0x18
|
||||
SPI_USR1_OFFS = 0x1C
|
||||
SPI_USR2_OFFS = 0x20
|
||||
SPI_MOSI_DLEN_OFFS = 0x24
|
||||
SPI_MISO_DLEN_OFFS = 0x28
|
||||
SPI_W0_OFFS = 0x58
|
||||
|
||||
BOOTLOADER_FLASH_OFFSET = 0x0
|
||||
|
||||
SUPPORTS_ENCRYPTED_FLASH = True
|
||||
|
||||
FLASH_ENCRYPTED_WRITE_ALIGN = 16
|
||||
|
||||
# todo: use espefuse APIs to get this info
|
||||
EFUSE_BASE = 0x60007000 # BLOCK0 read base address
|
||||
EFUSE_BLOCK1_ADDR = EFUSE_BASE + 0x44
|
||||
EFUSE_BLOCK2_ADDR = EFUSE_BASE + 0x5C
|
||||
MAC_EFUSE_REG = EFUSE_BASE + 0x044
|
||||
|
||||
EFUSE_RD_REG_BASE = EFUSE_BASE + 0x030 # BLOCK0 read base address
|
||||
|
||||
EFUSE_PURPOSE_KEY0_REG = EFUSE_BASE + 0x34
|
||||
EFUSE_PURPOSE_KEY0_SHIFT = 24
|
||||
EFUSE_PURPOSE_KEY1_REG = EFUSE_BASE + 0x34
|
||||
EFUSE_PURPOSE_KEY1_SHIFT = 28
|
||||
EFUSE_PURPOSE_KEY2_REG = EFUSE_BASE + 0x38
|
||||
EFUSE_PURPOSE_KEY2_SHIFT = 0
|
||||
EFUSE_PURPOSE_KEY3_REG = EFUSE_BASE + 0x38
|
||||
EFUSE_PURPOSE_KEY3_SHIFT = 4
|
||||
EFUSE_PURPOSE_KEY4_REG = EFUSE_BASE + 0x38
|
||||
EFUSE_PURPOSE_KEY4_SHIFT = 8
|
||||
EFUSE_PURPOSE_KEY5_REG = EFUSE_BASE + 0x38
|
||||
EFUSE_PURPOSE_KEY5_SHIFT = 12
|
||||
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG = EFUSE_RD_REG_BASE
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT = 1 << 20
|
||||
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_REG = EFUSE_BASE + 0x034
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_MASK = 0x7 << 18
|
||||
|
||||
EFUSE_SECURE_BOOT_EN_REG = EFUSE_BASE + 0x038
|
||||
EFUSE_SECURE_BOOT_EN_MASK = 1 << 20
|
||||
|
||||
EFUSE_RD_REPEAT_DATA3_REG = EFUSE_BASE + 0x3C
|
||||
EFUSE_RD_REPEAT_DATA3_REG_FLASH_TYPE_MASK = 1 << 9
|
||||
|
||||
PURPOSE_VAL_XTS_AES256_KEY_1 = 2
|
||||
PURPOSE_VAL_XTS_AES256_KEY_2 = 3
|
||||
PURPOSE_VAL_XTS_AES128_KEY = 4
|
||||
|
||||
UARTDEV_BUF_NO = 0x3FCEF14C # Variable in ROM .bss which indicates the port in use
|
||||
UARTDEV_BUF_NO_USB_OTG = 3 # The above var when USB-OTG is used
|
||||
UARTDEV_BUF_NO_USB_JTAG_SERIAL = 4 # The above var when USB-JTAG/Serial is used
|
||||
|
||||
RTC_CNTL_WDT_WKEY = 0x50D83AA1
|
||||
RTCCNTL_BASE_REG = 0x60008000
|
||||
RTC_CNTL_WDTCONFIG0_REG = RTCCNTL_BASE_REG + 0x0090
|
||||
RTC_CNTL_WDTWPROTECT_REG = RTCCNTL_BASE_REG + 0x00B0
|
||||
|
||||
USB_RAM_BLOCK = 0x800 # Max block size USB-OTG is used
|
||||
|
||||
GPIO_STRAP_REG = 0x60004038
|
||||
GPIO_STRAP_SPI_BOOT_MASK = 0x8 # Not download mode
|
||||
RTC_CNTL_OPTION1_REG = 0x6000812C
|
||||
RTC_CNTL_FORCE_DOWNLOAD_BOOT_MASK = 0x1 # Is download mode forced over USB?
|
||||
|
||||
UART_CLKDIV_REG = 0x60000014
|
||||
|
||||
MEMORY_MAP = [
|
||||
[0x00000000, 0x00010000, "PADDING"],
|
||||
[0x3C000000, 0x3D000000, "DROM"],
|
||||
[0x3D000000, 0x3E000000, "EXTRAM_DATA"],
|
||||
[0x600FE000, 0x60100000, "RTC_DRAM"],
|
||||
[0x3FC88000, 0x3FD00000, "BYTE_ACCESSIBLE"],
|
||||
[0x3FC88000, 0x403E2000, "MEM_INTERNAL"],
|
||||
[0x3FC88000, 0x3FD00000, "DRAM"],
|
||||
[0x40000000, 0x4001A100, "IROM_MASK"],
|
||||
[0x40370000, 0x403E0000, "IRAM"],
|
||||
[0x600FE000, 0x60100000, "RTC_IRAM"],
|
||||
[0x42000000, 0x42800000, "IROM"],
|
||||
[0x50000000, 0x50002000, "RTC_DATA"],
|
||||
]
|
||||
|
||||
def get_pkg_version(self):
|
||||
num_word = 3
|
||||
return (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * num_word)) >> 21) & 0x07
|
||||
|
||||
def is_eco0(self, minor_raw):
|
||||
# Workaround: The major version field was allocated to other purposes
|
||||
# when block version is v1.1.
|
||||
# Luckily only chip v0.0 have this kind of block version and efuse usage.
|
||||
return (
|
||||
(minor_raw & 0x7) == 0
|
||||
and self.get_blk_version_major() == 1
|
||||
and self.get_blk_version_minor() == 1
|
||||
)
|
||||
|
||||
def get_minor_chip_version(self):
|
||||
minor_raw = self.get_raw_minor_chip_version()
|
||||
if self.is_eco0(minor_raw):
|
||||
return 0
|
||||
return minor_raw
|
||||
|
||||
def get_raw_minor_chip_version(self):
|
||||
hi_num_word = 5
|
||||
hi = (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * hi_num_word)) >> 23) & 0x01
|
||||
low_num_word = 3
|
||||
low = (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * low_num_word)) >> 18) & 0x07
|
||||
return (hi << 3) + low
|
||||
|
||||
def get_blk_version_major(self):
|
||||
num_word = 4
|
||||
return (self.read_reg(self.EFUSE_BLOCK2_ADDR + (4 * num_word)) >> 0) & 0x03
|
||||
|
||||
def get_blk_version_minor(self):
|
||||
num_word = 3
|
||||
return (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * num_word)) >> 24) & 0x07
|
||||
|
||||
def get_major_chip_version(self):
|
||||
minor_raw = self.get_raw_minor_chip_version()
|
||||
if self.is_eco0(minor_raw):
|
||||
return 0
|
||||
return self.get_raw_major_chip_version()
|
||||
|
||||
def get_raw_major_chip_version(self):
|
||||
num_word = 5
|
||||
return (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * num_word)) >> 24) & 0x03
|
||||
|
||||
def get_chip_description(self):
|
||||
major_rev = self.get_major_chip_version()
|
||||
minor_rev = self.get_minor_chip_version()
|
||||
return f"{self.CHIP_NAME} (revision v{major_rev}.{minor_rev})"
|
||||
|
||||
def get_chip_features(self):
|
||||
return ["WiFi", "BLE"]
|
||||
|
||||
def get_crystal_freq(self):
|
||||
# ESP32S3 XTAL is fixed to 40MHz
|
||||
return 40
|
||||
|
||||
def get_flash_crypt_config(self):
|
||||
return None # doesn't exist on ESP32-S3
|
||||
|
||||
def get_key_block_purpose(self, key_block):
|
||||
if key_block < 0 or key_block > 5:
|
||||
raise FatalError("Valid key block numbers must be in range 0-5")
|
||||
|
||||
reg, shift = [
|
||||
(self.EFUSE_PURPOSE_KEY0_REG, self.EFUSE_PURPOSE_KEY0_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY1_REG, self.EFUSE_PURPOSE_KEY1_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY2_REG, self.EFUSE_PURPOSE_KEY2_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY3_REG, self.EFUSE_PURPOSE_KEY3_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY4_REG, self.EFUSE_PURPOSE_KEY4_SHIFT),
|
||||
(self.EFUSE_PURPOSE_KEY5_REG, self.EFUSE_PURPOSE_KEY5_SHIFT),
|
||||
][key_block]
|
||||
return (self.read_reg(reg) >> shift) & 0xF
|
||||
|
||||
def is_flash_encryption_key_valid(self):
|
||||
# Need to see either an AES-128 key or two AES-256 keys
|
||||
purposes = [self.get_key_block_purpose(b) for b in range(6)]
|
||||
|
||||
if any(p == self.PURPOSE_VAL_XTS_AES128_KEY for p in purposes):
|
||||
return True
|
||||
|
||||
return any(p == self.PURPOSE_VAL_XTS_AES256_KEY_1 for p in purposes) and any(
|
||||
p == self.PURPOSE_VAL_XTS_AES256_KEY_2 for p in purposes
|
||||
)
|
||||
|
||||
def get_secure_boot_enabled(self):
|
||||
return (
|
||||
self.read_reg(self.EFUSE_SECURE_BOOT_EN_REG)
|
||||
& self.EFUSE_SECURE_BOOT_EN_MASK
|
||||
)
|
||||
|
||||
def override_vddsdio(self, new_voltage):
|
||||
raise NotImplementedInROMError(
|
||||
"VDD_SDIO overrides are not supported for ESP32-S3"
|
||||
)
|
||||
|
||||
def read_mac(self):
|
||||
mac0 = self.read_reg(self.MAC_EFUSE_REG)
|
||||
mac1 = self.read_reg(self.MAC_EFUSE_REG + 4) # only bottom 16 bits are MAC
|
||||
bitstring = struct.pack(">II", mac1, mac0)[2:]
|
||||
return tuple(bitstring)
|
||||
|
||||
def flash_type(self):
|
||||
return (
|
||||
1
|
||||
if self.read_reg(self.EFUSE_RD_REPEAT_DATA3_REG)
|
||||
& self.EFUSE_RD_REPEAT_DATA3_REG_FLASH_TYPE_MASK
|
||||
else 0
|
||||
)
|
||||
|
||||
def uses_usb_otg(self):
|
||||
"""
|
||||
Check the UARTDEV_BUF_NO register to see if USB-OTG console is being used
|
||||
"""
|
||||
if self.secure_download_mode:
|
||||
return False # can't detect native USB in secure download mode
|
||||
return self.get_uart_no() == self.UARTDEV_BUF_NO_USB_OTG
|
||||
|
||||
def uses_usb_jtag_serial(self):
|
||||
"""
|
||||
Check the UARTDEV_BUF_NO register to see if USB-JTAG/Serial is being used
|
||||
"""
|
||||
if self.secure_download_mode:
|
||||
return False # can't detect USB-JTAG/Serial in secure download mode
|
||||
return self.get_uart_no() == self.UARTDEV_BUF_NO_USB_JTAG_SERIAL
|
||||
|
||||
def disable_rtc_watchdog(self):
|
||||
# When USB-JTAG/Serial is used, the RTC watchdog is not reset
|
||||
# and can then reset the board during flashing. Disable it.
|
||||
if self.uses_usb_jtag_serial():
|
||||
self.write_reg(self.RTC_CNTL_WDTWPROTECT_REG, self.RTC_CNTL_WDT_WKEY)
|
||||
self.write_reg(self.RTC_CNTL_WDTCONFIG0_REG, 0)
|
||||
self.write_reg(self.RTC_CNTL_WDTWPROTECT_REG, 0)
|
||||
|
||||
def _post_connect(self):
|
||||
if self.uses_usb_otg():
|
||||
self.ESP_RAM_BLOCK = self.USB_RAM_BLOCK
|
||||
if not self.sync_stub_detected: # Don't run if stub is reused
|
||||
self.disable_rtc_watchdog()
|
||||
|
||||
def _check_if_can_reset(self):
|
||||
"""
|
||||
Check the strapping register to see if we can reset out of download mode.
|
||||
"""
|
||||
if os.getenv("ESPTOOL_TESTING") is not None:
|
||||
print("ESPTOOL_TESTING is set, ignoring strapping mode check")
|
||||
# Esptool tests over USB-OTG run with GPIO0 strapped low,
|
||||
# don't complain in this case.
|
||||
return
|
||||
strap_reg = self.read_reg(self.GPIO_STRAP_REG)
|
||||
force_dl_reg = self.read_reg(self.RTC_CNTL_OPTION1_REG)
|
||||
if (
|
||||
strap_reg & self.GPIO_STRAP_SPI_BOOT_MASK == 0
|
||||
and force_dl_reg & self.RTC_CNTL_FORCE_DOWNLOAD_BOOT_MASK == 0
|
||||
):
|
||||
print(
|
||||
"WARNING: {} chip was placed into download mode using GPIO0.\n"
|
||||
"esptool.py can not exit the download mode over USB. "
|
||||
"To run the app, reset the chip manually.\n"
|
||||
"To suppress this note, set --after option to 'no_reset'.".format(
|
||||
self.get_chip_description()
|
||||
)
|
||||
)
|
||||
raise SystemExit(1)
|
||||
|
||||
def hard_reset(self):
|
||||
uses_usb_otg = self.uses_usb_otg()
|
||||
if uses_usb_otg:
|
||||
self._check_if_can_reset()
|
||||
|
||||
print("Hard resetting via RTS pin...")
|
||||
HardReset(self._port, uses_usb_otg)()
|
||||
|
||||
def change_baud(self, baud):
|
||||
ESPLoader.change_baud(self, baud)
|
||||
|
||||
|
||||
class ESP32S3StubLoader(ESP32S3ROM):
|
||||
"""Access class for ESP32S3 stub loader, runs on top of ROM.
|
||||
|
||||
(Basically the same as ESP32StubLoader, but different base class.
|
||||
Can possibly be made into a mixin.)
|
||||
"""
|
||||
|
||||
FLASH_WRITE_SIZE = 0x4000 # matches MAX_WRITE_BLOCK in stub_loader.c
|
||||
STATUS_BYTES_LENGTH = 2 # same as ESP8266, different to ESP32 ROM
|
||||
IS_STUB = True
|
||||
|
||||
def __init__(self, rom_loader):
|
||||
self.secure_download_mode = rom_loader.secure_download_mode
|
||||
self._port = rom_loader._port
|
||||
self._trace_enabled = rom_loader._trace_enabled
|
||||
self.cache = rom_loader.cache
|
||||
self.flush_input() # resets _slip_reader
|
||||
|
||||
if rom_loader.uses_usb_otg():
|
||||
self.ESP_RAM_BLOCK = self.USB_RAM_BLOCK
|
||||
self.FLASH_WRITE_SIZE = self.USB_RAM_BLOCK
|
||||
|
||||
|
||||
ESP32S3ROM.STUB_CLASS = ESP32S3StubLoader
|
||||
@@ -1,42 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2014-2022 Fredrik Ahlberg, Angus Gratton,
|
||||
# Espressif Systems (Shanghai) CO LTD, other contributors as noted.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
from .esp32s3 import ESP32S3ROM
|
||||
|
||||
|
||||
class ESP32S3BETA2ROM(ESP32S3ROM):
|
||||
CHIP_NAME = "ESP32-S3(beta2)"
|
||||
IMAGE_CHIP_ID = 4
|
||||
|
||||
CHIP_DETECT_MAGIC_VALUE = [0xEB004136]
|
||||
|
||||
EFUSE_BASE = 0x6001A000 # BLOCK0 read base address
|
||||
|
||||
def get_chip_description(self):
|
||||
major_rev = self.get_major_chip_version()
|
||||
minor_rev = self.get_minor_chip_version()
|
||||
return f"{self.CHIP_NAME} (revision v{major_rev}.{minor_rev})"
|
||||
|
||||
|
||||
class ESP32S3BETA2StubLoader(ESP32S3BETA2ROM):
|
||||
"""Access class for ESP32S3 stub loader, runs on top of ROM.
|
||||
|
||||
(Basically the same as ESP32StubLoader, but different base class.
|
||||
Can possibly be made into a mixin.)
|
||||
"""
|
||||
|
||||
FLASH_WRITE_SIZE = 0x4000 # matches MAX_WRITE_BLOCK in stub_loader.c
|
||||
STATUS_BYTES_LENGTH = 2 # same as ESP8266, different to ESP32 ROM
|
||||
IS_STUB = True
|
||||
|
||||
def __init__(self, rom_loader):
|
||||
self.secure_download_mode = rom_loader.secure_download_mode
|
||||
self._port = rom_loader._port
|
||||
self._trace_enabled = rom_loader._trace_enabled
|
||||
self.cache = rom_loader.cache
|
||||
self.flush_input() # resets _slip_reader
|
||||
|
||||
|
||||
ESP32S3BETA2ROM.STUB_CLASS = ESP32S3BETA2StubLoader
|
||||
@@ -1,191 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2014-2022 Fredrik Ahlberg, Angus Gratton,
|
||||
# Espressif Systems (Shanghai) CO LTD, other contributors as noted.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
from ..loader import ESPLoader
|
||||
from ..util import FatalError, NotImplementedInROMError
|
||||
|
||||
|
||||
class ESP8266ROM(ESPLoader):
|
||||
"""Access class for ESP8266 ROM bootloader"""
|
||||
|
||||
CHIP_NAME = "ESP8266"
|
||||
IS_STUB = False
|
||||
|
||||
CHIP_DETECT_MAGIC_VALUE = [0xFFF0C101]
|
||||
|
||||
# OTP ROM addresses
|
||||
ESP_OTP_MAC0 = 0x3FF00050
|
||||
ESP_OTP_MAC1 = 0x3FF00054
|
||||
ESP_OTP_MAC3 = 0x3FF0005C
|
||||
|
||||
SPI_REG_BASE = 0x60000200
|
||||
SPI_USR_OFFS = 0x1C
|
||||
SPI_USR1_OFFS = 0x20
|
||||
SPI_USR2_OFFS = 0x24
|
||||
SPI_MOSI_DLEN_OFFS = None
|
||||
SPI_MISO_DLEN_OFFS = None
|
||||
SPI_W0_OFFS = 0x40
|
||||
|
||||
UART_CLKDIV_REG = 0x60000014
|
||||
|
||||
XTAL_CLK_DIVIDER = 2
|
||||
|
||||
FLASH_SIZES = {
|
||||
"512KB": 0x00,
|
||||
"256KB": 0x10,
|
||||
"1MB": 0x20,
|
||||
"2MB": 0x30,
|
||||
"4MB": 0x40,
|
||||
"2MB-c1": 0x50,
|
||||
"4MB-c1": 0x60,
|
||||
"8MB": 0x80,
|
||||
"16MB": 0x90,
|
||||
}
|
||||
|
||||
FLASH_FREQUENCY = {
|
||||
"80m": 0xF,
|
||||
"40m": 0x0,
|
||||
"26m": 0x1,
|
||||
"20m": 0x2,
|
||||
}
|
||||
|
||||
BOOTLOADER_FLASH_OFFSET = 0
|
||||
|
||||
MEMORY_MAP = [
|
||||
[0x3FF00000, 0x3FF00010, "DPORT"],
|
||||
[0x3FFE8000, 0x40000000, "DRAM"],
|
||||
[0x40100000, 0x40108000, "IRAM"],
|
||||
[0x40201010, 0x402E1010, "IROM"],
|
||||
]
|
||||
|
||||
def get_efuses(self):
|
||||
# Return the 128 bits of ESP8266 efuse as a single Python integer
|
||||
result = self.read_reg(0x3FF0005C) << 96
|
||||
result |= self.read_reg(0x3FF00058) << 64
|
||||
result |= self.read_reg(0x3FF00054) << 32
|
||||
result |= self.read_reg(0x3FF00050)
|
||||
return result
|
||||
|
||||
def _get_flash_size(self, efuses):
|
||||
# rX_Y = EFUSE_DATA_OUTX[Y]
|
||||
r0_4 = (efuses & (1 << 4)) != 0
|
||||
r3_25 = (efuses & (1 << 121)) != 0
|
||||
r3_26 = (efuses & (1 << 122)) != 0
|
||||
r3_27 = (efuses & (1 << 123)) != 0
|
||||
|
||||
if r0_4 and not r3_25:
|
||||
if not r3_27 and not r3_26:
|
||||
return 1
|
||||
elif not r3_27 and r3_26:
|
||||
return 2
|
||||
if not r0_4 and r3_25:
|
||||
if not r3_27 and not r3_26:
|
||||
return 2
|
||||
elif not r3_27 and r3_26:
|
||||
return 4
|
||||
return -1
|
||||
|
||||
def get_chip_description(self):
|
||||
efuses = self.get_efuses()
|
||||
is_8285 = (
|
||||
efuses & ((1 << 4) | 1 << 80)
|
||||
) != 0 # One or the other efuse bit is set for ESP8285
|
||||
if is_8285:
|
||||
flash_size = self._get_flash_size(efuses)
|
||||
max_temp = (
|
||||
efuses & (1 << 5)
|
||||
) != 0 # This efuse bit identifies the max flash temperature
|
||||
chip_name = {
|
||||
1: "ESP8285H08" if max_temp else "ESP8285N08",
|
||||
2: "ESP8285H16" if max_temp else "ESP8285N16",
|
||||
}.get(flash_size, "ESP8285")
|
||||
return chip_name
|
||||
return "ESP8266EX"
|
||||
|
||||
def get_chip_features(self):
|
||||
features = ["WiFi"]
|
||||
if "ESP8285" in self.get_chip_description():
|
||||
features += ["Embedded Flash"]
|
||||
return features
|
||||
|
||||
def flash_spi_attach(self, hspi_arg):
|
||||
if self.IS_STUB:
|
||||
super(ESP8266ROM, self).flash_spi_attach(hspi_arg)
|
||||
else:
|
||||
# ESP8266 ROM has no flash_spi_attach command in serial protocol,
|
||||
# but flash_begin will do it
|
||||
self.flash_begin(0, 0)
|
||||
|
||||
def flash_set_parameters(self, size):
|
||||
# not implemented in ROM, but OK to silently skip for ROM
|
||||
if self.IS_STUB:
|
||||
super(ESP8266ROM, self).flash_set_parameters(size)
|
||||
|
||||
def chip_id(self):
|
||||
"""
|
||||
Read Chip ID from efuse - the equivalent of the SDK system_get_chip_id() func
|
||||
"""
|
||||
id0 = self.read_reg(self.ESP_OTP_MAC0)
|
||||
id1 = self.read_reg(self.ESP_OTP_MAC1)
|
||||
return (id0 >> 24) | ((id1 & 0xFFFFFF) << 8)
|
||||
|
||||
def read_mac(self):
|
||||
"""Read MAC from OTP ROM"""
|
||||
mac0 = self.read_reg(self.ESP_OTP_MAC0)
|
||||
mac1 = self.read_reg(self.ESP_OTP_MAC1)
|
||||
mac3 = self.read_reg(self.ESP_OTP_MAC3)
|
||||
if mac3 != 0:
|
||||
oui = ((mac3 >> 16) & 0xFF, (mac3 >> 8) & 0xFF, mac3 & 0xFF)
|
||||
elif ((mac1 >> 16) & 0xFF) == 0:
|
||||
oui = (0x18, 0xFE, 0x34)
|
||||
elif ((mac1 >> 16) & 0xFF) == 1:
|
||||
oui = (0xAC, 0xD0, 0x74)
|
||||
else:
|
||||
raise FatalError("Unknown OUI")
|
||||
return oui + ((mac1 >> 8) & 0xFF, mac1 & 0xFF, (mac0 >> 24) & 0xFF)
|
||||
|
||||
def get_erase_size(self, offset, size):
|
||||
"""Calculate an erase size given a specific size in bytes.
|
||||
|
||||
Provides a workaround for the bootloader erase bug."""
|
||||
|
||||
sectors_per_block = 16
|
||||
sector_size = self.FLASH_SECTOR_SIZE
|
||||
num_sectors = (size + sector_size - 1) // sector_size
|
||||
start_sector = offset // sector_size
|
||||
|
||||
head_sectors = sectors_per_block - (start_sector % sectors_per_block)
|
||||
if num_sectors < head_sectors:
|
||||
head_sectors = num_sectors
|
||||
|
||||
if num_sectors < 2 * head_sectors:
|
||||
return (num_sectors + 1) // 2 * sector_size
|
||||
else:
|
||||
return (num_sectors - head_sectors) * sector_size
|
||||
|
||||
def override_vddsdio(self, new_voltage):
|
||||
raise NotImplementedInROMError(
|
||||
"Overriding VDDSDIO setting only applies to ESP32"
|
||||
)
|
||||
|
||||
|
||||
class ESP8266StubLoader(ESP8266ROM):
|
||||
"""Access class for ESP8266 stub loader, runs on top of ROM."""
|
||||
|
||||
FLASH_WRITE_SIZE = 0x4000 # matches MAX_WRITE_BLOCK in stub_loader.c
|
||||
IS_STUB = True
|
||||
|
||||
def __init__(self, rom_loader):
|
||||
self.secure_download_mode = rom_loader.secure_download_mode
|
||||
self._port = rom_loader._port
|
||||
self._trace_enabled = rom_loader._trace_enabled
|
||||
self.cache = rom_loader.cache
|
||||
self.flush_input() # resets _slip_reader
|
||||
|
||||
def get_erase_size(self, offset, size):
|
||||
return size # stub doesn't have same size bug as ROM loader
|
||||
|
||||
|
||||
ESP8266ROM.STUB_CLASS = ESP8266StubLoader
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"entry": 1074521560,
|
||||
"text": "CAD0PxwA9D8AAPQ/AMD8PxAA9D82QQAh+v/AIAA4AkH5/8AgACgEICB0nOIGBQAAAEH1/4H2/8AgAKgEiAigoHTgCAALImYC54b0/yHx/8AgADkCHfAAAKDr/T8Ya/0/hIAAAEBAAABYq/0/pOv9PzZBALH5/yCgdBARIKXHAJYaBoH2/5KhAZCZEZqYwCAAuAmR8/+goHSaiMAgAJIYAJCQ9BvJwMD0wCAAwlgAmpvAIACiSQDAIACSGACB6v+QkPSAgPSHmUeB5f+SoQGQmRGamMAgAMgJoeX/seP/h5wXxgEAfOiHGt7GCADAIACJCsAgALkJRgIAwCAAuQrAIACJCZHX/5qIDAnAIACSWAAd8AAA+CD0P/gw9D82QQCR/f/AIACICYCAJFZI/5H6/8AgAIgJgIAkVkj/HfAAAAAQIPQ/ACD0PwAAAAg2QQAQESCl/P8h+v8MCMAgAIJiAJH6/4H4/8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ABKglcDp4ywg6UNADMN/UAdjz6cslcjpOywKoS+lSOgvQCTh4qxnY0BxaFn45L19lqFfTgjoG0Bob819OOLB6CTB4AM3MgxtIOniwDjkwegAUWX8Mf/54DAPAllEwUFcZfwx//ngCA5l/DH/+eA4DzNsgOkywDjDgScAUWX8Mf/54AgOhMFgD6X8Mf/54CgNgKUwbL2UGZU1lRGWbZZJlqWWgZb9ktmTNZMRk22TQlhgoA=",
|
||||
"text_start": 1077411840,
|
||||
"data": "GGvKP+AIOEAsCThAhAk4QCgKOECUCjhAQgo4QKgHOEDkCThAJAo4QJgJOEBYBzhAzAk4QFgHOEC6CDhA/gg4QCwJOECECThAzAg4QBIIOEBCCDhAyAg4QOYMOEAsCThArAs4QJoMOECkBjhAxAw4QKQGOECkBjhApAY4QKQGOECkBjhApAY4QKQGOECkBjhASAs4QKQGOEDICzhAmgw4QA==",
|
||||
"data_start": 1070295976
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"entry": 1077413532,
|
||||
"text": "QREixCbCBsa3NwRgEUc3RMg/2Mu3NARgEwQEANxAkYuR57JAIkSSREEBgoCIQBxAE3X1D4KX3bcBEbcHAGBOxoOphwBKyDdJyD8mylLEBs4izLcEAGB9WhMJCQDATBN09D8N4PJAYkQjqDQBQknSRLJJIkoFYYKAiECDJwkAE3X1D4KXfRTjGUT/yb8TBwAMlEGqh2MY5QCFR4XGI6AFAHlVgoAFR2OH5gAJRmONxgB9VYKAQgUTB7ANQYVjlecCiUecwfW3kwbADWMW1QCYwRMFAAyCgJMG0A19VWOV1wCYwRMFsA2CgLd1yT9BEZOFhboGxmE/Y0UFBrd3yT+ThweyA6cHCAPWRwgTdfUPkwYWAMIGwYIjktcIMpcjAKcAA9dHCJFnk4cHBGMe9wI398g/EwcHsqFnupcDpgcItzbJP7d3yT+Thweyk4YGtmMf5gAjpscII6DXCCOSBwghoPlX4wb1/LJAQQGCgCOm1wgjoOcI3bc3JwBgfEudi/X/NzcAYHxLnYv1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nu/wr9gJZRMFBXGX8Mf/54BgIu/wb9OX8Mf/54CgJdG6A6TLAOMHBJzv8C/WEwWAPpfwx//ngAAg7/AP0QKUVbrv8I/Q9lBmVNZURlm2WSZalloGW/ZLZkzWTEZNtk0JYYKAAAA=",
|
||||
"text_start": 1077411840,
|
||||
"data": "IGvIP1YKOECmCjhA/go4QKILOEAODDhAvAs4QCIJOEBeCzhAngs4QBILOEDSCDhARgs4QNIIOEAwCjhAdgo4QKYKOED+CjhAQgo4QIYJOEC2CThAPgo4QGAOOECmCjhAJg04QBgOOEASCDhAQA44QBIIOEASCDhAEgg4QBIIOEASCDhAEgg4QBIIOEASCDhAwgw4QBIIOEBEDThAGA44QA==",
|
||||
"data_start": 1070164912
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"entry": 1082132112,
|
||||
"text": "QREixCbCBsa39wBgEUc3BIRA2Mu39ABgEwQEANxAkYuR57JAIkSSREEBgoCIQBxAE3X1D4KX3bcBEbcHAGBOxoOphwBKyDcJhEAmylLEBs4izLcEAGB9WhMJCQDATBN09A8N4PJAYkQjqDQBQknSRLJJIkoFYYKAiECDJwkAE3X1D4KXfRTjGUT/yb8TBwAMlEGqh2MY5QCFR4XGI6AFAHlVgoAFR2OH5gAJRmONxgB9VYKAQgUTB7ANQYVjlecCiUecwfW3kwbADWMW1QCYwRMFAAyCgJMG0A19VWOV1wCYwRMFsA2CgLc1hUBBEZOFRboGxmE/Y0UFBrc3hUCTh8exA6cHCAPWRwgTdfUPkwYWAMIGwYIjktcIMpcjAKcAA9dHCJFnk4cHBGMe9wI3t4RAEwfHsaFnupcDpgcIt/aEQLc3hUCTh8exk4bGtWMf5gAjpscII6DXCCOSBwghoPlX4wb1/LJAQQGCgCOm1wgjoOcI3bc3NwBgfEudi/X/NycAYHxLnYv1/4KAQREGxt03tzcAYCOmBwI3BwAImMOYQ33/yFeyQBNF9f8FiUEBgoBBEQbG2T993TcHAEC3NwBgmMM3NwBgHEP9/7JAQQG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wD9yBt4PHOwADxysAE4yLAaIH2Y8TjQf/BUS3e8k/3ERjBQ0AmcNjTIAAY18ECBMHcAzYyOOWB6qTB5AMWaiTh4u6mEO398g/k4eHsZmPPtaDJ4qwt3zIP2rQk4zMAJONi7oFSGNz/QANSELGOsTv8A/VIkcySDdFyD/ihXwQk4aKsRAQEwVFApfwx//ngMBIglcDp4ywg6UNADMN/UAdjz6cslcjpOywKoS+lSOgvQCTh4qxnY0BxaFn45L19lqFVTgjoG0Bob819OOLB6CTB4AM3MgxtIOniwDjkwegAUWX8Mf/54CAOwllEwUFcZfwx//ngKA3l/DH/+eAIDvNsgOkywDjDgScAUWX8Mf/54DgOBMFgD6X8Mf/54AgNQKUwbL2UGZU1lRGWbZZJlqWWgZb9ktmTNZMRk22TQlhgoA=",
|
||||
"text_start": 1077411840,
|
||||
"data": "GGvIP/gIOEBECThAnAk4QEAKOECsCjhAWgo4QMAHOED8CThAPAo4QLAJOEBwBzhA5Ak4QHAHOEDSCDhAFgk4QEQJOECcCThA5Ag4QCoIOEBaCDhA4Ag4QP4MOEBECThAxAs4QLIMOEC8BjhA3Aw4QLwGOEC8BjhAvAY4QLwGOEC8BjhAvAY4QLwGOEC8BjhAYAs4QLwGOEDgCzhAsgw4QA==",
|
||||
"data_start": 1070164904
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"entry": 1082132112,
|
||||
"text": "QREixCbCBsa39wBgEUc3BINA2Mu39ABgEwQEANxAkYuR57JAIkSSREEBgoCIQBxAE3X1D4KX3bcBEbcHAGBOxoOphwBKyDcJg0AmylLEBs4izLcEAGB9WhMJCQDATBN09A8N4PJAYkQjqDQBQknSRLJJIkoFYYKAiECDJwkAE3X1D4KXfRTjGUT/yb8TBwAMlEGqh2MY5QCFR4XGI6AFAHlVgoAFR2OH5gAJRmONxgB9VYKAQgUTB7ANQYVjlecCiUecwfW3kwbADWMW1QCYwRMFAAyCgJMG0A19VWOV1wCYwRMFsA2CgLc1hEBBEZOFR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fwf//ngMA1glcDp4ywg6UNADMN/UAdjz6cslcjpOywKoS+lSOgvQCTh8qxnY0BxaFn45L19lqF7/Av0COgbQGZvy3044MHoJMHgAzcyPW6g6eLAOObB57v8K/aCWUTBQVxl/B//+eAICTv8C/Wl/B//+eAYCjRugOkywDjBwSc7/Av2BMFgD6X8H//54DAIe/wz9MClFW67/BP0/ZQZlTWVEZZtlkmWpZaBlv2S2ZM1kxGTbZNCWGCgAAA",
|
||||
"text_start": 1082130432,
|
||||
"data": "HCuDQCoKgEB6CoBA0gqAQHYLgEDiC4BAkAuAQPYIgEAyC4BAcguAQOYKgECmCIBAGguAQKYIgEAECoBASgqAQHoKgEDSCoBAFgqAQFoJgECKCYBAEgqAQDQOgEB6CoBA+gyAQOwNgEDmB4BAFA6AQOYHgEDmB4BA5geAQOYHgEDmB4BA5geAQOYHgEDmB4BAlgyAQOYHgEAYDYBA7A2AQA==",
|
||||
"data_start": 1082403756
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"entry": 1077413318,
|
||||
"text": "ARG3BwBgTsaDqYcASsg3Scg/JspSxAbOIsy3BABgfVoTCQkAwEwTdPQ/DeDyQGJEI6g0AUJJ0kSySSJKBWGCgIhAgycJABN19Q+Cl30U4xlE/8m/EwcADJRBqodjGOUAhUeFxiOgBQB5VYKABUdjh+YACUZjjcYAfVWCgEIFEwewDUGFY5XnAolHnMH1t5MGwA1jFtUAmMETBQAMgoCTBtANfVVjldcAmMETBbANgoC3dck/QRGThQW6BsZhP2NFBQa3d8k/k4eHsQOnBwgD1kcIE3X1D5MGFgDCBsGCI5LXCDKXIwCnAAPXRwiRZ5OHBwRjHvcCN/fIPxMHh7GhZ7qXA6YHCLc2yT+3d8k/k4eHsZOGhrVjH+YAI6bHCCOg1wgjkgcIIaD5V+MG9fyyQEEBgoAjptcII6DnCN23NycAYHxLnYv1/zc3AGB8S52L9f+CgEERBsbdN7cnAGAjpgcCNwcACJjDmEN9/8hXskATRfX/BYlBAYK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crACIEXYyX8Mf/54BAYQOsxABBFGNzhAEijOMEDLrAQGKUMYCcSGNV8ACcRGNa9Arv8K/idd3IQGKGk4WLAZfwx//ngEBdAcWTB0AM3MjcQOKX3MDcRLOHh0HcxJfwx//ngCBcub4JZRMFBXEDrMsAA6SLAJfwx//ngGBNtwcAYNhLtwYAAcEWk1dHARIHdY+9i9mPs4eHAwFFs9WHApfwx//ngEBOEwWAPpfwx//ngABKAb6DpksBA6YLAYOlywADpYsA7/Cv+O28g8U7AIPHKwAThYsBogXdjcEVrTrVtO/wD9yBt4PHOwADxysAE4yLAaIH2Y8TjQf/BUS3e8k/3ERjBQ0AmcNjTIAAY18ECBMHcAzYyOOWB6qTB5AMWaiTh4u6mEO398g/k4eHsZmPPtaDJ4qwt3zIP2rQk4zMAJONi7oFSGNz/QANSELGOsTv8A/VIkcySDdFyD/ihXwQk4aKsRAQEwVFApfwx//ngMBIglcDp4ywg6UNADMN/UAdjz6cslcjpOywKoS+lSOgvQCTh4qxnY0BxaFn45L19lqFVTgjoG0Bob819OOLB6CTB4AM3MgxtIOniwDjkwegAUWX8Mf/54CAOwllEwUFcZfwx//ngKA3l/DH/+eAIDvNsgOkywDjDgScAUWX8Mf/54DgOBMFgD6X8Mf/54AgNQKUwbL2UGZU1lRGWbZZJlqWWgZb9ktmTNZMRk22TQlhgoA=",
|
||||
"text_start": 1077411840,
|
||||
"data": "GGvIP/gIOEBECThAnAk4QEAKOECsCjhAWgo4QMAHOED8CThAPAo4QLAJOEBwBzhA5Ak4QHAHOEDSCDhAFgk4QEQJOECcCThA5Ag4QCoIOEBaCDhA4Ag4QP4MOEBECThAxAs4QLIMOEC8BjhA3Aw4QLwGOEC8BjhAvAY4QLwGOEC8BjhAvAY4QLwGOEC8BjhAYAs4QLwGOEDgCzhAsgw4QA==",
|
||||
"data_start": 1070164904
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"entry": 1077413318,
|
||||
"text": "ARG3BwBgTsaDqYcASsg3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ICVW/40KVkq2oqJxwKoRieGBR/7gCABxP/6RQP7AIAB4B4jhcLQ1wHcRkHcQcLsgILLine truncated
|
||||
"text_start": 1073905664,
|
||||
"data": "ZCv9PzaLAkDBiwJAhpACQEqMAkDjiwJASowCQKmMAkByjQJA5Y0CQI2NAkDAigJAC40CQGSNAkDMjAJACI4CQPaMAkAIjgJAr4sCQA6MAkBKjAJAqYwCQMeLAkACiwJAx44CQD2QAkDYiQJAZZACQNiJAkDYiQJA2IkCQNiJAkDYiQJA2IkCQNiJAkDYiQJAZI4CQNiJAkBZjwJAPZACQA==",
|
||||
"data_start": 1073622012
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"entry": 1077381684,
|
||||
"text": "FIADYACAA2BIAMo/BIADYDZBAIH7/wxJwCAAmQjGBAAAgfj/wCAAqAiB9/+goHSICOAIACH2/8AgAIgCJ+jhHfAAAAAIAABgHAAAYBAAAGA2QQAh/P/AIAA4AkH7/8AgACgEICCUnOJB6P9GBAAMODCIAcAgAKgIiASgoHTgCAALImYC6Ib0/yHx/8AgADkCHfAAAOwryz9kq8o/hIAAAEBAAACk68o/8CvLPzZBALH5/yCgdBARIGUoAZYaBoH2/5KhAZCZEZqYwCAAuAmR8/+goHSaiMAgAJIYAJCQ9BvJwMD0wCAAwlgAmpvAIACiSQDAIACSGACB6v+QkPSAgPSHmUeB5f+SoQGQmRGamMAgAMgJoeX/seP/h5wXxgEAfOiHGt7GCADAIACJCsAgALkJRgIAwCAAuQrAIACJCZHX/5qIDAnAIACSWAAd8AAAVCAAYFQwAGA2QQCR/f/AIACICYCAJFZI/5H6/8AgAIgJgIAkVkj/HfAAAAAsIABgACAAYAAAAAg2QQAQESCl/P8h+v8MCMAgAIJiAJH6/4H4/8AgAJJoAMAgAJgIVnn/wCAAiAJ88oAiMCAgBB3wAAAAAEA2QQAQESDl+/8Wav+B7P+R+//AIACSaADAIACYCFZ5/x3wAAAUKABANkEAIKIggf3/4AgAHfAAAHDi+j8II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ated
|
||||
"text_start": 1077379072,
|
||||
"data": "ZCvKP4KLN0APjDdA15A3QJqMN0AvjDdAmow3QPmMN0DGjTdAOY43QOGNN0ANizdAXI03QLiNN0AcjTdAXI43QEaNN0BcjjdA/Ys3QFqMN0CajDdA+Yw3QBWMN0BOizdAHI83QJuQN0AsijdAvZA3QCyKN0AsijdALIo3QCyKN0AsijdALIo3QCyKN0AsijdAto43QCyKN0CyjzdAm5A3QA==",
|
||||
"data_start": 1070279668
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"entry": 1074843652,
|
||||
"text": "qBAAQAH//0Z0AAAAkIH/PwgB/z+AgAAAhIAAAEBAAABIQf8/lIH/PzH5/xLB8CAgdAJhA4XvATKv/pZyA1H0/0H2/zH0/yAgdDA1gEpVwCAAaANCFQBAMPQbQ0BA9MAgAEJVADo2wCAAIkMAIhUAMev/ICD0N5I/Ieb/Meb/Qen/OjLAIABoA1Hm/yeWEoYAAAAAAMAgACkEwCAAWQNGAgDAIABZBMAgACkDMdv/OiIMA8AgADJSAAgxEsEQDfAAoA0AAJiB/z8Agf4/T0hBSais/z+krP8/KNAQQEzqEEAMAABg//8AAAAQAAAAAAEAAAAAAYyAAAAQQAAAAAD//wBAAAAAgf4/BIH+PxAnAAAUAABg//8PAKis/z8Igf4/uKz/PwCAAAA4KQAAkI//PwiD/z8Qg/8/rKz/P5yv/z8wnf8/iK//P5gbAAAACAAAYAkAAFAOAABQEgAAPCkAALCs/z+0rP8/1Kr/PzspAADwgf8/DK//P5Cu/z+ACwAAEK7/P5Ct/z8BAAAAAAAAALAVAADx/wAAmKz/P5iq/z+8DwBAiA8AQKgPAEBYPwBAREYAQCxMAEB4SABAAEoAQLRJAEDMLgBA2DkAQEjfAECQ4QBATCYAQIRJAEAhvP+SoRCQEcAiYSMioAACYUPCYULSYUHiYUDyYT8B6f/AAAAhsv8xs/8MBAYBAABJAksiNzL4hbUBIqCMDEMqIcWnAYW0ASF8/8F6/zGr/yoswCAAy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
# Espressif Systems (Shanghai) CO LTD, other contributors as noted.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import re
|
||||
import struct
|
||||
import sys
|
||||
|
||||
|
||||
def byte(bitstr, index):
|
||||
return bitstr[index]
|
||||
|
||||
|
||||
def mask_to_shift(mask):
|
||||
"""Return the index of the least significant bit in the mask"""
|
||||
shift = 0
|
||||
while mask & 0x1 == 0:
|
||||
shift += 1
|
||||
mask >>= 1
|
||||
return shift
|
||||
|
||||
|
||||
def div_roundup(a, b):
|
||||
"""Return a/b rounded up to nearest integer,
|
||||
equivalent result to int(math.ceil(float(int(a)) / float(int(b))), only
|
||||
without possible floating point accuracy errors.
|
||||
"""
|
||||
return (int(a) + int(b) - 1) // int(b)
|
||||
|
||||
|
||||
def flash_size_bytes(size):
|
||||
"""Given a flash size of the type passed in args.flash_size
|
||||
(ie 512KB or 1MB) then return the size in bytes.
|
||||
"""
|
||||
if "MB" in size:
|
||||
return int(size[: size.index("MB")]) * 1024 * 1024
|
||||
elif "KB" in size:
|
||||
return int(size[: size.index("KB")]) * 1024
|
||||
else:
|
||||
raise FatalError("Unknown size %s" % size)
|
||||
|
||||
|
||||
def hexify(s, uppercase=True):
|
||||
format_str = "%02X" if uppercase else "%02x"
|
||||
return "".join(format_str % c for c in s)
|
||||
|
||||
|
||||
def pad_to(data, alignment, pad_character=b"\xFF"):
|
||||
"""Pad to the next alignment boundary"""
|
||||
pad_mod = len(data) % alignment
|
||||
if pad_mod != 0:
|
||||
data += pad_character * (alignment - pad_mod)
|
||||
return data
|
||||
|
||||
|
||||
def print_overwrite(message, last_line=False):
|
||||
"""Print a message, overwriting the currently printed line.
|
||||
|
||||
If last_line is False, don't append a newline at the end
|
||||
(expecting another subsequent call will overwrite this one.)
|
||||
|
||||
After a sequence of calls with last_line=False, call once with last_line=True.
|
||||
|
||||
If output is not a TTY (for example redirected a pipe),
|
||||
no overwriting happens and this function is the same as print().
|
||||
"""
|
||||
if sys.stdout.isatty():
|
||||
print("\r%s" % message, end="\n" if last_line else "")
|
||||
else:
|
||||
print(message)
|
||||
|
||||
|
||||
def expand_chip_name(chip_name):
|
||||
"""Change chip name to official form, e.g. `esp32s3beta2` -> `ESP32-S3(beta2)`"""
|
||||
# Put "-" after "esp32"
|
||||
chip_name = re.sub(r"(esp32)(?!$)", r"\1-", chip_name)
|
||||
# Put "()" around "betaN"
|
||||
chip_name = re.sub(r"(beta\d*)", r"(\1)", chip_name)
|
||||
# Uppercase everything before "(betaN)"
|
||||
chip_name = re.sub(r"^[^\(]+", lambda x: x.group(0).upper(), chip_name)
|
||||
return chip_name
|
||||
|
||||
|
||||
def strip_chip_name(chip_name):
|
||||
"""Strip chip name to normalized form, e.g. `ESP32-S3(beta2)` -> `esp32s3beta2`"""
|
||||
return re.sub(r"[-()]", "", chip_name.lower())
|
||||
|
||||
|
||||
class FatalError(RuntimeError):
|
||||
"""
|
||||
Wrapper class for runtime errors that aren't caused by internal bugs, but by
|
||||
ESP ROM responses or input content.
|
||||
"""
|
||||
|
||||
def __init__(self, message):
|
||||
RuntimeError.__init__(self, message)
|
||||
|
||||
@staticmethod
|
||||
def WithResult(message, result):
|
||||
"""
|
||||
Return a fatal error object that appends the hex values of
|
||||
'result' and its meaning as a string formatted argument.
|
||||
"""
|
||||
|
||||
err_defs = {
|
||||
# ROM error codes
|
||||
0x101: "Out of memory",
|
||||
0x102: "Invalid argument",
|
||||
0x103: "Invalid state",
|
||||
0x104: "Invalid size",
|
||||
0x105: "Requested resource not found",
|
||||
0x106: "Operation or feature not supported",
|
||||
0x107: "Operation timed out",
|
||||
0x108: "Received response was invalid",
|
||||
0x109: "CRC or checksum was invalid",
|
||||
0x10A: "Version was invalid",
|
||||
0x10B: "MAC address was invalid",
|
||||
# Flasher stub error codes
|
||||
0xC000: "Bad data length",
|
||||
0xC100: "Bad data checksum",
|
||||
0xC200: "Bad blocksize",
|
||||
0xC300: "Invalid command",
|
||||
0xC400: "Failed SPI operation",
|
||||
0xC500: "Failed SPI unlock",
|
||||
0xC600: "Not in flash mode",
|
||||
0xC700: "Inflate error",
|
||||
0xC800: "Not enough data",
|
||||
0xC900: "Too much data",
|
||||
0xFF00: "Command not implemented",
|
||||
}
|
||||
|
||||
err_code = struct.unpack(">H", result[:2])
|
||||
message += " (result was {}: {})".format(
|
||||
hexify(result), err_defs.get(err_code[0], "Unknown result")
|
||||
)
|
||||
return FatalError(message)
|
||||
|
||||
|
||||
class NotImplementedInROMError(FatalError):
|
||||
"""
|
||||
Wrapper class for the error thrown when a particular ESP bootloader function
|
||||
is not implemented in the ROM bootloader.
|
||||
"""
|
||||
|
||||
def __init__(self, bootloader, func):
|
||||
FatalError.__init__(
|
||||
self,
|
||||
"%s ROM does not support function %s."
|
||||
% (bootloader.CHIP_NAME, func.__name__),
|
||||
)
|
||||
|
||||
|
||||
class NotSupportedError(FatalError):
|
||||
def __init__(self, esp, function_name):
|
||||
FatalError.__init__(
|
||||
self,
|
||||
"Function %s is not supported for %s." % (function_name, esp.CHIP_NAME),
|
||||
)
|
||||
|
||||
|
||||
class UnsupportedCommandError(RuntimeError):
|
||||
"""
|
||||
Wrapper class for when ROM loader returns an invalid command response.
|
||||
|
||||
Usually this indicates the loader is running in Secure Download Mode.
|
||||
"""
|
||||
|
||||
def __init__(self, esp, op):
|
||||
if esp.secure_download_mode:
|
||||
msg = "This command (0x%x) is not supported in Secure Download Mode" % op
|
||||
else:
|
||||
msg = "Invalid (unsupported) command 0x%x" % op
|
||||
RuntimeError.__init__(self, msg)
|
||||
@@ -20,6 +20,7 @@ platform = espressif32 @ 6.12.0
|
||||
board_build.partitions = min_spiffs.csv
|
||||
framework = arduino
|
||||
monitor_speed = 115200
|
||||
build_src_filter = +<*> -<rp2350/> ; src/rp2350/ is the RP2350 port, built only by its own envs
|
||||
board_build.embed_files =
|
||||
data_embed/index.html.gz
|
||||
data_embed/style.css.gz
|
||||
|
||||
@@ -197,6 +197,7 @@
|
||||
}
|
||||
|
||||
void uploadToAPRSIS(const String& packet) {
|
||||
if (packet == "") return; // never send an empty line to APRS-IS
|
||||
beaconBytesSent = checkATResponse("AT+CIPSEND=0," + String(packet.length()+1));
|
||||
delay(2000);
|
||||
if (beaconBytesSent) {
|
||||
|
||||
+12
-2
@@ -52,6 +52,7 @@ ___________________________________________________________________*/
|
||||
#include "syslog_utils.h"
|
||||
#include "power_utils.h"
|
||||
#include "sleep_utils.h"
|
||||
#include "thermal_utils.h"
|
||||
#include "mqtt_utils.h"
|
||||
#include "lora_utils.h"
|
||||
#include "wifi_utils.h"
|
||||
@@ -68,8 +69,8 @@ ___________________________________________________________________*/
|
||||
#endif
|
||||
|
||||
|
||||
String versionDate = "2026-09-29";
|
||||
String versionNumber = "4.0.1";
|
||||
String versionDate = "2026-11-17";
|
||||
String versionNumber = "4.0.5";
|
||||
Configuration Config;
|
||||
WiFiClient aprsIsClient;
|
||||
WiFiClient mqttClient;
|
||||
@@ -108,6 +109,9 @@ void setup() {
|
||||
}
|
||||
networkManager->setHostName("iGATE-" + Config.callsign);
|
||||
POWER_Utils::setup();
|
||||
#ifdef FAN_CTRL_PIN
|
||||
THERMAL_Utils::setup();
|
||||
#endif
|
||||
Utils::setupDisplay();
|
||||
LoRa_Utils::setup();
|
||||
Utils::validateFreqs();
|
||||
@@ -135,6 +139,9 @@ void loop() {
|
||||
SLEEP_Utils::checkWakeUpFlag();
|
||||
Utils::checkBeaconInterval();
|
||||
STATION_Utils::processOutputPacketBufferUltraEcoMode();
|
||||
#ifdef FAN_CTRL_PIN
|
||||
THERMAL_Utils::monitor();
|
||||
#endif
|
||||
Utils::checkSleepByLowBatteryVoltage(1);
|
||||
SLEEP_Utils::startSleeping();
|
||||
} else {
|
||||
@@ -222,6 +229,9 @@ void loop() {
|
||||
displayShow(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
||||
#endif
|
||||
|
||||
#ifdef FAN_CTRL_PIN
|
||||
THERMAL_Utils::monitor();
|
||||
#endif
|
||||
Utils::checkRebootTime();
|
||||
Utils::checkSleepByLowBatteryVoltage(1);
|
||||
}
|
||||
|
||||
+40
-54
@@ -60,6 +60,7 @@ uint32_t lastServerCheck = 0;
|
||||
namespace APRS_IS_Utils {
|
||||
|
||||
void upload(const String& line) {
|
||||
if (line == "") return; // never send an empty line to APRS-IS
|
||||
aprsIsClient.print(line + "\r\n");
|
||||
}
|
||||
|
||||
@@ -151,42 +152,36 @@ namespace APRS_IS_Utils {
|
||||
return packetToUpload;
|
||||
}
|
||||
|
||||
String buildIS2Meta() {
|
||||
static String fixedTail; // rx_modem + rx_bitrate + rx_frequency: RX config doesn't change at runtime
|
||||
if (fixedTail == "") {
|
||||
// LoRa bit rate = SF * (BW / 2^SF) * 4/CR (CR = denominator: 5..8)
|
||||
uint32_t bitrate = (uint32_t)(Config.loramodule.rxSpreadingFactor
|
||||
* ((float)Config.loramodule.rxSignalBandwidth / (1 << Config.loramodule.rxSpreadingFactor))
|
||||
* (4.0 / Config.loramodule.rxCodingRate4));
|
||||
fixedTail = " rx_modem=2 rx_bitrate=" + String(bitrate) + " rx_frequency=" + String(Config.loramodule.rxFreq);
|
||||
}
|
||||
return "#is2-meta rx_rssi_dbm=" + String(lastAprsPacket.rssi) + " rx_snr_db=" + String(lastAprsPacket.snr, 1) + fixedTail;
|
||||
}
|
||||
|
||||
bool processReceivedLoRaMessage(const String& sender, const String& packet) {
|
||||
String receivedMessage;
|
||||
int leftCurlyBraceIndex = packet.indexOf("{");
|
||||
int colonIndex = packet.indexOf(":");
|
||||
if (leftCurlyBraceIndex > 0) { // ack?
|
||||
String ackMessage = "ack";
|
||||
ackMessage.concat(packet.substring(leftCurlyBraceIndex + 1));
|
||||
ackMessage.trim();
|
||||
//Serial.println(ackMessage);
|
||||
|
||||
String addToBuffer = Config.callsign;
|
||||
addToBuffer += ">APLRG1";
|
||||
if (lastAprsPacket.header == "") addToBuffer += ",RFONLY";
|
||||
if (Config.beacon.path != "") {
|
||||
addToBuffer += ",";
|
||||
addToBuffer += Config.beacon.path;
|
||||
}
|
||||
addToBuffer += "::";
|
||||
|
||||
String processedSender = sender;
|
||||
for (int i = sender.length(); i < 9; i++) {
|
||||
processedSender += ' ';
|
||||
}
|
||||
addToBuffer += processedSender;
|
||||
|
||||
addToBuffer += ":";
|
||||
addToBuffer += ackMessage;
|
||||
STATION_Utils::addToOutputPacketBuffer(addToBuffer);
|
||||
String ackCallsign = (Config.tacticalCallsign == "") ? Config.callsign : Config.tacticalCallsign; // ack from the callsign the message was addressed to
|
||||
String ackPath = (lastAprsPacket.header == "") ? "RFONLY," + Config.beacon.path : Config.beacon.path;
|
||||
String ackPacket = APRSPacketLib::generateAckPacket(ackCallsign, "APLRG1", ackPath, sender, packet);
|
||||
if (ackPacket != "") STATION_Utils::addToOutputPacketBuffer(ackPacket);
|
||||
receivedMessage = packet.substring(colonIndex + 1, leftCurlyBraceIndex);
|
||||
} else {
|
||||
receivedMessage = packet.substring(colonIndex + 1);
|
||||
}
|
||||
if (receivedMessage.indexOf("?") == 0) {
|
||||
if (QUERY_Utils::isQuery(receivedMessage)) {
|
||||
if (!Config.display.alwaysOn && Config.display.timeout != 0) displayToggle(true);
|
||||
|
||||
STATION_Utils::addToOutputPacketBuffer(QUERY_Utils::process(receivedMessage, sender, false, lastAprsPacket.header != ""));
|
||||
String queryAnswer = QUERY_Utils::process(receivedMessage, sender, false, lastAprsPacket.header != "");
|
||||
if (queryAnswer != "") STATION_Utils::addToOutputPacketBuffer(queryAnswer); // unknown query: no answer
|
||||
lastScreenOn = millis();
|
||||
displayShow(firstLine, secondLine, thirdLine, fourthLine, fifthLine, "Callsign = " + sender, "TYPE --> QUERY", 0);
|
||||
return true;
|
||||
@@ -219,7 +214,11 @@ namespace APRS_IS_Utils {
|
||||
A7670_Utils::uploadToAPRSIS(aprsPacketToUpload);
|
||||
stationBeacon = false;
|
||||
#else
|
||||
upload(aprsPacketToUpload);
|
||||
if (Config.aprs_is.is2Metadata && aprsPacketToUpload != "") {
|
||||
upload(buildIS2Meta() + "\r\n" + aprsPacketToUpload); // IS2PLAIN: meta line right before the packet, same write
|
||||
} else {
|
||||
upload(aprsPacketToUpload);
|
||||
}
|
||||
#endif
|
||||
Utils::println("(Uploaded to APRS-IS)");
|
||||
displayShow(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
||||
@@ -274,21 +273,9 @@ namespace APRS_IS_Utils {
|
||||
}
|
||||
|
||||
void processAckMessage(const String& sender, const String& message) {
|
||||
String ackPacket = Config.callsign;
|
||||
ackPacket += ">APLRG1,TCPIP,qAC::";
|
||||
|
||||
String senderCallsign = sender;
|
||||
for (int i = sender.length(); i < 9; i++) {
|
||||
senderCallsign += ' ';
|
||||
}
|
||||
ackPacket += senderCallsign;
|
||||
ackPacket += ":";
|
||||
|
||||
String ackMessage = "ack";
|
||||
ackMessage += message.substring(message.indexOf("{") + 1);
|
||||
ackMessage.trim();
|
||||
ackPacket += ackMessage;
|
||||
|
||||
String ackPacket = APRSPacketLib::generateAckPacket(Config.callsign, "APLRG1", "", sender, message);
|
||||
if (ackPacket == "") return;
|
||||
ackPacket = APRSPacketLib::generateAPRSISPacket(ackPacket);
|
||||
#ifdef HAS_A7670
|
||||
A7670_Utils::uploadToAPRSIS(ackPacket);
|
||||
#else
|
||||
@@ -314,7 +301,7 @@ namespace APRS_IS_Utils {
|
||||
if (Config.digi.backupDigiMode) lastServerCheck = currentTime;
|
||||
} else {
|
||||
int doubleColonIndex = packet.indexOf("::");
|
||||
if (Config.aprs_is.messagesToRF && doubleColonIndex > 0) {
|
||||
if (doubleColonIndex > 0) { // messages for this station are always answered; messagesToRF only gates forwarding to RF
|
||||
String Sender = packet.substring(0, packet.indexOf(">"));
|
||||
const String& AddresseeAndMessage = packet.substring(doubleColonIndex + 2);
|
||||
int colonIndex = AddresseeAndMessage.indexOf(":");
|
||||
@@ -329,7 +316,7 @@ namespace APRS_IS_Utils {
|
||||
} else {
|
||||
receivedMessage = AddresseeAndMessage.substring(colonIndex + 1);
|
||||
}
|
||||
if (receivedMessage.indexOf("?") == 0) {
|
||||
if (QUERY_Utils::isQuery(receivedMessage)) {
|
||||
Utils::println("Rx Query (APRS-IS) : " + packet);
|
||||
String queryAnswer = QUERY_Utils::process(receivedMessage, Sender, true, false);
|
||||
//Serial.println("---> QUERY Answer : " + queryAnswer.substring(0,queryAnswer.indexOf("\n")));
|
||||
@@ -337,24 +324,23 @@ namespace APRS_IS_Utils {
|
||||
displayToggle(true);
|
||||
}
|
||||
lastScreenOn = currentTime;
|
||||
#ifdef HAS_A7670
|
||||
A7670_Utils::uploadToAPRSIS(queryAnswer);
|
||||
#else
|
||||
upload(queryAnswer);
|
||||
#endif
|
||||
SYSLOG_Utils::logAPRSISTx(queryAnswer);
|
||||
fifthLine = "APRS-IS ----> APRS-IS";
|
||||
sixthLine = Config.callsign;
|
||||
for (int j = sixthLine.length();j < 9;j++) {
|
||||
sixthLine += " ";
|
||||
if (queryAnswer != "") { // unknown query: no answer
|
||||
#ifdef HAS_A7670
|
||||
A7670_Utils::uploadToAPRSIS(queryAnswer);
|
||||
#else
|
||||
upload(queryAnswer);
|
||||
#endif
|
||||
SYSLOG_Utils::logAPRSISTx(queryAnswer);
|
||||
}
|
||||
fifthLine = "APRS-IS ----> APRS-IS";
|
||||
sixthLine = Utils::padForDisplay(Config.callsign);
|
||||
sixthLine += "> ";
|
||||
sixthLine += Sender;
|
||||
seventhLine = "QUERY = ";
|
||||
seventhLine += receivedMessage;
|
||||
}
|
||||
displayShow(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
||||
} else {
|
||||
} else if (Config.aprs_is.messagesToRF) {
|
||||
Utils::print("Rx Message (APRS-IS): " + packet);
|
||||
if (STATION_Utils::wasHeard(Addressee) && packet.indexOf("EQNS.") == -1 && packet.indexOf("UNIT.") == -1 && packet.indexOf("PARM.") == -1) {
|
||||
STATION_Utils::addToOutputPacketBuffer(buildPacketToTx(packet, 1));
|
||||
|
||||
+88
-9
@@ -17,7 +17,17 @@
|
||||
*/
|
||||
|
||||
#include <ArduinoJson.h>
|
||||
#if defined(ARDUINO_ARCH_RP2040)
|
||||
#include <LittleFS.h>
|
||||
#define IGATE_FS LittleFS
|
||||
#define IGATE_FS_BEGIN() LittleFS.begin()
|
||||
#define IGATE_RESTART() rp2040.restart()
|
||||
#else
|
||||
#include <SPIFFS.h>
|
||||
#define IGATE_FS SPIFFS
|
||||
#define IGATE_FS_BEGIN() SPIFFS.begin(false)
|
||||
#define IGATE_RESTART() ESP.restart()
|
||||
#endif
|
||||
#include "configuration.h"
|
||||
#include "board_pinout.h"
|
||||
#include "display.h"
|
||||
@@ -30,7 +40,7 @@ bool Configuration::writeFile() {
|
||||
Serial.println("Saving configuration...");
|
||||
|
||||
JsonDocument data;
|
||||
File configFile = SPIFFS.open("/igate_conf.json", "w");
|
||||
File configFile = IGATE_FS.open("/igate_conf.json", "w");
|
||||
|
||||
if (!configFile) {
|
||||
Serial.println("Error: Could not open config file for writing");
|
||||
@@ -63,8 +73,10 @@ bool Configuration::writeFile() {
|
||||
data["aprs_is"]["filter"] = aprs_is.filter;
|
||||
data["aprs_is"]["messagesToRF"] = aprs_is.messagesToRF;
|
||||
data["aprs_is"]["objectsToRF"] = aprs_is.objectsToRF;
|
||||
data["aprs_is"]["is2Metadata"] = aprs_is.is2Metadata;
|
||||
|
||||
data["beacon"]["comment"] = beacon.comment;
|
||||
data["beacon"]["rfCommentEveryXBeacons"] = beacon.rfCommentEveryXBeacons;
|
||||
data["beacon"]["interval"] = beacon.interval;
|
||||
data["beacon"]["latitude"] = beacon.latitude;
|
||||
data["beacon"]["longitude"] = beacon.longitude;
|
||||
@@ -180,6 +192,16 @@ bool Configuration::writeFile() {
|
||||
data["ntp"]["server"] = ntp.server;
|
||||
data["ntp"]["gmtCorrection"] = ntp.gmtCorrection;
|
||||
|
||||
#if defined(ARDUINO_ARCH_RP2040)
|
||||
// Wired IP settings: only the RP2350 + W5500 build has an Ethernet stack
|
||||
// to configure (the web UI shows its "IP Config" block when this exists).
|
||||
data["network"]["dhcp"] = network.dhcp;
|
||||
data["network"]["ip"] = network.ip;
|
||||
data["network"]["gateway"] = network.gateway;
|
||||
data["network"]["subnet"] = network.subnet;
|
||||
data["network"]["dns"] = network.dns;
|
||||
#endif
|
||||
|
||||
data["other"]["rebootMode"] = rebootMode;
|
||||
data["other"]["rebootModeTime"] = rebootModeTime;
|
||||
|
||||
@@ -197,7 +219,7 @@ bool Configuration::writeFile() {
|
||||
|
||||
bool Configuration::readFile() {
|
||||
Serial.println("Reading config..");
|
||||
File configFile = SPIFFS.open("/igate_conf.json", "r");
|
||||
File configFile = IGATE_FS.open("/igate_conf.json", "r");
|
||||
|
||||
if (configFile) {
|
||||
bool needsRewrite = false;
|
||||
@@ -237,7 +259,8 @@ bool Configuration::readFile() {
|
||||
data["aprs_is"]["port"].isNull() ||
|
||||
data["aprs_is"]["filter"].isNull() ||
|
||||
data["aprs_is"]["messagesToRF"].isNull() ||
|
||||
data["aprs_is"]["objectsToRF"].isNull()) needsRewrite = true;
|
||||
data["aprs_is"]["objectsToRF"].isNull() ||
|
||||
data["aprs_is"]["is2Metadata"].isNull()) needsRewrite = true;
|
||||
aprs_is.active = data["aprs_is"]["active"] | false;
|
||||
aprs_is.passcode = data["aprs_is"]["passcode"] | "XYZWV";
|
||||
aprs_is.server = data["aprs_is"]["server"] | "rotate.aprs2.net";
|
||||
@@ -245,10 +268,12 @@ bool Configuration::readFile() {
|
||||
aprs_is.filter = data["aprs_is"]["filter"] | "m/10";
|
||||
aprs_is.messagesToRF = data["aprs_is"]["messagesToRF"] | false;
|
||||
aprs_is.objectsToRF = data["aprs_is"]["objectsToRF"] | false;
|
||||
aprs_is.is2Metadata = data["aprs_is"]["is2Metadata"] | false;
|
||||
|
||||
if (data["beacon"]["latitude"].isNull() ||
|
||||
data["beacon"]["longitude"].isNull() ||
|
||||
data["beacon"]["comment"].isNull() ||
|
||||
data["beacon"]["rfCommentEveryXBeacons"].isNull() ||
|
||||
data["beacon"]["interval"].isNull() ||
|
||||
data["beacon"]["overlay"].isNull() ||
|
||||
data["beacon"]["symbol"].isNull() ||
|
||||
@@ -263,6 +288,7 @@ bool Configuration::readFile() {
|
||||
beacon.latitude = data["beacon"]["latitude"] | 0.0;
|
||||
beacon.longitude = data["beacon"]["longitude"] | 0.0;
|
||||
beacon.comment = data["beacon"]["comment"] | "LoRa APRS";
|
||||
beacon.rfCommentEveryXBeacons = data["beacon"]["rfCommentEveryXBeacons"] | 1;
|
||||
beacon.interval = data["beacon"]["interval"] | 15;
|
||||
beacon.overlay = data["beacon"]["overlay"] | "L";
|
||||
beacon.symbol = data["beacon"]["symbol"] | "a";
|
||||
@@ -415,6 +441,15 @@ bool Configuration::readFile() {
|
||||
ntp.server = data["ntp"]["server"] | "pool.ntp.org";
|
||||
ntp.gmtCorrection = data["ntp"]["gmtCorrection"] | 0.0;
|
||||
|
||||
#if defined(ARDUINO_ARCH_RP2040)
|
||||
if (data["network"]["dhcp"].isNull()) needsRewrite = true;
|
||||
network.dhcp = data["network"]["dhcp"] | true;
|
||||
network.ip = data["network"]["ip"] | "";
|
||||
network.gateway = data["network"]["gateway"] | "";
|
||||
network.subnet = data["network"]["subnet"] | "255.255.255.0";
|
||||
network.dns = data["network"]["dns"] | "";
|
||||
#endif
|
||||
|
||||
if (data["other"]["rebootMode"].isNull() ||
|
||||
data["other"]["rebootModeTime"].isNull()) needsRewrite = true;
|
||||
rebootMode = data["other"]["rebootMode"] | false;
|
||||
@@ -436,7 +471,7 @@ bool Configuration::readFile() {
|
||||
Serial.println("Config JSON incomplete, rewriting...");
|
||||
writeFile();
|
||||
delay(1000);
|
||||
ESP.restart();
|
||||
IGATE_RESTART();
|
||||
}
|
||||
Serial.println("Config read successfuly");
|
||||
return true;
|
||||
@@ -470,8 +505,10 @@ void Configuration::setDefaultValues() {
|
||||
aprs_is.filter = "m/10";
|
||||
aprs_is.messagesToRF = false;
|
||||
aprs_is.objectsToRF = false;
|
||||
aprs_is.is2Metadata = false;
|
||||
|
||||
beacon.comment = "LoRa APRS";
|
||||
beacon.rfCommentEveryXBeacons = 1;
|
||||
beacon.latitude = 0.0;
|
||||
beacon.longitude = 0.0;
|
||||
beacon.interval = 15;
|
||||
@@ -564,6 +601,12 @@ void Configuration::setDefaultValues() {
|
||||
ntp.server = "pool.ntp.org";
|
||||
ntp.gmtCorrection = 0.0;
|
||||
|
||||
network.dhcp = true;
|
||||
network.ip = "";
|
||||
network.gateway = "";
|
||||
network.subnet = "255.255.255.0";
|
||||
network.dns = "";
|
||||
|
||||
rebootMode = false;
|
||||
rebootModeTime = 0;
|
||||
|
||||
@@ -573,22 +616,58 @@ void Configuration::setDefaultValues() {
|
||||
}
|
||||
|
||||
void Configuration::setup() {
|
||||
if (!SPIFFS.begin(false)) {
|
||||
if (!IGATE_FS_BEGIN()) {
|
||||
#if defined(ARDUINO_ARCH_RP2040)
|
||||
// A stale/incompatible LittleFS (e.g. this board previously ran a
|
||||
// firmware with a different filesystem_size, leaving the FS region with
|
||||
// data that mounts but can't be written) fails to mount cleanly — format
|
||||
// once and retry rather than giving up.
|
||||
Serial.println("File system mount failed — formatting...");
|
||||
LittleFS.format();
|
||||
if (!IGATE_FS_BEGIN()) {
|
||||
Serial.println("File system unusable after format");
|
||||
return;
|
||||
}
|
||||
Serial.println("File system formatted and mounted");
|
||||
#else
|
||||
Serial.println("SPIFFS Mount Failed, formatting...");
|
||||
|
||||
if (!SPIFFS.begin(true)) {
|
||||
Serial.println("SPIFFS Format Failed");
|
||||
return;
|
||||
}
|
||||
Serial.println("SPIFFS Ready");
|
||||
#endif
|
||||
} else {
|
||||
Serial.println("File system mounted");
|
||||
}
|
||||
Serial.println("SPIFFS Ready");
|
||||
|
||||
if (!SPIFFS.exists("/igate_conf.json")) {
|
||||
bool exists = IGATE_FS.exists("/igate_conf.json");
|
||||
if (!exists) {
|
||||
Serial.println("Config not found, creating default...");
|
||||
setDefaultValues();
|
||||
writeFile();
|
||||
bool ok = writeFile();
|
||||
#if defined(ARDUINO_ARCH_RP2040)
|
||||
if (!ok) {
|
||||
// Mounted but the write was rejected (stale FS from a different
|
||||
// layout). Format once, remount and retry so we never reboot-loop
|
||||
// here on a config that can't be created.
|
||||
Serial.println("Config write failed — formatting file system and retrying...");
|
||||
LittleFS.format();
|
||||
IGATE_FS_BEGIN();
|
||||
ok = writeFile();
|
||||
}
|
||||
if (ok) {
|
||||
delay(1000);
|
||||
IGATE_RESTART();
|
||||
} else {
|
||||
Serial.println("Config could not be persisted — continuing with defaults");
|
||||
}
|
||||
#else
|
||||
(void)ok;
|
||||
delay(1000);
|
||||
ESP.restart();
|
||||
IGATE_RESTART();
|
||||
#endif
|
||||
}
|
||||
|
||||
readFile();
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
extern Configuration Config;
|
||||
extern uint32_t lastScreenOn;
|
||||
extern APRSPacket lastAprsPacket;
|
||||
extern String iGateBeaconPacket;
|
||||
extern String firstLine;
|
||||
extern String secondLine;
|
||||
extern String thirdLine;
|
||||
|
||||
+88
-15
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <APRSPacketLib.h>
|
||||
#include <TinyGPS++.h>
|
||||
#include <SPIFFS.h>
|
||||
#include <WiFi.h>
|
||||
#include "configuration.h"
|
||||
#include "board_pinout.h"
|
||||
@@ -31,22 +32,91 @@
|
||||
#define GPS_BAUD 9600
|
||||
#endif
|
||||
|
||||
#define GPS_BAUD_FILE "/gps_baud.dat"
|
||||
#define GPS_BAUD_PROBE_TIME_MS 1500
|
||||
const uint32_t gpsBaudRates[] = {9600, 115200, 38400, 4800, 57600}; // most common first
|
||||
|
||||
extern Configuration Config;
|
||||
extern HardwareSerial gpsSerial;
|
||||
extern TinyGPSPlus gps;
|
||||
extern bool stationCallsignIsValid;
|
||||
String distance, iGateBeaconPacket, iGateLoRaBeaconPacket;
|
||||
String distance, iGateAPRSISBeaconPacket, iGateLoRaBeaconPacket;
|
||||
|
||||
|
||||
namespace GPS_Utils {
|
||||
|
||||
String getiGateLoRaBeaconPacket() {
|
||||
return iGateLoRaBeaconPacket;
|
||||
#ifdef HAS_GPS
|
||||
bool isKnownBaudRate(uint32_t baud) {
|
||||
if (baud == GPS_BAUD) return true;
|
||||
for (uint32_t knownBaud : gpsBaudRates) {
|
||||
if (knownBaud == baud) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t readSavedBaudRate() {
|
||||
File file = SPIFFS.open(GPS_BAUD_FILE, "r");
|
||||
if (!file) return 0;
|
||||
uint32_t baud = file.readString().toInt();
|
||||
file.close();
|
||||
return isKnownBaudRate(baud) ? baud : 0;
|
||||
}
|
||||
|
||||
void saveBaudRate(uint32_t baud) {
|
||||
File file = SPIFFS.open(GPS_BAUD_FILE, "w");
|
||||
if (!file) {
|
||||
Utils::println("GPS: could not save baud rate");
|
||||
return;
|
||||
}
|
||||
file.print(baud);
|
||||
file.close();
|
||||
}
|
||||
|
||||
bool probeBaudRate(uint32_t baud) {
|
||||
gpsSerial.end();
|
||||
delay(50);
|
||||
gpsSerial.begin(baud, SERIAL_8N1, GPS_TX, GPS_RX);
|
||||
uint32_t validSentences = gps.passedChecksum();
|
||||
uint32_t probeStart = millis();
|
||||
while (millis() - probeStart < GPS_BAUD_PROBE_TIME_MS) {
|
||||
while (gpsSerial.available() > 0) gps.encode(gpsSerial.read());
|
||||
if (gps.passedChecksum() > validSentences) return true; // NMEA with valid checksum
|
||||
delay(10);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t detectBaudRate() {
|
||||
uint32_t savedBaud = readSavedBaudRate();
|
||||
|
||||
uint32_t candidates[2 + sizeof(gpsBaudRates) / sizeof(gpsBaudRates[0])];
|
||||
size_t count = 0;
|
||||
auto addCandidate = [&](uint32_t baud) {
|
||||
if (baud == 0) return;
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
if (candidates[i] == baud) return;
|
||||
}
|
||||
candidates[count++] = baud;
|
||||
};
|
||||
addCandidate(savedBaud); // saved first, then board default, then common ones
|
||||
addCandidate(GPS_BAUD);
|
||||
for (uint32_t baud : gpsBaudRates) addCandidate(baud);
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
if (i == 1) displayShow("GPS", "Searching", "baud rate...", "", 0);
|
||||
bool found = probeBaudRate(candidates[i]);
|
||||
if (!found && i == 0) found = probeBaudRate(candidates[i]); // retry first one: GPS may be slow to start
|
||||
if (found) {
|
||||
if (candidates[i] != savedBaud) saveBaudRate(candidates[i]);
|
||||
return candidates[i];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void generateBeacons() {
|
||||
String beaconPacket = APRSPacketLib::generateBasePacket(Config.callsign, "APLRG1", Config.beacon.path);
|
||||
String encodedGPS = APRSPacketLib::encodeGPSIntoBase91(Config.beacon.latitude, Config.beacon.longitude, 0, 0, Config.beacon.symbol, false, 0, true, Config.beacon.ambiguityLevel);
|
||||
String beaconCallsign = Config.callsign;
|
||||
|
||||
if (Config.callsign.indexOf("NOCALL-10") != 0) {
|
||||
if (!stationCallsignIsValid) {
|
||||
@@ -58,7 +128,7 @@ namespace GPS_Utils {
|
||||
Config.digi.mode = 0;
|
||||
Config.digi.backupDigiMode = false;
|
||||
} else if (stationCallsignIsValid && Config.tacticalCallsign != "") {
|
||||
beaconPacket = APRSPacketLib::generateBasePacket(Config.tacticalCallsign, "APLRG1", Config.beacon.path);
|
||||
beaconCallsign = Config.tacticalCallsign;
|
||||
Config.aprs_is.active = false;
|
||||
Config.beacon.sendViaAPRSIS = false;
|
||||
Config.digi.backupDigiMode = false;
|
||||
@@ -68,15 +138,10 @@ namespace GPS_Utils {
|
||||
Config.beacon.sendViaRF = false;
|
||||
}
|
||||
|
||||
iGateBeaconPacket = beaconPacket;
|
||||
iGateBeaconPacket += ",qAC:=";
|
||||
iGateBeaconPacket += Config.beacon.overlay;
|
||||
iGateBeaconPacket += encodedGPS;
|
||||
String encodedGPS = APRSPacketLib::encodeGPSIntoBase91(Config.beacon.latitude, Config.beacon.longitude, 0, 0, Config.beacon.symbol, false, 0, true, Config.beacon.ambiguityLevel);
|
||||
|
||||
iGateLoRaBeaconPacket = beaconPacket;
|
||||
iGateLoRaBeaconPacket += ":=";
|
||||
iGateLoRaBeaconPacket += Config.beacon.overlay;
|
||||
iGateLoRaBeaconPacket += encodedGPS;
|
||||
iGateLoRaBeaconPacket = APRSPacketLib::generateBase91GPSBeaconPacket(beaconCallsign, "APLRG1", Config.beacon.path, Config.beacon.overlay, encodedGPS);
|
||||
iGateAPRSISBeaconPacket = APRSPacketLib::generateAPRSISPacket(iGateLoRaBeaconPacket);
|
||||
}
|
||||
|
||||
double calculateDistanceTo(double latitude, double longitude) {
|
||||
@@ -104,7 +169,15 @@ namespace GPS_Utils {
|
||||
void setup() {
|
||||
#ifdef HAS_GPS
|
||||
if (Config.beacon.gpsActive && Config.digi.ecoMode != 1) {
|
||||
gpsSerial.begin(GPS_BAUD, SERIAL_8N1, GPS_TX, GPS_RX);
|
||||
uint32_t detectedBaud = detectBaudRate();
|
||||
if (detectedBaud != 0) {
|
||||
Utils::println("GPS: baud rate detected: " + String(detectedBaud));
|
||||
} else {
|
||||
Utils::println("GPS: no NMEA data found, using default baud rate: " + String(GPS_BAUD));
|
||||
gpsSerial.end();
|
||||
delay(50);
|
||||
gpsSerial.begin(GPS_BAUD, SERIAL_8N1, GPS_TX, GPS_RX);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
generateBeacons();
|
||||
|
||||
+56
-22
@@ -28,6 +28,7 @@
|
||||
#include "ntp_utils.h"
|
||||
#include "display.h"
|
||||
#include "utils.h"
|
||||
#include "thermal_utils.h"
|
||||
|
||||
|
||||
extern Configuration Config;
|
||||
@@ -69,6 +70,18 @@ int rssi, freqError;
|
||||
float snr;
|
||||
APRSPacket lastAprsPacket;
|
||||
|
||||
#if defined(HAS_SX1278) || defined(HAS_SX1276)
|
||||
#define CHIP_MIN_POWER 2 // PA_BOOST (below 2 RadioLib switches to RFO, not wired on most modules)
|
||||
#define CHIP_MAX_POWER 20
|
||||
#else // SX1262 / SX1268 / LLCC68
|
||||
#define CHIP_MIN_POWER -9
|
||||
#define CHIP_MAX_POWER 22
|
||||
#endif
|
||||
|
||||
#ifndef RADIO_MAX_POWER // optional per board in board_pinout.h (e.g. 1W PA modules)
|
||||
#define RADIO_MAX_POWER CHIP_MAX_POWER
|
||||
#endif
|
||||
|
||||
|
||||
namespace LoRa_Utils {
|
||||
|
||||
@@ -85,10 +98,21 @@ namespace LoRa_Utils {
|
||||
operationDone = true;
|
||||
}
|
||||
|
||||
int validPower(int requested) {
|
||||
const int maxPower = (RADIO_MAX_POWER < CHIP_MAX_POWER) ? RADIO_MAX_POWER : CHIP_MAX_POWER;
|
||||
int power = constrain(requested, CHIP_MIN_POWER, maxPower);
|
||||
#if defined(HAS_SX1278) || defined(HAS_SX1276)
|
||||
if (power > 17 && power < 20) power = 17; // SX127x PA_BOOST: only 2-17 or 20
|
||||
#endif
|
||||
return power;
|
||||
}
|
||||
|
||||
void setup() {
|
||||
#ifdef RADIO_VCC_PIN // LoRa module power switch (QRP Labs LightGateway, T-Beam 1W)
|
||||
pinMode(RADIO_VCC_PIN, OUTPUT);
|
||||
digitalWrite(RADIO_VCC_PIN, HIGH);
|
||||
#endif
|
||||
#if defined (LIGHTGATEWAY_1_0) || defined(LIGHTGATEWAY_PLUS_1_0)
|
||||
pinMode(RADIO_VCC_PIN,OUTPUT);
|
||||
digitalWrite(RADIO_VCC_PIN,HIGH);
|
||||
loraSPI.begin(RADIO_SCLK_PIN, RADIO_MISO_PIN, RADIO_MOSI_PIN, RADIO_CS_PIN);
|
||||
#else
|
||||
SPI.begin(RADIO_SCLK_PIN, RADIO_MISO_PIN, RADIO_MOSI_PIN);
|
||||
@@ -103,6 +127,8 @@ namespace LoRa_Utils {
|
||||
#endif
|
||||
#if (defined(RADIO_RXEN) && defined(RADIO_TXEN)) // before begin() so RF switch is driven from start (Ebyte E22/E32 1W, QRP Labs LightGateway)
|
||||
radio.setRfSwitchPins(RADIO_RXEN, RADIO_TXEN);
|
||||
#elif defined(RADIO_RXEN) // T-Beam 1W: RXEN = LNA only, DIO2 drives the PA
|
||||
radio.setRfSwitchPins(RADIO_RXEN, RADIOLIB_NC);
|
||||
#endif
|
||||
int state = radio.begin(freq);
|
||||
if (state != RADIOLIB_ERR_NONE) {
|
||||
@@ -131,21 +157,17 @@ namespace LoRa_Utils {
|
||||
radio.setBandwidth(signalBandwidth);
|
||||
radio.setCRC(true);
|
||||
|
||||
/*#ifdef SX126X_DIO2_AS_RF_SWITCH
|
||||
radio.setRfSwitchPins(RADIO_RXEN, RADIOLIB_NC);
|
||||
radio.setDio2AsRfSwitch(true);
|
||||
#endif*/
|
||||
|
||||
#ifdef HAS_1W_LORA // Ebyte E22 400M30S (SX1268) / 900M30S (SX1262) / Ebyte E220 400M30S (LLCC68)
|
||||
state = radio.setOutputPower(Config.loramodule.power); // max value 20dB for 1W modules as they have Low Noise Amp
|
||||
radio.setCurrentLimit(140); // to be validated (100 , 120, 140)?
|
||||
#endif
|
||||
int power = validPower(Config.loramodule.power);
|
||||
if (power != Config.loramodule.power) {
|
||||
Utils::println("LoRa power adjusted: " + String(Config.loramodule.power) + " -> " + String(power));
|
||||
}
|
||||
state = radio.setOutputPower(power);
|
||||
if (state != RADIOLIB_ERR_NONE) {
|
||||
Utils::println("LoRa setOutputPower failed! State: " + String(state)); // log and keep going
|
||||
}
|
||||
#if defined(HAS_SX1278) || defined(HAS_SX1276)
|
||||
state = radio.setOutputPower(Config.loramodule.power); // max value 20dB for 400M30S as it has Low Noise Amp
|
||||
radio.setCurrentLimit(100); // to be validated (80 , 100)?
|
||||
#endif
|
||||
#if (defined(HAS_SX1268) || defined(HAS_SX1262)) && !defined(HAS_1W_LORA)
|
||||
state = radio.setOutputPower(Config.loramodule.power + 2); // values available: 10, 17, 22 --> if 20 in tracker_conf.json it will be updated to 22.
|
||||
radio.setCurrentLimit(120); // OCP ceiling for SX127x: ~120mA needed at +20dBm (not a fixed consumption)
|
||||
#else // SX1262 / SX1268 / LLCC68 (also 1W Ebyte E22 / E220 modules)
|
||||
radio.setCurrentLimit(140);
|
||||
#endif
|
||||
|
||||
@@ -156,16 +178,15 @@ namespace LoRa_Utils {
|
||||
#if defined(HAS_TCXO) && !defined(HAS_1W_LORA)
|
||||
radio.setDio2AsRfSwitch();
|
||||
#endif
|
||||
#if defined(TTGO_T_BEAM_1W)
|
||||
radio.setDio2AsRfSwitch(true); // DIO2 drives the 1W PA
|
||||
radio.setPaRampTime(RADIOLIB_SX126X_PA_RAMP_800U); // PA needs >800us to settle (default 200us)
|
||||
#endif
|
||||
#ifdef HAS_TCXO
|
||||
radio.setTCXO(1.8);
|
||||
#endif
|
||||
|
||||
if (state == RADIOLIB_ERR_NONE) {
|
||||
Utils::println("init : LoRa Module ... done!");
|
||||
} else {
|
||||
Utils::println("Starting LoRa failed! State: " + String(state));
|
||||
while (true);
|
||||
}
|
||||
Utils::println("init : LoRa Module ... done!");
|
||||
}
|
||||
|
||||
void changeFreqTx() {
|
||||
@@ -222,6 +243,12 @@ namespace LoRa_Utils {
|
||||
|
||||
void sendNewPacket(const String& newPacket) {
|
||||
if (!Config.loramodule.txActive) return;
|
||||
#ifdef FAN_CTRL_PIN
|
||||
if (THERMAL_Utils::isTxBlocked()) {
|
||||
Utils::println("Thermal: Tx blocked (over-temperature), packet dropped: " + newPacket);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (Config.loramodule.txFreq != Config.loramodule.rxFreq) {
|
||||
if (!packetIsBeacon || (packetIsBeacon && Config.beacon.beaconFreq == 1)) {
|
||||
@@ -245,7 +272,13 @@ namespace LoRa_Utils {
|
||||
}
|
||||
|
||||
if (!cadDropped) {
|
||||
#ifdef FAN_CTRL_PIN
|
||||
THERMAL_Utils::onTxStart();
|
||||
#endif
|
||||
int state = radio.transmit("\x3c\xff\x01" + newPacket);
|
||||
#ifdef FAN_CTRL_PIN
|
||||
THERMAL_Utils::onTxEnd();
|
||||
#endif
|
||||
transmitFlag = true;
|
||||
if (state == RADIOLIB_ERR_NONE) {
|
||||
if (Config.syslog.active && networkManager->isConnected()) {
|
||||
@@ -305,6 +338,7 @@ namespace LoRa_Utils {
|
||||
receivedPackets.erase(receivedPackets.begin());
|
||||
}
|
||||
ReceivedPacket receivedPacket;
|
||||
receivedPacket.rxDate = NTP_Utils::getFormatedDate();
|
||||
receivedPacket.rxTime = NTP_Utils::getFormatedTime();
|
||||
receivedPacket.packet = sanitizeForWeb(packet.substring(3));
|
||||
receivedPacket.RSSI = rssi;
|
||||
|
||||
+9
-1
@@ -18,7 +18,11 @@
|
||||
|
||||
#include <ArduinoJson.h>
|
||||
#include "map_utils.h"
|
||||
#include "ntp_utils.h"
|
||||
#if defined(ARDUINO_ARCH_RP2040)
|
||||
#include "rp2350/ntp_rp2350.h" // RP2350 port: lean SNTP client over W5500
|
||||
#else
|
||||
#include "ntp_utils.h"
|
||||
#endif
|
||||
|
||||
#define MAX_MAP_STATIONS 50
|
||||
#define STATION_TTL_MS 3600000UL // 1 hora (en milisegundos)
|
||||
@@ -30,7 +34,11 @@ std::vector<MapStation> mapStations;
|
||||
namespace MAP_Utils {
|
||||
|
||||
void writeFormatedTime(char* dst, size_t size) { // gets NTP time ("HH:MM:SS") and writes it to dst if valid
|
||||
#if defined(ARDUINO_ARCH_RP2040)
|
||||
String t = Ntp::synced() ? Ntp::hms(Ntp::nowEpoch()) : String("");
|
||||
#else
|
||||
String t = NTP_Utils::getFormatedTime();
|
||||
#endif
|
||||
if (t.length() == 8 && t.charAt(2) == ':') {
|
||||
t.toCharArray(dst, size);
|
||||
} else {
|
||||
|
||||
+20
-1
@@ -51,12 +51,14 @@ bool NetworkManager::_connectWiFi(const WiFiNetwork& network) {
|
||||
WiFi.mode(_wifiAPmode ? WIFI_AP_STA : WIFI_STA);
|
||||
|
||||
Serial.println("[NM] Attempting to connect to WiFi: " + network.ssid);
|
||||
_lastWiFiDisconnectReason = 0;
|
||||
WiFi.begin(network.ssid.c_str(), network.psk.c_str());
|
||||
|
||||
Serial.print("[NM] Connecting ");
|
||||
|
||||
int attempts = 0;
|
||||
while (!isWiFiConnected() && attempts < 10) {
|
||||
if (_lastWiFiDisconnectReason == WIFI_REASON_AUTH_FAIL) break;
|
||||
delay(500);
|
||||
#ifdef INTERNAL_LED_PIN
|
||||
digitalWrite(INTERNAL_LED_PIN,HIGH);
|
||||
@@ -72,10 +74,19 @@ bool NetworkManager::_connectWiFi(const WiFiNetwork& network) {
|
||||
|
||||
if (isWiFiConnected()) return true;
|
||||
|
||||
if (_isWiFiAuthFailure()) {
|
||||
Serial.println("[NM] Wrong WiFi password for SSID: " + network.ssid);
|
||||
if (_wifiAuthFailSSID.isEmpty()) _wifiAuthFailSSID = network.ssid;
|
||||
}
|
||||
Serial.println("[NM] Failed to connect to WiFi after " + String(attempts) + " attempts. SSID: " + network.ssid);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool NetworkManager::_isWiFiAuthFailure() const {
|
||||
uint8_t reason = _lastWiFiDisconnectReason;
|
||||
return reason == WIFI_REASON_AUTH_FAIL || reason == WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT || reason == WIFI_REASON_HANDSHAKE_TIMEOUT;
|
||||
}
|
||||
|
||||
void NetworkManager::_processAPTimeout() {
|
||||
if (!_wifiAPmode || _apTimeout == 0) {
|
||||
return;
|
||||
@@ -93,8 +104,11 @@ void NetworkManager::_processAPTimeout() {
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkManager::_onNetworkEvent(arduino_event_id_t event, arduino_event_info_t /*info*/) {
|
||||
void NetworkManager::_onNetworkEvent(arduino_event_id_t event, arduino_event_info_t info) {
|
||||
switch (event) {
|
||||
case ARDUINO_EVENT_WIFI_STA_DISCONNECTED:
|
||||
_lastWiFiDisconnectReason = info.wifi_sta_disconnected.reason;
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_START:
|
||||
Serial.println("[NM] ETH Started");
|
||||
if (!_hostName.isEmpty()) {
|
||||
@@ -224,6 +238,7 @@ bool NetworkManager::connectWiFi() {
|
||||
if (_wifiNetworks.empty()) {
|
||||
return false;
|
||||
}
|
||||
_wifiAuthFailSSID = "";
|
||||
|
||||
for (size_t i = 0; i < _wifiNetworks.size(); i++) {
|
||||
disconnectWiFi();
|
||||
@@ -256,6 +271,10 @@ String NetworkManager::getWiFiAPSSID() const {
|
||||
return WiFi.softAPSSID();
|
||||
}
|
||||
|
||||
String NetworkManager::getWiFiAuthFailSSID() const {
|
||||
return _wifiAuthFailSSID;
|
||||
}
|
||||
|
||||
IPAddress NetworkManager::getWiFiIP() const {
|
||||
return WiFi.localIP();
|
||||
}
|
||||
|
||||
@@ -70,4 +70,13 @@ namespace NTP_Utils {
|
||||
return String(formatedTime);
|
||||
}
|
||||
|
||||
String getFormatedDate() {
|
||||
if (Config.digi.ecoMode != 0) return "";
|
||||
struct tm timeinfo;
|
||||
if (!ntpStarted || !getLocalTime(&timeinfo, 0)) return ""; // 0 ms: don't wait (default timeout would block 5 s)
|
||||
char formatedDate[11];
|
||||
strftime(formatedDate, sizeof(formatedDate), "%Y-%m-%d", &timeinfo);
|
||||
return String(formatedDate);
|
||||
}
|
||||
|
||||
}
|
||||
+7
-8
@@ -66,7 +66,7 @@ namespace POWER_Utils {
|
||||
}
|
||||
|
||||
void vext_ctrl_OFF() {
|
||||
digitalWrite(VEXT_CTRL_PIN, Config.digi.ecoMode == 1 ? VEXT_CTRL_ON_STATE : !VEXT_CTRL_ON_STATE);
|
||||
digitalWrite(VEXT_CTRL_PIN, !VEXT_CTRL_ON_STATE); // always off, regardless of ecoMode
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -111,9 +111,7 @@ namespace POWER_Utils {
|
||||
PMU.enableALDO3();
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HELTEC_WIRELESS_TRACKER
|
||||
adc_ctrl_ON();
|
||||
#endif
|
||||
// HELTEC_WIRELESS_TRACKER: GPS shares Vext (GPIO3) with the TFT, so it follows the display power (not controlled here)
|
||||
//gpsIsActive = true;
|
||||
}
|
||||
|
||||
@@ -129,9 +127,7 @@ namespace POWER_Utils {
|
||||
PMU.disableALDO3();
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HELTEC_WIRELESS_TRACKER
|
||||
adc_ctrl_OFF();
|
||||
#endif
|
||||
// HELTEC_WIRELESS_TRACKER: GPS shares Vext with the TFT, turned off with it (see activateGPS)
|
||||
//gpsIsActive = false;
|
||||
}
|
||||
|
||||
@@ -199,7 +195,10 @@ namespace POWER_Utils {
|
||||
PMU.setDC1Voltage(3300);
|
||||
PMU.enableDC1();
|
||||
#ifdef TTGO_T_Beam_S3_SUPREME_V3
|
||||
PMU.setALDO1Voltage(3300);
|
||||
PMU.setALDO1Voltage(3300); // BME280, QMC6310, QMI8658, OLED
|
||||
PMU.enableALDO1();
|
||||
PMU.setALDO2Voltage(3300); // sensors/OLED I2C + RTC PCF8563 (must stay on)
|
||||
PMU.enableALDO2();
|
||||
#endif
|
||||
PMU.setButtonBatteryChargeVoltage(3300);
|
||||
PMU.enableButtonBatteryCharge();
|
||||
|
||||
+16
-26
@@ -16,6 +16,7 @@
|
||||
* along with LoRa APRS iGate. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <APRSPacketLib.h>
|
||||
#include "configuration.h"
|
||||
#include "battery_utils.h"
|
||||
#include "station_utils.h"
|
||||
@@ -36,11 +37,17 @@ extern String versionNumber;
|
||||
|
||||
namespace QUERY_Utils {
|
||||
|
||||
bool isQuery(const String& message) { // "?..." queries, plus "HELP" (any case) without the "?"
|
||||
String queryQuestion = message;
|
||||
queryQuestion.toUpperCase();
|
||||
return queryQuestion.startsWith("?") || queryQuestion == "HELP";
|
||||
}
|
||||
|
||||
String process(const String& query, const String& station, bool queryFromAPRSIS, bool thirdParty) {
|
||||
String answer;
|
||||
String queryQuestion = query;
|
||||
queryQuestion.toUpperCase();
|
||||
if (queryQuestion == "?APRS?" || queryQuestion == "H" || queryQuestion == "HELP" || queryQuestion=="?") {
|
||||
if (queryQuestion == "?APRS?" || queryQuestion == "?" || queryQuestion == "HELP") {
|
||||
answer.concat("?APRSV ?APRSP ?APRSL ?APRSSR ?EM=? ?TX=? "); // ?APRSH ?WHERE callsign
|
||||
} else if (queryQuestion == "?APRSV") {
|
||||
answer.concat("CA2RXU_LoRa_iGate v");
|
||||
@@ -139,32 +146,15 @@ namespace QUERY_Utils {
|
||||
|
||||
if (answer == "") return "";
|
||||
|
||||
String queryAnswer = (Config.tacticalCallsign == "" ? Config.callsign : Config.tacticalCallsign);
|
||||
queryAnswer += ">APLRG1";
|
||||
if (queryFromAPRSIS) {
|
||||
queryAnswer += ",TCPIP,qAC";
|
||||
} else {
|
||||
if (!thirdParty) queryAnswer += ",RFONLY";
|
||||
if (Config.beacon.path != "") {
|
||||
queryAnswer += ",";
|
||||
queryAnswer += Config.beacon.path;
|
||||
}
|
||||
}
|
||||
queryAnswer += "::";
|
||||
answer += " *";
|
||||
answer += char(random(97, 123));
|
||||
answer += char(random(97, 123));
|
||||
answer += "*";
|
||||
|
||||
String processedStation = station;
|
||||
for (int i = station.length(); i < 9; i++) {
|
||||
processedStation += ' ';
|
||||
}
|
||||
queryAnswer += processedStation;
|
||||
queryAnswer += ":";
|
||||
queryAnswer += answer;
|
||||
|
||||
queryAnswer += " *";
|
||||
queryAnswer += char(random(97, 123));
|
||||
queryAnswer += char(random(97, 123));
|
||||
queryAnswer += "*";
|
||||
return queryAnswer;
|
||||
String queryCallsign = (Config.tacticalCallsign == "") ? Config.callsign : Config.tacticalCallsign;
|
||||
String queryPath = queryFromAPRSIS ? "" : (thirdParty ? Config.beacon.path : "RFONLY," + Config.beacon.path);
|
||||
String queryAnswer = APRSPacketLib::generateMessagePacket(queryCallsign, "APLRG1", queryPath, station, answer);
|
||||
return queryFromAPRSIS ? APRSPacketLib::generateAPRSISPacket(queryAnswer) : queryAnswer;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
#include "aprsis_rp2350.h"
|
||||
#include <Ethernet.h>
|
||||
#include <APRSPacketLib.h>
|
||||
#include "configuration.h"
|
||||
#include "station_rp2350.h"
|
||||
#include "syslog_rp2350.h"
|
||||
|
||||
extern Configuration Config;
|
||||
// Inbox store (eth_web.cpp) — poll() runs in netTask, same task that owns it.
|
||||
extern void ethWebAddMessage(const String &from, const String &text, const String &via);
|
||||
|
||||
static EthernetClient aprsClient;
|
||||
static const char *IGATE_VERS = "RP2350iGate 0.1";
|
||||
static uint32_t lastLineMs = 0; // last line of any kind from the server ("#" keepalives too)
|
||||
static uint32_t connectedAt = 0; // when the current connection was opened
|
||||
|
||||
// APRS-IS servers send a "#" keepalive about every 20 s. A connection that stays
|
||||
// quiet this long is dead even if the socket still reports it as connected.
|
||||
static const uint32_t SILENT_DROP_MS = 60000;
|
||||
|
||||
// Parse one APRS-IS line; if it's a message addressed to our callsign, record it
|
||||
// in the inbox and ack it (if it carries a {msgid}).
|
||||
static void processAprsisLine(const String &line) {
|
||||
// Login answer: "# logresp CALL verified, server T2XXX" / "... unverified, ...".
|
||||
// Like the ESP32 (APRS_IS_Utils::processAPRSISPacket), a rejected passcode stops APRS-IS
|
||||
// (until the next boot or config save) instead of reconnecting every 10 s and uploading
|
||||
// packets the server ignores. Only an explicit "unverified" blocks: if a server never
|
||||
// answers, behaviour stays as before. "unverified" contains "verified", so test it first.
|
||||
if (line.startsWith("# logresp") && line.indexOf(Config.callsign) >= 0 && line.indexOf("unverified") >= 0) {
|
||||
Serial.println("\n****APRS PASSCODE NOT VALID****\n");
|
||||
Syslog::logTx("*** APRS-IS passcode NOT valid -> APRS-IS stopped ***");
|
||||
aprsClient.stop();
|
||||
Config.aprs_is.active = false; // in memory only: the saved config keeps APRS-IS enabled
|
||||
return;
|
||||
}
|
||||
if (line.length() == 0 || line[0] == '#') return; // server comment / keepalive
|
||||
int gt = line.indexOf('>');
|
||||
int dc = line.indexOf("::");
|
||||
if (gt <= 0 || dc <= gt) return; // not a message packet
|
||||
String from = line.substring(0, gt);
|
||||
if (from == Config.callsign) return; // ignore our own echoes
|
||||
String rest = line.substring(dc + 2); // "ADDRESSEE :text{id}"
|
||||
int fc = rest.indexOf(':');
|
||||
if (fc < 0) return;
|
||||
String addressee = rest.substring(0, fc);
|
||||
addressee.trim();
|
||||
if (addressee != Config.callsign) return; // not for us
|
||||
|
||||
String text = rest.substring(fc + 1);
|
||||
int brace = text.indexOf('{');
|
||||
String msg = (brace > 0) ? text.substring(0, brace) : text;
|
||||
ethWebAddMessage(from, msg, "IS");
|
||||
|
||||
// ack id = text after the LAST '{'; empty = no ack requested (generateAckMessage)
|
||||
String id = (brace > 0) ? text.substring(text.lastIndexOf('{') + 1) : "";
|
||||
id.trim();
|
||||
if (id.length() && aprsClient.connected()) { // ack it over APRS-IS
|
||||
String ack = Config.callsign;
|
||||
ack += ">APLRG1,TCPIP*::";
|
||||
String padded = from;
|
||||
for (int i = from.length(); i < 9; i++) padded += ' ';
|
||||
ack += padded;
|
||||
ack += ":ack";
|
||||
ack += id;
|
||||
aprsClient.print(ack + "\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
namespace AprsIs {
|
||||
|
||||
bool connected() { return aprsClient.connected(); }
|
||||
|
||||
bool connect() {
|
||||
if (aprsClient.connected()) return true;
|
||||
aprsClient.stop();
|
||||
Serial.printf("[aprsis] connecting %s:%d ...\n",
|
||||
Config.aprs_is.server.c_str(), Config.aprs_is.port);
|
||||
if (!aprsClient.connect(Config.aprs_is.server.c_str(), Config.aprs_is.port)) {
|
||||
Serial.println("[aprsis] connect FAILED");
|
||||
return false;
|
||||
}
|
||||
// login line: "user CALL pass PASSCODE vers SW VER [filter F]"
|
||||
String login = "user ";
|
||||
login += Config.callsign;
|
||||
login += " pass ";
|
||||
login += Config.aprs_is.passcode;
|
||||
login += " vers ";
|
||||
login += IGATE_VERS;
|
||||
if (Config.aprs_is.filter.length()) {
|
||||
login += " filter ";
|
||||
login += Config.aprs_is.filter;
|
||||
}
|
||||
aprsClient.print(login + "\r\n");
|
||||
connectedAt = millis();
|
||||
Serial.println("[aprsis] connected, logged in as " + Config.callsign);
|
||||
return true;
|
||||
}
|
||||
|
||||
void poll() {
|
||||
// read line by line; record messages addressed to us, drop the rest
|
||||
static String lineBuf;
|
||||
while (aprsClient.available()) {
|
||||
char ch = (char)aprsClient.read();
|
||||
if (ch == '\n') { lastLineMs = millis(); processAprsisLine(lineBuf); lineBuf = ""; }
|
||||
else if (ch != '\r') { if (lineBuf.length() < 512) lineBuf += ch; }
|
||||
}
|
||||
// a server that went quiet leaves the socket "connected" forever: drop it so
|
||||
// netTask reconnects
|
||||
if (aprsClient.connected() && millis() - lastLineMs > SILENT_DROP_MS &&
|
||||
millis() - connectedAt > SILENT_DROP_MS) {
|
||||
Serial.println("[aprsis] server silent, reconnecting");
|
||||
aprsClient.stop();
|
||||
}
|
||||
}
|
||||
|
||||
bool silentFor(uint32_t ms) { return millis() - lastLineMs > ms; }
|
||||
|
||||
void send(const String &line) {
|
||||
if (line.length() == 0) return; // never send an empty line to APRS-IS
|
||||
if (aprsClient.connected()) aprsClient.print(line + "\r\n");
|
||||
}
|
||||
|
||||
// Gate rules of APRS_IS_Utils::processLoRaPacket. This build never gates APRS-IS
|
||||
// back to RF (no messagesToRF/objectsToRF), so it is a receive-only iGate and
|
||||
// uses qAO, like the ESP32 with messagesToRF off (buildPacketToUpload).
|
||||
// IS2PLAIN metadata line sent right before the gated packet (same as buildIS2Meta()
|
||||
// in the ESP32 aprs_is_utils.cpp). rx_modem=2 is LoRa; the bit rate is derived from
|
||||
// the RX SF/BW/CR, which only change with a config save (= reboot), so it is cached.
|
||||
static String buildIS2Meta(int rssi, float snr) {
|
||||
static String fixedTail;
|
||||
if (fixedTail == "") {
|
||||
// LoRa bit rate = SF * (BW / 2^SF) * 4/CR (CR = denominator: 5..8)
|
||||
uint32_t bitrate = (uint32_t)(Config.loramodule.rxSpreadingFactor
|
||||
* ((float)Config.loramodule.rxSignalBandwidth / (1 << Config.loramodule.rxSpreadingFactor))
|
||||
* (4.0 / Config.loramodule.rxCodingRate4));
|
||||
fixedTail = " rx_modem=2 rx_bitrate=" + String(bitrate) + " rx_frequency=" + String(Config.loramodule.rxFreq);
|
||||
}
|
||||
return "#is2-meta rx_rssi_dbm=" + String(rssi) + " rx_snr_db=" + String(snr, 1) + fixedTail;
|
||||
}
|
||||
|
||||
void forward(const String &packet, int rssi, float snr) {
|
||||
if (!aprsClient.connected()) return;
|
||||
if (packet.length() < 5) return;
|
||||
String body = packet.substring(3); // skip the 3-byte LoRa-APRS header
|
||||
int gt = body.indexOf('>');
|
||||
int colon = body.indexOf(':');
|
||||
if (gt <= 0 || colon <= gt) return; // not a valid "SENDER>PATH:payload"
|
||||
if (colon + 1 < (int)body.length() && body[colon + 1] == '}') return; // third-party packet
|
||||
|
||||
String sender = body.substring(0, gt);
|
||||
if (sender == Config.callsign || !Station::callsignIsValid(sender)) return;
|
||||
|
||||
// NOGATE / RFONLY / TCPIP count only in the path, not in the payload
|
||||
String hdr = body.substring(gt + 1, colon); // "TOCALL,PATH"
|
||||
int comma = hdr.indexOf(',');
|
||||
String path = (comma > 2) ? hdr.substring(comma + 1) : "";
|
||||
if (path.indexOf("NOGATE") >= 0 || path.indexOf("RFONLY") >= 0 || path.indexOf("TCPIP") >= 0) return;
|
||||
|
||||
// SENDER>TOCALL,PATH,qAO,IGATECALL:payload
|
||||
String line = body.substring(0, colon);
|
||||
line += ",qAO,";
|
||||
line += Config.callsign;
|
||||
line += APRSPacketLib::checkForStartingBytes(body.substring(colon));
|
||||
if (Config.aprs_is.is2Metadata) aprsClient.print(buildIS2Meta(rssi, snr) + "\r\n" + line + "\r\n"); // meta line + packet in one write
|
||||
else aprsClient.print(line + "\r\n");
|
||||
Serial.println("[aprsis] up: " + line);
|
||||
}
|
||||
|
||||
} // namespace AprsIs
|
||||
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
// Lean APRS-IS uplink for the RP2350 iGate core path (RX LoRa -> APRS-IS),
|
||||
// over the W5500 (EthernetClient). The full feature set (queries, digi, TNC,
|
||||
// station tracking) of the original aprs_is_utils.cpp is deferred. All calls
|
||||
// touch the W5500/SPI0, so run them from the same task that owns Ethernet.
|
||||
namespace AprsIs {
|
||||
bool connect(); // TCP connect + APRS-IS login
|
||||
bool connected();
|
||||
void poll(); // drain incoming server lines (keepalive); drops a silent connection
|
||||
bool silentFor(uint32_t ms); // no line from the server for `ms` (feeds the backup digi)
|
||||
void send(const String &line); // send a raw APRS-IS line (e.g. beacon)
|
||||
void forward(const String &loraPacket, int rssi, float snr); // RX LoRa packet -> APRS-IS (qAO: receive-only iGate); rssi/snr feed the IS2 meta line
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* RP2350 supply-voltage monitor. Reads VSYS through the board's 3:1 divider on
|
||||
* GP29/ADC3 (Pico2 / W5500-EVB-Pico2): the pin sees VSYS/3, ADC full scale is
|
||||
* the 3.3 V reference. analogRead is cheap and not tied to any bus, so it is safe
|
||||
* to call from whichever task builds the beacon/telemetry.
|
||||
*/
|
||||
#include "battery_rp2350.h"
|
||||
#include "board_pinout.h" // VSYS_CAL per board
|
||||
|
||||
#ifndef PIN_VSYS_ADC
|
||||
#define PIN_VSYS_ADC A3 // GP29 = ADC3 = VSYS/3 on Pico2 / W5500-EVB-Pico2
|
||||
#endif
|
||||
|
||||
// Per-board calibration of the VSYS reading. This code was first tuned on the
|
||||
// WIZnet W5500-EVB-Pico2, whose VSYS sense reads accurately (factor 1.0). On a
|
||||
// genuine Raspberry Pi Pico 2 the on-board 200k/100k divider on GP29 reads
|
||||
// consistently low (~0.59x) under the RP2350 ADC, so the e22-2 variant sets
|
||||
// VSYS_CAL to bring the reported value back to the measured ~5 V supply.
|
||||
#ifndef VSYS_CAL
|
||||
#define VSYS_CAL 1.0f
|
||||
#endif
|
||||
|
||||
namespace Battery {
|
||||
|
||||
void setup() {
|
||||
analogReadResolution(12);
|
||||
}
|
||||
|
||||
float vsys() {
|
||||
// The Raspberry Pi Pico 2's on-board VSYS/3 divider (200k/100k) is high
|
||||
// impedance, so the first ADC sample after the mux selects this channel reads
|
||||
// low (the sample-and-hold cap shares charge with the previous channel/state).
|
||||
// The WIZnet W5500-EVB-Pico2 this was first ported on happened to read fine
|
||||
// with a single shot; a genuine Pico 2 does not. Discard a couple of priming
|
||||
// reads to let the S&H settle on the high-Z source, then average.
|
||||
(void)analogRead(PIN_VSYS_ADC);
|
||||
(void)analogRead(PIN_VSYS_ADC);
|
||||
delayMicroseconds(50);
|
||||
uint32_t acc = 0;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
acc += analogRead(PIN_VSYS_ADC); // 0..4095 over 0..3.3 V
|
||||
delayMicroseconds(20);
|
||||
}
|
||||
return (float)acc / 16.0f * 3.3f / 4096.0f * 3.0f * VSYS_CAL; // undo /3 divider + per-board cal
|
||||
}
|
||||
|
||||
} // namespace Battery
|
||||
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
// Supply-voltage monitor for the RP2350 iGate. Reads VSYS via the on-board 3:1
|
||||
// divider on GP29/ADC3 (Pico2 / WIZnet W5500-EVB-Pico2). Reported in the beacon
|
||||
// (Batt=) and/or as APRS telemetry, per Config.battery. No sleep handling — this
|
||||
// is a mains/Ethernet iGate.
|
||||
namespace Battery {
|
||||
void setup(); // ADC resolution
|
||||
float vsys(); // supply voltage in volts (0 if unavailable)
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
#include "beacon_rp2350.h"
|
||||
#include <APRSPacketLib.h>
|
||||
#include "configuration.h"
|
||||
#include "wx_rp2350.h"
|
||||
#include "battery_rp2350.h"
|
||||
#include "gps_rp2350.h"
|
||||
|
||||
extern Configuration Config;
|
||||
|
||||
namespace Beacon {
|
||||
|
||||
// " Batt=X.XXV" appended to the comment when supply-voltage reporting goes in the
|
||||
// beacon (not as telemetry). Empty otherwise.
|
||||
static String battField() {
|
||||
if (Config.battery.sendInternalVoltage && !Config.battery.sendVoltageAsTelemetry) {
|
||||
char b[12];
|
||||
snprintf(b, sizeof(b), " Batt=%.2fV", (double)Battery::vsys());
|
||||
return String(b);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
// Base91-compressed position payload: =<overlay><base91> (mirrors gps_utils.cpp).
|
||||
// Uses the live GPS fix when GPS is active and locked, else the fixed config
|
||||
// coordinates (a stationary iGate keeps its saved position until a fix arrives).
|
||||
static String encodedPosition() {
|
||||
double lat = Config.beacon.latitude;
|
||||
double lng = Config.beacon.longitude;
|
||||
#ifdef HAS_GPS
|
||||
if (Config.beacon.gpsActive && Gps::hasFix()) {
|
||||
lat = Gps::lat();
|
||||
lng = Gps::lng();
|
||||
}
|
||||
#endif
|
||||
return APRSPacketLib::encodeGPSIntoBase91(lat, lng, 0, 0, Config.beacon.symbol,
|
||||
false, 0, true, Config.beacon.ambiguityLevel);
|
||||
}
|
||||
|
||||
// Weather field appended after the position when a sensor is active (matches
|
||||
// utils.cpp: position + wxData + comment).
|
||||
static String wxField() {
|
||||
if (!Config.wxsensor.active) return "";
|
||||
String wx = Wx::readAprs();
|
||||
return wx.length() ? wx : ".../...g...t...";
|
||||
}
|
||||
|
||||
String buildAprsisLine() {
|
||||
// Own packet uploaded to APRS-IS: TCPIP* only, no RF path and no q construct
|
||||
// (the server appends qAC itself) -- upstream's generateAPRSISPacket().
|
||||
String line = Config.callsign;
|
||||
line += ">APLRG1,TCPIP*:="; // position w/ messaging
|
||||
line += Config.beacon.overlay;
|
||||
line += encodedPosition();
|
||||
line += wxField();
|
||||
line += Config.beacon.comment;
|
||||
line += battField();
|
||||
return line;
|
||||
}
|
||||
|
||||
// RF beacons built so far. buildRfLine() is called once per RF beacon queued
|
||||
// (loraTask), so counting here matches upstream's rfBeaconCounter in utils.cpp.
|
||||
static uint32_t rfBeaconCounter = 0;
|
||||
|
||||
String buildRfLine() {
|
||||
// Built from loraTask — must NOT touch the BMP280 (Wire/I2C0 is owned by
|
||||
// netTask via buildAprsisLine), so no WX field here. Position + comment only.
|
||||
String line = APRSPacketLib::generateBasePacket(Config.callsign, "APLRG1", Config.beacon.path);
|
||||
line += ":=";
|
||||
line += Config.beacon.overlay;
|
||||
line += encodedPosition();
|
||||
// RF carries the comment only every Nth beacon (APRS-IS always does).
|
||||
int commentEveryX = max(1, Config.beacon.rfCommentEveryXBeacons); // 0 or negative = every beacon
|
||||
if (rfBeaconCounter % commentEveryX == 0) line += Config.beacon.comment;
|
||||
rfBeaconCounter++;
|
||||
line += battField();
|
||||
return line;
|
||||
}
|
||||
|
||||
} // namespace Beacon
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
// Builds the iGate position beacon (fixed lat/lon from Config.beacon), using
|
||||
// APRSPacketLib's Base91-compressed position — same format as the ESP32 build.
|
||||
namespace Beacon {
|
||||
String buildAprsisLine(); // CALL>APLRG1,PATH,qAC:=<overlay><base91><comment>
|
||||
String buildRfLine(); // CALL>APLRG1,PATH:=<overlay><base91><comment>
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
// Compatibility shim for W5100S builds (the rp2350_igate_w5100s env).
|
||||
//
|
||||
// The RAK13800_W5100S driver ships its API in <RAK13800_W5100S.h> and provides
|
||||
// no <Ethernet.h>, whereas the W5500 (arduino-libraries/Ethernet) build does.
|
||||
// This directory is added to the include path ONLY by the W5100S env, so the
|
||||
// iGate sources' `#include <Ethernet.h>` resolves here and pulls the W5100S
|
||||
// driver — which exposes the same Ethernet/EthernetClient/EthernetServer/
|
||||
// EthernetUDP API, so no other source changes are needed.
|
||||
#include <RAK13800_W5100S.h>
|
||||
@@ -0,0 +1,252 @@
|
||||
// AUTO-ADAPTED from web_utils.cpp::handleWriteConfiguration (lines 148-293).
|
||||
// Applies a posted config form (urlencoded OR multipart/form-data — the SPA uses
|
||||
// fetch + FormData = multipart) to the global Config and persists it. Replaces
|
||||
// ESPAsyncWebServer's request->getParam/hasParam with a tiny local parser.
|
||||
// Regenerate if the original mapping changes.
|
||||
#include <Arduino.h>
|
||||
#include <vector>
|
||||
#include "configuration.h"
|
||||
#include "lora_utils.h"
|
||||
|
||||
extern Configuration Config;
|
||||
|
||||
struct FormKV { String k, v; };
|
||||
|
||||
static String urlDecode(const String &s) {
|
||||
String out; out.reserve(s.length());
|
||||
for (size_t i = 0; i < s.length(); i++) {
|
||||
char c = s[i];
|
||||
if (c == '+') out += ' ';
|
||||
else if (c == '%' && i + 2 < s.length()) {
|
||||
auto hx = [](char h) -> int {
|
||||
if (h >= '0' && h <= '9') return h - '0';
|
||||
if (h >= 'a' && h <= 'f') return h - 'a' + 10;
|
||||
if (h >= 'A' && h <= 'F') return h - 'A' + 10;
|
||||
return 0; };
|
||||
out += (char)((hx(s[i + 1]) << 4) | hx(s[i + 2])); i += 2;
|
||||
} else out += c;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
static void parseUrlencoded(const String &body, std::vector<FormKV> &kv) {
|
||||
int i = 0, n = body.length();
|
||||
while (i < n) {
|
||||
int amp = body.indexOf('&', i); if (amp < 0) amp = n;
|
||||
String pair = body.substring(i, amp);
|
||||
int eq = pair.indexOf('='); FormKV e;
|
||||
if (eq < 0) { e.k = urlDecode(pair); }
|
||||
else { e.k = urlDecode(pair.substring(0, eq)); e.v = urlDecode(pair.substring(eq + 1)); }
|
||||
if (e.k.length()) kv.push_back(e);
|
||||
i = amp + 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Minimal multipart/form-data parser for simple text fields (no file uploads).
|
||||
static void parseMultipart(const String &boundary, const String &body, std::vector<FormKV> &kv) {
|
||||
if (!boundary.length()) return;
|
||||
String delim = "--" + boundary;
|
||||
int pos = 0;
|
||||
while (true) {
|
||||
int start = body.indexOf(delim, pos);
|
||||
if (start < 0) break;
|
||||
start += delim.length();
|
||||
if (body.substring(start, start + 2) == "--") break; // closing boundary
|
||||
if (body.substring(start, start + 2) == "\r\n") start += 2; // skip CRLF
|
||||
int hend = body.indexOf("\r\n\r\n", start);
|
||||
if (hend < 0) break;
|
||||
String headers = body.substring(start, hend);
|
||||
int valStart = hend + 4;
|
||||
int next = body.indexOf(delim, valStart);
|
||||
if (next < 0) next = body.length();
|
||||
int valEnd = next;
|
||||
if (valEnd >= 2 && body.substring(valEnd - 2, valEnd) == "\r\n") valEnd -= 2;
|
||||
int ni = headers.indexOf("name=\"");
|
||||
if (ni >= 0) {
|
||||
ni += 6;
|
||||
int ne = headers.indexOf('"', ni);
|
||||
if (ne > ni) { FormKV e; e.k = headers.substring(ni, ne); e.v = body.substring(valStart, valEnd); kv.push_back(e); }
|
||||
}
|
||||
pos = next;
|
||||
}
|
||||
}
|
||||
|
||||
bool applyConfigForm(const String &contentType, const String &body) {
|
||||
std::vector<FormKV> kv;
|
||||
if (contentType.indexOf("multipart/form-data") >= 0) {
|
||||
int bi = contentType.indexOf("boundary=");
|
||||
String boundary = (bi >= 0) ? contentType.substring(bi + 9) : "";
|
||||
boundary.trim();
|
||||
parseMultipart(boundary, body, kv);
|
||||
} else {
|
||||
parseUrlencoded(body, kv);
|
||||
}
|
||||
auto fHas = [&](const String &name) -> bool { for (auto &e : kv) if (e.k == name) return true; return false; };
|
||||
auto fGet = [&](const String &name) -> String { for (auto &e : kv) if (e.k == name) return e.v; return String(); };
|
||||
auto getParamStringSafe = [&](const String &name, const String &def = "") -> String { return fHas(name) ? fGet(name) : def; };
|
||||
auto getParamIntSafe = [&](const String &name, int def = 0) -> int { return fHas(name) ? fGet(name).toInt() : def; };
|
||||
auto getParamFloatSafe = [&](const String &name, float def = 0.0f) -> float { return fHas(name) ? fGet(name).toFloat() : def; };
|
||||
auto getParamDoubleSafe = [&](const String &name, double def = 0.0) -> double { return fHas(name) ? (double)fGet(name).toDouble() : def; };
|
||||
|
||||
int networks = getParamIntSafe("wifi.APs");
|
||||
|
||||
Config.wifiAPs = {};
|
||||
|
||||
for (int i = 0; i < networks; i++) {
|
||||
WiFi_AP wifiap;
|
||||
wifiap.ssid = getParamStringSafe("wifi.AP." + String(i) + ".ssid");
|
||||
wifiap.password = getParamStringSafe("wifi.AP." + String(i) + ".password");
|
||||
|
||||
Config.wifiAPs.push_back(wifiap);
|
||||
}
|
||||
|
||||
Config.startupDelay = getParamIntSafe("startupDelay", Config.startupDelay);
|
||||
|
||||
Config.callsign = getParamStringSafe("callsign", Config.callsign);
|
||||
Config.tacticalCallsign = getParamStringSafe("tacticalCallsign", Config.tacticalCallsign);
|
||||
Config.wifiAutoAP.enabled = fHas("wifi.autoAP.enabled");
|
||||
Config.wifiAutoAP.password = getParamStringSafe("wifi.autoAP.password", Config.wifiAutoAP.password);
|
||||
Config.wifiAutoAP.timeout = getParamIntSafe("wifi.autoAP.timeout", Config.wifiAutoAP.timeout);
|
||||
|
||||
Config.aprs_is.active = fHas("aprs_is.active");
|
||||
if (Config.aprs_is.active) {
|
||||
Config.aprs_is.messagesToRF = fHas("aprs_is.messagesToRF");
|
||||
Config.aprs_is.objectsToRF = fHas("aprs_is.objectsToRF");
|
||||
Config.aprs_is.is2Metadata = fHas("aprs_is.is2Metadata");
|
||||
Config.aprs_is.server = getParamStringSafe("aprs_is.server", Config.aprs_is.server);
|
||||
Config.aprs_is.passcode = getParamStringSafe("aprs_is.passcode", Config.aprs_is.passcode);
|
||||
Config.aprs_is.port = getParamIntSafe("aprs_is.port", Config.aprs_is.port);
|
||||
Config.aprs_is.filter = getParamStringSafe("aprs_is.filter", Config.aprs_is.filter);
|
||||
}
|
||||
|
||||
Config.beacon.interval = getParamIntSafe("beacon.interval", Config.beacon.interval);
|
||||
Config.beacon.sendViaAPRSIS = fHas("beacon.sendViaAPRSIS");
|
||||
Config.beacon.sendViaRF = fHas("beacon.sendViaRF");
|
||||
Config.beacon.beaconFreq = getParamIntSafe("beacon.beaconFreq", Config.beacon.beaconFreq);
|
||||
Config.beacon.latitude = getParamDoubleSafe("beacon.latitude", Config.beacon.latitude);
|
||||
Config.beacon.longitude = getParamDoubleSafe("beacon.longitude", Config.beacon.longitude);
|
||||
Config.beacon.comment = getParamStringSafe("beacon.comment", Config.beacon.comment);
|
||||
Config.beacon.rfCommentEveryXBeacons = getParamIntSafe("beacon.rfCommentEveryXBeacons", Config.beacon.rfCommentEveryXBeacons);
|
||||
Config.beacon.overlay = getParamStringSafe("beacon.overlay", Config.beacon.overlay);
|
||||
Config.beacon.symbol = getParamStringSafe("beacon.symbol", Config.beacon.symbol);
|
||||
Config.beacon.path = getParamStringSafe("beacon.path", Config.beacon.path);
|
||||
|
||||
Config.beacon.statusActive = fHas("beacon.statusActive");
|
||||
if (Config.beacon.statusActive) {
|
||||
Config.beacon.statusPacket = getParamStringSafe("beacon.statusPacket", Config.beacon.statusPacket);
|
||||
}
|
||||
|
||||
Config.beacon.gpsActive = fHas("beacon.gpsActive");
|
||||
Config.beacon.ambiguityLevel = getParamIntSafe("beacon.ambiguityLevel", Config.beacon.ambiguityLevel);
|
||||
|
||||
Config.personalNote = getParamStringSafe("personalNote", Config.personalNote);
|
||||
|
||||
Config.blacklist = getParamStringSafe("blacklist", Config.blacklist);
|
||||
|
||||
Config.digi.mode = getParamIntSafe("digi.mode", Config.digi.mode);
|
||||
Config.digi.ecoMode = getParamIntSafe("digi.ecoMode", Config.digi.ecoMode);
|
||||
Config.digi.backupDigiMode = fHas("digi.backupDigiMode");
|
||||
|
||||
Config.loramodule.rxActive = fHas("lora.rxActive");
|
||||
Config.loramodule.rxFreq = getParamIntSafe("lora.rxFreq", Config.loramodule.rxFreq);
|
||||
Config.loramodule.rxSpreadingFactor = getParamIntSafe("lora.rxSpreadingFactor", Config.loramodule.rxSpreadingFactor);
|
||||
Config.loramodule.rxCodingRate4 = getParamIntSafe("lora.rxCodingRate4", Config.loramodule.rxCodingRate4);
|
||||
Config.loramodule.rxSignalBandwidth = getParamIntSafe("lora.rxSignalBandwidth", Config.loramodule.rxSignalBandwidth);
|
||||
Config.loramodule.txActive = fHas("lora.txActive");
|
||||
Config.loramodule.txFreq = getParamIntSafe("lora.txFreq", Config.loramodule.txFreq);
|
||||
Config.loramodule.txSpreadingFactor = getParamIntSafe("lora.txSpreadingFactor", Config.loramodule.txSpreadingFactor);
|
||||
Config.loramodule.txCodingRate4 = getParamIntSafe("lora.txCodingRate4", Config.loramodule.txCodingRate4);
|
||||
Config.loramodule.txSignalBandwidth = getParamIntSafe("lora.txSignalBandwidth", Config.loramodule.txSignalBandwidth);
|
||||
Config.loramodule.power = LoRa_Utils::validPower(getParamIntSafe("lora.power", Config.loramodule.power)); // saved as the power the radio chip really uses
|
||||
Config.loramodule.cadActive = fHas("lora.cadActive");
|
||||
|
||||
Config.display.alwaysOn = fHas("display.alwaysOn");
|
||||
if (!Config.display.alwaysOn) {
|
||||
Config.display.timeout = getParamIntSafe("display.timeout", Config.display.timeout);
|
||||
}
|
||||
Config.display.turn180 = fHas("display.turn180");
|
||||
|
||||
Config.battery.sendInternalVoltage = fHas("battery.sendInternalVoltage");
|
||||
Config.battery.monitorInternalVoltage = fHas("battery.monitorInternalVoltage");
|
||||
if (Config.battery.monitorInternalVoltage) {
|
||||
Config.battery.internalSleepVoltage = getParamFloatSafe("battery.internalSleepVoltage", Config.battery.internalSleepVoltage);
|
||||
}
|
||||
|
||||
Config.battery.sendExternalVoltage = fHas("battery.sendExternalVoltage");
|
||||
if (Config.battery.sendExternalVoltage) {
|
||||
Config.battery.useExternalI2CSensor = fHas("battery.useExternalI2CSensor");
|
||||
}
|
||||
if (Config.battery.sendExternalVoltage) {
|
||||
Config.battery.externalVoltagePin = getParamIntSafe("battery.externalVoltagePin", Config.battery.externalVoltagePin);
|
||||
Config.battery.voltageDividerR1 = getParamFloatSafe("battery.voltageDividerR1", Config.battery.voltageDividerR1);
|
||||
Config.battery.voltageDividerR2 = getParamFloatSafe("battery.voltageDividerR2", Config.battery.voltageDividerR2);
|
||||
}
|
||||
Config.battery.monitorExternalVoltage = fHas("battery.monitorExternalVoltage");
|
||||
if (Config.battery.monitorExternalVoltage) {
|
||||
Config.battery.externalSleepVoltage = getParamFloatSafe("battery.externalSleepVoltage", Config.battery.externalSleepVoltage);
|
||||
}
|
||||
Config.battery.sendVoltageAsTelemetry = fHas("battery.sendVoltageAsTelemetry");
|
||||
|
||||
Config.wxsensor.active = fHas("wxsensor.active");
|
||||
if (Config.wxsensor.active) {
|
||||
Config.wxsensor.heightCorrection = getParamIntSafe("wxsensor.heightCorrection", Config.wxsensor.heightCorrection);
|
||||
Config.wxsensor.temperatureCorrection = getParamFloatSafe("wxsensor.temperatureCorrection", Config.wxsensor.temperatureCorrection);
|
||||
Config.beacon.symbol = "_";
|
||||
}
|
||||
|
||||
Config.syslog.active = fHas("syslog.active");
|
||||
if (Config.syslog.active) {
|
||||
Config.syslog.server = getParamStringSafe("syslog.server", Config.syslog.server);
|
||||
Config.syslog.port = getParamIntSafe("syslog.port", Config.syslog.port);
|
||||
Config.syslog.logBeaconOverTCPIP = fHas("syslog.logBeaconOverTCPIP");
|
||||
}
|
||||
|
||||
Config.tnc.enableServer = fHas("tnc.enableServer");
|
||||
Config.tnc.enableSerial = fHas("tnc.enableSerial");
|
||||
Config.tnc.acceptOwn = fHas("tnc.acceptOwn");
|
||||
Config.tnc.aprsBridgeActive = fHas("tnc.aprsBridgeActive");
|
||||
Config.tnc.kissProtocol = getParamStringSafe("tnc.kissProtocol", Config.tnc.kissProtocol ? "KISS" : "TNC2") != "TNC2";
|
||||
|
||||
Config.mqtt.active = fHas("mqtt.active");
|
||||
if (Config.mqtt.active) {
|
||||
Config.mqtt.server = getParamStringSafe("mqtt.server", Config.mqtt.server);
|
||||
Config.mqtt.topic = getParamStringSafe("mqtt.topic", Config.mqtt.topic);
|
||||
Config.mqtt.username = getParamStringSafe("mqtt.username", Config.mqtt.username);
|
||||
Config.mqtt.password = getParamStringSafe("mqtt.password", Config.mqtt.password);
|
||||
Config.mqtt.port = getParamIntSafe("mqtt.port", Config.mqtt.port);
|
||||
Config.mqtt.beaconOverMqtt = fHas("mqtt.beaconOverMqtt");
|
||||
}
|
||||
|
||||
Config.rebootMode = fHas("other.rebootMode");
|
||||
if (Config.rebootMode) {
|
||||
Config.rebootModeTime = getParamIntSafe("other.rebootModeTime", Config.rebootModeTime);
|
||||
}
|
||||
|
||||
Config.ota.username = getParamStringSafe("ota.username", Config.ota.username);
|
||||
Config.ota.password = getParamStringSafe("ota.password", Config.ota.password);
|
||||
|
||||
Config.webadmin.active = fHas("webadmin.active");
|
||||
if (Config.webadmin.active) {
|
||||
Config.webadmin.username = getParamStringSafe("webadmin.username", Config.webadmin.username);
|
||||
Config.webadmin.password = getParamStringSafe("webadmin.password", Config.webadmin.password);
|
||||
}
|
||||
|
||||
Config.remoteManagement.managers = getParamStringSafe("remoteManagement.managers", Config.remoteManagement.managers);
|
||||
Config.remoteManagement.rfOnly = fHas("remoteManagement.rfOnly");
|
||||
|
||||
Config.ntp.server = getParamStringSafe("ntp.server", Config.ntp.server);
|
||||
Config.ntp.gmtCorrection = getParamFloatSafe("ntp.gmtCorrection", Config.ntp.gmtCorrection);
|
||||
|
||||
Config.network.dhcp = fHas("network.dhcp");
|
||||
if (!Config.network.dhcp) {
|
||||
Config.network.ip = getParamStringSafe("network.ip", Config.network.ip);
|
||||
Config.network.gateway = getParamStringSafe("network.gateway", Config.network.gateway);
|
||||
Config.network.subnet = getParamStringSafe("network.subnet", Config.network.subnet);
|
||||
Config.network.dns = getParamStringSafe("network.dns", Config.network.dns);
|
||||
}
|
||||
|
||||
Config.rememberStationTime = getParamIntSafe("other.rememberStationTime", Config.rememberStationTime);
|
||||
|
||||
Serial.printf("[cfg] applied %d form fields\n", (int)kv.size());
|
||||
return Config.writeFile();
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
* RP2350 digipeater — lean port of DIGI_Utils (src/digi_utils.cpp).
|
||||
* Computes the WIDEn-N-rewritten packet to re-transmit over RF. The actual TX
|
||||
* is done by the caller (loraTask, which owns the radio) via
|
||||
* LoRa_Utils::sendNewPacket(), so this module never touches the radio or W5500.
|
||||
*/
|
||||
#include "digi_rp2350.h"
|
||||
#include "configuration.h"
|
||||
#include "station_rp2350.h"
|
||||
|
||||
extern Configuration Config;
|
||||
// Backup digi running right now (Config.digi.backupDigiMode ticked and APRS-IS
|
||||
// down); set by netTask in main.cpp, the RP2350 counterpart of the ESP32 global
|
||||
// backupDigiMode in LoRa_APRS_iGate.cpp.
|
||||
extern volatile bool g_backupDigi;
|
||||
|
||||
namespace {
|
||||
|
||||
String stationCall() {
|
||||
return Config.tacticalCallsign.length() ? Config.tacticalCallsign : Config.callsign;
|
||||
}
|
||||
|
||||
// strip any residual on-air header bytes ('<' 0xFF 0x01) appended to the payload
|
||||
String checkForStartingBytes(const String& packet) {
|
||||
int idx = packet.indexOf("\x3c\xff\x01");
|
||||
return (idx != -1) ? packet.substring(0, idx) : packet;
|
||||
}
|
||||
|
||||
// Drop used WIDE1*/WIDE2* hops, matching whole path tokens only (port of
|
||||
// DIGI_Utils::cleanPath).
|
||||
String cleanPath(const String& path) {
|
||||
String result;
|
||||
unsigned int start = 0;
|
||||
while (true) {
|
||||
int delim = path.indexOf(',', start);
|
||||
int end = (delim == -1) ? path.length() : delim;
|
||||
String token = path.substring(start, end);
|
||||
if (token != "WIDE1*" && token != "WIDE2*") {
|
||||
if (result.length() > 0) result += ",";
|
||||
result += token;
|
||||
}
|
||||
if (delim == -1) break;
|
||||
start = delim + 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Offset of `token` as a whole comma-separated path element, or -1 (port of
|
||||
// DIGI_Utils' pathTokenIndex).
|
||||
int pathTokenIndex(const String& path, const String& token) {
|
||||
unsigned int start = 0;
|
||||
while (start < path.length()) {
|
||||
int end = path.indexOf(",", start);
|
||||
if (end == -1) end = path.length();
|
||||
if (path.substring(start, end) == token) return start;
|
||||
start = end + 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Port of DIGI_Utils::processMode3Path: digipeat only when our own callsign is
|
||||
// listed (unused) in the path, keeping the rest of the path intact and marking
|
||||
// our token with '*'. Every token before ours must already be marked.
|
||||
String processMode3Path(const String& path, const String& call) {
|
||||
int start = 0;
|
||||
bool prevTokensAllStar = true;
|
||||
int ownTokenEnd = -1;
|
||||
|
||||
while (start < (int)path.length()) {
|
||||
int delim = path.indexOf(',', start);
|
||||
if (delim == -1) delim = path.length();
|
||||
|
||||
String token = path.substring(start, delim);
|
||||
bool tokenIsOwn = (token == call) || (token == call + "*");
|
||||
bool tokenStar = token.endsWith("*");
|
||||
|
||||
if (tokenIsOwn) {
|
||||
if (tokenStar) return ""; // already digipeated by us
|
||||
if (!prevTokensAllStar) return ""; // earlier hops must be marked
|
||||
ownTokenEnd = delim;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!tokenStar) prevTokensAllStar = false;
|
||||
start = delim + 1;
|
||||
}
|
||||
|
||||
if (ownTokenEnd == -1) return "";
|
||||
return cleanPath(path.substring(0, ownTokenEnd)) + "*" + path.substring(ownTokenEnd);
|
||||
}
|
||||
|
||||
// Port of DIGI_Utils::buildPacket, non-crossFreq / non-thirdParty branch only.
|
||||
// `packet` is the headerless "SENDER>PATH:payload"; `path` is the part after the
|
||||
// first comma in PATH (e.g. "WIDE1-1" or "WIDE2-2").
|
||||
String buildPacket(const String& path, const String& packet) {
|
||||
String call = stationCall();
|
||||
int colon = packet.indexOf(':');
|
||||
int digiMode = Config.digi.mode;
|
||||
String tempPath = path;
|
||||
|
||||
if (tempPath.indexOf("WIDE1-1") != -1 && (digiMode == 1 || digiMode == 2 || g_backupDigi)) {
|
||||
if (tempPath.indexOf('*') != -1) return ""; // '*' shouldn't precede WIDE1-1
|
||||
if (pathTokenIndex(tempPath, "WIDE1-1") != 0) return ""; // WIDE1-1 must be the first hop
|
||||
tempPath = call + "*" + tempPath.substring(7);
|
||||
} else if (tempPath.indexOf("WIDE2-") != -1 && digiMode == 2) {
|
||||
tempPath = cleanPath(path);
|
||||
int idx = pathTokenIndex(tempPath, "WIDE2-1");
|
||||
if (idx != -1) {
|
||||
tempPath = tempPath.substring(0, idx) + call + "*" + tempPath.substring(idx + 7);
|
||||
} else {
|
||||
idx = pathTokenIndex(tempPath, "WIDE2-2");
|
||||
if (idx == -1) return ""; // WIDE2-3+ unsupported
|
||||
tempPath = tempPath.substring(0, idx) + call + "*,WIDE2-1" + tempPath.substring(idx + 7);
|
||||
}
|
||||
} else if (digiMode == 3) { // own-callsign path digi
|
||||
tempPath = processMode3Path(tempPath, call);
|
||||
if (tempPath == "") return "";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
||||
String out = packet.substring(0, packet.indexOf(',') + 1); // "SENDER>APxxxx,"
|
||||
out += tempPath;
|
||||
out += checkForStartingBytes(packet.substring(colon)); // ":payload"
|
||||
return out;
|
||||
}
|
||||
|
||||
// Port of DIGI_Utils::generateDigipeatedPacket, non-thirdParty / non-crossFreq.
|
||||
String generateDigipeatedPacket(const String& packet) {
|
||||
int gt = packet.indexOf('>');
|
||||
int colon = packet.indexOf(':');
|
||||
if (gt < 0 || colon <= gt) return "";
|
||||
String hdr = packet.substring(gt + 1, colon); // "APxxxx,WIDE1-1,..."
|
||||
int comma = hdr.indexOf(',');
|
||||
int digiMode = Config.digi.mode;
|
||||
bool backup = g_backupDigi;
|
||||
|
||||
if (comma <= 2) return ""; // no path -> nothing to consume
|
||||
String path = hdr.substring(comma + 1);
|
||||
|
||||
if (digiMode == 1 || backup) { // WIDE1-1 fill-in digi
|
||||
return (path.indexOf("WIDE1-1") != -1) ? buildPacket(path, packet) : "";
|
||||
}
|
||||
if (digiMode == 2) { // WIDE2-n (+ WIDE1-1) digi
|
||||
int w1 = path.indexOf("WIDE1-1");
|
||||
int w2 = path.indexOf("WIDE2-");
|
||||
bool hasW1 = w1 != -1, hasW2 = w2 != -1;
|
||||
if (hasW1 && hasW2 && w2 < w1) return ""; // WIDE1 must precede WIDE2
|
||||
if (hasW1 || hasW2) return buildPacket(path, packet);
|
||||
}
|
||||
if (digiMode == 3) { // repeat only if we are in the path
|
||||
if (path.indexOf(stationCall()) != -1) return buildPacket(path, packet);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace Digi {
|
||||
|
||||
bool enabled() {
|
||||
// Digi modes (upstream V4.0.0 numbering): 1 = WIDE1-1 fill-in, 2 = WIDE2-n,
|
||||
// 3 = own-callsign path. CrossFreq digipeating is not ported.
|
||||
return (Config.digi.mode >= 1 && Config.digi.mode <= 3) || g_backupDigi;
|
||||
}
|
||||
|
||||
String process(const String& rawPacket) {
|
||||
if (!enabled()) return "";
|
||||
if (rawPacket.length() < 5) return "";
|
||||
|
||||
String packet = rawPacket.substring(3); // drop 3-byte LoRa-APRS header
|
||||
int gt = packet.indexOf('>');
|
||||
if (gt < 3) return "";
|
||||
int colon = packet.indexOf(':');
|
||||
if (colon < gt) return "";
|
||||
String sender = packet.substring(0, gt);
|
||||
|
||||
// NOGATE in the path is not repeated (as DIGI_Utils::processLoRaPacket). RFONLY
|
||||
// only keeps a packet off APRS-IS, so it is still digipeated.
|
||||
String hdr = packet.substring(gt + 1, colon); // "APxxxx,WIDE1-1,..."
|
||||
int comma = hdr.indexOf(',');
|
||||
if (comma > 2 && hdr.substring(comma + 1).indexOf("NOGATE") >= 0) return "";
|
||||
|
||||
String call = stationCall();
|
||||
if (sender == call) return ""; // never repeat ourselves
|
||||
if (Config.tacticalCallsign.length() == 0 && !Station::callsignIsValid(sender)) return "";
|
||||
|
||||
// NOTE: duplicate filtering + blacklist are applied upstream in loraTask
|
||||
// (Station::isDuplicate / isBlacklisted), shared with the gate path.
|
||||
return generateDigipeatedPacket(packet);
|
||||
}
|
||||
|
||||
} // namespace Digi
|
||||
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
// Lean APRS digipeater for the RP2350 port. Faithful port of the WIDEn-N path
|
||||
// rewriting from src/digi_utils.cpp (DIGI_Utils), trimmed to the single-radio /
|
||||
// same-frequency case (no cross-freq, no third-party, no message queries — those
|
||||
// belong to the iGate/TNC paths). Read-only on Config; keeps its own small dedup
|
||||
// ring buffer to break repeater loops.
|
||||
//
|
||||
// Modes (Config.digi.mode, matching the web UI since V4.0.0):
|
||||
// 0 OFF
|
||||
// 1 WIDE1 (fill-in) digi — consume WIDE1-1 only
|
||||
// 2 WIDE2 (+WIDE1) digi — consume WIDE1-1 and WIDE2-n
|
||||
// 3 own-callsign digi — repeat only when our callsign is next in the path
|
||||
// While the backup digi runs (Config.digi.backupDigiMode ticked AND APRS-IS down,
|
||||
// see g_backupDigi in main.cpp) only WIDE1-1 is repeated, whatever the mode.
|
||||
namespace Digi {
|
||||
// True when digipeating is enabled (so the caller can skip the work entirely).
|
||||
bool enabled();
|
||||
|
||||
// Given the RAW received packet (WITH the 3-byte LoRa-APRS header), returns
|
||||
// the headerless packet to re-transmit over RF ("SENDER>PATH:payload"), or ""
|
||||
// if this packet should not be digipeated (off, self, dup, no WIDE to consume,
|
||||
// invalid callsign, NOGATE in the path).
|
||||
String process(const String& rawPacket);
|
||||
}
|
||||
@@ -0,0 +1,459 @@
|
||||
#include "eth_web.h"
|
||||
#include <Arduino.h>
|
||||
#include <Ethernet.h>
|
||||
#include <LittleFS.h>
|
||||
#include <vector>
|
||||
#include "web_assets.h" // gzipped SPA assets embedded in flash
|
||||
#include "ntp_rp2350.h"
|
||||
#include "ota_rp2350.h"
|
||||
#include "map_utils.h" // stations heard with a decoded position (web "Map" view)
|
||||
#include "configuration.h"
|
||||
|
||||
extern Configuration Config;
|
||||
|
||||
// Apply a posted config form (urlencoded or multipart) to Config + persist.
|
||||
extern bool applyConfigForm(const String &contentType, const String &body);
|
||||
|
||||
// Set by POST /action?type=send-beacon; netTask sends an APRS-IS beacon and clears it.
|
||||
extern volatile bool g_beaconNow;
|
||||
// Set by POST /action?type=send-rf-beacon; loraTask sends an RF beacon and clears it.
|
||||
extern volatile bool g_rfBeaconNow;
|
||||
// Originate an APRS message (RF via loraTask and/or APRS-IS via the socket);
|
||||
// sentRF / sentTCP report which copies actually went out.
|
||||
extern void webSendMessage(const String &to, const String &text, bool viaRF, bool viaTCP,
|
||||
bool &sentRF, bool &sentTCP);
|
||||
|
||||
static const int WEB_PORT = 80;
|
||||
static const size_t MAX_LINE_LEN = 512;
|
||||
static const long MAX_CONFIG_BODY = 64 * 1024; // POST /configuration.json; bigger = 413
|
||||
static const size_t MAX_HEADER_LINES = 40;
|
||||
static const char *CONFIG_PATH = "/igate_conf.json";
|
||||
|
||||
static EthernetServer webServer(WEB_PORT);
|
||||
static bool webStarted = false;
|
||||
|
||||
// --- incoming APRS messages addressed to us (shown in the Messages view) ---
|
||||
struct RxMsg { String from; String text; String via; uint32_t when; };
|
||||
static std::vector<RxMsg> rxMessages; // netTask-owned, newest pushed to back
|
||||
static const size_t RXMSG_MAX = 20;
|
||||
|
||||
void ethWebAddMessage(const String &from, const String &text, const String &via) {
|
||||
if (rxMessages.size() >= RXMSG_MAX) rxMessages.erase(rxMessages.begin());
|
||||
rxMessages.push_back({from, text, via, millis()});
|
||||
Serial.println("[msg] from " + from + " (" + via + "): " + text);
|
||||
}
|
||||
|
||||
// --- received LoRa packets log (shown in the Received packets view) ---
|
||||
struct RxPkt { String frame; int rssi; float snr; uint32_t when; };
|
||||
static std::vector<RxPkt> rxPackets; // netTask-owned, newest pushed to back
|
||||
static const size_t RXPKT_MAX = 10;
|
||||
|
||||
void ethWebAddPacket(const String &frame, int rssi, float snr) {
|
||||
if (rxPackets.size() >= RXPKT_MAX) rxPackets.erase(rxPackets.begin());
|
||||
rxPackets.push_back({frame, rssi, snr, millis()});
|
||||
}
|
||||
|
||||
struct Request {
|
||||
String method;
|
||||
String path;
|
||||
String query;
|
||||
String contentType;
|
||||
String authorization;
|
||||
String ifNoneMatch;
|
||||
long contentLength = 0;
|
||||
};
|
||||
|
||||
// minimal percent-decoder for query-string values
|
||||
static String urlDecodeQ(const String &s) {
|
||||
String out; out.reserve(s.length());
|
||||
for (size_t i = 0; i < s.length(); i++) {
|
||||
char ch = s[i];
|
||||
if (ch == '+') out += ' ';
|
||||
else if (ch == '%' && i + 2 < s.length()) {
|
||||
auto hx = [](char h) -> int {
|
||||
if (h >= '0' && h <= '9') return h - '0';
|
||||
if (h >= 'a' && h <= 'f') return h - 'a' + 10;
|
||||
if (h >= 'A' && h <= 'F') return h - 'A' + 10;
|
||||
return 0; };
|
||||
out += (char)((hx(s[i + 1]) << 4) | hx(s[i + 2])); i += 2;
|
||||
} else out += ch;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// extract a query-string parameter ("key=value", value up to '&'), url-decoded
|
||||
static String getQueryParam(const String &query, const char *key) {
|
||||
String needle = String(key) + "=";
|
||||
int i = query.indexOf(needle);
|
||||
if (i < 0) return "";
|
||||
i += needle.length();
|
||||
int amp = query.indexOf('&', i);
|
||||
if (amp < 0) amp = query.length();
|
||||
return urlDecodeQ(query.substring(i, amp));
|
||||
}
|
||||
|
||||
// standard base64 of a string (for HTTP Basic auth comparison)
|
||||
static String b64(const String &data) {
|
||||
static const char *T = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
String r;
|
||||
int v = 0, c = 0;
|
||||
for (size_t i = 0; i < data.length(); i++) {
|
||||
v = (v << 8) | (uint8_t)data[i];
|
||||
c += 8;
|
||||
while (c >= 6) { c -= 6; r += T[(v >> c) & 0x3F]; }
|
||||
}
|
||||
if (c > 0) r += T[(v << (6 - c)) & 0x3F];
|
||||
while (r.length() % 4) r += '=';
|
||||
return r;
|
||||
}
|
||||
|
||||
// web-interface HTTP Basic auth: allowed unless webadmin is active with creds and
|
||||
// the request lacks the matching "Authorization: Basic <base64(user:pass)>".
|
||||
static bool webAuthOk(const String &authHeader) {
|
||||
if (!Config.webadmin.active) return true;
|
||||
if (Config.webadmin.username.length() == 0 && Config.webadmin.password.length() == 0) return true;
|
||||
if (!authHeader.startsWith("Basic ")) return false;
|
||||
String token = authHeader.substring(6);
|
||||
token.trim();
|
||||
return token == b64(Config.webadmin.username + ":" + Config.webadmin.password);
|
||||
}
|
||||
|
||||
// escape a string for embedding in a JSON string literal
|
||||
static String jsonEscape(const String &s) {
|
||||
String out; out.reserve(s.length() + 4);
|
||||
for (size_t i = 0; i < s.length(); i++) {
|
||||
char ch = s[i];
|
||||
if (ch == '"' || ch == '\\') { out += '\\'; out += ch; }
|
||||
else if (ch == '\n') out += "\\n";
|
||||
else if (ch == '\r') out += "\\r";
|
||||
else if (ch == '\t') out += "\\t";
|
||||
else if ((uint8_t)ch < 0x20) { /* drop other control chars */ }
|
||||
else out += ch;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// ---- HTTP request parsing (adapted from mesh/eth/ethApiHandlers.cpp) ----
|
||||
static bool readLine(EthernetClient &c, String &out, uint32_t deadlineMs) {
|
||||
out = "";
|
||||
while ((int32_t)(millis() - deadlineMs) < 0) {
|
||||
if (!c.connected()) return false;
|
||||
if (!c.available()) { delay(1); continue; }
|
||||
int ch = c.read();
|
||||
if (ch < 0) continue;
|
||||
if (ch == '\n') return true;
|
||||
if (ch == '\r') continue;
|
||||
if (out.length() >= MAX_LINE_LEN) return false;
|
||||
out += (char)ch;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool headerIs(const String &line, const char *prefix, String &valueOut) {
|
||||
size_t pl = strlen(prefix);
|
||||
if (line.length() < pl + 1) return false;
|
||||
for (size_t i = 0; i < pl; i++) {
|
||||
char a = line.charAt(i), b = prefix[i];
|
||||
if (a >= 'A' && a <= 'Z') a += 32;
|
||||
if (b >= 'A' && b <= 'Z') b += 32;
|
||||
if (a != b) return false;
|
||||
}
|
||||
if (line.charAt(pl) != ':') return false;
|
||||
valueOut = line.substring(pl + 1);
|
||||
valueOut.trim();
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool parseRequest(EthernetClient &c, Request &req, uint32_t deadlineMs) {
|
||||
String line;
|
||||
if (!readLine(c, line, deadlineMs) || line.length() == 0) return false;
|
||||
int sp1 = line.indexOf(' ');
|
||||
int sp2 = line.indexOf(' ', sp1 + 1);
|
||||
if (sp1 <= 0 || sp2 <= sp1) return false;
|
||||
req.method = line.substring(0, sp1);
|
||||
String full = line.substring(sp1 + 1, sp2);
|
||||
int q = full.indexOf('?');
|
||||
if (q >= 0) { req.path = full.substring(0, q); req.query = full.substring(q + 1); }
|
||||
else { req.path = full; req.query = ""; }
|
||||
size_t n = 0; String val;
|
||||
while (n++ < MAX_HEADER_LINES) {
|
||||
if (!readLine(c, line, deadlineMs)) return false;
|
||||
if (line.length() == 0) return true; // end of headers
|
||||
if (headerIs(line, "Content-Length", val)) req.contentLength = val.toInt();
|
||||
else if (headerIs(line, "Content-Type", val)) req.contentType = val;
|
||||
else if (headerIs(line, "Authorization", val)) req.authorization = val;
|
||||
else if (headerIs(line, "If-None-Match", val)) req.ifNoneMatch = val;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---- response helpers ----
|
||||
static void sendStatus(EthernetClient &c, int code, const char *reason) {
|
||||
c.print("HTTP/1.1 "); c.print(code); c.print(' '); c.print(reason); c.print("\r\n");
|
||||
}
|
||||
// WIZnet's socketSend() clamps a write to the socket TX buffer (SSIZE, 2 KB here)
|
||||
// but EthernetClient::write() returns the size it was ASKED for, not what it sent,
|
||||
// so a single print() of a longer body silently loses the tail: a /stations.json of
|
||||
// 2616 bytes reached the browser cut at 2048, mid-JSON, and the map stayed empty.
|
||||
// Always hand the socket chunks that fit, and give up if the peer goes away or
|
||||
// stops reading for 5 s (an idle timeout, not a total one: the page is one ~185 KB
|
||||
// response now, see tools/gen_web_assets_rp2350.py, and a slow client may need longer).
|
||||
static void sendBody(EthernetClient &c, const uint8_t *data, size_t len) {
|
||||
size_t sent = 0;
|
||||
uint32_t deadline = millis() + 5000;
|
||||
while (sent < len && c.connected() && (int32_t)(millis() - deadline) < 0) {
|
||||
size_t chunk = len - sent;
|
||||
if (chunk > 1024) chunk = 1024;
|
||||
size_t w = c.write(data + sent, chunk);
|
||||
if (w == 0) { delay(1); continue; } // TX buffer full: let it drain
|
||||
sent += w;
|
||||
deadline = millis() + 5000;
|
||||
}
|
||||
if (sent < len) Serial.printf("[web] short send: %u of %u bytes\n", (unsigned)sent, (unsigned)len);
|
||||
}
|
||||
|
||||
static void sendText(EthernetClient &c, int code, const char *reason, const char *ctype, const String &body) {
|
||||
sendStatus(c, code, reason);
|
||||
c.print("Content-Type: "); c.print(ctype); c.print("\r\n");
|
||||
c.print("Content-Length: "); c.print(body.length()); c.print("\r\n");
|
||||
c.print("Connection: close\r\n\r\n");
|
||||
sendBody(c, (const uint8_t *)body.c_str(), body.length());
|
||||
}
|
||||
|
||||
static void serveConfig(EthernetClient &c) {
|
||||
File f = LittleFS.open(CONFIG_PATH, "r");
|
||||
if (!f) { sendText(c, 200, "OK", "application/json", "{}"); return; }
|
||||
sendStatus(c, 200, "OK");
|
||||
c.print("Content-Type: application/json\r\n");
|
||||
c.print("Content-Length: "); c.print((uint32_t)f.size()); c.print("\r\n");
|
||||
c.print("Connection: close\r\n\r\n");
|
||||
uint8_t buf[256];
|
||||
size_t n;
|
||||
while ((n = f.read(buf, sizeof(buf))) > 0) c.write(buf, n);
|
||||
f.close();
|
||||
}
|
||||
|
||||
// Serve a gzipped flash asset (chunked — the W5500 TX buffer is ~2 KB/socket).
|
||||
// The SPA assets live in flash, so they only change when the firmware does:
|
||||
// tag them with the build stamp and let the browser revalidate on each load.
|
||||
// With a plain "max-age" a browser kept serving the old page for an hour after
|
||||
// an OTA -- and mixed old and new files, since each asset expires on its own --
|
||||
// which looks exactly like a broken web UI.
|
||||
static String assetEtag(const WebAsset &a) {
|
||||
extern const char *FW_BUILD;
|
||||
uint32_t h = 5381;
|
||||
for (const char *p = FW_BUILD; *p; p++) h = h * 33u + (uint8_t)*p;
|
||||
char buf[32];
|
||||
snprintf(buf, sizeof(buf), "\"%08lx-%x\"", (unsigned long)h, (unsigned)a.len);
|
||||
return String(buf);
|
||||
}
|
||||
|
||||
static void serveAsset(EthernetClient &c, const WebAsset &a, const String &ifNoneMatch) {
|
||||
String etag = assetEtag(a);
|
||||
if (ifNoneMatch.length() && ifNoneMatch.indexOf(etag) >= 0) { // unchanged since last load
|
||||
sendStatus(c, 304, "Not Modified");
|
||||
c.print("ETag: "); c.print(etag); c.print("\r\n");
|
||||
c.print("Cache-Control: no-cache\r\n");
|
||||
c.print("Content-Length: 0\r\nConnection: close\r\n\r\n");
|
||||
return;
|
||||
}
|
||||
sendStatus(c, 200, "OK");
|
||||
c.print("Content-Type: "); c.print(a.ctype); c.print("\r\n");
|
||||
c.print("Content-Encoding: gzip\r\n");
|
||||
c.print("Cache-Control: no-cache\r\n");
|
||||
c.print("ETag: "); c.print(etag); c.print("\r\n");
|
||||
c.print("Content-Length: "); c.print((uint32_t)a.len); c.print("\r\n");
|
||||
c.print("Connection: close\r\n\r\n");
|
||||
sendBody(c, a.data, a.len); // RP2350: flash is directly addressable
|
||||
}
|
||||
|
||||
// POST /configuration.json : read the urlencoded body, apply to Config, persist,
|
||||
// then redirect + reboot (mirrors the original web_utils flow).
|
||||
static void handleConfigPost(EthernetClient &c, const Request &req) {
|
||||
if (req.contentLength > MAX_CONFIG_BODY) {
|
||||
sendText(c, 413, "Payload Too Large", "text/plain", "config form too large");
|
||||
c.flush();
|
||||
return;
|
||||
}
|
||||
String body;
|
||||
if (req.contentLength > 0) body.reserve(req.contentLength);
|
||||
uint32_t dl = millis() + 8000;
|
||||
while ((long)body.length() < req.contentLength && (int32_t)(millis() - dl) < 0) {
|
||||
int avail = c.available();
|
||||
if (avail > 0) {
|
||||
while (avail-- > 0 && (long)body.length() < req.contentLength) body += (char)c.read();
|
||||
} else if (!c.connected()) break;
|
||||
else delay(1);
|
||||
}
|
||||
Serial.printf("[web] POST /configuration.json: %d bytes (%s)\n",
|
||||
(int)body.length(), req.contentType.c_str());
|
||||
if (applyConfigForm(req.contentType, body)) {
|
||||
sendStatus(c, 302, "Found");
|
||||
c.print("Location: /?success=1\r\n");
|
||||
c.print("Content-Length: 0\r\nConnection: close\r\n\r\n");
|
||||
c.flush();
|
||||
delay(500);
|
||||
Serial.println("[web] config saved -> reboot");
|
||||
rp2040.restart();
|
||||
} else {
|
||||
sendText(c, 500, "Internal Server Error", "text/plain", "could not save config");
|
||||
c.flush();
|
||||
}
|
||||
}
|
||||
|
||||
static void handleClient(EthernetClient &c) {
|
||||
Request req;
|
||||
uint32_t deadline = millis() + 3000;
|
||||
if (!parseRequest(c, req, deadline)) return;
|
||||
Serial.printf("[web] %s %s\n", req.method.c_str(), req.path.c_str());
|
||||
|
||||
// web-interface auth (HTTP Basic) when enabled. /status (version probe) and
|
||||
// /update (its own OTA auth) are exempt to avoid breaking probes / double-auth.
|
||||
if (req.path != "/status" && req.path != "/update" && !webAuthOk(req.authorization)) {
|
||||
sendStatus(c, 401, "Unauthorized");
|
||||
c.print("WWW-Authenticate: Basic realm=\"iGate Admin\"\r\n");
|
||||
c.print("Content-Length: 0\r\nConnection: close\r\n\r\n");
|
||||
c.flush();
|
||||
return;
|
||||
}
|
||||
if (req.path == "/status") {
|
||||
extern const char *FW_BUILD;
|
||||
sendText(c, 200, "OK", "text/plain", String("LoRa APRS iGate RP2350 — built ") + FW_BUILD);
|
||||
c.flush();
|
||||
return;
|
||||
}
|
||||
if (req.path == "/stations.json") { // stations with a position, for the Map view
|
||||
sendText(c, 200, "OK", "application/json", MAP_Utils::getStationsJson());
|
||||
c.flush();
|
||||
return;
|
||||
}
|
||||
if (req.path == "/messages.json") {
|
||||
String body = "[";
|
||||
uint32_t now = millis();
|
||||
for (size_t i = rxMessages.size(); i-- > 0; ) { // newest first
|
||||
const RxMsg &m = rxMessages[i];
|
||||
body += "{\"from\":\""; body += jsonEscape(m.from);
|
||||
body += "\",\"text\":\""; body += jsonEscape(m.text);
|
||||
body += "\",\"via\":\""; body += jsonEscape(m.via);
|
||||
body += "\",\"age\":"; body += String((now - m.when) / 1000);
|
||||
body += "}";
|
||||
if (i != 0) body += ",";
|
||||
}
|
||||
body += "]";
|
||||
sendText(c, 200, "OK", "application/json", body);
|
||||
c.flush();
|
||||
return;
|
||||
}
|
||||
if (req.path == "/received-packets.json") {
|
||||
String body = "[";
|
||||
uint32_t now = millis();
|
||||
for (size_t i = rxPackets.size(); i-- > 0; ) { // newest first
|
||||
const RxPkt &p = rxPackets[i];
|
||||
uint32_t age = (now - p.when) / 1000;
|
||||
String ago = age < 60 ? String(age) + "s" : String(age / 60) + "m";
|
||||
// real wall-clock = NTP-now minus this packet's age (works even for
|
||||
// packets received before the NTP sync); fall back to "ago" if no NTP
|
||||
// (and no date, like upstream's empty getFormatedDate())
|
||||
uint32_t rxEpoch = Ntp::nowEpoch() - age;
|
||||
String rxDate = Ntp::synced() ? Ntp::ymd(rxEpoch) : "";
|
||||
String rxTime = Ntp::synced() ? Ntp::hms(rxEpoch) : ago;
|
||||
body += "{\"rxDate\":\""; body += rxDate;
|
||||
body += "\",\"rxTime\":\""; body += rxTime;
|
||||
body += "\",\"packet\":\""; body += jsonEscape(p.frame);
|
||||
body += "\",\"RSSI\":"; body += String(p.rssi);
|
||||
body += ",\"SNR\":"; body += String(p.snr, 1);
|
||||
body += "}";
|
||||
if (i != 0) body += ",";
|
||||
}
|
||||
body += "]";
|
||||
sendText(c, 200, "OK", "application/json", body);
|
||||
c.flush();
|
||||
return;
|
||||
}
|
||||
if (req.path == "/update") { // POST raw firmware.bin -> arduino-pico Updater
|
||||
if (req.method == "POST") { Ota::handleUpdate(c, req.authorization, req.contentLength); return; }
|
||||
sendText(c, 405, "Method Not Allowed", "text/plain", "POST firmware.bin");
|
||||
c.flush();
|
||||
return;
|
||||
}
|
||||
if (req.path == "/configuration.json") {
|
||||
if (req.method == "GET") { serveConfig(c); c.flush(); return; }
|
||||
if (req.method == "POST") { handleConfigPost(c, req); return; } // reboots on success
|
||||
sendText(c, 405, "Method Not Allowed", "text/plain", "GET or POST");
|
||||
c.flush();
|
||||
return;
|
||||
}
|
||||
if (req.path == "/action") { // POST /action?type=send-beacon | send-rf-beacon | send-message | reboot
|
||||
if (req.method != "POST") { // POST only, as on ESP32 (web_utils.cpp)
|
||||
sendText(c, 405, "Method Not Allowed", "text/plain", "POST only");
|
||||
c.flush();
|
||||
return;
|
||||
}
|
||||
if (req.query.indexOf("send-message") >= 0) {
|
||||
String to = getQueryParam(req.query, "to");
|
||||
String text = getQueryParam(req.query, "text");
|
||||
bool viaRF = req.query.indexOf("rf=1") >= 0;
|
||||
bool viaTCP = req.query.indexOf("tcp=1") >= 0;
|
||||
if (!viaRF && !viaTCP) viaRF = true; // default to RF if unspecified
|
||||
if (to.length() == 0 || text.length() == 0) {
|
||||
sendText(c, 400, "Bad Request", "text/plain", "need to= and text=");
|
||||
} else {
|
||||
bool sentRF, sentTCP;
|
||||
webSendMessage(to, text, viaRF, viaTCP, sentRF, sentTCP);
|
||||
// tell the page which copies really went out (it shows this text)
|
||||
String sent, failed;
|
||||
if (sentRF) sent = "RF";
|
||||
if (sentTCP) sent += sent.length() ? " + APRS-IS" : "APRS-IS";
|
||||
if (viaRF && !sentRF) failed = "RF (TX queue full)";
|
||||
if (viaTCP && !sentTCP) failed += failed.length() ? ", APRS-IS (not connected)" : "APRS-IS (not connected)";
|
||||
String reply = sent.length() ? String("queued (") + sent + ")" : String("not sent");
|
||||
if (failed.length()) reply += String(sent.length() ? "; not sent: " : ": ") + failed;
|
||||
if (sent.length()) sendText(c, 200, "OK", "text/plain", reply);
|
||||
else sendText(c, 503, "Service Unavailable", "text/plain", reply);
|
||||
}
|
||||
} else if (req.query.indexOf("send-rf-beacon") >= 0) {
|
||||
g_rfBeaconNow = true;
|
||||
sendText(c, 200, "OK", "text/plain", "rf beacon queued");
|
||||
} else if (req.query.indexOf("send-beacon") >= 0) {
|
||||
g_beaconNow = true;
|
||||
sendText(c, 200, "OK", "text/plain", "beacon queued");
|
||||
} else if (req.query.indexOf("reboot") >= 0) {
|
||||
sendText(c, 200, "OK", "text/plain", "rebooting");
|
||||
c.flush();
|
||||
delay(300);
|
||||
rp2040.restart();
|
||||
} else {
|
||||
sendText(c, 404, "Not Found", "text/plain", "unknown action");
|
||||
}
|
||||
c.flush();
|
||||
return;
|
||||
}
|
||||
if (req.method == "GET") { // static SPA assets
|
||||
for (size_t i = 0; i < WEB_ASSETS_N; i++) {
|
||||
if (req.path == WEB_ASSETS[i].path) {
|
||||
serveAsset(c, WEB_ASSETS[i], req.ifNoneMatch);
|
||||
c.flush();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
sendText(c, 404, "Not Found", "text/plain", "not found");
|
||||
c.flush();
|
||||
}
|
||||
|
||||
void ethWebSetup() {
|
||||
if (webStarted) return;
|
||||
LittleFS.begin();
|
||||
webServer.begin();
|
||||
webStarted = true;
|
||||
Serial.println("[web] HTTP config server on :80 (/status, /configuration.json)");
|
||||
}
|
||||
|
||||
void ethWebPoll() {
|
||||
if (!webStarted) return;
|
||||
EthernetClient client = webServer.accept();
|
||||
if (client) {
|
||||
handleClient(client);
|
||||
client.stop();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
// Minimal HTTP config server for the RP2350 iGate port, over the W5500
|
||||
// (arduino-libraries/Ethernet). Adapted from the Meshtastic fork's mesh/eth
|
||||
// transport (request parsing / response helpers), without the PhoneAPI
|
||||
// / protobuf / OSThread coupling. Plain EthernetClient, served from a FreeRTOS
|
||||
// task. Routes: GET /status, GET /configuration.json (more added incrementally).
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
void ethWebSetup(); // bind EthernetServer on :80 + mount LittleFS
|
||||
void ethWebPoll(); // accept + handle one pending client (call from the net task loop)
|
||||
|
||||
// Record an incoming APRS message addressed to us (served at GET /messages.json).
|
||||
// `via` is "RF" or "IS". Call from the net task only (store is netTask-owned).
|
||||
void ethWebAddMessage(const String &from, const String &text, const String &via);
|
||||
|
||||
// Record a received LoRa packet for GET /received-packets.json (net task only).
|
||||
void ethWebAddPacket(const String &frame, int rssi, float snr);
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* RP2350 GPS reader (UART1 / Serial2 -> TinyGPS++). Ported from the ESP32
|
||||
* gps_utils.cpp (excluded from the RP2350 build_src_filter). The UART is opened
|
||||
* whenever the firmware is built with -D HAS_GPS so the fix can be observed on
|
||||
* the serial log for bring-up; the beacon only *uses* the GPS position when
|
||||
* Config.beacon.gpsActive is set (see beacon_rp2350.cpp encodedPosition()).
|
||||
*
|
||||
* poll() runs in netTask and updates a plain snapshot; the beacon builders read
|
||||
* that snapshot (from netTask and loraTask). Only scalar reads cross tasks, so a
|
||||
* momentarily torn value is harmless (a slightly stale beacon position).
|
||||
*/
|
||||
#include "gps_rp2350.h"
|
||||
#include "configuration.h"
|
||||
|
||||
extern Configuration Config;
|
||||
|
||||
#ifdef HAS_GPS
|
||||
#include <TinyGPS++.h>
|
||||
|
||||
#ifndef GPS_BAUDRATE
|
||||
#define GPS_BAUDRATE 9600 // most NMEA modules (incl. the DL20U9A) default here
|
||||
#endif
|
||||
#ifndef PIN_GPS_TX
|
||||
#define PIN_GPS_TX 8 // RP2350 UART1 TX (GP08) -> GPS RX
|
||||
#endif
|
||||
#ifndef PIN_GPS_RX
|
||||
#define PIN_GPS_RX 9 // RP2350 UART1 RX (GP09) <- GPS TX
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
TinyGPSPlus tinyGps;
|
||||
bool started = false;
|
||||
struct {
|
||||
bool valid = false;
|
||||
double lat = 0.0;
|
||||
double lng = 0.0;
|
||||
double alt = NAN;
|
||||
uint32_t sats = 0;
|
||||
} fix;
|
||||
}
|
||||
#endif // HAS_GPS
|
||||
|
||||
namespace Gps {
|
||||
|
||||
void setup() {
|
||||
#ifdef HAS_GPS
|
||||
Serial2.setTX(PIN_GPS_TX);
|
||||
Serial2.setRX(PIN_GPS_RX);
|
||||
// Enlarge the RX ring buffer: poll() only drains the UART when the net loop
|
||||
// runs, so a brief stall (web request, APRS-IS reconnect) would overflow the
|
||||
// 32-byte default and corrupt NMEA sentences. 256 B covers a full 1 Hz burst.
|
||||
Serial2.setFIFOSize(256);
|
||||
Serial2.begin(GPS_BAUDRATE);
|
||||
started = true;
|
||||
Serial.printf("[gps] UART1 @%d baud (TX=GP%d RX=GP%d), gpsActive=%d\n",
|
||||
GPS_BAUDRATE, PIN_GPS_TX, PIN_GPS_RX, (int)Config.beacon.gpsActive);
|
||||
#endif
|
||||
}
|
||||
|
||||
void poll() {
|
||||
#ifdef HAS_GPS
|
||||
if (!started) return;
|
||||
while (Serial2.available() > 0) tinyGps.encode(Serial2.read());
|
||||
|
||||
if (tinyGps.location.isValid() &&
|
||||
tinyGps.location.lat() != 0.0 && tinyGps.location.lng() != 0.0) {
|
||||
fix.valid = true;
|
||||
fix.lat = tinyGps.location.lat();
|
||||
fix.lng = tinyGps.location.lng();
|
||||
fix.alt = tinyGps.altitude.isValid() ? tinyGps.altitude.meters() : NAN;
|
||||
fix.sats = tinyGps.satellites.isValid() ? tinyGps.satellites.value() : 0;
|
||||
}
|
||||
|
||||
#ifdef GPS_DEBUG
|
||||
// Bring-up diagnostic (opt-in, -D GPS_DEBUG): charsProcessed()==0 means no
|
||||
// NMEA is arriving (wiring or baud); otherwise shows fix progress (sats climb,
|
||||
// then a valid position). Off in release images to keep the serial log clean.
|
||||
static uint32_t lastLog = 0;
|
||||
if (millis() - lastLog > 15000) {
|
||||
lastLog = millis();
|
||||
Serial.printf("[gps] chars=%lu csum-ok=%lu csum-fail=%lu sats=%d fix=%d lat=%.5f lng=%.5f alt=%.0f\n",
|
||||
(unsigned long)tinyGps.charsProcessed(),
|
||||
(unsigned long)tinyGps.passedChecksum(),
|
||||
(unsigned long)tinyGps.failedChecksum(),
|
||||
tinyGps.satellites.isValid() ? (int)tinyGps.satellites.value() : 0,
|
||||
(int)fix.valid, fix.lat, fix.lng, fix.alt);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
bool hasFix() {
|
||||
#ifdef HAS_GPS
|
||||
return started && fix.valid;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
double lat() {
|
||||
#ifdef HAS_GPS
|
||||
return fix.lat;
|
||||
#else
|
||||
return 0.0;
|
||||
#endif
|
||||
}
|
||||
|
||||
double lng() {
|
||||
#ifdef HAS_GPS
|
||||
return fix.lng;
|
||||
#else
|
||||
return 0.0;
|
||||
#endif
|
||||
}
|
||||
|
||||
double altMeters() {
|
||||
#ifdef HAS_GPS
|
||||
return fix.alt;
|
||||
#else
|
||||
return NAN;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t satellites() {
|
||||
#ifdef HAS_GPS
|
||||
return fix.sats;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace Gps
|
||||
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
// GPS reader for the RP2350 iGate port: hardware UART (UART1 / Serial2) parsed
|
||||
// with TinyGPS++. Compiles to no-ops unless built with -D HAS_GPS. When
|
||||
// Config.beacon.gpsActive is set and a valid fix is present, the beacon uses the
|
||||
// live GPS position (see beacon_rp2350.cpp) instead of the fixed config position.
|
||||
namespace Gps {
|
||||
void setup(); // begin the UART (HAS_GPS only); call from setup()
|
||||
void poll(); // feed available UART bytes to TinyGPS++; call each net loop
|
||||
bool hasFix(); // true when a valid, non-zero position fix is available
|
||||
double lat(); // last valid latitude (0 if no fix)
|
||||
double lng(); // last valid longitude (0 if no fix)
|
||||
double altMeters(); // last valid altitude in metres (NAN if unknown)
|
||||
uint32_t satellites(); // satellites in use (0 if unknown)
|
||||
}
|
||||
@@ -0,0 +1,346 @@
|
||||
/*
|
||||
* RP2350 implementation of the LoRa_Utils API (include/lora_utils.h), reusing
|
||||
* the validated E22P / SX1262 radio bring-up (SPI1, DIO2-as-RF-switch, TCXO).
|
||||
* Replaces the ESP32-centric src/lora_utils.cpp (excluded from the RP2350
|
||||
* build_src_filter). LoRa-APRS framing: on-air packets are prefixed with the
|
||||
* 3 bytes '<' 0xFF 0x01 (OE5BPA standard).
|
||||
*/
|
||||
#include "lora_utils.h"
|
||||
#include <RadioLib.h>
|
||||
#include <SPI.h>
|
||||
#include "configuration.h"
|
||||
#include "board_pinout.h"
|
||||
|
||||
extern Configuration Config;
|
||||
|
||||
// The same E22 / E22P footprint takes a 433 MHz (SX1268) or an 868/915 MHz (SX1262)
|
||||
// module, and the version string the die reports varies by batch (an E22-400M30S
|
||||
// here reports "SX1262", an E22P-433M30S "SX1268"). RadioLib's begin() rejects a
|
||||
// mismatch with RADIOLIB_ERR_CHIP_NOT_FOUND, so setup() tries one class and falls
|
||||
// back to the other. Both share the SX126x command set: everything else goes
|
||||
// through `radio`.
|
||||
static SX1262 radio1262 = new Module(RADIO_CS_PIN, RADIO_DIO1_PIN, RADIO_RST_PIN, RADIO_BUSY_PIN, SPI1);
|
||||
static SX1268 radio1268 = new Module(RADIO_CS_PIN, RADIO_DIO1_PIN, RADIO_RST_PIN, RADIO_BUSY_PIN, SPI1);
|
||||
static SX126x* radio = &radio1262;
|
||||
static volatile bool rxFlag = false;
|
||||
|
||||
// How often to warm-reset the SX126x analog frontend / AGC state (see resetAGC).
|
||||
// Ported from upstream PR #440 (ndoo / Andrew Yong), itself from Meshtastic.
|
||||
#define AGC_RESET_INTERVAL_MS 60000
|
||||
|
||||
// Signal stats of the last received packet (read by the ?APRSSR query; the
|
||||
// original firmware keeps these as globals, so the query module externs them).
|
||||
int rssi = 0;
|
||||
float snr = 0;
|
||||
int freqError = 0;
|
||||
static float rxFreqMHz = 433.775f;
|
||||
static float txFreqMHz = 433.775f;
|
||||
|
||||
static void onLoraDio1() { rxFlag = true; }
|
||||
|
||||
#define CHIP_MIN_POWER -9 // SX1262 / SX1268
|
||||
#define CHIP_MAX_POWER 22
|
||||
|
||||
// The E22(P)-xxxM30S carries its own 30 dBm PA; driving the SX126x above 20 dBm
|
||||
// overdrives it -> ~690 mA current spike -> supply brownout that wedges the
|
||||
// module in a low-sensitivity state until a physical power cycle (verified on
|
||||
// the .243 W5100S: power=22 went deaf, cold-boot recovered ~10 dB). Cap the
|
||||
// SX126x drive at 20 dBm — no useful range is gained above it on this front-end.
|
||||
#ifndef RADIO_MAX_POWER
|
||||
#define RADIO_MAX_POWER 20
|
||||
#endif
|
||||
|
||||
namespace LoRa_Utils {
|
||||
|
||||
int validPower(int requested) {
|
||||
const int maxPower = (RADIO_MAX_POWER < CHIP_MAX_POWER) ? RADIO_MAX_POWER : CHIP_MAX_POWER;
|
||||
return constrain(requested, CHIP_MIN_POWER, maxPower);
|
||||
}
|
||||
|
||||
// Undocumented Heltec/Semtech-recommended SX126x register patch (bit 0 of 0x8B5)
|
||||
// that measurably reduces packet loss. Needs RADIOLIB_LOW_LEVEL=1 for getMod().
|
||||
// Calibrate(0x7F) clears it, so resetAGC() re-applies it after every calibration.
|
||||
static void applyRxSensitivityPatch() {
|
||||
if (radio->getMod()->SPIsetRegValue(0x8B5, 0x01, 0, 0) == RADIOLIB_ERR_NONE)
|
||||
Serial.println("[lora] applied SX126x 0x8B5 RX-sensitivity patch");
|
||||
else
|
||||
Serial.println("[lora] FAILED to apply SX126x 0x8B5 RX-sensitivity patch");
|
||||
}
|
||||
|
||||
// SX126x has no true AGC; the frontend gain can get stuck low after prolonged RX.
|
||||
// Periodically warm-reset it (warm sleep + full calibration), skipping if a packet
|
||||
// is actively arriving. Called from receivePacket() only (loraTask owns SPI1).
|
||||
static void resetAGC() {
|
||||
uint32_t irqFlags = radio->getIrqFlags();
|
||||
if (irqFlags & (RADIOLIB_SX126X_IRQ_HEADER_VALID | RADIOLIB_SX126X_IRQ_PREAMBLE_DETECTED))
|
||||
return; // packet actively arriving, don't disturb it
|
||||
|
||||
radio->sleep(true); // warm sleep - resets the analog frontend / AGC state
|
||||
radio->standby(RADIOLIB_SX126X_STANDBY_RC, true); // wake to RC standby for stable calibration
|
||||
|
||||
uint8_t calData = RADIOLIB_SX126X_CALIBRATE_ALL;
|
||||
radio->getMod()->SPIwriteStream(RADIOLIB_SX126X_CMD_CALIBRATE, &calData, 1, true, false);
|
||||
|
||||
radio->getMod()->hal->delay(5);
|
||||
uint32_t calibrationStart = millis();
|
||||
while (radio->getMod()->hal->digitalRead(radio->getMod()->getGpio())) {
|
||||
if (millis() - calibrationStart > 50) {
|
||||
Serial.println("[lora] SX126x AGC reset: calibration did not complete within 50ms");
|
||||
break;
|
||||
}
|
||||
radio->getMod()->hal->yield();
|
||||
}
|
||||
|
||||
float freq = (float)Config.loramodule.rxFreq / 1000000;
|
||||
radio->calibrateImage(freq); // Calibrate(0x7F) defaults image cal to the wrong band otherwise
|
||||
|
||||
radio->setRxBoostedGainMode(true); // re-apply settings that Calibrate(0x7F) resets
|
||||
applyRxSensitivityPatch();
|
||||
|
||||
radio->startReceive();
|
||||
}
|
||||
|
||||
void setup() {
|
||||
// RF front-end control depends on how TXEN is wired (see board_pinout.h):
|
||||
// RADIO_TXEN >= 0 -> canonical E22-400M30S / E22P-433M30S design (datasheet
|
||||
// §4.1/§5.2): TXEN and RXEN are separate MCU-driven lines,
|
||||
// DIO2 floating. RadioLib toggles both switch pins around
|
||||
// every RX/TX transition (LNA off in TX, PA off in RX).
|
||||
// RADIO_TXEN < 0 -> bridged front-end (DIO2->TXEN): a single RFEN (RXEN)
|
||||
// line held HIGH, dropped by hand during transmit. The
|
||||
// default on the boards, whose DIO2-TXEN jumper ships fitted.
|
||||
#if RADIO_TXEN < 0
|
||||
pinMode(RADIO_RXEN, OUTPUT);
|
||||
digitalWrite(RADIO_RXEN, HIGH); // bridged: RFEN held HIGH while active
|
||||
#endif
|
||||
SPI1.setSCK(RADIO_SCLK_PIN);
|
||||
SPI1.setTX(RADIO_MOSI_PIN);
|
||||
SPI1.setRX(RADIO_MISO_PIN);
|
||||
SPI1.begin(false);
|
||||
|
||||
// Deliberate E22 reset with the RF front-end held OFF (PA + LNA), so a *software*
|
||||
// reboot (config save -> rp2040.restart, which does NOT power-cycle the module)
|
||||
// recovers a module left in a bad state instead of needing a physical power
|
||||
// cycle. RadioLib's begin() also resets, but a longer, front-end-safe pulse here
|
||||
// is more reliable after a glitchy restart.
|
||||
#if RADIO_TXEN >= 0
|
||||
pinMode(RADIO_TXEN, OUTPUT); digitalWrite(RADIO_TXEN, LOW); // PA off during reset
|
||||
pinMode(RADIO_RXEN, OUTPUT); digitalWrite(RADIO_RXEN, LOW); // LNA off during reset
|
||||
#endif
|
||||
pinMode(RADIO_RST_PIN, OUTPUT);
|
||||
digitalWrite(RADIO_RST_PIN, LOW); delay(5);
|
||||
digitalWrite(RADIO_RST_PIN, HIGH); delay(5);
|
||||
|
||||
#ifdef LORA_DIAG
|
||||
Serial.println("[diag] ==== LoRa bring-up diagnostic ====");
|
||||
// Low-level reach-the-chip probe (separates "dead/stuck chip" from "bad MISO/SPI").
|
||||
pinMode(RADIO_BUSY_PIN, INPUT);
|
||||
pinMode(RADIO_RST_PIN, OUTPUT);
|
||||
pinMode(RADIO_CS_PIN, OUTPUT);
|
||||
digitalWrite(RADIO_CS_PIN, HIGH);
|
||||
Serial.printf("[diag] pins CS=%d SCK=%d MOSI=%d MISO=%d RST=%d BUSY=%d DIO1=%d\n", RADIO_CS_PIN,
|
||||
RADIO_SCLK_PIN, RADIO_MOSI_PIN, RADIO_MISO_PIN, RADIO_RST_PIN, RADIO_BUSY_PIN, RADIO_DIO1_PIN);
|
||||
Serial.printf("[diag] BUSY before reset = %d\n", digitalRead(RADIO_BUSY_PIN));
|
||||
digitalWrite(RADIO_RST_PIN, LOW);
|
||||
delay(2);
|
||||
Serial.printf("[diag] BUSY while NRST low = %d\n", digitalRead(RADIO_BUSY_PIN));
|
||||
digitalWrite(RADIO_RST_PIN, HIGH);
|
||||
delay(1);
|
||||
int bA = digitalRead(RADIO_BUSY_PIN);
|
||||
delay(10);
|
||||
int bB = digitalRead(RADIO_BUSY_PIN);
|
||||
// A live SX126x pulses BUSY high during boot then drops it LOW (ready) ~1-2 ms
|
||||
// after NRST is released. BUSY stuck HIGH => chip not running (dead/power/clock).
|
||||
Serial.printf("[diag] BUSY after reset: +1ms=%d +11ms=%d (expect ->0 if chip alive)\n", bA, bB);
|
||||
// Raw GetStatus (opcode 0xC0): clock out the status byte. 0x00 or 0xFF on MISO
|
||||
// = no chip / dead MISO path; anything else = SPI link to the die is alive.
|
||||
SPI1.beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE0));
|
||||
digitalWrite(RADIO_CS_PIN, LOW);
|
||||
uint8_t op = SPI1.transfer(0xC0);
|
||||
uint8_t stbyte = SPI1.transfer(0x00);
|
||||
digitalWrite(RADIO_CS_PIN, HIGH);
|
||||
SPI1.endTransaction();
|
||||
Serial.printf("[diag] SX126x GetStatus raw: op=%02X status=%02X (00/FF = mudo)\n", op, stbyte);
|
||||
// Version string (REG 0x0320, 16 bytes). RadioLib findChip() strncmp's the
|
||||
// first 6 chars vs the class name -> a "SX1262" here is why the SX1268 class
|
||||
// rejected this E22-400M30S with -2.
|
||||
{
|
||||
uint8_t ver[17] = {0};
|
||||
SPI1.beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE0));
|
||||
digitalWrite(RADIO_CS_PIN, LOW);
|
||||
SPI1.transfer(0x1D); // ReadRegister opcode
|
||||
SPI1.transfer(0x03); // addr hi (0x0320)
|
||||
SPI1.transfer(0x20); // addr lo
|
||||
SPI1.transfer(0x00); // status NOP
|
||||
for (int k = 0; k < 16; k++) ver[k] = SPI1.transfer(0x00);
|
||||
digitalWrite(RADIO_CS_PIN, HIGH);
|
||||
SPI1.endTransaction();
|
||||
Serial.printf("[diag] chip version string = '%s'\n", (char *)ver);
|
||||
}
|
||||
#endif
|
||||
|
||||
rxFreqMHz = (float)Config.loramodule.rxFreq / 1000000.0f;
|
||||
txFreqMHz = (float)Config.loramodule.txFreq / 1000000.0f;
|
||||
float bw = (float)Config.loramodule.rxSignalBandwidth / 1000.0f;
|
||||
|
||||
int power = validPower(Config.loramodule.power);
|
||||
if (power != Config.loramodule.power)
|
||||
Serial.printf("[lora] power adjusted: %d -> %d dBm\n", Config.loramodule.power, power);
|
||||
|
||||
auto begin = [&](auto& chip, bool useLDO) {
|
||||
return chip.begin(rxFreqMHz, bw, Config.loramodule.rxSpreadingFactor,
|
||||
Config.loramodule.rxCodingRate4, 0x12, power,
|
||||
8, SX126X_DIO3_TCXO_VOLTAGE, useLDO);
|
||||
};
|
||||
radio = &radio1262;
|
||||
int st = begin(radio1262, false);
|
||||
if (st == RADIOLIB_ERR_CHIP_NOT_FOUND) { // die reports itself as SX1268
|
||||
radio = &radio1268;
|
||||
st = begin(radio1268, false);
|
||||
}
|
||||
if (st != RADIOLIB_ERR_NONE) { // some E22 modules need the LDO regulator
|
||||
Serial.printf("[lora] begin %d -> retry LDO\n", st);
|
||||
st = (radio == &radio1268) ? begin(radio1268, true) : begin(radio1262, true);
|
||||
}
|
||||
#if RADIO_TXEN < 0
|
||||
radio->setDio2AsRfSwitch(true); // bridged: DIO2 -> TXEN on-module (DIO2 wired)
|
||||
#else
|
||||
// Canonical front-end: DIO2 is left floating; RadioLib drives the external
|
||||
// TXEN/RXEN switch pins itself (mutually exclusive) on every RX/TX transition.
|
||||
radio->setRfSwitchPins(RADIO_RXEN, RADIO_TXEN);
|
||||
#endif
|
||||
radio->setRxBoostedGainMode(true); // boosted LNA gain (higher RX sensitivity)
|
||||
applyRxSensitivityPatch(); // undocumented 0x8B5 RX patch (upstream PR #440)
|
||||
radio->setDio1Action(onLoraDio1);
|
||||
radio->startReceive();
|
||||
Serial.printf("[lora] %s %s @%.4f MHz SF%d BW%.0f CR4:%d (state %d)\n",
|
||||
radio == &radio1268 ? "SX1268" : "SX1262",
|
||||
st == RADIOLIB_ERR_NONE ? "RX listening" : "FAILED", rxFreqMHz,
|
||||
Config.loramodule.rxSpreadingFactor, bw, Config.loramodule.rxCodingRate4, st);
|
||||
}
|
||||
|
||||
String receivePacket() {
|
||||
// Periodic AGC warm-reset (upstream PR #440). Only when no packet is pending —
|
||||
// resetAGC() sleeps/calibrates the radio, which would drop an already-received
|
||||
// (RxDone) packet waiting in the FIFO. It also bails internally if one is
|
||||
// mid-arrival (HEADER_VALID / PREAMBLE_DETECTED).
|
||||
#ifdef LORA_RX_POLL
|
||||
bool rxPending = radio->getIrqFlags() & RADIOLIB_SX126X_IRQ_RX_DONE;
|
||||
#else
|
||||
bool rxPending = rxFlag;
|
||||
#endif
|
||||
static uint32_t lastAgcResetTime = 0;
|
||||
if (!rxPending && millis() - lastAgcResetTime > AGC_RESET_INTERVAL_MS) {
|
||||
resetAGC();
|
||||
lastAgcResetTime = millis();
|
||||
}
|
||||
|
||||
#ifdef LORA_RX_POLL
|
||||
// Optional fallback for a carrier that genuinely doesn't route the SX126x
|
||||
// DIO1 RxDone interrupt to the MCU: poll the IRQ register over SPI instead of
|
||||
// relying on the DIO1 interrupt / rxFlag. Not needed on the current boards —
|
||||
// the W5100S carrier was verified (isr fires on TxDone and RxDone, GP14 goes
|
||||
// high) to deliver the DIO1 IRQ once the DIO2->TXEN bridge was cut and the
|
||||
// canonical RF switch (setRfSwitchPins) is used.
|
||||
if (!(radio->getIrqFlags() & RADIOLIB_SX126X_IRQ_RX_DONE)) return "";
|
||||
#else
|
||||
if (!rxFlag) return "";
|
||||
#endif
|
||||
rxFlag = false;
|
||||
String str;
|
||||
int st = radio->readData(str);
|
||||
rssi = (int)radio->getRSSI();
|
||||
snr = radio->getSNR();
|
||||
freqError = (int)radio->getFrequencyError();
|
||||
radio->startReceive(); // re-arm
|
||||
if (st != RADIOLIB_ERR_NONE) return "";
|
||||
// Return the RAW packet WITH its 3-byte LoRa-APRS header ('<' 0xFF 0x01) —
|
||||
// the iGate processing (gate + digi) does packet.substring(3) to skip it.
|
||||
return str;
|
||||
}
|
||||
|
||||
String receivePacketFromSleep() { return receivePacket(); }
|
||||
|
||||
void changeFreqTx() { radio->standby(); radio->setFrequency(txFreqMHz); }
|
||||
void changeFreqRx() { radio->standby(); radio->setFrequency(rxFreqMHz); radio->startReceive(); }
|
||||
|
||||
// --- CAD / DIFS / BEB (port of the channel access in src/lora_utils.cpp) --------
|
||||
// Listen before transmitting: DIFS = N consecutive free CAD slots, then a binary
|
||||
// exponential backoff of free slots. Enabled per config (LoRa -> "Channel Activity
|
||||
// Detection"). Bounded like upstream (V4.0.2): after CAD_MAX_WAIT_MS of busy
|
||||
// channel the packet is dropped, so loraTask (which also services RX and the TX
|
||||
// buffer) never blocks forever on a permanently busy channel.
|
||||
#define DIFS_SLOTS 2
|
||||
#define CAD_MAX_WAIT_MS 10000
|
||||
|
||||
static const int CAD_BACKOFF_MAX = 4;
|
||||
static uint32_t cadStartTime = 0;
|
||||
|
||||
static bool doCAD() { return radio->scanChannel() != RADIOLIB_CHANNEL_FREE; } // true = busy
|
||||
|
||||
static bool doDIFS() {
|
||||
for (uint8_t i = DIFS_SLOTS; i > 0; i--) {
|
||||
if (doCAD()) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool cadTimedOut() { return millis() - cadStartTime > CAD_MAX_WAIT_MS; }
|
||||
|
||||
static void waitForDIFS() {
|
||||
while (!doDIFS()) {
|
||||
if (cadTimedOut()) return;
|
||||
}
|
||||
}
|
||||
|
||||
static void doBEB() {
|
||||
int backoff = random(1, CAD_BACKOFF_MAX + 1);
|
||||
while (backoff > 0) {
|
||||
if (cadTimedOut()) return;
|
||||
if (doCAD()) {
|
||||
waitForDIFS(); // busy channel: freeze backoff and restart DIFS
|
||||
} else {
|
||||
backoff--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sendNewPacket(const String& newPacket) {
|
||||
if (!Config.loramodule.txActive) return; // RF TX disabled (RX-only iGate / ?TX=OFF)
|
||||
changeFreqTx();
|
||||
if (Config.loramodule.cadActive) { // listen before transmit
|
||||
cadStartTime = millis();
|
||||
waitForDIFS();
|
||||
doBEB();
|
||||
if (cadTimedOut()) {
|
||||
Serial.println("[lora] CAD timeout, packet dropped: " + newPacket);
|
||||
changeFreqRx();
|
||||
rxFlag = false; // DIO1 also fires on CAD done: don't read that back as RX
|
||||
return;
|
||||
}
|
||||
}
|
||||
#if RADIO_TXEN < 0
|
||||
digitalWrite(RADIO_RXEN, LOW); // bridged: RX path off; DIO2 drives TXEN during transmit
|
||||
#endif
|
||||
String tx;
|
||||
tx.reserve(newPacket.length() + 3);
|
||||
tx += '<';
|
||||
tx += (char)0xFF;
|
||||
tx += (char)0x01;
|
||||
tx += newPacket;
|
||||
int st = radio->transmit(tx);
|
||||
Serial.printf("[lora] TX %d B (state %d)\n", (int)tx.length(), st);
|
||||
#if RADIO_TXEN < 0
|
||||
digitalWrite(RADIO_RXEN, HIGH); // bridged: restore RX path
|
||||
#endif
|
||||
changeFreqRx();
|
||||
// DIO1 fires on TxDone as well as RxDone, so transmit() just set rxFlag.
|
||||
// Clear it (after re-arming RX) so the next receivePacket() doesn't read the
|
||||
// stale TX FIFO back as a bogus "received" packet (self-RX -> duplicate gate).
|
||||
rxFlag = false;
|
||||
}
|
||||
|
||||
void wakeRadio() { radio->standby(); radio->startReceive(); }
|
||||
void sleepRadio() { radio->sleep(); }
|
||||
|
||||
} // namespace LoRa_Utils
|
||||
@@ -0,0 +1,388 @@
|
||||
/*
|
||||
* LoRa APRS iGate — RP2350 (WIZnet W5500-EVB-Pico2 + E22).
|
||||
* Core path: receive LoRa-APRS packets (SPI1, LoRa_Utils) and forward them to
|
||||
* APRS-IS over Ethernet (W5500/SPI0, AprsIs), plus the web config server.
|
||||
*
|
||||
* Concurrency (FreeRTOS SMP):
|
||||
* - loraTask : owns the radio (SPI1); RX packets -> rxQueue.
|
||||
* - netTask : owns the W5500 (SPI0); DHCP + web server + APRS-IS connect/
|
||||
* poll/forward. ALL Ethernet/W5500 access lives here (no race).
|
||||
* - loop() : LED heartbeat + status line.
|
||||
* The two SPI buses are separate, so radio and network run truly in parallel.
|
||||
*/
|
||||
#include <Arduino.h>
|
||||
#include <FreeRTOS.h>
|
||||
#include <task.h>
|
||||
#include <queue.h>
|
||||
#include <SPI.h>
|
||||
#include <Ethernet.h>
|
||||
#include "configuration.h"
|
||||
#include "board_pinout.h" // PIN_ETH_* (W5500 / W5100S on SPI0)
|
||||
#include "lora_utils.h"
|
||||
#include "eth_web.h"
|
||||
#include "aprsis_rp2350.h"
|
||||
#include "beacon_rp2350.h"
|
||||
#include "wx_rp2350.h"
|
||||
#include "digi_rp2350.h"
|
||||
#include "station_rp2350.h"
|
||||
#include "query_rp2350.h"
|
||||
#include "message_rp2350.h"
|
||||
#include "tnc_rp2350.h"
|
||||
#include "telemetry_rp2350.h"
|
||||
#include "ntp_rp2350.h"
|
||||
#include "mqtt_rp2350.h"
|
||||
#include "syslog_rp2350.h"
|
||||
#include "battery_rp2350.h"
|
||||
#include "gps_rp2350.h"
|
||||
#include "map_utils.h" // stations map behind the web "Map" view (/stations.json)
|
||||
#include <APRSPacketLib.h>
|
||||
#include "pico/unique_id.h" // pico_get_unique_board_id (cached at boot — SMP-safe)
|
||||
|
||||
#ifndef HB_LED
|
||||
#define HB_LED 25 // onboard LED (GP25 on the WIZnet W5500-EVB-Pico2)
|
||||
#endif
|
||||
|
||||
// Firmware build timestamp — shown in the boot banner and served at GET /status
|
||||
// (lets you confirm which build is running, e.g. after an OTA).
|
||||
const char *FW_BUILD = __DATE__ " " __TIME__;
|
||||
|
||||
// Global iGate config instance (lives in LoRa_APRS_iGate.cpp on ESP32, excluded
|
||||
// from the RP2350 build; the modules extern it).
|
||||
Configuration Config;
|
||||
|
||||
static byte mac[6];
|
||||
static QueueHandle_t rxQueue; // heap String* handoff: loraTask -> netTask
|
||||
static QueueHandle_t txMsgQueue; // heap String* handoff: netTask -> loraTask (outgoing msgs)
|
||||
static QueueHandle_t rxMsgQueue; // heap String* handoff: loraTask -> netTask (incoming msgs for us)
|
||||
static QueueHandle_t rxPktQueue; // heap String* handoff: loraTask -> netTask (RX packets log)
|
||||
|
||||
// Signal stats of the last RX (set in lora_utils_rp2350.cpp's receivePacket()).
|
||||
extern int rssi;
|
||||
extern float snr;
|
||||
volatile bool g_beaconNow = false; // set by POST /action?type=send-beacon (eth_web)
|
||||
volatile bool g_rfBeaconNow = false; // set by POST /action?type=send-rf-beacon (eth_web)
|
||||
// Backup digi running (RP2350 counterpart of the ESP32 runtime backupDigiMode):
|
||||
// written by netTask, read by loraTask and the digi.
|
||||
volatile bool g_backupDigi = false;
|
||||
|
||||
// Called from netTask (eth_web /action handler) to originate an APRS message.
|
||||
// We build here (Config is read-only) and hand the packet to loraTask, the sole
|
||||
// owner of the Station output buffer (no cross-task race on outBuffer).
|
||||
// Called from netTask (eth_web /action). RF goes via the queue to loraTask; the
|
||||
// APRS-IS copy is sent right here (netTask owns the socket). sentRF / sentTCP say
|
||||
// which copies actually went out, for the reply to the web page.
|
||||
void webSendMessage(const String &to, const String &text, bool viaRF, bool viaTCP,
|
||||
bool &sentRF, bool &sentTCP) {
|
||||
sentRF = sentTCP = false;
|
||||
if (viaRF) {
|
||||
String pkt = Message::buildRF(to, text);
|
||||
if (pkt.length()) {
|
||||
String *p = new String(pkt);
|
||||
if (xQueueSend(txMsgQueue, &p, 0) == pdTRUE) sentRF = true;
|
||||
else delete p;
|
||||
}
|
||||
}
|
||||
if (viaTCP && AprsIs::connected()) {
|
||||
String line = Message::buildAprsis(to, text);
|
||||
if (line.length()) {
|
||||
AprsIs::send(line);
|
||||
sentTCP = true;
|
||||
Serial.println("[msg] APRS-IS: " + line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called from loraTask (Query::handleMessage) when an APRS message addressed to
|
||||
// us is received. Hand it to netTask (the W5500 owner) for the /messages.json
|
||||
// store via a queue — no cross-task race on the message list.
|
||||
void onIncomingMessage(const String &from, const String &text) {
|
||||
String *p = new String(from + "\t" + text);
|
||||
if (xQueueSend(rxMsgQueue, &p, 0) != pdTRUE) delete p;
|
||||
}
|
||||
|
||||
// Called from netTask (TNC KISS client, MQTT downlink) to transmit a frame over
|
||||
// RF. Hands it to loraTask via txMsgQueue (Station output buffer owner).
|
||||
void enqueueRfFrame(const String &frame) {
|
||||
if (frame.length() == 0) return;
|
||||
String *p = new String(frame);
|
||||
if (xQueueSend(txMsgQueue, &p, 0) != pdTRUE) delete p;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------- LoRa RX/TX task
|
||||
// Owns the radio (SPI1): transmits the RF beacon (when Config.beacon.sendViaRF or
|
||||
// while the backup digi runs, as the ESP32 does) and receives LoRa-APRS packets.
|
||||
// Both run from THIS task so the radio is never touched concurrently.
|
||||
void loraTask(void *) {
|
||||
LoRa_Utils::setup();
|
||||
uint32_t lastRfBeacon = 0;
|
||||
for (;;) {
|
||||
// --- RF beacon TX: enqueue into the anti-collision output buffer ---
|
||||
if (Config.beacon.sendViaRF || g_backupDigi) {
|
||||
bool locOk = !(Config.beacon.latitude == 0.0 && Config.beacon.longitude == 0.0);
|
||||
#ifdef HAS_GPS
|
||||
if (Config.beacon.gpsActive && Gps::hasFix()) locOk = true; // GPS fix supplies the position
|
||||
#endif
|
||||
if (locOk && (lastRfBeacon == 0 || g_rfBeaconNow ||
|
||||
(millis() - lastRfBeacon >= (uint32_t)Config.beacon.interval * 60000UL))) {
|
||||
lastRfBeacon = millis();
|
||||
g_rfBeaconNow = false;
|
||||
String rf = Beacon::buildRfLine();
|
||||
Serial.println("[beacon] RF queued: " + rf);
|
||||
Station::enqueueTx(rf, true);
|
||||
}
|
||||
}
|
||||
// --- RX ---
|
||||
String pkt = LoRa_Utils::receivePacket(); // raw packet (with 3-byte hdr), "" if none
|
||||
if (pkt.length() > 0) {
|
||||
Station::noteRx();
|
||||
String body = pkt.length() > 3 ? pkt.substring(3) : pkt; // strip LoRa-APRS header
|
||||
Serial.println("[lora] RX: " + body);
|
||||
|
||||
// log every RX packet for the web "Received packets" view (frame +
|
||||
// signal stats captured together, before policy filtering)
|
||||
String *lp = new String(String(rssi) + "\t" + String(snr, 1) + "\t" + body);
|
||||
if (xQueueSend(rxPktQueue, &lp, 0) != pdTRUE) delete lp;
|
||||
|
||||
// packet policy (shared by gate + digi): parse SENDER + payload
|
||||
int gt = body.indexOf('>');
|
||||
int colon = body.indexOf(':');
|
||||
String sender = (gt > 0) ? body.substring(0, gt) : "";
|
||||
String payload = (colon >= 0) ? body.substring(colon) : body;
|
||||
|
||||
// our own packet heard back (e.g. digipeated by another station): do
|
||||
// not gate/digi it, nor count it as a heard station (matches upstream).
|
||||
String selfCall = Config.tacticalCallsign.length() ? Config.tacticalCallsign : Config.callsign;
|
||||
bool isSelf = sender.length() && sender == selfCall;
|
||||
bool blacklisted = sender.length() && Station::isBlacklisted(sender);
|
||||
bool dup = !isSelf && sender.length() && Station::isDuplicate(sender, payload);
|
||||
if (sender.length() && !isSelf) Station::updateLastHeard(sender);
|
||||
|
||||
if (isSelf) {
|
||||
Serial.println("[lora] ignored own packet heard back: " + sender);
|
||||
} else if (blacklisted) {
|
||||
Serial.println("[lora] dropped (blacklist): " + sender);
|
||||
} else if (dup) {
|
||||
Serial.println("[lora] dropped (dup <25s): " + sender);
|
||||
} else if (sender.length() && Query::handleMessage(body, sender)) {
|
||||
// it was a query addressed to us — answered over RF, don't gate/digi
|
||||
} else {
|
||||
// gate to APRS-IS (handed to netTask, the W5500 owner)
|
||||
// "rssi\tsnr\tframe": the signal stats travel with the frame for the IS2 meta line
|
||||
String *p = new String(String(rssi) + "\t" + String(snr, 1) + "\t" + pkt);
|
||||
if (xQueueSend(rxQueue, &p, 0) != pdTRUE) delete p; // drop if full
|
||||
// digipeat: rewrite WIDEn-N and enqueue for anti-collision TX
|
||||
if (Digi::enabled()) {
|
||||
String repeat = Digi::process(pkt);
|
||||
if (repeat.length() > 0) {
|
||||
Serial.println("[digi] queued: " + repeat);
|
||||
Station::enqueueTx(repeat, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// --- outgoing messages handed over by netTask (web /action) ---
|
||||
String *m;
|
||||
while (xQueueReceive(txMsgQueue, &m, 0) == pdTRUE) {
|
||||
Serial.println("[msg] queued: " + *m);
|
||||
Station::enqueueTx(*m, false);
|
||||
delete m;
|
||||
}
|
||||
// --- pump the RF output buffer (spaces TX, backs off after RX) ---
|
||||
Station::processTxBuffer();
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------- Network task
|
||||
void netTask(void *) {
|
||||
pinMode(PIN_ETH_RST, OUTPUT);
|
||||
digitalWrite(PIN_ETH_RST, LOW); vTaskDelay(pdMS_TO_TICKS(10));
|
||||
digitalWrite(PIN_ETH_RST, HIGH); vTaskDelay(pdMS_TO_TICKS(60));
|
||||
SPI.setRX(PIN_ETH_MISO);
|
||||
SPI.setSCK(PIN_ETH_SCK);
|
||||
SPI.setTX(PIN_ETH_MOSI);
|
||||
#ifdef USE_W5100S
|
||||
// The RAK13800_W5100S driver defines only the two-arg init(SPIClass&, cs);
|
||||
// pass the SPI0 port configured just above.
|
||||
Ethernet.init(SPI, PIN_ETH_CS);
|
||||
#else
|
||||
Ethernet.init(PIN_ETH_CS);
|
||||
#endif
|
||||
|
||||
// MAC derived from the chip's unique board ID (like Meshtastic's getMacAddr).
|
||||
// pico_get_unique_board_id() returns a value cached at boot by an SDK ctor
|
||||
// (single-core, before the scheduler) — it does NOT touch flash here, so it's
|
||||
// safe under FreeRTOS SMP. mac[0]=0x02 => locally administered + unicast; the
|
||||
// 4 chip bytes make two identical boards differ on the LAN (no DHCP clash).
|
||||
pico_unique_board_id_t uid;
|
||||
pico_get_unique_board_id(&uid);
|
||||
mac[0] = 0x02; mac[1] = 0x00;
|
||||
mac[2] = uid.id[4]; mac[3] = uid.id[5]; mac[4] = uid.id[6]; mac[5] = uid.id[7];
|
||||
Serial.printf("[ETH] MAC %02X:%02X:%02X:%02X:%02X:%02X\n",
|
||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
if (!Config.network.dhcp) {
|
||||
// static IP — parse the strings; first DNS of the list goes to the stack
|
||||
IPAddress ip, gw, sn, dns;
|
||||
ip.fromString(Config.network.ip);
|
||||
gw.fromString(Config.network.gateway);
|
||||
sn.fromString(Config.network.subnet.length() ? Config.network.subnet : String("255.255.255.0"));
|
||||
String d = Config.network.dns; d.trim();
|
||||
int sep = d.indexOf(' '); if (sep < 0) sep = d.indexOf(',');
|
||||
dns.fromString(sep > 0 ? d.substring(0, sep) : d);
|
||||
Ethernet.begin(mac, ip, dns, gw, sn); // synchronous, no DHCP wait
|
||||
Serial.print("[ETH] static IP: "); Serial.println(Ethernet.localIP());
|
||||
} else {
|
||||
Serial.println("[ETH] DHCP...");
|
||||
if (Ethernet.begin(mac) == 0) Serial.println("[ETH] DHCP FAILED (check link/cable)");
|
||||
else { Serial.print("[ETH] IP: "); Serial.println(Ethernet.localIP()); }
|
||||
}
|
||||
|
||||
ethWebSetup();
|
||||
Tnc::setup(); // KISS TNC server on :8001 (if enabled)
|
||||
Mqtt::setup(); // MQTT bridge (if Config.mqtt.active)
|
||||
Syslog::setup(); // remote syslog (if Config.syslog.active)
|
||||
|
||||
uint32_t lastMaintain = millis();
|
||||
uint32_t lastAprsTry = 0;
|
||||
uint32_t lastHb = 0;
|
||||
uint32_t lastBeacon = 0;
|
||||
for (;;) {
|
||||
ethWebPoll();
|
||||
Gps::poll(); // feed GPS NMEA -> TinyGPS++ (HAS_GPS only)
|
||||
Tnc::poll(); // accept KISS clients + read their frames
|
||||
Ntp::poll(); // SNTP time sync (real timestamps)
|
||||
Mqtt::loop(); // MQTT (re)connect + service
|
||||
if (Config.aprs_is.active) {
|
||||
if (!AprsIs::connected() && (millis() - lastAprsTry > 10000)) {
|
||||
lastAprsTry = millis();
|
||||
AprsIs::connect();
|
||||
}
|
||||
AprsIs::poll();
|
||||
// Backup digi (WIFI_Utils::checkWiFi on ESP32): with the option ticked,
|
||||
// 30 s without a line from the server = APRS-IS down -> repeat WIDE1-1
|
||||
// and beacon over RF; back to normal as soon as the server talks again.
|
||||
bool backup = Config.digi.backupDigiMode && AprsIs::silentFor(30000);
|
||||
if (backup != g_backupDigi) {
|
||||
g_backupDigi = backup;
|
||||
const char *note = backup ? "*** APRS-IS down -> Backup Digi Mode ***"
|
||||
: "*** APRS-IS back -> Stopping Backup Digi Mode ***";
|
||||
Serial.println(note);
|
||||
Syslog::logTx(note);
|
||||
}
|
||||
// telemetry channel definitions (EQNS/UNIT/PARM) at boot + ~daily
|
||||
if (AprsIs::connected() && Telemetry::dueDefinitions()) Telemetry::sendDefinitions();
|
||||
// periodic position beacon over APRS-IS (config has sendViaAPRSIS)
|
||||
bool locOk = !(Config.beacon.latitude == 0.0 && Config.beacon.longitude == 0.0);
|
||||
#ifdef HAS_GPS
|
||||
if (Config.beacon.gpsActive && Gps::hasFix()) locOk = true; // GPS fix supplies the position
|
||||
#endif
|
||||
if (Config.beacon.sendViaAPRSIS && AprsIs::connected() && !g_backupDigi && locOk &&
|
||||
(lastBeacon == 0 || g_beaconNow ||
|
||||
(millis() - lastBeacon >= (uint32_t)Config.beacon.interval * 60000UL))) {
|
||||
lastBeacon = millis();
|
||||
g_beaconNow = false;
|
||||
String b = Beacon::buildAprsisLine();
|
||||
AprsIs::send(b);
|
||||
Serial.println("[beacon] APRS-IS: " + b);
|
||||
String t = Telemetry::dataPacket(); // classic T# telemetry packet
|
||||
AprsIs::send(t);
|
||||
Serial.println("[telemetry] " + t);
|
||||
Mqtt::publishBeacon(b); // mirror beacon to MQTT (if beaconOverMqtt)
|
||||
if (Config.syslog.logBeaconOverTCPIP) Syslog::logTx("APRSIS BEACON / " + b);
|
||||
}
|
||||
}
|
||||
// forward any LoRa packets handed over by loraTask
|
||||
String *p;
|
||||
while (xQueueReceive(rxQueue, &p, 0) == pdTRUE) {
|
||||
if (Config.aprs_is.active) {
|
||||
int t1 = p->indexOf('\t');
|
||||
int t2 = (t1 >= 0) ? p->indexOf('\t', t1 + 1) : -1;
|
||||
if (t2 > t1) AprsIs::forward(p->substring(t2 + 1), p->substring(0, t1).toInt(), p->substring(t1 + 1, t2).toFloat());
|
||||
}
|
||||
delete p;
|
||||
}
|
||||
// store any incoming messages addressed to us (for GET /messages.json)
|
||||
String *m;
|
||||
while (xQueueReceive(rxMsgQueue, &m, 0) == pdTRUE) {
|
||||
int tab = m->indexOf('\t');
|
||||
if (tab > 0) ethWebAddMessage(m->substring(0, tab), m->substring(tab + 1), "RF");
|
||||
delete m;
|
||||
}
|
||||
// store RX packets log (for GET /received-packets.json): "rssi\tsnr\tframe"
|
||||
// and forward each received frame to any connected KISS TNC clients.
|
||||
String *lp;
|
||||
while (xQueueReceive(rxPktQueue, &lp, 0) == pdTRUE) {
|
||||
int t1 = lp->indexOf('\t');
|
||||
int t2 = lp->indexOf('\t', t1 + 1);
|
||||
if (t1 > 0 && t2 > t1) {
|
||||
String frame = lp->substring(t2 + 1);
|
||||
int prssi = lp->substring(0, t1).toInt();
|
||||
float psnr = lp->substring(t1 + 1, t2).toFloat();
|
||||
ethWebAddPacket(frame, prssi, psnr);
|
||||
// feed the stations map (upstream V4 "Map" view -> GET /stations.json).
|
||||
// Decoded here, in netTask, because that task owns both the map store
|
||||
// and the web server (no cross-core access to mapStations).
|
||||
APRSPacket ap = APRSPacketLib::processReceivedPacket(frame, prssi, psnr, 0);
|
||||
if (ap.type == 0 || ap.type == 4) { // 0 = GPS position, 4 = Mic-E
|
||||
MAP_Utils::upsert(ap.sender, ap.latitude, ap.longitude, ap.path,
|
||||
ap.overlay + ap.symbol, ap.rssi, ap.snr);
|
||||
}
|
||||
Tnc::broadcast(frame);
|
||||
Mqtt::publishRx(frame);
|
||||
Syslog::logRx(frame, prssi, psnr);
|
||||
}
|
||||
delete lp;
|
||||
}
|
||||
if (millis() - lastMaintain > 5000) { Ethernet.maintain(); lastMaintain = millis(); }
|
||||
// heartbeat printed HERE (netTask owns the W5500 — no SPI race)
|
||||
if (millis() - lastHb > 3000) {
|
||||
lastHb = millis();
|
||||
IPAddress ip = Ethernet.localIP();
|
||||
String clock = Ntp::synced() ? Ntp::hms(Ntp::nowEpoch()) : "--:--:--";
|
||||
Serial.printf("[hb] up=%lus %s ip=%d.%d.%d.%d callsign=%s aprsis=%s stations=%u vsys=%.2fV\n",
|
||||
(unsigned long)(millis() / 1000), clock.c_str(), ip[0], ip[1], ip[2], ip[3],
|
||||
Config.callsign.c_str(), AprsIs::connected() ? "up" : "down",
|
||||
(unsigned)Station::activeCount(), Battery::vsys());
|
||||
}
|
||||
// scheduled auto-reboot (Config "Reboot Time", in hours of uptime)
|
||||
if (Config.rebootMode && Config.rebootModeTime > 0 &&
|
||||
millis() > (uint32_t)Config.rebootModeTime * 3600UL * 1000UL) {
|
||||
Serial.println("[reboot] scheduled reboot time reached, restarting...");
|
||||
delay(100);
|
||||
rp2040.restart();
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(15));
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------- setup
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
uint32_t t0 = millis();
|
||||
while (!Serial && (millis() - t0 < 3000)) {}
|
||||
Serial.println(String("\n=== LoRa APRS iGate — RP2350 (built ") + FW_BUILD + ") ===");
|
||||
|
||||
pinMode(HB_LED, OUTPUT);
|
||||
Config.setup(); // LittleFS + /igate_conf.json (defaults on first boot)
|
||||
if (Config.rebootMode && Config.rebootModeTime > 0)
|
||||
Serial.printf("[reboot] auto-reboot every %d h\n", Config.rebootModeTime);
|
||||
Station::setup(); // load blacklist/managers from Config
|
||||
Battery::setup(); // VSYS ADC
|
||||
Wx::setup(); // BMP280 on I2C0 (Wire) — single-threaded init here
|
||||
Gps::setup(); // GPS UART (UART1 / Serial2) — HAS_GPS only
|
||||
|
||||
rxQueue = xQueueCreate(8, sizeof(String *));
|
||||
txMsgQueue = xQueueCreate(4, sizeof(String *));
|
||||
rxMsgQueue = xQueueCreate(8, sizeof(String *));
|
||||
rxPktQueue = xQueueCreate(8, sizeof(String *));
|
||||
xTaskCreate(loraTask, "lora", 4096, nullptr, 3, nullptr);
|
||||
xTaskCreate(netTask, "net", 4096, nullptr, 2, nullptr);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// LED blink ONLY — no W5500/Ethernet access here (that lives in netTask),
|
||||
// otherwise concurrent SPI0 access corrupts both readers.
|
||||
static uint32_t tick = 0;
|
||||
digitalWrite(HB_LED, (tick++ & 1) ? HIGH : LOW); // ~2 Hz proof-of-life
|
||||
vTaskDelay(pdMS_TO_TICKS(250));
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* RP2350 APRS message originator. Builds a standard message packet addressed to
|
||||
* another station. Pure (read-only on Config); the caller enqueues the result
|
||||
* into the Station output buffer from loraTask.
|
||||
*/
|
||||
#include "message_rp2350.h"
|
||||
#include "configuration.h"
|
||||
|
||||
extern Configuration Config;
|
||||
|
||||
namespace Message {
|
||||
|
||||
static String envelope(const String& tocallPath, const String& to, const String& text) {
|
||||
String pkt = Config.callsign;
|
||||
pkt += ">APLRG1";
|
||||
pkt += tocallPath; // ",PATH" (RF) or ",TCPIP*" (APRS-IS)
|
||||
pkt += "::";
|
||||
String padded = to;
|
||||
for (int i = to.length(); i < 9; i++) padded += ' '; // APRS addressee is 9 chars
|
||||
pkt += padded;
|
||||
pkt += ':';
|
||||
pkt += text;
|
||||
return pkt;
|
||||
}
|
||||
|
||||
String buildRF(const String& to, const String& text) {
|
||||
if (to.length() == 0 || text.length() == 0) return "";
|
||||
String path = Config.beacon.path.length() ? ("," + Config.beacon.path) : "";
|
||||
return envelope(path, to, text);
|
||||
}
|
||||
|
||||
String buildAprsis(const String& to, const String& text) {
|
||||
if (to.length() == 0 || text.length() == 0) return "";
|
||||
return envelope(",TCPIP*", to, text);
|
||||
}
|
||||
|
||||
} // namespace Message
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
// Originate APRS text messages from the iGate. A small feature (no UI yet — first
|
||||
// driven over the web /action API for testing the query responder, later wirable
|
||||
// to the SPA). Builds a standard APRS message packet:
|
||||
// CALL>APLRG1[,path]::ADDRESSEE :text (addressee padded to 9 chars)
|
||||
// The text is sent verbatim; append a "{id" suffix if you want the recipient to
|
||||
// ack it.
|
||||
namespace Message {
|
||||
// Pure builders (read-only on Config) — safe to call from any task. Return ""
|
||||
// on empty to/text.
|
||||
// buildRF : headerless packet for Station::enqueueTx (RF; LoRa_Utils
|
||||
// prepends the 3-byte LoRa-APRS header at TX).
|
||||
// buildAprsis: line for AprsIs::send (APRS-IS over TCP, TCPIP* q-construct).
|
||||
String buildRF(const String& to, const String& text);
|
||||
String buildAprsis(const String& to, const String& text);
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* RP2350 MQTT bridge — lean port of mqtt_utils (PubSubClient), WiFiClient ->
|
||||
* EthernetClient. Publishes RX packets, subscribes for an RF downlink. netTask
|
||||
* only (the W5500 owner; PubSubClient and the EthernetClient live here).
|
||||
*/
|
||||
#include "mqtt_rp2350.h"
|
||||
#include <Ethernet.h>
|
||||
#include <PubSubClient.h>
|
||||
#include "configuration.h"
|
||||
|
||||
extern Configuration Config;
|
||||
extern void enqueueRfFrame(const String &frame); // main.cpp: -> txMsgQueue -> loraTask
|
||||
|
||||
static EthernetClient mqttNet;
|
||||
static PubSubClient pubSub(mqttNet);
|
||||
static bool started = false;
|
||||
static uint32_t lastTry = 0;
|
||||
|
||||
// True if `sender` is this iGate (callsign or tactical). Used to break feedback
|
||||
// loops: our subscription "<topic>/<callsign>/#" also matches "<topic>/<callsign>"
|
||||
// (MQTT '#' includes the parent), so our own publishes echo back to us.
|
||||
static bool isOurs(const String &sender) {
|
||||
return sender == Config.callsign ||
|
||||
(Config.tacticalCallsign.length() && sender == Config.tacticalCallsign);
|
||||
}
|
||||
|
||||
// Inbound MQTT message on the subscribed topic -> transmit over RF.
|
||||
static void onMessage(char *topic, byte *payload, unsigned int len) {
|
||||
String msg;
|
||||
msg.reserve(len);
|
||||
for (unsigned int i = 0; i < len; i++) msg += (char)payload[i];
|
||||
int gt = msg.indexOf('>');
|
||||
String sender = (gt > 0) ? msg.substring(0, gt) : "";
|
||||
if (isOurs(sender)) { // our own packet echoed back by the broker — don't re-TX
|
||||
Serial.println("[mqtt] ignored own frame echoed back");
|
||||
return;
|
||||
}
|
||||
Serial.println("[mqtt] rx " + String(topic) + ": " + msg);
|
||||
enqueueRfFrame(msg);
|
||||
}
|
||||
|
||||
namespace Mqtt {
|
||||
|
||||
void setup() {
|
||||
if (!Config.mqtt.active) return;
|
||||
pubSub.setServer(Config.mqtt.server.c_str(), Config.mqtt.port);
|
||||
pubSub.setCallback(onMessage);
|
||||
started = true;
|
||||
Serial.printf("[mqtt] enabled, broker %s:%d\n", Config.mqtt.server.c_str(), Config.mqtt.port);
|
||||
}
|
||||
|
||||
static void connect() {
|
||||
if (Config.mqtt.server.isEmpty() || Config.mqtt.port <= 0) return;
|
||||
Serial.println("[mqtt] connecting...");
|
||||
bool ok = Config.mqtt.username.length()
|
||||
? pubSub.connect(Config.callsign.c_str(), Config.mqtt.username.c_str(), Config.mqtt.password.c_str())
|
||||
: pubSub.connect(Config.callsign.c_str());
|
||||
if (ok) {
|
||||
String sub = Config.mqtt.topic + "/" + Config.callsign + "/#";
|
||||
pubSub.subscribe(sub.c_str());
|
||||
Serial.println("[mqtt] connected, subscribed " + sub);
|
||||
} else {
|
||||
Serial.println("[mqtt] connect failed rc=" + String(pubSub.state()));
|
||||
}
|
||||
}
|
||||
|
||||
void loop() {
|
||||
if (!started) return;
|
||||
if (!pubSub.connected()) {
|
||||
if (millis() - lastTry > 10000) { lastTry = millis(); connect(); }
|
||||
return;
|
||||
}
|
||||
pubSub.loop();
|
||||
}
|
||||
|
||||
void publishRx(const String &frame) {
|
||||
if (!started || !pubSub.connected()) return;
|
||||
int gt = frame.indexOf('>');
|
||||
String sender = (gt > 0) ? frame.substring(0, gt) : "unknown";
|
||||
if (isOurs(sender)) return; // don't publish our own packets (they'd echo back -> RF loop)
|
||||
String topic = Config.mqtt.topic + "/" + sender;
|
||||
pubSub.publish(topic.c_str(), frame.c_str());
|
||||
}
|
||||
|
||||
void publishBeacon(const String &line) {
|
||||
if (!started || !pubSub.connected() || !Config.mqtt.beaconOverMqtt) return;
|
||||
String topic = Config.mqtt.topic + "/" + Config.callsign;
|
||||
pubSub.publish(topic.c_str(), line.c_str());
|
||||
}
|
||||
|
||||
} // namespace Mqtt
|
||||
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
// MQTT bridge for the RP2350 iGate (PubSubClient over EthernetClient; replaces
|
||||
// the ESP32 mqtt_utils' WiFiClient). When Config.mqtt.active:
|
||||
// - publishes each received RF packet to "<topic>/<sender>"
|
||||
// - subscribes to "<topic>/<callsign>/#"; payloads are transmitted over RF
|
||||
// - optionally publishes our own beacon to "<topic>/<callsign>" (beaconOverMqtt)
|
||||
// netTask only (W5500 owner); RF downlink goes through enqueueRfFrame().
|
||||
namespace Mqtt {
|
||||
void setup(); // configure broker + callback if active
|
||||
void loop(); // (re)connect + pubSub.loop(); call each net loop
|
||||
void publishRx(const String &frame); // a received RF frame -> MQTT
|
||||
void publishBeacon(const String &line); // own beacon -> MQTT (if beaconOverMqtt)
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* RP2350 SNTP client over EthernetUDP (W5500). Non-blocking request/reply; keeps
|
||||
* a (baseEpoch, baseMillis) pair so nowEpoch() interpolates with millis() between
|
||||
* syncs. Local time = UTC + Config.ntp.gmtCorrection hours. netTask only.
|
||||
*
|
||||
* The UDP socket is only held from the request to the reply (or its timeout):
|
||||
* the W5100S has 4 sockets, and one kept open here for good left the web server
|
||||
* a single one, so a browser loading the page got connections refused.
|
||||
*/
|
||||
#include "ntp_rp2350.h"
|
||||
#include <Ethernet.h>
|
||||
#include <EthernetUdp.h>
|
||||
#include <Dns.h>
|
||||
#include "configuration.h"
|
||||
|
||||
extern Configuration Config;
|
||||
|
||||
static EthernetUDP udp;
|
||||
static bool isSynced = false;
|
||||
static uint32_t baseEpoch = 0; // local unix epoch at last sync
|
||||
static uint32_t baseMillis = 0; // millis() at last sync
|
||||
static uint32_t lastAttempt = 0;
|
||||
static bool pending = false;
|
||||
static uint32_t sentAt = 0;
|
||||
|
||||
static const uint16_t LOCAL_PORT = 2390;
|
||||
static const uint32_t SYNC_INTERVAL = 15UL * 60UL * 1000UL; // resync every 15 min
|
||||
static const uint32_t RETRY_INTERVAL = 5UL * 1000UL; // retry quickly while unsynced (DNS may not be ready at boot)
|
||||
static const uint32_t RESYNC_RETRY = 60UL * 1000UL; // a failed resync is retried this often, not on every poll
|
||||
static const uint32_t NTP_UNIX_DELTA = 2208988800UL; // seconds 1900 -> 1970
|
||||
|
||||
namespace Ntp {
|
||||
|
||||
static void sendRequest() {
|
||||
// Resolve BEFORE taking our socket: the DNS lookup needs a socket of its own.
|
||||
IPAddress server;
|
||||
if (!server.fromString(Config.ntp.server)) {
|
||||
DNSClient dns;
|
||||
dns.begin(Ethernet.dnsServerIP());
|
||||
if (dns.getHostByName(Config.ntp.server.c_str(), server) != 1) return;
|
||||
}
|
||||
if (udp.begin(LOCAL_PORT) != 1) return; // no free socket now: try again later
|
||||
byte pkt[48] = {0};
|
||||
pkt[0] = 0x1B; // LI=0, VN=3, Mode=3 (client)
|
||||
if (udp.beginPacket(server, 123) == 1) {
|
||||
udp.write(pkt, 48);
|
||||
udp.endPacket();
|
||||
pending = true;
|
||||
sentAt = millis();
|
||||
} else {
|
||||
udp.stop();
|
||||
}
|
||||
}
|
||||
|
||||
void poll() {
|
||||
uint32_t now = millis();
|
||||
|
||||
bool due = !isSynced ? (lastAttempt == 0 || now - lastAttempt > RETRY_INTERVAL)
|
||||
: (now - baseMillis > SYNC_INTERVAL && now - lastAttempt > RESYNC_RETRY);
|
||||
if (!pending && due) { lastAttempt = now; sendRequest(); }
|
||||
|
||||
if (pending) {
|
||||
if (udp.parsePacket() >= 48) {
|
||||
byte buf[48];
|
||||
udp.read(buf, 48);
|
||||
uint32_t secs1900 = ((uint32_t)buf[40] << 24) | ((uint32_t)buf[41] << 16) |
|
||||
((uint32_t)buf[42] << 8) | (uint32_t)buf[43];
|
||||
baseEpoch = (secs1900 - NTP_UNIX_DELTA) + (int32_t)(Config.ntp.gmtCorrection * 3600.0f);
|
||||
baseMillis = millis();
|
||||
isSynced = true;
|
||||
pending = false;
|
||||
udp.stop();
|
||||
Serial.println("[ntp] synced " + hms(baseEpoch) + " (" + Config.ntp.server + ")");
|
||||
} else if (millis() - sentAt > 3000) {
|
||||
// timeout — retry next interval. Not `now - sentAt`: sentAt is stamped after
|
||||
// `now`, past the DNS lookup, so that difference wrapped and every request
|
||||
// timed out in the same poll it was sent, before the reply could arrive.
|
||||
pending = false;
|
||||
udp.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool synced() { return isSynced; }
|
||||
|
||||
uint32_t nowEpoch() {
|
||||
if (!isSynced) return 0;
|
||||
return baseEpoch + (millis() - baseMillis) / 1000;
|
||||
}
|
||||
|
||||
String hms(uint32_t epoch) {
|
||||
uint32_t d = epoch % 86400UL;
|
||||
char b[9];
|
||||
snprintf(b, sizeof(b), "%02u:%02u:%02u",
|
||||
(unsigned)(d / 3600), (unsigned)((d % 3600) / 60), (unsigned)(d % 60));
|
||||
return String(b);
|
||||
}
|
||||
|
||||
String ymd(uint32_t epoch) {
|
||||
// days since 1970-01-01 -> civil date (Howard Hinnant's civil_from_days)
|
||||
int32_t z = (int32_t)(epoch / 86400UL) + 719468;
|
||||
int32_t era = z / 146097;
|
||||
uint32_t doe = (uint32_t)(z - era * 146097);
|
||||
uint32_t yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365;
|
||||
uint32_t doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
|
||||
uint32_t mp = (5 * doy + 2) / 153;
|
||||
uint32_t d = doy - (153 * mp + 2) / 5 + 1;
|
||||
uint32_t m = mp < 10 ? mp + 3 : mp - 9;
|
||||
int32_t y = (int32_t)yoe + era * 400 + (m <= 2 ? 1 : 0);
|
||||
char b[32];
|
||||
snprintf(b, sizeof(b), "%04d-%02u-%02u", (int)y, (unsigned)m, (unsigned)d);
|
||||
return String(b);
|
||||
}
|
||||
|
||||
} // namespace Ntp
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
// Lean SNTP client over the W5500 (EthernetUDP) — replaces the ESP32 ntp_utils
|
||||
// (NTPClient + WiFiUDP). Non-blocking: poll() fires a request and picks up the
|
||||
// reply on a later call. Time is local (Config.ntp.gmtCorrection applied). Used
|
||||
// for real timestamps in the web views / heartbeat. netTask only (W5500 owner).
|
||||
namespace Ntp {
|
||||
void poll(); // sync periodically (~15 min); call each net loop
|
||||
bool synced(); // true once a reply has been received
|
||||
uint32_t nowEpoch(); // current LOCAL unix epoch, 0 if not synced
|
||||
String hms(uint32_t epoch); // "HH:MM:SS" from a local epoch
|
||||
String ymd(uint32_t epoch); // "YYYY-MM-DD" from a local epoch
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* RP2350 network OTA. Streams the posted raw firmware.bin into the arduino-pico
|
||||
* Updater (Update.begin/write/end); Update.end(true) stages it via picoOTA for
|
||||
* the bootloader, which copies it on the next reboot. netTask only (W5500 owner;
|
||||
* the transfer blocks the net loop for a few seconds — acceptable).
|
||||
*/
|
||||
#include "ota_rp2350.h"
|
||||
#include <Updater.h>
|
||||
#include "configuration.h"
|
||||
|
||||
extern Configuration Config;
|
||||
|
||||
namespace {
|
||||
|
||||
String base64(const String &data) {
|
||||
static const char *T = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
String r;
|
||||
int v = 0, c = 0;
|
||||
for (size_t i = 0; i < data.length(); i++) {
|
||||
v = (v << 8) | (uint8_t)data[i];
|
||||
c += 8;
|
||||
while (c >= 6) { c -= 6; r += T[(v >> c) & 0x3F]; }
|
||||
}
|
||||
if (c > 0) r += T[(v << (6 - c)) & 0x3F];
|
||||
while (r.length() % 4) r += '=';
|
||||
return r;
|
||||
}
|
||||
|
||||
// No credentials configured -> open. Otherwise require "Basic <base64(user:pass)>".
|
||||
bool authOk(const String &authHeader) {
|
||||
if (Config.ota.username.length() == 0 && Config.ota.password.length() == 0) return true;
|
||||
if (!authHeader.startsWith("Basic ")) return false;
|
||||
String token = authHeader.substring(6);
|
||||
token.trim();
|
||||
return token == base64(Config.ota.username + ":" + Config.ota.password);
|
||||
}
|
||||
|
||||
void reply(EthernetClient &c, int code, const char *reason, const char *msg) {
|
||||
c.print("HTTP/1.1 "); c.print(code); c.print(' '); c.print(reason); c.print("\r\n");
|
||||
c.print("Connection: close\r\nContent-Type: text/plain\r\nContent-Length: ");
|
||||
c.print((int)strlen(msg)); c.print("\r\n\r\n"); c.print(msg);
|
||||
c.flush();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace Ota {
|
||||
|
||||
void handleUpdate(EthernetClient &c, const String &authHeader, long contentLength) {
|
||||
if (!authOk(authHeader)) {
|
||||
c.print("HTTP/1.1 401 Unauthorized\r\nWWW-Authenticate: Basic realm=\"iGate OTA\"\r\n"
|
||||
"Connection: close\r\nContent-Length: 0\r\n\r\n");
|
||||
c.flush();
|
||||
Serial.println("[ota] auth failed");
|
||||
return;
|
||||
}
|
||||
if (contentLength <= 0) { reply(c, 400, "Bad Request", "need Content-Length"); return; }
|
||||
|
||||
Serial.printf("[ota] starting update, %ld bytes\n", contentLength);
|
||||
if (!Update.begin((size_t)contentLength)) {
|
||||
Serial.printf("[ota] Update.begin failed err=%u\n", Update.getError());
|
||||
reply(c, 500, "Internal Server Error", "begin failed (not enough space?)");
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t buf[1024];
|
||||
long remaining = contentLength;
|
||||
uint32_t lastActivity = millis();
|
||||
while (remaining > 0) {
|
||||
if (!c.connected()) { Serial.println("[ota] client disconnected"); Update.end(false); return; }
|
||||
int avail = c.available();
|
||||
if (avail <= 0) {
|
||||
if (millis() - lastActivity > 10000) {
|
||||
Serial.println("[ota] timeout");
|
||||
Update.end(false);
|
||||
reply(c, 408, "Request Timeout", "timeout");
|
||||
return;
|
||||
}
|
||||
delay(1);
|
||||
continue;
|
||||
}
|
||||
size_t cap = sizeof(buf);
|
||||
if ((long)cap > remaining) cap = (size_t)remaining;
|
||||
if ((size_t)avail < cap) cap = (size_t)avail;
|
||||
int got = c.read(buf, cap);
|
||||
if (got <= 0) continue;
|
||||
if (Update.write(buf, (size_t)got) != (size_t)got) {
|
||||
Serial.printf("[ota] write failed err=%u\n", Update.getError());
|
||||
Update.end(false);
|
||||
reply(c, 500, "Internal Server Error", "write failed");
|
||||
return;
|
||||
}
|
||||
remaining -= got;
|
||||
lastActivity = millis();
|
||||
}
|
||||
|
||||
if (!Update.end(true)) {
|
||||
Serial.printf("[ota] end failed err=%u\n", Update.getError());
|
||||
reply(c, 500, "Internal Server Error", "finalize failed");
|
||||
return;
|
||||
}
|
||||
|
||||
Serial.println("[ota] update staged OK, rebooting...");
|
||||
reply(c, 200, "OK", "update ok, rebooting");
|
||||
delay(400);
|
||||
rp2040.restart();
|
||||
}
|
||||
|
||||
} // namespace Ota
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
#include <Ethernet.h>
|
||||
|
||||
// Network firmware update for the RP2350 iGate. Replaces the ESP32 ota_utils
|
||||
// (ElegantOTA + ESPAsyncWebServer) with the arduino-pico Updater: the raw
|
||||
// firmware.bin is streamed into flash and staged for the bootloader, which
|
||||
// applies it on the next reboot. Served at POST /update over the W5500
|
||||
// (netTask). HTTP Basic auth against Config.ota.username/password (when set).
|
||||
//
|
||||
// curl -u user:pass --data-binary @firmware.bin http://<ip>/update
|
||||
namespace Ota {
|
||||
void handleUpdate(EthernetClient &c, const String &authHeader, long contentLength);
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* RP2350 query responder — lean port of QUERY_Utils (src/query_utils.cpp).
|
||||
* Answers RF-borne APRS message queries directed at our callsign. Replies/acks
|
||||
* go through the Station anti-collision output buffer. loraTask context only.
|
||||
*/
|
||||
#include "query_rp2350.h"
|
||||
#include "configuration.h"
|
||||
#include "station_rp2350.h"
|
||||
|
||||
extern Configuration Config;
|
||||
|
||||
// Signal stats of the last RX, set by lora_utils_rp2350.cpp.
|
||||
extern int rssi;
|
||||
extern float snr;
|
||||
extern int freqError;
|
||||
|
||||
// Records an incoming APRS message addressed to us (main.cpp -> netTask store,
|
||||
// served at GET /messages.json). Called from loraTask.
|
||||
extern void onIncomingMessage(const String &from, const String &text);
|
||||
|
||||
static const char *IGATE_VERSION = "RP2350 LoRa iGate v0.1";
|
||||
|
||||
namespace {
|
||||
|
||||
// Build the APRS message envelope addressed back to `station`:
|
||||
// CALL>APLRG1,RFONLY[,PATH]::STATION : (9-char padded addressee, RFONLY so
|
||||
// the reply is not gated). Caller appends the message body.
|
||||
// `gateable` drops the RFONLY tag so a neighbouring iGate may put the reply on
|
||||
// APRS-IS: used for third-party traffic, whose originator is not on our RF
|
||||
// (same rule as upstream's APRS_IS_Utils::processReceivedLoRaMessage).
|
||||
String envelope(const String& station, bool gateable = false) {
|
||||
String s = Config.callsign;
|
||||
s += ">APLRG1";
|
||||
if (!gateable) s += ",RFONLY";
|
||||
if (Config.beacon.path.length()) { s += ','; s += Config.beacon.path; }
|
||||
s += "::";
|
||||
String padded = station;
|
||||
for (int i = station.length(); i < 9; i++) padded += ' ';
|
||||
s += padded;
|
||||
s += ':';
|
||||
return s;
|
||||
}
|
||||
|
||||
// Compose the answer text for a query, or "" if unsupported. Manager-only remote
|
||||
// management commands (Config.remoteManagement managers) are honored when `sender`
|
||||
// is a manager. Our queries arrive over RF only, so rfOnly is always satisfied.
|
||||
String answerFor(const String& query, const String& sender) {
|
||||
String q = query;
|
||||
q.toUpperCase();
|
||||
// --- public queries ---
|
||||
if (q == "?APRS?" || q == "?" || q == "HELP")
|
||||
return "?APRSV ?APRSP ?APRSL ?APRSSR";
|
||||
if (q == "?APRSV")
|
||||
return String(IGATE_VERSION);
|
||||
if (q == "?APRSP")
|
||||
return "iGate QTH: " + String(Config.beacon.latitude, 2) + " " + String(Config.beacon.longitude, 2);
|
||||
if (q == "?APRSL") {
|
||||
String list = Station::heardListString();
|
||||
if (list.length() == 0)
|
||||
return "No Station Listened in the last " + String(Config.rememberStationTime) + " min.";
|
||||
return list;
|
||||
}
|
||||
if (q == "?APRSSR") {
|
||||
char buf[40];
|
||||
snprintf(buf, sizeof(buf), " %ddBm / %.2fdB / %dHz", rssi, (double)snr, freqError);
|
||||
return String(buf);
|
||||
}
|
||||
// --- manager-only remote management ---
|
||||
if (Station::isManager(sender)) {
|
||||
if (q.startsWith("?TX=ON")) {
|
||||
if (Config.loramodule.txActive) return "TX was ON";
|
||||
Config.loramodule.txActive = true;
|
||||
return "TX=ON";
|
||||
}
|
||||
if (q.startsWith("?TX=OFF")) {
|
||||
if (!Config.loramodule.txActive) return "TX was OFF";
|
||||
Config.loramodule.txActive = false;
|
||||
return "TX=OFF";
|
||||
}
|
||||
if (q.startsWith("?TX=?"))
|
||||
return Config.loramodule.txActive ? "TX=ON" : "TX=OFF";
|
||||
if (q.startsWith("?COMMIT")) {
|
||||
Config.writeFile();
|
||||
return "New Config Saved";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace Query {
|
||||
|
||||
bool handleMessage(const String& body, const String& sender) {
|
||||
// Third-party packet ("GATE>PATH:}ORIGINAL>PATH,TCPIP,GATE*::ADDRESSEE:text"):
|
||||
// a message another iGate pulled off APRS-IS and re-transmitted on RF. Unwrap
|
||||
// it so the message is credited to the ORIGINAL sender instead of the station
|
||||
// that repeated it (same detection as DIGI_Utils::processLoRaPacket upstream).
|
||||
String packet = body;
|
||||
String from = sender;
|
||||
bool thirdParty = false;
|
||||
int fc = body.indexOf(':');
|
||||
if (fc > 5 && fc < (int)body.length() - 1 && body[fc + 1] == '}' && body.indexOf("TCPIP") > 0) {
|
||||
thirdParty = true;
|
||||
packet = body.substring(body.indexOf(":}") + 2);
|
||||
int gt = packet.indexOf('>');
|
||||
if (gt <= 0) return false;
|
||||
from = packet.substring(0, gt);
|
||||
}
|
||||
|
||||
int dc = packet.indexOf("::");
|
||||
if (dc <= 10) return false; // not an APRS message
|
||||
|
||||
String addresseeAndMsg = packet.substring(dc + 2);
|
||||
int firstColon = addresseeAndMsg.indexOf(':');
|
||||
if (firstColon < 0) return false;
|
||||
String addressee = addresseeAndMsg.substring(0, firstColon);
|
||||
addressee.trim();
|
||||
if (addressee != Config.callsign) return false; // not for us
|
||||
|
||||
// Our own message handed back by an APRS-IS gateway: consume it (so it is
|
||||
// neither gated nor digipeated again) but don't log it or ack ourselves.
|
||||
if (from == Config.callsign) return true;
|
||||
|
||||
String text = addresseeAndMsg.substring(firstColon + 1); // message text (+ optional {msgid})
|
||||
|
||||
// ack any message that carries a {msgid}
|
||||
int brace = text.indexOf('{');
|
||||
String msgText = (brace > 0) ? text.substring(0, brace) : text;
|
||||
|
||||
onIncomingMessage(from, msgText); // log it for the web UI
|
||||
// ack id = text after the LAST '{' ("hola{MM}AA" -> "MM}AA", APRS 1.2c reply-acks);
|
||||
// an empty id means no ack was requested (upstream's generateAckMessage)
|
||||
String ackId = (brace > 0) ? text.substring(text.lastIndexOf('{') + 1) : "";
|
||||
ackId.trim();
|
||||
if (ackId.length()) {
|
||||
String ack = envelope(from, thirdParty);
|
||||
ack += "ack";
|
||||
ack += ackId;
|
||||
Station::enqueueTx(ack, false);
|
||||
Serial.println("[query] ack -> " + from + (thirdParty ? " (3rd party, " : " (") + ackId + ")");
|
||||
}
|
||||
|
||||
String upperText = msgText;
|
||||
upperText.toUpperCase();
|
||||
if (msgText.startsWith("?") || upperText == "HELP") { // it's a query ("HELP" needs no '?')
|
||||
String answer = answerFor(msgText, from);
|
||||
answer.trim();
|
||||
if (answer.length()) {
|
||||
String reply = envelope(from, thirdParty);
|
||||
reply += answer;
|
||||
reply += " *"; // random 2-char tag (matches upstream)
|
||||
reply += char(random(97, 123));
|
||||
reply += char(random(97, 123));
|
||||
reply += '*';
|
||||
Station::enqueueTx(reply, false);
|
||||
Serial.println("[query] " + msgText + " -> " + from + ": " + answer);
|
||||
}
|
||||
return true; // query handled: don't gate/digipeat
|
||||
}
|
||||
// Plain message addressed to us: consumed locally (recorded + acked above).
|
||||
// Return true so it is NOT gated to APRS-IS nor digipeated — a message "for
|
||||
// me" is not pass-through traffic. Messages to OTHER stations still gate/digi
|
||||
// normally (this function returns false early for them). To put a message on
|
||||
// APRS-IS, the sender uses the "Send via APRS-IS (TCP)" path explicitly.
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Query
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
// Lean port of QUERY_Utils (src/query_utils.cpp) for the RP2350 iGate. Answers
|
||||
// APRS message queries directed at our callsign, received over RF. Supported
|
||||
// public queries: ?APRS?/H/HELP/? (help), ?APRSV (version), ?APRSP (position),
|
||||
// ?APRSL (last-heard list), ?APRSSR (signal report of the last RX). Manager-only
|
||||
// remote control (?EM=/?TX=/?COMMIT) is NOT ported (EcoMode/txActive gating not
|
||||
// in the RP2350 feature set).
|
||||
//
|
||||
// Replies and acks are enqueued into the Station RF output buffer (anti-collision).
|
||||
// Call from loraTask only.
|
||||
namespace Query {
|
||||
// If `body` (headerless "SENDER>PATH::ADDRESSEE :text") is an APRS message
|
||||
// addressed to our callsign: send an ack (when it carries a {msgid}) and, if
|
||||
// the text is a query, enqueue the reply over RF. Returns true when it was a
|
||||
// query for us (caller should NOT gate/digipeat it). A non-query message for
|
||||
// us is acked but returns false (let the caller gate it as usual).
|
||||
bool handleMessage(const String& body, const String& sender);
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
/*
|
||||
* RP2350 station services — lean port of STATION_Utils (src/station_utils.cpp).
|
||||
* Blacklist/managers, last-heard tracking, 25 s dedup, and an anti-collision RF
|
||||
* output buffer. All called from loraTask (single-threaded -> no locks).
|
||||
*/
|
||||
#include "station_rp2350.h"
|
||||
#include "configuration.h"
|
||||
#include "lora_utils.h"
|
||||
#include <vector>
|
||||
|
||||
extern Configuration Config;
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr uint32_t SECS_TO_WAIT = 3; // s between TX, and after an RX, before TXing
|
||||
constexpr uint32_t DEDUP_WINDOW = 25UL * 1000;
|
||||
|
||||
struct LastHeard { uint32_t when; String station; };
|
||||
struct OutPacket { String packet; bool isBeacon; };
|
||||
struct DedupEntry { uint32_t when; uint32_t hash; };
|
||||
|
||||
std::vector<String> blacklist;
|
||||
std::vector<String> managers;
|
||||
std::vector<LastHeard> lastHeard;
|
||||
std::vector<OutPacket> outBuffer;
|
||||
std::vector<DedupEntry> dedup;
|
||||
|
||||
uint32_t lastRxTime = 0;
|
||||
uint32_t lastTxTime = 0;
|
||||
volatile size_t activeStations = 0;
|
||||
volatile uint32_t rxCounter = 0; // RX packets since last telemetry (benign cross-task read-reset)
|
||||
|
||||
std::vector<String> loadCallsignList(const String& list) {
|
||||
std::vector<String> out;
|
||||
int start = 0, n = list.length();
|
||||
while (start < n) {
|
||||
while (start < n && list[start] == ' ') start++;
|
||||
if (start >= n) break;
|
||||
int end = start;
|
||||
while (end < n && list[end] != ' ') end++;
|
||||
out.emplace_back(list.substring(start, end));
|
||||
start = end + 1;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// matches a callsign against a list with trailing-wildcard support ("EA4*")
|
||||
bool inList(const std::vector<String>& list, const String& callsign) {
|
||||
for (const String& entry : list) {
|
||||
int star = entry.indexOf('*');
|
||||
if (star >= 0) {
|
||||
if (star >= 2 && (int)callsign.length() >= star &&
|
||||
strncmp(callsign.c_str(), entry.c_str(), star) == 0)
|
||||
return true;
|
||||
} else if (entry == callsign) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t djb2(const String& station, const String& payload) {
|
||||
uint32_t h = 5381;
|
||||
for (size_t i = 0; i < station.length(); i++) h = ((h << 5) + h) + (uint8_t)station[i];
|
||||
for (size_t i = 0; i < payload.length(); i++) h = ((h << 5) + h) + (uint8_t)payload[i];
|
||||
return h;
|
||||
}
|
||||
|
||||
void deleteNotHeard() {
|
||||
uint32_t now = millis();
|
||||
uint32_t timeout = (uint32_t)Config.rememberStationTime * 60UL * 1000UL;
|
||||
for (int i = (int)lastHeard.size() - 1; i >= 0; i--)
|
||||
if (now - lastHeard[i].when >= timeout) lastHeard.erase(lastHeard.begin() + i);
|
||||
activeStations = lastHeard.size();
|
||||
}
|
||||
|
||||
void cleanDedup() {
|
||||
uint32_t now = millis();
|
||||
for (int i = (int)dedup.size() - 1; i >= 0; i--)
|
||||
if (now - dedup[i].when > DEDUP_WINDOW) dedup.erase(dedup.begin() + i);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace Station {
|
||||
|
||||
void setup() {
|
||||
blacklist = loadCallsignList(Config.blacklist);
|
||||
managers = loadCallsignList(Config.remoteManagement.managers);
|
||||
Serial.printf("[station] blacklist=%u managers=%u\n",
|
||||
(unsigned)blacklist.size(), (unsigned)managers.size());
|
||||
}
|
||||
|
||||
bool isBlacklisted(const String& callsign) { return inList(blacklist, callsign); }
|
||||
bool isManager(const String& callsign) { return inList(managers, callsign); }
|
||||
|
||||
// Verbatim copy of Utils::callsignIsValid (src/utils.cpp), which is not built for
|
||||
// the RP2350. Keep the two in step.
|
||||
bool callsignIsValid(const String& callsign) {
|
||||
if (callsign == "WLNK-1") return true;
|
||||
int totalCallsignLength = callsign.length();
|
||||
if (totalCallsignLength < 4) return false;
|
||||
|
||||
int hyphenIndex = callsign.indexOf("-");
|
||||
int baseCallsignLength = (hyphenIndex > 0) ? hyphenIndex : totalCallsignLength;
|
||||
|
||||
if (hyphenIndex > 0) { // SSID Validation
|
||||
if (hyphenIndex < 4) return false; // base Callsign must have at least 4 characters
|
||||
int ssidStart = hyphenIndex + 1;
|
||||
int ssidLength = totalCallsignLength - ssidStart;
|
||||
if (ssidLength == 0 || ssidLength > 2) return false;
|
||||
if (callsign.indexOf('-', ssidStart) != -1) return false; // avoid another "-" in ssid
|
||||
if (ssidLength == 2 && callsign[ssidStart] == '0') return false; // ssid can't start with "0"
|
||||
for (int i = ssidStart; i < totalCallsignLength; i++) {
|
||||
if (!isDigit(callsign[i])) return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (baseCallsignLength < 4 || baseCallsignLength > 6) return false;
|
||||
|
||||
bool padded = false; // Callsigns with 4 characters like A0AA are padded into 5 characters for further analisis : A0AA --> _A0AA
|
||||
if (baseCallsignLength == 4 && isAlpha(callsign[0]) && isDigit(callsign[1]) && isAlpha(callsign[2]) && isAlpha(callsign[3])) padded = true;
|
||||
char c0, c1, c2, c3;
|
||||
if (padded) {
|
||||
c0 = ' ';
|
||||
c1 = callsign[0];
|
||||
c2 = callsign[1];
|
||||
c3 = callsign[2];
|
||||
} else {
|
||||
c0 = callsign[0];
|
||||
c1 = callsign[1];
|
||||
c2 = callsign[2];
|
||||
c3 = callsign[3];
|
||||
}
|
||||
if (!isDigit(c2) || !isAlpha(c3)) { // __0A__ must be validated
|
||||
if (c0 != 'R' && !isDigit(c1) && !isAlpha(c2)) return false; // to accepto R0A___
|
||||
}
|
||||
|
||||
bool isValid =
|
||||
((isAlphaNumeric(c0) || c0 == ' ') && isAlpha(c1)) || // AA0A (+A+A) + _A0AA (+A) + 0A0A (+A+A)
|
||||
(isAlpha(c0) && isDigit(c1)) || // A00A (+A+A)
|
||||
(c0 == 'R' && baseCallsignLength == 6 && isDigit(c1) && isAlpha(c2) && isAlpha(c3) && isAlpha(callsign[4])); // R0AA (+A+A)
|
||||
if (!isValid) return false; // also 00__ avoided
|
||||
|
||||
if (baseCallsignLength > 4 ) { // to validate ____AA
|
||||
for (int i = 4; i < baseCallsignLength; i++) {
|
||||
if (!isAlpha(callsign[i])) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void updateLastHeard(const String& station) {
|
||||
deleteNotHeard();
|
||||
uint32_t now = millis();
|
||||
for (auto& s : lastHeard) {
|
||||
if (s.station == station) { s.when = now; return; }
|
||||
}
|
||||
lastHeard.push_back({now, station});
|
||||
activeStations = lastHeard.size();
|
||||
}
|
||||
|
||||
bool wasHeard(const String& station) {
|
||||
deleteNotHeard();
|
||||
for (const auto& s : lastHeard)
|
||||
if (s.station == station) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t activeCount() { return activeStations; }
|
||||
|
||||
String heardListString() {
|
||||
deleteNotHeard();
|
||||
String out;
|
||||
for (const auto& s : lastHeard) { out += s.station; out += ' '; }
|
||||
out.trim();
|
||||
return out;
|
||||
}
|
||||
|
||||
bool isDuplicate(const String& station, const String& payload) {
|
||||
cleanDedup();
|
||||
uint32_t h = djb2(station, payload);
|
||||
for (const auto& d : dedup)
|
||||
if (d.hash == h) return true;
|
||||
dedup.push_back({millis(), h});
|
||||
return false;
|
||||
}
|
||||
|
||||
void enqueueTx(const String& packet, bool isBeacon) {
|
||||
if (packet.length() == 0) return; // never queue an empty packet
|
||||
outBuffer.push_back({packet, isBeacon});
|
||||
}
|
||||
|
||||
void noteRx() { lastRxTime = millis(); rxCounter++; }
|
||||
|
||||
uint32_t takeRxCount() { uint32_t n = rxCounter; rxCounter = 0; return n; }
|
||||
|
||||
size_t txPending() { return outBuffer.size(); }
|
||||
|
||||
void processTxBuffer() {
|
||||
if (outBuffer.empty()) return;
|
||||
uint32_t now = millis();
|
||||
uint32_t window = SECS_TO_WAIT * 1000;
|
||||
if ((now - lastTxTime) <= window || (now - lastRxTime) <= window) return; // let the channel settle
|
||||
LoRa_Utils::sendNewPacket(outBuffer.front().packet);
|
||||
outBuffer.erase(outBuffer.begin());
|
||||
lastTxTime = millis();
|
||||
}
|
||||
|
||||
} // namespace Station
|
||||
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
// Lean port of STATION_Utils (src/station_utils.cpp) for the RP2350 iGate.
|
||||
// Provides the shared packet-policy services: blacklist/managers, last-heard
|
||||
// tracking, a 25 s duplicate filter, and an anti-collision RF output buffer.
|
||||
//
|
||||
// CONCURRENCY: every function here is meant to be called from loraTask only (the
|
||||
// owner of the radio). All state is therefore single-threaded — no locks. The
|
||||
// one exception is activeCount(), which reads a volatile snapshot so netTask can
|
||||
// print it in the heartbeat. Dropped from the original: display hooks, EcoMode /
|
||||
// low-voltage sleep, and config-write-on-TX (not in the RP2350 feature set).
|
||||
namespace Station {
|
||||
void setup(); // load blacklist/managers from Config (call at boot)
|
||||
|
||||
bool isBlacklisted(const String& callsign);
|
||||
bool isManager(const String& callsign);
|
||||
bool callsignIsValid(const String& callsign); // port of Utils::callsignIsValid; pure, safe from any task
|
||||
|
||||
void updateLastHeard(const String& station); // record/refresh a heard station
|
||||
bool wasHeard(const String& station); // heard within rememberStationTime?
|
||||
size_t activeCount(); // # stations currently tracked (volatile snapshot)
|
||||
String heardListString(); // space-separated heard callsigns (for ?APRSL)
|
||||
|
||||
// 25 s duplicate filter on (station, payload). True if the same packet was
|
||||
// seen within the window (caller should neither gate nor digipeat it).
|
||||
bool isDuplicate(const String& station, const String& payload);
|
||||
|
||||
// RF output buffer (anti-collision TX scheduling). Enqueue digipeats/beacons
|
||||
// from loraTask; processTxBuffer() sends at most one packet per call once the
|
||||
// channel has been idle (no RX/TX) for SECS_TO_WAIT seconds.
|
||||
void enqueueTx(const String& packet, bool isBeacon = false);
|
||||
void noteRx(); // call on every RX (feeds the TX backoff)
|
||||
uint32_t takeRxCount(); // RX packets since last call, then resets (for telemetry)
|
||||
void processTxBuffer(); // call each loraTask iteration
|
||||
size_t txPending();
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* RP2350 remote syslog (RFC5424 / UDP over EthernetUDP). The server IP is
|
||||
* resolved once at setup (literal or one DNS lookup) and cached; logging is
|
||||
* fire-and-forget UDP to that IP — never a per-call DNS lookup (the per-LOG
|
||||
* DNS/ARP block is what reboot-looped the W5500 boards). netTask only.
|
||||
*/
|
||||
#include "syslog_rp2350.h"
|
||||
#include <Ethernet.h>
|
||||
#include <EthernetUdp.h>
|
||||
#include <Dns.h>
|
||||
#include "configuration.h"
|
||||
|
||||
extern Configuration Config;
|
||||
|
||||
static EthernetUDP udp;
|
||||
static IPAddress serverIp;
|
||||
static bool ready = false;
|
||||
|
||||
static void send(const String &message) {
|
||||
if (!ready) return;
|
||||
String pkt = "<165>1 - ";
|
||||
pkt += Config.callsign;
|
||||
pkt += " RP2350iGate - - - ";
|
||||
pkt += message;
|
||||
udp.beginPacket(serverIp, Config.syslog.port); // resolved IP -> no DNS
|
||||
udp.write((const uint8_t *)pkt.c_str(), pkt.length());
|
||||
udp.endPacket();
|
||||
}
|
||||
|
||||
namespace Syslog {
|
||||
|
||||
void setup() {
|
||||
if (!Config.syslog.active) return;
|
||||
udp.begin(0);
|
||||
if (serverIp.fromString(Config.syslog.server)) { // literal IP
|
||||
ready = true;
|
||||
} else { // resolve hostname once
|
||||
DNSClient dns;
|
||||
dns.begin(Ethernet.dnsServerIP());
|
||||
IPAddress ip;
|
||||
if (dns.getHostByName(Config.syslog.server.c_str(), ip) == 1) { serverIp = ip; ready = true; }
|
||||
}
|
||||
if (ready)
|
||||
Serial.printf("[syslog] -> %d.%d.%d.%d:%d\n", serverIp[0], serverIp[1], serverIp[2], serverIp[3],
|
||||
Config.syslog.port);
|
||||
else
|
||||
Serial.println("[syslog] could not resolve server " + Config.syslog.server);
|
||||
}
|
||||
|
||||
void logRx(const String &frame, int rssi, float snr) {
|
||||
if (!ready) return;
|
||||
int gt = frame.indexOf('>');
|
||||
int colon = frame.indexOf(':');
|
||||
String sender = (gt > 0) ? frame.substring(0, gt) : "?";
|
||||
String payload = (colon >= 0) ? frame.substring(colon + 1) : frame;
|
||||
char sig[40];
|
||||
snprintf(sig, sizeof(sig), " / %ddBm / %.2fdB", rssi, (double)snr);
|
||||
send("RX / " + sender + " ---> " + payload + sig);
|
||||
}
|
||||
|
||||
void logTx(const String &info) {
|
||||
send(info);
|
||||
}
|
||||
|
||||
} // namespace Syslog
|
||||
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
// Remote syslog (RFC5424 over UDP) for the RP2350 iGate. Replaces the ESP32
|
||||
// syslog_utils (WiFiUDP) with EthernetUDP. The server is resolved ONCE at setup
|
||||
// (literal IP or a single DNS lookup) and cached, so logging never does per-call
|
||||
// DNS — that blocking-per-LOG behaviour is what reboot-looped the W5500 boards.
|
||||
// netTask only (W5500 owner); fire-and-forget UDP.
|
||||
namespace Syslog {
|
||||
void setup(); // resolve server once + begin UDP
|
||||
void logRx(const String &frame, int rssi, float snr); // a received RF packet
|
||||
void logTx(const String &info); // a TX / APRS-IS event line
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* RP2350 APRS structured telemetry — classic "T#seq,a1..a5,bits" data packets
|
||||
* plus EQNS/UNIT/PARM definitions addressed to self. Operational channels
|
||||
* (RxPkts/Heard/RSSI/SNR). netTask only (reads netTask-owned counters + the
|
||||
* APRS-IS socket via AprsIs). Values are 3-digit 0..255 with the EQNS below
|
||||
* mapping them back to engineering units.
|
||||
*/
|
||||
#include "telemetry_rp2350.h"
|
||||
#include "configuration.h"
|
||||
#include "station_rp2350.h"
|
||||
#include "aprsis_rp2350.h"
|
||||
#include "battery_rp2350.h"
|
||||
|
||||
extern Configuration Config;
|
||||
extern int rssi; // last RX signal stats (lora_utils_rp2350.cpp)
|
||||
extern float snr;
|
||||
|
||||
namespace {
|
||||
|
||||
uint16_t sequence = 0; // 000..999
|
||||
uint32_t lastDefs = 0; // millis() of last EQNS/UNIT/PARM (0 = never)
|
||||
|
||||
int clamp255(long v) { return v < 0 ? 0 : (v > 255 ? 255 : (int)v); }
|
||||
|
||||
String pad3(int v) {
|
||||
char b[4];
|
||||
snprintf(b, sizeof(b), "%03d", clamp255(v));
|
||||
return String(b);
|
||||
}
|
||||
|
||||
String selfCall() {
|
||||
return Config.tacticalCallsign.length() ? Config.tacticalCallsign : Config.callsign;
|
||||
}
|
||||
|
||||
// self-addressed message envelope for EQNS/UNIT/PARM (TCPIP*: the server adds qAC)
|
||||
String defEnvelope(const String &call, const String &payload) {
|
||||
String s = call;
|
||||
s += ">APLRG1,TCPIP*::";
|
||||
String padded = call;
|
||||
for (int i = call.length(); i < 9; i++) padded += ' ';
|
||||
s += padded;
|
||||
s += ':';
|
||||
s += payload;
|
||||
return s;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace Telemetry {
|
||||
|
||||
String dataPacket() {
|
||||
int a1 = clamp255(Station::takeRxCount()); // RxPkts EQNS 0,1,0
|
||||
int a2 = clamp255(Station::activeCount()); // Heard EQNS 0,1,0
|
||||
int a3 = clamp255(rssi + 150); // RSSI EQNS 0,1,-150 -> dBm
|
||||
int a4 = clamp255((long)((snr + 20.0f) * 5.0f)); // SNR EQNS 0,0.2,-20 -> dB
|
||||
int a5 = Config.battery.sendVoltageAsTelemetry // Vbat EQNS 0,0.1,0 -> V (VSYS)
|
||||
? clamp255((long)(Battery::vsys() * 10.0f)) : 0;
|
||||
|
||||
char seq[6];
|
||||
snprintf(seq, sizeof(seq), "%03u", sequence);
|
||||
sequence = (sequence + 1) % 1000;
|
||||
|
||||
String line = selfCall();
|
||||
line += ">APLRG1,TCPIP*:T#";
|
||||
line += seq; line += ',';
|
||||
line += pad3(a1); line += ',';
|
||||
line += pad3(a2); line += ',';
|
||||
line += pad3(a3); line += ',';
|
||||
line += pad3(a4); line += ',';
|
||||
line += pad3(a5); line += ",00000000";
|
||||
return line;
|
||||
}
|
||||
|
||||
bool dueDefinitions() {
|
||||
return lastDefs == 0 || (millis() - lastDefs) > 24UL * 60UL * 60UL * 1000UL;
|
||||
}
|
||||
|
||||
void sendDefinitions() {
|
||||
String call = selfCall();
|
||||
AprsIs::send(defEnvelope(call, "PARM.RxPkts,Heard,RSSI,SNR,Vbat"));
|
||||
AprsIs::send(defEnvelope(call, "UNIT.Pkt,Stn,dBm,dB,V"));
|
||||
AprsIs::send(defEnvelope(call, "EQNS.0,1,0,0,1,0,0,1,-150,0,0.2,-20,0,0.1,0"));
|
||||
lastDefs = millis() ? millis() : 1;
|
||||
Serial.println("[telemetry] sent EQNS/UNIT/PARM definitions");
|
||||
}
|
||||
|
||||
} // namespace Telemetry
|
||||
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
// APRS structured telemetry for the RP2350 iGate, classic "T#" data packets
|
||||
// (universally parsed by aprs.fi; the Base91 "|...|"-in-comment form did not
|
||||
// register there). Operational channels (no battery — this board has none):
|
||||
// A1 RxPkts RF packets since last report A2 Heard stations heard
|
||||
// A3 RSSI last RX dBm A4 SNR last RX dB (A5 spare)
|
||||
// Sent as its own packet alongside the APRS-IS beacon; EQNS./UNIT./PARM. define
|
||||
// the channels (sent to self at boot + ~daily). netTask only.
|
||||
namespace Telemetry {
|
||||
String dataPacket(); // "CALL>APLRG1,TCPIP,qAC:T#nnn,a1..a5,bits"; advances seq
|
||||
bool dueDefinitions(); // true at boot and every ~24 h
|
||||
void sendDefinitions(); // AprsIs::send the EQNS./UNIT./PARM. messages
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* RP2350 TNC server — replaces the ESP32 tnc_utils.cpp (WiFiServer/mDNS) with an
|
||||
* EthernetServer on the W5500. Speaks KISS (codec reused as-is from
|
||||
* src/kiss_utils.cpp) or, with tnc.kissProtocol = false, plain TNC2 text lines
|
||||
* terminated by CR LF, as tnc_utils.cpp does. Runs entirely in netTask (W5500
|
||||
* owner); frames bound for RF are handed to loraTask via enqueueRfFrame()
|
||||
* (txMsgQueue -> Station buffer).
|
||||
*/
|
||||
#include "tnc_rp2350.h"
|
||||
#include <Ethernet.h>
|
||||
#include "configuration.h"
|
||||
#include "kiss_utils.h"
|
||||
#include "kiss_protocol.h"
|
||||
#include "aprsis_rp2350.h"
|
||||
|
||||
extern Configuration Config;
|
||||
extern void enqueueRfFrame(const String &frame); // main.cpp: push to txMsgQueue -> loraTask
|
||||
|
||||
#define TNC_PORT 8001
|
||||
#define TNC_MAX_CLIENTS 2
|
||||
#define TNC_MAX_BUF 512
|
||||
|
||||
static EthernetServer tncServer(TNC_PORT);
|
||||
static EthernetClient tncClients[TNC_MAX_CLIENTS];
|
||||
static String tncBuf[TNC_MAX_CLIENTS];
|
||||
static bool tncStarted = false;
|
||||
|
||||
namespace {
|
||||
|
||||
const char *protocolLabel() {
|
||||
return Config.tnc.kissProtocol ? "KISS" : "TNC2";
|
||||
}
|
||||
|
||||
// Act on one complete TNC2 frame from a client: TX over RF (honoring acceptOwn /
|
||||
// txActive) and optionally bridge to APRS-IS.
|
||||
void processFrame(const String &frame) {
|
||||
int gt = frame.indexOf('>');
|
||||
String sender = (gt > 0) ? frame.substring(0, gt) : "";
|
||||
if (!Config.tnc.acceptOwn && sender == Config.callsign) {
|
||||
Serial.printf("[tnc] ignored own frame from %s client\n", protocolLabel());
|
||||
return;
|
||||
}
|
||||
Serial.printf("[tnc] <- (%s) ", protocolLabel());
|
||||
Serial.println(frame);
|
||||
if (Config.loramodule.txActive) enqueueRfFrame(frame); // -> loraTask -> RF
|
||||
|
||||
if (Config.tnc.aprsBridgeActive && Config.aprs_is.active && AprsIs::connected()) {
|
||||
int colon = frame.indexOf(':');
|
||||
if (gt > 0 && colon > gt) { // SENDER>PATH,qAO,IGATE:payload
|
||||
String line = frame.substring(0, colon);
|
||||
line += ",qAO,";
|
||||
line += Config.callsign;
|
||||
line += frame.substring(colon);
|
||||
AprsIs::send(line);
|
||||
Serial.println("[tnc] -> APRS-IS: " + line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// KISS: collect bytes between FENDs, then decode.
|
||||
void handleByteKISS(int idx, char ch) {
|
||||
String &buf = tncBuf[idx];
|
||||
if (buf.length() == 0 && ch != (char)FEND) return; // wait for a frame start
|
||||
buf += ch;
|
||||
|
||||
if (ch == (char)FEND && buf.length() > 3) {
|
||||
bool isData = false;
|
||||
String frame = decodeKISS(buf, isData);
|
||||
buf = "";
|
||||
if (isData && frame.length() > 0) processFrame(frame);
|
||||
}
|
||||
if (buf.length() > TNC_MAX_BUF) buf = "";
|
||||
}
|
||||
|
||||
// TNC2: one frame per line; CR is ignored, LF ends it. Lines that are not
|
||||
// SENDER>PATH:payload are dropped, as tnc_utils.cpp does.
|
||||
void handleByteTNC2(int idx, char ch) {
|
||||
String &buf = tncBuf[idx];
|
||||
if (ch == '\r') return;
|
||||
|
||||
if (ch == '\n') {
|
||||
String frame = buf;
|
||||
frame.trim();
|
||||
buf = "";
|
||||
if (frame.length() > 0 && frame.indexOf(':') != -1 && frame.indexOf('>') != -1) processFrame(frame);
|
||||
return;
|
||||
}
|
||||
|
||||
buf += ch;
|
||||
if (buf.length() > TNC_MAX_BUF) buf = "";
|
||||
}
|
||||
|
||||
void handleByte(int idx, char ch) {
|
||||
if (Config.tnc.kissProtocol) handleByteKISS(idx, ch);
|
||||
else handleByteTNC2(idx, ch);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace Tnc {
|
||||
|
||||
void setup() {
|
||||
if (!Config.tnc.enableServer) return;
|
||||
tncServer.begin();
|
||||
tncStarted = true;
|
||||
Serial.printf("[tnc] %s server on :%d\n", protocolLabel(), TNC_PORT);
|
||||
}
|
||||
|
||||
void poll() {
|
||||
if (!tncStarted) return;
|
||||
|
||||
EthernetClient nc = tncServer.accept();
|
||||
if (nc) {
|
||||
bool placed = false;
|
||||
for (int i = 0; i < TNC_MAX_CLIENTS; i++) {
|
||||
if (!tncClients[i] || !tncClients[i].connected()) {
|
||||
tncClients[i].stop();
|
||||
tncClients[i] = nc;
|
||||
tncBuf[i] = "";
|
||||
placed = true;
|
||||
Serial.printf("[tnc] client %d connected\n", i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!placed) { Serial.println("[tnc] no free slots, refused"); nc.stop(); }
|
||||
}
|
||||
|
||||
for (int i = 0; i < TNC_MAX_CLIENTS; i++) {
|
||||
if (tncClients[i] && tncClients[i].connected()) {
|
||||
while (tncClients[i].available() > 0) handleByte(i, (char)tncClients[i].read());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void broadcast(const String &tnc2frame) {
|
||||
if (!tncStarted || tnc2frame.length() == 0) return;
|
||||
String encoded = Config.tnc.kissProtocol ? encodeKISS(tnc2frame) : (tnc2frame + "\r\n");
|
||||
for (int i = 0; i < TNC_MAX_CLIENTS; i++) {
|
||||
if (tncClients[i] && tncClients[i].connected()) {
|
||||
tncClients[i].print(encoded);
|
||||
tncClients[i].flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Tnc
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
// KISS TNC server for the RP2350 iGate (TCP :8001 over the W5500). Lets external
|
||||
// APRS clients (APRSdroid, Xastir, YAAC, ...) use the iGate's LoRa radio:
|
||||
// client -> KISS frame -> decode -> RF TX (and optional APRS-IS bridge)
|
||||
// RF RX -> KISS-encode -> all connected clients
|
||||
// Reuses the validated KISS codec (src/kiss_utils.cpp). All calls run from
|
||||
// netTask (the W5500 owner); RF TX is handed to loraTask via enqueueRfFrame().
|
||||
namespace Tnc {
|
||||
void setup(); // start the server if Config.tnc.enableServer
|
||||
void poll(); // accept clients + read their KISS frames
|
||||
void broadcast(const String& tnc2frame); // a received RF frame -> KISS clients
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
#include "wx_rp2350.h"
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_BMP280.h>
|
||||
#include <Adafruit_BME680.h>
|
||||
#include "configuration.h"
|
||||
#include "board_pinout.h" // PIN_WX_SDA / PIN_WX_SCL
|
||||
|
||||
extern Configuration Config;
|
||||
|
||||
// Which I2C peripheral the weather sensor hangs off. arduino-pico: Wire = I2C0
|
||||
// (GP4/GP5 by default), Wire1 = I2C1 (GP6/GP7 etc.). Select with -D WX_USE_WIRE1.
|
||||
#ifdef WX_USE_WIRE1
|
||||
#define WX_WIRE Wire1
|
||||
#else
|
||||
#define WX_WIRE Wire
|
||||
#endif
|
||||
|
||||
#ifndef PIN_WX_SDA
|
||||
#define PIN_WX_SDA 4 // I2C0 default SDA on arduino-pico (GP4)
|
||||
#endif
|
||||
#ifndef PIN_WX_SCL
|
||||
#define PIN_WX_SCL 5 // I2C0 default SCL on arduino-pico (GP5)
|
||||
#endif
|
||||
|
||||
#define WX_CORRECTION_FACTOR 8.2296f // metres -> hPa (matches wx_utils.cpp)
|
||||
|
||||
namespace Wx {
|
||||
|
||||
static Adafruit_BMP280 bmp280(&WX_WIRE);
|
||||
static Adafruit_BME680 bme680(&WX_WIRE);
|
||||
static bool bmpPresent = false; // BMP280: temperature + barometric pressure
|
||||
static bool bme680Present = false; // BME680: temp + humidity + pressure + gas/VOC
|
||||
static bool shtPresent = false; // SHT40: temperature + relative humidity
|
||||
static uint8_t sht40Addr = 0; // 0x44 (AD1B) or 0x45 (BD1B)
|
||||
|
||||
// --- APRS field formatters (byte-for-byte the ESP32 wx_utils.cpp output) ---
|
||||
static String tempString(float degF) { // temperature in Fahrenheit, 3 digits
|
||||
String s = String((int)degF);
|
||||
switch (s.length()) {
|
||||
case 1: return "00" + s;
|
||||
case 2: return "0" + s;
|
||||
case 3: return s;
|
||||
default: return "-999";
|
||||
}
|
||||
}
|
||||
|
||||
static String presString(float hPa) { // pressure x10 (0.1 hPa), 5 digits
|
||||
String whole = String((int)hPa);
|
||||
String dec = String(int((hPa - int(hPa)) * 10));
|
||||
switch (whole.length()) {
|
||||
case 1: return "000" + whole + dec;
|
||||
case 2: return "00" + whole + dec;
|
||||
case 3: return "0" + whole + dec;
|
||||
case 4: return whole + dec;
|
||||
case 5: return whole;
|
||||
default: return "-99999";
|
||||
}
|
||||
}
|
||||
|
||||
static String humString(float rh) { // relative humidity, 2 digits (h00 == 100%)
|
||||
long h = lround(rh);
|
||||
if (h >= 100) return "00"; // APRS encodes 100% as "00"
|
||||
if (h < 0) h = 0;
|
||||
char b[3];
|
||||
snprintf(b, sizeof(b), "%02ld", h);
|
||||
return String(b);
|
||||
}
|
||||
|
||||
// SHT40: write 0xFD (measure, high precision), wait, read 6 bytes
|
||||
// [tMSB tLSB tCRC hMSB hLSB hCRC]. Datasheet conversions. CRC not checked (lean).
|
||||
static bool sht40Read(float &tC, float &rh) {
|
||||
WX_WIRE.beginTransmission(sht40Addr);
|
||||
WX_WIRE.write(0xFD);
|
||||
if (WX_WIRE.endTransmission() != 0) return false;
|
||||
delay(10); // high-precision conversion ~8.2 ms
|
||||
if (WX_WIRE.requestFrom(sht40Addr, (uint8_t)6) != 6) return false;
|
||||
uint8_t d[6];
|
||||
for (int i = 0; i < 6; i++) d[i] = WX_WIRE.read();
|
||||
uint16_t rawT = ((uint16_t)d[0] << 8) | d[1];
|
||||
uint16_t rawH = ((uint16_t)d[3] << 8) | d[4];
|
||||
tC = -45.0f + 175.0f * ((float)rawT / 65535.0f);
|
||||
rh = -6.0f + 125.0f * ((float)rawH / 65535.0f);
|
||||
if (rh < 0.0f) rh = 0.0f;
|
||||
if (rh > 100.0f) rh = 100.0f;
|
||||
return true;
|
||||
}
|
||||
|
||||
void setup() {
|
||||
WX_WIRE.setSDA(PIN_WX_SDA);
|
||||
WX_WIRE.setSCL(PIN_WX_SCL);
|
||||
WX_WIRE.begin();
|
||||
// The board carries dedicated 4.7k external I2C pull-ups, so no internal
|
||||
// pull-ups are enabled here.
|
||||
|
||||
// I2C scan (diagnostic): list everything answering on PIN_WX_SDA/SCL.
|
||||
Serial.printf("[wx] I2C scan on SDA=%d SCL=%d:", PIN_WX_SDA, PIN_WX_SCL);
|
||||
int found = 0;
|
||||
for (uint8_t a = 0x08; a < 0x78; a++) {
|
||||
WX_WIRE.beginTransmission(a);
|
||||
if (WX_WIRE.endTransmission() == 0) { Serial.printf(" 0x%02X", a); found++; }
|
||||
}
|
||||
Serial.println(found ? "" : " (none)");
|
||||
|
||||
// 0x76/0x77 (SDO strap) hosts either a BMP280 (temp + pressure) or a BME680
|
||||
// (temp + humidity + pressure + gas/VOC) — they share the address. Each
|
||||
// Adafruit .begin() validates its own chip ID (BMP280 = 0x58, BME680 = 0x61),
|
||||
// so probe the BME680 first and fall back to the BMP280: no false positives.
|
||||
if (bme680.begin(0x76) || bme680.begin(0x77)) {
|
||||
bme680.setTemperatureOversampling(BME680_OS_8X);
|
||||
bme680.setHumidityOversampling(BME680_OS_2X);
|
||||
bme680.setPressureOversampling(BME680_OS_4X);
|
||||
bme680.setIIRFilterSize(BME680_FILTER_SIZE_3);
|
||||
bme680.setGasHeater(320, 150); // 320 C for 150 ms -> gas resistance
|
||||
bme680Present = true;
|
||||
Serial.println("[wx] BME680 found (temp + humidity + pressure + gas)");
|
||||
} else if (bmp280.begin(0x76) || bmp280.begin(0x77)) {
|
||||
bmp280.setSampling(Adafruit_BMP280::MODE_FORCED,
|
||||
Adafruit_BMP280::SAMPLING_X2, // temperature
|
||||
Adafruit_BMP280::SAMPLING_X16, // pressure
|
||||
Adafruit_BMP280::FILTER_X16,
|
||||
Adafruit_BMP280::STANDBY_MS_500);
|
||||
bmpPresent = true;
|
||||
Serial.println("[wx] BMP280 found (temp + pressure)");
|
||||
}
|
||||
|
||||
// SHT40 at 0x44 or 0x45 (temp + humidity). Detected by an ACK on the bus.
|
||||
for (uint8_t a = 0x44; a <= 0x45; a++) {
|
||||
WX_WIRE.beginTransmission(a);
|
||||
if (WX_WIRE.endTransmission() == 0) {
|
||||
sht40Addr = a;
|
||||
shtPresent = true;
|
||||
Serial.printf("[wx] SHT40 found at 0x%02X (temp + humidity)\n", a);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bmpPresent && !bme680Present && !shtPresent)
|
||||
Serial.println("[wx] no BME680/BMP280/SHT40 on I2C (weather disabled)");
|
||||
}
|
||||
|
||||
bool present() { return bmpPresent || bme680Present || shtPresent; }
|
||||
|
||||
// APRS weather payload: ".../...g...t<TTT>[h<HH>][b<PPPPP>]". Temperature comes
|
||||
// from whichever sensor is present (SHT40 preferred); humidity from the SHT40 or
|
||||
// BME680, pressure from the BME680 or BMP280. A BME680 also appends its gas/VOC
|
||||
// resistance ("Gas: <k>Kohms", matching the ESP32 wx_utils.cpp). Absent fields
|
||||
// are omitted.
|
||||
String readAprs() {
|
||||
if (!bmpPresent && !bme680Present && !shtPresent) return "";
|
||||
|
||||
float tC = NAN, rh = NAN, p = NAN, gasKohm = NAN;
|
||||
|
||||
if (shtPresent) {
|
||||
float t, h;
|
||||
if (sht40Read(t, h)) { tC = t; rh = h; }
|
||||
}
|
||||
if (bme680Present) {
|
||||
if (bme680.performReading()) { // blocking read (temp/hum/pres/gas)
|
||||
p = bme680.pressure / 100.0f; // hPa
|
||||
gasKohm = bme680.gas_resistance / 1000.0f; // kOhms
|
||||
if (isnan(tC)) tC = bme680.temperature; // SHT40 temp preferred if present
|
||||
if (isnan(rh)) rh = bme680.humidity; // SHT40 humidity preferred if present
|
||||
}
|
||||
} else if (bmpPresent) {
|
||||
bmp280.takeForcedMeasurement();
|
||||
float bt = bmp280.readTemperature(); // degC
|
||||
float bp = bmp280.readPressure() / 100.0f; // hPa
|
||||
if (!isnan(bp)) p = bp;
|
||||
if (isnan(tC) && !isnan(bt)) tC = bt; // fall back to BMP280 temp
|
||||
}
|
||||
|
||||
if (isnan(tC)) return ".../...g...t...";
|
||||
|
||||
String wx = ".../...g...t";
|
||||
wx += tempString((tC + Config.wxsensor.temperatureCorrection) * 1.8f + 32.0f);
|
||||
wx += "h";
|
||||
wx += isnan(rh) ? String("..") : humString(rh);
|
||||
if (!isnan(p)) {
|
||||
wx += "b";
|
||||
wx += presString(p + Config.wxsensor.heightCorrection / WX_CORRECTION_FACTOR);
|
||||
}
|
||||
if (bme680Present && !isnan(gasKohm)) {
|
||||
wx += "Gas: ";
|
||||
wx += String(gasKohm);
|
||||
wx += "Kohms";
|
||||
}
|
||||
return wx;
|
||||
}
|
||||
|
||||
} // namespace Wx
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
// Lean weather module for the RP2350 iGate on I2C0 (Wire). Auto-detects a
|
||||
// BMP280 (0x76/0x77 -> temperature + barometric pressure) and/or an SHT40
|
||||
// (0x44 -> temperature + relative humidity), and builds the APRS weather field
|
||||
// from whatever is present.
|
||||
namespace Wx {
|
||||
// Probe the BMP280 and SHT40 on Wire (PIN_WX_SDA/PIN_WX_SCL). Safe to call
|
||||
// when no sensor is present — readAprs() then returns "". Call from setup().
|
||||
void setup();
|
||||
|
||||
// True once a BMP280 or SHT40 answered on the bus at setup().
|
||||
bool present();
|
||||
|
||||
// APRS weather payload: ".../...g...t<TTT>[h<HH>][b<PPPPP>]" (temp degF,
|
||||
// humidity %, pressure 0.1 hPa; absent fields omitted). Returns "" if no
|
||||
// sensor was detected. Call from netTask only (single Wire owner).
|
||||
String readAprs();
|
||||
}
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "sleep_utils.h"
|
||||
#include "digi_utils.h"
|
||||
#include "lora_utils.h"
|
||||
#include "thermal_utils.h"
|
||||
|
||||
|
||||
extern Configuration Config;
|
||||
@@ -75,6 +76,9 @@ namespace SLEEP_Utils {
|
||||
Serial.print("(Sleeping : "); Serial.print(timeToSleep); Serial.println("seconds)");
|
||||
delay(100);
|
||||
LoRa_Utils::wakeRadio();
|
||||
#ifdef FAN_CTRL_PIN
|
||||
THERMAL_Utils::turnOffFan(); // GPIOs keep their level in light sleep
|
||||
#endif
|
||||
esp_light_sleep_start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,6 +234,7 @@ namespace STATION_Utils {
|
||||
}
|
||||
|
||||
void addToOutputPacketBuffer(const String& packet, bool flag) {
|
||||
if (packet == "") return; // never queue an empty packet
|
||||
outputPacketBuffer.emplace_back(OutputPacketBuffer{packet, flag});
|
||||
}
|
||||
|
||||
|
||||
Loaded 100 of 123 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user