mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-15 07:12:34 +00:00
Compare commits
469 Commits
v2.6.4.b89
...
no-arduino
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6b115b2dc | ||
|
|
6749d9ffc5 | ||
|
|
21404de7fc | ||
|
|
0f69f6ca71 | ||
|
|
633924ced8 | ||
|
|
298e5d36c9 | ||
|
|
3770e43d86 | ||
|
|
6e376aeea6 | ||
|
|
6f922641b2 | ||
|
|
0ced4188b6 | ||
|
|
f34b9859c6 | ||
|
|
e7e15af282 | ||
|
|
d1c86a088a | ||
|
|
0a5e703a94 | ||
|
|
22be1f031d | ||
|
|
b1e7a26dfc | ||
|
|
134e01aa70 | ||
|
|
a30f5c8d93 | ||
|
|
1df2f32ae0 | ||
|
|
0edccf5b86 | ||
|
|
284b8bcff2 | ||
|
|
29402a5e7a | ||
|
|
6627f2e873 | ||
|
|
5bdae47379 | ||
|
|
3df894106b | ||
|
|
218f5bdbf3 | ||
|
|
749c3ca53c | ||
|
|
43aa906017 | ||
|
|
763c80e571 | ||
|
|
8cbc5fbeae | ||
|
|
9799f10e63 | ||
|
|
f9d4fdbb52 | ||
|
|
ea9c71ecd9 | ||
|
|
53f2f615b2 | ||
|
|
b6cb0b148c | ||
|
|
fe3ad06d21 | ||
|
|
5f36da4374 | ||
|
|
699e1a15b3 | ||
|
|
69058002d7 | ||
|
|
7a7166d575 | ||
|
|
ba53543354 | ||
|
|
cb9429e83e | ||
|
|
f972b62d89 | ||
|
|
9fc98b1154 | ||
|
|
7849a3d291 | ||
|
|
c0c2ec195f | ||
|
|
e31cd0bc77 | ||
|
|
5195815df0 | ||
|
|
303006e1df | ||
|
|
69a08cb69d | ||
|
|
ac0547ca3e | ||
|
|
a66f381a5d | ||
|
|
fda6de2f51 | ||
|
|
8a997eb529 | ||
|
|
42a80d8aed | ||
|
|
da69d88790 | ||
|
|
051e7331f2 | ||
|
|
ec2efa55fc | ||
|
|
96c18d9908 | ||
|
|
8908805894 | ||
|
|
03b59ae39a | ||
|
|
cc2dd66ce2 | ||
|
|
158c88ddef | ||
|
|
138dc89442 | ||
|
|
bdd03bc853 | ||
|
|
aaf9f4011f | ||
|
|
7c9ec46d8f | ||
|
|
4fdc5f094a | ||
|
|
4935e91454 | ||
|
|
baefda213a | ||
|
|
6aff2179d1 | ||
|
|
3741b78a32 | ||
|
|
3108de207e | ||
|
|
dbfa703cfa | ||
|
|
7c4714afbb | ||
|
|
0d37804db5 | ||
|
|
106dd08710 | ||
|
|
f223b8a55d | ||
|
|
75a49d3486 | ||
|
|
7d95b487ef | ||
|
|
2e72850d99 | ||
|
|
8179af3968 | ||
|
|
5fbdf4b6dc | ||
|
|
c47bdd11f9 | ||
|
|
d3b16c1e47 | ||
|
|
e29588d2e2 | ||
|
|
9b69c2a9af | ||
|
|
30e83d36b7 | ||
|
|
e974a58d18 | ||
|
|
b2663d4b19 | ||
|
|
bed25406c1 | ||
|
|
6a22bb5187 | ||
|
|
61de338aa2 | ||
|
|
bf21481bef | ||
|
|
2c9e169451 | ||
|
|
b5f74cead1 | ||
|
|
13421b32b5 | ||
|
|
295ed2a8cf | ||
|
|
8f717d58e7 | ||
|
|
06a65bd80e | ||
|
|
10f1567b96 | ||
|
|
067d01b832 | ||
|
|
3aed7b4190 | ||
|
|
c01db98819 | ||
|
|
4a55f6468a | ||
|
|
9e3cf441a1 | ||
|
|
beba1b4882 | ||
|
|
ba1ef45024 | ||
|
|
b12e9d43be | ||
|
|
c59f16db42 | ||
|
|
7cd50d7044 | ||
|
|
d98612a2ca | ||
|
|
9d9fb2d74c | ||
|
|
351dff14e8 | ||
|
|
2432d0616b | ||
|
|
b35fb886e4 | ||
|
|
53d5801790 | ||
|
|
93aa88129c | ||
|
|
f1d4e5fa48 | ||
|
|
41c1b29d70 | ||
|
|
25b2a75dfe | ||
|
|
6041357cbb | ||
|
|
cf3f35d566 | ||
|
|
3e3a55a971 | ||
|
|
e0f878872f | ||
|
|
4226d4c4f8 | ||
|
|
a4ef8bf5f0 | ||
|
|
021f872507 | ||
|
|
ec50801726 | ||
|
|
6db585051e | ||
|
|
aca5159170 | ||
|
|
c70fa0ef13 | ||
|
|
3fe44755d0 | ||
|
|
16994c8725 | ||
|
|
7f0afcdae2 | ||
|
|
9aff65e313 | ||
|
|
286376e46a | ||
|
|
660a7058c8 | ||
|
|
584ac8bdc9 | ||
|
|
d7697e6dec | ||
|
|
7411dd4f0c | ||
|
|
4d1d89644b | ||
|
|
61ebce5241 | ||
|
|
3dd6dc0296 | ||
|
|
b2d81b740f | ||
|
|
f1440a27d7 | ||
|
|
212005bfe9 | ||
|
|
afc5d1fdeb | ||
|
|
e7352cada4 | ||
|
|
61d918751e | ||
|
|
61e4eb12e6 | ||
|
|
5b312ab917 | ||
|
|
a50a94150a | ||
|
|
3398a52a34 | ||
|
|
a8294b983a | ||
|
|
066609a718 | ||
|
|
2a6944fe12 | ||
|
|
512183c39f | ||
|
|
18d11d28d4 | ||
|
|
1ef4caea05 | ||
|
|
7d8f9c7f6d | ||
|
|
c2d5862161 | ||
|
|
6bba17d463 | ||
|
|
ef9d0d7805 | ||
|
|
60d2cb35e0 | ||
|
|
ed6de5095e | ||
|
|
b63b73ab84 | ||
|
|
3901ae8956 | ||
|
|
7cffd9ba70 | ||
|
|
fc64bea698 | ||
|
|
a51a6b8c47 | ||
|
|
1af4a0bdc9 | ||
|
|
bc313da064 | ||
|
|
f16402dec1 | ||
|
|
feafd2bc0c | ||
|
|
b1955c34aa | ||
|
|
94af3bd1ab | ||
|
|
d9ad2322e8 | ||
|
|
0a8bd1e4be | ||
|
|
ace63eee8d | ||
|
|
9cba2e7b7f | ||
|
|
a7415791a5 | ||
|
|
cc66f7c79b | ||
|
|
e1417cff2e | ||
|
|
efb3f85cd0 | ||
|
|
fe25e5efd5 | ||
|
|
c40fdc9a43 | ||
|
|
7293e542ec | ||
|
|
b9fcd9da23 | ||
|
|
2a06b058fd | ||
|
|
2f4f2b1202 | ||
|
|
62e1974d09 | ||
|
|
d9bfed242c | ||
|
|
4b770ceade | ||
|
|
9fc208df5f | ||
|
|
6542c7bb47 | ||
|
|
b208e1924f | ||
|
|
48dc44ea8f | ||
|
|
b17bb49a63 | ||
|
|
7c9296b0f4 | ||
|
|
23fe093a65 | ||
|
|
c2a38357f1 | ||
|
|
3aee4bfc6b | ||
|
|
6bc9986f22 | ||
|
|
9c4dae3bf6 | ||
|
|
dbc0122bbd | ||
|
|
a1d859bf4c | ||
|
|
71ba6fa9ce | ||
|
|
212963156b | ||
|
|
ae88ec96f7 | ||
|
|
b66d3d7157 | ||
|
|
2a7059c86e | ||
|
|
14752caee5 | ||
|
|
981ecfdb61 | ||
|
|
ca9bf6b31a | ||
|
|
ff2a12d579 | ||
|
|
3a6fc668d8 | ||
|
|
581021031c | ||
|
|
b657ba1abb | ||
|
|
6f256c06f6 | ||
|
|
86217111b2 | ||
|
|
4e8ae7b108 | ||
|
|
0a61ea4137 | ||
|
|
bc1cc0081f | ||
|
|
57d6c1fa85 | ||
|
|
62421a83fd | ||
|
|
867f50ab11 | ||
|
|
1e81ebed06 | ||
|
|
dd2cf633b0 | ||
|
|
fdbe16f650 | ||
|
|
a2903921cd | ||
|
|
9a57a774f6 | ||
|
|
7bc473ed99 | ||
|
|
3596ea20bc | ||
|
|
eebf174735 | ||
|
|
849e06497a | ||
|
|
66a06230c4 | ||
|
|
2d6181fca0 | ||
|
|
a32e45f8f2 | ||
|
|
75c5080fd9 | ||
|
|
055fdcb7f6 | ||
|
|
33093e28fa | ||
|
|
df631d480b | ||
|
|
8bb1f3e869 | ||
|
|
d75c91a760 | ||
|
|
9d31d9f43b | ||
|
|
152b8b1b02 | ||
|
|
10693c4569 | ||
|
|
7da8aea1df | ||
|
|
baae2503d5 | ||
|
|
947191a797 | ||
|
|
987623567a | ||
|
|
a8ab6e82e6 | ||
|
|
5c005aaed5 | ||
|
|
0e1a1c99f0 | ||
|
|
f9fbc3ff86 | ||
|
|
124f4daa71 | ||
|
|
00e2ac33ad | ||
|
|
845088e45b | ||
|
|
e0b1fdb5e8 | ||
|
|
a7ef9e9c08 | ||
|
|
216fbf2343 | ||
|
|
635de2d229 | ||
|
|
72eae42b81 | ||
|
|
b4e8f7dbb6 | ||
|
|
473ef1bc03 | ||
|
|
ca8c177363 | ||
|
|
77e6868d5d | ||
|
|
54c1423039 | ||
|
|
03f19bca0e | ||
|
|
89df9d7686 | ||
|
|
45fcd479f6 | ||
|
|
b1e35cd8b3 | ||
|
|
70ced735d9 | ||
|
|
24e9539d40 | ||
|
|
5f245177bc | ||
|
|
72dd5bd88d | ||
|
|
8812eadd44 | ||
|
|
48dc0e014c | ||
|
|
e03f3de185 | ||
|
|
5d48d2c0a7 | ||
|
|
2b57ffafd7 | ||
|
|
a30f431b6a | ||
|
|
916afb5098 | ||
|
|
d26b50b78c | ||
|
|
c6e5ec055f | ||
|
|
5ab1db0142 | ||
|
|
64a1cd3f99 | ||
|
|
9da141aa8c | ||
|
|
74b3dc34e4 | ||
|
|
e2f6600cb9 | ||
|
|
ef14967fbf | ||
|
|
c177c6d655 | ||
|
|
a36f21b29a | ||
|
|
d74359abf0 | ||
|
|
5fd64d4114 | ||
|
|
816d948ee5 | ||
|
|
e0dafc3618 | ||
|
|
4a9a59342a | ||
|
|
5699d8632e | ||
|
|
e5cd0d613c | ||
|
|
64c8bde04a | ||
|
|
4477031971 | ||
|
|
1138f74e2c | ||
|
|
cf5c8de92e | ||
|
|
7e8294dfad | ||
|
|
98411d408a | ||
|
|
040a34fca8 | ||
|
|
ecd9f015d8 | ||
|
|
4e30023a4b | ||
|
|
b46aad85cc | ||
|
|
c4dc3472ac | ||
|
|
28e62e53e5 | ||
|
|
257165431f | ||
|
|
f1fda7bdeb | ||
|
|
3eb845eaae | ||
|
|
e4c2730f71 | ||
|
|
900a7c4c5e | ||
|
|
e7d0837d01 | ||
|
|
e7ce910c3b | ||
|
|
e957009019 | ||
|
|
7079f538ed | ||
|
|
baa05aacf5 | ||
|
|
4ef9eae695 | ||
|
|
d90b721f7b | ||
|
|
9e4847840a | ||
|
|
854d74f8db | ||
|
|
f1f6b63380 | ||
|
|
56fbfe13ae | ||
|
|
6b2e03e9d2 | ||
|
|
bf9a7d3a7f | ||
|
|
35d4784c5c | ||
|
|
5fa236c77d | ||
|
|
f7849f2bd4 | ||
|
|
91f38797a8 | ||
|
|
06ce6f3e8a | ||
|
|
3694805938 | ||
|
|
6d53ce7956 | ||
|
|
9f56e613f2 | ||
|
|
5c13f3451c | ||
|
|
1008a08c99 | ||
|
|
e98da27446 | ||
|
|
daa03aba30 | ||
|
|
456f94511f | ||
|
|
1888342a57 | ||
|
|
8e40d88e24 | ||
|
|
0d8e39cc2a | ||
|
|
78fa4c5c70 | ||
|
|
536b6d87c6 | ||
|
|
5256ae90dc | ||
|
|
fc3d9f2a15 | ||
|
|
69f938ea98 | ||
|
|
ec298199ee | ||
|
|
f03f547e9e | ||
|
|
0d800b7a22 | ||
|
|
09fd3c0782 | ||
|
|
1b1d4625aa | ||
|
|
fb2010552f | ||
|
|
c94dd1e331 | ||
|
|
ebea34520d | ||
|
|
cfc2a96a45 | ||
|
|
c0dab4a672 | ||
|
|
383ae7a82f | ||
|
|
38b118fb8b | ||
|
|
2a4582da20 | ||
|
|
7c4ac89059 | ||
|
|
12d1305618 | ||
|
|
a084073cc1 | ||
|
|
e2933bcb5b | ||
|
|
606abfc116 | ||
|
|
860e8eca5a | ||
|
|
5a9d70b445 | ||
|
|
2125c03974 | ||
|
|
cdbf0bec2d | ||
|
|
d5d20fe33f | ||
|
|
99f6b398b3 | ||
|
|
396fc1824e | ||
|
|
74325ba439 | ||
|
|
33cfe14d4a | ||
|
|
56eb0c08b2 | ||
|
|
01f7cd998a | ||
|
|
c49f20f96c | ||
|
|
afc710a868 | ||
|
|
9cdeedfcbd | ||
|
|
b7218f4a53 | ||
|
|
08bbff260c | ||
|
|
225e2726f3 | ||
|
|
ae47de152c | ||
|
|
2b7bc6696f | ||
|
|
52d1d8d7c8 | ||
|
|
75490f410b | ||
|
|
67ae1c553c | ||
|
|
a1df41a9e0 | ||
|
|
1b33189fe6 | ||
|
|
25237a15ff | ||
|
|
0110275494 | ||
|
|
65f00e9474 | ||
|
|
6e0cca16d1 | ||
|
|
2711c53b5f | ||
|
|
7856e069a5 | ||
|
|
4dfba50304 | ||
|
|
7494106170 | ||
|
|
0665802823 | ||
|
|
6270c5663c | ||
|
|
1017f6af35 | ||
|
|
11bafae287 | ||
|
|
31130fd49e | ||
|
|
13b4093d84 | ||
|
|
b7aaf3ae47 | ||
|
|
047ccbcb55 | ||
|
|
e4e8d28831 | ||
|
|
594cb0cc1e | ||
|
|
52eb4eca03 | ||
|
|
ef18a9b5b5 | ||
|
|
67fddcc214 | ||
|
|
6f47035420 | ||
|
|
af7a70ce08 | ||
|
|
22b44ce7e6 | ||
|
|
2f8a1dba8f | ||
|
|
f6ed10f329 | ||
|
|
c693cd59a9 | ||
|
|
644849126c | ||
|
|
c271515fb0 | ||
|
|
efc69550ef | ||
|
|
ea4ce8d827 | ||
|
|
128c347c64 | ||
|
|
6ee7644070 | ||
|
|
bb961e855e | ||
|
|
7554ff6c57 | ||
|
|
ae88759059 | ||
|
|
9993306751 | ||
|
|
2c01fad798 | ||
|
|
a5efbfccd7 | ||
|
|
886bffe8f3 | ||
|
|
39408fd3b1 | ||
|
|
3314b00fcc | ||
|
|
72db671e00 | ||
|
|
bd2d2981c9 | ||
|
|
da26ff5b95 | ||
|
|
f626f02005 | ||
|
|
2acb2fee79 | ||
|
|
ca1e09d780 | ||
|
|
71f774aa37 | ||
|
|
99ca59b8a1 | ||
|
|
f18f60cd0b | ||
|
|
850d21dcb9 | ||
|
|
e08177ba98 | ||
|
|
b52c355f2f | ||
|
|
e79d4492e8 | ||
|
|
95523a9659 | ||
|
|
f60c4ec5bc | ||
|
|
7181e1a296 | ||
|
|
aff0834f8e | ||
|
|
32d91ed859 | ||
|
|
a93d779ec0 | ||
|
|
38c8c20a2b | ||
|
|
1fd95d85b8 | ||
|
|
50db11fff6 | ||
|
|
2fc6781322 | ||
|
|
0480ddd266 | ||
|
|
a3a0c14923 | ||
|
|
213a178d71 | ||
|
|
72f6fde772 | ||
|
|
62a6c91c70 | ||
|
|
bd20c74287 | ||
|
|
c9e71173de | ||
|
|
41c44353f7 | ||
|
|
7fce089540 | ||
|
|
1dedd291fb |
9
.github/actions/build-variant/action.yml
vendored
9
.github/actions/build-variant/action.yml
vendored
@@ -43,6 +43,13 @@ runs:
|
||||
id: base
|
||||
uses: ./.github/actions/setup-base
|
||||
|
||||
- name: Get web ui version
|
||||
if: inputs.include-web-ui == 'true'
|
||||
id: webver
|
||||
shell: bash
|
||||
run: |
|
||||
echo "ver=$(cat bin/web.version)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Pull web ui
|
||||
if: inputs.include-web-ui == 'true'
|
||||
uses: dsaltares/fetch-gh-release-asset@master
|
||||
@@ -51,7 +58,7 @@ runs:
|
||||
file: build.tar
|
||||
target: build.tar
|
||||
token: ${{ inputs.github_token }}
|
||||
version: tags/v2.5.3
|
||||
version: tags/v${{ steps.webver.outputs.ver }}
|
||||
|
||||
- name: Unpack web ui
|
||||
if: inputs.include-web-ui == 'true'
|
||||
|
||||
29
.github/dependabot.yml
vendored
29
.github/dependabot.yml
vendored
@@ -1,29 +0,0 @@
|
||||
#trunk-ignore-all(yamllint/quoted-strings): required by dependabot syntax check
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: docker
|
||||
directory: /.devcontainer
|
||||
schedule:
|
||||
interval: daily
|
||||
time: "05:00"
|
||||
timezone: US/Pacific
|
||||
- package-ecosystem: docker
|
||||
directory: /
|
||||
schedule:
|
||||
interval: daily
|
||||
time: "05:00"
|
||||
timezone: US/Pacific
|
||||
- package-ecosystem: gitsubmodule
|
||||
directory: /
|
||||
schedule:
|
||||
interval: daily
|
||||
time: "05:00"
|
||||
timezone: US/Pacific
|
||||
ignore:
|
||||
- dependency-name: protobufs
|
||||
- package-ecosystem: github-actions
|
||||
directory: /.github/workflows
|
||||
schedule:
|
||||
interval: daily
|
||||
time: "05:00"
|
||||
timezone: US/Pacific
|
||||
7
.github/workflows/docker_build.yml
vendored
7
.github/workflows/docker_build.yml
vendored
@@ -26,6 +26,11 @@ on:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
pio_env:
|
||||
description: PlatformIO environment to build
|
||||
required: false
|
||||
type: string
|
||||
default: native
|
||||
outputs:
|
||||
digest:
|
||||
description: Digest of built image
|
||||
@@ -90,3 +95,5 @@ jobs:
|
||||
push: ${{ inputs.push }}
|
||||
tags: ${{ steps.meta.outputs.tags }} # Tag is only meant to be consumed by the "manifest" job
|
||||
platforms: ${{ inputs.platform }}
|
||||
build-args: |
|
||||
PIO_ENV=${{ inputs.pio_env }}
|
||||
|
||||
104
.github/workflows/main_matrix.yml
vendored
104
.github/workflows/main_matrix.yml
vendored
@@ -5,14 +5,20 @@ concurrency:
|
||||
on:
|
||||
# # Triggers the workflow on push but only for the master branch
|
||||
push:
|
||||
branches: [master, develop]
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
- event/*
|
||||
paths-ignore:
|
||||
- "**.md"
|
||||
- version.properties
|
||||
|
||||
# Note: This is different from "pull_request". Need to specify ref when doing checkouts.
|
||||
pull_request_target:
|
||||
branches: [master, develop]
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
- event/*
|
||||
paths-ignore:
|
||||
- "**.md"
|
||||
#- "**.yml"
|
||||
@@ -32,12 +38,12 @@ jobs:
|
||||
name: Checkout base
|
||||
- id: jsonStep
|
||||
run: |
|
||||
if [[ "${{ github.head_ref }}" == "" ]]; then
|
||||
if [[ "$GITHUB_HEAD_REF" == "" ]]; then
|
||||
TARGETS=$(./bin/generate_ci_matrix.py ${{matrix.arch}})
|
||||
else
|
||||
TARGETS=$(./bin/generate_ci_matrix.py ${{matrix.arch}} quick)
|
||||
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
|
||||
outputs:
|
||||
esp32: ${{ steps.jsonStep.outputs.esp32 }}
|
||||
@@ -143,9 +149,10 @@ jobs:
|
||||
secrets: inherit
|
||||
|
||||
test-native:
|
||||
if: ${{ !contains(github.ref_name, 'event/') }}
|
||||
uses: ./.github/workflows/test_native.yml
|
||||
|
||||
docker-debian-amd64:
|
||||
docker-deb-amd64:
|
||||
uses: ./.github/workflows/docker_build.yml
|
||||
with:
|
||||
distro: debian
|
||||
@@ -153,7 +160,16 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
push: false
|
||||
|
||||
docker-alpine-amd64:
|
||||
docker-deb-amd64-tft:
|
||||
uses: ./.github/workflows/docker_build.yml
|
||||
with:
|
||||
distro: debian
|
||||
platform: linux/amd64
|
||||
runs-on: ubuntu-24.04
|
||||
push: false
|
||||
pio_env: native-tft
|
||||
|
||||
docker-alp-amd64:
|
||||
uses: ./.github/workflows/docker_build.yml
|
||||
with:
|
||||
distro: alpine
|
||||
@@ -161,7 +177,16 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
push: false
|
||||
|
||||
docker-debian-arm64:
|
||||
docker-alp-amd64-tft:
|
||||
uses: ./.github/workflows/docker_build.yml
|
||||
with:
|
||||
distro: alpine
|
||||
platform: linux/amd64
|
||||
runs-on: ubuntu-24.04
|
||||
push: false
|
||||
pio_env: native-tft
|
||||
|
||||
docker-deb-arm64:
|
||||
uses: ./.github/workflows/docker_build.yml
|
||||
with:
|
||||
distro: debian
|
||||
@@ -169,7 +194,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04-arm
|
||||
push: false
|
||||
|
||||
docker-debian-armv7:
|
||||
docker-deb-armv7:
|
||||
uses: ./.github/workflows/docker_build.yml
|
||||
with:
|
||||
distro: debian
|
||||
@@ -177,17 +202,6 @@ jobs:
|
||||
runs-on: ubuntu-24.04-arm
|
||||
push: false
|
||||
|
||||
after-checks:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event_name != 'workflow_dispatch' }}
|
||||
needs: [check]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{github.event.pull_request.head.ref}}
|
||||
repository: ${{github.event.pull_request.head.repo.full_name}}
|
||||
|
||||
gather-artifacts:
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -332,7 +346,7 @@ jobs:
|
||||
merge-multiple: true
|
||||
path: ./output/pio-deps-native-tft
|
||||
|
||||
- name: Zip linux sources
|
||||
- name: Zip Linux sources
|
||||
working-directory: output
|
||||
run: |
|
||||
zip -j -9 -r ./meshtasticd-${{ steps.version.outputs.deb }}-src.zip ./debian-src
|
||||
@@ -342,7 +356,9 @@ jobs:
|
||||
- name: Display structure of downloaded files
|
||||
run: ls -lR
|
||||
|
||||
- name: Add linux sources to release
|
||||
- name: Add Linux sources to GtiHub Release
|
||||
# Only run when targeting master branch with workflow_dispatch
|
||||
if: ${{ github.ref_name == 'master' }}
|
||||
run: |
|
||||
gh release upload v${{ steps.version.outputs.long }} ./output/meshtasticd-${{ steps.version.outputs.deb }}-src.zip
|
||||
gh release upload v${{ steps.version.outputs.long }} ./output/platformio-deps-native-tft-${{ steps.version.outputs.long }}.zip
|
||||
@@ -400,9 +416,53 @@ jobs:
|
||||
- name: Display structure of downloaded files
|
||||
run: ls -lR
|
||||
|
||||
- name: Add bins and debug elfs to release
|
||||
- name: Add bins and debug elfs to GitHub Release
|
||||
# Only run when targeting master branch with workflow_dispatch
|
||||
if: ${{ github.ref_name == 'master' }}
|
||||
run: |
|
||||
gh release upload v${{ steps.version.outputs.long }} ./firmware-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip
|
||||
gh release upload v${{ steps.version.outputs.long }} ./debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
publish-firmware:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||
needs: [release-firmware]
|
||||
env:
|
||||
targets: esp32,esp32s3,esp32c3,esp32c6,nrf52840,rp2040,stm32
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
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
|
||||
with:
|
||||
pattern: firmware-{${{ env.targets }}}-${{ steps.version.outputs.long }}
|
||||
merge-multiple: true
|
||||
path: ./publish
|
||||
|
||||
- name: Publish firmware to meshtastic.github.io
|
||||
uses: peaceiris/actions-gh-pages@v4
|
||||
env:
|
||||
# On event/* branches, use the event name as the destination prefix
|
||||
DEST_PREFIX: ${{ contains(github.ref_name, 'event/') && format('{0}/', github.ref_name) || '' }}
|
||||
with:
|
||||
deploy_key: ${{ secrets.DIST_PAGES_DEPLOY_KEY }}
|
||||
external_repository: meshtastic/meshtastic.github.io
|
||||
publish_branch: master
|
||||
publish_dir: ./publish
|
||||
destination_dir: ${{ env.DEST_PREFIX }}firmware-${{ steps.version.outputs.long }}
|
||||
keep_files: true
|
||||
user_name: github-actions[bot]
|
||||
user_email: github-actions[bot]@users.noreply.github.com
|
||||
commit_message: ${{ steps.version.outputs.long }}
|
||||
enable_jekyll: true
|
||||
|
||||
47
.github/workflows/release_channels.yml
vendored
47
.github/workflows/release_channels.yml
vendored
@@ -46,11 +46,14 @@ jobs:
|
||||
|
||||
# Create a PR to bump version when a release is Published
|
||||
bump-version:
|
||||
if: ${{ github.event.release.published }}
|
||||
if: github.event.action == 'published'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
contents: write
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -60,32 +63,44 @@ jobs:
|
||||
with:
|
||||
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: Bump version.properties
|
||||
run: >-
|
||||
bin/bump_version.py
|
||||
run: |
|
||||
# Bump version.properties
|
||||
chmod +x ./bin/bump_version.py
|
||||
./bin/bump_version.py
|
||||
|
||||
- name: Get new release version string
|
||||
run: |
|
||||
echo "short=$(./bin/buildinfo.py short)" >> $GITHUB_OUTPUT
|
||||
id: new_version
|
||||
|
||||
- name: Ensure debian deps are installed
|
||||
shell: bash
|
||||
run: |
|
||||
sudo apt-get update -y --fix-missing
|
||||
sudo apt-get install -y devscripts
|
||||
|
||||
- name: Update debian changelog
|
||||
run: >-
|
||||
debian/ci_changelog.sh
|
||||
run: |
|
||||
# Update debian changelog
|
||||
chmod +x ./debian/ci_changelog.sh
|
||||
./debian/ci_changelog.sh
|
||||
|
||||
- name: Create version.properties pull request
|
||||
- name: Bump org.meshtastic.meshtasticd.metainfo.xml
|
||||
run: |
|
||||
# Bump org.meshtastic.meshtasticd.metainfo.xml
|
||||
pip install -r bin/bump_metainfo/requirements.txt -q
|
||||
chmod +x ./bin/bump_metainfo/bump_metainfo.py
|
||||
./bin/bump_metainfo/bump_metainfo.py --file bin/org.meshtastic.meshtasticd.metainfo.xml "${{ steps.new_version.outputs.short }}"
|
||||
env:
|
||||
PIP_DISABLE_PIP_VERSION_CHECK: 1
|
||||
|
||||
- name: Create Bumps pull request
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
with:
|
||||
title: Bump version.properties
|
||||
base: ${{ github.event.repository.default_branch }}
|
||||
title: Bump release version
|
||||
commit-message: automated bumps
|
||||
add-paths: |
|
||||
version.properties
|
||||
debian/changelog
|
||||
bin/org.meshtastic.meshtasticd.metainfo.xml
|
||||
|
||||
2
.github/workflows/sec_sast_semgrep_cron.yml
vendored
2
.github/workflows/sec_sast_semgrep_cron.yml
vendored
@@ -13,7 +13,7 @@ permissions:
|
||||
|
||||
jobs:
|
||||
semgrep-full:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
container:
|
||||
image: semgrep/semgrep
|
||||
|
||||
|
||||
2
.github/workflows/sec_sast_semgrep_pull.yml
vendored
2
.github/workflows/sec_sast_semgrep_pull.yml
vendored
@@ -6,7 +6,7 @@ permissions: read-all
|
||||
|
||||
jobs:
|
||||
semgrep-diff:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
container:
|
||||
image: semgrep/semgrep
|
||||
|
||||
|
||||
2
.github/workflows/test_native.yml
vendored
2
.github/workflows/test_native.yml
vendored
@@ -143,7 +143,7 @@ jobs:
|
||||
merge-multiple: true
|
||||
|
||||
- name: Test Report
|
||||
uses: dorny/test-reporter@v2.0.0
|
||||
uses: dorny/test-reporter@v2.1.0
|
||||
with:
|
||||
name: PlatformIO Tests
|
||||
path: testreport.xml
|
||||
|
||||
7
.github/workflows/tests.yml
vendored
7
.github/workflows/tests.yml
vendored
@@ -5,7 +5,10 @@ on:
|
||||
- cron: 0 0 * * * # Run every day at midnight
|
||||
workflow_dispatch: {}
|
||||
|
||||
permissions: read-all
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
checks: write
|
||||
|
||||
jobs:
|
||||
native-tests:
|
||||
@@ -44,7 +47,7 @@ jobs:
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
node-version: 22
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
|
||||
1
.trunk/configs/.prettierignore
Normal file
1
.trunk/configs/.prettierignore
Normal file
@@ -0,0 +1 @@
|
||||
renovate.json
|
||||
@@ -1,34 +1,34 @@
|
||||
version: 0.1
|
||||
cli:
|
||||
version: 1.22.11
|
||||
version: 1.24.0
|
||||
plugins:
|
||||
sources:
|
||||
- id: trunk
|
||||
ref: v1.6.7
|
||||
ref: v1.7.0
|
||||
uri: https://github.com/trunk-io/plugins
|
||||
lint:
|
||||
enabled:
|
||||
- checkov@3.2.435
|
||||
- renovate@40.34.4
|
||||
- prettier@3.5.3
|
||||
- trufflehog@3.88.18
|
||||
- yamllint@1.37.0
|
||||
- trufflehog@3.88.34
|
||||
- yamllint@1.37.1
|
||||
- bandit@1.8.3
|
||||
- checkov@3.2.394
|
||||
- terrascan@1.19.9
|
||||
- trivy@0.60.0
|
||||
- trivy@0.62.1
|
||||
- taplo@0.9.3
|
||||
- ruff@0.11.2
|
||||
- ruff@0.11.11
|
||||
- isort@6.0.1
|
||||
- markdownlint@0.44.0
|
||||
- oxipng@9.1.4
|
||||
- markdownlint@0.45.0
|
||||
- oxipng@9.1.5
|
||||
- svgo@3.3.2
|
||||
- actionlint@1.7.7
|
||||
- flake8@7.1.2
|
||||
- flake8@7.2.0
|
||||
- hadolint@2.12.1-beta
|
||||
- shfmt@3.6.0
|
||||
- shellcheck@0.10.0
|
||||
- black@25.1.0
|
||||
- git-diff-check
|
||||
- gitleaks@8.24.2
|
||||
- gitleaks@8.26.0
|
||||
- clang-format@16.0.3
|
||||
ignore:
|
||||
- linters: [ALL]
|
||||
@@ -38,7 +38,7 @@ runtimes:
|
||||
enabled:
|
||||
- python@3.10.8
|
||||
- go@1.21.0
|
||||
- node@18.20.5
|
||||
- node@22.16.0
|
||||
actions:
|
||||
disabled:
|
||||
- trunk-announce
|
||||
|
||||
54
.vscode/settings.json
vendored
54
.vscode/settings.json
vendored
@@ -10,5 +10,59 @@
|
||||
},
|
||||
"[powershell]": {
|
||||
"editor.defaultFormatter": "ms-vscode.powershell"
|
||||
},
|
||||
"files.associations": {
|
||||
"array": "cpp",
|
||||
"atomic": "cpp",
|
||||
"*.tcc": "cpp",
|
||||
"cctype": "cpp",
|
||||
"clocale": "cpp",
|
||||
"cmath": "cpp",
|
||||
"csignal": "cpp",
|
||||
"cstdarg": "cpp",
|
||||
"cstddef": "cpp",
|
||||
"cstdint": "cpp",
|
||||
"cstdio": "cpp",
|
||||
"cstdlib": "cpp",
|
||||
"cstring": "cpp",
|
||||
"ctime": "cpp",
|
||||
"cwchar": "cpp",
|
||||
"cwctype": "cpp",
|
||||
"deque": "cpp",
|
||||
"list": "cpp",
|
||||
"unordered_map": "cpp",
|
||||
"unordered_set": "cpp",
|
||||
"vector": "cpp",
|
||||
"exception": "cpp",
|
||||
"algorithm": "cpp",
|
||||
"functional": "cpp",
|
||||
"iterator": "cpp",
|
||||
"map": "cpp",
|
||||
"memory": "cpp",
|
||||
"memory_resource": "cpp",
|
||||
"numeric": "cpp",
|
||||
"optional": "cpp",
|
||||
"random": "cpp",
|
||||
"string": "cpp",
|
||||
"string_view": "cpp",
|
||||
"system_error": "cpp",
|
||||
"tuple": "cpp",
|
||||
"type_traits": "cpp",
|
||||
"utility": "cpp",
|
||||
"fstream": "cpp",
|
||||
"initializer_list": "cpp",
|
||||
"iomanip": "cpp",
|
||||
"iosfwd": "cpp",
|
||||
"iostream": "cpp",
|
||||
"istream": "cpp",
|
||||
"limits": "cpp",
|
||||
"new": "cpp",
|
||||
"ostream": "cpp",
|
||||
"sstream": "cpp",
|
||||
"stdexcept": "cpp",
|
||||
"streambuf": "cpp",
|
||||
"cinttypes": "cpp",
|
||||
"typeinfo": "cpp",
|
||||
"*.xbm": "cpp"
|
||||
}
|
||||
}
|
||||
|
||||
36
Dockerfile
36
Dockerfile
@@ -1,20 +1,20 @@
|
||||
# trunk-ignore-all(terrascan/AC_DOCKER_0002): Known terrascan issue
|
||||
# trunk-ignore-all(trivy/DS002): We must run as root for this container
|
||||
# trunk-ignore-all(checkov/CKV_DOCKER_8): We must run as root for this container
|
||||
# trunk-ignore-all(hadolint/DL3002): We must run as root for this container
|
||||
# trunk-ignore-all(hadolint/DL3008): Do not pin apt package versions
|
||||
# trunk-ignore-all(hadolint/DL3013): Do not pin pip package versions
|
||||
|
||||
FROM python:3.13-bookworm AS builder
|
||||
ARG PIO_ENV=native
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV TZ=Etc/UTC
|
||||
|
||||
# Install Dependencies
|
||||
ENV PIP_ROOT_USER_ACTION=ignore
|
||||
RUN apt-get update && apt-get install --no-install-recommends -y \
|
||||
wget g++ zip git ca-certificates \
|
||||
curl wget g++ zip git ca-certificates pkg-config \
|
||||
libgpiod-dev libyaml-cpp-dev libbluetooth-dev libi2c-dev libuv1-dev \
|
||||
libusb-1.0-0-dev libulfius-dev liborcania-dev libssl-dev pkg-config \
|
||||
libusb-1.0-0-dev libulfius-dev liborcania-dev libssl-dev \
|
||||
libx11-dev libinput-dev libxkbcommon-x11-dev \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/* \
|
||||
&& pip install --no-cache-dir -U platformio \
|
||||
&& mkdir /tmp/firmware
|
||||
@@ -24,13 +24,26 @@ WORKDIR /tmp/firmware
|
||||
COPY . /tmp/firmware
|
||||
|
||||
# Build
|
||||
RUN bash ./bin/build-native.sh && \
|
||||
RUN bash ./bin/build-native.sh "$PIO_ENV" && \
|
||||
cp "/tmp/firmware/release/meshtasticd_linux_$(uname -m)" "/tmp/firmware/release/meshtasticd"
|
||||
|
||||
# Fetch web assets
|
||||
RUN curl -L "https://github.com/meshtastic/web/releases/download/v$(cat /tmp/firmware/bin/web.version)/build.tar" -o /tmp/web.tar \
|
||||
&& mkdir -p /tmp/web \
|
||||
&& tar -xf /tmp/web.tar -C /tmp/web/ \
|
||||
&& gzip -dr /tmp/web \
|
||||
&& rm /tmp/web.tar
|
||||
|
||||
##### PRODUCTION BUILD #############
|
||||
|
||||
FROM debian:bookworm-slim
|
||||
LABEL org.opencontainers.image.title="Meshtastic" \
|
||||
org.opencontainers.image.description="Debian Meshtastic daemon and web interface" \
|
||||
org.opencontainers.image.url="https://meshtastic.org" \
|
||||
org.opencontainers.image.documentation="https://meshtastic.org/docs/" \
|
||||
org.opencontainers.image.authors="Meshtastic" \
|
||||
org.opencontainers.image.licenses="GPL-3.0-or-later" \
|
||||
org.opencontainers.image.source="https://github.com/meshtastic/firmware/"
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV TZ=Etc/UTC
|
||||
|
||||
@@ -38,14 +51,17 @@ ENV TZ=Etc/UTC
|
||||
USER root
|
||||
|
||||
RUN apt-get update && apt-get --no-install-recommends -y install \
|
||||
libc-bin libc6 libgpiod2 libyaml-cpp0.7 libi2c0 libuv1 libusb-1.0-0-dev liborcania2.3 libulfius2.7 libssl3 \
|
||||
libc-bin libc6 libgpiod2 libyaml-cpp0.7 libi2c0 libuv1 libusb-1.0-0-dev \
|
||||
liborcania2.3 libulfius2.7 libssl3 \
|
||||
libx11-6 libinput10 libxkbcommon-x11-0 \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/* \
|
||||
&& mkdir -p /var/lib/meshtasticd \
|
||||
&& mkdir -p /etc/meshtasticd/config.d \
|
||||
&& mkdir -p /etc/meshtasticd/ssl
|
||||
|
||||
# Fetch compiled binary from the builder
|
||||
COPY --from=builder /tmp/firmware/release/meshtasticd /usr/sbin/
|
||||
COPY --from=builder /tmp/firmware/release/meshtasticd /usr/bin/
|
||||
COPY --from=builder /tmp/web /usr/share/meshtasticd/
|
||||
# Copy config templates
|
||||
COPY ./bin/config.d /etc/meshtasticd/available.d
|
||||
|
||||
@@ -54,7 +70,9 @@ VOLUME /var/lib/meshtasticd
|
||||
|
||||
# Expose Meshtastic TCP API port from the host
|
||||
EXPOSE 4403
|
||||
# Expose Meshtastic Web UI port from the host
|
||||
EXPOSE 9443
|
||||
|
||||
CMD [ "sh", "-cx", "meshtasticd -d /var/lib/meshtasticd" ]
|
||||
CMD [ "sh", "-cx", "meshtasticd --fsdir=/var/lib/meshtasticd" ]
|
||||
|
||||
HEALTHCHECK NONE
|
||||
HEALTHCHECK NONE
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
| Firmware Version | Supported |
|
||||
| ---------------- | ------------------ |
|
||||
| 2.5.x | :white_check_mark: |
|
||||
| <= 2.4.x | :x: |
|
||||
| 2.6.x | :white_check_mark: |
|
||||
| <= 2.5.x | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
# trunk-ignore-all(trivy/DS002): We must run as root for this container
|
||||
# trunk-ignore-all(checkov/CKV_DOCKER_8): We must run as root for this container
|
||||
# trunk-ignore-all(hadolint/DL3002): We must run as root for this container
|
||||
# trunk-ignore-all(hadolint/DL3018): Do not pin apk package versions
|
||||
# trunk-ignore-all(hadolint/DL3013): Do not pin pip package versions
|
||||
|
||||
FROM python:3.13-alpine3.21 AS builder
|
||||
|
||||
ARG PIO_ENV=native
|
||||
ENV PIP_ROOT_USER_ACTION=ignore
|
||||
|
||||
RUN apk --no-cache add \
|
||||
bash g++ libstdc++-dev linux-headers zip git ca-certificates libgpiod-dev yaml-cpp-dev bluez-dev \
|
||||
libusb-dev i2c-tools-dev libuv-dev openssl-dev pkgconf argp-standalone \
|
||||
libx11-dev libinput-dev libxkbcommon-dev \
|
||||
&& rm -rf /var/cache/apk/* \
|
||||
&& pip install --no-cache-dir -U platformio \
|
||||
&& mkdir /tmp/firmware
|
||||
@@ -21,23 +22,35 @@ COPY . /tmp/firmware
|
||||
# Add `argp` for musl
|
||||
ENV PLATFORMIO_BUILD_FLAGS="-Os -ffunction-sections -fdata-sections -Wl,--gc-sections -largp"
|
||||
|
||||
RUN bash ./bin/build-native.sh && \
|
||||
RUN bash ./bin/build-native.sh "$PIO_ENV" && \
|
||||
cp "/tmp/firmware/release/meshtasticd_linux_$(uname -m)" "/tmp/firmware/release/meshtasticd"
|
||||
|
||||
# ##### PRODUCTION BUILD #############
|
||||
|
||||
FROM alpine:3.21
|
||||
LABEL org.opencontainers.image.title="Meshtastic" \
|
||||
org.opencontainers.image.description="Alpine Meshtastic daemon" \
|
||||
org.opencontainers.image.url="https://meshtastic.org" \
|
||||
org.opencontainers.image.documentation="https://meshtastic.org/docs/" \
|
||||
org.opencontainers.image.authors="Meshtastic" \
|
||||
org.opencontainers.image.licenses="GPL-3.0-or-later" \
|
||||
org.opencontainers.image.source="https://github.com/meshtastic/firmware/"
|
||||
|
||||
# nosemgrep: dockerfile.security.last-user-is-root.last-user-is-root
|
||||
USER root
|
||||
|
||||
RUN apk --no-cache add \
|
||||
libstdc++ libgpiod yaml-cpp libusb i2c-tools libuv \
|
||||
shadow libstdc++ libgpiod yaml-cpp libusb i2c-tools libuv \
|
||||
libx11 libinput libxkbcommon \
|
||||
&& rm -rf /var/cache/apk/* \
|
||||
&& mkdir -p /var/lib/meshtasticd \
|
||||
&& mkdir -p /etc/meshtasticd/config.d \
|
||||
&& mkdir -p /etc/meshtasticd/ssl
|
||||
COPY --from=builder /tmp/firmware/release/meshtasticd /usr/sbin/
|
||||
|
||||
# Fetch compiled binary from the builder
|
||||
COPY --from=builder /tmp/firmware/release/meshtasticd /usr/bin/
|
||||
# Copy config templates
|
||||
COPY ./bin/config.d /etc/meshtasticd/available.d
|
||||
|
||||
WORKDIR /var/lib/meshtasticd
|
||||
VOLUME /var/lib/meshtasticd
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
[esp32_base]
|
||||
extends = arduino_base
|
||||
custom_esp32_kind = esp32
|
||||
platform = platformio/espressif32@6.10.0
|
||||
platform =
|
||||
# renovate: datasource=custom.pio depName=platformio/espressif32 packageName=platformio/platform/espressif32
|
||||
platformio/espressif32@6.10.0
|
||||
|
||||
build_src_filter =
|
||||
${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2xx0> -<mesh/eth/> -<mesh/raspihttp>
|
||||
@@ -44,13 +46,20 @@ lib_deps =
|
||||
${arduino_base.lib_deps}
|
||||
${networking_base.lib_deps}
|
||||
${environmental_base.lib_deps}
|
||||
${environmental_extra.lib_deps}
|
||||
${radiolib_base.lib_deps}
|
||||
https://github.com/meshtastic/esp32_https_server/archive/23665b3adc080a311dcbb586ed5941b5f94d6ea2.zip
|
||||
# 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
|
||||
# renovate: datasource=custom.pio depName=NimBLE-Arduino packageName=h2zero/library/NimBLE-Arduino
|
||||
h2zero/NimBLE-Arduino@^1.4.3
|
||||
# renovate: datasource=git-refs depName=libpax packageName=https://github.com/dbinfrago/libpax gitBranch=master
|
||||
https://github.com/dbinfrago/libpax/archive/3cdc0371c375676a97967547f4065607d4c53fd1.zip
|
||||
# renovate: datasource=custom.pio depName=XPowersLib packageName=lewisxhe/library/XPowersLib
|
||||
lewisxhe/XPowersLib@^0.2.7
|
||||
# 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
|
||||
rweather/Crypto@^0.4.0
|
||||
# renovate: datasource=custom.pio depName=rweather/Crypto packageName=rweather/library/Crypto
|
||||
rweather/Crypto@0.4.0
|
||||
|
||||
lib_ignore =
|
||||
segger_rtt
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
[esp32c6_base]
|
||||
extends = esp32_base
|
||||
platform = https://github.com/Jason2866/platform-espressif32/archive/22faa566df8c789000f8136cd8d0aca49617af55.zip
|
||||
platform =
|
||||
# Do not renovate until we have switched to pioarduino tagged builds
|
||||
https://github.com/Jason2866/platform-espressif32/archive/22faa566df8c789000f8136cd8d0aca49617af55.zip
|
||||
build_flags =
|
||||
${arduino_base.build_flags}
|
||||
-Wall
|
||||
@@ -23,10 +25,14 @@ lib_deps =
|
||||
${arduino_base.lib_deps}
|
||||
${networking_base.lib_deps}
|
||||
${environmental_base.lib_deps}
|
||||
${environmental_extra.lib_deps}
|
||||
${radiolib_base.lib_deps}
|
||||
# renovate: datasource=custom.pio depName=XPowersLib packageName=lewisxhe/library/XPowersLib
|
||||
lewisxhe/XPowersLib@^0.2.7
|
||||
# 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
|
||||
rweather/Crypto@^0.4.0
|
||||
# renovate: datasource=custom.pio depName=rweather/Crypto packageName=rweather/library/Crypto
|
||||
rweather/Crypto@0.4.0
|
||||
|
||||
build_src_filter =
|
||||
${esp32_base.build_src_filter} -<mesh/http>
|
||||
|
||||
@@ -16,4 +16,4 @@ build_flags =
|
||||
lib_ignore =
|
||||
${esp32_base.lib_ignore}
|
||||
NimBLE-Arduino
|
||||
libpax
|
||||
libpax
|
||||
|
||||
@@ -3,4 +3,3 @@ extends = esp32_base
|
||||
custom_esp32_kind = esp32s3
|
||||
|
||||
monitor_speed = 115200
|
||||
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
[nrf52_base]
|
||||
; Instead of the standard nordicnrf52 platform, we use our fork which has our added variant files
|
||||
platform = platformio/nordicnrf52@^10.7.0
|
||||
platform =
|
||||
# renovate: datasource=custom.pio depName=platformio/nordicnrf52 packageName=platformio/platform/nordicnrf52
|
||||
platformio/nordicnrf52@^10.8.0
|
||||
extends = arduino_base
|
||||
platform_packages =
|
||||
; our custom Git version until they merge our PR
|
||||
# TODO renovate
|
||||
platformio/framework-arduinoadafruitnrf52 @ https://github.com/meshtastic/Adafruit_nRF52_Arduino#e13f5820002a4fb2a5e6754b42ace185277e5adf
|
||||
; Don't renovate toolchain-gccarmnoneeabi
|
||||
platformio/toolchain-gccarmnoneeabi@~1.90301.0
|
||||
|
||||
build_type = debug
|
||||
@@ -24,8 +28,9 @@ build_src_filter =
|
||||
lib_deps=
|
||||
${arduino_base.lib_deps}
|
||||
${radiolib_base.lib_deps}
|
||||
rweather/Crypto@^0.4.0
|
||||
# renovate: datasource=custom.pio depName=rweather/Crypto packageName=rweather/library/Crypto
|
||||
rweather/Crypto@0.4.0
|
||||
|
||||
lib_ignore =
|
||||
BluetoothOTA
|
||||
lvgl
|
||||
lvgl
|
||||
|
||||
@@ -6,7 +6,9 @@ build_flags = ${nrf52_base.build_flags}
|
||||
lib_deps =
|
||||
${nrf52_base.lib_deps}
|
||||
${environmental_base.lib_deps}
|
||||
https://github.com/Kongduino/Adafruit_nRFCrypto/archive/e31a8825ea3300b163a0a3c1ddd5de34e10e1371.zip
|
||||
${environmental_extra.lib_deps}
|
||||
# renovate: datasource=git-refs depName=Kongduino-Adafruit_nRFCrypto packageName=https://github.com/Kongduino/Adafruit_nRFCrypto gitBranch=master
|
||||
https://github.com/Kongduino/Adafruit_nRFCrypto/archive/5f838d2709461a2c981f642917aa50254a25c14c.zip
|
||||
|
||||
; Common NRF52 debugging settings follow. See the Meshtastic developer docs for how to connect SWD debugging probes to your board.
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
; The Portduino based 'native' environment. Currently supported on Linux targets with real LoRa hardware (or simulated).
|
||||
[portduino_base]
|
||||
platform = https://github.com/meshtastic/platform-native/archive/c5bd469ab9b5a6966321e09557b27d906961da63.zip
|
||||
platform =
|
||||
# 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
|
||||
framework = arduino
|
||||
|
||||
build_src_filter =
|
||||
@@ -15,18 +17,19 @@ build_src_filter =
|
||||
+<mesh/raspihttp/>
|
||||
-<mesh/eth/>
|
||||
-<modules/esp32>
|
||||
-<modules/Telemetry/EnvironmentTelemetry.cpp>
|
||||
-<modules/Telemetry/AirQualityTelemetry.cpp>
|
||||
-<modules/Telemetry/Sensor>
|
||||
+<../variants/portduino>
|
||||
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
${networking_base.lib_deps}
|
||||
${radiolib_base.lib_deps}
|
||||
rweather/Crypto@^0.4.0
|
||||
${environmental_base.lib_deps}
|
||||
# renovate: datasource=custom.pio depName=rweather/Crypto packageName=rweather/library/Crypto
|
||||
rweather/Crypto@0.4.0
|
||||
# renovate: datasource=custom.pio depName=LovyanGFX packageName=lovyan03/library/LovyanGFX
|
||||
lovyan03/LovyanGFX@^1.2.0
|
||||
https://github.com/pine64/libch341-spi-userspace/archive/a9b17e3452f7fb747000d9b4ad4409155b39f6ef.zip
|
||||
# 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
|
||||
|
||||
build_flags =
|
||||
${arduino_base.build_flags}
|
||||
@@ -42,4 +45,7 @@ build_flags =
|
||||
-lyaml-cpp
|
||||
-li2c
|
||||
-luv
|
||||
-std=gnu17
|
||||
-std=c++17
|
||||
|
||||
lib_ignore = Adafruit NeoPixel
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
; Common settings for rp2040 Processor based targets
|
||||
[rp2040_base]
|
||||
platform = https://github.com/maxgerhardt/platform-raspberrypi#76ecf3c7e9dd4503af0331154c4ca1cddc4b03e5 ; For arduino-pico >= 4.4.3
|
||||
platform =
|
||||
# TODO renovate
|
||||
https://github.com/maxgerhardt/platform-raspberrypi#76ecf3c7e9dd4503af0331154c4ca1cddc4b03e5
|
||||
; For arduino-pico >= 4.4.3
|
||||
extends = arduino_base
|
||||
platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico#4.4.3
|
||||
platform_packages =
|
||||
# TODO renovate
|
||||
framework-arduinopico@https://github.com/earlephilhower/arduino-pico#4.4.3
|
||||
|
||||
board_build.core = earlephilhower
|
||||
board_build.filesystem_size = 0.5m
|
||||
@@ -23,5 +28,7 @@ lib_ignore =
|
||||
lib_deps =
|
||||
${arduino_base.lib_deps}
|
||||
${environmental_base.lib_deps}
|
||||
${environmental_extra.lib_deps}
|
||||
${radiolib_base.lib_deps}
|
||||
rweather/Crypto
|
||||
# renovate: datasource=custom.pio depName=rweather/Crypto packageName=rweather/library/Crypto
|
||||
rweather/Crypto@0.4.0
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
; Common settings for rp2040 Processor based targets
|
||||
; Common settings for rp2350 Processor based targets
|
||||
[rp2350_base]
|
||||
platform = https://github.com/maxgerhardt/platform-raspberrypi#76ecf3c7e9dd4503af0331154c4ca1cddc4b03e5 ; For arduino-pico >= 4.4.3
|
||||
platform =
|
||||
# TODO renovate
|
||||
https://github.com/maxgerhardt/platform-raspberrypi#76ecf3c7e9dd4503af0331154c4ca1cddc4b03e5
|
||||
; For arduino-pico >= 4.4.3
|
||||
extends = arduino_base
|
||||
platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico#4.4.3
|
||||
platform_packages =
|
||||
# TODO renovate
|
||||
framework-arduinopico@https://github.com/earlephilhower/arduino-pico#4.4.3
|
||||
|
||||
board_build.core = earlephilhower
|
||||
board_build.filesystem_size = 0.5m
|
||||
@@ -20,5 +25,7 @@ lib_ignore =
|
||||
lib_deps =
|
||||
${arduino_base.lib_deps}
|
||||
${environmental_base.lib_deps}
|
||||
${environmental_extra.lib_deps}
|
||||
${radiolib_base.lib_deps}
|
||||
rweather/Crypto
|
||||
# renovate: datasource=custom.pio depName=rweather/Crypto packageName=rweather/library/Crypto
|
||||
rweather/Crypto@0.4.0
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
[stm32_base]
|
||||
extends = arduino_base
|
||||
platform = ststm32
|
||||
platform_packages = platformio/framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32/archive/2.10.1.zip
|
||||
platform =
|
||||
# renovate: datasource=custom.pio depName=platformio/ststm32 packageName=platformio/platform/ststm32
|
||||
platformio/ststm32@19.1.0
|
||||
platform_packages =
|
||||
# TODO renovate
|
||||
platformio/framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32/archive/2.10.1.zip
|
||||
extra_scripts =
|
||||
${env.extra_scripts}
|
||||
post:extra_scripts/extra_stm32.py
|
||||
@@ -35,6 +39,7 @@ debug_tool = stlink
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
${radiolib_base.lib_deps}
|
||||
# renovate: datasource=git-refs depName=caveman99-stm32-Crypto packageName=https://github.com/caveman99/Crypto gitBranch=main
|
||||
https://github.com/caveman99/Crypto/archive/eae9c768054118a9399690f8af202853d1ae8516.zip
|
||||
|
||||
lib_ignore =
|
||||
|
||||
7
bin/99-meshtasticd-udev.rules
Normal file
7
bin/99-meshtasticd-udev.rules
Normal file
@@ -0,0 +1,7 @@
|
||||
# Set spidev ownership to 'spi' group
|
||||
SUBSYSTEM=="spidev", KERNEL=="spidev*", GROUP="spi", MODE="0660"
|
||||
# Allow access to USB CH341 devices
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="5512", MODE="0666"
|
||||
# Set gpio ownership to 'gpio' group
|
||||
SUBSYSTEM=="*gpiomem*", GROUP="gpio", MODE="0660"
|
||||
SUBSYSTEM=="gpio", GROUP="gpio", MODE="0660"
|
||||
@@ -15,6 +15,7 @@ platformioFailed() {
|
||||
|
||||
VERSION=$(bin/buildinfo.py long)
|
||||
SHORT_VERSION=$(bin/buildinfo.py short)
|
||||
PIO_ENV=${1:-native}
|
||||
|
||||
OUTDIR=release/
|
||||
|
||||
@@ -24,7 +25,7 @@ mkdir -p $OUTDIR/
|
||||
rm -r $OUTDIR/* || true
|
||||
|
||||
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
|
||||
pio pkg update --environment native || platformioFailed
|
||||
pio run --environment native || platformioFailed
|
||||
cp .pio/build/native/program "$OUTDIR/meshtasticd_linux_$(uname -m)"
|
||||
pio pkg update --environment "$PIO_ENV" || platformioFailed
|
||||
pio run --environment "$PIO_ENV" || platformioFailed
|
||||
cp ".pio/build/$PIO_ENV/program" "$OUTDIR/meshtasticd_linux_$(uname -m)"
|
||||
cp bin/native-install.* $OUTDIR
|
||||
|
||||
72
bin/bump_metainfo/bump_metainfo.py
Executable file
72
bin/bump_metainfo/bump_metainfo.py
Executable file
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import xml.etree.ElementTree as ET
|
||||
from defusedxml.ElementTree import parse
|
||||
from datetime import datetime, timezone
|
||||
|
||||
|
||||
# Indent by 2 spaces to align with xml formatting.
|
||||
def indent(elem, level=0):
|
||||
i = "\n" + level * " "
|
||||
if len(elem):
|
||||
if not elem.text or not elem.text.strip():
|
||||
elem.text = i + " "
|
||||
for child in elem:
|
||||
indent(child, level + 1)
|
||||
if not child.tail or not child.tail.strip():
|
||||
child.tail = i
|
||||
if level and (not elem.tail or not elem.tail.strip()):
|
||||
elem.tail = i
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Prepend new release entry to metainfo.xml file.")
|
||||
parser.add_argument("--file", help="Path to the metainfo.xml file",
|
||||
default="org.meshtastic.meshtasticd.metainfo.xml")
|
||||
parser.add_argument("version", help="Version string (e.g. 2.6.4)")
|
||||
parser.add_argument("--date", help="Release date (YYYY-MM-DD), defaults to today",
|
||||
default=datetime.now(timezone.utc).date().isoformat())
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
tree = parse(args.file)
|
||||
root = tree.getroot()
|
||||
|
||||
releases = root.find('releases')
|
||||
if releases is None:
|
||||
raise RuntimeError("<releases> element not found in XML.")
|
||||
|
||||
existing_versions = {
|
||||
release.get('version'): release
|
||||
for release in releases.findall('release')
|
||||
}
|
||||
existing_release = existing_versions.get(args.version)
|
||||
|
||||
if existing_release is not None:
|
||||
if not existing_release.get('date'):
|
||||
print(f"Version {args.version} found without date. Adding date...")
|
||||
existing_release.set('date', args.date)
|
||||
else:
|
||||
print(
|
||||
f"Version {args.version} is already present with date, skipping insertion.")
|
||||
else:
|
||||
new_release = ET.Element('release', {
|
||||
'version': args.version,
|
||||
'date': args.date
|
||||
})
|
||||
url = ET.SubElement(new_release, 'url', {'type': 'details'})
|
||||
url.text = f"https://github.com/meshtastic/firmware/releases?q=tag%3Av{args.version}"
|
||||
|
||||
releases.insert(0, new_release)
|
||||
|
||||
indent(releases, level=1)
|
||||
releases.tail = "\n"
|
||||
|
||||
print(f"Inserted new release: {args.version}")
|
||||
|
||||
tree.write(args.file, encoding='UTF-8', xml_declaration=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
1
bin/bump_metainfo/requirements.txt
Normal file
1
bin/bump_metainfo/requirements.txt
Normal file
@@ -0,0 +1 @@
|
||||
defusedxml==0.7.1
|
||||
@@ -6,6 +6,12 @@
|
||||
### Including the "Module:" line!
|
||||
---
|
||||
Lora:
|
||||
# Default to auto-detecting the module type
|
||||
# This will be overridden by configs from config.d
|
||||
Module: auto
|
||||
|
||||
# # Uncomment to enable Simulation mode, or use --sim
|
||||
# Module: sim
|
||||
|
||||
# Module: sx1262 # Waveshare SX1302 LISTEN ONLY AT THIS TIME!
|
||||
# CS: 7
|
||||
@@ -182,14 +188,22 @@ Logging:
|
||||
# AsciiLogs: true # default if not specified is !isatty() on stdout
|
||||
|
||||
Webserver:
|
||||
# Port: 443 # Port for Webserver & Webservices
|
||||
# Port: 9443 # Port for Webserver & Webservices
|
||||
# RootPath: /usr/share/meshtasticd/web # Root Dir of WebServer
|
||||
# SSLKey: /etc/meshtasticd/ssl/private_key.pem # Path to SSL Key, generated if not present
|
||||
# SSLCert: /etc/meshtasticd/ssl/certificate.pem # Path to SSL Certificate, generated if not present
|
||||
|
||||
|
||||
HostMetrics:
|
||||
# ReportInterval: 30 # Interval in minutes between HostMetrics report packets, or 0 for disabled
|
||||
# Channel: 0 # channel to send Host Metrics over. Defaults to the primary channel.
|
||||
# UserStringCommand: cat /sys/firmware/devicetree/base/serial-number # Command to execute, to send the results as the userString
|
||||
|
||||
|
||||
General:
|
||||
MaxNodes: 200
|
||||
MaxMessageQueue: 100
|
||||
ConfigDirectory: /etc/meshtasticd/config.d/
|
||||
AvailableDirectory: /etc/meshtasticd/available.d/
|
||||
# MACAddress: AA:BB:CC:DD:EE:FF
|
||||
# MACAddressSource: eth0
|
||||
# MACAddressSource: eth0
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# MeshAdv-Pi E22-900M30S
|
||||
# https://github.com/chrismyers2000/MeshAdv-Pi-Hat
|
||||
Lora:
|
||||
Module: sx1262
|
||||
CS: 21
|
||||
@@ -9,4 +11,4 @@ Lora:
|
||||
DIO3_TCXO_VOLTAGE: true
|
||||
# Only for E22-900M33S:
|
||||
# Limit the output power to 8 dBm
|
||||
# SX126X_MAX_POWER: 8
|
||||
# SX126X_MAX_POWER: 8
|
||||
|
||||
11
bin/config.d/lora-MeshAdv-Mini-900M22S.yaml
Normal file
11
bin/config.d/lora-MeshAdv-Mini-900M22S.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
# MeshAdv Mini E22-900M22S
|
||||
# https://github.com/chrismyers2000/MeshAdv-Mini
|
||||
Lora:
|
||||
Module: sx1262 # Ebyte E22-900M22S
|
||||
CS: 8
|
||||
IRQ: 16
|
||||
Busy: 20
|
||||
Reset: 24
|
||||
TXen: 13
|
||||
DIO2_AS_RF_SWITCH: true
|
||||
DIO3_TCXO_VOLTAGE: true
|
||||
11
bin/config.d/lora-piggystick-lr1121.yaml
Normal file
11
bin/config.d/lora-piggystick-lr1121.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
Lora:
|
||||
Module: lr1121
|
||||
CS: 0
|
||||
IRQ: 6
|
||||
Reset: 2
|
||||
Busy: 4
|
||||
spidev: ch341
|
||||
DIO3_TCXO_VOLTAGE: 1.8
|
||||
# USB_Serialnum: 12345678
|
||||
USB_PID: 0x5512
|
||||
USB_VID: 0x1A86
|
||||
@@ -17,8 +17,8 @@ SET "LOGCOUNTER=0"
|
||||
SET "S3=s3 v3 t-deck wireless-paper wireless-tracker station-g2 unphone"
|
||||
SET "C3=esp32c3"
|
||||
@REM FIXME: Determine flash size from PlatformIO variant, this is unmaintainable.
|
||||
SET "BIGDB_8MB=picomputer-s3 unphone seeed-sensecap-indicator crowpanel-esp32s3 heltec_capsule_sensor_v3 heltec-v3 heltec-vision-master-e213 heltec-vision-master-e290 heltec-vision-master-t190 heltec-wireless-paper heltec-wireless-tracker heltec-wsl-v3 icarus seeed-xiao-s3 tbeam-s3-core t-watch-s3 tracksenger"
|
||||
SET "BIGDB_16MB=t-deck mesh-tab t-energy-s3 dreamcatcher ESP32-S3-Pico m5stack-cores3 station-g2 t-eth-elite"
|
||||
SET "BIGDB_8MB=picomputer-s3 unphone seeed-sensecap-indicator crowpanel-esp32s3 heltec_capsule_sensor_v3 heltec-v3 heltec-vision-master-e213 heltec-vision-master-e290 heltec-vision-master-t190 heltec-wireless-paper heltec-wireless-tracker heltec-wsl-v3 icarus seeed-xiao-s3 tbeam-s3-core tracksenger"
|
||||
SET "BIGDB_16MB=t-deck mesh-tab t-energy-s3 dreamcatcher ESP32-S3-Pico m5stack-cores3 station-g2 t-eth-elite t-watch-s3"
|
||||
|
||||
GOTO getopts
|
||||
:help
|
||||
|
||||
@@ -22,7 +22,6 @@ BIGDB_8MB=(
|
||||
"icarus"
|
||||
"seeed-xiao-s3"
|
||||
"tbeam-s3-core"
|
||||
"t-watch-s3"
|
||||
"tracksenger"
|
||||
)
|
||||
BIGDB_16MB=(
|
||||
@@ -34,6 +33,7 @@ BIGDB_16MB=(
|
||||
"m5stack-cores3"
|
||||
"station-g2"
|
||||
"t-eth-elite"
|
||||
"t-watch-s3"
|
||||
)
|
||||
S3_VARIANTS=(
|
||||
"s3"
|
||||
@@ -43,6 +43,16 @@ S3_VARIANTS=(
|
||||
"wireless-tracker"
|
||||
"station-g2"
|
||||
"unphone"
|
||||
"t-eth-elite"
|
||||
"mesh-tab"
|
||||
"dreamcatcher"
|
||||
"ESP32-S3-Pico"
|
||||
"seeed-sensecap-indicator"
|
||||
"heltec_capsule_sensor_v3"
|
||||
"vision-master"
|
||||
"icarus"
|
||||
"tracksenger"
|
||||
"elecrow-adv"
|
||||
)
|
||||
|
||||
# Determine the correct esptool command to use
|
||||
@@ -138,7 +148,7 @@ if [ -f "${FILENAME}" ] && [ -n "${FILENAME##*"update"*}" ]; then
|
||||
|
||||
# littlefs* offset for BigDB 8mb and OTA OFFSET.
|
||||
for variant in "${BIGDB_8MB[@]}"; do
|
||||
if [ -n "${FILENAME##*"$variant"*}" ]; then
|
||||
if [ -z "${FILENAME##*"$variant"*}" ]; then
|
||||
OFFSET=0x670000
|
||||
OTA_OFFSET=0x340000
|
||||
fi
|
||||
@@ -146,7 +156,7 @@ if [ -f "${FILENAME}" ] && [ -n "${FILENAME##*"update"*}" ]; then
|
||||
|
||||
# littlefs* offset for BigDB 16mb and OTA OFFSET.
|
||||
for variant in "${BIGDB_16MB[@]}"; do
|
||||
if [ -n "${FILENAME##*"$variant"*}" ]; then
|
||||
if [ -z "${FILENAME##*"$variant"*}" ]; then
|
||||
OFFSET=0xc90000
|
||||
OTA_OFFSET=0x650000
|
||||
fi
|
||||
@@ -155,7 +165,7 @@ if [ -f "${FILENAME}" ] && [ -n "${FILENAME##*"update"*}" ]; then
|
||||
# Account for S3 board's different OTA partition
|
||||
# FIXME: Use PlatformIO info to determine MCU type, this is unmaintainable
|
||||
for variant in "${S3_VARIANTS[@]}"; do
|
||||
if [ -n "${FILENAME##*"$variant"*}" ]; then
|
||||
if [ -z "${FILENAME##*"$variant"*}" ]; then
|
||||
MCU="esp32s3"
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -5,10 +5,11 @@ StartLimitInterval=200
|
||||
StartLimitBurst=5
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
Group=root
|
||||
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||
User=meshtasticd
|
||||
Group=meshtasticd
|
||||
Type=simple
|
||||
ExecStart=/usr/sbin/meshtasticd
|
||||
ExecStart=/usr/bin/meshtasticd
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cp "release/meshtasticd_linux_$(uname -m)" /usr/sbin/meshtasticd
|
||||
cp "release/meshtasticd_linux_$(uname -m)" /usr/bin/meshtasticd
|
||||
mkdir -p /etc/meshtasticd
|
||||
if [[ -f "/etc/meshtasticd/config.yaml" ]]; then
|
||||
cp bin/config-dist.yaml /etc/meshtasticd/config-upgrade.yaml
|
||||
|
||||
8
bin/org.meshtastic.meshtasticd.desktop
Normal file
8
bin/org.meshtastic.meshtasticd.desktop
Normal file
@@ -0,0 +1,8 @@
|
||||
[Desktop Entry]
|
||||
Name=Meshtastic
|
||||
Comment=Meshtastic App
|
||||
Exec=meshtasticd
|
||||
Icon=org.meshtastic.meshtasticd
|
||||
Terminal=true
|
||||
Type=Application
|
||||
Categories=Network;Chat;HamRadio;
|
||||
112
bin/org.meshtastic.meshtasticd.metainfo.xml
Normal file
112
bin/org.meshtastic.meshtasticd.metainfo.xml
Normal file
@@ -0,0 +1,112 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<component type="desktop-application">
|
||||
<id>org.meshtastic.meshtasticd</id>
|
||||
|
||||
<name>Meshtastic</name>
|
||||
<summary>Decentralized mesh communication</summary>
|
||||
|
||||
<metadata_license>CC-BY-4.0</metadata_license>
|
||||
<project_license>GPL-3.0-or-later</project_license>
|
||||
|
||||
<developer id="org.meshtastic">
|
||||
<name>Meshtastic</name>
|
||||
</developer>
|
||||
|
||||
<description>
|
||||
<p>
|
||||
Meshtastic is an open source project for creating off-grid, affordable, and resilient communication with LoRa mesh networks.
|
||||
</p>
|
||||
</description>
|
||||
|
||||
<launchable type="desktop-id">org.meshtastic.meshtasticd.desktop</launchable>
|
||||
|
||||
<categories>
|
||||
<category>Network</category>
|
||||
<category>Chat</category>
|
||||
<category>HamRadio</category>
|
||||
</categories>
|
||||
<keywords>
|
||||
<keyword>mesh</keyword>
|
||||
<keyword>LoRa</keyword>
|
||||
</keywords>
|
||||
|
||||
<recommends>
|
||||
<control>keyboard</control>
|
||||
<control>pointing</control>
|
||||
<control>touch</control>
|
||||
</recommends>
|
||||
<requires>
|
||||
<display_length compare="ge">360</display_length>
|
||||
</requires>
|
||||
|
||||
<branding>
|
||||
<color type="primary" scheme_preference="light">#97be89</color>
|
||||
<color type="primary" scheme_preference="dark">#206538</color>
|
||||
</branding>
|
||||
|
||||
<content_rating type="oars-1.1">
|
||||
<content_attribute id="social-chat">intense</content_attribute>
|
||||
<content_attribute id="social-location">intense</content_attribute>
|
||||
</content_rating>
|
||||
|
||||
<url type="bugtracker">https://github.com/meshtastic/firmware/issues</url>
|
||||
<url type="homepage">https://meshtastic.org/</url>
|
||||
<url type="donation">https://opencollective.com/meshtastic</url>
|
||||
<url type="faq">https://meshtastic.org/docs/software/linux/usage/</url>
|
||||
<url type="vcs-browser">https://github.com/meshtastic/firmware/</url>
|
||||
|
||||
<screenshots>
|
||||
<screenshot type="default">
|
||||
<image>https://meshtastic.org/img/software/meshtastic-ui/mui_home_dashboard_dark.webp</image>
|
||||
<caption>Home Dashboard</caption>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image>https://meshtastic.org/img/software/meshtastic-ui/mui_initial_boot.webp</image>
|
||||
<caption>Setup</caption>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image>https://meshtastic.org/img/software/meshtastic-ui/mui_node_list_dark.webp</image>
|
||||
<caption>Nodes List</caption>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image>https://meshtastic.org/img/software/meshtastic-ui/mui_chat_list_dark.webp</image>
|
||||
<caption>Chats List</caption>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image>https://meshtastic.org/img/software/meshtastic-ui/mui_chat_message_dark.webp</image>
|
||||
<caption>Messages</caption>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image>https://meshtastic.org/img/software/meshtastic-ui/mui_map_dark.webp</image>
|
||||
<caption>Map</caption>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image>https://meshtastic.org/img/software/meshtastic-ui/mui_settings_dark.webp</image>
|
||||
<caption>Settings</caption>
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
|
||||
<releases>
|
||||
<release version="2.6.10" date="2025-05-25">
|
||||
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.6.10</url>
|
||||
</release>
|
||||
<release version="2.6.9" date="2025-05-15">
|
||||
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.6.9</url>
|
||||
</release>
|
||||
<release version="2.6.8" date="2025-05-05">
|
||||
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.6.8</url>
|
||||
</release>
|
||||
<release version="2.6.7" date="2025-04-28">
|
||||
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.6.7</url>
|
||||
</release>
|
||||
<release version="2.6.6" date="2025-04-15">
|
||||
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.6.6</url>
|
||||
</release>
|
||||
<release version="2.6.5" date="2025-03-30">
|
||||
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.6.5</url>
|
||||
</release>
|
||||
<release version="2.6.4" date="2025-03-28">
|
||||
<url type="details">https://github.com/meshtastic/firmware/releases?q=tag%3Av2.6.4</url>
|
||||
</release>
|
||||
</releases>
|
||||
</component>
|
||||
16
bin/org.meshtastic.meshtasticd.svg
Normal file
16
bin/org.meshtastic.meshtasticd.svg
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="512" height="512" viewBox="0 0 512 512" xml:space="preserve">
|
||||
<desc>Created with Fabric.js 4.6.0</desc>
|
||||
<defs>
|
||||
</defs>
|
||||
<g transform="matrix(1 0 0 1 256 256)" id="xYQ9Gk9Jwpgj_HMOXB3F_" >
|
||||
<path style="stroke: rgb(213,130,139); stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(103,234,148); fill-rule: nonzero; opacity: 1;" vector-effect="non-scaling-stroke" transform=" translate(-256, -256)" d="M 0 0 L 512 0 L 512 512 L 0 512 z" stroke-linecap="round" />
|
||||
</g>
|
||||
<g transform="matrix(1.79 0 0 1.79 313.74 258.36)" id="1xBsk2n9FZp60Rz1O-ceJ" >
|
||||
<path style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: round; stroke-miterlimit: 2; fill: rgb(44,45,60); fill-rule: evenodd; opacity: 1;" vector-effect="non-scaling-stroke" transform=" translate(-250.97, -362.41)" d="M 250.908 330.267 L 193.126 415.005 L 180.938 406.694 L 244.802 313.037 C 246.174 311.024 248.453 309.819 250.889 309.816 C 253.326 309.814 255.606 311.015 256.982 313.026 L 320.994 406.536 L 308.821 414.869 L 250.908 330.267 Z" stroke-linecap="round" />
|
||||
</g>
|
||||
<g transform="matrix(1.81 0 0 1.81 145 256.15)" id="KxN7E9YpbyPgz0S4z4Cl6" >
|
||||
<path style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: round; stroke-miterlimit: 2; fill: rgb(44,45,60); fill-rule: evenodd; opacity: 1;" vector-effect="non-scaling-stroke" transform=" translate(-115.14, -528.06)" d="M 87.642 581.398 L 154.757 482.977 L 142.638 474.713 L 75.523 573.134 L 87.642 581.398 Z" stroke-linecap="round" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
@@ -2,6 +2,10 @@ function meshtastic_version {
|
||||
meshtastic_version=$(python3 bin/buildinfo.py short)
|
||||
echo -n "$meshtastic_version"
|
||||
}
|
||||
function web_version {
|
||||
web_version=$(cat bin/web.version)
|
||||
echo -n "$web_version"
|
||||
}
|
||||
function git_commits_num {
|
||||
total_commits=$(git rev-list --all --count)
|
||||
echo -n "$total_commits"
|
||||
|
||||
1
bin/web.version
Normal file
1
bin/web.version
Normal file
@@ -0,0 +1 @@
|
||||
2.5.3
|
||||
43
boards/crowpanel.json
Normal file
43
boards/crowpanel.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"ldscript": "esp32s3_out.ld",
|
||||
"memory_type": "qio_opi",
|
||||
"partitions": "default_16MB.csv"
|
||||
},
|
||||
"core": "esp32",
|
||||
"extra_flags": [
|
||||
"-DBOARD_HAS_PSRAM",
|
||||
"-DARDUINO_USB_CDC_ON_BOOT=0",
|
||||
"-DARDUINO_USB_MODE=1",
|
||||
"-DARDUINO_RUNNING_CORE=1",
|
||||
"-DARDUINO_EVENT_RUNNING_CORE=0"
|
||||
],
|
||||
"f_cpu": "240000000L",
|
||||
"f_flash": "80000000L",
|
||||
"flash_mode": "qio",
|
||||
"hwids": [["0x303A", "0x1001"]],
|
||||
"mcu": "esp32s3",
|
||||
"variant": "ESP32-S3-WROOM-1-N16R8"
|
||||
},
|
||||
"connectivity": ["wifi", "bluetooth", "lora"],
|
||||
"debug": {
|
||||
"default_tool": "esp-builtin",
|
||||
"onboard_tools": ["esp-builtin"],
|
||||
"openocd_target": "esp32s3.cfg"
|
||||
},
|
||||
"frameworks": ["arduino", "espidf"],
|
||||
"name": "ESP32-S3-WROOM-1-N16R8 (16 MB Flash, 8 MB PSRAM)",
|
||||
"upload": {
|
||||
"flash_size": "16MB",
|
||||
"maximum_ram_size": 524288,
|
||||
"maximum_size": 16777216,
|
||||
"require_upload_port": true,
|
||||
"speed": 921600
|
||||
},
|
||||
"monitor": {
|
||||
"speed": 115200
|
||||
},
|
||||
"url": "https://www.espressif.com/sites/default/files/documentation/esp32-s3-wroom-1_wroom-1u_datasheet_en.pdf",
|
||||
"vendor": "Espressif"
|
||||
}
|
||||
53
boards/heltec_mesh_pocket.json
Normal file
53
boards/heltec_mesh_pocket.json
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"ldscript": "nrf52840_s140_v6.ld"
|
||||
},
|
||||
"core": "nRF5",
|
||||
"cpu": "cortex-m4",
|
||||
"extra_flags": "-DNRF52840_XXAA",
|
||||
"f_cpu": "64000000L",
|
||||
"hwids": [
|
||||
["0x239A", "0x4405"],
|
||||
["0x239A", "0x0029"],
|
||||
["0x239A", "0x002A"]
|
||||
],
|
||||
"usb_product": "HT-n5262",
|
||||
"mcu": "nrf52840",
|
||||
"variant": "heltec_mesh_pocket",
|
||||
"variants_dir": "variants",
|
||||
"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",
|
||||
"onboard_tools": ["jlink"],
|
||||
"svd_path": "nrf52840.svd",
|
||||
"openocd_target": "nrf52840-mdk-rs"
|
||||
},
|
||||
"frameworks": ["arduino"],
|
||||
"name": "Heltec nrf (Adafruit BSP)",
|
||||
"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": "https://heltec.org/project/meshpocket/",
|
||||
"vendor": "Heltec"
|
||||
}
|
||||
@@ -2,7 +2,8 @@
|
||||
"build": {
|
||||
"arduino": {
|
||||
"ldscript": "esp32s3_out.ld",
|
||||
"partitions": "default_8MB.csv"
|
||||
"partitions": "default_8MB.csv",
|
||||
"memory_type": "qio_opi"
|
||||
},
|
||||
"core": "esp32",
|
||||
"extra_flags": [
|
||||
@@ -15,6 +16,7 @@
|
||||
"f_cpu": "240000000L",
|
||||
"f_flash": "80000000L",
|
||||
"flash_mode": "qio",
|
||||
"psram_type": "opi",
|
||||
"hwids": [
|
||||
["0x303A", "0x1001"],
|
||||
["0x303A", "0x0002"]
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
"build": {
|
||||
"arduino": {
|
||||
"ldscript": "esp32s3_out.ld",
|
||||
"partitions": "default_8MB.csv"
|
||||
"partitions": "default_8MB.csv",
|
||||
"memory_type": "qio_opi"
|
||||
},
|
||||
"core": "esp32",
|
||||
"extra_flags": [
|
||||
@@ -15,6 +16,7 @@
|
||||
"f_cpu": "240000000L",
|
||||
"f_flash": "80000000L",
|
||||
"flash_mode": "qio",
|
||||
"psram_type": "opi",
|
||||
"hwids": [
|
||||
["0x303A", "0x1001"],
|
||||
["0x303A", "0x0002"]
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
"build": {
|
||||
"arduino": {
|
||||
"ldscript": "esp32s3_out.ld",
|
||||
"partitions": "default_8MB.csv"
|
||||
"partitions": "default_8MB.csv",
|
||||
"memory_type": "qio_opi"
|
||||
},
|
||||
"core": "esp32",
|
||||
"extra_flags": [
|
||||
@@ -15,6 +16,7 @@
|
||||
"f_cpu": "240000000L",
|
||||
"f_flash": "80000000L",
|
||||
"flash_mode": "qio",
|
||||
"psram_type": "opi",
|
||||
"hwids": [
|
||||
["0x303A", "0x1001"],
|
||||
["0x303A", "0x0002"]
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"f_boot": "120000000L",
|
||||
"boot": "qio",
|
||||
"flash_mode": "qio",
|
||||
"psram_type": "opi",
|
||||
"hwids": [["0x1A86", "0x7523"]],
|
||||
"mcu": "esp32s3",
|
||||
"variant": "esp32s3"
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"f_cpu": "240000000L",
|
||||
"f_flash": "80000000L",
|
||||
"flash_mode": "qio",
|
||||
"psram_type": "opi",
|
||||
"hwids": [["0x2886", "0x0059"]],
|
||||
"mcu": "esp32s3",
|
||||
"variant": "seeed-xiao-s3"
|
||||
|
||||
54
boards/seeed_solar_node.json
Normal file
54
boards/seeed_solar_node.json
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"ldscript": "nrf52840_s140_v7.ld"
|
||||
},
|
||||
"core": "nRF5",
|
||||
"cpu": "cortex-m4",
|
||||
"extra_flags": "-DARDUINO_MDBT50Q_RX -DNRF52840_XXAA",
|
||||
"f_cpu": "64000000L",
|
||||
"hwids": [["0x2886", "0x0059"]],
|
||||
"usb_product": "XIAO-BOOT",
|
||||
"mcu": "nrf52840",
|
||||
"variant": "seeed_solar_node",
|
||||
"bsp": {
|
||||
"name": "adafruit"
|
||||
},
|
||||
"softdevice": {
|
||||
"sd_flags": "-DS140",
|
||||
"sd_name": "s140",
|
||||
"sd_version": "7.3.0",
|
||||
"sd_fwid": "0x0123"
|
||||
},
|
||||
"bootloader": {
|
||||
"settings_addr": "0xFF000"
|
||||
}
|
||||
},
|
||||
"connectivity": ["bluetooth"],
|
||||
"debug": {
|
||||
"jlink_device": "nRF52840_xxAA",
|
||||
"svd_path": "nrf52840.svd",
|
||||
"openocd_target": "nrf52840-mdk-rs"
|
||||
},
|
||||
"frameworks": ["arduino"],
|
||||
"name": "seeed_solar_node",
|
||||
"upload": {
|
||||
"maximum_ram_size": 248832,
|
||||
"maximum_size": 815104,
|
||||
"speed": 115200,
|
||||
"protocol": "nrfutil",
|
||||
"protocols": [
|
||||
"jlink",
|
||||
"nrfjprog",
|
||||
"nrfutil",
|
||||
"stlink",
|
||||
"cmsis-dap",
|
||||
"blackmagic"
|
||||
],
|
||||
"use_1200bps_touch": true,
|
||||
"require_upload_port": true,
|
||||
"wait_for_upload_port": true
|
||||
},
|
||||
"url": "https://www.seeedstudio.com/Seeed-XIAO-BLE-Sense-nRF52840-p-5253.html",
|
||||
"vendor": "Seeed Studio"
|
||||
}
|
||||
54
boards/seeed_wio_tracker_L1.json
Normal file
54
boards/seeed_wio_tracker_L1.json
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"ldscript": "nrf52840_s140_v7.ld"
|
||||
},
|
||||
"core": "nRF5",
|
||||
"cpu": "cortex-m4",
|
||||
"extra_flags": "-DARDUINO_MDBT50Q_RX -DNRF52840_XXAA",
|
||||
"f_cpu": "64000000L",
|
||||
"hwids": [["0x2886", "0x1668"]],
|
||||
"usb_product": "TRACKER L1",
|
||||
"mcu": "nrf52840",
|
||||
"variant": "seeed_wio_tracker_L1",
|
||||
"bsp": {
|
||||
"name": "adafruit"
|
||||
},
|
||||
"softdevice": {
|
||||
"sd_flags": "-DS140",
|
||||
"sd_name": "s140",
|
||||
"sd_version": "7.3.0",
|
||||
"sd_fwid": "0x0123"
|
||||
},
|
||||
"bootloader": {
|
||||
"settings_addr": "0xFF000"
|
||||
}
|
||||
},
|
||||
"connectivity": ["bluetooth"],
|
||||
"debug": {
|
||||
"jlink_device": "nRF52840_xxAA",
|
||||
"svd_path": "nrf52840.svd",
|
||||
"openocd_target": "nrf52840-mdk-rs"
|
||||
},
|
||||
"frameworks": ["arduino"],
|
||||
"name": "seeed_wio_tracker_L1",
|
||||
"upload": {
|
||||
"maximum_ram_size": 248832,
|
||||
"maximum_size": 815104,
|
||||
"speed": 115200,
|
||||
"protocol": "nrfutil",
|
||||
"protocols": [
|
||||
"jlink",
|
||||
"nrfjprog",
|
||||
"nrfutil",
|
||||
"stlink",
|
||||
"cmsis-dap",
|
||||
"blackmagic"
|
||||
],
|
||||
"use_1200bps_touch": true,
|
||||
"require_upload_port": true,
|
||||
"wait_for_upload_port": true
|
||||
},
|
||||
"url": "https://www.seeedstudio.com/Wio-Tracker-L1-p-6477.html",
|
||||
"vendor": "Seeed Studio"
|
||||
}
|
||||
@@ -16,6 +16,7 @@
|
||||
"f_cpu": "240000000L",
|
||||
"f_flash": "80000000L",
|
||||
"flash_mode": "qio",
|
||||
"psram_type": "opi",
|
||||
"hwids": [
|
||||
["0x303A", "0x1001"],
|
||||
["0x303A", "0x0002"]
|
||||
@@ -23,16 +24,16 @@
|
||||
"mcu": "esp32s3",
|
||||
"variant": "t-watch-s3"
|
||||
},
|
||||
"connectivity": ["wifi"],
|
||||
"connectivity": ["wifi", "bluetooth", "lora"],
|
||||
"debug": {
|
||||
"openocd_target": "esp32s3.cfg"
|
||||
},
|
||||
"frameworks": ["arduino"],
|
||||
"name": "LilyGo T-Watch 2020 V3",
|
||||
"upload": {
|
||||
"flash_size": "8MB",
|
||||
"flash_size": "16MB",
|
||||
"maximum_ram_size": 327680,
|
||||
"maximum_size": 8388608,
|
||||
"maximum_size": 16777216,
|
||||
"require_upload_port": true,
|
||||
"use_1200bps_touch": true,
|
||||
"wait_for_upload_port": true,
|
||||
|
||||
14
debian/changelog
vendored
14
debian/changelog
vendored
@@ -1,9 +1,19 @@
|
||||
meshtasticd (2.5.22.0) UNRELEASED; urgency=medium
|
||||
meshtasticd (2.6.10.0) UNRELEASED; urgency=medium
|
||||
|
||||
[ Austin Lane ]
|
||||
* Initial packaging
|
||||
* GitHub Actions Automatic version bump
|
||||
* GitHub Actions Automatic version bump
|
||||
* GitHub Actions Automatic version bump
|
||||
* GitHub Actions Automatic version bump
|
||||
|
||||
-- Austin Lane <github-actions[bot]@users.noreply.github.com> Wed, 05 Feb 2025 01:10:33 +0000
|
||||
[ ]
|
||||
* GitHub Actions Automatic version bump
|
||||
|
||||
[ ]
|
||||
* 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
|
||||
|
||||
9
debian/ci_pack_sdeb.sh
vendored
9
debian/ci_pack_sdeb.sh
vendored
@@ -5,13 +5,14 @@ export PLATFORMIO_PACKAGES_DIR=pio/packages
|
||||
export PLATFORMIO_CORE_DIR=pio/core
|
||||
|
||||
# Download libraries to `pio`
|
||||
platformio pkg install -e native
|
||||
platformio pkg install -e native -t platformio/tool-scons@4.40502.0
|
||||
platformio pkg install -e native-tft
|
||||
platformio pkg install -e native-tft -t platformio/tool-scons@4.40502.0
|
||||
# Compress `pio` directory to prevent dh_clean from sanitizing it
|
||||
tar -cf pio.tar pio/
|
||||
rm -rf pio
|
||||
# Download the latest meshtastic/web release build.tar to `web.tar`
|
||||
curl -L https://github.com/meshtastic/web/releases/latest/download/build.tar -o web.tar
|
||||
# Download the meshtastic/web release build.tar to `web.tar`
|
||||
web_ver=$(cat bin/web.version)
|
||||
curl -L "https://github.com/meshtastic/web/releases/download/v$web_ver/build.tar" -o web.tar
|
||||
|
||||
package=$(dpkg-parsechangelog --show-field Source)
|
||||
|
||||
|
||||
11
debian/control
vendored
11
debian/control
vendored
@@ -21,14 +21,19 @@ Build-Depends: debhelper-compat (= 13),
|
||||
openssl,
|
||||
libssl-dev,
|
||||
libulfius-dev,
|
||||
liborcania-dev
|
||||
liborcania-dev,
|
||||
libx11-dev,
|
||||
libinput-dev,
|
||||
libxkbcommon-x11-dev
|
||||
Standards-Version: 4.6.2
|
||||
Homepage: https://github.com/meshtastic/firmware
|
||||
Rules-Requires-Root: no
|
||||
|
||||
Package: meshtasticd
|
||||
Architecture: any
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
Depends: adduser,
|
||||
${misc:Depends},
|
||||
${shlibs:Depends}
|
||||
Description: Meshtastic daemon for communicating with Meshtastic devices
|
||||
Meshtastic is an off-grid text communication platform that uses inexpensive
|
||||
LoRa radios.
|
||||
LoRa radios.
|
||||
|
||||
3
debian/meshtasticd.dirs
vendored
3
debian/meshtasticd.dirs
vendored
@@ -1,5 +1,6 @@
|
||||
var/lib/meshtasticd
|
||||
etc/meshtasticd
|
||||
etc/meshtasticd/config.d
|
||||
etc/meshtasticd/available.d
|
||||
usr/share/meshtasticd/web
|
||||
etc/meshtasticd/ssl
|
||||
etc/meshtasticd/ssl
|
||||
|
||||
10
debian/meshtasticd.install
vendored
10
debian/meshtasticd.install
vendored
@@ -1,8 +1,8 @@
|
||||
.pio/build/native/meshtasticd usr/sbin
|
||||
.pio/build/native-tft/meshtasticd usr/bin
|
||||
|
||||
bin/config.yaml etc/meshtasticd
|
||||
bin/config.d/* etc/meshtasticd/available.d
|
||||
bin/config.yaml etc/meshtasticd
|
||||
bin/config.d/* etc/meshtasticd/available.d
|
||||
|
||||
bin/meshtasticd.service lib/systemd/system
|
||||
bin/meshtasticd.service lib/systemd/system
|
||||
|
||||
web/* usr/share/meshtasticd/web
|
||||
web/* usr/share/meshtasticd/web
|
||||
|
||||
80
debian/meshtasticd.postinst
vendored
Executable file
80
debian/meshtasticd.postinst
vendored
Executable file
@@ -0,0 +1,80 @@
|
||||
#!/bin/sh
|
||||
# postinst script for meshtasticd
|
||||
#
|
||||
# see: dh_installdeb(1)
|
||||
|
||||
set -e
|
||||
|
||||
# summary of how this script can be called:
|
||||
# * <postinst> `configure' <most-recently-configured-version>
|
||||
# * <old-postinst> `abort-upgrade' <new version>
|
||||
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
|
||||
# <new-version>
|
||||
# * <postinst> `abort-remove'
|
||||
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
|
||||
# <failed-install-package> <version> `removing'
|
||||
# <conflicting-package> <version>
|
||||
# for details, see http://www.debian.org/doc/debian-policy/ or
|
||||
# the debian-policy package
|
||||
|
||||
|
||||
case "$1" in
|
||||
configure|reconfigure)
|
||||
# create spi, gpio groups (for udev rules)
|
||||
# these groups already exist on Raspberry Pi OS
|
||||
getent group spi >/dev/null 2>/dev/null || addgroup --system spi
|
||||
getent group gpio >/dev/null 2>/dev/null || addgroup --system gpio
|
||||
# create a meshtasticd group and user
|
||||
getent passwd meshtasticd >/dev/null 2>/dev/null || adduser --system --home /var/lib/meshtasticd --no-create-home meshtasticd
|
||||
getent group meshtasticd >/dev/null 2>/dev/null || addgroup --system meshtasticd
|
||||
adduser meshtasticd meshtasticd >/dev/null 2>/dev/null
|
||||
adduser meshtasticd spi >/dev/null 2>/dev/null
|
||||
adduser meshtasticd gpio >/dev/null 2>/dev/null
|
||||
# add meshtasticd user to appropriate groups (if they exist)
|
||||
getent group plugdev >/dev/null 2>/dev/null && adduser meshtasticd plugdev >/dev/null 2>/dev/null
|
||||
getent group dialout >/dev/null 2>/dev/null && adduser meshtasticd dialout >/dev/null 2>/dev/null
|
||||
getent group i2c >/dev/null 2>/dev/null && adduser meshtasticd i2c >/dev/null 2>/dev/null
|
||||
getent group video >/dev/null 2>/dev/null && adduser meshtasticd video >/dev/null 2>/dev/null
|
||||
getent group audio >/dev/null 2>/dev/null && adduser meshtasticd audio >/dev/null 2>/dev/null
|
||||
getent group input >/dev/null 2>/dev/null && adduser meshtasticd input >/dev/null 2>/dev/null
|
||||
|
||||
|
||||
# migrate /root/.portduino to /var/lib/meshtasticd/.portduino
|
||||
# should only run once, upon upgrade from < 2.6.9
|
||||
if [ -n "$2" ] && dpkg --compare-versions "$2" lt 2.6.9; then
|
||||
if [ -d /root/.portduino ] && [ ! -e /var/lib/meshtasticd/.portduino ]; then
|
||||
cp -r /root/.portduino /var/lib/meshtasticd/.portduino
|
||||
echo "Migrated meshtasticd VFS from /root/.portduino to /var/lib/meshtasticd/.portduino"
|
||||
echo "meshtasticd now runs as the 'meshtasticd' user, not 'root'."
|
||||
echo "See https://github.com/meshtastic/firmware/pull/6718 for details"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d /var/lib/meshtasticd ]; then
|
||||
chown -R meshtasticd:meshtasticd /var/lib/meshtasticd
|
||||
fi
|
||||
|
||||
if [ -d /etc/meshtasticd ]; then
|
||||
chown -R meshtasticd:meshtasticd /etc/meshtasticd
|
||||
fi
|
||||
|
||||
if [ -d /usr/share/meshtasticd ]; then
|
||||
chown -R meshtasticd:meshtasticd /usr/share/meshtasticd
|
||||
fi
|
||||
;;
|
||||
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postinst called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# dh_installdeb will replace this with shell code automatically
|
||||
# generated by other debhelper scripts.
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
||||
41
debian/meshtasticd.postrm
vendored
Executable file
41
debian/meshtasticd.postrm
vendored
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
# postrm script for meshtasticd
|
||||
#
|
||||
# see: dh_installdeb(1)
|
||||
|
||||
set -e
|
||||
|
||||
# summary of how this script can be called:
|
||||
# * <postrm> `remove'
|
||||
# * <postrm> `purge'
|
||||
# * <old-postrm> `upgrade' <new-version>
|
||||
# * <new-postrm> `failed-upgrade' <old-version>
|
||||
# * <new-postrm> `abort-install'
|
||||
# * <new-postrm> `abort-install' <old-version>
|
||||
# * <new-postrm> `abort-upgrade' <old-version>
|
||||
# * <disappearer's-postrm> `disappear' <overwriter>
|
||||
# <overwriter-version>
|
||||
# for details, see http://www.debian.org/doc/debian-policy/ or
|
||||
# the debian-policy package
|
||||
|
||||
|
||||
case "$1" in
|
||||
purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
|
||||
# Only remove /var/lib/meshtasticd on purge
|
||||
if [ "${1}" = "purge" ] ; then
|
||||
rm -rf /var/lib/meshtasticd
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postrm called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# dh_installdeb will replace this with shell code automatically
|
||||
# generated by other debhelper scripts.
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
||||
7
debian/meshtasticd.udev
vendored
Normal file
7
debian/meshtasticd.udev
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
# Set spidev ownership to 'spi' group
|
||||
SUBSYSTEM=="spidev", KERNEL=="spidev*", GROUP="spi", MODE="0660"
|
||||
# Allow access to USB CH341 devices
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="5512", MODE="0666"
|
||||
# Set gpio ownership to 'gpio' group
|
||||
SUBSYSTEM=="*gpiomem*", GROUP="gpio", MODE="0660"
|
||||
SUBSYSTEM=="gpio", GROUP="gpio", MODE="0660"
|
||||
4
debian/rules
vendored
4
debian/rules
vendored
@@ -26,7 +26,7 @@ override_dh_auto_build:
|
||||
mkdir -p web && tar -xf web.tar -C web
|
||||
gunzip web/ -r
|
||||
# Build with platformio
|
||||
$(PIO_ENV) platformio run -e native
|
||||
$(PIO_ENV) platformio run -e native-tft
|
||||
# Move the binary and default config to the correct name
|
||||
mv .pio/build/native/program .pio/build/native/meshtasticd
|
||||
mv .pio/build/native-tft/program .pio/build/native-tft/meshtasticd
|
||||
cp bin/config-dist.yaml bin/config.yaml
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
# - https://docs.pagure.org/rpkg-util/v3/index.html
|
||||
# - https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/
|
||||
|
||||
%global meshtasticd_user meshtasticd
|
||||
|
||||
Name: meshtasticd
|
||||
# Version Ex: 2.5.19
|
||||
Version: {{{ meshtastic_version }}}
|
||||
@@ -21,7 +23,7 @@ Summary: Meshtastic daemon for communicating with Meshtastic devices
|
||||
License: GPL-3.0
|
||||
URL: https://github.com/meshtastic/firmware
|
||||
Source0: {{{ git_dir_pack }}}
|
||||
Source1: https://github.com/meshtastic/web/releases/latest/download/build.tar
|
||||
Source1: https://github.com/meshtastic/web/releases/download/v{{{ web_version }}}/build.tar
|
||||
|
||||
BuildRequires: systemd-rpm-macros
|
||||
BuildRequires: python3-devel
|
||||
@@ -42,6 +44,12 @@ BuildRequires: pkgconfig(openssl)
|
||||
BuildRequires: pkgconfig(liborcania)
|
||||
BuildRequires: pkgconfig(libyder)
|
||||
BuildRequires: pkgconfig(libulfius)
|
||||
# TFT components:
|
||||
BuildRequires: pkgconfig(x11)
|
||||
BuildRequires: pkgconfig(libinput)
|
||||
BuildRequires: pkgconfig(xkbcommon-x11)
|
||||
|
||||
Requires: systemd-udev
|
||||
|
||||
%description
|
||||
Meshtastic daemon for controlling Meshtastic devices. Meshtastic is an off-grid
|
||||
@@ -55,19 +63,29 @@ tar -xf %{SOURCE1} -C web
|
||||
gzip -dr web
|
||||
|
||||
%build
|
||||
# Use the “native” environment from platformio to build a Linux binary
|
||||
platformio run -e native
|
||||
# Use the “native-tft” environment from platformio to build a Linux binary
|
||||
platformio run -e native-tft
|
||||
|
||||
%install
|
||||
mkdir -p %{buildroot}%{_sbindir}
|
||||
install -m 0755 .pio/build/native/program %{buildroot}%{_sbindir}/meshtasticd
|
||||
# Install meshtasticd binary
|
||||
mkdir -p %{buildroot}%{_bindir}
|
||||
install -m 0755 .pio/build/native-tft/program %{buildroot}%{_bindir}/meshtasticd
|
||||
|
||||
# Install portduino VFS dir
|
||||
install -p -d -m 0770 %{buildroot}%{_localstatedir}/lib/meshtasticd
|
||||
|
||||
# Install udev rules
|
||||
mkdir -p %{buildroot}%{_udevrulesdir}
|
||||
install -m 0644 bin/99-meshtasticd-udev.rules %{buildroot}%{_udevrulesdir}/99-meshtasticd-udev.rules
|
||||
|
||||
# Install config dirs
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/meshtasticd
|
||||
install -m 0644 bin/config-dist.yaml %{buildroot}%{_sysconfdir}/meshtasticd/config.yaml
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/meshtasticd/config.d
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/meshtasticd/available.d
|
||||
cp -r bin/config.d/* %{buildroot}%{_sysconfdir}/meshtasticd/available.d
|
||||
|
||||
# Install systemd service
|
||||
install -D -m 0644 bin/meshtasticd.service %{buildroot}%{_unitdir}/meshtasticd.service
|
||||
|
||||
# Install the web files under /usr/share/meshtasticd/web
|
||||
@@ -76,10 +94,54 @@ cp -r web/* %{buildroot}%{_datadir}/meshtasticd/web
|
||||
# Install default SSL storage directory (for web)
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/meshtasticd/ssl
|
||||
|
||||
%pre
|
||||
# create spi group (for udev rules)
|
||||
getent group spi > /dev/null || groupadd -r spi
|
||||
# create a meshtasticd group and user
|
||||
getent group %{meshtasticd_user} > /dev/null || groupadd -r %{meshtasticd_user}
|
||||
getent passwd %{meshtasticd_user} > /dev/null || \
|
||||
useradd -r -d %{_localstatedir}/lib/meshtasticd -g %{meshtasticd_user} -G spi \
|
||||
-s /sbin/nologin -c "Meshtastic Daemon" %{meshtasticd_user}
|
||||
# add meshtasticd user to appropriate groups (if they exist)
|
||||
getent group gpio > /dev/null && usermod -a -G gpio %{meshtasticd_user} > /dev/null
|
||||
getent group plugdev > /dev/null && usermod -a -G plugdev %{meshtasticd_user} > /dev/null
|
||||
getent group dialout > /dev/null && usermod -a -G dialout %{meshtasticd_user} > /dev/null
|
||||
getent group i2c > /dev/null && usermod -a -G i2c %{meshtasticd_user} > /dev/null
|
||||
getent group video > /dev/null && usermod -a -G video %{meshtasticd_user} > /dev/null
|
||||
getent group audio > /dev/null && usermod -a -G audio %{meshtasticd_user} > /dev/null
|
||||
getent group input > /dev/null && usermod -a -G input %{meshtasticd_user} > /dev/null
|
||||
exit 0
|
||||
|
||||
%triggerin -- meshtasticd < 2.6.9
|
||||
# migrate .portduino (if it exists and hasn’t already been copied)
|
||||
if [ -d /root/.portduino ] && [ ! -e /var/lib/meshtasticd/.portduino ]; then
|
||||
mkdir -p /var/lib/meshtasticd
|
||||
cp -r /root/.portduino /var/lib/meshtasticd/.portduino
|
||||
chown -R %{meshtasticd_user}:%{meshtasticd_user} \
|
||||
%{_localstatedir}/lib/meshtasticd || :
|
||||
# Fix SELinux labels if present (no-op on non-SELinux systems)
|
||||
restorecon -R /var/lib/meshtasticd/.portduino 2>/dev/null || :
|
||||
echo "Migrated meshtasticd VFS from /root/.portduino to /var/lib/meshtasticd/.portduino"
|
||||
echo "meshtasticd now runs as the 'meshtasticd' user, not 'root'."
|
||||
echo "See https://github.com/meshtastic/firmware/pull/6718 for details"
|
||||
fi
|
||||
|
||||
%post
|
||||
%systemd_post meshtasticd.service
|
||||
|
||||
%preun
|
||||
%systemd_preun meshtasticd.service
|
||||
|
||||
%postun
|
||||
%systemd_postun_with_restart meshtasticd.service
|
||||
|
||||
%files
|
||||
%defattr(-,%{meshtasticd_user},%{meshtasticd_user})
|
||||
%license LICENSE
|
||||
%doc README.md
|
||||
%{_sbindir}/meshtasticd
|
||||
%{_bindir}/meshtasticd
|
||||
%dir %{_localstatedir}/lib/meshtasticd
|
||||
%{_udevrulesdir}/99-meshtasticd-udev.rules
|
||||
%dir %{_sysconfdir}/meshtasticd
|
||||
%dir %{_sysconfdir}/meshtasticd/config.d
|
||||
%dir %{_sysconfdir}/meshtasticd/available.d
|
||||
@@ -92,4 +154,4 @@ mkdir -p %{buildroot}%{_sysconfdir}/meshtasticd/ssl
|
||||
%dir %{_sysconfdir}/meshtasticd/ssl
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
||||
%autochangelog
|
||||
|
||||
107
platformio.ini
107
platformio.ini
@@ -50,18 +50,26 @@ build_flags = -Wno-missing-field-initializers
|
||||
-DMESHTASTIC_EXCLUDE_REMOTEHARDWARE=1
|
||||
-DMESHTASTIC_EXCLUDE_HEALTH_TELEMETRY=1
|
||||
-DMESHTASTIC_EXCLUDE_POWERSTRESS=1 ; exclude power stress test module from main firmware
|
||||
-DMESHTASTIC_EXCLUDE_GENERIC_THREAD_MODULE=1
|
||||
#-DBUILD_EPOCH=$UNIX_TIME
|
||||
#-D OLED_PL=1
|
||||
|
||||
monitor_speed = 115200
|
||||
monitor_filters = direct
|
||||
lib_deps =
|
||||
https://github.com/meshtastic/esp8266-oled-ssd1306/archive/e16cee124fe26490cb14880c679321ad8ac89c95.zip
|
||||
# renovate: datasource=git-refs depName=meshtastic-esp8266-oled-ssd1306 packageName=https://github.com/meshtastic/esp8266-oled-ssd1306 gitBranch=master
|
||||
https://github.com/meshtastic/esp8266-oled-ssd1306/archive/0119501e9983bd894830b02f545c377ee08d66fe.zip
|
||||
# renovate: datasource=custom.pio depName=OneButton packageName=mathertel/library/OneButton
|
||||
mathertel/OneButton@2.6.1
|
||||
# renovate: datasource=git-refs depName=meshtastic-arduino-fsm packageName=https://github.com/meshtastic/arduino-fsm gitBranch=master
|
||||
https://github.com/meshtastic/arduino-fsm/archive/7db3702bf0cfe97b783d6c72595e3f38e0b19159.zip
|
||||
# renovate: datasource=git-refs depName=meshtastic-TinyGPSPlus packageName=https://github.com/meshtastic/TinyGPSPlus gitBranch=master
|
||||
https://github.com/meshtastic/TinyGPSPlus/archive/71a82db35f3b973440044c476d4bcdc673b104f4.zip
|
||||
# renovate: datasource=git-refs depName=meshtastic-ArduinoThread packageName=https://github.com/meshtastic/ArduinoThread gitBranch=master
|
||||
https://github.com/meshtastic/ArduinoThread/archive/7c3ee9e1951551b949763b1f5280f8db1fa4068d.zip
|
||||
# renovate: datasource=custom.pio depName=Nanopb packageName=nanopb/library/Nanopb
|
||||
nanopb/Nanopb@0.4.91
|
||||
# renovate: datasource=custom.pio depName=ErriezCRC32 packageName=erriez/library/ErriezCRC32
|
||||
erriez/ErriezCRC32@1.0.1
|
||||
|
||||
; Used for the code analysis in PIO Home / Inspect
|
||||
@@ -77,6 +85,7 @@ check_flags =
|
||||
framework = arduino
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
# renovate: datasource=custom.pio depName=NonBlockingRTTTL packageName=end2endzone/library/NonBlockingRTTTL
|
||||
end2endzone/NonBlockingRTTTL@1.3.0
|
||||
build_flags = ${env.build_flags} -Os
|
||||
build_src_filter = ${env.build_src_filter} -<platform/portduino/> -<graphics/niche/>
|
||||
@@ -84,57 +93,103 @@ build_src_filter = ${env.build_src_filter} -<platform/portduino/> -<graphics/nic
|
||||
; Common libs for communicating over TCP/IP networks such as MQTT
|
||||
[networking_base]
|
||||
lib_deps =
|
||||
knolleary/PubSubClient@2.8
|
||||
arduino-libraries/NTPClient@3.1.0
|
||||
# renovate: datasource=custom.pio depName=TBPubSubClient packageName=thingsboard/library/TBPubSubClient
|
||||
thingsboard/TBPubSubClient@2.12.1
|
||||
# renovate: datasource=custom.pio depName=NTPClient packageName=arduino-libraries/library/NTPClient
|
||||
arduino-libraries/NTPClient@3.2.1
|
||||
# renovate: datasource=custom.pio depName=Syslog packageName=arcao/library/Syslog
|
||||
arcao/Syslog@2.0.0
|
||||
|
||||
[radiolib_base]
|
||||
lib_deps =
|
||||
# renovate: datasource=custom.pio depName=RadioLib packageName=jgromes/library/RadioLib
|
||||
jgromes/RadioLib@7.1.2
|
||||
|
||||
[device-ui_base]
|
||||
lib_deps =
|
||||
https://github.com/meshtastic/device-ui/archive/99171e87a70452395b56cce713a951c1c2964370.zip
|
||||
# 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
|
||||
|
||||
; Common libs for environmental measurements in telemetry module
|
||||
; (not included in native / portduino)
|
||||
[environmental_base]
|
||||
lib_deps =
|
||||
adafruit/Adafruit BusIO@1.16.2
|
||||
adafruit/Adafruit Unified Sensor@1.1.14
|
||||
# renovate: datasource=custom.pio depName=Adafruit BusIO packageName=adafruit/library/Adafruit BusIO
|
||||
adafruit/Adafruit BusIO@1.17.1
|
||||
# renovate: datasource=custom.pio depName=Adafruit Unified Sensor packageName=adafruit/library/Adafruit Unified Sensor
|
||||
adafruit/Adafruit Unified Sensor@1.1.15
|
||||
# renovate: datasource=custom.pio depName=Adafruit BMP280 packageName=adafruit/library/Adafruit BMP280 Library
|
||||
adafruit/Adafruit BMP280 Library@2.6.8
|
||||
# renovate: datasource=custom.pio depName=Adafruit BMP085 packageName=adafruit/library/Adafruit BMP085 Library
|
||||
adafruit/Adafruit BMP085 Library@1.2.4
|
||||
adafruit/Adafruit BME280 Library@2.2.4
|
||||
adafruit/Adafruit BMP3XX Library@2.1.5
|
||||
# renovate: datasource=custom.pio depName=Adafruit BME280 packageName=adafruit/library/Adafruit BME280 Library
|
||||
adafruit/Adafruit BME280 Library@2.3.0
|
||||
# renovate: datasource=custom.pio depName=Adafruit DPS310 packageName=adafruit/library/Adafruit DPS310
|
||||
adafruit/Adafruit DPS310@1.1.5
|
||||
# renovate: datasource=custom.pio depName=Adafruit MCP9808 packageName=adafruit/library/Adafruit MCP9808 Library
|
||||
adafruit/Adafruit MCP9808 Library@2.0.2
|
||||
# renovate: datasource=custom.pio depName=Adafruit INA260 packageName=adafruit/library/Adafruit INA260 Library
|
||||
adafruit/Adafruit INA260 Library@1.5.2
|
||||
# renovate: datasource=custom.pio depName=Adafruit INA219 packageName=adafruit/library/Adafruit INA219
|
||||
adafruit/Adafruit INA219@1.2.3
|
||||
adafruit/Adafruit MAX1704X@1.0.3
|
||||
adafruit/Adafruit SHTC3 Library@1.0.1
|
||||
adafruit/Adafruit LPS2X@2.0.6
|
||||
adafruit/Adafruit SHT31 Library@2.2.2
|
||||
adafruit/Adafruit PM25 AQI Sensor@1.1.1
|
||||
# renovate: datasource=custom.pio depName=Adafruit PM25 AQI Sensor packageName=adafruit/library/Adafruit PM25 AQI Sensor
|
||||
adafruit/Adafruit PM25 AQI Sensor@2.0.0
|
||||
# renovate: datasource=custom.pio depName=Adafruit MPU6050 packageName=adafruit/library/Adafruit MPU6050
|
||||
adafruit/Adafruit MPU6050@2.2.6
|
||||
# renovate: datasource=custom.pio depName=Adafruit LIS3DH packageName=adafruit/library/Adafruit LIS3DH
|
||||
adafruit/Adafruit LIS3DH@1.3.0
|
||||
# renovate: datasource=custom.pio depName=Adafruit AHTX0 packageName=adafruit/library/Adafruit AHTX0
|
||||
adafruit/Adafruit AHTX0@2.0.5
|
||||
adafruit/Adafruit LSM6DS@4.7.3
|
||||
adafruit/Adafruit VEML7700 Library@2.1.6
|
||||
adafruit/Adafruit SHT4x Library@1.0.5
|
||||
# renovate: datasource=custom.pio depName=Adafruit LSM6DS packageName=adafruit/library/Adafruit LSM6DS
|
||||
adafruit/Adafruit LSM6DS@4.7.4
|
||||
# renovate: datasource=custom.pio depName=Adafruit TSL2591 packageName=adafruit/library/Adafruit TSL2591 Library
|
||||
adafruit/Adafruit TSL2591 Library@1.4.5
|
||||
sparkfun/SparkFun Qwiic Scale NAU7802 Arduino Library@1.0.6
|
||||
sparkfun/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library@1.2.13
|
||||
ClosedCube OPT3001@1.1.2
|
||||
# renovate: datasource=custom.pio depName=EmotiBit MLX90632 packageName=emotibit/library/EmotiBit MLX90632
|
||||
emotibit/EmotiBit MLX90632@1.0.8
|
||||
# renovate: datasource=custom.pio depName=Adafruit MLX90614 packageName=adafruit/library/Adafruit MLX90614 Library
|
||||
adafruit/Adafruit MLX90614 Library@2.1.5
|
||||
https://github.com/boschsensortec/Bosch-BSEC2-Library/archive/v1.7.2502.zip
|
||||
boschsensortec/BME68x Sensor Library@1.1.40407
|
||||
# renovate: datasource=github-tags depName=INA3221 packageName=KodinLanewave/INA3221
|
||||
https://github.com/KodinLanewave/INA3221/archive/1.0.1.zip
|
||||
# renovate: datasource=custom.pio depName=QMC5883L Compass packageName=mprograms/library/QMC5883LCompass
|
||||
mprograms/QMC5883LCompass@1.2.3
|
||||
# renovate: datasource=custom.pio depName=DFRobot_RTU packageName=dfrobot/library/DFRobot_RTU
|
||||
dfrobot/DFRobot_RTU@1.0.3
|
||||
https://github.com/meshtastic/DFRobot_LarkWeatherStation/archive/4de3a9cadef0f6a5220a8a906cf9775b02b0040d.zip
|
||||
# renovate: datasource=git-refs depName=DFRobot_RainfallSensor packageName=https://github.com/DFRobot/DFRobot_RainfallSensor gitBranch=master
|
||||
https://github.com/DFRobot/DFRobot_RainfallSensor/archive/38fea5e02b40a5430be6dab39a99a6f6347d667e.zip
|
||||
robtillaart/INA226@0.6.0
|
||||
|
||||
; Health Sensor Libraries
|
||||
# renovate: datasource=custom.pio depName=INA226 packageName=robtillaart/library/INA226
|
||||
robtillaart/INA226@0.6.4
|
||||
# renovate: datasource=custom.pio depName=SparkFun MAX3010x packageName=sparkfun/library/SparkFun MAX3010x Pulse and Proximity Sensor Library
|
||||
sparkfun/SparkFun MAX3010x Pulse and Proximity Sensor Library@1.1.2
|
||||
# renovate: datasource=custom.pio depName=SparkFun 9DoF IMU Breakout ICM 20948 packageName=sparkfun/library/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library
|
||||
sparkfun/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library@1.3.2
|
||||
# renovate: datasource=custom.pio depName=Adafruit LTR390 Library packageName=adafruit/library/Adafruit LTR390 Library
|
||||
adafruit/Adafruit LTR390 Library@1.1.2
|
||||
# renovate: datasource=custom.pio depName=Adafruit PCT2075 packageName=adafruit/library/Adafruit PCT2075
|
||||
adafruit/Adafruit PCT2075@1.0.5
|
||||
|
||||
; (not included in native / portduino)
|
||||
[environmental_extra]
|
||||
lib_deps =
|
||||
# renovate: datasource=custom.pio depName=Adafruit BMP3XX packageName=adafruit/library/Adafruit BMP3XX Library
|
||||
adafruit/Adafruit BMP3XX Library@2.1.6
|
||||
# renovate: datasource=custom.pio depName=Adafruit MAX1704X packageName=adafruit/library/Adafruit MAX1704X
|
||||
adafruit/Adafruit MAX1704X@1.0.3
|
||||
# renovate: datasource=custom.pio depName=Adafruit SHTC3 packageName=adafruit/library/Adafruit SHTC3 Library
|
||||
adafruit/Adafruit SHTC3 Library@1.0.1
|
||||
# renovate: datasource=custom.pio depName=Adafruit LPS2X packageName=adafruit/library/Adafruit LPS2X
|
||||
adafruit/Adafruit LPS2X@2.0.6
|
||||
# renovate: datasource=custom.pio depName=Adafruit SHT31 packageName=adafruit/library/Adafruit SHT31 Library
|
||||
adafruit/Adafruit SHT31 Library@2.2.2
|
||||
# renovate: datasource=custom.pio depName=Adafruit VEML7700 packageName=adafruit/library/Adafruit VEML7700 Library
|
||||
adafruit/Adafruit VEML7700 Library@2.1.6
|
||||
# renovate: datasource=custom.pio depName=Adafruit SHT4x packageName=adafruit/library/Adafruit SHT4x Library
|
||||
adafruit/Adafruit SHT4x Library@1.0.5
|
||||
# renovate: datasource=custom.pio depName=SparkFun Qwiic Scale NAU7802 packageName=sparkfun/library/SparkFun Qwiic Scale NAU7802 Arduino Library
|
||||
sparkfun/SparkFun Qwiic Scale NAU7802 Arduino Library@1.0.6
|
||||
# renovate: datasource=custom.pio depName=ClosedCube OPT3001 packageName=closedcube/library/ClosedCube OPT3001
|
||||
ClosedCube OPT3001@1.1.2
|
||||
# renovate: datasource=custom.pio depName=Bosch BSEC2 packageName=boschsensortec/library/bsec2
|
||||
boschsensortec/bsec2@1.10.2610
|
||||
# renovate: datasource=custom.pio depName=Bosch BME68x packageName=boschsensortec/library/BME68x Sensor Library
|
||||
boschsensortec/BME68x Sensor Library@1.3.40408
|
||||
# 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
|
||||
Submodule protobufs updated: f00e96f12d...24c7a3d287
99
renovate.json
Normal file
99
renovate.json
Normal file
@@ -0,0 +1,99 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
":dependencyDashboard",
|
||||
":semanticCommitTypeAll(chore)",
|
||||
":ignoreModulesAndTests",
|
||||
"group:recommended",
|
||||
"replacements:all",
|
||||
"workarounds:all"
|
||||
],
|
||||
"forkProcessing": "enabled",
|
||||
"ignoreDeps": [
|
||||
"protobufs"
|
||||
],
|
||||
"git-submodules": {
|
||||
"enabled": true
|
||||
},
|
||||
"pip_requirements": {
|
||||
"managerFilePatterns": [
|
||||
"/bin/bump_metainfo/requirements.txt/"
|
||||
]
|
||||
},
|
||||
"commitMessageTopic": "{{depName}}",
|
||||
"labels": [
|
||||
"dependencies"
|
||||
],
|
||||
"customDatasources": {
|
||||
"pio": {
|
||||
"description": "PlatformIO Registry",
|
||||
"defaultRegistryUrlTemplate": "https://api.registry.platformio.org/v3/packages/{{packageName}}",
|
||||
"format": "json",
|
||||
"transformTemplates": [
|
||||
"{\"releases\": [$map($.versions, function($v) { { \"version\": $v.name, \"releaseTimestamp\": $v.released_at } })], \"homepage\": $encodeUrl($join([\"https://registry.platformio.org/\",$.type,\"/\",$.owner.username,\"/\",$.name])) }"
|
||||
]
|
||||
}
|
||||
},
|
||||
"customManagers": [
|
||||
{
|
||||
"customType": "regex",
|
||||
"description": "Match meshtastic/web version",
|
||||
"managerFilePatterns": [
|
||||
"/bin/web.version/"
|
||||
],
|
||||
"matchStrings": [
|
||||
"(?<currentValue>.+)$"
|
||||
],
|
||||
"datasourceTemplate": "github-releases",
|
||||
"depNameTemplate": "meshtastic/web",
|
||||
"versioningTemplate": "semver-coerced"
|
||||
},
|
||||
{
|
||||
"customType": "regex",
|
||||
"description": "Match normal PIO dependencies",
|
||||
"managerFilePatterns": [
|
||||
"/.*\\.ini$/"
|
||||
],
|
||||
"matchStrings": [
|
||||
"# renovate: datasource=(?<datasource>.*?)(?: depName=(?<depName>.+?))? packageName=(?<packageName>.+?)(?: versioning=(?<versioning>[a-z-]+?))?\\s+?.+?@(?<currentValue>.+?)\\s"
|
||||
],
|
||||
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver-coerced{{/if}}"
|
||||
},
|
||||
{
|
||||
"customType": "regex",
|
||||
"description": "Match PIO zipped dependencies with github tag ref",
|
||||
"managerFilePatterns": [
|
||||
"/.*\\.ini$/"
|
||||
],
|
||||
"matchStrings": [
|
||||
"# renovate: datasource=github-tags(?: depName=(?<depName>.+?))? packageName=(?<packageName>.+?)(?: versioning=(?<versioning>[a-z-]+?))?\\s+?https://.+?archive/(?<currentValue>.+?).zip\\s"
|
||||
],
|
||||
"datasourceTemplate": "github-tags",
|
||||
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver-coerced{{/if}}"
|
||||
},
|
||||
{
|
||||
"customType": "regex",
|
||||
"description": "Match PIO zipped dependencies with git commit ref",
|
||||
"managerFilePatterns": [
|
||||
"/.*\\.ini$/"
|
||||
],
|
||||
"matchStrings": [
|
||||
"# renovate: datasource=git-refs(?: depName=(?<depName>.+?))? packageName=(?<packageName>.+?)(?: versioning=(?<versioning>[a-z-]+?))?\\sgitBranch=(?<gitBranch>.+?)\\s+?https://.+?archive/(?<currentDigest>.+?).zip\\s"
|
||||
],
|
||||
"datasourceTemplate": "git-refs",
|
||||
"currentValueTemplate": "{{{gitBranch}}}",
|
||||
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}git{{/if}}"
|
||||
}
|
||||
],
|
||||
"packageRules": [
|
||||
{
|
||||
"matchDepNames": [
|
||||
"meshtastic/device-ui"
|
||||
],
|
||||
"reviewers": [
|
||||
"mverch67"
|
||||
],
|
||||
"changelogUrl": "https://github.com/meshtastic/device-ui/compare/{{currentDigest}}...{{newDigest}}"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -6,6 +6,11 @@
|
||||
NCP5623 rgb;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_LP5562
|
||||
#include <graphics/NomadStarLED.h>
|
||||
LP5562 rgbw;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_NEOPIXEL
|
||||
#include <graphics/NeoPixel.h>
|
||||
Adafruit_NeoPixel pixels(NEOPIXEL_COUNT, NEOPIXEL_DATA, NEOPIXEL_TYPE);
|
||||
@@ -26,7 +31,7 @@ class AmbientLightingThread : public concurrency::OSThread
|
||||
notifyDeepSleepObserver.observe(¬ifyDeepSleep); // Let us know when shutdown() is issued.
|
||||
|
||||
// Enables Ambient Lighting by default if conditions are meet.
|
||||
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
|
||||
#ifdef HAS_RGB_LED
|
||||
#ifdef ENABLE_AMBIENTLIGHTING
|
||||
moduleConfig.ambient_lighting.led_state = true;
|
||||
#endif
|
||||
@@ -39,7 +44,7 @@ class AmbientLightingThread : public concurrency::OSThread
|
||||
// moduleConfig.ambient_lighting.green = (myNodeInfo.my_node_num & 0x00FF00) >> 8;
|
||||
// moduleConfig.ambient_lighting.blue = myNodeInfo.my_node_num & 0x0000FF;
|
||||
|
||||
#ifdef HAS_NCP5623
|
||||
#if defined(HAS_NCP5623) || defined(HAS_LP5562)
|
||||
_type = type;
|
||||
if (_type == ScanI2C::DeviceType::NONE) {
|
||||
LOG_DEBUG("AmbientLighting Disable due to no RGB leds found on I2C bus");
|
||||
@@ -47,17 +52,21 @@ class AmbientLightingThread : public concurrency::OSThread
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
|
||||
#ifdef HAS_RGB_LED
|
||||
if (!moduleConfig.ambient_lighting.led_state) {
|
||||
LOG_DEBUG("AmbientLighting Disable due to moduleConfig.ambient_lighting.led_state OFF");
|
||||
disable();
|
||||
return;
|
||||
}
|
||||
LOG_DEBUG("AmbientLighting init");
|
||||
#ifdef HAS_NCP5623
|
||||
#if defined(HAS_NCP5623) || defined(HAS_LP5562)
|
||||
if (_type == ScanI2C::NCP5623) {
|
||||
rgb.begin();
|
||||
#endif
|
||||
#ifdef HAS_LP5562
|
||||
} else if (_type == ScanI2C::LP5562) {
|
||||
rgbw.begin();
|
||||
#endif
|
||||
#ifdef RGBLED_RED
|
||||
pinMode(RGBLED_RED, OUTPUT);
|
||||
pinMode(RGBLED_GREEN, OUTPUT);
|
||||
@@ -70,7 +79,7 @@ class AmbientLightingThread : public concurrency::OSThread
|
||||
#endif
|
||||
setLighting();
|
||||
#endif
|
||||
#ifdef HAS_NCP5623
|
||||
#if defined(HAS_NCP5623) || defined(HAS_LP5562)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -78,13 +87,13 @@ class AmbientLightingThread : public concurrency::OSThread
|
||||
protected:
|
||||
int32_t runOnce() override
|
||||
{
|
||||
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
|
||||
#ifdef HAS_NCP5623
|
||||
if (_type == ScanI2C::NCP5623 && moduleConfig.ambient_lighting.led_state) {
|
||||
#ifdef HAS_RGB_LED
|
||||
#if defined(HAS_NCP5623) || defined(HAS_LP5562)
|
||||
if ((_type == ScanI2C::NCP5623 || _type == ScanI2C::LP5562) && moduleConfig.ambient_lighting.led_state) {
|
||||
#endif
|
||||
setLighting();
|
||||
return 30000; // 30 seconds to reset from any animations that may have been running from Ext. Notification
|
||||
#ifdef HAS_NCP5623
|
||||
#if defined(HAS_NCP5623) || defined(HAS_LP5562)
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -108,6 +117,14 @@ class AmbientLightingThread : public concurrency::OSThread
|
||||
rgb.setBlue(0);
|
||||
LOG_INFO("OFF: NCP5623 Ambient lighting");
|
||||
#endif
|
||||
#ifdef HAS_LP5562
|
||||
rgbw.setCurrent(0);
|
||||
rgbw.setRed(0);
|
||||
rgbw.setGreen(0);
|
||||
rgbw.setBlue(0);
|
||||
rgbw.setWhite(0);
|
||||
LOG_INFO("OFF: LP5562 Ambient lighting");
|
||||
#endif
|
||||
#ifdef HAS_NEOPIXEL
|
||||
pixels.clear();
|
||||
pixels.show();
|
||||
@@ -141,6 +158,14 @@ class AmbientLightingThread : public concurrency::OSThread
|
||||
LOG_DEBUG("Init NCP5623 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);
|
||||
#endif
|
||||
#ifdef HAS_LP5562
|
||||
rgbw.setCurrent(moduleConfig.ambient_lighting.current);
|
||||
rgbw.setRed(moduleConfig.ambient_lighting.red);
|
||||
rgbw.setGreen(moduleConfig.ambient_lighting.green);
|
||||
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,
|
||||
moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
||||
#endif
|
||||
#ifdef HAS_NEOPIXEL
|
||||
pixels.fill(pixels.Color(moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green,
|
||||
moduleConfig.ambient_lighting.blue),
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "RadioLibInterface.h"
|
||||
#include "buzz.h"
|
||||
#include "main.h"
|
||||
#include "modules/CannedMessageModule.h"
|
||||
#include "modules/ExternalNotificationModule.h"
|
||||
#include "power.h"
|
||||
#include "sleep.h"
|
||||
@@ -26,6 +27,7 @@
|
||||
using namespace concurrency;
|
||||
|
||||
ButtonThread *buttonThread; // Declared extern in header
|
||||
extern CannedMessageModule *cannedMessageModule;
|
||||
volatile ButtonThread::ButtonEventType ButtonThread::btnEvent = ButtonThread::BUTTON_EVENT_NONE;
|
||||
|
||||
#if defined(BUTTON_PIN) || defined(ARCH_PORTDUINO) || defined(USERPREFS_BUTTON_PIN)
|
||||
@@ -116,46 +118,66 @@ ButtonThread::ButtonThread() : OSThread("Button")
|
||||
#endif
|
||||
}
|
||||
|
||||
void ButtonThread::switchPage()
|
||||
{
|
||||
// Prevent screen switch if CannedMessageModule is focused and intercepting input
|
||||
#if HAS_SCREEN
|
||||
extern CannedMessageModule *cannedMessageModule;
|
||||
|
||||
if (cannedMessageModule && cannedMessageModule->isInterceptingAndFocused()) {
|
||||
LOG_DEBUG("User button ignored during canned message input");
|
||||
return; // Skip screen change
|
||||
}
|
||||
#endif
|
||||
|
||||
// Default behavior if not blocked
|
||||
#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)
|
||||
// #if defined(ELECROW_ThinkNode_M1) || defined(ELECROW_ThinkNode_M2)
|
||||
// buzzer_updata();
|
||||
// if (buttonPressed) {
|
||||
// buttonPressed = false; // 清除标志
|
||||
// LOG_INFO("PIN_BUTTON2 pressed!"); // 串口打印信息
|
||||
// // off_currentTime = millis();
|
||||
// while (digitalRead(PIN_BUTTON2) == HIGH) {
|
||||
// if (cont < 40) {
|
||||
// // unsigned long currentTime = millis(); // 获取当前时间
|
||||
// // if (currentTime - off_currentTime >= 1000) {
|
||||
// cont++;
|
||||
// // off_currentTime = currentTime;
|
||||
// // }
|
||||
// delay(100);
|
||||
// } else {
|
||||
|
||||
// currentState = OFF;
|
||||
// isBuzzing = false;
|
||||
// cont = 0;
|
||||
// BEEP_STATE = false;
|
||||
// analogWrite(M2_buzzer, 0);
|
||||
// pinMode(M2_buzzer, INPUT);
|
||||
// screen->setOn(false);
|
||||
// cont = 0;
|
||||
// LOG_INFO("GGGGGGGGGGGGGGGGGGGGGGGGG");
|
||||
// pinMode(1, OUTPUT);
|
||||
// digitalWrite(1, LOW);
|
||||
// pinMode(6, OUTPUT);
|
||||
// digitalWrite(6, LOW);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// #endif
|
||||
userButton.tick();
|
||||
canSleep &= userButton.isIdle();
|
||||
#elif defined(ARCH_PORTDUINO)
|
||||
@@ -180,32 +202,27 @@ int32_t ButtonThread::runOnce()
|
||||
// If a nag notification is running, stop it and prevent other actions
|
||||
if (moduleConfig.external_notification.enabled && (externalNotificationModule->nagCycleCutoff != UINT32_MAX)) {
|
||||
externalNotificationModule->stopNow();
|
||||
return 50;
|
||||
}
|
||||
#ifdef BUTTON_PIN
|
||||
#if !defined(USERPREFS_BUTTON_PIN)
|
||||
if (((config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN) !=
|
||||
#endif
|
||||
#if defined(USERPREFS_BUTTON_PIN)
|
||||
if (((config.device.button_gpio ? config.device.button_gpio : USERPREFS_BUTTON_PIN) !=
|
||||
#endif
|
||||
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(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);
|
||||
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)
|
||||
@@ -215,47 +232,56 @@ int32_t ButtonThread::runOnce()
|
||||
|
||||
case BUTTON_EVENT_DOUBLE_PRESSED: {
|
||||
LOG_BUTTON("Double press!");
|
||||
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
|
||||
}
|
||||
|
||||
#ifdef ELECROW_ThinkNode_M1
|
||||
digitalWrite(PIN_EINK_EN, digitalRead(PIN_EINK_EN) == LOW);
|
||||
break;
|
||||
#endif
|
||||
|
||||
// Send GPS position immediately
|
||||
sendAdHocPosition();
|
||||
|
||||
// Show temporary on-screen confirmation banner for 3 seconds
|
||||
screen->showOverlayBanner("Ad-hoc Ping Sent", 3000);
|
||||
break;
|
||||
}
|
||||
|
||||
case BUTTON_EVENT_MULTI_PRESSED: {
|
||||
LOG_BUTTON("Mulitipress! %hux", multipressClickCount);
|
||||
switch (multipressClickCount) {
|
||||
#if HAS_GPS
|
||||
#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)
|
||||
|
||||
const char *statusMsg = (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED)
|
||||
? "GPS Enabled"
|
||||
: "GPS Disabled";
|
||||
|
||||
if (screen) {
|
||||
screen->forceDisplay(true); // Force a new UI frame, then force an EInk update
|
||||
screen->showOverlayBanner(statusMsg, 3000);
|
||||
}
|
||||
}
|
||||
break;
|
||||
#elif defined(ELECROW_ThinkNode_M2)
|
||||
#elif defined(ELECROW_ThinkNode_M1) || defined(ELECROW_ThinkNode_M2)
|
||||
case 3:
|
||||
LOG_INFO("3 clicks: toggle buzzer");
|
||||
buzzer_flag = !buzzer_flag;
|
||||
if (buzzer_flag) {
|
||||
playBeep();
|
||||
}
|
||||
if (!buzzer_flag)
|
||||
noTone(PIN_BUZZER);
|
||||
break;
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(USE_EINK) && defined(PIN_EINK_EN) // i.e. T-Echo
|
||||
#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 defined(RAK_4631)
|
||||
#if !MESHTASTIC_EXCLUDE_SCREEN && HAS_SCREEN
|
||||
// 5 clicks: start accelerometer/magenetometer calibration for 30 seconds
|
||||
case 5:
|
||||
if (accelerometerThread) {
|
||||
@@ -280,9 +306,12 @@ int32_t ButtonThread::runOnce()
|
||||
case BUTTON_EVENT_LONG_PRESSED: {
|
||||
LOG_BUTTON("Long press!");
|
||||
powerFSM.trigger(EVENT_PRESS);
|
||||
|
||||
if (screen) {
|
||||
screen->startAlert("Shutting down...");
|
||||
// Show shutdown message as a temporary overlay banner
|
||||
screen->showOverlayBanner("Shutting Down..."); // Display for 3 seconds
|
||||
}
|
||||
|
||||
playBeep();
|
||||
break;
|
||||
}
|
||||
@@ -294,20 +323,30 @@ int32_t ButtonThread::runOnce()
|
||||
playShutdownMelody();
|
||||
delay(3000);
|
||||
power->shutdown();
|
||||
nodeDB->saveToDisk();
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef BUTTON_PIN_TOUCH
|
||||
case BUTTON_EVENT_TOUCH_LONG_PRESSED: {
|
||||
LOG_BUTTON("Touch press!");
|
||||
if (screen) {
|
||||
// Wake if asleep
|
||||
if (powerFSM.getState() == &stateDARK)
|
||||
powerFSM.trigger(EVENT_PRESS);
|
||||
// Ignore if: no screen
|
||||
if (!screen)
|
||||
break;
|
||||
|
||||
// Update display (legacy behaviour)
|
||||
screen->forceDisplay();
|
||||
}
|
||||
#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
|
||||
@@ -349,8 +388,12 @@ void ButtonThread::attachButtonInterrupts()
|
||||
#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);
|
||||
|
||||
@@ -37,6 +37,10 @@ class ButtonThread : public concurrency::OSThread
|
||||
void attachButtonInterrupts();
|
||||
void detachButtonInterrupts();
|
||||
void storeClickCount();
|
||||
bool isBuzzing() { return buzzer_flag; }
|
||||
void setScreenFlag(bool flag) { screen_flag = flag; }
|
||||
bool getScreenFlag() { return screen_flag; }
|
||||
bool isInterceptingAndFocused();
|
||||
|
||||
// Disconnect and reconnect interrupts for light sleep
|
||||
#ifdef ARCH_ESP32
|
||||
@@ -72,14 +76,12 @@ class ButtonThread : public concurrency::OSThread
|
||||
|
||||
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()
|
||||
{
|
||||
if (millis() > c_holdOffTime) {
|
||||
btnEvent = BUTTON_EVENT_PRESSED_SCREEN;
|
||||
}
|
||||
}
|
||||
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();
|
||||
|
||||
@@ -27,9 +27,6 @@ const char *DisplayFormatters::getModemPresetDisplayName(meshtastic_Config_LoRaC
|
||||
case meshtastic_Config_LoRaConfig_ModemPreset_LONG_MODERATE:
|
||||
return useShortName ? "LongM" : "LongMod";
|
||||
break;
|
||||
case meshtastic_Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW:
|
||||
return useShortName ? "VeryL" : "VLongSlow";
|
||||
break;
|
||||
default:
|
||||
return useShortName ? "Custom" : "Invalid";
|
||||
break;
|
||||
|
||||
@@ -12,13 +12,14 @@
|
||||
#include "SPILock.h"
|
||||
#include "configuration.h"
|
||||
|
||||
#ifdef HAS_SDCARD
|
||||
// Software SPI is used by MUI so disable SD card here until it's also implemented
|
||||
#if defined(HAS_SDCARD) && !defined(SDCARD_USE_SOFT_SPI)
|
||||
#include <SD.h>
|
||||
#include <SPI.h>
|
||||
|
||||
#ifdef SDCARD_USE_SPI1
|
||||
SPIClass SPI1(HSPI);
|
||||
#define SDHandler SPI1
|
||||
SPIClass SPI_HSPI(HSPI);
|
||||
#define SDHandler SPI_HSPI
|
||||
#else
|
||||
#define SDHandler SPI
|
||||
#endif
|
||||
@@ -306,7 +307,7 @@ void fsInit()
|
||||
*/
|
||||
void setupSDCard()
|
||||
{
|
||||
#ifdef HAS_SDCARD
|
||||
#if defined(HAS_SDCARD) && !defined(SDCARD_USE_SOFT_SPI)
|
||||
concurrency::LockGuard g(spiLock);
|
||||
SDHandler.begin(SPI_SCK, SPI_MISO, SPI_MOSI);
|
||||
if (!SD.begin(SDCARD_CS, SDHandler, SD_SPI_FREQUENCY)) {
|
||||
|
||||
@@ -76,23 +76,47 @@ static const uint8_t ext_chrg_detect_value = EXT_CHRG_DETECT_VALUE;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(ARCH_PORTDUINO)
|
||||
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
#if __has_include(<Adafruit_INA219.h>)
|
||||
INA219Sensor ina219Sensor;
|
||||
INA226Sensor ina226Sensor;
|
||||
INA260Sensor ina260Sensor;
|
||||
INA3221Sensor ina3221Sensor;
|
||||
#else
|
||||
NullSensor ina219Sensor;
|
||||
#endif
|
||||
|
||||
#if !MESHTASTIC_EXCLUDE_I2C && !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
||||
#if __has_include(<INA226.h>)
|
||||
INA226Sensor ina226Sensor;
|
||||
#else
|
||||
NullSensor ina226Sensor;
|
||||
#endif
|
||||
|
||||
#if __has_include(<Adafruit_INA260.h>)
|
||||
INA260Sensor ina260Sensor;
|
||||
#else
|
||||
NullSensor ina260Sensor;
|
||||
#endif
|
||||
|
||||
#if __has_include(<INA3221.h>)
|
||||
INA3221Sensor ina3221Sensor;
|
||||
#else
|
||||
NullSensor ina3221Sensor;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if !MESHTASTIC_EXCLUDE_I2C && !defined(ARCH_STM32WL)
|
||||
#include "modules/Telemetry/Sensor/MAX17048Sensor.h"
|
||||
#include <utility>
|
||||
extern std::pair<uint8_t, TwoWire *> nodeTelemetrySensorsMap[_meshtastic_TelemetrySensorType_MAX + 1];
|
||||
#if HAS_TELEMETRY && (!MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR || !MESHTASTIC_EXCLUDE_POWER_TELEMETRY)
|
||||
#if __has_include(<Adafruit_MAX1704X.h>)
|
||||
MAX17048Sensor max17048Sensor;
|
||||
#else
|
||||
NullSensor max17048Sensor;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && HAS_RAKPROT && !defined(ARCH_PORTDUINO)
|
||||
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && HAS_RAKPROT
|
||||
RAK9154Sensor rak9154Sensor;
|
||||
#endif
|
||||
|
||||
@@ -203,7 +227,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
||||
*/
|
||||
virtual int getBatteryPercent() override
|
||||
{
|
||||
#if defined(HAS_RAKPROT) && !defined(ARCH_PORTDUINO) && !defined(HAS_PMU)
|
||||
#if defined(HAS_RAKPROT) && !defined(HAS_PMU)
|
||||
if (hasRAK()) {
|
||||
return rak9154Sensor.getBusBatteryPercent();
|
||||
}
|
||||
@@ -248,15 +272,13 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
||||
virtual uint16_t getBattVoltage() override
|
||||
{
|
||||
|
||||
#if HAS_TELEMETRY && defined(HAS_RAKPROT) && !defined(ARCH_PORTDUINO) && !defined(HAS_PMU) && \
|
||||
!MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
#if HAS_TELEMETRY && defined(HAS_RAKPROT) && !defined(HAS_PMU) && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
if (hasRAK()) {
|
||||
return getRAKVoltage();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_TELEMETRY && !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !defined(HAS_PMU) && \
|
||||
!MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
#if HAS_TELEMETRY && !defined(ARCH_STM32WL) && !defined(HAS_PMU) && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||
if (hasINA()) {
|
||||
return getINAVoltage();
|
||||
}
|
||||
@@ -380,6 +402,20 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
||||
// if we have a integrated device with a battery, we can assume that the battery is always connected
|
||||
#ifdef BATTERY_IMMUTABLE
|
||||
virtual bool isBatteryConnect() override { return true; }
|
||||
#elif defined(ADC_V)
|
||||
virtual bool isBatteryConnect() override
|
||||
{
|
||||
int lastReading = digitalRead(ADC_V);
|
||||
// 判断值是否变化
|
||||
for (int i = 2; i < 500; i++) {
|
||||
int reading = digitalRead(ADC_V);
|
||||
if (reading != lastReading) {
|
||||
return false; // 有变化,USB供电, 没接电池
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
virtual bool isBatteryConnect() override { return getBatteryPercent() != -1; }
|
||||
#endif
|
||||
@@ -412,8 +448,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
||||
/// we can't be smart enough to say 'full'?
|
||||
virtual bool isCharging() override
|
||||
{
|
||||
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && defined(HAS_RAKPROT) && !defined(ARCH_PORTDUINO) && \
|
||||
!defined(HAS_PMU)
|
||||
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && defined(HAS_RAKPROT) && !defined(HAS_PMU)
|
||||
if (hasRAK()) {
|
||||
return (rak9154Sensor.isCharging()) ? OptTrue : OptFalse;
|
||||
}
|
||||
@@ -421,7 +456,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
||||
#ifdef EXT_CHRG_DETECT
|
||||
return digitalRead(EXT_CHRG_DETECT) == ext_chrg_detect_value;
|
||||
#else
|
||||
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && \
|
||||
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(ARCH_STM32WL) && \
|
||||
!defined(DISABLE_INA_CHARGING_DETECTION)
|
||||
if (hasINA()) {
|
||||
// get current flow from INA sensor - negative value means power flowing into the battery
|
||||
@@ -436,6 +471,8 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
||||
return isBatteryConnect() && isVbusIn();
|
||||
#endif
|
||||
#endif
|
||||
// by default, we check the battery voltage only
|
||||
return isVbusIn();
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -466,7 +503,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
||||
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(ARCH_STM32WL)
|
||||
uint16_t getINAVoltage()
|
||||
{
|
||||
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219].first == config.power.device_battery_ina_address) {
|
||||
@@ -533,9 +570,6 @@ Power::Power() : OSThread("Power")
|
||||
{
|
||||
statusHandler = {};
|
||||
low_voltage_counter = 0;
|
||||
#if defined(ELECROW_ThinkNode_M1) || defined(POWER_CFG)
|
||||
low_voltage_counter_led3 = 0;
|
||||
#endif
|
||||
#ifdef DEBUG_HEAP
|
||||
lastheap = memGet.getFreeHeap();
|
||||
#endif
|
||||
@@ -716,9 +750,6 @@ void Power::readPowerStatus()
|
||||
const PowerStatus powerStatus2 = PowerStatus(hasBattery, usbPowered, isChargingNow, batteryVoltageMv, batteryChargePercent);
|
||||
LOG_DEBUG("Battery: usbPower=%d, isCharging=%d, batMv=%d, batPct=%d", powerStatus2.getHasUSB(), powerStatus2.getIsCharging(),
|
||||
powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent());
|
||||
#if defined(ELECROW_ThinkNode_M1) || defined(POWER_CFG)
|
||||
power_num = powerStatus2.getBatteryVoltageMv();
|
||||
#endif
|
||||
newStatus.notifyObservers(&powerStatus2);
|
||||
#ifdef DEBUG_HEAP
|
||||
if (lastheap != memGet.getFreeHeap()) {
|
||||
@@ -766,9 +797,6 @@ void Power::readPowerStatus()
|
||||
if (batteryLevel && powerStatus2.getHasBattery() && !powerStatus2.getHasUSB()) {
|
||||
if (batteryLevel->getBattVoltage() < OCV[NUM_OCV_POINTS - 1]) {
|
||||
low_voltage_counter++;
|
||||
#if defined(ELECROW_ThinkNode_M1)
|
||||
low_voltage_counter_led3 = low_voltage_counter;
|
||||
#endif
|
||||
LOG_DEBUG("Low voltage counter: %d/10", low_voltage_counter);
|
||||
if (low_voltage_counter > 10) {
|
||||
#ifdef ARCH_NRF52
|
||||
@@ -781,13 +809,7 @@ void Power::readPowerStatus()
|
||||
}
|
||||
} else {
|
||||
low_voltage_counter = 0;
|
||||
#if defined(ELECROW_ThinkNode_M1)
|
||||
low_voltage_counter_led3 = low_voltage_counter;
|
||||
#endif
|
||||
}
|
||||
#ifdef POWER_CFG
|
||||
low_voltage_counter_led3 = low_voltage_counter;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -831,7 +853,8 @@ int32_t Power::runOnce()
|
||||
#ifndef T_WATCH_S3 // FIXME - why is this triggering on the T-Watch S3?
|
||||
if (PMU->isPekeyLongPressIrq()) {
|
||||
LOG_DEBUG("PEK long button press");
|
||||
screen->setOn(false);
|
||||
if (screen)
|
||||
screen->setOn(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "sleep.h"
|
||||
#include "target_specific.h"
|
||||
|
||||
#if HAS_WIFI && !defined(ARCH_PORTDUINO)
|
||||
#if HAS_WIFI && !defined(ARCH_PORTDUINO) || defined(MESHTASTIC_EXCLUDE_WIFI)
|
||||
#include "mesh/wifi/WiFiAPClient.h"
|
||||
#endif
|
||||
|
||||
@@ -82,7 +82,8 @@ static uint32_t secsSlept;
|
||||
static void lsEnter()
|
||||
{
|
||||
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
|
||||
|
||||
// LOG_INFO("lsEnter end");
|
||||
@@ -160,7 +161,8 @@ static void lsExit()
|
||||
static void nbEnter()
|
||||
{
|
||||
LOG_DEBUG("State: NB");
|
||||
screen->setOn(false);
|
||||
if (screen)
|
||||
screen->setOn(false);
|
||||
#ifdef ARCH_ESP32
|
||||
// Only ESP32 should turn off bluetooth
|
||||
setBluetoothEnable(false);
|
||||
@@ -172,22 +174,26 @@ static void nbEnter()
|
||||
static void darkEnter()
|
||||
{
|
||||
setBluetoothEnable(true);
|
||||
screen->setOn(false);
|
||||
if (screen)
|
||||
screen->setOn(false);
|
||||
}
|
||||
|
||||
static void serialEnter()
|
||||
{
|
||||
LOG_DEBUG("State: SERIAL");
|
||||
setBluetoothEnable(false);
|
||||
screen->setOn(true);
|
||||
screen->print("Serial connected\n");
|
||||
if (screen) {
|
||||
screen->setOn(true);
|
||||
screen->print("Serial connected\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void serialExit()
|
||||
{
|
||||
// Turn bluetooth back on when we leave serial stream API
|
||||
setBluetoothEnable(true);
|
||||
screen->print("Serial disconnected\n");
|
||||
if (screen)
|
||||
screen->print("Serial disconnected\n");
|
||||
}
|
||||
|
||||
static void powerEnter()
|
||||
@@ -198,7 +204,8 @@ static void powerEnter()
|
||||
LOG_INFO("Loss of power in Powered");
|
||||
powerFSM.trigger(EVENT_POWER_DISCONNECTED);
|
||||
} else {
|
||||
screen->setOn(true);
|
||||
if (screen)
|
||||
screen->setOn(true);
|
||||
setBluetoothEnable(true);
|
||||
// within enter() the function getState() returns the state we came from
|
||||
|
||||
@@ -221,7 +228,8 @@ static void powerIdle()
|
||||
|
||||
static void powerExit()
|
||||
{
|
||||
screen->setOn(true);
|
||||
if (screen)
|
||||
screen->setOn(true);
|
||||
setBluetoothEnable(true);
|
||||
|
||||
// Mothballed: print change of power-state to device screen
|
||||
@@ -232,7 +240,8 @@ static void powerExit()
|
||||
static void onEnter()
|
||||
{
|
||||
LOG_DEBUG("State: ON");
|
||||
screen->setOn(true);
|
||||
if (screen)
|
||||
screen->setOn(true);
|
||||
setBluetoothEnable(true);
|
||||
}
|
||||
|
||||
@@ -246,7 +255,8 @@ static void onIdle()
|
||||
|
||||
static void screenPress()
|
||||
{
|
||||
screen->onPress();
|
||||
if (screen)
|
||||
screen->onPress();
|
||||
}
|
||||
|
||||
static void bootEnter()
|
||||
@@ -269,9 +279,6 @@ Fsm powerFSM(&stateBOOT);
|
||||
void PowerFSM_setup()
|
||||
{
|
||||
bool isRouter = (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER ? 1 : 0);
|
||||
bool isTrackerOrSensor = config.device.role == meshtastic_Config_DeviceConfig_Role_TRACKER ||
|
||||
config.device.role == meshtastic_Config_DeviceConfig_Role_TAK_TRACKER ||
|
||||
config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR;
|
||||
bool hasPower = isPowered();
|
||||
|
||||
LOG_INFO("PowerFSM init, USB power=%d", hasPower ? 1 : 0);
|
||||
@@ -383,6 +390,12 @@ void PowerFSM_setup()
|
||||
// See: https://github.com/meshtastic/firmware/issues/1071
|
||||
// Don't add power saving transitions if we are a power saving tracker or sensor or have Wifi enabled. Sleep will be initiated
|
||||
// through the modules
|
||||
|
||||
#if HAS_WIFI || !defined(MESHTASTIC_EXCLUDE_WIFI)
|
||||
bool isTrackerOrSensor = config.device.role == meshtastic_Config_DeviceConfig_Role_TRACKER ||
|
||||
config.device.role == meshtastic_Config_DeviceConfig_Role_TAK_TRACKER ||
|
||||
config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR;
|
||||
|
||||
if ((isRouter || config.power.is_power_saving) && !isWifiAvailable() && !isTrackerOrSensor) {
|
||||
powerFSM.add_timed_transition(&stateNB, &stateLS,
|
||||
Default::getConfiguredOrDefaultMs(config.power.min_wake_secs, default_min_wake_secs), NULL,
|
||||
@@ -400,7 +413,9 @@ void PowerFSM_setup()
|
||||
Default::getConfiguredOrDefaultMs(config.display.screen_on_secs, default_screen_on_secs),
|
||||
NULL, "Screen-on timeout");
|
||||
}
|
||||
#else
|
||||
#endif // HAS_WIFI || !defined(MESHTASTIC_EXCLUDE_WIFI)
|
||||
|
||||
#else // (not) ARCH_ESP32
|
||||
// If not ESP32, light-sleep not used. Check periodically if config has drifted out of stateDark
|
||||
powerFSM.add_timed_transition(&stateDARK, &stateDARK,
|
||||
Default::getConfiguredOrDefaultMs(config.display.screen_on_secs, default_screen_on_secs), NULL,
|
||||
@@ -409,4 +424,4 @@ void PowerFSM_setup()
|
||||
|
||||
powerFSM.run_machine(); // run one iteration of the state machine, so we run our on enter tasks for the initial DARK state
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -80,10 +80,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// Override user saved region, for producing region-locked builds
|
||||
// #define REGULATORY_LORA_REGIONCODE meshtastic_Config_LoRaConfig_RegionCode_SG_923
|
||||
|
||||
// Total system gain in dBm to subtract from Tx power to remain within regulatory ERP limit for non-licensed operators
|
||||
// This value should be set in variant.h and is PA gain + antenna gain (if system ships with an antenna)
|
||||
#ifndef REGULATORY_GAIN_LORA
|
||||
#define REGULATORY_GAIN_LORA 0
|
||||
// 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)
|
||||
#ifndef TX_GAIN_LORA
|
||||
#define TX_GAIN_LORA 0
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -99,8 +99,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// -----------------------------------------------------------------------------
|
||||
// OLED & Input
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#if defined(SEEED_WIO_TRACKER_L1)
|
||||
#define SSD1306_ADDRESS 0x3D
|
||||
#define USE_SH1106
|
||||
#else
|
||||
#define SSD1306_ADDRESS 0x3C
|
||||
#endif
|
||||
#define ST7567_ADDRESS 0x3F
|
||||
|
||||
// The SH1106 controller is almost, but not quite, the same as SSD1306
|
||||
@@ -152,6 +156,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define MLX90614_ADDR_DEF 0x5A
|
||||
#define CGRADSENS_ADDR 0x66
|
||||
#define LTR390UV_ADDR 0x53
|
||||
#define XPOWERS_AXP192_AXP2101_ADDRESS 0x34 // same adress as TCA8418
|
||||
#define PCT2075_ADDR 0x37
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ACCELEROMETER
|
||||
@@ -170,6 +176,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// LED
|
||||
// -----------------------------------------------------------------------------
|
||||
#define NCP5623_ADDR 0x38
|
||||
#define LP5562_ADDR 0x30
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Security
|
||||
@@ -295,6 +302,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#error HW_VENDOR must be defined
|
||||
#endif
|
||||
|
||||
// Support multiple RGB LED configuration
|
||||
#if defined(HAS_NCP5623) || defined(HAS_LP5562) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
|
||||
#define HAS_RGB_LED
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Global switches to turn off features for a minimized build
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -31,8 +31,8 @@ ScanI2C::FoundDevice ScanI2C::firstRTC() const
|
||||
|
||||
ScanI2C::FoundDevice ScanI2C::firstKeyboard() const
|
||||
{
|
||||
ScanI2C::DeviceType types[] = {CARDKB, TDECKKB, BBQ10KB, RAK14004, MPR121KB};
|
||||
return firstOfOrNONE(5, types);
|
||||
ScanI2C::DeviceType types[] = {CARDKB, TDECKKB, BBQ10KB, RAK14004, MPR121KB, TCA8418KB};
|
||||
return firstOfOrNONE(6, types);
|
||||
}
|
||||
|
||||
ScanI2C::FoundDevice ScanI2C::firstAccelerometer() const
|
||||
@@ -41,6 +41,12 @@ ScanI2C::FoundDevice ScanI2C::firstAccelerometer() const
|
||||
return firstOfOrNONE(8, types);
|
||||
}
|
||||
|
||||
ScanI2C::FoundDevice ScanI2C::firstRGBLED() const
|
||||
{
|
||||
ScanI2C::DeviceType types[] = {NCP5623, LP5562};
|
||||
return firstOfOrNONE(2, types);
|
||||
}
|
||||
|
||||
ScanI2C::FoundDevice ScanI2C::find(ScanI2C::DeviceType) const
|
||||
{
|
||||
return DEVICE_NONE;
|
||||
|
||||
@@ -18,7 +18,7 @@ class ScanI2C
|
||||
TDECKKB,
|
||||
BBQ10KB,
|
||||
RAK14004,
|
||||
PMU_AXP192_AXP2101,
|
||||
PMU_AXP192_AXP2101, // has the same adress as the TCA8418KB
|
||||
BME_680,
|
||||
BME_280,
|
||||
BMP_280,
|
||||
@@ -49,6 +49,7 @@ class ScanI2C
|
||||
VEML7700,
|
||||
RCWL9620,
|
||||
NCP5623,
|
||||
LP5562,
|
||||
TSL2591,
|
||||
OPT3001,
|
||||
MLX90632,
|
||||
@@ -69,6 +70,8 @@ class ScanI2C
|
||||
DFROBOT_RAIN,
|
||||
DPS310,
|
||||
LTR390UV,
|
||||
TCA8418KB,
|
||||
PCT2075,
|
||||
} DeviceType;
|
||||
|
||||
// typedef uint8_t DeviceAddress;
|
||||
@@ -121,6 +124,8 @@ class ScanI2C
|
||||
|
||||
FoundDevice firstAccelerometer() const;
|
||||
|
||||
FoundDevice firstRGBLED() const;
|
||||
|
||||
virtual FoundDevice find(DeviceType) const;
|
||||
|
||||
virtual bool exists(DeviceType) const;
|
||||
|
||||
@@ -10,11 +10,6 @@
|
||||
#include "meshUtils.h" // vformat
|
||||
#endif
|
||||
|
||||
// AXP192 and AXP2101 have the same device address, we just need to identify it in Power.cpp
|
||||
#ifndef XPOWERS_AXP192_AXP2101_ADDRESS
|
||||
#define XPOWERS_AXP192_AXP2101_ADDRESS 0x34
|
||||
#endif
|
||||
|
||||
bool in_array(uint8_t *array, int size, uint8_t lookfor)
|
||||
{
|
||||
int i;
|
||||
@@ -218,9 +213,20 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
||||
#ifdef HAS_NCP5623
|
||||
SCAN_SIMPLE_CASE(NCP5623_ADDR, NCP5623, "NCP5623", (uint8_t)addr.address);
|
||||
#endif
|
||||
#ifdef HAS_PMU
|
||||
SCAN_SIMPLE_CASE(XPOWERS_AXP192_AXP2101_ADDRESS, PMU_AXP192_AXP2101, "AXP192/AXP2101", (uint8_t)addr.address)
|
||||
#ifdef HAS_LP5562
|
||||
SCAN_SIMPLE_CASE(LP5562_ADDR, LP5562, "LP5562", (uint8_t)addr.address);
|
||||
#endif
|
||||
case XPOWERS_AXP192_AXP2101_ADDRESS:
|
||||
// Do we have the axp2101/192 or the TCA8418
|
||||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x90), 1);
|
||||
if (registerValue == 0x0) {
|
||||
logFoundDevice("TCA8418", (uint8_t)addr.address);
|
||||
type = TCA8418KB;
|
||||
} else {
|
||||
logFoundDevice("AXP192/AXP2101", (uint8_t)addr.address);
|
||||
type = PMU_AXP192_AXP2101;
|
||||
}
|
||||
break;
|
||||
case BME_ADDR:
|
||||
case BME_ADDR_ALTERNATE:
|
||||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xD0), 1); // GET_ID
|
||||
@@ -428,6 +434,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
||||
SCAN_SIMPLE_CASE(MAX1704X_ADDR, MAX17048, "MAX17048", (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(PCT2075_ADDR, PCT2075, "PCT2075", (uint8_t)addr.address);
|
||||
#ifdef HAS_TPS65233
|
||||
SCAN_SIMPLE_CASE(TPS65233_ADDR, TPS65233, "TPS65233", (uint8_t)addr.address);
|
||||
#endif
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "RTC.h"
|
||||
#include "Throttle.h"
|
||||
#include "buzz.h"
|
||||
#include "concurrency/Periodic.h"
|
||||
#include "meshUtils.h"
|
||||
|
||||
#include "main.h" // pmu_found
|
||||
@@ -89,6 +90,45 @@ static const char *getGPSPowerStateString(GPSPowerState state)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PIN_GPS_SWITCH
|
||||
// If we have a hardware switch, define a periodic watcher outside of the GPS runOnce thread, since this can be sleeping
|
||||
// idefinitely
|
||||
|
||||
int lastState = LOW;
|
||||
bool firstrun = true;
|
||||
|
||||
static int32_t gpsSwitch()
|
||||
{
|
||||
if (gps) {
|
||||
int currentState = digitalRead(PIN_GPS_SWITCH);
|
||||
|
||||
// if the switch is set to zero, disable the GPS Thread
|
||||
if (firstrun)
|
||||
if (currentState == LOW)
|
||||
lastState = HIGH;
|
||||
|
||||
if (currentState != lastState) {
|
||||
if (currentState == LOW) {
|
||||
config.position.gps_mode = meshtastic_Config_PositionConfig_GpsMode_DISABLED;
|
||||
if (!firstrun)
|
||||
playGPSDisableBeep();
|
||||
gps->disable();
|
||||
} else {
|
||||
config.position.gps_mode = meshtastic_Config_PositionConfig_GpsMode_ENABLED;
|
||||
if (!firstrun)
|
||||
playGPSEnableBeep();
|
||||
gps->enable();
|
||||
}
|
||||
lastState = currentState;
|
||||
}
|
||||
firstrun = false;
|
||||
}
|
||||
return 1000;
|
||||
}
|
||||
|
||||
static concurrency::Periodic *gpsPeriodic;
|
||||
#endif
|
||||
|
||||
static void UBXChecksum(uint8_t *message, size_t length)
|
||||
{
|
||||
uint8_t CK_A = 0, CK_B = 0;
|
||||
@@ -530,6 +570,19 @@ bool GPS::setup()
|
||||
// Switch to Fitness Mode, for running and walking purpose with low speed (<5 m/s)
|
||||
_serial_gps->write("$PMTK886,1*29\r\n");
|
||||
delay(250);
|
||||
} else if (gnssModel == GNSS_MODEL_MTK_PA1010D) {
|
||||
// PA1010D is used in the Pimoroni GPS board.
|
||||
|
||||
// Enable all constellations.
|
||||
_serial_gps->write("$PMTK353,1,1,1,1,1*2A\r\n");
|
||||
// Above command will reset the GPS and takes longer before it will accept new commands
|
||||
delay(1000);
|
||||
// Only ask for RMC and GGA (GNRMC and GNGGA)
|
||||
_serial_gps->write("$PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28\r\n");
|
||||
delay(250);
|
||||
// Enable SBAS / WAAS
|
||||
_serial_gps->write("$PMTK301,2*2E\r\n");
|
||||
delay(250);
|
||||
} else if (gnssModel == GNSS_MODEL_MTK_PA1616S) {
|
||||
// PA1616S is used in some GPS breakout boards from Adafruit
|
||||
// PA1616S does not have GLONASS capability. PA1616D does, but is not implemented here.
|
||||
@@ -770,13 +823,6 @@ void GPS::setPowerState(GPSPowerState newState, uint32_t sleepTime)
|
||||
powerState = newState;
|
||||
LOG_INFO("GPS power state move from %s to %s", getGPSPowerStateString(oldState), getGPSPowerStateString(newState));
|
||||
|
||||
#ifdef HELTEC_MESH_NODE_T114
|
||||
if ((oldState == GPS_OFF || oldState == GPS_HARDSLEEP) && (newState != GPS_OFF && newState != GPS_HARDSLEEP)) {
|
||||
_serial_gps->begin(serialSpeeds[speedSelect]);
|
||||
} else if ((newState == GPS_OFF || newState == GPS_HARDSLEEP) && (oldState != GPS_OFF && oldState != GPS_HARDSLEEP)) {
|
||||
_serial_gps->end();
|
||||
}
|
||||
#endif
|
||||
switch (newState) {
|
||||
case GPS_ACTIVE:
|
||||
case GPS_IDLE:
|
||||
@@ -1204,9 +1250,11 @@ GnssModel_t GPS::probe(int serialSpeed)
|
||||
// Close all NMEA sentences, valid for MTK3333 and MTK3339 platforms
|
||||
_serial_gps->write("$PMTK514,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*2E\r\n");
|
||||
delay(20);
|
||||
std::vector<ChipInfo> mtk = {{"L76B", "Quectel-L76B", GNSS_MODEL_MTK_L76B},
|
||||
{"PA1616S", "1616S", GNSS_MODEL_MTK_PA1616S},
|
||||
{"LS20031", "MC-1513", GNSS_MODEL_MTK_L76B}};
|
||||
std::vector<ChipInfo> mtk = {{"L76B", "Quectel-L76B", GNSS_MODEL_MTK_L76B}, {"PA1010D", "1010D", GNSS_MODEL_MTK_PA1010D},
|
||||
{"PA1616S", "1616S", GNSS_MODEL_MTK_PA1616S}, {"LS20031", "MC-1513", GNSS_MODEL_MTK_L76B},
|
||||
{"L96", "Quectel-L96", GNSS_MODEL_MTK_L76B}, {"L80-R", "_3337_", GNSS_MODEL_MTK_L76B},
|
||||
{"L80", "_3339_", GNSS_MODEL_MTK_L76B}};
|
||||
|
||||
PROBE_FAMILY("MTK Family", "$PMTK605*31", mtk, 500);
|
||||
|
||||
uint8_t cfg_rate[] = {0xB5, 0x62, 0x06, 0x08, 0x00, 0x00, 0x00, 0x00};
|
||||
@@ -1389,6 +1437,12 @@ GPS *GPS::createGps()
|
||||
pinMode(PIN_GPS_PPS, INPUT);
|
||||
#endif
|
||||
|
||||
#ifdef PIN_GPS_SWITCH
|
||||
// toggle GPS via external GPIO switch
|
||||
pinMode(PIN_GPS_SWITCH, INPUT);
|
||||
gpsPeriodic = new concurrency::Periodic("GPSSwitch", gpsSwitch);
|
||||
#endif
|
||||
|
||||
// Currently disabled per issue #525 (TinyGPS++ crash bug)
|
||||
// when fixed upstream, can be un-disabled to enable 3D FixType and PDOP
|
||||
#ifndef TINYGPS_OPTION_NO_CUSTOM_FIELDS
|
||||
|
||||
@@ -27,6 +27,7 @@ typedef enum {
|
||||
GNSS_MODEL_UC6580,
|
||||
GNSS_MODEL_UNKNOWN,
|
||||
GNSS_MODEL_MTK_L76B,
|
||||
GNSS_MODEL_MTK_PA1010D,
|
||||
GNSS_MODEL_MTK_PA1616S,
|
||||
GNSS_MODEL_AG3335,
|
||||
GNSS_MODEL_AG3352,
|
||||
|
||||
@@ -224,7 +224,7 @@ static const uint8_t _message_GSA[] = {
|
||||
0x00, // Rate for DDC
|
||||
0x00, // Rate for UART1
|
||||
0x00, // Rate for UART2
|
||||
0x00, // Rate for USB usefull for native linux
|
||||
0x00, // Rate for USB useful for native linux
|
||||
0x00, // Rate for SPI
|
||||
0x00 // Reserved
|
||||
};
|
||||
@@ -258,7 +258,7 @@ static const uint8_t _message_RMC[] = {
|
||||
0x00, // Rate for DDC
|
||||
0x01, // Rate for UART1
|
||||
0x00, // Rate for UART2
|
||||
0x01, // Rate for USB usefull for native linux
|
||||
0x01, // Rate for USB useful for native linux
|
||||
0x00, // Rate for SPI
|
||||
0x00 // Reserved
|
||||
};
|
||||
@@ -269,7 +269,7 @@ static const uint8_t _message_GGA[] = {
|
||||
0x00, // Rate for DDC
|
||||
0x01, // Rate for UART1
|
||||
0x00, // Rate for UART2
|
||||
0x01, // Rate for USB, usefull for native linux
|
||||
0x01, // Rate for USB, useful for native linux
|
||||
0x00, // Rate for SPI
|
||||
0x00 // Reserved
|
||||
};
|
||||
|
||||
@@ -129,9 +129,10 @@ bool EInkDisplay::connect()
|
||||
// backlight power, HIGH is backlight on, LOW is off
|
||||
pinMode(PIN_EINK_EN, OUTPUT);
|
||||
#ifdef ELECROW_ThinkNode_M1
|
||||
digitalWrite(PIN_EINK_EN, LOW);
|
||||
#else
|
||||
// ThinkNode M1 has a hardware dimmable backlight. Start enabled
|
||||
digitalWrite(PIN_EINK_EN, HIGH);
|
||||
#else
|
||||
digitalWrite(PIN_EINK_EN, LOW);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -180,7 +181,6 @@ bool EInkDisplay::connect()
|
||||
// Start HSPI
|
||||
hspi = new SPIClass(HSPI);
|
||||
hspi->begin(PIN_EINK_SCLK, -1, PIN_EINK_MOSI, PIN_EINK_CS); // SCLK, MISO, MOSI, SS
|
||||
|
||||
// VExt already enabled in setup()
|
||||
// RTC GPIO hold disabled in setup()
|
||||
|
||||
@@ -217,6 +217,21 @@ bool EInkDisplay::connect()
|
||||
adafruitDisplay->setRotation(1);
|
||||
adafruitDisplay->setPartialWindow(0, 0, EINK_WIDTH, EINK_HEIGHT);
|
||||
}
|
||||
#elif defined(HELTEC_MESH_POCKET)
|
||||
{
|
||||
spi1 = &SPI1;
|
||||
spi1->begin();
|
||||
// VExt already enabled in setup()
|
||||
// RTC GPIO hold disabled in setup()
|
||||
|
||||
// Create GxEPD2 objects
|
||||
auto lowLevel = new EINK_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY, *spi1);
|
||||
adafruitDisplay = new GxEPD2_BW<EINK_DISPLAY_MODEL, EINK_DISPLAY_MODEL::HEIGHT>(*lowLevel);
|
||||
|
||||
// Init GxEPD2
|
||||
adafruitDisplay->init();
|
||||
adafruitDisplay->setRotation(3);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
||||
@@ -73,6 +73,10 @@ class EInkDisplay : public OLEDDisplay
|
||||
SPIClass *hspi = NULL;
|
||||
#endif
|
||||
|
||||
#if defined(HELTEC_MESH_POCKET)
|
||||
SPIClass *spi1 = NULL;
|
||||
#endif
|
||||
|
||||
private:
|
||||
// FIXME quick hack to limit drawing to a very slow rate
|
||||
uint32_t lastDrawMsec = 0;
|
||||
|
||||
5
src/graphics/NomadStarLED.h
Normal file
5
src/graphics/NomadStarLED.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#ifdef HAS_LP5562
|
||||
#include <LP5562.h>
|
||||
extern LP5562 rgbw;
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,10 @@
|
||||
#include "detect/ScanI2C.h"
|
||||
#include "mesh/generated/meshtastic/config.pb.h"
|
||||
#include <OLEDDisplay.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#define getStringCenteredX(s) ((SCREEN_WIDTH - display->getStringWidth(s)) / 2)
|
||||
|
||||
#if !HAS_SCREEN
|
||||
#include "power.h"
|
||||
@@ -64,6 +68,7 @@ class Screen
|
||||
#include "mesh/MeshModule.h"
|
||||
#include "power.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// 0 to 255, though particular variants might define different defaults
|
||||
#ifndef BRIGHTNESS_DEFAULT
|
||||
@@ -90,7 +95,7 @@ class Screen
|
||||
|
||||
/// Convert an integer GPS coords to a floating point
|
||||
#define DegD(i) (i * 1e-7)
|
||||
|
||||
extern bool hasUnreadMessage;
|
||||
namespace
|
||||
{
|
||||
/// A basic 2D point class for drawing
|
||||
@@ -181,9 +186,23 @@ class Screen : public concurrency::OSThread
|
||||
|
||||
public:
|
||||
explicit Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY);
|
||||
|
||||
size_t frameCount = 0; // Total number of active frames
|
||||
~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
|
||||
};
|
||||
|
||||
// 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 &operator=(const Screen &) = delete;
|
||||
|
||||
@@ -214,21 +233,11 @@ class Screen : public concurrency::OSThread
|
||||
|
||||
void blink();
|
||||
|
||||
void drawFrameText(OLEDDisplay *, OLEDDisplayUiState *, int16_t, int16_t, const char *);
|
||||
|
||||
void getTimeAgoStr(uint32_t agoSecs, char *timeStr, uint8_t maxLength);
|
||||
|
||||
// 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);
|
||||
|
||||
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)
|
||||
void onPress() { enqueueCmd(ScreenCmd{.cmd = Cmd::ON_PRESS}); }
|
||||
void showPrevFrame() { enqueueCmd(ScreenCmd{.cmd = Cmd::SHOW_PREV_FRAME}); }
|
||||
@@ -260,6 +269,8 @@ class Screen : public concurrency::OSThread
|
||||
enqueueCmd(cmd);
|
||||
}
|
||||
|
||||
void showOverlayBanner(const char *message, uint32_t durationMs = 3000);
|
||||
|
||||
void startFirmwareUpdateScreen()
|
||||
{
|
||||
ScreenCmd cmd;
|
||||
@@ -306,9 +317,6 @@ class Screen : public concurrency::OSThread
|
||||
}
|
||||
}
|
||||
|
||||
/// 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
|
||||
static char customFontTableLookup(const uint8_t ch)
|
||||
{
|
||||
@@ -600,30 +608,26 @@ class Screen : public concurrency::OSThread
|
||||
// - Used to dismiss the currently shown frame (txt; waypoint) by CardKB combo
|
||||
struct FramesetInfo {
|
||||
struct FramePositions {
|
||||
uint8_t fault = 0;
|
||||
uint8_t textMessage = 0;
|
||||
uint8_t waypoint = 0;
|
||||
uint8_t focusedModule = 0;
|
||||
uint8_t log = 0;
|
||||
uint8_t settings = 0;
|
||||
uint8_t wifi = 0;
|
||||
uint8_t fault = 255;
|
||||
uint8_t textMessage = 255;
|
||||
uint8_t waypoint = 255;
|
||||
uint8_t focusedModule = 255;
|
||||
uint8_t log = 255;
|
||||
uint8_t settings = 255;
|
||||
uint8_t wifi = 255;
|
||||
uint8_t deviceFocused = 255;
|
||||
uint8_t memory = 255;
|
||||
} positions;
|
||||
|
||||
uint8_t frameCount = 0;
|
||||
} framesetInfo;
|
||||
|
||||
// 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
|
||||
};
|
||||
|
||||
// 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);
|
||||
struct DismissedFrames {
|
||||
bool textMessage = false;
|
||||
bool waypoint = false;
|
||||
bool wifi = false;
|
||||
bool memory = false;
|
||||
} dismissedFrames;
|
||||
|
||||
/// Try to start drawing ASAP
|
||||
void setFastFramerate();
|
||||
@@ -631,13 +635,6 @@ class Screen : public concurrency::OSThread
|
||||
// Sets frame up for immediate drawing
|
||||
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);
|
||||
|
||||
@@ -691,4 +688,13 @@ class Screen : public concurrency::OSThread
|
||||
|
||||
} // namespace graphics
|
||||
|
||||
extern "C" {
|
||||
extern char *alertBannerMessage;
|
||||
extern uint32_t alertBannerUntil;
|
||||
}
|
||||
|
||||
// Extern declarations for function symbols used in UIRenderer
|
||||
extern std::vector<std::string> functionSymbol;
|
||||
extern std::string functionSymbolString;
|
||||
|
||||
#endif
|
||||
@@ -16,6 +16,10 @@
|
||||
#include "graphics/fonts/OLEDDisplayFontsCS.h"
|
||||
#endif
|
||||
|
||||
#ifdef CROWPANEL_ESP32S3_5_EPAPER
|
||||
#include "graphics/fonts/EinkDisplayFonts.h"
|
||||
#endif
|
||||
|
||||
#ifdef OLED_PL
|
||||
#define FONT_SMALL_LOCAL ArialMT_Plain_10_PL
|
||||
#else
|
||||
@@ -61,7 +65,7 @@
|
||||
#endif
|
||||
|
||||
#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ILI9342_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || \
|
||||
defined(ST7789_CS) || defined(USE_ST7789) || defined(HX8357_CS)) && \
|
||||
defined(ST7789_CS) || defined(USE_ST7789) || defined(HX8357_CS) || defined(ILI9488_CS)) && \
|
||||
!defined(DISPLAY_FORCE_SMALL_FONTS)
|
||||
// The screen is bigger so use bigger fonts
|
||||
#define FONT_SMALL FONT_MEDIUM_LOCAL // Height: 19
|
||||
@@ -74,13 +78,12 @@
|
||||
#endif
|
||||
|
||||
#if defined(CROWPANEL_ESP32S3_5_EPAPER)
|
||||
#include "graphics/fonts/EinkDisplayFonts.h"
|
||||
#undef FONT_SMALL
|
||||
#undef FONT_MEDIUM
|
||||
#undef FONT_LARGE
|
||||
#define FONT_SMALL FONT_LARGE_LOCAL // Height: 30
|
||||
#define FONT_MEDIUM FONT_LARGE_LOCAL // Height: 30
|
||||
#define FONT_LARGE FONT_LARGE_LOCAL // Height: 30
|
||||
#define FONT_SMALL Monospaced_plain_30
|
||||
#define FONT_MEDIUM Monospaced_plain_30
|
||||
#define FONT_LARGE Monospaced_plain_30
|
||||
#endif
|
||||
|
||||
#define _fontHeight(font) ((font)[1] + 1) // height is position 1
|
||||
|
||||
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;
|
||||
256
src/graphics/SharedUIDisplay.cpp
Normal file
256
src/graphics/SharedUIDisplay.cpp
Normal file
@@ -0,0 +1,256 @@
|
||||
#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
|
||||
{
|
||||
|
||||
// === Shared External State ===
|
||||
bool hasUnreadMessage = false;
|
||||
bool isMuted = 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)
|
||||
{
|
||||
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();
|
||||
|
||||
const bool useBigIcons = (screenW > 128);
|
||||
|
||||
// === Inverted Header Background ===
|
||||
if (isInverted) {
|
||||
drawRoundedHighlight(display, x, y, screenW, highlightHeight, 2);
|
||||
display->setColor(BLACK);
|
||||
} else {
|
||||
if (screenW > 128) {
|
||||
display->drawLine(0, 20, screenW, 20);
|
||||
} else {
|
||||
display->drawLine(0, 14, screenW, 14);
|
||||
}
|
||||
}
|
||||
|
||||
// === Battery State ===
|
||||
int chargePercent = powerStatus->getBatteryChargePercent();
|
||||
bool isCharging = powerStatus->getIsCharging() == meshtastic::OptionalBool::OptTrue;
|
||||
static uint32_t lastBlinkShared = 0;
|
||||
static bool isBoltVisibleShared = true;
|
||||
uint32_t now = millis();
|
||||
|
||||
#ifndef USE_EINK
|
||||
if (isCharging && now - lastBlinkShared > 500) {
|
||||
isBoltVisibleShared = !isBoltVisibleShared;
|
||||
lastBlinkShared = now;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool useHorizontalBattery = (screenW > 128 && screenW >= screenH);
|
||||
const int textY = y + (highlightHeight - FONT_HEIGHT_SMALL) / 2;
|
||||
|
||||
// === Battery Icons ===
|
||||
if (useHorizontalBattery) {
|
||||
int batteryX = 2;
|
||||
int batteryY = HEADER_OFFSET_Y + 2;
|
||||
display->drawXbm(batteryX, batteryY, 29, 15, batteryBitmap_h);
|
||||
if (isCharging && isBoltVisibleShared)
|
||||
display->drawXbm(batteryX + 9, batteryY + 1, 9, 13, lightning_bolt_h);
|
||||
else {
|
||||
display->drawXbm(batteryX + 8, batteryY, 12, 15, batteryBitmap_sidegaps_h);
|
||||
int fillWidth = 24 * chargePercent / 100;
|
||||
display->fillRect(batteryX + 1, batteryY + 1, fillWidth, 13);
|
||||
}
|
||||
} else {
|
||||
int batteryX = 1;
|
||||
int batteryY = HEADER_OFFSET_Y + 1;
|
||||
#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);
|
||||
}
|
||||
}
|
||||
|
||||
// === Battery % Display ===
|
||||
char chargeStr[4];
|
||||
snprintf(chargeStr, sizeof(chargeStr), "%d", chargePercent);
|
||||
int chargeNumWidth = display->getStringWidth(chargeStr);
|
||||
const int batteryOffset = useHorizontalBattery ? 28 : 6;
|
||||
#ifdef USE_EINK
|
||||
const int percentX = x + xOffset + batteryOffset - 2;
|
||||
#else
|
||||
const int percentX = x + xOffset + batteryOffset;
|
||||
#endif
|
||||
display->drawString(percentX, textY, chargeStr);
|
||||
display->drawString(percentX + chargeNumWidth - 1, textY, "%");
|
||||
if (isBold) {
|
||||
display->drawString(percentX + 1, textY, chargeStr);
|
||||
display->drawString(percentX + 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) {
|
||||
// === 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 + 4;
|
||||
|
||||
// === Show Mail or Mute Icon to the Left of Time ===
|
||||
int iconRightEdge = timeX - 2;
|
||||
|
||||
static bool isMailIconVisible = true;
|
||||
static uint32_t lastMailBlink = 0;
|
||||
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 (useBigIcons) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// === 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;
|
||||
|
||||
static bool isMailIconVisible = true;
|
||||
static uint32_t lastMailBlink = 0;
|
||||
bool showMail = false;
|
||||
|
||||
if (hasUnreadMessage) {
|
||||
if (now - lastMailBlink > 500) {
|
||||
isMailIconVisible = !isMailIconVisible;
|
||||
lastMailBlink = now;
|
||||
}
|
||||
showMail = isMailIconVisible;
|
||||
}
|
||||
|
||||
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 (useBigIcons) {
|
||||
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
|
||||
}
|
||||
|
||||
} // namespace graphics
|
||||
46
src/graphics/SharedUIDisplay.h
Normal file
46
src/graphics/SharedUIDisplay.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
|
||||
#include <OLEDDisplay.h>
|
||||
|
||||
namespace graphics
|
||||
{
|
||||
|
||||
// =======================
|
||||
// Shared UI Helpers
|
||||
// =======================
|
||||
|
||||
// Compact line layout
|
||||
#define compactFirstLine ((FONT_HEIGHT_SMALL - 1) * 1)
|
||||
#define compactSecondLine ((FONT_HEIGHT_SMALL - 1) * 2) - 2
|
||||
#define compactThirdLine ((FONT_HEIGHT_SMALL - 1) * 3) - 4
|
||||
#define compactFourthLine ((FONT_HEIGHT_SMALL - 1) * 4) - 6
|
||||
#define compactFifthLine ((FONT_HEIGHT_SMALL - 1) * 5) - 8
|
||||
|
||||
// Standard line layout
|
||||
#define standardFirstLine (FONT_HEIGHT_SMALL + 1) * 1
|
||||
#define standardSecondLine (FONT_HEIGHT_SMALL + 1) * 2
|
||||
#define standardThirdLine (FONT_HEIGHT_SMALL + 1) * 3
|
||||
#define standardFourthLine (FONT_HEIGHT_SMALL + 1) * 4
|
||||
|
||||
// More Compact line layout
|
||||
#define moreCompactFirstLine compactFirstLine
|
||||
#define moreCompactSecondLine (moreCompactFirstLine + (FONT_HEIGHT_SMALL - 5))
|
||||
#define moreCompactThirdLine (moreCompactSecondLine + (FONT_HEIGHT_SMALL - 5))
|
||||
#define moreCompactFourthLine (moreCompactThirdLine + (FONT_HEIGHT_SMALL - 5))
|
||||
#define moreCompactFifthLine (moreCompactFourthLine + (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;
|
||||
|
||||
// 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);
|
||||
|
||||
} // namespace graphics
|
||||
@@ -120,6 +120,303 @@ static void rak14014_tpIntHandle(void)
|
||||
_rak14014_touch_int = true;
|
||||
}
|
||||
|
||||
#elif defined(ST72xx_DE)
|
||||
#include <LovyanGFX.hpp>
|
||||
#include <TCA9534.h>
|
||||
#include <lgfx/v1/platforms/esp32s3/Bus_RGB.hpp>
|
||||
#include <lgfx/v1/platforms/esp32s3/Panel_RGB.hpp>
|
||||
TCA9534 ioex;
|
||||
|
||||
class LGFX : public lgfx::LGFX_Device
|
||||
{
|
||||
lgfx::Bus_RGB _bus_instance;
|
||||
lgfx::Panel_RGB _panel_instance;
|
||||
lgfx::Touch_GT911 _touch_instance;
|
||||
|
||||
public:
|
||||
const uint16_t screenWidth = TFT_WIDTH;
|
||||
const uint16_t screenHeight = TFT_HEIGHT;
|
||||
|
||||
bool init_impl(bool use_reset, bool use_clear) override
|
||||
{
|
||||
ioex.attach(Wire);
|
||||
ioex.setDeviceAddress(0x18);
|
||||
ioex.config(1, TCA9534::Config::OUT);
|
||||
ioex.config(2, TCA9534::Config::OUT);
|
||||
ioex.config(3, TCA9534::Config::OUT);
|
||||
ioex.config(4, TCA9534::Config::OUT);
|
||||
|
||||
ioex.output(1, TCA9534::Level::H);
|
||||
ioex.output(3, TCA9534::Level::L);
|
||||
ioex.output(4, TCA9534::Level::H);
|
||||
|
||||
pinMode(1, OUTPUT);
|
||||
digitalWrite(1, LOW);
|
||||
ioex.output(2, TCA9534::Level::L);
|
||||
delay(20);
|
||||
ioex.output(2, TCA9534::Level::H);
|
||||
delay(100);
|
||||
pinMode(1, INPUT);
|
||||
|
||||
return LGFX_Device::init_impl(use_reset, use_clear);
|
||||
}
|
||||
|
||||
LGFX(void)
|
||||
{
|
||||
{
|
||||
auto cfg = _panel_instance.config();
|
||||
|
||||
cfg.memory_width = screenWidth;
|
||||
cfg.memory_height = screenHeight;
|
||||
cfg.panel_width = screenWidth;
|
||||
cfg.panel_height = screenHeight;
|
||||
cfg.offset_x = 0;
|
||||
cfg.offset_y = 0;
|
||||
cfg.offset_rotation = 0;
|
||||
_panel_instance.config(cfg);
|
||||
}
|
||||
|
||||
{
|
||||
auto cfg = _panel_instance.config_detail();
|
||||
cfg.use_psram = 0;
|
||||
_panel_instance.config_detail(cfg);
|
||||
}
|
||||
|
||||
{
|
||||
auto cfg = _bus_instance.config();
|
||||
cfg.panel = &_panel_instance;
|
||||
cfg.pin_d0 = ST72xx_B0; // B0
|
||||
cfg.pin_d1 = ST72xx_B1; // B1
|
||||
cfg.pin_d2 = ST72xx_B2; // B2
|
||||
cfg.pin_d3 = ST72xx_B3; // B3
|
||||
cfg.pin_d4 = ST72xx_B4; // B4
|
||||
cfg.pin_d5 = ST72xx_G0; // G0
|
||||
cfg.pin_d6 = ST72xx_G1; // G1
|
||||
cfg.pin_d7 = ST72xx_G2; // G2
|
||||
cfg.pin_d8 = ST72xx_G3; // G3
|
||||
cfg.pin_d9 = ST72xx_G4; // G4
|
||||
cfg.pin_d10 = ST72xx_G5; // G5
|
||||
cfg.pin_d11 = ST72xx_R0; // R0
|
||||
cfg.pin_d12 = ST72xx_R1; // R1
|
||||
cfg.pin_d13 = ST72xx_R2; // R2
|
||||
cfg.pin_d14 = ST72xx_R3; // R3
|
||||
cfg.pin_d15 = ST72xx_R4; // R4
|
||||
|
||||
cfg.pin_henable = ST72xx_DE;
|
||||
cfg.pin_vsync = ST72xx_VSYNC;
|
||||
cfg.pin_hsync = ST72xx_HSYNC;
|
||||
cfg.pin_pclk = ST72xx_PCLK;
|
||||
cfg.freq_write = 13000000;
|
||||
|
||||
#ifdef ST7265_HSYNC_POLARITY
|
||||
cfg.hsync_polarity = ST7265_HSYNC_POLARITY;
|
||||
cfg.hsync_front_porch = ST7265_HSYNC_FRONT_PORCH; // 8;
|
||||
cfg.hsync_pulse_width = ST7265_HSYNC_PULSE_WIDTH; // 4;
|
||||
cfg.hsync_back_porch = ST7265_HSYNC_BACK_PORCH; // 8;
|
||||
|
||||
cfg.vsync_polarity = ST7265_VSYNC_POLARITY; // 0;
|
||||
cfg.vsync_front_porch = ST7265_VSYNC_FRONT_PORCH; // 8;
|
||||
cfg.vsync_pulse_width = ST7265_VSYNC_PULSE_WIDTH; // 4;
|
||||
cfg.vsync_back_porch = ST7265_VSYNC_BACK_PORCH; // 8;
|
||||
|
||||
cfg.pclk_idle_high = 1;
|
||||
cfg.pclk_active_neg = ST7265_PCLK_ACTIVE_NEG; // 0;
|
||||
// cfg.pclk_idle_high = 0;
|
||||
// cfg.de_idle_high = 1;
|
||||
#endif
|
||||
|
||||
#ifdef ST7262_HSYNC_POLARITY
|
||||
cfg.hsync_polarity = ST7262_HSYNC_POLARITY;
|
||||
cfg.hsync_front_porch = ST7262_HSYNC_FRONT_PORCH; // 8;
|
||||
cfg.hsync_pulse_width = ST7262_HSYNC_PULSE_WIDTH; // 4;
|
||||
cfg.hsync_back_porch = ST7262_HSYNC_BACK_PORCH; // 8;
|
||||
|
||||
cfg.vsync_polarity = ST7262_VSYNC_POLARITY; // 0;
|
||||
cfg.vsync_front_porch = ST7262_VSYNC_FRONT_PORCH; // 8;
|
||||
cfg.vsync_pulse_width = ST7262_VSYNC_PULSE_WIDTH; // 4;
|
||||
cfg.vsync_back_porch = ST7262_VSYNC_BACK_PORCH; // 8;
|
||||
|
||||
cfg.pclk_idle_high = 1;
|
||||
cfg.pclk_active_neg = ST7262_PCLK_ACTIVE_NEG; // 0;
|
||||
// cfg.pclk_idle_high = 0;
|
||||
// cfg.de_idle_high = 1;
|
||||
#endif
|
||||
|
||||
#ifdef SC7277_HSYNC_POLARITY
|
||||
cfg.hsync_polarity = SC7277_HSYNC_POLARITY;
|
||||
cfg.hsync_front_porch = SC7277_HSYNC_FRONT_PORCH; // 8;
|
||||
cfg.hsync_pulse_width = SC7277_HSYNC_PULSE_WIDTH; // 4;
|
||||
cfg.hsync_back_porch = SC7277_HSYNC_BACK_PORCH; // 8;
|
||||
|
||||
cfg.vsync_polarity = SC7277_VSYNC_POLARITY; // 0;
|
||||
cfg.vsync_front_porch = SC7277_VSYNC_FRONT_PORCH; // 8;
|
||||
cfg.vsync_pulse_width = SC7277_VSYNC_PULSE_WIDTH; // 4;
|
||||
cfg.vsync_back_porch = SC7277_VSYNC_BACK_PORCH; // 8;
|
||||
|
||||
cfg.pclk_idle_high = 1;
|
||||
cfg.pclk_active_neg = SC7277_PCLK_ACTIVE_NEG; // 0;
|
||||
// cfg.pclk_idle_high = 0;
|
||||
// cfg.de_idle_high = 1;
|
||||
#endif
|
||||
|
||||
_bus_instance.config(cfg);
|
||||
}
|
||||
_panel_instance.setBus(&_bus_instance);
|
||||
|
||||
{
|
||||
auto cfg = _touch_instance.config();
|
||||
cfg.x_min = 0;
|
||||
cfg.x_max = TFT_WIDTH;
|
||||
cfg.y_min = 0;
|
||||
cfg.y_max = TFT_HEIGHT;
|
||||
cfg.pin_int = -1;
|
||||
cfg.pin_rst = -1;
|
||||
cfg.bus_shared = true;
|
||||
cfg.offset_rotation = 0;
|
||||
|
||||
cfg.i2c_port = 0;
|
||||
cfg.i2c_addr = 0x5D;
|
||||
cfg.pin_sda = I2C_SDA;
|
||||
cfg.pin_scl = I2C_SCL;
|
||||
cfg.freq = 400000;
|
||||
_touch_instance.config(cfg);
|
||||
_panel_instance.setTouch(&_touch_instance);
|
||||
}
|
||||
|
||||
setPanel(&_panel_instance);
|
||||
}
|
||||
};
|
||||
|
||||
static LGFX *tft = nullptr;
|
||||
|
||||
#elif defined(ILI9488_CS)
|
||||
#include <LovyanGFX.hpp> // Graphics and font library for ILI9488 driver chip
|
||||
|
||||
class LGFX : public lgfx::LGFX_Device
|
||||
{
|
||||
lgfx::Panel_ILI9488 _panel_instance;
|
||||
lgfx::Bus_SPI _bus_instance;
|
||||
lgfx::Light_PWM _light_instance;
|
||||
lgfx::Touch_GT911 _touch_instance;
|
||||
|
||||
public:
|
||||
LGFX(void)
|
||||
{
|
||||
{
|
||||
auto cfg = _bus_instance.config();
|
||||
|
||||
// configure SPI
|
||||
cfg.spi_host = ILI9488_SPI_HOST; // ESP32-S2,S3,C3 : SPI2_HOST or SPI3_HOST / ESP32 : VSPI_HOST or HSPI_HOST
|
||||
cfg.spi_mode = 0;
|
||||
cfg.freq_write = SPI_FREQUENCY; // SPI clock for transmission (up to 80MHz, rounded to the value obtained by dividing
|
||||
// 80MHz by an integer)
|
||||
cfg.freq_read = SPI_READ_FREQUENCY; // SPI clock when receiving
|
||||
cfg.spi_3wire = false; // Set to true if reception is done on the MOSI pin
|
||||
cfg.use_lock = true; // Set to true to use transaction locking
|
||||
cfg.dma_channel = SPI_DMA_CH_AUTO; // SPI_DMA_CH_AUTO; // Set DMA channel to use (0=not use DMA / 1=1ch / 2=ch /
|
||||
// SPI_DMA_CH_AUTO=auto setting)
|
||||
cfg.pin_sclk = ILI9488_SCK; // Set SPI SCLK pin number
|
||||
cfg.pin_mosi = ILI9488_SDA; // Set SPI MOSI pin number
|
||||
cfg.pin_miso = ILI9488_MISO; // Set SPI MISO pin number (-1 = disable)
|
||||
cfg.pin_dc = ILI9488_RS; // Set SPI DC pin number (-1 = disable)
|
||||
|
||||
_bus_instance.config(cfg); // applies the set value to the bus.
|
||||
_panel_instance.setBus(&_bus_instance); // set the bus on the panel.
|
||||
}
|
||||
|
||||
{ // Set the display panel control.
|
||||
auto cfg = _panel_instance.config(); // Gets a structure for display panel settings.
|
||||
|
||||
cfg.pin_cs = ILI9488_CS; // Pin number where CS is connected (-1 = disable)
|
||||
cfg.pin_rst = -1; // Pin number where RST is connected (-1 = disable)
|
||||
cfg.pin_busy = -1; // Pin number where BUSY is connected (-1 = disable)
|
||||
|
||||
// The following setting values are general initial values for each panel, so please comment out any
|
||||
// unknown items and try them.
|
||||
|
||||
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)
|
||||
#ifdef TFT_DUMMY_READ_PIXELS
|
||||
cfg.dummy_read_pixel = TFT_DUMMY_READ_PIXELS; // Number of bits for dummy read before pixel readout
|
||||
#else
|
||||
cfg.dummy_read_pixel = 9; // Number of bits for dummy read before pixel readout
|
||||
#endif
|
||||
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.invert = true; // Set to true if the light/darkness of the panel is reversed
|
||||
cfg.rgb_order = false; // Set to true if the panel's red and blue are swapped
|
||||
cfg.dlen_16bit =
|
||||
false; // Set to true for panels that transmit data length in 16-bit units with 16-bit parallel or SPI
|
||||
cfg.bus_shared = true; // If the bus is shared with the SD card, set to true (bus control with drawJpgFile etc.)
|
||||
|
||||
// Set the following only when the display is shifted with a driver with a variable number of pixels, such as the
|
||||
// ST7735 or ILI9163.
|
||||
// cfg.memory_width = TFT_WIDTH; // Maximum width supported by the driver IC
|
||||
// cfg.memory_height = TFT_HEIGHT; // Maximum height supported by the driver IC
|
||||
_panel_instance.config(cfg);
|
||||
}
|
||||
|
||||
#ifdef ILI9488_BL
|
||||
// Set the backlight control
|
||||
{
|
||||
auto cfg = _light_instance.config(); // Gets a structure for backlight settings.
|
||||
|
||||
cfg.pin_bl = ILI9488_BL; // Pin number to which the backlight is connected
|
||||
cfg.invert = false; // true to invert the brightness of the backlight
|
||||
// cfg.freq = 44100; // PWM frequency of backlight
|
||||
// cfg.pwm_channel = 1; // PWM channel number to use
|
||||
|
||||
_light_instance.config(cfg);
|
||||
_panel_instance.setLight(&_light_instance); // Set the backlight on the panel.
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_TOUCHSCREEN
|
||||
// Configure settings for touch screen control.
|
||||
{
|
||||
auto cfg = _touch_instance.config();
|
||||
|
||||
cfg.pin_cs = -1;
|
||||
cfg.x_min = 0;
|
||||
cfg.x_max = TFT_HEIGHT - 1;
|
||||
cfg.y_min = 0;
|
||||
cfg.y_max = TFT_WIDTH - 1;
|
||||
cfg.pin_int = SCREEN_TOUCH_INT;
|
||||
#ifdef SCREEN_TOUCH_RST
|
||||
cfg.pin_rst = SCREEN_TOUCH_RST;
|
||||
#endif
|
||||
cfg.bus_shared = true;
|
||||
cfg.offset_rotation = TFT_OFFSET_ROTATION;
|
||||
// cfg.freq = 2500000;
|
||||
|
||||
// I2C
|
||||
cfg.i2c_port = TOUCH_I2C_PORT;
|
||||
cfg.i2c_addr = TOUCH_SLAVE_ADDRESS;
|
||||
#ifdef SCREEN_TOUCH_USE_I2C1
|
||||
cfg.pin_sda = I2C_SDA1;
|
||||
cfg.pin_scl = I2C_SCL1;
|
||||
#else
|
||||
cfg.pin_sda = I2C_SDA;
|
||||
cfg.pin_scl = I2C_SCL;
|
||||
#endif
|
||||
// cfg.freq = 400000;
|
||||
|
||||
_touch_instance.config(cfg);
|
||||
_panel_instance.setTouch(&_touch_instance);
|
||||
}
|
||||
#endif
|
||||
|
||||
setPanel(&_panel_instance);
|
||||
}
|
||||
};
|
||||
|
||||
static LGFX *tft = nullptr;
|
||||
|
||||
#elif defined(ST7789_CS)
|
||||
#include <LovyanGFX.hpp> // Graphics and font library for ST7735 driver chip
|
||||
|
||||
@@ -129,7 +426,7 @@ class LGFX : public lgfx::LGFX_Device
|
||||
lgfx::Bus_SPI _bus_instance;
|
||||
lgfx::Light_PWM _light_instance;
|
||||
#if HAS_TOUCHSCREEN
|
||||
#ifdef T_WATCH_S3
|
||||
#if defined(T_WATCH_S3) || defined(ELECROW)
|
||||
lgfx::Touch_FT5x06 _touch_instance;
|
||||
#else
|
||||
lgfx::Touch_GT911 _touch_instance;
|
||||
@@ -171,16 +468,22 @@ class LGFX : public lgfx::LGFX_Device
|
||||
// The following setting values are general initial values for each panel, so please comment out any
|
||||
// unknown items and try them.
|
||||
|
||||
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)
|
||||
cfg.dummy_read_pixel = 9; // Number of bits for dummy read before pixel readout
|
||||
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.invert = true; // Set to true if the light/darkness of the panel is reversed
|
||||
cfg.rgb_order = false; // Set to true if the panel's red and blue are swapped
|
||||
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)
|
||||
#ifdef TFT_DUMMY_READ_PIXELS
|
||||
cfg.dummy_read_pixel = TFT_DUMMY_READ_PIXELS; // Number of bits for dummy read before pixel readout
|
||||
#else
|
||||
cfg.dummy_read_pixel = 9; // Number of bits for dummy read before pixel readout
|
||||
#endif
|
||||
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.invert = true; // Set to true if the light/darkness of the panel is reversed
|
||||
cfg.rgb_order = false; // Set to true if the panel's red and blue are swapped
|
||||
cfg.dlen_16bit =
|
||||
false; // Set to true for panels that transmit data length in 16-bit units with 16-bit parallel or SPI
|
||||
cfg.bus_shared = true; // If the bus is shared with the SD card, set to true (bus control with drawJpgFile etc.)
|
||||
@@ -217,6 +520,9 @@ class LGFX : public lgfx::LGFX_Device
|
||||
cfg.y_min = 0;
|
||||
cfg.y_max = TFT_WIDTH - 1;
|
||||
cfg.pin_int = SCREEN_TOUCH_INT;
|
||||
#ifdef SCREEN_TOUCH_RST
|
||||
cfg.pin_rst = SCREEN_TOUCH_RST;
|
||||
#endif
|
||||
cfg.bus_shared = true;
|
||||
cfg.offset_rotation = TFT_OFFSET_ROTATION;
|
||||
// cfg.freq = 2500000;
|
||||
@@ -347,7 +653,7 @@ static LGFX *tft = nullptr;
|
||||
#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
|
||||
#elif ARCH_PORTDUINO && HAS_SCREEN != 0 && !HAS_TFT
|
||||
#elif ARCH_PORTDUINO
|
||||
#include <LovyanGFX.hpp> // Graphics and font library for ST7735 driver chip
|
||||
|
||||
class LGFX : public lgfx::LGFX_Device
|
||||
@@ -391,11 +697,16 @@ class LGFX : public lgfx::LGFX_Device
|
||||
_panel_instance->setBus(&_bus_instance); // set the bus on the panel.
|
||||
|
||||
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_rst = settingsMap[displayReset];
|
||||
cfg.panel_width = settingsMap[displayWidth]; // actual displayable width
|
||||
cfg.panel_height = settingsMap[displayHeight]; // actual displayable height
|
||||
if (settingsMap[displayRotate]) {
|
||||
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_y = settingsMap[displayOffsetY]; // Panel offset amount in Y direction
|
||||
cfg.offset_rotation = settingsMap[displayOffsetRotate]; // Rotation direction value offset 0~7 (4~7 is mirrored)
|
||||
@@ -640,7 +951,7 @@ static LGFX *tft = nullptr;
|
||||
#endif
|
||||
|
||||
#if defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || defined(ILI9341_DRIVER) || defined(ILI9342_DRIVER) || \
|
||||
defined(RAK14014) || defined(HX8357_CS) || (ARCH_PORTDUINO && HAS_SCREEN != 0)
|
||||
defined(RAK14014) || defined(HX8357_CS) || defined(ILI9488_CS) || defined(ST72xx_DE) || (ARCH_PORTDUINO && HAS_SCREEN != 0)
|
||||
#include "SPILock.h"
|
||||
#include "TFTDisplay.h"
|
||||
#include <SPI.h>
|
||||
@@ -672,9 +983,9 @@ TFTDisplay::TFTDisplay(uint8_t address, int sda, int scl, OLEDDISPLAY_GEOMETRY g
|
||||
|
||||
#if ARCH_PORTDUINO
|
||||
if (settingsMap[displayRotate]) {
|
||||
setGeometry(GEOMETRY_RAWMODE, settingsMap[configNames::displayHeight], settingsMap[configNames::displayWidth]);
|
||||
} else {
|
||||
setGeometry(GEOMETRY_RAWMODE, settingsMap[configNames::displayWidth], settingsMap[configNames::displayHeight]);
|
||||
} else {
|
||||
setGeometry(GEOMETRY_RAWMODE, settingsMap[configNames::displayHeight], settingsMap[configNames::displayWidth]);
|
||||
}
|
||||
|
||||
#elif defined(SCREEN_ROTATE)
|
||||
@@ -863,6 +1174,8 @@ bool TFTDisplay::connect()
|
||||
tft->setRotation(1); // T-Deck has the TFT in landscape
|
||||
#elif defined(T_WATCH_S3) || defined(SENSECAP_INDICATOR)
|
||||
tft->setRotation(2); // T-Watch S3 left-handed orientation
|
||||
#elif ARCH_PORTDUINO
|
||||
tft->setRotation(0);
|
||||
#else
|
||||
tft->setRotation(3); // Orient horizontal and wide underneath the silkscreen name label
|
||||
#endif
|
||||
|
||||
40
src/graphics/draw/ClockRenderer.h
Normal file
40
src/graphics/draw/ClockRenderer.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include "graphics/Screen.h"
|
||||
#include <OLEDDisplay.h>
|
||||
#include <OLEDDisplayUi.h>
|
||||
|
||||
namespace graphics
|
||||
{
|
||||
|
||||
/// Forward declarations
|
||||
class Screen;
|
||||
|
||||
/**
|
||||
* @brief Clock drawing functions
|
||||
*
|
||||
* Contains all functions related to drawing analog and digital clocks,
|
||||
* segmented displays, and time-related UI elements.
|
||||
*/
|
||||
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);
|
||||
|
||||
// Utility functions
|
||||
bool deltaToTimestamp(uint32_t secondsAgo, uint8_t *hours, uint8_t *minutes, int32_t *daysAgo);
|
||||
|
||||
} // namespace ClockRenderer
|
||||
|
||||
} // namespace graphics
|
||||
132
src/graphics/draw/CompassRenderer.cpp
Normal file
132
src/graphics/draw/CompassRenderer.cpp
Normal file
@@ -0,0 +1,132 @@
|
||||
#include "CompassRenderer.h"
|
||||
#include "NodeDB.h"
|
||||
#include "UIRenderer.h"
|
||||
#include "configuration.h"
|
||||
#include "gps/GeoCoord.h"
|
||||
#include "graphics/ScreenFonts.h"
|
||||
#include <cmath>
|
||||
|
||||
namespace graphics
|
||||
{
|
||||
namespace CompassRenderer
|
||||
{
|
||||
|
||||
// Point helper class for compass calculations
|
||||
struct Point {
|
||||
float x, y;
|
||||
Point(float x, float y) : x(x), y(y) {}
|
||||
|
||||
void rotate(float angle)
|
||||
{
|
||||
float cos_a = cos(angle);
|
||||
float sin_a = sin(angle);
|
||||
float new_x = x * cos_a - y * sin_a;
|
||||
float new_y = x * sin_a + y * cos_a;
|
||||
x = new_x;
|
||||
y = new_y;
|
||||
}
|
||||
|
||||
void scale(float factor)
|
||||
{
|
||||
x *= factor;
|
||||
y *= factor;
|
||||
}
|
||||
|
||||
void translate(float dx, float dy)
|
||||
{
|
||||
x += dx;
|
||||
y += dy;
|
||||
}
|
||||
};
|
||||
|
||||
void drawCompassNorth(OLEDDisplay *display, int16_t compassX, int16_t compassY, float myHeading)
|
||||
{
|
||||
// Show the compass heading (not implemented in original)
|
||||
// This could draw a "N" indicator or north arrow
|
||||
// For now, we'll draw a simple north indicator
|
||||
const float radius = 8.0f;
|
||||
Point north(0, -radius);
|
||||
north.rotate(-myHeading);
|
||||
north.translate(compassX, compassY);
|
||||
|
||||
// Draw a small "N" or north indicator
|
||||
display->drawCircle(north.x, north.y, 2);
|
||||
display->setFont(FONT_SMALL);
|
||||
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
||||
display->drawString(north.x, north.y - 3, "N");
|
||||
}
|
||||
|
||||
void drawNodeHeading(OLEDDisplay *display, int16_t compassX, int16_t compassY, uint16_t compassDiam, float headingRadian)
|
||||
{
|
||||
Point tip(0.0f, 0.5f), tail(0.0f, -0.35f); // pointing up initially
|
||||
float arrowOffsetX = 0.14f, arrowOffsetY = 1.0f;
|
||||
Point leftArrow(tip.x - arrowOffsetX, tip.y - arrowOffsetY), rightArrow(tip.x + arrowOffsetX, tip.y - arrowOffsetY);
|
||||
|
||||
Point *arrowPoints[] = {&tip, &tail, &leftArrow, &rightArrow};
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
arrowPoints[i]->rotate(headingRadian);
|
||||
arrowPoints[i]->scale(compassDiam * 0.6);
|
||||
arrowPoints[i]->translate(compassX, compassY);
|
||||
}
|
||||
|
||||
#ifdef USE_EINK
|
||||
display->drawTriangle(tip.x, tip.y, rightArrow.x, rightArrow.y, tail.x, tail.y);
|
||||
#else
|
||||
display->fillTriangle(tip.x, tip.y, rightArrow.x, rightArrow.y, tail.x, tail.y);
|
||||
#endif
|
||||
display->drawTriangle(tip.x, tip.y, leftArrow.x, leftArrow.y, tail.x, tail.y);
|
||||
}
|
||||
|
||||
void drawArrowToNode(OLEDDisplay *display, int16_t x, int16_t y, int16_t size, float bearing)
|
||||
{
|
||||
float radians = bearing * DEG_TO_RAD;
|
||||
|
||||
Point tip(0, -size / 2);
|
||||
Point left(-size / 4, size / 4);
|
||||
Point right(size / 4, size / 4);
|
||||
|
||||
tip.rotate(radians);
|
||||
left.rotate(radians);
|
||||
right.rotate(radians);
|
||||
|
||||
tip.translate(x, y);
|
||||
left.translate(x, y);
|
||||
right.translate(x, y);
|
||||
|
||||
display->drawTriangle(tip.x, tip.y, left.x, left.y, right.x, right.y);
|
||||
}
|
||||
|
||||
float estimatedHeading(double lat, double lon)
|
||||
{
|
||||
// Simple magnetic declination estimation
|
||||
// This is a very basic implementation - the original might be more sophisticated
|
||||
return 0.0f; // Return 0 for now, indicating no heading available
|
||||
}
|
||||
|
||||
uint16_t getCompassDiam(uint32_t displayWidth, uint32_t displayHeight)
|
||||
{
|
||||
// Calculate appropriate compass diameter based on display size
|
||||
uint16_t minDimension = (displayWidth < displayHeight) ? displayWidth : displayHeight;
|
||||
uint16_t maxDiam = minDimension / 3; // Use 1/3 of the smaller dimension
|
||||
|
||||
// Ensure minimum and maximum bounds
|
||||
if (maxDiam < 16)
|
||||
maxDiam = 16;
|
||||
if (maxDiam > 64)
|
||||
maxDiam = 64;
|
||||
|
||||
return maxDiam;
|
||||
}
|
||||
|
||||
float calculateBearing(double lat1, double lon1, double lat2, double lon2)
|
||||
{
|
||||
double dLon = (lon2 - lon1) * DEG_TO_RAD;
|
||||
double y = sin(dLon) * cos(lat2 * DEG_TO_RAD);
|
||||
double x = cos(lat1 * DEG_TO_RAD) * sin(lat2 * DEG_TO_RAD) - sin(lat1 * DEG_TO_RAD) * cos(lat2 * DEG_TO_RAD) * cos(dLon);
|
||||
double bearing = atan2(y, x) * RAD_TO_DEG;
|
||||
return fmod(bearing + 360.0, 360.0);
|
||||
}
|
||||
|
||||
} // namespace CompassRenderer
|
||||
} // namespace graphics
|
||||
36
src/graphics/draw/CompassRenderer.h
Normal file
36
src/graphics/draw/CompassRenderer.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include "graphics/Screen.h"
|
||||
#include "mesh/generated/meshtastic/mesh.pb.h"
|
||||
#include <OLEDDisplay.h>
|
||||
#include <OLEDDisplayUi.h>
|
||||
|
||||
namespace graphics
|
||||
{
|
||||
|
||||
/// Forward declarations
|
||||
class Screen;
|
||||
|
||||
/**
|
||||
* @brief Compass and navigation drawing functions
|
||||
*
|
||||
* Contains all functions related to drawing compass elements, headings,
|
||||
* navigation arrows, and location-based UI components.
|
||||
*/
|
||||
namespace CompassRenderer
|
||||
{
|
||||
// Compass drawing functions
|
||||
void drawCompassNorth(OLEDDisplay *display, int16_t compassX, int16_t compassY, float myHeading);
|
||||
void drawNodeHeading(OLEDDisplay *display, int16_t compassX, int16_t compassY, uint16_t compassDiam, float headingRadian);
|
||||
void drawArrowToNode(OLEDDisplay *display, int16_t x, int16_t y, int16_t size, float bearing);
|
||||
|
||||
// Navigation and location functions
|
||||
float estimatedHeading(double lat, double lon);
|
||||
uint16_t getCompassDiam(uint32_t displayWidth, uint32_t displayHeight);
|
||||
|
||||
// Utility functions for bearing calculations
|
||||
float calculateBearing(double lat1, double lon1, double lat2, double lon2);
|
||||
|
||||
} // namespace CompassRenderer
|
||||
|
||||
} // namespace graphics
|
||||
677
src/graphics/draw/DebugRenderer.cpp
Normal file
677
src/graphics/draw/DebugRenderer.cpp
Normal file
@@ -0,0 +1,677 @@
|
||||
#include "DebugRenderer.h"
|
||||
#include "../Screen.h"
|
||||
#include "FSCommon.h"
|
||||
#include "NodeDB.h"
|
||||
#include "Throttle.h"
|
||||
#include "UIRenderer.h"
|
||||
#include "airtime.h"
|
||||
#include "configuration.h"
|
||||
#include "gps/RTC.h"
|
||||
#include "graphics/ScreenFonts.h"
|
||||
#include "graphics/SharedUIDisplay.h"
|
||||
#include "graphics/images.h"
|
||||
#include "main.h"
|
||||
#include "mesh/Channels.h"
|
||||
#include "mesh/generated/meshtastic/deviceonly.pb.h"
|
||||
#include "sleep.h"
|
||||
|
||||
#if HAS_WIFI && !defined(ARCH_PORTDUINO)
|
||||
#include "mesh/wifi/WiFiAPClient.h"
|
||||
#include <WiFi.h>
|
||||
#ifdef ARCH_ESP32
|
||||
#include "mesh/wifi/WiFiAPClient.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ARCH_ESP32
|
||||
#include "modules/StoreForwardModule.h"
|
||||
#endif
|
||||
#include <DisplayFormatters.h>
|
||||
#include <RadioLibInterface.h>
|
||||
#include <target_specific.h>
|
||||
|
||||
using namespace meshtastic;
|
||||
|
||||
// Battery icon array
|
||||
static uint8_t imgBattery[16] = {0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xE7, 0x3C};
|
||||
|
||||
// External variables
|
||||
extern graphics::Screen *screen;
|
||||
extern PowerStatus *powerStatus;
|
||||
extern NodeStatus *nodeStatus;
|
||||
extern GPSStatus *gpsStatus;
|
||||
extern Channels channels;
|
||||
extern "C" {
|
||||
extern char ourId[5];
|
||||
}
|
||||
extern AirTime *airTime;
|
||||
|
||||
// External functions from Screen.cpp
|
||||
extern bool heartbeat;
|
||||
|
||||
#ifdef ARCH_ESP32
|
||||
extern StoreForwardModule *storeForwardModule;
|
||||
#endif
|
||||
|
||||
namespace graphics
|
||||
{
|
||||
namespace DebugRenderer
|
||||
{
|
||||
|
||||
void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||
{
|
||||
display->setFont(FONT_SMALL);
|
||||
|
||||
// The coordinates define the left starting point of the text
|
||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
|
||||
if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_INVERTED) {
|
||||
display->fillRect(0 + x, 0 + y, x + display->getWidth(), y + FONT_HEIGHT_SMALL);
|
||||
display->setColor(BLACK);
|
||||
}
|
||||
|
||||
char channelStr[20];
|
||||
snprintf(channelStr, sizeof(channelStr), "#%s", channels.getName(channels.getPrimaryIndex()));
|
||||
|
||||
// Display power status
|
||||
if (powerStatus->getHasBattery()) {
|
||||
if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_DEFAULT) {
|
||||
UIRenderer::drawBattery(display, x, y + 2, imgBattery, powerStatus);
|
||||
} else {
|
||||
UIRenderer::drawBattery(display, x + 1, y + 3, imgBattery, powerStatus);
|
||||
}
|
||||
} else if (powerStatus->knowsUSB()) {
|
||||
if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_DEFAULT) {
|
||||
display->drawFastImage(x, y + 2, 16, 8, powerStatus->getHasUSB() ? imgUSB : imgPower);
|
||||
} else {
|
||||
display->drawFastImage(x + 1, y + 3, 16, 8, powerStatus->getHasUSB() ? imgUSB : imgPower);
|
||||
}
|
||||
}
|
||||
// Display nodes status
|
||||
if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_DEFAULT) {
|
||||
UIRenderer::drawNodes(display, x + (SCREEN_WIDTH * 0.25), y + 2, nodeStatus);
|
||||
} else {
|
||||
UIRenderer::drawNodes(display, x + (SCREEN_WIDTH * 0.25), y + 3, nodeStatus);
|
||||
}
|
||||
#if HAS_GPS
|
||||
// Display GPS status
|
||||
if (config.position.gps_mode != meshtastic_Config_PositionConfig_GpsMode_ENABLED) {
|
||||
UIRenderer::drawGpsPowerStatus(display, x, y + 2, gpsStatus);
|
||||
} else {
|
||||
if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_DEFAULT) {
|
||||
UIRenderer::drawGps(display, x + (SCREEN_WIDTH * 0.63), y + 2, gpsStatus);
|
||||
} else {
|
||||
UIRenderer::drawGps(display, x + (SCREEN_WIDTH * 0.63), y + 3, gpsStatus);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
display->setColor(WHITE);
|
||||
// Draw the channel name
|
||||
display->drawString(x, y + FONT_HEIGHT_SMALL, channelStr);
|
||||
// Draw our hardware ID to assist with bluetooth pairing. Either prefix with Info or S&F Logo
|
||||
if (moduleConfig.store_forward.enabled) {
|
||||
#ifdef ARCH_ESP32
|
||||
if (!Throttle::isWithinTimespanMs(storeForwardModule->lastHeartbeat,
|
||||
(storeForwardModule->heartbeatInterval * 1200))) { // no heartbeat, overlap a bit
|
||||
#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ILI9342_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || \
|
||||
defined(ST7789_CS) || defined(USE_ST7789) || defined(ILI9488_CS) || defined(HX8357_CS) || ARCH_PORTDUINO) && \
|
||||
!defined(DISPLAY_FORCE_SMALL_FONTS)
|
||||
display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 12, 8,
|
||||
imgQuestionL1);
|
||||
display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 11 + FONT_HEIGHT_SMALL, 12, 8,
|
||||
imgQuestionL2);
|
||||
#else
|
||||
display->drawFastImage(x + SCREEN_WIDTH - 10 - display->getStringWidth(ourId), y + 2 + FONT_HEIGHT_SMALL, 8, 8,
|
||||
imgQuestion);
|
||||
#endif
|
||||
} else {
|
||||
#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ILI9342_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || \
|
||||
defined(ST7789_CS) || defined(USE_ST7789) || defined(ILI9488_CS) || defined(HX8357_CS)) && \
|
||||
!defined(DISPLAY_FORCE_SMALL_FONTS)
|
||||
display->drawFastImage(x + SCREEN_WIDTH - 18 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 16, 8,
|
||||
imgSFL1);
|
||||
display->drawFastImage(x + SCREEN_WIDTH - 18 - display->getStringWidth(ourId), y + 11 + FONT_HEIGHT_SMALL, 16, 8,
|
||||
imgSFL2);
|
||||
#else
|
||||
display->drawFastImage(x + SCREEN_WIDTH - 13 - display->getStringWidth(ourId), y + 2 + FONT_HEIGHT_SMALL, 11, 8,
|
||||
imgSF);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
// TODO: Raspberry Pi supports more than just the one screen size
|
||||
#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ILI9342_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || \
|
||||
defined(ST7789_CS) || defined(USE_ST7789) || defined(ILI9488_CS) || defined(HX8357_CS) || ARCH_PORTDUINO) && \
|
||||
!defined(DISPLAY_FORCE_SMALL_FONTS)
|
||||
display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 12, 8,
|
||||
imgInfoL1);
|
||||
display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 11 + FONT_HEIGHT_SMALL, 12, 8,
|
||||
imgInfoL2);
|
||||
#else
|
||||
display->drawFastImage(x + SCREEN_WIDTH - 10 - display->getStringWidth(ourId), y + 2 + FONT_HEIGHT_SMALL, 8, 8, imgInfo);
|
||||
#endif
|
||||
}
|
||||
|
||||
display->drawString(x + SCREEN_WIDTH - display->getStringWidth(ourId), y + FONT_HEIGHT_SMALL, ourId);
|
||||
|
||||
// Draw any log messages
|
||||
display->drawLogBuffer(x, y + (FONT_HEIGHT_SMALL * 2));
|
||||
|
||||
/* Display a heartbeat pixel that blinks every time the frame is redrawn */
|
||||
#ifdef SHOW_REDRAWS
|
||||
if (heartbeat)
|
||||
display->setPixel(0, 0);
|
||||
heartbeat = !heartbeat;
|
||||
#endif
|
||||
}
|
||||
|
||||
void drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||
{
|
||||
#if HAS_WIFI && !defined(ARCH_PORTDUINO)
|
||||
const char *wifiName = config.network.wifi_ssid;
|
||||
|
||||
display->setFont(FONT_SMALL);
|
||||
|
||||
// The coordinates define the left starting point of the text
|
||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
|
||||
if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_INVERTED) {
|
||||
display->fillRect(0 + x, 0 + y, x + display->getWidth(), y + FONT_HEIGHT_SMALL);
|
||||
display->setColor(BLACK);
|
||||
}
|
||||
|
||||
if (WiFi.status() != WL_CONNECTED) {
|
||||
display->drawString(x, y, "WiFi: Not Connected");
|
||||
if (config.display.heading_bold)
|
||||
display->drawString(x + 1, y, "WiFi: Not Connected");
|
||||
} else {
|
||||
display->drawString(x, y, "WiFi: Connected");
|
||||
if (config.display.heading_bold)
|
||||
display->drawString(x + 1, y, "WiFi: Connected");
|
||||
|
||||
char rssiStr[32];
|
||||
snprintf(rssiStr, sizeof(rssiStr), "RSSI %d", WiFi.RSSI());
|
||||
display->drawString(x + SCREEN_WIDTH - display->getStringWidth(rssiStr), y, rssiStr);
|
||||
if (config.display.heading_bold) {
|
||||
display->drawString(x + SCREEN_WIDTH - display->getStringWidth(rssiStr) - 1, y, rssiStr);
|
||||
}
|
||||
}
|
||||
|
||||
display->setColor(WHITE);
|
||||
|
||||
/*
|
||||
- WL_CONNECTED: assigned when connected to a WiFi network;
|
||||
- WL_NO_SSID_AVAIL: assigned when no SSID are available;
|
||||
- WL_CONNECT_FAILED: assigned when the connection fails for all the attempts;
|
||||
- WL_CONNECTION_LOST: assigned when the connection is lost;
|
||||
- WL_DISCONNECTED: assigned when disconnected from a network;
|
||||
- WL_IDLE_STATUS: it is a temporary status assigned when WiFi.begin() is called and remains active until the number of
|
||||
attempts expires (resulting in WL_CONNECT_FAILED) or a connection is established (resulting in WL_CONNECTED);
|
||||
- WL_SCAN_COMPLETED: assigned when the scan networks is completed;
|
||||
- WL_NO_SHIELD: assigned when no WiFi shield is present;
|
||||
|
||||
*/
|
||||
if (WiFi.status() == WL_CONNECTED) {
|
||||
char ipStr[64];
|
||||
snprintf(ipStr, sizeof(ipStr), "IP: %s", WiFi.localIP().toString().c_str());
|
||||
display->drawString(x, y + FONT_HEIGHT_SMALL * 1, ipStr);
|
||||
} else if (WiFi.status() == WL_NO_SSID_AVAIL) {
|
||||
display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "SSID Not Found");
|
||||
} else if (WiFi.status() == WL_CONNECTION_LOST) {
|
||||
display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "Connection Lost");
|
||||
} else if (WiFi.status() == WL_IDLE_STATUS) {
|
||||
display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "Idle ... Reconnecting");
|
||||
} else if (WiFi.status() == WL_CONNECT_FAILED) {
|
||||
display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "Connection Failed");
|
||||
}
|
||||
#ifdef ARCH_ESP32
|
||||
else {
|
||||
// Codes:
|
||||
// https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/wifi.html#wi-fi-reason-code
|
||||
display->drawString(x, y + FONT_HEIGHT_SMALL * 1,
|
||||
WiFi.disconnectReasonName(static_cast<wifi_err_reason_t>(getWifiDisconnectReason())));
|
||||
}
|
||||
#else
|
||||
else {
|
||||
char statusStr[32];
|
||||
snprintf(statusStr, sizeof(statusStr), "Unknown status: %d", WiFi.status());
|
||||
display->drawString(x, y + FONT_HEIGHT_SMALL * 1, statusStr);
|
||||
}
|
||||
#endif
|
||||
|
||||
char ssidStr[64];
|
||||
snprintf(ssidStr, sizeof(ssidStr), "SSID: %s", wifiName);
|
||||
display->drawString(x, y + FONT_HEIGHT_SMALL * 2, ssidStr);
|
||||
|
||||
display->drawString(x, y + FONT_HEIGHT_SMALL * 3, "http://meshtastic.local");
|
||||
|
||||
/* Display a heartbeat pixel that blinks every time the frame is redrawn */
|
||||
#ifdef SHOW_REDRAWS
|
||||
if (heartbeat)
|
||||
display->setPixel(0, 0);
|
||||
heartbeat = !heartbeat;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||
{
|
||||
display->setFont(FONT_SMALL);
|
||||
|
||||
// The coordinates define the left starting point of the text
|
||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
|
||||
if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_INVERTED) {
|
||||
display->fillRect(0 + x, 0 + y, x + display->getWidth(), y + FONT_HEIGHT_SMALL);
|
||||
display->setColor(BLACK);
|
||||
}
|
||||
|
||||
char batStr[20];
|
||||
if (powerStatus->getHasBattery()) {
|
||||
int batV = powerStatus->getBatteryVoltageMv() / 1000;
|
||||
int batCv = (powerStatus->getBatteryVoltageMv() % 1000) / 10;
|
||||
|
||||
snprintf(batStr, sizeof(batStr), "B %01d.%02dV %3d%% %c%c", batV, batCv, powerStatus->getBatteryChargePercent(),
|
||||
powerStatus->getIsCharging() ? '+' : ' ', powerStatus->getHasUSB() ? 'U' : ' ');
|
||||
|
||||
// Line 1
|
||||
display->drawString(x, y, batStr);
|
||||
if (config.display.heading_bold)
|
||||
display->drawString(x + 1, y, batStr);
|
||||
} else {
|
||||
// Line 1
|
||||
display->drawString(x, y, "USB");
|
||||
if (config.display.heading_bold)
|
||||
display->drawString(x + 1, y, "USB");
|
||||
}
|
||||
|
||||
// auto mode = DisplayFormatters::getModemPresetDisplayName(config.lora.modem_preset, true);
|
||||
|
||||
// display->drawString(x + SCREEN_WIDTH - display->getStringWidth(mode), y, mode);
|
||||
// if (config.display.heading_bold)
|
||||
// display->drawString(x + SCREEN_WIDTH - display->getStringWidth(mode) - 1, y, mode);
|
||||
|
||||
uint32_t currentMillis = millis();
|
||||
uint32_t seconds = currentMillis / 1000;
|
||||
uint32_t minutes = seconds / 60;
|
||||
uint32_t hours = minutes / 60;
|
||||
uint32_t days = hours / 24;
|
||||
// currentMillis %= 1000;
|
||||
// seconds %= 60;
|
||||
// minutes %= 60;
|
||||
// hours %= 24;
|
||||
|
||||
// Show uptime as days, hours, minutes OR seconds
|
||||
std::string uptime = UIRenderer::drawTimeDelta(days, hours, minutes, seconds);
|
||||
|
||||
// Line 1 (Still)
|
||||
display->drawString(x + SCREEN_WIDTH - display->getStringWidth(uptime.c_str()), y, uptime.c_str());
|
||||
if (config.display.heading_bold)
|
||||
display->drawString(x - 1 + SCREEN_WIDTH - display->getStringWidth(uptime.c_str()), y, uptime.c_str());
|
||||
|
||||
display->setColor(WHITE);
|
||||
|
||||
// Setup string to assemble analogClock string
|
||||
std::string analogClock = "";
|
||||
|
||||
uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice, true); // Display local timezone
|
||||
if (rtc_sec > 0) {
|
||||
long hms = rtc_sec % SEC_PER_DAY;
|
||||
// hms += tz.tz_dsttime * SEC_PER_HOUR;
|
||||
// hms -= tz.tz_minuteswest * SEC_PER_MIN;
|
||||
// mod `hms` to ensure in positive range of [0...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 min = (hms % SEC_PER_HOUR) / SEC_PER_MIN;
|
||||
int sec = (hms % SEC_PER_HOUR) % SEC_PER_MIN; // or hms % SEC_PER_MIN
|
||||
|
||||
char timebuf[12];
|
||||
|
||||
if (config.display.use_12h_clock) {
|
||||
std::string meridiem = "am";
|
||||
if (hour >= 12) {
|
||||
if (hour > 12)
|
||||
hour -= 12;
|
||||
meridiem = "pm";
|
||||
}
|
||||
if (hour == 00) {
|
||||
hour = 12;
|
||||
}
|
||||
snprintf(timebuf, sizeof(timebuf), "%d:%02d:%02d%s", hour, min, sec, meridiem.c_str());
|
||||
} else {
|
||||
snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d", hour, min, sec);
|
||||
}
|
||||
analogClock += timebuf;
|
||||
}
|
||||
|
||||
// Line 2
|
||||
display->drawString(x, y + FONT_HEIGHT_SMALL * 1, analogClock.c_str());
|
||||
|
||||
// Display Channel Utilization
|
||||
char chUtil[13];
|
||||
snprintf(chUtil, sizeof(chUtil), "ChUtil %2.0f%%", airTime->channelUtilizationPercent());
|
||||
display->drawString(x + SCREEN_WIDTH - display->getStringWidth(chUtil), y + FONT_HEIGHT_SMALL * 1, chUtil);
|
||||
|
||||
#if HAS_GPS
|
||||
if (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED) {
|
||||
// Line 3
|
||||
if (config.display.gps_format !=
|
||||
meshtastic_Config_DisplayConfig_GpsCoordinateFormat_DMS) // if DMS then don't draw altitude
|
||||
UIRenderer::drawGpsAltitude(display, x, y + FONT_HEIGHT_SMALL * 2, gpsStatus);
|
||||
|
||||
// Line 4
|
||||
UIRenderer::drawGpsCoordinates(display, x, y + FONT_HEIGHT_SMALL * 3, gpsStatus);
|
||||
} else {
|
||||
UIRenderer::drawGpsPowerStatus(display, x, y + FONT_HEIGHT_SMALL * 2, gpsStatus);
|
||||
}
|
||||
#endif
|
||||
/* Display a heartbeat pixel that blinks every time the frame is redrawn */
|
||||
#ifdef SHOW_REDRAWS
|
||||
if (heartbeat)
|
||||
display->setPixel(0, 0);
|
||||
heartbeat = !heartbeat;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Trampoline functions for DebugInfo class access
|
||||
void drawDebugInfoTrampoline(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||
{
|
||||
drawFrame(display, state, x, y);
|
||||
}
|
||||
|
||||
void drawDebugInfoSettingsTrampoline(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||
{
|
||||
drawFrameSettings(display, state, x, y);
|
||||
}
|
||||
|
||||
void drawDebugInfoWiFiTrampoline(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||
{
|
||||
drawFrameWiFi(display, state, x, y);
|
||||
}
|
||||
|
||||
// ****************************
|
||||
// * LoRa Focused Screen *
|
||||
// ****************************
|
||||
void drawLoRaFocused(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||
{
|
||||
display->clear();
|
||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
display->setFont(FONT_SMALL);
|
||||
|
||||
// === Header ===
|
||||
graphics::drawCommonHeader(display, x, y);
|
||||
|
||||
// === Draw title (aligned with header baseline) ===
|
||||
const int highlightHeight = FONT_HEIGHT_SMALL - 1;
|
||||
const int textY = y + 1 + (highlightHeight - FONT_HEIGHT_SMALL) / 2;
|
||||
const char *titleStr = (SCREEN_WIDTH > 128) ? "LoRa Info" : "LoRa";
|
||||
const int centerX = x + SCREEN_WIDTH / 2;
|
||||
|
||||
if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_INVERTED) {
|
||||
display->setColor(BLACK);
|
||||
}
|
||||
|
||||
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
||||
display->drawString(centerX, textY, titleStr);
|
||||
if (config.display.heading_bold) {
|
||||
display->drawString(centerX + 1, textY, titleStr);
|
||||
}
|
||||
display->setColor(WHITE);
|
||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
|
||||
// === First Row: Region / BLE Name ===
|
||||
graphics::UIRenderer::drawNodes(display, x, compactFirstLine + 3, nodeStatus, 0, true, "");
|
||||
|
||||
uint8_t dmac[6];
|
||||
char shortnameble[35];
|
||||
getMacAddr(dmac);
|
||||
snprintf(ourId, sizeof(ourId), "%02x%02x", dmac[4], dmac[5]);
|
||||
snprintf(shortnameble, sizeof(shortnameble), "BLE: %s", ourId);
|
||||
int textWidth = display->getStringWidth(shortnameble);
|
||||
int nameX = (SCREEN_WIDTH - textWidth);
|
||||
display->drawString(nameX, compactFirstLine, shortnameble);
|
||||
|
||||
// === Second Row: Radio Preset ===
|
||||
auto mode = DisplayFormatters::getModemPresetDisplayName(config.lora.modem_preset, false);
|
||||
char regionradiopreset[25];
|
||||
const char *region = myRegion ? myRegion->name : NULL;
|
||||
snprintf(regionradiopreset, sizeof(regionradiopreset), "%s/%s", region, mode);
|
||||
textWidth = display->getStringWidth(regionradiopreset);
|
||||
nameX = (SCREEN_WIDTH - textWidth) / 2;
|
||||
display->drawString(nameX, compactSecondLine, regionradiopreset);
|
||||
|
||||
// === Third Row: Frequency / ChanNum ===
|
||||
char frequencyslot[35];
|
||||
char freqStr[16];
|
||||
float freq = RadioLibInterface::instance->getFreq();
|
||||
snprintf(freqStr, sizeof(freqStr), "%.3f", freq);
|
||||
if (config.lora.channel_num == 0) {
|
||||
snprintf(frequencyslot, sizeof(frequencyslot), "Freq: %s", freqStr);
|
||||
} else {
|
||||
snprintf(frequencyslot, sizeof(frequencyslot), "Freq/Chan: %s (%d)", freqStr, config.lora.channel_num);
|
||||
}
|
||||
size_t len = strlen(frequencyslot);
|
||||
if (len >= 4 && strcmp(frequencyslot + len - 4, " (0)") == 0) {
|
||||
frequencyslot[len - 4] = '\0'; // Remove the last three characters
|
||||
}
|
||||
textWidth = display->getStringWidth(frequencyslot);
|
||||
nameX = (SCREEN_WIDTH - textWidth) / 2;
|
||||
display->drawString(nameX, compactThirdLine, frequencyslot);
|
||||
|
||||
// === Fourth Row: Channel Utilization ===
|
||||
const char *chUtil = "ChUtil:";
|
||||
char chUtilPercentage[10];
|
||||
snprintf(chUtilPercentage, sizeof(chUtilPercentage), "%2.0f%%", airTime->channelUtilizationPercent());
|
||||
|
||||
int chUtil_x = (SCREEN_WIDTH > 128) ? display->getStringWidth(chUtil) + 10 : display->getStringWidth(chUtil) + 5;
|
||||
int chUtil_y = compactFourthLine + 3;
|
||||
|
||||
int chutil_bar_width = (SCREEN_WIDTH > 128) ? 100 : 50;
|
||||
int chutil_bar_height = (SCREEN_WIDTH > 128) ? 12 : 7;
|
||||
int extraoffset = (SCREEN_WIDTH > 128) ? 6 : 3;
|
||||
int chutil_percent = airTime->channelUtilizationPercent();
|
||||
|
||||
int centerofscreen = SCREEN_WIDTH / 2;
|
||||
int total_line_content_width = (chUtil_x + chutil_bar_width + display->getStringWidth(chUtilPercentage) + extraoffset) / 2;
|
||||
int starting_position = centerofscreen - total_line_content_width;
|
||||
|
||||
display->drawString(starting_position, compactFourthLine, chUtil);
|
||||
|
||||
// Force 56% or higher to show a full 100% bar, text would still show related percent.
|
||||
if (chutil_percent >= 61) {
|
||||
chutil_percent = 100;
|
||||
}
|
||||
|
||||
// Weighting for nonlinear segments
|
||||
float milestone1 = 25;
|
||||
float milestone2 = 40;
|
||||
float weight1 = 0.45; // Weight for 0–25%
|
||||
float weight2 = 0.35; // Weight for 25–40%
|
||||
float weight3 = 0.20; // Weight for 40–100%
|
||||
float totalWeight = weight1 + weight2 + weight3;
|
||||
|
||||
int seg1 = chutil_bar_width * (weight1 / totalWeight);
|
||||
int seg2 = chutil_bar_width * (weight2 / totalWeight);
|
||||
int seg3 = chutil_bar_width * (weight3 / totalWeight);
|
||||
|
||||
int fillRight = 0;
|
||||
|
||||
if (chutil_percent <= milestone1) {
|
||||
fillRight = (seg1 * (chutil_percent / milestone1));
|
||||
} else if (chutil_percent <= milestone2) {
|
||||
fillRight = seg1 + (seg2 * ((chutil_percent - milestone1) / (milestone2 - milestone1)));
|
||||
} else {
|
||||
fillRight = seg1 + seg2 + (seg3 * ((chutil_percent - milestone2) / (100 - milestone2)));
|
||||
}
|
||||
|
||||
// Draw outline
|
||||
display->drawRect(starting_position + chUtil_x, chUtil_y, chutil_bar_width, chutil_bar_height);
|
||||
|
||||
// Fill progress
|
||||
if (fillRight > 0) {
|
||||
display->fillRect(starting_position + chUtil_x, chUtil_y, fillRight, chutil_bar_height);
|
||||
}
|
||||
|
||||
display->drawString(starting_position + chUtil_x + chutil_bar_width + extraoffset, compactFourthLine, chUtilPercentage);
|
||||
}
|
||||
|
||||
// ****************************
|
||||
// * Memory Screen *
|
||||
// ****************************
|
||||
void drawMemoryUsage(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||
{
|
||||
display->clear();
|
||||
display->setFont(FONT_SMALL);
|
||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
|
||||
// === Header ===
|
||||
graphics::drawCommonHeader(display, x, y);
|
||||
|
||||
// === Draw title ===
|
||||
const int highlightHeight = FONT_HEIGHT_SMALL - 1;
|
||||
const int textY = y + 1 + (highlightHeight - FONT_HEIGHT_SMALL) / 2;
|
||||
const char *titleStr = (SCREEN_WIDTH > 128) ? "Memory" : "Mem";
|
||||
const int centerX = x + SCREEN_WIDTH / 2;
|
||||
|
||||
if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_INVERTED) {
|
||||
display->setColor(BLACK);
|
||||
}
|
||||
|
||||
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
||||
display->drawString(centerX, textY, titleStr);
|
||||
if (config.display.heading_bold) {
|
||||
display->drawString(centerX + 1, textY, titleStr);
|
||||
}
|
||||
display->setColor(WHITE);
|
||||
|
||||
// === Layout ===
|
||||
int contentY = y + FONT_HEIGHT_SMALL;
|
||||
const int rowYOffset = FONT_HEIGHT_SMALL - 3;
|
||||
const int barHeight = 6;
|
||||
const int labelX = x;
|
||||
const int barsOffset = (SCREEN_WIDTH > 128) ? 24 : 0;
|
||||
const int barX = x + 40 + barsOffset;
|
||||
|
||||
int rowY = contentY;
|
||||
|
||||
// === Heap delta tracking (disabled) ===
|
||||
/*
|
||||
static uint32_t previousHeapFree = 0;
|
||||
static int32_t totalHeapDelta = 0;
|
||||
static int deltaChangeCount = 0;
|
||||
*/
|
||||
|
||||
auto drawUsageRow = [&](const char *label, uint32_t used, uint32_t total, bool isHeap = false) {
|
||||
if (total == 0)
|
||||
return;
|
||||
|
||||
int percent = (used * 100) / total;
|
||||
|
||||
char combinedStr[24];
|
||||
if (SCREEN_WIDTH > 128) {
|
||||
snprintf(combinedStr, sizeof(combinedStr), "%s%3d%% %lu/%luKB", (percent > 80) ? "! " : "", percent, used / 1024,
|
||||
total / 1024);
|
||||
} else {
|
||||
snprintf(combinedStr, sizeof(combinedStr), "%s%3d%%", (percent > 80) ? "! " : "", percent);
|
||||
}
|
||||
|
||||
int textWidth = display->getStringWidth(combinedStr);
|
||||
int adjustedBarWidth = SCREEN_WIDTH - barX - textWidth - 6;
|
||||
if (adjustedBarWidth < 10)
|
||||
adjustedBarWidth = 10;
|
||||
|
||||
int fillWidth = (used * adjustedBarWidth) / total;
|
||||
|
||||
// Label
|
||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
display->drawString(labelX, rowY, label);
|
||||
|
||||
// Bar
|
||||
int barY = rowY + (FONT_HEIGHT_SMALL - barHeight) / 2;
|
||||
display->setColor(WHITE);
|
||||
display->drawRect(barX, barY, adjustedBarWidth, barHeight);
|
||||
|
||||
display->fillRect(barX, barY, fillWidth, barHeight);
|
||||
display->setColor(WHITE);
|
||||
|
||||
// Value string
|
||||
display->setTextAlignment(TEXT_ALIGN_RIGHT);
|
||||
display->drawString(SCREEN_WIDTH - 2, rowY, combinedStr);
|
||||
|
||||
rowY += rowYOffset;
|
||||
|
||||
// === Heap delta display (disabled) ===
|
||||
/*
|
||||
if (isHeap && previousHeapFree > 0) {
|
||||
int32_t delta = (int32_t)(memGet.getFreeHeap() - previousHeapFree);
|
||||
if (delta != 0) {
|
||||
totalHeapDelta += delta;
|
||||
deltaChangeCount++;
|
||||
|
||||
char deltaStr[16];
|
||||
snprintf(deltaStr, sizeof(deltaStr), "%ld", delta);
|
||||
|
||||
int deltaX = centerX - display->getStringWidth(deltaStr) / 2 - 8;
|
||||
int deltaY = rowY + 1;
|
||||
|
||||
// Triangle
|
||||
if (delta > 0) {
|
||||
display->drawLine(deltaX, deltaY + 6, deltaX + 3, deltaY);
|
||||
display->drawLine(deltaX + 3, deltaY, deltaX + 6, deltaY + 6);
|
||||
display->drawLine(deltaX, deltaY + 6, deltaX + 6, deltaY + 6);
|
||||
} else {
|
||||
display->drawLine(deltaX, deltaY, deltaX + 3, deltaY + 6);
|
||||
display->drawLine(deltaX + 3, deltaY + 6, deltaX + 6, deltaY);
|
||||
display->drawLine(deltaX, deltaY, deltaX + 6, deltaY);
|
||||
}
|
||||
|
||||
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
||||
display->drawString(centerX + 6, deltaY, deltaStr);
|
||||
rowY += rowYOffset;
|
||||
}
|
||||
}
|
||||
|
||||
if (isHeap) {
|
||||
previousHeapFree = memGet.getFreeHeap();
|
||||
}
|
||||
*/
|
||||
};
|
||||
|
||||
// === Memory values ===
|
||||
uint32_t heapUsed = memGet.getHeapSize() - memGet.getFreeHeap();
|
||||
uint32_t heapTotal = memGet.getHeapSize();
|
||||
|
||||
uint32_t psramUsed = memGet.getPsramSize() - memGet.getFreePsram();
|
||||
uint32_t psramTotal = memGet.getPsramSize();
|
||||
|
||||
uint32_t flashUsed = 0, flashTotal = 0;
|
||||
#ifdef ESP32
|
||||
flashUsed = FSCom.usedBytes();
|
||||
flashTotal = FSCom.totalBytes();
|
||||
#endif
|
||||
|
||||
uint32_t sdUsed = 0, sdTotal = 0;
|
||||
bool hasSD = false;
|
||||
/*
|
||||
#ifdef HAS_SDCARD
|
||||
hasSD = SD.cardType() != CARD_NONE;
|
||||
if (hasSD) {
|
||||
sdUsed = SD.usedBytes();
|
||||
sdTotal = SD.totalBytes();
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
// === Draw memory rows
|
||||
drawUsageRow("Heap:", heapUsed, heapTotal, true);
|
||||
drawUsageRow("PSRAM:", psramUsed, psramTotal);
|
||||
#ifdef ESP32
|
||||
if (flashTotal > 0)
|
||||
drawUsageRow("Flash:", flashUsed, flashTotal);
|
||||
#endif
|
||||
if (hasSD && sdTotal > 0)
|
||||
drawUsageRow("SD:", sdUsed, sdTotal);
|
||||
}
|
||||
} // namespace DebugRenderer
|
||||
} // namespace graphics
|
||||
38
src/graphics/draw/DebugRenderer.h
Normal file
38
src/graphics/draw/DebugRenderer.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include <OLEDDisplay.h>
|
||||
#include <OLEDDisplayUi.h>
|
||||
|
||||
namespace graphics
|
||||
{
|
||||
|
||||
/// Forward declarations
|
||||
class Screen;
|
||||
class DebugInfo;
|
||||
|
||||
/**
|
||||
* @brief Debug and diagnostic drawing functions
|
||||
*
|
||||
* Contains all functions related to drawing debug information,
|
||||
* WiFi status, settings screens, and diagnostic data.
|
||||
*/
|
||||
namespace DebugRenderer
|
||||
{
|
||||
// Debug frame functions
|
||||
void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||
void drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||
void drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||
|
||||
// Trampoline functions for framework callback compatibility
|
||||
void drawDebugInfoTrampoline(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||
void drawDebugInfoSettingsTrampoline(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||
void drawDebugInfoWiFiTrampoline(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||
|
||||
// LoRa information display
|
||||
void drawLoRaFocused(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||
|
||||
// Memory screen display
|
||||
void drawMemoryUsage(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||
} // namespace DebugRenderer
|
||||
|
||||
} // namespace graphics
|
||||
38
src/graphics/draw/DrawRenderers.h
Normal file
38
src/graphics/draw/DrawRenderers.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @brief Master include file for all Screen draw renderers
|
||||
*
|
||||
* This file includes all the individual renderer headers to provide
|
||||
* a convenient single include for accessing all draw functions.
|
||||
*/
|
||||
|
||||
#include "graphics/draw/ClockRenderer.h"
|
||||
#include "graphics/draw/CompassRenderer.h"
|
||||
#include "graphics/draw/DebugRenderer.h"
|
||||
#include "graphics/draw/NodeListRenderer.h"
|
||||
#include "graphics/draw/ScreenRenderer.h"
|
||||
#include "graphics/draw/UIRenderer.h"
|
||||
|
||||
namespace graphics
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief Collection of all draw renderers
|
||||
*
|
||||
* This namespace provides access to all the specialized rendering
|
||||
* functions organized by category.
|
||||
*/
|
||||
namespace DrawRenderers
|
||||
{
|
||||
// Re-export all renderer namespaces for convenience
|
||||
using namespace ClockRenderer;
|
||||
using namespace CompassRenderer;
|
||||
using namespace DebugRenderer;
|
||||
using namespace NodeListRenderer;
|
||||
using namespace ScreenRenderer;
|
||||
using namespace UIRenderer;
|
||||
|
||||
} // namespace DrawRenderers
|
||||
|
||||
} // namespace graphics
|
||||
448
src/graphics/draw/MessageRenderer.cpp
Normal file
448
src/graphics/draw/MessageRenderer.cpp
Normal file
@@ -0,0 +1,448 @@
|
||||
/*
|
||||
BaseUI
|
||||
|
||||
Developed and Maintained By:
|
||||
- Ronald Garcia (HarukiToreda) – Lead development and implementation.
|
||||
- JasonP (Xaositek) – Screen layout and icon design, UI improvements and testing.
|
||||
- TonyG (Tropho) – Project management, structural planning, and testing
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "MessageRenderer.h"
|
||||
|
||||
// Core includes
|
||||
#include "NodeDB.h"
|
||||
#include "configuration.h"
|
||||
#include "gps/RTC.h"
|
||||
#include "graphics/ScreenFonts.h"
|
||||
#include "graphics/SharedUIDisplay.h"
|
||||
#include "graphics/emotes.h"
|
||||
#include "main.h"
|
||||
#include "meshUtils.h"
|
||||
|
||||
// Additional includes for UI rendering
|
||||
#include "UIRenderer.h"
|
||||
|
||||
// Additional includes for dependencies
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// External declarations
|
||||
extern bool hasUnreadMessage;
|
||||
extern meshtastic_DeviceState devicestate;
|
||||
|
||||
using graphics::Emote;
|
||||
using graphics::emotes;
|
||||
using graphics::numEmotes;
|
||||
|
||||
namespace graphics
|
||||
{
|
||||
namespace MessageRenderer
|
||||
{
|
||||
|
||||
// Forward declaration from Screen.cpp - this function needs to be accessible
|
||||
// For now, we'll implement a local version that matches the Screen.cpp functionality
|
||||
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 drawStringWithEmotes(OLEDDisplay *display, int x, int y, const std::string &line, const Emote *emotes, int emoteCount)
|
||||
{
|
||||
int cursorX = x;
|
||||
const int fontHeight = FONT_HEIGHT_SMALL;
|
||||
|
||||
// === Step 1: Find tallest emote in the line ===
|
||||
int maxIconHeight = fontHeight;
|
||||
for (size_t i = 0; i < line.length();) {
|
||||
bool matched = false;
|
||||
for (int e = 0; e < emoteCount; ++e) {
|
||||
size_t emojiLen = strlen(emotes[e].label);
|
||||
if (line.compare(i, emojiLen, emotes[e].label) == 0) {
|
||||
if (emotes[e].height > maxIconHeight)
|
||||
maxIconHeight = emotes[e].height;
|
||||
i += emojiLen;
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!matched) {
|
||||
uint8_t c = static_cast<uint8_t>(line[i]);
|
||||
if ((c & 0xE0) == 0xC0)
|
||||
i += 2;
|
||||
else if ((c & 0xF0) == 0xE0)
|
||||
i += 3;
|
||||
else if ((c & 0xF8) == 0xF0)
|
||||
i += 4;
|
||||
else
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// === Step 2: Baseline alignment ===
|
||||
int lineHeight = std::max(fontHeight, maxIconHeight);
|
||||
int baselineOffset = (lineHeight - fontHeight) / 2;
|
||||
int fontY = y + baselineOffset;
|
||||
int fontMidline = fontY + fontHeight / 2;
|
||||
|
||||
// === Step 3: Render line in segments ===
|
||||
size_t i = 0;
|
||||
bool inBold = false;
|
||||
|
||||
while (i < line.length()) {
|
||||
// Check for ** start/end for faux bold
|
||||
if (line.compare(i, 2, "**") == 0) {
|
||||
inBold = !inBold;
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Look ahead for the next emote match
|
||||
size_t nextEmotePos = std::string::npos;
|
||||
const Emote *matchedEmote = nullptr;
|
||||
size_t emojiLen = 0;
|
||||
|
||||
for (int e = 0; e < emoteCount; ++e) {
|
||||
size_t pos = line.find(emotes[e].label, i);
|
||||
if (pos != std::string::npos && (nextEmotePos == std::string::npos || pos < nextEmotePos)) {
|
||||
nextEmotePos = pos;
|
||||
matchedEmote = &emotes[e];
|
||||
emojiLen = strlen(emotes[e].label);
|
||||
}
|
||||
}
|
||||
|
||||
// Render normal text segment up to the emote or bold toggle
|
||||
size_t nextControl = std::min(nextEmotePos, line.find("**", i));
|
||||
if (nextControl == std::string::npos)
|
||||
nextControl = line.length();
|
||||
|
||||
if (nextControl > i) {
|
||||
std::string textChunk = line.substr(i, nextControl - i);
|
||||
if (inBold) {
|
||||
// Faux bold: draw twice, offset by 1px
|
||||
display->drawString(cursorX + 1, fontY, textChunk.c_str());
|
||||
}
|
||||
display->drawString(cursorX, fontY, textChunk.c_str());
|
||||
cursorX += display->getStringWidth(textChunk.c_str());
|
||||
i = nextControl;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Render the emote (if found)
|
||||
if (matchedEmote && i == nextEmotePos) {
|
||||
int iconY = fontMidline - matchedEmote->height / 2 - 1;
|
||||
display->drawXbm(cursorX, iconY, matchedEmote->width, matchedEmote->height, matchedEmote->bitmap);
|
||||
cursorX += matchedEmote->width + 1;
|
||||
i += emojiLen;
|
||||
} else {
|
||||
// No more emotes — render the rest of the line
|
||||
std::string remaining = line.substr(i);
|
||||
if (inBold) {
|
||||
display->drawString(cursorX + 1, fontY, remaining.c_str());
|
||||
}
|
||||
display->drawString(cursorX, fontY, remaining.c_str());
|
||||
cursorX += display->getStringWidth(remaining.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||
{
|
||||
// Clear the unread message indicator when viewing the message
|
||||
hasUnreadMessage = false;
|
||||
|
||||
const meshtastic_MeshPacket &mp = devicestate.rx_text_message;
|
||||
const char *msg = reinterpret_cast<const char *>(mp.decoded.payload.bytes);
|
||||
|
||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
display->setFont(FONT_SMALL);
|
||||
|
||||
const int navHeight = FONT_HEIGHT_SMALL;
|
||||
const int scrollBottom = SCREEN_HEIGHT - navHeight;
|
||||
const int usableHeight = scrollBottom;
|
||||
const int textWidth = SCREEN_WIDTH;
|
||||
const int cornerRadius = 2;
|
||||
|
||||
bool isInverted = (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_INVERTED);
|
||||
bool isBold = config.display.heading_bold;
|
||||
|
||||
// === Header Construction ===
|
||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(getFrom(&mp));
|
||||
char headerStr[80];
|
||||
const char *sender = "???";
|
||||
if (node && node->has_user) {
|
||||
if (SCREEN_WIDTH >= 200 && strlen(node->user.long_name) > 0) {
|
||||
sender = node->user.long_name;
|
||||
} else {
|
||||
sender = node->user.short_name;
|
||||
}
|
||||
}
|
||||
uint32_t seconds = sinceReceived(&mp), minutes = seconds / 60, hours = minutes / 60, days = hours / 24;
|
||||
uint8_t timestampHours, timestampMinutes;
|
||||
int32_t daysAgo;
|
||||
bool useTimestamp = deltaToTimestamp(seconds, ×tampHours, ×tampMinutes, &daysAgo);
|
||||
|
||||
if (useTimestamp && minutes >= 15 && daysAgo == 0) {
|
||||
std::string prefix = (daysAgo == 1 && SCREEN_WIDTH >= 200) ? "Yesterday" : "At";
|
||||
if (config.display.use_12h_clock) {
|
||||
bool isPM = timestampHours >= 12;
|
||||
timestampHours = timestampHours % 12;
|
||||
if (timestampHours == 0)
|
||||
timestampHours = 12;
|
||||
snprintf(headerStr, sizeof(headerStr), "%s %d:%02d%s from %s", prefix.c_str(), timestampHours, timestampMinutes,
|
||||
isPM ? "p" : "a", sender);
|
||||
} else {
|
||||
snprintf(headerStr, sizeof(headerStr), "%s %d:%02d from %s", prefix.c_str(), timestampHours, timestampMinutes,
|
||||
sender);
|
||||
}
|
||||
} else {
|
||||
snprintf(headerStr, sizeof(headerStr), "%s ago from %s", UIRenderer::drawTimeDelta(days, hours, minutes, seconds).c_str(),
|
||||
sender);
|
||||
}
|
||||
|
||||
#ifndef EXCLUDE_EMOJI
|
||||
// === Bounce animation setup ===
|
||||
static uint32_t lastBounceTime = 0;
|
||||
static int bounceY = 0;
|
||||
const int bounceRange = 2; // Max pixels to bounce up/down
|
||||
const int bounceInterval = 60; // How quickly to change bounce direction (ms)
|
||||
|
||||
uint32_t now = millis();
|
||||
if (now - lastBounceTime >= bounceInterval) {
|
||||
lastBounceTime = now;
|
||||
bounceY = (bounceY + 1) % (bounceRange * 2);
|
||||
}
|
||||
for (int i = 0; i < numEmotes; ++i) {
|
||||
const Emote &e = emotes[i];
|
||||
if (strcmp(msg, e.label) == 0) {
|
||||
// Draw the header
|
||||
if (isInverted) {
|
||||
drawRoundedHighlight(display, x, 0, SCREEN_WIDTH, FONT_HEIGHT_SMALL - 1, cornerRadius);
|
||||
display->setColor(BLACK);
|
||||
display->drawString(x + 3, 0, headerStr);
|
||||
if (isBold)
|
||||
display->drawString(x + 4, 0, headerStr);
|
||||
display->setColor(WHITE);
|
||||
} else {
|
||||
display->drawString(x, 0, headerStr);
|
||||
if (SCREEN_WIDTH > 128) {
|
||||
display->drawLine(0, 20, SCREEN_WIDTH, 20);
|
||||
} else {
|
||||
display->drawLine(0, 14, SCREEN_WIDTH, 14);
|
||||
}
|
||||
}
|
||||
|
||||
// Center the emote below header + apply bounce
|
||||
int remainingHeight = SCREEN_HEIGHT - FONT_HEIGHT_SMALL - navHeight;
|
||||
int emoteY = FONT_HEIGHT_SMALL + (remainingHeight - e.height) / 2 + bounceY - bounceRange;
|
||||
display->drawXbm((SCREEN_WIDTH - e.width) / 2, emoteY, e.width, e.height, e.bitmap);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// === Word-wrap and build line list ===
|
||||
char messageBuf[237];
|
||||
snprintf(messageBuf, sizeof(messageBuf), "%s", msg);
|
||||
|
||||
std::vector<std::string> lines;
|
||||
lines.push_back(std::string(headerStr)); // Header line is always first
|
||||
|
||||
std::string line, word;
|
||||
for (int i = 0; messageBuf[i]; ++i) {
|
||||
char ch = messageBuf[i];
|
||||
if (ch == '\n') {
|
||||
if (!word.empty())
|
||||
line += word;
|
||||
if (!line.empty())
|
||||
lines.push_back(line);
|
||||
line.clear();
|
||||
word.clear();
|
||||
} else if (ch == ' ') {
|
||||
line += word + ' ';
|
||||
word.clear();
|
||||
} else {
|
||||
word += ch;
|
||||
std::string test = line + word;
|
||||
if (display->getStringWidth(test.c_str()) > textWidth + 4) {
|
||||
if (!line.empty())
|
||||
lines.push_back(line);
|
||||
line = word;
|
||||
word.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!word.empty())
|
||||
line += word;
|
||||
if (!line.empty())
|
||||
lines.push_back(line);
|
||||
|
||||
// === Scrolling logic ===
|
||||
std::vector<int> rowHeights;
|
||||
|
||||
for (const auto &line : lines) {
|
||||
int maxHeight = FONT_HEIGHT_SMALL;
|
||||
for (int i = 0; i < numEmotes; ++i) {
|
||||
const Emote &e = emotes[i];
|
||||
if (line.find(e.label) != std::string::npos) {
|
||||
if (e.height > maxHeight)
|
||||
maxHeight = e.height;
|
||||
}
|
||||
}
|
||||
rowHeights.push_back(maxHeight);
|
||||
}
|
||||
int totalHeight = 0;
|
||||
for (size_t i = 1; i < rowHeights.size(); ++i) {
|
||||
totalHeight += rowHeights[i];
|
||||
}
|
||||
int usableScrollHeight = usableHeight - rowHeights[0]; // remove header height
|
||||
int scrollStop = std::max(0, totalHeight - usableScrollHeight);
|
||||
|
||||
static float scrollY = 0.0f;
|
||||
static uint32_t lastTime = 0, scrollStartDelay = 0, pauseStart = 0;
|
||||
static bool waitingToReset = false, scrollStarted = false;
|
||||
|
||||
// === Smooth scrolling adjustment ===
|
||||
// You can tweak this divisor to change how smooth it scrolls.
|
||||
// Lower = smoother, but can feel slow.
|
||||
float delta = (now - lastTime) / 400.0f;
|
||||
lastTime = now;
|
||||
|
||||
const float scrollSpeed = 2.0f; // pixels per second
|
||||
|
||||
// Delay scrolling start by 2 seconds
|
||||
if (scrollStartDelay == 0)
|
||||
scrollStartDelay = now;
|
||||
if (!scrollStarted && now - scrollStartDelay > 2000)
|
||||
scrollStarted = true;
|
||||
|
||||
if (totalHeight > usableHeight) {
|
||||
if (scrollStarted) {
|
||||
if (!waitingToReset) {
|
||||
scrollY += delta * scrollSpeed;
|
||||
if (scrollY >= scrollStop) {
|
||||
scrollY = scrollStop;
|
||||
waitingToReset = true;
|
||||
pauseStart = lastTime;
|
||||
}
|
||||
} else if (lastTime - pauseStart > 3000) {
|
||||
scrollY = 0;
|
||||
waitingToReset = false;
|
||||
scrollStarted = false;
|
||||
scrollStartDelay = lastTime;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
scrollY = 0;
|
||||
}
|
||||
|
||||
int scrollOffset = static_cast<int>(scrollY);
|
||||
int yOffset = -scrollOffset;
|
||||
if (!isInverted) {
|
||||
if (SCREEN_WIDTH > 128) {
|
||||
display->drawLine(0, yOffset + 20, SCREEN_WIDTH, yOffset + 20);
|
||||
} else {
|
||||
display->drawLine(0, yOffset + 14, SCREEN_WIDTH, yOffset + 14);
|
||||
}
|
||||
}
|
||||
|
||||
// === Render visible lines ===
|
||||
for (size_t i = 0; i < lines.size(); ++i) {
|
||||
int lineY = yOffset;
|
||||
for (size_t j = 0; j < i; ++j)
|
||||
lineY += rowHeights[j];
|
||||
if (lineY > -rowHeights[i] && lineY < scrollBottom) {
|
||||
if (i == 0 && isInverted) {
|
||||
drawRoundedHighlight(display, x, lineY, SCREEN_WIDTH, FONT_HEIGHT_SMALL - 1, cornerRadius);
|
||||
display->setColor(BLACK);
|
||||
display->drawString(x + 3, lineY, lines[i].c_str());
|
||||
if (isBold)
|
||||
display->drawString(x + 4, lineY, lines[i].c_str());
|
||||
display->setColor(WHITE);
|
||||
} else {
|
||||
drawStringWithEmotes(display, x, lineY, lines[i], emotes, numEmotes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace MessageRenderer
|
||||
} // namespace graphics
|
||||
18
src/graphics/draw/MessageRenderer.h
Normal file
18
src/graphics/draw/MessageRenderer.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include "OLEDDisplay.h"
|
||||
#include "OLEDDisplayUi.h"
|
||||
#include "graphics/emotes.h"
|
||||
|
||||
namespace graphics
|
||||
{
|
||||
namespace MessageRenderer
|
||||
{
|
||||
|
||||
// Text and emote rendering
|
||||
void drawStringWithEmotes(OLEDDisplay *display, int x, int y, const std::string &line, const Emote *emotes, int emoteCount);
|
||||
|
||||
/// Draws the text message frame for displaying received messages
|
||||
void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||
|
||||
} // namespace MessageRenderer
|
||||
} // namespace graphics
|
||||
878
src/graphics/draw/NodeListRenderer.cpp
Normal file
878
src/graphics/draw/NodeListRenderer.cpp
Normal file
@@ -0,0 +1,878 @@
|
||||
#include "NodeListRenderer.h"
|
||||
#include "CompassRenderer.h"
|
||||
#include "NodeDB.h"
|
||||
#include "UIRenderer.h"
|
||||
#include "configuration.h"
|
||||
#include "gps/GeoCoord.h"
|
||||
#include "gps/RTC.h" // for getTime() function
|
||||
#include "graphics/ScreenFonts.h"
|
||||
#include "graphics/SharedUIDisplay.h"
|
||||
#include "graphics/images.h"
|
||||
#include <algorithm>
|
||||
|
||||
// Forward declarations for functions defined in Screen.cpp
|
||||
namespace graphics
|
||||
{
|
||||
extern bool haveGlyphs(const char *str);
|
||||
} // namespace graphics
|
||||
|
||||
// Global screen instance
|
||||
extern graphics::Screen *screen;
|
||||
|
||||
namespace graphics
|
||||
{
|
||||
namespace NodeListRenderer
|
||||
{
|
||||
|
||||
// Function moved from Screen.cpp to NodeListRenderer.cpp since it's primarily used here
|
||||
void drawScaledXBitmap16x16(int x, int y, int width, int height, const uint8_t *bitmapXBM, OLEDDisplay *display)
|
||||
{
|
||||
for (int row = 0; row < height; row++) {
|
||||
uint8_t rowMask = (1 << row);
|
||||
for (int col = 0; col < width; col++) {
|
||||
uint8_t colData = pgm_read_byte(&bitmapXBM[col]);
|
||||
if (colData & rowMask) {
|
||||
// Note: rows become X, columns become Y after transpose
|
||||
display->fillRect(x + row * 2, y + col * 2, 2, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Static variables for dynamic cycling
|
||||
static NodeListMode currentMode = MODE_LAST_HEARD;
|
||||
static int scrollIndex = 0;
|
||||
|
||||
// =============================
|
||||
// Utility Functions
|
||||
// =============================
|
||||
|
||||
const char *getSafeNodeName(meshtastic_NodeInfoLite *node)
|
||||
{
|
||||
static char nodeName[16] = "?";
|
||||
if (node->has_user && strlen(node->user.short_name) > 0) {
|
||||
bool valid = true;
|
||||
const char *name = node->user.short_name;
|
||||
for (size_t i = 0; i < strlen(name); i++) {
|
||||
uint8_t c = (uint8_t)name[i];
|
||||
if (c < 32 || c > 126) {
|
||||
valid = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (valid) {
|
||||
strncpy(nodeName, name, sizeof(nodeName) - 1);
|
||||
nodeName[sizeof(nodeName) - 1] = '\0';
|
||||
} else {
|
||||
snprintf(nodeName, sizeof(nodeName), "%04X", (uint16_t)(node->num & 0xFFFF));
|
||||
}
|
||||
} else {
|
||||
strcpy(nodeName, "?");
|
||||
}
|
||||
return nodeName;
|
||||
}
|
||||
|
||||
uint32_t sinceLastSeen(meshtastic_NodeInfoLite *node)
|
||||
{
|
||||
uint32_t now = getTime();
|
||||
uint32_t last_seen = node->last_heard;
|
||||
if (last_seen == 0 || now < last_seen) {
|
||||
return UINT32_MAX;
|
||||
}
|
||||
return now - last_seen;
|
||||
}
|
||||
|
||||
const char *getCurrentModeTitle(int screenWidth)
|
||||
{
|
||||
switch (currentMode) {
|
||||
case MODE_LAST_HEARD:
|
||||
return "Node List";
|
||||
case MODE_HOP_SIGNAL:
|
||||
return (screenWidth > 128) ? "Hops/Signal" : "Hops/Sig";
|
||||
case MODE_DISTANCE:
|
||||
return "Distance";
|
||||
default:
|
||||
return "Nodes";
|
||||
}
|
||||
}
|
||||
|
||||
// Use dynamic timing based on mode
|
||||
unsigned long getModeCycleIntervalMs()
|
||||
{
|
||||
return 3000;
|
||||
}
|
||||
|
||||
// Calculate bearing between two lat/lon points
|
||||
float calculateBearing(double lat1, double lon1, double lat2, double lon2)
|
||||
{
|
||||
double dLon = (lon2 - lon1) * DEG_TO_RAD;
|
||||
double y = sin(dLon) * cos(lat2 * DEG_TO_RAD);
|
||||
double x = cos(lat1 * DEG_TO_RAD) * sin(lat2 * DEG_TO_RAD) - sin(lat1 * DEG_TO_RAD) * cos(lat2 * DEG_TO_RAD) * cos(dLon);
|
||||
double bearing = atan2(y, x) * RAD_TO_DEG;
|
||||
return fmod(bearing + 360.0, 360.0);
|
||||
}
|
||||
|
||||
int calculateMaxScroll(int totalEntries, int visibleRows)
|
||||
{
|
||||
return std::max(0, (totalEntries - 1) / (visibleRows * 2));
|
||||
}
|
||||
|
||||
void retrieveAndSortNodes(std::vector<NodeEntry> &nodeList)
|
||||
{
|
||||
size_t numNodes = nodeDB->getNumMeshNodes();
|
||||
for (size_t i = 0; i < numNodes; i++) {
|
||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNodeByIndex(i);
|
||||
if (!node || node->num == nodeDB->getNodeNum())
|
||||
continue;
|
||||
|
||||
NodeEntry entry;
|
||||
entry.node = node;
|
||||
entry.sortValue = sinceLastSeen(node);
|
||||
|
||||
nodeList.push_back(entry);
|
||||
}
|
||||
|
||||
// Sort nodes: favorites first, then by last heard (most recent first)
|
||||
std::sort(nodeList.begin(), nodeList.end(), [](const NodeEntry &a, const NodeEntry &b) {
|
||||
bool aFav = a.node->is_favorite;
|
||||
bool bFav = b.node->is_favorite;
|
||||
if (aFav != bFav)
|
||||
return aFav > bFav;
|
||||
if (a.sortValue == 0 || a.sortValue == UINT32_MAX)
|
||||
return false;
|
||||
if (b.sortValue == 0 || b.sortValue == UINT32_MAX)
|
||||
return true;
|
||||
return a.sortValue < b.sortValue;
|
||||
});
|
||||
}
|
||||
|
||||
void drawColumnSeparator(OLEDDisplay *display, int16_t x, int16_t yStart, int16_t yEnd)
|
||||
{
|
||||
int columnWidth = display->getWidth() / 2;
|
||||
int separatorX = x + columnWidth - 1;
|
||||
for (int y = yStart; y <= yEnd; y += 2) {
|
||||
display->setPixel(separatorX, y);
|
||||
}
|
||||
}
|
||||
|
||||
void drawScrollbar(OLEDDisplay *display, int visibleNodeRows, int totalEntries, int scrollIndex, int columns, int scrollStartY)
|
||||
{
|
||||
if (totalEntries <= visibleNodeRows * columns)
|
||||
return;
|
||||
|
||||
int scrollbarX = display->getWidth() - 2;
|
||||
int scrollbarHeight = display->getHeight() - scrollStartY - 10;
|
||||
int thumbHeight = std::max(4, (scrollbarHeight * visibleNodeRows * columns) / totalEntries);
|
||||
int maxScroll = calculateMaxScroll(totalEntries, visibleNodeRows);
|
||||
int thumbY = scrollStartY + (scrollIndex * (scrollbarHeight - thumbHeight)) / std::max(1, maxScroll);
|
||||
|
||||
for (int i = 0; i < thumbHeight; i++) {
|
||||
display->setPixel(scrollbarX, thumbY + i);
|
||||
}
|
||||
}
|
||||
|
||||
// =============================
|
||||
// Entry Renderers
|
||||
// =============================
|
||||
|
||||
void drawEntryLastHeard(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int16_t x, int16_t y, int columnWidth)
|
||||
{
|
||||
bool isLeftCol = (x < SCREEN_WIDTH / 2);
|
||||
int timeOffset = (SCREEN_WIDTH > 128) ? (isLeftCol ? 7 : 10) : (isLeftCol ? 3 : 7);
|
||||
|
||||
const char *nodeName = getSafeNodeName(node);
|
||||
|
||||
char timeStr[10];
|
||||
uint32_t seconds = sinceLastSeen(node);
|
||||
if (seconds == 0 || seconds == UINT32_MAX) {
|
||||
snprintf(timeStr, sizeof(timeStr), "?");
|
||||
} else {
|
||||
uint32_t minutes = seconds / 60, hours = minutes / 60, days = hours / 24;
|
||||
snprintf(timeStr, sizeof(timeStr), (days > 365 ? "?" : "%d%c"),
|
||||
(days ? days
|
||||
: hours ? hours
|
||||
: minutes),
|
||||
(days ? 'd'
|
||||
: hours ? 'h'
|
||||
: 'm'));
|
||||
}
|
||||
|
||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
display->setFont(FONT_SMALL);
|
||||
display->drawString(x + ((SCREEN_WIDTH > 128) ? 6 : 3), y, nodeName);
|
||||
if (node->is_favorite) {
|
||||
if (SCREEN_WIDTH > 128) {
|
||||
drawScaledXBitmap16x16(x, y + 6, smallbulletpoint_width, smallbulletpoint_height, smallbulletpoint, display);
|
||||
} else {
|
||||
display->drawXbm(x, y + 5, smallbulletpoint_width, smallbulletpoint_height, smallbulletpoint);
|
||||
}
|
||||
}
|
||||
|
||||
int rightEdge = x + columnWidth - timeOffset;
|
||||
int textWidth = display->getStringWidth(timeStr);
|
||||
display->drawString(rightEdge - textWidth, y, timeStr);
|
||||
}
|
||||
|
||||
void drawEntryHopSignal(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int16_t x, int16_t y, int columnWidth)
|
||||
{
|
||||
bool isLeftCol = (x < SCREEN_WIDTH / 2);
|
||||
|
||||
int nameMaxWidth = columnWidth - 25;
|
||||
int barsOffset = (SCREEN_WIDTH > 128) ? (isLeftCol ? 16 : 20) : (isLeftCol ? 15 : 19);
|
||||
int hopOffset = (SCREEN_WIDTH > 128) ? (isLeftCol ? 17 : 25) : (isLeftCol ? 13 : 17);
|
||||
|
||||
int barsXOffset = columnWidth - barsOffset;
|
||||
|
||||
const char *nodeName = getSafeNodeName(node);
|
||||
|
||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
display->setFont(FONT_SMALL);
|
||||
|
||||
display->drawStringMaxWidth(x + ((SCREEN_WIDTH > 128) ? 6 : 3), y, nameMaxWidth, nodeName);
|
||||
if (node->is_favorite) {
|
||||
if (SCREEN_WIDTH > 128) {
|
||||
drawScaledXBitmap16x16(x, y + 6, smallbulletpoint_width, smallbulletpoint_height, smallbulletpoint, display);
|
||||
} else {
|
||||
display->drawXbm(x, y + 5, smallbulletpoint_width, smallbulletpoint_height, smallbulletpoint);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw signal strength bars
|
||||
int bars = (node->snr > 5) ? 4 : (node->snr > 0) ? 3 : (node->snr > -5) ? 2 : (node->snr > -10) ? 1 : 0;
|
||||
int barWidth = 2;
|
||||
int barStartX = x + barsXOffset;
|
||||
int barStartY = y + 1 + (FONT_HEIGHT_SMALL / 2) + 2;
|
||||
|
||||
for (int b = 0; b < 4; b++) {
|
||||
if (b < bars) {
|
||||
int height = (b * 2);
|
||||
display->fillRect(barStartX + (b * (barWidth + 1)), barStartY - height, barWidth, height);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw hop count
|
||||
char hopStr[6] = "";
|
||||
if (node->has_hops_away && node->hops_away > 0)
|
||||
snprintf(hopStr, sizeof(hopStr), "[%d]", node->hops_away);
|
||||
|
||||
if (hopStr[0] != '\0') {
|
||||
int rightEdge = x + columnWidth - hopOffset;
|
||||
int textWidth = display->getStringWidth(hopStr);
|
||||
display->drawString(rightEdge - textWidth, y, hopStr);
|
||||
}
|
||||
}
|
||||
|
||||
void drawNodeDistance(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int16_t x, int16_t y, int columnWidth)
|
||||
{
|
||||
bool isLeftCol = (x < SCREEN_WIDTH / 2);
|
||||
int nameMaxWidth = columnWidth - (SCREEN_WIDTH > 128 ? (isLeftCol ? 25 : 28) : (isLeftCol ? 20 : 22));
|
||||
|
||||
const char *nodeName = getSafeNodeName(node);
|
||||
char distStr[10] = "";
|
||||
|
||||
meshtastic_NodeInfoLite *ourNode = nodeDB->getMeshNode(nodeDB->getNodeNum());
|
||||
if (nodeDB->hasValidPosition(ourNode) && nodeDB->hasValidPosition(node)) {
|
||||
double lat1 = ourNode->position.latitude_i * 1e-7;
|
||||
double lon1 = ourNode->position.longitude_i * 1e-7;
|
||||
double lat2 = node->position.latitude_i * 1e-7;
|
||||
double lon2 = node->position.longitude_i * 1e-7;
|
||||
|
||||
double earthRadiusKm = 6371.0;
|
||||
double dLat = (lat2 - lat1) * DEG_TO_RAD;
|
||||
double dLon = (lon2 - lon1) * DEG_TO_RAD;
|
||||
|
||||
double a =
|
||||
sin(dLat / 2) * sin(dLat / 2) + cos(lat1 * DEG_TO_RAD) * cos(lat2 * DEG_TO_RAD) * sin(dLon / 2) * sin(dLon / 2);
|
||||
double c = 2 * atan2(sqrt(a), sqrt(1 - a));
|
||||
double distanceKm = earthRadiusKm * c;
|
||||
|
||||
if (config.display.units == meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL) {
|
||||
double miles = distanceKm * 0.621371;
|
||||
if (miles < 0.1) {
|
||||
int feet = (int)(miles * 5280);
|
||||
if (feet < 1000)
|
||||
snprintf(distStr, sizeof(distStr), "%dft", feet);
|
||||
else
|
||||
snprintf(distStr, sizeof(distStr), "¼mi"); // 4-char max
|
||||
} else {
|
||||
int roundedMiles = (int)(miles + 0.5);
|
||||
if (roundedMiles < 1000)
|
||||
snprintf(distStr, sizeof(distStr), "%dmi", roundedMiles);
|
||||
else
|
||||
snprintf(distStr, sizeof(distStr), "999"); // Max display cap
|
||||
}
|
||||
} else {
|
||||
if (distanceKm < 1.0) {
|
||||
int meters = (int)(distanceKm * 1000);
|
||||
if (meters < 1000)
|
||||
snprintf(distStr, sizeof(distStr), "%dm", meters);
|
||||
else
|
||||
snprintf(distStr, sizeof(distStr), "1k");
|
||||
} else {
|
||||
int km = (int)(distanceKm + 0.5);
|
||||
if (km < 1000)
|
||||
snprintf(distStr, sizeof(distStr), "%dk", km);
|
||||
else
|
||||
snprintf(distStr, sizeof(distStr), "999");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
display->setFont(FONT_SMALL);
|
||||
display->drawStringMaxWidth(x + ((SCREEN_WIDTH > 128) ? 6 : 3), y, nameMaxWidth, nodeName);
|
||||
if (node->is_favorite) {
|
||||
if (SCREEN_WIDTH > 128) {
|
||||
drawScaledXBitmap16x16(x, y + 6, smallbulletpoint_width, smallbulletpoint_height, smallbulletpoint, display);
|
||||
} else {
|
||||
display->drawXbm(x, y + 5, smallbulletpoint_width, smallbulletpoint_height, smallbulletpoint);
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen(distStr) > 0) {
|
||||
int offset = (SCREEN_WIDTH > 128) ? (isLeftCol ? 7 : 10) // Offset for Wide Screens (Left Column:Right Column)
|
||||
: (isLeftCol ? 5 : 8); // Offset for Narrow Screens (Left Column:Right Column)
|
||||
int rightEdge = x + columnWidth - offset;
|
||||
int textWidth = display->getStringWidth(distStr);
|
||||
display->drawString(rightEdge - textWidth, y, distStr);
|
||||
}
|
||||
}
|
||||
|
||||
void drawEntryDynamic(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int16_t x, int16_t y, int columnWidth)
|
||||
{
|
||||
switch (currentMode) {
|
||||
case MODE_LAST_HEARD:
|
||||
drawEntryLastHeard(display, node, x, y, columnWidth);
|
||||
break;
|
||||
case MODE_HOP_SIGNAL:
|
||||
drawEntryHopSignal(display, node, x, y, columnWidth);
|
||||
break;
|
||||
case MODE_DISTANCE:
|
||||
drawNodeDistance(display, node, x, y, columnWidth);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void drawEntryCompass(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int16_t x, int16_t y, int columnWidth)
|
||||
{
|
||||
bool isLeftCol = (x < SCREEN_WIDTH / 2);
|
||||
|
||||
// Adjust max text width depending on column and screen width
|
||||
int nameMaxWidth = columnWidth - (SCREEN_WIDTH > 128 ? (isLeftCol ? 25 : 28) : (isLeftCol ? 20 : 22));
|
||||
|
||||
const char *nodeName = getSafeNodeName(node);
|
||||
|
||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
display->setFont(FONT_SMALL);
|
||||
display->drawStringMaxWidth(x + ((SCREEN_WIDTH > 128) ? 6 : 3), y, nameMaxWidth, nodeName);
|
||||
if (node->is_favorite) {
|
||||
if (SCREEN_WIDTH > 128) {
|
||||
drawScaledXBitmap16x16(x, y + 6, smallbulletpoint_width, smallbulletpoint_height, smallbulletpoint, display);
|
||||
} else {
|
||||
display->drawXbm(x, y + 5, smallbulletpoint_width, smallbulletpoint_height, smallbulletpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void drawCompassArrow(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int16_t x, int16_t y, int columnWidth, float myHeading,
|
||||
double userLat, double userLon)
|
||||
{
|
||||
if (!nodeDB->hasValidPosition(node))
|
||||
return;
|
||||
|
||||
bool isLeftCol = (x < SCREEN_WIDTH / 2);
|
||||
int arrowXOffset = (SCREEN_WIDTH > 128) ? (isLeftCol ? 22 : 24) : (isLeftCol ? 12 : 18);
|
||||
|
||||
int centerX = x + columnWidth - arrowXOffset;
|
||||
int centerY = y + FONT_HEIGHT_SMALL / 2;
|
||||
|
||||
double nodeLat = node->position.latitude_i * 1e-7;
|
||||
double nodeLon = node->position.longitude_i * 1e-7;
|
||||
float bearingToNode = calculateBearing(userLat, userLon, nodeLat, nodeLon);
|
||||
float relativeBearing = fmod((bearingToNode - myHeading + 360), 360);
|
||||
float angle = relativeBearing * DEG_TO_RAD;
|
||||
|
||||
// Shrink size by 2px
|
||||
int size = FONT_HEIGHT_SMALL - 5;
|
||||
float halfSize = size / 2.0;
|
||||
|
||||
// Point of the arrow
|
||||
int tipX = centerX + halfSize * cos(angle);
|
||||
int tipY = centerY - halfSize * sin(angle);
|
||||
|
||||
float baseAngle = radians(35);
|
||||
float sideLen = halfSize * 0.95;
|
||||
float notchInset = halfSize * 0.35;
|
||||
|
||||
// Left and right corners
|
||||
int leftX = centerX + sideLen * cos(angle + PI - baseAngle);
|
||||
int leftY = centerY - sideLen * sin(angle + PI - baseAngle);
|
||||
|
||||
int rightX = centerX + sideLen * cos(angle + PI + baseAngle);
|
||||
int rightY = centerY - sideLen * sin(angle + PI + baseAngle);
|
||||
|
||||
// Center notch (cut-in)
|
||||
int notchX = centerX - notchInset * cos(angle);
|
||||
int notchY = centerY + notchInset * sin(angle);
|
||||
|
||||
// Draw the chevron-style arrowhead
|
||||
display->fillTriangle(tipX, tipY, leftX, leftY, notchX, notchY);
|
||||
display->fillTriangle(tipX, tipY, notchX, notchY, rightX, rightY);
|
||||
}
|
||||
|
||||
// =============================
|
||||
// Main Screen Functions
|
||||
// =============================
|
||||
|
||||
void drawNodeListScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y, const char *title,
|
||||
EntryRenderer renderer, NodeExtrasRenderer extras, float heading, double lat, double lon)
|
||||
{
|
||||
const int COMMON_HEADER_HEIGHT = FONT_HEIGHT_SMALL - 1;
|
||||
const int rowYOffset = FONT_HEIGHT_SMALL - 3;
|
||||
|
||||
int columnWidth = display->getWidth() / 2;
|
||||
|
||||
display->clear();
|
||||
|
||||
// Draw the battery/time header
|
||||
graphics::drawCommonHeader(display, x, y);
|
||||
|
||||
// Draw the centered title within the header
|
||||
const int highlightHeight = COMMON_HEADER_HEIGHT;
|
||||
const int textY = y + 1 + (highlightHeight - FONT_HEIGHT_SMALL) / 2;
|
||||
const int centerX = x + SCREEN_WIDTH / 2;
|
||||
|
||||
display->setFont(FONT_SMALL);
|
||||
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
||||
|
||||
if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_INVERTED)
|
||||
display->setColor(BLACK);
|
||||
|
||||
display->drawString(centerX, textY, title);
|
||||
if (config.display.heading_bold)
|
||||
display->drawString(centerX + 1, textY, title);
|
||||
|
||||
display->setColor(WHITE);
|
||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
|
||||
// Space below header
|
||||
y += COMMON_HEADER_HEIGHT;
|
||||
|
||||
// Fetch and display sorted node list
|
||||
std::vector<NodeEntry> nodeList;
|
||||
retrieveAndSortNodes(nodeList);
|
||||
|
||||
int totalEntries = nodeList.size();
|
||||
int totalRowsAvailable = (display->getHeight() - y) / rowYOffset;
|
||||
#ifdef USE_EINK
|
||||
totalRowsAvailable -= 1;
|
||||
#endif
|
||||
int visibleNodeRows = totalRowsAvailable;
|
||||
int totalColumns = 2;
|
||||
|
||||
int startIndex = scrollIndex * visibleNodeRows * totalColumns;
|
||||
int endIndex = std::min(startIndex + visibleNodeRows * totalColumns, totalEntries);
|
||||
|
||||
int yOffset = 0;
|
||||
int col = 0;
|
||||
int lastNodeY = y;
|
||||
int shownCount = 0;
|
||||
int rowCount = 0;
|
||||
|
||||
for (int i = startIndex; i < endIndex; ++i) {
|
||||
int xPos = x + (col * columnWidth);
|
||||
int yPos = y + yOffset;
|
||||
renderer(display, nodeList[i].node, xPos, yPos, columnWidth);
|
||||
|
||||
if (extras) {
|
||||
extras(display, nodeList[i].node, xPos, yPos, columnWidth, heading, lat, lon);
|
||||
}
|
||||
|
||||
lastNodeY = std::max(lastNodeY, yPos + FONT_HEIGHT_SMALL);
|
||||
yOffset += rowYOffset;
|
||||
shownCount++;
|
||||
rowCount++;
|
||||
|
||||
if (rowCount >= totalRowsAvailable) {
|
||||
yOffset = 0;
|
||||
rowCount = 0;
|
||||
col++;
|
||||
if (col > (totalColumns - 1))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw column separator
|
||||
if (shownCount > 0) {
|
||||
const int firstNodeY = y + 3;
|
||||
drawColumnSeparator(display, x, firstNodeY, lastNodeY);
|
||||
}
|
||||
|
||||
const int scrollStartY = y + 3;
|
||||
drawScrollbar(display, visibleNodeRows, totalEntries, scrollIndex, 2, scrollStartY);
|
||||
}
|
||||
|
||||
// =============================
|
||||
// Screen Frame Functions
|
||||
// =============================
|
||||
|
||||
#ifndef USE_EINK
|
||||
void drawDynamicNodeListScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||
{
|
||||
// Static variables to track mode and duration
|
||||
static NodeListMode lastRenderedMode = MODE_COUNT;
|
||||
static unsigned long modeStartTime = 0;
|
||||
|
||||
unsigned long now = millis();
|
||||
|
||||
// On very first call (on boot or state enter)
|
||||
if (lastRenderedMode == MODE_COUNT) {
|
||||
currentMode = MODE_LAST_HEARD;
|
||||
modeStartTime = now;
|
||||
}
|
||||
|
||||
// Time to switch to next mode?
|
||||
if (now - modeStartTime >= getModeCycleIntervalMs()) {
|
||||
currentMode = static_cast<NodeListMode>((currentMode + 1) % MODE_COUNT);
|
||||
modeStartTime = now;
|
||||
}
|
||||
|
||||
// Render screen based on currentMode
|
||||
const char *title = getCurrentModeTitle(display->getWidth());
|
||||
drawNodeListScreen(display, state, x, y, title, drawEntryDynamic);
|
||||
|
||||
// Track the last mode to avoid reinitializing modeStartTime
|
||||
lastRenderedMode = currentMode;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_EINK
|
||||
void drawLastHeardScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||
{
|
||||
const char *title = "Node List";
|
||||
drawNodeListScreen(display, state, x, y, title, drawEntryLastHeard);
|
||||
}
|
||||
|
||||
void drawHopSignalScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||
{
|
||||
const char *title = "Hops/Signal";
|
||||
drawNodeListScreen(display, state, x, y, title, drawEntryHopSignal);
|
||||
}
|
||||
|
||||
void drawDistanceScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||
{
|
||||
const char *title = "Distance";
|
||||
drawNodeListScreen(display, state, x, y, title, drawNodeDistance);
|
||||
}
|
||||
#endif
|
||||
|
||||
void drawNodeListWithCompasses(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||
{
|
||||
float heading = 0;
|
||||
bool validHeading = false;
|
||||
double lat = 0;
|
||||
double lon = 0;
|
||||
|
||||
#if HAS_GPS
|
||||
if (screen->hasHeading()) {
|
||||
heading = screen->getHeading(); // degrees
|
||||
validHeading = true;
|
||||
} else {
|
||||
heading = screen->estimatedHeading(lat, lon);
|
||||
validHeading = !isnan(heading);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!validHeading)
|
||||
return;
|
||||
|
||||
drawNodeListScreen(display, state, x, y, "Bearings", drawEntryCompass, drawCompassArrow, heading, lat, lon);
|
||||
}
|
||||
|
||||
void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||
{
|
||||
// Cache favorite nodes for the current frame only, to save computation
|
||||
static std::vector<meshtastic_NodeInfoLite *> favoritedNodes;
|
||||
static int prevFrame = -1;
|
||||
|
||||
// Only rebuild favorites list if we're on a new frame
|
||||
if (state->currentFrame != prevFrame) {
|
||||
prevFrame = state->currentFrame;
|
||||
favoritedNodes.clear();
|
||||
size_t total = nodeDB->getNumMeshNodes();
|
||||
for (size_t i = 0; i < total; i++) {
|
||||
meshtastic_NodeInfoLite *n = nodeDB->getMeshNodeByIndex(i);
|
||||
// Skip nulls and ourself
|
||||
if (!n || n->num == nodeDB->getNodeNum())
|
||||
continue;
|
||||
if (n->is_favorite)
|
||||
favoritedNodes.push_back(n);
|
||||
}
|
||||
// Keep a stable, consistent display order
|
||||
std::sort(favoritedNodes.begin(), favoritedNodes.end(),
|
||||
[](meshtastic_NodeInfoLite *a, meshtastic_NodeInfoLite *b) { return a->num < b->num; });
|
||||
}
|
||||
if (favoritedNodes.empty())
|
||||
return;
|
||||
|
||||
// Only display if index is valid
|
||||
int nodeIndex = state->currentFrame - (screen->frameCount - favoritedNodes.size());
|
||||
if (nodeIndex < 0 || nodeIndex >= (int)favoritedNodes.size())
|
||||
return;
|
||||
|
||||
meshtastic_NodeInfoLite *node = favoritedNodes[nodeIndex];
|
||||
if (!node || node->num == nodeDB->getNodeNum() || !node->is_favorite)
|
||||
return;
|
||||
|
||||
display->clear();
|
||||
|
||||
// Draw battery/time/mail header (common across screens)
|
||||
graphics::drawCommonHeader(display, x, y);
|
||||
|
||||
// Draw the short node name centered at the top, with bold shadow if set
|
||||
const int highlightHeight = FONT_HEIGHT_SMALL - 1;
|
||||
const int textY = y + 1 + (highlightHeight - FONT_HEIGHT_SMALL) / 2;
|
||||
const int centerX = x + SCREEN_WIDTH / 2;
|
||||
const char *shortName = (node->has_user && haveGlyphs(node->user.short_name)) ? node->user.short_name : "Node";
|
||||
|
||||
if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_INVERTED)
|
||||
display->setColor(BLACK);
|
||||
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
||||
display->setFont(FONT_SMALL);
|
||||
display->drawString(centerX, textY, shortName);
|
||||
if (config.display.heading_bold)
|
||||
display->drawString(centerX + 1, textY, shortName);
|
||||
|
||||
display->setColor(WHITE);
|
||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
display->setFont(FONT_SMALL);
|
||||
|
||||
// Dynamic row stacking with predefined Y positions
|
||||
const int yPositions[5] = {moreCompactFirstLine, moreCompactSecondLine, moreCompactThirdLine, moreCompactFourthLine,
|
||||
moreCompactFifthLine};
|
||||
int line = 0;
|
||||
|
||||
// 1. Long Name (always try to show first)
|
||||
const char *username = (node->has_user && node->user.long_name[0]) ? node->user.long_name : nullptr;
|
||||
if (username && line < 5) {
|
||||
display->drawString(x, yPositions[line++], username);
|
||||
}
|
||||
|
||||
// 2. Signal and Hops (combined on one line, if available)
|
||||
char signalHopsStr[32] = "";
|
||||
bool haveSignal = false;
|
||||
int percentSignal = clamp((int)((node->snr + 10) * 5), 0, 100);
|
||||
const char *signalLabel = " Sig";
|
||||
|
||||
// If SNR looks reasonable, show signal
|
||||
if ((int)((node->snr + 10) * 5) >= 0 && node->snr > -100) {
|
||||
snprintf(signalHopsStr, sizeof(signalHopsStr), "%s: %d%%", signalLabel, percentSignal);
|
||||
haveSignal = true;
|
||||
}
|
||||
// If hops is valid (>0), show right after signal
|
||||
if (node->hops_away > 0) {
|
||||
size_t len = strlen(signalHopsStr);
|
||||
if (haveSignal) {
|
||||
snprintf(signalHopsStr + len, sizeof(signalHopsStr) - len, " [%d %s]", node->hops_away,
|
||||
(node->hops_away == 1 ? "Hop" : "Hops"));
|
||||
} else {
|
||||
snprintf(signalHopsStr, sizeof(signalHopsStr), "[%d %s]", node->hops_away, (node->hops_away == 1 ? "Hop" : "Hops"));
|
||||
}
|
||||
}
|
||||
if (signalHopsStr[0] && line < 5) {
|
||||
display->drawString(x, yPositions[line++], signalHopsStr);
|
||||
}
|
||||
|
||||
// 3. Heard (last seen, skip if node never seen)
|
||||
char seenStr[20] = "";
|
||||
uint32_t seconds = sinceLastSeen(node);
|
||||
if (seconds != 0 && seconds != UINT32_MAX) {
|
||||
uint32_t minutes = seconds / 60, hours = minutes / 60, days = hours / 24;
|
||||
snprintf(seenStr, sizeof(seenStr), (days > 365 ? " Heard: ?" : " Heard: %d%c ago"),
|
||||
(days ? days
|
||||
: hours ? hours
|
||||
: minutes),
|
||||
(days ? 'd'
|
||||
: hours ? 'h'
|
||||
: 'm'));
|
||||
}
|
||||
if (seenStr[0] && line < 5) {
|
||||
display->drawString(x, yPositions[line++], seenStr);
|
||||
}
|
||||
|
||||
// 4. Uptime (only show if metric is present)
|
||||
char uptimeStr[32] = "";
|
||||
if (node->has_device_metrics && node->device_metrics.has_uptime_seconds) {
|
||||
uint32_t uptime = node->device_metrics.uptime_seconds;
|
||||
uint32_t days = uptime / 86400;
|
||||
uint32_t hours = (uptime % 86400) / 3600;
|
||||
uint32_t mins = (uptime % 3600) / 60;
|
||||
|
||||
if (days > 0) {
|
||||
snprintf(uptimeStr, sizeof(uptimeStr), " Uptime: %dd %dh", days, hours);
|
||||
} else if (hours > 0) {
|
||||
snprintf(uptimeStr, sizeof(uptimeStr), " Uptime: %dh %dm", hours, mins);
|
||||
} else {
|
||||
snprintf(uptimeStr, sizeof(uptimeStr), " Uptime: %dm", mins);
|
||||
}
|
||||
}
|
||||
if (uptimeStr[0] && line < 5) {
|
||||
display->drawString(x, yPositions[line++], uptimeStr);
|
||||
}
|
||||
|
||||
// 5. Distance (only if both nodes have GPS position)
|
||||
meshtastic_NodeInfoLite *ourNode = nodeDB->getMeshNode(nodeDB->getNodeNum());
|
||||
char distStr[24] = "";
|
||||
bool haveDistance = false;
|
||||
|
||||
if (nodeDB->hasValidPosition(ourNode) && nodeDB->hasValidPosition(node)) {
|
||||
double lat1 = ourNode->position.latitude_i * 1e-7;
|
||||
double lon1 = ourNode->position.longitude_i * 1e-7;
|
||||
double lat2 = node->position.latitude_i * 1e-7;
|
||||
double lon2 = node->position.longitude_i * 1e-7;
|
||||
|
||||
double earthRadiusKm = 6371.0;
|
||||
double dLat = (lat2 - lat1) * DEG_TO_RAD;
|
||||
double dLon = (lon2 - lon1) * DEG_TO_RAD;
|
||||
|
||||
double a =
|
||||
sin(dLat / 2) * sin(dLat / 2) + cos(lat1 * DEG_TO_RAD) * cos(lat2 * DEG_TO_RAD) * sin(dLon / 2) * sin(dLon / 2);
|
||||
double c = 2 * atan2(sqrt(a), sqrt(1 - a));
|
||||
double distanceKm = earthRadiusKm * c;
|
||||
|
||||
// Format distance appropriately
|
||||
if (distanceKm < 1.0) {
|
||||
double miles = distanceKm * 0.621371;
|
||||
if (miles < 0.1) {
|
||||
int feet = (int)(miles * 5280);
|
||||
if (feet > 0 && feet < 1000) {
|
||||
snprintf(distStr, sizeof(distStr), " Distance: %dft", feet);
|
||||
haveDistance = true;
|
||||
} else if (feet >= 1000) {
|
||||
snprintf(distStr, sizeof(distStr), " Distance: ¼mi");
|
||||
haveDistance = true;
|
||||
}
|
||||
} else {
|
||||
int roundedMiles = (int)(miles + 0.5);
|
||||
if (roundedMiles > 0 && roundedMiles < 1000) {
|
||||
snprintf(distStr, sizeof(distStr), " Distance: %dmi", roundedMiles);
|
||||
haveDistance = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int km = (int)(distanceKm + 0.5);
|
||||
if (km > 0 && km < 1000) {
|
||||
snprintf(distStr, sizeof(distStr), " Distance: %dkm", km);
|
||||
haveDistance = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Only display if we actually have a value!
|
||||
if (haveDistance && distStr[0] && line < 5) {
|
||||
display->drawString(x, yPositions[line++], distStr);
|
||||
}
|
||||
|
||||
// Compass rendering for different screen orientations
|
||||
if (SCREEN_WIDTH > SCREEN_HEIGHT) {
|
||||
// Landscape: side-aligned compass
|
||||
bool showCompass = false;
|
||||
if (ourNode && (nodeDB->hasValidPosition(ourNode) || screen->hasHeading()) && nodeDB->hasValidPosition(node)) {
|
||||
showCompass = true;
|
||||
}
|
||||
if (showCompass) {
|
||||
const int16_t topY = compactFirstLine;
|
||||
const int16_t bottomY = SCREEN_HEIGHT - (FONT_HEIGHT_SMALL - 1);
|
||||
const int16_t usableHeight = bottomY - topY - 5;
|
||||
int16_t compassRadius = usableHeight / 2;
|
||||
if (compassRadius < 8)
|
||||
compassRadius = 8;
|
||||
const int16_t compassDiam = compassRadius * 2;
|
||||
const int16_t compassX = x + SCREEN_WIDTH - compassRadius - 8;
|
||||
const int16_t compassY = topY + (usableHeight / 2) + ((FONT_HEIGHT_SMALL - 1) / 2) + 2;
|
||||
|
||||
const auto &op = ourNode->position;
|
||||
float myHeading = screen->hasHeading() ? screen->getHeading() * PI / 180
|
||||
: screen->estimatedHeading(DegD(op.latitude_i), DegD(op.longitude_i));
|
||||
CompassRenderer::drawCompassNorth(display, compassX, compassY, myHeading);
|
||||
|
||||
const auto &p = node->position;
|
||||
float bearing = GeoCoord::bearing(DegD(op.latitude_i), DegD(op.longitude_i), DegD(p.latitude_i), DegD(p.longitude_i));
|
||||
if (!config.display.compass_north_top)
|
||||
bearing -= myHeading;
|
||||
CompassRenderer::drawNodeHeading(display, compassX, compassY, compassDiam, bearing);
|
||||
|
||||
display->drawCircle(compassX, compassY, compassRadius);
|
||||
}
|
||||
} else {
|
||||
// Portrait: bottom-centered compass
|
||||
bool showCompass = false;
|
||||
if (ourNode && (nodeDB->hasValidPosition(ourNode) || screen->hasHeading()) && nodeDB->hasValidPosition(node)) {
|
||||
showCompass = true;
|
||||
}
|
||||
if (showCompass) {
|
||||
int yBelowContent = (line > 0 && line <= 5) ? (yPositions[line - 1] + FONT_HEIGHT_SMALL + 2) : moreCompactFirstLine;
|
||||
|
||||
const int margin = 4;
|
||||
#if defined(USE_EINK)
|
||||
const int iconSize = (SCREEN_WIDTH > 128) ? 16 : 8;
|
||||
const int navBarHeight = iconSize + 6;
|
||||
#else
|
||||
const int navBarHeight = 0;
|
||||
#endif
|
||||
int availableHeight = SCREEN_HEIGHT - yBelowContent - navBarHeight - margin;
|
||||
|
||||
if (availableHeight < FONT_HEIGHT_SMALL * 2)
|
||||
return;
|
||||
|
||||
int compassRadius = availableHeight / 2;
|
||||
if (compassRadius < 8)
|
||||
compassRadius = 8;
|
||||
if (compassRadius * 2 > SCREEN_WIDTH - 16)
|
||||
compassRadius = (SCREEN_WIDTH - 16) / 2;
|
||||
|
||||
int compassX = x + SCREEN_WIDTH / 2;
|
||||
int compassY = yBelowContent + availableHeight / 2;
|
||||
|
||||
const auto &op = ourNode->position;
|
||||
float myHeading = screen->hasHeading() ? screen->getHeading() * PI / 180
|
||||
: screen->estimatedHeading(DegD(op.latitude_i), DegD(op.longitude_i));
|
||||
CompassRenderer::drawCompassNorth(display, compassX, compassY, myHeading);
|
||||
|
||||
const auto &p = node->position;
|
||||
float bearing = GeoCoord::bearing(DegD(op.latitude_i), DegD(op.longitude_i), DegD(p.latitude_i), DegD(p.longitude_i));
|
||||
if (!config.display.compass_north_top)
|
||||
bearing -= myHeading;
|
||||
CompassRenderer::drawNodeHeading(display, compassX, compassY, compassRadius * 2, bearing);
|
||||
|
||||
display->drawCircle(compassX, compassY, compassRadius);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Draw a series of fields in a column, wrapping to multiple columns if needed
|
||||
void drawColumns(OLEDDisplay *display, int16_t x, int16_t y, const char **fields)
|
||||
{
|
||||
// The coordinates define the left starting point of the text
|
||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
|
||||
const char **f = fields;
|
||||
int xo = x, yo = y;
|
||||
while (*f) {
|
||||
display->drawString(xo, yo, *f);
|
||||
if ((display->getColor() == BLACK) && config.display.heading_bold)
|
||||
display->drawString(xo + 1, yo, *f);
|
||||
|
||||
display->setColor(WHITE);
|
||||
yo += FONT_HEIGHT_SMALL;
|
||||
if (yo > SCREEN_HEIGHT - FONT_HEIGHT_SMALL) {
|
||||
xo += SCREEN_WIDTH / 2;
|
||||
yo = 0;
|
||||
}
|
||||
f++;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace NodeListRenderer
|
||||
} // namespace graphics
|
||||
71
src/graphics/draw/NodeListRenderer.h
Normal file
71
src/graphics/draw/NodeListRenderer.h
Normal file
@@ -0,0 +1,71 @@
|
||||
#pragma once
|
||||
|
||||
#include "graphics/Screen.h"
|
||||
#include "mesh/generated/meshtastic/mesh.pb.h"
|
||||
#include <OLEDDisplay.h>
|
||||
#include <OLEDDisplayUi.h>
|
||||
|
||||
namespace graphics
|
||||
{
|
||||
|
||||
/// Forward declarations
|
||||
class Screen;
|
||||
|
||||
/**
|
||||
* @brief Node list and entry rendering functions
|
||||
*
|
||||
* Contains all functions related to drawing node lists and individual node entries
|
||||
* including last heard, hop signal, distance, and compass views.
|
||||
*/
|
||||
namespace NodeListRenderer
|
||||
{
|
||||
// Entry renderer function types
|
||||
typedef void (*EntryRenderer)(OLEDDisplay *, meshtastic_NodeInfoLite *, int16_t, int16_t, int);
|
||||
typedef void (*NodeExtrasRenderer)(OLEDDisplay *, meshtastic_NodeInfoLite *, int16_t, int16_t, int, float, double, double);
|
||||
|
||||
// Node entry structure
|
||||
struct NodeEntry {
|
||||
meshtastic_NodeInfoLite *node;
|
||||
uint32_t sortValue;
|
||||
};
|
||||
|
||||
// Node list mode enumeration
|
||||
enum NodeListMode { MODE_LAST_HEARD = 0, MODE_HOP_SIGNAL = 1, MODE_DISTANCE = 2, MODE_COUNT = 3 };
|
||||
|
||||
// Main node list screen function
|
||||
void drawNodeListScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y, const char *title,
|
||||
EntryRenderer renderer, NodeExtrasRenderer extras = nullptr, float heading = 0, double lat = 0,
|
||||
double lon = 0);
|
||||
|
||||
// Entry renderers
|
||||
void drawEntryLastHeard(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int16_t x, int16_t y, int columnWidth);
|
||||
void drawEntryHopSignal(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int16_t x, int16_t y, int columnWidth);
|
||||
void drawNodeDistance(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int16_t x, int16_t y, int columnWidth);
|
||||
void drawEntryDynamic(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int16_t x, int16_t y, int columnWidth);
|
||||
void drawEntryCompass(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int16_t x, int16_t y, int columnWidth);
|
||||
|
||||
// Extras renderers
|
||||
void drawCompassArrow(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int16_t x, int16_t y, int columnWidth, float myHeading,
|
||||
double userLat, double userLon);
|
||||
|
||||
// Screen frame functions
|
||||
void drawLastHeardScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||
void drawHopSignalScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||
void drawDistanceScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||
void drawDynamicNodeListScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||
void drawNodeListWithCompasses(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||
void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||
|
||||
// Utility functions
|
||||
const char *getCurrentModeTitle(int screenWidth);
|
||||
void retrieveAndSortNodes(std::vector<NodeEntry> &nodeList);
|
||||
const char *getSafeNodeName(meshtastic_NodeInfoLite *node);
|
||||
uint32_t sinceLastSeen(meshtastic_NodeInfoLite *node);
|
||||
void drawColumns(OLEDDisplay *display, int16_t x, int16_t y, const char **fields);
|
||||
|
||||
// Bitmap drawing function
|
||||
void drawScaledXBitmap16x16(int x, int y, int width, int height, const uint8_t *bitmapXBM, OLEDDisplay *display);
|
||||
|
||||
} // namespace NodeListRenderer
|
||||
|
||||
} // 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