Compare commits
427 Commits
meshtastic
...
v2.5.7.f77
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f77c87dca8 | ||
|
|
198b62f3fc | ||
|
|
3e5f129fce | ||
|
|
ad214ea42a | ||
|
|
25b557cf46 | ||
|
|
7fd1c334d3 | ||
|
|
696bcc60af | ||
|
|
af0db8a29f | ||
|
|
ea20bb1836 | ||
|
|
420ab89f8d | ||
|
|
1212969ff7 | ||
|
|
e49e584ae1 | ||
|
|
89c1e041e1 | ||
|
|
655e58f424 | ||
|
|
0ec1684718 | ||
|
|
05e4a639a1 | ||
|
|
fb9f361052 | ||
|
|
37448205b5 | ||
|
|
015f7335b0 | ||
|
|
48d8b85a3b | ||
|
|
363fd8ab98 | ||
|
|
323e7503ea | ||
|
|
4e4431560e | ||
|
|
a8c216f4f8 | ||
|
|
9d0729c83f | ||
|
|
3c89716074 | ||
|
|
ec96256bcd | ||
|
|
1f2d972e18 | ||
|
|
cc87002a8a | ||
|
|
8ab772221d | ||
|
|
d55c08d5cd | ||
|
|
e8f287a36f | ||
|
|
b769799410 | ||
|
|
f5f9fd54a1 | ||
|
|
f82585d9b0 | ||
|
|
1b04d41b9a | ||
|
|
3b21856a76 | ||
|
|
519ca9c0aa | ||
|
|
23a52ee625 | ||
|
|
7ff4bafe22 | ||
|
|
149620f071 | ||
|
|
0cbade989e | ||
|
|
411834afba | ||
|
|
1096973828 | ||
|
|
dc9aa6aff7 | ||
|
|
ad8747d914 | ||
|
|
ddd4a45bc3 | ||
|
|
4f8f96ab29 | ||
|
|
ee5091fee5 | ||
|
|
876993f095 | ||
|
|
a05b009379 | ||
|
|
5db4918413 | ||
|
|
a0dd7b43d5 | ||
|
|
b1f045cab8 | ||
|
|
2e5399dbe4 | ||
|
|
d005b1e49c | ||
|
|
9d9258a59b | ||
|
|
37f294d0a6 | ||
|
|
411aedaf5d | ||
|
|
1c54388bb8 | ||
|
|
94ecbad904 | ||
|
|
53f189fff4 | ||
|
|
93d874b013 | ||
|
|
234a56446b | ||
|
|
830281803f | ||
|
|
bb9f003c24 | ||
|
|
001a845ac3 | ||
|
|
7febb41727 | ||
|
|
ad031dd69f | ||
|
|
ebc3a66d10 | ||
|
|
553e572eb5 | ||
|
|
01df3ff477 | ||
|
|
a3a97d3025 | ||
|
|
0952d1b252 | ||
|
|
8a370c5381 | ||
|
|
a6f96cb9b4 | ||
|
|
d650001caa | ||
|
|
0c90a2274f | ||
|
|
dac433ed2f | ||
|
|
8acc9ccf5f | ||
|
|
243421b2a5 | ||
|
|
6d6ed55ed7 | ||
|
|
783466f116 | ||
|
|
55049ed547 | ||
|
|
e182ae75c2 | ||
|
|
7e946d15ca | ||
|
|
c3b9d493b6 | ||
|
|
4db0c75c8e | ||
|
|
e7cfadacd8 | ||
|
|
673fe294f3 | ||
|
|
236374491b | ||
|
|
d6f26c682d | ||
|
|
befc2ece6f | ||
|
|
b2b60eccdb | ||
|
|
07d4e6f5be | ||
|
|
0a93261c06 | ||
|
|
00f15459ec | ||
|
|
b8044c4983 | ||
|
|
18f12584ab | ||
|
|
e1e7bbc420 | ||
|
|
5f974d2961 | ||
|
|
cae2e43dc6 | ||
|
|
0d175a918c | ||
|
|
3440c640c3 | ||
|
|
b769d9f854 | ||
|
|
8d288d5a3c | ||
|
|
dc55d7dd98 | ||
|
|
553514e3b7 | ||
|
|
1dace9a508 | ||
|
|
dd587419c7 | ||
|
|
bce7d73cc6 | ||
|
|
810a79668c | ||
|
|
51ee6c11ea | ||
|
|
cb06ab10da | ||
|
|
199566a996 | ||
|
|
5fcad1d8c5 | ||
|
|
a5bcf48240 | ||
|
|
8ad89ba724 | ||
|
|
fd6e8613c6 | ||
|
|
b529099f90 | ||
|
|
3896009e55 | ||
|
|
6f506cead5 | ||
|
|
3492c9aa99 | ||
|
|
19f45d282f | ||
|
|
d73cbf14d5 | ||
|
|
d41d4c930e | ||
|
|
403e5c304e | ||
|
|
dcb2707d94 | ||
|
|
2e935fd943 | ||
|
|
88af23319c | ||
|
|
42a3301188 | ||
|
|
57b8b55fc5 | ||
|
|
d0440f3cac | ||
|
|
ef2035a60c | ||
|
|
fa29386eb7 | ||
|
|
7e0665a5cd | ||
|
|
233962104c | ||
|
|
a70d5ee9d8 | ||
|
|
a542d41ac7 | ||
|
|
9513c68544 | ||
|
|
448afb8345 | ||
|
|
22ecbcb046 | ||
|
|
7963ca6171 | ||
|
|
6a355616c7 | ||
|
|
ec23189407 | ||
|
|
479b0856b4 | ||
|
|
7289f36600 | ||
|
|
ef1f0cb074 | ||
|
|
1e8d089c4e | ||
|
|
06dab4fa13 | ||
|
|
12efedec42 | ||
|
|
e530ceb566 | ||
|
|
da346159f7 | ||
|
|
c650e7d273 | ||
|
|
f3213a5b2f | ||
|
|
1dc0cc0d05 | ||
|
|
f28f5e07b7 | ||
|
|
62c306a14b | ||
|
|
5a2c58197b | ||
|
|
cc101f9cd2 | ||
|
|
016e1005df | ||
|
|
6e1aa52723 | ||
|
|
5ff265c196 | ||
|
|
1f08401070 | ||
|
|
d1d6bfe693 | ||
|
|
a39280e9df | ||
|
|
48fa9f2242 | ||
|
|
7f59cb54ef | ||
|
|
36a66df923 | ||
|
|
8efc15f4d9 | ||
|
|
884e3f2e35 | ||
|
|
0e0811eccd | ||
|
|
fd1b68513a | ||
|
|
2798946176 | ||
|
|
4ee1ae429b | ||
|
|
482361b252 | ||
|
|
cb1cf055b1 | ||
|
|
6c2e60d415 | ||
|
|
ef223b1195 | ||
|
|
ae14ca7870 | ||
|
|
747046d335 | ||
|
|
e02a7d1c68 | ||
|
|
bdb998c763 | ||
|
|
c35d780236 | ||
|
|
39febad630 | ||
|
|
40932ea06c | ||
|
|
f37b88b55e | ||
|
|
743fc2e812 | ||
|
|
30356dcd97 | ||
|
|
5f6d9c3e27 | ||
|
|
4794cdb120 | ||
|
|
a32233bb92 | ||
|
|
fff2e435b5 | ||
|
|
8f84a96b69 | ||
|
|
11c17ec78c | ||
|
|
b4bdf604f5 | ||
|
|
833d7f65bc | ||
|
|
9bebad2dbe | ||
|
|
14019f2afa | ||
|
|
12481b568a | ||
|
|
3072b2a444 | ||
|
|
5c77e29d66 | ||
|
|
118809fbfc | ||
|
|
baf9cf5a59 | ||
|
|
51e4b364b0 | ||
|
|
581686c7b7 | ||
|
|
3a2fa118a2 | ||
|
|
ac5edf867c | ||
|
|
d4e8452c60 | ||
|
|
4128d75ad4 | ||
|
|
ed4527cfa5 | ||
|
|
26112ba001 | ||
|
|
9dd769586f | ||
|
|
6e1616375e | ||
|
|
a7c379961a | ||
|
|
02d9d8b76c | ||
|
|
d1138d51e5 | ||
|
|
31e952c72e | ||
|
|
9d7938f570 | ||
|
|
9456c42fc0 | ||
|
|
40b3dbaa70 | ||
|
|
1129c92974 | ||
|
|
1293c5cdd4 | ||
|
|
bebd2bb9e0 | ||
|
|
f73aa8aa82 | ||
|
|
e6e05dda1e | ||
|
|
c50df710ba | ||
|
|
65104d5d8c | ||
|
|
881f133021 | ||
|
|
10c51d8a05 | ||
|
|
453b3a59b2 | ||
|
|
67fd4b64af | ||
|
|
1d0013918b | ||
|
|
cac640ea97 | ||
|
|
e7569838c7 | ||
|
|
64b2bf5f93 | ||
|
|
d6a008500a | ||
|
|
a9d636c025 | ||
|
|
292027f40f | ||
|
|
3c126212d5 | ||
|
|
9710ac79d3 | ||
|
|
f2801a660b | ||
|
|
4d269501dd | ||
|
|
752192b09a | ||
|
|
f8f9329529 | ||
|
|
c3e53d916d | ||
|
|
c679932248 | ||
|
|
5488c8f579 | ||
|
|
6c488fe816 | ||
|
|
771cb52616 | ||
|
|
10869ea10a | ||
|
|
e4d0e38f37 | ||
|
|
d7badcc9cb | ||
|
|
4fbf666cd9 | ||
|
|
adb094ebc9 | ||
|
|
b709d47832 | ||
|
|
01d42d4728 | ||
|
|
ce480ae626 | ||
|
|
139686d639 | ||
|
|
4fde1ca2a8 | ||
|
|
c72612d826 | ||
|
|
682133501a | ||
|
|
b4c09ace23 | ||
|
|
c39d270f40 | ||
|
|
428a567078 | ||
|
|
0ad1f776ae | ||
|
|
e78c706999 | ||
|
|
c442cd7267 | ||
|
|
9cbabb0468 | ||
|
|
9a7a4d3814 | ||
|
|
fa1cc59841 | ||
|
|
d4dc4dec76 | ||
|
|
be01c18c74 | ||
|
|
e8829b8f52 | ||
|
|
1afd61698b | ||
|
|
3ff9398b92 | ||
|
|
76900555e8 | ||
|
|
1487ca2a30 | ||
|
|
f960164c0e | ||
|
|
11598beb16 | ||
|
|
1f8aa1efc7 | ||
|
|
18aac0ba25 | ||
|
|
2e24d244be | ||
|
|
7db98ca1da | ||
|
|
9f8d86cb25 | ||
|
|
2ff0af55b1 | ||
|
|
51af747508 | ||
|
|
893bbe09d1 | ||
|
|
d21087f639 | ||
|
|
01203eb854 | ||
|
|
2072ebd196 | ||
|
|
202699239f | ||
|
|
906b0233d2 | ||
|
|
d584031d10 | ||
|
|
f324ab7de7 | ||
|
|
54f56438da | ||
|
|
e6c7c80b3f | ||
|
|
c053c7d9ae | ||
|
|
953beb56b1 | ||
|
|
acd044fdea | ||
|
|
de706523f5 | ||
|
|
52cef05c70 | ||
|
|
6490cadd35 | ||
|
|
8e5928276b | ||
|
|
5dcaceccdd | ||
|
|
f1cf2bf413 | ||
|
|
3882841283 | ||
|
|
74e6470439 | ||
|
|
dca711ac24 | ||
|
|
7368cb99dc | ||
|
|
ec848bab52 | ||
|
|
ed13105aec | ||
|
|
c2272ce5a1 | ||
|
|
0664c09f9d | ||
|
|
ba31a7c753 | ||
|
|
1bca8de042 | ||
|
|
6ffdc9875b | ||
|
|
b84cf55659 | ||
|
|
85d722232e | ||
|
|
921d92c649 | ||
|
|
82f1be33aa | ||
|
|
0f3450ad44 | ||
|
|
114df8cb1b | ||
|
|
d3a293a0d8 | ||
|
|
91b4199f9d | ||
|
|
6473cf0b69 | ||
|
|
84e197574b | ||
|
|
5c4c0965af | ||
|
|
7289b295e8 | ||
|
|
7c32ab3023 | ||
|
|
2bc036f9eb | ||
|
|
cc89e85e71 | ||
|
|
da45cb8557 | ||
|
|
2ebfcea94e | ||
|
|
deada41cee | ||
|
|
777bcf691a | ||
|
|
35e1c401e2 | ||
|
|
19c57e8ec6 | ||
|
|
db4a793aa9 | ||
|
|
c6196b2260 | ||
|
|
3eebdcefa4 | ||
|
|
4289cb089b | ||
|
|
2d52803dbd | ||
|
|
c78302a2ee | ||
|
|
923458bc18 | ||
|
|
50fb4ab22a | ||
|
|
f5016763fd | ||
|
|
2a6921292e | ||
|
|
a47570d65a | ||
|
|
db4dc88d6f | ||
|
|
be306cc384 | ||
|
|
a967dd52f3 | ||
|
|
11378325e0 | ||
|
|
4b5bcf52d2 | ||
|
|
5ba418b2cd | ||
|
|
bc753e6903 | ||
|
|
34a543ec74 | ||
|
|
06cd9abd81 | ||
|
|
af30485611 | ||
|
|
cd6bd1e9a3 | ||
|
|
b025eeb13c | ||
|
|
21eb54e58a | ||
|
|
6f1db6fc63 | ||
|
|
a5118787b3 | ||
|
|
39c90dd581 | ||
|
|
33e6f7f6e0 | ||
|
|
97fd189f43 | ||
|
|
1e665d5181 | ||
|
|
b3343303a9 | ||
|
|
f37276d5fc | ||
|
|
905194c604 | ||
|
|
ea6f6c3668 | ||
|
|
51b22630b4 | ||
|
|
5d831ef461 | ||
|
|
4e8672cce4 | ||
|
|
41a769aa06 | ||
|
|
8d57b6164a | ||
|
|
dc3eba9100 | ||
|
|
ff8baa1c85 | ||
|
|
3a10a27851 | ||
|
|
8893529653 | ||
|
|
1ab5bf4355 | ||
|
|
ae791ca7e1 | ||
|
|
35cfe4318a | ||
|
|
b59bd6fee9 | ||
|
|
8b911f14cf | ||
|
|
d36c69396b | ||
|
|
b39aca8d11 | ||
|
|
6c327d960d | ||
|
|
9527874815 | ||
|
|
cd480846e9 | ||
|
|
3d72fbb19e | ||
|
|
9f3a1c1214 | ||
|
|
625254cf90 | ||
|
|
c4c85777d0 | ||
|
|
ca8d2204ba | ||
|
|
a388e78842 | ||
|
|
35cdc81d45 | ||
|
|
910b6b7512 | ||
|
|
371c3e05bf | ||
|
|
f37df4d6bf | ||
|
|
ba9a3cd719 | ||
|
|
9ac0e26d42 | ||
|
|
1ba4f6e222 | ||
|
|
e8e9826adc | ||
|
|
6724f1f7ea | ||
|
|
013021941e | ||
|
|
4e850296b6 | ||
|
|
0c42f79038 | ||
|
|
4fc3782ea3 | ||
|
|
9ac4a0114f | ||
|
|
9188786581 | ||
|
|
f1602ee3f6 | ||
|
|
5537f98dd6 | ||
|
|
4ed12bf21d | ||
|
|
106dab23db | ||
|
|
2f9dcee954 | ||
|
|
68d6ff8c24 | ||
|
|
dc8cc122a6 | ||
|
|
e9d55de3cb | ||
|
|
dacb452d47 | ||
|
|
b2e2f1dba3 | ||
|
|
b2417f651a | ||
|
|
d02ba45109 | ||
|
|
c6bffd7d7f | ||
|
|
a5b79528b3 | ||
|
|
6217e97c41 |
@@ -13,16 +13,13 @@
|
|||||||
},
|
},
|
||||||
"customizations": {
|
"customizations": {
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"extensions": [
|
"extensions": ["ms-vscode.cpptools", "platformio.platformio-ide"]
|
||||||
"ms-vscode.cpptools",
|
|
||||||
"platformio.platformio-ide",
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
"forwardPorts": [ 4403 ],
|
"forwardPorts": [4403],
|
||||||
|
|
||||||
// Run commands to prepare the container for use
|
// Run commands to prepare the container for use
|
||||||
"postCreateCommand": ".devcontainer/setup.sh",
|
"postCreateCommand": ".devcontainer/setup.sh"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
git submodule update --init
|
git submodule update --init
|
||||||
|
|||||||
14
.github/ISSUE_TEMPLATE/Bug Report.yml
vendored
@@ -49,10 +49,24 @@ body:
|
|||||||
- Heltec V3
|
- Heltec V3
|
||||||
- Heltec Wireless Paper
|
- Heltec Wireless Paper
|
||||||
- Heltec Wireless Tracker
|
- Heltec Wireless Tracker
|
||||||
|
- Heltec Mesh Node T114
|
||||||
|
- Heltec Vision Master E213
|
||||||
|
- Heltec Vision Master E290
|
||||||
|
- Heltec Vision Master T190
|
||||||
|
- Nano G1
|
||||||
|
- Nano G1 Explorer
|
||||||
|
- Nano G2 Ultra
|
||||||
- Raspberry Pi Pico (W)
|
- Raspberry Pi Pico (W)
|
||||||
- Relay v1
|
- Relay v1
|
||||||
- Relay v2
|
- Relay v2
|
||||||
- Seeed Wio Tracker 1110
|
- Seeed Wio Tracker 1110
|
||||||
|
- Seeed Card Tracker T1000-E
|
||||||
|
- Station G1
|
||||||
|
- Station G2
|
||||||
|
- unPhone
|
||||||
|
- CanaryOne
|
||||||
|
- Chatter
|
||||||
|
- Linux Native
|
||||||
- DIY
|
- DIY
|
||||||
- Other
|
- Other
|
||||||
validations:
|
validations:
|
||||||
|
|||||||
1
.github/ISSUE_TEMPLATE/feature.yml
vendored
@@ -18,6 +18,7 @@ body:
|
|||||||
- ESP32
|
- ESP32
|
||||||
- RP2040
|
- RP2040
|
||||||
- Linux Native
|
- Linux Native
|
||||||
|
- Cross-Platform
|
||||||
- other
|
- other
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|||||||
94
.github/actions/build-variant/action.yml
vendored
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
name: Setup Build Variant Composite Action
|
||||||
|
description: Variant build actions for Meshtastic Platform IO steps
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
board:
|
||||||
|
description: The board to build for
|
||||||
|
required: true
|
||||||
|
github_token:
|
||||||
|
description: GitHub token
|
||||||
|
required: true
|
||||||
|
build-script-path:
|
||||||
|
description: Path to the build script
|
||||||
|
required: true
|
||||||
|
remove-debug-flags:
|
||||||
|
description: A space separated list of files to remove debug flags from
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
ota-firmware-source:
|
||||||
|
description: The OTA firmware file to pull
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
ota-firmware-target:
|
||||||
|
description: The target path to store the OTA firmware file
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
artifact-paths:
|
||||||
|
description: A newline separated list of paths to store as artifacts
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
include-web-ui:
|
||||||
|
description: Include the web UI in the build
|
||||||
|
required: false
|
||||||
|
default: "false"
|
||||||
|
arch:
|
||||||
|
description: Processor arch name
|
||||||
|
required: true
|
||||||
|
default: "esp32"
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Build base
|
||||||
|
id: base
|
||||||
|
uses: ./.github/actions/setup-base
|
||||||
|
|
||||||
|
- name: Pull web ui
|
||||||
|
if: inputs.include-web-ui == 'true'
|
||||||
|
uses: dsaltares/fetch-gh-release-asset@master
|
||||||
|
with:
|
||||||
|
repo: meshtastic/web
|
||||||
|
file: build.tar
|
||||||
|
target: build.tar
|
||||||
|
token: ${{ inputs.github_token }}
|
||||||
|
|
||||||
|
- name: Unpack web ui
|
||||||
|
if: inputs.include-web-ui == 'true'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
tar -xf build.tar -C data/static
|
||||||
|
rm build.tar
|
||||||
|
|
||||||
|
- name: Remove debug flags for release
|
||||||
|
shell: bash
|
||||||
|
if: inputs.remove-debug-flags != ''
|
||||||
|
run: |
|
||||||
|
for INI_FILE in ${{ inputs.remove-debug-flags }}; do
|
||||||
|
sed -i '/DDEBUG_HEAP/d' ${INI_FILE}
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Build ${{ inputs.board }}
|
||||||
|
shell: bash
|
||||||
|
run: ${{ inputs.build-script-path }} ${{ inputs.board }}
|
||||||
|
|
||||||
|
- name: Pull OTA Firmware
|
||||||
|
if: inputs.ota-firmware-source != '' && inputs.ota-firmware-target != ''
|
||||||
|
uses: dsaltares/fetch-gh-release-asset@master
|
||||||
|
with:
|
||||||
|
repo: meshtastic/firmware-ota
|
||||||
|
file: ${{ inputs.ota-firmware-source }}
|
||||||
|
target: ${{ inputs.ota-firmware-target }}
|
||||||
|
token: ${{ inputs.github_token }}
|
||||||
|
|
||||||
|
- name: Get release version string
|
||||||
|
shell: bash
|
||||||
|
run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
|
||||||
|
id: version
|
||||||
|
|
||||||
|
- name: Store binaries as an artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: firmware-${{ inputs.arch }}-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip
|
||||||
|
overwrite: true
|
||||||
|
path: |
|
||||||
|
${{ inputs.artifact-paths }}
|
||||||
5
.github/actions/setup-base/action.yml
vendored
@@ -11,6 +11,11 @@ runs:
|
|||||||
ref: ${{github.event.pull_request.head.ref}}
|
ref: ${{github.event.pull_request.head.ref}}
|
||||||
repository: ${{github.event.pull_request.head.repo.full_name}}
|
repository: ${{github.event.pull_request.head.repo.full_name}}
|
||||||
|
|
||||||
|
- name: Uncomment build epoch
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
sed -i 's/#-DBUILD_EPOCH=$UNIX_TIME/-DBUILD_EPOCH=$UNIX_TIME/' platformio.ini
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
26
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: docker
|
||||||
|
directory: devcontainer
|
||||||
|
schedule:
|
||||||
|
interval: daily
|
||||||
|
time: "05:00" # trunk-ignore(yamllint/quoted-strings): required by dependabot syntax check
|
||||||
|
timezone: US/Pacific
|
||||||
|
- package-ecosystem: docker
|
||||||
|
directory: /
|
||||||
|
schedule:
|
||||||
|
interval: daily
|
||||||
|
time: "05:00" # trunk-ignore(yamllint/quoted-strings): required by dependabot syntax check
|
||||||
|
timezone: US/Pacific
|
||||||
|
- package-ecosystem: gitsubmodule
|
||||||
|
directory: /
|
||||||
|
schedule:
|
||||||
|
interval: daily
|
||||||
|
time: "05:00" # trunk-ignore(yamllint/quoted-strings): required by dependabot syntax check
|
||||||
|
timezone: US/Pacific
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
directory: /.github/workflows
|
||||||
|
schedule:
|
||||||
|
interval: daily
|
||||||
|
time: "05:00" # trunk-ignore(yamllint/quoted-strings): required by dependabot syntax check
|
||||||
|
timezone: US/Pacific
|
||||||
59
.github/workflows/build_esp32.yml
vendored
@@ -12,52 +12,23 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build base
|
|
||||||
id: base
|
|
||||||
uses: ./.github/actions/setup-base
|
|
||||||
|
|
||||||
- name: Pull web ui
|
|
||||||
uses: dsaltares/fetch-gh-release-asset@master
|
|
||||||
with:
|
|
||||||
repo: meshtastic/web
|
|
||||||
file: build.tar
|
|
||||||
target: build.tar
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Unpack web ui
|
|
||||||
run: |
|
|
||||||
tar -xf build.tar -C data/static
|
|
||||||
rm build.tar
|
|
||||||
|
|
||||||
- name: Remove debug flags for release
|
|
||||||
if: ${{ github.event_name == 'workflow_dispatch' }}
|
|
||||||
run: |
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32.ini
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s2.ini
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s3.ini
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32c3.ini
|
|
||||||
|
|
||||||
- name: Build ESP32
|
- name: Build ESP32
|
||||||
run: bin/build-esp32.sh ${{ inputs.board }}
|
id: build
|
||||||
|
uses: ./.github/actions/build-variant
|
||||||
- name: Pull OTA Firmware
|
|
||||||
uses: dsaltares/fetch-gh-release-asset@master
|
|
||||||
with:
|
with:
|
||||||
repo: meshtastic/firmware-ota
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: firmware.bin
|
board: ${{ inputs.board }}
|
||||||
target: release/bleota.bin
|
remove-debug-flags: >-
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
./arch/esp32/esp32.ini
|
||||||
|
./arch/esp32/esp32s2.ini
|
||||||
- name: Get release version string
|
./arch/esp32/esp32s3.ini
|
||||||
shell: bash
|
./arch/esp32/esp32c3.ini
|
||||||
run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
|
build-script-path: bin/build-esp32.sh
|
||||||
id: version
|
ota-firmware-source: firmware.bin
|
||||||
|
ota-firmware-target: release/bleota.bin
|
||||||
- name: Store binaries as an artifact
|
artifact-paths: |
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip
|
|
||||||
overwrite: true
|
|
||||||
path: |
|
|
||||||
release/*.bin
|
release/*.bin
|
||||||
release/*.elf
|
release/*.elf
|
||||||
|
include-web-ui: true
|
||||||
|
arch: esp32
|
||||||
|
|||||||
58
.github/workflows/build_esp32_c3.yml
vendored
@@ -14,50 +14,22 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build base
|
|
||||||
id: base
|
|
||||||
uses: ./.github/actions/setup-base
|
|
||||||
|
|
||||||
- name: Pull web ui
|
- name: Build ESP32-C3
|
||||||
uses: dsaltares/fetch-gh-release-asset@master
|
id: build
|
||||||
|
uses: ./.github/actions/build-variant
|
||||||
with:
|
with:
|
||||||
repo: meshtastic/web
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: build.tar
|
board: ${{ inputs.board }}
|
||||||
target: build.tar
|
remove-debug-flags: >-
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
./arch/esp32/esp32.ini
|
||||||
|
./arch/esp32/esp32s2.ini
|
||||||
- name: Unpack web ui
|
./arch/esp32/esp32s3.ini
|
||||||
run: |
|
./arch/esp32/esp32c3.ini
|
||||||
tar -xf build.tar -C data/static
|
build-script-path: bin/build-esp32.sh
|
||||||
rm build.tar
|
ota-firmware-source: firmware-c3.bin
|
||||||
- name: Remove debug flags for release
|
ota-firmware-target: release/bleota-c3.bin
|
||||||
if: ${{ github.event_name == 'workflow_dispatch' }}
|
artifact-paths: |
|
||||||
run: |
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32.ini
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s2.ini
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s3.ini
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32c3.ini
|
|
||||||
- name: Build ESP32
|
|
||||||
run: bin/build-esp32.sh ${{ inputs.board }}
|
|
||||||
|
|
||||||
- name: Pull OTA Firmware
|
|
||||||
uses: dsaltares/fetch-gh-release-asset@master
|
|
||||||
with:
|
|
||||||
repo: meshtastic/firmware-ota
|
|
||||||
file: firmware-c3.bin
|
|
||||||
target: release/bleota-c3.bin
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Get release version string
|
|
||||||
shell: bash
|
|
||||||
run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
|
|
||||||
id: version
|
|
||||||
|
|
||||||
- name: Store binaries as an artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip
|
|
||||||
overwrite: true
|
|
||||||
path: |
|
|
||||||
release/*.bin
|
release/*.bin
|
||||||
release/*.elf
|
release/*.elf
|
||||||
|
arch: esp32c3
|
||||||
|
|||||||
36
.github/workflows/build_esp32_c6.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
name: Build ESP32-C6
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
board:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-esp32-c6:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Build ESP32-C6
|
||||||
|
id: build
|
||||||
|
uses: ./.github/actions/build-variant
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
board: ${{ inputs.board }}
|
||||||
|
remove-debug-flags: >-
|
||||||
|
./arch/esp32/esp32.ini
|
||||||
|
./arch/esp32/esp32s2.ini
|
||||||
|
./arch/esp32/esp32s3.ini
|
||||||
|
./arch/esp32/esp32c3.ini
|
||||||
|
./arch/esp32/esp32c6.ini
|
||||||
|
build-script-path: bin/build-esp32.sh
|
||||||
|
ota-firmware-source: firmware-c3.bin
|
||||||
|
ota-firmware-target: release/bleota-c3.bin
|
||||||
|
artifact-paths: |
|
||||||
|
release/*.bin
|
||||||
|
release/*.elf
|
||||||
|
arch: esp32c6
|
||||||
59
.github/workflows/build_esp32_s3.yml
vendored
@@ -12,50 +12,23 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build base
|
|
||||||
id: base
|
|
||||||
uses: ./.github/actions/setup-base
|
|
||||||
|
|
||||||
- name: Pull web ui
|
- name: Build ESP32-S3
|
||||||
uses: dsaltares/fetch-gh-release-asset@master
|
id: build
|
||||||
|
uses: ./.github/actions/build-variant
|
||||||
with:
|
with:
|
||||||
repo: meshtastic/web
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: build.tar
|
board: ${{ inputs.board }}
|
||||||
target: build.tar
|
remove-debug-flags: >-
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
./arch/esp32/esp32.ini
|
||||||
|
./arch/esp32/esp32s2.ini
|
||||||
- name: Unpack web ui
|
./arch/esp32/esp32s3.ini
|
||||||
run: |
|
./arch/esp32/esp32c3.ini
|
||||||
tar -xf build.tar -C data/static
|
build-script-path: bin/build-esp32.sh
|
||||||
rm build.tar
|
ota-firmware-source: firmware-s3.bin
|
||||||
- name: Remove debug flags for release
|
ota-firmware-target: release/bleota-s3.bin
|
||||||
if: ${{ github.event_name == 'workflow_dispatch' }}
|
artifact-paths: |
|
||||||
run: |
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32.ini
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s2.ini
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s3.ini
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32c3.ini
|
|
||||||
- name: Build ESP32
|
|
||||||
run: bin/build-esp32.sh ${{ inputs.board }}
|
|
||||||
|
|
||||||
- name: Pull OTA Firmware
|
|
||||||
uses: dsaltares/fetch-gh-release-asset@master
|
|
||||||
with:
|
|
||||||
repo: meshtastic/firmware-ota
|
|
||||||
file: firmware-s3.bin
|
|
||||||
target: release/bleota-s3.bin
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Get release version string
|
|
||||||
shell: bash
|
|
||||||
run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
|
|
||||||
id: version
|
|
||||||
|
|
||||||
- name: Store binaries as an artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip
|
|
||||||
overwrite: true
|
|
||||||
path: |
|
|
||||||
release/*.bin
|
release/*.bin
|
||||||
release/*.elf
|
release/*.elf
|
||||||
|
include-web-ui: true
|
||||||
|
arch: esp32s3
|
||||||
|
|||||||
4
.github/workflows/build_native.yml
vendored
@@ -67,7 +67,7 @@ jobs:
|
|||||||
- name: Docker build and push tagged versions
|
- name: Docker build and push tagged versions
|
||||||
if: ${{ github.event_name == 'workflow_dispatch' }}
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||||
continue-on-error: true # FIXME: Failing docker login auth
|
continue-on-error: true # FIXME: Failing docker login auth
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
@@ -77,7 +77,7 @@ jobs:
|
|||||||
- name: Docker build and push
|
- name: Docker build and push
|
||||||
if: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request_target' && github.event_name != 'pull_request' }}
|
if: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request_target' && github.event_name != 'pull_request' }}
|
||||||
continue-on-error: true # FIXME: Failing docker login auth
|
continue-on-error: true # FIXME: Failing docker login auth
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
|
|||||||
21
.github/workflows/build_nrf52.yml
vendored
@@ -12,24 +12,17 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build base
|
|
||||||
id: base
|
|
||||||
uses: ./.github/actions/setup-base
|
|
||||||
|
|
||||||
- name: Build NRF52
|
- name: Build NRF52
|
||||||
run: bin/build-nrf52.sh ${{ inputs.board }}
|
id: build
|
||||||
|
uses: ./.github/actions/build-variant
|
||||||
- name: Get release version string
|
|
||||||
run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
|
|
||||||
id: version
|
|
||||||
|
|
||||||
- name: Store binaries as an artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
with:
|
||||||
name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
overwrite: true
|
board: ${{ inputs.board }}
|
||||||
path: |
|
build-script-path: bin/build-nrf52.sh
|
||||||
|
artifact-paths: |
|
||||||
release/*.hex
|
release/*.hex
|
||||||
release/*.uf2
|
release/*.uf2
|
||||||
release/*.elf
|
release/*.elf
|
||||||
release/*.zip
|
release/*.zip
|
||||||
|
arch: nrf52840
|
||||||
|
|||||||
21
.github/workflows/build_rpi2040.yml
vendored
@@ -12,22 +12,15 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build base
|
|
||||||
id: base
|
|
||||||
uses: ./.github/actions/setup-base
|
|
||||||
|
|
||||||
- name: Build Raspberry Pi 2040
|
- name: Build Raspberry Pi 2040
|
||||||
run: ./bin/build-rpi2040.sh ${{ inputs.board }}
|
id: build
|
||||||
|
uses: ./.github/actions/build-variant
|
||||||
- name: Get release version string
|
|
||||||
run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
|
|
||||||
id: version
|
|
||||||
|
|
||||||
- name: Store binaries as an artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
with:
|
||||||
name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
overwrite: true
|
board: ${{ inputs.board }}
|
||||||
path: |
|
build-script-path: bin/build-rpi2040.sh
|
||||||
|
artifact-paths: |
|
||||||
release/*.uf2
|
release/*.uf2
|
||||||
release/*.elf
|
release/*.elf
|
||||||
|
arch: rp2040
|
||||||
|
|||||||
24
.github/workflows/build_stm32.yml
vendored
@@ -12,22 +12,16 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build base
|
|
||||||
id: base
|
|
||||||
uses: ./.github/actions/setup-base
|
|
||||||
|
|
||||||
- name: Build STM32
|
- name: Build STM32WL
|
||||||
run: bin/build-stm32.sh ${{ inputs.board }}
|
id: build
|
||||||
|
uses: ./.github/actions/build-variant
|
||||||
- name: Get release version string
|
|
||||||
run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
|
|
||||||
id: version
|
|
||||||
|
|
||||||
- name: Store binaries as an artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
with:
|
||||||
name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
overwrite: true
|
board: ${{ inputs.board }}
|
||||||
path: |
|
build-script-path: bin/build-stm32.sh
|
||||||
|
artifact-paths: |
|
||||||
release/*.hex
|
release/*.hex
|
||||||
release/*.bin
|
release/*.bin
|
||||||
|
release/*.elf
|
||||||
|
arch: stm32
|
||||||
|
|||||||
35
.github/workflows/generate-userprefs.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
name: Generate UsersPrefs JSON manifest
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- userPrefs.h
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
generate-userprefs:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Clang
|
||||||
|
run: sudo apt-get install -y clang
|
||||||
|
|
||||||
|
- name: Install trunk
|
||||||
|
run: curl https://get.trunk.io -fsSL | bash
|
||||||
|
|
||||||
|
- name: Generate userPrefs.jsom
|
||||||
|
run: python3 ./bin/build-userprefs-json.py
|
||||||
|
|
||||||
|
- name: Trunk format json
|
||||||
|
run: trunk format userPrefs.json
|
||||||
|
|
||||||
|
- name: Commit userPrefs.json
|
||||||
|
run: |
|
||||||
|
git config --global user.email "actions@github.com"
|
||||||
|
git config --global user.name "GitHub Actions"
|
||||||
|
git add userPrefs.json
|
||||||
|
git commit -m "Update userPrefs.json"
|
||||||
|
git push
|
||||||
210
.github/workflows/main_matrix.yml
vendored
@@ -1,7 +1,7 @@
|
|||||||
name: CI
|
name: CI
|
||||||
#concurrency:
|
concurrency:
|
||||||
# group: ${{ github.ref }}
|
group: ci-${{ github.head_ref || github.run_id }}
|
||||||
# cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
|
cancel-in-progress: true
|
||||||
on:
|
on:
|
||||||
# # Triggers the workflow on push but only for the master branch
|
# # Triggers the workflow on push but only for the master branch
|
||||||
push:
|
push:
|
||||||
@@ -24,7 +24,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
arch: [esp32, esp32s3, esp32c3, nrf52840, rp2040, stm32, check]
|
arch: [esp32, esp32s3, esp32c3, esp32c6, nrf52840, rp2040, stm32, check]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- id: checkout
|
- id: checkout
|
||||||
@@ -32,13 +32,18 @@ jobs:
|
|||||||
name: Checkout base
|
name: Checkout base
|
||||||
- id: jsonStep
|
- id: jsonStep
|
||||||
run: |
|
run: |
|
||||||
TARGETS=$(./bin/generate_ci_matrix.py ${{matrix.arch}})
|
if [[ "${{ github.head_ref }}" == "" ]]; then
|
||||||
echo "$TARGETS"
|
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 }} Head: ${{ github.head_ref }} Ref: ${{ github.ref }} Targets: $TARGETS"
|
||||||
echo "${{matrix.arch}}=$(jq -cn --argjson environments "$TARGETS" '{board: $environments}')" >> $GITHUB_OUTPUT
|
echo "${{matrix.arch}}=$(jq -cn --argjson environments "$TARGETS" '{board: $environments}')" >> $GITHUB_OUTPUT
|
||||||
outputs:
|
outputs:
|
||||||
esp32: ${{ steps.jsonStep.outputs.esp32 }}
|
esp32: ${{ steps.jsonStep.outputs.esp32 }}
|
||||||
esp32s3: ${{ steps.jsonStep.outputs.esp32s3 }}
|
esp32s3: ${{ steps.jsonStep.outputs.esp32s3 }}
|
||||||
esp32c3: ${{ steps.jsonStep.outputs.esp32c3 }}
|
esp32c3: ${{ steps.jsonStep.outputs.esp32c3 }}
|
||||||
|
esp32c6: ${{ steps.jsonStep.outputs.esp32c6 }}
|
||||||
nrf52840: ${{ steps.jsonStep.outputs.nrf52840 }}
|
nrf52840: ${{ steps.jsonStep.outputs.nrf52840 }}
|
||||||
rp2040: ${{ steps.jsonStep.outputs.rp2040 }}
|
rp2040: ${{ steps.jsonStep.outputs.rp2040 }}
|
||||||
stm32: ${{ steps.jsonStep.outputs.stm32 }}
|
stm32: ${{ steps.jsonStep.outputs.stm32 }}
|
||||||
@@ -51,6 +56,7 @@ jobs:
|
|||||||
matrix: ${{ fromJson(needs.setup.outputs.check) }}
|
matrix: ${{ fromJson(needs.setup.outputs.check) }}
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.event_name != 'workflow_dispatch' }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build base
|
- name: Build base
|
||||||
@@ -86,6 +92,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
board: ${{ matrix.board }}
|
board: ${{ matrix.board }}
|
||||||
|
|
||||||
|
build-esp32-c6:
|
||||||
|
needs: setup
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix: ${{ fromJson(needs.setup.outputs.esp32c6) }}
|
||||||
|
uses: ./.github/workflows/build_esp32_c6.yml
|
||||||
|
with:
|
||||||
|
board: ${{ matrix.board }}
|
||||||
|
|
||||||
build-nrf52:
|
build-nrf52:
|
||||||
needs: setup
|
needs: setup
|
||||||
strategy:
|
strategy:
|
||||||
@@ -124,6 +139,7 @@ jobs:
|
|||||||
|
|
||||||
after-checks:
|
after-checks:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.event_name != 'workflow_dispatch' }}
|
||||||
needs: [check]
|
needs: [check]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
@@ -136,18 +152,20 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
arch: [esp32, esp32s3, esp32c3, esp32c6, nrf52840, rp2040, stm32]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
[
|
[
|
||||||
build-esp32,
|
build-esp32,
|
||||||
build-esp32-s3,
|
build-esp32-s3,
|
||||||
build-esp32-c3,
|
build-esp32-c3,
|
||||||
|
build-esp32-c6,
|
||||||
build-nrf52,
|
build-nrf52,
|
||||||
build-rpi2040,
|
build-rpi2040,
|
||||||
build-stm32,
|
build-stm32,
|
||||||
package-raspbian,
|
|
||||||
package-raspbian-armv7l,
|
|
||||||
package-native,
|
|
||||||
]
|
]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
@@ -159,6 +177,7 @@ jobs:
|
|||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: ./
|
path: ./
|
||||||
|
pattern: firmware-${{matrix.arch}}-*
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
|
|
||||||
- name: Display structure of downloaded files
|
- name: Display structure of downloaded files
|
||||||
@@ -169,12 +188,12 @@ jobs:
|
|||||||
id: version
|
id: version
|
||||||
|
|
||||||
- name: Move files up
|
- name: Move files up
|
||||||
run: mv -b -t ./ ./release/meshtasticd_linux_* ./bin/config-dist.yaml ./bin/device-*.sh ./bin/device-*.bat
|
run: mv -b -t ./ ./bin/device-*.sh ./bin/device-*.bat
|
||||||
|
|
||||||
- name: Repackage in single firmware zip
|
- name: Repackage in single firmware zip
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: firmware-${{ steps.version.outputs.version }}
|
name: firmware-${{matrix.arch}}-${{ steps.version.outputs.version }}
|
||||||
overwrite: true
|
overwrite: true
|
||||||
path: |
|
path: |
|
||||||
./firmware-*.bin
|
./firmware-*.bin
|
||||||
@@ -183,16 +202,14 @@ jobs:
|
|||||||
./firmware-*-ota.zip
|
./firmware-*-ota.zip
|
||||||
./device-*.sh
|
./device-*.sh
|
||||||
./device-*.bat
|
./device-*.bat
|
||||||
./meshtasticd_linux_*
|
|
||||||
./config-dist.yaml
|
|
||||||
./littlefs-*.bin
|
./littlefs-*.bin
|
||||||
./bleota*bin
|
./bleota*bin
|
||||||
./Meshtastic_nRF52_factory_erase*.uf2
|
./Meshtastic_nRF52_factory_erase*.uf2
|
||||||
retention-days: 90
|
retention-days: 30
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: firmware-${{ steps.version.outputs.version }}
|
name: firmware-${{matrix.arch}}-${{ steps.version.outputs.version }}
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
path: ./output
|
path: ./output
|
||||||
|
|
||||||
@@ -206,32 +223,34 @@ jobs:
|
|||||||
chmod +x ./output/device-update.sh
|
chmod +x ./output/device-update.sh
|
||||||
|
|
||||||
- name: Zip firmware
|
- name: Zip firmware
|
||||||
run: zip -j -9 -r ./firmware-${{ steps.version.outputs.version }}.zip ./output
|
run: zip -j -9 -r ./firmware-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip ./output
|
||||||
|
|
||||||
- name: Repackage in single elfs zip
|
- name: Repackage in single elfs zip
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: debug-elfs-${{ steps.version.outputs.version }}.zip
|
name: debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip
|
||||||
overwrite: true
|
overwrite: true
|
||||||
path: ./*.elf
|
path: ./*.elf
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
|
|
||||||
- name: Create request artifacts
|
- uses: scruplelesswizard/comment-artifact@main
|
||||||
continue-on-error: true # FIXME: Why are we getting 502, but things still work?
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
if: ${{ github.event_name == 'pull_request_target' || github.event_name == 'pull_request' }}
|
|
||||||
uses: gavv/pull-request-artifacts@v2.1.0
|
|
||||||
with:
|
with:
|
||||||
commit: ${{ (github.event.pull_request_target || github.event.pull_request).head.sha }}
|
name: firmware-${{matrix.arch}}-${{ steps.version.outputs.version }}
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
description: "Download firmware-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip. This artifact will be available for 90 days from creation"
|
||||||
artifacts-token: ${{ secrets.ARTIFACTS_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
artifacts-repo: meshtastic/artifacts
|
|
||||||
artifacts-branch: device
|
|
||||||
artifacts: ./firmware-${{ steps.version.outputs.version }}.zip
|
|
||||||
|
|
||||||
release-artifacts:
|
release-artifacts:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event_name == 'workflow_dispatch' }}
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||||
needs: [gather-artifacts, after-checks]
|
outputs:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
needs: [
|
||||||
|
gather-artifacts,
|
||||||
|
package-raspbian,
|
||||||
|
package-raspbian-armv7l,
|
||||||
|
package-native,
|
||||||
|
]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -245,42 +264,6 @@ jobs:
|
|||||||
run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
|
run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
|
||||||
id: version
|
id: version
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: firmware-${{ steps.version.outputs.version }}
|
|
||||||
merge-multiple: true
|
|
||||||
path: ./output
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
pattern: meshtasticd_${{ steps.version.outputs.version }}_*.deb
|
|
||||||
merge-multiple: true
|
|
||||||
path: ./output
|
|
||||||
|
|
||||||
- name: Display structure of downloaded files
|
|
||||||
run: ls -R
|
|
||||||
|
|
||||||
- name: Device scripts permissions
|
|
||||||
run: |
|
|
||||||
chmod +x ./output/device-install.sh
|
|
||||||
chmod +x ./output/device-update.sh
|
|
||||||
|
|
||||||
- name: Zip firmware
|
|
||||||
run: zip -j -9 -r ./firmware-${{ steps.version.outputs.version }}.zip ./output -x *.deb
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: debug-elfs-${{ steps.version.outputs.version }}.zip
|
|
||||||
merge-multiple: true
|
|
||||||
path: ./elfs
|
|
||||||
|
|
||||||
- name: Zip Elfs
|
|
||||||
run: zip -j -9 -r ./debug-elfs-${{ steps.version.outputs.version }}.zip ./elfs
|
|
||||||
|
|
||||||
# For diagnostics
|
|
||||||
- name: Show artifacts
|
|
||||||
run: ls -lR
|
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
uses: actions/create-release@v1
|
uses: actions/create-release@v1
|
||||||
id: create_release
|
id: create_release
|
||||||
@@ -294,25 +277,16 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
|
||||||
- name: Add bins to release
|
- name: Download deb files
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/download-artifact@v4
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
pattern: meshtasticd_${{ steps.version.outputs.version }}_*.deb
|
||||||
asset_path: ./firmware-${{ steps.version.outputs.version }}.zip
|
merge-multiple: true
|
||||||
asset_name: firmware-${{ steps.version.outputs.version }}.zip
|
path: ./output
|
||||||
asset_content_type: application/zip
|
|
||||||
|
|
||||||
- name: Add debug elfs to release
|
# For diagnostics
|
||||||
uses: actions/upload-release-asset@v1
|
- name: Display structure of downloaded files
|
||||||
env:
|
run: ls -lR
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: ./debug-elfs-${{ steps.version.outputs.version }}.zip
|
|
||||||
asset_name: debug-elfs-${{ steps.version.outputs.version }}.zip
|
|
||||||
asset_content_type: application/zip
|
|
||||||
|
|
||||||
- name: Add raspbian aarch64 .deb
|
- name: Add raspbian aarch64 .deb
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
@@ -349,7 +323,79 @@ jobs:
|
|||||||
bin/bump_version.py
|
bin/bump_version.py
|
||||||
|
|
||||||
- name: Create version.properties pull request
|
- name: Create version.properties pull request
|
||||||
uses: peter-evans/create-pull-request@v6
|
uses: peter-evans/create-pull-request@v7
|
||||||
with:
|
with:
|
||||||
|
title: Bump version.properties
|
||||||
add-paths: |
|
add-paths: |
|
||||||
version.properties
|
version.properties
|
||||||
|
|
||||||
|
release-firmware:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
arch: [esp32, esp32s3, esp32c3, esp32c6, nrf52840, rp2040, stm32]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||||
|
needs: [release-artifacts]
|
||||||
|
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 "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
|
||||||
|
id: version
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
pattern: firmware-${{matrix.arch}}-${{ steps.version.outputs.version }}
|
||||||
|
merge-multiple: true
|
||||||
|
path: ./output
|
||||||
|
|
||||||
|
- name: Display structure of downloaded files
|
||||||
|
run: ls -lR
|
||||||
|
|
||||||
|
- name: Device scripts permissions
|
||||||
|
run: |
|
||||||
|
chmod +x ./output/device-install.sh
|
||||||
|
chmod +x ./output/device-update.sh
|
||||||
|
|
||||||
|
- name: Zip firmware
|
||||||
|
run: zip -j -9 -r ./firmware-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip ./output
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip
|
||||||
|
merge-multiple: true
|
||||||
|
path: ./elfs
|
||||||
|
|
||||||
|
- name: Zip firmware
|
||||||
|
run: zip -j -9 -r ./debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip ./elfs
|
||||||
|
|
||||||
|
# For diagnostics
|
||||||
|
- name: Display structure of downloaded files
|
||||||
|
run: ls -lR
|
||||||
|
|
||||||
|
- name: Add bins to release
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{needs.release-artifacts.outputs.upload_url}}
|
||||||
|
asset_path: ./firmware-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip
|
||||||
|
asset_name: firmware-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip
|
||||||
|
asset_content_type: application/zip
|
||||||
|
|
||||||
|
- name: Add debug elfs to release
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{needs.release-artifacts.outputs.upload_url}}
|
||||||
|
asset_path: ./debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip
|
||||||
|
asset_name: debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip
|
||||||
|
asset_content_type: application/zip
|
||||||
|
|||||||
2
.github/workflows/package_amd64.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
uses: ./.github/workflows/build_native.yml
|
uses: ./.github/workflows/build_native.yml
|
||||||
|
|
||||||
package-native:
|
package-native:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
needs: build-native
|
needs: build-native
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
|
|||||||
2
.github/workflows/package_raspbian.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
uses: ./.github/workflows/build_raspbian.yml
|
uses: ./.github/workflows/build_raspbian.yml
|
||||||
|
|
||||||
package-raspbian:
|
package-raspbian:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
needs: build-raspbian
|
needs: build-raspbian
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ jobs:
|
|||||||
uses: ./.github/workflows/build_raspbian_armv7l.yml
|
uses: ./.github/workflows/build_raspbian_armv7l.yml
|
||||||
|
|
||||||
package-raspbian_armv7l:
|
package-raspbian_armv7l:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
needs: build-raspbian_armv7l
|
needs: build-raspbian_armv7l
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
|
|||||||
2
.github/workflows/sec_sast_semgrep_cron.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
|||||||
semgrep-full:
|
semgrep-full:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: returntocorp/semgrep
|
image: semgrep/semgrep
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# step 1
|
# step 1
|
||||||
|
|||||||
4
.github/workflows/sec_sast_semgrep_pull.yml
vendored
@@ -4,9 +4,9 @@ on: pull_request
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
semgrep-diff:
|
semgrep-diff:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
container:
|
container:
|
||||||
image: returntocorp/semgrep
|
image: semgrep/semgrep
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# step 1
|
# step 1
|
||||||
|
|||||||
45
.github/workflows/tests.yml
vendored
@@ -57,35 +57,50 @@ jobs:
|
|||||||
reporter: java-junit
|
reporter: java-junit
|
||||||
|
|
||||||
hardware-tests:
|
hardware-tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: test-runner
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# - uses: actions/setup-python@v5
|
||||||
|
# with:
|
||||||
|
# python-version: '3.10'
|
||||||
|
|
||||||
|
# pipx install "setuptools<72"
|
||||||
- name: Upgrade python tools
|
- name: Upgrade python tools
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
pipx install adafruit-nrfutil
|
||||||
pip install -U --no-build-isolation --no-cache-dir "setuptools<72"
|
pipx install poetry
|
||||||
pip install -U platformio adafruit-nrfutil --no-build-isolation
|
pipx install meshtastic --pip-args=--pre
|
||||||
pip install -U poetry --no-build-isolation
|
|
||||||
pip install -U meshtastic --pre --no-build-isolation
|
- name: Install PlatformIO from script
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
curl -fsSL -o get-platformio.py https://raw.githubusercontent.com/platformio/platformio-core-installer/master/get-platformio.py
|
||||||
|
python3 get-platformio.py
|
||||||
|
|
||||||
- name: Upgrade platformio
|
- name: Upgrade platformio
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
export PATH=$PATH:$HOME/.local/bin
|
||||||
pio upgrade
|
pio upgrade
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
|
||||||
- name: Setup pnpm
|
- name: Setup pnpm
|
||||||
uses: pnpm/action-setup@v2
|
uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install dependencies, setup devices and run
|
||||||
run: pnpm install
|
shell: bash
|
||||||
|
run: |
|
||||||
- name: Setup devices
|
git submodule update --init --recursive
|
||||||
run: pnpm run setup
|
cd meshtestic/
|
||||||
|
pnpm install
|
||||||
- name: Execute end to end tests on connected hardware
|
pnpm run setup
|
||||||
run: pnpm run test
|
pnpm run test
|
||||||
|
|||||||
11
.github/workflows/update_protobufs.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: "Update protobufs and regenerate classes"
|
name: Update protobufs and regenerate classes
|
||||||
on: workflow_dispatch
|
on: workflow_dispatch
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -17,17 +17,18 @@ jobs:
|
|||||||
|
|
||||||
- name: Download nanopb
|
- name: Download nanopb
|
||||||
run: |
|
run: |
|
||||||
wget https://jpa.kapsi.fi/nanopb/download/nanopb-0.4.8-linux-x86.tar.gz
|
wget https://jpa.kapsi.fi/nanopb/download/nanopb-0.4.9-linux-x86.tar.gz
|
||||||
tar xvzf nanopb-0.4.8-linux-x86.tar.gz
|
tar xvzf nanopb-0.4.9-linux-x86.tar.gz
|
||||||
mv nanopb-0.4.8-linux-x86 nanopb-0.4.8
|
mv nanopb-0.4.9-linux-x86 nanopb-0.4.9
|
||||||
|
|
||||||
- name: Re-generate protocol buffers
|
- name: Re-generate protocol buffers
|
||||||
run: |
|
run: |
|
||||||
./bin/regen-protos.sh
|
./bin/regen-protos.sh
|
||||||
|
|
||||||
- name: Create pull request
|
- name: Create pull request
|
||||||
uses: peter-evans/create-pull-request@v6
|
uses: peter-evans/create-pull-request@v7
|
||||||
with:
|
with:
|
||||||
|
title: Update protobufs and classes
|
||||||
add-paths: |
|
add-paths: |
|
||||||
protobufs
|
protobufs
|
||||||
src/mesh
|
src/mesh
|
||||||
|
|||||||
4
.gitignore
vendored
@@ -1,6 +1,4 @@
|
|||||||
.pio
|
.pio
|
||||||
main/configuration.h
|
|
||||||
main/credentials.h
|
|
||||||
|
|
||||||
# ignore vscode IDE settings files
|
# ignore vscode IDE settings files
|
||||||
.vscode/*
|
.vscode/*
|
||||||
@@ -32,4 +30,4 @@ release/
|
|||||||
.vscode/extensions.json
|
.vscode/extensions.json
|
||||||
/compile_commands.json
|
/compile_commands.json
|
||||||
src/mesh/raspihttp/certificate.pem
|
src/mesh/raspihttp/certificate.pem
|
||||||
src/mesh/raspihttp/private_key.pem
|
src/mesh/raspihttp/private_key.pem
|
||||||
|
|||||||
@@ -1,34 +1,34 @@
|
|||||||
version: 0.1
|
version: 0.1
|
||||||
cli:
|
cli:
|
||||||
version: 1.22.3
|
version: 1.22.6
|
||||||
plugins:
|
plugins:
|
||||||
sources:
|
sources:
|
||||||
- id: trunk
|
- id: trunk
|
||||||
ref: v1.6.2
|
ref: v1.6.3
|
||||||
uri: https://github.com/trunk-io/plugins
|
uri: https://github.com/trunk-io/plugins
|
||||||
lint:
|
lint:
|
||||||
enabled:
|
enabled:
|
||||||
- trufflehog@3.81.9
|
- trufflehog@3.82.6
|
||||||
- yamllint@1.35.1
|
- yamllint@1.35.1
|
||||||
- bandit@1.7.9
|
- bandit@1.7.10
|
||||||
- checkov@3.2.238
|
- checkov@3.2.256
|
||||||
- terrascan@1.19.1
|
- terrascan@1.19.1
|
||||||
- trivy@0.54.1
|
- trivy@0.55.2
|
||||||
#- trufflehog@3.63.2-rc0
|
#- trufflehog@3.63.2-rc0
|
||||||
- taplo@0.9.3
|
- taplo@0.9.3
|
||||||
- ruff@0.6.2
|
- ruff@0.6.8
|
||||||
- isort@5.13.2
|
- isort@5.13.2
|
||||||
- markdownlint@0.41.0
|
- markdownlint@0.42.0
|
||||||
- oxipng@9.1.2
|
- oxipng@9.1.2
|
||||||
- svgo@3.3.2
|
- svgo@3.3.2
|
||||||
- actionlint@1.7.1
|
- actionlint@1.7.3
|
||||||
- flake8@7.1.1
|
- flake8@7.1.1
|
||||||
- hadolint@2.12.0
|
- hadolint@2.12.0
|
||||||
- shfmt@3.6.0
|
- shfmt@3.6.0
|
||||||
- shellcheck@0.10.0
|
- shellcheck@0.10.0
|
||||||
- black@24.8.0
|
- black@24.8.0
|
||||||
- git-diff-check
|
- git-diff-check
|
||||||
- gitleaks@8.18.4
|
- gitleaks@8.20.0
|
||||||
- clang-format@16.0.3
|
- clang-format@16.0.3
|
||||||
- prettier@3.3.3
|
- prettier@3.3.3
|
||||||
ignore:
|
ignore:
|
||||||
|
|||||||
12
SECURITY.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
## Supported Versions
|
||||||
|
|
||||||
|
| Firmware Version | Supported |
|
||||||
|
| ---------------- | ------------------ |
|
||||||
|
| 2.5.x | :white_check_mark: |
|
||||||
|
| <= 2.4.x | :x: |
|
||||||
|
|
||||||
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
We support the private reporting of potential security vulnerabilities. Please go to the Security tab to file a report with a description of the potential vulnerability and reproduction scripts (preferred) or steps, and our developers will review.
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
[esp32_base]
|
[esp32_base]
|
||||||
extends = arduino_base
|
extends = arduino_base
|
||||||
custom_esp32_kind = esp32
|
custom_esp32_kind = esp32
|
||||||
platform = platformio/espressif32@6.7.0
|
platform = platformio/espressif32@6.9.0
|
||||||
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2040> -<mesh/eth/> -<mesh/raspihttp>
|
${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2xx0> -<mesh/eth/> -<mesh/raspihttp>
|
||||||
|
|
||||||
upload_speed = 921600
|
upload_speed = 921600
|
||||||
debug_init_break = tbreak setup
|
debug_init_break = tbreak setup
|
||||||
@@ -46,7 +46,7 @@ lib_deps =
|
|||||||
https://github.com/meshtastic/esp32_https_server.git#23665b3adc080a311dcbb586ed5941b5f94d6ea2
|
https://github.com/meshtastic/esp32_https_server.git#23665b3adc080a311dcbb586ed5941b5f94d6ea2
|
||||||
h2zero/NimBLE-Arduino@^1.4.2
|
h2zero/NimBLE-Arduino@^1.4.2
|
||||||
https://github.com/dbSuS/libpax.git#7bcd3fcab75037505be9b122ab2b24cc5176b587
|
https://github.com/dbSuS/libpax.git#7bcd3fcab75037505be9b122ab2b24cc5176b587
|
||||||
https://github.com/lewisxhe/XPowersLib.git#84b7373faea3118b6c37954d52f98b8a337148d6
|
lewisxhe/XPowersLib@^0.2.6
|
||||||
https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f
|
https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f
|
||||||
rweather/Crypto@^0.4.0
|
rweather/Crypto@^0.4.0
|
||||||
|
|
||||||
|
|||||||
40
arch/esp32/esp32c6.ini
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
[esp32c6_base]
|
||||||
|
extends = esp32_base
|
||||||
|
platform = https://github.com/Jason2866/platform-espressif32.git#22faa566df8c789000f8136cd8d0aca49617af55
|
||||||
|
build_flags =
|
||||||
|
${arduino_base.build_flags}
|
||||||
|
-Wall
|
||||||
|
-Wextra
|
||||||
|
-Isrc/platform/esp32
|
||||||
|
-std=c++11
|
||||||
|
-DESP_OPENSSL_SUPPRESS_LEGACY_WARNING
|
||||||
|
-DSERIAL_BUFFER_SIZE=4096
|
||||||
|
-DLIBPAX_ARDUINO
|
||||||
|
-DLIBPAX_WIFI
|
||||||
|
-DLIBPAX_BLE
|
||||||
|
-DMESHTASTIC_EXCLUDE_WEBSERVER
|
||||||
|
;-DDEBUG_HEAP
|
||||||
|
; TEMP
|
||||||
|
-DHAS_BLUETOOTH=0
|
||||||
|
-DMESHTASTIC_EXCLUDE_PAXCOUNTER
|
||||||
|
-DMESHTASTIC_EXCLUDE_BLUETOOTH
|
||||||
|
|
||||||
|
lib_deps =
|
||||||
|
${arduino_base.lib_deps}
|
||||||
|
${networking_base.lib_deps}
|
||||||
|
${environmental_base.lib_deps}
|
||||||
|
lewisxhe/XPowersLib@^0.2.6
|
||||||
|
https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f
|
||||||
|
rweather/Crypto@^0.4.0
|
||||||
|
|
||||||
|
build_src_filter =
|
||||||
|
${esp32_base.build_src_filter} -<mesh/http>
|
||||||
|
|
||||||
|
monitor_speed = 460800
|
||||||
|
monitor_filters = esp32_c3_exception_decoder
|
||||||
|
|
||||||
|
lib_ignore =
|
||||||
|
NonBlockingRTTTL
|
||||||
|
NimBLE-Arduino
|
||||||
|
libpax
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ build_flags =
|
|||||||
-DLFS_NO_ASSERT ; Disable LFS assertions , see https://github.com/meshtastic/firmware/pull/3818
|
-DLFS_NO_ASSERT ; Disable LFS assertions , see https://github.com/meshtastic/firmware/pull/3818
|
||||||
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
${arduino_base.build_src_filter} -<platform/esp32/> -<platform/stm32wl> -<nimble/> -<mesh/wifi/> -<mesh/api/> -<mesh/http/> -<modules/esp32> -<platform/rp2040> -<mesh/eth/> -<mesh/raspihttp>
|
${arduino_base.build_src_filter} -<platform/esp32/> -<platform/stm32wl> -<nimble/> -<mesh/wifi/> -<mesh/api/> -<mesh/http/> -<modules/esp32> -<platform/rp2xx0> -<mesh/eth/> -<mesh/raspihttp>
|
||||||
|
|
||||||
lib_deps=
|
lib_deps=
|
||||||
${arduino_base.lib_deps}
|
${arduino_base.lib_deps}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
; The Portduino based sim environment on top of any host OS, all hardware will be simulated
|
; The Portduino based sim environment on top of any host OS, all hardware will be simulated
|
||||||
[portduino_base]
|
[portduino_base]
|
||||||
platform = https://github.com/meshtastic/platform-native.git#ad8112adf82ce1f5b917092cf32be07a077801a0
|
platform = https://github.com/meshtastic/platform-native.git#6b3796d697481c8f6e3f4aa5c111bd9979f29e64
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
@@ -9,7 +9,7 @@ build_src_filter =
|
|||||||
-<nimble/>
|
-<nimble/>
|
||||||
-<platform/nrf52/>
|
-<platform/nrf52/>
|
||||||
-<platform/stm32wl/>
|
-<platform/stm32wl/>
|
||||||
-<platform/rp2040>
|
-<platform/rp2xx0>
|
||||||
-<mesh/wifi/>
|
-<mesh/wifi/>
|
||||||
-<mesh/http/>
|
-<mesh/http/>
|
||||||
+<mesh/raspihttp/>
|
+<mesh/raspihttp/>
|
||||||
@@ -24,7 +24,7 @@ lib_deps =
|
|||||||
${env.lib_deps}
|
${env.lib_deps}
|
||||||
${networking_base.lib_deps}
|
${networking_base.lib_deps}
|
||||||
rweather/Crypto@^0.4.0
|
rweather/Crypto@^0.4.0
|
||||||
https://github.com/lovyan03/LovyanGFX.git#5a39989aa2c9492572255b22f033843ec8900233
|
lovyan03/LovyanGFX@^1.1.16
|
||||||
|
|
||||||
build_flags =
|
build_flags =
|
||||||
${arduino_base.build_flags}
|
${arduino_base.build_flags}
|
||||||
|
|||||||
25
arch/rp2xx0/rp2040.ini
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
; Common settings for rp2040 Processor based targets
|
||||||
|
[rp2040_base]
|
||||||
|
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#v1.2.0-gcc12
|
||||||
|
extends = arduino_base
|
||||||
|
platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#4.0.3
|
||||||
|
|
||||||
|
board_build.core = earlephilhower
|
||||||
|
board_build.filesystem_size = 0.5m
|
||||||
|
build_flags =
|
||||||
|
${arduino_base.build_flags} -Wno-unused-variable -Wcast-align
|
||||||
|
-Isrc/platform/rp2xx0
|
||||||
|
-Isrc/platform/rp2xx0/hardware_rosc/include
|
||||||
|
-Isrc/platform/rp2xx0/pico_sleep/include
|
||||||
|
-D__PLAT_RP2040__
|
||||||
|
# -D _POSIX_THREADS
|
||||||
|
build_src_filter =
|
||||||
|
${arduino_base.build_src_filter} -<platform/esp32/> -<nimble/> -<modules/esp32> -<platform/nrf52/> -<platform/stm32wl> -<mesh/eth/> -<mesh/wifi/> -<mesh/http/> -<mesh/raspihttp>
|
||||||
|
|
||||||
|
lib_ignore =
|
||||||
|
BluetoothOTA
|
||||||
|
|
||||||
|
lib_deps =
|
||||||
|
${arduino_base.lib_deps}
|
||||||
|
${environmental_base.lib_deps}
|
||||||
|
rweather/Crypto
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
; Common settings for rp2040 Processor based targets
|
; Common settings for rp2040 Processor based targets
|
||||||
[rp2040_base]
|
[rp2350_base]
|
||||||
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#60d6ae81fcc73c34b1493ca9e261695e471bc0c2
|
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#9e55f6db5c56b9867c69fe473f388beea4546672
|
||||||
extends = arduino_base
|
extends = arduino_base
|
||||||
platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#3.7.2
|
platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#a6ab6e1f95bc1428d667d55ea7173c0744acc03c ; 4.0.2+
|
||||||
|
|
||||||
board_build.core = earlephilhower
|
board_build.core = earlephilhower
|
||||||
board_build.filesystem_size = 0.5m
|
board_build.filesystem_size = 0.5m
|
||||||
build_flags =
|
build_flags =
|
||||||
${arduino_base.build_flags} -Wno-unused-variable
|
${arduino_base.build_flags} -Wno-unused-variable
|
||||||
-Isrc/platform/rp2040
|
-Isrc/platform/rp2xx0
|
||||||
-D__PLAT_RP2040__
|
-D__PLAT_RP2040__
|
||||||
# -D _POSIX_THREADS
|
# -D _POSIX_THREADS
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
[stm32_base]
|
[stm32_base]
|
||||||
extends = arduino_base
|
extends = arduino_base
|
||||||
platform = ststm32
|
platform = ststm32
|
||||||
platform_packages = platformio/framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32.git#361a7fdb67e2a7104e99b4f42a802469eef8b129
|
platform_packages = platformio/framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32.git#ea74156acd823b6d14739f389e6cdc648f8ee36e
|
||||||
|
|
||||||
build_type = release
|
build_type = release
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ build_flags =
|
|||||||
-fdata-sections
|
-fdata-sections
|
||||||
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
${arduino_base.build_src_filter} -<platform/esp32/> -<nimble/> -<mesh/api/> -<mesh/wifi/> -<mesh/http/> -<modules/esp32> -<mesh/eth/> -<input> -<buzz> -<modules/RemoteHardwareModule.cpp> -<platform/nrf52> -<platform/portduino> -<platform/rp2040> -<mesh/raspihttp>
|
${arduino_base.build_src_filter} -<platform/esp32/> -<nimble/> -<mesh/api/> -<mesh/wifi/> -<mesh/http/> -<modules/esp32> -<mesh/eth/> -<input> -<buzz> -<modules/RemoteHardwareModule.cpp> -<platform/nrf52> -<platform/portduino> -<platform/rp2xx0> -<mesh/raspihttp>
|
||||||
|
|
||||||
board_upload.offset_address = 0x08000000
|
board_upload.offset_address = 0x08000000
|
||||||
upload_protocol = stlink
|
upload_protocol = stlink
|
||||||
@@ -33,5 +33,5 @@ lib_deps =
|
|||||||
https://github.com/caveman99/Crypto.git#f61ae26a53f7a2d0ba5511625b8bf8eff3a35d5e
|
https://github.com/caveman99/Crypto.git#f61ae26a53f7a2d0ba5511625b8bf8eff3a35d5e
|
||||||
|
|
||||||
lib_ignore =
|
lib_ignore =
|
||||||
https://github.com/mathertel/OneButton@~2.6.1
|
mathertel/OneButton@~2.6.1
|
||||||
Wire
|
Wire
|
||||||
48
bin/build-userprefs-json.py
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
import json
|
||||||
|
import subprocess
|
||||||
|
import re
|
||||||
|
|
||||||
|
def get_macros_from_header(header_file):
|
||||||
|
# Run clang to preprocess the header file and capture the output
|
||||||
|
result = subprocess.run(['clang', '-E', '-dM', header_file], capture_output=True, text=True)
|
||||||
|
if result.returncode != 0:
|
||||||
|
raise RuntimeError(f"Clang preprocessing failed: {result.stderr}")
|
||||||
|
|
||||||
|
# Extract macros from the output
|
||||||
|
macros = {}
|
||||||
|
macro_pattern = re.compile(r'#define\s+(\w+)\s+(.*)')
|
||||||
|
for line in result.stdout.splitlines():
|
||||||
|
match = macro_pattern.match(line)
|
||||||
|
if match and 'USERPREFS_' in line and '_USERPREFS_' not in line:
|
||||||
|
macros[match.group(1)] = match.group(2)
|
||||||
|
|
||||||
|
return macros
|
||||||
|
|
||||||
|
def write_macros_to_json(macros, output_file):
|
||||||
|
with open(output_file, 'w') as f:
|
||||||
|
json.dump(macros, f, indent=4)
|
||||||
|
|
||||||
|
def main():
|
||||||
|
header_file = 'userPrefs.h'
|
||||||
|
output_file = 'userPrefs.json'
|
||||||
|
# Uncomment all macros in the header file
|
||||||
|
with open(header_file, 'r') as file:
|
||||||
|
lines = file.readlines()
|
||||||
|
|
||||||
|
uncommented_lines = []
|
||||||
|
for line in lines:
|
||||||
|
stripped_line = line.strip().replace('/*', '').replace('*/', '')
|
||||||
|
if stripped_line.startswith('//') and 'USERPREFS_' in stripped_line:
|
||||||
|
# Replace "//"
|
||||||
|
stripped_line = stripped_line.replace('//', '')
|
||||||
|
uncommented_lines.append(stripped_line + '\n')
|
||||||
|
|
||||||
|
with open(header_file, 'w') as file:
|
||||||
|
for line in uncommented_lines:
|
||||||
|
file.write(line)
|
||||||
|
macros = get_macros_from_header(header_file)
|
||||||
|
write_macros_to_json(macros, output_file)
|
||||||
|
print(f"Macros have been written to {output_file}")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -9,6 +9,7 @@ Lora:
|
|||||||
# IRQ: 16
|
# IRQ: 16
|
||||||
# Busy: 20
|
# Busy: 20
|
||||||
# Reset: 18
|
# Reset: 18
|
||||||
|
# SX126X_ANT_SW: 6
|
||||||
|
|
||||||
# Module: sx1262 # Waveshare SX1302 LISTEN ONLY AT THIS TIME!
|
# Module: sx1262 # Waveshare SX1302 LISTEN ONLY AT THIS TIME!
|
||||||
# CS: 7
|
# CS: 7
|
||||||
@@ -153,4 +154,4 @@ Webserver:
|
|||||||
|
|
||||||
General:
|
General:
|
||||||
MaxNodes: 200
|
MaxNodes: 200
|
||||||
MaxMessageQueue: 100
|
MaxMessageQueue: 100
|
||||||
@@ -6,6 +6,7 @@ import configparser
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import random
|
||||||
|
|
||||||
rootdir = "variants/"
|
rootdir = "variants/"
|
||||||
|
|
||||||
@@ -39,5 +40,7 @@ for subdir, dirs, files in os.walk(rootdir):
|
|||||||
"check" in options
|
"check" in options
|
||||||
):
|
):
|
||||||
outlist.append(section)
|
outlist.append(section)
|
||||||
|
if ("quick" in options) & (len(outlist) > 3):
|
||||||
print(json.dumps(outlist))
|
print(json.dumps(random.sample(outlist, 3)))
|
||||||
|
else:
|
||||||
|
print(json.dumps(outlist))
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
cd protobufs && ..\nanopb-0.4.8\generator-bin\protoc.exe --experimental_allow_proto3_optional "--nanopb_out=-S.cpp -v:..\src\mesh\generated" -I=..\protobufs\ ..\protobufs\meshtastic\*.proto
|
cd protobufs && ..\nanopb-0.4.9\generator-bin\protoc.exe --experimental_allow_proto3_optional "--nanopb_out=-S.cpp -v:..\src\mesh\generated" -I=..\protobufs\ ..\protobufs\meshtastic\*.proto
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo "This script requires https://jpa.kapsi.fi/nanopb/download/ version 0.4.8 to be located in the"
|
echo "This script requires https://jpa.kapsi.fi/nanopb/download/ version 0.4.9 to be located in the"
|
||||||
echo "firmware root directory if the following step fails, you should download the correct"
|
echo "firmware root directory if the following step fails, you should download the correct"
|
||||||
echo "prebuilt binaries for your computer into nanopb-0.4.8"
|
echo "prebuilt binaries for your computer into nanopb-0.4.9"
|
||||||
|
|
||||||
# the nanopb tool seems to require that the .options file be in the current directory!
|
# the nanopb tool seems to require that the .options file be in the current directory!
|
||||||
cd protobufs
|
cd protobufs
|
||||||
../nanopb-0.4.8/generator-bin/protoc --experimental_allow_proto3_optional "--nanopb_out=-S.cpp -v:../src/mesh/generated/" -I=../protobufs meshtastic/*.proto
|
../nanopb-0.4.9/generator-bin/protoc --experimental_allow_proto3_optional "--nanopb_out=-S.cpp -v:../src/mesh/generated/" -I=../protobufs meshtastic/*.proto
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
},
|
},
|
||||||
"core": "nRF5",
|
"core": "nRF5",
|
||||||
"cpu": "cortex-m4",
|
"cpu": "cortex-m4",
|
||||||
"extra_flags": "-DARDUINO_NRF52840_PCA10056 -DNRF52840_XXAA",
|
"extra_flags": "-DHELTEC_T114 -DNRF52840_XXAA",
|
||||||
"f_cpu": "64000000L",
|
"f_cpu": "64000000L",
|
||||||
"hwids": [
|
"hwids": [
|
||||||
["0x239A", "0x4405"],
|
["0x239A", "0x4405"],
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
{
|
|
||||||
"build": {
|
|
||||||
"arduino": {
|
|
||||||
"ldscript": "nrf52840_s140_v6.ld"
|
|
||||||
},
|
|
||||||
"core": "nRF5",
|
|
||||||
"cpu": "cortex-m4",
|
|
||||||
"extra_flags": "-DARDUINO_NRF52840_LORA_RELAY_V1 -DNRF52840_XXAA",
|
|
||||||
"f_cpu": "64000000L",
|
|
||||||
"hwids": [["0x239A", "0x4404"]],
|
|
||||||
"usb_product": "LORA_RELAY",
|
|
||||||
"mcu": "nrf52840",
|
|
||||||
"variant": "lora_relay_v1",
|
|
||||||
"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": "Meshtastic Lora Relay V1 (Adafruit BSP)",
|
|
||||||
"upload": {
|
|
||||||
"maximum_ram_size": 248832,
|
|
||||||
"maximum_size": 815104,
|
|
||||||
"require_upload_port": true,
|
|
||||||
"speed": 115200,
|
|
||||||
"protocol": "jlink",
|
|
||||||
"protocols": ["jlink", "nrfjprog", "stlink"]
|
|
||||||
},
|
|
||||||
"url": "https://github.com/BigCorvus/SX1262-LoRa-BLE-Relay",
|
|
||||||
"vendor": "BigCorvus"
|
|
||||||
}
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
{
|
|
||||||
"build": {
|
|
||||||
"arduino": {
|
|
||||||
"ldscript": "nrf52840_s140_v6.ld"
|
|
||||||
},
|
|
||||||
"core": "nRF5",
|
|
||||||
"cpu": "cortex-m4",
|
|
||||||
"extra_flags": "-DARDUINO_NRF52840_LORA_RELAY_V2 -DNRF52840_XXAA",
|
|
||||||
"f_cpu": "64000000L",
|
|
||||||
"hwids": [["0x239A", "0x4406"]],
|
|
||||||
"usb_product": "LORA_RELAY",
|
|
||||||
"mcu": "nrf52840",
|
|
||||||
"variant": "lora_relay_v2",
|
|
||||||
"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": "Meshtastic Lora Relay V1 (Adafruit BSP)",
|
|
||||||
"upload": {
|
|
||||||
"maximum_ram_size": 248832,
|
|
||||||
"maximum_size": 815104,
|
|
||||||
"require_upload_port": true,
|
|
||||||
"speed": 115200,
|
|
||||||
"protocol": "jlink",
|
|
||||||
"protocols": ["jlink", "nrfjprog", "stlink"]
|
|
||||||
},
|
|
||||||
"url": "https://github.com/BigCorvus/SX1262-LoRa-BLE-Relay",
|
|
||||||
"vendor": "BigCorvus"
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
{
|
|
||||||
"build": {
|
|
||||||
"arduino": {
|
|
||||||
"ldscript": "nrf52832_s132_v6.ld"
|
|
||||||
},
|
|
||||||
"core": "nRF5",
|
|
||||||
"cpu": "cortex-m4",
|
|
||||||
"extra_flags": "-DNRF52832_XXAA -DNRF52",
|
|
||||||
"f_cpu": "64000000L",
|
|
||||||
"mcu": "nrf52832",
|
|
||||||
"variant": "lora_isp4520",
|
|
||||||
"bsp": {
|
|
||||||
"name": "adafruit"
|
|
||||||
},
|
|
||||||
"softdevice": {
|
|
||||||
"sd_flags": "-DS132",
|
|
||||||
"sd_name": "s132",
|
|
||||||
"sd_version": "6.1.1",
|
|
||||||
"sd_fwid": "0x00B7"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"connectivity": ["bluetooth"],
|
|
||||||
"debug": {
|
|
||||||
"jlink_device": "nRF52832_xxAA",
|
|
||||||
"svd_path": "nrf52.svd",
|
|
||||||
"openocd_target": "nrf52840-mdk-rs"
|
|
||||||
},
|
|
||||||
"frameworks": ["arduino"],
|
|
||||||
"name": "lora ISP4520",
|
|
||||||
"upload": {
|
|
||||||
"maximum_ram_size": 65536,
|
|
||||||
"maximum_size": 524288,
|
|
||||||
"require_upload_port": true,
|
|
||||||
"speed": 115200,
|
|
||||||
"protocol": "nrfutil",
|
|
||||||
"protocols": ["jlink", "nrfjprog", "nrfutil", "stlink"]
|
|
||||||
},
|
|
||||||
"url": "",
|
|
||||||
"vendor": "PsiSoft"
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
},
|
},
|
||||||
"core": "nRF5",
|
"core": "nRF5",
|
||||||
"cpu": "cortex-m4",
|
"cpu": "cortex-m4",
|
||||||
"extra_flags": "-DARDUINO_WIO_WM1110 -DNRF52840_XXAA",
|
"extra_flags": "-DME25LS01_4Y10TD -DNRF52840_XXAA",
|
||||||
"f_cpu": "64000000L",
|
"f_cpu": "64000000L",
|
||||||
"hwids": [
|
"hwids": [
|
||||||
["0x239A", "0x8029"],
|
["0x239A", "0x8029"],
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
},
|
},
|
||||||
"core": "nRF5",
|
"core": "nRF5",
|
||||||
"cpu": "cortex-m4",
|
"cpu": "cortex-m4",
|
||||||
"extra_flags": "-DARDUINO_WIO_WM1110 -DNRF52840_XXAA",
|
"extra_flags": "-DMS24SF1 -DNRF52840_XXAA",
|
||||||
"f_cpu": "64000000L",
|
"f_cpu": "64000000L",
|
||||||
"hwids": [
|
"hwids": [
|
||||||
["0x239A", "0x8029"],
|
["0x239A", "0x8029"],
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
},
|
},
|
||||||
"core": "nRF5",
|
"core": "nRF5",
|
||||||
"cpu": "cortex-m4",
|
"cpu": "cortex-m4",
|
||||||
"extra_flags": "-DARDUINO_NRF52840_FEATHER -DNRF52840_XXAA",
|
"extra_flags": "-DNORDIC_PCA10059 -DNRF52840_XXAA",
|
||||||
"f_cpu": "64000000L",
|
"f_cpu": "64000000L",
|
||||||
"hwids": [
|
"hwids": [
|
||||||
["0x239A", "0x8029"],
|
["0x239A", "0x8029"],
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
{
|
|
||||||
"build": {
|
|
||||||
"arduino": {
|
|
||||||
"ldscript": "nrf52840_s113_v7.ld"
|
|
||||||
},
|
|
||||||
"core": "nRF5",
|
|
||||||
"cpu": "cortex-m4",
|
|
||||||
"extra_flags": "-DARDUINO_NRF52840_PCA10056 -DNRF52840_XXAA",
|
|
||||||
"f_cpu": "64000000L",
|
|
||||||
"hwids": [["0x239A", "0x4404"]],
|
|
||||||
"usb_product": "nrf52840dk",
|
|
||||||
"mcu": "nrf52840",
|
|
||||||
"variant": "pca10056-rc-clock",
|
|
||||||
"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": "A modified NRF52840-DK devboard (Adafruit BSP)",
|
|
||||||
"upload": {
|
|
||||||
"maximum_ram_size": 248832,
|
|
||||||
"maximum_size": 815104,
|
|
||||||
"require_upload_port": true,
|
|
||||||
"speed": 115200,
|
|
||||||
"protocol": "jlink",
|
|
||||||
"protocols": ["jlink", "nrfjprog", "stlink"]
|
|
||||||
},
|
|
||||||
"url": "https://meshtastic.org/",
|
|
||||||
"vendor": "Nordic Semi"
|
|
||||||
}
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
{
|
|
||||||
"build": {
|
|
||||||
"arduino": {
|
|
||||||
"ldscript": "nrf52840_s140_v6.ld"
|
|
||||||
},
|
|
||||||
"core": "nRF5",
|
|
||||||
"cpu": "cortex-m4",
|
|
||||||
"extra_flags": "-DARDUINO_NRF52840_PPR -DNRF52840_XXAA",
|
|
||||||
"f_cpu": "64000000L",
|
|
||||||
"hwids": [["0x239A", "0x4403"]],
|
|
||||||
"usb_product": "PPR",
|
|
||||||
"mcu": "nrf52840",
|
|
||||||
"variant": "ppr",
|
|
||||||
"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": "Meshtastic PPR (Adafruit BSP)",
|
|
||||||
"upload": {
|
|
||||||
"maximum_ram_size": 248832,
|
|
||||||
"maximum_size": 815104,
|
|
||||||
"require_upload_port": true,
|
|
||||||
"speed": 115200,
|
|
||||||
"protocol": "jlink",
|
|
||||||
"protocols": ["jlink", "nrfjprog", "stlink"]
|
|
||||||
},
|
|
||||||
"url": "https://meshtastic.org/",
|
|
||||||
"vendor": "Othernet"
|
|
||||||
}
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
{
|
|
||||||
"build": {
|
|
||||||
"arduino": {
|
|
||||||
"ldscript": "nrf52833_s113_v7.ld"
|
|
||||||
},
|
|
||||||
"core": "nRF5",
|
|
||||||
"cpu": "cortex-m4",
|
|
||||||
"extra_flags": "-DARDUINO_NRF52833_PPR -DNRF52833_XXAA",
|
|
||||||
"f_cpu": "64000000L",
|
|
||||||
"hwids": [["0x239A", "0x4406"]],
|
|
||||||
"usb_product": "PPR",
|
|
||||||
"mcu": "nrf52833",
|
|
||||||
"variant": "ppr",
|
|
||||||
"variants_dir": "variants",
|
|
||||||
"bsp": {
|
|
||||||
"name": "adafruit"
|
|
||||||
},
|
|
||||||
"softdevice": {
|
|
||||||
"sd_flags": "-DS113",
|
|
||||||
"sd_name": "s113",
|
|
||||||
"sd_version": "7.2.0",
|
|
||||||
"sd_fwid": "0x00b6"
|
|
||||||
},
|
|
||||||
"bootloader": {
|
|
||||||
"settings_addr": "0xFF000"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"connectivity": ["bluetooth"],
|
|
||||||
"debug": {
|
|
||||||
"jlink_device": "nRF52833_xxAA",
|
|
||||||
"onboard_tools": ["jlink"],
|
|
||||||
"svd_path": "nrf52833.svd",
|
|
||||||
"openocd_target": "nrf52840-mdk-rs"
|
|
||||||
},
|
|
||||||
"frameworks": ["arduino"],
|
|
||||||
"name": "Meshtastic PPR1 (Adafruit BSP)",
|
|
||||||
"upload": {
|
|
||||||
"maximum_ram_size": 248832,
|
|
||||||
"maximum_size": 815104,
|
|
||||||
"require_upload_port": true,
|
|
||||||
"speed": 115200,
|
|
||||||
"protocol": "jlink",
|
|
||||||
"protocols": ["jlink", "nrfjprog", "stlink"]
|
|
||||||
},
|
|
||||||
"url": "https://meshtastic.org/",
|
|
||||||
"vendor": "Othernet"
|
|
||||||
}
|
|
||||||
42
boards/seeed-sensecap-indicator.json
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"arduino": {
|
||||||
|
"ldscript": "esp32s3_out.ld",
|
||||||
|
"partitions": "default_8MB.csv",
|
||||||
|
"memory_type": "qio_opi"
|
||||||
|
},
|
||||||
|
"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=1"
|
||||||
|
],
|
||||||
|
"f_cpu": "240000000L",
|
||||||
|
"f_flash": "80000000L",
|
||||||
|
"flash_mode": "qio",
|
||||||
|
"hwids": [["0x1A86", "0x7523"]],
|
||||||
|
"mcu": "esp32s3",
|
||||||
|
"variant": "esp32s3r8"
|
||||||
|
},
|
||||||
|
"connectivity": ["wifi", "bluetooth", "lora"],
|
||||||
|
"debug": {
|
||||||
|
"default_tool": "esp-builtin",
|
||||||
|
"onboard_tools": ["esp-builtin"],
|
||||||
|
"openocd_target": "esp32s3.cfg"
|
||||||
|
},
|
||||||
|
"frameworks": ["arduino"],
|
||||||
|
"name": "Seeed Studio SenseCAP Indicator",
|
||||||
|
"upload": {
|
||||||
|
"flash_size": "8MB",
|
||||||
|
"maximum_ram_size": 327680,
|
||||||
|
"maximum_size": 8388608,
|
||||||
|
"require_upload_port": true,
|
||||||
|
"use_1200bps_touch": true,
|
||||||
|
"wait_for_upload_port": true,
|
||||||
|
"speed": 921600
|
||||||
|
},
|
||||||
|
"url": "https://www.seeedstudio.com/Indicator-for-Meshtastic.html",
|
||||||
|
"vendor": "Seeed Studio"
|
||||||
|
}
|
||||||
41
boards/seeed-xiao-s3.json
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"arduino": {
|
||||||
|
"ldscript": "esp32s3_out.ld",
|
||||||
|
"memory_type": "qio_opi"
|
||||||
|
},
|
||||||
|
"core": "esp32",
|
||||||
|
"extra_flags": [
|
||||||
|
"-DBOARD_HAS_PSRAM",
|
||||||
|
"-DARDUINO_USB_CDC_ON_BOOT=1",
|
||||||
|
"-DARDUINO_USB_MODE=0",
|
||||||
|
"-DARDUINO_RUNNING_CORE=1",
|
||||||
|
"-DARDUINO_EVENT_RUNNING_CORE=0"
|
||||||
|
],
|
||||||
|
"f_cpu": "240000000L",
|
||||||
|
"f_flash": "80000000L",
|
||||||
|
"flash_mode": "qio",
|
||||||
|
"hwids": [["0x2886", "0x0059"]],
|
||||||
|
"mcu": "esp32s3",
|
||||||
|
"variant": "seeed-xiao-s3"
|
||||||
|
},
|
||||||
|
"connectivity": ["wifi", "bluetooth", "lora"],
|
||||||
|
"debug": {
|
||||||
|
"default_tool": "esp-builtin",
|
||||||
|
"onboard_tools": ["esp-builtin"],
|
||||||
|
"openocd_target": "esp32s3.cfg"
|
||||||
|
},
|
||||||
|
"frameworks": ["arduino", "espidf"],
|
||||||
|
"name": "seeed-xiao-s3",
|
||||||
|
"upload": {
|
||||||
|
"flash_size": "8MB",
|
||||||
|
"maximum_ram_size": 8388608,
|
||||||
|
"maximum_size": 8388608,
|
||||||
|
"use_1200bps_touch": true,
|
||||||
|
"wait_for_upload_port": true,
|
||||||
|
"require_upload_port": true,
|
||||||
|
"speed": 921600
|
||||||
|
},
|
||||||
|
"url": "https://www.seeedstudio.com/XIAO-ESP32S3-Sense-p-5639.html",
|
||||||
|
"vendor": "Seeed Studio"
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 845 B After Width: | Height: | Size: 594 B |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M9 11.75c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zm6 0c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8 0-.29.02-.58.05-.86 2.36-1.05 4.23-2.98 5.21-5.37C11.07 8.33 14.05 10 17.42 10c.78 0 1.53-.09 2.25-.26.21.71.33 1.47.33 2.26 0 4.41-3.59 8-8 8z"/><path d="M0 0h24v24H0z" fill="none"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M9 11.75a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5m6 0a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8 0-.29.02-.58.05-.86 2.36-1.05 4.23-2.98 5.21-5.37a9.97 9.97 0 0 0 10.41 3.97c.21.71.33 1.47.33 2.26 0 4.41-3.59 8-8 8"/><path fill="none" d="M0 0h24v24H0z"/></svg>
|
||||||
|
Before Width: | Height: | Size: 550 B After Width: | Height: | Size: 445 B |
BIN
images/face.png
|
Before Width: | Height: | Size: 329 B After Width: | Height: | Size: 225 B |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M20.94 11c-.46-4.17-3.77-7.48-7.94-7.94V1h-2v2.06C6.83 3.52 3.52 6.83 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c4.17-.46 7.48-3.77 7.94-7.94H23v-2h-2.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M20.94 11A8.994 8.994 0 0 0 13 3.06V1h-2v2.06A8.994 8.994 0 0 0 3.06 11H1v2h2.06A8.994 8.994 0 0 0 11 20.94V23h2v-2.06A8.994 8.994 0 0 0 20.94 13H23v-2zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7"/></svg>
|
||||||
|
Before Width: | Height: | Size: 365 B After Width: | Height: | Size: 348 B |
BIN
images/pin.png
|
Before Width: | Height: | Size: 288 B After Width: | Height: | Size: 203 B |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7m0 9.5a2.5 2.5 0 0 1 0-5 2.5 2.5 0 0 1 0 5"/><path fill="none" d="M0 0h24v24H0z"/></svg>
|
||||||
|
Before Width: | Height: | Size: 292 B After Width: | Height: | Size: 250 B |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM9 11H7V9h2v2zm4 0h-2V9h2v2zm4 0h-2V9h2v2z"/><path d="M0 0h24v24H0z" fill="none"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2M9 11H7V9h2zm4 0h-2V9h2zm4 0h-2V9h2z"/><path fill="none" d="M0 0h24v24H0z"/></svg>
|
||||||
|
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 246 B |
@@ -17,11 +17,9 @@ default_envs = tbeam
|
|||||||
;default_envs = tlora-v2-1-1_6
|
;default_envs = tlora-v2-1-1_6
|
||||||
;default_envs = tlora-v2-1-1_6-tcxo
|
;default_envs = tlora-v2-1-1_6-tcxo
|
||||||
;default_envs = tlora-t3s3-v1
|
;default_envs = tlora-t3s3-v1
|
||||||
;default_envs = lora-relay-v1 # nrf board
|
|
||||||
;default_envs = t-echo
|
;default_envs = t-echo
|
||||||
;default_envs = canaryone
|
;default_envs = canaryone
|
||||||
;default_envs = nrf52840dk-geeksville
|
;default_envs = native
|
||||||
;default_envs = native # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you'd like to change the default to something like lora-relay-v1 put that here
|
|
||||||
;default_envs = nano-g1
|
;default_envs = nano-g1
|
||||||
;default_envs = pca10059_diy_eink
|
;default_envs = pca10059_diy_eink
|
||||||
;default_envs = meshtastic-diy-v1
|
;default_envs = meshtastic-diy-v1
|
||||||
@@ -29,6 +27,7 @@ default_envs = tbeam
|
|||||||
;default_envs = meshtastic-dr-dev
|
;default_envs = meshtastic-dr-dev
|
||||||
;default_envs = m5stack-coreink
|
;default_envs = m5stack-coreink
|
||||||
;default_envs = rak4631
|
;default_envs = rak4631
|
||||||
|
;default_envs = rak4631_eth_gw
|
||||||
;default_envs = rak2560
|
;default_envs = rak2560
|
||||||
;default_envs = rak10701
|
;default_envs = rak10701
|
||||||
;default_envs = wio-e5
|
;default_envs = wio-e5
|
||||||
@@ -60,43 +59,44 @@ build_flags = -Wno-missing-field-initializers
|
|||||||
-DUSE_THREAD_NAMES
|
-DUSE_THREAD_NAMES
|
||||||
-DTINYGPS_OPTION_NO_CUSTOM_FIELDS
|
-DTINYGPS_OPTION_NO_CUSTOM_FIELDS
|
||||||
-DPB_ENABLE_MALLOC=1
|
-DPB_ENABLE_MALLOC=1
|
||||||
-DRADIOLIB_EXCLUDE_CC1101
|
-DRADIOLIB_EXCLUDE_CC1101=1
|
||||||
-DRADIOLIB_EXCLUDE_NRF24
|
-DRADIOLIB_EXCLUDE_NRF24=1
|
||||||
-DRADIOLIB_EXCLUDE_RF69
|
-DRADIOLIB_EXCLUDE_RF69=1
|
||||||
-DRADIOLIB_EXCLUDE_SX1231
|
-DRADIOLIB_EXCLUDE_SX1231=1
|
||||||
-DRADIOLIB_EXCLUDE_SX1233
|
-DRADIOLIB_EXCLUDE_SX1233=1
|
||||||
-DRADIOLIB_EXCLUDE_SI443X
|
-DRADIOLIB_EXCLUDE_SI443X=1
|
||||||
-DRADIOLIB_EXCLUDE_RFM2X
|
-DRADIOLIB_EXCLUDE_RFM2X=1
|
||||||
-DRADIOLIB_EXCLUDE_AFSK
|
-DRADIOLIB_EXCLUDE_AFSK=1
|
||||||
-DRADIOLIB_EXCLUDE_BELL
|
-DRADIOLIB_EXCLUDE_BELL=1
|
||||||
-DRADIOLIB_EXCLUDE_HELLSCHREIBER
|
-DRADIOLIB_EXCLUDE_HELLSCHREIBER=1
|
||||||
-DRADIOLIB_EXCLUDE_MORSE
|
-DRADIOLIB_EXCLUDE_MORSE=1
|
||||||
-DRADIOLIB_EXCLUDE_RTTY
|
-DRADIOLIB_EXCLUDE_RTTY=1
|
||||||
-DRADIOLIB_EXCLUDE_SSTV
|
-DRADIOLIB_EXCLUDE_SSTV=1
|
||||||
-DRADIOLIB_EXCLUDE_AX25
|
-DRADIOLIB_EXCLUDE_AX25=1
|
||||||
-DRADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
-DRADIOLIB_EXCLUDE_DIRECT_RECEIVE=1
|
||||||
-DRADIOLIB_EXCLUDE_BELL
|
-DRADIOLIB_EXCLUDE_BELL=1
|
||||||
-DRADIOLIB_EXCLUDE_PAGER
|
-DRADIOLIB_EXCLUDE_PAGER=1
|
||||||
-DRADIOLIB_EXCLUDE_FSK4
|
-DRADIOLIB_EXCLUDE_FSK4=1
|
||||||
-DRADIOLIB_EXCLUDE_APRS
|
-DRADIOLIB_EXCLUDE_APRS=1
|
||||||
-DRADIOLIB_EXCLUDE_LORAWAN
|
-DRADIOLIB_EXCLUDE_LORAWAN=1
|
||||||
-DMESHTASTIC_EXCLUDE_DROPZONE=1
|
-DMESHTASTIC_EXCLUDE_DROPZONE=1
|
||||||
|
-DMESHTASTIC_EXCLUDE_REMOTEHARDWARE=1
|
||||||
|
#-DBUILD_EPOCH=$UNIX_TIME
|
||||||
;-D OLED_PL
|
;-D OLED_PL
|
||||||
|
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
monitor_filters = direct
|
monitor_filters = direct
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
; jgromes/RadioLib@~6.6.0
|
jgromes/RadioLib@~7.0.2
|
||||||
https://github.com/jgromes/RadioLib.git#3115fc2d6700a9aee05888791ac930a910f2628f
|
|
||||||
https://github.com/meshtastic/esp8266-oled-ssd1306.git#e16cee124fe26490cb14880c679321ad8ac89c95 ; ESP8266_SSD1306
|
https://github.com/meshtastic/esp8266-oled-ssd1306.git#e16cee124fe26490cb14880c679321ad8ac89c95 ; ESP8266_SSD1306
|
||||||
https://github.com/mathertel/OneButton@~2.6.1 ; OneButton library for non-blocking button debounce
|
mathertel/OneButton@~2.6.1 ; OneButton library for non-blocking button debounce
|
||||||
https://github.com/meshtastic/arduino-fsm.git#7db3702bf0cfe97b783d6c72595e3f38e0b19159
|
https://github.com/meshtastic/arduino-fsm.git#7db3702bf0cfe97b783d6c72595e3f38e0b19159
|
||||||
https://github.com/meshtastic/TinyGPSPlus.git#71a82db35f3b973440044c476d4bcdc673b104f4
|
https://github.com/meshtastic/TinyGPSPlus.git#71a82db35f3b973440044c476d4bcdc673b104f4
|
||||||
https://github.com/meshtastic/ArduinoThread.git#1ae8778c85d0a2a729f989e0b1e7d7c4dc84eef0
|
https://github.com/meshtastic/ArduinoThread.git#1ae8778c85d0a2a729f989e0b1e7d7c4dc84eef0
|
||||||
nanopb/Nanopb@^0.4.8
|
nanopb/Nanopb@^0.4.9
|
||||||
erriez/ErriezCRC32@^1.0.1
|
erriez/ErriezCRC32@^1.0.1
|
||||||
|
|
||||||
; Used for the code analysis in PIO Home / Inspect
|
; Used for the code analysis in PIO Home / Inspect
|
||||||
check_tool = cppcheck
|
check_tool = cppcheck
|
||||||
check_skip_packages = yes
|
check_skip_packages = yes
|
||||||
@@ -127,7 +127,7 @@ lib_deps =
|
|||||||
; (not included in native / portduino)
|
; (not included in native / portduino)
|
||||||
[environmental_base]
|
[environmental_base]
|
||||||
lib_deps =
|
lib_deps =
|
||||||
adafruit/Adafruit BusIO@^1.15.0
|
adafruit/Adafruit BusIO@^1.16.1
|
||||||
adafruit/Adafruit Unified Sensor@^1.1.11
|
adafruit/Adafruit Unified Sensor@^1.1.11
|
||||||
adafruit/Adafruit BMP280 Library@^2.6.8
|
adafruit/Adafruit BMP280 Library@^2.6.8
|
||||||
adafruit/Adafruit BMP085 Library@^1.2.4
|
adafruit/Adafruit BMP085 Library@^1.2.4
|
||||||
@@ -136,28 +136,31 @@ lib_deps =
|
|||||||
adafruit/Adafruit MCP9808 Library@^2.0.0
|
adafruit/Adafruit MCP9808 Library@^2.0.0
|
||||||
adafruit/Adafruit INA260 Library@^1.5.0
|
adafruit/Adafruit INA260 Library@^1.5.0
|
||||||
adafruit/Adafruit INA219@^1.2.0
|
adafruit/Adafruit INA219@^1.2.0
|
||||||
|
adafruit/Adafruit MAX1704X@^1.0.3
|
||||||
adafruit/Adafruit SHTC3 Library@^1.0.0
|
adafruit/Adafruit SHTC3 Library@^1.0.0
|
||||||
adafruit/Adafruit LPS2X@^2.0.4
|
adafruit/Adafruit LPS2X@^2.0.4
|
||||||
adafruit/Adafruit SHT31 Library@^2.2.2
|
adafruit/Adafruit SHT31 Library@^2.2.2
|
||||||
adafruit/Adafruit PM25 AQI Sensor@^1.0.6
|
adafruit/Adafruit PM25 AQI Sensor@^1.1.1
|
||||||
adafruit/Adafruit MPU6050@^2.2.4
|
adafruit/Adafruit MPU6050@^2.2.4
|
||||||
adafruit/Adafruit LIS3DH@^1.2.4
|
adafruit/Adafruit LIS3DH@^1.3.0
|
||||||
adafruit/Adafruit AHTX0@^2.0.5
|
adafruit/Adafruit AHTX0@^2.0.5
|
||||||
adafruit/Adafruit LSM6DS@^4.7.2
|
adafruit/Adafruit LSM6DS@^4.7.2
|
||||||
adafruit/Adafruit VEML7700 Library@^2.1.6
|
adafruit/Adafruit VEML7700 Library@^2.1.6
|
||||||
adafruit/Adafruit SHT4x Library@^1.0.4
|
adafruit/Adafruit SHT4x Library@^1.0.4
|
||||||
adafruit/Adafruit TSL2591 Library@^1.4.5
|
adafruit/Adafruit TSL2591 Library@^1.4.5
|
||||||
sparkfun/SparkFun Qwiic Scale NAU7802 Arduino Library@^1.0.5
|
sparkfun/SparkFun Qwiic Scale NAU7802 Arduino Library@^1.0.5
|
||||||
|
sparkfun/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library@^1.2.13
|
||||||
ClosedCube OPT3001@^1.1.2
|
ClosedCube OPT3001@^1.1.2
|
||||||
emotibit/EmotiBit MLX90632@^1.0.8
|
emotibit/EmotiBit MLX90632@^1.0.8
|
||||||
dfrobot/DFRobot_RTU@^1.0.3
|
dfrobot/DFRobot_RTU@^1.0.3
|
||||||
|
sparkfun/SparkFun MAX3010x Pulse and Proximity Sensor Library@^1.1.2
|
||||||
|
adafruit/Adafruit MLX90614 Library@^2.1.5
|
||||||
|
|
||||||
https://github.com/boschsensortec/Bosch-BSEC2-Library#v1.7.2502
|
https://github.com/boschsensortec/Bosch-BSEC2-Library#v1.7.2502
|
||||||
boschsensortec/BME68x Sensor Library@^1.1.40407
|
boschsensortec/BME68x Sensor Library@^1.1.40407
|
||||||
https://github.com/KodinLanewave/INA3221@^1.0.0
|
https://github.com/KodinLanewave/INA3221@^1.0.1
|
||||||
lewisxhe/SensorLib@^0.2.0
|
lewisxhe/SensorLib@0.2.0
|
||||||
mprograms/QMC5883LCompass@^1.2.0
|
mprograms/QMC5883LCompass@^1.2.0
|
||||||
|
|
||||||
|
https://github.com/meshtastic/DFRobot_LarkWeatherStation#4de3a9cadef0f6a5220a8a906cf9775b02b0040d
|
||||||
https://github.com/meshtastic/DFRobot_LarkWeatherStation#dee914270dc7cb3e43fbf034edd85a63a16a12ee
|
https://github.com/gjelsoe/STK8xxx-Accelerometer.git#v0.1.1
|
||||||
|
|||||||
@@ -1,297 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include "configuration.h"
|
|
||||||
|
|
||||||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
|
||||||
|
|
||||||
#include "PowerFSM.h"
|
|
||||||
#include "concurrency/OSThread.h"
|
|
||||||
#include "main.h"
|
|
||||||
#include "power.h"
|
|
||||||
|
|
||||||
#include <Adafruit_LIS3DH.h>
|
|
||||||
#include <Adafruit_LSM6DS3TRC.h>
|
|
||||||
#include <Adafruit_MPU6050.h>
|
|
||||||
#include <Arduino.h>
|
|
||||||
#include <SensorBMA423.hpp>
|
|
||||||
#include <Wire.h>
|
|
||||||
#ifdef RAK_4631
|
|
||||||
#include "Fusion/Fusion.h"
|
|
||||||
#include "graphics/Screen.h"
|
|
||||||
#include "graphics/ScreenFonts.h"
|
|
||||||
#include <Rak_BMX160.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ACCELEROMETER_CHECK_INTERVAL_MS 100
|
|
||||||
#define ACCELEROMETER_CLICK_THRESHOLD 40
|
|
||||||
|
|
||||||
static inline int readRegister(uint8_t address, uint8_t reg, uint8_t *data, uint8_t len)
|
|
||||||
{
|
|
||||||
Wire.beginTransmission(address);
|
|
||||||
Wire.write(reg);
|
|
||||||
Wire.endTransmission();
|
|
||||||
Wire.requestFrom((uint8_t)address, (uint8_t)len);
|
|
||||||
uint8_t i = 0;
|
|
||||||
while (Wire.available()) {
|
|
||||||
data[i++] = Wire.read();
|
|
||||||
}
|
|
||||||
return 0; // Pass
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int writeRegister(uint8_t address, uint8_t reg, uint8_t *data, uint8_t len)
|
|
||||||
{
|
|
||||||
Wire.beginTransmission(address);
|
|
||||||
Wire.write(reg);
|
|
||||||
Wire.write(data, len);
|
|
||||||
return (0 != Wire.endTransmission());
|
|
||||||
}
|
|
||||||
|
|
||||||
class AccelerometerThread : public concurrency::OSThread
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit AccelerometerThread(ScanI2C::DeviceType type) : OSThread("AccelerometerThread")
|
|
||||||
{
|
|
||||||
if (accelerometer_found.port == ScanI2C::I2CPort::NO_I2C) {
|
|
||||||
LOG_DEBUG("AccelerometerThread disabling due to no sensors found\n");
|
|
||||||
disable();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
acceleremoter_type = type;
|
|
||||||
#ifndef RAK_4631
|
|
||||||
if (!config.display.wake_on_tap_or_motion && !config.device.double_tap_as_button_press) {
|
|
||||||
LOG_DEBUG("AccelerometerThread disabling due to no interested configurations\n");
|
|
||||||
disable();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
void start()
|
|
||||||
{
|
|
||||||
init();
|
|
||||||
setIntervalFromNow(0);
|
|
||||||
};
|
|
||||||
|
|
||||||
protected:
|
|
||||||
int32_t runOnce() override
|
|
||||||
{
|
|
||||||
canSleep = true; // Assume we should not keep the board awake
|
|
||||||
|
|
||||||
if (acceleremoter_type == ScanI2C::DeviceType::MPU6050 && mpu.getMotionInterruptStatus()) {
|
|
||||||
wakeScreen();
|
|
||||||
} else if (acceleremoter_type == ScanI2C::DeviceType::LIS3DH && lis.getClick() > 0) {
|
|
||||||
uint8_t click = lis.getClick();
|
|
||||||
if (!config.device.double_tap_as_button_press) {
|
|
||||||
wakeScreen();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.device.double_tap_as_button_press && (click & 0x20)) {
|
|
||||||
buttonPress();
|
|
||||||
return 500;
|
|
||||||
}
|
|
||||||
} else if (acceleremoter_type == ScanI2C::DeviceType::BMA423 && bmaSensor.readIrqStatus() != DEV_WIRE_NONE) {
|
|
||||||
if (bmaSensor.isTilt() || bmaSensor.isDoubleTap()) {
|
|
||||||
wakeScreen();
|
|
||||||
return 500;
|
|
||||||
}
|
|
||||||
#ifdef RAK_4631
|
|
||||||
} else if (acceleremoter_type == ScanI2C::DeviceType::BMX160) {
|
|
||||||
sBmx160SensorData_t magAccel;
|
|
||||||
sBmx160SensorData_t gAccel;
|
|
||||||
|
|
||||||
/* Get a new sensor event */
|
|
||||||
bmx160.getAllData(&magAccel, NULL, &gAccel);
|
|
||||||
|
|
||||||
// expirimental calibrate routine. Limited to between 10 and 30 seconds after boot
|
|
||||||
if (millis() > 12 * 1000 && millis() < 30 * 1000) {
|
|
||||||
if (!showingScreen) {
|
|
||||||
showingScreen = true;
|
|
||||||
screen->startAlert((FrameCallback)drawFrameCalibration);
|
|
||||||
}
|
|
||||||
if (magAccel.x > highestX)
|
|
||||||
highestX = magAccel.x;
|
|
||||||
if (magAccel.x < lowestX)
|
|
||||||
lowestX = magAccel.x;
|
|
||||||
if (magAccel.y > highestY)
|
|
||||||
highestY = magAccel.y;
|
|
||||||
if (magAccel.y < lowestY)
|
|
||||||
lowestY = magAccel.y;
|
|
||||||
if (magAccel.z > highestZ)
|
|
||||||
highestZ = magAccel.z;
|
|
||||||
if (magAccel.z < lowestZ)
|
|
||||||
lowestZ = magAccel.z;
|
|
||||||
} else if (showingScreen && millis() >= 30 * 1000) {
|
|
||||||
showingScreen = false;
|
|
||||||
screen->endAlert();
|
|
||||||
}
|
|
||||||
|
|
||||||
int highestRealX = highestX - (highestX + lowestX) / 2;
|
|
||||||
|
|
||||||
magAccel.x -= (highestX + lowestX) / 2;
|
|
||||||
magAccel.y -= (highestY + lowestY) / 2;
|
|
||||||
magAccel.z -= (highestZ + lowestZ) / 2;
|
|
||||||
FusionVector ga, ma;
|
|
||||||
ga.axis.x = -gAccel.x; // default location for the BMX160 is on the rear of the board
|
|
||||||
ga.axis.y = -gAccel.y;
|
|
||||||
ga.axis.z = gAccel.z;
|
|
||||||
ma.axis.x = -magAccel.x;
|
|
||||||
ma.axis.y = -magAccel.y;
|
|
||||||
ma.axis.z = magAccel.z * 3;
|
|
||||||
|
|
||||||
// If we're set to one of the inverted positions
|
|
||||||
if (config.display.compass_orientation > meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_270) {
|
|
||||||
ma = FusionAxesSwap(ma, FusionAxesAlignmentNXNYPZ);
|
|
||||||
ga = FusionAxesSwap(ga, FusionAxesAlignmentNXNYPZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
float heading = FusionCompassCalculateHeading(FusionConventionNed, ga, ma);
|
|
||||||
|
|
||||||
switch (config.display.compass_orientation) {
|
|
||||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_0_INVERTED:
|
|
||||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_0:
|
|
||||||
break;
|
|
||||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_90:
|
|
||||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_90_INVERTED:
|
|
||||||
heading += 90;
|
|
||||||
break;
|
|
||||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_180:
|
|
||||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_180_INVERTED:
|
|
||||||
heading += 180;
|
|
||||||
break;
|
|
||||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_270:
|
|
||||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_270_INVERTED:
|
|
||||||
heading += 270;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
screen->setHeading(heading);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
} else if (acceleremoter_type == ScanI2C::DeviceType::LSM6DS3 && lsm.shake()) {
|
|
||||||
wakeScreen();
|
|
||||||
return 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ACCELEROMETER_CHECK_INTERVAL_MS;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
void init()
|
|
||||||
{
|
|
||||||
LOG_DEBUG("AccelerometerThread initializing\n");
|
|
||||||
|
|
||||||
if (acceleremoter_type == ScanI2C::DeviceType::MPU6050 && mpu.begin(accelerometer_found.address)) {
|
|
||||||
LOG_DEBUG("MPU6050 initializing\n");
|
|
||||||
// setup motion detection
|
|
||||||
mpu.setHighPassFilter(MPU6050_HIGHPASS_0_63_HZ);
|
|
||||||
mpu.setMotionDetectionThreshold(1);
|
|
||||||
mpu.setMotionDetectionDuration(20);
|
|
||||||
mpu.setInterruptPinLatch(true); // Keep it latched. Will turn off when reinitialized.
|
|
||||||
mpu.setInterruptPinPolarity(true);
|
|
||||||
} else if (acceleremoter_type == ScanI2C::DeviceType::LIS3DH && lis.begin(accelerometer_found.address)) {
|
|
||||||
LOG_DEBUG("LIS3DH initializing\n");
|
|
||||||
lis.setRange(LIS3DH_RANGE_2_G);
|
|
||||||
// Adjust threshold, higher numbers are less sensitive
|
|
||||||
lis.setClick(config.device.double_tap_as_button_press ? 2 : 1, ACCELEROMETER_CLICK_THRESHOLD);
|
|
||||||
} else if (acceleremoter_type == ScanI2C::DeviceType::BMA423 &&
|
|
||||||
bmaSensor.begin(accelerometer_found.address, &readRegister, &writeRegister)) {
|
|
||||||
LOG_DEBUG("BMA423 initializing\n");
|
|
||||||
bmaSensor.configAccelerometer(bmaSensor.RANGE_2G, bmaSensor.ODR_100HZ, bmaSensor.BW_NORMAL_AVG4,
|
|
||||||
bmaSensor.PERF_CONTINUOUS_MODE);
|
|
||||||
bmaSensor.enableAccelerometer();
|
|
||||||
bmaSensor.configInterrupt(BMA4_LEVEL_TRIGGER, BMA4_ACTIVE_HIGH, BMA4_PUSH_PULL, BMA4_OUTPUT_ENABLE,
|
|
||||||
BMA4_INPUT_DISABLE);
|
|
||||||
|
|
||||||
#ifdef BMA423_INT
|
|
||||||
pinMode(BMA4XX_INT, INPUT);
|
|
||||||
attachInterrupt(
|
|
||||||
BMA4XX_INT,
|
|
||||||
[] {
|
|
||||||
// Set interrupt to set irq value to true
|
|
||||||
BMA_IRQ = true;
|
|
||||||
},
|
|
||||||
RISING); // Select the interrupt mode according to the actual circuit
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef T_WATCH_S3
|
|
||||||
// Need to raise the wrist function, need to set the correct axis
|
|
||||||
bmaSensor.setReampAxes(bmaSensor.REMAP_TOP_LAYER_RIGHT_CORNER);
|
|
||||||
#else
|
|
||||||
bmaSensor.setReampAxes(bmaSensor.REMAP_BOTTOM_LAYER_BOTTOM_LEFT_CORNER);
|
|
||||||
#endif
|
|
||||||
// bmaSensor.enableFeature(bmaSensor.FEATURE_STEP_CNTR, true);
|
|
||||||
bmaSensor.enableFeature(bmaSensor.FEATURE_TILT, true);
|
|
||||||
bmaSensor.enableFeature(bmaSensor.FEATURE_WAKEUP, true);
|
|
||||||
// bmaSensor.resetPedometer();
|
|
||||||
|
|
||||||
// Turn on feature interrupt
|
|
||||||
bmaSensor.enablePedometerIRQ();
|
|
||||||
bmaSensor.enableTiltIRQ();
|
|
||||||
// It corresponds to isDoubleClick interrupt
|
|
||||||
bmaSensor.enableWakeupIRQ();
|
|
||||||
#ifdef RAK_4631
|
|
||||||
} else if (acceleremoter_type == ScanI2C::DeviceType::BMX160 && bmx160.begin()) {
|
|
||||||
bmx160.ODR_Config(BMX160_ACCEL_ODR_100HZ, BMX160_GYRO_ODR_100HZ); // set output data rate
|
|
||||||
|
|
||||||
#endif
|
|
||||||
} else if (acceleremoter_type == ScanI2C::DeviceType::LSM6DS3 && lsm.begin_I2C(accelerometer_found.address)) {
|
|
||||||
LOG_DEBUG("LSM6DS3 initializing\n");
|
|
||||||
// Default threshold of 2G, less sensitive options are 4, 8 or 16G
|
|
||||||
lsm.setAccelRange(LSM6DS_ACCEL_RANGE_2_G);
|
|
||||||
#ifndef LSM6DS3_WAKE_THRESH
|
|
||||||
#define LSM6DS3_WAKE_THRESH 20
|
|
||||||
#endif
|
|
||||||
lsm.enableWakeup(config.display.wake_on_tap_or_motion, 1, LSM6DS3_WAKE_THRESH);
|
|
||||||
// Duration is number of occurances needed to trigger, higher threshold is less sensitive
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void wakeScreen()
|
|
||||||
{
|
|
||||||
if (powerFSM.getState() == &stateDARK) {
|
|
||||||
LOG_INFO("Tap or motion detected. Turning on screen\n");
|
|
||||||
powerFSM.trigger(EVENT_INPUT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void buttonPress()
|
|
||||||
{
|
|
||||||
LOG_DEBUG("Double-tap detected. Firing button press\n");
|
|
||||||
powerFSM.trigger(EVENT_PRESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
ScanI2C::DeviceType acceleremoter_type;
|
|
||||||
Adafruit_MPU6050 mpu;
|
|
||||||
Adafruit_LIS3DH lis;
|
|
||||||
Adafruit_LSM6DS3TRC lsm;
|
|
||||||
SensorBMA423 bmaSensor;
|
|
||||||
bool BMA_IRQ = false;
|
|
||||||
#ifdef RAK_4631
|
|
||||||
bool showingScreen = false;
|
|
||||||
RAK_BMX160 bmx160;
|
|
||||||
float highestX = 0, lowestX = 0, highestY = 0, lowestY = 0, highestZ = 0, lowestZ = 0;
|
|
||||||
|
|
||||||
static void drawFrameCalibration(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
|
||||||
{
|
|
||||||
int x_offset = display->width() / 2;
|
|
||||||
int y_offset = display->height() <= 80 ? 0 : 32;
|
|
||||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
|
||||||
display->setFont(FONT_MEDIUM);
|
|
||||||
display->drawString(x, y, "Calibrating\nCompass");
|
|
||||||
int16_t compassX = 0, compassY = 0;
|
|
||||||
uint16_t compassDiam = graphics::Screen::getCompassDiam(display->getWidth(), display->getHeight());
|
|
||||||
|
|
||||||
// coordinates for the center of the compass/circle
|
|
||||||
if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_DEFAULT) {
|
|
||||||
compassX = x + display->getWidth() - compassDiam / 2 - 5;
|
|
||||||
compassY = y + display->getHeight() / 2;
|
|
||||||
} else {
|
|
||||||
compassX = x + display->getWidth() - compassDiam / 2 - 5;
|
|
||||||
compassY = y + FONT_HEIGHT_SMALL + (display->getHeight() - FONT_HEIGHT_SMALL) / 2;
|
|
||||||
}
|
|
||||||
display->drawCircle(compassX, compassY, compassDiam / 2);
|
|
||||||
screen->drawCompassNorth(display, compassX, compassY, screen->getHeading() * PI / 180);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -42,18 +42,18 @@ class AmbientLightingThread : public concurrency::OSThread
|
|||||||
#ifdef HAS_NCP5623
|
#ifdef HAS_NCP5623
|
||||||
_type = type;
|
_type = type;
|
||||||
if (_type == ScanI2C::DeviceType::NONE) {
|
if (_type == ScanI2C::DeviceType::NONE) {
|
||||||
LOG_DEBUG("AmbientLightingThread disabling due to no RGB leds found on I2C bus\n");
|
LOG_DEBUG("AmbientLightingThread disabling due to no RGB leds found on I2C bus");
|
||||||
disable();
|
disable();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
|
#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
|
||||||
if (!moduleConfig.ambient_lighting.led_state) {
|
if (!moduleConfig.ambient_lighting.led_state) {
|
||||||
LOG_DEBUG("AmbientLightingThread disabling due to moduleConfig.ambient_lighting.led_state OFF\n");
|
LOG_DEBUG("AmbientLightingThread disabling due to moduleConfig.ambient_lighting.led_state OFF");
|
||||||
disable();
|
disable();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LOG_DEBUG("AmbientLightingThread initializing\n");
|
LOG_DEBUG("AmbientLightingThread initializing");
|
||||||
#ifdef HAS_NCP5623
|
#ifdef HAS_NCP5623
|
||||||
if (_type == ScanI2C::NCP5623) {
|
if (_type == ScanI2C::NCP5623) {
|
||||||
rgb.begin();
|
rgb.begin();
|
||||||
@@ -106,27 +106,27 @@ class AmbientLightingThread : public concurrency::OSThread
|
|||||||
rgb.setRed(0);
|
rgb.setRed(0);
|
||||||
rgb.setGreen(0);
|
rgb.setGreen(0);
|
||||||
rgb.setBlue(0);
|
rgb.setBlue(0);
|
||||||
LOG_INFO("Turn Off NCP5623 Ambient lighting.\n");
|
LOG_INFO("Turn Off NCP5623 Ambient lighting.");
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_NEOPIXEL
|
#ifdef HAS_NEOPIXEL
|
||||||
pixels.clear();
|
pixels.clear();
|
||||||
pixels.show();
|
pixels.show();
|
||||||
LOG_INFO("Turn Off NeoPixel Ambient lighting.\n");
|
LOG_INFO("Turn Off NeoPixel Ambient lighting.");
|
||||||
#endif
|
#endif
|
||||||
#ifdef RGBLED_CA
|
#ifdef RGBLED_CA
|
||||||
analogWrite(RGBLED_RED, 255 - 0);
|
analogWrite(RGBLED_RED, 255 - 0);
|
||||||
analogWrite(RGBLED_GREEN, 255 - 0);
|
analogWrite(RGBLED_GREEN, 255 - 0);
|
||||||
analogWrite(RGBLED_BLUE, 255 - 0);
|
analogWrite(RGBLED_BLUE, 255 - 0);
|
||||||
LOG_INFO("Turn Off Ambient lighting RGB Common Anode.\n");
|
LOG_INFO("Turn Off Ambient lighting RGB Common Anode.");
|
||||||
#elif defined(RGBLED_RED)
|
#elif defined(RGBLED_RED)
|
||||||
analogWrite(RGBLED_RED, 0);
|
analogWrite(RGBLED_RED, 0);
|
||||||
analogWrite(RGBLED_GREEN, 0);
|
analogWrite(RGBLED_GREEN, 0);
|
||||||
analogWrite(RGBLED_BLUE, 0);
|
analogWrite(RGBLED_BLUE, 0);
|
||||||
LOG_INFO("Turn Off Ambient lighting RGB Common Cathode.\n");
|
LOG_INFO("Turn Off Ambient lighting RGB Common Cathode.");
|
||||||
#endif
|
#endif
|
||||||
#ifdef UNPHONE
|
#ifdef UNPHONE
|
||||||
unphone.rgb(0, 0, 0);
|
unphone.rgb(0, 0, 0);
|
||||||
LOG_INFO("Turn Off unPhone Ambient lighting.\n");
|
LOG_INFO("Turn Off unPhone Ambient lighting.");
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ class AmbientLightingThread : public concurrency::OSThread
|
|||||||
rgb.setRed(moduleConfig.ambient_lighting.red);
|
rgb.setRed(moduleConfig.ambient_lighting.red);
|
||||||
rgb.setGreen(moduleConfig.ambient_lighting.green);
|
rgb.setGreen(moduleConfig.ambient_lighting.green);
|
||||||
rgb.setBlue(moduleConfig.ambient_lighting.blue);
|
rgb.setBlue(moduleConfig.ambient_lighting.blue);
|
||||||
LOG_DEBUG("Initializing NCP5623 Ambient lighting w/ current=%d, red=%d, green=%d, blue=%d\n",
|
LOG_DEBUG("Initializing NCP5623 Ambient lighting w/ current=%d, red=%d, green=%d, blue=%d",
|
||||||
moduleConfig.ambient_lighting.current, moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green,
|
moduleConfig.ambient_lighting.current, moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green,
|
||||||
moduleConfig.ambient_lighting.blue);
|
moduleConfig.ambient_lighting.blue);
|
||||||
#endif
|
#endif
|
||||||
@@ -158,7 +158,7 @@ class AmbientLightingThread : public concurrency::OSThread
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
pixels.show();
|
pixels.show();
|
||||||
LOG_DEBUG("Initializing NeoPixel Ambient lighting w/ brightness(current)=%d, red=%d, green=%d, blue=%d\n",
|
LOG_DEBUG("Initializing NeoPixel Ambient lighting w/ brightness(current)=%d, red=%d, green=%d, blue=%d",
|
||||||
moduleConfig.ambient_lighting.current, moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green,
|
moduleConfig.ambient_lighting.current, moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green,
|
||||||
moduleConfig.ambient_lighting.blue);
|
moduleConfig.ambient_lighting.blue);
|
||||||
#endif
|
#endif
|
||||||
@@ -166,18 +166,18 @@ class AmbientLightingThread : public concurrency::OSThread
|
|||||||
analogWrite(RGBLED_RED, 255 - moduleConfig.ambient_lighting.red);
|
analogWrite(RGBLED_RED, 255 - moduleConfig.ambient_lighting.red);
|
||||||
analogWrite(RGBLED_GREEN, 255 - moduleConfig.ambient_lighting.green);
|
analogWrite(RGBLED_GREEN, 255 - moduleConfig.ambient_lighting.green);
|
||||||
analogWrite(RGBLED_BLUE, 255 - moduleConfig.ambient_lighting.blue);
|
analogWrite(RGBLED_BLUE, 255 - moduleConfig.ambient_lighting.blue);
|
||||||
LOG_DEBUG("Initializing Ambient lighting RGB Common Anode w/ red=%d, green=%d, blue=%d\n",
|
LOG_DEBUG("Initializing Ambient lighting RGB Common Anode w/ red=%d, green=%d, blue=%d",
|
||||||
moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
||||||
#elif defined(RGBLED_RED)
|
#elif defined(RGBLED_RED)
|
||||||
analogWrite(RGBLED_RED, moduleConfig.ambient_lighting.red);
|
analogWrite(RGBLED_RED, moduleConfig.ambient_lighting.red);
|
||||||
analogWrite(RGBLED_GREEN, moduleConfig.ambient_lighting.green);
|
analogWrite(RGBLED_GREEN, moduleConfig.ambient_lighting.green);
|
||||||
analogWrite(RGBLED_BLUE, moduleConfig.ambient_lighting.blue);
|
analogWrite(RGBLED_BLUE, moduleConfig.ambient_lighting.blue);
|
||||||
LOG_DEBUG("Initializing Ambient lighting RGB Common Cathode w/ red=%d, green=%d, blue=%d\n",
|
LOG_DEBUG("Initializing Ambient lighting RGB Common Cathode w/ red=%d, green=%d, blue=%d",
|
||||||
moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
||||||
#endif
|
#endif
|
||||||
#ifdef UNPHONE
|
#ifdef UNPHONE
|
||||||
unphone.rgb(moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
unphone.rgb(moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
||||||
LOG_DEBUG("Initializing unPhone Ambient lighting w/ red=%d, green=%d, blue=%d\n", moduleConfig.ambient_lighting.red,
|
LOG_DEBUG("Initializing unPhone Ambient lighting w/ red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.red,
|
||||||
moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ ButtonThread::ButtonThread() : OSThread("Button")
|
|||||||
#if defined(ARCH_PORTDUINO)
|
#if defined(ARCH_PORTDUINO)
|
||||||
if (settingsMap.count(user) != 0 && settingsMap[user] != RADIOLIB_NC) {
|
if (settingsMap.count(user) != 0 && settingsMap[user] != RADIOLIB_NC) {
|
||||||
this->userButton = OneButton(settingsMap[user], true, true);
|
this->userButton = OneButton(settingsMap[user], true, true);
|
||||||
LOG_DEBUG("Using GPIO%02d for button\n", settingsMap[user]);
|
LOG_DEBUG("Using GPIO%02d for button", settingsMap[user]);
|
||||||
}
|
}
|
||||||
#elif defined(BUTTON_PIN)
|
#elif defined(BUTTON_PIN)
|
||||||
int pin = config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN; // Resolved button pin
|
int pin = config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN; // Resolved button pin
|
||||||
@@ -47,7 +47,7 @@ ButtonThread::ButtonThread() : OSThread("Button")
|
|||||||
#else
|
#else
|
||||||
this->userButton = OneButton(pin, true, true);
|
this->userButton = OneButton(pin, true, true);
|
||||||
#endif
|
#endif
|
||||||
LOG_DEBUG("Using GPIO%02d for button\n", pin);
|
LOG_DEBUG("Using GPIO%02d for button", pin);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef INPUT_PULLUP_SENSE
|
#ifdef INPUT_PULLUP_SENSE
|
||||||
@@ -123,7 +123,12 @@ int32_t ButtonThread::runOnce()
|
|||||||
if (btnEvent != BUTTON_EVENT_NONE) {
|
if (btnEvent != BUTTON_EVENT_NONE) {
|
||||||
switch (btnEvent) {
|
switch (btnEvent) {
|
||||||
case BUTTON_EVENT_PRESSED: {
|
case BUTTON_EVENT_PRESSED: {
|
||||||
LOG_BUTTON("press!\n");
|
LOG_BUTTON("press!");
|
||||||
|
// If a nag notification is running, stop it and prevent other actions
|
||||||
|
if (moduleConfig.external_notification.enabled && (externalNotificationModule->nagCycleCutoff != UINT32_MAX)) {
|
||||||
|
externalNotificationModule->stopNow();
|
||||||
|
return 50;
|
||||||
|
}
|
||||||
#ifdef BUTTON_PIN
|
#ifdef BUTTON_PIN
|
||||||
if (((config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN) !=
|
if (((config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN) !=
|
||||||
moduleConfig.canned_message.inputbroker_pin_press) ||
|
moduleConfig.canned_message.inputbroker_pin_press) ||
|
||||||
@@ -143,7 +148,7 @@ int32_t ButtonThread::runOnce()
|
|||||||
}
|
}
|
||||||
|
|
||||||
case BUTTON_EVENT_DOUBLE_PRESSED: {
|
case BUTTON_EVENT_DOUBLE_PRESSED: {
|
||||||
LOG_BUTTON("Double press!\n");
|
LOG_BUTTON("Double press!");
|
||||||
service->refreshLocalMeshNode();
|
service->refreshLocalMeshNode();
|
||||||
auto sentPosition = service->trySendPosition(NODENUM_BROADCAST, true);
|
auto sentPosition = service->trySendPosition(NODENUM_BROADCAST, true);
|
||||||
if (screen) {
|
if (screen) {
|
||||||
@@ -157,7 +162,7 @@ int32_t ButtonThread::runOnce()
|
|||||||
}
|
}
|
||||||
|
|
||||||
case BUTTON_EVENT_MULTI_PRESSED: {
|
case BUTTON_EVENT_MULTI_PRESSED: {
|
||||||
LOG_BUTTON("Mulitipress! %hux\n", multipressClickCount);
|
LOG_BUTTON("Mulitipress! %hux", multipressClickCount);
|
||||||
switch (multipressClickCount) {
|
switch (multipressClickCount) {
|
||||||
#if HAS_GPS
|
#if HAS_GPS
|
||||||
// 3 clicks: toggle GPS
|
// 3 clicks: toggle GPS
|
||||||
@@ -184,7 +189,7 @@ int32_t ButtonThread::runOnce()
|
|||||||
} // end multipress event
|
} // end multipress event
|
||||||
|
|
||||||
case BUTTON_EVENT_LONG_PRESSED: {
|
case BUTTON_EVENT_LONG_PRESSED: {
|
||||||
LOG_BUTTON("Long press!\n");
|
LOG_BUTTON("Long press!");
|
||||||
powerFSM.trigger(EVENT_PRESS);
|
powerFSM.trigger(EVENT_PRESS);
|
||||||
if (screen) {
|
if (screen) {
|
||||||
screen->startAlert("Shutting down...");
|
screen->startAlert("Shutting down...");
|
||||||
@@ -196,7 +201,7 @@ int32_t ButtonThread::runOnce()
|
|||||||
// Do actual shutdown when button released, otherwise the button release
|
// Do actual shutdown when button released, otherwise the button release
|
||||||
// may wake the board immediatedly.
|
// may wake the board immediatedly.
|
||||||
case BUTTON_EVENT_LONG_RELEASED: {
|
case BUTTON_EVENT_LONG_RELEASED: {
|
||||||
LOG_INFO("Shutdown from long press\n");
|
LOG_INFO("Shutdown from long press");
|
||||||
playShutdownMelody();
|
playShutdownMelody();
|
||||||
delay(3000);
|
delay(3000);
|
||||||
power->shutdown();
|
power->shutdown();
|
||||||
@@ -205,7 +210,7 @@ int32_t ButtonThread::runOnce()
|
|||||||
|
|
||||||
#ifdef BUTTON_PIN_TOUCH
|
#ifdef BUTTON_PIN_TOUCH
|
||||||
case BUTTON_EVENT_TOUCH_LONG_PRESSED: {
|
case BUTTON_EVENT_TOUCH_LONG_PRESSED: {
|
||||||
LOG_BUTTON("Touch press!\n");
|
LOG_BUTTON("Touch press!");
|
||||||
if (screen) {
|
if (screen) {
|
||||||
// Wake if asleep
|
// Wake if asleep
|
||||||
if (powerFSM.getState() == &stateDARK)
|
if (powerFSM.getState() == &stateDARK)
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ bool lfs_assert_failed =
|
|||||||
|
|
||||||
extern "C" void lfs_assert(const char *reason)
|
extern "C" void lfs_assert(const char *reason)
|
||||||
{
|
{
|
||||||
LOG_ERROR("LFS assert: %s\n", reason);
|
LOG_ERROR("LFS assert: %s", reason);
|
||||||
lfs_assert_failed = true;
|
lfs_assert_failed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,19 +75,19 @@ bool copyFile(const char *from, const char *to)
|
|||||||
r = OSFS::getFile(from, cbuffer);
|
r = OSFS::getFile(from, cbuffer);
|
||||||
|
|
||||||
if (r == notfound) {
|
if (r == notfound) {
|
||||||
LOG_ERROR("Failed to open source file %s\n", from);
|
LOG_ERROR("Failed to open source file %s", from);
|
||||||
return false;
|
return false;
|
||||||
} else if (r == noerr) {
|
} else if (r == noerr) {
|
||||||
r = OSFS::newFile(to, cbuffer, true);
|
r = OSFS::newFile(to, cbuffer, true);
|
||||||
if (r == noerr) {
|
if (r == noerr) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR("OSFS Error %d\n", r);
|
LOG_ERROR("OSFS Error %d", r);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR("OSFS Error %d\n", r);
|
LOG_ERROR("OSFS Error %d", r);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -97,13 +97,13 @@ bool copyFile(const char *from, const char *to)
|
|||||||
|
|
||||||
File f1 = FSCom.open(from, FILE_O_READ);
|
File f1 = FSCom.open(from, FILE_O_READ);
|
||||||
if (!f1) {
|
if (!f1) {
|
||||||
LOG_ERROR("Failed to open source file %s\n", from);
|
LOG_ERROR("Failed to open source file %s", from);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
File f2 = FSCom.open(to, FILE_O_WRITE);
|
File f2 = FSCom.open(to, FILE_O_WRITE);
|
||||||
if (!f2) {
|
if (!f2) {
|
||||||
LOG_ERROR("Failed to open destination file %s\n", to);
|
LOG_ERROR("Failed to open destination file %s", to);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@ void listDir(const char *dirname, uint8_t levels, bool del)
|
|||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32
|
||||||
listDir(file.path(), levels - 1, del);
|
listDir(file.path(), levels - 1, del);
|
||||||
if (del) {
|
if (del) {
|
||||||
LOG_DEBUG("Removing %s\n", file.path());
|
LOG_DEBUG("Removing %s", file.path());
|
||||||
strncpy(buffer, file.path(), sizeof(buffer));
|
strncpy(buffer, file.path(), sizeof(buffer));
|
||||||
file.close();
|
file.close();
|
||||||
FSCom.rmdir(buffer);
|
FSCom.rmdir(buffer);
|
||||||
@@ -241,7 +241,7 @@ void listDir(const char *dirname, uint8_t levels, bool del)
|
|||||||
#elif (defined(ARCH_RP2040) || defined(ARCH_PORTDUINO))
|
#elif (defined(ARCH_RP2040) || defined(ARCH_PORTDUINO))
|
||||||
listDir(file.name(), levels - 1, del);
|
listDir(file.name(), levels - 1, del);
|
||||||
if (del) {
|
if (del) {
|
||||||
LOG_DEBUG("Removing %s\n", file.name());
|
LOG_DEBUG("Removing %s", file.name());
|
||||||
strncpy(buffer, file.name(), sizeof(buffer));
|
strncpy(buffer, file.name(), sizeof(buffer));
|
||||||
file.close();
|
file.close();
|
||||||
FSCom.rmdir(buffer);
|
FSCom.rmdir(buffer);
|
||||||
@@ -249,7 +249,7 @@ void listDir(const char *dirname, uint8_t levels, bool del)
|
|||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
LOG_DEBUG(" %s (directory)\n", file.name());
|
LOG_DEBUG(" %s (directory)", file.name());
|
||||||
listDir(file.name(), levels - 1, del);
|
listDir(file.name(), levels - 1, del);
|
||||||
file.close();
|
file.close();
|
||||||
#endif
|
#endif
|
||||||
@@ -257,26 +257,26 @@ void listDir(const char *dirname, uint8_t levels, bool del)
|
|||||||
} else {
|
} else {
|
||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32
|
||||||
if (del) {
|
if (del) {
|
||||||
LOG_DEBUG("Deleting %s\n", file.path());
|
LOG_DEBUG("Deleting %s", file.path());
|
||||||
strncpy(buffer, file.path(), sizeof(buffer));
|
strncpy(buffer, file.path(), sizeof(buffer));
|
||||||
file.close();
|
file.close();
|
||||||
FSCom.remove(buffer);
|
FSCom.remove(buffer);
|
||||||
} else {
|
} else {
|
||||||
LOG_DEBUG(" %s (%i Bytes)\n", file.path(), file.size());
|
LOG_DEBUG(" %s (%i Bytes)", file.path(), file.size());
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
#elif (defined(ARCH_RP2040) || defined(ARCH_PORTDUINO))
|
#elif (defined(ARCH_RP2040) || defined(ARCH_PORTDUINO))
|
||||||
if (del) {
|
if (del) {
|
||||||
LOG_DEBUG("Deleting %s\n", file.name());
|
LOG_DEBUG("Deleting %s", file.name());
|
||||||
strncpy(buffer, file.name(), sizeof(buffer));
|
strncpy(buffer, file.name(), sizeof(buffer));
|
||||||
file.close();
|
file.close();
|
||||||
FSCom.remove(buffer);
|
FSCom.remove(buffer);
|
||||||
} else {
|
} else {
|
||||||
LOG_DEBUG(" %s (%i Bytes)\n", file.name(), file.size());
|
LOG_DEBUG(" %s (%i Bytes)", file.name(), file.size());
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
LOG_DEBUG(" %s (%i Bytes)\n", file.name(), file.size());
|
LOG_DEBUG(" %s (%i Bytes)", file.name(), file.size());
|
||||||
file.close();
|
file.close();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -284,7 +284,7 @@ void listDir(const char *dirname, uint8_t levels, bool del)
|
|||||||
}
|
}
|
||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32
|
||||||
if (del) {
|
if (del) {
|
||||||
LOG_DEBUG("Removing %s\n", root.path());
|
LOG_DEBUG("Removing %s", root.path());
|
||||||
strncpy(buffer, root.path(), sizeof(buffer));
|
strncpy(buffer, root.path(), sizeof(buffer));
|
||||||
root.close();
|
root.close();
|
||||||
FSCom.rmdir(buffer);
|
FSCom.rmdir(buffer);
|
||||||
@@ -293,7 +293,7 @@ void listDir(const char *dirname, uint8_t levels, bool del)
|
|||||||
}
|
}
|
||||||
#elif (defined(ARCH_RP2040) || defined(ARCH_PORTDUINO))
|
#elif (defined(ARCH_RP2040) || defined(ARCH_PORTDUINO))
|
||||||
if (del) {
|
if (del) {
|
||||||
LOG_DEBUG("Removing %s\n", root.name());
|
LOG_DEBUG("Removing %s", root.name());
|
||||||
strncpy(buffer, root.name(), sizeof(buffer));
|
strncpy(buffer, root.name(), sizeof(buffer));
|
||||||
root.close();
|
root.close();
|
||||||
FSCom.rmdir(buffer);
|
FSCom.rmdir(buffer);
|
||||||
@@ -329,13 +329,13 @@ void fsInit()
|
|||||||
{
|
{
|
||||||
#ifdef FSCom
|
#ifdef FSCom
|
||||||
if (!FSBegin()) {
|
if (!FSBegin()) {
|
||||||
LOG_ERROR("Filesystem mount Failed.\n");
|
LOG_ERROR("Filesystem mount Failed.");
|
||||||
// assert(0); This auto-formats the partition, so no need to fail here.
|
// assert(0); This auto-formats the partition, so no need to fail here.
|
||||||
}
|
}
|
||||||
#if defined(ARCH_ESP32)
|
#if defined(ARCH_ESP32)
|
||||||
LOG_DEBUG("Filesystem files (%d/%d Bytes):\n", FSCom.usedBytes(), FSCom.totalBytes());
|
LOG_DEBUG("Filesystem files (%d/%d Bytes):", FSCom.usedBytes(), FSCom.totalBytes());
|
||||||
#else
|
#else
|
||||||
LOG_DEBUG("Filesystem files:\n");
|
LOG_DEBUG("Filesystem files:");
|
||||||
#endif
|
#endif
|
||||||
listDir("/", 10);
|
listDir("/", 10);
|
||||||
#endif
|
#endif
|
||||||
@@ -350,28 +350,28 @@ void setupSDCard()
|
|||||||
SDHandler.begin(SPI_SCK, SPI_MISO, SPI_MOSI);
|
SDHandler.begin(SPI_SCK, SPI_MISO, SPI_MOSI);
|
||||||
|
|
||||||
if (!SD.begin(SDCARD_CS, SDHandler)) {
|
if (!SD.begin(SDCARD_CS, SDHandler)) {
|
||||||
LOG_DEBUG("No SD_MMC card detected\n");
|
LOG_DEBUG("No SD_MMC card detected");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint8_t cardType = SD.cardType();
|
uint8_t cardType = SD.cardType();
|
||||||
if (cardType == CARD_NONE) {
|
if (cardType == CARD_NONE) {
|
||||||
LOG_DEBUG("No SD_MMC card attached\n");
|
LOG_DEBUG("No SD_MMC card attached");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LOG_DEBUG("SD_MMC Card Type: ");
|
LOG_DEBUG("SD_MMC Card Type: ");
|
||||||
if (cardType == CARD_MMC) {
|
if (cardType == CARD_MMC) {
|
||||||
LOG_DEBUG("MMC\n");
|
LOG_DEBUG("MMC");
|
||||||
} else if (cardType == CARD_SD) {
|
} else if (cardType == CARD_SD) {
|
||||||
LOG_DEBUG("SDSC\n");
|
LOG_DEBUG("SDSC");
|
||||||
} else if (cardType == CARD_SDHC) {
|
} else if (cardType == CARD_SDHC) {
|
||||||
LOG_DEBUG("SDHC\n");
|
LOG_DEBUG("SDHC");
|
||||||
} else {
|
} else {
|
||||||
LOG_DEBUG("UNKNOWN\n");
|
LOG_DEBUG("UNKNOWN");
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t cardSize = SD.cardSize() / (1024 * 1024);
|
uint64_t cardSize = SD.cardSize() / (1024 * 1024);
|
||||||
LOG_DEBUG("SD Card Size: %lluMB\n", cardSize);
|
LOG_DEBUG("SD Card Size: %lu MB", (uint32_t)cardSize);
|
||||||
LOG_DEBUG("Total space: %llu MB\n", SD.totalBytes() / (1024 * 1024));
|
LOG_DEBUG("Total space: %lu MB", (uint32_t)(SD.totalBytes() / (1024 * 1024)));
|
||||||
LOG_DEBUG("Used space: %llu MB\n", SD.usedBytes() / (1024 * 1024));
|
LOG_DEBUG("Used space: %lu MB", (uint32_t)(SD.usedBytes() / (1024 * 1024)));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ class GPSStatus : public Status
|
|||||||
{
|
{
|
||||||
if (config.position.fixed_position) {
|
if (config.position.fixed_position) {
|
||||||
#ifdef GPS_EXTRAVERBOSE
|
#ifdef GPS_EXTRAVERBOSE
|
||||||
LOG_WARN("Using fixed latitude\n");
|
LOG_WARN("Using fixed latitude");
|
||||||
#endif
|
#endif
|
||||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum());
|
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum());
|
||||||
return node->position.latitude_i;
|
return node->position.latitude_i;
|
||||||
@@ -64,7 +64,7 @@ class GPSStatus : public Status
|
|||||||
{
|
{
|
||||||
if (config.position.fixed_position) {
|
if (config.position.fixed_position) {
|
||||||
#ifdef GPS_EXTRAVERBOSE
|
#ifdef GPS_EXTRAVERBOSE
|
||||||
LOG_WARN("Using fixed longitude\n");
|
LOG_WARN("Using fixed longitude");
|
||||||
#endif
|
#endif
|
||||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum());
|
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum());
|
||||||
return node->position.longitude_i;
|
return node->position.longitude_i;
|
||||||
@@ -77,7 +77,7 @@ class GPSStatus : public Status
|
|||||||
{
|
{
|
||||||
if (config.position.fixed_position) {
|
if (config.position.fixed_position) {
|
||||||
#ifdef GPS_EXTRAVERBOSE
|
#ifdef GPS_EXTRAVERBOSE
|
||||||
LOG_WARN("Using fixed altitude\n");
|
LOG_WARN("Using fixed altitude");
|
||||||
#endif
|
#endif
|
||||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum());
|
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeDB->getNodeNum());
|
||||||
return node->position.altitude;
|
return node->position.altitude;
|
||||||
@@ -95,7 +95,7 @@ class GPSStatus : public Status
|
|||||||
bool matches(const GPSStatus *newStatus) const
|
bool matches(const GPSStatus *newStatus) const
|
||||||
{
|
{
|
||||||
#ifdef GPS_EXTRAVERBOSE
|
#ifdef GPS_EXTRAVERBOSE
|
||||||
LOG_DEBUG("GPSStatus.match() new pos@%x to old pos@%x\n", newStatus->p.timestamp, p.timestamp);
|
LOG_DEBUG("GPSStatus.match() new pos@%x to old pos@%x", newStatus->p.timestamp, p.timestamp);
|
||||||
#endif
|
#endif
|
||||||
return (newStatus->hasLock != hasLock || newStatus->isConnected != isConnected ||
|
return (newStatus->hasLock != hasLock || newStatus->isConnected != isConnected ||
|
||||||
newStatus->isPowerSaving != isPowerSaving || newStatus->p.latitude_i != p.latitude_i ||
|
newStatus->isPowerSaving != isPowerSaving || newStatus->p.latitude_i != p.latitude_i ||
|
||||||
@@ -112,7 +112,7 @@ class GPSStatus : public Status
|
|||||||
|
|
||||||
if (isDirty && p.timestamp && (newStatus->p.timestamp == p.timestamp)) {
|
if (isDirty && p.timestamp && (newStatus->p.timestamp == p.timestamp)) {
|
||||||
// We can NEVER be in two locations at the same time! (also PR #886)
|
// We can NEVER be in two locations at the same time! (also PR #886)
|
||||||
LOG_ERROR("BUG: Positional timestamp unchanged from prev solution\n");
|
LOG_ERROR("BUG: Positional timestamp unchanged from prev solution");
|
||||||
}
|
}
|
||||||
|
|
||||||
initialized = true;
|
initialized = true;
|
||||||
@@ -124,11 +124,11 @@ class GPSStatus : public Status
|
|||||||
if (isDirty) {
|
if (isDirty) {
|
||||||
if (hasLock) {
|
if (hasLock) {
|
||||||
// In debug logs, identify position by @timestamp:stage (stage 3 = notify)
|
// In debug logs, identify position by @timestamp:stage (stage 3 = notify)
|
||||||
LOG_DEBUG("New GPS pos@%x:3 lat=%f lon=%f alt=%d pdop=%.2f track=%.2f speed=%.2f sats=%d\n", p.timestamp,
|
LOG_DEBUG("New GPS pos@%x:3 lat=%f lon=%f alt=%d pdop=%.2f track=%.2f speed=%.2f sats=%d", p.timestamp,
|
||||||
p.latitude_i * 1e-7, p.longitude_i * 1e-7, p.altitude, p.PDOP * 1e-2, p.ground_track * 1e-5,
|
p.latitude_i * 1e-7, p.longitude_i * 1e-7, p.altitude, p.PDOP * 1e-2, p.ground_track * 1e-5,
|
||||||
p.ground_speed * 1e-2, p.sats_in_view);
|
p.ground_speed * 1e-2, p.sats_in_view);
|
||||||
} else {
|
} else {
|
||||||
LOG_DEBUG("No GPS lock\n");
|
LOG_DEBUG("No GPS lock");
|
||||||
}
|
}
|
||||||
onNewStatus.notifyObservers(this);
|
onNewStatus.notifyObservers(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ void GpioVirtPin::set(bool value)
|
|||||||
|
|
||||||
void GpioHwPin::set(bool value)
|
void GpioHwPin::set(bool value)
|
||||||
{
|
{
|
||||||
// if (num == 3) LOG_DEBUG("Setting pin %d to %d\n", num, value);
|
// if (num == 3) LOG_DEBUG("Setting pin %d to %d", num, value);
|
||||||
pinMode(num, OUTPUT);
|
pinMode(num, OUTPUT);
|
||||||
digitalWrite(num, value);
|
digitalWrite(num, value);
|
||||||
}
|
}
|
||||||
@@ -88,7 +88,7 @@ void GpioBinaryTransformer::update()
|
|||||||
newValue = (GpioVirtPin::PinState)(p1 && p2);
|
newValue = (GpioVirtPin::PinState)(p1 && p2);
|
||||||
break;
|
break;
|
||||||
case Or:
|
case Or:
|
||||||
// LOG_DEBUG("Doing GPIO OR\n");
|
// LOG_DEBUG("Doing GPIO OR");
|
||||||
newValue = (GpioVirtPin::PinState)(p1 || p2);
|
newValue = (GpioVirtPin::PinState)(p1 || p2);
|
||||||
break;
|
break;
|
||||||
case Xor:
|
case Xor:
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class NodeStatus : public Status
|
|||||||
numTotal = newStatus->getNumTotal();
|
numTotal = newStatus->getNumTotal();
|
||||||
}
|
}
|
||||||
if (isDirty || newStatus->forceUpdate) {
|
if (isDirty || newStatus->forceUpdate) {
|
||||||
LOG_DEBUG("Node status update: %d online, %d total\n", numOnline, numTotal);
|
LOG_DEBUG("Node status update: %d online, %d total", numOnline, numTotal);
|
||||||
onNewStatus.notifyObservers(this);
|
onNewStatus.notifyObservers(this);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
193
src/Power.cpp
@@ -13,6 +13,7 @@
|
|||||||
#include "power.h"
|
#include "power.h"
|
||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "PowerFSM.h"
|
#include "PowerFSM.h"
|
||||||
|
#include "Throttle.h"
|
||||||
#include "buzz/buzz.h"
|
#include "buzz/buzz.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
@@ -30,6 +31,7 @@
|
|||||||
#if HAS_WIFI
|
#if HAS_WIFI
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DELAY_FOREVER
|
#ifndef DELAY_FOREVER
|
||||||
@@ -75,6 +77,15 @@ INA219Sensor ina219Sensor;
|
|||||||
INA3221Sensor ina3221Sensor;
|
INA3221Sensor ina3221Sensor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !MESHTASTIC_EXCLUDE_I2C && !defined(ARCH_PORTDUINO) && !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)
|
||||||
|
MAX17048Sensor max17048Sensor;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HAS_RAKPROT && !defined(ARCH_PORTDUINO)
|
#if HAS_RAKPROT && !defined(ARCH_PORTDUINO)
|
||||||
RAK9154Sensor rak9154Sensor;
|
RAK9154Sensor rak9154Sensor;
|
||||||
#endif
|
#endif
|
||||||
@@ -136,6 +147,8 @@ using namespace meshtastic;
|
|||||||
*/
|
*/
|
||||||
static HasBatteryLevel *batteryLevel; // Default to NULL for no battery level sensor
|
static HasBatteryLevel *batteryLevel; // Default to NULL for no battery level sensor
|
||||||
|
|
||||||
|
#ifdef BATTERY_PIN
|
||||||
|
|
||||||
static void adcEnable()
|
static void adcEnable()
|
||||||
{
|
{
|
||||||
#ifdef ADC_CTRL // enable adc voltage divider when we need to read
|
#ifdef ADC_CTRL // enable adc voltage divider when we need to read
|
||||||
@@ -160,11 +173,14 @@ static void adcDisable()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple battery level sensor that assumes the battery voltage is attached via a voltage-divider to an analog input
|
* A simple battery level sensor that assumes the battery voltage is attached via a voltage-divider to an analog input
|
||||||
*/
|
*/
|
||||||
class AnalogBatteryLevel : public HasBatteryLevel
|
class AnalogBatteryLevel : public HasBatteryLevel
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
/**
|
/**
|
||||||
* Battery state of charge, from 0 to 100 or -1 for unknown
|
* Battery state of charge, from 0 to 100 or -1 for unknown
|
||||||
*/
|
*/
|
||||||
@@ -224,7 +240,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
#if HAS_TELEMETRY && !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !defined(HAS_PMU) && \
|
#if HAS_TELEMETRY && !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !defined(HAS_PMU) && \
|
||||||
!MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
!MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
|
||||||
if (hasINA()) {
|
if (hasINA()) {
|
||||||
LOG_DEBUG("Using INA on I2C addr 0x%x for device battery voltage\n", config.power.device_battery_ina_address);
|
LOG_DEBUG("Using INA on I2C addr 0x%x for device battery voltage", config.power.device_battery_ina_address);
|
||||||
return getINAVoltage();
|
return getINAVoltage();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -244,7 +260,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
config.power.adc_multiplier_override > 0 ? config.power.adc_multiplier_override : ADC_MULTIPLIER;
|
config.power.adc_multiplier_override > 0 ? config.power.adc_multiplier_override : ADC_MULTIPLIER;
|
||||||
// Do not call analogRead() often.
|
// Do not call analogRead() often.
|
||||||
const uint32_t min_read_interval = 5000;
|
const uint32_t min_read_interval = 5000;
|
||||||
if (millis() - last_read_time_ms > min_read_interval) {
|
if (!Throttle::isWithinTimespanMs(last_read_time_ms, min_read_interval)) {
|
||||||
last_read_time_ms = millis();
|
last_read_time_ms = millis();
|
||||||
|
|
||||||
uint32_t raw = 0;
|
uint32_t raw = 0;
|
||||||
@@ -274,7 +290,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
last_read_value += (scaled - last_read_value) * 0.5; // Virtual LPF
|
last_read_value += (scaled - last_read_value) * 0.5; // Virtual LPF
|
||||||
}
|
}
|
||||||
|
|
||||||
// LOG_DEBUG("battery gpio %d raw val=%u scaled=%u filtered=%u\n", BATTERY_PIN, raw, (uint32_t)(scaled), (uint32_t)
|
// LOG_DEBUG("battery gpio %d raw val=%u scaled=%u filtered=%u", BATTERY_PIN, raw, (uint32_t)(scaled), (uint32_t)
|
||||||
// (last_read_value));
|
// (last_read_value));
|
||||||
}
|
}
|
||||||
return last_read_value;
|
return last_read_value;
|
||||||
@@ -319,7 +335,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
raw += adc_buf;
|
raw += adc_buf;
|
||||||
raw_c++; // Count valid samples
|
raw_c++; // Count valid samples
|
||||||
} else {
|
} else {
|
||||||
LOG_DEBUG("An attempt to sample ADC2 failed\n");
|
LOG_DEBUG("An attempt to sample ADC2 failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -479,7 +495,7 @@ bool Power::analogInit()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BATTERY_PIN
|
#ifdef BATTERY_PIN
|
||||||
LOG_DEBUG("Using analog input %d for battery level\n", BATTERY_PIN);
|
LOG_DEBUG("Using analog input %d for battery level", BATTERY_PIN);
|
||||||
|
|
||||||
// disable any internal pullups
|
// disable any internal pullups
|
||||||
pinMode(BATTERY_PIN, INPUT);
|
pinMode(BATTERY_PIN, INPUT);
|
||||||
@@ -510,18 +526,18 @@ bool Power::analogInit()
|
|||||||
esp_adc_cal_value_t val_type = esp_adc_cal_characterize(unit, atten, width, DEFAULT_VREF, adc_characs);
|
esp_adc_cal_value_t val_type = esp_adc_cal_characterize(unit, atten, width, DEFAULT_VREF, adc_characs);
|
||||||
// show ADC characterization base
|
// show ADC characterization base
|
||||||
if (val_type == ESP_ADC_CAL_VAL_EFUSE_TP) {
|
if (val_type == ESP_ADC_CAL_VAL_EFUSE_TP) {
|
||||||
LOG_INFO("ADCmod: ADC characterization based on Two Point values stored in eFuse\n");
|
LOG_INFO("ADCmod: ADC characterization based on Two Point values stored in eFuse");
|
||||||
} else if (val_type == ESP_ADC_CAL_VAL_EFUSE_VREF) {
|
} else if (val_type == ESP_ADC_CAL_VAL_EFUSE_VREF) {
|
||||||
LOG_INFO("ADCmod: ADC characterization based on reference voltage stored in eFuse\n");
|
LOG_INFO("ADCmod: ADC characterization based on reference voltage stored in eFuse");
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_IDF_TARGET_ESP32S3
|
#ifdef CONFIG_IDF_TARGET_ESP32S3
|
||||||
// ESP32S3
|
// ESP32S3
|
||||||
else if (val_type == ESP_ADC_CAL_VAL_EFUSE_TP_FIT) {
|
else if (val_type == ESP_ADC_CAL_VAL_EFUSE_TP_FIT) {
|
||||||
LOG_INFO("ADCmod: ADC Characterization based on Two Point values and fitting curve coefficients stored in eFuse\n");
|
LOG_INFO("ADCmod: ADC Characterization based on Two Point values and fitting curve coefficients stored in eFuse");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
LOG_INFO("ADCmod: ADC characterization based on default reference voltage\n");
|
LOG_INFO("ADCmod: ADC characterization based on default reference voltage");
|
||||||
}
|
}
|
||||||
#endif // ARCH_ESP32
|
#endif // ARCH_ESP32
|
||||||
|
|
||||||
@@ -551,7 +567,12 @@ bool Power::analogInit()
|
|||||||
*/
|
*/
|
||||||
bool Power::setup()
|
bool Power::setup()
|
||||||
{
|
{
|
||||||
bool found = axpChipInit() || analogInit();
|
// initialise one power sensor (only)
|
||||||
|
bool found = axpChipInit();
|
||||||
|
if (!found)
|
||||||
|
found = lipoInit();
|
||||||
|
if (!found)
|
||||||
|
found = analogInit();
|
||||||
|
|
||||||
#ifdef NRF_APM
|
#ifdef NRF_APM
|
||||||
found = true;
|
found = true;
|
||||||
@@ -565,9 +586,9 @@ bool Power::setup()
|
|||||||
|
|
||||||
void Power::shutdown()
|
void Power::shutdown()
|
||||||
{
|
{
|
||||||
LOG_INFO("Shutting down\n");
|
LOG_INFO("Shutting down");
|
||||||
|
|
||||||
#if defined(ARCH_NRF52) || defined(ARCH_ESP32)
|
#if defined(ARCH_NRF52) || defined(ARCH_ESP32) || defined(ARCH_RP2040)
|
||||||
#ifdef PIN_LED1
|
#ifdef PIN_LED1
|
||||||
ledOff(PIN_LED1);
|
ledOff(PIN_LED1);
|
||||||
#endif
|
#endif
|
||||||
@@ -620,7 +641,7 @@ void Power::readPowerStatus()
|
|||||||
// changes.
|
// changes.
|
||||||
|
|
||||||
nrfx_power_usb_state_t nrf_usb_state = nrfx_power_usbstatus_get();
|
nrfx_power_usb_state_t nrf_usb_state = nrfx_power_usbstatus_get();
|
||||||
// LOG_DEBUG("NRF Power %d\n", nrf_usb_state);
|
// LOG_DEBUG("NRF Power %d", nrf_usb_state);
|
||||||
|
|
||||||
// If changed to DISCONNECTED
|
// If changed to DISCONNECTED
|
||||||
if (nrf_usb_state == NRFX_POWER_USB_STATE_DISCONNECTED)
|
if (nrf_usb_state == NRFX_POWER_USB_STATE_DISCONNECTED)
|
||||||
@@ -633,22 +654,22 @@ void Power::readPowerStatus()
|
|||||||
|
|
||||||
// Notify any status instances that are observing us
|
// Notify any status instances that are observing us
|
||||||
const PowerStatus powerStatus2 = PowerStatus(hasBattery, usbPowered, isCharging, batteryVoltageMv, batteryChargePercent);
|
const PowerStatus powerStatus2 = PowerStatus(hasBattery, usbPowered, isCharging, batteryVoltageMv, batteryChargePercent);
|
||||||
LOG_DEBUG("Battery: usbPower=%d, isCharging=%d, batMv=%d, batPct=%d\n", powerStatus2.getHasUSB(),
|
LOG_DEBUG("Battery: usbPower=%d, isCharging=%d, batMv=%d, batPct=%d", powerStatus2.getHasUSB(), powerStatus2.getIsCharging(),
|
||||||
powerStatus2.getIsCharging(), powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent());
|
powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent());
|
||||||
newStatus.notifyObservers(&powerStatus2);
|
newStatus.notifyObservers(&powerStatus2);
|
||||||
#ifdef DEBUG_HEAP
|
#ifdef DEBUG_HEAP
|
||||||
if (lastheap != memGet.getFreeHeap()) {
|
if (lastheap != memGet.getFreeHeap()) {
|
||||||
LOG_DEBUG("Threads running:");
|
std::string threadlist = "Threads running:";
|
||||||
int running = 0;
|
int running = 0;
|
||||||
for (int i = 0; i < MAX_THREADS; i++) {
|
for (int i = 0; i < MAX_THREADS; i++) {
|
||||||
auto thread = concurrency::mainController.get(i);
|
auto thread = concurrency::mainController.get(i);
|
||||||
if ((thread != nullptr) && (thread->enabled)) {
|
if ((thread != nullptr) && (thread->enabled)) {
|
||||||
LOG_DEBUG(" %s", thread->ThreadName.c_str());
|
threadlist += vformat(" %s", thread->ThreadName.c_str());
|
||||||
running++;
|
running++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG_DEBUG("\n");
|
LOG_DEBUG(threadlist.c_str());
|
||||||
LOG_DEBUG("Heap status: %d/%d bytes free (%d), running %d/%d threads\n", memGet.getFreeHeap(), memGet.getHeapSize(),
|
LOG_DEBUG("Heap status: %d/%d bytes free (%d), running %d/%d threads", memGet.getFreeHeap(), memGet.getHeapSize(),
|
||||||
memGet.getFreeHeap() - lastheap, running, concurrency::mainController.size(false));
|
memGet.getFreeHeap() - lastheap, running, concurrency::mainController.size(false));
|
||||||
lastheap = memGet.getFreeHeap();
|
lastheap = memGet.getFreeHeap();
|
||||||
}
|
}
|
||||||
@@ -681,13 +702,13 @@ void Power::readPowerStatus()
|
|||||||
if (batteryLevel && powerStatus2.getHasBattery() && !powerStatus2.getHasUSB()) {
|
if (batteryLevel && powerStatus2.getHasBattery() && !powerStatus2.getHasUSB()) {
|
||||||
if (batteryLevel->getBattVoltage() < OCV[NUM_OCV_POINTS - 1]) {
|
if (batteryLevel->getBattVoltage() < OCV[NUM_OCV_POINTS - 1]) {
|
||||||
low_voltage_counter++;
|
low_voltage_counter++;
|
||||||
LOG_DEBUG("Low voltage counter: %d/10\n", low_voltage_counter);
|
LOG_DEBUG("Low voltage counter: %d/10", low_voltage_counter);
|
||||||
if (low_voltage_counter > 10) {
|
if (low_voltage_counter > 10) {
|
||||||
#ifdef ARCH_NRF52
|
#ifdef ARCH_NRF52
|
||||||
// We can't trigger deep sleep on NRF52, it's freezing the board
|
// We can't trigger deep sleep on NRF52, it's freezing the board
|
||||||
LOG_DEBUG("Low voltage detected, but not triggering deep sleep\n");
|
LOG_DEBUG("Low voltage detected, but not triggering deep sleep");
|
||||||
#else
|
#else
|
||||||
LOG_INFO("Low voltage detected, triggering deep sleep\n");
|
LOG_INFO("Low voltage detected, triggering deep sleep");
|
||||||
powerFSM.trigger(EVENT_LOW_BATTERY);
|
powerFSM.trigger(EVENT_LOW_BATTERY);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -709,12 +730,12 @@ int32_t Power::runOnce()
|
|||||||
PMU->getIrqStatus();
|
PMU->getIrqStatus();
|
||||||
|
|
||||||
if (PMU->isVbusRemoveIrq()) {
|
if (PMU->isVbusRemoveIrq()) {
|
||||||
LOG_INFO("USB unplugged\n");
|
LOG_INFO("USB unplugged");
|
||||||
powerFSM.trigger(EVENT_POWER_DISCONNECTED);
|
powerFSM.trigger(EVENT_POWER_DISCONNECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PMU->isVbusInsertIrq()) {
|
if (PMU->isVbusInsertIrq()) {
|
||||||
LOG_INFO("USB plugged In\n");
|
LOG_INFO("USB plugged In");
|
||||||
powerFSM.trigger(EVENT_POWER_CONNECTED);
|
powerFSM.trigger(EVENT_POWER_CONNECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -722,21 +743,21 @@ int32_t Power::runOnce()
|
|||||||
Other things we could check if we cared...
|
Other things we could check if we cared...
|
||||||
|
|
||||||
if (PMU->isBatChagerStartIrq()) {
|
if (PMU->isBatChagerStartIrq()) {
|
||||||
LOG_DEBUG("Battery start charging\n");
|
LOG_DEBUG("Battery start charging");
|
||||||
}
|
}
|
||||||
if (PMU->isBatChagerDoneIrq()) {
|
if (PMU->isBatChagerDoneIrq()) {
|
||||||
LOG_DEBUG("Battery fully charged\n");
|
LOG_DEBUG("Battery fully charged");
|
||||||
}
|
}
|
||||||
if (PMU->isBatInsertIrq()) {
|
if (PMU->isBatInsertIrq()) {
|
||||||
LOG_DEBUG("Battery inserted\n");
|
LOG_DEBUG("Battery inserted");
|
||||||
}
|
}
|
||||||
if (PMU->isBatRemoveIrq()) {
|
if (PMU->isBatRemoveIrq()) {
|
||||||
LOG_DEBUG("Battery removed\n");
|
LOG_DEBUG("Battery removed");
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
#ifndef T_WATCH_S3 // FIXME - why is this triggering on the T-Watch S3?
|
#ifndef T_WATCH_S3 // FIXME - why is this triggering on the T-Watch S3?
|
||||||
if (PMU->isPekeyLongPressIrq()) {
|
if (PMU->isPekeyLongPressIrq()) {
|
||||||
LOG_DEBUG("PEK long button press\n");
|
LOG_DEBUG("PEK long button press");
|
||||||
screen->setOn(false);
|
screen->setOn(false);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -779,22 +800,22 @@ bool Power::axpChipInit()
|
|||||||
if (!PMU) {
|
if (!PMU) {
|
||||||
PMU = new XPowersAXP2101(*w);
|
PMU = new XPowersAXP2101(*w);
|
||||||
if (!PMU->init()) {
|
if (!PMU->init()) {
|
||||||
LOG_WARN("Failed to find AXP2101 power management\n");
|
LOG_WARN("Failed to find AXP2101 power management");
|
||||||
delete PMU;
|
delete PMU;
|
||||||
PMU = NULL;
|
PMU = NULL;
|
||||||
} else {
|
} else {
|
||||||
LOG_INFO("AXP2101 PMU init succeeded, using AXP2101 PMU\n");
|
LOG_INFO("AXP2101 PMU init succeeded, using AXP2101 PMU");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PMU) {
|
if (!PMU) {
|
||||||
PMU = new XPowersAXP192(*w);
|
PMU = new XPowersAXP192(*w);
|
||||||
if (!PMU->init()) {
|
if (!PMU->init()) {
|
||||||
LOG_WARN("Failed to find AXP192 power management\n");
|
LOG_WARN("Failed to find AXP192 power management");
|
||||||
delete PMU;
|
delete PMU;
|
||||||
PMU = NULL;
|
PMU = NULL;
|
||||||
} else {
|
} else {
|
||||||
LOG_INFO("AXP192 PMU init succeeded, using AXP192 PMU\n");
|
LOG_INFO("AXP192 PMU init succeeded, using AXP192 PMU");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -950,56 +971,54 @@ bool Power::axpChipInit()
|
|||||||
PMU->enableVbusVoltageMeasure();
|
PMU->enableVbusVoltageMeasure();
|
||||||
PMU->enableBattVoltageMeasure();
|
PMU->enableBattVoltageMeasure();
|
||||||
|
|
||||||
LOG_DEBUG("=======================================================================\n");
|
|
||||||
if (PMU->isChannelAvailable(XPOWERS_DCDC1)) {
|
if (PMU->isChannelAvailable(XPOWERS_DCDC1)) {
|
||||||
LOG_DEBUG("DC1 : %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_DCDC1) ? "+" : "-",
|
LOG_DEBUG("DC1 : %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_DCDC1) ? "+" : "-",
|
||||||
PMU->getPowerChannelVoltage(XPOWERS_DCDC1));
|
PMU->getPowerChannelVoltage(XPOWERS_DCDC1));
|
||||||
}
|
}
|
||||||
if (PMU->isChannelAvailable(XPOWERS_DCDC2)) {
|
if (PMU->isChannelAvailable(XPOWERS_DCDC2)) {
|
||||||
LOG_DEBUG("DC2 : %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_DCDC2) ? "+" : "-",
|
LOG_DEBUG("DC2 : %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_DCDC2) ? "+" : "-",
|
||||||
PMU->getPowerChannelVoltage(XPOWERS_DCDC2));
|
PMU->getPowerChannelVoltage(XPOWERS_DCDC2));
|
||||||
}
|
}
|
||||||
if (PMU->isChannelAvailable(XPOWERS_DCDC3)) {
|
if (PMU->isChannelAvailable(XPOWERS_DCDC3)) {
|
||||||
LOG_DEBUG("DC3 : %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_DCDC3) ? "+" : "-",
|
LOG_DEBUG("DC3 : %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_DCDC3) ? "+" : "-",
|
||||||
PMU->getPowerChannelVoltage(XPOWERS_DCDC3));
|
PMU->getPowerChannelVoltage(XPOWERS_DCDC3));
|
||||||
}
|
}
|
||||||
if (PMU->isChannelAvailable(XPOWERS_DCDC4)) {
|
if (PMU->isChannelAvailable(XPOWERS_DCDC4)) {
|
||||||
LOG_DEBUG("DC4 : %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_DCDC4) ? "+" : "-",
|
LOG_DEBUG("DC4 : %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_DCDC4) ? "+" : "-",
|
||||||
PMU->getPowerChannelVoltage(XPOWERS_DCDC4));
|
PMU->getPowerChannelVoltage(XPOWERS_DCDC4));
|
||||||
}
|
}
|
||||||
if (PMU->isChannelAvailable(XPOWERS_LDO2)) {
|
if (PMU->isChannelAvailable(XPOWERS_LDO2)) {
|
||||||
LOG_DEBUG("LDO2 : %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_LDO2) ? "+" : "-",
|
LOG_DEBUG("LDO2 : %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_LDO2) ? "+" : "-",
|
||||||
PMU->getPowerChannelVoltage(XPOWERS_LDO2));
|
PMU->getPowerChannelVoltage(XPOWERS_LDO2));
|
||||||
}
|
}
|
||||||
if (PMU->isChannelAvailable(XPOWERS_LDO3)) {
|
if (PMU->isChannelAvailable(XPOWERS_LDO3)) {
|
||||||
LOG_DEBUG("LDO3 : %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_LDO3) ? "+" : "-",
|
LOG_DEBUG("LDO3 : %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_LDO3) ? "+" : "-",
|
||||||
PMU->getPowerChannelVoltage(XPOWERS_LDO3));
|
PMU->getPowerChannelVoltage(XPOWERS_LDO3));
|
||||||
}
|
}
|
||||||
if (PMU->isChannelAvailable(XPOWERS_ALDO1)) {
|
if (PMU->isChannelAvailable(XPOWERS_ALDO1)) {
|
||||||
LOG_DEBUG("ALDO1: %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_ALDO1) ? "+" : "-",
|
LOG_DEBUG("ALDO1: %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_ALDO1) ? "+" : "-",
|
||||||
PMU->getPowerChannelVoltage(XPOWERS_ALDO1));
|
PMU->getPowerChannelVoltage(XPOWERS_ALDO1));
|
||||||
}
|
}
|
||||||
if (PMU->isChannelAvailable(XPOWERS_ALDO2)) {
|
if (PMU->isChannelAvailable(XPOWERS_ALDO2)) {
|
||||||
LOG_DEBUG("ALDO2: %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_ALDO2) ? "+" : "-",
|
LOG_DEBUG("ALDO2: %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_ALDO2) ? "+" : "-",
|
||||||
PMU->getPowerChannelVoltage(XPOWERS_ALDO2));
|
PMU->getPowerChannelVoltage(XPOWERS_ALDO2));
|
||||||
}
|
}
|
||||||
if (PMU->isChannelAvailable(XPOWERS_ALDO3)) {
|
if (PMU->isChannelAvailable(XPOWERS_ALDO3)) {
|
||||||
LOG_DEBUG("ALDO3: %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_ALDO3) ? "+" : "-",
|
LOG_DEBUG("ALDO3: %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_ALDO3) ? "+" : "-",
|
||||||
PMU->getPowerChannelVoltage(XPOWERS_ALDO3));
|
PMU->getPowerChannelVoltage(XPOWERS_ALDO3));
|
||||||
}
|
}
|
||||||
if (PMU->isChannelAvailable(XPOWERS_ALDO4)) {
|
if (PMU->isChannelAvailable(XPOWERS_ALDO4)) {
|
||||||
LOG_DEBUG("ALDO4: %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_ALDO4) ? "+" : "-",
|
LOG_DEBUG("ALDO4: %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_ALDO4) ? "+" : "-",
|
||||||
PMU->getPowerChannelVoltage(XPOWERS_ALDO4));
|
PMU->getPowerChannelVoltage(XPOWERS_ALDO4));
|
||||||
}
|
}
|
||||||
if (PMU->isChannelAvailable(XPOWERS_BLDO1)) {
|
if (PMU->isChannelAvailable(XPOWERS_BLDO1)) {
|
||||||
LOG_DEBUG("BLDO1: %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_BLDO1) ? "+" : "-",
|
LOG_DEBUG("BLDO1: %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_BLDO1) ? "+" : "-",
|
||||||
PMU->getPowerChannelVoltage(XPOWERS_BLDO1));
|
PMU->getPowerChannelVoltage(XPOWERS_BLDO1));
|
||||||
}
|
}
|
||||||
if (PMU->isChannelAvailable(XPOWERS_BLDO2)) {
|
if (PMU->isChannelAvailable(XPOWERS_BLDO2)) {
|
||||||
LOG_DEBUG("BLDO2: %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_BLDO2) ? "+" : "-",
|
LOG_DEBUG("BLDO2: %s Voltage:%u mV ", PMU->isPowerChannelEnable(XPOWERS_BLDO2) ? "+" : "-",
|
||||||
PMU->getPowerChannelVoltage(XPOWERS_BLDO2));
|
PMU->getPowerChannelVoltage(XPOWERS_BLDO2));
|
||||||
}
|
}
|
||||||
LOG_DEBUG("=======================================================================\n");
|
|
||||||
|
|
||||||
// We can safely ignore this approach for most (or all) boards because MCU turned off
|
// We can safely ignore this approach for most (or all) boards because MCU turned off
|
||||||
// earlier than battery discharged to 2.6V.
|
// earlier than battery discharged to 2.6V.
|
||||||
@@ -1042,4 +1061,82 @@ bool Power::axpChipInit()
|
|||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !MESHTASTIC_EXCLUDE_I2C && !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper class for an I2C MAX17048 Lipo battery sensor.
|
||||||
|
*/
|
||||||
|
class LipoBatteryLevel : public HasBatteryLevel
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
MAX17048Singleton *max17048 = nullptr;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Init the I2C MAX17048 Lipo battery level sensor
|
||||||
|
*/
|
||||||
|
bool runOnce()
|
||||||
|
{
|
||||||
|
if (max17048 == nullptr) {
|
||||||
|
max17048 = MAX17048Singleton::GetInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
// try to start if the sensor has been detected
|
||||||
|
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_MAX17048].first != 0) {
|
||||||
|
return max17048->runOnce(nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_MAX17048].second);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Battery state of charge, from 0 to 100 or -1 for unknown
|
||||||
|
*/
|
||||||
|
virtual int getBatteryPercent() override { return max17048->getBusBatteryPercent(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The raw voltage of the battery in millivolts, or NAN if unknown
|
||||||
|
*/
|
||||||
|
virtual uint16_t getBattVoltage() override { return max17048->getBusVoltageMv(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return true if there is a battery installed in this unit
|
||||||
|
*/
|
||||||
|
virtual bool isBatteryConnect() override { return max17048->isBatteryConnected(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return true if there is an external power source detected
|
||||||
|
*/
|
||||||
|
virtual bool isVbusIn() override { return max17048->isExternallyPowered(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return true if the battery is currently charging
|
||||||
|
*/
|
||||||
|
virtual bool isCharging() override { return max17048->isBatteryCharging(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
LipoBatteryLevel lipoLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init the Lipo battery level sensor
|
||||||
|
*/
|
||||||
|
bool Power::lipoInit()
|
||||||
|
{
|
||||||
|
bool result = lipoLevel.runOnce();
|
||||||
|
LOG_DEBUG("Power::lipoInit lipo sensor is %s", result ? "ready" : "not ready yet");
|
||||||
|
if (!result)
|
||||||
|
return false;
|
||||||
|
batteryLevel = &lipoLevel;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
/**
|
||||||
|
* The Lipo battery level sensor is unavailable - default to AnalogBatteryLevel
|
||||||
|
*/
|
||||||
|
bool Power::lipoInit()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -53,7 +53,7 @@ static bool isPowered()
|
|||||||
|
|
||||||
static void sdsEnter()
|
static void sdsEnter()
|
||||||
{
|
{
|
||||||
LOG_DEBUG("Enter state: SDS\n");
|
LOG_DEBUG("Enter state: SDS");
|
||||||
// FIXME - make sure GPS and LORA radio are off first - because we want close to zero current draw
|
// FIXME - make sure GPS and LORA radio are off first - because we want close to zero current draw
|
||||||
doDeepSleep(Default::getConfiguredOrDefaultMs(config.power.sds_secs), false);
|
doDeepSleep(Default::getConfiguredOrDefaultMs(config.power.sds_secs), false);
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@ extern Power *power;
|
|||||||
|
|
||||||
static void shutdownEnter()
|
static void shutdownEnter()
|
||||||
{
|
{
|
||||||
LOG_DEBUG("Enter state: SHUTDOWN\n");
|
LOG_DEBUG("Enter state: SHUTDOWN");
|
||||||
power->shutdown();
|
power->shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,16 +72,16 @@ static uint32_t secsSlept;
|
|||||||
|
|
||||||
static void lsEnter()
|
static void lsEnter()
|
||||||
{
|
{
|
||||||
LOG_INFO("lsEnter begin, ls_secs=%u\n", config.power.ls_secs);
|
LOG_INFO("lsEnter begin, ls_secs=%u", config.power.ls_secs);
|
||||||
screen->setOn(false);
|
screen->setOn(false);
|
||||||
secsSlept = 0; // How long have we been sleeping this time
|
secsSlept = 0; // How long have we been sleeping this time
|
||||||
|
|
||||||
// LOG_INFO("lsEnter end\n");
|
// LOG_INFO("lsEnter end");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lsIdle()
|
static void lsIdle()
|
||||||
{
|
{
|
||||||
// LOG_INFO("lsIdle begin ls_secs=%u\n", getPref_ls_secs());
|
// LOG_INFO("lsIdle begin ls_secs=%u", getPref_ls_secs());
|
||||||
|
|
||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ static void lsIdle()
|
|||||||
wakeCause2 = doLightSleep(100); // leave led on for 1ms
|
wakeCause2 = doLightSleep(100); // leave led on for 1ms
|
||||||
|
|
||||||
secsSlept += sleepTime;
|
secsSlept += sleepTime;
|
||||||
// LOG_INFO("sleeping, flash led!\n");
|
// LOG_INFO("sleeping, flash led!");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ESP_SLEEP_WAKEUP_UART:
|
case ESP_SLEEP_WAKEUP_UART:
|
||||||
@@ -137,7 +137,7 @@ static void lsIdle()
|
|||||||
} else {
|
} else {
|
||||||
// Time to stop sleeping!
|
// Time to stop sleeping!
|
||||||
ledBlink.set(false);
|
ledBlink.set(false);
|
||||||
LOG_INFO("Reached ls_secs, servicing loop()\n");
|
LOG_INFO("Reached ls_secs, servicing loop()");
|
||||||
powerFSM.trigger(EVENT_WAKE_TIMER);
|
powerFSM.trigger(EVENT_WAKE_TIMER);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -145,12 +145,12 @@ static void lsIdle()
|
|||||||
|
|
||||||
static void lsExit()
|
static void lsExit()
|
||||||
{
|
{
|
||||||
LOG_INFO("Exit state: LS\n");
|
LOG_INFO("Exit state: LS");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nbEnter()
|
static void nbEnter()
|
||||||
{
|
{
|
||||||
LOG_DEBUG("Enter state: NB\n");
|
LOG_DEBUG("Enter state: NB");
|
||||||
screen->setOn(false);
|
screen->setOn(false);
|
||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32
|
||||||
// Only ESP32 should turn off bluetooth
|
// Only ESP32 should turn off bluetooth
|
||||||
@@ -168,7 +168,7 @@ static void darkEnter()
|
|||||||
|
|
||||||
static void serialEnter()
|
static void serialEnter()
|
||||||
{
|
{
|
||||||
LOG_DEBUG("Enter state: SERIAL\n");
|
LOG_DEBUG("Enter state: SERIAL");
|
||||||
setBluetoothEnable(false);
|
setBluetoothEnable(false);
|
||||||
screen->setOn(true);
|
screen->setOn(true);
|
||||||
screen->print("Serial connected\n");
|
screen->print("Serial connected\n");
|
||||||
@@ -183,10 +183,10 @@ static void serialExit()
|
|||||||
|
|
||||||
static void powerEnter()
|
static void powerEnter()
|
||||||
{
|
{
|
||||||
// LOG_DEBUG("Enter state: POWER\n");
|
// LOG_DEBUG("Enter state: POWER");
|
||||||
if (!isPowered()) {
|
if (!isPowered()) {
|
||||||
// If we got here, we are in the wrong state - we should be in powered, let that state ahndle things
|
// If we got here, we are in the wrong state - we should be in powered, let that state ahndle things
|
||||||
LOG_INFO("Loss of power in Powered\n");
|
LOG_INFO("Loss of power in Powered");
|
||||||
powerFSM.trigger(EVENT_POWER_DISCONNECTED);
|
powerFSM.trigger(EVENT_POWER_DISCONNECTED);
|
||||||
} else {
|
} else {
|
||||||
screen->setOn(true);
|
screen->setOn(true);
|
||||||
@@ -205,7 +205,7 @@ static void powerIdle()
|
|||||||
{
|
{
|
||||||
if (!isPowered()) {
|
if (!isPowered()) {
|
||||||
// If we got here, we are in the wrong state
|
// If we got here, we are in the wrong state
|
||||||
LOG_INFO("Loss of power in Powered\n");
|
LOG_INFO("Loss of power in Powered");
|
||||||
powerFSM.trigger(EVENT_POWER_DISCONNECTED);
|
powerFSM.trigger(EVENT_POWER_DISCONNECTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -222,7 +222,7 @@ static void powerExit()
|
|||||||
|
|
||||||
static void onEnter()
|
static void onEnter()
|
||||||
{
|
{
|
||||||
LOG_DEBUG("Enter state: ON\n");
|
LOG_DEBUG("Enter state: ON");
|
||||||
screen->setOn(true);
|
screen->setOn(true);
|
||||||
setBluetoothEnable(true);
|
setBluetoothEnable(true);
|
||||||
}
|
}
|
||||||
@@ -242,7 +242,7 @@ static void screenPress()
|
|||||||
|
|
||||||
static void bootEnter()
|
static void bootEnter()
|
||||||
{
|
{
|
||||||
LOG_DEBUG("Enter state: BOOT\n");
|
LOG_DEBUG("Enter state: BOOT");
|
||||||
}
|
}
|
||||||
|
|
||||||
State stateSHUTDOWN(shutdownEnter, NULL, NULL, "SHUTDOWN");
|
State stateSHUTDOWN(shutdownEnter, NULL, NULL, "SHUTDOWN");
|
||||||
@@ -264,7 +264,7 @@ void PowerFSM_setup()
|
|||||||
config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR;
|
config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR;
|
||||||
bool hasPower = isPowered();
|
bool hasPower = isPowered();
|
||||||
|
|
||||||
LOG_INFO("PowerFSM init, USB power=%d\n", hasPower ? 1 : 0);
|
LOG_INFO("PowerFSM init, USB power=%d", hasPower ? 1 : 0);
|
||||||
powerFSM.add_timed_transition(&stateBOOT, hasPower ? &statePOWER : &stateON, 3 * 1000, NULL, "boot timeout");
|
powerFSM.add_timed_transition(&stateBOOT, hasPower ? &statePOWER : &stateON, 3 * 1000, NULL, "boot timeout");
|
||||||
|
|
||||||
// wake timer expired or a packet arrived
|
// wake timer expired or a packet arrived
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ void PowerMon::emitLog(const char *reason)
|
|||||||
{
|
{
|
||||||
#ifdef USE_POWERMON
|
#ifdef USE_POWERMON
|
||||||
// The nrf52 printf doesn't understand 64 bit ints, so if we ever reach that point this function will need to change.
|
// The nrf52 printf doesn't understand 64 bit ints, so if we ever reach that point this function will need to change.
|
||||||
LOG_INFO("S:PM:0x%08lx,%s\n", (uint32_t)states, reason);
|
LOG_INFO("S:PM:0x%08lx,%s", (uint32_t)states, reason);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class PowerStatus : public Status
|
|||||||
isCharging = newStatus->isCharging;
|
isCharging = newStatus->isCharging;
|
||||||
}
|
}
|
||||||
if (isDirty) {
|
if (isDirty) {
|
||||||
// LOG_DEBUG("Battery %dmV %d%%\n", batteryVoltageMv, batteryChargePercent);
|
// LOG_DEBUG("Battery %dmV %d%%", batteryVoltageMv, batteryChargePercent);
|
||||||
onNewStatus.notifyObservers(this);
|
onNewStatus.notifyObservers(this);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -98,81 +98,75 @@ void RedirectablePrint::log_to_serial(const char *logLevel, const char *format,
|
|||||||
{
|
{
|
||||||
size_t r = 0;
|
size_t r = 0;
|
||||||
|
|
||||||
// Cope with 0 len format strings, but look for new line terminator
|
|
||||||
bool hasNewline = *format && format[strlen(format) - 1] == '\n';
|
|
||||||
#ifdef ARCH_PORTDUINO
|
#ifdef ARCH_PORTDUINO
|
||||||
bool color = !settingsMap[ascii_logs];
|
bool color = !settingsMap[ascii_logs];
|
||||||
#else
|
#else
|
||||||
bool color = true;
|
bool color = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// If we are the first message on a report, include the header
|
// include the header
|
||||||
if (!isContinuationMessage) {
|
if (color) {
|
||||||
|
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_DEBUG) == 0)
|
||||||
|
Print::write("\u001b[34m", 6);
|
||||||
|
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_INFO) == 0)
|
||||||
|
Print::write("\u001b[32m", 6);
|
||||||
|
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_WARN) == 0)
|
||||||
|
Print::write("\u001b[33m", 6);
|
||||||
|
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_ERROR) == 0)
|
||||||
|
Print::write("\u001b[31m", 6);
|
||||||
|
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_TRACE) == 0)
|
||||||
|
Print::write("\u001b[35m", 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice, true); // display local time on logfile
|
||||||
|
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
|
||||||
|
#ifdef ARCH_PORTDUINO
|
||||||
|
::printf("%s ", logLevel);
|
||||||
if (color) {
|
if (color) {
|
||||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_DEBUG) == 0)
|
::printf("\u001b[0m");
|
||||||
Print::write("\u001b[34m", 6);
|
|
||||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_INFO) == 0)
|
|
||||||
Print::write("\u001b[32m", 6);
|
|
||||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_WARN) == 0)
|
|
||||||
Print::write("\u001b[33m", 6);
|
|
||||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_ERROR) == 0)
|
|
||||||
Print::write("\u001b[31m", 6);
|
|
||||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_TRACE) == 0)
|
|
||||||
Print::write("\u001b[35m", 6);
|
|
||||||
}
|
}
|
||||||
|
::printf("| %02d:%02d:%02d %u ", hour, min, sec, millis() / 1000);
|
||||||
uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice, true); // display local time on logfile
|
|
||||||
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
|
|
||||||
#ifdef ARCH_PORTDUINO
|
|
||||||
::printf("%s ", logLevel);
|
|
||||||
if (color) {
|
|
||||||
::printf("\u001b[0m");
|
|
||||||
}
|
|
||||||
::printf("| %02d:%02d:%02d %u ", hour, min, sec, millis() / 1000);
|
|
||||||
#else
|
#else
|
||||||
printf("%s ", logLevel);
|
printf("%s ", logLevel);
|
||||||
if (color) {
|
if (color) {
|
||||||
printf("\u001b[0m");
|
printf("\u001b[0m");
|
||||||
}
|
}
|
||||||
printf("| %02d:%02d:%02d %u ", hour, min, sec, millis() / 1000);
|
printf("| %02d:%02d:%02d %u ", hour, min, sec, millis() / 1000);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#ifdef ARCH_PORTDUINO
|
#ifdef ARCH_PORTDUINO
|
||||||
::printf("%s ", logLevel);
|
::printf("%s ", logLevel);
|
||||||
if (color) {
|
if (color) {
|
||||||
::printf("\u001b[0m");
|
::printf("\u001b[0m");
|
||||||
}
|
}
|
||||||
::printf("| ??:??:?? %u ", millis() / 1000);
|
::printf("| ??:??:?? %u ", millis() / 1000);
|
||||||
#else
|
#else
|
||||||
printf("%s ", logLevel);
|
printf("%s ", logLevel);
|
||||||
if (color) {
|
if (color) {
|
||||||
printf("\u001b[0m");
|
printf("\u001b[0m");
|
||||||
}
|
}
|
||||||
printf("| ??:??:?? %u ", millis() / 1000);
|
printf("| ??:??:?? %u ", millis() / 1000);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
auto thread = concurrency::OSThread::currentThread;
|
auto thread = concurrency::OSThread::currentThread;
|
||||||
if (thread) {
|
if (thread) {
|
||||||
print("[");
|
print("[");
|
||||||
// printf("%p ", thread);
|
// printf("%p ", thread);
|
||||||
// assert(thread->ThreadName.length());
|
// assert(thread->ThreadName.length());
|
||||||
print(thread->ThreadName);
|
print(thread->ThreadName);
|
||||||
print("] ");
|
print("] ");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
r += vprintf(logLevel, format, arg);
|
r += vprintf(logLevel, format, arg);
|
||||||
|
|
||||||
isContinuationMessage = !hasNewline;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RedirectablePrint::log_to_syslog(const char *logLevel, const char *format, va_list arg)
|
void RedirectablePrint::log_to_syslog(const char *logLevel, const char *format, va_list arg)
|
||||||
@@ -283,6 +277,14 @@ meshtastic_LogRecord_Level RedirectablePrint::getLogLevel(const char *logLevel)
|
|||||||
|
|
||||||
void RedirectablePrint::log(const char *logLevel, const char *format, ...)
|
void RedirectablePrint::log(const char *logLevel, const char *format, ...)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// append \n to format
|
||||||
|
size_t len = strlen(format);
|
||||||
|
char *newFormat = new char[len + 2];
|
||||||
|
strcpy(newFormat, format);
|
||||||
|
newFormat[len] = '\n';
|
||||||
|
newFormat[len + 1] = '\0';
|
||||||
|
|
||||||
#if ARCH_PORTDUINO
|
#if ARCH_PORTDUINO
|
||||||
// level trace is special, two possible ways to handle it.
|
// level trace is special, two possible ways to handle it.
|
||||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_TRACE) == 0) {
|
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_TRACE) == 0) {
|
||||||
@@ -295,17 +297,24 @@ void RedirectablePrint::log(const char *logLevel, const char *format, ...)
|
|||||||
}
|
}
|
||||||
va_end(arg);
|
va_end(arg);
|
||||||
}
|
}
|
||||||
if (settingsMap[logoutputlevel] < level_trace && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_TRACE) == 0)
|
if (settingsMap[logoutputlevel] < level_trace && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_TRACE) == 0) {
|
||||||
|
delete[] newFormat;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (settingsMap[logoutputlevel] < level_debug && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_DEBUG) == 0)
|
if (settingsMap[logoutputlevel] < level_debug && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_DEBUG) == 0) {
|
||||||
|
delete[] newFormat;
|
||||||
return;
|
return;
|
||||||
else if (settingsMap[logoutputlevel] < level_info && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_INFO) == 0)
|
} else if (settingsMap[logoutputlevel] < level_info && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_INFO) == 0) {
|
||||||
|
delete[] newFormat;
|
||||||
return;
|
return;
|
||||||
else if (settingsMap[logoutputlevel] < level_warn && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_WARN) == 0)
|
} else if (settingsMap[logoutputlevel] < level_warn && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_WARN) == 0) {
|
||||||
|
delete[] newFormat;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (moduleConfig.serial.override_console_serial_port && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_DEBUG) == 0) {
|
if (moduleConfig.serial.override_console_serial_port && strcmp(logLevel, MESHTASTIC_LOG_LEVEL_DEBUG) == 0) {
|
||||||
|
delete[] newFormat;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,9 +328,9 @@ void RedirectablePrint::log(const char *logLevel, const char *format, ...)
|
|||||||
va_list arg;
|
va_list arg;
|
||||||
va_start(arg, format);
|
va_start(arg, format);
|
||||||
|
|
||||||
log_to_serial(logLevel, format, arg);
|
log_to_serial(logLevel, newFormat, arg);
|
||||||
log_to_syslog(logLevel, format, arg);
|
log_to_syslog(logLevel, newFormat, arg);
|
||||||
log_to_ble(logLevel, format, arg);
|
log_to_ble(logLevel, newFormat, arg);
|
||||||
|
|
||||||
va_end(arg);
|
va_end(arg);
|
||||||
#ifdef HAS_FREE_RTOS
|
#ifdef HAS_FREE_RTOS
|
||||||
@@ -331,17 +340,18 @@ void RedirectablePrint::log(const char *logLevel, const char *format, ...)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete[] newFormat;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RedirectablePrint::hexDump(const char *logLevel, unsigned char *buf, uint16_t len)
|
void RedirectablePrint::hexDump(const char *logLevel, unsigned char *buf, uint16_t len)
|
||||||
{
|
{
|
||||||
const char alphabet[17] = "0123456789abcdef";
|
const char alphabet[17] = "0123456789abcdef";
|
||||||
log(logLevel, " +------------------------------------------------+ +----------------+\n");
|
log(logLevel, " +------------------------------------------------+ +----------------+");
|
||||||
log(logLevel, " |.0 .1 .2 .3 .4 .5 .6 .7 .8 .9 .a .b .c .d .e .f | | ASCII |\n");
|
log(logLevel, " |.0 .1 .2 .3 .4 .5 .6 .7 .8 .9 .a .b .c .d .e .f | | ASCII |");
|
||||||
for (uint16_t i = 0; i < len; i += 16) {
|
for (uint16_t i = 0; i < len; i += 16) {
|
||||||
if (i % 128 == 0)
|
if (i % 128 == 0)
|
||||||
log(logLevel, " +------------------------------------------------+ +----------------+\n");
|
log(logLevel, " +------------------------------------------------+ +----------------+");
|
||||||
char s[] = "| | | |\n";
|
char s[] = "| | | |\n";
|
||||||
uint8_t ix = 1, iy = 52;
|
uint8_t ix = 1, iy = 52;
|
||||||
for (uint8_t j = 0; j < 16; j++) {
|
for (uint8_t j = 0; j < 16; j++) {
|
||||||
@@ -363,7 +373,7 @@ void RedirectablePrint::hexDump(const char *logLevel, unsigned char *buf, uint16
|
|||||||
log(logLevel, ".");
|
log(logLevel, ".");
|
||||||
log(logLevel, s);
|
log(logLevel, s);
|
||||||
}
|
}
|
||||||
log(logLevel, " +------------------------------------------------+ +----------------+\n");
|
log(logLevel, " +------------------------------------------------+ +----------------+");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string RedirectablePrint::mt_sprintf(const std::string fmt_str, ...)
|
std::string RedirectablePrint::mt_sprintf(const std::string fmt_str, ...)
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ class RedirectablePrint : public Print
|
|||||||
{
|
{
|
||||||
Print *dest;
|
Print *dest;
|
||||||
|
|
||||||
/// Used to allow multiple logDebug messages to appear on a single log line
|
|
||||||
bool isContinuationMessage = false;
|
|
||||||
|
|
||||||
#ifdef HAS_FREE_RTOS
|
#ifdef HAS_FREE_RTOS
|
||||||
SemaphoreHandle_t inDebugPrint = nullptr;
|
SemaphoreHandle_t inDebugPrint = nullptr;
|
||||||
StaticSemaphore_t _MutexStorageSpace;
|
StaticSemaphore_t _MutexStorageSpace;
|
||||||
|
|||||||
@@ -59,14 +59,14 @@ bool SafeFile::close()
|
|||||||
|
|
||||||
// brief window of risk here ;-)
|
// brief window of risk here ;-)
|
||||||
if (fullAtomic && FSCom.exists(filename.c_str()) && !FSCom.remove(filename.c_str())) {
|
if (fullAtomic && FSCom.exists(filename.c_str()) && !FSCom.remove(filename.c_str())) {
|
||||||
LOG_ERROR("Can't remove old pref file\n");
|
LOG_ERROR("Can't remove old pref file");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
String filenameTmp = filename;
|
String filenameTmp = filename;
|
||||||
filenameTmp += ".tmp";
|
filenameTmp += ".tmp";
|
||||||
if (!renameFile(filenameTmp.c_str(), filename.c_str())) {
|
if (!renameFile(filenameTmp.c_str(), filename.c_str())) {
|
||||||
LOG_ERROR("Error: can't rename new pref file\n");
|
LOG_ERROR("Error: can't rename new pref file");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ bool SafeFile::testReadback()
|
|||||||
filenameTmp += ".tmp";
|
filenameTmp += ".tmp";
|
||||||
auto f2 = FSCom.open(filenameTmp.c_str(), FILE_O_READ);
|
auto f2 = FSCom.open(filenameTmp.c_str(), FILE_O_READ);
|
||||||
if (!f2) {
|
if (!f2) {
|
||||||
LOG_ERROR("Can't open tmp file for readback\n");
|
LOG_ERROR("Can't open tmp file for readback");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ bool SafeFile::testReadback()
|
|||||||
f2.close();
|
f2.close();
|
||||||
|
|
||||||
if (test_hash != hash) {
|
if (test_hash != hash) {
|
||||||
LOG_ERROR("Readback failed hash mismatch\n");
|
LOG_ERROR("Readback failed hash mismatch");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
class SafeFile : public Print
|
class SafeFile : public Print
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SafeFile(char const *filepath, bool fullAtomic = false);
|
explicit SafeFile(char const *filepath, bool fullAtomic = false);
|
||||||
|
|
||||||
virtual size_t write(uint8_t);
|
virtual size_t write(uint8_t);
|
||||||
virtual size_t write(const uint8_t *buffer, size_t size);
|
virtual size_t write(const uint8_t *buffer, size_t size);
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "SerialConsole.h"
|
#include "SerialConsole.h"
|
||||||
|
#include "Default.h"
|
||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "PowerFSM.h"
|
#include "PowerFSM.h"
|
||||||
|
#include "Throttle.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
|
|
||||||
@@ -44,10 +46,11 @@ SerialConsole::SerialConsole() : StreamAPI(&Port), RedirectablePrint(&Port), con
|
|||||||
Port.setRX(SERIAL2_RX);
|
Port.setRX(SERIAL2_RX);
|
||||||
#endif
|
#endif
|
||||||
Port.begin(SERIAL_BAUD);
|
Port.begin(SERIAL_BAUD);
|
||||||
#if defined(ARCH_NRF52) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(ARCH_RP2040)
|
#if defined(ARCH_NRF52) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(ARCH_RP2040) || \
|
||||||
|
defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6)
|
||||||
time_t timeout = millis();
|
time_t timeout = millis();
|
||||||
while (!Port) {
|
while (!Port) {
|
||||||
if ((millis() - timeout) < 5000) {
|
if (Throttle::isWithinTimespanMs(timeout, FIVE_SECONDS_MS)) {
|
||||||
delay(100);
|
delay(100);
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
@@ -72,8 +75,7 @@ void SerialConsole::flush()
|
|||||||
// For the serial port we can't really detect if any client is on the other side, so instead just look for recent messages
|
// For the serial port we can't really detect if any client is on the other side, so instead just look for recent messages
|
||||||
bool SerialConsole::checkIsConnected()
|
bool SerialConsole::checkIsConnected()
|
||||||
{
|
{
|
||||||
uint32_t now = millis();
|
return Throttle::isWithinTimespanMs(lastContactMsec, SERIAL_CONNECTION_TIMEOUT);
|
||||||
return (now - lastContactMsec) < SERIAL_CONNECTION_TIMEOUT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -120,4 +122,4 @@ void SerialConsole::log_to_serial(const char *logLevel, const char *format, va_l
|
|||||||
emitLogRecord(ll, thread ? thread->ThreadName.c_str() : "", format, arg);
|
emitLogRecord(ll, thread ? thread->ThreadName.c_str() : "", format, arg);
|
||||||
} else
|
} else
|
||||||
RedirectablePrint::log_to_serial(logLevel, format, arg);
|
RedirectablePrint::log_to_serial(logLevel, format, arg);
|
||||||
}
|
}
|
||||||
@@ -13,17 +13,17 @@ void AirTime::logAirtime(reportTypes reportType, uint32_t airtime_ms)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (reportType == TX_LOG) {
|
if (reportType == TX_LOG) {
|
||||||
LOG_DEBUG("AirTime - Packet transmitted : %ums\n", airtime_ms);
|
LOG_DEBUG("Packet transmitted : %ums", airtime_ms);
|
||||||
this->airtimes.periodTX[0] = this->airtimes.periodTX[0] + airtime_ms;
|
this->airtimes.periodTX[0] = this->airtimes.periodTX[0] + airtime_ms;
|
||||||
air_period_tx[0] = air_period_tx[0] + airtime_ms;
|
air_period_tx[0] = air_period_tx[0] + airtime_ms;
|
||||||
|
|
||||||
this->utilizationTX[this->getPeriodUtilHour()] = this->utilizationTX[this->getPeriodUtilHour()] + airtime_ms;
|
this->utilizationTX[this->getPeriodUtilHour()] = this->utilizationTX[this->getPeriodUtilHour()] + airtime_ms;
|
||||||
} else if (reportType == RX_LOG) {
|
} else if (reportType == RX_LOG) {
|
||||||
LOG_DEBUG("AirTime - Packet received : %ums\n", airtime_ms);
|
LOG_DEBUG("Packet received : %ums", airtime_ms);
|
||||||
this->airtimes.periodRX[0] = this->airtimes.periodRX[0] + airtime_ms;
|
this->airtimes.periodRX[0] = this->airtimes.periodRX[0] + airtime_ms;
|
||||||
air_period_rx[0] = air_period_rx[0] + airtime_ms;
|
air_period_rx[0] = air_period_rx[0] + airtime_ms;
|
||||||
} else if (reportType == RX_ALL_LOG) {
|
} else if (reportType == RX_ALL_LOG) {
|
||||||
LOG_DEBUG("AirTime - Packet received (noise?) : %ums\n", airtime_ms);
|
LOG_DEBUG("Packet received (noise?) : %ums", airtime_ms);
|
||||||
this->airtimes.periodRX_ALL[0] = this->airtimes.periodRX_ALL[0] + airtime_ms;
|
this->airtimes.periodRX_ALL[0] = this->airtimes.periodRX_ALL[0] + airtime_ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ void AirTime::airtimeRotatePeriod()
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (this->airtimes.lastPeriodIndex != this->currentPeriodIndex()) {
|
if (this->airtimes.lastPeriodIndex != this->currentPeriodIndex()) {
|
||||||
LOG_DEBUG("Rotating airtimes to a new period = %u\n", this->currentPeriodIndex());
|
LOG_DEBUG("Rotating airtimes to a new period = %u", this->currentPeriodIndex());
|
||||||
|
|
||||||
for (int i = PERIODS_TO_LOG - 2; i >= 0; --i) {
|
for (int i = PERIODS_TO_LOG - 2; i >= 0; --i) {
|
||||||
this->airtimes.periodTX[i + 1] = this->airtimes.periodTX[i];
|
this->airtimes.periodTX[i + 1] = this->airtimes.periodTX[i];
|
||||||
@@ -105,7 +105,7 @@ float AirTime::channelUtilizationPercent()
|
|||||||
uint32_t sum = 0;
|
uint32_t sum = 0;
|
||||||
for (uint32_t i = 0; i < CHANNEL_UTILIZATION_PERIODS; i++) {
|
for (uint32_t i = 0; i < CHANNEL_UTILIZATION_PERIODS; i++) {
|
||||||
sum += this->channelUtilization[i];
|
sum += this->channelUtilization[i];
|
||||||
// LOG_DEBUG("ChanUtilArray %u %u\n", i, this->channelUtilization[i]);
|
// LOG_DEBUG("ChanUtilArray %u %u", i, this->channelUtilization[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (float(sum) / float(CHANNEL_UTILIZATION_PERIODS * 10 * 1000)) * 100;
|
return (float(sum) / float(CHANNEL_UTILIZATION_PERIODS * 10 * 1000)) * 100;
|
||||||
@@ -127,7 +127,7 @@ bool AirTime::isTxAllowedChannelUtil(bool polite)
|
|||||||
if (channelUtilizationPercent() < percentage) {
|
if (channelUtilizationPercent() < percentage) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
LOG_WARN("Channel utilization is >%d percent. Skipping this opportunity to send.\n", percentage);
|
LOG_WARN("Channel utilization is >%d percent. Skipping this opportunity to send.", percentage);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ bool AirTime::isTxAllowedAirUtil()
|
|||||||
if (utilizationTXPercent() < myRegion->dutyCycle * polite_duty_cycle_percent / 100) {
|
if (utilizationTXPercent() < myRegion->dutyCycle * polite_duty_cycle_percent / 100) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
LOG_WARN("Tx air utilization is >%f percent. Skipping this opportunity to send.\n",
|
LOG_WARN("Tx air utilization is >%f percent. Skipping this opportunity to send.",
|
||||||
myRegion->dutyCycle * polite_duty_cycle_percent / 100);
|
myRegion->dutyCycle * polite_duty_cycle_percent / 100);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -209,13 +209,13 @@ int32_t AirTime::runOnce()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
LOG_DEBUG("utilPeriodTX %d TX Airtime %3.2f%\n", utilPeriodTX, airTime->utilizationTXPercent());
|
LOG_DEBUG("utilPeriodTX %d TX Airtime %3.2f%", utilPeriodTX, airTime->utilizationTXPercent());
|
||||||
for (uint32_t i = 0; i < MINUTES_IN_HOUR; i++) {
|
for (uint32_t i = 0; i < MINUTES_IN_HOUR; i++) {
|
||||||
LOG_DEBUG(
|
LOG_DEBUG(
|
||||||
"%d,", this->utilizationTX[i]
|
"%d,", this->utilizationTX[i]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
LOG_DEBUG("\n");
|
LOG_DEBUG("");
|
||||||
*/
|
*/
|
||||||
return (1000 * 1);
|
return (1000 * 1);
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@ bool InterruptableDelay::delay(uint32_t msec)
|
|||||||
// sem take will return false if we timed out (i.e. were not interrupted)
|
// sem take will return false if we timed out (i.e. were not interrupted)
|
||||||
bool r = semaphore.take(msec);
|
bool r = semaphore.take(msec);
|
||||||
|
|
||||||
// LOG_DEBUG("interrupt=%d\n", r);
|
// LOG_DEBUG("interrupt=%d", r);
|
||||||
return !r;
|
return !r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,12 +32,12 @@ IRAM_ATTR bool NotifiedWorkerThread::notifyCommon(uint32_t v, bool overwrite)
|
|||||||
|
|
||||||
notification = v;
|
notification = v;
|
||||||
if (debugNotification) {
|
if (debugNotification) {
|
||||||
LOG_DEBUG("setting notification %d\n", v);
|
LOG_DEBUG("setting notification %d", v);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (debugNotification) {
|
if (debugNotification) {
|
||||||
LOG_DEBUG("dropping notification %d\n", v);
|
LOG_DEBUG("dropping notification %d", v);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,7 @@ bool NotifiedWorkerThread::notifyLater(uint32_t delay, uint32_t v, bool overwrit
|
|||||||
if (didIt) { // If we didn't already have something queued, override the delay to be larger
|
if (didIt) { // If we didn't already have something queued, override the delay to be larger
|
||||||
setIntervalFromNow(delay); // a new version of setInterval relative to the current time
|
setIntervalFromNow(delay); // a new version of setInterval relative to the current time
|
||||||
if (debugNotification) {
|
if (debugNotification) {
|
||||||
LOG_DEBUG("delaying notification %u\n", delay);
|
LOG_DEBUG("delaying notification %u", delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,15 +62,15 @@ bool OSThread::shouldRun(unsigned long time)
|
|||||||
bool r = Thread::shouldRun(time);
|
bool r = Thread::shouldRun(time);
|
||||||
|
|
||||||
if (showRun && r) {
|
if (showRun && r) {
|
||||||
LOG_DEBUG("Thread %s: run\n", ThreadName.c_str());
|
LOG_DEBUG("Thread %s: run", ThreadName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showWaiting && enabled && !r) {
|
if (showWaiting && enabled && !r) {
|
||||||
LOG_DEBUG("Thread %s: wait %lu\n", ThreadName.c_str(), interval);
|
LOG_DEBUG("Thread %s: wait %lu", ThreadName.c_str(), interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showDisabled && !enabled) {
|
if (showDisabled && !enabled) {
|
||||||
LOG_DEBUG("Thread %s: disabled\n", ThreadName.c_str());
|
LOG_DEBUG("Thread %s: disabled", ThreadName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
@@ -86,9 +86,9 @@ void OSThread::run()
|
|||||||
#ifdef DEBUG_HEAP
|
#ifdef DEBUG_HEAP
|
||||||
auto newHeap = memGet.getFreeHeap();
|
auto newHeap = memGet.getFreeHeap();
|
||||||
if (newHeap < heap)
|
if (newHeap < heap)
|
||||||
LOG_DEBUG("------ Thread %s leaked heap %d -> %d (%d) ------\n", ThreadName.c_str(), heap, newHeap, newHeap - heap);
|
LOG_DEBUG("------ Thread %s leaked heap %d -> %d (%d) ------", ThreadName.c_str(), heap, newHeap, newHeap - heap);
|
||||||
if (heap < newHeap)
|
if (heap < newHeap)
|
||||||
LOG_DEBUG("++++++ Thread %s freed heap %d -> %d (%d) ++++++\n", ThreadName.c_str(), heap, newHeap, newHeap - heap);
|
LOG_DEBUG("++++++ Thread %s freed heap %d -> %d (%d) ++++++", ThreadName.c_str(), heap, newHeap, newHeap - heap);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
runned();
|
runned();
|
||||||
|
|||||||
@@ -69,6 +69,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#ifndef RTC_DATA_ATTR
|
#ifndef RTC_DATA_ATTR
|
||||||
#define RTC_DATA_ATTR
|
#define RTC_DATA_ATTR
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef EXT_RAM_BSS_ATTR
|
||||||
|
#define EXT_RAM_BSS_ATTR EXT_RAM_ATTR
|
||||||
|
#endif
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Regulatory overrides
|
// Regulatory overrides
|
||||||
@@ -122,9 +125,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define INA_ADDR_ALTERNATE 0x41
|
#define INA_ADDR_ALTERNATE 0x41
|
||||||
#define INA_ADDR_WAVESHARE_UPS 0x43
|
#define INA_ADDR_WAVESHARE_UPS 0x43
|
||||||
#define INA3221_ADDR 0x42
|
#define INA3221_ADDR 0x42
|
||||||
|
#define MAX1704X_ADDR 0x36
|
||||||
#define QMC6310_ADDR 0x1C
|
#define QMC6310_ADDR 0x1C
|
||||||
#define QMI8658_ADDR 0x6B
|
#define QMI8658_ADDR 0x6B
|
||||||
#define QMC5883L_ADDR 0x1E
|
#define QMC5883L_ADDR 0x0D
|
||||||
|
#define HMC5883L_ADDR 0x1E
|
||||||
#define SHTC3_ADDR 0x70
|
#define SHTC3_ADDR 0x70
|
||||||
#define LPS22HB_ADDR 0x5C
|
#define LPS22HB_ADDR 0x5C
|
||||||
#define LPS22HB_ADDR_ALT 0x5D
|
#define LPS22HB_ADDR_ALT 0x5D
|
||||||
@@ -139,15 +144,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define MLX90632_ADDR 0x3A
|
#define MLX90632_ADDR 0x3A
|
||||||
#define DFROBOT_LARK_ADDR 0x42
|
#define DFROBOT_LARK_ADDR 0x42
|
||||||
#define NAU7802_ADDR 0x2A
|
#define NAU7802_ADDR 0x2A
|
||||||
|
#define MAX30102_ADDR 0x57
|
||||||
|
#define MLX90614_ADDR_DEF 0x5A
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// ACCELEROMETER
|
// ACCELEROMETER
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
#define MPU6050_ADDR 0x68
|
#define MPU6050_ADDR 0x68
|
||||||
|
#define STK8BXX_ADR 0x18
|
||||||
#define LIS3DH_ADR 0x18
|
#define LIS3DH_ADR 0x18
|
||||||
#define BMA423_ADDR 0x19
|
#define BMA423_ADDR 0x19
|
||||||
#define LSM6DS3_ADDR 0x6A
|
#define LSM6DS3_ADDR 0x6A
|
||||||
#define BMX160_ADDR 0x69
|
#define BMX160_ADDR 0x69
|
||||||
|
#define ICM20948_ADDR 0x69
|
||||||
|
#define ICM20948_ADDR_ALT 0x68
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// LED
|
// LED
|
||||||
@@ -162,6 +172,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// IO Expander
|
// IO Expander
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
#define TCA9535_ADDR 0x20
|
||||||
#define TCA9555_ADDR 0x26
|
#define TCA9555_ADDR 0x26
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@@ -171,6 +182,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define GPS_THREAD_INTERVAL 200
|
#define GPS_THREAD_INTERVAL 200
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Touchscreen
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
#define FT6336U_ADDR 0x48
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// BIAS-T Generator
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
#define TPS65233_ADDR 0x60
|
||||||
|
|
||||||
// convert 24-bit color to 16-bit (56K)
|
// convert 24-bit color to 16-bit (56K)
|
||||||
#define COLOR565(r, g, b) (((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3))
|
#define COLOR565(r, g, b) (((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3))
|
||||||
|
|
||||||
@@ -202,6 +223,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define MINIMUM_SAFE_FREE_HEAP 1500
|
#define MINIMUM_SAFE_FREE_HEAP 1500
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef WIRE_INTERFACES_COUNT
|
||||||
|
// Officially an NRF52 macro
|
||||||
|
// Repurposed cross-platform to identify devices using Wire1
|
||||||
|
#if defined(I2C_SDA1) || defined(PIN_WIRE1_SDA)
|
||||||
|
#define WIRE_INTERFACES_COUNT 2
|
||||||
|
#elif HAS_WIRE
|
||||||
|
#define WIRE_INTERFACES_COUNT 1
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Step #3: mop up with disabled values for HAS_ options not handled by the above two */
|
/* Step #3: mop up with disabled values for HAS_ options not handled by the above two */
|
||||||
|
|
||||||
#ifndef HAS_WIFI
|
#ifndef HAS_WIFI
|
||||||
@@ -324,4 +355,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "DebugConfiguration.h"
|
#include "DebugConfiguration.h"
|
||||||
#include "RF95Configuration.h"
|
#include "RF95Configuration.h"
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ enum LoRaRadioType {
|
|||||||
LLCC68_RADIO,
|
LLCC68_RADIO,
|
||||||
SX1280_RADIO,
|
SX1280_RADIO,
|
||||||
LR1110_RADIO,
|
LR1110_RADIO,
|
||||||
LR1120_RADIO
|
LR1120_RADIO,
|
||||||
|
LR1121_RADIO
|
||||||
};
|
};
|
||||||
|
|
||||||
extern LoRaRadioType radioType;
|
extern LoRaRadioType radioType;
|
||||||
@@ -37,8 +37,8 @@ ScanI2C::FoundDevice ScanI2C::firstKeyboard() const
|
|||||||
|
|
||||||
ScanI2C::FoundDevice ScanI2C::firstAccelerometer() const
|
ScanI2C::FoundDevice ScanI2C::firstAccelerometer() const
|
||||||
{
|
{
|
||||||
ScanI2C::DeviceType types[] = {MPU6050, LIS3DH, BMA423, LSM6DS3, BMX160};
|
ScanI2C::DeviceType types[] = {MPU6050, LIS3DH, BMA423, LSM6DS3, BMX160, STK8BAXX, ICM20948};
|
||||||
return firstOfOrNONE(5, types);
|
return firstOfOrNONE(7, types);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScanI2C::FoundDevice ScanI2C::find(ScanI2C::DeviceType) const
|
ScanI2C::FoundDevice ScanI2C::find(ScanI2C::DeviceType) const
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class ScanI2C
|
|||||||
INA260,
|
INA260,
|
||||||
INA219,
|
INA219,
|
||||||
INA3221,
|
INA3221,
|
||||||
|
MAX17048,
|
||||||
MCP9808,
|
MCP9808,
|
||||||
SHT31,
|
SHT31,
|
||||||
SHT4X,
|
SHT4X,
|
||||||
@@ -36,12 +37,14 @@ class ScanI2C
|
|||||||
QMC6310,
|
QMC6310,
|
||||||
QMI8658,
|
QMI8658,
|
||||||
QMC5883L,
|
QMC5883L,
|
||||||
|
HMC5883L,
|
||||||
PMSA0031,
|
PMSA0031,
|
||||||
MPU6050,
|
MPU6050,
|
||||||
LIS3DH,
|
LIS3DH,
|
||||||
BMA423,
|
BMA423,
|
||||||
BQ24295,
|
BQ24295,
|
||||||
LSM6DS3,
|
LSM6DS3,
|
||||||
|
TCA9535,
|
||||||
TCA9555,
|
TCA9555,
|
||||||
VEML7700,
|
VEML7700,
|
||||||
RCWL9620,
|
RCWL9620,
|
||||||
@@ -49,10 +52,16 @@ class ScanI2C
|
|||||||
TSL2591,
|
TSL2591,
|
||||||
OPT3001,
|
OPT3001,
|
||||||
MLX90632,
|
MLX90632,
|
||||||
|
MLX90614,
|
||||||
AHT10,
|
AHT10,
|
||||||
BMX160,
|
BMX160,
|
||||||
DFROBOT_LARK,
|
DFROBOT_LARK,
|
||||||
NAU7802
|
NAU7802,
|
||||||
|
FT6336U,
|
||||||
|
STK8BAXX,
|
||||||
|
ICM20948,
|
||||||
|
MAX30102,
|
||||||
|
TPS65233
|
||||||
} DeviceType;
|
} DeviceType;
|
||||||
|
|
||||||
// typedef uint8_t DeviceAddress;
|
// typedef uint8_t DeviceAddress;
|
||||||
@@ -63,8 +72,9 @@ class ScanI2C
|
|||||||
} I2CPort;
|
} I2CPort;
|
||||||
|
|
||||||
typedef struct DeviceAddress {
|
typedef struct DeviceAddress {
|
||||||
I2CPort port;
|
// set default values for ADDRESS_NONE
|
||||||
uint8_t address;
|
I2CPort port = I2CPort::NO_I2C;
|
||||||
|
uint8_t address = 0;
|
||||||
|
|
||||||
explicit DeviceAddress(I2CPort port, uint8_t address);
|
explicit DeviceAddress(I2CPort port, uint8_t address);
|
||||||
DeviceAddress();
|
DeviceAddress();
|
||||||
|
|||||||
@@ -71,15 +71,15 @@ ScanI2C::DeviceType ScanI2CTwoWire::probeOLED(ScanI2C::DeviceAddress addr) const
|
|||||||
r &= 0x0f;
|
r &= 0x0f;
|
||||||
|
|
||||||
if (r == 0x08 || r == 0x00) {
|
if (r == 0x08 || r == 0x00) {
|
||||||
LOG_INFO("sh1106 display found\n");
|
LOG_INFO("sh1106 display found");
|
||||||
o_probe = SCREEN_SH1106; // SH1106
|
o_probe = SCREEN_SH1106; // SH1106
|
||||||
} else if (r == 0x03 || r == 0x04 || r == 0x06 || r == 0x07) {
|
} else if (r == 0x03 || r == 0x04 || r == 0x06 || r == 0x07) {
|
||||||
LOG_INFO("ssd1306 display found\n");
|
LOG_INFO("ssd1306 display found");
|
||||||
o_probe = SCREEN_SSD1306; // SSD1306
|
o_probe = SCREEN_SSD1306; // SSD1306
|
||||||
}
|
}
|
||||||
c++;
|
c++;
|
||||||
} while ((r != r_prev) && (c < 4));
|
} while ((r != r_prev) && (c < 4));
|
||||||
LOG_DEBUG("0x%x subtype probed in %i tries \n", r, c);
|
LOG_DEBUG("0x%x subtype probed in %i tries ", r, c);
|
||||||
|
|
||||||
return o_probe;
|
return o_probe;
|
||||||
}
|
}
|
||||||
@@ -88,31 +88,31 @@ void ScanI2CTwoWire::printATECCInfo() const
|
|||||||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
||||||
atecc.readConfigZone(false);
|
atecc.readConfigZone(false);
|
||||||
|
|
||||||
LOG_DEBUG("ATECC608B Serial Number: ");
|
std::string atecc_numbers = "ATECC608B Serial Number: ";
|
||||||
for (int i = 0; i < 9; i++) {
|
for (int i = 0; i < 9; i++) {
|
||||||
LOG_DEBUG("%02x", atecc.serialNumber[i]);
|
atecc_numbers += vformat("%02x", atecc.serialNumber[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DEBUG(", Rev Number: ");
|
atecc_numbers += ", Rev Number: ";
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
LOG_DEBUG("%02x", atecc.revisionNumber[i]);
|
atecc_numbers += vformat("%02x", atecc.revisionNumber[i]);
|
||||||
}
|
}
|
||||||
LOG_DEBUG("\n");
|
LOG_DEBUG(atecc_numbers.c_str());
|
||||||
|
|
||||||
LOG_DEBUG("ATECC608B Config %s", atecc.configLockStatus ? "Locked" : "Unlocked");
|
LOG_DEBUG("ATECC608B Config %s, Data %s, Slot 0 %s", atecc.configLockStatus ? "Locked" : "Unlocked",
|
||||||
LOG_DEBUG(", Data %s", atecc.dataOTPLockStatus ? "Locked" : "Unlocked");
|
atecc.dataOTPLockStatus ? "Locked" : "Unlocked", atecc.slot0LockStatus ? "Locked" : "Unlocked");
|
||||||
LOG_DEBUG(", Slot 0 %s\n", atecc.slot0LockStatus ? "Locked" : "Unlocked");
|
|
||||||
|
|
||||||
|
std::string atecc_publickey = "";
|
||||||
if (atecc.configLockStatus && atecc.dataOTPLockStatus && atecc.slot0LockStatus) {
|
if (atecc.configLockStatus && atecc.dataOTPLockStatus && atecc.slot0LockStatus) {
|
||||||
if (atecc.generatePublicKey() == false) {
|
if (atecc.generatePublicKey() == false) {
|
||||||
LOG_DEBUG("ATECC608B Error generating public key\n");
|
atecc_publickey += "ATECC608B Error generating public key";
|
||||||
} else {
|
} else {
|
||||||
LOG_DEBUG("ATECC608B Public Key: ");
|
atecc_publickey += "ATECC608B Public Key: ";
|
||||||
for (int i = 0; i < 64; i++) {
|
for (int i = 0; i < 64; i++) {
|
||||||
LOG_DEBUG("%02x", atecc.publicKey64Bytes[i]);
|
atecc_publickey += vformat("%02x", atecc.publicKey64Bytes[i]);
|
||||||
}
|
}
|
||||||
LOG_DEBUG("\n");
|
|
||||||
}
|
}
|
||||||
|
LOG_DEBUG(atecc_publickey.c_str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -128,7 +128,7 @@ uint16_t ScanI2CTwoWire::getRegisterValue(const ScanI2CTwoWire::RegisterLocation
|
|||||||
i2cBus->endTransmission();
|
i2cBus->endTransmission();
|
||||||
delay(20);
|
delay(20);
|
||||||
i2cBus->requestFrom(registerLocation.i2cAddress.address, responseWidth);
|
i2cBus->requestFrom(registerLocation.i2cAddress.address, responseWidth);
|
||||||
LOG_DEBUG("Wire.available() = %d\n", i2cBus->available());
|
LOG_DEBUG("Wire.available() = %d", i2cBus->available());
|
||||||
if (i2cBus->available() == 2) {
|
if (i2cBus->available() == 2) {
|
||||||
// Read MSB, then LSB
|
// Read MSB, then LSB
|
||||||
value = (uint16_t)i2cBus->read() << 8;
|
value = (uint16_t)i2cBus->read() << 8;
|
||||||
@@ -149,7 +149,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||||||
{
|
{
|
||||||
concurrency::LockGuard guard((concurrency::Lock *)&lock);
|
concurrency::LockGuard guard((concurrency::Lock *)&lock);
|
||||||
|
|
||||||
LOG_DEBUG("Scanning for I2C devices on port %d\n", port);
|
LOG_DEBUG("Scanning for I2C devices on port %d", port);
|
||||||
|
|
||||||
uint8_t err;
|
uint8_t err;
|
||||||
|
|
||||||
@@ -162,13 +162,13 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||||||
Melopero_RV3028 rtc;
|
Melopero_RV3028 rtc;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef I2C_SDA1
|
#if WIRE_INTERFACES_COUNT == 2
|
||||||
if (port == I2CPort::WIRE1) {
|
if (port == I2CPort::WIRE1) {
|
||||||
i2cBus = &Wire1;
|
i2cBus = &Wire1;
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
i2cBus = &Wire;
|
i2cBus = &Wire;
|
||||||
#ifdef I2C_SDA1
|
#if WIRE_INTERFACES_COUNT == 2
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||||||
if (asize != 0) {
|
if (asize != 0) {
|
||||||
if (!in_array(address, asize, addr.address))
|
if (!in_array(address, asize, addr.address))
|
||||||
continue;
|
continue;
|
||||||
LOG_DEBUG("Scanning address 0x%x\n", addr.address);
|
LOG_DEBUG("Scanning address 0x%x", addr.address);
|
||||||
}
|
}
|
||||||
i2cBus->beginTransmission(addr.address);
|
i2cBus->beginTransmission(addr.address);
|
||||||
#ifdef ARCH_PORTDUINO
|
#ifdef ARCH_PORTDUINO
|
||||||
@@ -189,7 +189,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||||||
#endif
|
#endif
|
||||||
type = NONE;
|
type = NONE;
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
LOG_DEBUG("I2C device found at address 0x%x\n", addr.address);
|
LOG_DEBUG("I2C device found at address 0x%x", addr.address);
|
||||||
|
|
||||||
switch (addr.address) {
|
switch (addr.address) {
|
||||||
case SSD1306_ADDRESS:
|
case SSD1306_ADDRESS:
|
||||||
@@ -205,9 +205,9 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
LOG_INFO("ATECC608B initialized\n");
|
LOG_INFO("ATECC608B initialized");
|
||||||
} else {
|
} else {
|
||||||
LOG_WARN("ATECC608B initialization failed\n");
|
LOG_WARN("ATECC608B initialization failed");
|
||||||
}
|
}
|
||||||
printATECCInfo();
|
printATECCInfo();
|
||||||
break;
|
break;
|
||||||
@@ -217,7 +217,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||||||
case RV3028_RTC:
|
case RV3028_RTC:
|
||||||
// foundDevices[addr] = RTC_RV3028;
|
// foundDevices[addr] = RTC_RV3028;
|
||||||
type = RTC_RV3028;
|
type = RTC_RV3028;
|
||||||
LOG_INFO("RV3028 RTC found\n");
|
LOG_INFO("RV3028 RTC found");
|
||||||
rtc.initI2C(*i2cBus);
|
rtc.initI2C(*i2cBus);
|
||||||
rtc.writeToRegister(0x35, 0x07); // no Clkout
|
rtc.writeToRegister(0x35, 0x07); // no Clkout
|
||||||
rtc.writeToRegister(0x37, 0xB4);
|
rtc.writeToRegister(0x37, 0xB4);
|
||||||
@@ -225,7 +225,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PCF8563_RTC
|
#ifdef PCF8563_RTC
|
||||||
SCAN_SIMPLE_CASE(PCF8563_RTC, RTC_PCF8563, "PCF8563 RTC found\n")
|
SCAN_SIMPLE_CASE(PCF8563_RTC, RTC_PCF8563, "PCF8563 RTC found")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case CARDKB_ADDR:
|
case CARDKB_ADDR:
|
||||||
@@ -233,49 +233,49 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||||||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x04), 1);
|
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x04), 1);
|
||||||
if (registerValue == 0x02) {
|
if (registerValue == 0x02) {
|
||||||
// KEYPAD_VERSION
|
// KEYPAD_VERSION
|
||||||
LOG_INFO("RAK14004 found\n");
|
LOG_INFO("RAK14004 found");
|
||||||
type = RAK14004;
|
type = RAK14004;
|
||||||
} else {
|
} else {
|
||||||
LOG_INFO("m5 cardKB found\n");
|
LOG_INFO("m5 cardKB found");
|
||||||
type = CARDKB;
|
type = CARDKB;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
SCAN_SIMPLE_CASE(TDECK_KB_ADDR, TDECKKB, "T-Deck keyboard found\n");
|
SCAN_SIMPLE_CASE(TDECK_KB_ADDR, TDECKKB, "T-Deck keyboard found");
|
||||||
SCAN_SIMPLE_CASE(BBQ10_KB_ADDR, BBQ10KB, "BB Q10 keyboard found\n");
|
SCAN_SIMPLE_CASE(BBQ10_KB_ADDR, BBQ10KB, "BB Q10 keyboard found");
|
||||||
SCAN_SIMPLE_CASE(ST7567_ADDRESS, SCREEN_ST7567, "st7567 display found\n");
|
SCAN_SIMPLE_CASE(ST7567_ADDRESS, SCREEN_ST7567, "st7567 display found");
|
||||||
#ifdef HAS_NCP5623
|
#ifdef HAS_NCP5623
|
||||||
SCAN_SIMPLE_CASE(NCP5623_ADDR, NCP5623, "NCP5623 RGB LED found\n");
|
SCAN_SIMPLE_CASE(NCP5623_ADDR, NCP5623, "NCP5623 RGB LED found");
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_PMU
|
#ifdef HAS_PMU
|
||||||
SCAN_SIMPLE_CASE(XPOWERS_AXP192_AXP2101_ADDRESS, PMU_AXP192_AXP2101, "axp192/axp2101 PMU found\n")
|
SCAN_SIMPLE_CASE(XPOWERS_AXP192_AXP2101_ADDRESS, PMU_AXP192_AXP2101, "axp192/axp2101 PMU found")
|
||||||
#endif
|
#endif
|
||||||
case BME_ADDR:
|
case BME_ADDR:
|
||||||
case BME_ADDR_ALTERNATE:
|
case BME_ADDR_ALTERNATE:
|
||||||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xD0), 1); // GET_ID
|
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xD0), 1); // GET_ID
|
||||||
switch (registerValue) {
|
switch (registerValue) {
|
||||||
case 0x61:
|
case 0x61:
|
||||||
LOG_INFO("BME-680 sensor found at address 0x%x\n", (uint8_t)addr.address);
|
LOG_INFO("BME-680 sensor found at address 0x%x", (uint8_t)addr.address);
|
||||||
type = BME_680;
|
type = BME_680;
|
||||||
break;
|
break;
|
||||||
case 0x60:
|
case 0x60:
|
||||||
LOG_INFO("BME-280 sensor found at address 0x%x\n", (uint8_t)addr.address);
|
LOG_INFO("BME-280 sensor found at address 0x%x", (uint8_t)addr.address);
|
||||||
type = BME_280;
|
type = BME_280;
|
||||||
break;
|
break;
|
||||||
case 0x55:
|
case 0x55:
|
||||||
LOG_INFO("BMP-085 or BMP-180 sensor found at address 0x%x\n", (uint8_t)addr.address);
|
LOG_INFO("BMP-085 or BMP-180 sensor found at address 0x%x", (uint8_t)addr.address);
|
||||||
type = BMP_085;
|
type = BMP_085;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x00), 1); // GET_ID
|
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x00), 1); // GET_ID
|
||||||
switch (registerValue) {
|
switch (registerValue) {
|
||||||
case 0x50: // BMP-388 should be 0x50
|
case 0x50: // BMP-388 should be 0x50
|
||||||
LOG_INFO("BMP-388 sensor found at address 0x%x\n", (uint8_t)addr.address);
|
LOG_INFO("BMP-388 sensor found at address 0x%x", (uint8_t)addr.address);
|
||||||
type = BMP_3XX;
|
type = BMP_3XX;
|
||||||
break;
|
break;
|
||||||
case 0x58: // BMP-280 should be 0x58
|
case 0x58: // BMP-280 should be 0x58
|
||||||
default:
|
default:
|
||||||
LOG_INFO("BMP-280 sensor found at address 0x%x\n", (uint8_t)addr.address);
|
LOG_INFO("BMP-280 sensor found at address 0x%x", (uint8_t)addr.address);
|
||||||
type = BMP_280;
|
type = BMP_280;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -284,7 +284,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||||||
break;
|
break;
|
||||||
#ifndef HAS_NCP5623
|
#ifndef HAS_NCP5623
|
||||||
case AHT10_ADDR:
|
case AHT10_ADDR:
|
||||||
LOG_INFO("AHT10 sensor found at address 0x%x\n", (uint8_t)addr.address);
|
LOG_INFO("AHT10 sensor found at address 0x%x", (uint8_t)addr.address);
|
||||||
type = AHT10;
|
type = AHT10;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@@ -292,97 +292,147 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
|||||||
case INA_ADDR_ALTERNATE:
|
case INA_ADDR_ALTERNATE:
|
||||||
case INA_ADDR_WAVESHARE_UPS:
|
case INA_ADDR_WAVESHARE_UPS:
|
||||||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xFE), 2);
|
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xFE), 2);
|
||||||
LOG_DEBUG("Register MFG_UID: 0x%x\n", registerValue);
|
LOG_DEBUG("Register MFG_UID: 0x%x", registerValue);
|
||||||
if (registerValue == 0x5449) {
|
if (registerValue == 0x5449) {
|
||||||
LOG_INFO("INA260 sensor found at address 0x%x\n", (uint8_t)addr.address);
|
LOG_INFO("INA260 sensor found at address 0x%x", (uint8_t)addr.address);
|
||||||
type = INA260;
|
type = INA260;
|
||||||
} else { // Assume INA219 if INA260 ID is not found
|
} else { // Assume INA219 if INA260 ID is not found
|
||||||
LOG_INFO("INA219 sensor found at address 0x%x\n", (uint8_t)addr.address);
|
LOG_INFO("INA219 sensor found at address 0x%x", (uint8_t)addr.address);
|
||||||
type = INA219;
|
type = INA219;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case INA3221_ADDR:
|
case INA3221_ADDR:
|
||||||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xFE), 2);
|
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xFE), 2);
|
||||||
LOG_DEBUG("Register MFG_UID: 0x%x\n", registerValue);
|
LOG_DEBUG("Register MFG_UID: 0x%x", registerValue);
|
||||||
if (registerValue == 0x5449) {
|
if (registerValue == 0x5449) {
|
||||||
LOG_INFO("INA3221 sensor found at address 0x%x\n", (uint8_t)addr.address);
|
LOG_INFO("INA3221 sensor found at address 0x%x", (uint8_t)addr.address);
|
||||||
type = INA3221;
|
type = INA3221;
|
||||||
} else {
|
} else {
|
||||||
LOG_INFO("DFRobot Lark weather station found at address 0x%x\n", (uint8_t)addr.address);
|
LOG_INFO("DFRobot Lark weather station found at address 0x%x", (uint8_t)addr.address);
|
||||||
type = DFROBOT_LARK;
|
type = DFROBOT_LARK;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MCP9808_ADDR:
|
case MCP9808_ADDR:
|
||||||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x07), 2);
|
// We need to check for STK8BAXX first, since register 0x07 is new data flag for the z-axis and can produce some
|
||||||
if (registerValue == 0x0400) {
|
// weird result. and register 0x00 doesn't seems to be colliding with MCP9808 and LIS3DH chips.
|
||||||
type = MCP9808;
|
{
|
||||||
LOG_INFO("MCP9808 sensor found\n");
|
// Check register 0x00 for 0x8700 response to ID STK8BA53 chip.
|
||||||
} else {
|
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x00), 2);
|
||||||
type = LIS3DH;
|
if (registerValue == 0x8700) {
|
||||||
LOG_INFO("LIS3DH accelerometer found\n");
|
type = STK8BAXX;
|
||||||
|
LOG_INFO("STK8BAXX accelerometer found");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check register 0x07 for 0x0400 response to ID MCP9808 chip.
|
||||||
|
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x07), 2);
|
||||||
|
if (registerValue == 0x0400) {
|
||||||
|
type = MCP9808;
|
||||||
|
LOG_INFO("MCP9808 sensor found");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check register 0x0F for 0x3300 response to ID LIS3DH chip.
|
||||||
|
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x0F), 2);
|
||||||
|
if (registerValue == 0x3300 || registerValue == 0x3333) { // RAK4631 WisBlock has LIS3DH register at 0x3333
|
||||||
|
type = LIS3DH;
|
||||||
|
LOG_INFO("LIS3DH accelerometer found");
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SHT31_4x_ADDR:
|
case SHT31_4x_ADDR:
|
||||||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x89), 2);
|
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x89), 2);
|
||||||
if (registerValue == 0x11a2 || registerValue == 0x11da || registerValue == 0xe9c) {
|
if (registerValue == 0x11a2 || registerValue == 0x11da || registerValue == 0xe9c) {
|
||||||
type = SHT4X;
|
type = SHT4X;
|
||||||
LOG_INFO("SHT4X sensor found\n");
|
LOG_INFO("SHT4X sensor found");
|
||||||
} else if (getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x7E), 2) == 0x5449) {
|
} else if (getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x7E), 2) == 0x5449) {
|
||||||
type = OPT3001;
|
type = OPT3001;
|
||||||
LOG_INFO("OPT3001 light sensor found\n");
|
LOG_INFO("OPT3001 light sensor found");
|
||||||
} else {
|
} else {
|
||||||
type = SHT31;
|
type = SHT31;
|
||||||
LOG_INFO("SHT31 sensor found\n");
|
LOG_INFO("SHT31 sensor found");
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
SCAN_SIMPLE_CASE(SHTC3_ADDR, SHTC3, "SHTC3 sensor found\n")
|
SCAN_SIMPLE_CASE(SHTC3_ADDR, SHTC3, "SHTC3 sensor found")
|
||||||
SCAN_SIMPLE_CASE(RCWL9620_ADDR, RCWL9620, "RCWL9620 sensor found\n")
|
case RCWL9620_ADDR:
|
||||||
|
// get MAX30102 PARTID
|
||||||
|
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xFF), 1);
|
||||||
|
if (registerValue == 0x15) {
|
||||||
|
type = MAX30102;
|
||||||
|
LOG_INFO("MAX30102 Health sensor found");
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
type = RCWL9620;
|
||||||
|
LOG_INFO("RCWL9620 sensor found");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case LPS22HB_ADDR_ALT:
|
case LPS22HB_ADDR_ALT:
|
||||||
SCAN_SIMPLE_CASE(LPS22HB_ADDR, LPS22HB, "LPS22HB sensor found\n")
|
SCAN_SIMPLE_CASE(LPS22HB_ADDR, LPS22HB, "LPS22HB sensor found")
|
||||||
|
|
||||||
SCAN_SIMPLE_CASE(QMC6310_ADDR, QMC6310, "QMC6310 Highrate 3-Axis magnetic sensor found\n")
|
SCAN_SIMPLE_CASE(QMC6310_ADDR, QMC6310, "QMC6310 Highrate 3-Axis magnetic sensor found")
|
||||||
|
|
||||||
case QMI8658_ADDR:
|
case QMI8658_ADDR:
|
||||||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x0A), 1); // get ID
|
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x0A), 1); // get ID
|
||||||
if (registerValue == 0xC0) {
|
if (registerValue == 0xC0) {
|
||||||
type = BQ24295;
|
type = BQ24295;
|
||||||
LOG_INFO("BQ24295 PMU found\n");
|
LOG_INFO("BQ24295 PMU found");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x0F), 1); // get ID
|
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x0F), 1); // get ID
|
||||||
if (registerValue == 0x6A) {
|
if (registerValue == 0x6A) {
|
||||||
type = LSM6DS3;
|
type = LSM6DS3;
|
||||||
LOG_INFO("LSM6DS3 accelerometer found at address 0x%x\n", (uint8_t)addr.address);
|
LOG_INFO("LSM6DS3 accelerometer found at address 0x%x", (uint8_t)addr.address);
|
||||||
} else {
|
} else {
|
||||||
type = QMI8658;
|
type = QMI8658;
|
||||||
LOG_INFO("QMI8658 Highrate 6-Axis inertial measurement sensor found\n");
|
LOG_INFO("QMI8658 Highrate 6-Axis inertial measurement sensor found");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
SCAN_SIMPLE_CASE(QMC5883L_ADDR, QMC5883L, "QMC5883L Highrate 3-Axis magnetic sensor found\n")
|
SCAN_SIMPLE_CASE(QMC5883L_ADDR, QMC5883L, "QMC5883L Highrate 3-Axis magnetic sensor found")
|
||||||
|
SCAN_SIMPLE_CASE(HMC5883L_ADDR, HMC5883L, "HMC5883L 3-Axis digital compass found")
|
||||||
|
SCAN_SIMPLE_CASE(PMSA0031_ADDR, PMSA0031, "PMSA0031 air quality sensor found")
|
||||||
|
SCAN_SIMPLE_CASE(BMA423_ADDR, BMA423, "BMA423 accelerometer found");
|
||||||
|
SCAN_SIMPLE_CASE(LSM6DS3_ADDR, LSM6DS3, "LSM6DS3 accelerometer found at address 0x%x", (uint8_t)addr.address);
|
||||||
|
SCAN_SIMPLE_CASE(TCA9535_ADDR, TCA9535, "TCA9535 I2C expander found");
|
||||||
|
SCAN_SIMPLE_CASE(TCA9555_ADDR, TCA9555, "TCA9555 I2C expander found");
|
||||||
|
SCAN_SIMPLE_CASE(VEML7700_ADDR, VEML7700, "VEML7700 light sensor found");
|
||||||
|
SCAN_SIMPLE_CASE(TSL25911_ADDR, TSL2591, "TSL2591 light sensor found");
|
||||||
|
SCAN_SIMPLE_CASE(OPT3001_ADDR, OPT3001, "OPT3001 light sensor found");
|
||||||
|
SCAN_SIMPLE_CASE(MLX90632_ADDR, MLX90632, "MLX90632 IR temp sensor found");
|
||||||
|
SCAN_SIMPLE_CASE(NAU7802_ADDR, NAU7802, "NAU7802 based scale found");
|
||||||
|
SCAN_SIMPLE_CASE(FT6336U_ADDR, FT6336U, "FT6336U touchscreen found");
|
||||||
|
SCAN_SIMPLE_CASE(MAX1704X_ADDR, MAX17048, "MAX17048 lipo fuel gauge found");
|
||||||
|
#ifdef HAS_TPS65233
|
||||||
|
SCAN_SIMPLE_CASE(TPS65233_ADDR, TPS65233, "TPS65233 BIAS-T found");
|
||||||
|
#endif
|
||||||
|
SCAN_SIMPLE_CASE(MLX90614_ADDR_DEF, MLX90614, "MLX90614 IR temp sensor found");
|
||||||
|
|
||||||
SCAN_SIMPLE_CASE(PMSA0031_ADDR, PMSA0031, "PMSA0031 air quality sensor found\n")
|
case ICM20948_ADDR: // same as BMX160_ADDR
|
||||||
SCAN_SIMPLE_CASE(MPU6050_ADDR, MPU6050, "MPU6050 accelerometer found\n");
|
case ICM20948_ADDR_ALT: // same as MPU6050_ADDR
|
||||||
SCAN_SIMPLE_CASE(BMX160_ADDR, BMX160, "BMX160 accelerometer found\n");
|
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x00), 1);
|
||||||
SCAN_SIMPLE_CASE(BMA423_ADDR, BMA423, "BMA423 accelerometer found\n");
|
if (registerValue == 0xEA) {
|
||||||
SCAN_SIMPLE_CASE(LSM6DS3_ADDR, LSM6DS3, "LSM6DS3 accelerometer found at address 0x%x\n", (uint8_t)addr.address);
|
type = ICM20948;
|
||||||
SCAN_SIMPLE_CASE(TCA9555_ADDR, TCA9555, "TCA9555 I2C expander found\n");
|
LOG_INFO("ICM20948 9-dof motion processor found");
|
||||||
SCAN_SIMPLE_CASE(VEML7700_ADDR, VEML7700, "VEML7700 light sensor found\n");
|
break;
|
||||||
SCAN_SIMPLE_CASE(TSL25911_ADDR, TSL2591, "TSL2591 light sensor found\n");
|
} else if (addr.address == BMX160_ADDR) {
|
||||||
SCAN_SIMPLE_CASE(OPT3001_ADDR, OPT3001, "OPT3001 light sensor found\n");
|
type = BMX160;
|
||||||
SCAN_SIMPLE_CASE(MLX90632_ADDR, MLX90632, "MLX90632 IR temp sensor found\n");
|
LOG_INFO("BMX160 accelerometer found");
|
||||||
SCAN_SIMPLE_CASE(NAU7802_ADDR, NAU7802, "NAU7802 based scale found\n");
|
break;
|
||||||
|
} else {
|
||||||
|
type = MPU6050;
|
||||||
|
LOG_INFO("MPU6050 accelerometer found");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOG_INFO("Device found at address 0x%x was not able to be enumerated\n", addr.address);
|
LOG_INFO("Device found at address 0x%x was not able to be enumerated", addr.address);
|
||||||
}
|
}
|
||||||
} else if (err == 4) {
|
} else if (err == 4) {
|
||||||
LOG_ERROR("Unknown error at address 0x%x\n", addr.address);
|
LOG_ERROR("Unknown error at address 0x%x", addr.address);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a type was found for the enumerated device - save, if so
|
// Check if a type was found for the enumerated device - save, if so
|
||||||
@@ -403,7 +453,7 @@ TwoWire *ScanI2CTwoWire::fetchI2CBus(ScanI2C::DeviceAddress address) const
|
|||||||
if (address.port == ScanI2C::I2CPort::WIRE) {
|
if (address.port == ScanI2C::I2CPort::WIRE) {
|
||||||
return &Wire;
|
return &Wire;
|
||||||
} else {
|
} else {
|
||||||
#ifdef I2C_SDA1
|
#if WIRE_INTERFACES_COUNT == 2
|
||||||
return &Wire1;
|
return &Wire1;
|
||||||
#else
|
#else
|
||||||
return &Wire;
|
return &Wire;
|
||||||
@@ -415,4 +465,4 @@ size_t ScanI2CTwoWire::countDevices() const
|
|||||||
{
|
{
|
||||||
return foundDevices.size();
|
return foundDevices.size();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -3,13 +3,13 @@
|
|||||||
uint32_t axpDebugRead()
|
uint32_t axpDebugRead()
|
||||||
{
|
{
|
||||||
axp.debugCharging();
|
axp.debugCharging();
|
||||||
LOG_DEBUG("vbus current %f\n", axp.getVbusCurrent());
|
LOG_DEBUG("vbus current %f", axp.getVbusCurrent());
|
||||||
LOG_DEBUG("charge current %f\n", axp.getBattChargeCurrent());
|
LOG_DEBUG("charge current %f", axp.getBattChargeCurrent());
|
||||||
LOG_DEBUG("bat voltage %f\n", axp.getBattVoltage());
|
LOG_DEBUG("bat voltage %f", axp.getBattVoltage());
|
||||||
LOG_DEBUG("batt pct %d\n", axp.getBattPercentage());
|
LOG_DEBUG("batt pct %d", axp.getBattPercentage());
|
||||||
LOG_DEBUG("is battery connected %d\n", axp.isBatteryConnect());
|
LOG_DEBUG("is battery connected %d", axp.isBatteryConnect());
|
||||||
LOG_DEBUG("is USB connected %d\n", axp.isVBUSPlug());
|
LOG_DEBUG("is USB connected %d", axp.isVBUSPlug());
|
||||||
LOG_DEBUG("is charging %d\n", axp.isChargeing());
|
LOG_DEBUG("is charging %d", axp.isChargeing());
|
||||||
|
|
||||||
return 30 * 1000;
|
return 30 * 1000;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,9 +59,9 @@ void scanEInkDevice(void)
|
|||||||
d_writeCommand(0x20);
|
d_writeCommand(0x20);
|
||||||
eink_found = (d_waitWhileBusy(150) > 0) ? true : false;
|
eink_found = (d_waitWhileBusy(150) > 0) ? true : false;
|
||||||
if (eink_found)
|
if (eink_found)
|
||||||
LOG_DEBUG("EInk display found\n");
|
LOG_DEBUG("EInk display found");
|
||||||
else
|
else
|
||||||
LOG_DEBUG("EInk display not found\n");
|
LOG_DEBUG("EInk display not found");
|
||||||
SPI1.end();
|
SPI1.end();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
703
src/gps/GPS.cpp
@@ -26,11 +26,16 @@ struct uBloxGnssModelInfo {
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
GNSS_MODEL_ATGM336H,
|
GNSS_MODEL_ATGM336H,
|
||||||
GNSS_MODEL_MTK,
|
GNSS_MODEL_MTK,
|
||||||
GNSS_MODEL_UBLOX,
|
GNSS_MODEL_UBLOX6,
|
||||||
|
GNSS_MODEL_UBLOX7,
|
||||||
|
GNSS_MODEL_UBLOX8,
|
||||||
|
GNSS_MODEL_UBLOX9,
|
||||||
|
GNSS_MODEL_UBLOX10,
|
||||||
GNSS_MODEL_UC6580,
|
GNSS_MODEL_UC6580,
|
||||||
GNSS_MODEL_UNKNOWN,
|
GNSS_MODEL_UNKNOWN,
|
||||||
GNSS_MODEL_MTK_L76B,
|
GNSS_MODEL_MTK_L76B,
|
||||||
GNSS_MODEL_AG3335
|
GNSS_MODEL_AG3335,
|
||||||
|
GNSS_MODEL_AG3352
|
||||||
} GnssModel_t;
|
} GnssModel_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@@ -101,7 +106,7 @@ class GPS : private concurrency::OSThread
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/** If !NULL we will use this serial port to construct our GPS */
|
/** If !NULL we will use this serial port to construct our GPS */
|
||||||
#if defined(RPI_PICO_WAVESHARE)
|
#if defined(ARCH_RP2040)
|
||||||
static SerialUART *_serial_gps;
|
static SerialUART *_serial_gps;
|
||||||
#else
|
#else
|
||||||
static HardwareSerial *_serial_gps;
|
static HardwareSerial *_serial_gps;
|
||||||
@@ -129,6 +134,7 @@ class GPS : private concurrency::OSThread
|
|||||||
static const uint8_t _message_GGA[];
|
static const uint8_t _message_GGA[];
|
||||||
static const uint8_t _message_PMS[];
|
static const uint8_t _message_PMS[];
|
||||||
static const uint8_t _message_SAVE[];
|
static const uint8_t _message_SAVE[];
|
||||||
|
static const uint8_t _message_SAVE_10[];
|
||||||
|
|
||||||
// VALSET Commands for M10
|
// VALSET Commands for M10
|
||||||
static const uint8_t _message_VALSET_PM[];
|
static const uint8_t _message_VALSET_PM[];
|
||||||
@@ -150,6 +156,8 @@ class GPS : private concurrency::OSThread
|
|||||||
static const uint8_t _message_CAS_CFG_NAVX_CONF[];
|
static const uint8_t _message_CAS_CFG_NAVX_CONF[];
|
||||||
static const uint8_t _message_CAS_CFG_RATE_1HZ[];
|
static const uint8_t _message_CAS_CFG_RATE_1HZ[];
|
||||||
|
|
||||||
|
const char *ACK_SUCCESS_MESSAGE = "Get ack success!";
|
||||||
|
|
||||||
meshtastic_Position p = meshtastic_Position_init_default;
|
meshtastic_Position p = meshtastic_Position_init_default;
|
||||||
|
|
||||||
/** This is normally bound to config.position.gps_en_gpio but some rare boards (like heltec tracker) need more advanced
|
/** This is normally bound to config.position.gps_en_gpio but some rare boards (like heltec tracker) need more advanced
|
||||||
@@ -309,4 +317,4 @@ class GPS : private concurrency::OSThread
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern GPS *gps;
|
extern GPS *gps;
|
||||||
#endif // Exclude GPS
|
#endif // Exclude GPS
|
||||||
@@ -13,7 +13,7 @@ void GPSUpdateScheduling::informSearching()
|
|||||||
void GPSUpdateScheduling::informGotLock()
|
void GPSUpdateScheduling::informGotLock()
|
||||||
{
|
{
|
||||||
searchEndedMs = millis();
|
searchEndedMs = millis();
|
||||||
LOG_DEBUG("Took %us to get lock\n", (searchEndedMs - searchStartedMs) / 1000);
|
LOG_DEBUG("Took %us to get lock", (searchEndedMs - searchStartedMs) / 1000);
|
||||||
updateLockTimePrediction();
|
updateLockTimePrediction();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ void GPSUpdateScheduling::updateLockTimePrediction()
|
|||||||
|
|
||||||
searchCount++; // Only tracked so we can diregard initial lock-times
|
searchCount++; // Only tracked so we can diregard initial lock-times
|
||||||
|
|
||||||
LOG_DEBUG("Predicting %us to get next lock\n", predictedMsToGetLock / 1000);
|
LOG_DEBUG("Predicting %us to get next lock", predictedMsToGetLock / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// How long do we expect to spend searching for a lock?
|
// How long do we expect to spend searching for a lock?
|
||||||
|
|||||||
@@ -75,10 +75,13 @@ uint32_t printWPL(char *buf, size_t bufsz, const meshtastic_Position &pos, const
|
|||||||
uint32_t printGGA(char *buf, size_t bufsz, const meshtastic_Position &pos)
|
uint32_t printGGA(char *buf, size_t bufsz, const meshtastic_Position &pos)
|
||||||
{
|
{
|
||||||
GeoCoord geoCoord(pos.latitude_i, pos.longitude_i, pos.altitude);
|
GeoCoord geoCoord(pos.latitude_i, pos.longitude_i, pos.altitude);
|
||||||
tm *t = gmtime((time_t *)&pos.timestamp);
|
time_t timestamp = pos.timestamp;
|
||||||
|
|
||||||
|
tm *t = gmtime(×tamp);
|
||||||
if (getRTCQuality() > 0) { // use the device clock if we got time from somewhere. If not, use the GPS timestamp.
|
if (getRTCQuality() > 0) { // use the device clock if we got time from somewhere. If not, use the GPS timestamp.
|
||||||
uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice);
|
uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice);
|
||||||
t = gmtime((time_t *)&rtc_sec);
|
timestamp = rtc_sec;
|
||||||
|
t = gmtime(×tamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t len = snprintf(
|
uint32_t len = snprintf(
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "detect/ScanI2C.h"
|
#include "detect/ScanI2C.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include <Throttle.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@ void readFromRTC()
|
|||||||
if (rtc_found.address == RV3028_RTC) {
|
if (rtc_found.address == RV3028_RTC) {
|
||||||
uint32_t now = millis();
|
uint32_t now = millis();
|
||||||
Melopero_RV3028 rtc;
|
Melopero_RV3028 rtc;
|
||||||
#ifdef I2C_SDA1
|
#if WIRE_INTERFACES_COUNT == 2
|
||||||
rtc.initI2C(rtc_found.port == ScanI2C::I2CPort::WIRE1 ? Wire1 : Wire);
|
rtc.initI2C(rtc_found.port == ScanI2C::I2CPort::WIRE1 ? Wire1 : Wire);
|
||||||
#else
|
#else
|
||||||
rtc.initI2C();
|
rtc.initI2C();
|
||||||
@@ -43,7 +44,10 @@ void readFromRTC()
|
|||||||
t.tm_sec = rtc.getSecond();
|
t.tm_sec = rtc.getSecond();
|
||||||
tv.tv_sec = gm_mktime(&t);
|
tv.tv_sec = gm_mktime(&t);
|
||||||
tv.tv_usec = 0;
|
tv.tv_usec = 0;
|
||||||
LOG_DEBUG("Read RTC time from RV3028 as %ld\n", tv.tv_sec);
|
|
||||||
|
uint32_t printableEpoch = tv.tv_sec; // Print lib only supports 32 bit but time_t can be 64 bit on some platforms
|
||||||
|
LOG_DEBUG("Read RTC time from RV3028 getTime as %02d-%02d-%02d %02d:%02d:%02d (%ld)", t.tm_year + 1900, t.tm_mon + 1,
|
||||||
|
t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec, printableEpoch);
|
||||||
timeStartMsec = now;
|
timeStartMsec = now;
|
||||||
zeroOffsetSecs = tv.tv_sec;
|
zeroOffsetSecs = tv.tv_sec;
|
||||||
if (currentQuality == RTCQualityNone) {
|
if (currentQuality == RTCQualityNone) {
|
||||||
@@ -55,7 +59,7 @@ void readFromRTC()
|
|||||||
uint32_t now = millis();
|
uint32_t now = millis();
|
||||||
PCF8563_Class rtc;
|
PCF8563_Class rtc;
|
||||||
|
|
||||||
#ifdef I2C_SDA1
|
#if WIRE_INTERFACES_COUNT == 2
|
||||||
rtc.begin(rtc_found.port == ScanI2C::I2CPort::WIRE1 ? Wire1 : Wire);
|
rtc.begin(rtc_found.port == ScanI2C::I2CPort::WIRE1 ? Wire1 : Wire);
|
||||||
#else
|
#else
|
||||||
rtc.begin();
|
rtc.begin();
|
||||||
@@ -71,7 +75,10 @@ void readFromRTC()
|
|||||||
t.tm_sec = tc.second;
|
t.tm_sec = tc.second;
|
||||||
tv.tv_sec = gm_mktime(&t);
|
tv.tv_sec = gm_mktime(&t);
|
||||||
tv.tv_usec = 0;
|
tv.tv_usec = 0;
|
||||||
LOG_DEBUG("Read RTC time from PCF8563 as %ld\n", tv.tv_sec);
|
|
||||||
|
uint32_t printableEpoch = tv.tv_sec; // Print lib only supports 32 bit but time_t can be 64 bit on some platforms
|
||||||
|
LOG_DEBUG("Read RTC time from PCF8563 getDateTime as %02d-%02d-%02d %02d:%02d:%02d (%ld)", t.tm_year + 1900, t.tm_mon + 1,
|
||||||
|
t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec, printableEpoch);
|
||||||
timeStartMsec = now;
|
timeStartMsec = now;
|
||||||
zeroOffsetSecs = tv.tv_sec;
|
zeroOffsetSecs = tv.tv_sec;
|
||||||
if (currentQuality == RTCQualityNone) {
|
if (currentQuality == RTCQualityNone) {
|
||||||
@@ -81,7 +88,8 @@ void readFromRTC()
|
|||||||
#else
|
#else
|
||||||
if (!gettimeofday(&tv, NULL)) {
|
if (!gettimeofday(&tv, NULL)) {
|
||||||
uint32_t now = millis();
|
uint32_t now = millis();
|
||||||
LOG_DEBUG("Read RTC time as %ld\n", tv.tv_sec);
|
uint32_t printableEpoch = tv.tv_sec; // Print lib only supports 32 bit but time_t can be 64 bit on some platforms
|
||||||
|
LOG_DEBUG("Read RTC time as %ld", printableEpoch);
|
||||||
timeStartMsec = now;
|
timeStartMsec = now;
|
||||||
zeroOffsetSecs = tv.tv_sec;
|
zeroOffsetSecs = tv.tv_sec;
|
||||||
}
|
}
|
||||||
@@ -101,22 +109,32 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate)
|
|||||||
{
|
{
|
||||||
static uint32_t lastSetMsec = 0;
|
static uint32_t lastSetMsec = 0;
|
||||||
uint32_t now = millis();
|
uint32_t now = millis();
|
||||||
|
uint32_t printableEpoch = tv->tv_sec; // Print lib only supports 32 bit but time_t can be 64 bit on some platforms
|
||||||
|
#ifdef BUILD_EPOCH
|
||||||
|
if (tv->tv_sec < BUILD_EPOCH) {
|
||||||
|
LOG_WARN("Ignoring time (%ld) before build epoch (%ld)!", printableEpoch, BUILD_EPOCH);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool shouldSet;
|
bool shouldSet;
|
||||||
if (forceUpdate) {
|
if (forceUpdate) {
|
||||||
shouldSet = true;
|
shouldSet = true;
|
||||||
LOG_DEBUG("Overriding current RTC quality (%s) with incoming time of RTC quality of %s\n", RtcName(currentQuality),
|
LOG_DEBUG("Overriding current RTC quality (%s) with incoming time of RTC quality of %s", RtcName(currentQuality),
|
||||||
RtcName(q));
|
RtcName(q));
|
||||||
} else if (q > currentQuality) {
|
} else if (q > currentQuality) {
|
||||||
shouldSet = true;
|
shouldSet = true;
|
||||||
LOG_DEBUG("Upgrading time to quality %s\n", RtcName(q));
|
LOG_DEBUG("Upgrading time to quality %s", RtcName(q));
|
||||||
} else if (q >= RTCQualityNTP && (now - lastSetMsec) > (12 * 60 * 60 * 1000UL)) {
|
} else if (q == RTCQualityGPS) {
|
||||||
// Every 12 hrs we will slam in a new GPS or Phone GPS / NTP time, to correct for local RTC clock drift
|
|
||||||
shouldSet = true;
|
shouldSet = true;
|
||||||
LOG_DEBUG("Reapplying external time to correct clock drift %ld secs\n", tv->tv_sec);
|
LOG_DEBUG("Reapplying GPS time: %ld secs", printableEpoch);
|
||||||
|
} else if (q == RTCQualityNTP && !Throttle::isWithinTimespanMs(lastSetMsec, (12 * 60 * 60 * 1000UL))) {
|
||||||
|
// Every 12 hrs we will slam in a new NTP or Phone GPS / NTP time, to correct for local RTC clock drift
|
||||||
|
shouldSet = true;
|
||||||
|
LOG_DEBUG("Reapplying external time to correct clock drift %ld secs", printableEpoch);
|
||||||
} else {
|
} else {
|
||||||
shouldSet = false;
|
shouldSet = false;
|
||||||
LOG_DEBUG("Current RTC quality: %s. Ignoring time of RTC quality of %s\n", RtcName(currentQuality), RtcName(q));
|
LOG_DEBUG("Current RTC quality: %s. Ignoring time of RTC quality of %s", RtcName(currentQuality), RtcName(q));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldSet) {
|
if (shouldSet) {
|
||||||
@@ -133,29 +151,29 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate)
|
|||||||
#ifdef RV3028_RTC
|
#ifdef RV3028_RTC
|
||||||
if (rtc_found.address == RV3028_RTC) {
|
if (rtc_found.address == RV3028_RTC) {
|
||||||
Melopero_RV3028 rtc;
|
Melopero_RV3028 rtc;
|
||||||
#ifdef I2C_SDA1
|
#if WIRE_INTERFACES_COUNT == 2
|
||||||
rtc.initI2C(rtc_found.port == ScanI2C::I2CPort::WIRE1 ? Wire1 : Wire);
|
rtc.initI2C(rtc_found.port == ScanI2C::I2CPort::WIRE1 ? Wire1 : Wire);
|
||||||
#else
|
#else
|
||||||
rtc.initI2C();
|
rtc.initI2C();
|
||||||
#endif
|
#endif
|
||||||
tm *t = gmtime(&tv->tv_sec);
|
tm *t = gmtime(&tv->tv_sec);
|
||||||
rtc.setTime(t->tm_year + 1900, t->tm_mon + 1, t->tm_wday, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
|
rtc.setTime(t->tm_year + 1900, t->tm_mon + 1, t->tm_wday, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
|
||||||
LOG_DEBUG("RV3028_RTC setTime %02d-%02d-%02d %02d:%02d:%02d %ld\n", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
|
LOG_DEBUG("RV3028_RTC setTime %02d-%02d-%02d %02d:%02d:%02d (%ld)", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
|
||||||
t->tm_hour, t->tm_min, t->tm_sec, tv->tv_sec);
|
t->tm_hour, t->tm_min, t->tm_sec, printableEpoch);
|
||||||
}
|
}
|
||||||
#elif defined(PCF8563_RTC)
|
#elif defined(PCF8563_RTC)
|
||||||
if (rtc_found.address == PCF8563_RTC) {
|
if (rtc_found.address == PCF8563_RTC) {
|
||||||
PCF8563_Class rtc;
|
PCF8563_Class rtc;
|
||||||
|
|
||||||
#ifdef I2C_SDA1
|
#if WIRE_INTERFACES_COUNT == 2
|
||||||
rtc.begin(rtc_found.port == ScanI2C::I2CPort::WIRE1 ? Wire1 : Wire);
|
rtc.begin(rtc_found.port == ScanI2C::I2CPort::WIRE1 ? Wire1 : Wire);
|
||||||
#else
|
#else
|
||||||
rtc.begin();
|
rtc.begin();
|
||||||
#endif
|
#endif
|
||||||
tm *t = gmtime(&tv->tv_sec);
|
tm *t = gmtime(&tv->tv_sec);
|
||||||
rtc.setDateTime(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
|
rtc.setDateTime(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
|
||||||
LOG_DEBUG("PCF8563_RTC setDateTime %02d-%02d-%02d %02d:%02d:%02d %ld\n", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
|
LOG_DEBUG("PCF8563_RTC setDateTime %02d-%02d-%02d %02d:%02d:%02d (%ld)", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
|
||||||
t->tm_hour, t->tm_min, t->tm_sec, tv->tv_sec);
|
t->tm_hour, t->tm_min, t->tm_sec, printableEpoch);
|
||||||
}
|
}
|
||||||
#elif defined(ARCH_ESP32)
|
#elif defined(ARCH_ESP32)
|
||||||
settimeofday(tv, NULL);
|
settimeofday(tv, NULL);
|
||||||
@@ -210,9 +228,9 @@ bool perhapsSetRTC(RTCQuality q, struct tm &t)
|
|||||||
tv.tv_sec = res;
|
tv.tv_sec = res;
|
||||||
tv.tv_usec = 0; // time.centisecond() * (10 / 1000);
|
tv.tv_usec = 0; // time.centisecond() * (10 / 1000);
|
||||||
|
|
||||||
// LOG_DEBUG("Got time from GPS month=%d, year=%d, unixtime=%ld\n", t.tm_mon, t.tm_year, tv.tv_sec);
|
// LOG_DEBUG("Got time from GPS month=%d, year=%d, unixtime=%ld", t.tm_mon, t.tm_year, tv.tv_sec);
|
||||||
if (t.tm_year < 0 || t.tm_year >= 300) {
|
if (t.tm_year < 0 || t.tm_year >= 300) {
|
||||||
// LOG_DEBUG("Ignoring invalid GPS month=%d, year=%d, unixtime=%ld\n", t.tm_mon, t.tm_year, tv.tv_sec);
|
// LOG_DEBUG("Ignoring invalid GPS month=%d, year=%d, unixtime=%ld", t.tm_mon, t.tm_year, tv.tv_sec);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return perhapsSetRTC(q, &tv);
|
return perhapsSetRTC(q, &tv);
|
||||||
@@ -272,4 +290,4 @@ time_t gm_mktime(struct tm *tm)
|
|||||||
#else
|
#else
|
||||||
return mktime(tm);
|
return mktime(tm);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
const char *failMessage = "Unable to %s";
|
||||||
|
|
||||||
|
#define SEND_UBX_PACKET(TYPE, ID, DATA, ERRMSG, TIMEOUT) \
|
||||||
|
msglen = makeUBXPacket(TYPE, ID, sizeof(DATA), DATA); \
|
||||||
|
_serial_gps->write(UBXscratch, msglen); \
|
||||||
|
if (getACK(TYPE, ID, TIMEOUT) != GNSS_RESPONSE_OK) { \
|
||||||
|
LOG_WARN(failMessage, #ERRMSG); \
|
||||||
|
}
|
||||||
|
|
||||||
// Power Management
|
// Power Management
|
||||||
|
|
||||||
uint8_t GPS::_message_PMREQ[] PROGMEM = {
|
uint8_t GPS::_message_PMREQ[] PROGMEM = {
|
||||||
@@ -316,6 +325,13 @@ const uint8_t GPS::_message_SAVE[] = {
|
|||||||
0x17 // deviceMask: BBR, Flash, EEPROM, and SPI Flash
|
0x17 // deviceMask: BBR, Flash, EEPROM, and SPI Flash
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const uint8_t GPS::_message_SAVE_10[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, // clearMask: no sections cleared
|
||||||
|
0xFF, 0xFF, 0x00, 0x00, // saveMask: save all sections
|
||||||
|
0x00, 0x00, 0x00, 0x00, // loadMask: no sections loaded
|
||||||
|
0x01 // deviceMask: only save to BBR
|
||||||
|
};
|
||||||
|
|
||||||
// As the M10 has no flash, the best we can do to preserve the config is to set it in RAM and BBR.
|
// As the M10 has no flash, the best we can do to preserve the config is to set it in RAM and BBR.
|
||||||
// BBR will survive a restart, and power off for a while, but modules with small backup
|
// BBR will survive a restart, and power off for a while, but modules with small backup
|
||||||
// batteries or super caps will not retain the config for a long power off time.
|
// batteries or super caps will not retain the config for a long power off time.
|
||||||
@@ -335,36 +351,36 @@ const uint8_t GPS::_message_SAVE[] = {
|
|||||||
// has details on low-power modes
|
// has details on low-power modes
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CFG-PM2 has been replaced by many CFG-PM commands
|
OPERATEMODE E1 2 (0 | 1 | 2)
|
||||||
CFG-PMS has been removed
|
POSUPDATEPERIOD U4 5
|
||||||
|
ACQPERIOD U4 10
|
||||||
CFG-PM-OPERATEMODE E1 (0 | 1 | 2) -> 1 (PSMOO), because sporadic position updates are required instead of continous tracking <10s
|
GRIDOFFSET U4 0
|
||||||
(PSMCT) CFG-PM-POSUPDATEPERIOD U4 -> 0ms, no self-timed wakup because receiver power mode is controlled via "software standby
|
ONTIME U2 1
|
||||||
mode" by legacy UBX-RXM-PMREQ request CFG-PM-ACQPERIOD U4 -> 0ms, because receiver power mode is controlled via "software standby
|
MINACQTIME U1 0
|
||||||
mode" by legacy UBX-RXM-PMREQ request CFG-PM-ONTIME U4 -> 0ms, optional I guess CFG-PM-EXTINTBACKUP L -> 1, force receiver into
|
MAXACQTIME U1 0
|
||||||
BACKUP mode when EXTINT (should be connected to GPS_EN_PIN) pin is "low"
|
DONOTENTEROFF L 1
|
||||||
|
WAITTIMEFIX L 1
|
||||||
This is required because the receiver never enters low power mode if microcontroller is in deep-sleep.
|
UPDATEEPH L 1
|
||||||
Maybe the changing UART_RX levels trigger a wakeup but even with UBX-RXM-PMREQ[12] = 0x00 (all external wakeup sources disabled)
|
EXTINTWAKE L 0 no ext ints
|
||||||
the receivcer remains in aquisition state -> potentially a bug
|
EXTINTBACKUP L 0 no ext ints
|
||||||
|
EXTINTINACTIVE L 0 no ext ints
|
||||||
Workaround: Control the EXTINT pin by the GPS_EN_PIN signal
|
EXTINTACTIVITY U4 0 no ext ints
|
||||||
|
LIMITPEAKCURRENT L 1
|
||||||
As mentioned in the M10 operational issues down below, power save won't allow the use of BDS B1C.
|
|
||||||
CFG-SIGNAL-BDS_B1C_ENA L -> 0
|
|
||||||
|
|
||||||
// Ram layer config message:
|
// Ram layer config message:
|
||||||
// 01 01 00 00 01 00 D0 20 01 02 00 D0 40 00 00 00 00 03 00 D0 40 00 00 00 00 05 00 D0 30 00 00 0D 00 D0 10 01
|
// b5 62 06 8a 26 00 00 01 00 00 01 00 d0 20 02 02 00 d0 40 05 00 00 00 05 00 d0 30 01 00 08 00 d0 10 01 09 00 d0 10 01 10 00 d0
|
||||||
|
// 10 01 8b de
|
||||||
|
|
||||||
// BBR layer config message:
|
// BBR layer config message:
|
||||||
// 01 02 00 00 01 00 D0 20 01 02 00 D0 40 00 00 00 00 03 00 D0 40 00 00 00 00 05 00 D0 30 00 00 0D 00 D0 10 01
|
// b5 62 06 8a 26 00 00 02 00 00 01 00 d0 20 02 02 00 d0 40 05 00 00 00 05 00 d0 30 01 00 08 00 d0 10 01 09 00 d0 10 01 10 00 d0
|
||||||
|
// 10 01 8c 03
|
||||||
*/
|
*/
|
||||||
const uint8_t GPS::_message_VALSET_PM_RAM[] = {0x01, 0x01, 0x00, 0x00, 0x0F, 0x00, 0x31, 0x10, 0x00, 0x01, 0x00, 0xD0, 0x20, 0x01,
|
const uint8_t GPS::_message_VALSET_PM_RAM[] = {0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0xd0, 0x20, 0x02, 0x02, 0x00, 0xd0, 0x40,
|
||||||
0x02, 0x00, 0xD0, 0x40, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0xD0, 0x40, 0x00, 0x00,
|
0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0xd0, 0x30, 0x01, 0x00, 0x08, 0x00, 0xd0,
|
||||||
0x00, 0x00, 0x05, 0x00, 0xD0, 0x30, 0x00, 0x00, 0x0D, 0x00, 0xD0, 0x10, 0x01};
|
0x10, 0x01, 0x09, 0x00, 0xd0, 0x10, 0x01, 0x10, 0x00, 0xd0, 0x10, 0x01};
|
||||||
const uint8_t GPS::_message_VALSET_PM_BBR[] = {0x01, 0x02, 0x00, 0x00, 0x0F, 0x00, 0x31, 0x10, 0x00, 0x01, 0x00, 0xD0, 0x20, 0x01,
|
const uint8_t GPS::_message_VALSET_PM_BBR[] = {0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0xd0, 0x20, 0x02, 0x02, 0x00, 0xd0, 0x40,
|
||||||
0x02, 0x00, 0xD0, 0x40, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0xD0, 0x40, 0x00, 0x00,
|
0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0xd0, 0x30, 0x01, 0x00, 0x08, 0x00, 0xd0,
|
||||||
0x00, 0x00, 0x05, 0x00, 0xD0, 0x30, 0x00, 0x00, 0x0D, 0x00, 0xD0, 0x10, 0x01};
|
0x10, 0x01, 0x09, 0x00, 0xd0, 0x10, 0x01, 0x10, 0x00, 0xd0, 0x10, 0x01};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CFG-ITFM replaced by 5 valset messages which can be combined into one for RAM and one for BBR
|
CFG-ITFM replaced by 5 valset messages which can be combined into one for RAM and one for BBR
|
||||||
|
|||||||
@@ -79,13 +79,13 @@ bool EInkDisplay::forceDisplay(uint32_t msecLimit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Trigger the refresh in GxEPD2
|
// Trigger the refresh in GxEPD2
|
||||||
LOG_DEBUG("Updating E-Paper... ");
|
LOG_DEBUG("Updating E-Paper");
|
||||||
adafruitDisplay->nextPage();
|
adafruitDisplay->nextPage();
|
||||||
|
|
||||||
// End the update process
|
// End the update process
|
||||||
endUpdate();
|
endUpdate();
|
||||||
|
|
||||||
LOG_DEBUG("done\n");
|
LOG_DEBUG("done");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ void EInkDisplay::setDetected(uint8_t detected)
|
|||||||
// Connect to the display - variant specific
|
// Connect to the display - variant specific
|
||||||
bool EInkDisplay::connect()
|
bool EInkDisplay::connect()
|
||||||
{
|
{
|
||||||
LOG_INFO("Doing EInk init\n");
|
LOG_INFO("Doing EInk init");
|
||||||
|
|
||||||
#ifdef PIN_EINK_EN
|
#ifdef PIN_EINK_EN
|
||||||
// backlight power, HIGH is backlight on, LOW is off
|
// backlight power, HIGH is backlight on, LOW is off
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#include "Throttle.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
|
||||||
#if defined(USE_EINK) && defined(USE_EINK_DYNAMICDISPLAY)
|
#if defined(USE_EINK) && defined(USE_EINK_DYNAMICDISPLAY)
|
||||||
@@ -118,7 +119,7 @@ void EInkDynamicDisplay::endOrDetach()
|
|||||||
awaitRefresh();
|
awaitRefresh();
|
||||||
else {
|
else {
|
||||||
// Async begins
|
// Async begins
|
||||||
LOG_DEBUG("Async full-refresh begins (dropping frames)\n");
|
LOG_DEBUG("Async full-refresh begins (dropping frames)");
|
||||||
notifyLater(intervalPollAsyncRefresh, DUE_POLL_ASYNCREFRESH, true); // Hand-off to NotifiedWorkerThread
|
notifyLater(intervalPollAsyncRefresh, DUE_POLL_ASYNCREFRESH, true); // Hand-off to NotifiedWorkerThread
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -132,7 +133,7 @@ void EInkDynamicDisplay::endOrDetach()
|
|||||||
if (previousRefresh == FULL || previousRefresh == FAST) { // If refresh wasn't skipped (on unspecified..)
|
if (previousRefresh == FULL || previousRefresh == FAST) { // If refresh wasn't skipped (on unspecified..)
|
||||||
LOG_WARN(
|
LOG_WARN(
|
||||||
"GxEPD2 version has not been modified to support async refresh; using fallback behavior. Please update lib_deps in "
|
"GxEPD2 version has not been modified to support async refresh; using fallback behavior. Please update lib_deps in "
|
||||||
"variant's platformio.ini file\n");
|
"variant's platformio.ini file");
|
||||||
EInkDisplay::endUpdate();
|
EInkDisplay::endUpdate();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -169,7 +170,7 @@ bool EInkDynamicDisplay::determineMode()
|
|||||||
checkFastRequested();
|
checkFastRequested();
|
||||||
|
|
||||||
if (refresh == UNSPECIFIED)
|
if (refresh == UNSPECIFIED)
|
||||||
LOG_WARN("There was a flaw in the determineMode() logic.\n");
|
LOG_WARN("There was a flaw in the determineMode() logic.");
|
||||||
|
|
||||||
// -- Decision has been reached --
|
// -- Decision has been reached --
|
||||||
applyRefreshMode();
|
applyRefreshMode();
|
||||||
@@ -231,15 +232,13 @@ void EInkDynamicDisplay::checkForPromotion()
|
|||||||
// Is it too soon for another frame of this type?
|
// Is it too soon for another frame of this type?
|
||||||
void EInkDynamicDisplay::checkRateLimiting()
|
void EInkDynamicDisplay::checkRateLimiting()
|
||||||
{
|
{
|
||||||
uint32_t now = millis();
|
|
||||||
|
|
||||||
// Sanity check: millis() overflow - just let the update run..
|
// Sanity check: millis() overflow - just let the update run..
|
||||||
if (previousRunMs > now)
|
if (previousRunMs > millis())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Skip update: too soon for BACKGROUND
|
// Skip update: too soon for BACKGROUND
|
||||||
if (frameFlags == BACKGROUND) {
|
if (frameFlags == BACKGROUND) {
|
||||||
if (now - previousRunMs < EINK_LIMIT_RATE_BACKGROUND_SEC * 1000) {
|
if (Throttle::isWithinTimespanMs(previousRunMs, EINK_LIMIT_RATE_BACKGROUND_SEC * 1000)) {
|
||||||
refresh = SKIPPED;
|
refresh = SKIPPED;
|
||||||
reason = EXCEEDED_RATELIMIT_FULL;
|
reason = EXCEEDED_RATELIMIT_FULL;
|
||||||
return;
|
return;
|
||||||
@@ -252,10 +251,10 @@ void EInkDynamicDisplay::checkRateLimiting()
|
|||||||
|
|
||||||
// Skip update: too soon for RESPONSIVE
|
// Skip update: too soon for RESPONSIVE
|
||||||
if (frameFlags & RESPONSIVE) {
|
if (frameFlags & RESPONSIVE) {
|
||||||
if (now - previousRunMs < EINK_LIMIT_RATE_RESPONSIVE_SEC * 1000) {
|
if (Throttle::isWithinTimespanMs(previousRunMs, EINK_LIMIT_RATE_RESPONSIVE_SEC * 1000)) {
|
||||||
refresh = SKIPPED;
|
refresh = SKIPPED;
|
||||||
reason = EXCEEDED_RATELIMIT_FAST;
|
reason = EXCEEDED_RATELIMIT_FAST;
|
||||||
LOG_DEBUG("refresh=SKIPPED, reason=EXCEEDED_RATELIMIT_FAST, frameFlags=0x%x\n", frameFlags);
|
LOG_DEBUG("refresh=SKIPPED, reason=EXCEEDED_RATELIMIT_FAST, frameFlags=0x%x", frameFlags);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -272,7 +271,7 @@ void EInkDynamicDisplay::checkCosmetic()
|
|||||||
if (frameFlags & COSMETIC) {
|
if (frameFlags & COSMETIC) {
|
||||||
refresh = FULL;
|
refresh = FULL;
|
||||||
reason = FLAGGED_COSMETIC;
|
reason = FLAGGED_COSMETIC;
|
||||||
LOG_DEBUG("refresh=FULL, reason=FLAGGED_COSMETIC, frameFlags=0x%x\n", frameFlags);
|
LOG_DEBUG("refresh=FULL, reason=FLAGGED_COSMETIC, frameFlags=0x%x", frameFlags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,7 +286,7 @@ void EInkDynamicDisplay::checkDemandingFast()
|
|||||||
if (frameFlags & DEMAND_FAST) {
|
if (frameFlags & DEMAND_FAST) {
|
||||||
refresh = FAST;
|
refresh = FAST;
|
||||||
reason = FLAGGED_DEMAND_FAST;
|
reason = FLAGGED_DEMAND_FAST;
|
||||||
LOG_DEBUG("refresh=FAST, reason=FLAGGED_DEMAND_FAST, frameFlags=0x%x\n", frameFlags);
|
LOG_DEBUG("refresh=FAST, reason=FLAGGED_DEMAND_FAST, frameFlags=0x%x", frameFlags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,7 +306,7 @@ void EInkDynamicDisplay::checkFrameMatchesPrevious()
|
|||||||
if (frameFlags == BACKGROUND && fastRefreshCount > 0) {
|
if (frameFlags == BACKGROUND && fastRefreshCount > 0) {
|
||||||
refresh = FULL;
|
refresh = FULL;
|
||||||
reason = REDRAW_WITH_FULL;
|
reason = REDRAW_WITH_FULL;
|
||||||
LOG_DEBUG("refresh=FULL, reason=REDRAW_WITH_FULL, frameFlags=0x%x\n", frameFlags);
|
LOG_DEBUG("refresh=FULL, reason=REDRAW_WITH_FULL, frameFlags=0x%x", frameFlags);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -315,7 +314,7 @@ void EInkDynamicDisplay::checkFrameMatchesPrevious()
|
|||||||
// Not redrawn, not COSMETIC, not DEMAND_FAST
|
// Not redrawn, not COSMETIC, not DEMAND_FAST
|
||||||
refresh = SKIPPED;
|
refresh = SKIPPED;
|
||||||
reason = FRAME_MATCHED_PREVIOUS;
|
reason = FRAME_MATCHED_PREVIOUS;
|
||||||
LOG_DEBUG("refresh=SKIPPED, reason=FRAME_MATCHED_PREVIOUS, frameFlags=0x%x\n", frameFlags);
|
LOG_DEBUG("refresh=SKIPPED, reason=FRAME_MATCHED_PREVIOUS, frameFlags=0x%x", frameFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Have too many fast-refreshes occured consecutively, since last full refresh?
|
// Have too many fast-refreshes occured consecutively, since last full refresh?
|
||||||
@@ -329,7 +328,7 @@ void EInkDynamicDisplay::checkConsecutiveFastRefreshes()
|
|||||||
if (fastRefreshCount >= EINK_LIMIT_FASTREFRESH) {
|
if (fastRefreshCount >= EINK_LIMIT_FASTREFRESH) {
|
||||||
refresh = FULL;
|
refresh = FULL;
|
||||||
reason = EXCEEDED_LIMIT_FASTREFRESH;
|
reason = EXCEEDED_LIMIT_FASTREFRESH;
|
||||||
LOG_DEBUG("refresh=FULL, reason=EXCEEDED_LIMIT_FASTREFRESH, frameFlags=0x%x\n", frameFlags);
|
LOG_DEBUG("refresh=FULL, reason=EXCEEDED_LIMIT_FASTREFRESH, frameFlags=0x%x", frameFlags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,13 +343,13 @@ void EInkDynamicDisplay::checkFastRequested()
|
|||||||
// If we want BACKGROUND to use fast. (FULL only when a limit is hit)
|
// If we want BACKGROUND to use fast. (FULL only when a limit is hit)
|
||||||
refresh = FAST;
|
refresh = FAST;
|
||||||
reason = BACKGROUND_USES_FAST;
|
reason = BACKGROUND_USES_FAST;
|
||||||
LOG_DEBUG("refresh=FAST, reason=BACKGROUND_USES_FAST, fastRefreshCount=%lu, frameFlags=0x%x\n", fastRefreshCount,
|
LOG_DEBUG("refresh=FAST, reason=BACKGROUND_USES_FAST, fastRefreshCount=%lu, frameFlags=0x%x", fastRefreshCount,
|
||||||
frameFlags);
|
frameFlags);
|
||||||
#else
|
#else
|
||||||
// If we do want to use FULL for BACKGROUND updates
|
// If we do want to use FULL for BACKGROUND updates
|
||||||
refresh = FULL;
|
refresh = FULL;
|
||||||
reason = FLAGGED_BACKGROUND;
|
reason = FLAGGED_BACKGROUND;
|
||||||
LOG_DEBUG("refresh=FULL, reason=FLAGGED_BACKGROUND\n");
|
LOG_DEBUG("refresh=FULL, reason=FLAGGED_BACKGROUND");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,7 +357,7 @@ void EInkDynamicDisplay::checkFastRequested()
|
|||||||
if (frameFlags & RESPONSIVE) {
|
if (frameFlags & RESPONSIVE) {
|
||||||
refresh = FAST;
|
refresh = FAST;
|
||||||
reason = NO_OBJECTIONS;
|
reason = NO_OBJECTIONS;
|
||||||
LOG_DEBUG("refresh=FAST, reason=NO_OBJECTIONS, fastRefreshCount=%lu, frameFlags=0x%x\n", fastRefreshCount, frameFlags);
|
LOG_DEBUG("refresh=FAST, reason=NO_OBJECTIONS, fastRefreshCount=%lu, frameFlags=0x%x", fastRefreshCount, frameFlags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,7 +438,7 @@ void EInkDynamicDisplay::checkExcessiveGhosting()
|
|||||||
if (ghostPixelCount > EINK_LIMIT_GHOSTING_PX) {
|
if (ghostPixelCount > EINK_LIMIT_GHOSTING_PX) {
|
||||||
refresh = FULL;
|
refresh = FULL;
|
||||||
reason = EXCEEDED_GHOSTINGLIMIT;
|
reason = EXCEEDED_GHOSTINGLIMIT;
|
||||||
LOG_DEBUG("refresh=FULL, reason=EXCEEDED_GHOSTINGLIMIT, frameFlags=0x%x\n", frameFlags);
|
LOG_DEBUG("refresh=FULL, reason=EXCEEDED_GHOSTINGLIMIT, frameFlags=0x%x", frameFlags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -470,7 +469,7 @@ void EInkDynamicDisplay::joinAsyncRefresh()
|
|||||||
if (!asyncRefreshRunning)
|
if (!asyncRefreshRunning)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LOG_DEBUG("Joining an async refresh in progress\n");
|
LOG_DEBUG("Joining an async refresh in progress");
|
||||||
|
|
||||||
// Continually poll the BUSY pin
|
// Continually poll the BUSY pin
|
||||||
while (adafruitDisplay->epd2.isBusy())
|
while (adafruitDisplay->epd2.isBusy())
|
||||||
@@ -480,7 +479,7 @@ void EInkDynamicDisplay::joinAsyncRefresh()
|
|||||||
adafruitDisplay->endAsyncFull(); // Run the end of nextPage() code
|
adafruitDisplay->endAsyncFull(); // Run the end of nextPage() code
|
||||||
EInkDisplay::endUpdate(); // Run base-class code to finish off update (NOT our derived class override)
|
EInkDisplay::endUpdate(); // Run base-class code to finish off update (NOT our derived class override)
|
||||||
asyncRefreshRunning = false; // Unset the flag
|
asyncRefreshRunning = false; // Unset the flag
|
||||||
LOG_DEBUG("Refresh complete\n");
|
LOG_DEBUG("Refresh complete");
|
||||||
|
|
||||||
// Note: this code only works because of a modification to meshtastic/GxEPD2.
|
// Note: this code only works because of a modification to meshtastic/GxEPD2.
|
||||||
// It is only equipped to intercept calls to nextPage()
|
// It is only equipped to intercept calls to nextPage()
|
||||||
@@ -504,7 +503,7 @@ void EInkDynamicDisplay::pollAsyncRefresh()
|
|||||||
adafruitDisplay->endAsyncFull(); // Run the end of nextPage() code
|
adafruitDisplay->endAsyncFull(); // Run the end of nextPage() code
|
||||||
EInkDisplay::endUpdate(); // Run base-class code to finish off update (NOT our derived class override)
|
EInkDisplay::endUpdate(); // Run base-class code to finish off update (NOT our derived class override)
|
||||||
asyncRefreshRunning = false; // Unset the flag
|
asyncRefreshRunning = false; // Unset the flag
|
||||||
LOG_DEBUG("Async full-refresh complete\n");
|
LOG_DEBUG("Async full-refresh complete");
|
||||||
|
|
||||||
// Note: this code only works because of a modification to meshtastic/GxEPD2.
|
// Note: this code only works because of a modification to meshtastic/GxEPD2.
|
||||||
// It is only equipped to intercept calls to nextPage()
|
// It is only equipped to intercept calls to nextPage()
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "Screen.h"
|
#include "Screen.h"
|
||||||
#include "../userPrefs.h"
|
#include "../userPrefs.h"
|
||||||
#include "PowerMon.h"
|
#include "PowerMon.h"
|
||||||
|
#include "Throttle.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#if HAS_SCREEN
|
#if HAS_SCREEN
|
||||||
#include <OLEDDisplay.h>
|
#include <OLEDDisplay.h>
|
||||||
@@ -47,6 +48,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "modules/AdminModule.h"
|
#include "modules/AdminModule.h"
|
||||||
#include "modules/ExternalNotificationModule.h"
|
#include "modules/ExternalNotificationModule.h"
|
||||||
#include "modules/TextMessageModule.h"
|
#include "modules/TextMessageModule.h"
|
||||||
|
#include "modules/WaypointModule.h"
|
||||||
#include "sleep.h"
|
#include "sleep.h"
|
||||||
#include "target_specific.h"
|
#include "target_specific.h"
|
||||||
|
|
||||||
@@ -56,10 +58,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32
|
||||||
#include "esp_task_wdt.h"
|
#include "esp_task_wdt.h"
|
||||||
#include "modules/esp32/StoreForwardModule.h"
|
#include "modules/StoreForwardModule.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ARCH_PORTDUINO
|
#if ARCH_PORTDUINO
|
||||||
|
#include "modules/StoreForwardModule.h"
|
||||||
#include "platform/portduino/PortduinoGlue.h"
|
#include "platform/portduino/PortduinoGlue.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -117,6 +120,7 @@ static bool heartbeat = false;
|
|||||||
#define SCREEN_HEIGHT display->getHeight()
|
#define SCREEN_HEIGHT display->getHeight()
|
||||||
|
|
||||||
#include "graphics/ScreenFonts.h"
|
#include "graphics/ScreenFonts.h"
|
||||||
|
#include <Throttle.h>
|
||||||
|
|
||||||
#define getStringCenteredX(s) ((SCREEN_WIDTH - display->getStringWidth(s)) / 2)
|
#define getStringCenteredX(s) ((SCREEN_WIDTH - display->getStringWidth(s)) / 2)
|
||||||
|
|
||||||
@@ -140,7 +144,7 @@ static bool haveGlyphs(const char *str)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DEBUG("haveGlyphs=%d\n", have);
|
LOG_DEBUG("haveGlyphs=%d", have);
|
||||||
return have;
|
return have;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,8 +163,8 @@ static void drawIconScreen(const char *upperMsg, OLEDDisplay *display, OLEDDispl
|
|||||||
|
|
||||||
display->setFont(FONT_MEDIUM);
|
display->setFont(FONT_MEDIUM);
|
||||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
#ifdef SPLASH_TITLE_USERPREFS
|
#ifdef USERPREFS_SPLASH_TITLE
|
||||||
const char *title = SPLASH_TITLE_USERPREFS;
|
const char *title = USERPREFS_SPLASH_TITLE;
|
||||||
#else
|
#else
|
||||||
const char *title = "meshtastic.org";
|
const char *title = "meshtastic.org";
|
||||||
#endif
|
#endif
|
||||||
@@ -182,56 +186,6 @@ static void drawIconScreen(const char *upperMsg, OLEDDisplay *display, OLEDDispl
|
|||||||
display->setTextAlignment(TEXT_ALIGN_LEFT); // Restore left align, just to be kind to any other unsuspecting code
|
display->setTextAlignment(TEXT_ALIGN_LEFT); // Restore left align, just to be kind to any other unsuspecting code
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawOEMIconScreen(const char *upperMsg, OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
|
||||||
{
|
|
||||||
// draw an xbm image.
|
|
||||||
// Please note that everything that should be transitioned
|
|
||||||
// needs to be drawn relative to x and y
|
|
||||||
|
|
||||||
// draw centered icon left to right and centered above the one line of app text
|
|
||||||
display->drawXbm(x + (SCREEN_WIDTH - oemStore.oem_icon_width) / 2,
|
|
||||||
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - oemStore.oem_icon_height) / 2 + 2, oemStore.oem_icon_width,
|
|
||||||
oemStore.oem_icon_height, (const uint8_t *)oemStore.oem_icon_bits.bytes);
|
|
||||||
|
|
||||||
switch (oemStore.oem_font) {
|
|
||||||
case 0:
|
|
||||||
display->setFont(FONT_SMALL);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
display->setFont(FONT_LARGE);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
display->setFont(FONT_MEDIUM);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
|
||||||
const char *title = oemStore.oem_text;
|
|
||||||
display->drawString(x + getStringCenteredX(title), y + SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM, title);
|
|
||||||
display->setFont(FONT_SMALL);
|
|
||||||
|
|
||||||
// Draw region in upper left
|
|
||||||
if (upperMsg)
|
|
||||||
display->drawString(x + 0, y + 0, upperMsg);
|
|
||||||
|
|
||||||
// Draw version and shortname in upper right
|
|
||||||
char buf[25];
|
|
||||||
snprintf(buf, sizeof(buf), "%s\n%s", xstr(APP_VERSION_SHORT), haveGlyphs(owner.short_name) ? owner.short_name : "");
|
|
||||||
|
|
||||||
display->setTextAlignment(TEXT_ALIGN_RIGHT);
|
|
||||||
display->drawString(x + SCREEN_WIDTH, y + 0, buf);
|
|
||||||
screen->forceDisplay();
|
|
||||||
|
|
||||||
display->setTextAlignment(TEXT_ALIGN_LEFT); // Restore left align, just to be kind to any other unsuspecting code
|
|
||||||
}
|
|
||||||
|
|
||||||
static void drawOEMBootScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
|
||||||
{
|
|
||||||
// Draw region in upper left
|
|
||||||
const char *region = myRegion ? myRegion->name : NULL;
|
|
||||||
drawOEMIconScreen(region, display, state, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Screen::drawFrameText(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y, const char *message)
|
void Screen::drawFrameText(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y, const char *message)
|
||||||
{
|
{
|
||||||
uint16_t x_offset = display->width() / 2;
|
uint16_t x_offset = display->width() / 2;
|
||||||
@@ -288,7 +242,7 @@ static void drawWelcomeScreen(OLEDDisplay *display, OLEDDisplayUiState *state, i
|
|||||||
// draw overlay in bottom right corner of screen to show when notifications are muted or modifier key is active
|
// draw overlay in bottom right corner of screen to show when notifications are muted or modifier key is active
|
||||||
static void drawFunctionOverlay(OLEDDisplay *display, OLEDDisplayUiState *state)
|
static void drawFunctionOverlay(OLEDDisplay *display, OLEDDisplayUiState *state)
|
||||||
{
|
{
|
||||||
// LOG_DEBUG("Drawing function overlay\n");
|
// LOG_DEBUG("Drawing function overlay");
|
||||||
if (functionSymbals.begin() != functionSymbals.end()) {
|
if (functionSymbals.begin() != functionSymbals.end()) {
|
||||||
char buf[64];
|
char buf[64];
|
||||||
display->setFont(FONT_SMALL);
|
display->setFont(FONT_SMALL);
|
||||||
@@ -306,7 +260,7 @@ static void drawDeepSleepScreen(OLEDDisplay *display, OLEDDisplayUiState *state,
|
|||||||
EINK_ADD_FRAMEFLAG(display, COSMETIC);
|
EINK_ADD_FRAMEFLAG(display, COSMETIC);
|
||||||
EINK_ADD_FRAMEFLAG(display, BLOCKING);
|
EINK_ADD_FRAMEFLAG(display, BLOCKING);
|
||||||
|
|
||||||
LOG_DEBUG("Drawing deep sleep screen\n");
|
LOG_DEBUG("Drawing deep sleep screen");
|
||||||
|
|
||||||
// Display displayStr on the screen
|
// Display displayStr on the screen
|
||||||
drawIconScreen("Sleeping", display, state, x, y);
|
drawIconScreen("Sleeping", display, state, x, y);
|
||||||
@@ -315,7 +269,7 @@ static void drawDeepSleepScreen(OLEDDisplay *display, OLEDDisplayUiState *state,
|
|||||||
/// Used on eink displays when screen updates are paused
|
/// Used on eink displays when screen updates are paused
|
||||||
static void drawScreensaverOverlay(OLEDDisplay *display, OLEDDisplayUiState *state)
|
static void drawScreensaverOverlay(OLEDDisplay *display, OLEDDisplayUiState *state)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("Drawing screensaver overlay\n");
|
LOG_DEBUG("Drawing screensaver overlay");
|
||||||
|
|
||||||
EINK_ADD_FRAMEFLAG(display, COSMETIC); // Take the opportunity for a full-refresh
|
EINK_ADD_FRAMEFLAG(display, COSMETIC); // Take the opportunity for a full-refresh
|
||||||
|
|
||||||
@@ -381,9 +335,9 @@ static void drawModuleFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int
|
|||||||
} else {
|
} else {
|
||||||
// otherwise, just display the module frame that's aligned with the current frame
|
// otherwise, just display the module frame that's aligned with the current frame
|
||||||
module_frame = state->currentFrame;
|
module_frame = state->currentFrame;
|
||||||
// LOG_DEBUG("Screen is not in transition. Frame: %d\n\n", module_frame);
|
// LOG_DEBUG("Screen is not in transition. Frame: %d", module_frame);
|
||||||
}
|
}
|
||||||
// LOG_DEBUG("Drawing Module Frame %d\n\n", module_frame);
|
// LOG_DEBUG("Drawing Module Frame %d", module_frame);
|
||||||
MeshModule &pi = *moduleFrames.at(module_frame);
|
MeshModule &pi = *moduleFrames.at(module_frame);
|
||||||
pi.drawFrame(display, state, x, y);
|
pi.drawFrame(display, state, x, y);
|
||||||
}
|
}
|
||||||
@@ -493,7 +447,7 @@ void Screen::drawDigitalClockFrame(OLEDDisplay *display, OLEDDisplayUiState *sta
|
|||||||
display->drawString(x + 20, y + 2, batteryPercent);
|
display->drawString(x + 20, y + 2, batteryPercent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nimbleBluetooth->isConnected()) {
|
if (nimbleBluetooth && nimbleBluetooth->isConnected()) {
|
||||||
drawBluetoothConnectedIcon(display, display->getWidth() - 18, y + 2);
|
drawBluetoothConnectedIcon(display, display->getWidth() - 18, y + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -725,7 +679,7 @@ void Screen::drawAnalogClockFrame(OLEDDisplay *display, OLEDDisplayUiState *stat
|
|||||||
display->drawString(x + 20, y + 2, batteryPercent);
|
display->drawString(x + 20, y + 2, batteryPercent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nimbleBluetooth->isConnected()) {
|
if (nimbleBluetooth && nimbleBluetooth->isConnected()) {
|
||||||
drawBluetoothConnectedIcon(display, display->getWidth() - 18, y + 2);
|
drawBluetoothConnectedIcon(display, display->getWidth() - 18, y + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -958,7 +912,7 @@ static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state
|
|||||||
|
|
||||||
const meshtastic_MeshPacket &mp = devicestate.rx_text_message;
|
const meshtastic_MeshPacket &mp = devicestate.rx_text_message;
|
||||||
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(getFrom(&mp));
|
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(getFrom(&mp));
|
||||||
// LOG_DEBUG("drawing text message from 0x%x: %s\n", mp.from,
|
// LOG_DEBUG("drawing text message from 0x%x: %s", mp.from,
|
||||||
// mp.decoded.variant.data.decoded.bytes);
|
// mp.decoded.variant.data.decoded.bytes);
|
||||||
|
|
||||||
// Demo for drawStringMaxWidth:
|
// Demo for drawStringMaxWidth:
|
||||||
@@ -1004,55 +958,55 @@ static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state
|
|||||||
|
|
||||||
display->setColor(WHITE);
|
display->setColor(WHITE);
|
||||||
#ifndef EXCLUDE_EMOJI
|
#ifndef EXCLUDE_EMOJI
|
||||||
if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"\U0001F44D") == 0) {
|
if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "\U0001F44D") == 0) {
|
||||||
display->drawXbm(x + (SCREEN_WIDTH - thumbs_width) / 2,
|
display->drawXbm(x + (SCREEN_WIDTH - thumbs_width) / 2,
|
||||||
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - thumbs_height) / 2 + 2 + 5, thumbs_width, thumbs_height,
|
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - thumbs_height) / 2 + 2 + 5, thumbs_width, thumbs_height,
|
||||||
thumbup);
|
thumbup);
|
||||||
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"\U0001F44E") == 0) {
|
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "\U0001F44E") == 0) {
|
||||||
display->drawXbm(x + (SCREEN_WIDTH - thumbs_width) / 2,
|
display->drawXbm(x + (SCREEN_WIDTH - thumbs_width) / 2,
|
||||||
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - thumbs_height) / 2 + 2 + 5, thumbs_width, thumbs_height,
|
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - thumbs_height) / 2 + 2 + 5, thumbs_width, thumbs_height,
|
||||||
thumbdown);
|
thumbdown);
|
||||||
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"❓") == 0) {
|
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "❓") == 0) {
|
||||||
display->drawXbm(x + (SCREEN_WIDTH - question_width) / 2,
|
display->drawXbm(x + (SCREEN_WIDTH - question_width) / 2,
|
||||||
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - question_height) / 2 + 2 + 5, question_width, question_height,
|
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - question_height) / 2 + 2 + 5, question_width, question_height,
|
||||||
question);
|
question);
|
||||||
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"‼️") == 0) {
|
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "‼️") == 0) {
|
||||||
display->drawXbm(x + (SCREEN_WIDTH - bang_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - bang_height) / 2 + 2 + 5,
|
display->drawXbm(x + (SCREEN_WIDTH - bang_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - bang_height) / 2 + 2 + 5,
|
||||||
bang_width, bang_height, bang);
|
bang_width, bang_height, bang);
|
||||||
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"\U0001F4A9") == 0) {
|
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "\U0001F4A9") == 0) {
|
||||||
display->drawXbm(x + (SCREEN_WIDTH - poo_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - poo_height) / 2 + 2 + 5,
|
display->drawXbm(x + (SCREEN_WIDTH - poo_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - poo_height) / 2 + 2 + 5,
|
||||||
poo_width, poo_height, poo);
|
poo_width, poo_height, poo);
|
||||||
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "\xf0\x9f\xa4\xa3") == 0) {
|
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "\xf0\x9f\xa4\xa3") == 0) {
|
||||||
display->drawXbm(x + (SCREEN_WIDTH - haha_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - haha_height) / 2 + 2 + 5,
|
display->drawXbm(x + (SCREEN_WIDTH - haha_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - haha_height) / 2 + 2 + 5,
|
||||||
haha_width, haha_height, haha);
|
haha_width, haha_height, haha);
|
||||||
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"\U0001F44B") == 0) {
|
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "\U0001F44B") == 0) {
|
||||||
display->drawXbm(x + (SCREEN_WIDTH - wave_icon_width) / 2,
|
display->drawXbm(x + (SCREEN_WIDTH - wave_icon_width) / 2,
|
||||||
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - wave_icon_height) / 2 + 2 + 5, wave_icon_width,
|
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - wave_icon_height) / 2 + 2 + 5, wave_icon_width,
|
||||||
wave_icon_height, wave_icon);
|
wave_icon_height, wave_icon);
|
||||||
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"\U0001F920") == 0) {
|
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "\U0001F920") == 0) {
|
||||||
display->drawXbm(x + (SCREEN_WIDTH - cowboy_width) / 2,
|
display->drawXbm(x + (SCREEN_WIDTH - cowboy_width) / 2,
|
||||||
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - cowboy_height) / 2 + 2 + 5, cowboy_width, cowboy_height,
|
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - cowboy_height) / 2 + 2 + 5, cowboy_width, cowboy_height,
|
||||||
cowboy);
|
cowboy);
|
||||||
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"\U0001F42D") == 0) {
|
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "\U0001F42D") == 0) {
|
||||||
display->drawXbm(x + (SCREEN_WIDTH - deadmau5_width) / 2,
|
display->drawXbm(x + (SCREEN_WIDTH - deadmau5_width) / 2,
|
||||||
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - deadmau5_height) / 2 + 2 + 5, deadmau5_width, deadmau5_height,
|
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - deadmau5_height) / 2 + 2 + 5, deadmau5_width, deadmau5_height,
|
||||||
deadmau5);
|
deadmau5);
|
||||||
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"\xE2\x98\x80\xEF\xB8\x8F") == 0) {
|
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "\xE2\x98\x80\xEF\xB8\x8F") == 0) {
|
||||||
display->drawXbm(x + (SCREEN_WIDTH - sun_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - sun_height) / 2 + 2 + 5,
|
display->drawXbm(x + (SCREEN_WIDTH - sun_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - sun_height) / 2 + 2 + 5,
|
||||||
sun_width, sun_height, sun);
|
sun_width, sun_height, sun);
|
||||||
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"\u2614") == 0) {
|
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "\u2614") == 0) {
|
||||||
display->drawXbm(x + (SCREEN_WIDTH - rain_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - rain_height) / 2 + 2 + 10,
|
display->drawXbm(x + (SCREEN_WIDTH - rain_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - rain_height) / 2 + 2 + 10,
|
||||||
rain_width, rain_height, rain);
|
rain_width, rain_height, rain);
|
||||||
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"☁️") == 0) {
|
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "☁️") == 0) {
|
||||||
display->drawXbm(x + (SCREEN_WIDTH - cloud_width) / 2,
|
display->drawXbm(x + (SCREEN_WIDTH - cloud_width) / 2,
|
||||||
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - cloud_height) / 2 + 2 + 5, cloud_width, cloud_height, cloud);
|
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - cloud_height) / 2 + 2 + 5, cloud_width, cloud_height, cloud);
|
||||||
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"🌫️") == 0) {
|
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "🌫️") == 0) {
|
||||||
display->drawXbm(x + (SCREEN_WIDTH - fog_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - fog_height) / 2 + 2 + 5,
|
display->drawXbm(x + (SCREEN_WIDTH - fog_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - fog_height) / 2 + 2 + 5,
|
||||||
fog_width, fog_height, fog);
|
fog_width, fog_height, fog);
|
||||||
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"\xf0\x9f\x98\x88") == 0) {
|
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "\xf0\x9f\x98\x88") == 0) {
|
||||||
display->drawXbm(x + (SCREEN_WIDTH - devil_width) / 2,
|
display->drawXbm(x + (SCREEN_WIDTH - devil_width) / 2,
|
||||||
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - devil_height) / 2 + 2 + 5, devil_width, devil_height, devil);
|
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - devil_height) / 2 + 2 + 5, devil_width, devil_height, devil);
|
||||||
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), u8"♥️") == 0) {
|
} else if (strcmp(reinterpret_cast<const char *>(mp.decoded.payload.bytes), "♥️") == 0) {
|
||||||
display->drawXbm(x + (SCREEN_WIDTH - heart_width) / 2,
|
display->drawXbm(x + (SCREEN_WIDTH - heart_width) / 2,
|
||||||
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - heart_height) / 2 + 2 + 5, heart_width, heart_height, heart);
|
y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - heart_height) / 2 + 2 + 5, heart_width, heart_height, heart);
|
||||||
} else {
|
} else {
|
||||||
@@ -1093,8 +1047,8 @@ static void drawNodes(OLEDDisplay *display, int16_t x, int16_t y, const NodeStat
|
|||||||
{
|
{
|
||||||
char usersString[20];
|
char usersString[20];
|
||||||
snprintf(usersString, sizeof(usersString), "%d/%d", nodeStatus->getNumOnline(), nodeStatus->getNumTotal());
|
snprintf(usersString, sizeof(usersString), "%d/%d", nodeStatus->getNumOnline(), nodeStatus->getNumTotal());
|
||||||
#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) || defined(ST7789_CS) || defined(USE_ST7789) || \
|
#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ILI9342_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || \
|
||||||
defined(HX8357_CS)) && \
|
defined(ST7789_CS) || defined(USE_ST7789) || defined(HX8357_CS)) && \
|
||||||
!defined(DISPLAY_FORCE_SMALL_FONTS)
|
!defined(DISPLAY_FORCE_SMALL_FONTS)
|
||||||
display->drawFastImage(x, y + 3, 8, 8, imgUser);
|
display->drawFastImage(x, y + 3, 8, 8, imgUser);
|
||||||
#else
|
#else
|
||||||
@@ -1285,8 +1239,8 @@ static int8_t prevFrame = -1;
|
|||||||
// Draw the arrow pointing to a node's location
|
// Draw the arrow pointing to a node's location
|
||||||
void Screen::drawNodeHeading(OLEDDisplay *display, int16_t compassX, int16_t compassY, uint16_t compassDiam, float headingRadian)
|
void Screen::drawNodeHeading(OLEDDisplay *display, int16_t compassX, int16_t compassY, uint16_t compassDiam, float headingRadian)
|
||||||
{
|
{
|
||||||
Point tip(0.0f, 0.5f), tail(0.0f, -0.5f); // pointing up initially
|
Point tip(0.0f, 0.5f), tail(0.0f, -0.35f); // pointing up initially
|
||||||
float arrowOffsetX = 0.2f, arrowOffsetY = 0.2f;
|
float arrowOffsetX = 0.14f, arrowOffsetY = 1.0f;
|
||||||
Point leftArrow(tip.x - arrowOffsetX, tip.y - arrowOffsetY), rightArrow(tip.x + arrowOffsetX, tip.y - arrowOffsetY);
|
Point leftArrow(tip.x - arrowOffsetX, tip.y - arrowOffsetY), rightArrow(tip.x + arrowOffsetX, tip.y - arrowOffsetY);
|
||||||
|
|
||||||
Point *arrowPoints[] = {&tip, &tail, &leftArrow, &rightArrow};
|
Point *arrowPoints[] = {&tip, &tail, &leftArrow, &rightArrow};
|
||||||
@@ -1296,9 +1250,19 @@ void Screen::drawNodeHeading(OLEDDisplay *display, int16_t compassX, int16_t com
|
|||||||
arrowPoints[i]->scale(compassDiam * 0.6);
|
arrowPoints[i]->scale(compassDiam * 0.6);
|
||||||
arrowPoints[i]->translate(compassX, compassY);
|
arrowPoints[i]->translate(compassX, compassY);
|
||||||
}
|
}
|
||||||
|
/* Old arrow
|
||||||
display->drawLine(tip.x, tip.y, tail.x, tail.y);
|
display->drawLine(tip.x, tip.y, tail.x, tail.y);
|
||||||
display->drawLine(leftArrow.x, leftArrow.y, tip.x, tip.y);
|
display->drawLine(leftArrow.x, leftArrow.y, tip.x, tip.y);
|
||||||
display->drawLine(rightArrow.x, rightArrow.y, tip.x, tip.y);
|
display->drawLine(rightArrow.x, rightArrow.y, tip.x, tip.y);
|
||||||
|
display->drawLine(leftArrow.x, leftArrow.y, tail.x, tail.y);
|
||||||
|
display->drawLine(rightArrow.x, rightArrow.y, tail.x, tail.y);
|
||||||
|
*/
|
||||||
|
#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);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a string representation of the time passed since something happened
|
// Get a string representation of the time passed since something happened
|
||||||
@@ -1336,22 +1300,27 @@ void Screen::drawCompassNorth(OLEDDisplay *display, int16_t compassX, int16_t co
|
|||||||
// If north is supposed to be at the top of the compass we want rotation to be +0
|
// If north is supposed to be at the top of the compass we want rotation to be +0
|
||||||
if (config.display.compass_north_top)
|
if (config.display.compass_north_top)
|
||||||
myHeading = -0;
|
myHeading = -0;
|
||||||
|
/* N sign points currently not deleted*/
|
||||||
Point N1(-0.04f, 0.65f), N2(0.04f, 0.65f);
|
Point N1(-0.04f, 0.65f), N2(0.04f, 0.65f); // N sign points (N1-N4)
|
||||||
Point N3(-0.04f, 0.55f), N4(0.04f, 0.55f);
|
Point N3(-0.04f, 0.55f), N4(0.04f, 0.55f);
|
||||||
Point *rosePoints[] = {&N1, &N2, &N3, &N4};
|
Point NC1(0.00f, 0.50f); // north circle center point
|
||||||
|
Point *rosePoints[] = {&N1, &N2, &N3, &N4, &NC1};
|
||||||
|
|
||||||
uint16_t compassDiam = Screen::getCompassDiam(SCREEN_WIDTH, SCREEN_HEIGHT);
|
uint16_t compassDiam = Screen::getCompassDiam(SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
// North on compass will be negative of heading
|
// North on compass will be negative of heading
|
||||||
rosePoints[i]->rotate(-myHeading);
|
rosePoints[i]->rotate(-myHeading);
|
||||||
rosePoints[i]->scale(compassDiam);
|
rosePoints[i]->scale(compassDiam);
|
||||||
rosePoints[i]->translate(compassX, compassY);
|
rosePoints[i]->translate(compassX, compassY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* changed the N sign to a small circle on the compass circle.
|
||||||
display->drawLine(N1.x, N1.y, N3.x, N3.y);
|
display->drawLine(N1.x, N1.y, N3.x, N3.y);
|
||||||
display->drawLine(N2.x, N2.y, N4.x, N4.y);
|
display->drawLine(N2.x, N2.y, N4.x, N4.y);
|
||||||
display->drawLine(N1.x, N1.y, N4.x, N4.y);
|
display->drawLine(N1.x, N1.y, N4.x, N4.y);
|
||||||
|
*/
|
||||||
|
display->drawCircle(NC1.x, NC1.y, 4); // North sign circle, 4px radius is sufficient for all displays.
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t Screen::getCompassDiam(uint32_t displayWidth, uint32_t displayHeight)
|
uint16_t Screen::getCompassDiam(uint32_t displayWidth, uint32_t displayHeight)
|
||||||
@@ -1481,7 +1450,7 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
|
|||||||
if (!hasNodeHeading) {
|
if (!hasNodeHeading) {
|
||||||
// direction to node is unknown so display question mark
|
// direction to node is unknown so display question mark
|
||||||
// Debug info for gps lock errors
|
// Debug info for gps lock errors
|
||||||
// LOG_DEBUG("ourNode %d, ourPos %d, theirPos %d\n", !!ourNode, ourNode && hasValidPosition(ourNode),
|
// LOG_DEBUG("ourNode %d, ourPos %d, theirPos %d", !!ourNode, ourNode && hasValidPosition(ourNode),
|
||||||
// hasValidPosition(node));
|
// hasValidPosition(node));
|
||||||
display->drawString(compassX - FONT_HEIGHT_SMALL / 4, compassY - FONT_HEIGHT_SMALL / 2, "?");
|
display->drawString(compassX - FONT_HEIGHT_SMALL / 4, compassY - FONT_HEIGHT_SMALL / 2, "?");
|
||||||
}
|
}
|
||||||
@@ -1515,7 +1484,8 @@ Screen::Screen(ScanI2C::DeviceAddress address, meshtastic_Config_DisplayConfig_O
|
|||||||
#elif defined(USE_SSD1306)
|
#elif defined(USE_SSD1306)
|
||||||
dispdev = new SSD1306Wire(address.address, -1, -1, geometry,
|
dispdev = new SSD1306Wire(address.address, -1, -1, geometry,
|
||||||
(address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE);
|
(address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE);
|
||||||
#elif defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7789_CS) || defined(RAK14014) || defined(HX8357_CS)
|
#elif defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ILI9342_DRIVER) || defined(ST7701_CS) || defined(ST7789_CS) || \
|
||||||
|
defined(RAK14014) || defined(HX8357_CS)
|
||||||
dispdev = new TFTDisplay(address.address, -1, -1, geometry,
|
dispdev = new TFTDisplay(address.address, -1, -1, geometry,
|
||||||
(address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE);
|
(address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE);
|
||||||
#elif defined(USE_EINK) && !defined(USE_EINK_DYNAMICDISPLAY)
|
#elif defined(USE_EINK) && !defined(USE_EINK_DYNAMICDISPLAY)
|
||||||
@@ -1529,7 +1499,7 @@ Screen::Screen(ScanI2C::DeviceAddress address, meshtastic_Config_DisplayConfig_O
|
|||||||
(address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE);
|
(address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE);
|
||||||
#elif ARCH_PORTDUINO
|
#elif ARCH_PORTDUINO
|
||||||
if (settingsMap[displayPanel] != no_screen) {
|
if (settingsMap[displayPanel] != no_screen) {
|
||||||
LOG_DEBUG("Making TFTDisplay!\n");
|
LOG_DEBUG("Making TFTDisplay!");
|
||||||
dispdev = new TFTDisplay(address.address, -1, -1, geometry,
|
dispdev = new TFTDisplay(address.address, -1, -1, geometry,
|
||||||
(address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE);
|
(address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE);
|
||||||
} else {
|
} else {
|
||||||
@@ -1576,7 +1546,7 @@ void Screen::handleSetOn(bool on, FrameCallback einkScreensaver)
|
|||||||
|
|
||||||
if (on != screenOn) {
|
if (on != screenOn) {
|
||||||
if (on) {
|
if (on) {
|
||||||
LOG_INFO("Turning on screen\n");
|
LOG_INFO("Turning on screen");
|
||||||
powerMon->setState(meshtastic_PowerMon_State_Screen_On);
|
powerMon->setState(meshtastic_PowerMon_State_Screen_On);
|
||||||
#ifdef T_WATCH_S3
|
#ifdef T_WATCH_S3
|
||||||
PMU->enablePowerOutput(XPOWERS_ALDO2);
|
PMU->enablePowerOutput(XPOWERS_ALDO2);
|
||||||
@@ -1611,7 +1581,7 @@ void Screen::handleSetOn(bool on, FrameCallback einkScreensaver)
|
|||||||
// eInkScreensaver parameter is usually NULL (default argument), default frame used instead
|
// eInkScreensaver parameter is usually NULL (default argument), default frame used instead
|
||||||
setScreensaverFrames(einkScreensaver);
|
setScreensaverFrames(einkScreensaver);
|
||||||
#endif
|
#endif
|
||||||
LOG_INFO("Turning off screen\n");
|
LOG_INFO("Turning off screen");
|
||||||
dispdev->displayOff();
|
dispdev->displayOff();
|
||||||
#ifdef USE_ST7789
|
#ifdef USE_ST7789
|
||||||
SPI1.end();
|
SPI1.end();
|
||||||
@@ -1654,6 +1624,11 @@ void Screen::setup()
|
|||||||
static_cast<SH1106Wire *>(dispdev)->setSubtype(7);
|
static_cast<SH1106Wire *>(dispdev)->setSubtype(7);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(USE_ST7789) && defined(TFT_MESH)
|
||||||
|
// Heltec T114 and T190: honor a custom text color, if defined in variant.h
|
||||||
|
static_cast<ST7789Spi *>(dispdev)->setRGB(TFT_MESH);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Initialising the UI will init the display too.
|
// Initialising the UI will init the display too.
|
||||||
ui->init();
|
ui->init();
|
||||||
|
|
||||||
@@ -1674,9 +1649,6 @@ void Screen::setup()
|
|||||||
// Set the utf8 conversion function
|
// Set the utf8 conversion function
|
||||||
dispdev->setFontTableLookupFunction(customFontTableLookup);
|
dispdev->setFontTableLookupFunction(customFontTableLookup);
|
||||||
|
|
||||||
if (strlen(oemStore.oem_text) > 0)
|
|
||||||
logo_timeout *= 2;
|
|
||||||
|
|
||||||
// Add frames.
|
// Add frames.
|
||||||
EINK_ADD_FRAMEFLAG(dispdev, DEMAND_FAST);
|
EINK_ADD_FRAMEFLAG(dispdev, DEMAND_FAST);
|
||||||
alertFrames[0] = [this](OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) -> void {
|
alertFrames[0] = [this](OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) -> void {
|
||||||
@@ -1707,8 +1679,11 @@ void Screen::setup()
|
|||||||
// Standard behaviour is to FLIP the screen (needed on T-Beam). If this config item is set, unflip it, and thereby logically
|
// Standard behaviour is to FLIP the screen (needed on T-Beam). If this config item is set, unflip it, and thereby logically
|
||||||
// flip it. If you have a headache now, you're welcome.
|
// flip it. If you have a headache now, you're welcome.
|
||||||
if (!config.display.flip_screen) {
|
if (!config.display.flip_screen) {
|
||||||
#if defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7789_CS) || defined(RAK14014) || defined(HX8357_CS)
|
#if defined(ST7701_CS) || defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ILI9342_DRIVER) || defined(ST7701_CS) || \
|
||||||
|
defined(ST7789_CS) || defined(RAK14014) || defined(HX8357_CS)
|
||||||
static_cast<TFTDisplay *>(dispdev)->flipScreenVertically();
|
static_cast<TFTDisplay *>(dispdev)->flipScreenVertically();
|
||||||
|
#elif defined(USE_ST7789)
|
||||||
|
static_cast<ST7789Spi *>(dispdev)->flipScreenVertically();
|
||||||
#else
|
#else
|
||||||
dispdev->flipScreenVertically();
|
dispdev->flipScreenVertically();
|
||||||
#endif
|
#endif
|
||||||
@@ -1814,28 +1789,11 @@ int32_t Screen::runOnce()
|
|||||||
// serialSinceMsec adjusts for additional serial wait time during nRF52 bootup
|
// serialSinceMsec adjusts for additional serial wait time during nRF52 bootup
|
||||||
static bool showingBootScreen = true;
|
static bool showingBootScreen = true;
|
||||||
if (showingBootScreen && (millis() > (logo_timeout + serialSinceMsec))) {
|
if (showingBootScreen && (millis() > (logo_timeout + serialSinceMsec))) {
|
||||||
LOG_INFO("Done with boot screen...\n");
|
LOG_INFO("Done with boot screen...");
|
||||||
stopBootScreen();
|
stopBootScreen();
|
||||||
showingBootScreen = false;
|
showingBootScreen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have an OEM Boot screen, toggle after logo_timeout seconds
|
|
||||||
if (strlen(oemStore.oem_text) > 0) {
|
|
||||||
static bool showingOEMBootScreen = true;
|
|
||||||
if (showingOEMBootScreen && (millis() > ((logo_timeout / 2) + serialSinceMsec))) {
|
|
||||||
LOG_INFO("Switch to OEM screen...\n");
|
|
||||||
// Change frames.
|
|
||||||
static FrameCallback bootOEMFrames[] = {drawOEMBootScreen};
|
|
||||||
static const int bootOEMFrameCount = sizeof(bootOEMFrames) / sizeof(bootOEMFrames[0]);
|
|
||||||
ui->setFrames(bootOEMFrames, bootOEMFrameCount);
|
|
||||||
ui->update();
|
|
||||||
#ifndef USE_EINK
|
|
||||||
ui->update();
|
|
||||||
#endif
|
|
||||||
showingOEMBootScreen = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef DISABLE_WELCOME_UNSET
|
#ifndef DISABLE_WELCOME_UNSET
|
||||||
if (showingNormalScreen && config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET) {
|
if (showingNormalScreen && config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET) {
|
||||||
setWelcomeFrames();
|
setWelcomeFrames();
|
||||||
@@ -1856,13 +1814,7 @@ int32_t Screen::runOnce()
|
|||||||
handleSetOn(false);
|
handleSetOn(false);
|
||||||
break;
|
break;
|
||||||
case Cmd::ON_PRESS:
|
case Cmd::ON_PRESS:
|
||||||
// If a nag notification is running, stop it
|
handleOnPress();
|
||||||
if (moduleConfig.external_notification.enabled && (externalNotificationModule->nagCycleCutoff != UINT32_MAX)) {
|
|
||||||
externalNotificationModule->stopNow();
|
|
||||||
} else {
|
|
||||||
// Don't advance the screen if we just wanted to switch off the nag notification
|
|
||||||
handleOnPress();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case Cmd::SHOW_PREV_FRAME:
|
case Cmd::SHOW_PREV_FRAME:
|
||||||
handleShowPrevFrame();
|
handleShowPrevFrame();
|
||||||
@@ -1895,7 +1847,7 @@ int32_t Screen::runOnce()
|
|||||||
free(cmd.print_text);
|
free(cmd.print_text);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_ERROR("Invalid screen cmd\n");
|
LOG_ERROR("Invalid screen cmd");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1925,7 +1877,7 @@ int32_t Screen::runOnce()
|
|||||||
if (showingNormalScreen) {
|
if (showingNormalScreen) {
|
||||||
// standard screen loop handling here
|
// standard screen loop handling here
|
||||||
if (config.display.auto_screen_carousel_secs > 0 &&
|
if (config.display.auto_screen_carousel_secs > 0 &&
|
||||||
(millis() - lastScreenTransition) > (config.display.auto_screen_carousel_secs * 1000)) {
|
!Throttle::isWithinTimespanMs(lastScreenTransition, config.display.auto_screen_carousel_secs * 1000)) {
|
||||||
|
|
||||||
// If an E-Ink display struggles with fast refresh, force carousel to use full refresh instead
|
// If an E-Ink display struggles with fast refresh, force carousel to use full refresh instead
|
||||||
// Carousel is potentially a major source of E-Ink display wear
|
// Carousel is potentially a major source of E-Ink display wear
|
||||||
@@ -1933,12 +1885,12 @@ int32_t Screen::runOnce()
|
|||||||
EINK_ADD_FRAMEFLAG(dispdev, COSMETIC);
|
EINK_ADD_FRAMEFLAG(dispdev, COSMETIC);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LOG_DEBUG("LastScreenTransition exceeded %ums transitioning to next frame\n", (millis() - lastScreenTransition));
|
LOG_DEBUG("LastScreenTransition exceeded %ums transitioning to next frame", (millis() - lastScreenTransition));
|
||||||
handleOnPress();
|
handleOnPress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// LOG_DEBUG("want fps %d, fixed=%d\n", targetFramerate,
|
// LOG_DEBUG("want fps %d, fixed=%d", targetFramerate,
|
||||||
// ui->getUiState()->frameState); If we are scrolling we need to be called
|
// ui->getUiState()->frameState); If we are scrolling we need to be called
|
||||||
// soon, otherwise just 1 fps (to save CPU) We also ask to be called twice
|
// soon, otherwise just 1 fps (to save CPU) We also ask to be called twice
|
||||||
// as fast as we really need so that any rounding errors still result with
|
// as fast as we really need so that any rounding errors still result with
|
||||||
@@ -1969,7 +1921,7 @@ void Screen::drawDebugInfoWiFiTrampoline(OLEDDisplay *display, OLEDDisplayUiStat
|
|||||||
void Screen::setSSLFrames()
|
void Screen::setSSLFrames()
|
||||||
{
|
{
|
||||||
if (address_found.address) {
|
if (address_found.address) {
|
||||||
// LOG_DEBUG("showing SSL frames\n");
|
// LOG_DEBUG("showing SSL frames");
|
||||||
static FrameCallback sslFrames[] = {drawSSLScreen};
|
static FrameCallback sslFrames[] = {drawSSLScreen};
|
||||||
ui->setFrames(sslFrames, 1);
|
ui->setFrames(sslFrames, 1);
|
||||||
ui->update();
|
ui->update();
|
||||||
@@ -1981,7 +1933,7 @@ void Screen::setSSLFrames()
|
|||||||
void Screen::setWelcomeFrames()
|
void Screen::setWelcomeFrames()
|
||||||
{
|
{
|
||||||
if (address_found.address) {
|
if (address_found.address) {
|
||||||
// LOG_DEBUG("showing Welcome frames\n");
|
// LOG_DEBUG("showing Welcome frames");
|
||||||
static FrameCallback frames[] = {drawWelcomeScreen};
|
static FrameCallback frames[] = {drawWelcomeScreen};
|
||||||
setFrameImmediateDraw(frames);
|
setFrameImmediateDraw(frames);
|
||||||
}
|
}
|
||||||
@@ -2047,7 +1999,7 @@ void Screen::setFrames(FrameFocus focus)
|
|||||||
uint8_t originalPosition = ui->getUiState()->currentFrame;
|
uint8_t originalPosition = ui->getUiState()->currentFrame;
|
||||||
FramesetInfo fsi; // Location of specific frames, for applying focus parameter
|
FramesetInfo fsi; // Location of specific frames, for applying focus parameter
|
||||||
|
|
||||||
LOG_DEBUG("showing standard frames\n");
|
LOG_DEBUG("showing standard frames");
|
||||||
showingNormalScreen = true;
|
showingNormalScreen = true;
|
||||||
|
|
||||||
#ifdef USE_EINK
|
#ifdef USE_EINK
|
||||||
@@ -2060,10 +2012,10 @@ void Screen::setFrames(FrameFocus focus)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
moduleFrames = MeshModule::GetMeshModulesWithUIFrames();
|
moduleFrames = MeshModule::GetMeshModulesWithUIFrames();
|
||||||
LOG_DEBUG("Showing %d module frames\n", moduleFrames.size());
|
LOG_DEBUG("Showing %d module frames", moduleFrames.size());
|
||||||
#ifdef DEBUG_PORT
|
#ifdef DEBUG_PORT
|
||||||
int totalFrameCount = MAX_NUM_NODES + NUM_EXTRA_FRAMES + moduleFrames.size();
|
int totalFrameCount = MAX_NUM_NODES + NUM_EXTRA_FRAMES + moduleFrames.size();
|
||||||
LOG_DEBUG("Total frame count: %d\n", totalFrameCount);
|
LOG_DEBUG("Total frame count: %d", totalFrameCount);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// We don't show the node info of our node (if we have it yet - we should)
|
// We don't show the node info of our node (if we have it yet - we should)
|
||||||
@@ -2086,13 +2038,18 @@ void Screen::setFrames(FrameFocus focus)
|
|||||||
// Check if the module being drawn has requested focus
|
// Check if the module being drawn has requested focus
|
||||||
// We will honor this request later, if setFrames was triggered by a UIFrameEvent
|
// We will honor this request later, if setFrames was triggered by a UIFrameEvent
|
||||||
MeshModule *m = *i;
|
MeshModule *m = *i;
|
||||||
if (m->isRequestingFocus())
|
if (m->isRequestingFocus()) {
|
||||||
fsi.positions.focusedModule = numframes;
|
fsi.positions.focusedModule = numframes;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Identify the position of specific modules, if we need to know this later
|
||||||
|
if (m == waypointModule)
|
||||||
|
fsi.positions.waypoint = numframes;
|
||||||
|
|
||||||
numframes++;
|
numframes++;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DEBUG("Added modules. numframes: %d\n", numframes);
|
LOG_DEBUG("Added modules. numframes: %d", numframes);
|
||||||
|
|
||||||
// If we have a critical fault, show it first
|
// If we have a critical fault, show it first
|
||||||
fsi.positions.fault = numframes;
|
fsi.positions.fault = numframes;
|
||||||
@@ -2106,8 +2063,8 @@ void Screen::setFrames(FrameFocus focus)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// If we have a text message - show it next, unless it's a phone message and we aren't using any special modules
|
// If we have a text message - show it next, unless it's a phone message and we aren't using any special modules
|
||||||
fsi.positions.textMessage = numframes;
|
|
||||||
if (devicestate.has_rx_text_message && shouldDrawMessage(&devicestate.rx_text_message)) {
|
if (devicestate.has_rx_text_message && shouldDrawMessage(&devicestate.rx_text_message)) {
|
||||||
|
fsi.positions.textMessage = numframes;
|
||||||
normalFrames[numframes++] = drawTextMessageFrame;
|
normalFrames[numframes++] = drawTextMessageFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2137,7 +2094,7 @@ void Screen::setFrames(FrameFocus focus)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
fsi.frameCount = numframes; // Total framecount is used to apply FOCUS_PRESERVE
|
fsi.frameCount = numframes; // Total framecount is used to apply FOCUS_PRESERVE
|
||||||
LOG_DEBUG("Finished building frames. numframes: %d\n", numframes);
|
LOG_DEBUG("Finished building frames. numframes: %d", numframes);
|
||||||
|
|
||||||
ui->setFrames(normalFrames, numframes);
|
ui->setFrames(normalFrames, numframes);
|
||||||
ui->enableAllIndicators();
|
ui->enableAllIndicators();
|
||||||
@@ -2169,7 +2126,7 @@ void Screen::setFrames(FrameFocus focus)
|
|||||||
|
|
||||||
case FOCUS_PRESERVE:
|
case FOCUS_PRESERVE:
|
||||||
// If we can identify which type of frame "originalPosition" was, can move directly to it in the new frameset
|
// If we can identify which type of frame "originalPosition" was, can move directly to it in the new frameset
|
||||||
FramesetInfo &oldFsi = this->framesetInfo;
|
const FramesetInfo &oldFsi = this->framesetInfo;
|
||||||
if (originalPosition == oldFsi.positions.log)
|
if (originalPosition == oldFsi.positions.log)
|
||||||
ui->switchToFrame(fsi.positions.log);
|
ui->switchToFrame(fsi.positions.log);
|
||||||
else if (originalPosition == oldFsi.positions.settings)
|
else if (originalPosition == oldFsi.positions.settings)
|
||||||
@@ -2209,9 +2166,34 @@ void Screen::setFrameImmediateDraw(FrameCallback *drawFrames)
|
|||||||
setFastFramerate();
|
setFastFramerate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dismisses the currently displayed screen frame, if possible
|
||||||
|
// Relevant for text message, waypoint, others in future?
|
||||||
|
// Triggered with a CardKB keycombo
|
||||||
|
void Screen::dismissCurrentFrame()
|
||||||
|
{
|
||||||
|
uint8_t currentFrame = ui->getUiState()->currentFrame;
|
||||||
|
bool dismissed = false;
|
||||||
|
|
||||||
|
if (currentFrame == framesetInfo.positions.textMessage && devicestate.has_rx_text_message) {
|
||||||
|
LOG_INFO("Dismissing Text Message");
|
||||||
|
devicestate.has_rx_text_message = false;
|
||||||
|
dismissed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (currentFrame == framesetInfo.positions.waypoint && devicestate.has_rx_waypoint) {
|
||||||
|
LOG_DEBUG("Dismissing Waypoint");
|
||||||
|
devicestate.has_rx_waypoint = false;
|
||||||
|
dismissed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we did make changes to dismiss, we now need to regenerate the frameset
|
||||||
|
if (dismissed)
|
||||||
|
setFrames();
|
||||||
|
}
|
||||||
|
|
||||||
void Screen::handleStartFirmwareUpdateScreen()
|
void Screen::handleStartFirmwareUpdateScreen()
|
||||||
{
|
{
|
||||||
LOG_DEBUG("showing firmware screen\n");
|
LOG_DEBUG("showing firmware screen");
|
||||||
showingNormalScreen = false;
|
showingNormalScreen = false;
|
||||||
EINK_ADD_FRAMEFLAG(dispdev, DEMAND_FAST); // E-Ink: Explicitly use fast-refresh for next frame
|
EINK_ADD_FRAMEFLAG(dispdev, DEMAND_FAST); // E-Ink: Explicitly use fast-refresh for next frame
|
||||||
|
|
||||||
@@ -2303,7 +2285,7 @@ void Screen::handlePrint(const char *text)
|
|||||||
{
|
{
|
||||||
// the string passed into us probably has a newline, but that would confuse the logging system
|
// the string passed into us probably has a newline, but that would confuse the logging system
|
||||||
// so strip it
|
// so strip it
|
||||||
LOG_DEBUG("Screen: %.*s\n", strlen(text) - 1, text);
|
LOG_DEBUG("Screen: %.*s", strlen(text) - 1, text);
|
||||||
if (!useDisplay || !showingNormalScreen)
|
if (!useDisplay || !showingNormalScreen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -2418,10 +2400,10 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
|||||||
// Draw our hardware ID to assist with bluetooth pairing. Either prefix with Info or S&F Logo
|
// Draw our hardware ID to assist with bluetooth pairing. Either prefix with Info or S&F Logo
|
||||||
if (moduleConfig.store_forward.enabled) {
|
if (moduleConfig.store_forward.enabled) {
|
||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32
|
||||||
if (millis() - storeForwardModule->lastHeartbeat >
|
if (!Throttle::isWithinTimespanMs(storeForwardModule->lastHeartbeat,
|
||||||
(storeForwardModule->heartbeatInterval * 1200)) { // no heartbeat, overlap a bit
|
(storeForwardModule->heartbeatInterval * 1200))) { // no heartbeat, overlap a bit
|
||||||
#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) || defined(ST7789_CS) || defined(USE_ST7789) || \
|
#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ILI9342_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || \
|
||||||
defined(HX8357_CS)) && \
|
defined(ST7789_CS) || defined(USE_ST7789) || defined(HX8357_CS) || ARCH_PORTDUINO) && \
|
||||||
!defined(DISPLAY_FORCE_SMALL_FONTS)
|
!defined(DISPLAY_FORCE_SMALL_FONTS)
|
||||||
display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 12, 8,
|
display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 12, 8,
|
||||||
imgQuestionL1);
|
imgQuestionL1);
|
||||||
@@ -2432,8 +2414,8 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
|||||||
imgQuestion);
|
imgQuestion);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) || defined(ST7789_CS) || defined(USE_ST7789) || \
|
#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ILI9342_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || \
|
||||||
defined(HX8357_CS)) && \
|
defined(ST7789_CS) || defined(USE_ST7789) || defined(HX8357_CS)) && \
|
||||||
!defined(DISPLAY_FORCE_SMALL_FONTS)
|
!defined(DISPLAY_FORCE_SMALL_FONTS)
|
||||||
display->drawFastImage(x + SCREEN_WIDTH - 18 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 16, 8,
|
display->drawFastImage(x + SCREEN_WIDTH - 18 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 16, 8,
|
||||||
imgSFL1);
|
imgSFL1);
|
||||||
@@ -2447,8 +2429,8 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
|||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
// TODO: Raspberry Pi supports more than just the one screen size
|
// TODO: Raspberry Pi supports more than just the one screen size
|
||||||
#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) || defined(ST7789_CS) || defined(USE_ST7789) || \
|
#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ILI9342_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || \
|
||||||
defined(HX8357_CS) || ARCH_PORTDUINO) && \
|
defined(ST7789_CS) || defined(USE_ST7789) || defined(HX8357_CS) || ARCH_PORTDUINO) && \
|
||||||
!defined(DISPLAY_FORCE_SMALL_FONTS)
|
!defined(DISPLAY_FORCE_SMALL_FONTS)
|
||||||
display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 12, 8,
|
display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 12, 8,
|
||||||
imgInfoL1);
|
imgInfoL1);
|
||||||
@@ -2656,7 +2638,7 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat
|
|||||||
|
|
||||||
int Screen::handleStatusUpdate(const meshtastic::Status *arg)
|
int Screen::handleStatusUpdate(const meshtastic::Status *arg)
|
||||||
{
|
{
|
||||||
// LOG_DEBUG("Screen got status update %d\n", arg->getStatusType());
|
// LOG_DEBUG("Screen got status update %d", arg->getStatusType());
|
||||||
switch (arg->getStatusType()) {
|
switch (arg->getStatusType()) {
|
||||||
case STATUS_TYPE_NODE:
|
case STATUS_TYPE_NODE:
|
||||||
if (showingNormalScreen && nodeStatus->getLastNumTotal() != nodeStatus->getNumTotal()) {
|
if (showingNormalScreen && nodeStatus->getLastNumTotal() != nodeStatus->getNumTotal()) {
|
||||||
@@ -2721,12 +2703,23 @@ int Screen::handleInputEvent(const InputEvent *event)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (showingNormalScreen && moduleFrames.size() == 0) {
|
// Use left or right input from a keyboard to move between frames,
|
||||||
// LOG_DEBUG("Screen::handleInputEvent from %s\n", event->source);
|
// so long as a mesh module isn't using these events for some other purpose
|
||||||
if (event->inputEvent == static_cast<char>(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT)) {
|
if (showingNormalScreen) {
|
||||||
showPrevFrame();
|
|
||||||
} else if (event->inputEvent == static_cast<char>(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT)) {
|
// Ask any MeshModules if they're handling keyboard input right now
|
||||||
showNextFrame();
|
bool inputIntercepted = false;
|
||||||
|
for (MeshModule *module : moduleFrames) {
|
||||||
|
if (module->interceptingKeyboardInput())
|
||||||
|
inputIntercepted = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no modules are using the input, move between frames
|
||||||
|
if (!inputIntercepted) {
|
||||||
|
if (event->inputEvent == static_cast<char>(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT))
|
||||||
|
showPrevFrame();
|
||||||
|
else if (event->inputEvent == static_cast<char>(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT))
|
||||||
|
showNextFrame();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -454,6 +454,9 @@ class Screen : public concurrency::OSThread
|
|||||||
|
|
||||||
void setWelcomeFrames();
|
void setWelcomeFrames();
|
||||||
|
|
||||||
|
// Dismiss the currently focussed frame, if possible (e.g. text message, waypoint)
|
||||||
|
void dismissCurrentFrame();
|
||||||
|
|
||||||
#ifdef USE_EINK
|
#ifdef USE_EINK
|
||||||
/// Draw an image to remain on E-Ink display after screen off
|
/// Draw an image to remain on E-Ink display after screen off
|
||||||
void setScreensaverFrames(FrameCallback einkScreensaver = NULL);
|
void setScreensaverFrames(FrameCallback einkScreensaver = NULL);
|
||||||
@@ -503,11 +506,14 @@ class Screen : public concurrency::OSThread
|
|||||||
void handleStartFirmwareUpdateScreen();
|
void handleStartFirmwareUpdateScreen();
|
||||||
|
|
||||||
// Info collected by setFrames method.
|
// Info collected by setFrames method.
|
||||||
// Index location of specific frames. Used to apply the FrameFocus parameter of setFrames
|
// Index location of specific frames.
|
||||||
|
// - Used to apply the FrameFocus parameter of setFrames
|
||||||
|
// - Used to dismiss the currently shown frame (txt; waypoint) by CardKB combo
|
||||||
struct FramesetInfo {
|
struct FramesetInfo {
|
||||||
struct FramePositions {
|
struct FramePositions {
|
||||||
uint8_t fault = 0;
|
uint8_t fault = 0;
|
||||||
uint8_t textMessage = 0;
|
uint8_t textMessage = 0;
|
||||||
|
uint8_t waypoint = 0;
|
||||||
uint8_t focusedModule = 0;
|
uint8_t focusedModule = 0;
|
||||||
uint8_t log = 0;
|
uint8_t log = 0;
|
||||||
uint8_t settings = 0;
|
uint8_t settings = 0;
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
#include "graphics/fonts/OLEDDisplayFontsUA.h"
|
#include "graphics/fonts/OLEDDisplayFontsUA.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) || defined(ST7789_CS) || defined(USE_ST7789) || \
|
#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ILI9342_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || \
|
||||||
defined(HX8357_CS)) && \
|
defined(ST7789_CS) || defined(USE_ST7789) || defined(HX8357_CS)) && \
|
||||||
!defined(DISPLAY_FORCE_SMALL_FONTS)
|
!defined(DISPLAY_FORCE_SMALL_FONTS)
|
||||||
// The screen is bigger so use bigger fonts
|
// The screen is bigger so use bigger fonts
|
||||||
#define FONT_SMALL ArialMT_Plain_16 // Height: 19
|
#define FONT_SMALL ArialMT_Plain_16 // Height: 19
|
||||||
@@ -41,4 +41,4 @@
|
|||||||
|
|
||||||
#define FONT_HEIGHT_SMALL _fontHeight(FONT_SMALL)
|
#define FONT_HEIGHT_SMALL _fontHeight(FONT_SMALL)
|
||||||
#define FONT_HEIGHT_MEDIUM _fontHeight(FONT_MEDIUM)
|
#define FONT_HEIGHT_MEDIUM _fontHeight(FONT_MEDIUM)
|
||||||
#define FONT_HEIGHT_LARGE _fontHeight(FONT_LARGE)
|
#define FONT_HEIGHT_LARGE _fontHeight(FONT_LARGE)
|
||||||
|
|||||||
@@ -244,9 +244,9 @@ class LGFX : public lgfx::LGFX_Device
|
|||||||
|
|
||||||
static LGFX *tft = nullptr;
|
static LGFX *tft = nullptr;
|
||||||
|
|
||||||
#elif defined(ILI9341_DRIVER)
|
#elif defined(ILI9341_DRIVER) || defined(ILI9342_DRIVER)
|
||||||
|
|
||||||
#include <LovyanGFX.hpp> // Graphics and font library for ILI9341 driver chip
|
#include <LovyanGFX.hpp> // Graphics and font library for ILI9341/ILI9342 driver chip
|
||||||
|
|
||||||
#if defined(ILI9341_BACKLIGHT_EN) && !defined(TFT_BL)
|
#if defined(ILI9341_BACKLIGHT_EN) && !defined(TFT_BL)
|
||||||
#define TFT_BL ILI9341_BACKLIGHT_EN
|
#define TFT_BL ILI9341_BACKLIGHT_EN
|
||||||
@@ -254,7 +254,11 @@ static LGFX *tft = nullptr;
|
|||||||
|
|
||||||
class LGFX : public lgfx::LGFX_Device
|
class LGFX : public lgfx::LGFX_Device
|
||||||
{
|
{
|
||||||
|
#if defined(ILI9341_DRIVER)
|
||||||
lgfx::Panel_ILI9341 _panel_instance;
|
lgfx::Panel_ILI9341 _panel_instance;
|
||||||
|
#elif defined(ILI9342_DRIVER)
|
||||||
|
lgfx::Panel_ILI9342 _panel_instance;
|
||||||
|
#endif
|
||||||
lgfx::Bus_SPI _bus_instance;
|
lgfx::Bus_SPI _bus_instance;
|
||||||
lgfx::Light_PWM _light_instance;
|
lgfx::Light_PWM _light_instance;
|
||||||
|
|
||||||
@@ -265,7 +269,11 @@ class LGFX : public lgfx::LGFX_Device
|
|||||||
auto cfg = _bus_instance.config();
|
auto cfg = _bus_instance.config();
|
||||||
|
|
||||||
// configure SPI
|
// configure SPI
|
||||||
|
#if defined(ILI9341_DRIVER)
|
||||||
cfg.spi_host = ILI9341_SPI_HOST; // ESP32-S2,S3,C3 : SPI2_HOST or SPI3_HOST / ESP32 : VSPI_HOST or HSPI_HOST
|
cfg.spi_host = ILI9341_SPI_HOST; // ESP32-S2,S3,C3 : SPI2_HOST or SPI3_HOST / ESP32 : VSPI_HOST or HSPI_HOST
|
||||||
|
#elif defined(ILI9342_DRIVER)
|
||||||
|
cfg.spi_host = ILI9342_SPI_HOST; // ESP32-S2,S3,C3 : SPI2_HOST or SPI3_HOST / ESP32 : VSPI_HOST or HSPI_HOST
|
||||||
|
#endif
|
||||||
cfg.spi_mode = 0;
|
cfg.spi_mode = 0;
|
||||||
cfg.freq_write = SPI_FREQUENCY; // SPI clock for transmission (up to 80MHz, rounded to the value obtained by dividing
|
cfg.freq_write = SPI_FREQUENCY; // SPI clock for transmission (up to 80MHz, rounded to the value obtained by dividing
|
||||||
// 80MHz by an integer)
|
// 80MHz by an integer)
|
||||||
@@ -336,7 +344,7 @@ class LGFX : public lgfx::LGFX_Device
|
|||||||
static LGFX *tft = nullptr;
|
static LGFX *tft = nullptr;
|
||||||
|
|
||||||
#elif defined(ST7735_CS)
|
#elif defined(ST7735_CS)
|
||||||
#include <TFT_eSPI.h> // Graphics and font library for ILI9341 driver chip
|
#include <TFT_eSPI.h> // Graphics and font library for ILI9342 driver chip
|
||||||
|
|
||||||
static TFT_eSPI *tft = nullptr; // Invoke library, pins defined in User_Setup.h
|
static TFT_eSPI *tft = nullptr; // Invoke library, pins defined in User_Setup.h
|
||||||
#elif ARCH_PORTDUINO && HAS_SCREEN != 0
|
#elif ARCH_PORTDUINO && HAS_SCREEN != 0
|
||||||
@@ -360,6 +368,8 @@ class LGFX : public lgfx::LGFX_Device
|
|||||||
_panel_instance = new lgfx::Panel_ST7735S;
|
_panel_instance = new lgfx::Panel_ST7735S;
|
||||||
else if (settingsMap[displayPanel] == ili9341)
|
else if (settingsMap[displayPanel] == ili9341)
|
||||||
_panel_instance = new lgfx::Panel_ILI9341;
|
_panel_instance = new lgfx::Panel_ILI9341;
|
||||||
|
else if (settingsMap[displayPanel] == ili9342)
|
||||||
|
_panel_instance = new lgfx::Panel_ILI9342;
|
||||||
auto buscfg = _bus_instance.config();
|
auto buscfg = _bus_instance.config();
|
||||||
buscfg.spi_mode = 0;
|
buscfg.spi_mode = 0;
|
||||||
buscfg.spi_host = settingsMap[displayspidev];
|
buscfg.spi_host = settingsMap[displayspidev];
|
||||||
@@ -370,7 +380,7 @@ class LGFX : public lgfx::LGFX_Device
|
|||||||
_panel_instance->setBus(&_bus_instance); // set the bus on the panel.
|
_panel_instance->setBus(&_bus_instance); // set the bus on the panel.
|
||||||
|
|
||||||
auto cfg = _panel_instance->config(); // Gets a structure for display panel settings.
|
auto cfg = _panel_instance->config(); // Gets a structure for display panel settings.
|
||||||
LOG_DEBUG("Height: %d, Width: %d \n", settingsMap[displayHeight], settingsMap[displayWidth]);
|
LOG_DEBUG("Height: %d, Width: %d ", settingsMap[displayHeight], settingsMap[displayWidth]);
|
||||||
cfg.pin_cs = settingsMap[displayCS]; // Pin number where CS is connected (-1 = disable)
|
cfg.pin_cs = settingsMap[displayCS]; // Pin number where CS is connected (-1 = disable)
|
||||||
cfg.pin_rst = settingsMap[displayReset];
|
cfg.pin_rst = settingsMap[displayReset];
|
||||||
cfg.panel_width = settingsMap[displayWidth]; // actual displayable width
|
cfg.panel_width = settingsMap[displayWidth]; // actual displayable width
|
||||||
@@ -500,10 +510,126 @@ class LGFX : public lgfx::LGFX_Device
|
|||||||
|
|
||||||
static LGFX *tft = nullptr;
|
static LGFX *tft = nullptr;
|
||||||
|
|
||||||
|
#elif defined(ST7701_CS)
|
||||||
|
#include <LovyanGFX.hpp> // Graphics and font library for ST7701 driver chip
|
||||||
|
#include <lgfx/v1/platforms/esp32s3/Bus_RGB.hpp>
|
||||||
|
#include <lgfx/v1/platforms/esp32s3/Panel_RGB.hpp>
|
||||||
|
|
||||||
|
class LGFX : public lgfx::LGFX_Device
|
||||||
|
{
|
||||||
|
lgfx::Panel_ST7701 _panel_instance;
|
||||||
|
lgfx::Bus_RGB _bus_instance;
|
||||||
|
lgfx::Light_PWM _light_instance;
|
||||||
|
lgfx::Touch_FT5x06 _touch_instance;
|
||||||
|
|
||||||
|
public:
|
||||||
|
LGFX(void)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
auto cfg = _panel_instance.config();
|
||||||
|
cfg.memory_width = 800;
|
||||||
|
cfg.memory_height = 480;
|
||||||
|
cfg.panel_width = TFT_WIDTH;
|
||||||
|
cfg.panel_height = TFT_HEIGHT;
|
||||||
|
cfg.offset_x = TFT_OFFSET_X;
|
||||||
|
cfg.offset_y = TFT_OFFSET_Y;
|
||||||
|
_panel_instance.config(cfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto cfg = _panel_instance.config_detail();
|
||||||
|
cfg.pin_cs = ST7701_CS;
|
||||||
|
cfg.pin_sclk = ST7701_SCK;
|
||||||
|
cfg.pin_mosi = ST7701_SDA;
|
||||||
|
// cfg.use_psram = 1;
|
||||||
|
_panel_instance.config_detail(cfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto cfg = _bus_instance.config();
|
||||||
|
cfg.panel = &_panel_instance;
|
||||||
|
#ifdef SENSECAP_INDICATOR
|
||||||
|
cfg.pin_d0 = GPIO_NUM_15; // B0
|
||||||
|
cfg.pin_d1 = GPIO_NUM_14; // B1
|
||||||
|
cfg.pin_d2 = GPIO_NUM_13; // B2
|
||||||
|
cfg.pin_d3 = GPIO_NUM_12; // B3
|
||||||
|
cfg.pin_d4 = GPIO_NUM_11; // B4
|
||||||
|
|
||||||
|
cfg.pin_d5 = GPIO_NUM_10; // G0
|
||||||
|
cfg.pin_d6 = GPIO_NUM_9; // G1
|
||||||
|
cfg.pin_d7 = GPIO_NUM_8; // G2
|
||||||
|
cfg.pin_d8 = GPIO_NUM_7; // G3
|
||||||
|
cfg.pin_d9 = GPIO_NUM_6; // G4
|
||||||
|
cfg.pin_d10 = GPIO_NUM_5; // G5
|
||||||
|
|
||||||
|
cfg.pin_d11 = GPIO_NUM_4; // R0
|
||||||
|
cfg.pin_d12 = GPIO_NUM_3; // R1
|
||||||
|
cfg.pin_d13 = GPIO_NUM_2; // R2
|
||||||
|
cfg.pin_d14 = GPIO_NUM_1; // R3
|
||||||
|
cfg.pin_d15 = GPIO_NUM_0; // R4
|
||||||
|
|
||||||
|
cfg.pin_henable = GPIO_NUM_18;
|
||||||
|
cfg.pin_vsync = GPIO_NUM_17;
|
||||||
|
cfg.pin_hsync = GPIO_NUM_16;
|
||||||
|
cfg.pin_pclk = GPIO_NUM_21;
|
||||||
|
cfg.freq_write = 12000000;
|
||||||
|
|
||||||
|
cfg.hsync_polarity = 0;
|
||||||
|
cfg.hsync_front_porch = 10;
|
||||||
|
cfg.hsync_pulse_width = 8;
|
||||||
|
cfg.hsync_back_porch = 50;
|
||||||
|
|
||||||
|
cfg.vsync_polarity = 0;
|
||||||
|
cfg.vsync_front_porch = 10;
|
||||||
|
cfg.vsync_pulse_width = 8;
|
||||||
|
cfg.vsync_back_porch = 20;
|
||||||
|
|
||||||
|
cfg.pclk_active_neg = 0;
|
||||||
|
cfg.de_idle_high = 1;
|
||||||
|
cfg.pclk_idle_high = 0;
|
||||||
|
#endif
|
||||||
|
_bus_instance.config(cfg);
|
||||||
|
}
|
||||||
|
_panel_instance.setBus(&_bus_instance);
|
||||||
|
|
||||||
|
{
|
||||||
|
auto cfg = _light_instance.config();
|
||||||
|
cfg.pin_bl = ST7701_BL;
|
||||||
|
_light_instance.config(cfg);
|
||||||
|
}
|
||||||
|
_panel_instance.light(&_light_instance);
|
||||||
|
|
||||||
|
{
|
||||||
|
auto cfg = _touch_instance.config();
|
||||||
|
cfg.pin_cs = -1;
|
||||||
|
cfg.x_min = 0;
|
||||||
|
cfg.x_max = 479;
|
||||||
|
cfg.y_min = 0;
|
||||||
|
cfg.y_max = 479;
|
||||||
|
cfg.pin_int = -1; // don't use SCREEN_TOUCH_INT;
|
||||||
|
cfg.pin_rst = SCREEN_TOUCH_RST;
|
||||||
|
cfg.bus_shared = true;
|
||||||
|
cfg.offset_rotation = TFT_OFFSET_ROTATION;
|
||||||
|
|
||||||
|
cfg.i2c_port = TOUCH_I2C_PORT;
|
||||||
|
cfg.i2c_addr = TOUCH_SLAVE_ADDRESS;
|
||||||
|
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;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ST7735_CS) || defined(ST7789_CS) || defined(ILI9341_DRIVER) || defined(RAK14014) || defined(HX8357_CS) || \
|
#if defined(ST7701_CS) || defined(ST7735_CS) || defined(ST7789_CS) || defined(ILI9341_DRIVER) || defined(ILI9342_DRIVER) || \
|
||||||
(ARCH_PORTDUINO && HAS_SCREEN != 0)
|
defined(RAK14014) || defined(HX8357_CS) || (ARCH_PORTDUINO && HAS_SCREEN != 0)
|
||||||
#include "SPILock.h"
|
#include "SPILock.h"
|
||||||
#include "TFTDisplay.h"
|
#include "TFTDisplay.h"
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
@@ -517,7 +643,7 @@ GpioPin *TFTDisplay::backlightEnable = NULL;
|
|||||||
|
|
||||||
TFTDisplay::TFTDisplay(uint8_t address, int sda, int scl, OLEDDISPLAY_GEOMETRY geometry, HW_I2C i2cBus)
|
TFTDisplay::TFTDisplay(uint8_t address, int sda, int scl, OLEDDISPLAY_GEOMETRY geometry, HW_I2C i2cBus)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("TFTDisplay!\n");
|
LOG_DEBUG("TFTDisplay!");
|
||||||
|
|
||||||
#ifdef TFT_BL
|
#ifdef TFT_BL
|
||||||
GpioPin *p = new GpioHwPin(TFT_BL);
|
GpioPin *p = new GpioHwPin(TFT_BL);
|
||||||
@@ -586,7 +712,7 @@ void TFTDisplay::sendCommand(uint8_t com)
|
|||||||
// handle display on/off directly
|
// handle display on/off directly
|
||||||
switch (com) {
|
switch (com) {
|
||||||
case DISPLAYON: {
|
case DISPLAYON: {
|
||||||
// LOG_DEBUG("Display on\n");
|
// LOG_DEBUG("Display on");
|
||||||
backlightEnable->set(true);
|
backlightEnable->set(true);
|
||||||
#if ARCH_PORTDUINO
|
#if ARCH_PORTDUINO
|
||||||
display(true);
|
display(true);
|
||||||
@@ -610,7 +736,7 @@ void TFTDisplay::sendCommand(uint8_t com)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DISPLAYOFF: {
|
case DISPLAYOFF: {
|
||||||
// LOG_DEBUG("Display off\n");
|
// LOG_DEBUG("Display off");
|
||||||
backlightEnable->set(false);
|
backlightEnable->set(false);
|
||||||
#if ARCH_PORTDUINO
|
#if ARCH_PORTDUINO
|
||||||
tft->clear();
|
tft->clear();
|
||||||
@@ -646,14 +772,14 @@ void TFTDisplay::setDisplayBrightness(uint8_t _brightness)
|
|||||||
// todo
|
// todo
|
||||||
#else
|
#else
|
||||||
tft->setBrightness(_brightness);
|
tft->setBrightness(_brightness);
|
||||||
LOG_DEBUG("Brightness is set to value: %i \n", _brightness);
|
LOG_DEBUG("Brightness is set to value: %i ", _brightness);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFTDisplay::flipScreenVertically()
|
void TFTDisplay::flipScreenVertically()
|
||||||
{
|
{
|
||||||
#if defined(T_WATCH_S3)
|
#if defined(T_WATCH_S3)
|
||||||
LOG_DEBUG("Flip TFT vertically\n"); // T-Watch S3 right-handed orientation
|
LOG_DEBUG("Flip TFT vertically"); // T-Watch S3 right-handed orientation
|
||||||
tft->setRotation(0);
|
tft->setRotation(0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -697,7 +823,7 @@ void TFTDisplay::setDetected(uint8_t detected)
|
|||||||
bool TFTDisplay::connect()
|
bool TFTDisplay::connect()
|
||||||
{
|
{
|
||||||
concurrency::LockGuard g(spiLock);
|
concurrency::LockGuard g(spiLock);
|
||||||
LOG_INFO("Doing TFT init\n");
|
LOG_INFO("Doing TFT init");
|
||||||
#ifdef RAK14014
|
#ifdef RAK14014
|
||||||
tft = new TFT_eSPI;
|
tft = new TFT_eSPI;
|
||||||
#else
|
#else
|
||||||
@@ -705,11 +831,10 @@ bool TFTDisplay::connect()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
backlightEnable->set(true);
|
backlightEnable->set(true);
|
||||||
LOG_INFO("Power to TFT Backlight\n");
|
LOG_INFO("Power to TFT Backlight");
|
||||||
|
|
||||||
#ifdef UNPHONE
|
#ifdef UNPHONE
|
||||||
unphone.backlight(true); // using unPhone library
|
unphone.backlight(true); // using unPhone library
|
||||||
LOG_INFO("Power to TFT Backlight\n");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tft->init();
|
tft->init();
|
||||||
@@ -725,7 +850,7 @@ bool TFTDisplay::connect()
|
|||||||
attachInterrupt(digitalPinToInterrupt(SCREEN_TOUCH_INT), rak14014_tpIntHandle, FALLING);
|
attachInterrupt(digitalPinToInterrupt(SCREEN_TOUCH_INT), rak14014_tpIntHandle, FALLING);
|
||||||
#elif defined(T_DECK) || defined(PICOMPUTER_S3) || defined(CHATTER_2)
|
#elif defined(T_DECK) || defined(PICOMPUTER_S3) || defined(CHATTER_2)
|
||||||
tft->setRotation(1); // T-Deck has the TFT in landscape
|
tft->setRotation(1); // T-Deck has the TFT in landscape
|
||||||
#elif defined(T_WATCH_S3)
|
#elif defined(T_WATCH_S3) || defined(SENSECAP_INDICATOR)
|
||||||
tft->setRotation(2); // T-Watch S3 left-handed orientation
|
tft->setRotation(2); // T-Watch S3 left-handed orientation
|
||||||
#else
|
#else
|
||||||
tft->setRotation(3); // Orient horizontal and wide underneath the silkscreen name label
|
tft->setRotation(3); // Orient horizontal and wide underneath the silkscreen name label
|
||||||
@@ -735,4 +860,4 @@ bool TFTDisplay::connect()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||