mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-14 23:02:53 +00:00
Compare commits
324 Commits
no-arduino
...
markbirss-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e31b77e02a | ||
|
|
384436e937 | ||
|
|
eb30aae486 | ||
|
|
079286da04 | ||
|
|
0130899b3b | ||
|
|
d1f3c3c982 | ||
|
|
3b6eefa8bb | ||
|
|
5107531425 | ||
|
|
88655ffc44 | ||
|
|
10bd10b9d1 | ||
|
|
956a0f102b | ||
|
|
bdedd0e1fe | ||
|
|
4c901033b2 | ||
|
|
7d926da98c | ||
|
|
1b793d1f23 | ||
|
|
b5a8e8f51b | ||
|
|
cc5d00e211 | ||
|
|
1a8ab2aadc | ||
|
|
608fdc6f52 | ||
|
|
1d8638b47d | ||
|
|
3ecff48722 | ||
|
|
aa3b14ce72 | ||
|
|
28aeb0f09e | ||
|
|
7c5e2c5393 | ||
|
|
df8b629c2c | ||
|
|
a506dc6b65 | ||
|
|
fc1e6ccb8c | ||
|
|
bbc638ab82 | ||
|
|
4f57a2e248 | ||
|
|
4c6db2c5bd | ||
|
|
bbe548bc98 | ||
|
|
d1fbf65c5d | ||
|
|
7a4a915312 | ||
|
|
4f895f744b | ||
|
|
66a831dfa8 | ||
|
|
516597a73e | ||
|
|
4eb6c9fb8e | ||
|
|
46e2ae8860 | ||
|
|
54c0cbeb66 | ||
|
|
82ddf4732a | ||
|
|
ed0cdefb44 | ||
|
|
8836be0f47 | ||
|
|
96f63f3945 | ||
|
|
d80dcd6afd | ||
|
|
2087629a47 | ||
|
|
878d68c5ef | ||
|
|
86960cdb1d | ||
|
|
fff12979a2 | ||
|
|
6c12baf4ed | ||
|
|
29449a71d4 | ||
|
|
9b983b6487 | ||
|
|
806bfa54b5 | ||
|
|
920aeeeba5 | ||
|
|
32418448de | ||
|
|
b3525c2569 | ||
|
|
19dc2873c5 | ||
|
|
25b8d9b0ca | ||
|
|
8aef3c44f4 | ||
|
|
8345c21eff | ||
|
|
36b94cf823 | ||
|
|
475cfe4af2 | ||
|
|
b851b15a73 | ||
|
|
73347c2542 | ||
|
|
bc9023399d | ||
|
|
a9c9b96eb6 | ||
|
|
1c2a3c620f | ||
|
|
9313d04726 | ||
|
|
44518fea14 | ||
|
|
91049d0db3 | ||
|
|
855514b4f3 | ||
|
|
974741a366 | ||
|
|
5d98f7e307 | ||
|
|
3ca45ae99c | ||
|
|
cf574c71d8 | ||
|
|
abe0a34fc0 | ||
|
|
71b6508ad3 | ||
|
|
55fc4fcd90 | ||
|
|
c3b2b474c6 | ||
|
|
39716ed1ba | ||
|
|
625a529f6c | ||
|
|
31d56c16d5 | ||
|
|
5776385e8c | ||
|
|
8f10de5684 | ||
|
|
e864fcf9a8 | ||
|
|
86af5f5252 | ||
|
|
daa1d582cb | ||
|
|
f197f0e5ec | ||
|
|
3599ca6845 | ||
|
|
1be4fc5ae9 | ||
|
|
ac3e5684d6 | ||
|
|
29cca4d621 | ||
|
|
f3ff80963a | ||
|
|
45e428eb25 | ||
|
|
16d2650236 | ||
|
|
2ecbf704d0 | ||
|
|
5e28ee6d1e | ||
|
|
622023de8b | ||
|
|
b49e59b904 | ||
|
|
0133c5dc9e | ||
|
|
fd414ed149 | ||
|
|
77768e9023 | ||
|
|
86be2ac12f | ||
|
|
4342d51f5a | ||
|
|
41f52a6566 | ||
|
|
cb47325f08 | ||
|
|
deed6cd96a | ||
|
|
05c32c99e4 | ||
|
|
1ca0584ba0 | ||
|
|
5ae8021aa6 | ||
|
|
9798a91e7b | ||
|
|
e9a551ae90 | ||
|
|
d42bde135f | ||
|
|
72f3d19d5a | ||
|
|
f7ecf141b5 | ||
|
|
1063ef9034 | ||
|
|
13ac182142 | ||
|
|
4bab148e3b | ||
|
|
be75f11156 | ||
|
|
093868f3ed | ||
|
|
fe534eae37 | ||
|
|
1aad442ccc | ||
|
|
57c1c9286b | ||
|
|
6030bf50e0 | ||
|
|
6d8c815558 | ||
|
|
5f5698ccc0 | ||
|
|
74c735d5fb | ||
|
|
107dec22bd | ||
|
|
0795b21c2b | ||
|
|
a7e516d6f6 | ||
|
|
f6d378255c | ||
|
|
19d831d20d | ||
|
|
00495140bd | ||
|
|
354f149338 | ||
|
|
999e1207a5 | ||
|
|
916587c2a6 | ||
|
|
db4e4e6e53 | ||
|
|
9c08220d24 | ||
|
|
88b299dd41 | ||
|
|
19af2d9e3b | ||
|
|
fa23be4424 | ||
|
|
e1f40c2db9 | ||
|
|
415dc4aa47 | ||
|
|
f2fb473ecf | ||
|
|
f95c77b8bd | ||
|
|
09d4ee1ea7 | ||
|
|
40c586ca97 | ||
|
|
708978911b | ||
|
|
2a26209889 | ||
|
|
1378657206 | ||
|
|
98d010761e | ||
|
|
798b1f4d86 | ||
|
|
29893e0c28 | ||
|
|
1994bb3cd1 | ||
|
|
f35ca812a3 | ||
|
|
abbeb4874d | ||
|
|
0f96bd7a26 | ||
|
|
dfb07e8bd2 | ||
|
|
ff4eed08bc | ||
|
|
f13dc5b903 | ||
|
|
c1431f4f9a | ||
|
|
93132fad28 | ||
|
|
2254d551f4 | ||
|
|
f2d3f54824 | ||
|
|
6fa597bc5d | ||
|
|
b02e58521d | ||
|
|
81828c6244 | ||
|
|
549250b91a | ||
|
|
409dfe22ae | ||
|
|
a6be2e46ed | ||
|
|
3fdefe8289 | ||
|
|
1f85e2a02a | ||
|
|
f99ac2104c | ||
|
|
553fc0cb1b | ||
|
|
f39c7ad47e | ||
|
|
e505ec847e | ||
|
|
90e99b2bac | ||
|
|
d25240b33b | ||
|
|
d494c23a88 | ||
|
|
17f8303e01 | ||
|
|
aadea89202 | ||
|
|
53013e9a7e | ||
|
|
30eec01f55 | ||
|
|
cc961d7762 | ||
|
|
a7528d777a | ||
|
|
13013a272f | ||
|
|
3ea96bb6e1 | ||
|
|
baf0e9c7e6 | ||
|
|
598eebfb10 | ||
|
|
5841c889ba | ||
|
|
4bd416413a | ||
|
|
be06a7d881 | ||
|
|
26df4f8142 | ||
|
|
b6a13f1114 | ||
|
|
2bcf608654 | ||
|
|
705515ace2 | ||
|
|
a97df4bb52 | ||
|
|
f6743798e2 | ||
|
|
2ea70927c8 | ||
|
|
de5b55921e | ||
|
|
2b97576b18 | ||
|
|
29e7a71c97 | ||
|
|
18fbc2149d | ||
|
|
50424d1035 | ||
|
|
e87c991975 | ||
|
|
2ab717cebb | ||
|
|
ad23c065f6 | ||
|
|
eeb52a1221 | ||
|
|
8ae05f6b33 | ||
|
|
f6630cd31d | ||
|
|
c144bd03dc | ||
|
|
7512673b09 | ||
|
|
3870d81bf6 | ||
|
|
a7dcf580ad | ||
|
|
ecfaf3a095 | ||
|
|
91bcf072a0 | ||
|
|
4802cef3ca | ||
|
|
38896198f2 | ||
|
|
012f88e56f | ||
|
|
0808f5215f | ||
|
|
247e05bb10 | ||
|
|
4308bbc156 | ||
|
|
ce1480df98 | ||
|
|
0108ad7992 | ||
|
|
e1df4e19e5 | ||
|
|
8ba98ae873 | ||
|
|
7a38368494 | ||
|
|
195b7cc30a | ||
|
|
4feaec651f | ||
|
|
82b7cb5dd0 | ||
|
|
30bbb449db | ||
|
|
14421c3609 | ||
|
|
2cf7e51061 | ||
|
|
7fd12782a1 | ||
|
|
c914a62d93 | ||
|
|
12680ad9cd | ||
|
|
0561f2ca4b | ||
|
|
58743021c8 | ||
|
|
2fb46ce5d5 | ||
|
|
8be76a56c7 | ||
|
|
2c206febab | ||
|
|
db1eac12af | ||
|
|
56e67cb434 | ||
|
|
e9d5e36738 | ||
|
|
f71fdef3fd | ||
|
|
5e92145324 | ||
|
|
89a4589b68 | ||
|
|
20991d8b53 | ||
|
|
3ab9005b2f | ||
|
|
aabc5b7cf2 | ||
|
|
afcd97c154 | ||
|
|
cbdd7eae70 | ||
|
|
6374ffea35 | ||
|
|
1a6bb97f16 | ||
|
|
4f0b95e910 | ||
|
|
a81b41cbfb | ||
|
|
465fe18a89 | ||
|
|
bd0e25f3f5 | ||
|
|
9861e82f0a | ||
|
|
fcefd592e2 | ||
|
|
8a8a7cdefc | ||
|
|
8f9e569825 | ||
|
|
b0c5327585 | ||
|
|
f1dd623ce9 | ||
|
|
ac52edd11a | ||
|
|
66d5dde956 | ||
|
|
7dfbcc8f1d | ||
|
|
28244148a2 | ||
|
|
e623c70bd0 | ||
|
|
425f384b1f | ||
|
|
1557219bad | ||
|
|
691917b956 | ||
|
|
cc0fbfbd21 | ||
|
|
5d0bf03b01 | ||
|
|
8ff99437cb | ||
|
|
ba93097bb7 | ||
|
|
de098cca4c | ||
|
|
8faa04afdb | ||
|
|
fede1b8597 | ||
|
|
8557bd031d | ||
|
|
4e6418b635 | ||
|
|
a1a5503fe9 | ||
|
|
3b94981e56 | ||
|
|
f299447216 | ||
|
|
5f0c8863fd | ||
|
|
f9d17cdee0 | ||
|
|
68a28a177f | ||
|
|
60ec05e536 | ||
|
|
730cd388d6 | ||
|
|
6549b0477c | ||
|
|
8304cae010 | ||
|
|
0ad9758cfd | ||
|
|
e5f6804421 | ||
|
|
720add72b2 | ||
|
|
693b11db1d | ||
|
|
4bf2dd04ae | ||
|
|
c6c2a4d4dd | ||
|
|
79b8e7b1cf | ||
|
|
cf4f088337 | ||
|
|
22cb20d294 | ||
|
|
1eacdd0629 | ||
|
|
67e3d57412 | ||
|
|
7924ef87b5 | ||
|
|
3dec521f75 | ||
|
|
57a33790ed | ||
|
|
484af8eb9f | ||
|
|
b8970d66a1 | ||
|
|
e78033bb85 | ||
|
|
8bd7adca47 | ||
|
|
f67aec40e8 | ||
|
|
46c7d74760 | ||
|
|
15d2ae17f8 | ||
|
|
91579c4650 | ||
|
|
79b710a108 | ||
|
|
ba296db701 | ||
|
|
c0e1616382 | ||
|
|
070deb290f | ||
|
|
76f7207463 | ||
|
|
55b2bbf937 | ||
|
|
a5716cf25c | ||
|
|
4d81280ac2 | ||
|
|
9ce44556ce | ||
|
|
be0c7d73a3 | ||
|
|
d833a9ea61 | ||
|
|
5cd74f4b53 |
3
.github/FUNDING.yml
vendored
Normal file
3
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
open_collective: meshtastic
|
||||||
50
.github/actions/build-variant/action.yml
vendored
50
.github/actions/build-variant/action.yml
vendored
@@ -27,10 +27,10 @@ inputs:
|
|||||||
description: A newline separated list of paths to store as artifacts
|
description: A newline separated list of paths to store as artifacts
|
||||||
required: false
|
required: false
|
||||||
default: ""
|
default: ""
|
||||||
include-web-ui:
|
# include-web-ui:
|
||||||
description: Include the web UI in the build
|
# description: Include the web UI in the build
|
||||||
required: false
|
# required: false
|
||||||
default: "false"
|
# default: "false"
|
||||||
arch:
|
arch:
|
||||||
description: Processor arch name
|
description: Processor arch name
|
||||||
required: true
|
required: true
|
||||||
@@ -43,29 +43,29 @@ runs:
|
|||||||
id: base
|
id: base
|
||||||
uses: ./.github/actions/setup-base
|
uses: ./.github/actions/setup-base
|
||||||
|
|
||||||
- name: Get web ui version
|
# - name: Get web ui version
|
||||||
if: inputs.include-web-ui == 'true'
|
# if: inputs.include-web-ui == 'true'
|
||||||
id: webver
|
# id: webver
|
||||||
shell: bash
|
# shell: bash
|
||||||
run: |
|
# run: |
|
||||||
echo "ver=$(cat bin/web.version)" >> $GITHUB_OUTPUT
|
# echo "ver=$(cat bin/web.version)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Pull web ui
|
# - name: Pull web ui
|
||||||
if: inputs.include-web-ui == 'true'
|
# if: inputs.include-web-ui == 'true'
|
||||||
uses: dsaltares/fetch-gh-release-asset@master
|
# uses: dsaltares/fetch-gh-release-asset@master
|
||||||
with:
|
# with:
|
||||||
repo: meshtastic/web
|
# repo: meshtastic/web
|
||||||
file: build.tar
|
# file: build.tar
|
||||||
target: build.tar
|
# target: build.tar
|
||||||
token: ${{ inputs.github_token }}
|
# token: ${{ inputs.github_token }}
|
||||||
version: tags/v${{ steps.webver.outputs.ver }}
|
# version: tags/v${{ steps.webver.outputs.ver }}
|
||||||
|
|
||||||
- name: Unpack web ui
|
# - name: Unpack web ui
|
||||||
if: inputs.include-web-ui == 'true'
|
# if: inputs.include-web-ui == 'true'
|
||||||
shell: bash
|
# shell: bash
|
||||||
run: |
|
# run: |
|
||||||
tar -xf build.tar -C data/static
|
# tar -xf build.tar -C data/static
|
||||||
rm build.tar
|
# rm build.tar
|
||||||
|
|
||||||
- name: Remove debug flags for release
|
- name: Remove debug flags for release
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
5
.github/pull_request_template.md
vendored
5
.github/pull_request_template.md
vendored
@@ -1,6 +1,7 @@
|
|||||||
## 🙏 Thank you for sending in a pull request, here's some tips to get started!
|
## 🙏 Thank you for sending in a pull request, here's some tips to get started!
|
||||||
|
|
||||||
### ❌ (Please delete all these tips and replace them with your text) ❌
|
### ❌ (Please delete all these tips and replace them with your text) ❌
|
||||||
|
|
||||||
- Before starting on some new big chunk of code, it it is optional but highly recommended to open an issue first
|
- Before starting on some new big chunk of code, it it is optional but highly recommended to open an issue first
|
||||||
to say "Hey, I think this idea X should be implemented and I'm starting work on it. My general plan is Y, any feedback
|
to say "Hey, I think this idea X should be implemented and I'm starting work on it. My general plan is Y, any feedback
|
||||||
is appreciated." This will allow other devs to potentially save you time by not accidentially duplicating work etc...
|
is appreciated." This will allow other devs to potentially save you time by not accidentially duplicating work etc...
|
||||||
@@ -15,12 +16,12 @@
|
|||||||
- If you do not have the affected hardware to test your code changes adequately against regressions, please indicate this, so that contributors and commnunity members can help test your changes.
|
- If you do not have the affected hardware to test your code changes adequately against regressions, please indicate this, so that contributors and commnunity members can help test your changes.
|
||||||
- If your PR gets accepted you can request a "Contributor" role in the Meshtastic Discord
|
- If your PR gets accepted you can request a "Contributor" role in the Meshtastic Discord
|
||||||
|
|
||||||
|
|
||||||
## 🤝 Attestations
|
## 🤝 Attestations
|
||||||
|
|
||||||
- [ ] I have tested that my proposed changes behave as described.
|
- [ ] I have tested that my proposed changes behave as described.
|
||||||
- [ ] I have tested that my proposed changes do not cause any obvious regressions on the following devices:
|
- [ ] I have tested that my proposed changes do not cause any obvious regressions on the following devices:
|
||||||
- [ ] Heltec (Lora32) V3
|
- [ ] Heltec (Lora32) V3
|
||||||
- [ ] LilyGo T-Deck
|
- [ ] LilyGo T-Deck
|
||||||
- [ ] LilyGo T-Beam
|
- [ ] LilyGo T-Beam
|
||||||
- [ ] RAK WisBlock 4631
|
- [ ] RAK WisBlock 4631
|
||||||
- [ ] Seeed Studio T-1000E tracker card
|
- [ ] Seeed Studio T-1000E tracker card
|
||||||
|
|||||||
37
.github/workflows/build_esp32.yml
vendored
37
.github/workflows/build_esp32.yml
vendored
@@ -1,37 +0,0 @@
|
|||||||
name: Build ESP32
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
board:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-esp32:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Build ESP32
|
|
||||||
id: build
|
|
||||||
uses: ./.github/actions/build-variant
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
board: ${{ inputs.board }}
|
|
||||||
remove-debug-flags: >-
|
|
||||||
./arch/esp32/esp32.ini
|
|
||||||
./arch/esp32/esp32s2.ini
|
|
||||||
./arch/esp32/esp32s3.ini
|
|
||||||
./arch/esp32/esp32c3.ini
|
|
||||||
./arch/esp32/esp32c6.ini
|
|
||||||
build-script-path: bin/build-esp32.sh
|
|
||||||
ota-firmware-source: firmware.bin
|
|
||||||
ota-firmware-target: release/bleota.bin
|
|
||||||
artifact-paths: |
|
|
||||||
release/*.bin
|
|
||||||
release/*.elf
|
|
||||||
include-web-ui: true
|
|
||||||
arch: esp32
|
|
||||||
37
.github/workflows/build_esp32_c3.yml
vendored
37
.github/workflows/build_esp32_c3.yml
vendored
@@ -1,37 +0,0 @@
|
|||||||
name: Build ESP32-C3
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
board:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-esp32-c3:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Build ESP32-C3
|
|
||||||
id: build
|
|
||||||
uses: ./.github/actions/build-variant
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
board: ${{ inputs.board }}
|
|
||||||
remove-debug-flags: >-
|
|
||||||
./arch/esp32/esp32.ini
|
|
||||||
./arch/esp32/esp32s2.ini
|
|
||||||
./arch/esp32/esp32s3.ini
|
|
||||||
./arch/esp32/esp32c3.ini
|
|
||||||
./arch/esp32/esp32c6.ini
|
|
||||||
build-script-path: bin/build-esp32.sh
|
|
||||||
ota-firmware-source: firmware-c3.bin
|
|
||||||
ota-firmware-target: release/bleota-c3.bin
|
|
||||||
artifact-paths: |
|
|
||||||
release/*.bin
|
|
||||||
release/*.elf
|
|
||||||
include-web-ui: true
|
|
||||||
arch: esp32c3
|
|
||||||
37
.github/workflows/build_esp32_c6.yml
vendored
37
.github/workflows/build_esp32_c6.yml
vendored
@@ -1,37 +0,0 @@
|
|||||||
name: Build ESP32-C6
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
board:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-esp32-c6:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Build ESP32-C6
|
|
||||||
id: build
|
|
||||||
uses: ./.github/actions/build-variant
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
board: ${{ inputs.board }}
|
|
||||||
remove-debug-flags: >-
|
|
||||||
./arch/esp32/esp32.ini
|
|
||||||
./arch/esp32/esp32s2.ini
|
|
||||||
./arch/esp32/esp32s3.ini
|
|
||||||
./arch/esp32/esp32c3.ini
|
|
||||||
./arch/esp32/esp32c6.ini
|
|
||||||
build-script-path: bin/build-esp32.sh
|
|
||||||
ota-firmware-source: firmware-c3.bin
|
|
||||||
ota-firmware-target: release/bleota-c3.bin
|
|
||||||
artifact-paths: |
|
|
||||||
release/*.bin
|
|
||||||
release/*.elf
|
|
||||||
include-web-ui: true
|
|
||||||
arch: esp32c6
|
|
||||||
37
.github/workflows/build_esp32_s3.yml
vendored
37
.github/workflows/build_esp32_s3.yml
vendored
@@ -1,37 +0,0 @@
|
|||||||
name: Build ESP32-S3
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
board:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-esp32-s3:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Build ESP32-S3
|
|
||||||
id: build
|
|
||||||
uses: ./.github/actions/build-variant
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
board: ${{ inputs.board }}
|
|
||||||
remove-debug-flags: >-
|
|
||||||
./arch/esp32/esp32.ini
|
|
||||||
./arch/esp32/esp32s2.ini
|
|
||||||
./arch/esp32/esp32s3.ini
|
|
||||||
./arch/esp32/esp32c3.ini
|
|
||||||
./arch/esp32/esp32c6.ini
|
|
||||||
build-script-path: bin/build-esp32.sh
|
|
||||||
ota-firmware-source: firmware-s3.bin
|
|
||||||
ota-firmware-target: release/bleota-s3.bin
|
|
||||||
artifact-paths: |
|
|
||||||
release/*.bin
|
|
||||||
release/*.elf
|
|
||||||
include-web-ui: true
|
|
||||||
arch: esp32s3
|
|
||||||
66
.github/workflows/build_firmware.yml
vendored
Normal file
66
.github/workflows/build_firmware.yml
vendored
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
name: Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
platform:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
pio_env:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pio-build:
|
||||||
|
name: build-${{ inputs.platform }}
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
ref: ${{github.event.pull_request.head.ref}}
|
||||||
|
repository: ${{github.event.pull_request.head.repo.full_name}}
|
||||||
|
|
||||||
|
- name: Set OTA firmware source and target
|
||||||
|
if: startsWith(inputs.platform, 'esp32')
|
||||||
|
id: ota_dir
|
||||||
|
env:
|
||||||
|
PIO_PLATFORM: ${{ inputs.platform }}
|
||||||
|
run: |
|
||||||
|
if [ "$PIO_PLATFORM" = "esp32s3" ]; then
|
||||||
|
echo "src=firmware-s3.bin" >> $GITHUB_OUTPUT
|
||||||
|
echo "tgt=release/bleota-s3.bin" >> $GITHUB_OUTPUT
|
||||||
|
elif [ "$PIO_PLATFORM" = "esp32c3" ] || [ "$PIO_PLATFORM" = "esp32c6" ]; then
|
||||||
|
echo "src=firmware-c3.bin" >> $GITHUB_OUTPUT
|
||||||
|
echo "tgt=release/bleota-c3.bin" >> $GITHUB_OUTPUT
|
||||||
|
elif [ "$PIO_PLATFORM" = "esp32" ]; then
|
||||||
|
echo "src=firmware.bin" >> $GITHUB_OUTPUT
|
||||||
|
echo "tgt=release/bleota.bin" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Build ${{ inputs.platform }}
|
||||||
|
id: build
|
||||||
|
uses: meshtastic/gh-action-firmware@main
|
||||||
|
with:
|
||||||
|
pio_platform: ${{ inputs.platform }}
|
||||||
|
pio_env: ${{ inputs.pio_env }}
|
||||||
|
pio_target: build
|
||||||
|
ota_firmware_source: ${{ steps.ota_dir.outputs.src || '' }}
|
||||||
|
ota_firmware_target: ${{ steps.ota_dir.outputs.tgt || '' }}
|
||||||
|
|
||||||
|
- name: Store binaries as an artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: firmware-${{ inputs.platform }}-${{ inputs.pio_env }}-${{ inputs.version }}.zip
|
||||||
|
overwrite: true
|
||||||
|
path: |
|
||||||
|
release/*.bin
|
||||||
|
release/*.elf
|
||||||
|
release/*.uf2
|
||||||
|
release/*.hex
|
||||||
|
release/*-ota.zip
|
||||||
30
.github/workflows/build_nrf52.yml
vendored
30
.github/workflows/build_nrf52.yml
vendored
@@ -1,30 +0,0 @@
|
|||||||
name: Build NRF52
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
board:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-nrf52:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Build NRF52
|
|
||||||
id: build
|
|
||||||
uses: ./.github/actions/build-variant
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
board: ${{ inputs.board }}
|
|
||||||
build-script-path: bin/build-nrf52.sh
|
|
||||||
artifact-paths: |
|
|
||||||
release/*.hex
|
|
||||||
release/*.uf2
|
|
||||||
release/*.elf
|
|
||||||
release/*.zip
|
|
||||||
arch: nrf52840
|
|
||||||
28
.github/workflows/build_rpi2040.yml
vendored
28
.github/workflows/build_rpi2040.yml
vendored
@@ -1,28 +0,0 @@
|
|||||||
name: Build RPI2040
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
board:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-rpi2040:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Build Raspberry Pi 2040
|
|
||||||
id: build
|
|
||||||
uses: ./.github/actions/build-variant
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
board: ${{ inputs.board }}
|
|
||||||
build-script-path: bin/build-rpi2040.sh
|
|
||||||
artifact-paths: |
|
|
||||||
release/*.uf2
|
|
||||||
release/*.elf
|
|
||||||
arch: rp2040
|
|
||||||
29
.github/workflows/build_stm32.yml
vendored
29
.github/workflows/build_stm32.yml
vendored
@@ -1,29 +0,0 @@
|
|||||||
name: Build STM32
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
board:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-stm32:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Build STM32WL
|
|
||||||
id: build
|
|
||||||
uses: ./.github/actions/build-variant
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
board: ${{ inputs.board }}
|
|
||||||
build-script-path: bin/build-stm32.sh
|
|
||||||
artifact-paths: |
|
|
||||||
release/*.hex
|
|
||||||
release/*.bin
|
|
||||||
release/*.elf
|
|
||||||
arch: stm32
|
|
||||||
8
.github/workflows/daily_packaging.yml
vendored
8
.github/workflows/daily_packaging.yml
vendored
@@ -1,7 +1,7 @@
|
|||||||
name: Daily Packaging
|
name: Daily Packaging
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: 0 9 * * *
|
- cron: 0 2 * * *
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@@ -30,7 +30,11 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
series: [plucky, oracular, noble, jammy]
|
series:
|
||||||
|
- jammy # 22.04
|
||||||
|
- noble # 24.04
|
||||||
|
- plucky # 25.04
|
||||||
|
- questing # 25.10
|
||||||
uses: ./.github/workflows/package_ppa.yml
|
uses: ./.github/workflows/package_ppa.yml
|
||||||
with:
|
with:
|
||||||
ppa_repo: ppa:meshtastic/daily
|
ppa_repo: ppa:meshtastic/daily
|
||||||
|
|||||||
230
.github/workflows/main_matrix.yml
vendored
230
.github/workflows/main_matrix.yml
vendored
@@ -30,18 +30,31 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
arch: [esp32, esp32s3, esp32c3, esp32c6, nrf52840, rp2040, stm32, check]
|
arch:
|
||||||
runs-on: ubuntu-latest
|
- esp32
|
||||||
|
- esp32s3
|
||||||
|
- esp32c3
|
||||||
|
- esp32c6
|
||||||
|
- nrf52840
|
||||||
|
- rp2040
|
||||||
|
- rp2350
|
||||||
|
- stm32
|
||||||
|
- check
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- id: checkout
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
- uses: actions/setup-python@v5
|
||||||
name: Checkout base
|
with:
|
||||||
- id: jsonStep
|
python-version: 3.x
|
||||||
|
cache: pip
|
||||||
|
- run: pip install -U platformio
|
||||||
|
- name: Generate matrix
|
||||||
|
id: jsonStep
|
||||||
run: |
|
run: |
|
||||||
if [[ "$GITHUB_HEAD_REF" == "" ]]; then
|
if [[ "$GITHUB_HEAD_REF" == "" ]]; then
|
||||||
TARGETS=$(./bin/generate_ci_matrix.py ${{matrix.arch}})
|
TARGETS=$(./bin/generate_ci_matrix.py ${{matrix.arch}})
|
||||||
else
|
else
|
||||||
TARGETS=$(./bin/generate_ci_matrix.py ${{matrix.arch}} quick)
|
TARGETS=$(./bin/generate_ci_matrix.py ${{matrix.arch}} pr)
|
||||||
fi
|
fi
|
||||||
echo "Name: $GITHUB_REF_NAME Base: $GITHUB_BASE_REF Ref: $GITHUB_REF Targets: $TARGETS"
|
echo "Name: $GITHUB_REF_NAME Base: $GITHUB_BASE_REF Ref: $GITHUB_REF Targets: $TARGETS"
|
||||||
echo "${{matrix.arch}}=$(jq -cn --argjson environments "$TARGETS" '{board: $environments}')" >> $GITHUB_OUTPUT
|
echo "${{matrix.arch}}=$(jq -cn --argjson environments "$TARGETS" '{board: $environments}')" >> $GITHUB_OUTPUT
|
||||||
@@ -52,9 +65,25 @@ jobs:
|
|||||||
esp32c6: ${{ steps.jsonStep.outputs.esp32c6 }}
|
esp32c6: ${{ steps.jsonStep.outputs.esp32c6 }}
|
||||||
nrf52840: ${{ steps.jsonStep.outputs.nrf52840 }}
|
nrf52840: ${{ steps.jsonStep.outputs.nrf52840 }}
|
||||||
rp2040: ${{ steps.jsonStep.outputs.rp2040 }}
|
rp2040: ${{ steps.jsonStep.outputs.rp2040 }}
|
||||||
|
rp2350: ${{ steps.jsonStep.outputs.rp2350 }}
|
||||||
stm32: ${{ steps.jsonStep.outputs.stm32 }}
|
stm32: ${{ steps.jsonStep.outputs.stm32 }}
|
||||||
check: ${{ steps.jsonStep.outputs.check }}
|
check: ${{ steps.jsonStep.outputs.check }}
|
||||||
|
|
||||||
|
version:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Get release version string
|
||||||
|
run: |
|
||||||
|
echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
|
||||||
|
echo "deb=$(./bin/buildinfo.py deb)" >> $GITHUB_OUTPUT
|
||||||
|
id: version
|
||||||
|
env:
|
||||||
|
BUILD_LOCATION: local
|
||||||
|
outputs:
|
||||||
|
long: ${{ steps.version.outputs.long }}
|
||||||
|
deb: ${{ steps.version.outputs.deb }}
|
||||||
|
|
||||||
check:
|
check:
|
||||||
needs: setup
|
needs: setup
|
||||||
strategy:
|
strategy:
|
||||||
@@ -72,69 +101,95 @@ jobs:
|
|||||||
run: bin/check-all.sh ${{ matrix.board }}
|
run: bin/check-all.sh ${{ matrix.board }}
|
||||||
|
|
||||||
build-esp32:
|
build-esp32:
|
||||||
needs: setup
|
needs: [setup, version]
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix: ${{ fromJson(needs.setup.outputs.esp32) }}
|
matrix: ${{ fromJson(needs.setup.outputs.esp32) }}
|
||||||
uses: ./.github/workflows/build_esp32.yml
|
uses: ./.github/workflows/build_firmware.yml
|
||||||
with:
|
with:
|
||||||
board: ${{ matrix.board }}
|
version: ${{ needs.version.outputs.long }}
|
||||||
|
pio_env: ${{ matrix.board }}
|
||||||
|
platform: esp32
|
||||||
|
|
||||||
build-esp32-s3:
|
build-esp32s3:
|
||||||
needs: setup
|
needs: [setup, version]
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix: ${{ fromJson(needs.setup.outputs.esp32s3) }}
|
matrix: ${{ fromJson(needs.setup.outputs.esp32s3) }}
|
||||||
uses: ./.github/workflows/build_esp32_s3.yml
|
uses: ./.github/workflows/build_firmware.yml
|
||||||
with:
|
with:
|
||||||
board: ${{ matrix.board }}
|
version: ${{ needs.version.outputs.long }}
|
||||||
|
pio_env: ${{ matrix.board }}
|
||||||
|
platform: esp32s3
|
||||||
|
|
||||||
build-esp32-c3:
|
build-esp32c3:
|
||||||
needs: setup
|
needs: [setup, version]
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix: ${{ fromJson(needs.setup.outputs.esp32c3) }}
|
matrix: ${{ fromJson(needs.setup.outputs.esp32c3) }}
|
||||||
uses: ./.github/workflows/build_esp32_c3.yml
|
uses: ./.github/workflows/build_firmware.yml
|
||||||
with:
|
with:
|
||||||
board: ${{ matrix.board }}
|
version: ${{ needs.version.outputs.long }}
|
||||||
|
pio_env: ${{ matrix.board }}
|
||||||
|
platform: esp32c3
|
||||||
|
|
||||||
build-esp32-c6:
|
build-esp32c6:
|
||||||
needs: setup
|
needs: [setup, version]
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix: ${{ fromJson(needs.setup.outputs.esp32c6) }}
|
matrix: ${{ fromJson(needs.setup.outputs.esp32c6) }}
|
||||||
uses: ./.github/workflows/build_esp32_c6.yml
|
uses: ./.github/workflows/build_firmware.yml
|
||||||
with:
|
with:
|
||||||
board: ${{ matrix.board }}
|
version: ${{ needs.version.outputs.long }}
|
||||||
|
pio_env: ${{ matrix.board }}
|
||||||
|
platform: esp32c6
|
||||||
|
|
||||||
build-nrf52:
|
build-nrf52840:
|
||||||
needs: setup
|
needs: [setup, version]
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix: ${{ fromJson(needs.setup.outputs.nrf52840) }}
|
matrix: ${{ fromJson(needs.setup.outputs.nrf52840) }}
|
||||||
uses: ./.github/workflows/build_nrf52.yml
|
uses: ./.github/workflows/build_firmware.yml
|
||||||
with:
|
with:
|
||||||
board: ${{ matrix.board }}
|
version: ${{ needs.version.outputs.long }}
|
||||||
|
pio_env: ${{ matrix.board }}
|
||||||
|
platform: nrf52840
|
||||||
|
|
||||||
build-rpi2040:
|
build-rp2040:
|
||||||
needs: setup
|
needs: [setup, version]
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix: ${{ fromJson(needs.setup.outputs.rp2040) }}
|
matrix: ${{ fromJson(needs.setup.outputs.rp2040) }}
|
||||||
uses: ./.github/workflows/build_rpi2040.yml
|
uses: ./.github/workflows/build_firmware.yml
|
||||||
with:
|
with:
|
||||||
board: ${{ matrix.board }}
|
version: ${{ needs.version.outputs.long }}
|
||||||
|
pio_env: ${{ matrix.board }}
|
||||||
|
platform: rp2040
|
||||||
|
|
||||||
|
build-rp2350:
|
||||||
|
needs: [setup, version]
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix: ${{ fromJson(needs.setup.outputs.rp2350) }}
|
||||||
|
uses: ./.github/workflows/build_firmware.yml
|
||||||
|
with:
|
||||||
|
version: ${{ needs.version.outputs.long }}
|
||||||
|
pio_env: ${{ matrix.board }}
|
||||||
|
platform: rp2350
|
||||||
|
|
||||||
build-stm32:
|
build-stm32:
|
||||||
needs: setup
|
needs: [setup, version]
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix: ${{ fromJson(needs.setup.outputs.stm32) }}
|
matrix: ${{ fromJson(needs.setup.outputs.stm32) }}
|
||||||
uses: ./.github/workflows/build_stm32.yml
|
uses: ./.github/workflows/build_firmware.yml
|
||||||
with:
|
with:
|
||||||
board: ${{ matrix.board }}
|
version: ${{ needs.version.outputs.long }}
|
||||||
|
pio_env: ${{ matrix.board }}
|
||||||
|
platform: stm32
|
||||||
|
|
||||||
build-debian-src:
|
build-debian-src:
|
||||||
|
if: github.repository == 'meshtastic/firmware'
|
||||||
uses: ./.github/workflows/build_debian_src.yml
|
uses: ./.github/workflows/build_debian_src.yml
|
||||||
with:
|
with:
|
||||||
series: UNRELEASED
|
series: UNRELEASED
|
||||||
@@ -209,16 +264,26 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
arch: [esp32, esp32s3, esp32c3, esp32c6, nrf52840, rp2040, stm32]
|
arch:
|
||||||
|
- esp32
|
||||||
|
- esp32s3
|
||||||
|
- esp32c3
|
||||||
|
- esp32c6
|
||||||
|
- nrf52840
|
||||||
|
- rp2040
|
||||||
|
- rp2350
|
||||||
|
- stm32
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
[
|
[
|
||||||
|
version,
|
||||||
build-esp32,
|
build-esp32,
|
||||||
build-esp32-s3,
|
build-esp32s3,
|
||||||
build-esp32-c3,
|
build-esp32c3,
|
||||||
build-esp32-c6,
|
build-esp32c6,
|
||||||
build-nrf52,
|
build-nrf52840,
|
||||||
build-rpi2040,
|
build-rp2040,
|
||||||
|
build-rp2350,
|
||||||
build-stm32,
|
build-stm32,
|
||||||
]
|
]
|
||||||
steps:
|
steps:
|
||||||
@@ -237,17 +302,13 @@ jobs:
|
|||||||
- name: Display structure of downloaded files
|
- name: Display structure of downloaded files
|
||||||
run: ls -R
|
run: ls -R
|
||||||
|
|
||||||
- name: Get release version string
|
|
||||||
run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
|
|
||||||
id: version
|
|
||||||
|
|
||||||
- name: Move files up
|
- name: Move files up
|
||||||
run: mv -b -t ./ ./bin/device-*.sh ./bin/device-*.bat
|
run: mv -b -t ./ ./bin/device-*.sh ./bin/device-*.bat
|
||||||
|
|
||||||
- name: Repackage in single firmware zip
|
- name: Repackage in single firmware zip
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: firmware-${{matrix.arch}}-${{ steps.version.outputs.long }}
|
name: firmware-${{matrix.arch}}-${{ needs.version.outputs.long }}
|
||||||
overwrite: true
|
overwrite: true
|
||||||
path: |
|
path: |
|
||||||
./firmware-*.bin
|
./firmware-*.bin
|
||||||
@@ -257,14 +318,13 @@ jobs:
|
|||||||
./device-*.sh
|
./device-*.sh
|
||||||
./device-*.bat
|
./device-*.bat
|
||||||
./littlefs-*.bin
|
./littlefs-*.bin
|
||||||
./littlefswebui-*.bin
|
|
||||||
./bleota*bin
|
./bleota*bin
|
||||||
./Meshtastic_nRF52_factory_erase*.uf2
|
./Meshtastic_nRF52_factory_erase*.uf2
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: firmware-${{matrix.arch}}-${{ steps.version.outputs.long }}
|
name: firmware-${{matrix.arch}}-${{ needs.version.outputs.long }}
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
path: ./output
|
path: ./output
|
||||||
|
|
||||||
@@ -278,12 +338,12 @@ jobs:
|
|||||||
chmod +x ./output/device-update.sh
|
chmod +x ./output/device-update.sh
|
||||||
|
|
||||||
- name: Zip firmware
|
- name: Zip firmware
|
||||||
run: zip -j -9 -r ./firmware-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip ./output
|
run: zip -j -9 -r ./firmware-${{matrix.arch}}-${{ needs.version.outputs.long }}.zip ./output
|
||||||
|
|
||||||
- name: Repackage in single elfs zip
|
- name: Repackage in single elfs zip
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip
|
name: debug-elfs-${{matrix.arch}}-${{ needs.version.outputs.long }}.zip
|
||||||
overwrite: true
|
overwrite: true
|
||||||
path: ./*.elf
|
path: ./*.elf
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
@@ -291,8 +351,8 @@ jobs:
|
|||||||
- uses: scruplelesswizard/comment-artifact@main
|
- uses: scruplelesswizard/comment-artifact@main
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
with:
|
with:
|
||||||
name: firmware-${{matrix.arch}}-${{ steps.version.outputs.long }}
|
name: firmware-${{matrix.arch}}-${{ needs.version.outputs.long }}
|
||||||
description: "Download firmware-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip. This artifact will be available for 90 days from creation"
|
description: "Download firmware-${{matrix.arch}}-${{ needs.version.outputs.long }}.zip. This artifact will be available for 90 days from creation"
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
release-artifacts:
|
release-artifacts:
|
||||||
@@ -301,6 +361,7 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
needs:
|
needs:
|
||||||
|
- version
|
||||||
- gather-artifacts
|
- gather-artifacts
|
||||||
- build-debian-src
|
- build-debian-src
|
||||||
- package-pio-deps-native-tft
|
- package-pio-deps-native-tft
|
||||||
@@ -313,44 +374,36 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: 3.x
|
python-version: 3.x
|
||||||
|
|
||||||
- name: Get release version string
|
|
||||||
run: |
|
|
||||||
echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
|
|
||||||
echo "deb=$(./bin/buildinfo.py deb)" >> $GITHUB_OUTPUT
|
|
||||||
id: version
|
|
||||||
env:
|
|
||||||
BUILD_LOCATION: local
|
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
id: create_release
|
id: create_release
|
||||||
with:
|
with:
|
||||||
draft: true
|
draft: true
|
||||||
prerelease: true
|
prerelease: true
|
||||||
name: Meshtastic Firmware ${{ steps.version.outputs.long }} Alpha
|
name: Meshtastic Firmware ${{ needs.version.outputs.long }} Alpha
|
||||||
tag_name: v${{ steps.version.outputs.long }}
|
tag_name: v${{ needs.version.outputs.long }}
|
||||||
body: |
|
body: |
|
||||||
Autogenerated by github action, developer should edit as required before publishing...
|
Autogenerated by github action, developer should edit as required before publishing...
|
||||||
|
|
||||||
- name: Download source deb
|
- name: Download source deb
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
pattern: firmware-debian-${{ steps.version.outputs.deb }}~UNRELEASED-src
|
pattern: firmware-debian-${{ needs.version.outputs.deb }}~UNRELEASED-src
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
path: ./output/debian-src
|
path: ./output/debian-src
|
||||||
|
|
||||||
- name: Download `native-tft` pio deps
|
- name: Download `native-tft` pio deps
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
pattern: platformio-deps-native-tft-${{ steps.version.outputs.long }}
|
pattern: platformio-deps-native-tft-${{ needs.version.outputs.long }}
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
path: ./output/pio-deps-native-tft
|
path: ./output/pio-deps-native-tft
|
||||||
|
|
||||||
- name: Zip Linux sources
|
- name: Zip Linux sources
|
||||||
working-directory: output
|
working-directory: output
|
||||||
run: |
|
run: |
|
||||||
zip -j -9 -r ./meshtasticd-${{ steps.version.outputs.deb }}-src.zip ./debian-src
|
zip -j -9 -r ./meshtasticd-${{ needs.version.outputs.deb }}-src.zip ./debian-src
|
||||||
zip -9 -r ./platformio-deps-native-tft-${{ steps.version.outputs.long }}.zip ./pio-deps-native-tft
|
zip -9 -r ./platformio-deps-native-tft-${{ needs.version.outputs.long }}.zip ./pio-deps-native-tft
|
||||||
|
|
||||||
# For diagnostics
|
# For diagnostics
|
||||||
- name: Display structure of downloaded files
|
- name: Display structure of downloaded files
|
||||||
@@ -360,8 +413,8 @@ jobs:
|
|||||||
# Only run when targeting master branch with workflow_dispatch
|
# Only run when targeting master branch with workflow_dispatch
|
||||||
if: ${{ github.ref_name == 'master' }}
|
if: ${{ github.ref_name == 'master' }}
|
||||||
run: |
|
run: |
|
||||||
gh release upload v${{ steps.version.outputs.long }} ./output/meshtasticd-${{ steps.version.outputs.deb }}-src.zip
|
gh release upload v${{ needs.version.outputs.long }} ./output/meshtasticd-${{ needs.version.outputs.deb }}-src.zip
|
||||||
gh release upload v${{ steps.version.outputs.long }} ./output/platformio-deps-native-tft-${{ steps.version.outputs.long }}.zip
|
gh release upload v${{ needs.version.outputs.long }} ./output/platformio-deps-native-tft-${{ needs.version.outputs.long }}.zip
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
@@ -369,10 +422,18 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
arch: [esp32, esp32s3, esp32c3, esp32c6, nrf52840, rp2040, stm32]
|
arch:
|
||||||
|
- esp32
|
||||||
|
- esp32s3
|
||||||
|
- esp32c3
|
||||||
|
- esp32c6
|
||||||
|
- nrf52840
|
||||||
|
- rp2040
|
||||||
|
- rp2350
|
||||||
|
- stm32
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name == 'workflow_dispatch' }}
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||||
needs: [release-artifacts]
|
needs: [release-artifacts, version]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -382,13 +443,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: 3.x
|
python-version: 3.x
|
||||||
|
|
||||||
- name: Get release version string
|
|
||||||
run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
|
|
||||||
id: version
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
pattern: firmware-${{matrix.arch}}-${{ steps.version.outputs.long }}
|
pattern: firmware-${{matrix.arch}}-${{ needs.version.outputs.long }}
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
path: ./output
|
path: ./output
|
||||||
|
|
||||||
@@ -401,16 +458,16 @@ jobs:
|
|||||||
chmod +x ./output/device-update.sh
|
chmod +x ./output/device-update.sh
|
||||||
|
|
||||||
- name: Zip firmware
|
- name: Zip firmware
|
||||||
run: zip -j -9 -r ./firmware-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip ./output
|
run: zip -j -9 -r ./firmware-${{matrix.arch}}-${{ needs.version.outputs.long }}.zip ./output
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip
|
name: debug-elfs-${{matrix.arch}}-${{ needs.version.outputs.long }}.zip
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
path: ./elfs
|
path: ./elfs
|
||||||
|
|
||||||
- name: Zip debug elfs
|
- name: Zip debug elfs
|
||||||
run: zip -j -9 -r ./debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip ./elfs
|
run: zip -j -9 -r ./debug-elfs-${{matrix.arch}}-${{ needs.version.outputs.long }}.zip ./elfs
|
||||||
|
|
||||||
# For diagnostics
|
# For diagnostics
|
||||||
- name: Display structure of downloaded files
|
- name: Display structure of downloaded files
|
||||||
@@ -420,17 +477,18 @@ jobs:
|
|||||||
# Only run when targeting master branch with workflow_dispatch
|
# Only run when targeting master branch with workflow_dispatch
|
||||||
if: ${{ github.ref_name == 'master' }}
|
if: ${{ github.ref_name == 'master' }}
|
||||||
run: |
|
run: |
|
||||||
gh release upload v${{ steps.version.outputs.long }} ./firmware-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip
|
gh release upload v${{ needs.version.outputs.long }} ./firmware-${{matrix.arch}}-${{ needs.version.outputs.long }}.zip
|
||||||
gh release upload v${{ steps.version.outputs.long }} ./debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip
|
gh release upload v${{ needs.version.outputs.long }} ./debug-elfs-${{matrix.arch}}-${{ needs.version.outputs.long }}.zip
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
publish-firmware:
|
publish-firmware:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-24.04
|
||||||
if: ${{ github.event_name == 'workflow_dispatch' }}
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||||
needs: [release-firmware]
|
needs: [release-firmware, version]
|
||||||
env:
|
env:
|
||||||
targets: esp32,esp32s3,esp32c3,esp32c6,nrf52840,rp2040,stm32
|
targets: |-
|
||||||
|
esp32,esp32s3,esp32c3,esp32c6,nrf52840,rp2040,rp2350,stm32
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -440,13 +498,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: 3.x
|
python-version: 3.x
|
||||||
|
|
||||||
- name: Get release version string
|
|
||||||
run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
|
|
||||||
id: version
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
pattern: firmware-{${{ env.targets }}}-${{ steps.version.outputs.long }}
|
pattern: firmware-{${{ env.targets }}}-${{ needs.version.outputs.long }}
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
path: ./publish
|
path: ./publish
|
||||||
|
|
||||||
@@ -460,9 +514,9 @@ jobs:
|
|||||||
external_repository: meshtastic/meshtastic.github.io
|
external_repository: meshtastic/meshtastic.github.io
|
||||||
publish_branch: master
|
publish_branch: master
|
||||||
publish_dir: ./publish
|
publish_dir: ./publish
|
||||||
destination_dir: ${{ env.DEST_PREFIX }}firmware-${{ steps.version.outputs.long }}
|
destination_dir: ${{ env.DEST_PREFIX }}firmware-${{ needs.version.outputs.long }}
|
||||||
keep_files: true
|
keep_files: true
|
||||||
user_name: github-actions[bot]
|
user_name: github-actions[bot]
|
||||||
user_email: github-actions[bot]@users.noreply.github.com
|
user_email: github-actions[bot]@users.noreply.github.com
|
||||||
commit_message: ${{ steps.version.outputs.long }}
|
commit_message: ${{ needs.version.outputs.long }}
|
||||||
enable_jekyll: true
|
enable_jekyll: true
|
||||||
|
|||||||
2
.github/workflows/nightly.yml
vendored
2
.github/workflows/nightly.yml
vendored
@@ -8,6 +8,7 @@ permissions: read-all
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
trunk_check:
|
trunk_check:
|
||||||
|
if: github.repository == 'meshtastic/firmware'
|
||||||
name: Trunk Check and Upload
|
name: Trunk Check and Upload
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
|
||||||
@@ -21,6 +22,7 @@ jobs:
|
|||||||
trunk-token: ${{ secrets.TRUNK_TOKEN }}
|
trunk-token: ${{ secrets.TRUNK_TOKEN }}
|
||||||
|
|
||||||
trunk_upgrade:
|
trunk_upgrade:
|
||||||
|
if: github.repository == 'meshtastic/firmware'
|
||||||
# See: https://github.com/trunk-io/trunk-action/blob/v1/readme.md#automatic-upgrades
|
# See: https://github.com/trunk-io/trunk-action/blob/v1/readme.md#automatic-upgrades
|
||||||
name: Trunk Upgrade (PR)
|
name: Trunk Upgrade (PR)
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
|||||||
24
.github/workflows/pr_enforce_labels.yml
vendored
Normal file
24
.github/workflows/pr_enforce_labels.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
name: Check PR Labels
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened, edited, labeled, unlabeled, synchronize, reopened]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
pull-requests: read
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-label:
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
steps:
|
||||||
|
- name: Check for PR labels
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const labels = context.payload.pull_request.labels.map(label => label.name);
|
||||||
|
const requiredLabels = ['bugfix', 'enhancement', 'hardware-support', 'dependencies', 'submodules', 'github_actions', 'trunk'];
|
||||||
|
const hasRequiredLabel = labels.some(label => requiredLabels.includes(label));
|
||||||
|
if (!hasRequiredLabel) {
|
||||||
|
core.setFailed(`PR must have at least one of the following labels before it can be merged: ${requiredLabels.join(', ')}.`);
|
||||||
|
}
|
||||||
10
.github/workflows/release_channels.yml
vendored
10
.github/workflows/release_channels.yml
vendored
@@ -20,7 +20,11 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
series: [plucky, oracular, noble, jammy]
|
series:
|
||||||
|
- jammy # 22.04
|
||||||
|
- noble # 24.04
|
||||||
|
- plucky # 25.04
|
||||||
|
# - questing # 25.10
|
||||||
uses: ./.github/workflows/package_ppa.yml
|
uses: ./.github/workflows/package_ppa.yml
|
||||||
with:
|
with:
|
||||||
ppa_repo: |-
|
ppa_repo: |-
|
||||||
@@ -98,8 +102,10 @@ jobs:
|
|||||||
uses: peter-evans/create-pull-request@v7
|
uses: peter-evans/create-pull-request@v7
|
||||||
with:
|
with:
|
||||||
base: ${{ github.event.repository.default_branch }}
|
base: ${{ github.event.repository.default_branch }}
|
||||||
|
branch: create-pull-request/bump-version
|
||||||
|
labels: github_actions
|
||||||
title: Bump release version
|
title: Bump release version
|
||||||
commit-message: automated bumps
|
commit-message: Automated version bumps
|
||||||
add-paths: |
|
add-paths: |
|
||||||
version.properties
|
version.properties
|
||||||
debian/changelog
|
debian/changelog
|
||||||
|
|||||||
1
.github/workflows/sec_sast_semgrep_cron.yml
vendored
1
.github/workflows/sec_sast_semgrep_cron.yml
vendored
@@ -13,6 +13,7 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
semgrep-full:
|
semgrep-full:
|
||||||
|
if: github.repository == 'meshtastic/firmware'
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
container:
|
container:
|
||||||
image: semgrep/semgrep
|
image: semgrep/semgrep
|
||||||
|
|||||||
1
.github/workflows/stale_bot.yml
vendored
1
.github/workflows/stale_bot.yml
vendored
@@ -11,6 +11,7 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
stale_issues:
|
stale_issues:
|
||||||
|
if: github.repository == 'meshtastic/firmware'
|
||||||
name: Close Stale Issues
|
name: Close Stale Issues
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
|||||||
2
.github/workflows/test_native.yml
vendored
2
.github/workflows/test_native.yml
vendored
@@ -143,7 +143,7 @@ jobs:
|
|||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
|
|
||||||
- name: Test Report
|
- name: Test Report
|
||||||
uses: dorny/test-reporter@v2.1.0
|
uses: dorny/test-reporter@v2.1.1
|
||||||
with:
|
with:
|
||||||
name: PlatformIO Tests
|
name: PlatformIO Tests
|
||||||
path: testreport.xml
|
path: testreport.xml
|
||||||
|
|||||||
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@@ -12,9 +12,11 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
native-tests:
|
native-tests:
|
||||||
|
if: github.repository == 'meshtastic/firmware'
|
||||||
uses: ./.github/workflows/test_native.yml
|
uses: ./.github/workflows/test_native.yml
|
||||||
|
|
||||||
hardware-tests:
|
hardware-tests:
|
||||||
|
if: github.repository == 'meshtastic/firmware'
|
||||||
runs-on: test-runner
|
runs-on: test-runner
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
|
|||||||
3
.github/workflows/update_protobufs.yml
vendored
3
.github/workflows/update_protobufs.yml
vendored
@@ -33,7 +33,10 @@ jobs:
|
|||||||
- name: Create pull request
|
- name: Create pull request
|
||||||
uses: peter-evans/create-pull-request@v7
|
uses: peter-evans/create-pull-request@v7
|
||||||
with:
|
with:
|
||||||
|
branch: create-pull-request/update-protobufs
|
||||||
|
labels: submodules
|
||||||
title: Update protobufs and classes
|
title: Update protobufs and classes
|
||||||
|
commit-message: Update protobufs
|
||||||
add-paths: |
|
add-paths: |
|
||||||
protobufs
|
protobufs
|
||||||
src/mesh
|
src/mesh
|
||||||
|
|||||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -37,4 +37,7 @@ release/
|
|||||||
.vscode/extensions.json
|
.vscode/extensions.json
|
||||||
/compile_commands.json
|
/compile_commands.json
|
||||||
src/mesh/raspihttp/certificate.pem
|
src/mesh/raspihttp/certificate.pem
|
||||||
src/mesh/raspihttp/private_key.pem
|
src/mesh/raspihttp/private_key.pem
|
||||||
|
|
||||||
|
# Ignore logo (set at build time with platformio-custom.py)
|
||||||
|
data/boot/logo.*
|
||||||
|
|||||||
@@ -4,31 +4,31 @@ cli:
|
|||||||
plugins:
|
plugins:
|
||||||
sources:
|
sources:
|
||||||
- id: trunk
|
- id: trunk
|
||||||
ref: v1.7.0
|
ref: v1.7.1
|
||||||
uri: https://github.com/trunk-io/plugins
|
uri: https://github.com/trunk-io/plugins
|
||||||
lint:
|
lint:
|
||||||
enabled:
|
enabled:
|
||||||
- checkov@3.2.435
|
- checkov@3.2.451
|
||||||
- renovate@40.34.4
|
- renovate@41.40.0
|
||||||
- prettier@3.5.3
|
- prettier@3.6.2
|
||||||
- trufflehog@3.88.34
|
- trufflehog@3.90.1
|
||||||
- yamllint@1.37.1
|
- yamllint@1.37.1
|
||||||
- bandit@1.8.3
|
- bandit@1.8.6
|
||||||
- trivy@0.62.1
|
- trivy@0.64.1
|
||||||
- taplo@0.9.3
|
- taplo@0.9.3
|
||||||
- ruff@0.11.11
|
- ruff@0.12.4
|
||||||
- isort@6.0.1
|
- isort@6.0.1
|
||||||
- markdownlint@0.45.0
|
- markdownlint@0.45.0
|
||||||
- oxipng@9.1.5
|
- oxipng@9.1.5
|
||||||
- svgo@3.3.2
|
- svgo@4.0.0
|
||||||
- actionlint@1.7.7
|
- actionlint@1.7.7
|
||||||
- flake8@7.2.0
|
- flake8@7.3.0
|
||||||
- hadolint@2.12.1-beta
|
- hadolint@2.12.1-beta
|
||||||
- shfmt@3.6.0
|
- shfmt@3.6.0
|
||||||
- shellcheck@0.10.0
|
- shellcheck@0.10.0
|
||||||
- black@25.1.0
|
- black@25.1.0
|
||||||
- git-diff-check
|
- git-diff-check
|
||||||
- gitleaks@8.26.0
|
- gitleaks@8.28.0
|
||||||
- clang-format@16.0.3
|
- clang-format@16.0.3
|
||||||
ignore:
|
ignore:
|
||||||
- linters: [ALL]
|
- linters: [ALL]
|
||||||
|
|||||||
@@ -37,3 +37,4 @@ Join our community and help improve Meshtastic! 🚀
|
|||||||
## Stats
|
## Stats
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# trunk-ignore-all(hadolint/DL3018): Do not pin apk package versions
|
# trunk-ignore-all(hadolint/DL3018): Do not pin apk package versions
|
||||||
# trunk-ignore-all(hadolint/DL3013): Do not pin pip package versions
|
# trunk-ignore-all(hadolint/DL3013): Do not pin pip package versions
|
||||||
|
|
||||||
FROM python:3.13-alpine3.21 AS builder
|
FROM python:3.13-alpine3.22 AS builder
|
||||||
ARG PIO_ENV=native
|
ARG PIO_ENV=native
|
||||||
ENV PIP_ROOT_USER_ACTION=ignore
|
ENV PIP_ROOT_USER_ACTION=ignore
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ RUN bash ./bin/build-native.sh "$PIO_ENV" && \
|
|||||||
|
|
||||||
# ##### PRODUCTION BUILD #############
|
# ##### PRODUCTION BUILD #############
|
||||||
|
|
||||||
FROM alpine:3.21
|
FROM alpine:3.22
|
||||||
LABEL org.opencontainers.image.title="Meshtastic" \
|
LABEL org.opencontainers.image.title="Meshtastic" \
|
||||||
org.opencontainers.image.description="Alpine Meshtastic daemon" \
|
org.opencontainers.image.description="Alpine Meshtastic daemon" \
|
||||||
org.opencontainers.image.url="https://meshtastic.org" \
|
org.opencontainers.image.url="https://meshtastic.org" \
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ extends = arduino_base
|
|||||||
custom_esp32_kind = esp32
|
custom_esp32_kind = esp32
|
||||||
platform =
|
platform =
|
||||||
# renovate: datasource=custom.pio depName=platformio/espressif32 packageName=platformio/platform/espressif32
|
# renovate: datasource=custom.pio depName=platformio/espressif32 packageName=platformio/platform/espressif32
|
||||||
platformio/espressif32@6.10.0
|
platformio/espressif32@6.11.0
|
||||||
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2xx0> -<mesh/eth/> -<mesh/raspihttp>
|
${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2xx0> -<mesh/eth/> -<mesh/raspihttp>
|
||||||
@@ -49,13 +49,13 @@ lib_deps =
|
|||||||
${environmental_extra.lib_deps}
|
${environmental_extra.lib_deps}
|
||||||
${radiolib_base.lib_deps}
|
${radiolib_base.lib_deps}
|
||||||
# renovate: datasource=git-refs depName=meshtastic-esp32_https_server packageName=https://github.com/meshtastic/esp32_https_server gitBranch=master
|
# renovate: datasource=git-refs depName=meshtastic-esp32_https_server packageName=https://github.com/meshtastic/esp32_https_server gitBranch=master
|
||||||
https://github.com/meshtastic/esp32_https_server/archive/896f1771ceb5979987a0b41028bf1b4e7aad419b.zip
|
https://github.com/meshtastic/esp32_https_server/archive/3223704846752e6d545139204837bdb2a55459ca.zip
|
||||||
# renovate: datasource=custom.pio depName=NimBLE-Arduino packageName=h2zero/library/NimBLE-Arduino
|
# renovate: datasource=custom.pio depName=NimBLE-Arduino packageName=h2zero/library/NimBLE-Arduino
|
||||||
h2zero/NimBLE-Arduino@^1.4.3
|
h2zero/NimBLE-Arduino@^1.4.3
|
||||||
# renovate: datasource=git-refs depName=libpax packageName=https://github.com/dbinfrago/libpax gitBranch=master
|
# renovate: datasource=git-refs depName=libpax packageName=https://github.com/dbinfrago/libpax gitBranch=master
|
||||||
https://github.com/dbinfrago/libpax/archive/3cdc0371c375676a97967547f4065607d4c53fd1.zip
|
https://github.com/dbinfrago/libpax/archive/3cdc0371c375676a97967547f4065607d4c53fd1.zip
|
||||||
# renovate: datasource=custom.pio depName=XPowersLib packageName=lewisxhe/library/XPowersLib
|
# renovate: datasource=github-tags depName=XPowersLib packageName=lewisxhe/XPowersLib
|
||||||
lewisxhe/XPowersLib@^0.2.7
|
https://github.com/lewisxhe/XPowersLib/archive/v0.3.0.zip
|
||||||
# renovate: datasource=git-refs depName=meshtastic-ESP32_Codec2 packageName=https://github.com/meshtastic/ESP32_Codec2 gitBranch=master
|
# renovate: datasource=git-refs depName=meshtastic-ESP32_Codec2 packageName=https://github.com/meshtastic/ESP32_Codec2 gitBranch=master
|
||||||
https://github.com/meshtastic/ESP32_Codec2/archive/633326c78ac251c059ab3a8c430fcdf25b41672f.zip
|
https://github.com/meshtastic/ESP32_Codec2/archive/633326c78ac251c059ab3a8c430fcdf25b41672f.zip
|
||||||
# renovate: datasource=custom.pio depName=rweather/Crypto packageName=rweather/library/Crypto
|
# renovate: datasource=custom.pio depName=rweather/Crypto packageName=rweather/library/Crypto
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ lib_deps =
|
|||||||
${environmental_extra.lib_deps}
|
${environmental_extra.lib_deps}
|
||||||
${radiolib_base.lib_deps}
|
${radiolib_base.lib_deps}
|
||||||
# renovate: datasource=custom.pio depName=XPowersLib packageName=lewisxhe/library/XPowersLib
|
# renovate: datasource=custom.pio depName=XPowersLib packageName=lewisxhe/library/XPowersLib
|
||||||
lewisxhe/XPowersLib@^0.2.7
|
lewisxhe/XPowersLib@0.3.0
|
||||||
# renovate: datasource=git-refs depName=meshtastic-ESP32_Codec2 packageName=https://github.com/meshtastic/ESP32_Codec2 gitBranch=master
|
# renovate: datasource=git-refs depName=meshtastic-ESP32_Codec2 packageName=https://github.com/meshtastic/ESP32_Codec2 gitBranch=master
|
||||||
https://github.com/meshtastic/ESP32_Codec2/archive/633326c78ac251c059ab3a8c430fcdf25b41672f.zip
|
https://github.com/meshtastic/ESP32_Codec2/archive/633326c78ac251c059ab3a8c430fcdf25b41672f.zip
|
||||||
# renovate: datasource=custom.pio depName=rweather/Crypto packageName=rweather/library/Crypto
|
# renovate: datasource=custom.pio depName=rweather/Crypto packageName=rweather/library/Crypto
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
[portduino_base]
|
[portduino_base]
|
||||||
platform =
|
platform =
|
||||||
# renovate: datasource=git-refs depName=platform-native packageName=https://github.com/meshtastic/platform-native gitBranch=develop
|
# renovate: datasource=git-refs depName=platform-native packageName=https://github.com/meshtastic/platform-native gitBranch=develop
|
||||||
https://github.com/meshtastic/platform-native/archive/622341c6de8a239704318b10c3dbb00c21a3eab3.zip
|
https://github.com/meshtastic/platform-native/archive/6cb7a455b440dd0738e8ed74a18136ed5cf7ea63.zip
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
@@ -30,6 +30,8 @@ lib_deps =
|
|||||||
lovyan03/LovyanGFX@^1.2.0
|
lovyan03/LovyanGFX@^1.2.0
|
||||||
# renovate: datasource=git-refs depName=libch341-spi-userspace packageName=https://github.com/pine64/libch341-spi-userspace gitBranch=main
|
# renovate: datasource=git-refs depName=libch341-spi-userspace packageName=https://github.com/pine64/libch341-spi-userspace gitBranch=main
|
||||||
https://github.com/pine64/libch341-spi-userspace/archive/af9bc27c9c30fa90772279925b7c5913dff789b4.zip
|
https://github.com/pine64/libch341-spi-userspace/archive/af9bc27c9c30fa90772279925b7c5913dff789b4.zip
|
||||||
|
# renovate: datasource=custom.pio depName=adafruit/Adafruit seesaw Library packageName=adafruit/library/Adafruit seesaw Library
|
||||||
|
adafruit/Adafruit seesaw Library@1.7.9
|
||||||
|
|
||||||
build_flags =
|
build_flags =
|
||||||
${arduino_base.build_flags}
|
${arduino_base.build_flags}
|
||||||
@@ -37,7 +39,7 @@ build_flags =
|
|||||||
-Isrc/platform/portduino
|
-Isrc/platform/portduino
|
||||||
-DRADIOLIB_EEPROM_UNSUPPORTED
|
-DRADIOLIB_EEPROM_UNSUPPORTED
|
||||||
-DPORTDUINO_LINUX_HARDWARE
|
-DPORTDUINO_LINUX_HARDWARE
|
||||||
-DHAS_UDP_MULTICAST
|
-DHAS_UDP_MULTICAST=1
|
||||||
-lpthread
|
-lpthread
|
||||||
-lstdc++fs
|
-lstdc++fs
|
||||||
-lbluetooth
|
-lbluetooth
|
||||||
@@ -48,4 +50,7 @@ build_flags =
|
|||||||
-std=gnu17
|
-std=gnu17
|
||||||
-std=c++17
|
-std=c++17
|
||||||
|
|
||||||
lib_ignore = Adafruit NeoPixel
|
lib_ignore =
|
||||||
|
Adafruit NeoPixel
|
||||||
|
Adafruit ST7735 and ST7789 Library
|
||||||
|
SD
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
extends = arduino_base
|
extends = arduino_base
|
||||||
platform =
|
platform =
|
||||||
# renovate: datasource=custom.pio depName=platformio/ststm32 packageName=platformio/platform/ststm32
|
# renovate: datasource=custom.pio depName=platformio/ststm32 packageName=platformio/platform/ststm32
|
||||||
platformio/ststm32@19.1.0
|
platformio/ststm32@19.3.0
|
||||||
platform_packages =
|
platform_packages =
|
||||||
# TODO renovate
|
# TODO renovate
|
||||||
platformio/framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32/archive/2.10.1.zip
|
platformio/framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32/archive/2.10.1.zip
|
||||||
@@ -16,18 +16,27 @@ build_flags =
|
|||||||
${arduino_base.build_flags}
|
${arduino_base.build_flags}
|
||||||
-flto
|
-flto
|
||||||
-Isrc/platform/stm32wl -g
|
-Isrc/platform/stm32wl -g
|
||||||
-DMESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
-DMESHTASTIC_EXCLUDE_AUDIO=1
|
||||||
-DMESHTASTIC_EXCLUDE_INPUTBROKER
|
-DMESHTASTIC_EXCLUDE_ATAK=1 ; ATAK is quite big, disable it for big flash savings.
|
||||||
-DMESHTASTIC_EXCLUDE_I2C
|
-DMESHTASTIC_EXCLUDE_INPUTBROKER=1
|
||||||
-DMESHTASTIC_EXCLUDE_POWERMON
|
-DMESHTASTIC_EXCLUDE_POWERMON=1
|
||||||
-DMESHTASTIC_EXCLUDE_SCREEN
|
-DMESHTASTIC_EXCLUDE_SCREEN=1
|
||||||
-DMESHTASTIC_EXCLUDE_MQTT
|
-DMESHTASTIC_EXCLUDE_MQTT=1
|
||||||
-DMESHTASTIC_EXCLUDE_BLUETOOTH
|
-DMESHTASTIC_EXCLUDE_BLUETOOTH=1
|
||||||
-DMESHTASTIC_EXCLUDE_GPS
|
-DMESHTASTIC_EXCLUDE_WIFI=1
|
||||||
;-DDEBUG_MUTE
|
-DMESHTASTIC_EXCLUDE_TZ=1 ; Exclude TZ to save some flash space.
|
||||||
|
-DSERIAL_RX_BUFFER_SIZE=256 ; For GPS - the default of 64 is too small.
|
||||||
|
-DHAS_SCREEN=0 ; Always disable screen for STM32, it is not supported.
|
||||||
|
-DPIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF ; This is REQUIRED for at least traceroute debug prints - without it the length ends up uninitialized.
|
||||||
|
-DDEBUG_MUTE ; You can #undef DEBUG_MUTE in certain source files if you need the logs.
|
||||||
-fmerge-all-constants
|
-fmerge-all-constants
|
||||||
-ffunction-sections
|
-ffunction-sections
|
||||||
-fdata-sections
|
-fdata-sections
|
||||||
|
-DRADIOLIB_EXCLUDE_SX128X=1
|
||||||
|
-DRADIOLIB_EXCLUDE_SX127X=1
|
||||||
|
-DRADIOLIB_EXCLUDE_LR11X0=1
|
||||||
|
-DHAL_DAC_MODULE_ONLY
|
||||||
|
-DHAL_RNG_MODULE_ENABLED
|
||||||
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
${arduino_base.build_src_filter} -<platform/esp32/> -<nimble/> -<mesh/api/> -<mesh/wifi/> -<mesh/http/> -<modules/esp32> -<mesh/eth/> -<input> -<buzz> -<modules/RemoteHardwareModule.cpp> -<platform/nrf52> -<platform/portduino> -<platform/rp2xx0> -<mesh/raspihttp>
|
${arduino_base.build_src_filter} -<platform/esp32/> -<nimble/> -<mesh/api/> -<mesh/wifi/> -<mesh/http/> -<modules/esp32> -<mesh/eth/> -<input> -<buzz> -<modules/RemoteHardwareModule.cpp> -<platform/nrf52> -<platform/portduino> -<platform/rp2xx0> -<mesh/raspihttp>
|
||||||
@@ -39,9 +48,9 @@ debug_tool = stlink
|
|||||||
lib_deps =
|
lib_deps =
|
||||||
${env.lib_deps}
|
${env.lib_deps}
|
||||||
${radiolib_base.lib_deps}
|
${radiolib_base.lib_deps}
|
||||||
|
|
||||||
# renovate: datasource=git-refs depName=caveman99-stm32-Crypto packageName=https://github.com/caveman99/Crypto gitBranch=main
|
# renovate: datasource=git-refs depName=caveman99-stm32-Crypto packageName=https://github.com/caveman99/Crypto gitBranch=main
|
||||||
https://github.com/caveman99/Crypto/archive/eae9c768054118a9399690f8af202853d1ae8516.zip
|
https://github.com/caveman99/Crypto/archive/eae9c768054118a9399690f8af202853d1ae8516.zip
|
||||||
|
|
||||||
lib_ignore =
|
lib_ignore =
|
||||||
mathertel/OneButton@2.6.1
|
OneButton
|
||||||
Wire
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ rm -f $OUTDIR/firmware*
|
|||||||
rm -r $OUTDIR/* || true
|
rm -r $OUTDIR/* || true
|
||||||
|
|
||||||
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
|
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
|
||||||
platformio pkg update -e $1
|
platformio pkg install -e $1
|
||||||
|
|
||||||
echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS"
|
echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS"
|
||||||
rm -f .pio/build/$1/firmware.*
|
rm -f .pio/build/$1/firmware.*
|
||||||
@@ -34,11 +34,12 @@ SRCBIN=.pio/build/$1/firmware.bin
|
|||||||
cp $SRCBIN $OUTDIR/$basename-update.bin
|
cp $SRCBIN $OUTDIR/$basename-update.bin
|
||||||
|
|
||||||
echo "Building Filesystem for ESP32 targets"
|
echo "Building Filesystem for ESP32 targets"
|
||||||
pio run --environment $1 -t buildfs
|
# If you want to build the webui, uncomment the following lines
|
||||||
cp .pio/build/$1/littlefs.bin $OUTDIR/littlefswebui-$1-$VERSION.bin
|
# pio run --environment $1 -t buildfs
|
||||||
# Remove webserver files from the filesystem and rebuild
|
# cp .pio/build/$1/littlefs.bin $OUTDIR/littlefswebui-$1-$VERSION.bin
|
||||||
ls -l data/static # Diagnostic list of files
|
# # Remove webserver files from the filesystem and rebuild
|
||||||
rm -rf data/static
|
# ls -l data/static # Diagnostic list of files
|
||||||
|
# rm -rf data/static
|
||||||
pio run --environment $1 -t buildfs
|
pio run --environment $1 -t buildfs
|
||||||
cp .pio/build/$1/littlefs.bin $OUTDIR/littlefs-$1-$VERSION.bin
|
cp .pio/build/$1/littlefs.bin $OUTDIR/littlefs-$1-$VERSION.bin
|
||||||
cp bin/device-install.* $OUTDIR
|
cp bin/device-install.* $OUTDIR
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ elif (echo $2 | grep -q "nrf52"); then
|
|||||||
elif (echo $2 | grep -q "stm32"); then
|
elif (echo $2 | grep -q "stm32"); then
|
||||||
bin/build-stm32.sh $1
|
bin/build-stm32.sh $1
|
||||||
elif (echo $2 | grep -q "rpi2040"); then
|
elif (echo $2 | grep -q "rpi2040"); then
|
||||||
bin/build-rpi2040.sh $1
|
bin/build-rp2xx0.sh $1
|
||||||
else
|
else
|
||||||
echo "Unknown target $2"
|
echo "Unknown target $2"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ mkdir -p $OUTDIR/
|
|||||||
rm -r $OUTDIR/* || true
|
rm -r $OUTDIR/* || true
|
||||||
|
|
||||||
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
|
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
|
||||||
pio pkg update --environment "$PIO_ENV" || platformioFailed
|
pio pkg install --environment "$PIO_ENV" || platformioFailed
|
||||||
pio run --environment "$PIO_ENV" || platformioFailed
|
pio run --environment "$PIO_ENV" || platformioFailed
|
||||||
cp ".pio/build/$PIO_ENV/program" "$OUTDIR/meshtasticd_linux_$(uname -m)"
|
cp ".pio/build/$PIO_ENV/program" "$OUTDIR/meshtasticd_linux_$(uname -m)"
|
||||||
cp bin/native-install.* $OUTDIR
|
cp bin/native-install.* $OUTDIR
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ rm -f $OUTDIR/firmware*
|
|||||||
rm -r $OUTDIR/* || true
|
rm -r $OUTDIR/* || true
|
||||||
|
|
||||||
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
|
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
|
||||||
platformio pkg update -e $1
|
platformio pkg install -e $1
|
||||||
|
|
||||||
echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS"
|
echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS"
|
||||||
rm -f .pio/build/$1/firmware.*
|
rm -f .pio/build/$1/firmware.*
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ rm -f $OUTDIR/firmware*
|
|||||||
rm -r $OUTDIR/* || true
|
rm -r $OUTDIR/* || true
|
||||||
|
|
||||||
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
|
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
|
||||||
platformio pkg update -e $1
|
platformio pkg install -e $1
|
||||||
|
|
||||||
echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS"
|
echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS"
|
||||||
rm -f .pio/build/$1/firmware.*
|
rm -f .pio/build/$1/firmware.*
|
||||||
@@ -11,7 +11,7 @@ rm -f $OUTDIR/firmware*
|
|||||||
rm -r $OUTDIR/* || true
|
rm -r $OUTDIR/* || true
|
||||||
|
|
||||||
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
|
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
|
||||||
platformio pkg update -e $1
|
platformio pkg install -e $1
|
||||||
|
|
||||||
echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS"
|
echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS"
|
||||||
rm -f .pio/build/$1/firmware.*
|
rm -f .pio/build/$1/firmware.*
|
||||||
@@ -23,4 +23,4 @@ for BOARD in $BOARDS; do
|
|||||||
CHECK="${CHECK} -e ${BOARD}"
|
CHECK="${CHECK} -e ${BOARD}"
|
||||||
done
|
done
|
||||||
|
|
||||||
pio check --flags "-DAPP_VERSION=${APP_VERSION} --suppressions-list=suppressions.txt" $CHECK --skip-packages --pattern="src/" --fail-on-defect=medium --fail-on-defect=high
|
pio check --flags "-DAPP_VERSION=${APP_VERSION} --suppressions-list=suppressions.txt --inline-suppr" $CHECK --skip-packages --pattern="src/" --fail-on-defect=medium --fail-on-defect=high
|
||||||
|
|||||||
@@ -96,9 +96,9 @@ Lora:
|
|||||||
### Some devices, like the pinedio, may require spidev0.1 as a workaround.
|
### Some devices, like the pinedio, may require spidev0.1 as a workaround.
|
||||||
# spidev: spidev0.0
|
# spidev: spidev0.0
|
||||||
|
|
||||||
### Define GPIO buttons here:
|
### Deprecated location for User Button:
|
||||||
|
|
||||||
GPIO:
|
#GPIO:
|
||||||
# User: 6
|
# User: 6
|
||||||
|
|
||||||
### Define GPS
|
### Define GPS
|
||||||
@@ -115,17 +115,6 @@ I2C:
|
|||||||
|
|
||||||
Display:
|
Display:
|
||||||
|
|
||||||
### Waveshare 1.44inch LCD HAT
|
|
||||||
# Panel: ST7735S
|
|
||||||
# CS: 8 #Chip Select
|
|
||||||
# DC: 25 # Data/Command pin
|
|
||||||
# Backlight: 24
|
|
||||||
# Width: 128
|
|
||||||
# Height: 128
|
|
||||||
# Reset: 27
|
|
||||||
# OffsetX: 0
|
|
||||||
# OffsetY: 0
|
|
||||||
|
|
||||||
### Adafruit PiTFT 2.8 TFT+Touchscreen
|
### Adafruit PiTFT 2.8 TFT+Touchscreen
|
||||||
# Panel: ILI9341
|
# Panel: ILI9341
|
||||||
# CS: 8
|
# CS: 8
|
||||||
@@ -180,6 +169,16 @@ Input:
|
|||||||
|
|
||||||
# KeyboardDevice: /dev/input/by-id/usb-_Raspberry_Pi_Internal_Keyboard-event-kbd
|
# KeyboardDevice: /dev/input/by-id/usb-_Raspberry_Pi_Internal_Keyboard-event-kbd
|
||||||
|
|
||||||
|
### Standard User Button Config
|
||||||
|
# UserButton: 6
|
||||||
|
|
||||||
|
### Trackball/Joystick input
|
||||||
|
# TrackballUp: 6
|
||||||
|
# TrackballDown: 19
|
||||||
|
# TrackballLeft: 5
|
||||||
|
# TrackballRight: 26
|
||||||
|
# TrackballPress: 13
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
Logging:
|
Logging:
|
||||||
@@ -200,6 +199,10 @@ HostMetrics:
|
|||||||
# UserStringCommand: cat /sys/firmware/devicetree/base/serial-number # Command to execute, to send the results as the userString
|
# UserStringCommand: cat /sys/firmware/devicetree/base/serial-number # Command to execute, to send the results as the userString
|
||||||
|
|
||||||
|
|
||||||
|
Config:
|
||||||
|
# DisplayMode: TWOCOLOR # uncomment to force BaseUI
|
||||||
|
# DisplayMode: COLOR # uncomment to force MUI
|
||||||
|
|
||||||
General:
|
General:
|
||||||
MaxNodes: 200
|
MaxNodes: 200
|
||||||
MaxMessageQueue: 100
|
MaxMessageQueue: 100
|
||||||
|
|||||||
26
bin/config.d/display-waveshare-1-44.yaml
Normal file
26
bin/config.d/display-waveshare-1-44.yaml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
### Waveshare 1.44inch LCD HAT
|
||||||
|
Display:
|
||||||
|
Panel: ST7735S
|
||||||
|
spidev: spidev0.0 # Specify either the spidev here, or the CS below
|
||||||
|
# CS: 8 #Chip Select # Optional, as this is the default pin for spidev0.0
|
||||||
|
DC: 25 # Data/Command pin
|
||||||
|
Backlight: 24
|
||||||
|
Width: 128
|
||||||
|
Height: 128
|
||||||
|
Reset: 27
|
||||||
|
OffsetX: 2
|
||||||
|
OffsetY: 1
|
||||||
|
|
||||||
|
|
||||||
|
# OffsetY: 31 # These two options are used to properly flip the screen 180 degrees
|
||||||
|
# OffsetRotate: 3
|
||||||
|
|
||||||
|
|
||||||
|
Input:
|
||||||
|
TrackballUp: 6
|
||||||
|
TrackballDown: 19
|
||||||
|
TrackballLeft: 5
|
||||||
|
TrackballRight: 26
|
||||||
|
TrackballPress: 13
|
||||||
|
TrackballDirection: FALLING
|
||||||
|
# User: 21
|
||||||
@@ -6,6 +6,6 @@ Lora:
|
|||||||
IRQ: 16
|
IRQ: 16
|
||||||
Busy: 20
|
Busy: 20
|
||||||
Reset: 24
|
Reset: 24
|
||||||
TXen: 13
|
RXen: 12
|
||||||
DIO2_AS_RF_SWITCH: true
|
DIO2_AS_RF_SWITCH: true
|
||||||
DIO3_TCXO_VOLTAGE: true
|
DIO3_TCXO_VOLTAGE: true
|
||||||
|
|||||||
21
bin/config.d/lora-RAK6421.yaml
Normal file
21
bin/config.d/lora-RAK6421.yaml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
Lora:
|
||||||
|
|
||||||
|
### RAK13300in Slot 1
|
||||||
|
Module: sx1262
|
||||||
|
IRQ: 22 #IO6
|
||||||
|
Reset: 16 # IO4
|
||||||
|
Busy: 24 # IO5
|
||||||
|
# Ant_sw: 13 # IO3
|
||||||
|
DIO3_TCXO_VOLTAGE: true
|
||||||
|
DIO2_AS_RF_SWITCH: true
|
||||||
|
spidev: spidev0.0
|
||||||
|
# CS: 8
|
||||||
|
|
||||||
|
|
||||||
|
### RAK13300in Slot 2 pins
|
||||||
|
# IRQ: 18 #IO6
|
||||||
|
# Reset: 24 # IO4
|
||||||
|
# Busy: 19 # IO5
|
||||||
|
# # Ant_sw: 23 # IO3
|
||||||
|
# spidev: spidev0.1
|
||||||
|
# # CS: 7
|
||||||
18
bin/config.d/lora-lyra-picocalc-wio-sx1262.yaml
Normal file
18
bin/config.d/lora-lyra-picocalc-wio-sx1262.yaml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
Lora:
|
||||||
|
Module: sx1262
|
||||||
|
DIO2_AS_RF_SWITCH: true
|
||||||
|
DIO3_TCXO_VOLTAGE: true
|
||||||
|
gpiochip: 0
|
||||||
|
MOSI: 12
|
||||||
|
MISO: 13
|
||||||
|
IRQ: 1
|
||||||
|
Busy: 23
|
||||||
|
Reset: 22
|
||||||
|
RXen: 0
|
||||||
|
gpiochip: 1
|
||||||
|
CS: 9
|
||||||
|
SCK: 11
|
||||||
|
# TXen: bridge to DIO2 on E22 module
|
||||||
|
SX126X_MAX_POWER: 22
|
||||||
|
spidev: spidev1.0
|
||||||
|
spiSpeed: 2000000
|
||||||
52
bin/config.d/lora-ws-raspberry-pico-to-orangepi-03.yaml
Normal file
52
bin/config.d/lora-ws-raspberry-pico-to-orangepi-03.yaml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
# https://www.waveshare.com/pico-lora-sx1262-868m.htm
|
||||||
|
# http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/details/Orange-Pi-Zero-3.html
|
||||||
|
#
|
||||||
|
# See Orange Pi Zero3 manual, chapter 3.16, page 124 for 26-pin header pinout
|
||||||
|
#
|
||||||
|
# Pin Connection
|
||||||
|
# Waveshare Orange Pi Zero3
|
||||||
|
# 36 3.3V 17
|
||||||
|
# 15 MOSI 19
|
||||||
|
# 16 MISO 21
|
||||||
|
# 14 CLK 23
|
||||||
|
# 38 GND 25
|
||||||
|
# 4 BUSY 18
|
||||||
|
# 20 RESET 22
|
||||||
|
# 5 CS 24
|
||||||
|
# 26 DIO1/IRQ 26
|
||||||
|
|
||||||
|
Lora:
|
||||||
|
Module: sx1262 # Waveshare Raspberry Pico Lora module
|
||||||
|
DIO2_AS_RF_SWITCH: true
|
||||||
|
DIO3_TCXO_VOLTAGE: true
|
||||||
|
# Specify either the spidev1_1 or the CS below, not both!
|
||||||
|
# On DietPi Linux, when using the user overlay dietpi-spi1_1.dtbo, CS will be configured with spidev1.1
|
||||||
|
spidev: spidev1.1 # See Orange Pi Zero3 manual, chapter 3.18.3, page 130
|
||||||
|
# CS: # CS PIN_24 -> chip 1, line 233
|
||||||
|
# pin: 24
|
||||||
|
# gpiochip: 1
|
||||||
|
# line: 233
|
||||||
|
SCK: # SCK PIN_23 -> chip 1, line 230
|
||||||
|
pin: 23
|
||||||
|
gpiochip: 1
|
||||||
|
line: 230
|
||||||
|
Busy: # BUSY PIN_18 -> chip 1, line 78
|
||||||
|
pin: 18
|
||||||
|
gpiochip: 1
|
||||||
|
line: 78
|
||||||
|
MOSI: # MOSI PIN_19 -> chip 1, line 231
|
||||||
|
pin: 19
|
||||||
|
gpiochip: 1
|
||||||
|
line: 231
|
||||||
|
MISO: # MISO PIN_21 -> chip 1, line 232
|
||||||
|
pin: 21
|
||||||
|
gpiochip: 1
|
||||||
|
line: 232
|
||||||
|
Reset: # NRST PIN_22 -> chip 1, line 71
|
||||||
|
pin: 22
|
||||||
|
gpiochip: 1
|
||||||
|
line: 71
|
||||||
|
IRQ: # DIO1 PIN_26 -> chip 1, line 74
|
||||||
|
pin: 26
|
||||||
|
gpiochip: 1
|
||||||
|
line: 74
|
||||||
@@ -5,13 +5,13 @@ TITLE Meshtastic device-install
|
|||||||
SET "SCRIPT_NAME=%~nx0"
|
SET "SCRIPT_NAME=%~nx0"
|
||||||
SET "DEBUG=0"
|
SET "DEBUG=0"
|
||||||
SET "PYTHON="
|
SET "PYTHON="
|
||||||
SET "WEB_APP=0"
|
|
||||||
SET "TFT_BUILD=0"
|
SET "TFT_BUILD=0"
|
||||||
SET "BIGDB8=0"
|
SET "BIGDB8=0"
|
||||||
SET "BIGDB16=0"
|
SET "BIGDB16=0"
|
||||||
SET "ESPTOOL_BAUD=115200"
|
SET "ESPTOOL_BAUD=115200"
|
||||||
SET "ESPTOOL_CMD="
|
SET "ESPTOOL_CMD="
|
||||||
SET "LOGCOUNTER=0"
|
SET "LOGCOUNTER=0"
|
||||||
|
SET "BPS_RESET=0"
|
||||||
|
|
||||||
@REM FIXME: Determine mcu from PlatformIO variant, this is unmaintainable.
|
@REM FIXME: Determine mcu from PlatformIO variant, this is unmaintainable.
|
||||||
SET "S3=s3 v3 t-deck wireless-paper wireless-tracker station-g2 unphone"
|
SET "S3=s3 v3 t-deck wireless-paper wireless-tracker station-g2 unphone"
|
||||||
@@ -24,7 +24,7 @@ GOTO getopts
|
|||||||
:help
|
:help
|
||||||
ECHO Flash image file to device, but first erasing and writing system information.
|
ECHO Flash image file to device, but first erasing and writing system information.
|
||||||
ECHO.
|
ECHO.
|
||||||
ECHO Usage: %SCRIPT_NAME% -f filename [-p PORT] [-P python] (--web)
|
ECHO Usage: %SCRIPT_NAME% -f filename [-p PORT] [-P python] [--1200bps-reset]
|
||||||
ECHO.
|
ECHO.
|
||||||
ECHO Options:
|
ECHO Options:
|
||||||
ECHO -f filename The firmware .bin file to flash. Custom to your device type and region. (required)
|
ECHO -f filename The firmware .bin file to flash. Custom to your device type and region. (required)
|
||||||
@@ -34,14 +34,16 @@ ECHO If not set, ESPTOOL iterates all ports (Dangerous).
|
|||||||
ECHO -P python Specify alternate python interpreter to use to invoke esptool. (default: python)
|
ECHO -P python Specify alternate python interpreter to use to invoke esptool. (default: python)
|
||||||
ECHO If supplied the script will use python.
|
ECHO If supplied the script will use python.
|
||||||
ECHO If not supplied the script will try to find esptool in Path.
|
ECHO If not supplied the script will try to find esptool in Path.
|
||||||
ECHO --web Enable WebUI. (default: false)
|
ECHO --1200bps-reset Attempt to place the device in correct mode. (1200bps Reset)
|
||||||
|
ECHO Some hardware requires this twice.
|
||||||
ECHO.
|
ECHO.
|
||||||
|
ECHO Example: %SCRIPT_NAME% -p COM17 --1200bps-reset
|
||||||
ECHO Example: %SCRIPT_NAME% -f firmware-t-deck-tft-2.6.0.0b106d4.bin -p COM11
|
ECHO Example: %SCRIPT_NAME% -f firmware-t-deck-tft-2.6.0.0b106d4.bin -p COM11
|
||||||
ECHO Example: %SCRIPT_NAME% -f firmware-unphone-2.6.0.0b106d4.bin -p COM11 --web
|
ECHO Example: %SCRIPT_NAME% -f firmware-unphone-2.6.0.0b106d4.bin -p COM11
|
||||||
GOTO eof
|
GOTO eof
|
||||||
|
|
||||||
:version
|
:version
|
||||||
ECHO %SCRIPT_NAME% [Version 2.6.1]
|
ECHO %SCRIPT_NAME% [Version 2.6.2]
|
||||||
ECHO Meshtastic
|
ECHO Meshtastic
|
||||||
GOTO eof
|
GOTO eof
|
||||||
|
|
||||||
@@ -57,11 +59,13 @@ IF /I "%~1"=="-f" SET "FILENAME=%~2" & SHIFT
|
|||||||
IF "%~1"=="-p" SET "ESPTOOL_PORT=%~2" & SHIFT
|
IF "%~1"=="-p" SET "ESPTOOL_PORT=%~2" & SHIFT
|
||||||
IF /I "%~1"=="--port" SET "ESPTOOL_PORT=%~2" & SHIFT
|
IF /I "%~1"=="--port" SET "ESPTOOL_PORT=%~2" & SHIFT
|
||||||
IF "%~1"=="-P" SET "PYTHON=%~2" & SHIFT
|
IF "%~1"=="-P" SET "PYTHON=%~2" & SHIFT
|
||||||
IF /I "%~1"=="--web" SET "WEB_APP=1"
|
IF /I "%~1"=="--1200bps-reset" SET "BPS_RESET=1"
|
||||||
SHIFT
|
SHIFT
|
||||||
GOTO getopts
|
GOTO getopts
|
||||||
:endopts
|
:endopts
|
||||||
|
|
||||||
|
IF %BPS_RESET% EQU 1 GOTO skip-filename
|
||||||
|
|
||||||
CALL :LOG_MESSAGE DEBUG "Checking FILENAME parameter..."
|
CALL :LOG_MESSAGE DEBUG "Checking FILENAME parameter..."
|
||||||
IF "__!FILENAME!__"=="____" (
|
IF "__!FILENAME!__"=="____" (
|
||||||
CALL :LOG_MESSAGE DEBUG "Missing -f filename input."
|
CALL :LOG_MESSAGE DEBUG "Missing -f filename input."
|
||||||
@@ -95,6 +99,9 @@ IF NOT "!FILENAME:update=!"=="!FILENAME!" (
|
|||||||
CALL :LOG_MESSAGE DEBUG "We are NOT working with a *update* file. !FILENAME!"
|
CALL :LOG_MESSAGE DEBUG "We are NOT working with a *update* file. !FILENAME!"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
:skip-filename
|
||||||
|
SET "ESPTOOL_BAUD=1200"
|
||||||
|
|
||||||
CALL :LOG_MESSAGE DEBUG "Determine the correct esptool command to use..."
|
CALL :LOG_MESSAGE DEBUG "Determine the correct esptool command to use..."
|
||||||
IF NOT "__%PYTHON%__"=="____" (
|
IF NOT "__%PYTHON%__"=="____" (
|
||||||
SET "ESPTOOL_CMD=!PYTHON! -m esptool"
|
SET "ESPTOOL_CMD=!PYTHON! -m esptool"
|
||||||
@@ -133,13 +140,16 @@ IF "__!ESPTOOL_PORT!__" == "____" (
|
|||||||
)
|
)
|
||||||
CALL :LOG_MESSAGE INFO "Using esptool baud: !ESPTOOL_BAUD!."
|
CALL :LOG_MESSAGE INFO "Using esptool baud: !ESPTOOL_BAUD!."
|
||||||
|
|
||||||
|
IF %BPS_RESET% EQU 1 (
|
||||||
|
@REM Attempt to change mode via 1200bps Reset.
|
||||||
|
CALL :RUN_ESPTOOL !ESPTOOL_BAUD! --after no_reset read_flash_status
|
||||||
|
GOTO eof
|
||||||
|
)
|
||||||
|
|
||||||
@REM Check if FILENAME contains "-tft-" and set target partitionScheme accordingly.
|
@REM Check if FILENAME contains "-tft-" and set target partitionScheme accordingly.
|
||||||
@REM https://github.com/meshtastic/web-flasher/blob/main/types/resources.ts#L3
|
@REM https://github.com/meshtastic/web-flasher/blob/main/types/resources.ts#L3
|
||||||
IF NOT "!FILENAME:-tft-=!"=="!FILENAME!" (
|
IF NOT "!FILENAME:-tft-=!"=="!FILENAME!" (
|
||||||
CALL :LOG_MESSAGE DEBUG "We are working with a *-tft-* file. !FILENAME!"
|
CALL :LOG_MESSAGE DEBUG "We are working with a *-tft-* file. !FILENAME!"
|
||||||
IF %WEB_APP% EQU 1 (
|
|
||||||
CALL :LOG_MESSAGE ERROR "Cannot enable WebUI (--web) and MUI." & GOTO eof
|
|
||||||
)
|
|
||||||
SET "TFT_BUILD=1"
|
SET "TFT_BUILD=1"
|
||||||
) ELSE (
|
) ELSE (
|
||||||
CALL :LOG_MESSAGE DEBUG "We are NOT working with a *-tft-* file. !FILENAME!"
|
CALL :LOG_MESSAGE DEBUG "We are NOT working with a *-tft-* file. !FILENAME!"
|
||||||
@@ -193,13 +203,8 @@ SET "OTA_FILENAME=bleota.bin"
|
|||||||
:end_loop_c3
|
:end_loop_c3
|
||||||
CALL :LOG_MESSAGE DEBUG "Set OTA_FILENAME to: !OTA_FILENAME!"
|
CALL :LOG_MESSAGE DEBUG "Set OTA_FILENAME to: !OTA_FILENAME!"
|
||||||
|
|
||||||
@REM Check if (--web) is enabled and prefix BASENAME with "littlefswebui-" else "littlefs-".
|
@REM Set SPIFFS filename with "littlefs-" prefix.
|
||||||
IF %WEB_APP% EQU 1 (
|
SET "SPIFFS_FILENAME=littlefs-%BASENAME%"
|
||||||
CALL :LOG_MESSAGE INFO "WebUI selected."
|
|
||||||
SET "SPIFFS_FILENAME=littlefswebui-%BASENAME%"
|
|
||||||
) ELSE (
|
|
||||||
SET "SPIFFS_FILENAME=littlefs-%BASENAME%"
|
|
||||||
)
|
|
||||||
CALL :LOG_MESSAGE DEBUG "Set SPIFFS_FILENAME to: !SPIFFS_FILENAME!"
|
CALL :LOG_MESSAGE DEBUG "Set SPIFFS_FILENAME to: !SPIFFS_FILENAME!"
|
||||||
|
|
||||||
@REM Default offsets.
|
@REM Default offsets.
|
||||||
@@ -254,6 +259,7 @@ EXIT /B %ERRORLEVEL%
|
|||||||
IF %DEBUG% EQU 1 CALL :LOG_MESSAGE DEBUG "About to run command: !ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4"
|
IF %DEBUG% EQU 1 CALL :LOG_MESSAGE DEBUG "About to run command: !ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4"
|
||||||
CALL :RESET_ERROR
|
CALL :RESET_ERROR
|
||||||
!ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4
|
!ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4
|
||||||
|
IF %BPS_RESET% EQU 1 GOTO :eof
|
||||||
IF %ERRORLEVEL% NEQ 0 (
|
IF %ERRORLEVEL% NEQ 0 (
|
||||||
CALL :LOG_MESSAGE ERROR "Error running command: !ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4"
|
CALL :LOG_MESSAGE ERROR "Error running command: !ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4"
|
||||||
EXIT /B %ERRORLEVEL%
|
EXIT /B %ERRORLEVEL%
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
PYTHON=${PYTHON:-$(which python3 python | head -n 1)}
|
PYTHON=${PYTHON:-$(which python3 python | head -n 1)}
|
||||||
WEB_APP=false
|
BPS_RESET=false
|
||||||
TFT_BUILD=false
|
TFT_BUILD=false
|
||||||
MCU=""
|
MCU=""
|
||||||
|
|
||||||
@@ -32,185 +32,185 @@ BIGDB_16MB=(
|
|||||||
"ESP32-S3-Pico"
|
"ESP32-S3-Pico"
|
||||||
"m5stack-cores3"
|
"m5stack-cores3"
|
||||||
"station-g2"
|
"station-g2"
|
||||||
"t-eth-elite"
|
"t-eth-elite"
|
||||||
"t-watch-s3"
|
"t-watch-s3"
|
||||||
|
"elecrow-adv-35-tft"
|
||||||
|
"elecrow-adv-24-28-tft"
|
||||||
|
"elecrow-adv1-43-50-70-tft"
|
||||||
)
|
)
|
||||||
S3_VARIANTS=(
|
S3_VARIANTS=(
|
||||||
"s3"
|
"s3"
|
||||||
"-v3"
|
"-v3"
|
||||||
"t-deck"
|
"t-deck"
|
||||||
"wireless-paper"
|
"wireless-paper"
|
||||||
"wireless-tracker"
|
"wireless-tracker"
|
||||||
"station-g2"
|
"station-g2"
|
||||||
"unphone"
|
"unphone"
|
||||||
"t-eth-elite"
|
"t-eth-elite"
|
||||||
"mesh-tab"
|
"mesh-tab"
|
||||||
"dreamcatcher"
|
"dreamcatcher"
|
||||||
"ESP32-S3-Pico"
|
"ESP32-S3-Pico"
|
||||||
"seeed-sensecap-indicator"
|
"seeed-sensecap-indicator"
|
||||||
"heltec_capsule_sensor_v3"
|
"heltec_capsule_sensor_v3"
|
||||||
"vision-master"
|
"vision-master"
|
||||||
"icarus"
|
"icarus"
|
||||||
"tracksenger"
|
"tracksenger"
|
||||||
"elecrow-adv"
|
"elecrow-adv"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Determine the correct esptool command to use
|
# Determine the correct esptool command to use
|
||||||
if "$PYTHON" -m esptool version >/dev/null 2>&1; then
|
if "$PYTHON" -m esptool version >/dev/null 2>&1; then
|
||||||
ESPTOOL_CMD="$PYTHON -m esptool"
|
ESPTOOL_CMD="$PYTHON -m esptool"
|
||||||
elif command -v esptool >/dev/null 2>&1; then
|
elif command -v esptool >/dev/null 2>&1; then
|
||||||
ESPTOOL_CMD="esptool"
|
ESPTOOL_CMD="esptool"
|
||||||
elif command -v esptool.py >/dev/null 2>&1; then
|
elif command -v esptool.py >/dev/null 2>&1; then
|
||||||
ESPTOOL_CMD="esptool.py"
|
ESPTOOL_CMD="esptool.py"
|
||||||
else
|
else
|
||||||
echo "Error: esptool not found"
|
echo "Error: esptool not found"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Usage info
|
# Usage info
|
||||||
show_help() {
|
show_help() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Usage: $(basename $0) [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME] [--web]
|
Usage: $(basename "$0") [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME] [--1200bps-reset]
|
||||||
Flash image file to device, but first erasing and writing system information.
|
Flash image file to device, but first erasing and writing system information.
|
||||||
|
|
||||||
-h Display this help and exit.
|
-h Display this help and exit.
|
||||||
-p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not set, ESPTOOL iterates all ports (Dangerous).
|
-p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not set, ESPTOOL iterates all ports (Dangerous).
|
||||||
-P PYTHON Specify alternate python interpreter to use to invoke esptool. (Default: "$PYTHON")
|
-P PYTHON Specify alternate python interpreter to use to invoke esptool. (Default: "$PYTHON")
|
||||||
-f FILENAME The firmware .bin file to flash. Custom to your device type and region.
|
-f FILENAME The firmware .bin file to flash. Custom to your device type and region.
|
||||||
--web Enable WebUI. (Default: false)
|
--1200bps-reset Attempt to place the device in correct mode. Some hardware requires this twice. (1200bps Reset)
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
# Parse arguments using a single while loop
|
# Parse arguments using a single while loop
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-h | --help)
|
-h | --help)
|
||||||
show_help
|
show_help
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
-p)
|
-p)
|
||||||
ESPTOOL_CMD="$ESPTOOL_CMD --port $2"
|
ESPTOOL_CMD="$ESPTOOL_CMD --port $2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-P)
|
-P)
|
||||||
PYTHON="$2"
|
PYTHON="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-f)
|
-f)
|
||||||
FILENAME="$2"
|
FILENAME="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--web)
|
--1200bps-reset)
|
||||||
WEB_APP=true
|
BPS_RESET=true
|
||||||
;;
|
;;
|
||||||
--) # Stop parsing options
|
--) # Stop parsing options
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown argument: $1" >&2
|
echo "Unknown argument: $1" >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
shift # Move to the next argument
|
shift # Move to the next argument
|
||||||
done
|
done
|
||||||
|
|
||||||
[ -z "$FILENAME" -a -n "$1" ] && {
|
if [[ $BPS_RESET == true ]]; then
|
||||||
FILENAME=$1
|
$ESPTOOL_CMD --baud 1200 --after no_reset read_flash_status
|
||||||
shift
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "$FILENAME" ] && [ -n "$1" ] && {
|
||||||
|
FILENAME="$1"
|
||||||
|
shift
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $FILENAME != firmware-* ]]; then
|
if [[ "$FILENAME" != firmware-* ]]; then
|
||||||
echo "Filename must be a firmware-* file."
|
echo "Filename must be a firmware-* file."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if FILENAME contains "-tft-" and prevent web/mui comingling.
|
# Check if FILENAME contains "-tft-" and set target partitionScheme accordingly.
|
||||||
if [[ ${FILENAME//-tft-/} != "$FILENAME" ]]; then
|
if [[ "${FILENAME//-tft-/}" != "$FILENAME" ]]; then
|
||||||
TFT_BUILD=true
|
TFT_BUILD=true
|
||||||
if [[ $WEB_APP == true ]] && [[ $TFT_BUILD == true ]]; then
|
|
||||||
echo "Cannot enable WebUI (--web) and MUI."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Extract BASENAME from %FILENAME% for later use.
|
# Extract BASENAME from %FILENAME% for later use.
|
||||||
BASENAME="${FILENAME/firmware-/}"
|
BASENAME="${FILENAME/firmware-/}"
|
||||||
|
|
||||||
if [ -f "${FILENAME}" ] && [ -n "${FILENAME##*"update"*}" ]; then
|
if [ -f "${FILENAME}" ] && [ -n "${FILENAME##*"update"*}" ]; then
|
||||||
# Default littlefs* offset (--web).
|
# Default littlefs* offset.
|
||||||
OFFSET=0x300000
|
OFFSET=0x300000
|
||||||
|
|
||||||
# Default OTA Offset
|
# Default OTA Offset
|
||||||
OTA_OFFSET=0x260000
|
OTA_OFFSET=0x260000
|
||||||
|
|
||||||
# littlefs* offset for BigDB 8mb and OTA OFFSET.
|
# littlefs* offset for BigDB 8mb and OTA OFFSET.
|
||||||
for variant in "${BIGDB_8MB[@]}"; do
|
for variant in "${BIGDB_8MB[@]}"; do
|
||||||
if [ -z "${FILENAME##*"$variant"*}" ]; then
|
if [ -z "${FILENAME##*"$variant"*}" ]; then
|
||||||
OFFSET=0x670000
|
OFFSET=0x670000
|
||||||
OTA_OFFSET=0x340000
|
OTA_OFFSET=0x340000
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# littlefs* offset for BigDB 16mb and OTA OFFSET.
|
# littlefs* offset for BigDB 16mb and OTA OFFSET.
|
||||||
for variant in "${BIGDB_16MB[@]}"; do
|
for variant in "${BIGDB_16MB[@]}"; do
|
||||||
if [ -z "${FILENAME##*"$variant"*}" ]; then
|
if [ -z "${FILENAME##*"$variant"*}" ]; then
|
||||||
OFFSET=0xc90000
|
OFFSET=0xc90000
|
||||||
OTA_OFFSET=0x650000
|
OTA_OFFSET=0x650000
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Account for S3 board's different OTA partition
|
# Account for S3 board's different OTA partition
|
||||||
# FIXME: Use PlatformIO info to determine MCU type, this is unmaintainable
|
# FIXME: Use PlatformIO info to determine MCU type, this is unmaintainable
|
||||||
for variant in "${S3_VARIANTS[@]}"; do
|
for variant in "${S3_VARIANTS[@]}"; do
|
||||||
if [ -z "${FILENAME##*"$variant"*}" ]; then
|
if [ -z "${FILENAME##*"$variant"*}" ]; then
|
||||||
MCU="esp32s3"
|
MCU="esp32s3"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$MCU" != "esp32s3" ]; then
|
if [ "$MCU" != "esp32s3" ]; then
|
||||||
if [ -n "${FILENAME##*"esp32c3"*}" ]; then
|
if [ -n "${FILENAME##*"esp32c3"*}" ]; then
|
||||||
OTAFILE=bleota.bin
|
OTAFILE=bleota.bin
|
||||||
else
|
else
|
||||||
OTAFILE=bleota-c3.bin
|
OTAFILE=bleota-c3.bin
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
OTAFILE=bleota-s3.bin
|
OTAFILE=bleota-s3.bin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if WEB_APP (--web) is enabled and add "littlefswebui-" to BASENAME else "littlefs-".
|
# Set SPIFFS filename with "littlefs-" prefix.
|
||||||
if [ "$WEB_APP" = true ]; then
|
SPIFFSFILE=littlefs-${BASENAME}
|
||||||
SPIFFSFILE=littlefswebui-${BASENAME}
|
|
||||||
else
|
|
||||||
SPIFFSFILE=littlefs-${BASENAME}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -f $FILENAME ]]; then
|
if [[ ! -f "$FILENAME" ]]; then
|
||||||
echo "Error: file ${FILENAME} wasn't found. Terminating."
|
echo "Error: file ${FILENAME} wasn't found. Terminating."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [[ ! -f $OTAFILE ]]; then
|
if [[ ! -f "$OTAFILE" ]]; then
|
||||||
echo "Error: file ${OTAFILE} wasn't found. Terminating."
|
echo "Error: file ${OTAFILE} wasn't found. Terminating."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [[ ! -f $SPIFFSFILE ]]; then
|
if [[ ! -f "$SPIFFSFILE" ]]; then
|
||||||
echo "Error: file ${SPIFFSFILE} wasn't found. Terminating."
|
echo "Error: file ${SPIFFSFILE} wasn't found. Terminating."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Trying to flash ${FILENAME}, but first erasing and writing system information"
|
echo "Trying to flash ${FILENAME}, but first erasing and writing system information"
|
||||||
$ESPTOOL_CMD erase_flash
|
$ESPTOOL_CMD erase_flash
|
||||||
$ESPTOOL_CMD write_flash 0x00 "${FILENAME}"
|
$ESPTOOL_CMD write_flash 0x00 "${FILENAME}"
|
||||||
echo "Trying to flash ${OTAFILE} at offset ${OTA_OFFSET}"
|
echo "Trying to flash ${OTAFILE} at offset ${OTA_OFFSET}"
|
||||||
$ESPTOOL_CMD write_flash $OTA_OFFSET "${OTAFILE}"
|
$ESPTOOL_CMD write_flash $OTA_OFFSET "${OTAFILE}"
|
||||||
echo "Trying to flash ${SPIFFSFILE}, at offset ${OFFSET}"
|
echo "Trying to flash ${SPIFFSFILE}, at offset ${OFFSET}"
|
||||||
$ESPTOOL_CMD write_flash $OFFSET "${SPIFFSFILE}"
|
$ESPTOOL_CMD write_flash $OFFSET "${SPIFFSFILE}"
|
||||||
|
|
||||||
else
|
else
|
||||||
show_help
|
show_help
|
||||||
echo "Invalid file: ${FILENAME}"
|
echo "Invalid file: ${FILENAME}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -8,12 +8,13 @@ SET "PYTHON="
|
|||||||
SET "ESPTOOL_BAUD=115200"
|
SET "ESPTOOL_BAUD=115200"
|
||||||
SET "ESPTOOL_CMD="
|
SET "ESPTOOL_CMD="
|
||||||
SET "LOGCOUNTER=0"
|
SET "LOGCOUNTER=0"
|
||||||
|
SET "CHANGE_MODE=0"
|
||||||
|
|
||||||
GOTO getopts
|
GOTO getopts
|
||||||
:help
|
:help
|
||||||
ECHO Flash image file to device, but leave existing system intact.
|
ECHO Flash image file to device, but leave existing system intact.
|
||||||
ECHO.
|
ECHO.
|
||||||
ECHO Usage: %SCRIPT_NAME% -f filename [-p PORT] [-P python]
|
ECHO Usage: %SCRIPT_NAME% -f filename [-p PORT] [-P python] [--change-mode]
|
||||||
ECHO.
|
ECHO.
|
||||||
ECHO Options:
|
ECHO Options:
|
||||||
ECHO -f filename The update .bin file to flash. Custom to your device type and region. (required)
|
ECHO -f filename The update .bin file to flash. Custom to your device type and region. (required)
|
||||||
@@ -23,12 +24,15 @@ ECHO If not set, ESPTOOL iterates all ports (Dangerous).
|
|||||||
ECHO -P python Specify alternate python interpreter to use to invoke esptool. (default: python)
|
ECHO -P python Specify alternate python interpreter to use to invoke esptool. (default: python)
|
||||||
ECHO If supplied the script will use python.
|
ECHO If supplied the script will use python.
|
||||||
ECHO If not supplied the script will try to find esptool in Path.
|
ECHO If not supplied the script will try to find esptool in Path.
|
||||||
|
ECHO --change-mode Attempt to place the device in correct mode. (1200bps Reset)
|
||||||
|
ECHO Some hardware requires this twice.
|
||||||
ECHO.
|
ECHO.
|
||||||
|
ECHO Example: %SCRIPT_NAME% -p COM17 --change-mode
|
||||||
ECHO Example: %SCRIPT_NAME% -f firmware-t-deck-tft-2.6.0.0b106d4-update.bin -p COM11
|
ECHO Example: %SCRIPT_NAME% -f firmware-t-deck-tft-2.6.0.0b106d4-update.bin -p COM11
|
||||||
GOTO eof
|
GOTO eof
|
||||||
|
|
||||||
:version
|
:version
|
||||||
ECHO %SCRIPT_NAME% [Version 2.6.1]
|
ECHO %SCRIPT_NAME% [Version 2.6.2]
|
||||||
ECHO Meshtastic
|
ECHO Meshtastic
|
||||||
GOTO eof
|
GOTO eof
|
||||||
|
|
||||||
@@ -44,10 +48,13 @@ IF /I "%~1"=="-f" SET "FILENAME=%~2" & SHIFT
|
|||||||
IF "%~1"=="-p" SET "ESPTOOL_PORT=%~2" & SHIFT
|
IF "%~1"=="-p" SET "ESPTOOL_PORT=%~2" & SHIFT
|
||||||
IF /I "%~1"=="--port" SET "ESPTOOL_PORT=%~2" & SHIFT
|
IF /I "%~1"=="--port" SET "ESPTOOL_PORT=%~2" & SHIFT
|
||||||
IF "%~1"=="-P" SET "PYTHON=%~2" & SHIFT
|
IF "%~1"=="-P" SET "PYTHON=%~2" & SHIFT
|
||||||
|
IF /I "%~1"=="--change-mode" SET "CHANGE_MODE=1"
|
||||||
SHIFT
|
SHIFT
|
||||||
GOTO getopts
|
GOTO getopts
|
||||||
:endopts
|
:endopts
|
||||||
|
|
||||||
|
IF %CHANGE_MODE% EQU 1 GOTO skip-filename
|
||||||
|
|
||||||
CALL :LOG_MESSAGE DEBUG "Checking FILENAME parameter..."
|
CALL :LOG_MESSAGE DEBUG "Checking FILENAME parameter..."
|
||||||
IF "__!FILENAME!__"=="____" (
|
IF "__!FILENAME!__"=="____" (
|
||||||
CALL :LOG_MESSAGE DEBUG "Missing -f filename input."
|
CALL :LOG_MESSAGE DEBUG "Missing -f filename input."
|
||||||
@@ -77,6 +84,9 @@ IF "!FILENAME:update=!"=="!FILENAME!" (
|
|||||||
CALL :LOG_MESSAGE DEBUG "We are working with a *update* file. !FILENAME!"
|
CALL :LOG_MESSAGE DEBUG "We are working with a *update* file. !FILENAME!"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
:skip-filename
|
||||||
|
SET "ESPTOOL_BAUD=1200"
|
||||||
|
|
||||||
CALL :LOG_MESSAGE DEBUG "Determine the correct esptool command to use..."
|
CALL :LOG_MESSAGE DEBUG "Determine the correct esptool command to use..."
|
||||||
IF NOT "__%PYTHON%__"=="____" (
|
IF NOT "__%PYTHON%__"=="____" (
|
||||||
SET "ESPTOOL_CMD=!PYTHON! -m esptool"
|
SET "ESPTOOL_CMD=!PYTHON! -m esptool"
|
||||||
@@ -115,6 +125,12 @@ IF "__!ESPTOOL_PORT!__" == "____" (
|
|||||||
)
|
)
|
||||||
CALL :LOG_MESSAGE INFO "Using esptool baud: !ESPTOOL_BAUD!."
|
CALL :LOG_MESSAGE INFO "Using esptool baud: !ESPTOOL_BAUD!."
|
||||||
|
|
||||||
|
IF %CHANGE_MODE% EQU 1 (
|
||||||
|
@REM Attempt to change mode via 1200bps Reset.
|
||||||
|
CALL :RUN_ESPTOOL !ESPTOOL_BAUD! --after no_reset read_flash_status
|
||||||
|
GOTO eof
|
||||||
|
)
|
||||||
|
|
||||||
@REM Flashing operations.
|
@REM Flashing operations.
|
||||||
CALL :LOG_MESSAGE INFO "Trying to flash update "!FILENAME!" at OFFSET 0x10000..."
|
CALL :LOG_MESSAGE INFO "Trying to flash update "!FILENAME!" at OFFSET 0x10000..."
|
||||||
CALL :RUN_ESPTOOL !ESPTOOL_BAUD! write_flash 0x10000 "!FILENAME!" || GOTO eof
|
CALL :RUN_ESPTOOL !ESPTOOL_BAUD! write_flash 0x10000 "!FILENAME!" || GOTO eof
|
||||||
@@ -135,6 +151,7 @@ EXIT /B %ERRORLEVEL%
|
|||||||
IF %DEBUG% EQU 1 CALL :LOG_MESSAGE DEBUG "About to run command: !ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4"
|
IF %DEBUG% EQU 1 CALL :LOG_MESSAGE DEBUG "About to run command: !ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4"
|
||||||
CALL :RESET_ERROR
|
CALL :RESET_ERROR
|
||||||
!ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4
|
!ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4
|
||||||
|
IF %CHANGE_MODE% EQU 1 GOTO :eof
|
||||||
IF %ERRORLEVEL% NEQ 0 (
|
IF %ERRORLEVEL% NEQ 0 (
|
||||||
CALL :LOG_MESSAGE ERROR "Error running command: !ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4"
|
CALL :LOG_MESSAGE ERROR "Error running command: !ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4"
|
||||||
EXIT /B %ERRORLEVEL%
|
EXIT /B %ERRORLEVEL%
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
PYTHON=${PYTHON:-$(which python3 python|head -n 1)}
|
PYTHON=${PYTHON:-$(which python3 python|head -n 1)}
|
||||||
|
CHANGE_MODE=false
|
||||||
|
|
||||||
# Determine the correct esptool command to use
|
# Determine the correct esptool command to use
|
||||||
if "$PYTHON" -m esptool version >/dev/null 2>&1; then
|
if "$PYTHON" -m esptool version >/dev/null 2>&1; then
|
||||||
@@ -17,17 +18,29 @@ fi
|
|||||||
# Usage info
|
# Usage info
|
||||||
show_help() {
|
show_help() {
|
||||||
cat << EOF
|
cat << EOF
|
||||||
Usage: $(basename $0) [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME|FILENAME]
|
Usage: $(basename "$0") [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME|FILENAME] [--change-mode]
|
||||||
Flash image file to device, leave existing system intact."
|
Flash image file to device, leave existing system intact."
|
||||||
|
|
||||||
-h Display this help and exit
|
-h Display this help and exit
|
||||||
-p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not set, ESPTOOL iterates all ports (Dangerous).
|
-p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not set, ESPTOOL iterates all ports (Dangerous).
|
||||||
-P PYTHON Specify alternate python interpreter to use to invoke esptool. (Default: "$PYTHON")
|
-P PYTHON Specify alternate python interpreter to use to invoke esptool. (Default: "$PYTHON")
|
||||||
-f FILENAME The *update.bin file to flash. Custom to your device type.
|
-f FILENAME The *update.bin file to flash. Custom to your device type.
|
||||||
|
--change-mode Attempt to place the device in correct mode. Some hardware requires this twice. (1200bps Reset)
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check for --change-mode and remove it from arguments
|
||||||
|
NEW_ARGS=()
|
||||||
|
for arg in "$@"; do
|
||||||
|
if [ "$arg" = "--change-mode" ]; then
|
||||||
|
CHANGE_MODE=true
|
||||||
|
else
|
||||||
|
NEW_ARGS+=("$arg")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
set -- "${NEW_ARGS[@]}"
|
||||||
|
|
||||||
while getopts ":hp:P:f:" opt; do
|
while getopts ":hp:P:f:" opt; do
|
||||||
case "${opt}" in
|
case "${opt}" in
|
||||||
@@ -36,13 +49,13 @@ while getopts ":hp:P:f:" opt; do
|
|||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
p) ESPTOOL_CMD="$ESPTOOL_CMD --port ${OPTARG}"
|
p) ESPTOOL_CMD="$ESPTOOL_CMD --port ${OPTARG}"
|
||||||
;;
|
;;
|
||||||
P) PYTHON=${OPTARG}
|
P) PYTHON=${OPTARG}
|
||||||
;;
|
;;
|
||||||
f) FILENAME=${OPTARG}
|
f) FILENAME=${OPTARG}
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Invalid flag."
|
echo "Invalid flag."
|
||||||
show_help >&2
|
show_help >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
@@ -50,17 +63,22 @@ while getopts ":hp:P:f:" opt; do
|
|||||||
done
|
done
|
||||||
shift "$((OPTIND-1))"
|
shift "$((OPTIND-1))"
|
||||||
|
|
||||||
[ -z "$FILENAME" -a -n "$1" ] && {
|
if [ "$CHANGE_MODE" = true ]; then
|
||||||
FILENAME=$1
|
$ESPTOOL_CMD --baud 1200 --after no_reset read_flash_status
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "$FILENAME" ] && [ -n "$1" ] && {
|
||||||
|
FILENAME="$1"
|
||||||
shift
|
shift
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -f "${FILENAME}" ] && [ -z "${FILENAME##*"update"*}" ]; then
|
if [ -f "${FILENAME}" ] && [ -z "${FILENAME##*"update"*}" ]; then
|
||||||
printf "Trying to flash update ${FILENAME}"
|
echo "Trying to flash update ${FILENAME}"
|
||||||
$ESPTOOL_CMD --baud 115200 write_flash 0x10000 ${FILENAME}
|
$ESPTOOL_CMD --baud 115200 write_flash 0x10000 "${FILENAME}"
|
||||||
else
|
else
|
||||||
show_help
|
show_help
|
||||||
echo "Invalid file: ${FILENAME}"
|
echo "Invalid file: ${FILENAME}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -2,50 +2,71 @@
|
|||||||
|
|
||||||
"""Generate the CI matrix."""
|
"""Generate the CI matrix."""
|
||||||
|
|
||||||
import configparser
|
|
||||||
import json
|
import json
|
||||||
import os
|
|
||||||
import sys
|
import sys
|
||||||
import random
|
import random
|
||||||
|
import re
|
||||||
rootdir = "variants/"
|
from platformio.project.config import ProjectConfig
|
||||||
|
|
||||||
options = sys.argv[1:]
|
options = sys.argv[1:]
|
||||||
|
|
||||||
outlist = []
|
outlist = []
|
||||||
|
|
||||||
if len(options) < 1:
|
if len(options) < 1:
|
||||||
print(json.dumps(outlist))
|
print(json.dumps(outlist))
|
||||||
exit()
|
exit(1)
|
||||||
|
|
||||||
for subdir, dirs, files in os.walk(rootdir):
|
cfg = ProjectConfig.get_instance()
|
||||||
for file in files:
|
pio_envs = cfg.envs()
|
||||||
if file == "platformio.ini":
|
|
||||||
config = configparser.ConfigParser()
|
# Gather all PlatformIO environments for filtering later
|
||||||
config.read(subdir + "/" + file)
|
all_envs = []
|
||||||
for c in config.sections():
|
for pio_env in pio_envs:
|
||||||
if c.startswith("env:"):
|
env_build_flags = cfg.get(f"env:{pio_env}", 'build_flags')
|
||||||
section = config[c].name[4:]
|
env_platform = None
|
||||||
if "extends" in config[config[c].name]:
|
for flag in env_build_flags:
|
||||||
if config[config[c].name]["extends"] == options[0] + "_base":
|
# Extract the platform from the build flags
|
||||||
if "board_level" in config[config[c].name]:
|
# Example flag: -I variants/esp32s3/heltec-v3
|
||||||
if (
|
match = re.search(r"-I\s?variants/([^/]+)", flag)
|
||||||
config[config[c].name]["board_level"] == "extra"
|
if match:
|
||||||
) & ("extra" in options):
|
env_platform = match.group(1)
|
||||||
outlist.append(section)
|
break
|
||||||
else:
|
# Intentionally fail if platform cannot be determined
|
||||||
outlist.append(section)
|
if not env_platform:
|
||||||
# Add the TFT variants if the base variant is selected
|
print(f"Error: Could not determine platform for environment '{pio_env}'")
|
||||||
elif section.replace("-tft", "") in outlist and config[config[c].name].get("board_level") != "extra":
|
exit(1)
|
||||||
outlist.append(section)
|
# Store env details as a dictionary, and add to 'all_envs' list
|
||||||
elif section.replace("-inkhud", "") in outlist and config[config[c].name].get("board_level") != "extra":
|
env = {
|
||||||
outlist.append(section)
|
'name': pio_env,
|
||||||
if "board_check" in config[config[c].name]:
|
'platform': env_platform,
|
||||||
if (config[config[c].name]["board_check"] == "true") & (
|
'board_level': cfg.get(f"env:{pio_env}", 'board_level', default=None),
|
||||||
"check" in options
|
'board_check': bool(cfg.get(f"env:{pio_env}", 'board_check', default=False))
|
||||||
):
|
}
|
||||||
outlist.append(section)
|
all_envs.append(env)
|
||||||
if ("quick" in options) & (len(outlist) > 3):
|
|
||||||
print(json.dumps(random.sample(outlist, 3)))
|
# Filter outputs based on options
|
||||||
|
# Check is mutually exclusive with other options (except 'pr')
|
||||||
|
if "check" in options:
|
||||||
|
for env in all_envs:
|
||||||
|
if env['board_check']:
|
||||||
|
if "pr" in options:
|
||||||
|
if env['board_level'] == 'pr':
|
||||||
|
outlist.append(env['name'])
|
||||||
|
else:
|
||||||
|
outlist.append(env['name'])
|
||||||
|
# Filter (non-check) builds by platform
|
||||||
else:
|
else:
|
||||||
print(json.dumps(outlist))
|
for env in all_envs:
|
||||||
|
if options[0] == env['platform']:
|
||||||
|
# Always include board_level = 'pr'
|
||||||
|
if env['board_level'] == 'pr':
|
||||||
|
outlist.append(env['name'])
|
||||||
|
# Include board_level = 'extra' when requested
|
||||||
|
elif "extra" in options and env['board_level'] == "extra":
|
||||||
|
outlist.append(env['name'])
|
||||||
|
# If no board level is specified, include in release builds (not PR)
|
||||||
|
elif "pr" not in options and not env['board_level']:
|
||||||
|
outlist.append(env['name'])
|
||||||
|
|
||||||
|
# Return as a JSON list
|
||||||
|
print(json.dumps(outlist))
|
||||||
|
|||||||
@@ -87,6 +87,30 @@
|
|||||||
</screenshots>
|
</screenshots>
|
||||||
|
|
||||||
<releases>
|
<releases>
|
||||||
|
<release version="2.7.4" date="2025-07-19">
|
||||||
|
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.7.4</url>
|
||||||
|
</release>
|
||||||
|
<release version="2.7.3" date="2025-07-10">
|
||||||
|
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.7.3</url>
|
||||||
|
</release>
|
||||||
|
<release version="2.7.2" date="2025-07-04">
|
||||||
|
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.7.2</url>
|
||||||
|
</release>
|
||||||
|
<release version="2.7.1" date="2025-06-27">
|
||||||
|
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.7.1</url>
|
||||||
|
</release>
|
||||||
|
<release version="2.7.0" date="2025-06-20">
|
||||||
|
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.7.0</url>
|
||||||
|
</release>
|
||||||
|
<release version="2.6.13" date="2025-06-16">
|
||||||
|
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.6.13</url>
|
||||||
|
</release>
|
||||||
|
<release version="2.6.12" date="2025-06-15">
|
||||||
|
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.6.12</url>
|
||||||
|
</release>
|
||||||
|
<release version="2.6.11" date="2025-06-02">
|
||||||
|
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.6.11</url>
|
||||||
|
</release>
|
||||||
<release version="2.6.10" date="2025-05-25">
|
<release version="2.6.10" date="2025-05-25">
|
||||||
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.6.10</url>
|
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.6.10</url>
|
||||||
</release>
|
</release>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
# trunk-ignore-all(flake8/F821): For SConstruct imports
|
# trunk-ignore-all(flake8/F821): For SConstruct imports
|
||||||
import sys
|
import sys
|
||||||
from os.path import join
|
from os.path import join
|
||||||
|
import subprocess
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@@ -92,6 +93,17 @@ prefsLoc = projenv["PROJECT_DIR"] + "/version.properties"
|
|||||||
verObj = readProps(prefsLoc)
|
verObj = readProps(prefsLoc)
|
||||||
print("Using meshtastic platformio-custom.py, firmware version " + verObj["long"] + " on " + env.get("PIOENV"))
|
print("Using meshtastic platformio-custom.py, firmware version " + verObj["long"] + " on " + env.get("PIOENV"))
|
||||||
|
|
||||||
|
# get repository owner if git is installed
|
||||||
|
try:
|
||||||
|
r_owner = (
|
||||||
|
subprocess.check_output(["git", "config", "--get", "remote.origin.url"])
|
||||||
|
.decode("utf-8")
|
||||||
|
.strip().split("/")
|
||||||
|
)
|
||||||
|
repo_owner = r_owner[-2] + "/" + r_owner[-1].replace(".git", "")
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
repo_owner = "unknown"
|
||||||
|
|
||||||
jsonLoc = env["PROJECT_DIR"] + "/userPrefs.jsonc"
|
jsonLoc = env["PROJECT_DIR"] + "/userPrefs.jsonc"
|
||||||
with open(jsonLoc) as f:
|
with open(jsonLoc) as f:
|
||||||
jsonStr = re.sub("//.*","", f.read(), flags=re.MULTILINE)
|
jsonStr = re.sub("//.*","", f.read(), flags=re.MULTILINE)
|
||||||
@@ -117,6 +129,7 @@ flags = [
|
|||||||
"-DAPP_VERSION=" + verObj["long"],
|
"-DAPP_VERSION=" + verObj["long"],
|
||||||
"-DAPP_VERSION_SHORT=" + verObj["short"],
|
"-DAPP_VERSION_SHORT=" + verObj["short"],
|
||||||
"-DAPP_ENV=" + env.get("PIOENV"),
|
"-DAPP_ENV=" + env.get("PIOENV"),
|
||||||
|
"-DAPP_REPO=" + repo_owner,
|
||||||
] + pref_flags
|
] + pref_flags
|
||||||
|
|
||||||
print ("Using flags:")
|
print ("Using flags:")
|
||||||
@@ -131,3 +144,33 @@ for lb in env.GetLibBuilders():
|
|||||||
if lb.name == "meshtastic-device-ui":
|
if lb.name == "meshtastic-device-ui":
|
||||||
lb.env.Append(CPPDEFINES=[("APP_VERSION", verObj["long"])])
|
lb.env.Append(CPPDEFINES=[("APP_VERSION", verObj["long"])])
|
||||||
break
|
break
|
||||||
|
|
||||||
|
# Get the display resolution from macros
|
||||||
|
def get_display_resolution(build_flags):
|
||||||
|
# Check "DISPLAY_SIZE" to determine the screen resolution
|
||||||
|
for flag in build_flags:
|
||||||
|
if isinstance(flag, tuple) and flag[0] == "DISPLAY_SIZE":
|
||||||
|
screen_width, screen_height = map(int, flag[1].split("x"))
|
||||||
|
return screen_width, screen_height
|
||||||
|
print("No screen resolution defined in build_flags. Please define DISPLAY_SIZE.")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
def load_boot_logo(source, target, env):
|
||||||
|
build_flags = env.get("CPPDEFINES", [])
|
||||||
|
logo_w, logo_h = get_display_resolution(build_flags)
|
||||||
|
print(f"TFT build with {logo_w}x{logo_h} resolution detected")
|
||||||
|
|
||||||
|
# Load the boot logo from `branding/logo_<width>x<height>.png` if it exists
|
||||||
|
source_path = join(env["PROJECT_DIR"], "branding", f"logo_{logo_w}x{logo_h}.png")
|
||||||
|
dest_dir = join(env["PROJECT_DIR"], "data", "boot")
|
||||||
|
dest_path = join(dest_dir, "logo.png")
|
||||||
|
if env.File(source_path).exists():
|
||||||
|
print(f"Loading boot logo from {source_path}")
|
||||||
|
# Prepare the destination
|
||||||
|
env.Execute(f"mkdir -p {dest_dir} && rm -f {dest_path}")
|
||||||
|
# Copy the logo to the `data/boot` directory
|
||||||
|
env.Execute(f"cp {source_path} {dest_path}")
|
||||||
|
|
||||||
|
# Load the boot logo on TFT builds
|
||||||
|
if ("HAS_TFT", 1) in env.get("CPPDEFINES", []):
|
||||||
|
env.AddPreAction('$BUILD_DIR/littlefs.bin', load_boot_logo)
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
2.5.3
|
2.6.4
|
||||||
@@ -48,6 +48,6 @@
|
|||||||
"require_upload_port": true,
|
"require_upload_port": true,
|
||||||
"wait_for_upload_port": true
|
"wait_for_upload_port": true
|
||||||
},
|
},
|
||||||
"url": "FIXME",
|
"url": "https://www.elecrow.com/thinknode-m1-meshtastic-lora-signal-transceiver-powered-by-nrf52840-with-154-screen-support-gps.html",
|
||||||
"vendor": "ELECROW"
|
"vendor": "ELECROW"
|
||||||
}
|
}
|
||||||
|
|||||||
52
boards/gat562_mesh_trial_tracker.json
Normal file
52
boards/gat562_mesh_trial_tracker.json
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"arduino": {
|
||||||
|
"ldscript": "nrf52840_s140_v6.ld"
|
||||||
|
},
|
||||||
|
"core": "nRF5",
|
||||||
|
"cpu": "cortex-m4",
|
||||||
|
"extra_flags": "-DARDUINO_NRF52840_FEATHER -DNRF52840_XXAA",
|
||||||
|
"f_cpu": "64000000L",
|
||||||
|
"hwids": [
|
||||||
|
["0x239A", "0x8029"],
|
||||||
|
["0x239A", "0x0029"],
|
||||||
|
["0x239A", "0x002A"],
|
||||||
|
["0x239A", "0x802A"]
|
||||||
|
],
|
||||||
|
"usb_product": "GAT562 Mesh Trial Tracker",
|
||||||
|
"mcu": "nrf52840",
|
||||||
|
"variant": "gat562_mesh_trial_tracker",
|
||||||
|
"bsp": {
|
||||||
|
"name": "adafruit"
|
||||||
|
},
|
||||||
|
"softdevice": {
|
||||||
|
"sd_flags": "-DS140",
|
||||||
|
"sd_name": "s140",
|
||||||
|
"sd_version": "6.1.1",
|
||||||
|
"sd_fwid": "0x00B6"
|
||||||
|
},
|
||||||
|
"bootloader": {
|
||||||
|
"settings_addr": "0xFF000"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"connectivity": ["bluetooth"],
|
||||||
|
"debug": {
|
||||||
|
"jlink_device": "nRF52840_xxAA",
|
||||||
|
"svd_path": "nrf52840.svd",
|
||||||
|
"openocd_target": "nrf52840-mdk-rs"
|
||||||
|
},
|
||||||
|
"frameworks": ["arduino", "freertos"],
|
||||||
|
"name": "GAT562 Mesh Trial Tracker",
|
||||||
|
"upload": {
|
||||||
|
"maximum_ram_size": 248832,
|
||||||
|
"maximum_size": 815104,
|
||||||
|
"speed": 115200,
|
||||||
|
"protocol": "nrfutil",
|
||||||
|
"protocols": ["jlink", "nrfjprog", "nrfutil", "stlink"],
|
||||||
|
"use_1200bps_touch": true,
|
||||||
|
"require_upload_port": true,
|
||||||
|
"wait_for_upload_port": true
|
||||||
|
},
|
||||||
|
"url": "http://www.gat-iot.com/",
|
||||||
|
"vendor": "GAT-IOT"
|
||||||
|
}
|
||||||
@@ -10,7 +10,8 @@
|
|||||||
"hwids": [
|
"hwids": [
|
||||||
["0x239A", "0x4405"],
|
["0x239A", "0x4405"],
|
||||||
["0x239A", "0x0029"],
|
["0x239A", "0x0029"],
|
||||||
["0x239A", "0x002A"]
|
["0x239A", "0x002A"],
|
||||||
|
["0x2886", "0x1667"]
|
||||||
],
|
],
|
||||||
"usb_product": "HT-n5262",
|
"usb_product": "HT-n5262",
|
||||||
"mcu": "nrf52840",
|
"mcu": "nrf52840",
|
||||||
@@ -48,6 +49,6 @@
|
|||||||
"require_upload_port": true,
|
"require_upload_port": true,
|
||||||
"wait_for_upload_port": true
|
"wait_for_upload_port": true
|
||||||
},
|
},
|
||||||
"url": "FIXME",
|
"url": "https://heltec.org/project/mesh-node-t114/",
|
||||||
"vendor": "Heltec"
|
"vendor": "Heltec"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,10 @@
|
|||||||
"cpu": "cortex-m4",
|
"cpu": "cortex-m4",
|
||||||
"extra_flags": "-DARDUINO_MDBT50Q_RX -DNRF52840_XXAA",
|
"extra_flags": "-DARDUINO_MDBT50Q_RX -DNRF52840_XXAA",
|
||||||
"f_cpu": "64000000L",
|
"f_cpu": "64000000L",
|
||||||
"hwids": [["0x2886", "0x1668"]],
|
"hwids": [
|
||||||
|
["0x2886", "0x1668"],
|
||||||
|
["0x2886", "0x1667"]
|
||||||
|
],
|
||||||
"usb_product": "TRACKER L1",
|
"usb_product": "TRACKER L1",
|
||||||
"mcu": "nrf52840",
|
"mcu": "nrf52840",
|
||||||
"variant": "seeed_wio_tracker_L1",
|
"variant": "seeed_wio_tracker_L1",
|
||||||
|
|||||||
@@ -7,9 +7,7 @@
|
|||||||
"cpu": "cortex-m4",
|
"cpu": "cortex-m4",
|
||||||
"extra_flags": "-DARDUINO_MDBT50Q_RX -DNRF52840_XXAA",
|
"extra_flags": "-DARDUINO_MDBT50Q_RX -DNRF52840_XXAA",
|
||||||
"f_cpu": "64000000L",
|
"f_cpu": "64000000L",
|
||||||
"hwids": [
|
"hwids": [["0x2886", "0x0166"]],
|
||||||
["0x2886", "0x0166"]
|
|
||||||
],
|
|
||||||
"usb_product": "XIAO-BOOT",
|
"usb_product": "XIAO-BOOT",
|
||||||
"mcu": "nrf52840",
|
"mcu": "nrf52840",
|
||||||
"variant": "seeed_xiao_nrf52840_kit",
|
"variant": "seeed_xiao_nrf52840_kit",
|
||||||
|
|||||||
43
boards/t-deck-pro.json
Normal file
43
boards/t-deck-pro.json
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"arduino": {
|
||||||
|
"ldscript": "esp32s3_out.ld",
|
||||||
|
"memory_type": "qio_qspi",
|
||||||
|
"partitions": "default_16MB.csv"
|
||||||
|
},
|
||||||
|
"core": "esp32",
|
||||||
|
"extra_flags": [
|
||||||
|
"-DBOARD_HAS_PSRAM",
|
||||||
|
"-DARDUINO_USB_CDC_ON_BOOT=1",
|
||||||
|
"-DARDUINO_USB_MODE=1",
|
||||||
|
"-DARDUINO_RUNNING_CORE=1",
|
||||||
|
"-DARDUINO_EVENT_RUNNING_CORE=1"
|
||||||
|
],
|
||||||
|
"f_cpu": "240000000L",
|
||||||
|
"f_flash": "80000000L",
|
||||||
|
"flash_mode": "qio",
|
||||||
|
"hwids": [["0x303A", "0x1001"]],
|
||||||
|
"mcu": "esp32s3",
|
||||||
|
"variant": "esp32s3"
|
||||||
|
},
|
||||||
|
"connectivity": ["wifi", "bluetooth", "lora"],
|
||||||
|
"debug": {
|
||||||
|
"default_tool": "esp-builtin",
|
||||||
|
"onboard_tools": ["esp-builtin"],
|
||||||
|
"openocd_target": "esp32s3.cfg"
|
||||||
|
},
|
||||||
|
"frameworks": ["arduino", "espidf"],
|
||||||
|
"name": "LilyGo T-Deck Pro S3 (16M Flash 8M QSPI PSRAM )",
|
||||||
|
"upload": {
|
||||||
|
"flash_size": "16MB",
|
||||||
|
"maximum_ram_size": 327680,
|
||||||
|
"maximum_size": 16777216,
|
||||||
|
"require_upload_port": true,
|
||||||
|
"speed": 921600
|
||||||
|
},
|
||||||
|
"monitor": {
|
||||||
|
"speed": 115200
|
||||||
|
},
|
||||||
|
"url": "https://lilygo.cc/products/t-deck-pro",
|
||||||
|
"vendor": "LilyGo"
|
||||||
|
}
|
||||||
@@ -11,7 +11,8 @@
|
|||||||
["0x239A", "0x8029"],
|
["0x239A", "0x8029"],
|
||||||
["0x239A", "0x0029"],
|
["0x239A", "0x0029"],
|
||||||
["0x239A", "0x002A"],
|
["0x239A", "0x002A"],
|
||||||
["0x239A", "0x802A"]
|
["0x239A", "0x802A"],
|
||||||
|
["0x2886", "0x0057"]
|
||||||
],
|
],
|
||||||
"usb_product": "T1000-E-BOOT",
|
"usb_product": "T1000-E-BOOT",
|
||||||
"mcu": "nrf52840",
|
"mcu": "nrf52840",
|
||||||
|
|||||||
41
boards/wiscore_rak3312.json
Normal file
41
boards/wiscore_rak3312.json
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"arduino": {
|
||||||
|
"ldscript": "esp32s3_out.ld",
|
||||||
|
"memory_type": "qio_opi",
|
||||||
|
"partitions": "default_16MB.csv"
|
||||||
|
},
|
||||||
|
"core": "esp32",
|
||||||
|
"extra_flags": [
|
||||||
|
"-DRAK3312",
|
||||||
|
"-DARDUINO_USB_CDC_ON_BOOT=1",
|
||||||
|
"-DARDUINO_USB_MODE=1",
|
||||||
|
"-DARDUINO_RUNNING_CORE=1",
|
||||||
|
"-DARDUINO_EVENT_RUNNING_CORE=1",
|
||||||
|
"-DBOARD_HAS_PSRAM"
|
||||||
|
],
|
||||||
|
"f_cpu": "240000000L",
|
||||||
|
"f_flash": "80000000L",
|
||||||
|
"flash_mode": "dio",
|
||||||
|
"hwids": [["0x303A", "0x1001"]],
|
||||||
|
"mcu": "esp32s3",
|
||||||
|
"variant": "rak3312"
|
||||||
|
},
|
||||||
|
"connectivity": ["wifi", "bluetooth"],
|
||||||
|
"debug": {
|
||||||
|
"openocd_target": "esp32s3.cfg"
|
||||||
|
},
|
||||||
|
"frameworks": ["arduino", "espidf"],
|
||||||
|
"name": "WisCore RAK3312 Board",
|
||||||
|
"upload": {
|
||||||
|
"flash_size": "16MB",
|
||||||
|
"maximum_ram_size": 327680,
|
||||||
|
"maximum_size": 16777216,
|
||||||
|
"use_1200bps_touch": true,
|
||||||
|
"wait_for_upload_port": true,
|
||||||
|
"require_upload_port": true,
|
||||||
|
"speed": 921600
|
||||||
|
},
|
||||||
|
"url": "https://www.rakwireless.com/en-us",
|
||||||
|
"vendor": "rakwireless"
|
||||||
|
}
|
||||||
17
branding/README.md
Normal file
17
branding/README.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Meshtastic Branding / Whitelabeling
|
||||||
|
|
||||||
|
This directory is consumed during the creation of **event** firmware.
|
||||||
|
|
||||||
|
`bin/platformio-custom.py` determines the display resolution, and locates the corresponding `logo_<width>x<height>.png`.
|
||||||
|
|
||||||
|
Ex:
|
||||||
|
|
||||||
|
- `logo_800x480.png`
|
||||||
|
- `logo_480x480.png`
|
||||||
|
- `logo_480x320.png`
|
||||||
|
- `logo_320x480.png`
|
||||||
|
- `logo_320x240.png`
|
||||||
|
|
||||||
|
This file is copied to `data/boot/logo.png` before filesytem image compilation.
|
||||||
|
|
||||||
|
For additional examples see the [`event/defcon33` branch](https://github.com/meshtastic/firmware/tree/event/defcon33).
|
||||||
22
debian/changelog
vendored
22
debian/changelog
vendored
@@ -1,4 +1,4 @@
|
|||||||
meshtasticd (2.6.10.0) UNRELEASED; urgency=medium
|
meshtasticd (2.7.4.0) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
[ Austin Lane ]
|
[ Austin Lane ]
|
||||||
* Initial packaging
|
* Initial packaging
|
||||||
@@ -16,4 +16,22 @@ meshtasticd (2.6.10.0) UNRELEASED; urgency=medium
|
|||||||
[ ]
|
[ ]
|
||||||
* GitHub Actions Automatic version bump
|
* GitHub Actions Automatic version bump
|
||||||
|
|
||||||
-- <github-actions[bot]@users.noreply.github.com> Sun, 25 May 2025 20:46:49 +0000
|
[ ]
|
||||||
|
* GitHub Actions Automatic version bump
|
||||||
|
|
||||||
|
[ ]
|
||||||
|
* GitHub Actions Automatic version bump
|
||||||
|
|
||||||
|
[ ]
|
||||||
|
* GitHub Actions Automatic version bump
|
||||||
|
|
||||||
|
[ ]
|
||||||
|
* GitHub Actions Automatic version bump
|
||||||
|
|
||||||
|
[ Ubuntu ]
|
||||||
|
* GitHub Actions Automatic version bump
|
||||||
|
|
||||||
|
[ ]
|
||||||
|
* GitHub Actions Automatic version bump
|
||||||
|
|
||||||
|
-- <github-actions[bot]@users.noreply.github.com> Sat, 19 Jul 2025 11:36:55 +0000
|
||||||
|
|||||||
2
debian/meshtasticd.postinst
vendored
2
debian/meshtasticd.postinst
vendored
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
# postinst script for meshtasticd
|
# postinst script for meshtasticd
|
||||||
#
|
#
|
||||||
# see: dh_installdeb(1)
|
# see: dh_installdeb(1)
|
||||||
|
|||||||
2
debian/meshtasticd.postrm
vendored
2
debian/meshtasticd.postrm
vendored
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
# postrm script for meshtasticd
|
# postrm script for meshtasticd
|
||||||
#
|
#
|
||||||
# see: dh_installdeb(1)
|
# see: dh_installdeb(1)
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ default_envs = tbeam
|
|||||||
|
|
||||||
extra_configs =
|
extra_configs =
|
||||||
arch/*/*.ini
|
arch/*/*.ini
|
||||||
variants/*/platformio.ini
|
variants/*/*/platformio.ini
|
||||||
|
variants/*/diy/*/platformio.ini
|
||||||
src/graphics/niche/InkHUD/PlatformioConfig.ini
|
src/graphics/niche/InkHUD/PlatformioConfig.ini
|
||||||
|
|
||||||
description = Meshtastic
|
description = Meshtastic
|
||||||
@@ -49,10 +50,11 @@ build_flags = -Wno-missing-field-initializers
|
|||||||
-DMESHTASTIC_EXCLUDE_DROPZONE=1
|
-DMESHTASTIC_EXCLUDE_DROPZONE=1
|
||||||
-DMESHTASTIC_EXCLUDE_REMOTEHARDWARE=1
|
-DMESHTASTIC_EXCLUDE_REMOTEHARDWARE=1
|
||||||
-DMESHTASTIC_EXCLUDE_HEALTH_TELEMETRY=1
|
-DMESHTASTIC_EXCLUDE_HEALTH_TELEMETRY=1
|
||||||
-DMESHTASTIC_EXCLUDE_POWERSTRESS=1 ; exclude power stress test module from main firmware
|
-DMESHTASTIC_EXCLUDE_POWERSTRESS=1 ; exclude power stress test module from main firmware
|
||||||
-DMESHTASTIC_EXCLUDE_GENERIC_THREAD_MODULE=1
|
-DMESHTASTIC_EXCLUDE_GENERIC_THREAD_MODULE=1
|
||||||
#-DBUILD_EPOCH=$UNIX_TIME
|
-D MAX_THREADS=40 ; As we've split modules, we have more threads to manage
|
||||||
#-D OLED_PL=1
|
#-DBUILD_EPOCH=$UNIX_TIME
|
||||||
|
#-D OLED_PL=1
|
||||||
|
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
monitor_filters = direct
|
monitor_filters = direct
|
||||||
@@ -103,18 +105,18 @@ lib_deps =
|
|||||||
[radiolib_base]
|
[radiolib_base]
|
||||||
lib_deps =
|
lib_deps =
|
||||||
# renovate: datasource=custom.pio depName=RadioLib packageName=jgromes/library/RadioLib
|
# renovate: datasource=custom.pio depName=RadioLib packageName=jgromes/library/RadioLib
|
||||||
jgromes/RadioLib@7.1.2
|
jgromes/RadioLib@7.2.1
|
||||||
|
|
||||||
[device-ui_base]
|
[device-ui_base]
|
||||||
lib_deps =
|
lib_deps =
|
||||||
# renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master
|
# renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master
|
||||||
https://github.com/meshtastic/device-ui/archive/37e2fb84a8d1b7d8cc1e2ed00d34cfb1f284bd59.zip
|
https://github.com/meshtastic/device-ui/archive/c75d545bf9e8d1fe20051c319f427f711113ff22.zip
|
||||||
|
|
||||||
; Common libs for environmental measurements in telemetry module
|
; Common libs for environmental measurements in telemetry module
|
||||||
[environmental_base]
|
[environmental_base]
|
||||||
lib_deps =
|
lib_deps =
|
||||||
# renovate: datasource=custom.pio depName=Adafruit BusIO packageName=adafruit/library/Adafruit BusIO
|
# renovate: datasource=custom.pio depName=Adafruit BusIO packageName=adafruit/library/Adafruit BusIO
|
||||||
adafruit/Adafruit BusIO@1.17.1
|
adafruit/Adafruit BusIO@1.17.2
|
||||||
# renovate: datasource=custom.pio depName=Adafruit Unified Sensor packageName=adafruit/library/Adafruit Unified Sensor
|
# renovate: datasource=custom.pio depName=Adafruit Unified Sensor packageName=adafruit/library/Adafruit Unified Sensor
|
||||||
adafruit/Adafruit Unified Sensor@1.1.15
|
adafruit/Adafruit Unified Sensor@1.1.15
|
||||||
# renovate: datasource=custom.pio depName=Adafruit BMP280 packageName=adafruit/library/Adafruit BMP280 Library
|
# renovate: datasource=custom.pio depName=Adafruit BMP280 packageName=adafruit/library/Adafruit BMP280 Library
|
||||||
@@ -128,7 +130,7 @@ lib_deps =
|
|||||||
# renovate: datasource=custom.pio depName=Adafruit MCP9808 packageName=adafruit/library/Adafruit MCP9808 Library
|
# renovate: datasource=custom.pio depName=Adafruit MCP9808 packageName=adafruit/library/Adafruit MCP9808 Library
|
||||||
adafruit/Adafruit MCP9808 Library@2.0.2
|
adafruit/Adafruit MCP9808 Library@2.0.2
|
||||||
# renovate: datasource=custom.pio depName=Adafruit INA260 packageName=adafruit/library/Adafruit INA260 Library
|
# renovate: datasource=custom.pio depName=Adafruit INA260 packageName=adafruit/library/Adafruit INA260 Library
|
||||||
adafruit/Adafruit INA260 Library@1.5.2
|
adafruit/Adafruit INA260 Library@1.5.3
|
||||||
# renovate: datasource=custom.pio depName=Adafruit INA219 packageName=adafruit/library/Adafruit INA219
|
# renovate: datasource=custom.pio depName=Adafruit INA219 packageName=adafruit/library/Adafruit INA219
|
||||||
adafruit/Adafruit INA219@1.2.3
|
adafruit/Adafruit INA219@1.2.3
|
||||||
# renovate: datasource=custom.pio depName=Adafruit PM25 AQI Sensor packageName=adafruit/library/Adafruit PM25 AQI Sensor
|
# renovate: datasource=custom.pio depName=Adafruit PM25 AQI Sensor packageName=adafruit/library/Adafruit PM25 AQI Sensor
|
||||||
@@ -165,8 +167,10 @@ lib_deps =
|
|||||||
adafruit/Adafruit LTR390 Library@1.1.2
|
adafruit/Adafruit LTR390 Library@1.1.2
|
||||||
# renovate: datasource=custom.pio depName=Adafruit PCT2075 packageName=adafruit/library/Adafruit PCT2075
|
# renovate: datasource=custom.pio depName=Adafruit PCT2075 packageName=adafruit/library/Adafruit PCT2075
|
||||||
adafruit/Adafruit PCT2075@1.0.5
|
adafruit/Adafruit PCT2075@1.0.5
|
||||||
|
# renovate: datasource=custom.pio depName=DFRobot_BMM150 packageName=dfrobot/library/DFRobot_BMM150
|
||||||
; (not included in native / portduino)
|
dfrobot/DFRobot_BMM150@1.0.0
|
||||||
|
|
||||||
|
; (not included in native / portduino)
|
||||||
[environmental_extra]
|
[environmental_extra]
|
||||||
lib_deps =
|
lib_deps =
|
||||||
# renovate: datasource=custom.pio depName=Adafruit BMP3XX packageName=adafruit/library/Adafruit BMP3XX Library
|
# renovate: datasource=custom.pio depName=Adafruit BMP3XX packageName=adafruit/library/Adafruit BMP3XX Library
|
||||||
@@ -192,4 +196,8 @@ lib_deps =
|
|||||||
# renovate: datasource=custom.pio depName=Bosch BME68x packageName=boschsensortec/library/BME68x Sensor Library
|
# renovate: datasource=custom.pio depName=Bosch BME68x packageName=boschsensortec/library/BME68x Sensor Library
|
||||||
boschsensortec/BME68x Sensor Library@1.3.40408
|
boschsensortec/BME68x Sensor Library@1.3.40408
|
||||||
# renovate: datasource=git-refs depName=meshtastic-DFRobot_LarkWeatherStation packageName=https://github.com/meshtastic/DFRobot_LarkWeatherStation gitBranch=master
|
# renovate: datasource=git-refs depName=meshtastic-DFRobot_LarkWeatherStation packageName=https://github.com/meshtastic/DFRobot_LarkWeatherStation gitBranch=master
|
||||||
https://github.com/meshtastic/DFRobot_LarkWeatherStation/archive/4de3a9cadef0f6a5220a8a906cf9775b02b0040d.zip
|
https://github.com/meshtastic/DFRobot_LarkWeatherStation/archive/4de3a9cadef0f6a5220a8a906cf9775b02b0040d.zip
|
||||||
|
# renovate: datasource=custom.pio depName=Sensirion Core packageName=sensirion/library/Sensirion Core
|
||||||
|
sensirion/Sensirion Core@0.7.1
|
||||||
|
# renovate: datasource=custom.pio depName=Sensirion I2C SCD4x packageName=sensirion/library/Sensirion I2C SCD4x
|
||||||
|
sensirion/Sensirion I2C SCD4x@1.1.0
|
||||||
|
|||||||
Submodule protobufs updated: 24c7a3d287...1ecf94da98
@@ -59,82 +59,82 @@ class AmbientLightingThread : public concurrency::OSThread
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LOG_DEBUG("AmbientLighting init");
|
LOG_DEBUG("AmbientLighting init");
|
||||||
#if defined(HAS_NCP5623) || defined(HAS_LP5562)
|
#ifdef HAS_NCP5623
|
||||||
if (_type == ScanI2C::NCP5623) {
|
if (_type == ScanI2C::NCP5623) {
|
||||||
rgb.begin();
|
rgb.begin();
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_LP5562
|
#ifdef HAS_LP5562
|
||||||
} else if (_type == ScanI2C::LP5562) {
|
if (_type == ScanI2C::LP5562) {
|
||||||
rgbw.begin();
|
rgbw.begin();
|
||||||
#endif
|
#endif
|
||||||
#ifdef RGBLED_RED
|
#ifdef RGBLED_RED
|
||||||
pinMode(RGBLED_RED, OUTPUT);
|
pinMode(RGBLED_RED, OUTPUT);
|
||||||
pinMode(RGBLED_GREEN, OUTPUT);
|
pinMode(RGBLED_GREEN, OUTPUT);
|
||||||
pinMode(RGBLED_BLUE, OUTPUT);
|
pinMode(RGBLED_BLUE, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_NEOPIXEL
|
#ifdef HAS_NEOPIXEL
|
||||||
pixels.begin(); // Initialise the pixel(s)
|
pixels.begin(); // Initialise the pixel(s)
|
||||||
pixels.clear(); // Set all pixel colors to 'off'
|
pixels.clear(); // Set all pixel colors to 'off'
|
||||||
pixels.setBrightness(moduleConfig.ambient_lighting.current);
|
pixels.setBrightness(moduleConfig.ambient_lighting.current);
|
||||||
#endif
|
#endif
|
||||||
setLighting();
|
setLighting();
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAS_NCP5623) || defined(HAS_LP5562)
|
#if defined(HAS_NCP5623) || defined(HAS_LP5562)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int32_t runOnce() override
|
int32_t runOnce() override
|
||||||
{
|
{
|
||||||
#ifdef HAS_RGB_LED
|
#ifdef HAS_RGB_LED
|
||||||
#if defined(HAS_NCP5623) || defined(HAS_LP5562)
|
#if defined(HAS_NCP5623) || defined(HAS_LP5562)
|
||||||
if ((_type == ScanI2C::NCP5623 || _type == ScanI2C::LP5562) && moduleConfig.ambient_lighting.led_state) {
|
if ((_type == ScanI2C::NCP5623 || _type == ScanI2C::LP5562) && moduleConfig.ambient_lighting.led_state) {
|
||||||
#endif
|
#endif
|
||||||
setLighting();
|
setLighting();
|
||||||
return 30000; // 30 seconds to reset from any animations that may have been running from Ext. Notification
|
return 30000; // 30 seconds to reset from any animations that may have been running from Ext. Notification
|
||||||
#if defined(HAS_NCP5623) || defined(HAS_LP5562)
|
#if defined(HAS_NCP5623) || defined(HAS_LP5562)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
return disable();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
return disable();
|
|
||||||
}
|
|
||||||
|
|
||||||
// When shutdown() is issued, setLightingOff will be called.
|
// When shutdown() is issued, setLightingOff will be called.
|
||||||
CallbackObserver<AmbientLightingThread, void *> notifyDeepSleepObserver =
|
CallbackObserver<AmbientLightingThread, void *> notifyDeepSleepObserver =
|
||||||
CallbackObserver<AmbientLightingThread, void *>(this, &AmbientLightingThread::setLightingOff);
|
CallbackObserver<AmbientLightingThread, void *>(this, &AmbientLightingThread::setLightingOff);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ScanI2C::DeviceType _type = ScanI2C::DeviceType::NONE;
|
ScanI2C::DeviceType _type = ScanI2C::DeviceType::NONE;
|
||||||
|
|
||||||
// Turn RGB lighting off, is used in junction to shutdown()
|
// Turn RGB lighting off, is used in junction to shutdown()
|
||||||
int setLightingOff(void *unused)
|
int setLightingOff(void *unused)
|
||||||
{
|
{
|
||||||
#ifdef HAS_NCP5623
|
#ifdef HAS_NCP5623
|
||||||
rgb.setCurrent(0);
|
rgb.setCurrent(0);
|
||||||
rgb.setRed(0);
|
rgb.setRed(0);
|
||||||
rgb.setGreen(0);
|
rgb.setGreen(0);
|
||||||
rgb.setBlue(0);
|
rgb.setBlue(0);
|
||||||
LOG_INFO("OFF: NCP5623 Ambient lighting");
|
LOG_INFO("OFF: NCP5623 Ambient lighting");
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_LP5562
|
#ifdef HAS_LP5562
|
||||||
rgbw.setCurrent(0);
|
rgbw.setCurrent(0);
|
||||||
rgbw.setRed(0);
|
rgbw.setRed(0);
|
||||||
rgbw.setGreen(0);
|
rgbw.setGreen(0);
|
||||||
rgbw.setBlue(0);
|
rgbw.setBlue(0);
|
||||||
rgbw.setWhite(0);
|
rgbw.setWhite(0);
|
||||||
LOG_INFO("OFF: LP5562 Ambient lighting");
|
LOG_INFO("OFF: LP5562 Ambient lighting");
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_NEOPIXEL
|
#ifdef HAS_NEOPIXEL
|
||||||
pixels.clear();
|
pixels.clear();
|
||||||
pixels.show();
|
pixels.show();
|
||||||
LOG_INFO("OFF: NeoPixel Ambient lighting");
|
LOG_INFO("OFF: NeoPixel Ambient lighting");
|
||||||
#endif
|
#endif
|
||||||
#ifdef RGBLED_CA
|
#ifdef RGBLED_CA
|
||||||
analogWrite(RGBLED_RED, 255 - 0);
|
analogWrite(RGBLED_RED, 255 - 0);
|
||||||
analogWrite(RGBLED_GREEN, 255 - 0);
|
analogWrite(RGBLED_GREEN, 255 - 0);
|
||||||
analogWrite(RGBLED_BLUE, 255 - 0);
|
analogWrite(RGBLED_BLUE, 255 - 0);
|
||||||
LOG_INFO("OFF: Ambient light RGB Common Anode");
|
LOG_INFO("OFF: Ambient light RGB Common Anode");
|
||||||
#elif defined(RGBLED_RED)
|
#elif defined(RGBLED_RED)
|
||||||
analogWrite(RGBLED_RED, 0);
|
analogWrite(RGBLED_RED, 0);
|
||||||
analogWrite(RGBLED_GREEN, 0);
|
analogWrite(RGBLED_GREEN, 0);
|
||||||
@@ -142,56 +142,57 @@ class AmbientLightingThread : public concurrency::OSThread
|
|||||||
LOG_INFO("OFF: Ambient light RGB Common Cathode");
|
LOG_INFO("OFF: Ambient light RGB Common Cathode");
|
||||||
#endif
|
#endif
|
||||||
#ifdef UNPHONE
|
#ifdef UNPHONE
|
||||||
unphone.rgb(0, 0, 0);
|
unphone.rgb(0, 0, 0);
|
||||||
LOG_INFO("OFF: unPhone Ambient lighting");
|
LOG_INFO("OFF: unPhone Ambient lighting");
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setLighting()
|
void setLighting()
|
||||||
{
|
{
|
||||||
#ifdef HAS_NCP5623
|
#ifdef HAS_NCP5623
|
||||||
rgb.setCurrent(moduleConfig.ambient_lighting.current);
|
rgb.setCurrent(moduleConfig.ambient_lighting.current);
|
||||||
rgb.setRed(moduleConfig.ambient_lighting.red);
|
rgb.setRed(moduleConfig.ambient_lighting.red);
|
||||||
rgb.setGreen(moduleConfig.ambient_lighting.green);
|
rgb.setGreen(moduleConfig.ambient_lighting.green);
|
||||||
rgb.setBlue(moduleConfig.ambient_lighting.blue);
|
rgb.setBlue(moduleConfig.ambient_lighting.blue);
|
||||||
LOG_DEBUG("Init NCP5623 Ambient light w/ current=%d, red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.current,
|
LOG_DEBUG("Init NCP5623 Ambient light w/ current=%d, red=%d, green=%d, blue=%d",
|
||||||
moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
moduleConfig.ambient_lighting.current, moduleConfig.ambient_lighting.red,
|
||||||
|
moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_LP5562
|
#ifdef HAS_LP5562
|
||||||
rgbw.setCurrent(moduleConfig.ambient_lighting.current);
|
rgbw.setCurrent(moduleConfig.ambient_lighting.current);
|
||||||
rgbw.setRed(moduleConfig.ambient_lighting.red);
|
rgbw.setRed(moduleConfig.ambient_lighting.red);
|
||||||
rgbw.setGreen(moduleConfig.ambient_lighting.green);
|
rgbw.setGreen(moduleConfig.ambient_lighting.green);
|
||||||
rgbw.setBlue(moduleConfig.ambient_lighting.blue);
|
rgbw.setBlue(moduleConfig.ambient_lighting.blue);
|
||||||
LOG_DEBUG("Init LP5562 Ambient light w/ current=%d, red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.current,
|
LOG_DEBUG("Init LP5562 Ambient light w/ current=%d, red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.current,
|
||||||
moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_NEOPIXEL
|
#ifdef HAS_NEOPIXEL
|
||||||
pixels.fill(pixels.Color(moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green,
|
pixels.fill(pixels.Color(moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green,
|
||||||
moduleConfig.ambient_lighting.blue),
|
moduleConfig.ambient_lighting.blue),
|
||||||
0, NEOPIXEL_COUNT);
|
0, NEOPIXEL_COUNT);
|
||||||
|
|
||||||
// RadioMaster Bandit has addressable LED at the two buttons
|
// RadioMaster Bandit has addressable LED at the two buttons
|
||||||
// this allow us to set different lighting for them in variant.h file.
|
// this allow us to set different lighting for them in variant.h file.
|
||||||
#ifdef RADIOMASTER_900_BANDIT
|
#ifdef RADIOMASTER_900_BANDIT
|
||||||
#if defined(BUTTON1_COLOR) && defined(BUTTON1_COLOR_INDEX)
|
#if defined(BUTTON1_COLOR) && defined(BUTTON1_COLOR_INDEX)
|
||||||
pixels.fill(BUTTON1_COLOR, BUTTON1_COLOR_INDEX, 1);
|
pixels.fill(BUTTON1_COLOR, BUTTON1_COLOR_INDEX, 1);
|
||||||
#endif
|
#endif
|
||||||
#if defined(BUTTON2_COLOR) && defined(BUTTON2_COLOR_INDEX)
|
#if defined(BUTTON2_COLOR) && defined(BUTTON2_COLOR_INDEX)
|
||||||
pixels.fill(BUTTON2_COLOR, BUTTON2_COLOR_INDEX, 1);
|
pixels.fill(BUTTON2_COLOR, BUTTON2_COLOR_INDEX, 1);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
pixels.show();
|
pixels.show();
|
||||||
LOG_DEBUG("Init NeoPixel Ambient light w/ brightness(current)=%d, red=%d, green=%d, blue=%d",
|
LOG_DEBUG("Init NeoPixel Ambient light w/ brightness(current)=%d, red=%d, green=%d, blue=%d",
|
||||||
moduleConfig.ambient_lighting.current, moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green,
|
moduleConfig.ambient_lighting.current, moduleConfig.ambient_lighting.red,
|
||||||
moduleConfig.ambient_lighting.blue);
|
moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
||||||
#endif
|
#endif
|
||||||
#ifdef RGBLED_CA
|
#ifdef RGBLED_CA
|
||||||
analogWrite(RGBLED_RED, 255 - moduleConfig.ambient_lighting.red);
|
analogWrite(RGBLED_RED, 255 - moduleConfig.ambient_lighting.red);
|
||||||
analogWrite(RGBLED_GREEN, 255 - moduleConfig.ambient_lighting.green);
|
analogWrite(RGBLED_GREEN, 255 - moduleConfig.ambient_lighting.green);
|
||||||
analogWrite(RGBLED_BLUE, 255 - moduleConfig.ambient_lighting.blue);
|
analogWrite(RGBLED_BLUE, 255 - moduleConfig.ambient_lighting.blue);
|
||||||
LOG_DEBUG("Init Ambient light RGB Common Anode w/ red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.red,
|
LOG_DEBUG("Init Ambient light RGB Common Anode w/ red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.red,
|
||||||
moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
||||||
#elif defined(RGBLED_RED)
|
#elif defined(RGBLED_RED)
|
||||||
analogWrite(RGBLED_RED, moduleConfig.ambient_lighting.red);
|
analogWrite(RGBLED_RED, moduleConfig.ambient_lighting.red);
|
||||||
analogWrite(RGBLED_GREEN, moduleConfig.ambient_lighting.green);
|
analogWrite(RGBLED_GREEN, moduleConfig.ambient_lighting.green);
|
||||||
@@ -200,11 +201,12 @@ class AmbientLightingThread : public concurrency::OSThread
|
|||||||
moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
||||||
#endif
|
#endif
|
||||||
#ifdef UNPHONE
|
#ifdef UNPHONE
|
||||||
unphone.rgb(moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
unphone.rgb(moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green,
|
||||||
LOG_DEBUG("Init unPhone Ambient light w/ red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.red,
|
moduleConfig.ambient_lighting.blue);
|
||||||
moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
LOG_DEBUG("Init unPhone Ambient light w/ red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.red,
|
||||||
|
moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace concurrency
|
} // namespace concurrency
|
||||||
|
|||||||
@@ -47,6 +47,20 @@ class AudioThread : public concurrency::OSThread
|
|||||||
setCPUFast(false);
|
setCPUFast(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void readAloud(const char *text)
|
||||||
|
{
|
||||||
|
if (i2sRtttl != nullptr) {
|
||||||
|
i2sRtttl->stop();
|
||||||
|
delete i2sRtttl;
|
||||||
|
i2sRtttl = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
ESP8266SAM *sam = new ESP8266SAM;
|
||||||
|
sam->Say(audioOut, text);
|
||||||
|
delete sam;
|
||||||
|
setCPUFast(false);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int32_t runOnce() override
|
int32_t runOnce() override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -88,10 +88,16 @@ class BluetoothStatus : public Status
|
|||||||
break;
|
break;
|
||||||
case ConnectionState::CONNECTED:
|
case ConnectionState::CONNECTED:
|
||||||
LOG_DEBUG("BluetoothStatus CONNECTED");
|
LOG_DEBUG("BluetoothStatus CONNECTED");
|
||||||
|
#ifdef BLE_LED
|
||||||
|
digitalWrite(BLE_LED, HIGH);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ConnectionState::DISCONNECTED:
|
case ConnectionState::DISCONNECTED:
|
||||||
LOG_DEBUG("BluetoothStatus DISCONNECTED");
|
LOG_DEBUG("BluetoothStatus DISCONNECTED");
|
||||||
|
#ifdef BLE_LED
|
||||||
|
digitalWrite(BLE_LED, LOW);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,4 +108,4 @@ class BluetoothStatus : public Status
|
|||||||
|
|
||||||
} // namespace meshtastic
|
} // namespace meshtastic
|
||||||
|
|
||||||
extern meshtastic::BluetoothStatus *bluetoothStatus;
|
extern meshtastic::BluetoothStatus *bluetoothStatus;
|
||||||
|
|||||||
@@ -1,467 +0,0 @@
|
|||||||
#include "ButtonThread.h"
|
|
||||||
|
|
||||||
#include "configuration.h"
|
|
||||||
#if !MESHTASTIC_EXCLUDE_GPS
|
|
||||||
#include "GPS.h"
|
|
||||||
#endif
|
|
||||||
#include "MeshService.h"
|
|
||||||
#include "PowerFSM.h"
|
|
||||||
#include "RadioLibInterface.h"
|
|
||||||
#include "buzz.h"
|
|
||||||
#include "main.h"
|
|
||||||
#include "modules/ExternalNotificationModule.h"
|
|
||||||
#include "power.h"
|
|
||||||
#include "sleep.h"
|
|
||||||
#ifdef ARCH_PORTDUINO
|
|
||||||
#include "platform/portduino/PortduinoGlue.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DEBUG_BUTTONS 0
|
|
||||||
#if DEBUG_BUTTONS
|
|
||||||
#define LOG_BUTTON(...) LOG_DEBUG(__VA_ARGS__)
|
|
||||||
#else
|
|
||||||
#define LOG_BUTTON(...)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace concurrency;
|
|
||||||
|
|
||||||
ButtonThread *buttonThread; // Declared extern in header
|
|
||||||
volatile ButtonThread::ButtonEventType ButtonThread::btnEvent = ButtonThread::BUTTON_EVENT_NONE;
|
|
||||||
|
|
||||||
#if defined(BUTTON_PIN) || defined(ARCH_PORTDUINO) || defined(USERPREFS_BUTTON_PIN)
|
|
||||||
OneButton ButtonThread::userButton; // Get reference to static member
|
|
||||||
#endif
|
|
||||||
ButtonThread::ButtonThread() : OSThread("Button")
|
|
||||||
{
|
|
||||||
#if defined(BUTTON_PIN) || defined(ARCH_PORTDUINO) || defined(USERPREFS_BUTTON_PIN)
|
|
||||||
|
|
||||||
#if defined(ARCH_PORTDUINO)
|
|
||||||
if (settingsMap.count(user) != 0 && settingsMap[user] != RADIOLIB_NC) {
|
|
||||||
this->userButton = OneButton(settingsMap[user], true, true);
|
|
||||||
LOG_DEBUG("Use GPIO%02d for button", settingsMap[user]);
|
|
||||||
}
|
|
||||||
#elif defined(BUTTON_PIN)
|
|
||||||
#if !defined(USERPREFS_BUTTON_PIN)
|
|
||||||
int pin = config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN; // Resolved button pin
|
|
||||||
#endif
|
|
||||||
#ifdef USERPREFS_BUTTON_PIN
|
|
||||||
int pin = config.device.button_gpio ? config.device.button_gpio : USERPREFS_BUTTON_PIN; // Resolved button pin
|
|
||||||
#endif
|
|
||||||
#if defined(HELTEC_CAPSULE_SENSOR_V3) || defined(HELTEC_SENSOR_HUB)
|
|
||||||
this->userButton = OneButton(pin, false, false);
|
|
||||||
#elif defined(BUTTON_ACTIVE_LOW)
|
|
||||||
this->userButton = OneButton(pin, BUTTON_ACTIVE_LOW, BUTTON_ACTIVE_PULLUP);
|
|
||||||
#else
|
|
||||||
this->userButton = OneButton(pin, true, true);
|
|
||||||
#endif
|
|
||||||
LOG_DEBUG("Use GPIO%02d for button", pin);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef INPUT_PULLUP_SENSE
|
|
||||||
// Some platforms (nrf52) have a SENSE variant which allows wake from sleep - override what OneButton did
|
|
||||||
#ifdef BUTTON_SENSE_TYPE
|
|
||||||
pinMode(pin, BUTTON_SENSE_TYPE);
|
|
||||||
#else
|
|
||||||
pinMode(pin, INPUT_PULLUP_SENSE);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(BUTTON_PIN) || defined(ARCH_PORTDUINO) || defined(USERPREFS_BUTTON_PIN)
|
|
||||||
userButton.attachClick(userButtonPressed);
|
|
||||||
userButton.setClickMs(BUTTON_CLICK_MS);
|
|
||||||
userButton.setPressMs(BUTTON_LONGPRESS_MS);
|
|
||||||
userButton.setDebounceMs(1);
|
|
||||||
userButton.attachDoubleClick(userButtonDoublePressed);
|
|
||||||
userButton.attachMultiClick(userButtonMultiPressed, this); // Reference to instance: get click count from non-static OneButton
|
|
||||||
#if !defined(T_DECK) && \
|
|
||||||
!defined( \
|
|
||||||
ELECROW_ThinkNode_M2) // T-Deck immediately wakes up after shutdown, Thinknode M2 has this on the smaller ALT button
|
|
||||||
userButton.attachLongPressStart(userButtonPressedLongStart);
|
|
||||||
userButton.attachLongPressStop(userButtonPressedLongStop);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BUTTON_PIN_ALT
|
|
||||||
#if defined(ELECROW_ThinkNode_M2)
|
|
||||||
this->userButtonAlt = OneButton(BUTTON_PIN_ALT, false, false);
|
|
||||||
#else
|
|
||||||
this->userButtonAlt = OneButton(BUTTON_PIN_ALT, true, true);
|
|
||||||
#endif
|
|
||||||
#ifdef INPUT_PULLUP_SENSE
|
|
||||||
// Some platforms (nrf52) have a SENSE variant which allows wake from sleep - override what OneButton did
|
|
||||||
pinMode(BUTTON_PIN_ALT, INPUT_PULLUP_SENSE);
|
|
||||||
#endif
|
|
||||||
userButtonAlt.attachClick(userButtonPressedScreen);
|
|
||||||
userButtonAlt.setClickMs(BUTTON_CLICK_MS);
|
|
||||||
userButtonAlt.setPressMs(BUTTON_LONGPRESS_MS);
|
|
||||||
userButtonAlt.setDebounceMs(1);
|
|
||||||
userButtonAlt.attachLongPressStart(userButtonPressedLongStart);
|
|
||||||
userButtonAlt.attachLongPressStop(userButtonPressedLongStop);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BUTTON_PIN_TOUCH
|
|
||||||
userButtonTouch = OneButton(BUTTON_PIN_TOUCH, true, true);
|
|
||||||
userButtonTouch.setPressMs(BUTTON_TOUCH_MS);
|
|
||||||
userButtonTouch.attachLongPressStart(touchPressedLongStart); // Better handling with longpress than click?
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ARCH_ESP32
|
|
||||||
// Register callbacks for before and after lightsleep
|
|
||||||
// Used to detach and reattach interrupts
|
|
||||||
lsObserver.observe(¬ifyLightSleep);
|
|
||||||
lsEndObserver.observe(¬ifyLightSleepEnd);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
attachButtonInterrupts();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void ButtonThread::switchPage()
|
|
||||||
{
|
|
||||||
#ifdef BUTTON_PIN
|
|
||||||
#if !defined(USERPREFS_BUTTON_PIN)
|
|
||||||
if (((config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN) !=
|
|
||||||
moduleConfig.canned_message.inputbroker_pin_press) ||
|
|
||||||
!(moduleConfig.canned_message.updown1_enabled || moduleConfig.canned_message.rotary1_enabled) ||
|
|
||||||
!moduleConfig.canned_message.enabled) {
|
|
||||||
powerFSM.trigger(EVENT_PRESS);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#if defined(USERPREFS_BUTTON_PIN)
|
|
||||||
if (((config.device.button_gpio ? config.device.button_gpio : USERPREFS_BUTTON_PIN) !=
|
|
||||||
moduleConfig.canned_message.inputbroker_pin_press) ||
|
|
||||||
!(moduleConfig.canned_message.updown1_enabled || moduleConfig.canned_message.rotary1_enabled) ||
|
|
||||||
!moduleConfig.canned_message.enabled) {
|
|
||||||
powerFSM.trigger(EVENT_PRESS);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#if defined(ARCH_PORTDUINO)
|
|
||||||
if ((settingsMap.count(user) != 0 && settingsMap[user] != RADIOLIB_NC) &&
|
|
||||||
(settingsMap[user] != moduleConfig.canned_message.inputbroker_pin_press) ||
|
|
||||||
!moduleConfig.canned_message.enabled) {
|
|
||||||
powerFSM.trigger(EVENT_PRESS);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void ButtonThread::sendAdHocPosition()
|
|
||||||
{
|
|
||||||
service->refreshLocalMeshNode();
|
|
||||||
auto sentPosition = service->trySendPosition(NODENUM_BROADCAST, true);
|
|
||||||
if (screen) {
|
|
||||||
if (sentPosition)
|
|
||||||
screen->print("Sent ad-hoc position\n");
|
|
||||||
else
|
|
||||||
screen->print("Sent ad-hoc nodeinfo\n");
|
|
||||||
screen->forceDisplay(true); // Force a new UI frame, then force an EInk update
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t ButtonThread::runOnce()
|
|
||||||
{
|
|
||||||
// If the button is pressed we suppress CPU sleep until release
|
|
||||||
canSleep = true; // Assume we should not keep the board awake
|
|
||||||
|
|
||||||
#if defined(BUTTON_PIN) || defined(USERPREFS_BUTTON_PIN)
|
|
||||||
userButton.tick();
|
|
||||||
canSleep &= userButton.isIdle();
|
|
||||||
#elif defined(ARCH_PORTDUINO)
|
|
||||||
if (settingsMap.count(user) != 0 && settingsMap[user] != RADIOLIB_NC) {
|
|
||||||
userButton.tick();
|
|
||||||
canSleep &= userButton.isIdle();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef BUTTON_PIN_ALT
|
|
||||||
userButtonAlt.tick();
|
|
||||||
canSleep &= userButtonAlt.isIdle();
|
|
||||||
#endif
|
|
||||||
#ifdef BUTTON_PIN_TOUCH
|
|
||||||
userButtonTouch.tick();
|
|
||||||
canSleep &= userButtonTouch.isIdle();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (btnEvent != BUTTON_EVENT_NONE) {
|
|
||||||
switch (btnEvent) {
|
|
||||||
case BUTTON_EVENT_PRESSED: {
|
|
||||||
LOG_BUTTON("press!");
|
|
||||||
// If a nag notification is running, stop it and prevent other actions
|
|
||||||
if (moduleConfig.external_notification.enabled && (externalNotificationModule->nagCycleCutoff != UINT32_MAX)) {
|
|
||||||
externalNotificationModule->stopNow();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#ifdef ELECROW_ThinkNode_M1
|
|
||||||
sendAdHocPosition();
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
switchPage();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case BUTTON_EVENT_PRESSED_SCREEN: {
|
|
||||||
LOG_BUTTON("AltPress!");
|
|
||||||
#ifdef ELECROW_ThinkNode_M1
|
|
||||||
// If a nag notification is running, stop it and prevent other actions
|
|
||||||
if (moduleConfig.external_notification.enabled && (externalNotificationModule->nagCycleCutoff != UINT32_MAX)) {
|
|
||||||
externalNotificationModule->stopNow();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
switchPage();
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
// turn screen on or off
|
|
||||||
screen_flag = !screen_flag;
|
|
||||||
if (screen)
|
|
||||||
screen->setOn(screen_flag);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case BUTTON_EVENT_DOUBLE_PRESSED: {
|
|
||||||
LOG_BUTTON("Double press!");
|
|
||||||
#ifdef ELECROW_ThinkNode_M1
|
|
||||||
digitalWrite(PIN_EINK_EN, digitalRead(PIN_EINK_EN) == LOW);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
sendAdHocPosition();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case BUTTON_EVENT_MULTI_PRESSED: {
|
|
||||||
LOG_BUTTON("Mulitipress! %hux", multipressClickCount);
|
|
||||||
switch (multipressClickCount) {
|
|
||||||
#if HAS_GPS && !defined(ELECROW_ThinkNode_M1)
|
|
||||||
// 3 clicks: toggle GPS
|
|
||||||
case 3:
|
|
||||||
if (!config.device.disable_triple_click && (gps != nullptr)) {
|
|
||||||
gps->toggleGpsMode();
|
|
||||||
if (screen)
|
|
||||||
screen->forceDisplay(true); // Force a new UI frame, then force an EInk update
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#elif defined(ELECROW_ThinkNode_M1) || defined(ELECROW_ThinkNode_M2)
|
|
||||||
case 3:
|
|
||||||
LOG_INFO("3 clicks: toggle buzzer");
|
|
||||||
buzzer_flag = !buzzer_flag;
|
|
||||||
if (!buzzer_flag)
|
|
||||||
noTone(PIN_BUZZER);
|
|
||||||
break;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(USE_EINK) && defined(PIN_EINK_EN) && !defined(ELECROW_ThinkNode_M1) // i.e. T-Echo
|
|
||||||
// 4 clicks: toggle backlight
|
|
||||||
case 4:
|
|
||||||
digitalWrite(PIN_EINK_EN, digitalRead(PIN_EINK_EN) == LOW);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#if !MESHTASTIC_EXCLUDE_SCREEN && HAS_SCREEN
|
|
||||||
// 5 clicks: start accelerometer/magenetometer calibration for 30 seconds
|
|
||||||
case 5:
|
|
||||||
if (accelerometerThread) {
|
|
||||||
accelerometerThread->calibrate(30);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
// 6 clicks: start accelerometer/magenetometer calibration for 60 seconds
|
|
||||||
case 6:
|
|
||||||
if (accelerometerThread) {
|
|
||||||
accelerometerThread->calibrate(60);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
// No valid multipress action
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
} // end switch: click count
|
|
||||||
|
|
||||||
break;
|
|
||||||
} // end multipress event
|
|
||||||
|
|
||||||
case BUTTON_EVENT_LONG_PRESSED: {
|
|
||||||
LOG_BUTTON("Long press!");
|
|
||||||
powerFSM.trigger(EVENT_PRESS);
|
|
||||||
if (screen) {
|
|
||||||
screen->startAlert("Shutting down...");
|
|
||||||
}
|
|
||||||
playBeep();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do actual shutdown when button released, otherwise the button release
|
|
||||||
// may wake the board immediatedly.
|
|
||||||
case BUTTON_EVENT_LONG_RELEASED: {
|
|
||||||
LOG_INFO("Shutdown from long press");
|
|
||||||
playShutdownMelody();
|
|
||||||
delay(3000);
|
|
||||||
power->shutdown();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef BUTTON_PIN_TOUCH
|
|
||||||
case BUTTON_EVENT_TOUCH_LONG_PRESSED: {
|
|
||||||
LOG_BUTTON("Touch press!");
|
|
||||||
// Ignore if: no screen
|
|
||||||
if (!screen)
|
|
||||||
break;
|
|
||||||
|
|
||||||
#ifdef TTGO_T_ECHO
|
|
||||||
// Ignore if: TX in progress
|
|
||||||
// Uncommon T-Echo hardware bug, LoRa TX triggers touch button
|
|
||||||
if (!RadioLibInterface::instance || RadioLibInterface::instance->isSending())
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Wake if asleep
|
|
||||||
if (powerFSM.getState() == &stateDARK)
|
|
||||||
powerFSM.trigger(EVENT_PRESS);
|
|
||||||
|
|
||||||
// Update display (legacy behaviour)
|
|
||||||
screen->forceDisplay();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif // BUTTON_PIN_TOUCH
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
btnEvent = BUTTON_EVENT_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 50;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Attach (or re-attach) hardware interrupts for buttons
|
|
||||||
* Public method. Used outside class when waking from MCU sleep
|
|
||||||
*/
|
|
||||||
void ButtonThread::attachButtonInterrupts()
|
|
||||||
{
|
|
||||||
#if defined(ARCH_PORTDUINO)
|
|
||||||
if (settingsMap.count(user) != 0 && settingsMap[user] != RADIOLIB_NC)
|
|
||||||
wakeOnIrq(settingsMap[user], FALLING);
|
|
||||||
#elif defined(BUTTON_PIN)
|
|
||||||
// Interrupt for user button, during normal use. Improves responsiveness.
|
|
||||||
attachInterrupt(
|
|
||||||
#if !defined(USERPREFS_BUTTON_PIN)
|
|
||||||
config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN,
|
|
||||||
#endif
|
|
||||||
#if defined(USERPREFS_BUTTON_PIN)
|
|
||||||
config.device.button_gpio ? config.device.button_gpio : USERPREFS_BUTTON_PIN,
|
|
||||||
#endif
|
|
||||||
[]() {
|
|
||||||
ButtonThread::userButton.tick();
|
|
||||||
runASAP = true;
|
|
||||||
BaseType_t higherWake = 0;
|
|
||||||
mainDelay.interruptFromISR(&higherWake);
|
|
||||||
},
|
|
||||||
CHANGE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BUTTON_PIN_ALT
|
|
||||||
#ifdef ELECROW_ThinkNode_M2
|
|
||||||
wakeOnIrq(BUTTON_PIN_ALT, RISING);
|
|
||||||
#else
|
|
||||||
wakeOnIrq(BUTTON_PIN_ALT, FALLING);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BUTTON_PIN_TOUCH
|
|
||||||
wakeOnIrq(BUTTON_PIN_TOUCH, FALLING);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Detach the "normal" button interrupts.
|
|
||||||
* Public method. Used before attaching a "wake-on-button" interrupt for MCU sleep
|
|
||||||
*/
|
|
||||||
void ButtonThread::detachButtonInterrupts()
|
|
||||||
{
|
|
||||||
#if defined(ARCH_PORTDUINO)
|
|
||||||
if (settingsMap.count(user) != 0 && settingsMap[user] != RADIOLIB_NC)
|
|
||||||
detachInterrupt(settingsMap[user]);
|
|
||||||
#elif defined(BUTTON_PIN)
|
|
||||||
#if !defined(USERPREFS_BUTTON_PIN)
|
|
||||||
detachInterrupt(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN);
|
|
||||||
#endif
|
|
||||||
#if defined(USERPREFS_BUTTON_PIN)
|
|
||||||
detachInterrupt(config.device.button_gpio ? config.device.button_gpio : USERPREFS_BUTTON_PIN);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BUTTON_PIN_ALT
|
|
||||||
detachInterrupt(BUTTON_PIN_ALT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BUTTON_PIN_TOUCH
|
|
||||||
detachInterrupt(BUTTON_PIN_TOUCH);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ARCH_ESP32
|
|
||||||
|
|
||||||
// Detach our class' interrupts before lightsleep
|
|
||||||
// Allows sleep.cpp to configure its own interrupts, which wake the device on user-button press
|
|
||||||
int ButtonThread::beforeLightSleep(void *unused)
|
|
||||||
{
|
|
||||||
detachButtonInterrupts();
|
|
||||||
return 0; // Indicates success
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reconfigure our interrupts
|
|
||||||
// Our class' interrupts were disconnected during sleep, to allow the user button to wake the device from sleep
|
|
||||||
int ButtonThread::afterLightSleep(esp_sleep_wakeup_cause_t cause)
|
|
||||||
{
|
|
||||||
attachButtonInterrupts();
|
|
||||||
return 0; // Indicates success
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Watch a GPIO and if we get an IRQ, wake the main thread.
|
|
||||||
* Use to add wake on button press
|
|
||||||
*/
|
|
||||||
void ButtonThread::wakeOnIrq(int irq, int mode)
|
|
||||||
{
|
|
||||||
attachInterrupt(
|
|
||||||
irq,
|
|
||||||
[] {
|
|
||||||
BaseType_t higherWake = 0;
|
|
||||||
mainDelay.interruptFromISR(&higherWake);
|
|
||||||
runASAP = true;
|
|
||||||
},
|
|
||||||
FALLING);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Static callback
|
|
||||||
void ButtonThread::userButtonMultiPressed(void *callerThread)
|
|
||||||
{
|
|
||||||
// Grab click count from non-static button, while the info is still valid
|
|
||||||
ButtonThread *thread = (ButtonThread *)callerThread;
|
|
||||||
thread->storeClickCount();
|
|
||||||
|
|
||||||
// Then handle later, in the usual way
|
|
||||||
btnEvent = BUTTON_EVENT_MULTI_PRESSED;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Non-static method, runs during callback. Grabs info while still valid
|
|
||||||
void ButtonThread::storeClickCount()
|
|
||||||
{
|
|
||||||
#if defined(BUTTON_PIN) || defined(USERPREFS_BUTTON_PIN)
|
|
||||||
multipressClickCount = userButton.getNumberClicks();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void ButtonThread::userButtonPressedLongStart()
|
|
||||||
{
|
|
||||||
if (millis() > c_holdOffTime) {
|
|
||||||
btnEvent = BUTTON_EVENT_LONG_PRESSED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ButtonThread::userButtonPressedLongStop()
|
|
||||||
{
|
|
||||||
if (millis() > c_holdOffTime) {
|
|
||||||
btnEvent = BUTTON_EVENT_LONG_RELEASED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "OneButton.h"
|
|
||||||
#include "concurrency/OSThread.h"
|
|
||||||
#include "configuration.h"
|
|
||||||
|
|
||||||
#ifndef BUTTON_CLICK_MS
|
|
||||||
#define BUTTON_CLICK_MS 250
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef BUTTON_LONGPRESS_MS
|
|
||||||
#define BUTTON_LONGPRESS_MS 5000
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef BUTTON_TOUCH_MS
|
|
||||||
#define BUTTON_TOUCH_MS 400
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class ButtonThread : public concurrency::OSThread
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static const uint32_t c_holdOffTime = 30000; // hold off 30s after boot
|
|
||||||
|
|
||||||
enum ButtonEventType {
|
|
||||||
BUTTON_EVENT_NONE,
|
|
||||||
BUTTON_EVENT_PRESSED,
|
|
||||||
BUTTON_EVENT_PRESSED_SCREEN,
|
|
||||||
BUTTON_EVENT_DOUBLE_PRESSED,
|
|
||||||
BUTTON_EVENT_MULTI_PRESSED,
|
|
||||||
BUTTON_EVENT_LONG_PRESSED,
|
|
||||||
BUTTON_EVENT_LONG_RELEASED,
|
|
||||||
BUTTON_EVENT_TOUCH_LONG_PRESSED,
|
|
||||||
};
|
|
||||||
|
|
||||||
ButtonThread();
|
|
||||||
int32_t runOnce() override;
|
|
||||||
void attachButtonInterrupts();
|
|
||||||
void detachButtonInterrupts();
|
|
||||||
void storeClickCount();
|
|
||||||
bool isBuzzing() { return buzzer_flag; }
|
|
||||||
void setScreenFlag(bool flag) { screen_flag = flag; }
|
|
||||||
bool getScreenFlag() { return screen_flag; }
|
|
||||||
|
|
||||||
// Disconnect and reconnect interrupts for light sleep
|
|
||||||
#ifdef ARCH_ESP32
|
|
||||||
int beforeLightSleep(void *unused);
|
|
||||||
int afterLightSleep(esp_sleep_wakeup_cause_t cause);
|
|
||||||
#endif
|
|
||||||
private:
|
|
||||||
#if defined(BUTTON_PIN) || defined(ARCH_PORTDUINO) || defined(USERPREFS_BUTTON_PIN)
|
|
||||||
static OneButton userButton; // Static - accessed from an interrupt
|
|
||||||
#endif
|
|
||||||
#ifdef BUTTON_PIN_ALT
|
|
||||||
OneButton userButtonAlt;
|
|
||||||
#endif
|
|
||||||
#ifdef BUTTON_PIN_TOUCH
|
|
||||||
OneButton userButtonTouch;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ARCH_ESP32
|
|
||||||
// Get notified when lightsleep begins and ends
|
|
||||||
CallbackObserver<ButtonThread, void *> lsObserver =
|
|
||||||
CallbackObserver<ButtonThread, void *>(this, &ButtonThread::beforeLightSleep);
|
|
||||||
CallbackObserver<ButtonThread, esp_sleep_wakeup_cause_t> lsEndObserver =
|
|
||||||
CallbackObserver<ButtonThread, esp_sleep_wakeup_cause_t>(this, &ButtonThread::afterLightSleep);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// set during IRQ
|
|
||||||
static volatile ButtonEventType btnEvent;
|
|
||||||
bool buzzer_flag = false;
|
|
||||||
bool screen_flag = true;
|
|
||||||
|
|
||||||
// Store click count during callback, for later use
|
|
||||||
volatile int multipressClickCount = 0;
|
|
||||||
|
|
||||||
static void wakeOnIrq(int irq, int mode);
|
|
||||||
|
|
||||||
static void sendAdHocPosition();
|
|
||||||
static void switchPage();
|
|
||||||
|
|
||||||
// IRQ callbacks
|
|
||||||
static void userButtonPressed() { btnEvent = BUTTON_EVENT_PRESSED; }
|
|
||||||
static void userButtonPressedScreen() { btnEvent = BUTTON_EVENT_PRESSED_SCREEN; }
|
|
||||||
static void userButtonDoublePressed() { btnEvent = BUTTON_EVENT_DOUBLE_PRESSED; }
|
|
||||||
static void userButtonMultiPressed(void *callerThread); // Retrieve click count from non-static Onebutton while still valid
|
|
||||||
static void userButtonPressedLongStart();
|
|
||||||
static void userButtonPressedLongStop();
|
|
||||||
static void touchPressedLongStart() { btnEvent = BUTTON_EVENT_TOUCH_LONG_PRESSED; }
|
|
||||||
};
|
|
||||||
|
|
||||||
extern ButtonThread *buttonThread;
|
|
||||||
243
src/Power.cpp
243
src/Power.cpp
@@ -20,6 +20,11 @@
|
|||||||
#include "meshUtils.h"
|
#include "meshUtils.h"
|
||||||
#include "sleep.h"
|
#include "sleep.h"
|
||||||
|
|
||||||
|
#if defined(ARCH_PORTDUINO)
|
||||||
|
#include "api/WiFiServerAPI.h"
|
||||||
|
#include "input/LinuxInputImpl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// Working USB detection for powered/charging states on the RAK platform
|
// Working USB detection for powered/charging states on the RAK platform
|
||||||
#ifdef NRF_APM
|
#ifdef NRF_APM
|
||||||
#include "nrfx_power.h"
|
#include "nrfx_power.h"
|
||||||
@@ -103,7 +108,7 @@ NullSensor ina3221Sensor;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !MESHTASTIC_EXCLUDE_I2C && !defined(ARCH_STM32WL)
|
#if !MESHTASTIC_EXCLUDE_I2C
|
||||||
#include "modules/Telemetry/Sensor/MAX17048Sensor.h"
|
#include "modules/Telemetry/Sensor/MAX17048Sensor.h"
|
||||||
#include <utility>
|
#include <utility>
|
||||||
extern std::pair<uint8_t, TwoWire *> nodeTelemetrySensorsMap[_meshtastic_TelemetrySensorType_MAX + 1];
|
extern std::pair<uint8_t, TwoWire *> nodeTelemetrySensorsMap[_meshtastic_TelemetrySensorType_MAX + 1];
|
||||||
@@ -120,6 +125,15 @@ NullSensor max17048Sensor;
|
|||||||
RAK9154Sensor rak9154Sensor;
|
RAK9154Sensor rak9154Sensor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAS_PPM
|
||||||
|
// note: XPOWERS_CHIP_XXX must be defined in variant.h
|
||||||
|
#include <XPowersLib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAS_BQ27220
|
||||||
|
#include "bq27220.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_PMU
|
#ifdef HAS_PMU
|
||||||
XPowersLibInterface *PMU = NULL;
|
XPowersLibInterface *PMU = NULL;
|
||||||
#else
|
#else
|
||||||
@@ -278,7 +292,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_TELEMETRY && !defined(ARCH_STM32WL) && !defined(HAS_PMU) && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
#if HAS_TELEMETRY && !defined(HAS_PMU) && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||||
if (hasINA()) {
|
if (hasINA()) {
|
||||||
return getINAVoltage();
|
return getINAVoltage();
|
||||||
}
|
}
|
||||||
@@ -456,8 +470,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
#ifdef EXT_CHRG_DETECT
|
#ifdef EXT_CHRG_DETECT
|
||||||
return digitalRead(EXT_CHRG_DETECT) == ext_chrg_detect_value;
|
return digitalRead(EXT_CHRG_DETECT) == ext_chrg_detect_value;
|
||||||
#else
|
#else
|
||||||
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(ARCH_STM32WL) && \
|
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(DISABLE_INA_CHARGING_DETECTION)
|
||||||
!defined(DISABLE_INA_CHARGING_DETECTION)
|
|
||||||
if (hasINA()) {
|
if (hasINA()) {
|
||||||
// get current flow from INA sensor - negative value means power flowing into the battery
|
// get current flow from INA sensor - negative value means power flowing into the battery
|
||||||
// default assuming BATTERY+ <--> INA_VIN+ <--> SHUNT RESISTOR <--> INA_VIN- <--> LOAD
|
// default assuming BATTERY+ <--> INA_VIN+ <--> SHUNT RESISTOR <--> INA_VIN- <--> LOAD
|
||||||
@@ -503,7 +516,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(ARCH_STM32WL)
|
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||||
uint16_t getINAVoltage()
|
uint16_t getINAVoltage()
|
||||||
{
|
{
|
||||||
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219].first == config.power.device_battery_ina_address) {
|
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219].first == config.power.device_battery_ina_address) {
|
||||||
@@ -661,12 +674,16 @@ bool Power::analogInit()
|
|||||||
*/
|
*/
|
||||||
bool Power::setup()
|
bool Power::setup()
|
||||||
{
|
{
|
||||||
// initialise one power sensor (only)
|
bool found = false;
|
||||||
bool found = axpChipInit();
|
if (axpChipInit()) {
|
||||||
if (!found)
|
found = true;
|
||||||
found = lipoInit();
|
} else if (lipoInit()) {
|
||||||
if (!found)
|
found = true;
|
||||||
found = analogInit();
|
} else if (lipoChargerInit()) {
|
||||||
|
found = true;
|
||||||
|
} else if (analogInit()) {
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef NRF_APM
|
#ifdef NRF_APM
|
||||||
found = true;
|
found = true;
|
||||||
@@ -678,9 +695,59 @@ bool Power::setup()
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Power::powerCommandsCheck()
|
||||||
|
{
|
||||||
|
if (rebootAtMsec && millis() > rebootAtMsec) {
|
||||||
|
LOG_INFO("Rebooting");
|
||||||
|
reboot();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shutdownAtMsec && millis() > shutdownAtMsec) {
|
||||||
|
shutdownAtMsec = 0;
|
||||||
|
shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Power::reboot()
|
||||||
|
{
|
||||||
|
notifyReboot.notifyObservers(NULL);
|
||||||
|
#if defined(ARCH_ESP32)
|
||||||
|
ESP.restart();
|
||||||
|
#elif defined(ARCH_NRF52)
|
||||||
|
NVIC_SystemReset();
|
||||||
|
#elif defined(ARCH_RP2040)
|
||||||
|
rp2040.reboot();
|
||||||
|
#elif defined(ARCH_PORTDUINO)
|
||||||
|
deInitApiServer();
|
||||||
|
if (aLinuxInputImpl)
|
||||||
|
aLinuxInputImpl->deInit();
|
||||||
|
SPI.end();
|
||||||
|
Wire.end();
|
||||||
|
Serial1.end();
|
||||||
|
if (screen)
|
||||||
|
delete screen;
|
||||||
|
LOG_DEBUG("final reboot!");
|
||||||
|
reboot();
|
||||||
|
#elif defined(ARCH_STM32WL)
|
||||||
|
HAL_NVIC_SystemReset();
|
||||||
|
#else
|
||||||
|
rebootAtMsec = -1;
|
||||||
|
LOG_WARN("FIXME implement reboot for this platform. Note that some settings require a restart to be applied");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void Power::shutdown()
|
void Power::shutdown()
|
||||||
{
|
{
|
||||||
LOG_INFO("Shutting down");
|
|
||||||
|
#if HAS_SCREEN
|
||||||
|
if (screen) {
|
||||||
|
screen->showSimpleBanner("Shutting Down...", 0); // stays on screen
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if !defined(ARCH_STM32WL)
|
||||||
|
playShutdownMelody();
|
||||||
|
#endif
|
||||||
|
nodeDB->saveToDisk();
|
||||||
|
|
||||||
#if defined(ARCH_NRF52) || defined(ARCH_ESP32) || defined(ARCH_RP2040)
|
#if defined(ARCH_NRF52) || defined(ARCH_ESP32) || defined(ARCH_RP2040)
|
||||||
#ifdef PIN_LED1
|
#ifdef PIN_LED1
|
||||||
@@ -692,7 +759,11 @@ void Power::shutdown()
|
|||||||
#ifdef PIN_LED3
|
#ifdef PIN_LED3
|
||||||
ledOff(PIN_LED3);
|
ledOff(PIN_LED3);
|
||||||
#endif
|
#endif
|
||||||
doDeepSleep(DELAY_FOREVER, false, false);
|
doDeepSleep(DELAY_FOREVER, false, true);
|
||||||
|
#elif defined(ARCH_PORTDUINO)
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
#else
|
||||||
|
LOG_WARN("FIXME implement shutdown for this platform");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -853,7 +924,8 @@ int32_t Power::runOnce()
|
|||||||
#ifndef T_WATCH_S3 // FIXME - why is this triggering on the T-Watch S3?
|
#ifndef T_WATCH_S3 // FIXME - why is this triggering on the T-Watch S3?
|
||||||
if (PMU->isPekeyLongPressIrq()) {
|
if (PMU->isPekeyLongPressIrq()) {
|
||||||
LOG_DEBUG("PEK long button press");
|
LOG_DEBUG("PEK long button press");
|
||||||
screen->setOn(false);
|
if (screen)
|
||||||
|
screen->setOn(false);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1158,7 +1230,7 @@ bool Power::axpChipInit()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !MESHTASTIC_EXCLUDE_I2C && !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
#if !MESHTASTIC_EXCLUDE_I2C && __has_include(<Adafruit_MAX1704X.h>)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper class for an I2C MAX17048 Lipo battery sensor.
|
* Wrapper class for an I2C MAX17048 Lipo battery sensor.
|
||||||
@@ -1235,3 +1307,144 @@ bool Power::lipoInit()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAS_PPM) && HAS_PPM
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adapter class for BQ25896/BQ27220 Lipo battery charger.
|
||||||
|
*/
|
||||||
|
class LipoCharger : public HasBatteryLevel
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
XPowersPPM *ppm = nullptr;
|
||||||
|
BQ27220 *bq = nullptr;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Init the I2C BQ25896 Lipo battery charger
|
||||||
|
*/
|
||||||
|
bool runOnce()
|
||||||
|
{
|
||||||
|
if (ppm == nullptr) {
|
||||||
|
ppm = new XPowersPPM;
|
||||||
|
bool result = ppm->init(Wire, I2C_SDA, I2C_SCL, BQ25896_ADDR);
|
||||||
|
if (result) {
|
||||||
|
LOG_INFO("PPM BQ25896 init succeeded");
|
||||||
|
// Set the minimum operating voltage. Below this voltage, the PPM will protect
|
||||||
|
// ppm->setSysPowerDownVoltage(3100);
|
||||||
|
|
||||||
|
// Set input current limit, default is 500mA
|
||||||
|
// ppm->setInputCurrentLimit(800);
|
||||||
|
|
||||||
|
// Disable current limit pin
|
||||||
|
// ppm->disableCurrentLimitPin();
|
||||||
|
|
||||||
|
// Set the charging target voltage, Range:3840 ~ 4608mV ,step:16 mV
|
||||||
|
ppm->setChargeTargetVoltage(4288);
|
||||||
|
|
||||||
|
// Set the precharge current , Range: 64mA ~ 1024mA ,step:64mA
|
||||||
|
// ppm->setPrechargeCurr(64);
|
||||||
|
|
||||||
|
// The premise is that limit pin is disabled, or it will
|
||||||
|
// only follow the maximum charging current set by limit pin.
|
||||||
|
// Set the charging current , Range:0~5056mA ,step:64mA
|
||||||
|
ppm->setChargerConstantCurr(1024);
|
||||||
|
|
||||||
|
// To obtain voltage data, the ADC must be enabled first
|
||||||
|
ppm->enableMeasure();
|
||||||
|
|
||||||
|
// Turn on charging function
|
||||||
|
// If there is no battery connected, do not turn on the charging function
|
||||||
|
ppm->enableCharge();
|
||||||
|
} else {
|
||||||
|
LOG_WARN("PPM BQ25896 init failed");
|
||||||
|
delete ppm;
|
||||||
|
ppm = nullptr;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (bq == nullptr) {
|
||||||
|
bq = new BQ27220;
|
||||||
|
bq->setDefaultCapacity(BQ27220_DESIGN_CAPACITY);
|
||||||
|
|
||||||
|
bool result = bq->init();
|
||||||
|
if (result) {
|
||||||
|
LOG_DEBUG("BQ27220 design capacity: %d", bq->getDesignCapacity());
|
||||||
|
LOG_DEBUG("BQ27220 fullCharge capacity: %d", bq->getFullChargeCapacity());
|
||||||
|
LOG_DEBUG("BQ27220 remaining capacity: %d", bq->getRemainingCapacity());
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
LOG_WARN("BQ27220 init failed");
|
||||||
|
delete bq;
|
||||||
|
bq = nullptr;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Battery state of charge, from 0 to 100 or -1 for unknown
|
||||||
|
*/
|
||||||
|
virtual int getBatteryPercent() override
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
// return bq->getChargePercent(); // don't use BQ27220 for battery percent, it is not calibrated
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The raw voltage of the battery in millivolts, or NAN if unknown
|
||||||
|
*/
|
||||||
|
virtual uint16_t getBattVoltage() override { return bq->getVoltage(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return true if there is a battery installed in this unit
|
||||||
|
*/
|
||||||
|
virtual bool isBatteryConnect() override { return ppm->getBattVoltage() > 0; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return true if there is an external power source detected
|
||||||
|
*/
|
||||||
|
virtual bool isVbusIn() override { return ppm->getVbusVoltage() > 0; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return true if the battery is currently charging
|
||||||
|
*/
|
||||||
|
virtual bool isCharging() override
|
||||||
|
{
|
||||||
|
bool isCharging = ppm->isCharging();
|
||||||
|
if (isCharging) {
|
||||||
|
LOG_DEBUG("BQ27220 time to full charge: %d min", bq->getTimeToFull());
|
||||||
|
} else {
|
||||||
|
if (!ppm->isVbusIn()) {
|
||||||
|
LOG_DEBUG("BQ27220 time to empty: %d min (%d mAh)", bq->getTimeToEmpty(), bq->getRemainingCapacity());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isCharging;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
LipoCharger lipoCharger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init the Lipo battery charger
|
||||||
|
*/
|
||||||
|
bool Power::lipoChargerInit()
|
||||||
|
{
|
||||||
|
bool result = lipoCharger.runOnce();
|
||||||
|
LOG_DEBUG("Power::lipoChargerInit lipo sensor is %s", result ? "ready" : "not ready yet");
|
||||||
|
if (!result)
|
||||||
|
return false;
|
||||||
|
batteryLevel = &lipoCharger;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
/**
|
||||||
|
* The Lipo battery level sensor is unavailable - default to AnalogBatteryLevel
|
||||||
|
*/
|
||||||
|
bool Power::lipoChargerInit()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#ifndef SLEEP_TIME
|
#ifndef SLEEP_TIME
|
||||||
#define SLEEP_TIME 30
|
#define SLEEP_TIME 30
|
||||||
#endif
|
#endif
|
||||||
#if EXCLUDE_POWER_FSM
|
#if MESHTASTIC_EXCLUDE_POWER_FSM
|
||||||
FakeFsm powerFSM;
|
FakeFsm powerFSM;
|
||||||
void PowerFSM_setup(){};
|
void PowerFSM_setup(){};
|
||||||
#else
|
#else
|
||||||
@@ -72,7 +72,7 @@ extern Power *power;
|
|||||||
static void shutdownEnter()
|
static void shutdownEnter()
|
||||||
{
|
{
|
||||||
LOG_DEBUG("State: SHUTDOWN");
|
LOG_DEBUG("State: SHUTDOWN");
|
||||||
power->shutdown();
|
shutdownAtMsec = millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
@@ -82,7 +82,8 @@ static uint32_t secsSlept;
|
|||||||
static void lsEnter()
|
static void lsEnter()
|
||||||
{
|
{
|
||||||
LOG_INFO("lsEnter begin, ls_secs=%u", config.power.ls_secs);
|
LOG_INFO("lsEnter begin, ls_secs=%u", config.power.ls_secs);
|
||||||
screen->setOn(false);
|
if (screen)
|
||||||
|
screen->setOn(false);
|
||||||
secsSlept = 0; // How long have we been sleeping this time
|
secsSlept = 0; // How long have we been sleeping this time
|
||||||
|
|
||||||
// LOG_INFO("lsEnter end");
|
// LOG_INFO("lsEnter end");
|
||||||
@@ -160,7 +161,8 @@ static void lsExit()
|
|||||||
static void nbEnter()
|
static void nbEnter()
|
||||||
{
|
{
|
||||||
LOG_DEBUG("State: NB");
|
LOG_DEBUG("State: NB");
|
||||||
screen->setOn(false);
|
if (screen)
|
||||||
|
screen->setOn(false);
|
||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32
|
||||||
// Only ESP32 should turn off bluetooth
|
// Only ESP32 should turn off bluetooth
|
||||||
setBluetoothEnable(false);
|
setBluetoothEnable(false);
|
||||||
@@ -172,22 +174,23 @@ static void nbEnter()
|
|||||||
static void darkEnter()
|
static void darkEnter()
|
||||||
{
|
{
|
||||||
setBluetoothEnable(true);
|
setBluetoothEnable(true);
|
||||||
screen->setOn(false);
|
if (screen)
|
||||||
|
screen->setOn(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void serialEnter()
|
static void serialEnter()
|
||||||
{
|
{
|
||||||
LOG_DEBUG("State: SERIAL");
|
LOG_DEBUG("State: SERIAL");
|
||||||
setBluetoothEnable(false);
|
setBluetoothEnable(false);
|
||||||
screen->setOn(true);
|
if (screen) {
|
||||||
screen->print("Serial connected\n");
|
screen->setOn(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void serialExit()
|
static void serialExit()
|
||||||
{
|
{
|
||||||
// Turn bluetooth back on when we leave serial stream API
|
// Turn bluetooth back on when we leave serial stream API
|
||||||
setBluetoothEnable(true);
|
setBluetoothEnable(true);
|
||||||
screen->print("Serial disconnected\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void powerEnter()
|
static void powerEnter()
|
||||||
@@ -198,15 +201,10 @@ static void powerEnter()
|
|||||||
LOG_INFO("Loss of power in Powered");
|
LOG_INFO("Loss of power in Powered");
|
||||||
powerFSM.trigger(EVENT_POWER_DISCONNECTED);
|
powerFSM.trigger(EVENT_POWER_DISCONNECTED);
|
||||||
} else {
|
} else {
|
||||||
screen->setOn(true);
|
if (screen)
|
||||||
|
screen->setOn(true);
|
||||||
setBluetoothEnable(true);
|
setBluetoothEnable(true);
|
||||||
// within enter() the function getState() returns the state we came from
|
// within enter() the function getState() returns the state we came from
|
||||||
|
|
||||||
// Mothballed: print change of power-state to device screen
|
|
||||||
/* if (strcmp(powerFSM.getState()->name, "BOOT") != 0 && strcmp(powerFSM.getState()->name, "POWER") != 0 &&
|
|
||||||
strcmp(powerFSM.getState()->name, "DARK") != 0) {
|
|
||||||
screen->print("Powered...\n");
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,18 +219,16 @@ static void powerIdle()
|
|||||||
|
|
||||||
static void powerExit()
|
static void powerExit()
|
||||||
{
|
{
|
||||||
screen->setOn(true);
|
if (screen)
|
||||||
|
screen->setOn(true);
|
||||||
setBluetoothEnable(true);
|
setBluetoothEnable(true);
|
||||||
|
|
||||||
// Mothballed: print change of power-state to device screen
|
|
||||||
/*if (!isPowered())
|
|
||||||
screen->print("Unpowered...\n");*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void onEnter()
|
static void onEnter()
|
||||||
{
|
{
|
||||||
LOG_DEBUG("State: ON");
|
LOG_DEBUG("State: ON");
|
||||||
screen->setOn(true);
|
if (screen)
|
||||||
|
screen->setOn(true);
|
||||||
setBluetoothEnable(true);
|
setBluetoothEnable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,11 +240,6 @@ static void onIdle()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void screenPress()
|
|
||||||
{
|
|
||||||
screen->onPress();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void bootEnter()
|
static void bootEnter()
|
||||||
{
|
{
|
||||||
LOG_DEBUG("State: BOOT");
|
LOG_DEBUG("State: BOOT");
|
||||||
@@ -292,9 +283,9 @@ void PowerFSM_setup()
|
|||||||
powerFSM.add_transition(&stateLS, &stateON, EVENT_PRESS, NULL, "Press");
|
powerFSM.add_transition(&stateLS, &stateON, EVENT_PRESS, NULL, "Press");
|
||||||
powerFSM.add_transition(&stateNB, &stateON, EVENT_PRESS, NULL, "Press");
|
powerFSM.add_transition(&stateNB, &stateON, EVENT_PRESS, NULL, "Press");
|
||||||
powerFSM.add_transition(&stateDARK, isPowered() ? &statePOWER : &stateON, EVENT_PRESS, NULL, "Press");
|
powerFSM.add_transition(&stateDARK, isPowered() ? &statePOWER : &stateON, EVENT_PRESS, NULL, "Press");
|
||||||
powerFSM.add_transition(&statePOWER, &statePOWER, EVENT_PRESS, screenPress, "Press");
|
powerFSM.add_transition(&statePOWER, &statePOWER, EVENT_PRESS, NULL, "Press");
|
||||||
powerFSM.add_transition(&stateON, &stateON, EVENT_PRESS, screenPress, "Press"); // reenter On to restart our timers
|
powerFSM.add_transition(&stateON, &stateON, EVENT_PRESS, NULL, "Press"); // reenter On to restart our timers
|
||||||
powerFSM.add_transition(&stateSERIAL, &stateSERIAL, EVENT_PRESS, screenPress,
|
powerFSM.add_transition(&stateSERIAL, &stateSERIAL, EVENT_PRESS, NULL,
|
||||||
"Press"); // Allow button to work while in serial API
|
"Press"); // Allow button to work while in serial API
|
||||||
|
|
||||||
// Handle critically low power battery by forcing deep sleep
|
// Handle critically low power battery by forcing deep sleep
|
||||||
@@ -328,10 +319,10 @@ void PowerFSM_setup()
|
|||||||
// if any packet destined for phone arrives, turn on bluetooth at least
|
// if any packet destined for phone arrives, turn on bluetooth at least
|
||||||
powerFSM.add_transition(&stateNB, &stateDARK, EVENT_PACKET_FOR_PHONE, NULL, "Packet for phone");
|
powerFSM.add_transition(&stateNB, &stateDARK, EVENT_PACKET_FOR_PHONE, NULL, "Packet for phone");
|
||||||
|
|
||||||
// show the latest node when we get a new node db update
|
// Removed 2.7: we don't show the nodes individually for every node on the screen anymore
|
||||||
powerFSM.add_transition(&stateNB, &stateON, EVENT_NODEDB_UPDATED, NULL, "NodeDB update");
|
// powerFSM.add_transition(&stateNB, &stateON, EVENT_NODEDB_UPDATED, NULL, "NodeDB update");
|
||||||
powerFSM.add_transition(&stateDARK, &stateON, EVENT_NODEDB_UPDATED, NULL, "NodeDB update");
|
// powerFSM.add_transition(&stateDARK, &stateON, EVENT_NODEDB_UPDATED, NULL, "NodeDB update");
|
||||||
powerFSM.add_transition(&stateON, &stateON, EVENT_NODEDB_UPDATED, NULL, "NodeDB update");
|
// powerFSM.add_transition(&stateON, &stateON, EVENT_NODEDB_UPDATED, NULL, "NodeDB update");
|
||||||
|
|
||||||
// Show the received text message
|
// Show the received text message
|
||||||
powerFSM.add_transition(&stateLS, &stateON, EVENT_RECEIVED_MSG, NULL, "Received text");
|
powerFSM.add_transition(&stateLS, &stateON, EVENT_RECEIVED_MSG, NULL, "Received text");
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#define EVENT_RECEIVED_MSG 5
|
#define EVENT_RECEIVED_MSG 5
|
||||||
// #define EVENT_BOOT 6 // now done with a timed transition
|
// #define EVENT_BOOT 6 // now done with a timed transition
|
||||||
#define EVENT_BLUETOOTH_PAIR 7
|
#define EVENT_BLUETOOTH_PAIR 7
|
||||||
#define EVENT_NODEDB_UPDATED 8 // NodeDB has a big enough change that we think you should turn on the screen
|
// #define EVENT_NODEDB_UPDATED 8 // Now defunct: NodeDB has a big enough change that we think you should turn on the screen
|
||||||
#define EVENT_CONTACT_FROM_PHONE 9 // the phone just talked to us over bluetooth
|
#define EVENT_CONTACT_FROM_PHONE 9 // the phone just talked to us over bluetooth
|
||||||
#define EVENT_LOW_BATTERY 10 // Battery is critically low, go to sleep
|
#define EVENT_LOW_BATTERY 10 // Battery is critically low, go to sleep
|
||||||
#define EVENT_SERIAL_CONNECTED 11
|
#define EVENT_SERIAL_CONNECTED 11
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
#define EVENT_SHUTDOWN 16 // force a full shutdown now (not just sleep)
|
#define EVENT_SHUTDOWN 16 // force a full shutdown now (not just sleep)
|
||||||
#define EVENT_INPUT 17 // input broker wants something, we need to wake up and enable screen
|
#define EVENT_INPUT 17 // input broker wants something, we need to wake up and enable screen
|
||||||
|
|
||||||
#if EXCLUDE_POWER_FSM
|
#if MESHTASTIC_EXCLUDE_POWER_FSM
|
||||||
class FakeFsm
|
class FakeFsm
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class PowerFSMThread : public OSThread
|
|||||||
protected:
|
protected:
|
||||||
int32_t runOnce() override
|
int32_t runOnce() override
|
||||||
{
|
{
|
||||||
#if !EXCLUDE_POWER_FSM
|
#if !MESHTASTIC_EXCLUDE_POWER_FSM
|
||||||
powerFSM.run_machine();
|
powerFSM.run_machine();
|
||||||
|
|
||||||
/// If we are in power state we force the CPU to wake every 10ms to check for serial characters (we don't yet wake
|
/// If we are in power state we force the CPU to wake every 10ms to check for serial characters (we don't yet wake
|
||||||
|
|||||||
@@ -352,8 +352,8 @@ void RedirectablePrint::hexDump(const char *logLevel, unsigned char *buf, uint16
|
|||||||
for (uint16_t i = 0; i < len; i += 16) {
|
for (uint16_t i = 0; i < len; i += 16) {
|
||||||
if (i % 128 == 0)
|
if (i % 128 == 0)
|
||||||
log(logLevel, " +------------------------------------------------+ +----------------+");
|
log(logLevel, " +------------------------------------------------+ +----------------+");
|
||||||
char s[] = "| | | |\n";
|
char s[] = " | | | |\n";
|
||||||
uint8_t ix = 1, iy = 52;
|
uint8_t ix = 5, iy = 56;
|
||||||
for (uint8_t j = 0; j < 16; j++) {
|
for (uint8_t j = 0; j < 16; j++) {
|
||||||
if (i + j < len) {
|
if (i + j < len) {
|
||||||
uint8_t c = buf[i + j];
|
uint8_t c = buf[i + j];
|
||||||
@@ -367,10 +367,8 @@ void RedirectablePrint::hexDump(const char *logLevel, unsigned char *buf, uint16
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
uint8_t index = i / 16;
|
uint8_t index = i / 16;
|
||||||
if (i < 256)
|
sprintf(s, "%03x", index);
|
||||||
log(logLevel, " ");
|
s[3] = '.';
|
||||||
log(logLevel, "%02x", index);
|
|
||||||
log(logLevel, ".");
|
|
||||||
log(logLevel, s);
|
log(logLevel, s);
|
||||||
}
|
}
|
||||||
log(logLevel, " +------------------------------------------------+ +----------------+");
|
log(logLevel, " +------------------------------------------------+ +----------------+");
|
||||||
@@ -393,4 +391,4 @@ std::string RedirectablePrint::mt_sprintf(const std::string fmt_str, ...)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return std::string(formatted.get());
|
return std::string(formatted.get());
|
||||||
}
|
}
|
||||||
|
|||||||
72
src/buzz/BuzzerFeedbackThread.cpp
Normal file
72
src/buzz/BuzzerFeedbackThread.cpp
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
#include "BuzzerFeedbackThread.h"
|
||||||
|
#include "NodeDB.h"
|
||||||
|
#include "buzz.h"
|
||||||
|
#include "configuration.h"
|
||||||
|
|
||||||
|
BuzzerFeedbackThread *buzzerFeedbackThread;
|
||||||
|
|
||||||
|
BuzzerFeedbackThread::BuzzerFeedbackThread() : OSThread("BuzzerFeedback")
|
||||||
|
{
|
||||||
|
if (inputBroker)
|
||||||
|
inputObserver.observe(inputBroker);
|
||||||
|
}
|
||||||
|
|
||||||
|
int BuzzerFeedbackThread::handleInputEvent(const InputEvent *event)
|
||||||
|
{
|
||||||
|
// Only provide feedback if buzzer is enabled for notifications
|
||||||
|
if (config.device.buzzer_mode == meshtastic_Config_DeviceConfig_BuzzerMode_DISABLED ||
|
||||||
|
config.device.buzzer_mode == meshtastic_Config_DeviceConfig_BuzzerMode_NOTIFICATIONS_ONLY) {
|
||||||
|
return 0; // Let other handlers process the event
|
||||||
|
}
|
||||||
|
|
||||||
|
// Track last event time for potential future use
|
||||||
|
lastEventTime = millis();
|
||||||
|
needsUpdate = true;
|
||||||
|
|
||||||
|
// Handle different input events with appropriate buzzer feedback
|
||||||
|
switch (event->inputEvent) {
|
||||||
|
case INPUT_BROKER_USER_PRESS:
|
||||||
|
case INPUT_BROKER_ALT_PRESS:
|
||||||
|
case INPUT_BROKER_SELECT:
|
||||||
|
playBeep(); // Confirmation feedback
|
||||||
|
break;
|
||||||
|
|
||||||
|
case INPUT_BROKER_UP:
|
||||||
|
case INPUT_BROKER_DOWN:
|
||||||
|
case INPUT_BROKER_LEFT:
|
||||||
|
case INPUT_BROKER_RIGHT:
|
||||||
|
playChirp(); // Navigation feedback
|
||||||
|
break;
|
||||||
|
|
||||||
|
case INPUT_BROKER_CANCEL:
|
||||||
|
case INPUT_BROKER_BACK:
|
||||||
|
playBoop(); // Cancel/back feedback
|
||||||
|
break;
|
||||||
|
|
||||||
|
case INPUT_BROKER_SEND_PING:
|
||||||
|
playComboTune(); // Ping sent feedback
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// For other events, check if it's a printable character
|
||||||
|
if (event->kbchar >= 32 && event->kbchar <= 126) {
|
||||||
|
// Typing feedback - very short boop
|
||||||
|
// Removing this for now, too chatty
|
||||||
|
// playChirp();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0; // Allow other handlers to process the event
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t BuzzerFeedbackThread::runOnce()
|
||||||
|
{
|
||||||
|
// This thread is primarily event-driven, but we can use runOnce
|
||||||
|
// for any periodic tasks if needed in the future
|
||||||
|
|
||||||
|
needsUpdate = false;
|
||||||
|
|
||||||
|
// Run every 100ms when active, less frequently when idle
|
||||||
|
return needsUpdate ? 100 : 1000;
|
||||||
|
}
|
||||||
24
src/buzz/BuzzerFeedbackThread.h
Normal file
24
src/buzz/BuzzerFeedbackThread.h
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Observer.h"
|
||||||
|
#include "concurrency/OSThread.h"
|
||||||
|
#include "input/InputBroker.h"
|
||||||
|
|
||||||
|
class BuzzerFeedbackThread : public concurrency::OSThread
|
||||||
|
{
|
||||||
|
CallbackObserver<BuzzerFeedbackThread, const InputEvent *> inputObserver =
|
||||||
|
CallbackObserver<BuzzerFeedbackThread, const InputEvent *>(this, &BuzzerFeedbackThread::handleInputEvent);
|
||||||
|
|
||||||
|
public:
|
||||||
|
BuzzerFeedbackThread();
|
||||||
|
int handleInputEvent(const InputEvent *event);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual int32_t runOnce() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint32_t lastEventTime = 0;
|
||||||
|
bool needsUpdate = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern BuzzerFeedbackThread *buzzerFeedbackThread;
|
||||||
@@ -38,6 +38,11 @@ const int DURATION_1_1 = 1000; // 1/1 note
|
|||||||
|
|
||||||
void playTones(const ToneDuration *tone_durations, int size)
|
void playTones(const ToneDuration *tone_durations, int size)
|
||||||
{
|
{
|
||||||
|
if (config.device.buzzer_mode == meshtastic_Config_DeviceConfig_BuzzerMode_DISABLED ||
|
||||||
|
config.device.buzzer_mode == meshtastic_Config_DeviceConfig_BuzzerMode_NOTIFICATIONS_ONLY) {
|
||||||
|
// Buzzer is disabled or not set to system tones
|
||||||
|
return;
|
||||||
|
}
|
||||||
#ifdef PIN_BUZZER
|
#ifdef PIN_BUZZER
|
||||||
if (!config.device.buzzer_gpio)
|
if (!config.device.buzzer_gpio)
|
||||||
config.device.buzzer_gpio = PIN_BUZZER;
|
config.device.buzzer_gpio = PIN_BUZZER;
|
||||||
@@ -54,7 +59,7 @@ void playTones(const ToneDuration *tone_durations, int size)
|
|||||||
|
|
||||||
void playBeep()
|
void playBeep()
|
||||||
{
|
{
|
||||||
ToneDuration melody[] = {{NOTE_B3, DURATION_1_4}};
|
ToneDuration melody[] = {{NOTE_B3, DURATION_1_8}};
|
||||||
playTones(melody, sizeof(melody) / sizeof(ToneDuration));
|
playTones(melody, sizeof(melody) / sizeof(ToneDuration));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,3 +92,72 @@ void playShutdownMelody()
|
|||||||
ToneDuration melody[] = {{NOTE_CS4, DURATION_1_8}, {NOTE_AS3, DURATION_1_8}, {NOTE_FS3, DURATION_1_4}};
|
ToneDuration melody[] = {{NOTE_CS4, DURATION_1_8}, {NOTE_AS3, DURATION_1_8}, {NOTE_FS3, DURATION_1_4}};
|
||||||
playTones(melody, sizeof(melody) / sizeof(ToneDuration));
|
playTones(melody, sizeof(melody) / sizeof(ToneDuration));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void playChirp()
|
||||||
|
{
|
||||||
|
// A short, friendly "chirp" sound for key presses
|
||||||
|
ToneDuration melody[] = {{NOTE_AS3, 20}}; // Very short AS3 note
|
||||||
|
playTones(melody, sizeof(melody) / sizeof(ToneDuration));
|
||||||
|
}
|
||||||
|
|
||||||
|
void playBoop()
|
||||||
|
{
|
||||||
|
// A short, friendly "boop" sound for button presses
|
||||||
|
ToneDuration melody[] = {{NOTE_A3, 50}}; // Very short A3 note
|
||||||
|
playTones(melody, sizeof(melody) / sizeof(ToneDuration));
|
||||||
|
}
|
||||||
|
|
||||||
|
void playLongPressLeadUp()
|
||||||
|
{
|
||||||
|
// An ascending lead-up sequence for long press - builds anticipation
|
||||||
|
ToneDuration melody[] = {
|
||||||
|
{NOTE_C3, 100}, // Start low
|
||||||
|
{NOTE_E3, 100}, // Step up
|
||||||
|
{NOTE_G3, 100}, // Keep climbing
|
||||||
|
{NOTE_B3, 150} // Peak with longer note for emphasis
|
||||||
|
};
|
||||||
|
playTones(melody, sizeof(melody) / sizeof(ToneDuration));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Static state for progressive lead-up notes
|
||||||
|
static int leadUpNoteIndex = 0;
|
||||||
|
static const ToneDuration leadUpNotes[] = {
|
||||||
|
{NOTE_C3, 100}, // Start low
|
||||||
|
{NOTE_E3, 100}, // Step up
|
||||||
|
{NOTE_G3, 100}, // Keep climbing
|
||||||
|
{NOTE_B3, 150} // Peak with longer note for emphasis
|
||||||
|
};
|
||||||
|
static const int leadUpNotesCount = sizeof(leadUpNotes) / sizeof(ToneDuration);
|
||||||
|
|
||||||
|
bool playNextLeadUpNote()
|
||||||
|
{
|
||||||
|
if (leadUpNoteIndex >= leadUpNotesCount) {
|
||||||
|
return false; // All notes have been played
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use playTones to handle buzzer logic consistently
|
||||||
|
const auto ¬e = leadUpNotes[leadUpNoteIndex];
|
||||||
|
playTones(¬e, 1); // Play single note using existing playTones function
|
||||||
|
|
||||||
|
leadUpNoteIndex++;
|
||||||
|
return true; // Note was played (playTones handles buzzer availability internally)
|
||||||
|
}
|
||||||
|
|
||||||
|
void resetLeadUpSequence()
|
||||||
|
{
|
||||||
|
leadUpNoteIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void playComboTune()
|
||||||
|
{
|
||||||
|
// Quick high-pitched notes with trills
|
||||||
|
ToneDuration melody[] = {
|
||||||
|
{NOTE_G3, 80}, // Quick chirp
|
||||||
|
{NOTE_B3, 60}, // Higher chirp
|
||||||
|
{NOTE_CS4, 80}, // Even higher
|
||||||
|
{NOTE_G3, 60}, // Quick trill down
|
||||||
|
{NOTE_CS4, 60}, // Quick trill up
|
||||||
|
{NOTE_B3, 120} // Ending chirp
|
||||||
|
};
|
||||||
|
playTones(melody, sizeof(melody) / sizeof(ToneDuration));
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,4 +5,10 @@ void playLongBeep();
|
|||||||
void playStartMelody();
|
void playStartMelody();
|
||||||
void playShutdownMelody();
|
void playShutdownMelody();
|
||||||
void playGPSEnableBeep();
|
void playGPSEnableBeep();
|
||||||
void playGPSDisableBeep();
|
void playGPSDisableBeep();
|
||||||
|
void playComboTune();
|
||||||
|
void playBoop();
|
||||||
|
void playChirp();
|
||||||
|
void playLongPressLeadUp();
|
||||||
|
bool playNextLeadUpNote(); // Play the next note in the lead-up sequence
|
||||||
|
void resetLeadUpSequence(); // Reset the lead-up sequence to start from beginning
|
||||||
@@ -12,7 +12,7 @@ enum class Cmd {
|
|||||||
STOP_ALERT_FRAME,
|
STOP_ALERT_FRAME,
|
||||||
START_FIRMWARE_UPDATE_SCREEN,
|
START_FIRMWARE_UPDATE_SCREEN,
|
||||||
STOP_BOOT_SCREEN,
|
STOP_BOOT_SCREEN,
|
||||||
PRINT,
|
|
||||||
SHOW_PREV_FRAME,
|
SHOW_PREV_FRAME,
|
||||||
SHOW_NEXT_FRAME
|
SHOW_NEXT_FRAME,
|
||||||
|
NOOP
|
||||||
};
|
};
|
||||||
@@ -9,17 +9,23 @@ namespace concurrency
|
|||||||
Lock::Lock() : handle(xSemaphoreCreateBinary())
|
Lock::Lock() : handle(xSemaphoreCreateBinary())
|
||||||
{
|
{
|
||||||
assert(handle);
|
assert(handle);
|
||||||
assert(xSemaphoreGive(handle));
|
if (xSemaphoreGive(handle) == false) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lock::lock()
|
void Lock::lock()
|
||||||
{
|
{
|
||||||
assert(xSemaphoreTake(handle, portMAX_DELAY));
|
if (xSemaphoreTake(handle, portMAX_DELAY) == false) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lock::unlock()
|
void Lock::unlock()
|
||||||
{
|
{
|
||||||
assert(xSemaphoreGive(handle));
|
if (xSemaphoreGive(handle) == false) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Lock::Lock() {}
|
Lock::Lock() {}
|
||||||
|
|||||||
@@ -81,7 +81,43 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
// #define REGULATORY_LORA_REGIONCODE meshtastic_Config_LoRaConfig_RegionCode_SG_923
|
// #define REGULATORY_LORA_REGIONCODE meshtastic_Config_LoRaConfig_RegionCode_SG_923
|
||||||
|
|
||||||
// Total system gain in dBm to subtract from Tx power to remain within regulatory and Tx PA limits
|
// Total system gain in dBm to subtract from Tx power to remain within regulatory and Tx PA limits
|
||||||
// This value should be set in variant.h and is PA gain + antenna gain (if variant has a non-removable antenna)
|
// The value consists of PA gain + antenna gain (if variant has a non-removable antenna)
|
||||||
|
// TX_GAIN_LORA should be set with definitions below for common modules, or in variant.h.
|
||||||
|
|
||||||
|
// Gain for common modules with transmit PAs
|
||||||
|
#ifdef EBYTE_E22_900M30S
|
||||||
|
// 10dB PA gain and 30dB rated output; based on measurements from
|
||||||
|
// https://github.com/S5NC/EBYTE_ESP32-S3/blob/main/E22-900M30S%20power%20output%20testing.txt
|
||||||
|
#define TX_GAIN_LORA 7
|
||||||
|
#define SX126X_MAX_POWER 22
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef EBYTE_E22_900M33S
|
||||||
|
// 25dB PA gain and 33dB rated output; based on TX Power Curve from E22-900M33S_UserManual_EN_v1.0.pdf
|
||||||
|
#define TX_GAIN_LORA 25
|
||||||
|
#define SX126X_MAX_POWER 8
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef NICERF_MINIF27
|
||||||
|
// Note that datasheet power level of 9 corresponds with SX1262 at 22dBm
|
||||||
|
// Maximum output power of 29dBm with VCC_PA = 5V
|
||||||
|
#define TX_GAIN_LORA 7
|
||||||
|
#define SX126X_MAX_POWER 22
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef NICERF_F30_HF
|
||||||
|
// Maximum output power of 29.6dBm with VCC = 5V and SX1262 at 22dBm
|
||||||
|
#define TX_GAIN_LORA 8
|
||||||
|
#define SX126X_MAX_POWER 22
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef NICERF_F30_LF
|
||||||
|
// Maximum output power of 32.0dBm with VCC = 5V and SX1262 at 22dBm
|
||||||
|
#define TX_GAIN_LORA 10
|
||||||
|
#define SX126X_MAX_POWER 22
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Default system gain to 0 if not defined
|
||||||
#ifndef TX_GAIN_LORA
|
#ifndef TX_GAIN_LORA
|
||||||
#define TX_GAIN_LORA 0
|
#define TX_GAIN_LORA 0
|
||||||
#endif
|
#endif
|
||||||
@@ -114,11 +150,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
// Define if screen should be mirrored left to right
|
// Define if screen should be mirrored left to right
|
||||||
// #define SCREEN_MIRROR
|
// #define SCREEN_MIRROR
|
||||||
|
|
||||||
// I2C Keyboards (M5Stack, RAK14004, T-Deck)
|
// I2C Keyboards (M5Stack, RAK14004, T-Deck, T-Deck Pro, T-Lora Pager, CardKB, BBQ10, MPR121, TCA8418)
|
||||||
#define CARDKB_ADDR 0x5F
|
#define CARDKB_ADDR 0x5F
|
||||||
#define TDECK_KB_ADDR 0x55
|
#define TDECK_KB_ADDR 0x55
|
||||||
#define BBQ10_KB_ADDR 0x1F
|
#define BBQ10_KB_ADDR 0x1F
|
||||||
#define MPR121_KB_ADDR 0x5A
|
#define MPR121_KB_ADDR 0x5A
|
||||||
|
#define TCA8418_KB_ADDR 0x34
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// SENSOR
|
// SENSOR
|
||||||
@@ -153,11 +190,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define DFROBOT_RAIN_ADDR 0x1d
|
#define DFROBOT_RAIN_ADDR 0x1d
|
||||||
#define NAU7802_ADDR 0x2A
|
#define NAU7802_ADDR 0x2A
|
||||||
#define MAX30102_ADDR 0x57
|
#define MAX30102_ADDR 0x57
|
||||||
|
#define SCD4X_ADDR 0x62
|
||||||
#define MLX90614_ADDR_DEF 0x5A
|
#define MLX90614_ADDR_DEF 0x5A
|
||||||
#define CGRADSENS_ADDR 0x66
|
#define CGRADSENS_ADDR 0x66
|
||||||
#define LTR390UV_ADDR 0x53
|
#define LTR390UV_ADDR 0x53
|
||||||
#define XPOWERS_AXP192_AXP2101_ADDRESS 0x34 // same adress as TCA8418
|
#define XPOWERS_AXP192_AXP2101_ADDRESS 0x34 // same adress as TCA8418_KB
|
||||||
#define PCT2075_ADDR 0x37
|
#define PCT2075_ADDR 0x37
|
||||||
|
#define BQ27220_ADDR 0x55 // same address as TDECK_KB
|
||||||
|
#define BQ25896_ADDR 0x6B
|
||||||
|
#define LTR553ALS_ADDR 0x23
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// ACCELEROMETER
|
// ACCELEROMETER
|
||||||
@@ -171,6 +212,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define BMX160_ADDR 0x69
|
#define BMX160_ADDR 0x69
|
||||||
#define ICM20948_ADDR 0x69
|
#define ICM20948_ADDR 0x69
|
||||||
#define ICM20948_ADDR_ALT 0x68
|
#define ICM20948_ADDR_ALT 0x68
|
||||||
|
#define BHI260AP_ADDR 0x28
|
||||||
|
#define BMM150_ADDR 0x13
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// LED
|
// LED
|
||||||
@@ -192,6 +235,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
// Touchscreen
|
// Touchscreen
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
#define FT6336U_ADDR 0x48
|
#define FT6336U_ADDR 0x48
|
||||||
|
#define CST328_ADDR 0x1A
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// RAK12035VB Soil Monitor (using RAK12023 up to 3 RAK12035 monitors can be connected)
|
||||||
|
// - the default i2c address for this sensor is 0x20, and users are instructed to
|
||||||
|
// set 0x21 and 0x22 for the second and third sensor if present.
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
#define RAK120351_ADDR 0x20
|
||||||
|
#define RAK120352_ADDR 0x21
|
||||||
|
#define RAK120353_ADDR 0x22
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// BIAS-T Generator
|
// BIAS-T Generator
|
||||||
@@ -302,11 +355,41 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#error HW_VENDOR must be defined
|
#error HW_VENDOR must be defined
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef TB_DOWN
|
||||||
|
#define TB_DOWN 255
|
||||||
|
#endif
|
||||||
|
#ifndef TB_UP
|
||||||
|
#define TB_UP 255
|
||||||
|
#endif
|
||||||
|
#ifndef TB_LEFT
|
||||||
|
#define TB_LEFT 255
|
||||||
|
#endif
|
||||||
|
#ifndef TB_RIGHT
|
||||||
|
#define TB_RIGHT 255
|
||||||
|
#endif
|
||||||
|
#ifndef TB_PRESS
|
||||||
|
#define TB_PRESS 255
|
||||||
|
#endif
|
||||||
|
|
||||||
// Support multiple RGB LED configuration
|
// Support multiple RGB LED configuration
|
||||||
#if defined(HAS_NCP5623) || defined(HAS_LP5562) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
|
#if defined(HAS_NCP5623) || defined(HAS_LP5562) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
|
||||||
#define HAS_RGB_LED
|
#define HAS_RGB_LED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// default mapping of pins
|
||||||
|
#if defined(PIN_BUTTON2) && !defined(CANCEL_BUTTON_PIN)
|
||||||
|
#define ALT_BUTTON_PIN PIN_BUTTON2
|
||||||
|
#endif
|
||||||
|
#if defined ALT_BUTTON_PIN
|
||||||
|
|
||||||
|
#ifndef ALT_BUTTON_ACTIVE_LOW
|
||||||
|
#define ALT_BUTTON_ACTIVE_LOW true
|
||||||
|
#endif
|
||||||
|
#ifndef ALT_BUTTON_ACTIVE_PULLUP
|
||||||
|
#define ALT_BUTTON_ACTIVE_PULLUP true
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Global switches to turn off features for a minimized build
|
// Global switches to turn off features for a minimized build
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -37,8 +37,14 @@ ScanI2C::FoundDevice ScanI2C::firstKeyboard() const
|
|||||||
|
|
||||||
ScanI2C::FoundDevice ScanI2C::firstAccelerometer() const
|
ScanI2C::FoundDevice ScanI2C::firstAccelerometer() const
|
||||||
{
|
{
|
||||||
ScanI2C::DeviceType types[] = {MPU6050, LIS3DH, BMA423, LSM6DS3, BMX160, STK8BAXX, ICM20948, QMA6100P};
|
ScanI2C::DeviceType types[] = {MPU6050, LIS3DH, BMA423, LSM6DS3, BMX160, STK8BAXX, ICM20948, QMA6100P, BMM150};
|
||||||
return firstOfOrNONE(8, types);
|
return firstOfOrNONE(9, types);
|
||||||
|
}
|
||||||
|
|
||||||
|
ScanI2C::FoundDevice ScanI2C::firstAQI() const
|
||||||
|
{
|
||||||
|
ScanI2C::DeviceType types[] = {PMSA0031, SCD4X};
|
||||||
|
return firstOfOrNONE(2, types);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScanI2C::FoundDevice ScanI2C::firstRGBLED() const
|
ScanI2C::FoundDevice ScanI2C::firstRGBLED() const
|
||||||
@@ -80,4 +86,4 @@ bool ScanI2C::DeviceAddress::operator<(const ScanI2C::DeviceAddress &other) cons
|
|||||||
|| (port != NO_I2C && other.port != NO_I2C && (address < other.address));
|
|| (port != NO_I2C && other.port != NO_I2C && (address < other.address));
|
||||||
}
|
}
|
||||||
|
|
||||||
ScanI2C::FoundDevice::FoundDevice(ScanI2C::DeviceType type, ScanI2C::DeviceAddress address) : type(type), address(address) {}
|
ScanI2C::FoundDevice::FoundDevice(ScanI2C::DeviceType type, ScanI2C::DeviceAddress address) : type(type), address(address) {}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ class ScanI2C
|
|||||||
FT6336U,
|
FT6336U,
|
||||||
STK8BAXX,
|
STK8BAXX,
|
||||||
ICM20948,
|
ICM20948,
|
||||||
|
SCD4X,
|
||||||
MAX30102,
|
MAX30102,
|
||||||
TPS65233,
|
TPS65233,
|
||||||
MPR121KB,
|
MPR121KB,
|
||||||
@@ -70,8 +71,15 @@ class ScanI2C
|
|||||||
DFROBOT_RAIN,
|
DFROBOT_RAIN,
|
||||||
DPS310,
|
DPS310,
|
||||||
LTR390UV,
|
LTR390UV,
|
||||||
|
RAK12035,
|
||||||
TCA8418KB,
|
TCA8418KB,
|
||||||
PCT2075,
|
PCT2075,
|
||||||
|
CST328,
|
||||||
|
BQ25896,
|
||||||
|
BQ27220,
|
||||||
|
LTR553ALS,
|
||||||
|
BHI260AP,
|
||||||
|
BMM150
|
||||||
} DeviceType;
|
} DeviceType;
|
||||||
|
|
||||||
// typedef uint8_t DeviceAddress;
|
// typedef uint8_t DeviceAddress;
|
||||||
@@ -124,6 +132,8 @@ class ScanI2C
|
|||||||
|
|
||||||
FoundDevice firstAccelerometer() const;
|
FoundDevice firstAccelerometer() const;
|
||||||
|
|
||||||
|
FoundDevice firstAQI() const;
|
||||||
|
|
||||||
FoundDevice firstRGBLED() const;
|
FoundDevice firstRGBLED() const;
|
||||||
|
|
||||||
virtual FoundDevice find(DeviceType) const;
|
virtual FoundDevice find(DeviceType) const;
|
||||||
|
|||||||
@@ -184,8 +184,13 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||||||
type = RTC_RV3028;
|
type = RTC_RV3028;
|
||||||
logFoundDevice("RV3028", (uint8_t)addr.address);
|
logFoundDevice("RV3028", (uint8_t)addr.address);
|
||||||
rtc.initI2C(*i2cBus);
|
rtc.initI2C(*i2cBus);
|
||||||
rtc.writeToRegister(0x35, 0x07); // no Clkout
|
// Update RTC EEPROM settings, if necessary
|
||||||
rtc.writeToRegister(0x37, 0xB4);
|
if (rtc.readEEPROMRegister(0x35) != 0x07) {
|
||||||
|
rtc.writeEEPROMRegister(0x35, 0x07); // no Clkout
|
||||||
|
}
|
||||||
|
if (rtc.readEEPROMRegister(0x37) != 0xB4) {
|
||||||
|
rtc.writeEEPROMRegister(0x37, 0xB4);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -206,7 +211,17 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
SCAN_SIMPLE_CASE(TDECK_KB_ADDR, TDECKKB, "T-Deck keyboard", (uint8_t)addr.address);
|
case TDECK_KB_ADDR:
|
||||||
|
// Do we have the T-Deck keyboard or the T-Deck Pro battery sensor?
|
||||||
|
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x04), 1);
|
||||||
|
if (registerValue != 0) {
|
||||||
|
logFoundDevice("BQ27220", (uint8_t)addr.address);
|
||||||
|
type = BQ27220;
|
||||||
|
} else {
|
||||||
|
logFoundDevice("TDECKKB", (uint8_t)addr.address);
|
||||||
|
type = TDECKKB;
|
||||||
|
}
|
||||||
|
break;
|
||||||
SCAN_SIMPLE_CASE(BBQ10_KB_ADDR, BBQ10KB, "BB Q10", (uint8_t)addr.address);
|
SCAN_SIMPLE_CASE(BBQ10_KB_ADDR, BBQ10KB, "BB Q10", (uint8_t)addr.address);
|
||||||
|
|
||||||
SCAN_SIMPLE_CASE(ST7567_ADDRESS, SCREEN_ST7567, "ST7567", (uint8_t)addr.address);
|
SCAN_SIMPLE_CASE(ST7567_ADDRESS, SCREEN_ST7567, "ST7567", (uint8_t)addr.address);
|
||||||
@@ -358,7 +373,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||||||
case SHT31_4x_ADDR: // same as OPT3001_ADDR_ALT
|
case SHT31_4x_ADDR: // same as OPT3001_ADDR_ALT
|
||||||
case SHT31_4x_ADDR_ALT: // same as OPT3001_ADDR
|
case SHT31_4x_ADDR_ALT: // same as OPT3001_ADDR
|
||||||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x89), 2);
|
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x89), 2);
|
||||||
if (registerValue == 0x11a2 || registerValue == 0x11da || registerValue == 0xe9c) {
|
if (registerValue == 0x11a2 || registerValue == 0x11da || registerValue == 0xe9c || registerValue == 0xc8d) {
|
||||||
type = SHT4X;
|
type = SHT4X;
|
||||||
logFoundDevice("SHT4X", (uint8_t)addr.address);
|
logFoundDevice("SHT4X", (uint8_t)addr.address);
|
||||||
} else if (getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x7E), 2) == 0x5449) {
|
} else if (getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x7E), 2) == 0x5449) {
|
||||||
@@ -396,6 +411,12 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||||||
logFoundDevice("BQ24295", (uint8_t)addr.address);
|
logFoundDevice("BQ24295", (uint8_t)addr.address);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x14), 1); // get ID
|
||||||
|
if ((registerValue & 0b00000011) == 0b00000010) {
|
||||||
|
type = BQ25896;
|
||||||
|
logFoundDevice("BQ25896", (uint8_t)addr.address);
|
||||||
|
break;
|
||||||
|
}
|
||||||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x0F), 1); // get ID
|
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x0F), 1); // get ID
|
||||||
if (registerValue == 0x6A) {
|
if (registerValue == 0x6A) {
|
||||||
type = LSM6DS3;
|
type = LSM6DS3;
|
||||||
@@ -423,9 +444,21 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||||||
logFoundDevice("BMA423", (uint8_t)addr.address);
|
logFoundDevice("BMA423", (uint8_t)addr.address);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case TCA9535_ADDR:
|
||||||
|
case RAK120352_ADDR:
|
||||||
|
case RAK120353_ADDR:
|
||||||
|
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x02), 1);
|
||||||
|
if (registerValue == addr.address) { // RAK12035 returns its I2C address at 0x02 (eg 0x20)
|
||||||
|
type = RAK12035;
|
||||||
|
logFoundDevice("RAK12035", (uint8_t)addr.address);
|
||||||
|
} else {
|
||||||
|
type = TCA9535;
|
||||||
|
logFoundDevice("TCA9535", (uint8_t)addr.address);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
SCAN_SIMPLE_CASE(LSM6DS3_ADDR, LSM6DS3, "LSM6DS3", (uint8_t)addr.address);
|
SCAN_SIMPLE_CASE(LSM6DS3_ADDR, LSM6DS3, "LSM6DS3", (uint8_t)addr.address);
|
||||||
SCAN_SIMPLE_CASE(TCA9535_ADDR, TCA9535, "TCA9535", (uint8_t)addr.address);
|
|
||||||
SCAN_SIMPLE_CASE(TCA9555_ADDR, TCA9555, "TCA9555", (uint8_t)addr.address);
|
SCAN_SIMPLE_CASE(TCA9555_ADDR, TCA9555, "TCA9555", (uint8_t)addr.address);
|
||||||
SCAN_SIMPLE_CASE(VEML7700_ADDR, VEML7700, "VEML7700", (uint8_t)addr.address);
|
SCAN_SIMPLE_CASE(VEML7700_ADDR, VEML7700, "VEML7700", (uint8_t)addr.address);
|
||||||
SCAN_SIMPLE_CASE(TSL25911_ADDR, TSL2591, "TSL2591", (uint8_t)addr.address);
|
SCAN_SIMPLE_CASE(TSL25911_ADDR, TSL2591, "TSL2591", (uint8_t)addr.address);
|
||||||
@@ -435,6 +468,11 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||||||
SCAN_SIMPLE_CASE(DFROBOT_RAIN_ADDR, DFROBOT_RAIN, "DFRobot Rain Gauge", (uint8_t)addr.address);
|
SCAN_SIMPLE_CASE(DFROBOT_RAIN_ADDR, DFROBOT_RAIN, "DFRobot Rain Gauge", (uint8_t)addr.address);
|
||||||
SCAN_SIMPLE_CASE(LTR390UV_ADDR, LTR390UV, "LTR390UV", (uint8_t)addr.address);
|
SCAN_SIMPLE_CASE(LTR390UV_ADDR, LTR390UV, "LTR390UV", (uint8_t)addr.address);
|
||||||
SCAN_SIMPLE_CASE(PCT2075_ADDR, PCT2075, "PCT2075", (uint8_t)addr.address);
|
SCAN_SIMPLE_CASE(PCT2075_ADDR, PCT2075, "PCT2075", (uint8_t)addr.address);
|
||||||
|
SCAN_SIMPLE_CASE(CST328_ADDR, CST328, "CST328", (uint8_t)addr.address);
|
||||||
|
SCAN_SIMPLE_CASE(LTR553ALS_ADDR, LTR553ALS, "LTR553ALS", (uint8_t)addr.address);
|
||||||
|
SCAN_SIMPLE_CASE(BHI260AP_ADDR, BHI260AP, "BHI260AP", (uint8_t)addr.address);
|
||||||
|
SCAN_SIMPLE_CASE(SCD4X_ADDR, SCD4X, "SCD4X", (uint8_t)addr.address);
|
||||||
|
SCAN_SIMPLE_CASE(BMM150_ADDR, BMM150, "BMM150", (uint8_t)addr.address);
|
||||||
#ifdef HAS_TPS65233
|
#ifdef HAS_TPS65233
|
||||||
SCAN_SIMPLE_CASE(TPS65233_ADDR, TPS65233, "TPS65233", (uint8_t)addr.address);
|
SCAN_SIMPLE_CASE(TPS65233_ADDR, TPS65233, "TPS65233", (uint8_t)addr.address);
|
||||||
#endif
|
#endif
|
||||||
@@ -543,4 +581,4 @@ void ScanI2CTwoWire::logFoundDevice(const char *device, uint8_t address)
|
|||||||
{
|
{
|
||||||
LOG_INFO("%s found at address 0x%x", device, address);
|
LOG_INFO("%s found at address 0x%x", device, address);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ template <typename T, std::size_t N> std::size_t array_count(const T (&)[N])
|
|||||||
return N;
|
return N;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(NRF52840_XXAA) || defined(NRF52833_XXAA) || defined(ARCH_ESP32) || defined(ARCH_PORTDUINO)
|
#if defined(NRF52840_XXAA) || defined(NRF52833_XXAA) || defined(ARCH_ESP32) || defined(ARCH_PORTDUINO) || defined(ARCH_STM32WL)
|
||||||
#if defined(RAK2560)
|
#if defined(GPS_SERIAL_PORT)
|
||||||
HardwareSerial *GPS::_serial_gps = &Serial2;
|
HardwareSerial *GPS::_serial_gps = &GPS_SERIAL_PORT;
|
||||||
#else
|
#else
|
||||||
HardwareSerial *GPS::_serial_gps = &Serial1;
|
HardwareSerial *GPS::_serial_gps = &Serial1;
|
||||||
#endif
|
#endif
|
||||||
@@ -643,8 +643,16 @@ bool GPS::setup()
|
|||||||
delay(250);
|
delay(250);
|
||||||
} else if (IS_ONE_OF(gnssModel, GNSS_MODEL_AG3335, GNSS_MODEL_AG3352)) {
|
} else if (IS_ONE_OF(gnssModel, GNSS_MODEL_AG3335, GNSS_MODEL_AG3352)) {
|
||||||
|
|
||||||
_serial_gps->write("$PAIR066,1,0,1,0,0,1*3B\r\n"); // Enable GPS+GALILEO+NAVIC
|
if (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_IN ||
|
||||||
|
config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_NP_865) {
|
||||||
|
_serial_gps->write("$PAIR066,1,0,1,0,0,1*3B\r\n"); // Enable GPS+GALILEO+NAVIC
|
||||||
|
// GPS GLONASS GALILEO BDS QZSS NAVIC
|
||||||
|
// 1 0 1 0 0 1
|
||||||
|
} else {
|
||||||
|
_serial_gps->write("$PAIR066,1,1,1,1,0,0*3A\r\n"); // Enable GPS+GLONASS+GALILEO+BDS
|
||||||
|
// GPS GLONASS GALILEO BDS QZSS NAVIC
|
||||||
|
// 1 1 1 1 0 0
|
||||||
|
}
|
||||||
// Configure NMEA (sentences will output once per fix)
|
// Configure NMEA (sentences will output once per fix)
|
||||||
_serial_gps->write("$PAIR062,0,1*3F\r\n"); // GGA ON
|
_serial_gps->write("$PAIR062,0,1*3F\r\n"); // GGA ON
|
||||||
_serial_gps->write("$PAIR062,1,0*3F\r\n"); // GLL OFF
|
_serial_gps->write("$PAIR062,1,0*3F\r\n"); // GLL OFF
|
||||||
@@ -1503,7 +1511,7 @@ bool GPS::lookForTime()
|
|||||||
|
|
||||||
#ifdef GNSS_AIROHA
|
#ifdef GNSS_AIROHA
|
||||||
uint8_t fix = reader.fixQuality();
|
uint8_t fix = reader.fixQuality();
|
||||||
if (fix > 0) {
|
if (fix >= 1 && fix <= 5) {
|
||||||
if (lastFixStartMsec > 0) {
|
if (lastFixStartMsec > 0) {
|
||||||
if (Throttle::isWithinTimespanMs(lastFixStartMsec, GPS_FIX_HOLD_TIME)) {
|
if (Throttle::isWithinTimespanMs(lastFixStartMsec, GPS_FIX_HOLD_TIME)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -1536,7 +1544,10 @@ The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of s
|
|||||||
if (t.tm_mon > -1) {
|
if (t.tm_mon > -1) {
|
||||||
LOG_DEBUG("NMEA GPS time %02d-%02d-%02d %02d:%02d:%02d age %d", d.year(), d.month(), t.tm_mday, t.tm_hour, t.tm_min,
|
LOG_DEBUG("NMEA GPS time %02d-%02d-%02d %02d:%02d:%02d age %d", d.year(), d.month(), t.tm_mday, t.tm_hour, t.tm_min,
|
||||||
t.tm_sec, ti.age());
|
t.tm_sec, ti.age());
|
||||||
perhapsSetRTC(RTCQualityGPS, t);
|
if (perhapsSetRTC(RTCQualityGPS, t) == RTCSetResultInvalidTime) {
|
||||||
|
// Clear the GPS buffer if we got an invalid time
|
||||||
|
clearBuffer();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
@@ -1555,7 +1566,7 @@ bool GPS::lookForLocation()
|
|||||||
#ifdef GNSS_AIROHA
|
#ifdef GNSS_AIROHA
|
||||||
if ((config.position.gps_update_interval * 1000) >= (GPS_FIX_HOLD_TIME * 2)) {
|
if ((config.position.gps_update_interval * 1000) >= (GPS_FIX_HOLD_TIME * 2)) {
|
||||||
uint8_t fix = reader.fixQuality();
|
uint8_t fix = reader.fixQuality();
|
||||||
if (fix > 0) {
|
if (fix >= 1 && fix <= 5) {
|
||||||
if (lastFixStartMsec > 0) {
|
if (lastFixStartMsec > 0) {
|
||||||
if (Throttle::isWithinTimespanMs(lastFixStartMsec, GPS_FIX_HOLD_TIME)) {
|
if (Throttle::isWithinTimespanMs(lastFixStartMsec, GPS_FIX_HOLD_TIME)) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ void readFromRTC()
|
|||||||
*
|
*
|
||||||
* If we haven't yet set our RTC this boot, set it from a GPS derived time
|
* If we haven't yet set our RTC this boot, set it from a GPS derived time
|
||||||
*/
|
*/
|
||||||
bool perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate)
|
RTCSetResult perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate)
|
||||||
{
|
{
|
||||||
static uint32_t lastSetMsec = 0;
|
static uint32_t lastSetMsec = 0;
|
||||||
uint32_t now = millis();
|
uint32_t now = millis();
|
||||||
@@ -113,7 +113,7 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate)
|
|||||||
#ifdef BUILD_EPOCH
|
#ifdef BUILD_EPOCH
|
||||||
if (tv->tv_sec < BUILD_EPOCH) {
|
if (tv->tv_sec < BUILD_EPOCH) {
|
||||||
LOG_WARN("Ignore time (%ld) before build epoch (%ld)!", printableEpoch, BUILD_EPOCH);
|
LOG_WARN("Ignore time (%ld) before build epoch (%ld)!", printableEpoch, BUILD_EPOCH);
|
||||||
return false;
|
return RTCSetResultInvalidTime;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -184,9 +184,9 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate)
|
|||||||
readFromRTC();
|
readFromRTC();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return RTCSetResultSuccess;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return RTCSetResultNotSet; // RTC was already set with a higher quality time
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,7 +215,7 @@ const char *RtcName(RTCQuality quality)
|
|||||||
* @param t The time to potentially set the RTC to.
|
* @param t The time to potentially set the RTC to.
|
||||||
* @return True if the RTC was set to the provided time, false otherwise.
|
* @return True if the RTC was set to the provided time, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool perhapsSetRTC(RTCQuality q, struct tm &t)
|
RTCSetResult perhapsSetRTC(RTCQuality q, struct tm &t)
|
||||||
{
|
{
|
||||||
/* Convert to unix time
|
/* Convert to unix time
|
||||||
The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970
|
The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970
|
||||||
@@ -226,12 +226,19 @@ bool perhapsSetRTC(RTCQuality q, struct tm &t)
|
|||||||
time_t res = gm_mktime(&t);
|
time_t res = gm_mktime(&t);
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
tv.tv_sec = res;
|
tv.tv_sec = res;
|
||||||
tv.tv_usec = 0; // time.centisecond() * (10 / 1000);
|
tv.tv_usec = 0; // time.centisecond() * (10 / 1000);
|
||||||
|
uint32_t printableEpoch = tv.tv_sec; // Print lib only supports 32 bit but time_t can be 64 bit on some platforms
|
||||||
|
#ifdef BUILD_EPOCH
|
||||||
|
if (tv.tv_sec < BUILD_EPOCH) {
|
||||||
|
LOG_WARN("Ignore time (%ld) before build epoch (%ld)!", printableEpoch, BUILD_EPOCH);
|
||||||
|
return RTCSetResultInvalidTime;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// LOG_DEBUG("Got time from GPS month=%d, year=%d, unixtime=%ld", t.tm_mon, t.tm_year, tv.tv_sec);
|
// LOG_DEBUG("Got time from GPS month=%d, year=%d, unixtime=%ld", t.tm_mon, t.tm_year, tv.tv_sec);
|
||||||
if (t.tm_year < 0 || t.tm_year >= 300) {
|
if (t.tm_year < 0 || t.tm_year >= 300) {
|
||||||
// LOG_DEBUG("Ignore invalid GPS month=%d, year=%d, unixtime=%ld", t.tm_mon, t.tm_year, tv.tv_sec);
|
// LOG_DEBUG("Ignore invalid GPS month=%d, year=%d, unixtime=%ld", t.tm_mon, t.tm_year, tv.tv_sec);
|
||||||
return false;
|
return RTCSetResultInvalidTime;
|
||||||
} else {
|
} else {
|
||||||
return perhapsSetRTC(q, &tv);
|
return perhapsSetRTC(q, &tv);
|
||||||
}
|
}
|
||||||
@@ -244,11 +251,15 @@ bool perhapsSetRTC(RTCQuality q, struct tm &t)
|
|||||||
*/
|
*/
|
||||||
int32_t getTZOffset()
|
int32_t getTZOffset()
|
||||||
{
|
{
|
||||||
|
#if MESHTASTIC_EXCLUDE_TZ
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
time_t now = getTime(false);
|
time_t now = getTime(false);
|
||||||
struct tm *gmt;
|
struct tm *gmt;
|
||||||
gmt = gmtime(&now);
|
gmt = gmtime(&now);
|
||||||
gmt->tm_isdst = -1;
|
gmt->tm_isdst = -1;
|
||||||
return (int32_t)difftime(now, mktime(gmt));
|
return (int32_t)difftime(now, mktime(gmt));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,13 +22,22 @@ enum RTCQuality {
|
|||||||
RTCQualityGPS = 4
|
RTCQualityGPS = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// The RTC set result codes
|
||||||
|
/// Used to indicate the result of an attempt to set the RTC.
|
||||||
|
enum RTCSetResult {
|
||||||
|
RTCSetResultNotSet = 0, ///< RTC was set successfully
|
||||||
|
RTCSetResultSuccess = 1, ///< RTC was set successfully
|
||||||
|
RTCSetResultInvalidTime = 3, ///< The provided time was invalid (e.g., before the build epoch)
|
||||||
|
RTCSetResultError = 4 ///< An error occurred while setting the RTC
|
||||||
|
};
|
||||||
|
|
||||||
RTCQuality getRTCQuality();
|
RTCQuality getRTCQuality();
|
||||||
|
|
||||||
extern uint32_t lastSetFromPhoneNtpOrGps;
|
extern uint32_t lastSetFromPhoneNtpOrGps;
|
||||||
|
|
||||||
/// If we haven't yet set our RTC this boot, set it from a GPS derived time
|
/// If we haven't yet set our RTC this boot, set it from a GPS derived time
|
||||||
bool perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate = false);
|
RTCSetResult perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate = false);
|
||||||
bool perhapsSetRTC(RTCQuality q, struct tm &t);
|
RTCSetResult perhapsSetRTC(RTCQuality q, struct tm &t);
|
||||||
|
|
||||||
/// Return a string name for the quality
|
/// Return a string name for the quality
|
||||||
const char *RtcName(RTCQuality quality);
|
const char *RtcName(RTCQuality quality);
|
||||||
|
|||||||
@@ -6,6 +6,10 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
|
|
||||||
|
#ifdef GXEPD2_DRIVER_0
|
||||||
|
#include "einkDetect.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The macros EINK_DISPLAY_MODEL, EINK_WIDTH, and EINK_HEIGHT are defined as build_flags in a variant's platformio.ini
|
The macros EINK_DISPLAY_MODEL, EINK_WIDTH, and EINK_HEIGHT are defined as build_flags in a variant's platformio.ini
|
||||||
Previously, these macros were defined at the top of this file.
|
Previously, these macros were defined at the top of this file.
|
||||||
@@ -174,9 +178,8 @@ bool EInkDisplay::connect()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_VISION_MASTER_E213) || \
|
#elif defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_VISION_MASTER_E290) || defined(TLORA_T3S3_EPAPER) || \
|
||||||
defined(HELTEC_VISION_MASTER_E290) || defined(TLORA_T3S3_EPAPER) || defined(CROWPANEL_ESP32S3_5_EPAPER) || \
|
defined(CROWPANEL_ESP32S3_5_EPAPER) || defined(CROWPANEL_ESP32S3_4_EPAPER) || defined(CROWPANEL_ESP32S3_2_EPAPER)
|
||||||
defined(CROWPANEL_ESP32S3_4_EPAPER) || defined(CROWPANEL_ESP32S3_2_EPAPER)
|
|
||||||
{
|
{
|
||||||
// Start HSPI
|
// Start HSPI
|
||||||
hspi = new SPIClass(HSPI);
|
hspi = new SPIClass(HSPI);
|
||||||
@@ -203,7 +206,7 @@ bool EInkDisplay::connect()
|
|||||||
adafruitDisplay->setRotation(0);
|
adafruitDisplay->setRotation(0);
|
||||||
adafruitDisplay->setPartialWindow(0, 0, EINK_WIDTH, EINK_HEIGHT);
|
adafruitDisplay->setPartialWindow(0, 0, EINK_WIDTH, EINK_HEIGHT);
|
||||||
}
|
}
|
||||||
#elif defined(M5_COREINK)
|
#elif defined(M5_COREINK) || defined(T_DECK_PRO)
|
||||||
auto lowLevel = new EINK_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY);
|
auto lowLevel = new EINK_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY);
|
||||||
adafruitDisplay = new GxEPD2_BW<EINK_DISPLAY_MODEL, EINK_DISPLAY_MODEL::HEIGHT>(*lowLevel);
|
adafruitDisplay = new GxEPD2_BW<EINK_DISPLAY_MODEL, EINK_DISPLAY_MODEL::HEIGHT>(*lowLevel);
|
||||||
adafruitDisplay->init(115200, true, 40, false, SPI, SPISettings(4000000, MSBFIRST, SPI_MODE0));
|
adafruitDisplay->init(115200, true, 40, false, SPI, SPISettings(4000000, MSBFIRST, SPI_MODE0));
|
||||||
@@ -232,6 +235,23 @@ bool EInkDisplay::connect()
|
|||||||
adafruitDisplay->init();
|
adafruitDisplay->init();
|
||||||
adafruitDisplay->setRotation(3);
|
adafruitDisplay->setRotation(3);
|
||||||
}
|
}
|
||||||
|
#elif defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_VISION_MASTER_E213)
|
||||||
|
|
||||||
|
// Detect display model, before starting SPI
|
||||||
|
EInkDetectionResult displayModel = detectEInk();
|
||||||
|
|
||||||
|
// Start HSPI
|
||||||
|
hspi = new SPIClass(HSPI);
|
||||||
|
hspi->begin(PIN_EINK_SCLK, -1, PIN_EINK_MOSI, PIN_EINK_CS); // SCLK, MISO, MOSI, SS
|
||||||
|
|
||||||
|
// Create GxEPD2 object
|
||||||
|
adafruitDisplay = new GxEPD2_Multi<GXEPD2_DRIVER_0, GXEPD2_DRIVER_1>((uint8_t)displayModel, PIN_EINK_CS, PIN_EINK_DC,
|
||||||
|
PIN_EINK_RES, PIN_EINK_BUSY, *hspi);
|
||||||
|
|
||||||
|
// Init GxEPD2
|
||||||
|
adafruitDisplay->init();
|
||||||
|
adafruitDisplay->setRotation(3);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -5,6 +5,10 @@
|
|||||||
#include "GxEPD2_BW.h"
|
#include "GxEPD2_BW.h"
|
||||||
#include <OLEDDisplay.h>
|
#include <OLEDDisplay.h>
|
||||||
|
|
||||||
|
#ifdef GXEPD2_DRIVER_0 // If variant has multiple possible display models
|
||||||
|
#include "GxEPD2Multi.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An adapter class that allows using the GxEPD2 library as if it was an OLEDDisplay implementation.
|
* An adapter class that allows using the GxEPD2 library as if it was an OLEDDisplay implementation.
|
||||||
*
|
*
|
||||||
@@ -63,8 +67,15 @@ class EInkDisplay : public OLEDDisplay
|
|||||||
// Connect to the display
|
// Connect to the display
|
||||||
virtual bool connect() override;
|
virtual bool connect() override;
|
||||||
|
|
||||||
// AdafruitGFX display object - instantiated in connect(), variant specific
|
#ifdef GXEPD2_DRIVER_0
|
||||||
|
// AdafruitGFX display object - wrapper for multiple drivers
|
||||||
|
// Allows runtime detection of multiple displays
|
||||||
|
// Avoid this situation if possible!
|
||||||
|
GxEPD2_Multi<GXEPD2_DRIVER_0, GXEPD2_DRIVER_1> *adafruitDisplay = NULL;
|
||||||
|
#else
|
||||||
|
// AdafruitGFX display object (for single display model) - instantiated in connect(), variant specific
|
||||||
GxEPD2_BW<EINK_DISPLAY_MODEL, EINK_DISPLAY_MODEL::HEIGHT> *adafruitDisplay = NULL;
|
GxEPD2_BW<EINK_DISPLAY_MODEL, EINK_DISPLAY_MODEL::HEIGHT> *adafruitDisplay = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
// If display uses HSPI
|
// If display uses HSPI
|
||||||
#if defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_VISION_MASTER_E213) || \
|
#if defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_VISION_MASTER_E213) || \
|
||||||
|
|||||||
135
src/graphics/GxEPD2Multi.h
Normal file
135
src/graphics/GxEPD2Multi.h
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
// Wrapper class for GxEPD2_BW
|
||||||
|
|
||||||
|
// Generic signature at build-time, so that we can detect display model at run-time
|
||||||
|
// Workaround for issue of GxEPD2_BW objects not having a shared base class
|
||||||
|
// Only exposes methods which we are actually using
|
||||||
|
|
||||||
|
template <typename Driver0, typename Driver1> class GxEPD2_Multi
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void drawPixel(int16_t x, int16_t y, uint16_t color)
|
||||||
|
{
|
||||||
|
if (which == 0)
|
||||||
|
driver0->drawPixel(x, y, color);
|
||||||
|
else
|
||||||
|
driver1->drawPixel(x, y, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nextPage()
|
||||||
|
{
|
||||||
|
if (which == 0)
|
||||||
|
return driver0->nextPage();
|
||||||
|
else
|
||||||
|
return driver1->nextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
void hibernate()
|
||||||
|
{
|
||||||
|
if (which == 0)
|
||||||
|
driver0->hibernate();
|
||||||
|
else
|
||||||
|
driver1->hibernate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void init(uint32_t serial_diag_bitrate = 0)
|
||||||
|
{
|
||||||
|
if (which == 0)
|
||||||
|
driver0->init(serial_diag_bitrate);
|
||||||
|
else
|
||||||
|
driver1->init(serial_diag_bitrate);
|
||||||
|
}
|
||||||
|
|
||||||
|
void init(uint32_t serial_diag_bitrate, bool initial, uint16_t reset_duration = 20, bool pulldown_rst_mode = false)
|
||||||
|
{
|
||||||
|
if (which == 0)
|
||||||
|
driver0->init(serial_diag_bitrate, initial, reset_duration, pulldown_rst_mode);
|
||||||
|
else
|
||||||
|
driver1->init(serial_diag_bitrate, initial, reset_duration, pulldown_rst_mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setRotation(uint8_t x)
|
||||||
|
{
|
||||||
|
if (which == 0)
|
||||||
|
driver0->setRotation(x);
|
||||||
|
else
|
||||||
|
driver1->setRotation(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPartialWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
|
||||||
|
{
|
||||||
|
if (which == 0)
|
||||||
|
driver0->setPartialWindow(x, y, w, h);
|
||||||
|
else
|
||||||
|
driver1->setPartialWindow(x, y, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setFullWindow()
|
||||||
|
{
|
||||||
|
if (which == 0)
|
||||||
|
driver0->setFullWindow();
|
||||||
|
else
|
||||||
|
driver1->setFullWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
int16_t width()
|
||||||
|
{
|
||||||
|
if (which == 0)
|
||||||
|
return driver0->width();
|
||||||
|
else
|
||||||
|
return driver1->width();
|
||||||
|
}
|
||||||
|
|
||||||
|
int16_t height()
|
||||||
|
{
|
||||||
|
if (which == 0)
|
||||||
|
return driver0->height();
|
||||||
|
else
|
||||||
|
return driver1->height();
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearScreen(uint8_t value = 0xFF)
|
||||||
|
{
|
||||||
|
if (which == 0)
|
||||||
|
driver0->clearScreen();
|
||||||
|
else
|
||||||
|
driver1->clearScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
void endAsyncFull()
|
||||||
|
{
|
||||||
|
if (which == 0)
|
||||||
|
driver0->endAsyncFull();
|
||||||
|
else
|
||||||
|
driver1->endAsyncFull();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exposes methods of the GxEPD2_EPD object which is usually available as GxEPD2_BW::epd
|
||||||
|
class Epd2Wrapper
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bool isBusy() { return m_epd2->isBusy(); }
|
||||||
|
GxEPD2_EPD *m_epd2;
|
||||||
|
} epd2;
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
// Select driver by passing whichDriver as 0 or 1
|
||||||
|
GxEPD2_Multi(uint8_t whichDriver, int16_t cs, int16_t dc, int16_t rst, int16_t busy, SPIClass &spi)
|
||||||
|
{
|
||||||
|
assert(whichDriver == 0 || whichDriver == 1);
|
||||||
|
which = whichDriver;
|
||||||
|
LOG_DEBUG("GxEPD2_Multi driver: %d", which);
|
||||||
|
|
||||||
|
if (which == 0) {
|
||||||
|
driver0 = new GxEPD2_BW<Driver0, Driver0::HEIGHT>(Driver0(cs, dc, rst, busy, spi));
|
||||||
|
epd2.m_epd2 = &(driver0->epd2);
|
||||||
|
} else if (which == 1) {
|
||||||
|
driver1 = new GxEPD2_BW<Driver1, Driver1::HEIGHT>(Driver1(cs, dc, rst, busy, spi));
|
||||||
|
epd2.m_epd2 = &(driver1->epd2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint8_t which;
|
||||||
|
GxEPD2_BW<Driver0, Driver0::HEIGHT> *driver0;
|
||||||
|
GxEPD2_BW<Driver1, Driver1::HEIGHT> *driver1;
|
||||||
|
};
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,28 @@
|
|||||||
#include "detect/ScanI2C.h"
|
#include "detect/ScanI2C.h"
|
||||||
#include "mesh/generated/meshtastic/config.pb.h"
|
#include "mesh/generated/meshtastic/config.pb.h"
|
||||||
#include <OLEDDisplay.h>
|
#include <OLEDDisplay.h>
|
||||||
|
#include <functional>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#define getStringCenteredX(s) ((SCREEN_WIDTH - display->getStringWidth(s)) / 2)
|
||||||
|
namespace graphics
|
||||||
|
{
|
||||||
|
enum notificationTypeEnum { none, text_banner, selection_picker, node_picker, number_picker };
|
||||||
|
|
||||||
|
struct BannerOverlayOptions {
|
||||||
|
const char *message;
|
||||||
|
uint32_t durationMs = 30000;
|
||||||
|
const char **optionsArrayPtr = nullptr;
|
||||||
|
const int *optionsEnumPtr = nullptr;
|
||||||
|
uint8_t optionsCount = 0;
|
||||||
|
std::function<void(int)> bannerCallback = nullptr;
|
||||||
|
int8_t InitialSelected = 0;
|
||||||
|
notificationTypeEnum notificationType = notificationTypeEnum::text_banner;
|
||||||
|
};
|
||||||
|
} // namespace graphics
|
||||||
|
|
||||||
|
bool shouldWakeOnReceivedMessage();
|
||||||
|
|
||||||
#if !HAS_SCREEN
|
#if !HAS_SCREEN
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
@@ -14,11 +36,20 @@ namespace graphics
|
|||||||
class Screen
|
class Screen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum FrameFocus : uint8_t {
|
||||||
|
FOCUS_DEFAULT, // No specific frame
|
||||||
|
FOCUS_PRESERVE, // Return to the previous frame
|
||||||
|
FOCUS_FAULT,
|
||||||
|
FOCUS_TEXTMESSAGE,
|
||||||
|
FOCUS_MODULE, // Note: target module should call requestFocus(), otherwise no info about which module to focus
|
||||||
|
FOCUS_CLOCK,
|
||||||
|
FOCUS_SYSTEM,
|
||||||
|
};
|
||||||
|
|
||||||
explicit Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY);
|
explicit Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY);
|
||||||
void onPress() {}
|
void onPress() {}
|
||||||
void setup() {}
|
void setup() {}
|
||||||
void setOn(bool) {}
|
void setOn(bool) {}
|
||||||
void print(const char *) {}
|
|
||||||
void doDeepSleep() {}
|
void doDeepSleep() {}
|
||||||
void forceDisplay(bool forceUiUpdate = false) {}
|
void forceDisplay(bool forceUiUpdate = false) {}
|
||||||
void startFirmwareUpdateScreen() {}
|
void startFirmwareUpdateScreen() {}
|
||||||
@@ -27,6 +58,9 @@ class Screen
|
|||||||
void setFunctionSymbol(std::string) {}
|
void setFunctionSymbol(std::string) {}
|
||||||
void removeFunctionSymbol(std::string) {}
|
void removeFunctionSymbol(std::string) {}
|
||||||
void startAlert(const char *) {}
|
void startAlert(const char *) {}
|
||||||
|
void showSimpleBanner(const char *message, uint32_t durationMs = 0) {}
|
||||||
|
void showOverlayBanner(BannerOverlayOptions) {}
|
||||||
|
void setFrames(FrameFocus focus) {}
|
||||||
void endAlert() {}
|
void endAlert() {}
|
||||||
};
|
};
|
||||||
} // namespace graphics
|
} // namespace graphics
|
||||||
@@ -60,10 +94,13 @@ class Screen
|
|||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
#include "concurrency/LockGuard.h"
|
#include "concurrency/LockGuard.h"
|
||||||
#include "concurrency/OSThread.h"
|
#include "concurrency/OSThread.h"
|
||||||
|
#include "graphics/draw/MenuHandler.h"
|
||||||
#include "input/InputBroker.h"
|
#include "input/InputBroker.h"
|
||||||
#include "mesh/MeshModule.h"
|
#include "mesh/MeshModule.h"
|
||||||
|
#include "modules/AdminModule.h"
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
// 0 to 255, though particular variants might define different defaults
|
// 0 to 255, though particular variants might define different defaults
|
||||||
#ifndef BRIGHTNESS_DEFAULT
|
#ifndef BRIGHTNESS_DEFAULT
|
||||||
@@ -90,7 +127,7 @@ class Screen
|
|||||||
|
|
||||||
/// Convert an integer GPS coords to a floating point
|
/// Convert an integer GPS coords to a floating point
|
||||||
#define DegD(i) (i * 1e-7)
|
#define DegD(i) (i * 1e-7)
|
||||||
|
extern bool hasUnreadMessage;
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
/// A basic 2D point class for drawing
|
/// A basic 2D point class for drawing
|
||||||
@@ -176,14 +213,31 @@ class Screen : public concurrency::OSThread
|
|||||||
CallbackObserver<Screen, const UIFrameEvent *>(this, &Screen::handleUIFrameEvent); // Sent by Mesh Modules
|
CallbackObserver<Screen, const UIFrameEvent *>(this, &Screen::handleUIFrameEvent); // Sent by Mesh Modules
|
||||||
CallbackObserver<Screen, const InputEvent *> inputObserver =
|
CallbackObserver<Screen, const InputEvent *> inputObserver =
|
||||||
CallbackObserver<Screen, const InputEvent *>(this, &Screen::handleInputEvent);
|
CallbackObserver<Screen, const InputEvent *>(this, &Screen::handleInputEvent);
|
||||||
CallbackObserver<Screen, const meshtastic_AdminMessage *> adminMessageObserver =
|
CallbackObserver<Screen, AdminModule_ObserverData *> adminMessageObserver =
|
||||||
CallbackObserver<Screen, const meshtastic_AdminMessage *>(this, &Screen::handleAdminMessage);
|
CallbackObserver<Screen, AdminModule_ObserverData *>(this, &Screen::handleAdminMessage);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
OLEDDisplay *getDisplayDevice() { return dispdev; }
|
||||||
explicit Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY);
|
explicit Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY);
|
||||||
|
size_t frameCount = 0; // Total number of active frames
|
||||||
~Screen();
|
~Screen();
|
||||||
|
|
||||||
|
// Which frame we want to be displayed, after we regen the frameset by calling setFrames
|
||||||
|
enum FrameFocus : uint8_t {
|
||||||
|
FOCUS_DEFAULT, // No specific frame
|
||||||
|
FOCUS_PRESERVE, // Return to the previous frame
|
||||||
|
FOCUS_FAULT,
|
||||||
|
FOCUS_TEXTMESSAGE,
|
||||||
|
FOCUS_MODULE, // Note: target module should call requestFocus(), otherwise no info about which module to focus
|
||||||
|
FOCUS_CLOCK,
|
||||||
|
FOCUS_SYSTEM,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Regenerate the normal set of frames, focusing a specific frame if requested
|
||||||
|
// Call when a frame should be added / removed, or custom frames should be cleared
|
||||||
|
void setFrames(FrameFocus focus = FOCUS_DEFAULT);
|
||||||
|
|
||||||
|
std::vector<const uint8_t *> indicatorIcons; // Per-frame custom icon pointers
|
||||||
Screen(const Screen &) = delete;
|
Screen(const Screen &) = delete;
|
||||||
Screen &operator=(const Screen &) = delete;
|
Screen &operator=(const Screen &) = delete;
|
||||||
|
|
||||||
@@ -191,6 +245,12 @@ class Screen : public concurrency::OSThread
|
|||||||
meshtastic_Config_DisplayConfig_OledType model;
|
meshtastic_Config_DisplayConfig_OledType model;
|
||||||
OLEDDISPLAY_GEOMETRY geometry;
|
OLEDDISPLAY_GEOMETRY geometry;
|
||||||
|
|
||||||
|
bool isOverlayBannerShowing();
|
||||||
|
|
||||||
|
// Stores the last 4 of our hardware ID, to make finding the device for pairing easier
|
||||||
|
// FIXME: Needs refactoring and getMacAddr needs to be moved to a utility class
|
||||||
|
char ourId[5];
|
||||||
|
|
||||||
/// Initializes the UI, turns on the display, starts showing boot screen.
|
/// Initializes the UI, turns on the display, starts showing boot screen.
|
||||||
//
|
//
|
||||||
// Not thread safe - must be called before any other methods are called.
|
// Not thread safe - must be called before any other methods are called.
|
||||||
@@ -214,21 +274,9 @@ class Screen : public concurrency::OSThread
|
|||||||
|
|
||||||
void blink();
|
void blink();
|
||||||
|
|
||||||
void drawFrameText(OLEDDisplay *, OLEDDisplayUiState *, int16_t, int16_t, const char *);
|
|
||||||
|
|
||||||
void getTimeAgoStr(uint32_t agoSecs, char *timeStr, uint8_t maxLength);
|
|
||||||
|
|
||||||
// Draw north
|
// Draw north
|
||||||
void drawCompassNorth(OLEDDisplay *display, int16_t compassX, int16_t compassY, float myHeading);
|
|
||||||
|
|
||||||
static uint16_t getCompassDiam(uint32_t displayWidth, uint32_t displayHeight);
|
|
||||||
|
|
||||||
float estimatedHeading(double lat, double lon);
|
float estimatedHeading(double lat, double lon);
|
||||||
|
|
||||||
void drawNodeHeading(OLEDDisplay *display, int16_t compassX, int16_t compassY, uint16_t compassDiam, float headingRadian);
|
|
||||||
|
|
||||||
void drawColumns(OLEDDisplay *display, int16_t x, int16_t y, const char **fields);
|
|
||||||
|
|
||||||
/// Handle button press, trackball or swipe action)
|
/// Handle button press, trackball or swipe action)
|
||||||
void onPress() { enqueueCmd(ScreenCmd{.cmd = Cmd::ON_PRESS}); }
|
void onPress() { enqueueCmd(ScreenCmd{.cmd = Cmd::ON_PRESS}); }
|
||||||
void showPrevFrame() { enqueueCmd(ScreenCmd{.cmd = Cmd::SHOW_PREV_FRAME}); }
|
void showPrevFrame() { enqueueCmd(ScreenCmd{.cmd = Cmd::SHOW_PREV_FRAME}); }
|
||||||
@@ -260,6 +308,18 @@ class Screen : public concurrency::OSThread
|
|||||||
enqueueCmd(cmd);
|
enqueueCmd(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void showSimpleBanner(const char *message, uint32_t durationMs = 0);
|
||||||
|
void showOverlayBanner(BannerOverlayOptions);
|
||||||
|
|
||||||
|
void showNodePicker(const char *message, uint32_t durationMs, std::function<void(uint32_t)> bannerCallback);
|
||||||
|
void showNumberPicker(const char *message, uint32_t durationMs, uint8_t digits, std::function<void(uint32_t)> bannerCallback);
|
||||||
|
|
||||||
|
void requestMenu(graphics::menuHandler::screenMenus menuToShow)
|
||||||
|
{
|
||||||
|
graphics::menuHandler::menuQueue = menuToShow;
|
||||||
|
runNow();
|
||||||
|
}
|
||||||
|
|
||||||
void startFirmwareUpdateScreen()
|
void startFirmwareUpdateScreen()
|
||||||
{
|
{
|
||||||
ScreenCmd cmd;
|
ScreenCmd cmd;
|
||||||
@@ -272,7 +332,7 @@ class Screen : public concurrency::OSThread
|
|||||||
void setHeading(long _heading)
|
void setHeading(long _heading)
|
||||||
{
|
{
|
||||||
hasCompass = true;
|
hasCompass = true;
|
||||||
compassHeading = _heading;
|
compassHeading = fmod(_heading, 360);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasHeading() { return hasCompass; }
|
bool hasHeading() { return hasCompass; }
|
||||||
@@ -292,23 +352,12 @@ class Screen : public concurrency::OSThread
|
|||||||
/// Stops showing the boot screen.
|
/// Stops showing the boot screen.
|
||||||
void stopBootScreen() { enqueueCmd(ScreenCmd{.cmd = Cmd::STOP_BOOT_SCREEN}); }
|
void stopBootScreen() { enqueueCmd(ScreenCmd{.cmd = Cmd::STOP_BOOT_SCREEN}); }
|
||||||
|
|
||||||
/// Writes a string to the screen.
|
void runNow()
|
||||||
void print(const char *text)
|
|
||||||
{
|
{
|
||||||
ScreenCmd cmd;
|
setFastFramerate();
|
||||||
cmd.cmd = Cmd::PRINT;
|
enqueueCmd(ScreenCmd{.cmd = Cmd::NOOP});
|
||||||
// TODO(girts): strdup() here is scary, but we can't use std::string as
|
|
||||||
// FreeRTOS queue is just dumbly copying memory contents. It would be
|
|
||||||
// nice if we had a queue that could copy objects by value.
|
|
||||||
cmd.print_text = strdup(text);
|
|
||||||
if (!enqueueCmd(cmd)) {
|
|
||||||
free(cmd.print_text);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generates a very brief time delta display
|
|
||||||
std::string drawTimeDelta(uint32_t days, uint32_t hours, uint32_t minutes, uint32_t seconds);
|
|
||||||
|
|
||||||
/// Overrides the default utf8 character conversion, to replace empty space with question marks
|
/// Overrides the default utf8 character conversion, to replace empty space with question marks
|
||||||
static char customFontTableLookup(const uint8_t ch)
|
static char customFontTableLookup(const uint8_t ch)
|
||||||
{
|
{
|
||||||
@@ -533,7 +582,7 @@ class Screen : public concurrency::OSThread
|
|||||||
int handleTextMessage(const meshtastic_MeshPacket *arg);
|
int handleTextMessage(const meshtastic_MeshPacket *arg);
|
||||||
int handleUIFrameEvent(const UIFrameEvent *arg);
|
int handleUIFrameEvent(const UIFrameEvent *arg);
|
||||||
int handleInputEvent(const InputEvent *arg);
|
int handleInputEvent(const InputEvent *arg);
|
||||||
int handleAdminMessage(const meshtastic_AdminMessage *arg);
|
int handleAdminMessage(AdminModule_ObserverData *arg);
|
||||||
|
|
||||||
/// Used to force (super slow) eink displays to draw critical frames
|
/// Used to force (super slow) eink displays to draw critical frames
|
||||||
void forceDisplay(bool forceUiUpdate = false);
|
void forceDisplay(bool forceUiUpdate = false);
|
||||||
@@ -541,8 +590,6 @@ class Screen : public concurrency::OSThread
|
|||||||
/// Draws our SSL cert screen during boot (called from WebServer)
|
/// Draws our SSL cert screen during boot (called from WebServer)
|
||||||
void setSSLFrames();
|
void setSSLFrames();
|
||||||
|
|
||||||
void setWelcomeFrames();
|
|
||||||
|
|
||||||
// Dismiss the currently focussed frame, if possible (e.g. text message, waypoint)
|
// Dismiss the currently focussed frame, if possible (e.g. text message, waypoint)
|
||||||
void dismissCurrentFrame();
|
void dismissCurrentFrame();
|
||||||
|
|
||||||
@@ -591,7 +638,6 @@ class Screen : public concurrency::OSThread
|
|||||||
void handleOnPress();
|
void handleOnPress();
|
||||||
void handleShowNextFrame();
|
void handleShowNextFrame();
|
||||||
void handleShowPrevFrame();
|
void handleShowPrevFrame();
|
||||||
void handlePrint(const char *text);
|
|
||||||
void handleStartFirmwareUpdateScreen();
|
void handleStartFirmwareUpdateScreen();
|
||||||
|
|
||||||
// Info collected by setFrames method.
|
// Info collected by setFrames method.
|
||||||
@@ -600,30 +646,37 @@ class Screen : public concurrency::OSThread
|
|||||||
// - Used to dismiss the currently shown frame (txt; waypoint) by CardKB combo
|
// - Used to dismiss the currently shown frame (txt; waypoint) by CardKB combo
|
||||||
struct FramesetInfo {
|
struct FramesetInfo {
|
||||||
struct FramePositions {
|
struct FramePositions {
|
||||||
uint8_t fault = 0;
|
uint8_t fault = 255;
|
||||||
uint8_t textMessage = 0;
|
uint8_t waypoint = 255;
|
||||||
uint8_t waypoint = 0;
|
uint8_t focusedModule = 255;
|
||||||
uint8_t focusedModule = 0;
|
uint8_t log = 255;
|
||||||
uint8_t log = 0;
|
uint8_t settings = 255;
|
||||||
uint8_t settings = 0;
|
uint8_t wifi = 255;
|
||||||
uint8_t wifi = 0;
|
uint8_t deviceFocused = 255;
|
||||||
|
uint8_t memory = 255;
|
||||||
|
uint8_t gps = 255;
|
||||||
|
uint8_t home = 255;
|
||||||
|
uint8_t textMessage = 255;
|
||||||
|
uint8_t nodelist = 255;
|
||||||
|
uint8_t nodelist_lastheard = 255;
|
||||||
|
uint8_t nodelist_hopsignal = 255;
|
||||||
|
uint8_t nodelist_distance = 255;
|
||||||
|
uint8_t nodelist_bearings = 255;
|
||||||
|
uint8_t clock = 255;
|
||||||
|
uint8_t firstFavorite = 255;
|
||||||
|
uint8_t lastFavorite = 255;
|
||||||
|
uint8_t lora = 255;
|
||||||
} positions;
|
} positions;
|
||||||
|
|
||||||
uint8_t frameCount = 0;
|
uint8_t frameCount = 0;
|
||||||
} framesetInfo;
|
} framesetInfo;
|
||||||
|
|
||||||
// Which frame we want to be displayed, after we regen the frameset by calling setFrames
|
struct DismissedFrames {
|
||||||
enum FrameFocus : uint8_t {
|
bool textMessage = false;
|
||||||
FOCUS_DEFAULT, // No specific frame
|
bool waypoint = false;
|
||||||
FOCUS_PRESERVE, // Return to the previous frame
|
bool wifi = false;
|
||||||
FOCUS_FAULT,
|
bool memory = false;
|
||||||
FOCUS_TEXTMESSAGE,
|
} dismissedFrames;
|
||||||
FOCUS_MODULE, // Note: target module should call requestFocus(), otherwise no info about which module to focus
|
|
||||||
};
|
|
||||||
|
|
||||||
// Regenerate the normal set of frames, focusing a specific frame if requested
|
|
||||||
// Call when a frame should be added / removed, or custom frames should be cleared
|
|
||||||
void setFrames(FrameFocus focus = FOCUS_DEFAULT);
|
|
||||||
|
|
||||||
/// Try to start drawing ASAP
|
/// Try to start drawing ASAP
|
||||||
void setFastFramerate();
|
void setFastFramerate();
|
||||||
@@ -631,34 +684,6 @@ class Screen : public concurrency::OSThread
|
|||||||
// Sets frame up for immediate drawing
|
// Sets frame up for immediate drawing
|
||||||
void setFrameImmediateDraw(FrameCallback *drawFrames);
|
void setFrameImmediateDraw(FrameCallback *drawFrames);
|
||||||
|
|
||||||
/// Called when debug screen is to be drawn, calls through to debugInfo.drawFrame.
|
|
||||||
static void drawDebugInfoTrampoline(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
|
||||||
|
|
||||||
static void drawDebugInfoSettingsTrampoline(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
|
||||||
|
|
||||||
static void drawDebugInfoWiFiTrampoline(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
|
||||||
|
|
||||||
#if defined(DISPLAY_CLOCK_FRAME)
|
|
||||||
static void drawAnalogClockFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
|
||||||
|
|
||||||
static void drawDigitalClockFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
|
||||||
|
|
||||||
static void drawSegmentedDisplayCharacter(OLEDDisplay *display, int x, int y, uint8_t number, float scale = 1);
|
|
||||||
|
|
||||||
static void drawHorizontalSegment(OLEDDisplay *display, int x, int y, int width, int height);
|
|
||||||
|
|
||||||
static void drawVerticalSegment(OLEDDisplay *display, int x, int y, int width, int height);
|
|
||||||
|
|
||||||
static void drawSegmentedDisplayColon(OLEDDisplay *display, int x, int y, float scale = 1);
|
|
||||||
|
|
||||||
static void drawWatchFaceToggleButton(OLEDDisplay *display, int16_t x, int16_t y, bool digitalMode = true, float scale = 1);
|
|
||||||
|
|
||||||
static void drawBluetoothConnectedIcon(OLEDDisplay *display, int16_t x, int16_t y);
|
|
||||||
|
|
||||||
// Whether we are showing the digital watch face or the analog one
|
|
||||||
bool digitalWatchFace = true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// callback for current alert frame
|
/// callback for current alert frame
|
||||||
FrameCallback alertFrame;
|
FrameCallback alertFrame;
|
||||||
|
|
||||||
@@ -691,4 +716,9 @@ class Screen : public concurrency::OSThread
|
|||||||
|
|
||||||
} // namespace graphics
|
} // namespace graphics
|
||||||
|
|
||||||
|
// Extern declarations for function symbols used in UIRenderer
|
||||||
|
extern std::vector<std::string> functionSymbol;
|
||||||
|
extern std::string functionSymbolString;
|
||||||
|
extern graphics::Screen *screen;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
6
src/graphics/ScreenGlobals.cpp
Normal file
6
src/graphics/ScreenGlobals.cpp
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
// Global variables for screen function overlay
|
||||||
|
std::vector<std::string> functionSymbol;
|
||||||
|
std::string functionSymbolString;
|
||||||
394
src/graphics/SharedUIDisplay.cpp
Normal file
394
src/graphics/SharedUIDisplay.cpp
Normal file
@@ -0,0 +1,394 @@
|
|||||||
|
#include "graphics/SharedUIDisplay.h"
|
||||||
|
#include "RTC.h"
|
||||||
|
#include "graphics/ScreenFonts.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "meshtastic/config.pb.h"
|
||||||
|
#include "power.h"
|
||||||
|
#include <OLEDDisplay.h>
|
||||||
|
#include <graphics/images.h>
|
||||||
|
|
||||||
|
namespace graphics
|
||||||
|
{
|
||||||
|
|
||||||
|
void determineResolution(int16_t screenheight, int16_t screenwidth)
|
||||||
|
{
|
||||||
|
if (screenwidth > 128) {
|
||||||
|
isHighResolution = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Special case for Heltec Wireless Tracker v1.1
|
||||||
|
if (screenwidth == 160 && screenheight == 80) {
|
||||||
|
isHighResolution = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// === Shared External State ===
|
||||||
|
bool hasUnreadMessage = false;
|
||||||
|
bool isMuted = false;
|
||||||
|
bool isHighResolution = false;
|
||||||
|
|
||||||
|
// === Internal State ===
|
||||||
|
bool isBoltVisibleShared = true;
|
||||||
|
uint32_t lastBlinkShared = 0;
|
||||||
|
bool isMailIconVisible = true;
|
||||||
|
uint32_t lastMailBlink = 0;
|
||||||
|
|
||||||
|
// *********************************
|
||||||
|
// * Rounded Header when inverted *
|
||||||
|
// *********************************
|
||||||
|
void drawRoundedHighlight(OLEDDisplay *display, int16_t x, int16_t y, int16_t w, int16_t h, int16_t r)
|
||||||
|
{
|
||||||
|
// Draw the center and side rectangles
|
||||||
|
display->fillRect(x + r, y, w - 2 * r, h); // center bar
|
||||||
|
display->fillRect(x, y + r, r, h - 2 * r); // left edge
|
||||||
|
display->fillRect(x + w - r, y + r, r, h - 2 * r); // right edge
|
||||||
|
|
||||||
|
// Draw the rounded corners using filled circles
|
||||||
|
display->fillCircle(x + r + 1, y + r, r); // top-left
|
||||||
|
display->fillCircle(x + w - r - 1, y + r, r); // top-right
|
||||||
|
display->fillCircle(x + r + 1, y + h - r - 1, r); // bottom-left
|
||||||
|
display->fillCircle(x + w - r - 1, y + h - r - 1, r); // bottom-right
|
||||||
|
}
|
||||||
|
|
||||||
|
// *************************
|
||||||
|
// * Common Header Drawing *
|
||||||
|
// *************************
|
||||||
|
void drawCommonHeader(OLEDDisplay *display, int16_t x, int16_t y, const char *titleStr, bool battery_only)
|
||||||
|
{
|
||||||
|
constexpr int HEADER_OFFSET_Y = 1;
|
||||||
|
y += HEADER_OFFSET_Y;
|
||||||
|
|
||||||
|
display->setFont(FONT_SMALL);
|
||||||
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
|
|
||||||
|
const int xOffset = 4;
|
||||||
|
const int highlightHeight = FONT_HEIGHT_SMALL - 1;
|
||||||
|
const bool isInverted = (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_INVERTED);
|
||||||
|
const bool isBold = config.display.heading_bold;
|
||||||
|
|
||||||
|
const int screenW = display->getWidth();
|
||||||
|
const int screenH = display->getHeight();
|
||||||
|
|
||||||
|
if (!battery_only) {
|
||||||
|
// === Inverted Header Background ===
|
||||||
|
if (isInverted) {
|
||||||
|
display->setColor(BLACK);
|
||||||
|
display->fillRect(0, 0, screenW, highlightHeight + 2);
|
||||||
|
display->setColor(WHITE);
|
||||||
|
drawRoundedHighlight(display, x, y, screenW, highlightHeight, 2);
|
||||||
|
display->setColor(BLACK);
|
||||||
|
} else {
|
||||||
|
display->setColor(BLACK);
|
||||||
|
display->fillRect(0, 0, screenW, highlightHeight + 2);
|
||||||
|
display->setColor(WHITE);
|
||||||
|
if (isHighResolution) {
|
||||||
|
display->drawLine(0, 20, screenW, 20);
|
||||||
|
} else {
|
||||||
|
display->drawLine(0, 14, screenW, 14);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// === Screen Title ===
|
||||||
|
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
||||||
|
display->drawString(SCREEN_WIDTH / 2, y, titleStr);
|
||||||
|
if (config.display.heading_bold) {
|
||||||
|
display->drawString((SCREEN_WIDTH / 2) + 1, y, titleStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
|
|
||||||
|
// === Battery State ===
|
||||||
|
int chargePercent = powerStatus->getBatteryChargePercent();
|
||||||
|
bool isCharging = powerStatus->getIsCharging();
|
||||||
|
bool usbPowered = powerStatus->getHasUSB();
|
||||||
|
|
||||||
|
if (chargePercent >= 100) {
|
||||||
|
isCharging = false;
|
||||||
|
}
|
||||||
|
if (chargePercent == 101) {
|
||||||
|
usbPowered = true; // Forcing this flag on for the express purpose that some devices have no concept of having a USB cable
|
||||||
|
// plugged in
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t now = millis();
|
||||||
|
|
||||||
|
#ifndef USE_EINK
|
||||||
|
if (isCharging && now - lastBlinkShared > 500) {
|
||||||
|
isBoltVisibleShared = !isBoltVisibleShared;
|
||||||
|
lastBlinkShared = now;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool useHorizontalBattery = (isHighResolution && screenW >= screenH);
|
||||||
|
const int textY = y + (highlightHeight - FONT_HEIGHT_SMALL) / 2;
|
||||||
|
|
||||||
|
int batteryX = 1;
|
||||||
|
int batteryY = HEADER_OFFSET_Y + 1;
|
||||||
|
|
||||||
|
// === Battery Icons ===
|
||||||
|
if (usbPowered && !isCharging) { // This is a basic check to determine USB Powered is flagged but not charging
|
||||||
|
batteryX += 1;
|
||||||
|
batteryY += 2;
|
||||||
|
if (isHighResolution) {
|
||||||
|
display->drawXbm(batteryX, batteryY, 19, 12, imgUSB_HighResolution);
|
||||||
|
batteryX += 20; // Icon + 1 pixel
|
||||||
|
} else {
|
||||||
|
display->drawXbm(batteryX, batteryY, 10, 8, imgUSB);
|
||||||
|
batteryX += 11; // Icon + 1 pixel
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (useHorizontalBattery) {
|
||||||
|
batteryX += 1;
|
||||||
|
batteryY += 2;
|
||||||
|
display->drawXbm(batteryX, batteryY, 9, 13, batteryBitmap_h_bottom);
|
||||||
|
display->drawXbm(batteryX + 9, batteryY, 9, 13, batteryBitmap_h_top);
|
||||||
|
if (isCharging && isBoltVisibleShared)
|
||||||
|
display->drawXbm(batteryX + 4, batteryY, 9, 13, lightning_bolt_h);
|
||||||
|
else {
|
||||||
|
display->drawLine(batteryX + 5, batteryY, batteryX + 10, batteryY);
|
||||||
|
display->drawLine(batteryX + 5, batteryY + 12, batteryX + 10, batteryY + 12);
|
||||||
|
int fillWidth = 14 * chargePercent / 100;
|
||||||
|
display->fillRect(batteryX + 1, batteryY + 1, fillWidth, 11);
|
||||||
|
}
|
||||||
|
batteryX += 18; // Icon + 2 pixels
|
||||||
|
} else {
|
||||||
|
#ifdef USE_EINK
|
||||||
|
batteryY += 2;
|
||||||
|
#endif
|
||||||
|
display->drawXbm(batteryX, batteryY, 7, 11, batteryBitmap_v);
|
||||||
|
if (isCharging && isBoltVisibleShared)
|
||||||
|
display->drawXbm(batteryX + 1, batteryY + 3, 5, 5, lightning_bolt_v);
|
||||||
|
else {
|
||||||
|
display->drawXbm(batteryX - 1, batteryY + 4, 8, 3, batteryBitmap_sidegaps_v);
|
||||||
|
int fillHeight = 8 * chargePercent / 100;
|
||||||
|
int fillY = batteryY - fillHeight;
|
||||||
|
display->fillRect(batteryX + 1, fillY + 10, 5, fillHeight);
|
||||||
|
}
|
||||||
|
batteryX += 9; // Icon + 2 pixels
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chargePercent != 101) {
|
||||||
|
// === Battery % Display ===
|
||||||
|
char chargeStr[4];
|
||||||
|
snprintf(chargeStr, sizeof(chargeStr), "%d", chargePercent);
|
||||||
|
int chargeNumWidth = display->getStringWidth(chargeStr);
|
||||||
|
display->drawString(batteryX, textY, chargeStr);
|
||||||
|
display->drawString(batteryX + chargeNumWidth - 1, textY, "%");
|
||||||
|
if (isBold) {
|
||||||
|
display->drawString(batteryX + 1, textY, chargeStr);
|
||||||
|
display->drawString(batteryX + chargeNumWidth, textY, "%");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// === Time and Right-aligned Icons ===
|
||||||
|
uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice, true);
|
||||||
|
char timeStr[10] = "--:--"; // Fallback display
|
||||||
|
int timeStrWidth = display->getStringWidth("12:34"); // Default alignment
|
||||||
|
int timeX = screenW - xOffset - timeStrWidth + 4;
|
||||||
|
|
||||||
|
if (rtc_sec > 0 && !battery_only) {
|
||||||
|
// === Build Time String ===
|
||||||
|
long hms = (rtc_sec % SEC_PER_DAY + SEC_PER_DAY) % SEC_PER_DAY;
|
||||||
|
int hour = hms / SEC_PER_HOUR;
|
||||||
|
int minute = (hms % SEC_PER_HOUR) / SEC_PER_MIN;
|
||||||
|
snprintf(timeStr, sizeof(timeStr), "%d:%02d", hour, minute);
|
||||||
|
|
||||||
|
if (config.display.use_12h_clock) {
|
||||||
|
bool isPM = hour >= 12;
|
||||||
|
hour %= 12;
|
||||||
|
if (hour == 0)
|
||||||
|
hour = 12;
|
||||||
|
snprintf(timeStr, sizeof(timeStr), "%d:%02d%s", hour, minute, isPM ? "p" : "a");
|
||||||
|
}
|
||||||
|
|
||||||
|
timeStrWidth = display->getStringWidth(timeStr);
|
||||||
|
timeX = screenW - xOffset - timeStrWidth + 3;
|
||||||
|
|
||||||
|
// === Show Mail or Mute Icon to the Left of Time ===
|
||||||
|
int iconRightEdge = timeX - 2;
|
||||||
|
|
||||||
|
bool showMail = false;
|
||||||
|
|
||||||
|
#ifndef USE_EINK
|
||||||
|
if (hasUnreadMessage) {
|
||||||
|
if (now - lastMailBlink > 500) {
|
||||||
|
isMailIconVisible = !isMailIconVisible;
|
||||||
|
lastMailBlink = now;
|
||||||
|
}
|
||||||
|
showMail = isMailIconVisible;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (hasUnreadMessage) {
|
||||||
|
showMail = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (showMail) {
|
||||||
|
if (useHorizontalBattery) {
|
||||||
|
int iconW = 16, iconH = 12;
|
||||||
|
int iconX = iconRightEdge - iconW;
|
||||||
|
int iconY = textY + (FONT_HEIGHT_SMALL - iconH) / 2 - 1;
|
||||||
|
if (isInverted) {
|
||||||
|
display->setColor(WHITE);
|
||||||
|
display->fillRect(iconX - 1, iconY - 1, iconW + 3, iconH + 2);
|
||||||
|
display->setColor(BLACK);
|
||||||
|
} else {
|
||||||
|
display->setColor(BLACK);
|
||||||
|
display->fillRect(iconX - 1, iconY - 1, iconW + 3, iconH + 2);
|
||||||
|
display->setColor(WHITE);
|
||||||
|
}
|
||||||
|
display->drawRect(iconX, iconY, iconW + 1, iconH);
|
||||||
|
display->drawLine(iconX, iconY, iconX + iconW / 2, iconY + iconH - 4);
|
||||||
|
display->drawLine(iconX + iconW, iconY, iconX + iconW / 2, iconY + iconH - 4);
|
||||||
|
} else {
|
||||||
|
int iconX = iconRightEdge - (mail_width - 2);
|
||||||
|
int iconY = textY + (FONT_HEIGHT_SMALL - mail_height) / 2;
|
||||||
|
if (isInverted) {
|
||||||
|
display->setColor(WHITE);
|
||||||
|
display->fillRect(iconX - 1, iconY - 1, mail_width + 2, mail_height + 2);
|
||||||
|
display->setColor(BLACK);
|
||||||
|
} else {
|
||||||
|
display->setColor(BLACK);
|
||||||
|
display->fillRect(iconX - 1, iconY - 1, mail_width + 2, mail_height + 2);
|
||||||
|
display->setColor(WHITE);
|
||||||
|
}
|
||||||
|
display->drawXbm(iconX, iconY, mail_width, mail_height, mail);
|
||||||
|
}
|
||||||
|
} else if (isMuted) {
|
||||||
|
if (isHighResolution) {
|
||||||
|
int iconX = iconRightEdge - mute_symbol_big_width;
|
||||||
|
int iconY = textY + (FONT_HEIGHT_SMALL - mute_symbol_big_height) / 2;
|
||||||
|
|
||||||
|
if (isInverted) {
|
||||||
|
display->setColor(WHITE);
|
||||||
|
display->fillRect(iconX - 1, iconY - 1, mute_symbol_big_width + 2, mute_symbol_big_height + 2);
|
||||||
|
display->setColor(BLACK);
|
||||||
|
} else {
|
||||||
|
display->setColor(BLACK);
|
||||||
|
display->fillRect(iconX - 1, iconY - 1, mute_symbol_big_width + 2, mute_symbol_big_height + 2);
|
||||||
|
display->setColor(WHITE);
|
||||||
|
}
|
||||||
|
display->drawXbm(iconX, iconY, mute_symbol_big_width, mute_symbol_big_height, mute_symbol_big);
|
||||||
|
} else {
|
||||||
|
int iconX = iconRightEdge - mute_symbol_width;
|
||||||
|
int iconY = textY + (FONT_HEIGHT_SMALL - mail_height) / 2;
|
||||||
|
|
||||||
|
if (isInverted) {
|
||||||
|
display->setColor(WHITE);
|
||||||
|
display->fillRect(iconX - 1, iconY - 1, mute_symbol_width + 2, mute_symbol_height + 2);
|
||||||
|
display->setColor(BLACK);
|
||||||
|
} else {
|
||||||
|
display->setColor(BLACK);
|
||||||
|
display->fillRect(iconX - 1, iconY - 1, mute_symbol_width + 2, mute_symbol_height + 2);
|
||||||
|
display->setColor(WHITE);
|
||||||
|
}
|
||||||
|
display->drawXbm(iconX, iconY, mute_symbol_width, mute_symbol_height, mute_symbol);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// === Draw Time ===
|
||||||
|
display->drawString(timeX, textY, timeStr);
|
||||||
|
if (isBold)
|
||||||
|
display->drawString(timeX - 1, textY, timeStr);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// === No Time Available: Mail/Mute Icon Moves to Far Right ===
|
||||||
|
int iconRightEdge = screenW - xOffset;
|
||||||
|
|
||||||
|
bool showMail = false;
|
||||||
|
|
||||||
|
#ifndef USE_EINK
|
||||||
|
if (hasUnreadMessage) {
|
||||||
|
if (now - lastMailBlink > 500) {
|
||||||
|
isMailIconVisible = !isMailIconVisible;
|
||||||
|
lastMailBlink = now;
|
||||||
|
}
|
||||||
|
showMail = isMailIconVisible;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (hasUnreadMessage) {
|
||||||
|
showMail = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (showMail) {
|
||||||
|
if (useHorizontalBattery) {
|
||||||
|
int iconW = 16, iconH = 12;
|
||||||
|
int iconX = iconRightEdge - iconW;
|
||||||
|
int iconY = textY + (FONT_HEIGHT_SMALL - iconH) / 2 - 1;
|
||||||
|
display->drawRect(iconX, iconY, iconW + 1, iconH);
|
||||||
|
display->drawLine(iconX, iconY, iconX + iconW / 2, iconY + iconH - 4);
|
||||||
|
display->drawLine(iconX + iconW, iconY, iconX + iconW / 2, iconY + iconH - 4);
|
||||||
|
} else {
|
||||||
|
int iconX = iconRightEdge - mail_width;
|
||||||
|
int iconY = textY + (FONT_HEIGHT_SMALL - mail_height) / 2;
|
||||||
|
display->drawXbm(iconX, iconY, mail_width, mail_height, mail);
|
||||||
|
}
|
||||||
|
} else if (isMuted) {
|
||||||
|
if (isHighResolution) {
|
||||||
|
int iconX = iconRightEdge - mute_symbol_big_width;
|
||||||
|
int iconY = textY + (FONT_HEIGHT_SMALL - mute_symbol_big_height) / 2;
|
||||||
|
display->drawXbm(iconX, iconY, mute_symbol_big_width, mute_symbol_big_height, mute_symbol_big);
|
||||||
|
} else {
|
||||||
|
int iconX = iconRightEdge - mute_symbol_width;
|
||||||
|
int iconY = textY + (FONT_HEIGHT_SMALL - mail_height) / 2;
|
||||||
|
display->drawXbm(iconX, iconY, mute_symbol_width, mute_symbol_height, mute_symbol);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
display->setColor(WHITE); // Reset for other UI
|
||||||
|
}
|
||||||
|
|
||||||
|
const int *getTextPositions(OLEDDisplay *display)
|
||||||
|
{
|
||||||
|
static int textPositions[7]; // Static array that persists beyond function scope
|
||||||
|
|
||||||
|
if (isHighResolution) {
|
||||||
|
textPositions[0] = textZeroLine;
|
||||||
|
textPositions[1] = textFirstLine_medium;
|
||||||
|
textPositions[2] = textSecondLine_medium;
|
||||||
|
textPositions[3] = textThirdLine_medium;
|
||||||
|
textPositions[4] = textFourthLine_medium;
|
||||||
|
textPositions[5] = textFifthLine_medium;
|
||||||
|
textPositions[6] = textSixthLine_medium;
|
||||||
|
} else {
|
||||||
|
textPositions[0] = textZeroLine;
|
||||||
|
textPositions[1] = textFirstLine;
|
||||||
|
textPositions[2] = textSecondLine;
|
||||||
|
textPositions[3] = textThirdLine;
|
||||||
|
textPositions[4] = textFourthLine;
|
||||||
|
textPositions[5] = textFifthLine;
|
||||||
|
textPositions[6] = textSixthLine;
|
||||||
|
}
|
||||||
|
return textPositions;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isAllowedPunctuation(char c)
|
||||||
|
{
|
||||||
|
const std::string allowed = ".,!?;:-_()[]{}'\"@#$/\\&+=%~^ ";
|
||||||
|
return allowed.find(c) != std::string::npos;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string sanitizeString(const std::string &input)
|
||||||
|
{
|
||||||
|
std::string output;
|
||||||
|
bool inReplacement = false;
|
||||||
|
|
||||||
|
for (char c : input) {
|
||||||
|
if (std::isalnum(static_cast<unsigned char>(c)) || isAllowedPunctuation(c)) {
|
||||||
|
output += c;
|
||||||
|
inReplacement = false;
|
||||||
|
} else {
|
||||||
|
if (!inReplacement) {
|
||||||
|
output += 0xbf; // ISO-8859-1 for inverted question mark
|
||||||
|
inReplacement = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace graphics
|
||||||
60
src/graphics/SharedUIDisplay.h
Normal file
60
src/graphics/SharedUIDisplay.h
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <OLEDDisplay.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace graphics
|
||||||
|
{
|
||||||
|
|
||||||
|
// =======================
|
||||||
|
// Shared UI Helpers
|
||||||
|
// =======================
|
||||||
|
|
||||||
|
#define textZeroLine 0
|
||||||
|
// Consistent Line Spacing - this is standard for all display and the fall-back spacing
|
||||||
|
#define textFirstLine (FONT_HEIGHT_SMALL - 1)
|
||||||
|
#define textSecondLine (textFirstLine + (FONT_HEIGHT_SMALL - 5))
|
||||||
|
#define textThirdLine (textSecondLine + (FONT_HEIGHT_SMALL - 5))
|
||||||
|
#define textFourthLine (textThirdLine + (FONT_HEIGHT_SMALL - 5))
|
||||||
|
#define textFifthLine (textFourthLine + (FONT_HEIGHT_SMALL - 5))
|
||||||
|
#define textSixthLine (textFifthLine + (FONT_HEIGHT_SMALL - 5))
|
||||||
|
|
||||||
|
// Consistent Line Spacing for devices like T114 and TEcho/ThinkNode M1 of devices
|
||||||
|
#define textFirstLine_medium (FONT_HEIGHT_SMALL + 1)
|
||||||
|
#define textSecondLine_medium (textFirstLine_medium + FONT_HEIGHT_SMALL)
|
||||||
|
#define textThirdLine_medium (textSecondLine_medium + FONT_HEIGHT_SMALL)
|
||||||
|
#define textFourthLine_medium (textThirdLine_medium + FONT_HEIGHT_SMALL)
|
||||||
|
#define textFifthLine_medium (textFourthLine_medium + FONT_HEIGHT_SMALL)
|
||||||
|
#define textSixthLine_medium (textFifthLine_medium + FONT_HEIGHT_SMALL)
|
||||||
|
|
||||||
|
// Consistent Line Spacing for devices like VisionMaster T190
|
||||||
|
#define textFirstLine_large (FONT_HEIGHT_SMALL + 1)
|
||||||
|
#define textSecondLine_large (textFirstLine_large + (FONT_HEIGHT_SMALL + 5))
|
||||||
|
#define textThirdLine_large (textSecondLine_large + (FONT_HEIGHT_SMALL + 5))
|
||||||
|
#define textFourthLine_large (textThirdLine_large + (FONT_HEIGHT_SMALL + 5))
|
||||||
|
#define textFifthLine_large (textFourthLine_large + (FONT_HEIGHT_SMALL + 5))
|
||||||
|
#define textSixthLine_large (textFifthLine_large + (FONT_HEIGHT_SMALL + 5))
|
||||||
|
|
||||||
|
// Quick screen access
|
||||||
|
#define SCREEN_WIDTH display->getWidth()
|
||||||
|
#define SCREEN_HEIGHT display->getHeight()
|
||||||
|
|
||||||
|
// Shared state (declare inside namespace)
|
||||||
|
extern bool hasUnreadMessage;
|
||||||
|
extern bool isMuted;
|
||||||
|
extern bool isHighResolution;
|
||||||
|
void determineResolution(int16_t screenheight, int16_t screenwidth);
|
||||||
|
|
||||||
|
// Rounded highlight (used for inverted headers)
|
||||||
|
void drawRoundedHighlight(OLEDDisplay *display, int16_t x, int16_t y, int16_t w, int16_t h, int16_t r);
|
||||||
|
|
||||||
|
// Shared battery/time/mail header
|
||||||
|
void drawCommonHeader(OLEDDisplay *display, int16_t x, int16_t y, const char *titleStr = "", bool battery_only = false);
|
||||||
|
|
||||||
|
const int *getTextPositions(OLEDDisplay *display);
|
||||||
|
|
||||||
|
bool isAllowedPunctuation(char c);
|
||||||
|
|
||||||
|
std::string sanitizeString(const std::string &input);
|
||||||
|
|
||||||
|
} // namespace graphics
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
#if ARCH_PORTDUINO
|
#if ARCH_PORTDUINO
|
||||||
#include "platform/portduino/PortduinoGlue.h"
|
#include "platform/portduino/PortduinoGlue.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -14,8 +15,10 @@
|
|||||||
extern SX1509 gpioExtender;
|
extern SX1509 gpioExtender;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TFT_MESH
|
#ifdef TFT_MESH_OVERRIDE
|
||||||
#define TFT_MESH COLOR565(0x67, 0xEA, 0x94)
|
uint16_t TFT_MESH = TFT_MESH_OVERRIDE;
|
||||||
|
#else
|
||||||
|
uint16_t TFT_MESH = COLOR565(0x67, 0xEA, 0x94);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ST7735S)
|
#if defined(ST7735S)
|
||||||
@@ -467,18 +470,27 @@ class LGFX : public lgfx::LGFX_Device
|
|||||||
|
|
||||||
// The following setting values are general initial values for each panel, so please comment out any
|
// The following setting values are general initial values for each panel, so please comment out any
|
||||||
// unknown items and try them.
|
// unknown items and try them.
|
||||||
|
#if defined(T_WATCH_S3)
|
||||||
cfg.memory_width = TFT_WIDTH; // Maximum width supported by the driver IC
|
cfg.panel_width = 240;
|
||||||
cfg.memory_height = TFT_HEIGHT; // Maximum height supported by the driver IC
|
cfg.panel_height = 240;
|
||||||
cfg.panel_width = TFT_WIDTH; // actual displayable width
|
cfg.memory_width = 240;
|
||||||
cfg.panel_height = TFT_HEIGHT; // actual displayable height
|
cfg.memory_height = 320;
|
||||||
cfg.offset_x = TFT_OFFSET_X; // Panel offset amount in X direction
|
cfg.offset_x = 0;
|
||||||
cfg.offset_y = TFT_OFFSET_Y; // Panel offset amount in Y direction
|
cfg.offset_y = 0; // No vertical shift needed — panel is top-aligned
|
||||||
cfg.offset_rotation = TFT_OFFSET_ROTATION; // Rotation direction value offset 0~7 (4~7 is mirrored)
|
cfg.offset_rotation = 2; // Rotate 180° to correct upside-down layout
|
||||||
|
#else
|
||||||
|
cfg.memory_width = TFT_WIDTH; // Maximum width supported by the driver IC
|
||||||
|
cfg.memory_height = TFT_HEIGHT; // Maximum height supported by the driver IC
|
||||||
|
cfg.panel_width = TFT_WIDTH; // actual displayable width
|
||||||
|
cfg.panel_height = TFT_HEIGHT; // actual displayable height
|
||||||
|
cfg.offset_x = TFT_OFFSET_X; // Panel offset amount in X direction
|
||||||
|
cfg.offset_y = TFT_OFFSET_Y; // Panel offset amount in Y direction
|
||||||
|
cfg.offset_rotation = TFT_OFFSET_ROTATION; // Rotation direction value offset 0~7 (4~7 is mirrored)
|
||||||
|
#endif
|
||||||
#ifdef TFT_DUMMY_READ_PIXELS
|
#ifdef TFT_DUMMY_READ_PIXELS
|
||||||
cfg.dummy_read_pixel = TFT_DUMMY_READ_PIXELS; // Number of bits for dummy read before pixel readout
|
cfg.dummy_read_pixel = TFT_DUMMY_READ_PIXELS; // Number of bits for dummy read before pixel readout
|
||||||
#else
|
#else
|
||||||
cfg.dummy_read_pixel = 9; // Number of bits for dummy read before pixel readout
|
cfg.dummy_read_pixel = 9; // Number of bits for dummy read before pixel readout
|
||||||
#endif
|
#endif
|
||||||
cfg.dummy_read_bits = 1; // Number of bits for dummy read before non-pixel data read
|
cfg.dummy_read_bits = 1; // Number of bits for dummy read before non-pixel data read
|
||||||
cfg.readable = true; // Set to true if data can be read
|
cfg.readable = true; // Set to true if data can be read
|
||||||
@@ -653,7 +665,7 @@ static LGFX *tft = nullptr;
|
|||||||
#include <TFT_eSPI.h> // Graphics and font library for ILI9342 driver chip
|
#include <TFT_eSPI.h> // Graphics and font library for ILI9342 driver chip
|
||||||
|
|
||||||
static TFT_eSPI *tft = nullptr; // Invoke library, pins defined in User_Setup.h
|
static TFT_eSPI *tft = nullptr; // Invoke library, pins defined in User_Setup.h
|
||||||
#elif ARCH_PORTDUINO && HAS_SCREEN != 0 && !HAS_TFT
|
#elif ARCH_PORTDUINO
|
||||||
#include <LovyanGFX.hpp> // Graphics and font library for ST7735 driver chip
|
#include <LovyanGFX.hpp> // Graphics and font library for ST7735 driver chip
|
||||||
|
|
||||||
class LGFX : public lgfx::LGFX_Device
|
class LGFX : public lgfx::LGFX_Device
|
||||||
@@ -697,11 +709,16 @@ class LGFX : public lgfx::LGFX_Device
|
|||||||
_panel_instance->setBus(&_bus_instance); // set the bus on the panel.
|
_panel_instance->setBus(&_bus_instance); // set the bus on the panel.
|
||||||
|
|
||||||
auto cfg = _panel_instance->config(); // Gets a structure for display panel settings.
|
auto cfg = _panel_instance->config(); // Gets a structure for display panel settings.
|
||||||
LOG_DEBUG("Height: %d, Width: %d ", settingsMap[displayHeight], settingsMap[displayWidth]);
|
LOG_DEBUG("Width: %d, Height: %d", settingsMap[displayWidth], settingsMap[displayHeight]);
|
||||||
cfg.pin_cs = settingsMap[displayCS]; // Pin number where CS is connected (-1 = disable)
|
cfg.pin_cs = settingsMap[displayCS]; // Pin number where CS is connected (-1 = disable)
|
||||||
cfg.pin_rst = settingsMap[displayReset];
|
cfg.pin_rst = settingsMap[displayReset];
|
||||||
cfg.panel_width = settingsMap[displayWidth]; // actual displayable width
|
if (settingsMap[displayRotate]) {
|
||||||
cfg.panel_height = settingsMap[displayHeight]; // actual displayable height
|
cfg.panel_width = settingsMap[displayHeight]; // actual displayable width
|
||||||
|
cfg.panel_height = settingsMap[displayWidth]; // actual displayable height
|
||||||
|
} else {
|
||||||
|
cfg.panel_width = settingsMap[displayWidth]; // actual displayable width
|
||||||
|
cfg.panel_height = settingsMap[displayHeight]; // actual displayable height
|
||||||
|
}
|
||||||
cfg.offset_x = settingsMap[displayOffsetX]; // Panel offset amount in X direction
|
cfg.offset_x = settingsMap[displayOffsetX]; // Panel offset amount in X direction
|
||||||
cfg.offset_y = settingsMap[displayOffsetY]; // Panel offset amount in Y direction
|
cfg.offset_y = settingsMap[displayOffsetY]; // Panel offset amount in Y direction
|
||||||
cfg.offset_rotation = settingsMap[displayOffsetRotate]; // Rotation direction value offset 0~7 (4~7 is mirrored)
|
cfg.offset_rotation = settingsMap[displayOffsetRotate]; // Rotation direction value offset 0~7 (4~7 is mirrored)
|
||||||
@@ -978,9 +995,9 @@ TFTDisplay::TFTDisplay(uint8_t address, int sda, int scl, OLEDDISPLAY_GEOMETRY g
|
|||||||
|
|
||||||
#if ARCH_PORTDUINO
|
#if ARCH_PORTDUINO
|
||||||
if (settingsMap[displayRotate]) {
|
if (settingsMap[displayRotate]) {
|
||||||
setGeometry(GEOMETRY_RAWMODE, settingsMap[configNames::displayHeight], settingsMap[configNames::displayWidth]);
|
|
||||||
} else {
|
|
||||||
setGeometry(GEOMETRY_RAWMODE, settingsMap[configNames::displayWidth], settingsMap[configNames::displayHeight]);
|
setGeometry(GEOMETRY_RAWMODE, settingsMap[configNames::displayWidth], settingsMap[configNames::displayHeight]);
|
||||||
|
} else {
|
||||||
|
setGeometry(GEOMETRY_RAWMODE, settingsMap[configNames::displayHeight], settingsMap[configNames::displayWidth]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(SCREEN_ROTATE)
|
#elif defined(SCREEN_ROTATE)
|
||||||
@@ -1169,6 +1186,8 @@ bool TFTDisplay::connect()
|
|||||||
tft->setRotation(1); // T-Deck has the TFT in landscape
|
tft->setRotation(1); // T-Deck has the TFT in landscape
|
||||||
#elif defined(T_WATCH_S3) || defined(SENSECAP_INDICATOR)
|
#elif defined(T_WATCH_S3) || defined(SENSECAP_INDICATOR)
|
||||||
tft->setRotation(2); // T-Watch S3 left-handed orientation
|
tft->setRotation(2); // T-Watch S3 left-handed orientation
|
||||||
|
#elif ARCH_PORTDUINO
|
||||||
|
tft->setRotation(0); // use config.yaml to set rotation
|
||||||
#else
|
#else
|
||||||
tft->setRotation(3); // Orient horizontal and wide underneath the silkscreen name label
|
tft->setRotation(3); // Orient horizontal and wide underneath the silkscreen name label
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
103
src/graphics/TimeFormatters.cpp
Normal file
103
src/graphics/TimeFormatters.cpp
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
#include "TimeFormatters.h"
|
||||||
|
#include "configuration.h"
|
||||||
|
#include "gps/RTC.h"
|
||||||
|
#include "mesh/NodeDB.h"
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
bool deltaToTimestamp(uint32_t secondsAgo, uint8_t *hours, uint8_t *minutes, int32_t *daysAgo)
|
||||||
|
{
|
||||||
|
// Cache the result - avoid frequent recalculation
|
||||||
|
static uint8_t hoursCached = 0, minutesCached = 0;
|
||||||
|
static uint32_t daysAgoCached = 0;
|
||||||
|
static uint32_t secondsAgoCached = 0;
|
||||||
|
static bool validCached = false;
|
||||||
|
|
||||||
|
// Abort: if timezone not set
|
||||||
|
if (strlen(config.device.tzdef) == 0) {
|
||||||
|
validCached = false;
|
||||||
|
return validCached;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Abort: if invalid pointers passed
|
||||||
|
if (hours == nullptr || minutes == nullptr || daysAgo == nullptr) {
|
||||||
|
validCached = false;
|
||||||
|
return validCached;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Abort: if time seems invalid.. (> 6 months ago, probably seen before RTC set)
|
||||||
|
if (secondsAgo > SEC_PER_DAY * 30UL * 6) {
|
||||||
|
validCached = false;
|
||||||
|
return validCached;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If repeated request, don't bother recalculating
|
||||||
|
if (secondsAgo - secondsAgoCached < 60 && secondsAgoCached != 0) {
|
||||||
|
if (validCached) {
|
||||||
|
*hours = hoursCached;
|
||||||
|
*minutes = minutesCached;
|
||||||
|
*daysAgo = daysAgoCached;
|
||||||
|
}
|
||||||
|
return validCached;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get local time
|
||||||
|
uint32_t secondsRTC = getValidTime(RTCQuality::RTCQualityDevice, true); // Get local time
|
||||||
|
|
||||||
|
// Abort: if RTC not set
|
||||||
|
if (!secondsRTC) {
|
||||||
|
validCached = false;
|
||||||
|
return validCached;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get absolute time when last seen
|
||||||
|
uint32_t secondsSeenAt = secondsRTC - secondsAgo;
|
||||||
|
|
||||||
|
// Calculate daysAgo
|
||||||
|
*daysAgo = (secondsRTC / SEC_PER_DAY) - (secondsSeenAt / SEC_PER_DAY); // How many "midnights" have passed
|
||||||
|
|
||||||
|
// Get seconds since midnight
|
||||||
|
uint32_t hms = (secondsRTC - secondsAgo) % SEC_PER_DAY;
|
||||||
|
hms = (hms + SEC_PER_DAY) % SEC_PER_DAY;
|
||||||
|
|
||||||
|
// Tear apart hms into hours and minutes
|
||||||
|
*hours = hms / SEC_PER_HOUR;
|
||||||
|
*minutes = (hms % SEC_PER_HOUR) / SEC_PER_MIN;
|
||||||
|
|
||||||
|
// Cache the result
|
||||||
|
daysAgoCached = *daysAgo;
|
||||||
|
hoursCached = *hours;
|
||||||
|
minutesCached = *minutes;
|
||||||
|
secondsAgoCached = secondsAgo;
|
||||||
|
|
||||||
|
validCached = true;
|
||||||
|
return validCached;
|
||||||
|
}
|
||||||
|
|
||||||
|
void getTimeAgoStr(uint32_t agoSecs, char *timeStr, uint8_t maxLength)
|
||||||
|
{
|
||||||
|
// Use an absolute timestamp in some cases.
|
||||||
|
// Particularly useful with E-Ink displays. Static UI, fewer refreshes.
|
||||||
|
uint8_t timestampHours, timestampMinutes;
|
||||||
|
int32_t daysAgo;
|
||||||
|
bool useTimestamp = deltaToTimestamp(agoSecs, ×tampHours, ×tampMinutes, &daysAgo);
|
||||||
|
|
||||||
|
if (agoSecs < 120) // last 2 mins?
|
||||||
|
snprintf(timeStr, maxLength, "%u seconds ago", agoSecs);
|
||||||
|
// -- if suitable for timestamp --
|
||||||
|
else if (useTimestamp && agoSecs < 15 * SECONDS_IN_MINUTE) // Last 15 minutes
|
||||||
|
snprintf(timeStr, maxLength, "%u minutes ago", agoSecs / SECONDS_IN_MINUTE);
|
||||||
|
else if (useTimestamp && daysAgo == 0) // Today
|
||||||
|
snprintf(timeStr, maxLength, "Last seen: %02u:%02u", (unsigned int)timestampHours, (unsigned int)timestampMinutes);
|
||||||
|
else if (useTimestamp && daysAgo == 1) // Yesterday
|
||||||
|
snprintf(timeStr, maxLength, "Seen yesterday");
|
||||||
|
else if (useTimestamp && daysAgo > 1) // Last six months (capped by deltaToTimestamp method)
|
||||||
|
snprintf(timeStr, maxLength, "%li days ago", (long)daysAgo);
|
||||||
|
// -- if using time delta instead --
|
||||||
|
else if (agoSecs < 120 * 60) // last 2 hrs
|
||||||
|
snprintf(timeStr, maxLength, "%u minutes ago", agoSecs / 60);
|
||||||
|
// Only show hours ago if it's been less than 6 months. Otherwise, we may have bad data.
|
||||||
|
else if ((agoSecs / 60 / 60) < (730 * 6))
|
||||||
|
snprintf(timeStr, maxLength, "%u hours ago", agoSecs / 60 / 60);
|
||||||
|
else
|
||||||
|
snprintf(timeStr, maxLength, "unknown age");
|
||||||
|
}
|
||||||
26
src/graphics/TimeFormatters.h
Normal file
26
src/graphics/TimeFormatters.h
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "configuration.h"
|
||||||
|
#include "gps/RTC.h"
|
||||||
|
#include <airtime.h>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a delta in seconds ago to timestamp information (hours, minutes, days ago).
|
||||||
|
*
|
||||||
|
* @param secondsAgo Number of seconds ago to convert
|
||||||
|
* @param hours Pointer to store the hours (0-23)
|
||||||
|
* @param minutes Pointer to store the minutes (0-59)
|
||||||
|
* @param daysAgo Pointer to store the number of days ago
|
||||||
|
* @return true if conversion was successful, false if invalid input or time not available
|
||||||
|
*/
|
||||||
|
bool deltaToTimestamp(uint32_t secondsAgo, uint8_t *hours, uint8_t *minutes, int32_t *daysAgo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a human-readable string representing the time ago in a format like "2 days, 3 hours, 15 minutes".
|
||||||
|
*
|
||||||
|
* @param agoSecs Number of seconds ago to convert
|
||||||
|
* @param timeStr Pointer to store the resulting string
|
||||||
|
* @param maxLength Maximum length of the resulting string buffer
|
||||||
|
*/
|
||||||
|
void getTimeAgoStr(uint32_t agoSecs, char *timeStr, uint8_t maxLength);
|
||||||
520
src/graphics/draw/ClockRenderer.cpp
Normal file
520
src/graphics/draw/ClockRenderer.cpp
Normal file
@@ -0,0 +1,520 @@
|
|||||||
|
#include "configuration.h"
|
||||||
|
#if HAS_SCREEN
|
||||||
|
#include "ClockRenderer.h"
|
||||||
|
#include "NodeDB.h"
|
||||||
|
#include "UIRenderer.h"
|
||||||
|
#include "configuration.h"
|
||||||
|
#include "gps/GeoCoord.h"
|
||||||
|
#include "gps/RTC.h"
|
||||||
|
#include "graphics/ScreenFonts.h"
|
||||||
|
#include "graphics/SharedUIDisplay.h"
|
||||||
|
#include "graphics/emotes.h"
|
||||||
|
#include "graphics/images.h"
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
#if !MESHTASTIC_EXCLUDE_BLUETOOTH
|
||||||
|
#include "nimble/NimbleBluetooth.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace graphics
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace ClockRenderer
|
||||||
|
{
|
||||||
|
|
||||||
|
void drawSegmentedDisplayColon(OLEDDisplay *display, int x, int y, float scale)
|
||||||
|
{
|
||||||
|
uint16_t segmentWidth = SEGMENT_WIDTH * scale;
|
||||||
|
uint16_t segmentHeight = SEGMENT_HEIGHT * scale;
|
||||||
|
|
||||||
|
uint16_t cellHeight = (segmentWidth * 2) + (segmentHeight * 3) + 8;
|
||||||
|
|
||||||
|
uint16_t topAndBottomX = x + (4 * scale);
|
||||||
|
|
||||||
|
uint16_t quarterCellHeight = cellHeight / 4;
|
||||||
|
|
||||||
|
uint16_t topY = y + quarterCellHeight;
|
||||||
|
uint16_t bottomY = y + (quarterCellHeight * 3);
|
||||||
|
|
||||||
|
display->fillRect(topAndBottomX, topY, segmentHeight, segmentHeight);
|
||||||
|
display->fillRect(topAndBottomX, bottomY, segmentHeight, segmentHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawSegmentedDisplayCharacter(OLEDDisplay *display, int x, int y, uint8_t number, float scale)
|
||||||
|
{
|
||||||
|
// the numbers 0-9, each expressed as an array of seven boolean (0|1) values encoding the on/off state of
|
||||||
|
// segment {innerIndex + 1}
|
||||||
|
// e.g., to display the numeral '0', segments 1-6 are on, and segment 7 is off.
|
||||||
|
uint8_t numbers[10][7] = {
|
||||||
|
{1, 1, 1, 1, 1, 1, 0}, // 0 Display segment key
|
||||||
|
{0, 1, 1, 0, 0, 0, 0}, // 1 1
|
||||||
|
{1, 1, 0, 1, 1, 0, 1}, // 2 ___
|
||||||
|
{1, 1, 1, 1, 0, 0, 1}, // 3 6 | | 2
|
||||||
|
{0, 1, 1, 0, 0, 1, 1}, // 4 |_7̲_|
|
||||||
|
{1, 0, 1, 1, 0, 1, 1}, // 5 5 | | 3
|
||||||
|
{1, 0, 1, 1, 1, 1, 1}, // 6 |___|
|
||||||
|
{1, 1, 1, 0, 0, 1, 0}, // 7
|
||||||
|
{1, 1, 1, 1, 1, 1, 1}, // 8 4
|
||||||
|
{1, 1, 1, 1, 0, 1, 1}, // 9
|
||||||
|
};
|
||||||
|
|
||||||
|
// the width and height of each segment's central rectangle:
|
||||||
|
// _____________________
|
||||||
|
// ⋰| (only this part, |⋱
|
||||||
|
// ⋰ | not including | ⋱
|
||||||
|
// ⋱ | the triangles | ⋰
|
||||||
|
// ⋱| on the ends) |⋰
|
||||||
|
// ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
uint16_t segmentWidth = SEGMENT_WIDTH * scale;
|
||||||
|
uint16_t segmentHeight = SEGMENT_HEIGHT * scale;
|
||||||
|
|
||||||
|
// segment x and y coordinates
|
||||||
|
uint16_t segmentOneX = x + segmentHeight + 2;
|
||||||
|
uint16_t segmentOneY = y;
|
||||||
|
|
||||||
|
uint16_t segmentTwoX = segmentOneX + segmentWidth + 2;
|
||||||
|
uint16_t segmentTwoY = segmentOneY + segmentHeight + 2;
|
||||||
|
|
||||||
|
uint16_t segmentThreeX = segmentTwoX;
|
||||||
|
uint16_t segmentThreeY = segmentTwoY + segmentWidth + 2 + segmentHeight + 2;
|
||||||
|
|
||||||
|
uint16_t segmentFourX = segmentOneX;
|
||||||
|
uint16_t segmentFourY = segmentThreeY + segmentWidth + 2;
|
||||||
|
|
||||||
|
uint16_t segmentFiveX = x;
|
||||||
|
uint16_t segmentFiveY = segmentThreeY;
|
||||||
|
|
||||||
|
uint16_t segmentSixX = x;
|
||||||
|
uint16_t segmentSixY = segmentTwoY;
|
||||||
|
|
||||||
|
uint16_t segmentSevenX = segmentOneX;
|
||||||
|
uint16_t segmentSevenY = segmentTwoY + segmentWidth + 2;
|
||||||
|
|
||||||
|
if (numbers[number][0]) {
|
||||||
|
graphics::ClockRenderer::drawHorizontalSegment(display, segmentOneX, segmentOneY, segmentWidth, segmentHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (numbers[number][1]) {
|
||||||
|
graphics::ClockRenderer::drawVerticalSegment(display, segmentTwoX, segmentTwoY, segmentWidth, segmentHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (numbers[number][2]) {
|
||||||
|
graphics::ClockRenderer::drawVerticalSegment(display, segmentThreeX, segmentThreeY, segmentWidth, segmentHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (numbers[number][3]) {
|
||||||
|
graphics::ClockRenderer::drawHorizontalSegment(display, segmentFourX, segmentFourY, segmentWidth, segmentHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (numbers[number][4]) {
|
||||||
|
graphics::ClockRenderer::drawVerticalSegment(display, segmentFiveX, segmentFiveY, segmentWidth, segmentHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (numbers[number][5]) {
|
||||||
|
graphics::ClockRenderer::drawVerticalSegment(display, segmentSixX, segmentSixY, segmentWidth, segmentHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (numbers[number][6]) {
|
||||||
|
graphics::ClockRenderer::drawHorizontalSegment(display, segmentSevenX, segmentSevenY, segmentWidth, segmentHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawHorizontalSegment(OLEDDisplay *display, int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
int halfHeight = height / 2;
|
||||||
|
|
||||||
|
// draw central rectangle
|
||||||
|
display->fillRect(x, y, width, height);
|
||||||
|
|
||||||
|
// draw end triangles
|
||||||
|
display->fillTriangle(x, y, x, y + height - 1, x - halfHeight, y + halfHeight);
|
||||||
|
|
||||||
|
display->fillTriangle(x + width, y, x + width + halfHeight, y + halfHeight, x + width, y + height - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawVerticalSegment(OLEDDisplay *display, int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
int halfHeight = height / 2;
|
||||||
|
|
||||||
|
// draw central rectangle
|
||||||
|
display->fillRect(x, y, height, width);
|
||||||
|
|
||||||
|
// draw end triangles
|
||||||
|
display->fillTriangle(x + halfHeight, y - halfHeight, x + height - 1, y, x, y);
|
||||||
|
|
||||||
|
display->fillTriangle(x, y + width, x + height - 1, y + width, x + halfHeight, y + width + halfHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
void drawWatchFaceToggleButton(OLEDDisplay *display, int16_t x, int16_t y, bool digitalMode, float scale)
|
||||||
|
{
|
||||||
|
uint16_t segmentWidth = SEGMENT_WIDTH * scale;
|
||||||
|
uint16_t segmentHeight = SEGMENT_HEIGHT * scale;
|
||||||
|
|
||||||
|
if (digitalMode) {
|
||||||
|
uint16_t radius = (segmentWidth + (segmentHeight * 2) + 4) / 2;
|
||||||
|
uint16_t centerX = (x + segmentHeight + 2) + (radius / 2);
|
||||||
|
uint16_t centerY = (y + segmentHeight + 2) + (radius / 2);
|
||||||
|
|
||||||
|
display->drawCircle(centerX, centerY, radius);
|
||||||
|
display->drawCircle(centerX, centerY, radius + 1);
|
||||||
|
display->drawLine(centerX, centerY, centerX, centerY - radius + 3);
|
||||||
|
display->drawLine(centerX, centerY, centerX + radius - 3, centerY);
|
||||||
|
} else {
|
||||||
|
uint16_t segmentOneX = x + segmentHeight + 2;
|
||||||
|
uint16_t segmentOneY = y;
|
||||||
|
|
||||||
|
uint16_t segmentTwoX = segmentOneX + segmentWidth + 2;
|
||||||
|
uint16_t segmentTwoY = segmentOneY + segmentHeight + 2;
|
||||||
|
|
||||||
|
uint16_t segmentThreeX = segmentOneX;
|
||||||
|
uint16_t segmentThreeY = segmentTwoY + segmentWidth + 2;
|
||||||
|
|
||||||
|
uint16_t segmentFourX = x;
|
||||||
|
uint16_t segmentFourY = y + segmentHeight + 2;
|
||||||
|
|
||||||
|
drawHorizontalSegment(display, segmentOneX, segmentOneY, segmentWidth, segmentHeight);
|
||||||
|
drawVerticalSegment(display, segmentTwoX, segmentTwoY, segmentWidth, segmentHeight);
|
||||||
|
drawHorizontalSegment(display, segmentThreeX, segmentThreeY, segmentWidth, segmentHeight);
|
||||||
|
drawVerticalSegment(display, segmentFourX, segmentFourY, segmentWidth, segmentHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// Draw a digital clock
|
||||||
|
void drawDigitalClockFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||||
|
{
|
||||||
|
display->clear();
|
||||||
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
|
|
||||||
|
// === Set Title, Blank for Clock
|
||||||
|
const char *titleStr = "";
|
||||||
|
// === Header ===
|
||||||
|
graphics::drawCommonHeader(display, x, y, titleStr, true);
|
||||||
|
|
||||||
|
#ifdef T_WATCH_S3
|
||||||
|
if (nimbleBluetooth && nimbleBluetooth->isConnected()) {
|
||||||
|
graphics::ClockRenderer::drawBluetoothConnectedIcon(display, display->getWidth() - 18, display->getHeight() - 14);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice, true); // Display local timezone
|
||||||
|
char timeString[16];
|
||||||
|
int hour = 0;
|
||||||
|
int minute = 0;
|
||||||
|
int second = 0;
|
||||||
|
if (rtc_sec > 0) {
|
||||||
|
long hms = rtc_sec % SEC_PER_DAY;
|
||||||
|
hms = (hms + SEC_PER_DAY) % SEC_PER_DAY;
|
||||||
|
|
||||||
|
hour = hms / SEC_PER_HOUR;
|
||||||
|
minute = (hms % SEC_PER_HOUR) / SEC_PER_MIN;
|
||||||
|
second = (hms % SEC_PER_HOUR) % SEC_PER_MIN; // or hms % SEC_PER_MIN
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isPM = hour >= 12;
|
||||||
|
// hour = hour > 12 ? hour - 12 : hour;
|
||||||
|
if (config.display.use_12h_clock) {
|
||||||
|
hour %= 12;
|
||||||
|
if (hour == 0)
|
||||||
|
hour = 12;
|
||||||
|
snprintf(timeString, sizeof(timeString), "%d:%02d", hour, minute);
|
||||||
|
} else {
|
||||||
|
snprintf(timeString, sizeof(timeString), "%02d:%02d", hour, minute);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Format seconds string
|
||||||
|
char secondString[8];
|
||||||
|
snprintf(secondString, sizeof(secondString), "%02d", second);
|
||||||
|
|
||||||
|
#ifdef T_WATCH_S3
|
||||||
|
float scale = 1.5;
|
||||||
|
#elif defined(CHATTER_2)
|
||||||
|
float scale = 1.1;
|
||||||
|
#else
|
||||||
|
float scale = 0.75;
|
||||||
|
if (isHighResolution) {
|
||||||
|
scale = 1.5;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uint16_t segmentWidth = SEGMENT_WIDTH * scale;
|
||||||
|
uint16_t segmentHeight = SEGMENT_HEIGHT * scale;
|
||||||
|
|
||||||
|
// calculate hours:minutes string width
|
||||||
|
uint16_t timeStringWidth = strlen(timeString) * 5;
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < strlen(timeString); i++) {
|
||||||
|
char character = timeString[i];
|
||||||
|
|
||||||
|
if (character == ':') {
|
||||||
|
timeStringWidth += segmentHeight;
|
||||||
|
} else {
|
||||||
|
timeStringWidth += segmentWidth + (segmentHeight * 2) + 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t hourMinuteTextX = (display->getWidth() / 2) - (timeStringWidth / 2);
|
||||||
|
|
||||||
|
uint16_t startingHourMinuteTextX = hourMinuteTextX;
|
||||||
|
|
||||||
|
uint16_t hourMinuteTextY = (display->getHeight() / 2) - (((segmentWidth * 2) + (segmentHeight * 3) + 8) / 2);
|
||||||
|
|
||||||
|
// iterate over characters in hours:minutes string and draw segmented characters
|
||||||
|
for (uint8_t i = 0; i < strlen(timeString); i++) {
|
||||||
|
char character = timeString[i];
|
||||||
|
|
||||||
|
if (character == ':') {
|
||||||
|
drawSegmentedDisplayColon(display, hourMinuteTextX, hourMinuteTextY, scale);
|
||||||
|
|
||||||
|
hourMinuteTextX += segmentHeight + 6;
|
||||||
|
} else {
|
||||||
|
drawSegmentedDisplayCharacter(display, hourMinuteTextX, hourMinuteTextY, character - '0', scale);
|
||||||
|
|
||||||
|
hourMinuteTextX += segmentWidth + (segmentHeight * 2) + 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
hourMinuteTextX += 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw seconds string
|
||||||
|
display->setFont(FONT_SMALL);
|
||||||
|
int xOffset = (isHighResolution) ? 0 : -1;
|
||||||
|
if (hour >= 10) {
|
||||||
|
xOffset += (isHighResolution) ? 32 : 18;
|
||||||
|
}
|
||||||
|
int yOffset = (isHighResolution) ? 3 : 1;
|
||||||
|
#ifdef SENSECAP_INDICATOR
|
||||||
|
yOffset -= 3;
|
||||||
|
#endif
|
||||||
|
#ifdef T_DECK
|
||||||
|
yOffset -= 5;
|
||||||
|
#endif
|
||||||
|
if (config.display.use_12h_clock) {
|
||||||
|
display->drawString(startingHourMinuteTextX + xOffset, (display->getHeight() - hourMinuteTextY) - yOffset - 2,
|
||||||
|
isPM ? "pm" : "am");
|
||||||
|
}
|
||||||
|
#ifndef USE_EINK
|
||||||
|
xOffset = (isHighResolution) ? 18 : 10;
|
||||||
|
display->drawString(startingHourMinuteTextX + timeStringWidth - xOffset, (display->getHeight() - hourMinuteTextY) - yOffset,
|
||||||
|
secondString);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawBluetoothConnectedIcon(OLEDDisplay *display, int16_t x, int16_t y)
|
||||||
|
{
|
||||||
|
display->drawFastImage(x, y, 18, 14, bluetoothConnectedIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw an analog clock
|
||||||
|
void drawAnalogClockFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||||
|
{
|
||||||
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
|
// === Set Title, Blank for Clock
|
||||||
|
const char *titleStr = "";
|
||||||
|
// === Header ===
|
||||||
|
graphics::drawCommonHeader(display, x, y, titleStr, true);
|
||||||
|
|
||||||
|
#ifdef T_WATCH_S3
|
||||||
|
if (nimbleBluetooth && nimbleBluetooth->isConnected()) {
|
||||||
|
drawBluetoothConnectedIcon(display, display->getWidth() - 18, display->getHeight() - 14);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
// clock face center coordinates
|
||||||
|
int16_t centerX = display->getWidth() / 2;
|
||||||
|
int16_t centerY = display->getHeight() / 2;
|
||||||
|
|
||||||
|
// clock face radius
|
||||||
|
int16_t radius = 0;
|
||||||
|
if (display->getHeight() < display->getWidth()) {
|
||||||
|
radius = (display->getHeight() / 2) * 0.9;
|
||||||
|
} else {
|
||||||
|
radius = (display->getWidth() / 2) * 0.9;
|
||||||
|
}
|
||||||
|
#ifdef T_WATCH_S3
|
||||||
|
radius = (display->getWidth() / 2) * 0.8;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// noon (0 deg) coordinates (outermost circle)
|
||||||
|
int16_t noonX = centerX;
|
||||||
|
int16_t noonY = centerY - radius;
|
||||||
|
|
||||||
|
// second hand radius and y coordinate (outermost circle)
|
||||||
|
int16_t secondHandNoonY = noonY + 1;
|
||||||
|
|
||||||
|
// tick mark outer y coordinate; (first nested circle)
|
||||||
|
int16_t tickMarkOuterNoonY = secondHandNoonY;
|
||||||
|
|
||||||
|
// seconds tick mark inner y coordinate; (second nested circle)
|
||||||
|
double secondsTickMarkInnerNoonY = (double)noonY + 4;
|
||||||
|
if (isHighResolution) {
|
||||||
|
secondsTickMarkInnerNoonY = (double)noonY + 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
// hours tick mark inner y coordinate; (third nested circle)
|
||||||
|
double hoursTickMarkInnerNoonY = (double)noonY + 6;
|
||||||
|
if (isHighResolution) {
|
||||||
|
hoursTickMarkInnerNoonY = (double)noonY + 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
// minute hand y coordinate
|
||||||
|
int16_t minuteHandNoonY = secondsTickMarkInnerNoonY + 4;
|
||||||
|
|
||||||
|
// hour string y coordinate
|
||||||
|
int16_t hourStringNoonY = minuteHandNoonY + 18;
|
||||||
|
|
||||||
|
// hour hand radius and y coordinate
|
||||||
|
int16_t hourHandRadius = radius * 0.35;
|
||||||
|
if (isHighResolution) {
|
||||||
|
hourHandRadius = radius * 0.55;
|
||||||
|
}
|
||||||
|
int16_t hourHandNoonY = centerY - hourHandRadius;
|
||||||
|
|
||||||
|
display->setColor(OLEDDISPLAY_COLOR::WHITE);
|
||||||
|
display->drawCircle(centerX, centerY, radius);
|
||||||
|
|
||||||
|
uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice, true); // Display local timezone
|
||||||
|
if (rtc_sec > 0) {
|
||||||
|
long hms = rtc_sec % SEC_PER_DAY;
|
||||||
|
hms = (hms + SEC_PER_DAY) % SEC_PER_DAY;
|
||||||
|
|
||||||
|
// Tear apart hms into h:m:s
|
||||||
|
int hour = hms / SEC_PER_HOUR;
|
||||||
|
int minute = (hms % SEC_PER_HOUR) / SEC_PER_MIN;
|
||||||
|
int second = (hms % SEC_PER_HOUR) % SEC_PER_MIN; // or hms % SEC_PER_MIN
|
||||||
|
|
||||||
|
bool isPM = hour >= 12;
|
||||||
|
if (config.display.use_12h_clock) {
|
||||||
|
isPM = hour >= 12;
|
||||||
|
display->setFont(FONT_SMALL);
|
||||||
|
int yOffset = isHighResolution ? 1 : 0;
|
||||||
|
#ifdef USE_EINK
|
||||||
|
yOffset += 3;
|
||||||
|
#endif
|
||||||
|
display->drawString(centerX - (display->getStringWidth(isPM ? "pm" : "am") / 2), centerY + yOffset,
|
||||||
|
isPM ? "pm" : "am");
|
||||||
|
}
|
||||||
|
hour %= 12;
|
||||||
|
if (hour == 0)
|
||||||
|
hour = 12;
|
||||||
|
|
||||||
|
int16_t degreesPerHour = 30;
|
||||||
|
int16_t degreesPerMinuteOrSecond = 6;
|
||||||
|
|
||||||
|
double hourBaseAngle = hour * degreesPerHour;
|
||||||
|
double hourAngleOffset = ((double)minute / 60) * degreesPerHour;
|
||||||
|
double hourAngle = radians(hourBaseAngle + hourAngleOffset);
|
||||||
|
|
||||||
|
double minuteBaseAngle = minute * degreesPerMinuteOrSecond;
|
||||||
|
double minuteAngleOffset = ((double)second / 60) * degreesPerMinuteOrSecond;
|
||||||
|
double minuteAngle = radians(minuteBaseAngle + minuteAngleOffset);
|
||||||
|
|
||||||
|
double secondAngle = radians(second * degreesPerMinuteOrSecond);
|
||||||
|
|
||||||
|
double hourX = sin(-hourAngle) * (hourHandNoonY - centerY) + noonX;
|
||||||
|
double hourY = cos(-hourAngle) * (hourHandNoonY - centerY) + centerY;
|
||||||
|
|
||||||
|
double minuteX = sin(-minuteAngle) * (minuteHandNoonY - centerY) + noonX;
|
||||||
|
double minuteY = cos(-minuteAngle) * (minuteHandNoonY - centerY) + centerY;
|
||||||
|
|
||||||
|
double secondX = sin(-secondAngle) * (secondHandNoonY - centerY) + noonX;
|
||||||
|
double secondY = cos(-secondAngle) * (secondHandNoonY - centerY) + centerY;
|
||||||
|
|
||||||
|
display->setFont(FONT_MEDIUM);
|
||||||
|
|
||||||
|
// draw minute and hour tick marks and hour numbers
|
||||||
|
for (uint16_t angle = 0; angle < 360; angle += 6) {
|
||||||
|
double angleInRadians = radians(angle);
|
||||||
|
|
||||||
|
double sineAngleInRadians = sin(-angleInRadians);
|
||||||
|
double cosineAngleInRadians = cos(-angleInRadians);
|
||||||
|
|
||||||
|
double endX = sineAngleInRadians * (tickMarkOuterNoonY - centerY) + noonX;
|
||||||
|
double endY = cosineAngleInRadians * (tickMarkOuterNoonY - centerY) + centerY;
|
||||||
|
|
||||||
|
if (angle % degreesPerHour == 0) {
|
||||||
|
double startX = sineAngleInRadians * (hoursTickMarkInnerNoonY - centerY) + noonX;
|
||||||
|
double startY = cosineAngleInRadians * (hoursTickMarkInnerNoonY - centerY) + centerY;
|
||||||
|
|
||||||
|
// draw hour tick mark
|
||||||
|
display->drawLine(startX, startY, endX, endY);
|
||||||
|
|
||||||
|
static char buffer[2];
|
||||||
|
|
||||||
|
uint8_t hourInt = (angle / 30);
|
||||||
|
|
||||||
|
if (hourInt == 0) {
|
||||||
|
hourInt = 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
// hour number x offset needs to be adjusted for some cases
|
||||||
|
int8_t hourStringXOffset;
|
||||||
|
int8_t hourStringYOffset = 13;
|
||||||
|
|
||||||
|
switch (hourInt) {
|
||||||
|
case 3:
|
||||||
|
hourStringXOffset = 5;
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
hourStringXOffset = 7;
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
case 11:
|
||||||
|
hourStringXOffset = 8;
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
hourStringXOffset = 13;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
hourStringXOffset = 6;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
double hourStringX = (sineAngleInRadians * (hourStringNoonY - centerY) + noonX) - hourStringXOffset;
|
||||||
|
double hourStringY = (cosineAngleInRadians * (hourStringNoonY - centerY) + centerY) - hourStringYOffset;
|
||||||
|
|
||||||
|
#ifdef T_WATCH_S3
|
||||||
|
// draw hour number
|
||||||
|
display->drawStringf(hourStringX, hourStringY, buffer, "%d", hourInt);
|
||||||
|
#else
|
||||||
|
#ifdef USE_EINK
|
||||||
|
if (isHighResolution) {
|
||||||
|
// draw hour number
|
||||||
|
display->drawStringf(hourStringX, hourStringY, buffer, "%d", hourInt);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (isHighResolution && (hourInt == 3 || hourInt == 6 || hourInt == 9 || hourInt == 12)) {
|
||||||
|
// draw hour number
|
||||||
|
display->drawStringf(hourStringX, hourStringY, buffer, "%d", hourInt);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (angle % degreesPerMinuteOrSecond == 0) {
|
||||||
|
double startX = sineAngleInRadians * (secondsTickMarkInnerNoonY - centerY) + noonX;
|
||||||
|
double startY = cosineAngleInRadians * (secondsTickMarkInnerNoonY - centerY) + centerY;
|
||||||
|
|
||||||
|
if (isHighResolution) {
|
||||||
|
// draw minute tick mark
|
||||||
|
display->drawLine(startX, startY, endX, endY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw hour hand
|
||||||
|
display->drawLine(centerX, centerY, hourX, hourY);
|
||||||
|
|
||||||
|
// draw minute hand
|
||||||
|
display->drawLine(centerX, centerY, minuteX, minuteY);
|
||||||
|
#ifndef USE_EINK
|
||||||
|
// draw second hand
|
||||||
|
display->drawLine(centerX, centerY, secondX, secondY);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ClockRenderer
|
||||||
|
|
||||||
|
} // namespace graphics
|
||||||
|
#endif
|
||||||
31
src/graphics/draw/ClockRenderer.h
Normal file
31
src/graphics/draw/ClockRenderer.h
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <OLEDDisplay.h>
|
||||||
|
#include <OLEDDisplayUi.h>
|
||||||
|
|
||||||
|
namespace graphics
|
||||||
|
{
|
||||||
|
|
||||||
|
/// Forward declarations
|
||||||
|
class Screen;
|
||||||
|
|
||||||
|
namespace ClockRenderer
|
||||||
|
{
|
||||||
|
|
||||||
|
// Clock frame functions
|
||||||
|
void drawAnalogClockFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||||
|
void drawDigitalClockFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||||
|
|
||||||
|
// Segmented display functions
|
||||||
|
void drawSegmentedDisplayCharacter(OLEDDisplay *display, int x, int y, uint8_t number, float scale = 1);
|
||||||
|
void drawSegmentedDisplayColon(OLEDDisplay *display, int x, int y, float scale = 1);
|
||||||
|
void drawHorizontalSegment(OLEDDisplay *display, int x, int y, int width, int height);
|
||||||
|
void drawVerticalSegment(OLEDDisplay *display, int x, int y, int width, int height);
|
||||||
|
|
||||||
|
// UI elements for clock displays
|
||||||
|
// void drawWatchFaceToggleButton(OLEDDisplay *display, int16_t x, int16_t y, bool digitalMode = true, float scale = 1);
|
||||||
|
void drawBluetoothConnectedIcon(OLEDDisplay *display, int16_t x, int16_t y);
|
||||||
|
|
||||||
|
} // namespace ClockRenderer
|
||||||
|
|
||||||
|
} // namespace graphics
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user