mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-23 18:27:27 +00:00
Compare commits
227 Commits
v2.1.4.958
...
v2.1.15.cd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd787232ca | ||
|
|
344baf7ffc | ||
|
|
a491ceefcd | ||
|
|
1524c2365f | ||
|
|
9d3dc9283c | ||
|
|
b1398d0770 | ||
|
|
110ec85137 | ||
|
|
99a31c1fad | ||
|
|
113026c372 | ||
|
|
3bc82e59dc | ||
|
|
24bb52e83f | ||
|
|
68ef27df8b | ||
|
|
9ddbfc0e3e | ||
|
|
e699427bfc | ||
|
|
696afeef41 | ||
|
|
35ee12cb4c | ||
|
|
94f5c04e19 | ||
|
|
fbcd6743fd | ||
|
|
1b35cc018f | ||
|
|
f18b8328a2 | ||
|
|
d241a010aa | ||
|
|
78af6e2ed8 | ||
|
|
7475c8647c | ||
|
|
f3af3c1c33 | ||
|
|
a583163766 | ||
|
|
e943fc6b8a | ||
|
|
f2cf0ed315 | ||
|
|
59b1adf12f | ||
|
|
1ae77d198d | ||
|
|
2728e86aab | ||
|
|
f8cba0e7f2 | ||
|
|
e5b049d2e2 | ||
|
|
52df85c338 | ||
|
|
1dfa8f2d9e | ||
|
|
4f0922ec2b | ||
|
|
eb916da8ce | ||
|
|
1b68408f2f | ||
|
|
a9fed83d9a | ||
|
|
c0979e29ff | ||
|
|
9878ff3836 | ||
|
|
3219ad33ef | ||
|
|
6113a1fb70 | ||
|
|
d11bcda292 | ||
|
|
508cdf6060 | ||
|
|
0009b98996 | ||
|
|
77dace1043 | ||
|
|
e02720b29b | ||
|
|
ffa85ebccd | ||
|
|
f9b2556cd4 | ||
|
|
9c683f4c87 | ||
|
|
cf07d2dbcd | ||
|
|
7711b03bd8 | ||
|
|
c52fddac53 | ||
|
|
b0c3816a8b | ||
|
|
6cdf2817f4 | ||
|
|
f7e1f4cea6 | ||
|
|
75504793e8 | ||
|
|
4029f731c9 | ||
|
|
666a1f3401 | ||
|
|
70dc13a998 | ||
|
|
9841d49fb8 | ||
|
|
28ec4e35ec | ||
|
|
55cef30f93 | ||
|
|
0e15d6a5c2 | ||
|
|
29199e4732 | ||
|
|
6fc061fa43 | ||
|
|
c14b075996 | ||
|
|
6963e43e9f | ||
|
|
1d90096cba | ||
|
|
c1a1b450e3 | ||
|
|
f7041994af | ||
|
|
5037a50059 | ||
|
|
2e915e782b | ||
|
|
e761631d5e | ||
|
|
19a310e196 | ||
|
|
5ec624d9c3 | ||
|
|
b4ff37104a | ||
|
|
81bfd69a41 | ||
|
|
57aaf7f6ee | ||
|
|
9b6ac98ae0 | ||
|
|
e1c4968c58 | ||
|
|
694fd04367 | ||
|
|
cdc8bf44e9 | ||
|
|
09d48f659e | ||
|
|
46e29402a6 | ||
|
|
10f41e376c | ||
|
|
39aa756100 | ||
|
|
17e25babb1 | ||
|
|
7c9d0a022a | ||
|
|
313860c8a4 | ||
|
|
e360c62480 | ||
|
|
973b30fc0b | ||
|
|
a6385a522d | ||
|
|
6aa9e37872 | ||
|
|
5afa92395d | ||
|
|
b6ff80f0b7 | ||
|
|
7ef12c77a8 | ||
|
|
a27d354364 | ||
|
|
6e26f95df9 | ||
|
|
5dfb5172c2 | ||
|
|
e0bb95ca94 | ||
|
|
1621fbb5ab | ||
|
|
ac40f77694 | ||
|
|
9700fa55a3 | ||
|
|
87c59d7d61 | ||
|
|
584615bb4b | ||
|
|
c452c2ab40 | ||
|
|
d43ddc9ec2 | ||
|
|
a76cb94851 | ||
|
|
da75ae21ff | ||
|
|
a30c07e6b4 | ||
|
|
309d4fc7f2 | ||
|
|
a13775bd70 | ||
|
|
b43a5bc4f8 | ||
|
|
ec44ca49fd | ||
|
|
5d41e9fe9d | ||
|
|
7bd836673e | ||
|
|
e0da661632 | ||
|
|
a9ce4338ff | ||
|
|
a284439d7e | ||
|
|
10fac072bb | ||
|
|
d60ccb42da | ||
|
|
3598351689 | ||
|
|
74ed166ff0 | ||
|
|
0afeba0c86 | ||
|
|
ee971e376a | ||
|
|
eeeb7c5080 | ||
|
|
f526c4cc5a | ||
|
|
a9eb19fc62 | ||
|
|
29c13b5c30 | ||
|
|
f0c4c18a79 | ||
|
|
320bf57687 | ||
|
|
4b89f7dfcb | ||
|
|
43cff7adc9 | ||
|
|
d4e42898b1 | ||
|
|
82ab38d3e6 | ||
|
|
aa96ea02c6 | ||
|
|
242f880764 | ||
|
|
de08360271 | ||
|
|
990d418dc8 | ||
|
|
f8db02c622 | ||
|
|
fc8d16bb08 | ||
|
|
af65013e49 | ||
|
|
b1937e03ac | ||
|
|
23e6bc32c0 | ||
|
|
bd1e747fc9 | ||
|
|
3c0817340a | ||
|
|
9a42861766 | ||
|
|
038ff0f6cb | ||
|
|
918b509be8 | ||
|
|
9239698004 | ||
|
|
71479a6b17 | ||
|
|
b4bcae98cd | ||
|
|
294771cb44 | ||
|
|
1398611276 | ||
|
|
fbc3b2beee | ||
|
|
6bf538e26f | ||
|
|
713b5fbe96 | ||
|
|
ed96321406 | ||
|
|
39d8ae64e7 | ||
|
|
3f07251d23 | ||
|
|
657f22d058 | ||
|
|
bf1fbc6c0d | ||
|
|
5679a82195 | ||
|
|
2edc35d34b | ||
|
|
26d18244f0 | ||
|
|
82ba59765c | ||
|
|
7930aa1635 | ||
|
|
c55751964e | ||
|
|
b9b1cce6a5 | ||
|
|
044ef75fef | ||
|
|
9f940139a0 | ||
|
|
fdb09d4fba | ||
|
|
1968f3c45b | ||
|
|
790df42987 | ||
|
|
9a9279dd78 | ||
|
|
1e54a5d45c | ||
|
|
23272daffe | ||
|
|
6e685b0a54 | ||
|
|
1af7e48136 | ||
|
|
eda00b7b9c | ||
|
|
1898fe850e | ||
|
|
15dbe5da97 | ||
|
|
8f736c8ecc | ||
|
|
8a81f190b8 | ||
|
|
1425657a3c | ||
|
|
02041cb605 | ||
|
|
1f130d671b | ||
|
|
d62e56f428 | ||
|
|
5ac24bb33b | ||
|
|
2c259b8464 | ||
|
|
9d6e1ce8e5 | ||
|
|
cc64c3d61a | ||
|
|
3bb8cd7613 | ||
|
|
8db7316ae1 | ||
|
|
d2c72fae00 | ||
|
|
2e3b86608a | ||
|
|
e0a6a37bef | ||
|
|
57fc9baafc | ||
|
|
033e988e6f | ||
|
|
a47364f07b | ||
|
|
48a407bf5c | ||
|
|
2475debb2a | ||
|
|
568899031d | ||
|
|
f1c457f0c3 | ||
|
|
c8399b7256 | ||
|
|
63005a94fd | ||
|
|
9b4a59f92d | ||
|
|
2472d0947f | ||
|
|
a92b2ec6ca | ||
|
|
548bec026a | ||
|
|
ce882b389a | ||
|
|
25fd9d2d1d | ||
|
|
83a201fe86 | ||
|
|
462ee3d921 | ||
|
|
0104246067 | ||
|
|
3f5c0cb6ac | ||
|
|
fa371bc844 | ||
|
|
090f42f51f | ||
|
|
c2ff6f2f7c | ||
|
|
181832aedd | ||
|
|
4967a16abe | ||
|
|
e2f5e9206d | ||
|
|
57b8e3732e | ||
|
|
f0d27f896a | ||
|
|
e74b180655 | ||
|
|
88a44eede0 |
40
.github/workflows/main_matrix.yml
vendored
40
.github/workflows/main_matrix.yml
vendored
@@ -23,9 +23,9 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- board: rak11200
|
- board: rak11200
|
||||||
- board: tlora-v2-1-1.6
|
- board: tlora-v2-1-1_6
|
||||||
- board: tbeam
|
- board: tbeam
|
||||||
- board: heltec-v2.1
|
- board: heltec-v2_1
|
||||||
- board: meshtastic-diy-v1
|
- board: meshtastic-diy-v1
|
||||||
- board: rak4631
|
- board: rak4631
|
||||||
- board: t-echo
|
- board: t-echo
|
||||||
@@ -33,6 +33,7 @@ jobs:
|
|||||||
- board: m5stack-coreink
|
- board: m5stack-coreink
|
||||||
- board: tbeam-s3-core
|
- board: tbeam-s3-core
|
||||||
- board: tlora-t3s3-v1
|
- board: tlora-t3s3-v1
|
||||||
|
#- board: rak11310
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -42,6 +43,7 @@ jobs:
|
|||||||
uses: ./.github/actions/setup-base
|
uses: ./.github/actions/setup-base
|
||||||
|
|
||||||
- name: Trunk Check
|
- name: Trunk Check
|
||||||
|
if: ${{ github.event_name != 'workflow_dispatch' }}
|
||||||
uses: trunk-io/trunk-action@v1
|
uses: trunk-io/trunk-action@v1
|
||||||
|
|
||||||
- name: Check ${{ matrix.board }}
|
- name: Check ${{ matrix.board }}
|
||||||
@@ -56,13 +58,13 @@ jobs:
|
|||||||
- board: tlora-v2
|
- board: tlora-v2
|
||||||
- board: tlora-v1
|
- board: tlora-v1
|
||||||
- board: tlora_v1_3
|
- board: tlora_v1_3
|
||||||
- board: tlora-v2-1-1.6
|
- board: tlora-v2-1-1_6
|
||||||
- board: tlora-v2-1-1.8
|
- board: tlora-v2-1-1_8
|
||||||
- board: tbeam
|
- board: tbeam
|
||||||
- board: heltec-v1
|
- board: heltec-v1
|
||||||
- board: heltec-v2.0
|
- board: heltec-v2_0
|
||||||
- board: heltec-v2.1
|
- board: heltec-v2_1
|
||||||
- board: tbeam0.7
|
- board: tbeam0_7
|
||||||
- board: meshtastic-diy-v1
|
- board: meshtastic-diy-v1
|
||||||
- board: meshtastic-dr-dev
|
- board: meshtastic-dr-dev
|
||||||
- board: nano-g1
|
- board: nano-g1
|
||||||
@@ -102,16 +104,17 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
board: ${{ matrix.board }}
|
board: ${{ matrix.board }}
|
||||||
|
|
||||||
# build-rpi2040:
|
build-rpi2040:
|
||||||
# strategy:
|
strategy:
|
||||||
# fail-fast: false
|
fail-fast: false
|
||||||
# max-parallel: 2
|
max-parallel: 2
|
||||||
# matrix:
|
matrix:
|
||||||
# include:
|
include:
|
||||||
# - board: pico
|
- board: pico
|
||||||
# uses: ./.github/workflows/build_rpi2040.yml
|
- board: rak11310
|
||||||
# with:
|
uses: ./.github/workflows/build_rpi2040.yml
|
||||||
# board: ${{ matrix.board }}
|
with:
|
||||||
|
board: ${{ matrix.board }}
|
||||||
|
|
||||||
build-native:
|
build-native:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -185,7 +188,8 @@ jobs:
|
|||||||
|
|
||||||
gather-artifacts:
|
gather-artifacts:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build-esp32, build-esp32-s3, build-nrf52, build-native] #, build-rpi2040]
|
needs:
|
||||||
|
[build-esp32, build-esp32-s3, build-nrf52, build-native, build-rpi2040]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -30,3 +30,4 @@ __pycache__
|
|||||||
venv/
|
venv/
|
||||||
release/
|
release/
|
||||||
.vscode/extensions.json
|
.vscode/extensions.json
|
||||||
|
/compile_commands.json
|
||||||
|
|||||||
1
.trunk/.gitignore
vendored
1
.trunk/.gitignore
vendored
@@ -5,3 +5,4 @@
|
|||||||
plugins
|
plugins
|
||||||
user_trunk.yaml
|
user_trunk.yaml
|
||||||
user.yaml
|
user.yaml
|
||||||
|
shims
|
||||||
|
|||||||
3
.trunk/configs/.flake8
Normal file
3
.trunk/configs/.flake8
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Autoformatter friendly flake8 config (all formatting rules disabled)
|
||||||
|
[flake8]
|
||||||
|
extend-ignore = D1, D2, E1, E2, E3, E501, W1, W2, W3, W5
|
||||||
2
.trunk/configs/.isort.cfg
Normal file
2
.trunk/configs/.isort.cfg
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[settings]
|
||||||
|
profile=black
|
||||||
10
.trunk/configs/.yamllint.yaml
Normal file
10
.trunk/configs/.yamllint.yaml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
rules:
|
||||||
|
quoted-strings:
|
||||||
|
required: only-when-needed
|
||||||
|
extra-allowed: ["{|}"]
|
||||||
|
empty-values:
|
||||||
|
forbid-in-block-mappings: true
|
||||||
|
forbid-in-flow-mappings: true
|
||||||
|
key-duplicates: {}
|
||||||
|
octal-values:
|
||||||
|
forbid-implicit-octal: true
|
||||||
5
.trunk/configs/ruff.toml
Normal file
5
.trunk/configs/ruff.toml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Generic, formatter-friendly config.
|
||||||
|
select = ["B", "D3", "D4", "E", "F"]
|
||||||
|
|
||||||
|
# Never enforce `E501` (line length violations). This should be handled by formatters.
|
||||||
|
ignore = ["E501"]
|
||||||
@@ -1,28 +1,43 @@
|
|||||||
version: 0.1
|
version: 0.1
|
||||||
cli:
|
cli:
|
||||||
version: 1.3.1
|
version: 1.9.1
|
||||||
plugins:
|
plugins:
|
||||||
sources:
|
sources:
|
||||||
- id: trunk
|
- id: trunk
|
||||||
ref: v0.0.8
|
ref: v0.0.17
|
||||||
uri: https://github.com/trunk-io/plugins
|
uri: https://github.com/trunk-io/plugins
|
||||||
lint:
|
lint:
|
||||||
enabled:
|
enabled:
|
||||||
|
- taplo@0.7.0
|
||||||
|
- ruff@0.0.265
|
||||||
|
- yamllint@1.31.0
|
||||||
|
- isort@5.12.0
|
||||||
|
- markdownlint@0.34.0
|
||||||
|
- oxipng@8.0.0
|
||||||
|
- svgo@3.0.2
|
||||||
|
- actionlint@1.6.24
|
||||||
|
- flake8@6.0.0
|
||||||
|
- hadolint@2.12.0
|
||||||
|
- shfmt@3.5.0
|
||||||
|
- shellcheck@0.9.0
|
||||||
|
- black@23.3.0
|
||||||
- git-diff-check
|
- git-diff-check
|
||||||
- gitleaks@8.15.2
|
- gitleaks@8.16.3
|
||||||
- clang-format@14.0.0
|
- clang-format@14.0.0
|
||||||
- prettier@2.8.3
|
- prettier@2.8.8
|
||||||
disabled:
|
disabled:
|
||||||
|
- taplo@0.7.0
|
||||||
- shellcheck@0.9.0
|
- shellcheck@0.9.0
|
||||||
- shfmt@3.5.0
|
- shfmt@3.5.0
|
||||||
- oxipng@8.0.0
|
- oxipng@8.0.0
|
||||||
- actionlint@1.6.22
|
- actionlint@1.6.22
|
||||||
- markdownlint@0.33.0
|
- markdownlint@0.34.0
|
||||||
- hadolint@2.12.0
|
- hadolint@2.12.0
|
||||||
- svgo@3.0.2
|
- svgo@3.0.2
|
||||||
runtimes:
|
runtimes:
|
||||||
enabled:
|
enabled:
|
||||||
- go@1.18.3
|
- python@3.10.8
|
||||||
|
- go@1.19.5
|
||||||
- node@18.12.1
|
- node@18.12.1
|
||||||
actions:
|
actions:
|
||||||
disabled:
|
disabled:
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
; Common settings for ESP targes, mixin with extends = esp32_base
|
; Common settings for ESP targes, mixin with extends = esp32_base
|
||||||
[esp32_base]
|
[esp32_base]
|
||||||
extends = arduino_base
|
extends = arduino_base
|
||||||
platform = platformio/espressif32@^6.1.0
|
platform = platformio/espressif32@^6.2.0
|
||||||
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2040> -<mesh/eth/>
|
${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2040> -<mesh/eth/>
|
||||||
|
|
||||||
upload_speed = 921600
|
upload_speed = 921600
|
||||||
debug_init_break = tbreak setup
|
debug_init_break = tbreak setup
|
||||||
monitor_filters = esp32_exception_decoder
|
monitor_filters = esp32_exception_decoder
|
||||||
|
|
||||||
board_build.filesystem = littlefs
|
board_build.filesystem = littlefs
|
||||||
|
|
||||||
# Remove -DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL for low level BLE logging.
|
# Remove -DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL for low level BLE logging.
|
||||||
@@ -34,8 +37,9 @@ lib_deps =
|
|||||||
${environmental_base.lib_deps}
|
${environmental_base.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.0
|
h2zero/NimBLE-Arduino@^1.4.0
|
||||||
|
jgromes/RadioLib@^6.0.0
|
||||||
https://github.com/lewisxhe/XPowersLib.git#84b7373faea3118b6c37954d52f98b8a337148d6
|
https://github.com/lewisxhe/XPowersLib.git#84b7373faea3118b6c37954d52f98b8a337148d6
|
||||||
caveman99/ESP32 Codec2@^1.0.1
|
https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f
|
||||||
|
|
||||||
lib_ignore =
|
lib_ignore =
|
||||||
segger_rtt
|
segger_rtt
|
||||||
|
|||||||
@@ -1,45 +1,5 @@
|
|||||||
[esp32c3_base]
|
[esp32c3_base]
|
||||||
extends = arduino_base
|
extends = esp32_base
|
||||||
platform = platformio/espressif32@^6.1.0
|
|
||||||
build_src_filter =
|
|
||||||
${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2040> -<mesh/eth/>
|
|
||||||
upload_speed = 961200
|
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
debug_init_break = tbreak setup
|
|
||||||
monitor_filters = esp32_c3_exception_decoder
|
monitor_filters = esp32_c3_exception_decoder
|
||||||
board_build.filesystem = littlefs
|
|
||||||
|
|
||||||
# Remove -DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL for low level BLE logging.
|
|
||||||
# See library directory for BLE logging possible values: .pio/libdeps/tbeam/NimBLE-Arduino/src/log_common/log_common.h
|
|
||||||
# This overrides the BLE logging default of LOG_LEVEL_INFO (1) from: .pio/libdeps/tbeam/NimBLE-Arduino/src/esp_nimble_cfg.h
|
|
||||||
build_flags =
|
|
||||||
${arduino_base.build_flags}
|
|
||||||
-Wall
|
|
||||||
-Wextra
|
|
||||||
-Isrc/platform/esp32
|
|
||||||
-std=c++11
|
|
||||||
-DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG
|
|
||||||
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
|
|
||||||
-DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL
|
|
||||||
-DCONFIG_BT_NIMBLE_ENABLED
|
|
||||||
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=2
|
|
||||||
-DCONFIG_BT_NIMBLE_MAX_CCCDS=20
|
|
||||||
-DESP_OPENSSL_SUPPRESS_LEGACY_WARNING
|
|
||||||
;-DDEBUG_HEAP
|
|
||||||
|
|
||||||
lib_deps =
|
|
||||||
${arduino_base.lib_deps}
|
|
||||||
${networking_base.lib_deps}
|
|
||||||
${environmental_base.lib_deps}
|
|
||||||
https://github.com/meshtastic/esp32_https_server.git#23665b3adc080a311dcbb586ed5941b5f94d6ea2
|
|
||||||
h2zero/NimBLE-Arduino@^1.4.0
|
|
||||||
https://github.com/lewisxhe/XPowersLib.git#84b7373faea3118b6c37954d52f98b8a337148d6
|
|
||||||
caveman99/ESP32 Codec2@^1.0.1
|
|
||||||
|
|
||||||
lib_ignore =
|
|
||||||
segger_rtt
|
|
||||||
ESP32 BLE Arduino
|
|
||||||
|
|
||||||
; customize the partition table
|
|
||||||
; http://docs.platformio.org/en/latest/platforms/espressif32.html#partition-tables
|
|
||||||
board_build.partitions = partition-table.csv
|
|
||||||
@@ -1,47 +1,16 @@
|
|||||||
[esp32s2_base]
|
[esp32s2_base]
|
||||||
extends = arduino_base
|
extends = esp32_base
|
||||||
platform = platformio/espressif32@^6.1.0
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2040> -<mesh/eth/> -<nimble/>
|
${esp32_base.build_src_filter} -<nimble/>
|
||||||
upload_speed = 961200
|
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
debug_init_break = tbreak setup
|
|
||||||
monitor_filters = esp32_exception_decoder
|
|
||||||
board_build.filesystem = littlefs
|
|
||||||
|
|
||||||
# Remove -DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL for low level BLE logging.
|
|
||||||
# See library directory for BLE logging possible values: .pio/libdeps/tbeam/NimBLE-Arduino/src/log_common/log_common.h
|
|
||||||
# This overrides the BLE logging default of LOG_LEVEL_INFO (1) from: .pio/libdeps/tbeam/NimBLE-Arduino/src/esp_nimble_cfg.h
|
|
||||||
build_flags =
|
build_flags =
|
||||||
${arduino_base.build_flags}
|
${esp32_base.build_flags}
|
||||||
-Wall
|
|
||||||
-Wextra
|
|
||||||
-Isrc/platform/esp32
|
|
||||||
-std=c++11
|
|
||||||
-DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG
|
|
||||||
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
|
|
||||||
-DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL
|
|
||||||
-DAXP_DEBUG_PORT=Serial
|
|
||||||
-DCONFIG_BT_NIMBLE_ENABLED
|
|
||||||
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=2
|
|
||||||
-DCONFIG_BT_NIMBLE_MAX_CCCDS=20
|
|
||||||
-DESP_OPENSSL_SUPPRESS_LEGACY_WARNING
|
|
||||||
-DHAS_BLUETOOTH=0
|
-DHAS_BLUETOOTH=0
|
||||||
;-DDEBUG_HEAP
|
|
||||||
|
|
||||||
lib_deps =
|
|
||||||
${arduino_base.lib_deps}
|
|
||||||
${networking_base.lib_deps}
|
|
||||||
${environmental_base.lib_deps}
|
|
||||||
https://github.com/meshtastic/esp32_https_server.git#23665b3adc080a311dcbb586ed5941b5f94d6ea2
|
|
||||||
https://github.com/lewisxhe/XPowersLib.git#84b7373faea3118b6c37954d52f98b8a337148d6
|
|
||||||
caveman99/ESP32 Codec2@^1.0.1
|
|
||||||
|
|
||||||
lib_ignore =
|
lib_ignore =
|
||||||
segger_rtt
|
${esp32_base.lib_ignore}
|
||||||
ESP32 BLE Arduino
|
NimBLE-Arduino
|
||||||
|
|
||||||
; customize the partition table
|
|
||||||
; http://docs.platformio.org/en/latest/platforms/espressif32.html#partition-tables
|
|
||||||
board_build.partitions = partition-table.csv
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,47 +1,5 @@
|
|||||||
[esp32s3_base]
|
[esp32s3_base]
|
||||||
extends = arduino_base
|
extends = esp32_base
|
||||||
platform = platformio/espressif32@^6.1.0
|
|
||||||
build_src_filter =
|
|
||||||
${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2040> -<mesh/eth/>
|
|
||||||
upload_speed = 961200
|
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
debug_init_break = tbreak setup
|
|
||||||
monitor_filters = esp32_exception_decoder
|
|
||||||
board_build.filesystem = littlefs
|
|
||||||
|
|
||||||
# Remove -DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL for low level BLE logging.
|
|
||||||
# See library directory for BLE logging possible values: .pio/libdeps/tbeam/NimBLE-Arduino/src/log_common/log_common.h
|
|
||||||
# This overrides the BLE logging default of LOG_LEVEL_INFO (1) from: .pio/libdeps/tbeam/NimBLE-Arduino/src/esp_nimble_cfg.h
|
|
||||||
build_flags =
|
|
||||||
${arduino_base.build_flags}
|
|
||||||
-Wall
|
|
||||||
-Wextra
|
|
||||||
-Isrc/platform/esp32
|
|
||||||
-std=c++11
|
|
||||||
-DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG
|
|
||||||
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
|
|
||||||
-DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL
|
|
||||||
-DAXP_DEBUG_PORT=Serial
|
|
||||||
-DCONFIG_BT_NIMBLE_ENABLED
|
|
||||||
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=2
|
|
||||||
-DCONFIG_BT_NIMBLE_MAX_CCCDS=20
|
|
||||||
-DESP_OPENSSL_SUPPRESS_LEGACY_WARNING
|
|
||||||
;-DDEBUG_HEAP
|
|
||||||
|
|
||||||
lib_deps =
|
|
||||||
${arduino_base.lib_deps}
|
|
||||||
${networking_base.lib_deps}
|
|
||||||
${environmental_base.lib_deps}
|
|
||||||
https://github.com/meshtastic/esp32_https_server.git#23665b3adc080a311dcbb586ed5941b5f94d6ea2
|
|
||||||
h2zero/NimBLE-Arduino@^1.4.0
|
|
||||||
https://github.com/lewisxhe/XPowersLib.git#84b7373faea3118b6c37954d52f98b8a337148d6
|
|
||||||
caveman99/ESP32 Codec2@^1.0.1
|
|
||||||
|
|
||||||
lib_ignore =
|
|
||||||
segger_rtt
|
|
||||||
ESP32 BLE Arduino
|
|
||||||
|
|
||||||
; customize the partition table
|
|
||||||
; http://docs.platformio.org/en/latest/platforms/espressif32.html#partition-tables
|
|
||||||
board_build.partitions = partition-table.csv
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
[nrf52_base]
|
[nrf52_base]
|
||||||
; Instead of the standard nordicnrf52 platform, we use our fork which has our added variant files
|
; Instead of the standard nordicnrf52 platform, we use our fork which has our added variant files
|
||||||
platform = platformio/nordicnrf52@^9.5.0
|
platform = platformio/nordicnrf52@^9.6.0
|
||||||
|
|
||||||
extends = arduino_base
|
extends = arduino_base
|
||||||
|
|
||||||
build_type = debug ; I'm debugging with ICE a lot now
|
build_type = debug ; I'm debugging with ICE a lot now
|
||||||
build_flags =
|
build_flags =
|
||||||
${arduino_base.build_flags} -Wno-unused-variable
|
${arduino_base.build_flags} -Wno-unused-variable
|
||||||
-Isrc/platform/nrf52
|
-Isrc/platform/nrf52
|
||||||
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
${arduino_base.build_src_filter} -<platform/esp32/> -<platform/stm32wl> -<nimble/> -<mesh/api/> -<mesh/http/> -<modules/esp32> -<mqtt/> -<platform/rp2040> -<mesh/eth/>
|
${arduino_base.build_src_filter} -<platform/esp32/> -<platform/stm32wl> -<nimble/> -<mesh/api/> -<mesh/http/> -<modules/esp32> -<mqtt/> -<platform/rp2040> -<mesh/eth/>
|
||||||
|
|
||||||
|
lib_deps=
|
||||||
|
${arduino_base.lib_deps}
|
||||||
|
jgromes/RadioLib@^6.0.0
|
||||||
|
|
||||||
lib_ignore =
|
lib_ignore =
|
||||||
BluetoothOTA
|
BluetoothOTA
|
||||||
|
|
||||||
; Note: By default no lora device is created for this build - it uses a simulated interface
|
|
||||||
[env:feather_nrf52832]
|
|
||||||
extends = nrf52_base
|
|
||||||
board = adafruit_feather_nrf52832
|
|
||||||
|
|||||||
7
arch/nrf52/nrf52832.ini
Normal file
7
arch/nrf52/nrf52832.ini
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[nrf52832_base]
|
||||||
|
extends = nrf52_base
|
||||||
|
|
||||||
|
build_flags = ${nrf52_base.build_flags}
|
||||||
|
|
||||||
|
lib_deps =
|
||||||
|
${nrf52_base.lib_deps}
|
||||||
@@ -1,14 +1,9 @@
|
|||||||
[nrf52840_base]
|
[nrf52840_base]
|
||||||
extends = nrf52_base
|
extends = nrf52_base
|
||||||
|
|
||||||
build_flags = ${nrf52_base.build_flags}
|
build_flags = ${nrf52_base.build_flags}
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${arduino_base.lib_deps}
|
${nrf52_base.lib_deps}
|
||||||
${environmental_base.lib_deps}
|
${environmental_base.lib_deps}
|
||||||
https://github.com/Kongduino/Adafruit_nRFCrypto.git#e31a8825ea3300b163a0a3c1ddd5de34e10e1371
|
https://github.com/Kongduino/Adafruit_nRFCrypto.git#e31a8825ea3300b163a0a3c1ddd5de34e10e1371
|
||||||
|
|
||||||
; Note: By default no lora device is created for this build - it uses a simulated interface
|
|
||||||
[env:nrf52840dk]
|
|
||||||
extends = nrf52840_base
|
|
||||||
board = nrf52840_dk
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
; 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#096b3c3e9c5c8e19d4c3b6cd803fffef2a9be4c5
|
platform = https://github.com/meshtastic/platform-native.git#489ff929dca0bb768256ba2de45f95815111490f
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
${env.build_src_filter}
|
${env.build_src_filter}
|
||||||
-<platform/esp32/>
|
-<platform/esp32/>
|
||||||
@@ -16,8 +17,14 @@ build_src_filter =
|
|||||||
-<modules/Telemetry/AirQualityTelemetry.cpp>
|
-<modules/Telemetry/AirQualityTelemetry.cpp>
|
||||||
-<modules/Telemetry/Sensor>
|
-<modules/Telemetry/Sensor>
|
||||||
+<../variants/portduino>
|
+<../variants/portduino>
|
||||||
|
|
||||||
lib_deps =
|
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
|
||||||
build_flags = ${arduino_base.build_flags} -fPIC -Isrc/platform/portduino
|
jgromes/RadioLib@^6.0.0
|
||||||
|
|
||||||
|
build_flags =
|
||||||
|
${arduino_base.build_flags}
|
||||||
|
-fPIC
|
||||||
|
-Isrc/platform/portduino
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
; Common settings for rp2040 Processor based targets
|
; Common settings for rp2040 Processor based targets
|
||||||
[rp2040_base]
|
[rp2040_base]
|
||||||
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#9f8c10e50b5acd18e7bfd32638199c655be73a5b
|
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#0c33219f53faa035e188925ea1324f472e8b93d2
|
||||||
extends = arduino_base
|
extends = arduino_base
|
||||||
|
platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#3.2.1
|
||||||
|
|
||||||
board_build.core = earlephilhower
|
board_build.core = earlephilhower
|
||||||
board_build.filesystem_size = 0.5m
|
board_build.filesystem_size = 0.5m
|
||||||
build_flags =
|
build_flags =
|
||||||
@@ -11,9 +13,12 @@ build_flags =
|
|||||||
# -D _POSIX_THREADS
|
# -D _POSIX_THREADS
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
${arduino_base.build_src_filter} -<platform/esp32/> -<nimble/> -<mesh/api/> -<mesh/http/> -<modules/esp32> -<mqtt/> -<platform/nrf52/> -<platform/stm32wl> -<mesh/eth/>
|
${arduino_base.build_src_filter} -<platform/esp32/> -<nimble/> -<mesh/api/> -<mesh/http/> -<modules/esp32> -<mqtt/> -<platform/nrf52/> -<platform/stm32wl> -<mesh/eth/>
|
||||||
|
|
||||||
lib_ignore =
|
lib_ignore =
|
||||||
BluetoothOTA
|
BluetoothOTA
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${arduino_base.lib_deps}
|
${arduino_base.lib_deps}
|
||||||
${environmental_base.lib_deps}
|
${environmental_base.lib_deps}
|
||||||
https://github.com/kokke/tiny-AES-c.git#f06ac37fc31dfdaca2e0d9bec83f90d5663c319b
|
jgromes/RadioLib@^6.0.0
|
||||||
|
https://github.com/kokke/tiny-AES-c.git#f06ac37fc31dfdaca2e0d9bec83f90d5663c319b
|
||||||
@@ -1,18 +1,29 @@
|
|||||||
[stm32wl5e_base]
|
[stm32wl5e_base]
|
||||||
platform = platformio/ststm32@^15.4.1
|
platform_packages = platformio/framework-arduinoststm32 @ https://github.com/stm32duino/Arduino_Core_STM32.git#6e3f9910d0122e82a6c3438507dfac3d2fd80a39
|
||||||
|
platform = ststm32
|
||||||
board = generic_wl5e
|
board = generic_wl5e
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
|
||||||
build_type = debug
|
build_type = debug
|
||||||
|
|
||||||
build_flags =
|
build_flags =
|
||||||
${arduino_base.build_flags}
|
${arduino_base.build_flags}
|
||||||
-Isrc/platform/stm32wl -g
|
-Isrc/platform/stm32wl -g
|
||||||
-DHAL_SUBGHZ_MODULE_ENABLED
|
-DconfigUSE_CMSIS_RTOS_V2=1
|
||||||
# Arduino/PlatformIO framework-arduinoststm32 package does not presently have SUBGHZSPI support
|
-DVECT_TAB_OFFSET=0x08000000
|
||||||
# -DPIN_SPI_MOSI=PINSUBGHZSPIMOSI -DPIN_SPI_MISO=PINSUBGHZSPIMISO -DPIN_SPI_SCK=PINSUBGHZSPISCK
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
${arduino_base.build_src_filter} -<platform/esp32/> -<nimble/> -<mesh/api/> -<mesh/http/> -<modules/esp32> -<mesh/eth/> -<mqtt/> -<graphics> -<input> -<buzz> -<modules/Telemetry> -<platform/nrf52> -<platform/portduino> -<platform/rp2040>
|
${arduino_base.build_src_filter} -<platform/esp32/> -<nimble/> -<mesh/api/> -<mesh/http/> -<modules/esp32> -<mesh/eth/> -<mqtt/> -<input> -<buzz> -<modules/Telemetry> -<platform/nrf52> -<platform/portduino> -<platform/rp2040>
|
||||||
|
|
||||||
|
board_upload.offset_address = 0x08000000
|
||||||
|
upload_protocol = stlink
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${env.lib_deps}
|
${env.lib_deps}
|
||||||
|
jgromes/RadioLib@^6.0.0
|
||||||
https://github.com/kokke/tiny-AES-c.git#f06ac37fc31dfdaca2e0d9bec83f90d5663c319b
|
https://github.com/kokke/tiny-AES-c.git#f06ac37fc31dfdaca2e0d9bec83f90d5663c319b
|
||||||
lib_ignore =
|
https://github.com/littlefs-project/littlefs.git#v2.5.1
|
||||||
mathertel/OneButton@^2.0.3
|
https://github.com/stm32duino/STM32FreeRTOS.git#10.3.1
|
||||||
|
|
||||||
|
lib_ignore =
|
||||||
|
https://github.com/mathertel/OneButton#2.1.0
|
||||||
|
|||||||
38
bin/generate_ci_matrix.py
Executable file
38
bin/generate_ci_matrix.py
Executable file
@@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
"""Generate the CI matrix"""
|
||||||
|
|
||||||
|
import configparser
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
rootdir = "variants/"
|
||||||
|
|
||||||
|
options = sys.argv[1:]
|
||||||
|
|
||||||
|
outlist = []
|
||||||
|
|
||||||
|
if len(options) < 1:
|
||||||
|
print(json.dumps(outlist))
|
||||||
|
exit()
|
||||||
|
|
||||||
|
for subdir, dirs, files in os.walk(rootdir):
|
||||||
|
for file in files:
|
||||||
|
if file == "platformio.ini":
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
config.read(subdir + "/" + file)
|
||||||
|
for c in config.sections():
|
||||||
|
if c.startswith("env:"):
|
||||||
|
section = config[c].name[4:]
|
||||||
|
if "extends" in config[config[c].name]:
|
||||||
|
if config[config[c].name]["extends"] == options[0] + "_base":
|
||||||
|
if "board_level" in config[config[c].name]:
|
||||||
|
if (
|
||||||
|
config[config[c].name]["board_level"] == "extra"
|
||||||
|
) & ("extra" in options):
|
||||||
|
outlist.append(section)
|
||||||
|
else:
|
||||||
|
outlist.append(section)
|
||||||
|
|
||||||
|
print(json.dumps(outlist))
|
||||||
@@ -1,5 +1 @@
|
|||||||
cd protobufs && ..\nanopb-0.4.7\generator-bin\protoc.exe --nanopb_out=-v:..\src\mesh\generated -I=..\protobufs ..\protobufs\meshtastic\*.proto
|
cd protobufs && ..\nanopb-0.4.7\generator-bin\protoc.exe --experimental_allow_proto3_optional --nanopb_out=-v:..\src\mesh\generated -I=..\protobufs ..\protobufs\meshtastic\*.proto
|
||||||
|
|
||||||
@REM cd ../src/mesh/generated/meshtastic
|
|
||||||
@REM sed -i 's/#include "meshtastic/#include "./g' *
|
|
||||||
@REM sed -i 's/meshtastic_//g' *
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ echo "prebuilt binaries for your computer into nanopb-0.4.7"
|
|||||||
|
|
||||||
# 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.7/generator-bin/protoc --nanopb_out=-v:../src/mesh/generated/ -I=../protobufs meshtastic/*.proto
|
../nanopb-0.4.7/generator-bin/protoc --nanopb_out=-v:../src/mesh/generated/ -I=../protobufs meshtastic/*.proto --experimental_allow_proto3_optional
|
||||||
|
|
||||||
# cd ../src/mesh/generated/meshtastic
|
# cd ../src/mesh/generated/meshtastic
|
||||||
# sed -i 's/#include "meshtastic/#include "./g' -- *
|
# sed -i 's/#include "meshtastic/#include "./g' -- *
|
||||||
|
|||||||
38
boards/bpi_picow_esp32_s3.json
Normal file
38
boards/bpi_picow_esp32_s3.json
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"arduino": {
|
||||||
|
"ldscript": "esp32s3_out.ld"
|
||||||
|
},
|
||||||
|
"core": "esp32",
|
||||||
|
"extra_flags": [
|
||||||
|
"-DARDUINO_USB_CDC_ON_BOOT=1",
|
||||||
|
"-DARDUINO_USB_MODE=0",
|
||||||
|
"-DARDUINO_RUNNING_CORE=1",
|
||||||
|
"-DARDUINO_EVENT_RUNNING_CORE=1",
|
||||||
|
"-DBOARD_HAS_PSRAM"
|
||||||
|
],
|
||||||
|
"f_cpu": "240000000L",
|
||||||
|
"f_flash": "80000000L",
|
||||||
|
"flash_mode": "dio",
|
||||||
|
"hwids": [["0x303A", "0x1001"]],
|
||||||
|
"mcu": "esp32s3",
|
||||||
|
"variant": "bpi_picow_esp32_s3"
|
||||||
|
},
|
||||||
|
"connectivity": ["wifi"],
|
||||||
|
"debug": {
|
||||||
|
"openocd_target": "esp32s3.cfg"
|
||||||
|
},
|
||||||
|
"frameworks": ["arduino", "espidf"],
|
||||||
|
"name": "BPI-PicoW-S3 (8 MB FLASH, 2 MB PSRAM)",
|
||||||
|
"upload": {
|
||||||
|
"flash_size": "8MB",
|
||||||
|
"maximum_ram_size": 327680,
|
||||||
|
"maximum_size": 8388608,
|
||||||
|
"use_1200bps_touch": true,
|
||||||
|
"wait_for_upload_port": true,
|
||||||
|
"require_upload_port": true,
|
||||||
|
"speed": 921600
|
||||||
|
},
|
||||||
|
"url": "https://wiki.banana-pi.org/BPI-PicoW-S3",
|
||||||
|
"vendor": "BPI"
|
||||||
|
}
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
"maximum_ram_size": 65536,
|
"maximum_ram_size": 65536,
|
||||||
"maximum_size": 262144,
|
"maximum_size": 262144,
|
||||||
"protocol": "cmsis-dap",
|
"protocol": "cmsis-dap",
|
||||||
"protocols": ["cmsis-dap"]
|
"protocols": ["cmsis-dap", "stlink"]
|
||||||
},
|
},
|
||||||
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32wl-series.html",
|
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32wl-series.html",
|
||||||
"vendor": "ST"
|
"vendor": "ST"
|
||||||
|
|||||||
41
boards/my-esp32s3-diy-oled.json
Normal file
41
boards/my-esp32s3-diy-oled.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": [["0x303A", "0x1001"]],
|
||||||
|
"mcu": "esp32s3",
|
||||||
|
"variant": "my-esp32s3-diy-oled"
|
||||||
|
},
|
||||||
|
"connectivity": ["wifi"],
|
||||||
|
"debug": {
|
||||||
|
"default_tool": "esp-builtin",
|
||||||
|
"onboard_tools": ["esp-builtin"],
|
||||||
|
"openocd_target": "esp32s3.cfg"
|
||||||
|
},
|
||||||
|
"frameworks": ["arduino", "espidf"],
|
||||||
|
"name": "Clone ESP32-S3-DevKitC-1 v1.1 (16 MB FLASH, 8 MB PSRAM)",
|
||||||
|
"upload": {
|
||||||
|
"flash_size": "16MB",
|
||||||
|
"maximum_ram_size": 327680,
|
||||||
|
"maximum_size": 16777216,
|
||||||
|
"use_1200bps_touch": true,
|
||||||
|
"wait_for_upload_port": true,
|
||||||
|
"require_upload_port": true,
|
||||||
|
"speed": 921600
|
||||||
|
},
|
||||||
|
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html",
|
||||||
|
"vendor": "Espressif"
|
||||||
|
}
|
||||||
41
boards/my_esp32s3_diy_eink.json
Normal file
41
boards/my_esp32s3_diy_eink.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": [["0x303A", "0x1001"]],
|
||||||
|
"mcu": "esp32s3",
|
||||||
|
"variant": "my_esp32s3_diy_eink"
|
||||||
|
},
|
||||||
|
"connectivity": ["wifi"],
|
||||||
|
"debug": {
|
||||||
|
"default_tool": "esp-builtin",
|
||||||
|
"onboard_tools": ["esp-builtin"],
|
||||||
|
"openocd_target": "esp32s3.cfg"
|
||||||
|
},
|
||||||
|
"frameworks": ["arduino", "espidf"],
|
||||||
|
"name": "Clone ESP32-S3-DevKitC-1 v1.1 (16 MB FLASH, 8 MB PSRAM)",
|
||||||
|
"upload": {
|
||||||
|
"flash_size": "16MB",
|
||||||
|
"maximum_ram_size": 327680,
|
||||||
|
"maximum_size": 16777216,
|
||||||
|
"use_1200bps_touch": true,
|
||||||
|
"wait_for_upload_port": true,
|
||||||
|
"require_upload_port": true,
|
||||||
|
"speed": 921600
|
||||||
|
},
|
||||||
|
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html",
|
||||||
|
"vendor": "Espressif"
|
||||||
|
}
|
||||||
40
boards/wiscore_rak11300.json
Normal file
40
boards/wiscore_rak11300.json
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"arduino": {
|
||||||
|
"earlephilhower": {
|
||||||
|
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
|
||||||
|
"usb_vid": "0x2E8A",
|
||||||
|
"usb_pid": "0x000A"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"core": "earlephilhower",
|
||||||
|
"cpu": "cortex-m0plus",
|
||||||
|
"extra_flags": "-DARDUINO_GENERIC_RP2040 -DRASPBERRY_PI_PICO -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250",
|
||||||
|
"f_cpu": "133000000L",
|
||||||
|
"hwids": [
|
||||||
|
["0x2E8A", "0x00C0"],
|
||||||
|
["0x2E8A", "0x000A"]
|
||||||
|
],
|
||||||
|
"mcu": "rp2040",
|
||||||
|
"variant": "WisBlock_RAK11300_Board"
|
||||||
|
},
|
||||||
|
"debug": {
|
||||||
|
"jlink_device": "RP2040_M0_0",
|
||||||
|
"openocd_target": "rp2040.cfg",
|
||||||
|
"svd_path": "rp2040.svd"
|
||||||
|
},
|
||||||
|
"frameworks": ["arduino"],
|
||||||
|
"name": "WisBlock RAK11300",
|
||||||
|
"upload": {
|
||||||
|
"maximum_ram_size": 270336,
|
||||||
|
"maximum_size": 2097152,
|
||||||
|
"require_upload_port": true,
|
||||||
|
"native_usb": true,
|
||||||
|
"use_1200bps_touch": true,
|
||||||
|
"wait_for_upload_port": false,
|
||||||
|
"protocol": "picotool",
|
||||||
|
"protocols": ["cmsis-dap", "raspberrypi-swd", "picotool", "picoprobe"]
|
||||||
|
},
|
||||||
|
"url": "https://docs.rakwireless.com/",
|
||||||
|
"vendor": "RAKwireless"
|
||||||
|
}
|
||||||
@@ -2,17 +2,17 @@
|
|||||||
; https://docs.platformio.org/page/projectconf.html
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
[platformio]
|
[platformio]
|
||||||
default_envs = tbeam
|
;default_envs = tbeam
|
||||||
;default_envs = pico
|
;default_envs = pico
|
||||||
;default_envs = tbeam-s3-core
|
;default_envs = tbeam-s3-core
|
||||||
;default_envs = tbeam0.7
|
;default_envs = tbeam0.7
|
||||||
;default_envs = heltec-v1
|
;default_envs = heltec-v1
|
||||||
;default_envs = heltec-v2.0
|
;default_envs = heltec-v2_0
|
||||||
;default_envs = heltec-v2.1
|
;default_envs = heltec-v2_1
|
||||||
;default_envs = tlora-v1
|
;default_envs = tlora-v1
|
||||||
;default_envs = tlora_v1_3
|
;default_envs = tlora_v1_3
|
||||||
;default_envs = tlora-v2
|
;default_envs = tlora-v2
|
||||||
;default_envs = tlora-v2-1-1.6
|
;default_envs = tlora-v2-1-1_6
|
||||||
;default_envs = tlora-t3s3-v1
|
;default_envs = tlora-t3s3-v1
|
||||||
;default_envs = lora-relay-v1 # nrf board
|
;default_envs = lora-relay-v1 # nrf board
|
||||||
;default_envs = t-echo
|
;default_envs = t-echo
|
||||||
@@ -21,17 +21,18 @@ default_envs = tbeam
|
|||||||
;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
|
||||||
;default_envs = meshtastic-diy-v1.1
|
;default_envs = meshtastic-diy-v1_1
|
||||||
;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 = wio-e5
|
||||||
|
|
||||||
extra_configs =
|
extra_configs =
|
||||||
arch/*/*.ini
|
arch/*/*.ini
|
||||||
variants/*/platformio.ini
|
variants/*/platformio.ini
|
||||||
|
|
||||||
[env]
|
[env]
|
||||||
extra_scripts = bin/platformio-custom.py
|
extra_scripts = bin/platformio-custom.py
|
||||||
|
|
||||||
; note: we add src to our include search path so that lmic_project_config can override
|
; note: we add src to our include search path so that lmic_project_config can override
|
||||||
; note: TINYGPS_OPTION_NO_CUSTOM_FIELDS is VERY important. We don't use custom fields and somewhere in that pile
|
; note: TINYGPS_OPTION_NO_CUSTOM_FIELDS is VERY important. We don't use custom fields and somewhere in that pile
|
||||||
@@ -39,8 +40,8 @@ extra_scripts = bin/platformio-custom.py
|
|||||||
; FIXME: fix lib/BluetoothOTA dependency back on src/ so we can remove -Isrc
|
; FIXME: fix lib/BluetoothOTA dependency back on src/ so we can remove -Isrc
|
||||||
; The Radiolib stuff will speed up building considerably. Exclud all the stuff we dont need.
|
; The Radiolib stuff will speed up building considerably. Exclud all the stuff we dont need.
|
||||||
build_flags = -Wno-missing-field-initializers
|
build_flags = -Wno-missing-field-initializers
|
||||||
-Wno-format
|
-Wno-format
|
||||||
-Isrc -Isrc/mesh -Isrc/mesh/generated -Isrc/gps -Isrc/buzz -Wl,-Map,.pio/build/output.map
|
-Isrc -Isrc/mesh -Isrc/mesh/generated -Isrc/gps -Isrc/buzz -Wl,-Map,.pio/build/output.map
|
||||||
-DUSE_THREAD_NAMES
|
-DUSE_THREAD_NAMES
|
||||||
-DTINYGPS_OPTION_NO_CUSTOM_FIELDS
|
-DTINYGPS_OPTION_NO_CUSTOM_FIELDS
|
||||||
-DPB_ENABLE_MALLOC=1
|
-DPB_ENABLE_MALLOC=1
|
||||||
@@ -59,14 +60,13 @@ build_flags = -Wno-missing-field-initializers
|
|||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/meshtastic/esp8266-oled-ssd1306.git#b38094e03dfa964fbc0e799bc374e91a605c1223 ; ESP8266_SSD1306
|
https://github.com/meshtastic/esp8266-oled-ssd1306.git#b38094e03dfa964fbc0e799bc374e91a605c1223 ; ESP8266_SSD1306
|
||||||
mathertel/OneButton@^2.0.3 ; OneButton library for non-blocking button debounce
|
https://github.com/mathertel/OneButton#2.1.0 ; 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#127ad674ef85f0201cb68a065879653ed94792c4
|
https://github.com/meshtastic/TinyGPSPlus.git#127ad674ef85f0201cb68a065879653ed94792c4
|
||||||
https://github.com/meshtastic/ArduinoThread.git#72921ac222eed6f526ba1682023cee290d9aa1b3
|
https://github.com/meshtastic/ArduinoThread.git#72921ac222eed6f526ba1682023cee290d9aa1b3
|
||||||
nanopb/Nanopb@^0.4.7
|
nanopb/Nanopb@^0.4.7
|
||||||
erriez/ErriezCRC32@^1.0.1
|
erriez/ErriezCRC32@^1.0.1
|
||||||
jgromes/RadioLib@^5.7.0
|
|
||||||
|
|
||||||
; Used for the code analysis in PIO Home / Inspect
|
; Used for the code analysis in PIO Home / Inspect
|
||||||
check_tool = cppcheck
|
check_tool = cppcheck
|
||||||
@@ -83,19 +83,19 @@ lib_deps =
|
|||||||
${env.lib_deps}
|
${env.lib_deps}
|
||||||
mprograms/QMC5883LCompass@^1.1.1
|
mprograms/QMC5883LCompass@^1.1.1
|
||||||
end2endzone/NonBlockingRTTTL@^1.3.0
|
end2endzone/NonBlockingRTTTL@^1.3.0
|
||||||
https://github.com/meshtastic/SparkFun_ATECCX08a_Arduino_Library.git#52b5282639d08a8cbd4b748363089eed6102dc76
|
https://github.com/meshtastic/SparkFun_ATECCX08a_Arduino_Library.git#5cf62b36c6f30bc72a07bdb2c11fc9a22d1e31da
|
||||||
|
|
||||||
build_flags = ${env.build_flags} -Os -DRADIOLIB_SPI_PARANOID=0
|
build_flags = ${env.build_flags} -Os -DRADIOLIB_SPI_PARANOID=0
|
||||||
build_src_filter = ${env.build_src_filter} -<platform/portduino/>
|
build_src_filter = ${env.build_src_filter} -<platform/portduino/>
|
||||||
|
|
||||||
; Common libs for communicating over TCP/IP networks such as MQTT
|
; Common libs for communicating over TCP/IP networks such as MQTT
|
||||||
[networking_base]
|
[networking_base]
|
||||||
lib_deps =
|
lib_deps =
|
||||||
knolleary/PubSubClient@^2.8
|
knolleary/PubSubClient@^2.8
|
||||||
arduino-libraries/NTPClient@^3.1.0
|
arduino-libraries/NTPClient@^3.1.0
|
||||||
arcao/Syslog@^2.0.0
|
arcao/Syslog@^2.0.0
|
||||||
|
|
||||||
; Common libs for environmental measurements in telemetry module
|
; Common libs for environmental measurements in telemetry module
|
||||||
; (not included in native / portduino)
|
; (not included in native / portduino)
|
||||||
[environmental_base]
|
[environmental_base]
|
||||||
lib_deps =
|
lib_deps =
|
||||||
@@ -103,7 +103,8 @@ lib_deps =
|
|||||||
adafruit/Adafruit Unified Sensor@^1.1.9
|
adafruit/Adafruit Unified Sensor@^1.1.9
|
||||||
adafruit/Adafruit BMP280 Library@^2.6.6
|
adafruit/Adafruit BMP280 Library@^2.6.6
|
||||||
adafruit/Adafruit BME280 Library@^2.2.2
|
adafruit/Adafruit BME280 Library@^2.2.2
|
||||||
adafruit/Adafruit BME680 Library@^2.0.1
|
https://github.com/boschsensortec/Bosch-BSEC2-Library#v1.5.2400
|
||||||
|
boschsensortec/BME68x Sensor Library@^1.1.40407
|
||||||
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
|
||||||
@@ -112,4 +113,4 @@ lib_deps =
|
|||||||
adafruit/Adafruit SHT31 Library@^2.2.0
|
adafruit/Adafruit SHT31 Library@^2.2.0
|
||||||
adafruit/Adafruit PM25 AQI Sensor@^1.0.6
|
adafruit/Adafruit PM25 AQI Sensor@^1.0.6
|
||||||
adafruit/Adafruit MPU6050@^2.2.4
|
adafruit/Adafruit MPU6050@^2.2.4
|
||||||
adafruit/Adafruit LIS3DH@^1.2.4
|
adafruit/Adafruit LIS3DH@^1.2.4
|
||||||
Submodule protobufs updated: 9c9fe890ce...8d17bb2452
@@ -7,6 +7,9 @@
|
|||||||
#include <Adafruit_LIS3DH.h>
|
#include <Adafruit_LIS3DH.h>
|
||||||
#include <Adafruit_MPU6050.h>
|
#include <Adafruit_MPU6050.h>
|
||||||
|
|
||||||
|
#define ACCELEROMETER_CHECK_INTERVAL_MS 100
|
||||||
|
#define ACCELEROMETER_CLICK_THRESHOLD 40
|
||||||
|
|
||||||
namespace concurrency
|
namespace concurrency
|
||||||
{
|
{
|
||||||
class AccelerometerThread : public concurrency::OSThread
|
class AccelerometerThread : public concurrency::OSThread
|
||||||
@@ -14,10 +17,18 @@ class AccelerometerThread : public concurrency::OSThread
|
|||||||
public:
|
public:
|
||||||
AccelerometerThread(ScanI2C::DeviceType type = ScanI2C::DeviceType::NONE) : OSThread("AccelerometerThread")
|
AccelerometerThread(ScanI2C::DeviceType type = ScanI2C::DeviceType::NONE) : OSThread("AccelerometerThread")
|
||||||
{
|
{
|
||||||
if (accelerometer_found.port == ScanI2C::I2CPort::NO_I2C || !config.display.wake_on_tap_or_motion) {
|
if (accelerometer_found.port == ScanI2C::I2CPort::NO_I2C) {
|
||||||
|
LOG_DEBUG("AccelerometerThread disabling due to no sensors found\n");
|
||||||
disable();
|
disable();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
accleremoter_type = type;
|
accleremoter_type = type;
|
||||||
LOG_DEBUG("AccelerometerThread initializing\n");
|
LOG_DEBUG("AccelerometerThread initializing\n");
|
||||||
|
|
||||||
@@ -32,9 +43,8 @@ class AccelerometerThread : public concurrency::OSThread
|
|||||||
} else if (accleremoter_type == ScanI2C::DeviceType::LIS3DH && lis.begin(accelerometer_found.address)) {
|
} else if (accleremoter_type == ScanI2C::DeviceType::LIS3DH && lis.begin(accelerometer_found.address)) {
|
||||||
LOG_DEBUG("LIS3DH initializing\n");
|
LOG_DEBUG("LIS3DH initializing\n");
|
||||||
lis.setRange(LIS3DH_RANGE_2_G);
|
lis.setRange(LIS3DH_RANGE_2_G);
|
||||||
|
|
||||||
// Adjust threshhold, higher numbers are less sensitive
|
// Adjust threshhold, higher numbers are less sensitive
|
||||||
lis.setClick(1, 80);
|
lis.setClick(config.device.double_tap_as_button_press ? 2 : 1, ACCELEROMETER_CLICK_THRESHOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,19 +56,34 @@ class AccelerometerThread : public concurrency::OSThread
|
|||||||
if (accleremoter_type == ScanI2C::DeviceType::MPU6050 && mpu.getMotionInterruptStatus()) {
|
if (accleremoter_type == ScanI2C::DeviceType::MPU6050 && mpu.getMotionInterruptStatus()) {
|
||||||
wakeScreen();
|
wakeScreen();
|
||||||
} else if (accleremoter_type == ScanI2C::DeviceType::LIS3DH && lis.getClick() > 0) {
|
} else if (accleremoter_type == ScanI2C::DeviceType::LIS3DH && lis.getClick() > 0) {
|
||||||
wakeScreen();
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 100;
|
return ACCELEROMETER_CHECK_INTERVAL_MS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void wakeScreen()
|
void wakeScreen()
|
||||||
{
|
{
|
||||||
LOG_DEBUG("Tap or motion detected. Turning on screen\n");
|
|
||||||
if (powerFSM.getState() == &stateDARK) {
|
if (powerFSM.getState() == &stateDARK) {
|
||||||
|
LOG_INFO("Tap or motion detected. Turning on screen\n");
|
||||||
powerFSM.trigger(EVENT_INPUT);
|
powerFSM.trigger(EVENT_INPUT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void buttonPress()
|
||||||
|
{
|
||||||
|
LOG_DEBUG("Double-tap detected. Firing button press\n");
|
||||||
|
powerFSM.trigger(EVENT_PRESS);
|
||||||
|
}
|
||||||
|
|
||||||
ScanI2C::DeviceType accleremoter_type;
|
ScanI2C::DeviceType accleremoter_type;
|
||||||
Adafruit_MPU6050 mpu;
|
Adafruit_MPU6050 mpu;
|
||||||
Adafruit_LIS3DH lis;
|
Adafruit_LIS3DH lis;
|
||||||
|
|||||||
@@ -45,19 +45,19 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
ButtonThread() : OSThread("Button")
|
ButtonThread() : OSThread("Button")
|
||||||
{
|
{
|
||||||
#ifdef BUTTON_PIN
|
#ifdef BUTTON_PIN
|
||||||
userButton = OneButton(BUTTON_PIN, true, true);
|
userButton = OneButton(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN, true, true);
|
||||||
#ifdef INPUT_PULLUP_SENSE
|
#ifdef INPUT_PULLUP_SENSE
|
||||||
// Some platforms (nrf52) have a SENSE variant which allows wake from sleep - override what OneButton did
|
// Some platforms (nrf52) have a SENSE variant which allows wake from sleep - override what OneButton did
|
||||||
pinMode(BUTTON_PIN, INPUT_PULLUP_SENSE);
|
pinMode(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN, INPUT_PULLUP_SENSE);
|
||||||
#endif
|
#endif
|
||||||
userButton.attachClick(userButtonPressed);
|
userButton.attachClick(userButtonPressed);
|
||||||
userButton.setClickTicks(300);
|
userButton.setClickMs(300);
|
||||||
userButton.attachDuringLongPress(userButtonPressedLong);
|
userButton.attachDuringLongPress(userButtonPressedLong);
|
||||||
userButton.attachDoubleClick(userButtonDoublePressed);
|
userButton.attachDoubleClick(userButtonDoublePressed);
|
||||||
userButton.attachMultiClick(userButtonMultiPressed);
|
userButton.attachMultiClick(userButtonMultiPressed);
|
||||||
userButton.attachLongPressStart(userButtonPressedLongStart);
|
userButton.attachLongPressStart(userButtonPressedLongStart);
|
||||||
userButton.attachLongPressStop(userButtonPressedLongStop);
|
userButton.attachLongPressStop(userButtonPressedLongStop);
|
||||||
wakeOnIrq(BUTTON_PIN, FALLING);
|
wakeOnIrq(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN, FALLING);
|
||||||
#endif
|
#endif
|
||||||
#ifdef BUTTON_PIN_ALT
|
#ifdef BUTTON_PIN_ALT
|
||||||
userButtonAlt = OneButton(BUTTON_PIN_ALT, true, true);
|
userButtonAlt = OneButton(BUTTON_PIN_ALT, true, true);
|
||||||
@@ -115,7 +115,9 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
{
|
{
|
||||||
// LOG_DEBUG("press!\n");
|
// LOG_DEBUG("press!\n");
|
||||||
#ifdef BUTTON_PIN
|
#ifdef BUTTON_PIN
|
||||||
if ((BUTTON_PIN != moduleConfig.canned_message.inputbroker_pin_press) || !moduleConfig.canned_message.enabled) {
|
if (((config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN) !=
|
||||||
|
moduleConfig.canned_message.inputbroker_pin_press) ||
|
||||||
|
!moduleConfig.canned_message.enabled) {
|
||||||
powerFSM.trigger(EVENT_PRESS);
|
powerFSM.trigger(EVENT_PRESS);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -124,13 +126,8 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
{
|
{
|
||||||
// LOG_DEBUG("Long press!\n");
|
// LOG_DEBUG("Long press!\n");
|
||||||
// If user button is held down for 5 seconds, shutdown the device.
|
// If user button is held down for 5 seconds, shutdown the device.
|
||||||
if ((millis() - longPressTime > 5 * 1000) && (longPressTime > 0)) {
|
if ((millis() - longPressTime > 5000) && (longPressTime > 0)) {
|
||||||
#ifdef HAS_PMU
|
#if defined(ARCH_NRF52) || defined(ARCH_ESP32)
|
||||||
if (pmu_found == true) {
|
|
||||||
setLed(false);
|
|
||||||
power->shutdown();
|
|
||||||
}
|
|
||||||
#elif defined(ARCH_NRF52) || defined(ARCH_ESP32)
|
|
||||||
// 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.
|
||||||
if ((!shutdown_on_long_stop) && (millis() > 30 * 1000)) {
|
if ((!shutdown_on_long_stop) && (millis() > 30 * 1000)) {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#define DEBUG_PORT (*console) // Serial debug port
|
#define DEBUG_PORT (*console) // Serial debug port
|
||||||
|
|
||||||
#ifdef USE_SEGGER
|
#ifdef USE_SEGGER
|
||||||
|
#define DEBUG_PORT
|
||||||
#define LOG_DEBUG(...) SEGGER_RTT_printf(0, __VA_ARGS__)
|
#define LOG_DEBUG(...) SEGGER_RTT_printf(0, __VA_ARGS__)
|
||||||
#define LOG_INFO(...) SEGGER_RTT_printf(0, __VA_ARGS__)
|
#define LOG_INFO(...) SEGGER_RTT_printf(0, __VA_ARGS__)
|
||||||
#define LOG_WARN(...) SEGGER_RTT_printf(0, __VA_ARGS__)
|
#define LOG_WARN(...) SEGGER_RTT_printf(0, __VA_ARGS__)
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ bool copyFile(const char *from, const char *to)
|
|||||||
f2.write(cbuffer, i);
|
f2.write(cbuffer, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
f2.flush();
|
||||||
f2.close();
|
f2.close();
|
||||||
f1.close();
|
f1.close();
|
||||||
return true;
|
return true;
|
||||||
@@ -56,7 +57,7 @@ bool renameFile(const char *pathFrom, const char *pathTo)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void listDir(const char *dirname, uint8_t levels, boolean del = false)
|
void listDir(const char *dirname, uint8_t levels, bool del = false)
|
||||||
{
|
{
|
||||||
#ifdef FSCom
|
#ifdef FSCom
|
||||||
#if (defined(ARCH_ESP32) || defined(ARCH_RP2040) || defined(ARCH_PORTDUINO))
|
#if (defined(ARCH_ESP32) || defined(ARCH_RP2040) || defined(ARCH_PORTDUINO))
|
||||||
|
|||||||
@@ -13,6 +13,13 @@
|
|||||||
#define FILE_O_READ "r"
|
#define FILE_O_READ "r"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(ARCH_STM32WL)
|
||||||
|
#include "platform/stm32wl/InternalFileSystem.h" // STM32WL version
|
||||||
|
#define FSCom InternalFS
|
||||||
|
#define FSBegin() FSCom.begin()
|
||||||
|
using namespace LittleFS_Namespace;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(ARCH_RP2040)
|
#if defined(ARCH_RP2040)
|
||||||
// RP2040
|
// RP2040
|
||||||
#include "LittleFS.h"
|
#include "LittleFS.h"
|
||||||
@@ -42,6 +49,6 @@ using namespace Adafruit_LittleFS_Namespace;
|
|||||||
void fsInit();
|
void fsInit();
|
||||||
bool copyFile(const char *from, const char *to);
|
bool copyFile(const char *from, const char *to);
|
||||||
bool renameFile(const char *pathFrom, const char *pathTo);
|
bool renameFile(const char *pathFrom, const char *pathTo);
|
||||||
void listDir(const char *dirname, uint8_t levels, boolean del);
|
void listDir(const char *dirname, uint8_t levels, bool del);
|
||||||
void rmDir(const char *dirname);
|
void rmDir(const char *dirname);
|
||||||
void setupSDCard();
|
void setupSDCard();
|
||||||
@@ -138,8 +138,9 @@ class GPSStatus : public Status
|
|||||||
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\n", 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\n");
|
||||||
|
}
|
||||||
onNewStatus.notifyObservers(this);
|
onNewStatus.notifyObservers(this);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
316
src/Power.cpp
316
src/Power.cpp
@@ -17,12 +17,38 @@
|
|||||||
#define DELAY_FOREVER portMAX_DELAY
|
#define DELAY_FOREVER portMAX_DELAY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(BATTERY_PIN) && defined(ARCH_ESP32)
|
||||||
|
|
||||||
|
#ifndef BAT_MEASURE_ADC_UNIT // ADC1 is default
|
||||||
|
static const adc1_channel_t adc_channel = ADC_CHANNEL;
|
||||||
|
static const adc_unit_t unit = ADC_UNIT_1;
|
||||||
|
#else // ADC2
|
||||||
|
static const adc2_channel_t adc_channel = ADC_CHANNEL;
|
||||||
|
static const adc_unit_t unit = ADC_UNIT_2;
|
||||||
|
RTC_NOINIT_ATTR uint64_t RTC_reg_b;
|
||||||
|
|
||||||
|
#endif // BAT_MEASURE_ADC_UNIT
|
||||||
|
|
||||||
|
esp_adc_cal_characteristics_t *adc_characs = (esp_adc_cal_characteristics_t *)calloc(1, sizeof(esp_adc_cal_characteristics_t));
|
||||||
|
#ifndef ADC_ATTENUATION
|
||||||
|
static const adc_atten_t atten = ADC_ATTEN_DB_11;
|
||||||
|
#else
|
||||||
|
static const adc_atten_t atten = ADC_ATTENUATION;
|
||||||
|
#endif
|
||||||
|
#endif // BATTERY_PIN && ARCH_ESP32
|
||||||
|
|
||||||
|
#if HAS_TELEMETRY && !defined(ARCH_PORTDUINO)
|
||||||
|
INA260Sensor ina260Sensor;
|
||||||
|
INA219Sensor ina219Sensor;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_PMU
|
#ifdef HAS_PMU
|
||||||
#include "XPowersAXP192.tpp"
|
#include "XPowersAXP192.tpp"
|
||||||
#include "XPowersAXP2101.tpp"
|
#include "XPowersAXP2101.tpp"
|
||||||
#include "XPowersLibInterface.hpp"
|
#include "XPowersLibInterface.hpp"
|
||||||
XPowersLibInterface *PMU = NULL;
|
XPowersLibInterface *PMU = NULL;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// Copy of the base class defined in axp20x.h.
|
// Copy of the base class defined in axp20x.h.
|
||||||
// I'd rather not inlude axp20x.h as it brings Wire dependency.
|
// I'd rather not inlude axp20x.h as it brings Wire dependency.
|
||||||
class HasBatteryLevel
|
class HasBatteryLevel
|
||||||
@@ -108,6 +134,13 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
virtual uint16_t getBattVoltage() override
|
virtual uint16_t getBattVoltage() override
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#if defined(HAS_TELEMETRY) && !defined(ARCH_PORTDUINO) && !defined(HAS_PMU)
|
||||||
|
if (hasINA()) {
|
||||||
|
LOG_DEBUG("Using INA on I2C addr 0x%x for device battery voltage\n", config.power.device_battery_ina_address);
|
||||||
|
return getINAVoltage();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef ADC_MULTIPLIER
|
#ifndef ADC_MULTIPLIER
|
||||||
#define ADC_MULTIPLIER 2.0
|
#define ADC_MULTIPLIER 2.0
|
||||||
#endif
|
#endif
|
||||||
@@ -128,18 +161,41 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
// Set the number of samples, it has an effect of increasing sensitivity, especially in complex electromagnetic
|
// Set the number of samples, it has an effect of increasing sensitivity, especially in complex electromagnetic
|
||||||
// environment.
|
// environment.
|
||||||
uint32_t raw = 0;
|
uint32_t raw = 0;
|
||||||
|
#ifdef ARCH_ESP32
|
||||||
|
#ifndef BAT_MEASURE_ADC_UNIT // ADC1
|
||||||
|
for (int i = 0; i < BATTERY_SENSE_SAMPLES; i++) {
|
||||||
|
raw += adc1_get_raw(adc_channel);
|
||||||
|
}
|
||||||
|
#else // ADC2
|
||||||
|
int32_t adc_buf = 0;
|
||||||
|
for (int i = 0; i < BATTERY_SENSE_SAMPLES; i++) {
|
||||||
|
// ADC2 wifi bug workaround, see
|
||||||
|
// https://github.com/espressif/arduino-esp32/issues/102
|
||||||
|
WRITE_PERI_REG(SENS_SAR_READ_CTRL2_REG, RTC_reg_b);
|
||||||
|
SET_PERI_REG_MASK(SENS_SAR_READ_CTRL2_REG, SENS_SAR2_DATA_INV);
|
||||||
|
adc2_get_raw(adc_channel, ADC_WIDTH_BIT_12, &adc_buf);
|
||||||
|
raw += adc_buf;
|
||||||
|
}
|
||||||
|
#endif // BAT_MEASURE_ADC_UNIT
|
||||||
|
#else // !ARCH_ESP32
|
||||||
for (uint32_t i = 0; i < BATTERY_SENSE_SAMPLES; i++) {
|
for (uint32_t i = 0; i < BATTERY_SENSE_SAMPLES; i++) {
|
||||||
raw += analogRead(BATTERY_PIN);
|
raw += analogRead(BATTERY_PIN);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
raw = raw / BATTERY_SENSE_SAMPLES;
|
raw = raw / BATTERY_SENSE_SAMPLES;
|
||||||
|
|
||||||
float scaled;
|
float scaled;
|
||||||
|
#ifdef ARCH_ESP32
|
||||||
|
scaled = esp_adc_cal_raw_to_voltage(raw, adc_characs);
|
||||||
|
scaled *= operativeAdcMultiplier;
|
||||||
|
#else
|
||||||
#ifndef VBAT_RAW_TO_SCALED
|
#ifndef VBAT_RAW_TO_SCALED
|
||||||
scaled = 1000.0 * operativeAdcMultiplier * (AREF_VOLTAGE / 1024.0) * raw;
|
scaled = 1000.0 * operativeAdcMultiplier * (AREF_VOLTAGE / 1024.0) * raw;
|
||||||
#else
|
#else
|
||||||
scaled = VBAT_RAW_TO_SCALED(raw); // defined in variant.h
|
scaled = VBAT_RAW_TO_SCALED(raw); // defined in variant.h
|
||||||
#endif
|
#endif // VBAT RAW TO SCALED
|
||||||
// LOG_DEBUG("battery gpio %d raw val=%u scaled=%u\n", BATTERY_PIN, raw, (uint32_t)(scaled));
|
#endif // ARCH_ESP32
|
||||||
|
// LOG_DEBUG("battery gpio %d raw val=%u scaled=%u\n", BATTERY_PIN, raw, (uint32_t)(scaled));
|
||||||
|
|
||||||
last_read_value = scaled;
|
last_read_value = scaled;
|
||||||
return scaled;
|
return scaled;
|
||||||
} else {
|
} else {
|
||||||
@@ -147,7 +203,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif // BATTERY_PIN
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -160,8 +216,18 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
|
|
||||||
/// If we see a battery voltage higher than physics allows - assume charger is pumping
|
/// If we see a battery voltage higher than physics allows - assume charger is pumping
|
||||||
/// in power
|
/// in power
|
||||||
|
/// On some boards we don't have the power management chip (like AXPxxxx)
|
||||||
|
/// so we use EXT_PWR_DETECT GPIO pin to detect external power source
|
||||||
virtual bool isVbusIn() override
|
virtual bool isVbusIn() override
|
||||||
{
|
{
|
||||||
|
#ifdef EXT_PWR_DETECT
|
||||||
|
// if external powered that pin will be pulled up
|
||||||
|
if (digitalRead(EXT_PWR_DETECT) == HIGH) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// if it's not HIGH - check the battery
|
||||||
|
#endif
|
||||||
|
|
||||||
return getBattVoltage() > chargingVolt;
|
return getBattVoltage() > chargingVolt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,6 +259,35 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
const float fullVolt = BAT_FULLVOLT, emptyVolt = BAT_EMPTYVOLT, chargingVolt = BAT_CHARGINGVOLT, noBatVolt = BAT_NOBATVOLT;
|
const float fullVolt = BAT_FULLVOLT, emptyVolt = BAT_EMPTYVOLT, chargingVolt = BAT_CHARGINGVOLT, noBatVolt = BAT_NOBATVOLT;
|
||||||
float last_read_value = 0.0;
|
float last_read_value = 0.0;
|
||||||
uint32_t last_read_time_ms = 0;
|
uint32_t last_read_time_ms = 0;
|
||||||
|
|
||||||
|
#if defined(HAS_TELEMETRY) && !defined(ARCH_PORTDUINO)
|
||||||
|
uint16_t getINAVoltage()
|
||||||
|
{
|
||||||
|
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219] == config.power.device_battery_ina_address) {
|
||||||
|
return ina219Sensor.getBusVoltageMv();
|
||||||
|
} else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA260] == config.power.device_battery_ina_address) {
|
||||||
|
return ina260Sensor.getBusVoltageMv();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasINA()
|
||||||
|
{
|
||||||
|
if (!config.power.device_battery_ina_address) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219] == config.power.device_battery_ina_address) {
|
||||||
|
if (!ina219Sensor.isInitialized())
|
||||||
|
return ina219Sensor.runOnce() > 0;
|
||||||
|
return ina219Sensor.isRunning();
|
||||||
|
} else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA260] == config.power.device_battery_ina_address) {
|
||||||
|
if (!ina260Sensor.isInitialized())
|
||||||
|
return ina260Sensor.runOnce() > 0;
|
||||||
|
return ina260Sensor.isRunning();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
AnalogBatteryLevel analogLevel;
|
AnalogBatteryLevel analogLevel;
|
||||||
@@ -202,37 +297,68 @@ Power::Power() : OSThread("Power")
|
|||||||
statusHandler = {};
|
statusHandler = {};
|
||||||
low_voltage_counter = 0;
|
low_voltage_counter = 0;
|
||||||
#ifdef DEBUG_HEAP
|
#ifdef DEBUG_HEAP
|
||||||
lastheap = ESP.getFreeHeap();
|
lastheap = memGet.getFreeHeap();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Power::analogInit()
|
bool Power::analogInit()
|
||||||
{
|
{
|
||||||
|
#ifdef EXT_PWR_DETECT
|
||||||
|
pinMode(EXT_PWR_DETECT, INPUT);
|
||||||
|
#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\n", BATTERY_PIN);
|
||||||
|
|
||||||
// disable any internal pullups
|
// disable any internal pullups
|
||||||
pinMode(BATTERY_PIN, INPUT);
|
pinMode(BATTERY_PIN, INPUT);
|
||||||
|
|
||||||
#ifdef ARCH_ESP32
|
#ifndef BATTERY_SENSE_RESOLUTION_BITS
|
||||||
// ESP32 needs special analog stuff
|
#define BATTERY_SENSE_RESOLUTION_BITS 10
|
||||||
adcAttachPin(BATTERY_PIN);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ARCH_ESP32 // ESP32 needs special analog stuff
|
||||||
|
|
||||||
|
#ifndef ADC_WIDTH // max resolution by default
|
||||||
|
static const adc_bits_width_t width = ADC_WIDTH_BIT_12;
|
||||||
|
#else
|
||||||
|
static const adc_bits_width_t width = ADC_WIDTH;
|
||||||
|
#endif
|
||||||
|
#ifndef BAT_MEASURE_ADC_UNIT // ADC1
|
||||||
|
adc1_config_width(width);
|
||||||
|
adc1_config_channel_atten(adc_channel, atten);
|
||||||
|
#else // ADC2
|
||||||
|
adc2_config_channel_atten(adc_channel, atten);
|
||||||
|
// ADC2 wifi bug workaround
|
||||||
|
RTC_reg_b = READ_PERI_REG(SENS_SAR_READ_CTRL2_REG);
|
||||||
|
#endif
|
||||||
|
// calibrate ADC
|
||||||
|
esp_adc_cal_value_t val_type = esp_adc_cal_characterize(unit, atten, width, DEFAULT_VREF, adc_characs);
|
||||||
|
// show ADC characterization base
|
||||||
|
if (val_type == ESP_ADC_CAL_VAL_EFUSE_TP) {
|
||||||
|
LOG_INFO("ADCmod: ADC characterization based on Two Point values stored in eFuse\n");
|
||||||
|
} else if (val_type == ESP_ADC_CAL_VAL_EFUSE_VREF) {
|
||||||
|
LOG_INFO("ADCmod: ADC characterization based on reference voltage stored in eFuse\n");
|
||||||
|
} else {
|
||||||
|
LOG_INFO("ADCmod: ADC characterization based on default reference voltage\n");
|
||||||
|
}
|
||||||
|
#if defined(HELTEC_V3) || defined(HELTEC_WSL_V3)
|
||||||
|
pinMode(37, OUTPUT); // needed for P channel mosfet to work
|
||||||
|
digitalWrite(37, LOW);
|
||||||
|
#endif
|
||||||
|
#endif // ARCH_ESP32
|
||||||
|
|
||||||
#ifdef ARCH_NRF52
|
#ifdef ARCH_NRF52
|
||||||
#ifdef VBAT_AR_INTERNAL
|
#ifdef VBAT_AR_INTERNAL
|
||||||
analogReference(VBAT_AR_INTERNAL);
|
analogReference(VBAT_AR_INTERNAL);
|
||||||
#else
|
#else
|
||||||
analogReference(AR_INTERNAL); // 3.6V
|
analogReference(AR_INTERNAL); // 3.6V
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef BATTERY_SENSE_RESOLUTION_BITS
|
|
||||||
#define BATTERY_SENSE_RESOLUTION_BITS 10
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// adcStart(BATTERY_PIN);
|
|
||||||
analogReadResolution(BATTERY_SENSE_RESOLUTION_BITS); // Default of 12 is not very linear. Recommended to use 10 or 11
|
analogReadResolution(BATTERY_SENSE_RESOLUTION_BITS); // Default of 12 is not very linear. Recommended to use 10 or 11
|
||||||
// depending on needed resolution.
|
// depending on needed resolution.
|
||||||
|
|
||||||
|
#endif // ARCH_NRF52
|
||||||
|
|
||||||
batteryLevel = &analogLevel;
|
batteryLevel = &analogLevel;
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
@@ -263,12 +389,11 @@ void Power::shutdown()
|
|||||||
LOG_INFO("Shutting down\n");
|
LOG_INFO("Shutting down\n");
|
||||||
|
|
||||||
#ifdef HAS_PMU
|
#ifdef HAS_PMU
|
||||||
if (PMU) {
|
if (pmu_found == true) {
|
||||||
PMU->setChargingLedMode(XPOWERS_CHG_LED_OFF);
|
PMU->setChargingLedMode(XPOWERS_CHG_LED_OFF);
|
||||||
|
PMU->shutdown();
|
||||||
}
|
}
|
||||||
#endif
|
#elif defined(ARCH_NRF52) || defined(ARCH_ESP32)
|
||||||
|
|
||||||
#if defined(ARCH_NRF52) || defined(ARCH_ESP32)
|
|
||||||
#ifdef PIN_LED1
|
#ifdef PIN_LED1
|
||||||
ledOff(PIN_LED1);
|
ledOff(PIN_LED1);
|
||||||
#endif
|
#endif
|
||||||
@@ -289,7 +414,7 @@ void Power::readPowerStatus()
|
|||||||
{
|
{
|
||||||
if (batteryLevel) {
|
if (batteryLevel) {
|
||||||
bool hasBattery = batteryLevel->isBatteryConnect();
|
bool hasBattery = batteryLevel->isBatteryConnect();
|
||||||
int batteryVoltageMv = 0;
|
uint32_t batteryVoltageMv = 0;
|
||||||
int8_t batteryChargePercent = 0;
|
int8_t batteryChargePercent = 0;
|
||||||
if (hasBattery) {
|
if (hasBattery) {
|
||||||
batteryVoltageMv = batteryLevel->getBattVoltage();
|
batteryVoltageMv = batteryLevel->getBattVoltage();
|
||||||
@@ -314,7 +439,7 @@ void Power::readPowerStatus()
|
|||||||
powerStatus2.getIsCharging(), powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent());
|
powerStatus2.getIsCharging(), powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent());
|
||||||
newStatus.notifyObservers(&powerStatus2);
|
newStatus.notifyObservers(&powerStatus2);
|
||||||
#ifdef DEBUG_HEAP
|
#ifdef DEBUG_HEAP
|
||||||
if (lastheap != ESP.getFreeHeap()) {
|
if (lastheap != memGet.getFreeHeap()) {
|
||||||
LOG_DEBUG("Threads running:");
|
LOG_DEBUG("Threads running:");
|
||||||
int running = 0;
|
int running = 0;
|
||||||
for (int i = 0; i < MAX_THREADS; i++) {
|
for (int i = 0; i < MAX_THREADS; i++) {
|
||||||
@@ -325,9 +450,9 @@ void Power::readPowerStatus()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG_DEBUG("\n");
|
LOG_DEBUG("\n");
|
||||||
LOG_DEBUG("Heap status: %d/%d bytes free (%d), running %d/%d threads\n", ESP.getFreeHeap(), ESP.getHeapSize(),
|
LOG_DEBUG("Heap status: %d/%d bytes free (%d), running %d/%d threads\n", memGet.getFreeHeap(), memGet.getHeapSize(),
|
||||||
ESP.getFreeHeap() - lastheap, running, concurrency::mainController.size(false));
|
memGet.getFreeHeap() - lastheap, running, concurrency::mainController.size(false));
|
||||||
lastheap = ESP.getFreeHeap();
|
lastheap = memGet.getFreeHeap();
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_HEAP_MQTT
|
#ifdef DEBUG_HEAP_MQTT
|
||||||
if (mqtt) {
|
if (mqtt) {
|
||||||
@@ -336,41 +461,41 @@ void Power::readPowerStatus()
|
|||||||
getMacAddr(dmac); // Get our hardware ID
|
getMacAddr(dmac); // Get our hardware ID
|
||||||
char mac[18];
|
char mac[18];
|
||||||
sprintf(mac, "!%02x%02x%02x%02x", dmac[2], dmac[3], dmac[4], dmac[5]);
|
sprintf(mac, "!%02x%02x%02x%02x", dmac[2], dmac[3], dmac[4], dmac[5]);
|
||||||
auto newHeap = ESP.getFreeHeap();
|
|
||||||
std::string heapTopic = "msh/2/heap/" + std::string(mac);
|
auto newHeap = memGet.getFreeHeap();
|
||||||
|
std::string heapTopic =
|
||||||
|
(*moduleConfig.mqtt.root ? moduleConfig.mqtt.root : "msh") + std::string("/2/heap/") + std::string(mac);
|
||||||
std::string heapString = std::to_string(newHeap);
|
std::string heapString = std::to_string(newHeap);
|
||||||
mqtt->pubSub.publish(heapTopic.c_str(), heapString.c_str(), false);
|
mqtt->pubSub.publish(heapTopic.c_str(), heapString.c_str(), false);
|
||||||
// auto fragHeap = ESP.getHeapFragmentation();
|
|
||||||
auto wifiRSSI = WiFi.RSSI();
|
auto wifiRSSI = WiFi.RSSI();
|
||||||
heapTopic = "msh/2/wifi/" + std::string(mac);
|
std::string wifiTopic =
|
||||||
|
(*moduleConfig.mqtt.root ? moduleConfig.mqtt.root : "msh") + std::string("/2/wifi/") + std::string(mac);
|
||||||
std::string wifiString = std::to_string(wifiRSSI);
|
std::string wifiString = std::to_string(wifiRSSI);
|
||||||
mqtt->pubSub.publish(heapTopic.c_str(), wifiString.c_str(), false);
|
mqtt->pubSub.publish(wifiTopic.c_str(), wifiString.c_str(), false);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// If we have a battery at all and it is less than 10% full, force deep sleep if we have more than 3 low readings in a row
|
// If we have a battery at all and it is less than 10% full, force deep sleep if we have more than 10 low readings in
|
||||||
// Supect fluctuating voltage on the RAK4631 to force it to deep sleep even if battery is at 85% after only a few days
|
// a row
|
||||||
#ifdef ARCH_NRF52
|
|
||||||
if (powerStatus2.getHasBattery() && !powerStatus2.getHasUSB()) {
|
if (powerStatus2.getHasBattery() && !powerStatus2.getHasUSB()) {
|
||||||
if (batteryLevel->getBattVoltage() < MIN_BAT_MILLIVOLTS) {
|
if (batteryLevel->getBattVoltage() < MIN_BAT_MILLIVOLTS) {
|
||||||
low_voltage_counter++;
|
low_voltage_counter++;
|
||||||
LOG_DEBUG("Warning RAK4631 Low voltage counter: %d/10\n", low_voltage_counter);
|
LOG_DEBUG("Low voltage counter: %d/10\n", low_voltage_counter);
|
||||||
if (low_voltage_counter > 10) {
|
if (low_voltage_counter > 10) {
|
||||||
|
#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
|
||||||
// powerFSM.trigger(EVENT_LOW_BATTERY);
|
|
||||||
LOG_DEBUG("Low voltage detected, but not triggering deep sleep\n");
|
LOG_DEBUG("Low voltage detected, but not triggering deep sleep\n");
|
||||||
|
#else
|
||||||
|
LOG_INFO("Low voltage detected, triggering deep sleep\n");
|
||||||
|
powerFSM.trigger(EVENT_LOW_BATTERY);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
low_voltage_counter = 0;
|
low_voltage_counter = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
// If we have a battery at all and it is less than 10% full, force deep sleep
|
|
||||||
if (powerStatus2.getHasBattery() && !powerStatus2.getHasUSB() && batteryLevel->getBattVoltage() < MIN_BAT_MILLIVOLTS)
|
|
||||||
powerFSM.trigger(EVENT_LOW_BATTERY);
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
// No power sensing on this board - tell everyone else we have no idea what is happening
|
// No power sensing on this board - tell everyone else we have no idea what is happening
|
||||||
const PowerStatus powerStatus3 = PowerStatus(OptUnknown, OptUnknown, OptUnknown, -1, -1);
|
const PowerStatus powerStatus3 = PowerStatus(OptUnknown, OptUnknown, OptUnknown, -1, -1);
|
||||||
@@ -431,10 +556,10 @@ int32_t Power::runOnce()
|
|||||||
* Init the power manager chip
|
* Init the power manager chip
|
||||||
*
|
*
|
||||||
* axp192 power
|
* axp192 power
|
||||||
DCDC1 0.7-3.5V @ 1200mA max -> OLED // If you turn this off you'll lose comms to the axp192 because the OLED and the axp192
|
DCDC1 0.7-3.5V @ 1200mA max -> OLED // If you turn this off you'll lose comms to the axp192 because the OLED and the
|
||||||
share the same i2c bus, instead use ssd1306 sleep mode DCDC2 -> unused DCDC3 0.7-3.5V @ 700mA max -> ESP32 (keep this on!) LDO1
|
axp192 share the same i2c bus, instead use ssd1306 sleep mode DCDC2 -> unused DCDC3 0.7-3.5V @ 700mA max -> ESP32 (keep this
|
||||||
30mA -> charges GPS backup battery // charges the tiny J13 battery by the GPS to power the GPS ram (for a couple of days), can
|
on!) LDO1 30mA -> charges GPS backup battery // charges the tiny J13 battery by the GPS to power the GPS ram (for a couple of
|
||||||
not be turned off LDO2 200mA -> LORA LDO3 200mA -> GPS
|
days), can not be turned off LDO2 200mA -> LORA LDO3 200mA -> GPS
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
bool Power::axpChipInit()
|
bool Power::axpChipInit()
|
||||||
@@ -524,52 +649,83 @@ bool Power::axpChipInit()
|
|||||||
|
|
||||||
// Set up the charging voltage
|
// Set up the charging voltage
|
||||||
PMU->setChargeTargetVoltage(XPOWERS_AXP192_CHG_VOL_4V2);
|
PMU->setChargeTargetVoltage(XPOWERS_AXP192_CHG_VOL_4V2);
|
||||||
|
|
||||||
} else if (PMU->getChipModel() == XPOWERS_AXP2101) {
|
} else if (PMU->getChipModel() == XPOWERS_AXP2101) {
|
||||||
|
|
||||||
// t-beam s3 core
|
/*The alternative version of T-Beam 1.1 differs from T-Beam V1.1 in that it uses an AXP2101 power chip*/
|
||||||
|
if (HW_VENDOR == meshtastic_HardwareModel_TBEAM) {
|
||||||
|
// Unuse power channel
|
||||||
|
PMU->disablePowerOutput(XPOWERS_DCDC2);
|
||||||
|
PMU->disablePowerOutput(XPOWERS_DCDC3);
|
||||||
|
PMU->disablePowerOutput(XPOWERS_DCDC4);
|
||||||
|
PMU->disablePowerOutput(XPOWERS_DCDC5);
|
||||||
|
PMU->disablePowerOutput(XPOWERS_ALDO1);
|
||||||
|
PMU->disablePowerOutput(XPOWERS_ALDO4);
|
||||||
|
PMU->disablePowerOutput(XPOWERS_BLDO1);
|
||||||
|
PMU->disablePowerOutput(XPOWERS_BLDO2);
|
||||||
|
PMU->disablePowerOutput(XPOWERS_DLDO1);
|
||||||
|
PMU->disablePowerOutput(XPOWERS_DLDO2);
|
||||||
|
|
||||||
/**
|
// GNSS RTC PowerVDD 3300mV
|
||||||
* gnss module power channel
|
PMU->setPowerChannelVoltage(XPOWERS_VBACKUP, 3300);
|
||||||
* The default ALDO4 is off, you need to turn on the GNSS power first, otherwise it will be invalid during initialization
|
PMU->enablePowerOutput(XPOWERS_VBACKUP);
|
||||||
*/
|
|
||||||
PMU->setPowerChannelVoltage(XPOWERS_ALDO4, 3300);
|
|
||||||
PMU->enablePowerOutput(XPOWERS_ALDO4);
|
|
||||||
|
|
||||||
// lora radio power channel
|
// ESP32 VDD 3300mV
|
||||||
PMU->setPowerChannelVoltage(XPOWERS_ALDO3, 3300);
|
// ! No need to set, automatically open , Don't close it
|
||||||
PMU->enablePowerOutput(XPOWERS_ALDO3);
|
// PMU->setPowerChannelVoltage(XPOWERS_DCDC1, 3300);
|
||||||
|
// PMU->setProtectedChannel(XPOWERS_DCDC1);
|
||||||
|
|
||||||
// m.2 interface
|
// LoRa VDD 3300mV
|
||||||
PMU->setPowerChannelVoltage(XPOWERS_DCDC3, 3300);
|
PMU->setPowerChannelVoltage(XPOWERS_ALDO2, 3300);
|
||||||
PMU->enablePowerOutput(XPOWERS_DCDC3);
|
PMU->enablePowerOutput(XPOWERS_ALDO2);
|
||||||
|
|
||||||
/**
|
// GNSS VDD 3300mV
|
||||||
* ALDO2 cannot be turned off.
|
PMU->setPowerChannelVoltage(XPOWERS_ALDO3, 3300);
|
||||||
* It is a necessary condition for sensor communication.
|
PMU->enablePowerOutput(XPOWERS_ALDO3);
|
||||||
* It must be turned on to properly access the sensor and screen
|
} else if (HW_VENDOR == meshtastic_HardwareModel_LILYGO_TBEAM_S3_CORE) {
|
||||||
* It is also responsible for the power supply of PCF8563
|
// t-beam s3 core
|
||||||
*/
|
/**
|
||||||
PMU->setPowerChannelVoltage(XPOWERS_ALDO2, 3300);
|
* gnss module power channel
|
||||||
PMU->enablePowerOutput(XPOWERS_ALDO2);
|
* The default ALDO4 is off, you need to turn on the GNSS power first, otherwise it will be invalid during
|
||||||
|
* initialization
|
||||||
|
*/
|
||||||
|
PMU->setPowerChannelVoltage(XPOWERS_ALDO4, 3300);
|
||||||
|
PMU->enablePowerOutput(XPOWERS_ALDO4);
|
||||||
|
|
||||||
// 6-axis , magnetometer ,bme280 , oled screen power channel
|
// lora radio power channel
|
||||||
PMU->setPowerChannelVoltage(XPOWERS_ALDO1, 3300);
|
PMU->setPowerChannelVoltage(XPOWERS_ALDO3, 3300);
|
||||||
PMU->enablePowerOutput(XPOWERS_ALDO1);
|
PMU->enablePowerOutput(XPOWERS_ALDO3);
|
||||||
|
|
||||||
// sdcard power channle
|
// m.2 interface
|
||||||
PMU->setPowerChannelVoltage(XPOWERS_BLDO1, 3300);
|
PMU->setPowerChannelVoltage(XPOWERS_DCDC3, 3300);
|
||||||
PMU->enablePowerOutput(XPOWERS_BLDO1);
|
PMU->enablePowerOutput(XPOWERS_DCDC3);
|
||||||
|
|
||||||
// PMU->setPowerChannelVoltage(XPOWERS_DCDC4, 3300);
|
/**
|
||||||
// PMU->enablePowerOutput(XPOWERS_DCDC4);
|
* ALDO2 cannot be turned off.
|
||||||
|
* It is a necessary condition for sensor communication.
|
||||||
|
* It must be turned on to properly access the sensor and screen
|
||||||
|
* It is also responsible for the power supply of PCF8563
|
||||||
|
*/
|
||||||
|
PMU->setPowerChannelVoltage(XPOWERS_ALDO2, 3300);
|
||||||
|
PMU->enablePowerOutput(XPOWERS_ALDO2);
|
||||||
|
|
||||||
// not use channel
|
// 6-axis , magnetometer ,bme280 , oled screen power channel
|
||||||
PMU->disablePowerOutput(XPOWERS_DCDC2); // not elicited
|
PMU->setPowerChannelVoltage(XPOWERS_ALDO1, 3300);
|
||||||
PMU->disablePowerOutput(XPOWERS_DCDC5); // not elicited
|
PMU->enablePowerOutput(XPOWERS_ALDO1);
|
||||||
PMU->disablePowerOutput(XPOWERS_DLDO1); // Invalid power channel, it does not exist
|
|
||||||
PMU->disablePowerOutput(XPOWERS_DLDO2); // Invalid power channel, it does not exist
|
// sdcard power channle
|
||||||
PMU->disablePowerOutput(XPOWERS_VBACKUP);
|
PMU->setPowerChannelVoltage(XPOWERS_BLDO1, 3300);
|
||||||
|
PMU->enablePowerOutput(XPOWERS_BLDO1);
|
||||||
|
|
||||||
|
// PMU->setPowerChannelVoltage(XPOWERS_DCDC4, 3300);
|
||||||
|
// PMU->enablePowerOutput(XPOWERS_DCDC4);
|
||||||
|
|
||||||
|
// not use channel
|
||||||
|
PMU->disablePowerOutput(XPOWERS_DCDC2); // not elicited
|
||||||
|
PMU->disablePowerOutput(XPOWERS_DCDC5); // not elicited
|
||||||
|
PMU->disablePowerOutput(XPOWERS_DLDO1); // Invalid power channel, it does not exist
|
||||||
|
PMU->disablePowerOutput(XPOWERS_DLDO2); // Invalid power channel, it does not exist
|
||||||
|
PMU->disablePowerOutput(XPOWERS_VBACKUP);
|
||||||
|
}
|
||||||
|
|
||||||
// disable all axp chip interrupt
|
// disable all axp chip interrupt
|
||||||
PMU->disableIRQ(XPOWERS_AXP2101_ALL_IRQ);
|
PMU->disableIRQ(XPOWERS_AXP2101_ALL_IRQ);
|
||||||
@@ -683,4 +839,4 @@ bool Power::axpChipInit()
|
|||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -26,13 +26,16 @@ static bool isPowered()
|
|||||||
1) If we're powered up and there's no battery, we must be getting power externally. (because we'd be dead otherwise)
|
1) If we're powered up and there's no battery, we must be getting power externally. (because we'd be dead otherwise)
|
||||||
|
|
||||||
2) If we detect USB power from the power management chip, we must be getting power externally.
|
2) If we detect USB power from the power management chip, we must be getting power externally.
|
||||||
|
|
||||||
|
3) On some boards we don't have the power management chip (like AXPxxxx) so we use EXT_PWR_DETECT GPIO pin to detect
|
||||||
|
external power source (see `isVbusIn()` in `Power.cpp`)
|
||||||
*/
|
*/
|
||||||
return !isPowerSavingMode && powerStatus && (!powerStatus->getHasBattery() || powerStatus->getHasUSB());
|
return !isPowerSavingMode && powerStatus && (!powerStatus->getHasBattery() || powerStatus->getHasUSB());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sdsEnter()
|
static void sdsEnter()
|
||||||
{
|
{
|
||||||
LOG_INFO("Enter state: SDS\n");
|
LOG_DEBUG("Enter state: SDS\n");
|
||||||
// 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(getConfiguredOrDefaultMs(config.power.sds_secs));
|
doDeepSleep(getConfiguredOrDefaultMs(config.power.sds_secs));
|
||||||
}
|
}
|
||||||
@@ -41,7 +44,7 @@ extern Power *power;
|
|||||||
|
|
||||||
static void shutdownEnter()
|
static void shutdownEnter()
|
||||||
{
|
{
|
||||||
LOG_INFO("Enter state: SHUTDOWN\n");
|
LOG_DEBUG("Enter state: SHUTDOWN\n");
|
||||||
power->shutdown();
|
power->shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,11 +69,11 @@ static void lsIdle()
|
|||||||
|
|
||||||
// Do we have more sleeping to do?
|
// Do we have more sleeping to do?
|
||||||
if (secsSlept < config.power.ls_secs) {
|
if (secsSlept < config.power.ls_secs) {
|
||||||
// Briefly come out of sleep long enough to blink the led once every few seconds
|
|
||||||
uint32_t sleepTime = 30;
|
|
||||||
|
|
||||||
// If some other service would stall sleep, don't let sleep happen yet
|
// If some other service would stall sleep, don't let sleep happen yet
|
||||||
if (doPreflightSleep()) {
|
if (doPreflightSleep()) {
|
||||||
|
// Briefly come out of sleep long enough to blink the led once every few seconds
|
||||||
|
uint32_t sleepTime = 30;
|
||||||
|
|
||||||
setLed(false); // Never leave led on while in light sleep
|
setLed(false); // Never leave led on while in light sleep
|
||||||
esp_sleep_source_t wakeCause2 = doLightSleep(sleepTime * 1000LL);
|
esp_sleep_source_t wakeCause2 = doLightSleep(sleepTime * 1000LL);
|
||||||
|
|
||||||
@@ -96,12 +99,11 @@ static void lsIdle()
|
|||||||
LOG_INFO("wakeCause2 %d\n", wakeCause2);
|
LOG_INFO("wakeCause2 %d\n", wakeCause2);
|
||||||
|
|
||||||
#ifdef BUTTON_PIN
|
#ifdef BUTTON_PIN
|
||||||
bool pressed = !digitalRead(BUTTON_PIN);
|
bool pressed = !digitalRead(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN);
|
||||||
#else
|
#else
|
||||||
bool pressed = false;
|
bool pressed = false;
|
||||||
#endif
|
#endif
|
||||||
if (pressed) // If we woke because of press, instead generate a PRESS event.
|
if (pressed) { // If we woke because of press, instead generate a PRESS event.
|
||||||
{
|
|
||||||
powerFSM.trigger(EVENT_PRESS);
|
powerFSM.trigger(EVENT_PRESS);
|
||||||
} else {
|
} else {
|
||||||
// Otherwise let the NB state handle the IRQ (and that state will handle stuff like IRQs etc)
|
// Otherwise let the NB state handle the IRQ (and that state will handle stuff like IRQs etc)
|
||||||
@@ -133,7 +135,7 @@ static void lsExit()
|
|||||||
|
|
||||||
static void nbEnter()
|
static void nbEnter()
|
||||||
{
|
{
|
||||||
LOG_INFO("Enter state: NB\n");
|
LOG_DEBUG("Enter state: NB\n");
|
||||||
screen->setOn(false);
|
screen->setOn(false);
|
||||||
setBluetoothEnable(false);
|
setBluetoothEnable(false);
|
||||||
|
|
||||||
@@ -148,7 +150,7 @@ static void darkEnter()
|
|||||||
|
|
||||||
static void serialEnter()
|
static void serialEnter()
|
||||||
{
|
{
|
||||||
LOG_INFO("Enter state: SERIAL\n");
|
LOG_DEBUG("Enter state: SERIAL\n");
|
||||||
setBluetoothEnable(false);
|
setBluetoothEnable(false);
|
||||||
screen->setOn(true);
|
screen->setOn(true);
|
||||||
screen->print("Serial connected\n");
|
screen->print("Serial connected\n");
|
||||||
@@ -161,7 +163,7 @@ static void serialExit()
|
|||||||
|
|
||||||
static void powerEnter()
|
static void powerEnter()
|
||||||
{
|
{
|
||||||
LOG_INFO("Enter state: POWER\n");
|
LOG_DEBUG("Enter state: POWER\n");
|
||||||
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\n");
|
||||||
@@ -169,7 +171,11 @@ static void powerEnter()
|
|||||||
} else {
|
} else {
|
||||||
screen->setOn(true);
|
screen->setOn(true);
|
||||||
setBluetoothEnable(true);
|
setBluetoothEnable(true);
|
||||||
screen->print("Powered...\n");
|
// within enter() the function getState() returns the state we came from
|
||||||
|
if (strcmp(powerFSM.getState()->name, "BOOT") != 0 && strcmp(powerFSM.getState()->name, "POWER") != 0 &&
|
||||||
|
strcmp(powerFSM.getState()->name, "DARK") != 0) {
|
||||||
|
screen->print("Powered...\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,25 +192,15 @@ static void powerExit()
|
|||||||
{
|
{
|
||||||
screen->setOn(true);
|
screen->setOn(true);
|
||||||
setBluetoothEnable(true);
|
setBluetoothEnable(true);
|
||||||
screen->print("Unpowered...\n");
|
if (!isPowered())
|
||||||
|
screen->print("Unpowered...\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void onEnter()
|
static void onEnter()
|
||||||
{
|
{
|
||||||
LOG_INFO("Enter state: ON\n");
|
LOG_DEBUG("Enter state: ON\n");
|
||||||
screen->setOn(true);
|
screen->setOn(true);
|
||||||
setBluetoothEnable(true);
|
setBluetoothEnable(true);
|
||||||
|
|
||||||
static uint32_t lastPingMs;
|
|
||||||
|
|
||||||
uint32_t now = millis();
|
|
||||||
|
|
||||||
if ((now - lastPingMs) >
|
|
||||||
30 * 1000) { // if more than a minute since our last press, ask node we are looking at to update their state
|
|
||||||
if (displayedNodeNum)
|
|
||||||
service.sendNetworkPing(displayedNodeNum, true); // Refresh the currently displayed node
|
|
||||||
lastPingMs = now;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void onIdle()
|
static void onIdle()
|
||||||
@@ -222,7 +218,7 @@ static void screenPress()
|
|||||||
|
|
||||||
static void bootEnter()
|
static void bootEnter()
|
||||||
{
|
{
|
||||||
LOG_INFO("Enter state: BOOT\n");
|
LOG_DEBUG("Enter state: BOOT\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
State stateSHUTDOWN(shutdownEnter, NULL, NULL, "SHUTDOWN");
|
State stateSHUTDOWN(shutdownEnter, NULL, NULL, "SHUTDOWN");
|
||||||
@@ -257,7 +253,7 @@ void PowerFSM_setup()
|
|||||||
// Handle press events - note: we ignore button presses when in API mode
|
// Handle press events - note: we ignore button presses when in API mode
|
||||||
powerFSM.add_transition(&stateLS, &stateON, EVENT_PRESS, NULL, "Press");
|
powerFSM.add_transition(&stateLS, &stateON, EVENT_PRESS, NULL, "Press");
|
||||||
powerFSM.add_transition(&stateNB, &stateON, EVENT_PRESS, NULL, "Press");
|
powerFSM.add_transition(&stateNB, &stateON, EVENT_PRESS, NULL, "Press");
|
||||||
powerFSM.add_transition(&stateDARK, &stateON, EVENT_PRESS, NULL, "Press");
|
powerFSM.add_transition(&stateDARK, isPowered() ? &statePOWER : &stateON, EVENT_PRESS, NULL, "Press");
|
||||||
powerFSM.add_transition(&statePOWER, &statePOWER, EVENT_PRESS, screenPress, "Press");
|
powerFSM.add_transition(&statePOWER, &statePOWER, EVENT_PRESS, screenPress, "Press");
|
||||||
powerFSM.add_transition(&stateON, &stateON, EVENT_PRESS, screenPress, "Press"); // reenter On to restart our timers
|
powerFSM.add_transition(&stateON, &stateON, EVENT_PRESS, screenPress, "Press"); // reenter On to restart our timers
|
||||||
powerFSM.add_transition(&stateSERIAL, &stateSERIAL, EVENT_PRESS, screenPress,
|
powerFSM.add_transition(&stateSERIAL, &stateSERIAL, EVENT_PRESS, screenPress,
|
||||||
@@ -299,10 +295,10 @@ void PowerFSM_setup()
|
|||||||
powerFSM.add_transition(&stateON, &stateON, EVENT_NODEDB_UPDATED, NULL, "NodeDB update");
|
powerFSM.add_transition(&stateON, &stateON, EVENT_NODEDB_UPDATED, NULL, "NodeDB update");
|
||||||
|
|
||||||
// Show the received text message
|
// Show the received text message
|
||||||
powerFSM.add_transition(&stateLS, &stateON, EVENT_RECEIVED_TEXT_MSG, NULL, "Received text");
|
powerFSM.add_transition(&stateLS, &stateON, EVENT_RECEIVED_MSG, NULL, "Received text");
|
||||||
powerFSM.add_transition(&stateNB, &stateON, EVENT_RECEIVED_TEXT_MSG, NULL, "Received text");
|
powerFSM.add_transition(&stateNB, &stateON, EVENT_RECEIVED_MSG, NULL, "Received text");
|
||||||
powerFSM.add_transition(&stateDARK, &stateON, EVENT_RECEIVED_TEXT_MSG, NULL, "Received text");
|
powerFSM.add_transition(&stateDARK, &stateON, EVENT_RECEIVED_MSG, NULL, "Received text");
|
||||||
powerFSM.add_transition(&stateON, &stateON, EVENT_RECEIVED_TEXT_MSG, NULL, "Received text"); // restarts the sleep timer
|
powerFSM.add_transition(&stateON, &stateON, EVENT_RECEIVED_MSG, NULL, "Received text"); // restarts the sleep timer
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are not in statePOWER but get a serial connection, suppress sleep (and keep the screen on) while connected
|
// If we are not in statePOWER but get a serial connection, suppress sleep (and keep the screen on) while connected
|
||||||
@@ -330,6 +326,12 @@ void PowerFSM_setup()
|
|||||||
powerFSM.add_timed_transition(&stateON, &stateDARK,
|
powerFSM.add_timed_transition(&stateON, &stateDARK,
|
||||||
getConfiguredOrDefaultMs(config.display.screen_on_secs, default_screen_on_secs), NULL,
|
getConfiguredOrDefaultMs(config.display.screen_on_secs, default_screen_on_secs), NULL,
|
||||||
"Screen-on timeout");
|
"Screen-on timeout");
|
||||||
|
powerFSM.add_timed_transition(&statePOWER, &stateDARK,
|
||||||
|
getConfiguredOrDefaultMs(config.display.screen_on_secs, default_screen_on_secs), NULL,
|
||||||
|
"Screen-on timeout");
|
||||||
|
powerFSM.add_timed_transition(&stateDARK, &stateDARK,
|
||||||
|
getConfiguredOrDefaultMs(config.display.screen_on_secs, default_screen_on_secs), NULL,
|
||||||
|
"Screen-on timeout");
|
||||||
|
|
||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32
|
||||||
State *lowPowerState = &stateLS;
|
State *lowPowerState = &stateLS;
|
||||||
@@ -351,4 +353,4 @@ void PowerFSM_setup()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
powerFSM.run_machine(); // run one interation of the state machine, so we run our on enter tasks for the initial DARK state
|
powerFSM.run_machine(); // run one interation of the state machine, so we run our on enter tasks for the initial DARK state
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
#define EVENT_WAKE_TIMER 2
|
#define EVENT_WAKE_TIMER 2
|
||||||
// #define EVENT_RECEIVED_PACKET 3
|
// #define EVENT_RECEIVED_PACKET 3
|
||||||
#define EVENT_PACKET_FOR_PHONE 4
|
#define EVENT_PACKET_FOR_PHONE 4
|
||||||
#define EVENT_RECEIVED_TEXT_MSG 5
|
#define EVENT_RECEIVED_MSG 5
|
||||||
// #define EVENT_BOOT 6 // now done with a timed transition
|
// #define EVENT_BOOT 6 // now done with a timed transition
|
||||||
#define EVENT_BLUETOOTH_PAIR 7
|
#define EVENT_BLUETOOTH_PAIR 7
|
||||||
#define EVENT_NODEDB_UPDATED 8 // NodeDB has a big enough change that we think you should turn on the screen
|
#define EVENT_NODEDB_UPDATED 8 // NodeDB has a big enough change that we think you should turn on the screen
|
||||||
|
|||||||
@@ -62,6 +62,9 @@ size_t RedirectablePrint::vprintf(const char *format, va_list arg)
|
|||||||
|
|
||||||
size_t RedirectablePrint::log(const char *logLevel, const char *format, ...)
|
size_t RedirectablePrint::log(const char *logLevel, const char *format, ...)
|
||||||
{
|
{
|
||||||
|
if (moduleConfig.serial.override_console_serial_port && strcmp(logLevel, "DEBUG") == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
size_t r = 0;
|
size_t r = 0;
|
||||||
|
|
||||||
if (!inDebugPrint) {
|
if (!inDebugPrint) {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ SerialConsole::SerialConsole() : StreamAPI(&Port), RedirectablePrint(&Port), con
|
|||||||
// setDestination(&noopPrint); for testing, try turning off 'all' debug output and see what leaks
|
// setDestination(&noopPrint); for testing, try turning off 'all' debug output and see what leaks
|
||||||
|
|
||||||
Port.begin(SERIAL_BAUD);
|
Port.begin(SERIAL_BAUD);
|
||||||
#if defined(ARCH_NRF52) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3)
|
#if defined(ARCH_NRF52) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(ARCH_RP2040)
|
||||||
time_t timeout = millis();
|
time_t timeout = millis();
|
||||||
while (!Port) {
|
while (!Port) {
|
||||||
if ((millis() - timeout) < 5000) {
|
if ((millis() - timeout) < 5000) {
|
||||||
|
|||||||
@@ -31,12 +31,14 @@ IRAM_ATTR bool NotifiedWorkerThread::notifyCommon(uint32_t v, bool overwrite)
|
|||||||
runASAP = true;
|
runASAP = true;
|
||||||
|
|
||||||
notification = v;
|
notification = v;
|
||||||
if (debugNotification)
|
if (debugNotification) {
|
||||||
LOG_DEBUG("setting notification %d\n", v);
|
LOG_DEBUG("setting notification %d\n", v);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (debugNotification)
|
if (debugNotification) {
|
||||||
LOG_DEBUG("dropping notification %d\n", v);
|
LOG_DEBUG("dropping notification %d\n", v);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -64,8 +66,9 @@ 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\n", delay);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return didIt;
|
return didIt;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "OSThread.h"
|
#include "OSThread.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
#include "memGet.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
namespace concurrency
|
namespace concurrency
|
||||||
@@ -60,14 +61,17 @@ 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\n", 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\n", ThreadName.c_str(), interval);
|
||||||
|
}
|
||||||
|
|
||||||
if (showDisabled && !enabled)
|
if (showDisabled && !enabled) {
|
||||||
LOG_DEBUG("Thread %s: disabled\n", ThreadName.c_str());
|
LOG_DEBUG("Thread %s: disabled\n", ThreadName.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@@ -75,12 +79,12 @@ bool OSThread::shouldRun(unsigned long time)
|
|||||||
void OSThread::run()
|
void OSThread::run()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_HEAP
|
#ifdef DEBUG_HEAP
|
||||||
auto heap = ESP.getFreeHeap();
|
auto heap = memGet.getFreeHeap();
|
||||||
#endif
|
#endif
|
||||||
currentThread = this;
|
currentThread = this;
|
||||||
auto newDelay = runOnce();
|
auto newDelay = runOnce();
|
||||||
#ifdef DEBUG_HEAP
|
#ifdef DEBUG_HEAP
|
||||||
auto newHeap = ESP.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) ------\n", ThreadName.c_str(), heap, newHeap, newHeap - heap);
|
||||||
if (heap < newHeap)
|
if (heap < newHeap)
|
||||||
|
|||||||
@@ -124,6 +124,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define MPU6050_ADDR 0x68
|
#define MPU6050_ADDR 0x68
|
||||||
#define LIS3DH_ADR 0x18
|
#define LIS3DH_ADR 0x18
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// LED
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
#define NCP5623_ADDR 0x38
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Security
|
// Security
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class ScanI2C
|
|||||||
PMSA0031,
|
PMSA0031,
|
||||||
MPU6050,
|
MPU6050,
|
||||||
LIS3DH,
|
LIS3DH,
|
||||||
|
NCP5623,
|
||||||
} DeviceType;
|
} DeviceType;
|
||||||
|
|
||||||
// typedef uint8_t DeviceAddress;
|
// typedef uint8_t DeviceAddress;
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
SCAN_SIMPLE_CASE(ST7567_ADDRESS, SCREEN_ST7567, "st7567 display found\n")
|
SCAN_SIMPLE_CASE(ST7567_ADDRESS, SCREEN_ST7567, "st7567 display found\n")
|
||||||
|
SCAN_SIMPLE_CASE(NCP5623_ADDR, NCP5623, "NCP5623 RGB LED found\n");
|
||||||
|
|
||||||
#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\n")
|
||||||
@@ -290,7 +291,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port)
|
|||||||
|
|
||||||
TwoWire *ScanI2CTwoWire::fetchI2CBus(ScanI2C::DeviceAddress address) const
|
TwoWire *ScanI2CTwoWire::fetchI2CBus(ScanI2C::DeviceAddress address) const
|
||||||
{
|
{
|
||||||
if (address.port == ScanI2C::I2CPort::WIRE1) {
|
if (address.port == ScanI2C::I2CPort::WIRE) {
|
||||||
return &Wire;
|
return &Wire;
|
||||||
} else {
|
} else {
|
||||||
#ifdef I2C_SDA1
|
#ifdef I2C_SDA1
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#include <freertos/task.h>
|
#include <freertos/task.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ARDUINO_NRF52_ADAFRUIT)
|
#if defined(ARDUINO_NRF52_ADAFRUIT) || defined(ARDUINO_ARCH_STM32)
|
||||||
#define HAS_FREE_RTOS
|
#define HAS_FREE_RTOS
|
||||||
|
|
||||||
#include <FreeRTOS.h>
|
#include <FreeRTOS.h>
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#include "NMEAWPL.h"
|
#include "NMEAWPL.h"
|
||||||
#include "GeoCoord.h"
|
#include "GeoCoord.h"
|
||||||
|
#include "RTC.h"
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
/* -------------------------------------------
|
/* -------------------------------------------
|
||||||
* 1 2 3 4 5 6
|
* 1 2 3 4 5 6
|
||||||
@@ -16,10 +18,11 @@
|
|||||||
* -------------------------------------------
|
* -------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uint32_t printWPL(char *buf, size_t bufsz, const meshtastic_Position &pos, const char *name)
|
uint32_t printWPL(char *buf, size_t bufsz, const meshtastic_Position &pos, const char *name, bool isCaltopoMode)
|
||||||
{
|
{
|
||||||
GeoCoord geoCoord(pos.latitude_i, pos.longitude_i, pos.altitude);
|
GeoCoord geoCoord(pos.latitude_i, pos.longitude_i, pos.altitude);
|
||||||
uint32_t len = snprintf(buf, bufsz, "$GNWPL,%02d%07.4f,%c,%03d%07.4f,%c,%s", geoCoord.getDMSLatDeg(),
|
char type = isCaltopoMode ? 'P' : 'N';
|
||||||
|
uint32_t len = snprintf(buf, bufsz, "$G%cWPL,%02d%07.4f,%c,%03d%07.4f,%c,%s", type, geoCoord.getDMSLatDeg(),
|
||||||
(abs(geoCoord.getLatitude()) - geoCoord.getDMSLatDeg() * 1e+7) * 6e-6, geoCoord.getDMSLatCP(),
|
(abs(geoCoord.getLatitude()) - geoCoord.getDMSLatDeg() * 1e+7) * 6e-6, geoCoord.getDMSLatCP(),
|
||||||
geoCoord.getDMSLonDeg(), (abs(geoCoord.getLongitude()) - geoCoord.getDMSLonDeg() * 1e+7) * 6e-6,
|
geoCoord.getDMSLonDeg(), (abs(geoCoord.getLongitude()) - geoCoord.getDMSLonDeg() * 1e+7) * 6e-6,
|
||||||
geoCoord.getDMSLonCP(), name);
|
geoCoord.getDMSLonCP(), name);
|
||||||
@@ -56,12 +59,18 @@ 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);
|
||||||
uint32_t len =
|
tm *t = localtime((time_t *)&pos.timestamp);
|
||||||
snprintf(buf, bufsz, "$GNGGA,%06u.%03u,%02d%07.4f,%c,%03d%07.4f,%c,%u,%02u,%04u,%04d,%c,%04d,%c,%d,%04d", pos.time / 1000,
|
if (getRTCQuality() > 0) { // use the device clock if we got time from somewhere. If not, use the GPS timestamp.
|
||||||
pos.time % 1000, geoCoord.getDMSLatDeg(), (abs(geoCoord.getLatitude()) - geoCoord.getDMSLatDeg() * 1e+7) * 6e-6,
|
uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice);
|
||||||
geoCoord.getDMSLatCP(), geoCoord.getDMSLonDeg(),
|
t = localtime((time_t *)&rtc_sec);
|
||||||
(abs(geoCoord.getLongitude()) - geoCoord.getDMSLonDeg() * 1e+7) * 6e-6, geoCoord.getDMSLonCP(), pos.fix_type,
|
}
|
||||||
pos.sats_in_view, pos.HDOP, geoCoord.getAltitude(), 'M', pos.altitude_geoidal_separation, 'M', 0, 0);
|
|
||||||
|
uint32_t len = snprintf(
|
||||||
|
buf, bufsz, "$GNGGA,%02d%02d%02d.%02d,%02d%07.4f,%c,%03d%07.4f,%c,%u,%02u,%04u,%04d,%c,%04d,%c,%d,%04d", t->tm_hour,
|
||||||
|
t->tm_min, t->tm_sec, pos.timestamp_millis_adjust, geoCoord.getDMSLatDeg(),
|
||||||
|
(abs(geoCoord.getLatitude()) - geoCoord.getDMSLatDeg() * 1e+7) * 6e-6, geoCoord.getDMSLatCP(), geoCoord.getDMSLonDeg(),
|
||||||
|
(abs(geoCoord.getLongitude()) - geoCoord.getDMSLonDeg() * 1e+7) * 6e-6, geoCoord.getDMSLonCP(), pos.fix_quality,
|
||||||
|
pos.sats_in_view, pos.HDOP, geoCoord.getAltitude(), 'M', pos.altitude_geoidal_separation, 'M', 0, 0);
|
||||||
|
|
||||||
uint32_t chk = 0;
|
uint32_t chk = 0;
|
||||||
for (uint32_t i = 1; i < len; i++) {
|
for (uint32_t i = 1; i < len; i++) {
|
||||||
|
|||||||
@@ -3,5 +3,5 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
uint32_t printWPL(char *buf, size_t bufsz, const meshtastic_Position &pos, const char *name);
|
uint32_t printWPL(char *buf, size_t bufsz, const meshtastic_Position &pos, const char *name, bool isCaltopoMode = false);
|
||||||
uint32_t printGGA(char *buf, size_t bufsz, const meshtastic_Position &pos);
|
uint32_t printGGA(char *buf, size_t bufsz, const meshtastic_Position &pos);
|
||||||
|
|||||||
@@ -27,6 +27,10 @@
|
|||||||
// 1.54 inch 200x200 - GxEPD2_154_M09
|
// 1.54 inch 200x200 - GxEPD2_154_M09
|
||||||
//#define TECHO_DISPLAY_MODEL GxEPD2_154_M09
|
//#define TECHO_DISPLAY_MODEL GxEPD2_154_M09
|
||||||
|
|
||||||
|
#elif defined(MAKERPYTHON)
|
||||||
|
// 2.9 inch 296x128 - GxEPD2_290_T5D
|
||||||
|
#define TECHO_DISPLAY_MODEL GxEPD2_290_T5D
|
||||||
|
|
||||||
#elif defined(PCA10059)
|
#elif defined(PCA10059)
|
||||||
|
|
||||||
// 4.2 inch 300x400 - GxEPD2_420_M01
|
// 4.2 inch 300x400 - GxEPD2_420_M01
|
||||||
@@ -58,6 +62,9 @@ EInkDisplay::EInkDisplay(uint8_t address, int sda, int scl, OLEDDISPLAY_GEOMETRY
|
|||||||
|
|
||||||
// GxEPD2_154_M09
|
// GxEPD2_154_M09
|
||||||
// setGeometry(GEOMETRY_RAWMODE, 200, 200);
|
// setGeometry(GEOMETRY_RAWMODE, 200, 200);
|
||||||
|
#elif defined(MAKERPYTHON)
|
||||||
|
// GxEPD2_290_T5D
|
||||||
|
setGeometry(GEOMETRY_RAWMODE, 296, 128);
|
||||||
|
|
||||||
#elif defined(PCA10059)
|
#elif defined(PCA10059)
|
||||||
|
|
||||||
@@ -69,6 +76,11 @@ EInkDisplay::EInkDisplay(uint8_t address, int sda, int scl, OLEDDISPLAY_GEOMETRY
|
|||||||
// M5Stack_CoreInk 200x200
|
// M5Stack_CoreInk 200x200
|
||||||
// 1.54 inch 200x200 - GxEPD2_154_M09
|
// 1.54 inch 200x200 - GxEPD2_154_M09
|
||||||
setGeometry(GEOMETRY_RAWMODE, EPD_HEIGHT, EPD_WIDTH);
|
setGeometry(GEOMETRY_RAWMODE, EPD_HEIGHT, EPD_WIDTH);
|
||||||
|
#elif defined(my)
|
||||||
|
|
||||||
|
// GxEPD2_290_T5D
|
||||||
|
setGeometry(GEOMETRY_RAWMODE, 296, 128);
|
||||||
|
LOG_DEBUG("GEOMETRY_RAWMODE, 296, 128\n");
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// setGeometry(GEOMETRY_RAWMODE, 128, 64); // old resolution
|
// setGeometry(GEOMETRY_RAWMODE, 128, 64); // old resolution
|
||||||
@@ -109,7 +121,7 @@ bool EInkDisplay::forceDisplay(uint32_t msecLimit)
|
|||||||
#if defined(TTGO_T_ECHO)
|
#if defined(TTGO_T_ECHO)
|
||||||
// ePaper.Reset(); // wake the screen from sleep
|
// ePaper.Reset(); // wake the screen from sleep
|
||||||
adafruitDisplay->display(false); // FIXME, use partial update mode
|
adafruitDisplay->display(false); // FIXME, use partial update mode
|
||||||
#elif defined(RAK4630)
|
#elif defined(RAK4630) || defined(MAKERPYTHON)
|
||||||
|
|
||||||
// RAK14000 2.13 inch b/w 250x122 actually now does support partial updates
|
// RAK14000 2.13 inch b/w 250x122 actually now does support partial updates
|
||||||
|
|
||||||
@@ -125,6 +137,10 @@ bool EInkDisplay::forceDisplay(uint32_t msecLimit)
|
|||||||
|
|
||||||
#elif defined(PCA10059) || defined(M5_COREINK)
|
#elif defined(PCA10059) || defined(M5_COREINK)
|
||||||
adafruitDisplay->nextPage();
|
adafruitDisplay->nextPage();
|
||||||
|
|
||||||
|
#elif defined(PRIVATE_HW) || defined(my)
|
||||||
|
adafruitDisplay->nextPage();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Put screen to sleep to save power (possibly not necessary because we already did poweroff inside of display)
|
// Put screen to sleep to save power (possibly not necessary because we already did poweroff inside of display)
|
||||||
@@ -184,7 +200,7 @@ bool EInkDisplay::connect()
|
|||||||
adafruitDisplay->init();
|
adafruitDisplay->init();
|
||||||
adafruitDisplay->setRotation(3);
|
adafruitDisplay->setRotation(3);
|
||||||
}
|
}
|
||||||
#elif defined(RAK4630)
|
#elif defined(RAK4630) || defined(MAKERPYTHON)
|
||||||
{
|
{
|
||||||
if (eink_found) {
|
if (eink_found) {
|
||||||
auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY);
|
auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY);
|
||||||
@@ -216,6 +232,14 @@ bool EInkDisplay::connect()
|
|||||||
adafruitDisplay->init(115200, true, 40, false, SPI, SPISettings(4000000, MSBFIRST, SPI_MODE0));
|
adafruitDisplay->init(115200, true, 40, false, SPI, SPISettings(4000000, MSBFIRST, SPI_MODE0));
|
||||||
adafruitDisplay->setRotation(0);
|
adafruitDisplay->setRotation(0);
|
||||||
adafruitDisplay->setPartialWindow(0, 0, EPD_WIDTH, EPD_HEIGHT);
|
adafruitDisplay->setPartialWindow(0, 0, EPD_WIDTH, EPD_HEIGHT);
|
||||||
|
#elif defined(my)
|
||||||
|
{
|
||||||
|
auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY);
|
||||||
|
adafruitDisplay = new GxEPD2_BW<TECHO_DISPLAY_MODEL, TECHO_DISPLAY_MODEL::HEIGHT>(*lowLevel);
|
||||||
|
adafruitDisplay->init(115200, true, 40, false, SPI, SPISettings(4000000, MSBFIRST, SPI_MODE0));
|
||||||
|
adafruitDisplay->setRotation(1);
|
||||||
|
adafruitDisplay->setPartialWindow(0, 0, EPD_WIDTH, EPD_HEIGHT);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// adafruitDisplay->setFullWindow();
|
// adafruitDisplay->setFullWindow();
|
||||||
|
|||||||
@@ -348,8 +348,6 @@ static void drawFrameFirmware(OLEDDisplay *display, OLEDDisplayUiState *state, i
|
|||||||
/// Draw the last text message we received
|
/// Draw the last text message we received
|
||||||
static void drawCriticalFaultFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
static void drawCriticalFaultFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||||
{
|
{
|
||||||
displayedNodeNum = 0; // Not currently showing a node pane
|
|
||||||
|
|
||||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
display->setFont(FONT_MEDIUM);
|
display->setFont(FONT_MEDIUM);
|
||||||
|
|
||||||
@@ -370,8 +368,6 @@ static bool shouldDrawMessage(const meshtastic_MeshPacket *packet)
|
|||||||
/// Draw the last text message we received
|
/// Draw the last text message we received
|
||||||
static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||||
{
|
{
|
||||||
displayedNodeNum = 0; // Not currently showing a node pane
|
|
||||||
|
|
||||||
// the max length of this buffer is much longer than we can possibly print
|
// the max length of this buffer is much longer than we can possibly print
|
||||||
static char tempBuf[237];
|
static char tempBuf[237];
|
||||||
|
|
||||||
@@ -408,6 +404,43 @@ static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state
|
|||||||
display->drawStringMaxWidth(0 + x, 0 + y + FONT_HEIGHT_SMALL, x + display->getWidth(), tempBuf);
|
display->drawStringMaxWidth(0 + x, 0 + y + FONT_HEIGHT_SMALL, x + display->getWidth(), tempBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Draw the last waypoint we received
|
||||||
|
static void drawWaypointFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||||
|
{
|
||||||
|
static char tempBuf[237];
|
||||||
|
|
||||||
|
meshtastic_MeshPacket &mp = devicestate.rx_waypoint;
|
||||||
|
meshtastic_NodeInfo *node = nodeDB.getNode(getFrom(&mp));
|
||||||
|
|
||||||
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
|
display->setFont(FONT_SMALL);
|
||||||
|
if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_INVERTED) {
|
||||||
|
display->fillRect(0 + x, 0 + y, x + display->getWidth(), y + FONT_HEIGHT_SMALL);
|
||||||
|
display->setColor(BLACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t seconds = sinceReceived(&mp);
|
||||||
|
uint32_t minutes = seconds / 60;
|
||||||
|
uint32_t hours = minutes / 60;
|
||||||
|
uint32_t days = hours / 24;
|
||||||
|
|
||||||
|
if (config.display.heading_bold) {
|
||||||
|
display->drawStringf(1 + x, 0 + y, tempBuf, "%s ago from %s",
|
||||||
|
screen->drawTimeDelta(days, hours, minutes, seconds).c_str(),
|
||||||
|
(node && node->has_user) ? node->user.short_name : "???");
|
||||||
|
}
|
||||||
|
display->drawStringf(0 + x, 0 + y, tempBuf, "%s ago from %s", screen->drawTimeDelta(days, hours, minutes, seconds).c_str(),
|
||||||
|
(node && node->has_user) ? node->user.short_name : "???");
|
||||||
|
|
||||||
|
display->setColor(WHITE);
|
||||||
|
meshtastic_Waypoint scratch;
|
||||||
|
memset(&scratch, 0, sizeof(scratch));
|
||||||
|
if (pb_decode_from_bytes(mp.decoded.payload.bytes, mp.decoded.payload.size, &meshtastic_Waypoint_msg, &scratch)) {
|
||||||
|
snprintf(tempBuf, sizeof(tempBuf), "Received waypoint: %s", scratch.name);
|
||||||
|
display->drawStringMaxWidth(0 + x, 0 + y + FONT_HEIGHT_SMALL, x + display->getWidth(), tempBuf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Draw a series of fields in a column, wrapping to multiple colums if needed
|
/// Draw a series of fields in a column, wrapping to multiple colums if needed
|
||||||
static void drawColumns(OLEDDisplay *display, int16_t x, int16_t y, const char **fields)
|
static void drawColumns(OLEDDisplay *display, int16_t x, int16_t y, const char **fields)
|
||||||
{
|
{
|
||||||
@@ -678,13 +711,6 @@ static float estimatedHeading(double lat, double lon)
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sometimes we will have Position objects that only have a time, so check for
|
|
||||||
/// valid lat/lon
|
|
||||||
static bool hasPosition(meshtastic_NodeInfo *n)
|
|
||||||
{
|
|
||||||
return n->has_position && (n->position.latitude_i != 0 || n->position.longitude_i != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint16_t getCompassDiam(OLEDDisplay *display)
|
static uint16_t getCompassDiam(OLEDDisplay *display)
|
||||||
{
|
{
|
||||||
uint16_t diam = 0;
|
uint16_t diam = 0;
|
||||||
@@ -773,7 +799,6 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
|
|||||||
nodeIndex = (nodeIndex + 1) % nodeDB.getNumNodes();
|
nodeIndex = (nodeIndex + 1) % nodeDB.getNumNodes();
|
||||||
n = nodeDB.getNodeByIndex(nodeIndex);
|
n = nodeDB.getNodeByIndex(nodeIndex);
|
||||||
}
|
}
|
||||||
displayedNodeNum = n->num;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
meshtastic_NodeInfo *node = nodeDB.getNodeByIndex(nodeIndex);
|
meshtastic_NodeInfo *node = nodeDB.getNodeByIndex(nodeIndex);
|
||||||
@@ -824,12 +849,12 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
|
|||||||
}
|
}
|
||||||
bool hasNodeHeading = false;
|
bool hasNodeHeading = false;
|
||||||
|
|
||||||
if (ourNode && hasPosition(ourNode)) {
|
if (ourNode && hasValidPosition(ourNode)) {
|
||||||
meshtastic_Position &op = ourNode->position;
|
meshtastic_Position &op = ourNode->position;
|
||||||
float myHeading = estimatedHeading(DegD(op.latitude_i), DegD(op.longitude_i));
|
float myHeading = estimatedHeading(DegD(op.latitude_i), DegD(op.longitude_i));
|
||||||
drawCompassNorth(display, compassX, compassY, myHeading);
|
drawCompassNorth(display, compassX, compassY, myHeading);
|
||||||
|
|
||||||
if (hasPosition(node)) {
|
if (hasValidPosition(node)) {
|
||||||
// display direction toward node
|
// display direction toward node
|
||||||
hasNodeHeading = true;
|
hasNodeHeading = true;
|
||||||
meshtastic_Position &p = node->position;
|
meshtastic_Position &p = node->position;
|
||||||
@@ -860,7 +885,8 @@ 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 && hasPosition(ourNode), hasPosition(node));
|
// LOG_DEBUG("ourNode %d, ourPos %d, theirPos %d\n", !!ourNode, ourNode && hasValidPosition(ourNode),
|
||||||
|
// 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, "?");
|
||||||
}
|
}
|
||||||
display->drawCircle(compassX, compassY, getCompassDiam(display) / 2);
|
display->drawCircle(compassX, compassY, getCompassDiam(display) / 2);
|
||||||
@@ -1207,11 +1233,13 @@ void Screen::setFrames()
|
|||||||
|
|
||||||
moduleFrames = MeshModule::GetMeshModulesWithUIFrames();
|
moduleFrames = MeshModule::GetMeshModulesWithUIFrames();
|
||||||
LOG_DEBUG("Showing %d module frames\n", moduleFrames.size());
|
LOG_DEBUG("Showing %d module frames\n", moduleFrames.size());
|
||||||
|
#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\n", totalFrameCount);
|
||||||
|
#endif
|
||||||
|
|
||||||
// We don't show the node info our our node (if we have it yet - we should)
|
// We don't show the node info our our node (if we have it yet - we should)
|
||||||
size_t numnodes = nodeStatus->getNumTotal();
|
size_t numnodes = nodeDB.getNumNodes();
|
||||||
if (numnodes > 0)
|
if (numnodes > 0)
|
||||||
numnodes--;
|
numnodes--;
|
||||||
|
|
||||||
@@ -1237,6 +1265,10 @@ void Screen::setFrames()
|
|||||||
if (devicestate.has_rx_text_message && shouldDrawMessage(&devicestate.rx_text_message)) {
|
if (devicestate.has_rx_text_message && shouldDrawMessage(&devicestate.rx_text_message)) {
|
||||||
normalFrames[numframes++] = drawTextMessageFrame;
|
normalFrames[numframes++] = drawTextMessageFrame;
|
||||||
}
|
}
|
||||||
|
// If we have a waypoint - show it next, unless it's a phone message and we aren't using any special modules
|
||||||
|
if (devicestate.has_rx_waypoint && shouldDrawMessage(&devicestate.rx_waypoint)) {
|
||||||
|
normalFrames[numframes++] = drawWaypointFrame;
|
||||||
|
}
|
||||||
|
|
||||||
// then all the nodes
|
// then all the nodes
|
||||||
// We only show a few nodes in our scrolling list - because meshes with many nodes would have too many screens
|
// We only show a few nodes in our scrolling list - because meshes with many nodes would have too many screens
|
||||||
@@ -1393,8 +1425,6 @@ void Screen::setFastFramerate()
|
|||||||
|
|
||||||
void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||||
{
|
{
|
||||||
displayedNodeNum = 0; // Not currently showing a node pane
|
|
||||||
|
|
||||||
display->setFont(FONT_SMALL);
|
display->setFont(FONT_SMALL);
|
||||||
|
|
||||||
// The coordinates define the left starting point of the text
|
// The coordinates define the left starting point of the text
|
||||||
@@ -1502,8 +1532,6 @@ void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, i
|
|||||||
#if HAS_WIFI
|
#if HAS_WIFI
|
||||||
const char *wifiName = config.network.wifi_ssid;
|
const char *wifiName = config.network.wifi_ssid;
|
||||||
|
|
||||||
displayedNodeNum = 0; // Not currently showing a node pane
|
|
||||||
|
|
||||||
display->setFont(FONT_SMALL);
|
display->setFont(FONT_SMALL);
|
||||||
|
|
||||||
// The coordinates define the left starting point of the text
|
// The coordinates define the left starting point of the text
|
||||||
@@ -1634,8 +1662,6 @@ void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, i
|
|||||||
|
|
||||||
void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||||
{
|
{
|
||||||
displayedNodeNum = 0; // Not currently showing a node pane
|
|
||||||
|
|
||||||
display->setFont(FONT_SMALL);
|
display->setFont(FONT_SMALL);
|
||||||
|
|
||||||
// The coordinates define the left starting point of the text
|
// The coordinates define the left starting point of the text
|
||||||
|
|||||||
105
src/main.cpp
105
src/main.cpp
@@ -59,6 +59,9 @@ NRF52Bluetooth *nrf52Bluetooth;
|
|||||||
#include "SX1262Interface.h"
|
#include "SX1262Interface.h"
|
||||||
#include "SX1268Interface.h"
|
#include "SX1268Interface.h"
|
||||||
#include "SX1280Interface.h"
|
#include "SX1280Interface.h"
|
||||||
|
#ifdef ARCH_STM32WL
|
||||||
|
#include "STM32WLE5JCInterface.h"
|
||||||
|
#endif
|
||||||
#if !HAS_RADIO && defined(ARCH_PORTDUINO)
|
#if !HAS_RADIO && defined(ARCH_PORTDUINO)
|
||||||
#include "platform/portduino/SimRadio.h"
|
#include "platform/portduino/SimRadio.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -68,7 +71,7 @@ NRF52Bluetooth *nrf52Bluetooth;
|
|||||||
#endif
|
#endif
|
||||||
#include "PowerFSMThread.h"
|
#include "PowerFSMThread.h"
|
||||||
|
|
||||||
#if !defined(ARCH_PORTDUINO)
|
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
||||||
#include "AccelerometerThread.h"
|
#include "AccelerometerThread.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -100,6 +103,8 @@ uint8_t kb_model;
|
|||||||
ScanI2C::DeviceAddress rtc_found = ScanI2C::ADDRESS_NONE;
|
ScanI2C::DeviceAddress rtc_found = ScanI2C::ADDRESS_NONE;
|
||||||
// The I2C address of the Accelerometer (if found)
|
// The I2C address of the Accelerometer (if found)
|
||||||
ScanI2C::DeviceAddress accelerometer_found = ScanI2C::ADDRESS_NONE;
|
ScanI2C::DeviceAddress accelerometer_found = ScanI2C::ADDRESS_NONE;
|
||||||
|
// The I2C address of the RGB LED (if found)
|
||||||
|
ScanI2C::FoundDevice rgb_found = ScanI2C::FoundDevice(ScanI2C::DeviceType::NONE, ScanI2C::ADDRESS_NONE);
|
||||||
|
|
||||||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
||||||
ATECCX08A atecc;
|
ATECCX08A atecc;
|
||||||
@@ -142,17 +147,6 @@ static int32_t ledBlinker()
|
|||||||
|
|
||||||
setLed(ledOn);
|
setLed(ledOn);
|
||||||
|
|
||||||
#ifdef ARCH_ESP32
|
|
||||||
auto newHeap = ESP.getFreeHeap();
|
|
||||||
if (newHeap < 11000) {
|
|
||||||
LOG_DEBUG("\n\n====== heap too low [11000] -> reboot in 1s ======\n\n");
|
|
||||||
#ifdef HAS_SCREEN
|
|
||||||
screen->startRebootScreen();
|
|
||||||
#endif
|
|
||||||
rebootAtMsec = millis() + 900;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// have a very sparse duty cycle of LED being on, unless charging, then blink 0.5Hz square wave rate to indicate that
|
// have a very sparse duty cycle of LED being on, unless charging, then blink 0.5Hz square wave rate to indicate that
|
||||||
return powerStatus->getIsCharging() ? 1000 : (ledOn ? 1 : 1000);
|
return powerStatus->getIsCharging() ? 1000 : (ledOn ? 1 : 1000);
|
||||||
}
|
}
|
||||||
@@ -170,6 +164,7 @@ static OSThread *buttonThread;
|
|||||||
uint32_t ButtonThread::longPressTime = 0;
|
uint32_t ButtonThread::longPressTime = 0;
|
||||||
#endif
|
#endif
|
||||||
static OSThread *accelerometerThread;
|
static OSThread *accelerometerThread;
|
||||||
|
SPISettings spiSettings(4000000, MSBFIRST, SPI_MODE0);
|
||||||
|
|
||||||
RadioInterface *rIf = NULL;
|
RadioInterface *rIf = NULL;
|
||||||
|
|
||||||
@@ -229,10 +224,10 @@ void setup()
|
|||||||
|
|
||||||
// If the button is connected to GPIO 12, don't enable the ability to use
|
// If the button is connected to GPIO 12, don't enable the ability to use
|
||||||
// meshtasticAdmin on the device.
|
// meshtasticAdmin on the device.
|
||||||
pinMode(BUTTON_PIN, INPUT);
|
pinMode(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN, INPUT);
|
||||||
|
|
||||||
#ifdef BUTTON_NEED_PULLUP
|
#ifdef BUTTON_NEED_PULLUP
|
||||||
gpio_pullup_en((gpio_num_t)BUTTON_PIN);
|
gpio_pullup_en((gpio_num_t)(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN));
|
||||||
delay(10);
|
delay(10);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -245,8 +240,6 @@ void setup()
|
|||||||
|
|
||||||
fsInit();
|
fsInit();
|
||||||
|
|
||||||
router = new ReliableRouter();
|
|
||||||
|
|
||||||
#ifdef I2C_SDA1
|
#ifdef I2C_SDA1
|
||||||
Wire1.begin(I2C_SDA1, I2C_SCL1);
|
Wire1.begin(I2C_SDA1, I2C_SCL1);
|
||||||
#endif
|
#endif
|
||||||
@@ -357,14 +350,14 @@ void setup()
|
|||||||
* nodeTelemetrySensorsMap singleton. This wraps that logic in a temporary scope to declare the temporary field
|
* nodeTelemetrySensorsMap singleton. This wraps that logic in a temporary scope to declare the temporary field
|
||||||
* "found".
|
* "found".
|
||||||
*/
|
*/
|
||||||
#if !defined(ARCH_PORTDUINO)
|
|
||||||
|
// Only one supported RGB LED currently
|
||||||
|
rgb_found = i2cScanner->find(ScanI2C::DeviceType::NCP5623);
|
||||||
|
|
||||||
|
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
||||||
auto acc_info = i2cScanner->firstAccelerometer();
|
auto acc_info = i2cScanner->firstAccelerometer();
|
||||||
accelerometer_found = acc_info.type != ScanI2C::DeviceType::NONE ? acc_info.address : accelerometer_found;
|
accelerometer_found = acc_info.type != ScanI2C::DeviceType::NONE ? acc_info.address : accelerometer_found;
|
||||||
|
|
||||||
LOG_DEBUG("acc_info = %i\n", acc_info.type);
|
LOG_DEBUG("acc_info = %i\n", acc_info.type);
|
||||||
if (acc_info.type != ScanI2C::DeviceType::NONE) {
|
|
||||||
accelerometerThread = new AccelerometerThread(acc_info.type);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define STRING(S) #S
|
#define STRING(S) #S
|
||||||
@@ -403,10 +396,7 @@ void setup()
|
|||||||
// scanEInkDevice();
|
// scanEInkDevice();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_BUTTON
|
// LED init
|
||||||
// Buttons & LED
|
|
||||||
buttonThread = new ButtonThread();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef LED_PIN
|
#ifdef LED_PIN
|
||||||
pinMode(LED_PIN, OUTPUT);
|
pinMode(LED_PIN, OUTPUT);
|
||||||
@@ -430,6 +420,13 @@ void setup()
|
|||||||
// If we're taking on the repeater role, use flood router
|
// If we're taking on the repeater role, use flood router
|
||||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER)
|
if (config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER)
|
||||||
router = new FloodingRouter();
|
router = new FloodingRouter();
|
||||||
|
else
|
||||||
|
router = new ReliableRouter();
|
||||||
|
|
||||||
|
#if HAS_BUTTON
|
||||||
|
// Buttons. Moved here cause we need NodeDB to be initialized
|
||||||
|
buttonThread = new ButtonThread();
|
||||||
|
#endif
|
||||||
|
|
||||||
playStartMelody();
|
playStartMelody();
|
||||||
|
|
||||||
@@ -446,9 +443,29 @@ void setup()
|
|||||||
screen_model = meshtastic_Config_DisplayConfig_OledType_OLED_SH1107; // keep dimension of 128x64
|
screen_model = meshtastic_Config_DisplayConfig_OledType_OLED_SH1107; // keep dimension of 128x64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
||||||
|
if (acc_info.type != ScanI2C::DeviceType::NONE) {
|
||||||
|
accelerometerThread = new AccelerometerThread(acc_info.type);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Init our SPI controller (must be before screen and lora)
|
// Init our SPI controller (must be before screen and lora)
|
||||||
initSPI();
|
initSPI();
|
||||||
#ifndef ARCH_ESP32
|
#ifdef ARCH_RP2040
|
||||||
|
#ifdef HW_SPI1_DEVICE
|
||||||
|
SPI1.setSCK(RF95_SCK);
|
||||||
|
SPI1.setTX(RF95_MOSI);
|
||||||
|
SPI1.setRX(RF95_MISO);
|
||||||
|
pinMode(RF95_NSS, OUTPUT);
|
||||||
|
digitalWrite(RF95_NSS, HIGH);
|
||||||
|
SPI1.begin(false);
|
||||||
|
#else // HW_SPI1_DEVICE
|
||||||
|
SPI.setSCK(RF95_SCK);
|
||||||
|
SPI.setTX(RF95_MOSI);
|
||||||
|
SPI.setRX(RF95_MISO);
|
||||||
|
SPI.begin(false);
|
||||||
|
#endif // HW_SPI1_DEVICE
|
||||||
|
#elif !defined(ARCH_ESP32) // ARCH_RP2040
|
||||||
SPI.begin();
|
SPI.begin();
|
||||||
#else
|
#else
|
||||||
// ESP32
|
// ESP32
|
||||||
@@ -463,10 +480,11 @@ void setup()
|
|||||||
|
|
||||||
gps = createGps();
|
gps = createGps();
|
||||||
|
|
||||||
if (gps)
|
if (gps) {
|
||||||
gpsStatus->observe(&gps->newStatus);
|
gpsStatus->observe(&gps->newStatus);
|
||||||
else
|
} else {
|
||||||
LOG_WARN("No GPS found - running without GPS\n");
|
LOG_WARN("No GPS found - running without GPS\n");
|
||||||
|
}
|
||||||
|
|
||||||
nodeStatus->observe(&nodeDB.newStatus);
|
nodeStatus->observe(&nodeDB.newStatus);
|
||||||
|
|
||||||
@@ -509,7 +527,25 @@ void setup()
|
|||||||
digitalWrite(SX126X_ANT_SW, 1);
|
digitalWrite(SX126X_ANT_SW, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HW_SPI1_DEVICE
|
||||||
|
LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(SPI1, spiSettings);
|
||||||
|
#else // HW_SPI1_DEVICE
|
||||||
|
LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(SPI, spiSettings);
|
||||||
|
#endif
|
||||||
|
|
||||||
// radio init MUST BE AFTER service.init, so we have our radio config settings (from nodedb init)
|
// radio init MUST BE AFTER service.init, so we have our radio config settings (from nodedb init)
|
||||||
|
#if defined(USE_STM32WLx)
|
||||||
|
if (!rIf) {
|
||||||
|
rIf = new STM32WLE5JCInterface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY);
|
||||||
|
if (!rIf->init()) {
|
||||||
|
LOG_WARN("Failed to find STM32WL radio\n");
|
||||||
|
delete rIf;
|
||||||
|
rIf = NULL;
|
||||||
|
} else {
|
||||||
|
LOG_INFO("STM32WL Radio init succeeded, using STM32WL radio\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !HAS_RADIO && defined(ARCH_PORTDUINO)
|
#if !HAS_RADIO && defined(ARCH_PORTDUINO)
|
||||||
if (!rIf) {
|
if (!rIf) {
|
||||||
@@ -526,7 +562,7 @@ void setup()
|
|||||||
|
|
||||||
#if defined(RF95_IRQ)
|
#if defined(RF95_IRQ)
|
||||||
if (!rIf) {
|
if (!rIf) {
|
||||||
rIf = new RF95Interface(RF95_NSS, RF95_IRQ, RF95_RESET, RF95_DIO1, SPI);
|
rIf = new RF95Interface(RadioLibHAL, RF95_NSS, RF95_IRQ, RF95_RESET, RF95_DIO1);
|
||||||
if (!rIf->init()) {
|
if (!rIf->init()) {
|
||||||
LOG_WARN("Failed to find RF95 radio\n");
|
LOG_WARN("Failed to find RF95 radio\n");
|
||||||
delete rIf;
|
delete rIf;
|
||||||
@@ -539,7 +575,7 @@ void setup()
|
|||||||
|
|
||||||
#if defined(USE_SX1262)
|
#if defined(USE_SX1262)
|
||||||
if (!rIf) {
|
if (!rIf) {
|
||||||
rIf = new SX1262Interface(SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY, SPI);
|
rIf = new SX1262Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY);
|
||||||
if (!rIf->init()) {
|
if (!rIf->init()) {
|
||||||
LOG_WARN("Failed to find SX1262 radio\n");
|
LOG_WARN("Failed to find SX1262 radio\n");
|
||||||
delete rIf;
|
delete rIf;
|
||||||
@@ -552,7 +588,7 @@ void setup()
|
|||||||
|
|
||||||
#if defined(USE_SX1268)
|
#if defined(USE_SX1268)
|
||||||
if (!rIf) {
|
if (!rIf) {
|
||||||
rIf = new SX1268Interface(SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY, SPI);
|
rIf = new SX1268Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY);
|
||||||
if (!rIf->init()) {
|
if (!rIf->init()) {
|
||||||
LOG_WARN("Failed to find SX1268 radio\n");
|
LOG_WARN("Failed to find SX1268 radio\n");
|
||||||
delete rIf;
|
delete rIf;
|
||||||
@@ -565,7 +601,7 @@ void setup()
|
|||||||
|
|
||||||
#if defined(USE_LLCC68)
|
#if defined(USE_LLCC68)
|
||||||
if (!rIf) {
|
if (!rIf) {
|
||||||
rIf = new LLCC68Interface(SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY, SPI);
|
rIf = new LLCC68Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY);
|
||||||
if (!rIf->init()) {
|
if (!rIf->init()) {
|
||||||
LOG_WARN("Failed to find LLCC68 radio\n");
|
LOG_WARN("Failed to find LLCC68 radio\n");
|
||||||
delete rIf;
|
delete rIf;
|
||||||
@@ -578,7 +614,7 @@ void setup()
|
|||||||
|
|
||||||
#if defined(USE_SX1280)
|
#if defined(USE_SX1280)
|
||||||
if (!rIf) {
|
if (!rIf) {
|
||||||
rIf = new SX1280Interface(SX128X_CS, SX128X_DIO1, SX128X_RESET, SX128X_BUSY, SPI);
|
rIf = new SX1280Interface(RadioLibHAL, SX128X_CS, SX128X_DIO1, SX128X_RESET, SX128X_BUSY);
|
||||||
if (!rIf->init()) {
|
if (!rIf->init()) {
|
||||||
LOG_WARN("Failed to find SX1280 radio\n");
|
LOG_WARN("Failed to find SX1280 radio\n");
|
||||||
delete rIf;
|
delete rIf;
|
||||||
@@ -666,6 +702,7 @@ extern meshtastic_DeviceMetadata getDeviceMetadata()
|
|||||||
deviceMetadata.role = config.device.role;
|
deviceMetadata.role = config.device.role;
|
||||||
deviceMetadata.position_flags = config.position.position_flags;
|
deviceMetadata.position_flags = config.position.position_flags;
|
||||||
deviceMetadata.hw_model = HW_VENDOR;
|
deviceMetadata.hw_model = HW_VENDOR;
|
||||||
|
deviceMetadata.hasRemoteHardware = moduleConfig.remote_hardware.enabled;
|
||||||
return deviceMetadata;
|
return deviceMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -713,4 +750,4 @@ void loop()
|
|||||||
mainDelay.delay(delayMsec);
|
mainDelay.delay(delayMsec);
|
||||||
}
|
}
|
||||||
// if (didWake) LOG_DEBUG("wake!\n");
|
// if (didWake) LOG_DEBUG("wake!\n");
|
||||||
}
|
}
|
||||||
@@ -5,8 +5,10 @@
|
|||||||
#include "PowerStatus.h"
|
#include "PowerStatus.h"
|
||||||
#include "detect/ScanI2C.h"
|
#include "detect/ScanI2C.h"
|
||||||
#include "graphics/Screen.h"
|
#include "graphics/Screen.h"
|
||||||
|
#include "memGet.h"
|
||||||
#include "mesh/generated/meshtastic/config.pb.h"
|
#include "mesh/generated/meshtastic/config.pb.h"
|
||||||
#include "mesh/generated/meshtastic/telemetry.pb.h"
|
#include "mesh/generated/meshtastic/telemetry.pb.h"
|
||||||
|
#include <SPI.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
||||||
#include <SparkFun_ATECCX08a_Arduino_Library.h>
|
#include <SparkFun_ATECCX08a_Arduino_Library.h>
|
||||||
@@ -25,6 +27,7 @@ extern ScanI2C::DeviceAddress cardkb_found;
|
|||||||
extern uint8_t kb_model;
|
extern uint8_t kb_model;
|
||||||
extern ScanI2C::DeviceAddress rtc_found;
|
extern ScanI2C::DeviceAddress rtc_found;
|
||||||
extern ScanI2C::DeviceAddress accelerometer_found;
|
extern ScanI2C::DeviceAddress accelerometer_found;
|
||||||
|
extern ScanI2C::FoundDevice rgb_found;
|
||||||
|
|
||||||
extern bool eink_found;
|
extern bool eink_found;
|
||||||
extern bool pmu_found;
|
extern bool pmu_found;
|
||||||
@@ -35,8 +38,6 @@ extern bool isUSBPowered;
|
|||||||
extern ATECCX08A atecc;
|
extern ATECCX08A atecc;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern uint8_t nodeTelemetrySensorsMap[_meshtastic_TelemetrySensorType_MAX + 1];
|
|
||||||
|
|
||||||
extern int TCPPort; // set by Portduino
|
extern int TCPPort; // set by Portduino
|
||||||
|
|
||||||
// Global Screen singleton.
|
// Global Screen singleton.
|
||||||
@@ -64,3 +65,6 @@ extern bool runASAP;
|
|||||||
void nrf52Setup(), esp32Setup(), nrf52Loop(), esp32Loop(), clearBonds();
|
void nrf52Setup(), esp32Setup(), nrf52Loop(), esp32Loop(), clearBonds();
|
||||||
|
|
||||||
meshtastic_DeviceMetadata getDeviceMetadata();
|
meshtastic_DeviceMetadata getDeviceMetadata();
|
||||||
|
|
||||||
|
// FIXME, we default to 4MHz SPI, SPI mode 0, check if the datasheet says it can really do that
|
||||||
|
extern SPISettings spiSettings;
|
||||||
46
src/memGet.cpp
Normal file
46
src/memGet.cpp
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
#include "memGet.h"
|
||||||
|
#include "configuration.h"
|
||||||
|
|
||||||
|
MemGet memGet;
|
||||||
|
|
||||||
|
uint32_t MemGet::getFreeHeap()
|
||||||
|
{
|
||||||
|
#ifdef ARCH_ESP32
|
||||||
|
return ESP.getFreeHeap();
|
||||||
|
#elif defined(ARCH_NRF52)
|
||||||
|
return dbgHeapFree();
|
||||||
|
#else
|
||||||
|
// this platform does not have heap management function implemented
|
||||||
|
return UINT32_MAX;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t MemGet::getHeapSize()
|
||||||
|
{
|
||||||
|
#ifdef ARCH_ESP32
|
||||||
|
return ESP.getHeapSize();
|
||||||
|
#elif defined(ARCH_NRF52)
|
||||||
|
return dbgHeapTotal();
|
||||||
|
#else
|
||||||
|
// this platform does not have heap management function implemented
|
||||||
|
return UINT32_MAX;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t MemGet::getFreePsram()
|
||||||
|
{
|
||||||
|
#ifdef ARCH_ESP32
|
||||||
|
return ESP.getFreePsram();
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t MemGet::getPsramSize()
|
||||||
|
{
|
||||||
|
#ifdef ARCH_ESP32
|
||||||
|
return ESP.getPsramSize();
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
18
src/memGet.h
Normal file
18
src/memGet.h
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
#ifndef _MT_MEMGET_H
|
||||||
|
#define _MT_MEMGET_H
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
class MemGet
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
uint32_t getFreeHeap();
|
||||||
|
uint32_t getHeapSize();
|
||||||
|
uint32_t getFreePsram();
|
||||||
|
uint32_t getPsramSize();
|
||||||
|
};
|
||||||
|
|
||||||
|
extern MemGet memGet;
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -108,8 +108,9 @@ CryptoKey Channels::getKey(ChannelIndex chIndex)
|
|||||||
if (ch.role == meshtastic_Channel_Role_SECONDARY) {
|
if (ch.role == meshtastic_Channel_Role_SECONDARY) {
|
||||||
LOG_DEBUG("Unset PSK for secondary channel %s. using primary key\n", ch.settings.name);
|
LOG_DEBUG("Unset PSK for secondary channel %s. using primary key\n", ch.settings.name);
|
||||||
k = getKey(primaryIndex);
|
k = getKey(primaryIndex);
|
||||||
} else
|
} else {
|
||||||
LOG_WARN("User disabled encryption\n");
|
LOG_WARN("User disabled encryption\n");
|
||||||
|
}
|
||||||
} else if (k.length == 1) {
|
} else if (k.length == 1) {
|
||||||
// Convert the short single byte variants of psk into variant that can be used more generally
|
// Convert the short single byte variants of psk into variant that can be used more generally
|
||||||
|
|
||||||
@@ -260,6 +261,9 @@ const char *Channels::getName(size_t chIndex)
|
|||||||
case meshtastic_Config_LoRaConfig_ModemPreset_LONG_FAST:
|
case meshtastic_Config_LoRaConfig_ModemPreset_LONG_FAST:
|
||||||
channelName = "LongFast";
|
channelName = "LongFast";
|
||||||
break;
|
break;
|
||||||
|
case meshtastic_Config_LoRaConfig_ModemPreset_LONG_MODERATE:
|
||||||
|
channelName = "LongMod";
|
||||||
|
break;
|
||||||
case meshtastic_Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW:
|
case meshtastic_Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW:
|
||||||
channelName = "VLongSlow";
|
channelName = "VLongSlow";
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "CryptoEngine.h"
|
#include "CryptoEngine.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
|
||||||
|
concurrency::Lock *cryptLock;
|
||||||
|
|
||||||
void CryptoEngine::setKey(const CryptoKey &k)
|
void CryptoEngine::setKey(const CryptoKey &k)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("Using AES%d key!\n", k.length * 8);
|
LOG_DEBUG("Using AES%d key!\n", k.length * 8);
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "concurrency/LockGuard.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
extern concurrency::Lock *cryptLock;
|
||||||
|
|
||||||
struct CryptoKey {
|
struct CryptoKey {
|
||||||
uint8_t bytes[32];
|
uint8_t bytes[32];
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ bool FloodingRouter::shouldFilterReceived(const meshtastic_MeshPacket *p)
|
|||||||
{
|
{
|
||||||
if (wasSeenRecently(p)) { // Note: this will also add a recent packet record
|
if (wasSeenRecently(p)) { // Note: this will also add a recent packet record
|
||||||
printPacket("Ignoring incoming msg, because we've already seen it", p);
|
printPacket("Ignoring incoming msg, because we've already seen it", p);
|
||||||
|
Router::cancelSending(p->from, p->id); // cancel rebroadcast of this message *if* there was already one
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,4 +63,4 @@ void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas
|
|||||||
}
|
}
|
||||||
// handle the packet as normal
|
// handle the packet as normal
|
||||||
Router::sniffReceived(p, c);
|
Router::sniffReceived(p, c);
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,9 @@ template class SX126xInterface<SX1262>;
|
|||||||
template class SX126xInterface<SX1268>;
|
template class SX126xInterface<SX1268>;
|
||||||
template class SX126xInterface<LLCC68>;
|
template class SX126xInterface<LLCC68>;
|
||||||
template class SX128xInterface<SX1280>;
|
template class SX128xInterface<SX1280>;
|
||||||
|
#ifdef ARCH_STM32WL
|
||||||
|
template class SX126xInterface<STM32WLx>;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HAS_ETHERNET
|
#if HAS_ETHERNET
|
||||||
#include "api/ethServerAPI.h"
|
#include "api/ethServerAPI.h"
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
LLCC68Interface::LLCC68Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy,
|
LLCC68Interface::LLCC68Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||||
SPIClass &spi)
|
RADIOLIB_PIN_TYPE busy)
|
||||||
: SX126xInterface(cs, irq, rst, busy, spi)
|
: SX126xInterface(hal, cs, irq, rst, busy)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -6,12 +6,13 @@
|
|||||||
* Our adapter for LLCC68 radios
|
* Our adapter for LLCC68 radios
|
||||||
* https://www.semtech.com/products/wireless-rf/lora-core/llcc68
|
* https://www.semtech.com/products/wireless-rf/lora-core/llcc68
|
||||||
* ⚠️⚠️⚠️
|
* ⚠️⚠️⚠️
|
||||||
* Be aware that LLCC68 does not support Spreading Factor 12 (SF12) and will not work on the default "Long Slow" channel.
|
* Be aware that LLCC68 does not support Spreading Factor 12 (SF12) and will not work on the "LongSlow" and "VLongSlow" channels.
|
||||||
* You must change the channel if you get `Critical Error #3` with this module.
|
* You must change the channel if you get `Critical Error #3` with this module.
|
||||||
* ⚠️⚠️⚠️
|
* ⚠️⚠️⚠️
|
||||||
*/
|
*/
|
||||||
class LLCC68Interface : public SX126xInterface<LLCC68>
|
class LLCC68Interface : public SX126xInterface<LLCC68>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLCC68Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi);
|
LLCC68Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||||
|
RADIOLIB_PIN_TYPE busy);
|
||||||
};
|
};
|
||||||
@@ -179,9 +179,10 @@ void MeshModule::callPlugins(const meshtastic_MeshPacket &mp, RxSource src)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!moduleFound)
|
if (!moduleFound) {
|
||||||
LOG_DEBUG("No modules interested in portnum=%d, src=%s\n", mp.decoded.portnum,
|
LOG_DEBUG("No modules interested in portnum=%d, src=%s\n", mp.decoded.portnum,
|
||||||
(src == RX_SRC_LOCAL) ? "LOCAL" : "REMOTE");
|
(src == RX_SRC_LOCAL) ? "LOCAL" : "REMOTE");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
meshtastic_MeshPacket *MeshModule::allocReply()
|
meshtastic_MeshPacket *MeshModule::allocReply()
|
||||||
|
|||||||
@@ -77,8 +77,8 @@ int MeshService::handleFromRadio(const meshtastic_MeshPacket *mp)
|
|||||||
|
|
||||||
nodeDB.updateFrom(*mp); // update our DB state based off sniffing every RX packet from the radio
|
nodeDB.updateFrom(*mp); // update our DB state based off sniffing every RX packet from the radio
|
||||||
if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag && !nodeDB.getNode(mp->from)->has_user && nodeInfoModule) {
|
if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag && !nodeDB.getNode(mp->from)->has_user && nodeInfoModule) {
|
||||||
LOG_INFO("Heard a node we don't know, sending NodeInfo and asking for a response.\n");
|
LOG_INFO("Heard a node on channel %d we don't know, sending NodeInfo and asking for a response.\n", mp->channel);
|
||||||
nodeInfoModule->sendOurNodeInfo(mp->from, true);
|
nodeInfoModule->sendOurNodeInfo(mp->from, true, mp->channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
printPacket("Forwarding to phone", mp);
|
printPacket("Forwarding to phone", mp);
|
||||||
@@ -125,7 +125,6 @@ void MeshService::reloadOwner(bool shouldSave)
|
|||||||
// update everyone else and save to disk
|
// update everyone else and save to disk
|
||||||
if (nodeInfoModule && shouldSave) {
|
if (nodeInfoModule && shouldSave) {
|
||||||
nodeInfoModule->sendOurNodeInfo();
|
nodeInfoModule->sendOurNodeInfo();
|
||||||
nodeDB.saveToDisk(SEGMENT_DEVICESTATE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,15 +239,15 @@ void MeshService::sendNetworkPing(NodeNum dest, bool wantReplies)
|
|||||||
meshtastic_NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
meshtastic_NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
||||||
assert(node);
|
assert(node);
|
||||||
|
|
||||||
if (node->has_position && (node->position.latitude_i != 0 || node->position.longitude_i != 0)) {
|
if (hasValidPosition(node)) {
|
||||||
if (positionModule) {
|
if (positionModule) {
|
||||||
LOG_INFO("Sending position ping to 0x%x, wantReplies=%d\n", dest, wantReplies);
|
LOG_INFO("Sending position ping to 0x%x, wantReplies=%d, channel=%d\n", dest, wantReplies, node->channel);
|
||||||
positionModule->sendOurPosition(dest, wantReplies);
|
positionModule->sendOurPosition(dest, wantReplies, node->channel);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (nodeInfoModule) {
|
if (nodeInfoModule) {
|
||||||
LOG_INFO("Sending nodeinfo ping to 0x%x, wantReplies=%d\n", dest, wantReplies);
|
LOG_INFO("Sending nodeinfo ping to 0x%x, wantReplies=%d, channel=%d\n", dest, wantReplies, node->channel);
|
||||||
nodeInfoModule->sendOurNodeInfo(dest, wantReplies);
|
nodeInfoModule->sendOurNodeInfo(dest, wantReplies, node->channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,12 +58,6 @@ meshtastic_User &owner = devicestate.owner;
|
|||||||
|
|
||||||
static uint8_t ourMacAddr[6];
|
static uint8_t ourMacAddr[6];
|
||||||
|
|
||||||
/**
|
|
||||||
* The node number the user is currently looking at
|
|
||||||
* 0 if none
|
|
||||||
*/
|
|
||||||
NodeNum displayedNodeNum;
|
|
||||||
|
|
||||||
NodeDB::NodeDB() : nodes(devicestate.node_db), numNodes(&devicestate.node_db_count) {}
|
NodeDB::NodeDB() : nodes(devicestate.node_db), numNodes(&devicestate.node_db_count) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -171,6 +165,8 @@ void NodeDB::installDefaultConfig()
|
|||||||
config.lora.hop_limit = HOP_RELIABLE;
|
config.lora.hop_limit = HOP_RELIABLE;
|
||||||
config.position.gps_enabled = true;
|
config.position.gps_enabled = true;
|
||||||
config.position.position_broadcast_smart_enabled = true;
|
config.position.position_broadcast_smart_enabled = true;
|
||||||
|
config.position.broadcast_smart_minimum_distance = 100;
|
||||||
|
config.position.broadcast_smart_minimum_interval_secs = 30;
|
||||||
if (config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER)
|
if (config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER)
|
||||||
config.device.node_info_broadcast_secs = 3 * 60 * 60;
|
config.device.node_info_broadcast_secs = 3 * 60 * 60;
|
||||||
config.device.serial_enabled = true;
|
config.device.serial_enabled = true;
|
||||||
@@ -237,9 +233,7 @@ void NodeDB::installRoleDefaults(meshtastic_Config_DeviceConfig_Role role)
|
|||||||
} else if (role == meshtastic_Config_DeviceConfig_Role_REPEATER) {
|
} else if (role == meshtastic_Config_DeviceConfig_Role_REPEATER) {
|
||||||
config.display.screen_on_secs = 1;
|
config.display.screen_on_secs = 1;
|
||||||
} else if (role == meshtastic_Config_DeviceConfig_Role_TRACKER) {
|
} else if (role == meshtastic_Config_DeviceConfig_Role_TRACKER) {
|
||||||
config.position.position_broadcast_smart_enabled = false;
|
config.position.gps_update_interval = 30;
|
||||||
config.position.position_broadcast_secs = 120;
|
|
||||||
config.position.gps_update_interval = 60;
|
|
||||||
} else if (role == meshtastic_Config_DeviceConfig_Role_SENSOR) {
|
} else if (role == meshtastic_Config_DeviceConfig_Role_SENSOR) {
|
||||||
moduleConfig.telemetry.environment_measurement_enabled = true;
|
moduleConfig.telemetry.environment_measurement_enabled = true;
|
||||||
moduleConfig.telemetry.environment_update_interval = 300;
|
moduleConfig.telemetry.environment_update_interval = 300;
|
||||||
@@ -355,6 +349,11 @@ void NodeDB::init()
|
|||||||
if (channelFileCRC != crc32Buffer(&channelFile, sizeof(channelFile)))
|
if (channelFileCRC != crc32Buffer(&channelFile, sizeof(channelFile)))
|
||||||
saveWhat |= SEGMENT_CHANNELS;
|
saveWhat |= SEGMENT_CHANNELS;
|
||||||
|
|
||||||
|
if (!devicestate.node_remote_hardware_pins) {
|
||||||
|
meshtastic_NodeRemoteHardwarePin empty[12] = {meshtastic_RemoteHardwarePin_init_default};
|
||||||
|
memcpy(devicestate.node_remote_hardware_pins, empty, sizeof(empty));
|
||||||
|
}
|
||||||
|
|
||||||
saveToDisk(saveWhat);
|
saveToDisk(saveWhat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -474,8 +473,9 @@ void NodeDB::loadFromDisk()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loadProto(oemConfigFile, meshtastic_OEMStore_size, sizeof(meshtastic_OEMStore), &meshtastic_OEMStore_msg, &oemStore))
|
if (loadProto(oemConfigFile, meshtastic_OEMStore_size, sizeof(meshtastic_OEMStore), &meshtastic_OEMStore_msg, &oemStore)) {
|
||||||
LOG_INFO("Loaded OEMStore\n");
|
LOG_INFO("Loaded OEMStore\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Save a protobuf from a file, return true for success */
|
/** Save a protobuf from a file, return true for success */
|
||||||
@@ -496,13 +496,16 @@ bool NodeDB::saveProto(const char *filename, size_t protoSize, const pb_msgdesc_
|
|||||||
} else {
|
} else {
|
||||||
okay = true;
|
okay = true;
|
||||||
}
|
}
|
||||||
|
f.flush();
|
||||||
f.close();
|
f.close();
|
||||||
|
|
||||||
// brief window of risk here ;-)
|
// brief window of risk here ;-)
|
||||||
if (FSCom.exists(filename) && !FSCom.remove(filename))
|
if (FSCom.exists(filename) && !FSCom.remove(filename)) {
|
||||||
LOG_WARN("Can't remove old pref file\n");
|
LOG_WARN("Can't remove old pref file\n");
|
||||||
if (!renameFile(filenameTmp.c_str(), filename))
|
}
|
||||||
|
if (!renameFile(filenameTmp.c_str(), filename)) {
|
||||||
LOG_ERROR("Error: can't rename new pref file\n");
|
LOG_ERROR("Error: can't rename new pref file\n");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR("Can't write prefs\n");
|
LOG_ERROR("Can't write prefs\n");
|
||||||
#ifdef ARCH_NRF52
|
#ifdef ARCH_NRF52
|
||||||
@@ -581,10 +584,10 @@ void NodeDB::saveToDisk(int saveWhat)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const meshtastic_NodeInfo *NodeDB::readNextInfo()
|
const meshtastic_NodeInfo *NodeDB::readNextInfo(uint32_t &readIndex)
|
||||||
{
|
{
|
||||||
if (readPointer < *numNodes)
|
if (readIndex < *numNodes)
|
||||||
return &nodes[readPointer++];
|
return &nodes[readIndex++];
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -695,11 +698,11 @@ void NodeDB::updateTelemetry(uint32_t nodeId, const meshtastic_Telemetry &t, RxS
|
|||||||
|
|
||||||
/** Update user info for this node based on received user data
|
/** Update user info for this node based on received user data
|
||||||
*/
|
*/
|
||||||
void NodeDB::updateUser(uint32_t nodeId, const meshtastic_User &p)
|
bool NodeDB::updateUser(uint32_t nodeId, const meshtastic_User &p)
|
||||||
{
|
{
|
||||||
meshtastic_NodeInfo *info = getOrCreateNode(nodeId);
|
meshtastic_NodeInfo *info = getOrCreateNode(nodeId);
|
||||||
if (!info) {
|
if (!info) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DEBUG("old user %s/%s/%s\n", info->user.id, info->user.long_name, info->user.short_name);
|
LOG_DEBUG("old user %s/%s/%s\n", info->user.id, info->user.long_name, info->user.short_name);
|
||||||
@@ -716,10 +719,11 @@ void NodeDB::updateUser(uint32_t nodeId, const meshtastic_User &p)
|
|||||||
powerFSM.trigger(EVENT_NODEDB_UPDATED);
|
powerFSM.trigger(EVENT_NODEDB_UPDATED);
|
||||||
notifyObservers(true); // Force an update whether or not our node counts have changed
|
notifyObservers(true); // Force an update whether or not our node counts have changed
|
||||||
|
|
||||||
// Not really needed - we will save anyways when we go to sleep
|
|
||||||
// We just changed something important about the user, store our DB
|
// We just changed something important about the user, store our DB
|
||||||
// saveToDisk();
|
saveToDisk(SEGMENT_DEVICESTATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// given a subpacket sniffed from the network, update our DB state
|
/// given a subpacket sniffed from the network, update our DB state
|
||||||
@@ -727,7 +731,7 @@ void NodeDB::updateUser(uint32_t nodeId, const meshtastic_User &p)
|
|||||||
void NodeDB::updateFrom(const meshtastic_MeshPacket &mp)
|
void NodeDB::updateFrom(const meshtastic_MeshPacket &mp)
|
||||||
{
|
{
|
||||||
if (mp.which_payload_variant == meshtastic_MeshPacket_decoded_tag && mp.from) {
|
if (mp.which_payload_variant == meshtastic_MeshPacket_decoded_tag && mp.from) {
|
||||||
LOG_DEBUG("Update DB node 0x%x, rx_time=%u\n", mp.from, mp.rx_time);
|
LOG_DEBUG("Update DB node 0x%x, rx_time=%u, channel=%d\n", mp.from, mp.rx_time, mp.channel);
|
||||||
|
|
||||||
meshtastic_NodeInfo *info = getOrCreateNode(getFrom(&mp));
|
meshtastic_NodeInfo *info = getOrCreateNode(getFrom(&mp));
|
||||||
if (!info) {
|
if (!info) {
|
||||||
@@ -739,9 +743,22 @@ void NodeDB::updateFrom(const meshtastic_MeshPacket &mp)
|
|||||||
|
|
||||||
if (mp.rx_snr)
|
if (mp.rx_snr)
|
||||||
info->snr = mp.rx_snr; // keep the most recent SNR we received for this node.
|
info->snr = mp.rx_snr; // keep the most recent SNR we received for this node.
|
||||||
|
|
||||||
|
if (mp.decoded.portnum == meshtastic_PortNum_NODEINFO_APP) {
|
||||||
|
info->channel = mp.channel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t NodeDB::getNodeChannel(NodeNum n)
|
||||||
|
{
|
||||||
|
meshtastic_NodeInfo *info = getNode(n);
|
||||||
|
if (!info) {
|
||||||
|
return 0; // defaults to PRIMARY
|
||||||
|
}
|
||||||
|
return info->channel;
|
||||||
|
}
|
||||||
|
|
||||||
/// Find a node in our DB, return null for missing
|
/// Find a node in our DB, return null for missing
|
||||||
/// NOTE: This function might be called from an ISR
|
/// NOTE: This function might be called from an ISR
|
||||||
meshtastic_NodeInfo *NodeDB::getNode(NodeNum n)
|
meshtastic_NodeInfo *NodeDB::getNode(NodeNum n)
|
||||||
@@ -759,7 +776,7 @@ meshtastic_NodeInfo *NodeDB::getOrCreateNode(NodeNum n)
|
|||||||
meshtastic_NodeInfo *info = getNode(n);
|
meshtastic_NodeInfo *info = getNode(n);
|
||||||
|
|
||||||
if (!info) {
|
if (!info) {
|
||||||
if (*numNodes >= MAX_NUM_NODES) {
|
if ((*numNodes >= MAX_NUM_NODES) || (memGet.getFreeHeap() < meshtastic_NodeInfo_size * 3)) {
|
||||||
screen->print("warning: node_db full! erasing oldest entry\n");
|
screen->print("warning: node_db full! erasing oldest entry\n");
|
||||||
// look for oldest node and erase it
|
// look for oldest node and erase it
|
||||||
uint32_t oldest = UINT32_MAX;
|
uint32_t oldest = UINT32_MAX;
|
||||||
@@ -793,10 +810,11 @@ void recordCriticalError(meshtastic_CriticalErrorCode code, uint32_t address, co
|
|||||||
// Print error to screen and serial port
|
// Print error to screen and serial port
|
||||||
String lcd = String("Critical error ") + code + "!\n";
|
String lcd = String("Critical error ") + code + "!\n";
|
||||||
screen->print(lcd.c_str());
|
screen->print(lcd.c_str());
|
||||||
if (filename)
|
if (filename) {
|
||||||
LOG_ERROR("NOTE! Recording critical error %d at %s:%lu\n", code, filename, address);
|
LOG_ERROR("NOTE! Recording critical error %d at %s:%lu\n", code, filename, address);
|
||||||
else
|
} else {
|
||||||
LOG_ERROR("NOTE! Recording critical error %d, address=0x%lx\n", code, address);
|
LOG_ERROR("NOTE! Recording critical error %d, address=0x%lx\n", code, address);
|
||||||
|
}
|
||||||
|
|
||||||
// Record error to DB
|
// Record error to DB
|
||||||
myNodeInfo.error_code = code;
|
myNodeInfo.error_code = code;
|
||||||
|
|||||||
@@ -46,8 +46,6 @@ class NodeDB
|
|||||||
meshtastic_NodeInfo *nodes;
|
meshtastic_NodeInfo *nodes;
|
||||||
pb_size_t *numNodes;
|
pb_size_t *numNodes;
|
||||||
|
|
||||||
uint32_t readPointer = 0;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool updateGUI = false; // we think the gui should definitely be redrawn, screen will clear this once handled
|
bool updateGUI = false; // we think the gui should definitely be redrawn, screen will clear this once handled
|
||||||
meshtastic_NodeInfo *updateGUIforNode = NULL; // if currently showing this node, we think you should update the GUI
|
meshtastic_NodeInfo *updateGUIforNode = NULL; // if currently showing this node, we think you should update the GUI
|
||||||
@@ -86,7 +84,7 @@ class NodeDB
|
|||||||
|
|
||||||
/** Update user info for this node based on received user data
|
/** Update user info for this node based on received user data
|
||||||
*/
|
*/
|
||||||
void updateUser(uint32_t nodeId, const meshtastic_User &p);
|
bool updateUser(uint32_t nodeId, const meshtastic_User &p);
|
||||||
|
|
||||||
/// @return our node number
|
/// @return our node number
|
||||||
NodeNum getNodeNum() { return myNodeInfo.my_node_num; }
|
NodeNum getNodeNum() { return myNodeInfo.my_node_num; }
|
||||||
@@ -104,15 +102,15 @@ class NodeDB
|
|||||||
their denial?)
|
their denial?)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/// Called from bluetooth when the user wants to start reading the node DB from scratch.
|
|
||||||
void resetReadPointer() { readPointer = 0; }
|
|
||||||
|
|
||||||
/// Allow the bluetooth layer to read our next nodeinfo record, or NULL if done reading
|
/// Allow the bluetooth layer to read our next nodeinfo record, or NULL if done reading
|
||||||
const meshtastic_NodeInfo *readNextInfo();
|
const meshtastic_NodeInfo *readNextInfo(uint32_t &readIndex);
|
||||||
|
|
||||||
/// pick a provisional nodenum we hope no one is using
|
/// pick a provisional nodenum we hope no one is using
|
||||||
void pickNewNodeNum();
|
void pickNewNodeNum();
|
||||||
|
|
||||||
|
// get channel channel index we heard a nodeNum on, defaults to 0 if not found
|
||||||
|
uint8_t getNodeChannel(NodeNum n);
|
||||||
|
|
||||||
/// Find a node in our DB, return null for missing
|
/// Find a node in our DB, return null for missing
|
||||||
meshtastic_NodeInfo *getNode(NodeNum n);
|
meshtastic_NodeInfo *getNode(NodeNum n);
|
||||||
|
|
||||||
@@ -153,12 +151,6 @@ class NodeDB
|
|||||||
void installDefaultDeviceState(), installDefaultChannels(), installDefaultConfig(), installDefaultModuleConfig();
|
void installDefaultDeviceState(), installDefaultChannels(), installDefaultConfig(), installDefaultModuleConfig();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* The node number the user is currently looking at
|
|
||||||
* 0 if none
|
|
||||||
*/
|
|
||||||
extern NodeNum displayedNodeNum;
|
|
||||||
|
|
||||||
extern NodeDB nodeDB;
|
extern NodeDB nodeDB;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -220,6 +212,13 @@ inline uint32_t getConfiguredOrDefaultMs(uint32_t configuredInterval, uint32_t d
|
|||||||
return defaultInterval * 1000;
|
return defaultInterval * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Sometimes we will have Position objects that only have a time, so check for
|
||||||
|
/// valid lat/lon
|
||||||
|
static inline bool hasValidPosition(const meshtastic_NodeInfo *n)
|
||||||
|
{
|
||||||
|
return n->has_position && (n->position.latitude_i != 0 || n->position.longitude_i != 0);
|
||||||
|
}
|
||||||
|
|
||||||
/** The current change # for radio settings. Starts at 0 on boot and any time the radio settings
|
/** The current change # for radio settings. Starts at 0 on boot and any time the radio settings
|
||||||
* might have changed is incremented. Allows others to detect they might now be on a new channel.
|
* might have changed is incremented. Allows others to detect they might now be on a new channel.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -40,9 +40,8 @@ void PhoneAPI::handleStartConfig()
|
|||||||
state = STATE_SEND_MY_INFO;
|
state = STATE_SEND_MY_INFO;
|
||||||
|
|
||||||
LOG_INFO("Starting API client config\n");
|
LOG_INFO("Starting API client config\n");
|
||||||
nodeInfoForPhone = NULL; // Don't keep returning old nodeinfos
|
nodeInfoForPhone = NULL; // Don't keep returning old nodeinfos
|
||||||
nodeDB.resetReadPointer(); // FIXME, this read pointer should be moved out of nodeDB and into this class - because
|
resetReadIndex();
|
||||||
// this will break once we have multiple instances of PhoneAPI running independently
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhoneAPI::close()
|
void PhoneAPI::close()
|
||||||
@@ -373,7 +372,7 @@ bool PhoneAPI::available()
|
|||||||
|
|
||||||
case STATE_SEND_NODEINFO:
|
case STATE_SEND_NODEINFO:
|
||||||
if (!nodeInfoForPhone)
|
if (!nodeInfoForPhone)
|
||||||
nodeInfoForPhone = nodeDB.readNextInfo();
|
nodeInfoForPhone = nodeDB.readNextInfo(readIndex);
|
||||||
return true; // Always say we have something, because we might need to advance our state machine
|
return true; // Always say we have something, because we might need to advance our state machine
|
||||||
|
|
||||||
case STATE_SEND_PACKETS: {
|
case STATE_SEND_PACKETS: {
|
||||||
@@ -423,8 +422,9 @@ int PhoneAPI::onNotify(uint32_t newValue)
|
|||||||
if (state == STATE_SEND_PACKETS) {
|
if (state == STATE_SEND_PACKETS) {
|
||||||
LOG_INFO("Telling client we have new packets %u\n", newValue);
|
LOG_INFO("Telling client we have new packets %u\n", newValue);
|
||||||
onNowHasData(newValue);
|
onNowHasData(newValue);
|
||||||
} else
|
} else {
|
||||||
LOG_DEBUG("(Client not yet interested in packets)\n");
|
LOG_DEBUG("(Client not yet interested in packets)\n");
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ class PhoneAPI
|
|||||||
|
|
||||||
/// Use to ensure that clients don't get confused about old messages from the radio
|
/// Use to ensure that clients don't get confused about old messages from the radio
|
||||||
uint32_t config_nonce = 0;
|
uint32_t config_nonce = 0;
|
||||||
|
uint32_t readIndex = 0;
|
||||||
|
|
||||||
|
void resetReadIndex() { readIndex = 0; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PhoneAPI();
|
PhoneAPI();
|
||||||
|
|||||||
@@ -11,11 +11,11 @@
|
|||||||
|
|
||||||
#define POWER_DEFAULT 17 // How much power to use if the user hasn't set a power level
|
#define POWER_DEFAULT 17 // How much power to use if the user hasn't set a power level
|
||||||
|
|
||||||
RF95Interface::RF95Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy,
|
RF95Interface::RF95Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||||
SPIClass &spi)
|
RADIOLIB_PIN_TYPE busy)
|
||||||
: RadioLibInterface(cs, irq, rst, busy, spi)
|
: RadioLibInterface(hal, cs, irq, rst, busy)
|
||||||
{
|
{
|
||||||
// FIXME - we assume devices never get destroyed
|
LOG_WARN("RF95Interface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Some boards require GPIO control of tx vs rx paths */
|
/** Some boards require GPIO control of tx vs rx paths */
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ class RF95Interface : public RadioLibInterface
|
|||||||
RadioLibRF95 *lora = NULL; // Either a RFM95 or RFM96 depending on what was stuffed on this board
|
RadioLibRF95 *lora = NULL; // Either a RFM95 or RFM96 depending on what was stuffed on this board
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RF95Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi);
|
RF95Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||||
|
RADIOLIB_PIN_TYPE busy);
|
||||||
|
|
||||||
// TODO: Verify that this irq flag works with RFM95 / SX1276 radios the way it used to
|
// TODO: Verify that this irq flag works with RFM95 / SX1276 radios the way it used to
|
||||||
bool isIRQPending() override { return lora->getIRQFlags() & RADIOLIB_SX127X_MASK_IRQ_FLAG_VALID_HEADER; }
|
bool isIRQPending() override { return lora->getIRQFlags() & RADIOLIB_SX127X_MASK_IRQ_FLAG_VALID_HEADER; }
|
||||||
@@ -39,7 +40,7 @@ class RF95Interface : public RadioLibInterface
|
|||||||
/**
|
/**
|
||||||
* Enable a particular ISR callback glue function
|
* Enable a particular ISR callback glue function
|
||||||
*/
|
*/
|
||||||
virtual void enableInterrupt(void (*callback)()) { lora->setDio0Action(callback); }
|
virtual void enableInterrupt(void (*callback)()) { lora->setDio0Action(callback, RISING); }
|
||||||
|
|
||||||
/** can we detect a LoRa preamble on the current channel? */
|
/** can we detect a LoRa preamble on the current channel? */
|
||||||
virtual bool isChannelActive() override;
|
virtual bool isChannelActive() override;
|
||||||
|
|||||||
@@ -241,6 +241,7 @@ uint32_t RadioInterface::getTxDelayMsecWeighted(float snr)
|
|||||||
|
|
||||||
void printPacket(const char *prefix, const meshtastic_MeshPacket *p)
|
void printPacket(const char *prefix, const meshtastic_MeshPacket *p)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_PORT
|
||||||
std::string out = DEBUG_PORT.mt_sprintf("%s (id=0x%08x fr=0x%02x to=0x%02x, WantAck=%d, HopLim=%d Ch=0x%x", prefix, p->id,
|
std::string out = DEBUG_PORT.mt_sprintf("%s (id=0x%08x fr=0x%02x to=0x%02x, WantAck=%d, HopLim=%d Ch=0x%x", prefix, p->id,
|
||||||
p->from & 0xff, p->to & 0xff, p->want_ack, p->hop_limit, p->channel);
|
p->from & 0xff, p->to & 0xff, p->want_ack, p->hop_limit, p->channel);
|
||||||
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
|
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
|
||||||
@@ -281,8 +282,9 @@ void printPacket(const char *prefix, const meshtastic_MeshPacket *p)
|
|||||||
if (p->priority != 0)
|
if (p->priority != 0)
|
||||||
out += DEBUG_PORT.mt_sprintf(" priority=%d", p->priority);
|
out += DEBUG_PORT.mt_sprintf(" priority=%d", p->priority);
|
||||||
|
|
||||||
out += ")\n";
|
out += ")";
|
||||||
LOG_DEBUG("%s", out.c_str());
|
LOG_DEBUG("%s\n", out.c_str());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
RadioInterface::RadioInterface()
|
RadioInterface::RadioInterface()
|
||||||
|
|||||||
@@ -9,26 +9,23 @@
|
|||||||
#include <pb_decode.h>
|
#include <pb_decode.h>
|
||||||
#include <pb_encode.h>
|
#include <pb_encode.h>
|
||||||
|
|
||||||
// FIXME, we default to 4MHz SPI, SPI mode 0, check if the datasheet says it can really do that
|
void LockingArduinoHal::spiBeginTransaction()
|
||||||
static SPISettings spiSettings(4000000, MSBFIRST, SPI_MODE0);
|
|
||||||
|
|
||||||
void LockingModule::SPIbeginTransaction()
|
|
||||||
{
|
{
|
||||||
spiLock->lock();
|
spiLock->lock();
|
||||||
|
|
||||||
Module::SPIbeginTransaction();
|
ArduinoHal::spiBeginTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LockingModule::SPIendTransaction()
|
void LockingArduinoHal::spiEndTransaction()
|
||||||
{
|
{
|
||||||
spiLock->unlock();
|
spiLock->unlock();
|
||||||
|
|
||||||
Module::SPIendTransaction();
|
ArduinoHal::spiEndTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
RadioLibInterface::RadioLibInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy,
|
RadioLibInterface::RadioLibInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||||
SPIClass &spi, PhysicalLayer *_iface)
|
RADIOLIB_PIN_TYPE busy, PhysicalLayer *_iface)
|
||||||
: NotifiedWorkerThread("RadioIf"), module(cs, irq, rst, busy, spi, spiSettings), iface(_iface)
|
: NotifiedWorkerThread("RadioIf"), module(hal, cs, irq, rst, busy), iface(_iface)
|
||||||
{
|
{
|
||||||
instance = this;
|
instance = this;
|
||||||
#if defined(ARCH_STM32WL) && defined(USE_SX1262)
|
#if defined(ARCH_STM32WL) && defined(USE_SX1262)
|
||||||
@@ -81,8 +78,9 @@ bool RadioLibInterface::canSendImmediately()
|
|||||||
bool busyRx = isReceiving && isActivelyReceiving();
|
bool busyRx = isReceiving && isActivelyReceiving();
|
||||||
|
|
||||||
if (busyTx || busyRx) {
|
if (busyTx || busyRx) {
|
||||||
if (busyTx)
|
if (busyTx) {
|
||||||
LOG_WARN("Can not send yet, busyTx\n");
|
LOG_WARN("Can not send yet, busyTx\n");
|
||||||
|
}
|
||||||
// If we've been trying to send the same packet more than one minute and we haven't gotten a
|
// If we've been trying to send the same packet more than one minute and we haven't gotten a
|
||||||
// TX IRQ from the radio, the radio is probably broken.
|
// TX IRQ from the radio, the radio is probably broken.
|
||||||
if (busyTx && (millis() - lastTxStart > 60000)) {
|
if (busyTx && (millis() - lastTxStart > 60000)) {
|
||||||
@@ -91,8 +89,9 @@ bool RadioLibInterface::canSendImmediately()
|
|||||||
// reboot in 5 seconds when this condition occurs.
|
// reboot in 5 seconds when this condition occurs.
|
||||||
rebootAtMsec = lastTxStart + 65000;
|
rebootAtMsec = lastTxStart + 65000;
|
||||||
}
|
}
|
||||||
if (busyRx)
|
if (busyRx) {
|
||||||
LOG_WARN("Can not send yet, busyRx\n");
|
LOG_WARN("Can not send yet, busyRx\n");
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
} else
|
} else
|
||||||
return true;
|
return true;
|
||||||
@@ -167,9 +166,9 @@ meshtastic_QueueStatus RadioLibInterface::getQueueStatus()
|
|||||||
bool RadioLibInterface::canSleep()
|
bool RadioLibInterface::canSleep()
|
||||||
{
|
{
|
||||||
bool res = txQueue.empty();
|
bool res = txQueue.empty();
|
||||||
if (!res) // only print debug messages if we are vetoing sleep
|
if (!res) { // only print debug messages if we are vetoing sleep
|
||||||
LOG_DEBUG("radio wait to sleep, txEmpty=%d\n", res);
|
LOG_DEBUG("radio wait to sleep, txEmpty=%d\n", res);
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -407,4 +406,4 @@ void RadioLibInterface::startSend(meshtastic_MeshPacket *txp)
|
|||||||
// bits
|
// bits
|
||||||
enableInterrupt(isrTxLevel0);
|
enableInterrupt(isrTxLevel0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,37 +13,33 @@
|
|||||||
#define INTERRUPT_ATTR
|
#define INTERRUPT_ATTR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define RADIOLIB_PIN_TYPE uint32_t
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A wrapper for the RadioLib Module class, that adds mutex for SPI bus access
|
* We need to override the RadioLib ArduinoHal class to add mutex protection for SPI bus access
|
||||||
*/
|
*/
|
||||||
class LockingModule : public Module
|
class LockingArduinoHal : public ArduinoHal
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/*!
|
LockingArduinoHal(SPIClass &spi, SPISettings spiSettings) : ArduinoHal(spi, spiSettings){};
|
||||||
\brief Extended SPI-based module constructor.
|
|
||||||
|
|
||||||
\param cs Arduino pin to be used as chip select.
|
void spiBeginTransaction() override;
|
||||||
|
void spiEndTransaction() override;
|
||||||
\param irq Arduino pin to be used as interrupt/GPIO.
|
|
||||||
|
|
||||||
\param rst Arduino pin to be used as hardware reset for the module.
|
|
||||||
|
|
||||||
\param gpio Arduino pin to be used as additional interrupt/GPIO.
|
|
||||||
|
|
||||||
\param spi SPI interface to be used, can also use software SPI implementations.
|
|
||||||
|
|
||||||
\param spiSettings SPI interface settings.
|
|
||||||
*/
|
|
||||||
LockingModule(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE gpio, SPIClass &spi,
|
|
||||||
SPISettings spiSettings)
|
|
||||||
: Module(cs, irq, rst, gpio, spi, spiSettings)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void SPIbeginTransaction() override;
|
|
||||||
void SPIendTransaction() override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(USE_STM32WLx)
|
||||||
|
/**
|
||||||
|
* A wrapper for the RadioLib STM32WLx_Module class, that doesn't connect any pins as they are virtual
|
||||||
|
*/
|
||||||
|
class STM32WLx_ModuleWrapper : public STM32WLx_Module
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
STM32WLx_ModuleWrapper(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||||
|
RADIOLIB_PIN_TYPE busy)
|
||||||
|
: STM32WLx_Module(){};
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
class RadioLibInterface : public RadioInterface, protected concurrency::NotifiedWorkerThread
|
class RadioLibInterface : public RadioInterface, protected concurrency::NotifiedWorkerThread
|
||||||
{
|
{
|
||||||
/// Used as our notification from the ISR
|
/// Used as our notification from the ISR
|
||||||
@@ -73,7 +69,11 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified
|
|||||||
|
|
||||||
float currentLimit = 100; // 100mA OCP - Should be acceptable for RFM95/SX127x chipset.
|
float currentLimit = 100; // 100mA OCP - Should be acceptable for RFM95/SX127x chipset.
|
||||||
|
|
||||||
LockingModule module; // The HW interface to the radio
|
#if !defined(USE_STM32WLx)
|
||||||
|
Module module; // The HW interface to the radio
|
||||||
|
#else
|
||||||
|
STM32WLx_ModuleWrapper module;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* provides lowest common denominator RadioLib API
|
* provides lowest common denominator RadioLib API
|
||||||
@@ -99,8 +99,8 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified
|
|||||||
virtual void enableInterrupt(void (*)()) = 0;
|
virtual void enableInterrupt(void (*)()) = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RadioLibInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi,
|
RadioLibInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||||
PhysicalLayer *iface = NULL);
|
RADIOLIB_PIN_TYPE busy, PhysicalLayer *iface = NULL);
|
||||||
|
|
||||||
virtual ErrorCode send(meshtastic_MeshPacket *p) override;
|
virtual ErrorCode send(meshtastic_MeshPacket *p) override;
|
||||||
|
|
||||||
|
|||||||
@@ -79,5 +79,5 @@ bool RadioLibRF95::isReceiving()
|
|||||||
|
|
||||||
uint8_t RadioLibRF95::readReg(uint8_t addr)
|
uint8_t RadioLibRF95::readReg(uint8_t addr)
|
||||||
{
|
{
|
||||||
return _mod->SPIreadRegister(addr);
|
return mod->SPIreadRegister(addr);
|
||||||
}
|
}
|
||||||
@@ -104,13 +104,14 @@ void ReliableRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas
|
|||||||
|
|
||||||
if (p->to == ourNode) { // ignore ack/nak/want_ack packets that are not address to us (we only handle 0 hop reliability)
|
if (p->to == ourNode) { // ignore ack/nak/want_ack packets that are not address to us (we only handle 0 hop reliability)
|
||||||
if (p->want_ack) {
|
if (p->want_ack) {
|
||||||
if (MeshModule::currentReply)
|
if (MeshModule::currentReply) {
|
||||||
LOG_DEBUG("Some other module has replied to this message, no need for a 2nd ack\n");
|
LOG_DEBUG("Some other module has replied to this message, no need for a 2nd ack\n");
|
||||||
else if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag)
|
} else if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
|
||||||
sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, p->channel);
|
sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, p->channel);
|
||||||
else
|
} else {
|
||||||
// Send a 'NO_CHANNEL' error on the primary channel if want_ack packet destined for us cannot be decoded
|
// Send a 'NO_CHANNEL' error on the primary channel if want_ack packet destined for us cannot be decoded
|
||||||
sendAckNak(meshtastic_Routing_Error_NO_CHANNEL, getFrom(p), p->id, channels.getPrimaryIndex());
|
sendAckNak(meshtastic_Routing_Error_NO_CHANNEL, getFrom(p), p->id, channels.getPrimaryIndex());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We consider an ack to be either a !routing packet with a request ID or a routing packet with !error
|
// We consider an ack to be either a !routing packet with a request ID or a routing packet with !error
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ Router::Router() : concurrency::OSThread("Router"), fromRadioQueue(MAX_RX_FROMRA
|
|||||||
LOG_DEBUG("Size of MeshPacket %d\n", sizeof(MeshPacket)); */
|
LOG_DEBUG("Size of MeshPacket %d\n", sizeof(MeshPacket)); */
|
||||||
|
|
||||||
fromRadioQueue.setReader(this);
|
fromRadioQueue.setReader(this);
|
||||||
|
|
||||||
|
// init Lockguard for crypt operations
|
||||||
|
assert(!cryptLock);
|
||||||
|
cryptLock = new concurrency::Lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -173,6 +177,11 @@ ErrorCode Router::sendLocal(meshtastic_MeshPacket *p, RxSource src)
|
|||||||
handleReceived(p, src);
|
handleReceived(p, src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!p->channel) { // don't override if a channel was requested
|
||||||
|
p->channel = nodeDB.getNodeChannel(p->to);
|
||||||
|
LOG_DEBUG("localSend to channel %d\n", p->channel);
|
||||||
|
}
|
||||||
|
|
||||||
return send(p);
|
return send(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,8 +211,10 @@ ErrorCode Router::send(meshtastic_MeshPacket *p)
|
|||||||
if (!config.lora.override_duty_cycle && myRegion->dutyCycle < 100) {
|
if (!config.lora.override_duty_cycle && myRegion->dutyCycle < 100) {
|
||||||
float hourlyTxPercent = airTime->utilizationTXPercent();
|
float hourlyTxPercent = airTime->utilizationTXPercent();
|
||||||
if (hourlyTxPercent > myRegion->dutyCycle) {
|
if (hourlyTxPercent > myRegion->dutyCycle) {
|
||||||
|
#ifdef DEBUG_PORT
|
||||||
uint8_t silentMinutes = airTime->getSilentMinutes(hourlyTxPercent, myRegion->dutyCycle);
|
uint8_t silentMinutes = airTime->getSilentMinutes(hourlyTxPercent, myRegion->dutyCycle);
|
||||||
LOG_WARN("Duty cycle limit exceeded. Aborting send for now, you can send again in %d minutes.\n", silentMinutes);
|
LOG_WARN("Duty cycle limit exceeded. Aborting send for now, you can send again in %d minutes.\n", silentMinutes);
|
||||||
|
#endif
|
||||||
meshtastic_Routing_Error err = meshtastic_Routing_Error_DUTY_CYCLE_LIMIT;
|
meshtastic_Routing_Error err = meshtastic_Routing_Error_DUTY_CYCLE_LIMIT;
|
||||||
if (getFrom(p) == nodeDB.getNodeNum()) { // only send NAK to API, not to the mesh
|
if (getFrom(p) == nodeDB.getNodeNum()) { // only send NAK to API, not to the mesh
|
||||||
abortSendAndNak(err, p);
|
abortSendAndNak(err, p);
|
||||||
@@ -300,6 +311,8 @@ void Router::sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Rout
|
|||||||
|
|
||||||
bool perhapsDecode(meshtastic_MeshPacket *p)
|
bool perhapsDecode(meshtastic_MeshPacket *p)
|
||||||
{
|
{
|
||||||
|
concurrency::LockGuard g(cryptLock);
|
||||||
|
|
||||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER &&
|
if (config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER &&
|
||||||
config.device.rebroadcast_mode == meshtastic_Config_DeviceConfig_RebroadcastMode_ALL_SKIP_DECODING)
|
config.device.rebroadcast_mode == meshtastic_Config_DeviceConfig_RebroadcastMode_ALL_SKIP_DECODING)
|
||||||
return false;
|
return false;
|
||||||
@@ -366,6 +379,8 @@ bool perhapsDecode(meshtastic_MeshPacket *p)
|
|||||||
*/
|
*/
|
||||||
meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p)
|
meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p)
|
||||||
{
|
{
|
||||||
|
concurrency::LockGuard g(cryptLock);
|
||||||
|
|
||||||
// If the packet is not yet encrypted, do so now
|
// If the packet is not yet encrypted, do so now
|
||||||
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
|
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
|
||||||
size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), &meshtastic_Data_msg, &p->decoded);
|
size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), &meshtastic_Data_msg, &p->decoded);
|
||||||
@@ -466,9 +481,9 @@ void Router::perhapsHandleReceived(meshtastic_MeshPacket *p)
|
|||||||
// assert(radioConfig.has_preferences);
|
// assert(radioConfig.has_preferences);
|
||||||
bool ignore = is_in_repeated(config.lora.ignore_incoming, p->from);
|
bool ignore = is_in_repeated(config.lora.ignore_incoming, p->from);
|
||||||
|
|
||||||
if (ignore)
|
if (ignore) {
|
||||||
LOG_DEBUG("Ignoring incoming message, 0x%x is in our ignore list\n", p->from);
|
LOG_DEBUG("Ignoring incoming message, 0x%x is in our ignore list\n", p->from);
|
||||||
else if (ignore |= shouldFilterReceived(p)) {
|
} else if (ignore |= shouldFilterReceived(p)) {
|
||||||
LOG_DEBUG("Incoming message was filtered 0x%x\n", p->from);
|
LOG_DEBUG("Incoming message was filtered 0x%x\n", p->from);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
45
src/mesh/STM32WLE5JCInterface.cpp
Normal file
45
src/mesh/STM32WLE5JCInterface.cpp
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
#include "STM32WLE5JCInterface.h"
|
||||||
|
#include "configuration.h"
|
||||||
|
#include "error.h"
|
||||||
|
|
||||||
|
#ifndef STM32WLx_MAX_POWER
|
||||||
|
#define STM32WLx_MAX_POWER 22
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ARCH_STM32WL
|
||||||
|
|
||||||
|
STM32WLE5JCInterface::STM32WLE5JCInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq,
|
||||||
|
RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy)
|
||||||
|
: SX126xInterface(hal, cs, irq, rst, busy)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool STM32WLE5JCInterface::init()
|
||||||
|
{
|
||||||
|
RadioLibInterface::init();
|
||||||
|
|
||||||
|
lora.setRfSwitchTable(rfswitch_pins, rfswitch_table);
|
||||||
|
|
||||||
|
if (power == 0)
|
||||||
|
power = STM32WLx_MAX_POWER;
|
||||||
|
|
||||||
|
if (power > STM32WLx_MAX_POWER) // This chip has lower power limits than some
|
||||||
|
power = STM32WLx_MAX_POWER;
|
||||||
|
|
||||||
|
limitPower();
|
||||||
|
|
||||||
|
int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength, tcxoVoltage);
|
||||||
|
|
||||||
|
LOG_INFO("STM32WLx init result %d\n", res);
|
||||||
|
|
||||||
|
LOG_INFO("Frequency set to %f\n", getFreq());
|
||||||
|
LOG_INFO("Bandwidth set to %f\n", bw);
|
||||||
|
LOG_INFO("Power output set to %d\n", power);
|
||||||
|
|
||||||
|
if (res == RADIOLIB_ERR_NONE)
|
||||||
|
startReceive(); // start receiving
|
||||||
|
|
||||||
|
return res == RADIOLIB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // ARCH_STM32WL
|
||||||
31
src/mesh/STM32WLE5JCInterface.h
Normal file
31
src/mesh/STM32WLE5JCInterface.h
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "SX126xInterface.h"
|
||||||
|
|
||||||
|
#ifdef ARCH_STM32WL
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Our adapter for STM32WLE5JC radios
|
||||||
|
*/
|
||||||
|
class STM32WLE5JCInterface : public SX126xInterface<STM32WLx>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
STM32WLE5JCInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||||
|
RADIOLIB_PIN_TYPE busy);
|
||||||
|
|
||||||
|
virtual bool init() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
// https://github.com/Seeed-Studio/LoRaWan-E5-Node/blob/main/Middlewares/Third_Party/SubGHz_Phy/stm32_radio_driver/radio_driver.c
|
||||||
|
static const float tcxoVoltage = 1.7;
|
||||||
|
|
||||||
|
/* https://wiki.seeedstudio.com/LoRa-E5_STM32WLE5JC_Module/
|
||||||
|
* Wio-E5 module ONLY transmits through RFO_HP
|
||||||
|
* Receive: PA4=1, PA5=0
|
||||||
|
* Transmit(high output power, SMPS mode): PA4=0, PA5=1 */
|
||||||
|
static const RADIOLIB_PIN_TYPE rfswitch_pins[3] = {PA4, PA5, RADIOLIB_NC};
|
||||||
|
|
||||||
|
static const Module::RfSwitchMode_t rfswitch_table[4] = {
|
||||||
|
{STM32WLx::MODE_IDLE, {LOW, LOW}}, {STM32WLx::MODE_RX, {HIGH, LOW}}, {STM32WLx::MODE_TX_HP, {LOW, HIGH}}, END_OF_MODE_TABLE};
|
||||||
|
|
||||||
|
#endif // ARCH_STM32WL
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
SX1262Interface::SX1262Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy,
|
SX1262Interface::SX1262Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||||
SPIClass &spi)
|
RADIOLIB_PIN_TYPE busy)
|
||||||
: SX126xInterface(cs, irq, rst, busy, spi)
|
: SX126xInterface(hal, cs, irq, rst, busy)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -8,5 +8,6 @@
|
|||||||
class SX1262Interface : public SX126xInterface<SX1262>
|
class SX1262Interface : public SX126xInterface<SX1262>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SX1262Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi);
|
SX1262Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||||
|
RADIOLIB_PIN_TYPE busy);
|
||||||
};
|
};
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
SX1268Interface::SX1268Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy,
|
SX1268Interface::SX1268Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||||
SPIClass &spi)
|
RADIOLIB_PIN_TYPE busy)
|
||||||
: SX126xInterface(cs, irq, rst, busy, spi)
|
: SX126xInterface(hal, cs, irq, rst, busy)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,5 +10,6 @@ class SX1268Interface : public SX126xInterface<SX1268>
|
|||||||
public:
|
public:
|
||||||
virtual float getFreq() override;
|
virtual float getFreq() override;
|
||||||
|
|
||||||
SX1268Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi);
|
SX1268Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||||
|
RADIOLIB_PIN_TYPE busy);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
SX126xInterface<T>::SX126xInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy,
|
SX126xInterface<T>::SX126xInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||||
SPIClass &spi)
|
RADIOLIB_PIN_TYPE busy)
|
||||||
: RadioLibInterface(cs, irq, rst, busy, spi, &lora), lora(&module)
|
: RadioLibInterface(hal, cs, irq, rst, busy, &lora), lora(&module)
|
||||||
{
|
{
|
||||||
LOG_WARN("SX126xInterface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy);
|
LOG_WARN("SX126xInterface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy);
|
||||||
}
|
}
|
||||||
@@ -60,16 +60,19 @@ template <typename T> bool SX126xInterface<T>::init()
|
|||||||
LOG_DEBUG("Current limit set to %f\n", currentLimit);
|
LOG_DEBUG("Current limit set to %f\n", currentLimit);
|
||||||
LOG_DEBUG("Current limit set result %d\n", res);
|
LOG_DEBUG("Current limit set result %d\n", res);
|
||||||
|
|
||||||
#ifdef SX126X_E22
|
#if defined(SX126X_E22)
|
||||||
// E22 Emulation explicitly requires DIO2 as RF switch, so set it to TRUE again for good measure. In case somebody defines
|
// E22 Emulation explicitly requires DIO2 as RF switch, so set it to TRUE again for good measure. In case somebody defines
|
||||||
// SX126X_TX for an E22 Module
|
// SX126X_TX for an E22 Module
|
||||||
if (res == RADIOLIB_ERR_NONE)
|
if (res == RADIOLIB_ERR_NONE) {
|
||||||
|
LOG_DEBUG("SX126X_E22 mode enabled. Setting DIO2 as RF Switch\n");
|
||||||
res = lora.setDio2AsRfSwitch(true);
|
res = lora.setDio2AsRfSwitch(true);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SX126X_TXEN) && (SX126X_TXEN != RADIOLIB_NC)
|
#if defined(SX126X_TXEN) && (SX126X_TXEN != RADIOLIB_NC)
|
||||||
// lora.begin sets Dio2 as RF switch control, which is not true if we are manually controlling RX and TX
|
// lora.begin sets Dio2 as RF switch control, which is not true if we are manually controlling RX and TX
|
||||||
if (res == RADIOLIB_ERR_NONE) {
|
if (res == RADIOLIB_ERR_NONE) {
|
||||||
|
LOG_DEBUG("SX126X_TX/RX EN pins defined. Setting RF Switch: RXEN=%i, TXEN=%i\n", SX126X_RXEN, SX126X_TXEN);
|
||||||
res = lora.setDio2AsRfSwitch(false);
|
res = lora.setDio2AsRfSwitch(false);
|
||||||
lora.setRfSwitchPins(SX126X_RXEN, SX126X_TXEN);
|
lora.setRfSwitchPins(SX126X_RXEN, SX126X_TXEN);
|
||||||
}
|
}
|
||||||
@@ -176,8 +179,9 @@ template <typename T> void SX126xInterface<T>::setStandby()
|
|||||||
|
|
||||||
int err = lora.standby();
|
int err = lora.standby();
|
||||||
|
|
||||||
if (err != RADIOLIB_ERR_NONE)
|
if (err != RADIOLIB_ERR_NONE) {
|
||||||
LOG_DEBUG("SX126x standby failed with error %d\n", err);
|
LOG_DEBUG("SX126x standby failed with error %d\n", err);
|
||||||
|
}
|
||||||
|
|
||||||
assert(err == RADIOLIB_ERR_NONE);
|
assert(err == RADIOLIB_ERR_NONE);
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
template <class T> class SX126xInterface : public RadioLibInterface
|
template <class T> class SX126xInterface : public RadioLibInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SX126xInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi);
|
SX126xInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||||
|
RADIOLIB_PIN_TYPE busy);
|
||||||
|
|
||||||
/// Initialise the Driver transport hardware and software.
|
/// Initialise the Driver transport hardware and software.
|
||||||
/// Make sure the Driver is properly configured before calling init().
|
/// Make sure the Driver is properly configured before calling init().
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
SX1280Interface::SX1280Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy,
|
SX1280Interface::SX1280Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||||
SPIClass &spi)
|
RADIOLIB_PIN_TYPE busy)
|
||||||
: SX128xInterface(cs, irq, rst, busy, spi)
|
: SX128xInterface(hal, cs, irq, rst, busy)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,5 +9,6 @@
|
|||||||
class SX1280Interface : public SX128xInterface<SX1280>
|
class SX1280Interface : public SX128xInterface<SX1280>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SX1280Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi);
|
SX1280Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||||
|
RADIOLIB_PIN_TYPE busy);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,10 +9,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
SX128xInterface<T>::SX128xInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy,
|
SX128xInterface<T>::SX128xInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||||
SPIClass &spi)
|
RADIOLIB_PIN_TYPE busy)
|
||||||
: RadioLibInterface(cs, irq, rst, busy, spi, &lora), lora(&module)
|
: RadioLibInterface(hal, cs, irq, rst, busy, &lora), lora(&module)
|
||||||
{
|
{
|
||||||
|
LOG_WARN("SX128xInterface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initialise the Driver transport hardware and software.
|
/// Initialise the Driver transport hardware and software.
|
||||||
@@ -73,6 +74,12 @@ template <typename T> bool SX128xInterface<T>::init()
|
|||||||
LOG_INFO("Bandwidth set to %f\n", bw);
|
LOG_INFO("Bandwidth set to %f\n", bw);
|
||||||
LOG_INFO("Power output set to %d\n", power);
|
LOG_INFO("Power output set to %d\n", power);
|
||||||
|
|
||||||
|
#if defined(SX128X_TXEN) && (SX128X_TXEN != RADIOLIB_NC) && defined(SX128X_RXEN) && (SX128X_RXEN != RADIOLIB_NC)
|
||||||
|
if (res == RADIOLIB_ERR_NONE) {
|
||||||
|
lora.setRfSwitchPins(SX128X_RXEN, SX128X_TXEN);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (res == RADIOLIB_ERR_NONE)
|
if (res == RADIOLIB_ERR_NONE)
|
||||||
res = lora.setCRC(2);
|
res = lora.setCRC(2);
|
||||||
|
|
||||||
@@ -144,8 +151,9 @@ template <typename T> void SX128xInterface<T>::setStandby()
|
|||||||
|
|
||||||
int err = lora.standby();
|
int err = lora.standby();
|
||||||
|
|
||||||
if (err != RADIOLIB_ERR_NONE)
|
if (err != RADIOLIB_ERR_NONE) {
|
||||||
LOG_ERROR("SX128x standby failed with error %d\n", err);
|
LOG_ERROR("SX128x standby failed with error %d\n", err);
|
||||||
|
}
|
||||||
|
|
||||||
assert(err == RADIOLIB_ERR_NONE);
|
assert(err == RADIOLIB_ERR_NONE);
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
template <class T> class SX128xInterface : public RadioLibInterface
|
template <class T> class SX128xInterface : public RadioLibInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SX128xInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi);
|
SX128xInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||||
|
RADIOLIB_PIN_TYPE busy);
|
||||||
|
|
||||||
/// Initialise the Driver transport hardware and software.
|
/// Initialise the Driver transport hardware and software.
|
||||||
/// Make sure the Driver is properly configured before calling init().
|
/// Make sure the Driver is properly configured before calling init().
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ template <class T> class TypedQueue
|
|||||||
concurrency::OSThread *reader = NULL;
|
concurrency::OSThread *reader = NULL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TypedQueue(int maxElements) {}
|
explicit TypedQueue(int maxElements) {}
|
||||||
|
|
||||||
int numFree() { return 1; } // Always claim 1 free, because we can grow to any size
|
int numFree() { return 1; } // Always claim 1 free, because we can grow to any size
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ PB_BIND(meshtastic_AdminMessage, meshtastic_AdminMessage, 2)
|
|||||||
PB_BIND(meshtastic_HamParameters, meshtastic_HamParameters, AUTO)
|
PB_BIND(meshtastic_HamParameters, meshtastic_HamParameters, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(meshtastic_NodeRemoteHardwarePinsResponse, meshtastic_NodeRemoteHardwarePinsResponse, 2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,10 @@
|
|||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
#include "meshtastic/channel.pb.h"
|
#include "meshtastic/channel.pb.h"
|
||||||
#include "meshtastic/config.pb.h"
|
#include "meshtastic/config.pb.h"
|
||||||
|
#include "meshtastic/connection_status.pb.h"
|
||||||
|
#include "meshtastic/deviceonly.pb.h"
|
||||||
#include "meshtastic/mesh.pb.h"
|
#include "meshtastic/mesh.pb.h"
|
||||||
#include "meshtastic/module_config.pb.h"
|
#include "meshtastic/module_config.pb.h"
|
||||||
#include "meshtastic/connection_status.pb.h"
|
|
||||||
|
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
@@ -70,6 +71,13 @@ typedef struct _meshtastic_HamParameters {
|
|||||||
char short_name[6];
|
char short_name[6];
|
||||||
} meshtastic_HamParameters;
|
} meshtastic_HamParameters;
|
||||||
|
|
||||||
|
/* Response envelope for node_remote_hardware_pins */
|
||||||
|
typedef struct _meshtastic_NodeRemoteHardwarePinsResponse {
|
||||||
|
/* Nodes and their respective remote hardware GPIO pins */
|
||||||
|
pb_size_t node_remote_hardware_pins_count;
|
||||||
|
meshtastic_NodeRemoteHardwarePin node_remote_hardware_pins[16];
|
||||||
|
} meshtastic_NodeRemoteHardwarePinsResponse;
|
||||||
|
|
||||||
/* This message is handled by the Admin module and is responsible for all settings/channel read/write operations.
|
/* This message is handled by the Admin module and is responsible for all settings/channel read/write operations.
|
||||||
This message is used to do settings operations to both remote AND local nodes.
|
This message is used to do settings operations to both remote AND local nodes.
|
||||||
(Prior to 1.2 these operations were done via special ToRadio operations) */
|
(Prior to 1.2 these operations were done via special ToRadio operations) */
|
||||||
@@ -111,6 +119,10 @@ typedef struct _meshtastic_AdminMessage {
|
|||||||
meshtastic_DeviceConnectionStatus get_device_connection_status_response;
|
meshtastic_DeviceConnectionStatus get_device_connection_status_response;
|
||||||
/* Setup a node for licensed amateur (ham) radio operation */
|
/* Setup a node for licensed amateur (ham) radio operation */
|
||||||
meshtastic_HamParameters set_ham_mode;
|
meshtastic_HamParameters set_ham_mode;
|
||||||
|
/* Get the mesh's nodes with their available gpio pins for RemoteHardware module use */
|
||||||
|
bool get_node_remote_hardware_pins_request;
|
||||||
|
/* Respond with the mesh's nodes with their available gpio pins for RemoteHardware module use */
|
||||||
|
meshtastic_NodeRemoteHardwarePinsResponse get_node_remote_hardware_pins_response;
|
||||||
/* Set the owner for this node */
|
/* Set the owner for this node */
|
||||||
meshtastic_User set_owner;
|
meshtastic_User set_owner;
|
||||||
/* Set channels (using the new API).
|
/* Set channels (using the new API).
|
||||||
@@ -168,17 +180,21 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define meshtastic_AdminMessage_init_default {0, {0}}
|
#define meshtastic_AdminMessage_init_default {0, {0}}
|
||||||
#define meshtastic_HamParameters_init_default {"", 0, 0, ""}
|
#define meshtastic_HamParameters_init_default {"", 0, 0, ""}
|
||||||
|
#define meshtastic_NodeRemoteHardwarePinsResponse_init_default {0, {meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default}}
|
||||||
#define meshtastic_AdminMessage_init_zero {0, {0}}
|
#define meshtastic_AdminMessage_init_zero {0, {0}}
|
||||||
#define meshtastic_HamParameters_init_zero {"", 0, 0, ""}
|
#define meshtastic_HamParameters_init_zero {"", 0, 0, ""}
|
||||||
|
#define meshtastic_NodeRemoteHardwarePinsResponse_init_zero {0, {meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero}}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
#define meshtastic_HamParameters_call_sign_tag 1
|
#define meshtastic_HamParameters_call_sign_tag 1
|
||||||
#define meshtastic_HamParameters_tx_power_tag 2
|
#define meshtastic_HamParameters_tx_power_tag 2
|
||||||
#define meshtastic_HamParameters_frequency_tag 3
|
#define meshtastic_HamParameters_frequency_tag 3
|
||||||
#define meshtastic_HamParameters_short_name_tag 4
|
#define meshtastic_HamParameters_short_name_tag 4
|
||||||
|
#define meshtastic_NodeRemoteHardwarePinsResponse_node_remote_hardware_pins_tag 1
|
||||||
#define meshtastic_AdminMessage_get_channel_request_tag 1
|
#define meshtastic_AdminMessage_get_channel_request_tag 1
|
||||||
#define meshtastic_AdminMessage_get_channel_response_tag 2
|
#define meshtastic_AdminMessage_get_channel_response_tag 2
|
||||||
#define meshtastic_AdminMessage_get_owner_request_tag 3
|
#define meshtastic_AdminMessage_get_owner_request_tag 3
|
||||||
@@ -196,6 +212,8 @@ extern "C" {
|
|||||||
#define meshtastic_AdminMessage_get_device_connection_status_request_tag 16
|
#define meshtastic_AdminMessage_get_device_connection_status_request_tag 16
|
||||||
#define meshtastic_AdminMessage_get_device_connection_status_response_tag 17
|
#define meshtastic_AdminMessage_get_device_connection_status_response_tag 17
|
||||||
#define meshtastic_AdminMessage_set_ham_mode_tag 18
|
#define meshtastic_AdminMessage_set_ham_mode_tag 18
|
||||||
|
#define meshtastic_AdminMessage_get_node_remote_hardware_pins_request_tag 19
|
||||||
|
#define meshtastic_AdminMessage_get_node_remote_hardware_pins_response_tag 20
|
||||||
#define meshtastic_AdminMessage_set_owner_tag 32
|
#define meshtastic_AdminMessage_set_owner_tag 32
|
||||||
#define meshtastic_AdminMessage_set_channel_tag 33
|
#define meshtastic_AdminMessage_set_channel_tag 33
|
||||||
#define meshtastic_AdminMessage_set_config_tag 34
|
#define meshtastic_AdminMessage_set_config_tag 34
|
||||||
@@ -230,6 +248,8 @@ X(a, STATIC, ONEOF, STRING, (payload_variant,get_ringtone_response,get_ri
|
|||||||
X(a, STATIC, ONEOF, BOOL, (payload_variant,get_device_connection_status_request,get_device_connection_status_request), 16) \
|
X(a, STATIC, ONEOF, BOOL, (payload_variant,get_device_connection_status_request,get_device_connection_status_request), 16) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,get_device_connection_status_response,get_device_connection_status_response), 17) \
|
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,get_device_connection_status_response,get_device_connection_status_response), 17) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,set_ham_mode,set_ham_mode), 18) \
|
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,set_ham_mode,set_ham_mode), 18) \
|
||||||
|
X(a, STATIC, ONEOF, BOOL, (payload_variant,get_node_remote_hardware_pins_request,get_node_remote_hardware_pins_request), 19) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,get_node_remote_hardware_pins_response,get_node_remote_hardware_pins_response), 20) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,set_owner,set_owner), 32) \
|
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,set_owner,set_owner), 32) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,set_channel,set_channel), 33) \
|
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,set_channel,set_channel), 33) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,set_config,set_config), 34) \
|
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,set_config,set_config), 34) \
|
||||||
@@ -253,6 +273,7 @@ X(a, STATIC, ONEOF, INT32, (payload_variant,nodedb_reset,nodedb_reset),
|
|||||||
#define meshtastic_AdminMessage_payload_variant_get_device_metadata_response_MSGTYPE meshtastic_DeviceMetadata
|
#define meshtastic_AdminMessage_payload_variant_get_device_metadata_response_MSGTYPE meshtastic_DeviceMetadata
|
||||||
#define meshtastic_AdminMessage_payload_variant_get_device_connection_status_response_MSGTYPE meshtastic_DeviceConnectionStatus
|
#define meshtastic_AdminMessage_payload_variant_get_device_connection_status_response_MSGTYPE meshtastic_DeviceConnectionStatus
|
||||||
#define meshtastic_AdminMessage_payload_variant_set_ham_mode_MSGTYPE meshtastic_HamParameters
|
#define meshtastic_AdminMessage_payload_variant_set_ham_mode_MSGTYPE meshtastic_HamParameters
|
||||||
|
#define meshtastic_AdminMessage_payload_variant_get_node_remote_hardware_pins_response_MSGTYPE meshtastic_NodeRemoteHardwarePinsResponse
|
||||||
#define meshtastic_AdminMessage_payload_variant_set_owner_MSGTYPE meshtastic_User
|
#define meshtastic_AdminMessage_payload_variant_set_owner_MSGTYPE meshtastic_User
|
||||||
#define meshtastic_AdminMessage_payload_variant_set_channel_MSGTYPE meshtastic_Channel
|
#define meshtastic_AdminMessage_payload_variant_set_channel_MSGTYPE meshtastic_Channel
|
||||||
#define meshtastic_AdminMessage_payload_variant_set_config_MSGTYPE meshtastic_Config
|
#define meshtastic_AdminMessage_payload_variant_set_config_MSGTYPE meshtastic_Config
|
||||||
@@ -266,16 +287,25 @@ X(a, STATIC, SINGULAR, STRING, short_name, 4)
|
|||||||
#define meshtastic_HamParameters_CALLBACK NULL
|
#define meshtastic_HamParameters_CALLBACK NULL
|
||||||
#define meshtastic_HamParameters_DEFAULT NULL
|
#define meshtastic_HamParameters_DEFAULT NULL
|
||||||
|
|
||||||
|
#define meshtastic_NodeRemoteHardwarePinsResponse_FIELDLIST(X, a) \
|
||||||
|
X(a, STATIC, REPEATED, MESSAGE, node_remote_hardware_pins, 1)
|
||||||
|
#define meshtastic_NodeRemoteHardwarePinsResponse_CALLBACK NULL
|
||||||
|
#define meshtastic_NodeRemoteHardwarePinsResponse_DEFAULT NULL
|
||||||
|
#define meshtastic_NodeRemoteHardwarePinsResponse_node_remote_hardware_pins_MSGTYPE meshtastic_NodeRemoteHardwarePin
|
||||||
|
|
||||||
extern const pb_msgdesc_t meshtastic_AdminMessage_msg;
|
extern const pb_msgdesc_t meshtastic_AdminMessage_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_HamParameters_msg;
|
extern const pb_msgdesc_t meshtastic_HamParameters_msg;
|
||||||
|
extern const pb_msgdesc_t meshtastic_NodeRemoteHardwarePinsResponse_msg;
|
||||||
|
|
||||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||||
#define meshtastic_AdminMessage_fields &meshtastic_AdminMessage_msg
|
#define meshtastic_AdminMessage_fields &meshtastic_AdminMessage_msg
|
||||||
#define meshtastic_HamParameters_fields &meshtastic_HamParameters_msg
|
#define meshtastic_HamParameters_fields &meshtastic_HamParameters_msg
|
||||||
|
#define meshtastic_NodeRemoteHardwarePinsResponse_fields &meshtastic_NodeRemoteHardwarePinsResponse_msg
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define meshtastic_AdminMessage_size 234
|
#define meshtastic_AdminMessage_size 500
|
||||||
#define meshtastic_HamParameters_size 32
|
#define meshtastic_HamParameters_size 32
|
||||||
|
#define meshtastic_NodeRemoteHardwarePinsResponse_size 496
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|||||||
@@ -31,11 +31,9 @@ typedef enum _meshtastic_Channel_Role {
|
|||||||
|
|
||||||
/* Struct definitions */
|
/* Struct definitions */
|
||||||
typedef PB_BYTES_ARRAY_T(32) meshtastic_ChannelSettings_psk_t;
|
typedef PB_BYTES_ARRAY_T(32) meshtastic_ChannelSettings_psk_t;
|
||||||
/* Full settings (center freq, spread factor, pre-shared secret key etc...)
|
/* This information can be encoded as a QRcode/url so that other users can configure
|
||||||
needed to configure a radio for speaking on a particular channel This
|
|
||||||
information can be encoded as a QRcode/url so that other users can configure
|
|
||||||
their radio to join the same channel.
|
their radio to join the same channel.
|
||||||
A note about how channel names are shown to users: channelname-Xy
|
A note about how channel names are shown to users: channelname-X
|
||||||
poundsymbol is a prefix used to indicate this is a channel name (idea from @professr).
|
poundsymbol is a prefix used to indicate this is a channel name (idea from @professr).
|
||||||
Where X is a letter from A-Z (base 26) representing a hash of the PSK for this
|
Where X is a letter from A-Z (base 26) representing a hash of the PSK for this
|
||||||
channel - so that if the user changes anything about the channel (which does
|
channel - so that if the user changes anything about the channel (which does
|
||||||
@@ -45,8 +43,6 @@ typedef PB_BYTES_ARRAY_T(32) meshtastic_ChannelSettings_psk_t;
|
|||||||
The PSK is hashed into this letter by "0x41 + [xor all bytes of the psk ] modulo 26"
|
The PSK is hashed into this letter by "0x41 + [xor all bytes of the psk ] modulo 26"
|
||||||
This also allows the option of someday if people have the PSK off (zero), the
|
This also allows the option of someday if people have the PSK off (zero), the
|
||||||
users COULD type in a channel name and be able to talk.
|
users COULD type in a channel name and be able to talk.
|
||||||
Y is a lower case letter from a-z that represents the channel 'speed' settings
|
|
||||||
(for some future definition of speed)
|
|
||||||
FIXME: Add description of multi-channel support and how primary vs secondary channels are used.
|
FIXME: Add description of multi-channel support and how primary vs secondary channels are used.
|
||||||
FIXME: explain how apps use channels for security.
|
FIXME: explain how apps use channels for security.
|
||||||
explain how remote settings and remote gpio are managed as an example */
|
explain how remote settings and remote gpio are managed as an example */
|
||||||
@@ -60,7 +56,7 @@ typedef struct _meshtastic_ChannelSettings {
|
|||||||
because they are listed in this source code.
|
because they are listed in this source code.
|
||||||
Those bytes are mapped using the following scheme:
|
Those bytes are mapped using the following scheme:
|
||||||
`0` = No crypto
|
`0` = No crypto
|
||||||
`1` = The special "default" channel key: {0xd4, 0xf1, 0xbb, 0x3a, 0x20, 0x29, 0x07, 0x59, 0xf0, 0xbc, 0xff, 0xab, 0xcf, 0x4e, 0x69, 0xbf}
|
`1` = The special "default" channel key: {0xd4, 0xf1, 0xbb, 0x3a, 0x20, 0x29, 0x07, 0x59, 0xf0, 0xbc, 0xff, 0xab, 0xcf, 0x4e, 0x69, 0x01}
|
||||||
`2` through 10 = The default channel key, except with 1 through 9 added to the last byte.
|
`2` through 10 = The default channel key, except with 1 through 9 added to the last byte.
|
||||||
Shown to user as simple1 through 10 */
|
Shown to user as simple1 through 10 */
|
||||||
meshtastic_ChannelSettings_psk_t psk;
|
meshtastic_ChannelSettings_psk_t psk;
|
||||||
|
|||||||
12
src/mesh/generated/meshtastic/clientonly.pb.c
Normal file
12
src/mesh/generated/meshtastic/clientonly.pb.c
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
/* Automatically generated nanopb constant definitions */
|
||||||
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
|
#include "meshtastic/clientonly.pb.h"
|
||||||
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PB_BIND(meshtastic_DeviceProfile, meshtastic_DeviceProfile, 2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
73
src/mesh/generated/meshtastic/clientonly.pb.h
Normal file
73
src/mesh/generated/meshtastic/clientonly.pb.h
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
/* Automatically generated nanopb header */
|
||||||
|
/* Generated by nanopb-0.4.7 */
|
||||||
|
|
||||||
|
#ifndef PB_MESHTASTIC_MESHTASTIC_CLIENTONLY_PB_H_INCLUDED
|
||||||
|
#define PB_MESHTASTIC_MESHTASTIC_CLIENTONLY_PB_H_INCLUDED
|
||||||
|
#include <pb.h>
|
||||||
|
#include "meshtastic/localonly.pb.h"
|
||||||
|
|
||||||
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Struct definitions */
|
||||||
|
/* This abstraction is used to contain any configuration for provisioning a node on any client.
|
||||||
|
It is useful for importing and exporting configurations. */
|
||||||
|
typedef struct _meshtastic_DeviceProfile {
|
||||||
|
/* Long name for the node */
|
||||||
|
bool has_long_name;
|
||||||
|
char long_name[40];
|
||||||
|
/* Short name of the node */
|
||||||
|
bool has_short_name;
|
||||||
|
char short_name[5];
|
||||||
|
/* The url of the channels from our node */
|
||||||
|
pb_callback_t channel_url;
|
||||||
|
/* The Config of the node */
|
||||||
|
bool has_config;
|
||||||
|
meshtastic_LocalConfig config;
|
||||||
|
/* The ModuleConfig of the node */
|
||||||
|
bool has_module_config;
|
||||||
|
meshtastic_LocalModuleConfig module_config;
|
||||||
|
} meshtastic_DeviceProfile;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Initializer values for message structs */
|
||||||
|
#define meshtastic_DeviceProfile_init_default {false, "", false, "", {{NULL}, NULL}, false, meshtastic_LocalConfig_init_default, false, meshtastic_LocalModuleConfig_init_default}
|
||||||
|
#define meshtastic_DeviceProfile_init_zero {false, "", false, "", {{NULL}, NULL}, false, meshtastic_LocalConfig_init_zero, false, meshtastic_LocalModuleConfig_init_zero}
|
||||||
|
|
||||||
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
|
#define meshtastic_DeviceProfile_long_name_tag 1
|
||||||
|
#define meshtastic_DeviceProfile_short_name_tag 2
|
||||||
|
#define meshtastic_DeviceProfile_channel_url_tag 3
|
||||||
|
#define meshtastic_DeviceProfile_config_tag 4
|
||||||
|
#define meshtastic_DeviceProfile_module_config_tag 5
|
||||||
|
|
||||||
|
/* Struct field encoding specification for nanopb */
|
||||||
|
#define meshtastic_DeviceProfile_FIELDLIST(X, a) \
|
||||||
|
X(a, STATIC, OPTIONAL, STRING, long_name, 1) \
|
||||||
|
X(a, STATIC, OPTIONAL, STRING, short_name, 2) \
|
||||||
|
X(a, CALLBACK, OPTIONAL, STRING, channel_url, 3) \
|
||||||
|
X(a, STATIC, OPTIONAL, MESSAGE, config, 4) \
|
||||||
|
X(a, STATIC, OPTIONAL, MESSAGE, module_config, 5)
|
||||||
|
#define meshtastic_DeviceProfile_CALLBACK pb_default_field_callback
|
||||||
|
#define meshtastic_DeviceProfile_DEFAULT NULL
|
||||||
|
#define meshtastic_DeviceProfile_config_MSGTYPE meshtastic_LocalConfig
|
||||||
|
#define meshtastic_DeviceProfile_module_config_MSGTYPE meshtastic_LocalModuleConfig
|
||||||
|
|
||||||
|
extern const pb_msgdesc_t meshtastic_DeviceProfile_msg;
|
||||||
|
|
||||||
|
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||||
|
#define meshtastic_DeviceProfile_fields &meshtastic_DeviceProfile_msg
|
||||||
|
|
||||||
|
/* Maximum encoded size of messages (where known) */
|
||||||
|
/* meshtastic_DeviceProfile_size depends on runtime parameters */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -18,7 +18,7 @@ typedef enum _meshtastic_Config_DeviceConfig_Role {
|
|||||||
Same as a client except packets will not hop over this node, does not contribute to routing packets for mesh. */
|
Same as a client except packets will not hop over this node, does not contribute to routing packets for mesh. */
|
||||||
meshtastic_Config_DeviceConfig_Role_CLIENT_MUTE = 1,
|
meshtastic_Config_DeviceConfig_Role_CLIENT_MUTE = 1,
|
||||||
/* Router device role.
|
/* Router device role.
|
||||||
Mesh packets will prefer to be routed over this node. This node will not be used by client apps.
|
Mesh packets will prefer to be routed over this node. This node will not be used by client apps.
|
||||||
The wifi/ble radios and the oled screen will be put to sleep.
|
The wifi/ble radios and the oled screen will be put to sleep.
|
||||||
This mode may still potentially have higher power usage due to it's preference in message rebroadcasting on the mesh. */
|
This mode may still potentially have higher power usage due to it's preference in message rebroadcasting on the mesh. */
|
||||||
meshtastic_Config_DeviceConfig_Role_ROUTER = 2,
|
meshtastic_Config_DeviceConfig_Role_ROUTER = 2,
|
||||||
@@ -231,6 +231,11 @@ typedef struct _meshtastic_Config_DeviceConfig {
|
|||||||
/* Send our nodeinfo this often
|
/* Send our nodeinfo this often
|
||||||
Defaults to 900 Seconds (15 minutes) */
|
Defaults to 900 Seconds (15 minutes) */
|
||||||
uint32_t node_info_broadcast_secs;
|
uint32_t node_info_broadcast_secs;
|
||||||
|
/* Treat double tap interrupt on supported accelerometers as a button press if set to true */
|
||||||
|
bool double_tap_as_button_press;
|
||||||
|
/* If true, device is considered to be "managed" by a mesh administrator
|
||||||
|
Clients should then limit available configuration and administrative options inside the user interface */
|
||||||
|
bool is_managed;
|
||||||
} meshtastic_Config_DeviceConfig;
|
} meshtastic_Config_DeviceConfig;
|
||||||
|
|
||||||
/* Position Config */
|
/* Position Config */
|
||||||
@@ -262,6 +267,10 @@ typedef struct _meshtastic_Config_PositionConfig {
|
|||||||
uint32_t rx_gpio;
|
uint32_t rx_gpio;
|
||||||
/* (Re)define GPS_TX_PIN for your board. */
|
/* (Re)define GPS_TX_PIN for your board. */
|
||||||
uint32_t tx_gpio;
|
uint32_t tx_gpio;
|
||||||
|
/* The minimum distance in meters traveled (since the last send) before we can send a position to the mesh if position_broadcast_smart_enabled */
|
||||||
|
uint32_t broadcast_smart_minimum_distance;
|
||||||
|
/* The minumum number of seconds (since the last send) before we can send a position to the mesh if position_broadcast_smart_enabled */
|
||||||
|
uint32_t broadcast_smart_minimum_interval_secs;
|
||||||
} meshtastic_Config_PositionConfig;
|
} meshtastic_Config_PositionConfig;
|
||||||
|
|
||||||
/* Power Config\
|
/* Power Config\
|
||||||
@@ -284,7 +293,7 @@ typedef struct _meshtastic_Config_PowerConfig {
|
|||||||
0 for default of 1 minute */
|
0 for default of 1 minute */
|
||||||
uint32_t wait_bluetooth_secs;
|
uint32_t wait_bluetooth_secs;
|
||||||
/* Mesh Super Deep Sleep Timeout Seconds
|
/* Mesh Super Deep Sleep Timeout Seconds
|
||||||
While in Light Sleep if this value is exceeded we will lower into super deep sleep
|
While in Light Sleep if this value is exceeded we will lower into super deep sleep
|
||||||
for sds_secs (default 1 year) or a button press
|
for sds_secs (default 1 year) or a button press
|
||||||
0 for default of two hours, MAXUINT for disabled */
|
0 for default of two hours, MAXUINT for disabled */
|
||||||
uint32_t mesh_sds_timeout_secs;
|
uint32_t mesh_sds_timeout_secs;
|
||||||
@@ -302,6 +311,8 @@ typedef struct _meshtastic_Config_PowerConfig {
|
|||||||
While in light sleep when we receive packets on the LoRa radio we will wake and handle them and stay awake in no BLE mode for this value
|
While in light sleep when we receive packets on the LoRa radio we will wake and handle them and stay awake in no BLE mode for this value
|
||||||
0 for default of 10 seconds */
|
0 for default of 10 seconds */
|
||||||
uint32_t min_wake_secs;
|
uint32_t min_wake_secs;
|
||||||
|
/* I2C address of INA_2XX to use for reading device battery voltage */
|
||||||
|
uint8_t device_battery_ina_address;
|
||||||
} meshtastic_Config_PowerConfig;
|
} meshtastic_Config_PowerConfig;
|
||||||
|
|
||||||
typedef struct _meshtastic_Config_NetworkConfig_IpV4Config {
|
typedef struct _meshtastic_Config_NetworkConfig_IpV4Config {
|
||||||
@@ -347,7 +358,7 @@ typedef struct _meshtastic_Config_DisplayConfig {
|
|||||||
/* Automatically toggles to the next page on the screen like a carousel, based the specified interval in seconds.
|
/* Automatically toggles to the next page on the screen like a carousel, based the specified interval in seconds.
|
||||||
Potentially useful for devices without user buttons. */
|
Potentially useful for devices without user buttons. */
|
||||||
uint32_t auto_screen_carousel_secs;
|
uint32_t auto_screen_carousel_secs;
|
||||||
/* If this is set, the displayed compass will always point north. if unset, the old behaviour
|
/* If this is set, the displayed compass will always point north. if unset, the old behaviour
|
||||||
(top of display is heading direction) is used. */
|
(top of display is heading direction) is used. */
|
||||||
bool compass_north_top;
|
bool compass_north_top;
|
||||||
/* Flip screen vertically, for cases that mount the screen upside down */
|
/* Flip screen vertically, for cases that mount the screen upside down */
|
||||||
@@ -410,7 +421,7 @@ typedef struct _meshtastic_Config_LoRaConfig {
|
|||||||
If using the hash algorithm the channel number will be: hash(channel_name) %
|
If using the hash algorithm the channel number will be: hash(channel_name) %
|
||||||
NUM_CHANNELS (Where num channels depends on the regulatory region). */
|
NUM_CHANNELS (Where num channels depends on the regulatory region). */
|
||||||
uint16_t channel_num;
|
uint16_t channel_num;
|
||||||
/* If true, duty cycle limits will be exceeded and thus you're possibly not following
|
/* If true, duty cycle limits will be exceeded and thus you're possibly not following
|
||||||
the local regulations if you're not a HAM.
|
the local regulations if you're not a HAM.
|
||||||
Has no effect if the duty cycle of the used region is 100%. */
|
Has no effect if the duty cycle of the used region is 100%. */
|
||||||
bool override_duty_cycle;
|
bool override_duty_cycle;
|
||||||
@@ -523,18 +534,18 @@ extern "C" {
|
|||||||
|
|
||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define meshtastic_Config_init_default {0, {meshtastic_Config_DeviceConfig_init_default}}
|
#define meshtastic_Config_init_default {0, {meshtastic_Config_DeviceConfig_init_default}}
|
||||||
#define meshtastic_Config_DeviceConfig_init_default {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0}
|
#define meshtastic_Config_DeviceConfig_init_default {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0}
|
||||||
#define meshtastic_Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
#define meshtastic_Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0}
|
#define meshtastic_Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_Config_NetworkConfig_init_default {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_default, ""}
|
#define meshtastic_Config_NetworkConfig_init_default {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_default, ""}
|
||||||
#define meshtastic_Config_NetworkConfig_IpV4Config_init_default {0, 0, 0, 0}
|
#define meshtastic_Config_NetworkConfig_IpV4Config_init_default {0, 0, 0, 0}
|
||||||
#define meshtastic_Config_DisplayConfig_init_default {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0}
|
#define meshtastic_Config_DisplayConfig_init_default {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0}
|
||||||
#define meshtastic_Config_LoRaConfig_init_default {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}}
|
#define meshtastic_Config_LoRaConfig_init_default {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}}
|
||||||
#define meshtastic_Config_BluetoothConfig_init_default {0, _meshtastic_Config_BluetoothConfig_PairingMode_MIN, 0}
|
#define meshtastic_Config_BluetoothConfig_init_default {0, _meshtastic_Config_BluetoothConfig_PairingMode_MIN, 0}
|
||||||
#define meshtastic_Config_init_zero {0, {meshtastic_Config_DeviceConfig_init_zero}}
|
#define meshtastic_Config_init_zero {0, {meshtastic_Config_DeviceConfig_init_zero}}
|
||||||
#define meshtastic_Config_DeviceConfig_init_zero {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0}
|
#define meshtastic_Config_DeviceConfig_init_zero {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0}
|
||||||
#define meshtastic_Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
#define meshtastic_Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0}
|
#define meshtastic_Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_Config_NetworkConfig_init_zero {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_zero, ""}
|
#define meshtastic_Config_NetworkConfig_init_zero {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_zero, ""}
|
||||||
#define meshtastic_Config_NetworkConfig_IpV4Config_init_zero {0, 0, 0, 0}
|
#define meshtastic_Config_NetworkConfig_IpV4Config_init_zero {0, 0, 0, 0}
|
||||||
#define meshtastic_Config_DisplayConfig_init_zero {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0}
|
#define meshtastic_Config_DisplayConfig_init_zero {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0}
|
||||||
@@ -549,6 +560,8 @@ extern "C" {
|
|||||||
#define meshtastic_Config_DeviceConfig_buzzer_gpio_tag 5
|
#define meshtastic_Config_DeviceConfig_buzzer_gpio_tag 5
|
||||||
#define meshtastic_Config_DeviceConfig_rebroadcast_mode_tag 6
|
#define meshtastic_Config_DeviceConfig_rebroadcast_mode_tag 6
|
||||||
#define meshtastic_Config_DeviceConfig_node_info_broadcast_secs_tag 7
|
#define meshtastic_Config_DeviceConfig_node_info_broadcast_secs_tag 7
|
||||||
|
#define meshtastic_Config_DeviceConfig_double_tap_as_button_press_tag 8
|
||||||
|
#define meshtastic_Config_DeviceConfig_is_managed_tag 9
|
||||||
#define meshtastic_Config_PositionConfig_position_broadcast_secs_tag 1
|
#define meshtastic_Config_PositionConfig_position_broadcast_secs_tag 1
|
||||||
#define meshtastic_Config_PositionConfig_position_broadcast_smart_enabled_tag 2
|
#define meshtastic_Config_PositionConfig_position_broadcast_smart_enabled_tag 2
|
||||||
#define meshtastic_Config_PositionConfig_fixed_position_tag 3
|
#define meshtastic_Config_PositionConfig_fixed_position_tag 3
|
||||||
@@ -558,6 +571,8 @@ extern "C" {
|
|||||||
#define meshtastic_Config_PositionConfig_position_flags_tag 7
|
#define meshtastic_Config_PositionConfig_position_flags_tag 7
|
||||||
#define meshtastic_Config_PositionConfig_rx_gpio_tag 8
|
#define meshtastic_Config_PositionConfig_rx_gpio_tag 8
|
||||||
#define meshtastic_Config_PositionConfig_tx_gpio_tag 9
|
#define meshtastic_Config_PositionConfig_tx_gpio_tag 9
|
||||||
|
#define meshtastic_Config_PositionConfig_broadcast_smart_minimum_distance_tag 10
|
||||||
|
#define meshtastic_Config_PositionConfig_broadcast_smart_minimum_interval_secs_tag 11
|
||||||
#define meshtastic_Config_PowerConfig_is_power_saving_tag 1
|
#define meshtastic_Config_PowerConfig_is_power_saving_tag 1
|
||||||
#define meshtastic_Config_PowerConfig_on_battery_shutdown_after_secs_tag 2
|
#define meshtastic_Config_PowerConfig_on_battery_shutdown_after_secs_tag 2
|
||||||
#define meshtastic_Config_PowerConfig_adc_multiplier_override_tag 3
|
#define meshtastic_Config_PowerConfig_adc_multiplier_override_tag 3
|
||||||
@@ -566,6 +581,7 @@ extern "C" {
|
|||||||
#define meshtastic_Config_PowerConfig_sds_secs_tag 6
|
#define meshtastic_Config_PowerConfig_sds_secs_tag 6
|
||||||
#define meshtastic_Config_PowerConfig_ls_secs_tag 7
|
#define meshtastic_Config_PowerConfig_ls_secs_tag 7
|
||||||
#define meshtastic_Config_PowerConfig_min_wake_secs_tag 8
|
#define meshtastic_Config_PowerConfig_min_wake_secs_tag 8
|
||||||
|
#define meshtastic_Config_PowerConfig_device_battery_ina_address_tag 9
|
||||||
#define meshtastic_Config_NetworkConfig_IpV4Config_ip_tag 1
|
#define meshtastic_Config_NetworkConfig_IpV4Config_ip_tag 1
|
||||||
#define meshtastic_Config_NetworkConfig_IpV4Config_gateway_tag 2
|
#define meshtastic_Config_NetworkConfig_IpV4Config_gateway_tag 2
|
||||||
#define meshtastic_Config_NetworkConfig_IpV4Config_subnet_tag 3
|
#define meshtastic_Config_NetworkConfig_IpV4Config_subnet_tag 3
|
||||||
@@ -640,7 +656,9 @@ X(a, STATIC, SINGULAR, BOOL, debug_log_enabled, 3) \
|
|||||||
X(a, STATIC, SINGULAR, UINT32, button_gpio, 4) \
|
X(a, STATIC, SINGULAR, UINT32, button_gpio, 4) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, buzzer_gpio, 5) \
|
X(a, STATIC, SINGULAR, UINT32, buzzer_gpio, 5) \
|
||||||
X(a, STATIC, SINGULAR, UENUM, rebroadcast_mode, 6) \
|
X(a, STATIC, SINGULAR, UENUM, rebroadcast_mode, 6) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, node_info_broadcast_secs, 7)
|
X(a, STATIC, SINGULAR, UINT32, node_info_broadcast_secs, 7) \
|
||||||
|
X(a, STATIC, SINGULAR, BOOL, double_tap_as_button_press, 8) \
|
||||||
|
X(a, STATIC, SINGULAR, BOOL, is_managed, 9)
|
||||||
#define meshtastic_Config_DeviceConfig_CALLBACK NULL
|
#define meshtastic_Config_DeviceConfig_CALLBACK NULL
|
||||||
#define meshtastic_Config_DeviceConfig_DEFAULT NULL
|
#define meshtastic_Config_DeviceConfig_DEFAULT NULL
|
||||||
|
|
||||||
@@ -653,7 +671,9 @@ X(a, STATIC, SINGULAR, UINT32, gps_update_interval, 5) \
|
|||||||
X(a, STATIC, SINGULAR, UINT32, gps_attempt_time, 6) \
|
X(a, STATIC, SINGULAR, UINT32, gps_attempt_time, 6) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, position_flags, 7) \
|
X(a, STATIC, SINGULAR, UINT32, position_flags, 7) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, rx_gpio, 8) \
|
X(a, STATIC, SINGULAR, UINT32, rx_gpio, 8) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, tx_gpio, 9)
|
X(a, STATIC, SINGULAR, UINT32, tx_gpio, 9) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, broadcast_smart_minimum_distance, 10) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, broadcast_smart_minimum_interval_secs, 11)
|
||||||
#define meshtastic_Config_PositionConfig_CALLBACK NULL
|
#define meshtastic_Config_PositionConfig_CALLBACK NULL
|
||||||
#define meshtastic_Config_PositionConfig_DEFAULT NULL
|
#define meshtastic_Config_PositionConfig_DEFAULT NULL
|
||||||
|
|
||||||
@@ -665,7 +685,8 @@ X(a, STATIC, SINGULAR, UINT32, wait_bluetooth_secs, 4) \
|
|||||||
X(a, STATIC, SINGULAR, UINT32, mesh_sds_timeout_secs, 5) \
|
X(a, STATIC, SINGULAR, UINT32, mesh_sds_timeout_secs, 5) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, sds_secs, 6) \
|
X(a, STATIC, SINGULAR, UINT32, sds_secs, 6) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, ls_secs, 7) \
|
X(a, STATIC, SINGULAR, UINT32, ls_secs, 7) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, min_wake_secs, 8)
|
X(a, STATIC, SINGULAR, UINT32, min_wake_secs, 8) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, device_battery_ina_address, 9)
|
||||||
#define meshtastic_Config_PowerConfig_CALLBACK NULL
|
#define meshtastic_Config_PowerConfig_CALLBACK NULL
|
||||||
#define meshtastic_Config_PowerConfig_DEFAULT NULL
|
#define meshtastic_Config_PowerConfig_DEFAULT NULL
|
||||||
|
|
||||||
@@ -753,13 +774,13 @@ extern const pb_msgdesc_t meshtastic_Config_BluetoothConfig_msg;
|
|||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define meshtastic_Config_BluetoothConfig_size 10
|
#define meshtastic_Config_BluetoothConfig_size 10
|
||||||
#define meshtastic_Config_DeviceConfig_size 26
|
#define meshtastic_Config_DeviceConfig_size 30
|
||||||
#define meshtastic_Config_DisplayConfig_size 28
|
#define meshtastic_Config_DisplayConfig_size 28
|
||||||
#define meshtastic_Config_LoRaConfig_size 77
|
#define meshtastic_Config_LoRaConfig_size 77
|
||||||
#define meshtastic_Config_NetworkConfig_IpV4Config_size 20
|
#define meshtastic_Config_NetworkConfig_IpV4Config_size 20
|
||||||
#define meshtastic_Config_NetworkConfig_size 195
|
#define meshtastic_Config_NetworkConfig_size 195
|
||||||
#define meshtastic_Config_PositionConfig_size 42
|
#define meshtastic_Config_PositionConfig_size 54
|
||||||
#define meshtastic_Config_PowerConfig_size 43
|
#define meshtastic_Config_PowerConfig_size 46
|
||||||
#define meshtastic_Config_size 198
|
#define meshtastic_Config_size 198
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -15,5 +15,8 @@ PB_BIND(meshtastic_ChannelFile, meshtastic_ChannelFile, 2)
|
|||||||
PB_BIND(meshtastic_OEMStore, meshtastic_OEMStore, 2)
|
PB_BIND(meshtastic_OEMStore, meshtastic_OEMStore, 2)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(meshtastic_NodeRemoteHardwarePin, meshtastic_NodeRemoteHardwarePin, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "meshtastic/channel.pb.h"
|
#include "meshtastic/channel.pb.h"
|
||||||
#include "meshtastic/localonly.pb.h"
|
#include "meshtastic/localonly.pb.h"
|
||||||
#include "meshtastic/mesh.pb.h"
|
#include "meshtastic/mesh.pb.h"
|
||||||
|
#include "meshtastic/module_config.pb.h"
|
||||||
|
|
||||||
#if PB_PROTO_HEADER_VERSION != 40
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
@@ -24,40 +25,6 @@ typedef enum _meshtastic_ScreenFonts {
|
|||||||
} meshtastic_ScreenFonts;
|
} meshtastic_ScreenFonts;
|
||||||
|
|
||||||
/* Struct definitions */
|
/* Struct definitions */
|
||||||
/* This message is never sent over the wire, but it is used for serializing DB
|
|
||||||
state to flash in the device code
|
|
||||||
FIXME, since we write this each time we enter deep sleep (and have infinite
|
|
||||||
flash) it would be better to use some sort of append only data structure for
|
|
||||||
the receive queue and use the preferences store for the other stuff */
|
|
||||||
typedef struct _meshtastic_DeviceState {
|
|
||||||
/* Read only settings/info about this node */
|
|
||||||
bool has_my_node;
|
|
||||||
meshtastic_MyNodeInfo my_node;
|
|
||||||
/* My owner info */
|
|
||||||
bool has_owner;
|
|
||||||
meshtastic_User owner;
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
pb_size_t node_db_count;
|
|
||||||
meshtastic_NodeInfo node_db[80];
|
|
||||||
/* Received packets saved for delivery to the phone */
|
|
||||||
pb_size_t receive_queue_count;
|
|
||||||
meshtastic_MeshPacket receive_queue[1];
|
|
||||||
/* We keep the last received text message (only) stored in the device flash,
|
|
||||||
so we can show it on the screen.
|
|
||||||
Might be null */
|
|
||||||
bool has_rx_text_message;
|
|
||||||
meshtastic_MeshPacket rx_text_message;
|
|
||||||
/* A version integer used to invalidate old save files when we make
|
|
||||||
incompatible changes This integer is set at build time and is private to
|
|
||||||
NodeDB.cpp in the device code. */
|
|
||||||
uint32_t version;
|
|
||||||
/* Used only during development.
|
|
||||||
Indicates developer is testing and changes should never be saved to flash. */
|
|
||||||
bool no_save;
|
|
||||||
/* Some GPS receivers seem to have bogus settings from the factory, so we always do one factory reset. */
|
|
||||||
bool did_gps_reset;
|
|
||||||
} meshtastic_DeviceState;
|
|
||||||
|
|
||||||
/* The on-disk saved channels */
|
/* The on-disk saved channels */
|
||||||
typedef struct _meshtastic_ChannelFile {
|
typedef struct _meshtastic_ChannelFile {
|
||||||
/* The channels our node knows about */
|
/* The channels our node knows about */
|
||||||
@@ -94,6 +61,57 @@ typedef struct _meshtastic_OEMStore {
|
|||||||
meshtastic_LocalModuleConfig oem_local_module_config;
|
meshtastic_LocalModuleConfig oem_local_module_config;
|
||||||
} meshtastic_OEMStore;
|
} meshtastic_OEMStore;
|
||||||
|
|
||||||
|
/* RemoteHardwarePins associated with a node */
|
||||||
|
typedef struct _meshtastic_NodeRemoteHardwarePin {
|
||||||
|
/* The node_num exposing the available gpio pin */
|
||||||
|
uint32_t node_num;
|
||||||
|
/* The the available gpio pin for usage with RemoteHardware module */
|
||||||
|
bool has_pin;
|
||||||
|
meshtastic_RemoteHardwarePin pin;
|
||||||
|
} meshtastic_NodeRemoteHardwarePin;
|
||||||
|
|
||||||
|
/* This message is never sent over the wire, but it is used for serializing DB
|
||||||
|
state to flash in the device code
|
||||||
|
FIXME, since we write this each time we enter deep sleep (and have infinite
|
||||||
|
flash) it would be better to use some sort of append only data structure for
|
||||||
|
the receive queue and use the preferences store for the other stuff */
|
||||||
|
typedef struct _meshtastic_DeviceState {
|
||||||
|
/* Read only settings/info about this node */
|
||||||
|
bool has_my_node;
|
||||||
|
meshtastic_MyNodeInfo my_node;
|
||||||
|
/* My owner info */
|
||||||
|
bool has_owner;
|
||||||
|
meshtastic_User owner;
|
||||||
|
/* TODO: REPLACE */
|
||||||
|
pb_size_t node_db_count;
|
||||||
|
meshtastic_NodeInfo node_db[80];
|
||||||
|
/* Received packets saved for delivery to the phone */
|
||||||
|
pb_size_t receive_queue_count;
|
||||||
|
meshtastic_MeshPacket receive_queue[1];
|
||||||
|
/* We keep the last received text message (only) stored in the device flash,
|
||||||
|
so we can show it on the screen.
|
||||||
|
Might be null */
|
||||||
|
bool has_rx_text_message;
|
||||||
|
meshtastic_MeshPacket rx_text_message;
|
||||||
|
/* A version integer used to invalidate old save files when we make
|
||||||
|
incompatible changes This integer is set at build time and is private to
|
||||||
|
NodeDB.cpp in the device code. */
|
||||||
|
uint32_t version;
|
||||||
|
/* Used only during development.
|
||||||
|
Indicates developer is testing and changes should never be saved to flash. */
|
||||||
|
bool no_save;
|
||||||
|
/* Some GPS receivers seem to have bogus settings from the factory, so we always do one factory reset. */
|
||||||
|
bool did_gps_reset;
|
||||||
|
/* We keep the last received waypoint stored in the device flash,
|
||||||
|
so we can show it on the screen.
|
||||||
|
Might be null */
|
||||||
|
bool has_rx_waypoint;
|
||||||
|
meshtastic_MeshPacket rx_waypoint;
|
||||||
|
/* The mesh's nodes with their available gpio pins for RemoteHardware module */
|
||||||
|
pb_size_t node_remote_hardware_pins_count;
|
||||||
|
meshtastic_NodeRemoteHardwarePin node_remote_hardware_pins[12];
|
||||||
|
} meshtastic_DeviceState;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -109,23 +127,18 @@ extern "C" {
|
|||||||
#define meshtastic_OEMStore_oem_font_ENUMTYPE meshtastic_ScreenFonts
|
#define meshtastic_OEMStore_oem_font_ENUMTYPE meshtastic_ScreenFonts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define meshtastic_DeviceState_init_default {false, meshtastic_MyNodeInfo_init_default, false, meshtastic_User_init_default, 0, {meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default}, 0, {meshtastic_MeshPacket_init_default}, false, meshtastic_MeshPacket_init_default, 0, 0, 0}
|
#define meshtastic_DeviceState_init_default {false, meshtastic_MyNodeInfo_init_default, false, meshtastic_User_init_default, 0, {meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default}, 0, {meshtastic_MeshPacket_init_default}, false, meshtastic_MeshPacket_init_default, 0, 0, 0, false, meshtastic_MeshPacket_init_default, 0, {meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default}}
|
||||||
#define meshtastic_ChannelFile_init_default {0, {meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default}, 0}
|
#define meshtastic_ChannelFile_init_default {0, {meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default}, 0}
|
||||||
#define meshtastic_OEMStore_init_default {0, 0, {0, {0}}, _meshtastic_ScreenFonts_MIN, "", {0, {0}}, false, meshtastic_LocalConfig_init_default, false, meshtastic_LocalModuleConfig_init_default}
|
#define meshtastic_OEMStore_init_default {0, 0, {0, {0}}, _meshtastic_ScreenFonts_MIN, "", {0, {0}}, false, meshtastic_LocalConfig_init_default, false, meshtastic_LocalModuleConfig_init_default}
|
||||||
#define meshtastic_DeviceState_init_zero {false, meshtastic_MyNodeInfo_init_zero, false, meshtastic_User_init_zero, 0, {meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero}, 0, {meshtastic_MeshPacket_init_zero}, false, meshtastic_MeshPacket_init_zero, 0, 0, 0}
|
#define meshtastic_NodeRemoteHardwarePin_init_default {0, false, meshtastic_RemoteHardwarePin_init_default}
|
||||||
|
#define meshtastic_DeviceState_init_zero {false, meshtastic_MyNodeInfo_init_zero, false, meshtastic_User_init_zero, 0, {meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero}, 0, {meshtastic_MeshPacket_init_zero}, false, meshtastic_MeshPacket_init_zero, 0, 0, 0, false, meshtastic_MeshPacket_init_zero, 0, {meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero}}
|
||||||
#define meshtastic_ChannelFile_init_zero {0, {meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero}, 0}
|
#define meshtastic_ChannelFile_init_zero {0, {meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero}, 0}
|
||||||
#define meshtastic_OEMStore_init_zero {0, 0, {0, {0}}, _meshtastic_ScreenFonts_MIN, "", {0, {0}}, false, meshtastic_LocalConfig_init_zero, false, meshtastic_LocalModuleConfig_init_zero}
|
#define meshtastic_OEMStore_init_zero {0, 0, {0, {0}}, _meshtastic_ScreenFonts_MIN, "", {0, {0}}, false, meshtastic_LocalConfig_init_zero, false, meshtastic_LocalModuleConfig_init_zero}
|
||||||
|
#define meshtastic_NodeRemoteHardwarePin_init_zero {0, false, meshtastic_RemoteHardwarePin_init_zero}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
#define meshtastic_DeviceState_my_node_tag 2
|
|
||||||
#define meshtastic_DeviceState_owner_tag 3
|
|
||||||
#define meshtastic_DeviceState_node_db_tag 4
|
|
||||||
#define meshtastic_DeviceState_receive_queue_tag 5
|
|
||||||
#define meshtastic_DeviceState_rx_text_message_tag 7
|
|
||||||
#define meshtastic_DeviceState_version_tag 8
|
|
||||||
#define meshtastic_DeviceState_no_save_tag 9
|
|
||||||
#define meshtastic_DeviceState_did_gps_reset_tag 11
|
|
||||||
#define meshtastic_ChannelFile_channels_tag 1
|
#define meshtastic_ChannelFile_channels_tag 1
|
||||||
#define meshtastic_ChannelFile_version_tag 2
|
#define meshtastic_ChannelFile_version_tag 2
|
||||||
#define meshtastic_OEMStore_oem_icon_width_tag 1
|
#define meshtastic_OEMStore_oem_icon_width_tag 1
|
||||||
@@ -136,6 +149,18 @@ extern "C" {
|
|||||||
#define meshtastic_OEMStore_oem_aes_key_tag 6
|
#define meshtastic_OEMStore_oem_aes_key_tag 6
|
||||||
#define meshtastic_OEMStore_oem_local_config_tag 7
|
#define meshtastic_OEMStore_oem_local_config_tag 7
|
||||||
#define meshtastic_OEMStore_oem_local_module_config_tag 8
|
#define meshtastic_OEMStore_oem_local_module_config_tag 8
|
||||||
|
#define meshtastic_NodeRemoteHardwarePin_node_num_tag 1
|
||||||
|
#define meshtastic_NodeRemoteHardwarePin_pin_tag 2
|
||||||
|
#define meshtastic_DeviceState_my_node_tag 2
|
||||||
|
#define meshtastic_DeviceState_owner_tag 3
|
||||||
|
#define meshtastic_DeviceState_node_db_tag 4
|
||||||
|
#define meshtastic_DeviceState_receive_queue_tag 5
|
||||||
|
#define meshtastic_DeviceState_rx_text_message_tag 7
|
||||||
|
#define meshtastic_DeviceState_version_tag 8
|
||||||
|
#define meshtastic_DeviceState_no_save_tag 9
|
||||||
|
#define meshtastic_DeviceState_did_gps_reset_tag 11
|
||||||
|
#define meshtastic_DeviceState_rx_waypoint_tag 12
|
||||||
|
#define meshtastic_DeviceState_node_remote_hardware_pins_tag 13
|
||||||
|
|
||||||
/* Struct field encoding specification for nanopb */
|
/* Struct field encoding specification for nanopb */
|
||||||
#define meshtastic_DeviceState_FIELDLIST(X, a) \
|
#define meshtastic_DeviceState_FIELDLIST(X, a) \
|
||||||
@@ -146,7 +171,9 @@ X(a, STATIC, REPEATED, MESSAGE, receive_queue, 5) \
|
|||||||
X(a, STATIC, OPTIONAL, MESSAGE, rx_text_message, 7) \
|
X(a, STATIC, OPTIONAL, MESSAGE, rx_text_message, 7) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, version, 8) \
|
X(a, STATIC, SINGULAR, UINT32, version, 8) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, no_save, 9) \
|
X(a, STATIC, SINGULAR, BOOL, no_save, 9) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, did_gps_reset, 11)
|
X(a, STATIC, SINGULAR, BOOL, did_gps_reset, 11) \
|
||||||
|
X(a, STATIC, OPTIONAL, MESSAGE, rx_waypoint, 12) \
|
||||||
|
X(a, STATIC, REPEATED, MESSAGE, node_remote_hardware_pins, 13)
|
||||||
#define meshtastic_DeviceState_CALLBACK NULL
|
#define meshtastic_DeviceState_CALLBACK NULL
|
||||||
#define meshtastic_DeviceState_DEFAULT NULL
|
#define meshtastic_DeviceState_DEFAULT NULL
|
||||||
#define meshtastic_DeviceState_my_node_MSGTYPE meshtastic_MyNodeInfo
|
#define meshtastic_DeviceState_my_node_MSGTYPE meshtastic_MyNodeInfo
|
||||||
@@ -154,6 +181,8 @@ X(a, STATIC, SINGULAR, BOOL, did_gps_reset, 11)
|
|||||||
#define meshtastic_DeviceState_node_db_MSGTYPE meshtastic_NodeInfo
|
#define meshtastic_DeviceState_node_db_MSGTYPE meshtastic_NodeInfo
|
||||||
#define meshtastic_DeviceState_receive_queue_MSGTYPE meshtastic_MeshPacket
|
#define meshtastic_DeviceState_receive_queue_MSGTYPE meshtastic_MeshPacket
|
||||||
#define meshtastic_DeviceState_rx_text_message_MSGTYPE meshtastic_MeshPacket
|
#define meshtastic_DeviceState_rx_text_message_MSGTYPE meshtastic_MeshPacket
|
||||||
|
#define meshtastic_DeviceState_rx_waypoint_MSGTYPE meshtastic_MeshPacket
|
||||||
|
#define meshtastic_DeviceState_node_remote_hardware_pins_MSGTYPE meshtastic_NodeRemoteHardwarePin
|
||||||
|
|
||||||
#define meshtastic_ChannelFile_FIELDLIST(X, a) \
|
#define meshtastic_ChannelFile_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, REPEATED, MESSAGE, channels, 1) \
|
X(a, STATIC, REPEATED, MESSAGE, channels, 1) \
|
||||||
@@ -176,19 +205,29 @@ X(a, STATIC, OPTIONAL, MESSAGE, oem_local_module_config, 8)
|
|||||||
#define meshtastic_OEMStore_oem_local_config_MSGTYPE meshtastic_LocalConfig
|
#define meshtastic_OEMStore_oem_local_config_MSGTYPE meshtastic_LocalConfig
|
||||||
#define meshtastic_OEMStore_oem_local_module_config_MSGTYPE meshtastic_LocalModuleConfig
|
#define meshtastic_OEMStore_oem_local_module_config_MSGTYPE meshtastic_LocalModuleConfig
|
||||||
|
|
||||||
|
#define meshtastic_NodeRemoteHardwarePin_FIELDLIST(X, a) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, node_num, 1) \
|
||||||
|
X(a, STATIC, OPTIONAL, MESSAGE, pin, 2)
|
||||||
|
#define meshtastic_NodeRemoteHardwarePin_CALLBACK NULL
|
||||||
|
#define meshtastic_NodeRemoteHardwarePin_DEFAULT NULL
|
||||||
|
#define meshtastic_NodeRemoteHardwarePin_pin_MSGTYPE meshtastic_RemoteHardwarePin
|
||||||
|
|
||||||
extern const pb_msgdesc_t meshtastic_DeviceState_msg;
|
extern const pb_msgdesc_t meshtastic_DeviceState_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_ChannelFile_msg;
|
extern const pb_msgdesc_t meshtastic_ChannelFile_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_OEMStore_msg;
|
extern const pb_msgdesc_t meshtastic_OEMStore_msg;
|
||||||
|
extern const pb_msgdesc_t meshtastic_NodeRemoteHardwarePin_msg;
|
||||||
|
|
||||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||||
#define meshtastic_DeviceState_fields &meshtastic_DeviceState_msg
|
#define meshtastic_DeviceState_fields &meshtastic_DeviceState_msg
|
||||||
#define meshtastic_ChannelFile_fields &meshtastic_ChannelFile_msg
|
#define meshtastic_ChannelFile_fields &meshtastic_ChannelFile_msg
|
||||||
#define meshtastic_OEMStore_fields &meshtastic_OEMStore_msg
|
#define meshtastic_OEMStore_fields &meshtastic_OEMStore_msg
|
||||||
|
#define meshtastic_NodeRemoteHardwarePin_fields &meshtastic_NodeRemoteHardwarePin_msg
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define meshtastic_ChannelFile_size 638
|
#define meshtastic_ChannelFile_size 638
|
||||||
#define meshtastic_DeviceState_size 21800
|
#define meshtastic_DeviceState_size 22736
|
||||||
#define meshtastic_OEMStore_size 3008
|
#define meshtastic_NodeRemoteHardwarePin_size 29
|
||||||
|
#define meshtastic_OEMStore_size 3152
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|||||||
@@ -72,6 +72,9 @@ typedef struct _meshtastic_LocalModuleConfig {
|
|||||||
/* The part of the config that is specific to the Remote Hardware module */
|
/* The part of the config that is specific to the Remote Hardware module */
|
||||||
bool has_remote_hardware;
|
bool has_remote_hardware;
|
||||||
meshtastic_ModuleConfig_RemoteHardwareConfig remote_hardware;
|
meshtastic_ModuleConfig_RemoteHardwareConfig remote_hardware;
|
||||||
|
/* The part of the config that is specific to the Neighbor Info module */
|
||||||
|
bool has_neighbor_info;
|
||||||
|
meshtastic_ModuleConfig_NeighborInfoConfig neighbor_info;
|
||||||
} meshtastic_LocalModuleConfig;
|
} meshtastic_LocalModuleConfig;
|
||||||
|
|
||||||
|
|
||||||
@@ -81,9 +84,9 @@ extern "C" {
|
|||||||
|
|
||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define meshtastic_LocalConfig_init_default {false, meshtastic_Config_DeviceConfig_init_default, false, meshtastic_Config_PositionConfig_init_default, false, meshtastic_Config_PowerConfig_init_default, false, meshtastic_Config_NetworkConfig_init_default, false, meshtastic_Config_DisplayConfig_init_default, false, meshtastic_Config_LoRaConfig_init_default, false, meshtastic_Config_BluetoothConfig_init_default, 0}
|
#define meshtastic_LocalConfig_init_default {false, meshtastic_Config_DeviceConfig_init_default, false, meshtastic_Config_PositionConfig_init_default, false, meshtastic_Config_PowerConfig_init_default, false, meshtastic_Config_NetworkConfig_init_default, false, meshtastic_Config_DisplayConfig_init_default, false, meshtastic_Config_LoRaConfig_init_default, false, meshtastic_Config_BluetoothConfig_init_default, 0}
|
||||||
#define meshtastic_LocalModuleConfig_init_default {false, meshtastic_ModuleConfig_MQTTConfig_init_default, false, meshtastic_ModuleConfig_SerialConfig_init_default, false, meshtastic_ModuleConfig_ExternalNotificationConfig_init_default, false, meshtastic_ModuleConfig_StoreForwardConfig_init_default, false, meshtastic_ModuleConfig_RangeTestConfig_init_default, false, meshtastic_ModuleConfig_TelemetryConfig_init_default, false, meshtastic_ModuleConfig_CannedMessageConfig_init_default, 0, false, meshtastic_ModuleConfig_AudioConfig_init_default, false, meshtastic_ModuleConfig_RemoteHardwareConfig_init_default}
|
#define meshtastic_LocalModuleConfig_init_default {false, meshtastic_ModuleConfig_MQTTConfig_init_default, false, meshtastic_ModuleConfig_SerialConfig_init_default, false, meshtastic_ModuleConfig_ExternalNotificationConfig_init_default, false, meshtastic_ModuleConfig_StoreForwardConfig_init_default, false, meshtastic_ModuleConfig_RangeTestConfig_init_default, false, meshtastic_ModuleConfig_TelemetryConfig_init_default, false, meshtastic_ModuleConfig_CannedMessageConfig_init_default, 0, false, meshtastic_ModuleConfig_AudioConfig_init_default, false, meshtastic_ModuleConfig_RemoteHardwareConfig_init_default, false, meshtastic_ModuleConfig_NeighborInfoConfig_init_default}
|
||||||
#define meshtastic_LocalConfig_init_zero {false, meshtastic_Config_DeviceConfig_init_zero, false, meshtastic_Config_PositionConfig_init_zero, false, meshtastic_Config_PowerConfig_init_zero, false, meshtastic_Config_NetworkConfig_init_zero, false, meshtastic_Config_DisplayConfig_init_zero, false, meshtastic_Config_LoRaConfig_init_zero, false, meshtastic_Config_BluetoothConfig_init_zero, 0}
|
#define meshtastic_LocalConfig_init_zero {false, meshtastic_Config_DeviceConfig_init_zero, false, meshtastic_Config_PositionConfig_init_zero, false, meshtastic_Config_PowerConfig_init_zero, false, meshtastic_Config_NetworkConfig_init_zero, false, meshtastic_Config_DisplayConfig_init_zero, false, meshtastic_Config_LoRaConfig_init_zero, false, meshtastic_Config_BluetoothConfig_init_zero, 0}
|
||||||
#define meshtastic_LocalModuleConfig_init_zero {false, meshtastic_ModuleConfig_MQTTConfig_init_zero, false, meshtastic_ModuleConfig_SerialConfig_init_zero, false, meshtastic_ModuleConfig_ExternalNotificationConfig_init_zero, false, meshtastic_ModuleConfig_StoreForwardConfig_init_zero, false, meshtastic_ModuleConfig_RangeTestConfig_init_zero, false, meshtastic_ModuleConfig_TelemetryConfig_init_zero, false, meshtastic_ModuleConfig_CannedMessageConfig_init_zero, 0, false, meshtastic_ModuleConfig_AudioConfig_init_zero, false, meshtastic_ModuleConfig_RemoteHardwareConfig_init_zero}
|
#define meshtastic_LocalModuleConfig_init_zero {false, meshtastic_ModuleConfig_MQTTConfig_init_zero, false, meshtastic_ModuleConfig_SerialConfig_init_zero, false, meshtastic_ModuleConfig_ExternalNotificationConfig_init_zero, false, meshtastic_ModuleConfig_StoreForwardConfig_init_zero, false, meshtastic_ModuleConfig_RangeTestConfig_init_zero, false, meshtastic_ModuleConfig_TelemetryConfig_init_zero, false, meshtastic_ModuleConfig_CannedMessageConfig_init_zero, 0, false, meshtastic_ModuleConfig_AudioConfig_init_zero, false, meshtastic_ModuleConfig_RemoteHardwareConfig_init_zero, false, meshtastic_ModuleConfig_NeighborInfoConfig_init_zero}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
#define meshtastic_LocalConfig_device_tag 1
|
#define meshtastic_LocalConfig_device_tag 1
|
||||||
@@ -104,6 +107,7 @@ extern "C" {
|
|||||||
#define meshtastic_LocalModuleConfig_version_tag 8
|
#define meshtastic_LocalModuleConfig_version_tag 8
|
||||||
#define meshtastic_LocalModuleConfig_audio_tag 9
|
#define meshtastic_LocalModuleConfig_audio_tag 9
|
||||||
#define meshtastic_LocalModuleConfig_remote_hardware_tag 10
|
#define meshtastic_LocalModuleConfig_remote_hardware_tag 10
|
||||||
|
#define meshtastic_LocalModuleConfig_neighbor_info_tag 11
|
||||||
|
|
||||||
/* Struct field encoding specification for nanopb */
|
/* Struct field encoding specification for nanopb */
|
||||||
#define meshtastic_LocalConfig_FIELDLIST(X, a) \
|
#define meshtastic_LocalConfig_FIELDLIST(X, a) \
|
||||||
@@ -135,7 +139,8 @@ X(a, STATIC, OPTIONAL, MESSAGE, telemetry, 6) \
|
|||||||
X(a, STATIC, OPTIONAL, MESSAGE, canned_message, 7) \
|
X(a, STATIC, OPTIONAL, MESSAGE, canned_message, 7) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, version, 8) \
|
X(a, STATIC, SINGULAR, UINT32, version, 8) \
|
||||||
X(a, STATIC, OPTIONAL, MESSAGE, audio, 9) \
|
X(a, STATIC, OPTIONAL, MESSAGE, audio, 9) \
|
||||||
X(a, STATIC, OPTIONAL, MESSAGE, remote_hardware, 10)
|
X(a, STATIC, OPTIONAL, MESSAGE, remote_hardware, 10) \
|
||||||
|
X(a, STATIC, OPTIONAL, MESSAGE, neighbor_info, 11)
|
||||||
#define meshtastic_LocalModuleConfig_CALLBACK NULL
|
#define meshtastic_LocalModuleConfig_CALLBACK NULL
|
||||||
#define meshtastic_LocalModuleConfig_DEFAULT NULL
|
#define meshtastic_LocalModuleConfig_DEFAULT NULL
|
||||||
#define meshtastic_LocalModuleConfig_mqtt_MSGTYPE meshtastic_ModuleConfig_MQTTConfig
|
#define meshtastic_LocalModuleConfig_mqtt_MSGTYPE meshtastic_ModuleConfig_MQTTConfig
|
||||||
@@ -147,6 +152,7 @@ X(a, STATIC, OPTIONAL, MESSAGE, remote_hardware, 10)
|
|||||||
#define meshtastic_LocalModuleConfig_canned_message_MSGTYPE meshtastic_ModuleConfig_CannedMessageConfig
|
#define meshtastic_LocalModuleConfig_canned_message_MSGTYPE meshtastic_ModuleConfig_CannedMessageConfig
|
||||||
#define meshtastic_LocalModuleConfig_audio_MSGTYPE meshtastic_ModuleConfig_AudioConfig
|
#define meshtastic_LocalModuleConfig_audio_MSGTYPE meshtastic_ModuleConfig_AudioConfig
|
||||||
#define meshtastic_LocalModuleConfig_remote_hardware_MSGTYPE meshtastic_ModuleConfig_RemoteHardwareConfig
|
#define meshtastic_LocalModuleConfig_remote_hardware_MSGTYPE meshtastic_ModuleConfig_RemoteHardwareConfig
|
||||||
|
#define meshtastic_LocalModuleConfig_neighbor_info_MSGTYPE meshtastic_ModuleConfig_NeighborInfoConfig
|
||||||
|
|
||||||
extern const pb_msgdesc_t meshtastic_LocalConfig_msg;
|
extern const pb_msgdesc_t meshtastic_LocalConfig_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg;
|
extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg;
|
||||||
@@ -156,8 +162,8 @@ extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg;
|
|||||||
#define meshtastic_LocalModuleConfig_fields &meshtastic_LocalModuleConfig_msg
|
#define meshtastic_LocalModuleConfig_fields &meshtastic_LocalModuleConfig_msg
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define meshtastic_LocalConfig_size 442
|
#define meshtastic_LocalConfig_size 461
|
||||||
#define meshtastic_LocalModuleConfig_size 420
|
#define meshtastic_LocalModuleConfig_size 545
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|||||||
@@ -48,6 +48,12 @@ PB_BIND(meshtastic_ToRadio, meshtastic_ToRadio, 2)
|
|||||||
PB_BIND(meshtastic_Compressed, meshtastic_Compressed, AUTO)
|
PB_BIND(meshtastic_Compressed, meshtastic_Compressed, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(meshtastic_NeighborInfo, meshtastic_NeighborInfo, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(meshtastic_Neighbor, meshtastic_Neighbor, AUTO)
|
||||||
|
|
||||||
|
|
||||||
PB_BIND(meshtastic_DeviceMetadata, meshtastic_DeviceMetadata, AUTO)
|
PB_BIND(meshtastic_DeviceMetadata, meshtastic_DeviceMetadata, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ typedef enum _meshtastic_HardwareModel {
|
|||||||
meshtastic_HardwareModel_NANO_G1_EXPLORER = 17,
|
meshtastic_HardwareModel_NANO_G1_EXPLORER = 17,
|
||||||
/* B&Q Consulting Station Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:station */
|
/* B&Q Consulting Station Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:station */
|
||||||
meshtastic_HardwareModel_STATION_G1 = 25,
|
meshtastic_HardwareModel_STATION_G1 = 25,
|
||||||
|
/* RAK11310 (RP2040 + SX1262) */
|
||||||
|
meshtastic_HardwareModel_RAK11310 = 26,
|
||||||
/* ---------------------------------------------------------------------------
|
/* ---------------------------------------------------------------------------
|
||||||
Less common/prototype boards listed here (needs one more byte over the air)
|
Less common/prototype boards listed here (needs one more byte over the air)
|
||||||
--------------------------------------------------------------------------- */
|
--------------------------------------------------------------------------- */
|
||||||
@@ -93,6 +95,8 @@ typedef enum _meshtastic_HardwareModel {
|
|||||||
meshtastic_HardwareModel_BETAFPV_2400_TX = 45,
|
meshtastic_HardwareModel_BETAFPV_2400_TX = 45,
|
||||||
/* BetaFPV ExpressLRS "Nano" TX Module 900MHz with ESP32 CPU */
|
/* BetaFPV ExpressLRS "Nano" TX Module 900MHz with ESP32 CPU */
|
||||||
meshtastic_HardwareModel_BETAFPV_900_NANO_TX = 46,
|
meshtastic_HardwareModel_BETAFPV_900_NANO_TX = 46,
|
||||||
|
/* Raspberry Pi Pico (W) with Waveshare SX1262 LoRa Node Module */
|
||||||
|
meshtastic_HardwareModel_RPI_PICO = 47,
|
||||||
/* ------------------------------------------------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits.
|
Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits.
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------ */
|
------------------------------------------------------------------------------------------------------------------------------------------ */
|
||||||
@@ -563,6 +567,8 @@ typedef struct _meshtastic_NodeInfo {
|
|||||||
/* The latest device metrics for the node. */
|
/* The latest device metrics for the node. */
|
||||||
bool has_device_metrics;
|
bool has_device_metrics;
|
||||||
meshtastic_DeviceMetrics device_metrics;
|
meshtastic_DeviceMetrics device_metrics;
|
||||||
|
/* local channel index we heard that node on. Only populated if its not the default channel. */
|
||||||
|
uint8_t channel;
|
||||||
} meshtastic_NodeInfo;
|
} meshtastic_NodeInfo;
|
||||||
|
|
||||||
/* Unique local debugging info for this node
|
/* Unique local debugging info for this node
|
||||||
@@ -678,6 +684,25 @@ typedef struct _meshtastic_Compressed {
|
|||||||
meshtastic_Compressed_data_t data;
|
meshtastic_Compressed_data_t data;
|
||||||
} meshtastic_Compressed;
|
} meshtastic_Compressed;
|
||||||
|
|
||||||
|
/* A single edge in the mesh */
|
||||||
|
typedef struct _meshtastic_Neighbor {
|
||||||
|
/* Node ID of neighbor */
|
||||||
|
uint32_t node_id;
|
||||||
|
/* SNR of last heard message */
|
||||||
|
float snr;
|
||||||
|
} meshtastic_Neighbor;
|
||||||
|
|
||||||
|
/* Full info on edges for a single node */
|
||||||
|
typedef struct _meshtastic_NeighborInfo {
|
||||||
|
/* The node ID of the node sending info on its neighbors */
|
||||||
|
uint32_t node_id;
|
||||||
|
/* Field to pass neighbor info for the next sending cycle */
|
||||||
|
uint32_t last_sent_by_id;
|
||||||
|
/* The list of out edges from this node */
|
||||||
|
pb_size_t neighbors_count;
|
||||||
|
meshtastic_Neighbor neighbors[10];
|
||||||
|
} meshtastic_NeighborInfo;
|
||||||
|
|
||||||
/* Device metadata response */
|
/* Device metadata response */
|
||||||
typedef struct _meshtastic_DeviceMetadata {
|
typedef struct _meshtastic_DeviceMetadata {
|
||||||
/* Device firmware version string */
|
/* Device firmware version string */
|
||||||
@@ -698,6 +723,8 @@ typedef struct _meshtastic_DeviceMetadata {
|
|||||||
uint32_t position_flags;
|
uint32_t position_flags;
|
||||||
/* Device hardware model */
|
/* Device hardware model */
|
||||||
meshtastic_HardwareModel hw_model;
|
meshtastic_HardwareModel hw_model;
|
||||||
|
/* Has Remote Hardware enabled */
|
||||||
|
bool hasRemoteHardware;
|
||||||
} meshtastic_DeviceMetadata;
|
} meshtastic_DeviceMetadata;
|
||||||
|
|
||||||
/* Packets from the radio to the phone will appear on the fromRadio characteristic.
|
/* Packets from the radio to the phone will appear on the fromRadio characteristic.
|
||||||
@@ -811,6 +838,8 @@ extern "C" {
|
|||||||
|
|
||||||
#define meshtastic_Compressed_portnum_ENUMTYPE meshtastic_PortNum
|
#define meshtastic_Compressed_portnum_ENUMTYPE meshtastic_PortNum
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define meshtastic_DeviceMetadata_role_ENUMTYPE meshtastic_Config_DeviceConfig_Role
|
#define meshtastic_DeviceMetadata_role_ENUMTYPE meshtastic_Config_DeviceConfig_Role
|
||||||
#define meshtastic_DeviceMetadata_hw_model_ENUMTYPE meshtastic_HardwareModel
|
#define meshtastic_DeviceMetadata_hw_model_ENUMTYPE meshtastic_HardwareModel
|
||||||
|
|
||||||
@@ -823,14 +852,16 @@ extern "C" {
|
|||||||
#define meshtastic_Data_init_default {_meshtastic_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0}
|
#define meshtastic_Data_init_default {_meshtastic_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_Waypoint_init_default {0, 0, 0, 0, 0, "", "", 0}
|
#define meshtastic_Waypoint_init_default {0, 0, 0, 0, 0, "", "", 0}
|
||||||
#define meshtastic_MeshPacket_init_default {0, 0, 0, 0, {meshtastic_Data_init_default}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN}
|
#define meshtastic_MeshPacket_init_default {0, 0, 0, 0, {meshtastic_Data_init_default}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN}
|
||||||
#define meshtastic_NodeInfo_init_default {0, false, meshtastic_User_init_default, false, meshtastic_Position_init_default, 0, 0, false, meshtastic_DeviceMetrics_init_default}
|
#define meshtastic_NodeInfo_init_default {0, false, meshtastic_User_init_default, false, meshtastic_Position_init_default, 0, 0, false, meshtastic_DeviceMetrics_init_default, 0}
|
||||||
#define meshtastic_MyNodeInfo_init_default {0, 0, 0, "", _meshtastic_CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0}
|
#define meshtastic_MyNodeInfo_init_default {0, 0, 0, "", _meshtastic_CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0}
|
||||||
#define meshtastic_LogRecord_init_default {"", 0, "", _meshtastic_LogRecord_Level_MIN}
|
#define meshtastic_LogRecord_init_default {"", 0, "", _meshtastic_LogRecord_Level_MIN}
|
||||||
#define meshtastic_QueueStatus_init_default {0, 0, 0, 0}
|
#define meshtastic_QueueStatus_init_default {0, 0, 0, 0}
|
||||||
#define meshtastic_FromRadio_init_default {0, 0, {meshtastic_MeshPacket_init_default}}
|
#define meshtastic_FromRadio_init_default {0, 0, {meshtastic_MeshPacket_init_default}}
|
||||||
#define meshtastic_ToRadio_init_default {0, {meshtastic_MeshPacket_init_default}}
|
#define meshtastic_ToRadio_init_default {0, {meshtastic_MeshPacket_init_default}}
|
||||||
#define meshtastic_Compressed_init_default {_meshtastic_PortNum_MIN, {0, {0}}}
|
#define meshtastic_Compressed_init_default {_meshtastic_PortNum_MIN, {0, {0}}}
|
||||||
#define meshtastic_DeviceMetadata_init_default {"", 0, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_Role_MIN, 0, _meshtastic_HardwareModel_MIN}
|
#define meshtastic_NeighborInfo_init_default {0, 0, 0, {meshtastic_Neighbor_init_default, meshtastic_Neighbor_init_default, meshtastic_Neighbor_init_default, meshtastic_Neighbor_init_default, meshtastic_Neighbor_init_default, meshtastic_Neighbor_init_default, meshtastic_Neighbor_init_default, meshtastic_Neighbor_init_default, meshtastic_Neighbor_init_default, meshtastic_Neighbor_init_default}}
|
||||||
|
#define meshtastic_Neighbor_init_default {0, 0}
|
||||||
|
#define meshtastic_DeviceMetadata_init_default {"", 0, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_Role_MIN, 0, _meshtastic_HardwareModel_MIN, 0}
|
||||||
#define meshtastic_Position_init_zero {0, 0, 0, 0, _meshtastic_Position_LocSource_MIN, _meshtastic_Position_AltSource_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
#define meshtastic_Position_init_zero {0, 0, 0, 0, _meshtastic_Position_LocSource_MIN, _meshtastic_Position_AltSource_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_User_init_zero {"", "", "", {0}, _meshtastic_HardwareModel_MIN, 0}
|
#define meshtastic_User_init_zero {"", "", "", {0}, _meshtastic_HardwareModel_MIN, 0}
|
||||||
#define meshtastic_RouteDiscovery_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}}
|
#define meshtastic_RouteDiscovery_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}}
|
||||||
@@ -838,14 +869,16 @@ extern "C" {
|
|||||||
#define meshtastic_Data_init_zero {_meshtastic_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0}
|
#define meshtastic_Data_init_zero {_meshtastic_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_Waypoint_init_zero {0, 0, 0, 0, 0, "", "", 0}
|
#define meshtastic_Waypoint_init_zero {0, 0, 0, 0, 0, "", "", 0}
|
||||||
#define meshtastic_MeshPacket_init_zero {0, 0, 0, 0, {meshtastic_Data_init_zero}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN}
|
#define meshtastic_MeshPacket_init_zero {0, 0, 0, 0, {meshtastic_Data_init_zero}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN}
|
||||||
#define meshtastic_NodeInfo_init_zero {0, false, meshtastic_User_init_zero, false, meshtastic_Position_init_zero, 0, 0, false, meshtastic_DeviceMetrics_init_zero}
|
#define meshtastic_NodeInfo_init_zero {0, false, meshtastic_User_init_zero, false, meshtastic_Position_init_zero, 0, 0, false, meshtastic_DeviceMetrics_init_zero, 0}
|
||||||
#define meshtastic_MyNodeInfo_init_zero {0, 0, 0, "", _meshtastic_CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0}
|
#define meshtastic_MyNodeInfo_init_zero {0, 0, 0, "", _meshtastic_CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0}
|
||||||
#define meshtastic_LogRecord_init_zero {"", 0, "", _meshtastic_LogRecord_Level_MIN}
|
#define meshtastic_LogRecord_init_zero {"", 0, "", _meshtastic_LogRecord_Level_MIN}
|
||||||
#define meshtastic_QueueStatus_init_zero {0, 0, 0, 0}
|
#define meshtastic_QueueStatus_init_zero {0, 0, 0, 0}
|
||||||
#define meshtastic_FromRadio_init_zero {0, 0, {meshtastic_MeshPacket_init_zero}}
|
#define meshtastic_FromRadio_init_zero {0, 0, {meshtastic_MeshPacket_init_zero}}
|
||||||
#define meshtastic_ToRadio_init_zero {0, {meshtastic_MeshPacket_init_zero}}
|
#define meshtastic_ToRadio_init_zero {0, {meshtastic_MeshPacket_init_zero}}
|
||||||
#define meshtastic_Compressed_init_zero {_meshtastic_PortNum_MIN, {0, {0}}}
|
#define meshtastic_Compressed_init_zero {_meshtastic_PortNum_MIN, {0, {0}}}
|
||||||
#define meshtastic_DeviceMetadata_init_zero {"", 0, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_Role_MIN, 0, _meshtastic_HardwareModel_MIN}
|
#define meshtastic_NeighborInfo_init_zero {0, 0, 0, {meshtastic_Neighbor_init_zero, meshtastic_Neighbor_init_zero, meshtastic_Neighbor_init_zero, meshtastic_Neighbor_init_zero, meshtastic_Neighbor_init_zero, meshtastic_Neighbor_init_zero, meshtastic_Neighbor_init_zero, meshtastic_Neighbor_init_zero, meshtastic_Neighbor_init_zero, meshtastic_Neighbor_init_zero}}
|
||||||
|
#define meshtastic_Neighbor_init_zero {0, 0}
|
||||||
|
#define meshtastic_DeviceMetadata_init_zero {"", 0, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_Role_MIN, 0, _meshtastic_HardwareModel_MIN, 0}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
#define meshtastic_Position_latitude_i_tag 1
|
#define meshtastic_Position_latitude_i_tag 1
|
||||||
@@ -915,6 +948,7 @@ extern "C" {
|
|||||||
#define meshtastic_NodeInfo_snr_tag 4
|
#define meshtastic_NodeInfo_snr_tag 4
|
||||||
#define meshtastic_NodeInfo_last_heard_tag 5
|
#define meshtastic_NodeInfo_last_heard_tag 5
|
||||||
#define meshtastic_NodeInfo_device_metrics_tag 6
|
#define meshtastic_NodeInfo_device_metrics_tag 6
|
||||||
|
#define meshtastic_NodeInfo_channel_tag 7
|
||||||
#define meshtastic_MyNodeInfo_my_node_num_tag 1
|
#define meshtastic_MyNodeInfo_my_node_num_tag 1
|
||||||
#define meshtastic_MyNodeInfo_has_gps_tag 2
|
#define meshtastic_MyNodeInfo_has_gps_tag 2
|
||||||
#define meshtastic_MyNodeInfo_max_channels_tag 3
|
#define meshtastic_MyNodeInfo_max_channels_tag 3
|
||||||
@@ -945,6 +979,11 @@ extern "C" {
|
|||||||
#define meshtastic_ToRadio_xmodemPacket_tag 5
|
#define meshtastic_ToRadio_xmodemPacket_tag 5
|
||||||
#define meshtastic_Compressed_portnum_tag 1
|
#define meshtastic_Compressed_portnum_tag 1
|
||||||
#define meshtastic_Compressed_data_tag 2
|
#define meshtastic_Compressed_data_tag 2
|
||||||
|
#define meshtastic_Neighbor_node_id_tag 1
|
||||||
|
#define meshtastic_Neighbor_snr_tag 2
|
||||||
|
#define meshtastic_NeighborInfo_node_id_tag 1
|
||||||
|
#define meshtastic_NeighborInfo_last_sent_by_id_tag 2
|
||||||
|
#define meshtastic_NeighborInfo_neighbors_tag 3
|
||||||
#define meshtastic_DeviceMetadata_firmware_version_tag 1
|
#define meshtastic_DeviceMetadata_firmware_version_tag 1
|
||||||
#define meshtastic_DeviceMetadata_device_state_version_tag 2
|
#define meshtastic_DeviceMetadata_device_state_version_tag 2
|
||||||
#define meshtastic_DeviceMetadata_canShutdown_tag 3
|
#define meshtastic_DeviceMetadata_canShutdown_tag 3
|
||||||
@@ -954,6 +993,7 @@ extern "C" {
|
|||||||
#define meshtastic_DeviceMetadata_role_tag 7
|
#define meshtastic_DeviceMetadata_role_tag 7
|
||||||
#define meshtastic_DeviceMetadata_position_flags_tag 8
|
#define meshtastic_DeviceMetadata_position_flags_tag 8
|
||||||
#define meshtastic_DeviceMetadata_hw_model_tag 9
|
#define meshtastic_DeviceMetadata_hw_model_tag 9
|
||||||
|
#define meshtastic_DeviceMetadata_hasRemoteHardware_tag 10
|
||||||
#define meshtastic_FromRadio_id_tag 1
|
#define meshtastic_FromRadio_id_tag 1
|
||||||
#define meshtastic_FromRadio_packet_tag 2
|
#define meshtastic_FromRadio_packet_tag 2
|
||||||
#define meshtastic_FromRadio_my_info_tag 3
|
#define meshtastic_FromRadio_my_info_tag 3
|
||||||
@@ -1067,7 +1107,8 @@ X(a, STATIC, OPTIONAL, MESSAGE, user, 2) \
|
|||||||
X(a, STATIC, OPTIONAL, MESSAGE, position, 3) \
|
X(a, STATIC, OPTIONAL, MESSAGE, position, 3) \
|
||||||
X(a, STATIC, SINGULAR, FLOAT, snr, 4) \
|
X(a, STATIC, SINGULAR, FLOAT, snr, 4) \
|
||||||
X(a, STATIC, SINGULAR, FIXED32, last_heard, 5) \
|
X(a, STATIC, SINGULAR, FIXED32, last_heard, 5) \
|
||||||
X(a, STATIC, OPTIONAL, MESSAGE, device_metrics, 6)
|
X(a, STATIC, OPTIONAL, MESSAGE, device_metrics, 6) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, channel, 7)
|
||||||
#define meshtastic_NodeInfo_CALLBACK NULL
|
#define meshtastic_NodeInfo_CALLBACK NULL
|
||||||
#define meshtastic_NodeInfo_DEFAULT NULL
|
#define meshtastic_NodeInfo_DEFAULT NULL
|
||||||
#define meshtastic_NodeInfo_user_MSGTYPE meshtastic_User
|
#define meshtastic_NodeInfo_user_MSGTYPE meshtastic_User
|
||||||
@@ -1153,6 +1194,20 @@ X(a, STATIC, SINGULAR, BYTES, data, 2)
|
|||||||
#define meshtastic_Compressed_CALLBACK NULL
|
#define meshtastic_Compressed_CALLBACK NULL
|
||||||
#define meshtastic_Compressed_DEFAULT NULL
|
#define meshtastic_Compressed_DEFAULT NULL
|
||||||
|
|
||||||
|
#define meshtastic_NeighborInfo_FIELDLIST(X, a) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, node_id, 1) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, last_sent_by_id, 2) \
|
||||||
|
X(a, STATIC, REPEATED, MESSAGE, neighbors, 3)
|
||||||
|
#define meshtastic_NeighborInfo_CALLBACK NULL
|
||||||
|
#define meshtastic_NeighborInfo_DEFAULT NULL
|
||||||
|
#define meshtastic_NeighborInfo_neighbors_MSGTYPE meshtastic_Neighbor
|
||||||
|
|
||||||
|
#define meshtastic_Neighbor_FIELDLIST(X, a) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, node_id, 1) \
|
||||||
|
X(a, STATIC, SINGULAR, FLOAT, snr, 2)
|
||||||
|
#define meshtastic_Neighbor_CALLBACK NULL
|
||||||
|
#define meshtastic_Neighbor_DEFAULT NULL
|
||||||
|
|
||||||
#define meshtastic_DeviceMetadata_FIELDLIST(X, a) \
|
#define meshtastic_DeviceMetadata_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, SINGULAR, STRING, firmware_version, 1) \
|
X(a, STATIC, SINGULAR, STRING, firmware_version, 1) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, device_state_version, 2) \
|
X(a, STATIC, SINGULAR, UINT32, device_state_version, 2) \
|
||||||
@@ -1162,7 +1217,8 @@ X(a, STATIC, SINGULAR, BOOL, hasBluetooth, 5) \
|
|||||||
X(a, STATIC, SINGULAR, BOOL, hasEthernet, 6) \
|
X(a, STATIC, SINGULAR, BOOL, hasEthernet, 6) \
|
||||||
X(a, STATIC, SINGULAR, UENUM, role, 7) \
|
X(a, STATIC, SINGULAR, UENUM, role, 7) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, position_flags, 8) \
|
X(a, STATIC, SINGULAR, UINT32, position_flags, 8) \
|
||||||
X(a, STATIC, SINGULAR, UENUM, hw_model, 9)
|
X(a, STATIC, SINGULAR, UENUM, hw_model, 9) \
|
||||||
|
X(a, STATIC, SINGULAR, BOOL, hasRemoteHardware, 10)
|
||||||
#define meshtastic_DeviceMetadata_CALLBACK NULL
|
#define meshtastic_DeviceMetadata_CALLBACK NULL
|
||||||
#define meshtastic_DeviceMetadata_DEFAULT NULL
|
#define meshtastic_DeviceMetadata_DEFAULT NULL
|
||||||
|
|
||||||
@@ -1180,6 +1236,8 @@ extern const pb_msgdesc_t meshtastic_QueueStatus_msg;
|
|||||||
extern const pb_msgdesc_t meshtastic_FromRadio_msg;
|
extern const pb_msgdesc_t meshtastic_FromRadio_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_ToRadio_msg;
|
extern const pb_msgdesc_t meshtastic_ToRadio_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_Compressed_msg;
|
extern const pb_msgdesc_t meshtastic_Compressed_msg;
|
||||||
|
extern const pb_msgdesc_t meshtastic_NeighborInfo_msg;
|
||||||
|
extern const pb_msgdesc_t meshtastic_Neighbor_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_DeviceMetadata_msg;
|
extern const pb_msgdesc_t meshtastic_DeviceMetadata_msg;
|
||||||
|
|
||||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||||
@@ -1197,17 +1255,21 @@ extern const pb_msgdesc_t meshtastic_DeviceMetadata_msg;
|
|||||||
#define meshtastic_FromRadio_fields &meshtastic_FromRadio_msg
|
#define meshtastic_FromRadio_fields &meshtastic_FromRadio_msg
|
||||||
#define meshtastic_ToRadio_fields &meshtastic_ToRadio_msg
|
#define meshtastic_ToRadio_fields &meshtastic_ToRadio_msg
|
||||||
#define meshtastic_Compressed_fields &meshtastic_Compressed_msg
|
#define meshtastic_Compressed_fields &meshtastic_Compressed_msg
|
||||||
|
#define meshtastic_NeighborInfo_fields &meshtastic_NeighborInfo_msg
|
||||||
|
#define meshtastic_Neighbor_fields &meshtastic_Neighbor_msg
|
||||||
#define meshtastic_DeviceMetadata_fields &meshtastic_DeviceMetadata_msg
|
#define meshtastic_DeviceMetadata_fields &meshtastic_DeviceMetadata_msg
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define meshtastic_Compressed_size 243
|
#define meshtastic_Compressed_size 243
|
||||||
#define meshtastic_Data_size 270
|
#define meshtastic_Data_size 270
|
||||||
#define meshtastic_DeviceMetadata_size 44
|
#define meshtastic_DeviceMetadata_size 46
|
||||||
#define meshtastic_FromRadio_size 330
|
#define meshtastic_FromRadio_size 330
|
||||||
#define meshtastic_LogRecord_size 81
|
#define meshtastic_LogRecord_size 81
|
||||||
#define meshtastic_MeshPacket_size 321
|
#define meshtastic_MeshPacket_size 321
|
||||||
#define meshtastic_MyNodeInfo_size 179
|
#define meshtastic_MyNodeInfo_size 179
|
||||||
#define meshtastic_NodeInfo_size 258
|
#define meshtastic_NeighborInfo_size 142
|
||||||
|
#define meshtastic_Neighbor_size 11
|
||||||
|
#define meshtastic_NodeInfo_size 261
|
||||||
#define meshtastic_Position_size 137
|
#define meshtastic_Position_size 137
|
||||||
#define meshtastic_QueueStatus_size 23
|
#define meshtastic_QueueStatus_size 23
|
||||||
#define meshtastic_RouteDiscovery_size 40
|
#define meshtastic_RouteDiscovery_size 40
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ PB_BIND(meshtastic_ModuleConfig_MQTTConfig, meshtastic_ModuleConfig_MQTTConfig,
|
|||||||
PB_BIND(meshtastic_ModuleConfig_RemoteHardwareConfig, meshtastic_ModuleConfig_RemoteHardwareConfig, AUTO)
|
PB_BIND(meshtastic_ModuleConfig_RemoteHardwareConfig, meshtastic_ModuleConfig_RemoteHardwareConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(meshtastic_ModuleConfig_NeighborInfoConfig, meshtastic_ModuleConfig_NeighborInfoConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
PB_BIND(meshtastic_ModuleConfig_AudioConfig, meshtastic_ModuleConfig_AudioConfig, AUTO)
|
PB_BIND(meshtastic_ModuleConfig_AudioConfig, meshtastic_ModuleConfig_AudioConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
@@ -36,6 +39,10 @@ PB_BIND(meshtastic_ModuleConfig_TelemetryConfig, meshtastic_ModuleConfig_Telemet
|
|||||||
PB_BIND(meshtastic_ModuleConfig_CannedMessageConfig, meshtastic_ModuleConfig_CannedMessageConfig, AUTO)
|
PB_BIND(meshtastic_ModuleConfig_CannedMessageConfig, meshtastic_ModuleConfig_CannedMessageConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(meshtastic_RemoteHardwarePin, meshtastic_RemoteHardwarePin, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,15 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enum definitions */
|
/* Enum definitions */
|
||||||
|
typedef enum _meshtastic_RemoteHardwarePinType {
|
||||||
|
/* Unset/unused */
|
||||||
|
meshtastic_RemoteHardwarePinType_UNKNOWN = 0,
|
||||||
|
/* GPIO pin can be read (if it is high / low) */
|
||||||
|
meshtastic_RemoteHardwarePinType_DIGITAL_READ = 1,
|
||||||
|
/* GPIO pin can be written to (high / low) */
|
||||||
|
meshtastic_RemoteHardwarePinType_DIGITAL_WRITE = 2
|
||||||
|
} meshtastic_RemoteHardwarePinType;
|
||||||
|
|
||||||
/* Baudrate for codec2 voice */
|
/* Baudrate for codec2 voice */
|
||||||
typedef enum _meshtastic_ModuleConfig_AudioConfig_Audio_Baud {
|
typedef enum _meshtastic_ModuleConfig_AudioConfig_Audio_Baud {
|
||||||
meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_DEFAULT = 0,
|
meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_DEFAULT = 0,
|
||||||
@@ -49,7 +58,9 @@ typedef enum _meshtastic_ModuleConfig_SerialConfig_Serial_Mode {
|
|||||||
meshtastic_ModuleConfig_SerialConfig_Serial_Mode_SIMPLE = 1,
|
meshtastic_ModuleConfig_SerialConfig_Serial_Mode_SIMPLE = 1,
|
||||||
meshtastic_ModuleConfig_SerialConfig_Serial_Mode_PROTO = 2,
|
meshtastic_ModuleConfig_SerialConfig_Serial_Mode_PROTO = 2,
|
||||||
meshtastic_ModuleConfig_SerialConfig_Serial_Mode_TEXTMSG = 3,
|
meshtastic_ModuleConfig_SerialConfig_Serial_Mode_TEXTMSG = 3,
|
||||||
meshtastic_ModuleConfig_SerialConfig_Serial_Mode_NMEA = 4
|
meshtastic_ModuleConfig_SerialConfig_Serial_Mode_NMEA = 4,
|
||||||
|
/* NMEA messages specifically tailored for CalTopo */
|
||||||
|
meshtastic_ModuleConfig_SerialConfig_Serial_Mode_CALTOPO = 5
|
||||||
} meshtastic_ModuleConfig_SerialConfig_Serial_Mode;
|
} meshtastic_ModuleConfig_SerialConfig_Serial_Mode;
|
||||||
|
|
||||||
/* TODO: REPLACE */
|
/* TODO: REPLACE */
|
||||||
@@ -96,13 +107,21 @@ typedef struct _meshtastic_ModuleConfig_MQTTConfig {
|
|||||||
bool encryption_enabled;
|
bool encryption_enabled;
|
||||||
/* Whether to send / consume json packets on MQTT */
|
/* Whether to send / consume json packets on MQTT */
|
||||||
bool json_enabled;
|
bool json_enabled;
|
||||||
|
/* If true, we attempt to establish a secure connection using TLS */
|
||||||
|
bool tls_enabled;
|
||||||
|
/* The root topic to use for MQTT messages. Default is "msh".
|
||||||
|
This is useful if you want to use a single MQTT server for multiple meshtastic networks and separate them via ACLs */
|
||||||
|
char root[16];
|
||||||
} meshtastic_ModuleConfig_MQTTConfig;
|
} meshtastic_ModuleConfig_MQTTConfig;
|
||||||
|
|
||||||
/* RemoteHardwareModule Config */
|
/* NeighborInfoModule Config */
|
||||||
typedef struct _meshtastic_ModuleConfig_RemoteHardwareConfig {
|
typedef struct _meshtastic_ModuleConfig_NeighborInfoConfig {
|
||||||
/* Whether the Module is enabled */
|
/* Whether the Module is enabled */
|
||||||
bool enabled;
|
bool enabled;
|
||||||
} meshtastic_ModuleConfig_RemoteHardwareConfig;
|
/* Interval in seconds of how often we should try to send our
|
||||||
|
Neighbor Info to the mesh */
|
||||||
|
uint32_t update_interval;
|
||||||
|
} meshtastic_ModuleConfig_NeighborInfoConfig;
|
||||||
|
|
||||||
/* Audio Config for codec2 voice */
|
/* Audio Config for codec2 voice */
|
||||||
typedef struct _meshtastic_ModuleConfig_AudioConfig {
|
typedef struct _meshtastic_ModuleConfig_AudioConfig {
|
||||||
@@ -124,21 +143,24 @@ typedef struct _meshtastic_ModuleConfig_AudioConfig {
|
|||||||
|
|
||||||
/* Serial Config */
|
/* Serial Config */
|
||||||
typedef struct _meshtastic_ModuleConfig_SerialConfig {
|
typedef struct _meshtastic_ModuleConfig_SerialConfig {
|
||||||
/* Preferences for the SerialModule
|
/* Preferences for the SerialModule */
|
||||||
FIXME - Move this out of UserPreferences and into a section for module configuration. */
|
|
||||||
bool enabled;
|
bool enabled;
|
||||||
/* TODO: REPLACE */
|
/* TODO: REPLACE */
|
||||||
bool echo;
|
bool echo;
|
||||||
/* TODO: REPLACE */
|
/* RX pin (should match Arduino gpio pin number) */
|
||||||
uint32_t rxd;
|
uint32_t rxd;
|
||||||
/* TODO: REPLACE */
|
/* TX pin (should match Arduino gpio pin number) */
|
||||||
uint32_t txd;
|
uint32_t txd;
|
||||||
/* TODO: REPLACE */
|
/* Serial baud rate */
|
||||||
meshtastic_ModuleConfig_SerialConfig_Serial_Baud baud;
|
meshtastic_ModuleConfig_SerialConfig_Serial_Baud baud;
|
||||||
/* TODO: REPLACE */
|
/* TODO: REPLACE */
|
||||||
uint32_t timeout;
|
uint32_t timeout;
|
||||||
/* TODO: REPLACE */
|
/* Mode for serial module operation */
|
||||||
meshtastic_ModuleConfig_SerialConfig_Serial_Mode mode;
|
meshtastic_ModuleConfig_SerialConfig_Serial_Mode mode;
|
||||||
|
/* Overrides the platform's defacto Serial port instance to use with Serial module config settings
|
||||||
|
This is currently only usable in output modes like NMEA / CalTopo and may behave strangely or not work at all in other modes
|
||||||
|
Existing logging over the Serial Console will still be present */
|
||||||
|
bool override_console_serial_port;
|
||||||
} meshtastic_ModuleConfig_SerialConfig;
|
} meshtastic_ModuleConfig_SerialConfig;
|
||||||
|
|
||||||
/* External Notifications Config */
|
/* External Notifications Config */
|
||||||
@@ -203,7 +225,7 @@ typedef struct _meshtastic_ModuleConfig_RangeTestConfig {
|
|||||||
bool enabled;
|
bool enabled;
|
||||||
/* Send out range test messages from this node */
|
/* Send out range test messages from this node */
|
||||||
uint32_t sender;
|
uint32_t sender;
|
||||||
/* Bool value indicating that this node should save a RangeTest.csv file.
|
/* Bool value indicating that this node should save a RangeTest.csv file.
|
||||||
ESP32 Only */
|
ESP32 Only */
|
||||||
bool save;
|
bool save;
|
||||||
} meshtastic_ModuleConfig_RangeTestConfig;
|
} meshtastic_ModuleConfig_RangeTestConfig;
|
||||||
@@ -257,6 +279,27 @@ typedef struct _meshtastic_ModuleConfig_CannedMessageConfig {
|
|||||||
bool send_bell;
|
bool send_bell;
|
||||||
} meshtastic_ModuleConfig_CannedMessageConfig;
|
} meshtastic_ModuleConfig_CannedMessageConfig;
|
||||||
|
|
||||||
|
/* A GPIO pin definition for remote hardware module */
|
||||||
|
typedef struct _meshtastic_RemoteHardwarePin {
|
||||||
|
/* GPIO Pin number (must match Arduino) */
|
||||||
|
uint8_t gpio_pin;
|
||||||
|
/* Name for the GPIO pin (i.e. Front gate, mailbox, etc) */
|
||||||
|
char name[15];
|
||||||
|
/* Type of GPIO access available to consumers on the mesh */
|
||||||
|
meshtastic_RemoteHardwarePinType type;
|
||||||
|
} meshtastic_RemoteHardwarePin;
|
||||||
|
|
||||||
|
/* RemoteHardwareModule Config */
|
||||||
|
typedef struct _meshtastic_ModuleConfig_RemoteHardwareConfig {
|
||||||
|
/* Whether the Module is enabled */
|
||||||
|
bool enabled;
|
||||||
|
/* Whether the Module allows consumers to read / write to pins not defined in available_pins */
|
||||||
|
bool allow_undefined_pin_access;
|
||||||
|
/* Exposes the available pins to the mesh for reading and writing */
|
||||||
|
pb_size_t available_pins_count;
|
||||||
|
meshtastic_RemoteHardwarePin available_pins[4];
|
||||||
|
} meshtastic_ModuleConfig_RemoteHardwareConfig;
|
||||||
|
|
||||||
/* Module Config */
|
/* Module Config */
|
||||||
typedef struct _meshtastic_ModuleConfig {
|
typedef struct _meshtastic_ModuleConfig {
|
||||||
pb_size_t which_payload_variant;
|
pb_size_t which_payload_variant;
|
||||||
@@ -279,6 +322,8 @@ typedef struct _meshtastic_ModuleConfig {
|
|||||||
meshtastic_ModuleConfig_AudioConfig audio;
|
meshtastic_ModuleConfig_AudioConfig audio;
|
||||||
/* TODO: REPLACE */
|
/* TODO: REPLACE */
|
||||||
meshtastic_ModuleConfig_RemoteHardwareConfig remote_hardware;
|
meshtastic_ModuleConfig_RemoteHardwareConfig remote_hardware;
|
||||||
|
/* TODO: REPLACE */
|
||||||
|
meshtastic_ModuleConfig_NeighborInfoConfig neighbor_info;
|
||||||
} payload_variant;
|
} payload_variant;
|
||||||
} meshtastic_ModuleConfig;
|
} meshtastic_ModuleConfig;
|
||||||
|
|
||||||
@@ -288,6 +333,10 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Helper constants for enums */
|
/* Helper constants for enums */
|
||||||
|
#define _meshtastic_RemoteHardwarePinType_MIN meshtastic_RemoteHardwarePinType_UNKNOWN
|
||||||
|
#define _meshtastic_RemoteHardwarePinType_MAX meshtastic_RemoteHardwarePinType_DIGITAL_WRITE
|
||||||
|
#define _meshtastic_RemoteHardwarePinType_ARRAYSIZE ((meshtastic_RemoteHardwarePinType)(meshtastic_RemoteHardwarePinType_DIGITAL_WRITE+1))
|
||||||
|
|
||||||
#define _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MIN meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_DEFAULT
|
#define _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MIN meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_DEFAULT
|
||||||
#define _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MAX meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700B
|
#define _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MAX meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700B
|
||||||
#define _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_ARRAYSIZE ((meshtastic_ModuleConfig_AudioConfig_Audio_Baud)(meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700B+1))
|
#define _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_ARRAYSIZE ((meshtastic_ModuleConfig_AudioConfig_Audio_Baud)(meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700B+1))
|
||||||
@@ -297,8 +346,8 @@ extern "C" {
|
|||||||
#define _meshtastic_ModuleConfig_SerialConfig_Serial_Baud_ARRAYSIZE ((meshtastic_ModuleConfig_SerialConfig_Serial_Baud)(meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_921600+1))
|
#define _meshtastic_ModuleConfig_SerialConfig_Serial_Baud_ARRAYSIZE ((meshtastic_ModuleConfig_SerialConfig_Serial_Baud)(meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_921600+1))
|
||||||
|
|
||||||
#define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MIN meshtastic_ModuleConfig_SerialConfig_Serial_Mode_DEFAULT
|
#define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MIN meshtastic_ModuleConfig_SerialConfig_Serial_Mode_DEFAULT
|
||||||
#define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MAX meshtastic_ModuleConfig_SerialConfig_Serial_Mode_NMEA
|
#define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MAX meshtastic_ModuleConfig_SerialConfig_Serial_Mode_CALTOPO
|
||||||
#define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_ARRAYSIZE ((meshtastic_ModuleConfig_SerialConfig_Serial_Mode)(meshtastic_ModuleConfig_SerialConfig_Serial_Mode_NMEA+1))
|
#define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_ARRAYSIZE ((meshtastic_ModuleConfig_SerialConfig_Serial_Mode)(meshtastic_ModuleConfig_SerialConfig_Serial_Mode_CALTOPO+1))
|
||||||
|
|
||||||
#define _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE
|
#define _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE
|
||||||
#define _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MAX meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_BACK
|
#define _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MAX meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_BACK
|
||||||
@@ -307,6 +356,7 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define meshtastic_ModuleConfig_AudioConfig_bitrate_ENUMTYPE meshtastic_ModuleConfig_AudioConfig_Audio_Baud
|
#define meshtastic_ModuleConfig_AudioConfig_bitrate_ENUMTYPE meshtastic_ModuleConfig_AudioConfig_Audio_Baud
|
||||||
|
|
||||||
#define meshtastic_ModuleConfig_SerialConfig_baud_ENUMTYPE meshtastic_ModuleConfig_SerialConfig_Serial_Baud
|
#define meshtastic_ModuleConfig_SerialConfig_baud_ENUMTYPE meshtastic_ModuleConfig_SerialConfig_Serial_Baud
|
||||||
@@ -320,28 +370,34 @@ extern "C" {
|
|||||||
#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_event_ccw_ENUMTYPE meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar
|
#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_event_ccw_ENUMTYPE meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar
|
||||||
#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_event_press_ENUMTYPE meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar
|
#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_event_press_ENUMTYPE meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar
|
||||||
|
|
||||||
|
#define meshtastic_RemoteHardwarePin_type_ENUMTYPE meshtastic_RemoteHardwarePinType
|
||||||
|
|
||||||
|
|
||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define meshtastic_ModuleConfig_init_default {0, {meshtastic_ModuleConfig_MQTTConfig_init_default}}
|
#define meshtastic_ModuleConfig_init_default {0, {meshtastic_ModuleConfig_MQTTConfig_init_default}}
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_init_default {0, "", "", "", 0, 0}
|
#define meshtastic_ModuleConfig_MQTTConfig_init_default {0, "", "", "", 0, 0, 0, ""}
|
||||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_init_default {0}
|
#define meshtastic_ModuleConfig_RemoteHardwareConfig_init_default {0, 0, 0, {meshtastic_RemoteHardwarePin_init_default, meshtastic_RemoteHardwarePin_init_default, meshtastic_RemoteHardwarePin_init_default, meshtastic_RemoteHardwarePin_init_default}}
|
||||||
|
#define meshtastic_ModuleConfig_NeighborInfoConfig_init_default {0, 0}
|
||||||
#define meshtastic_ModuleConfig_AudioConfig_init_default {0, 0, _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MIN, 0, 0, 0, 0}
|
#define meshtastic_ModuleConfig_AudioConfig_init_default {0, 0, _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MIN, 0, 0, 0, 0}
|
||||||
#define meshtastic_ModuleConfig_SerialConfig_init_default {0, 0, 0, 0, _meshtastic_ModuleConfig_SerialConfig_Serial_Baud_MIN, 0, _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MIN}
|
#define meshtastic_ModuleConfig_SerialConfig_init_default {0, 0, 0, 0, _meshtastic_ModuleConfig_SerialConfig_Serial_Baud_MIN, 0, _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MIN, 0}
|
||||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
#define meshtastic_ModuleConfig_ExternalNotificationConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_ModuleConfig_StoreForwardConfig_init_default {0, 0, 0, 0, 0}
|
#define meshtastic_ModuleConfig_StoreForwardConfig_init_default {0, 0, 0, 0, 0}
|
||||||
#define meshtastic_ModuleConfig_RangeTestConfig_init_default {0, 0, 0}
|
#define meshtastic_ModuleConfig_RangeTestConfig_init_default {0, 0, 0}
|
||||||
#define meshtastic_ModuleConfig_TelemetryConfig_init_default {0, 0, 0, 0, 0, 0, 0}
|
#define meshtastic_ModuleConfig_TelemetryConfig_init_default {0, 0, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_ModuleConfig_CannedMessageConfig_init_default {0, 0, 0, 0, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0}
|
#define meshtastic_ModuleConfig_CannedMessageConfig_init_default {0, 0, 0, 0, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0}
|
||||||
|
#define meshtastic_RemoteHardwarePin_init_default {0, "", _meshtastic_RemoteHardwarePinType_MIN}
|
||||||
#define meshtastic_ModuleConfig_init_zero {0, {meshtastic_ModuleConfig_MQTTConfig_init_zero}}
|
#define meshtastic_ModuleConfig_init_zero {0, {meshtastic_ModuleConfig_MQTTConfig_init_zero}}
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_init_zero {0, "", "", "", 0, 0}
|
#define meshtastic_ModuleConfig_MQTTConfig_init_zero {0, "", "", "", 0, 0, 0, ""}
|
||||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_init_zero {0}
|
#define meshtastic_ModuleConfig_RemoteHardwareConfig_init_zero {0, 0, 0, {meshtastic_RemoteHardwarePin_init_zero, meshtastic_RemoteHardwarePin_init_zero, meshtastic_RemoteHardwarePin_init_zero, meshtastic_RemoteHardwarePin_init_zero}}
|
||||||
|
#define meshtastic_ModuleConfig_NeighborInfoConfig_init_zero {0, 0}
|
||||||
#define meshtastic_ModuleConfig_AudioConfig_init_zero {0, 0, _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MIN, 0, 0, 0, 0}
|
#define meshtastic_ModuleConfig_AudioConfig_init_zero {0, 0, _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MIN, 0, 0, 0, 0}
|
||||||
#define meshtastic_ModuleConfig_SerialConfig_init_zero {0, 0, 0, 0, _meshtastic_ModuleConfig_SerialConfig_Serial_Baud_MIN, 0, _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MIN}
|
#define meshtastic_ModuleConfig_SerialConfig_init_zero {0, 0, 0, 0, _meshtastic_ModuleConfig_SerialConfig_Serial_Baud_MIN, 0, _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MIN, 0}
|
||||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
#define meshtastic_ModuleConfig_ExternalNotificationConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_ModuleConfig_StoreForwardConfig_init_zero {0, 0, 0, 0, 0}
|
#define meshtastic_ModuleConfig_StoreForwardConfig_init_zero {0, 0, 0, 0, 0}
|
||||||
#define meshtastic_ModuleConfig_RangeTestConfig_init_zero {0, 0, 0}
|
#define meshtastic_ModuleConfig_RangeTestConfig_init_zero {0, 0, 0}
|
||||||
#define meshtastic_ModuleConfig_TelemetryConfig_init_zero {0, 0, 0, 0, 0, 0, 0}
|
#define meshtastic_ModuleConfig_TelemetryConfig_init_zero {0, 0, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_ModuleConfig_CannedMessageConfig_init_zero {0, 0, 0, 0, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0}
|
#define meshtastic_ModuleConfig_CannedMessageConfig_init_zero {0, 0, 0, 0, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0}
|
||||||
|
#define meshtastic_RemoteHardwarePin_init_zero {0, "", _meshtastic_RemoteHardwarePinType_MIN}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_enabled_tag 1
|
#define meshtastic_ModuleConfig_MQTTConfig_enabled_tag 1
|
||||||
@@ -350,7 +406,10 @@ extern "C" {
|
|||||||
#define meshtastic_ModuleConfig_MQTTConfig_password_tag 4
|
#define meshtastic_ModuleConfig_MQTTConfig_password_tag 4
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_encryption_enabled_tag 5
|
#define meshtastic_ModuleConfig_MQTTConfig_encryption_enabled_tag 5
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_json_enabled_tag 6
|
#define meshtastic_ModuleConfig_MQTTConfig_json_enabled_tag 6
|
||||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_enabled_tag 1
|
#define meshtastic_ModuleConfig_MQTTConfig_tls_enabled_tag 7
|
||||||
|
#define meshtastic_ModuleConfig_MQTTConfig_root_tag 8
|
||||||
|
#define meshtastic_ModuleConfig_NeighborInfoConfig_enabled_tag 1
|
||||||
|
#define meshtastic_ModuleConfig_NeighborInfoConfig_update_interval_tag 2
|
||||||
#define meshtastic_ModuleConfig_AudioConfig_codec2_enabled_tag 1
|
#define meshtastic_ModuleConfig_AudioConfig_codec2_enabled_tag 1
|
||||||
#define meshtastic_ModuleConfig_AudioConfig_ptt_pin_tag 2
|
#define meshtastic_ModuleConfig_AudioConfig_ptt_pin_tag 2
|
||||||
#define meshtastic_ModuleConfig_AudioConfig_bitrate_tag 3
|
#define meshtastic_ModuleConfig_AudioConfig_bitrate_tag 3
|
||||||
@@ -365,6 +424,7 @@ extern "C" {
|
|||||||
#define meshtastic_ModuleConfig_SerialConfig_baud_tag 5
|
#define meshtastic_ModuleConfig_SerialConfig_baud_tag 5
|
||||||
#define meshtastic_ModuleConfig_SerialConfig_timeout_tag 6
|
#define meshtastic_ModuleConfig_SerialConfig_timeout_tag 6
|
||||||
#define meshtastic_ModuleConfig_SerialConfig_mode_tag 7
|
#define meshtastic_ModuleConfig_SerialConfig_mode_tag 7
|
||||||
|
#define meshtastic_ModuleConfig_SerialConfig_override_console_serial_port_tag 8
|
||||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_enabled_tag 1
|
#define meshtastic_ModuleConfig_ExternalNotificationConfig_enabled_tag 1
|
||||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_output_ms_tag 2
|
#define meshtastic_ModuleConfig_ExternalNotificationConfig_output_ms_tag 2
|
||||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_output_tag 3
|
#define meshtastic_ModuleConfig_ExternalNotificationConfig_output_tag 3
|
||||||
@@ -405,6 +465,12 @@ extern "C" {
|
|||||||
#define meshtastic_ModuleConfig_CannedMessageConfig_enabled_tag 9
|
#define meshtastic_ModuleConfig_CannedMessageConfig_enabled_tag 9
|
||||||
#define meshtastic_ModuleConfig_CannedMessageConfig_allow_input_source_tag 10
|
#define meshtastic_ModuleConfig_CannedMessageConfig_allow_input_source_tag 10
|
||||||
#define meshtastic_ModuleConfig_CannedMessageConfig_send_bell_tag 11
|
#define meshtastic_ModuleConfig_CannedMessageConfig_send_bell_tag 11
|
||||||
|
#define meshtastic_RemoteHardwarePin_gpio_pin_tag 1
|
||||||
|
#define meshtastic_RemoteHardwarePin_name_tag 2
|
||||||
|
#define meshtastic_RemoteHardwarePin_type_tag 3
|
||||||
|
#define meshtastic_ModuleConfig_RemoteHardwareConfig_enabled_tag 1
|
||||||
|
#define meshtastic_ModuleConfig_RemoteHardwareConfig_allow_undefined_pin_access_tag 2
|
||||||
|
#define meshtastic_ModuleConfig_RemoteHardwareConfig_available_pins_tag 3
|
||||||
#define meshtastic_ModuleConfig_mqtt_tag 1
|
#define meshtastic_ModuleConfig_mqtt_tag 1
|
||||||
#define meshtastic_ModuleConfig_serial_tag 2
|
#define meshtastic_ModuleConfig_serial_tag 2
|
||||||
#define meshtastic_ModuleConfig_external_notification_tag 3
|
#define meshtastic_ModuleConfig_external_notification_tag 3
|
||||||
@@ -414,6 +480,7 @@ extern "C" {
|
|||||||
#define meshtastic_ModuleConfig_canned_message_tag 7
|
#define meshtastic_ModuleConfig_canned_message_tag 7
|
||||||
#define meshtastic_ModuleConfig_audio_tag 8
|
#define meshtastic_ModuleConfig_audio_tag 8
|
||||||
#define meshtastic_ModuleConfig_remote_hardware_tag 9
|
#define meshtastic_ModuleConfig_remote_hardware_tag 9
|
||||||
|
#define meshtastic_ModuleConfig_neighbor_info_tag 10
|
||||||
|
|
||||||
/* Struct field encoding specification for nanopb */
|
/* Struct field encoding specification for nanopb */
|
||||||
#define meshtastic_ModuleConfig_FIELDLIST(X, a) \
|
#define meshtastic_ModuleConfig_FIELDLIST(X, a) \
|
||||||
@@ -425,7 +492,8 @@ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,range_test,payload_variant.r
|
|||||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,telemetry,payload_variant.telemetry), 6) \
|
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,telemetry,payload_variant.telemetry), 6) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,canned_message,payload_variant.canned_message), 7) \
|
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,canned_message,payload_variant.canned_message), 7) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,audio,payload_variant.audio), 8) \
|
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,audio,payload_variant.audio), 8) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,remote_hardware,payload_variant.remote_hardware), 9)
|
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,remote_hardware,payload_variant.remote_hardware), 9) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,neighbor_info,payload_variant.neighbor_info), 10)
|
||||||
#define meshtastic_ModuleConfig_CALLBACK NULL
|
#define meshtastic_ModuleConfig_CALLBACK NULL
|
||||||
#define meshtastic_ModuleConfig_DEFAULT NULL
|
#define meshtastic_ModuleConfig_DEFAULT NULL
|
||||||
#define meshtastic_ModuleConfig_payload_variant_mqtt_MSGTYPE meshtastic_ModuleConfig_MQTTConfig
|
#define meshtastic_ModuleConfig_payload_variant_mqtt_MSGTYPE meshtastic_ModuleConfig_MQTTConfig
|
||||||
@@ -437,6 +505,7 @@ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,remote_hardware,payload_vari
|
|||||||
#define meshtastic_ModuleConfig_payload_variant_canned_message_MSGTYPE meshtastic_ModuleConfig_CannedMessageConfig
|
#define meshtastic_ModuleConfig_payload_variant_canned_message_MSGTYPE meshtastic_ModuleConfig_CannedMessageConfig
|
||||||
#define meshtastic_ModuleConfig_payload_variant_audio_MSGTYPE meshtastic_ModuleConfig_AudioConfig
|
#define meshtastic_ModuleConfig_payload_variant_audio_MSGTYPE meshtastic_ModuleConfig_AudioConfig
|
||||||
#define meshtastic_ModuleConfig_payload_variant_remote_hardware_MSGTYPE meshtastic_ModuleConfig_RemoteHardwareConfig
|
#define meshtastic_ModuleConfig_payload_variant_remote_hardware_MSGTYPE meshtastic_ModuleConfig_RemoteHardwareConfig
|
||||||
|
#define meshtastic_ModuleConfig_payload_variant_neighbor_info_MSGTYPE meshtastic_ModuleConfig_NeighborInfoConfig
|
||||||
|
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_FIELDLIST(X, a) \
|
#define meshtastic_ModuleConfig_MQTTConfig_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, enabled, 1) \
|
X(a, STATIC, SINGULAR, BOOL, enabled, 1) \
|
||||||
@@ -444,14 +513,25 @@ X(a, STATIC, SINGULAR, STRING, address, 2) \
|
|||||||
X(a, STATIC, SINGULAR, STRING, username, 3) \
|
X(a, STATIC, SINGULAR, STRING, username, 3) \
|
||||||
X(a, STATIC, SINGULAR, STRING, password, 4) \
|
X(a, STATIC, SINGULAR, STRING, password, 4) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, encryption_enabled, 5) \
|
X(a, STATIC, SINGULAR, BOOL, encryption_enabled, 5) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, json_enabled, 6)
|
X(a, STATIC, SINGULAR, BOOL, json_enabled, 6) \
|
||||||
|
X(a, STATIC, SINGULAR, BOOL, tls_enabled, 7) \
|
||||||
|
X(a, STATIC, SINGULAR, STRING, root, 8)
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_CALLBACK NULL
|
#define meshtastic_ModuleConfig_MQTTConfig_CALLBACK NULL
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_DEFAULT NULL
|
#define meshtastic_ModuleConfig_MQTTConfig_DEFAULT NULL
|
||||||
|
|
||||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_FIELDLIST(X, a) \
|
#define meshtastic_ModuleConfig_RemoteHardwareConfig_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, enabled, 1)
|
X(a, STATIC, SINGULAR, BOOL, enabled, 1) \
|
||||||
|
X(a, STATIC, SINGULAR, BOOL, allow_undefined_pin_access, 2) \
|
||||||
|
X(a, STATIC, REPEATED, MESSAGE, available_pins, 3)
|
||||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_CALLBACK NULL
|
#define meshtastic_ModuleConfig_RemoteHardwareConfig_CALLBACK NULL
|
||||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_DEFAULT NULL
|
#define meshtastic_ModuleConfig_RemoteHardwareConfig_DEFAULT NULL
|
||||||
|
#define meshtastic_ModuleConfig_RemoteHardwareConfig_available_pins_MSGTYPE meshtastic_RemoteHardwarePin
|
||||||
|
|
||||||
|
#define meshtastic_ModuleConfig_NeighborInfoConfig_FIELDLIST(X, a) \
|
||||||
|
X(a, STATIC, SINGULAR, BOOL, enabled, 1) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, update_interval, 2)
|
||||||
|
#define meshtastic_ModuleConfig_NeighborInfoConfig_CALLBACK NULL
|
||||||
|
#define meshtastic_ModuleConfig_NeighborInfoConfig_DEFAULT NULL
|
||||||
|
|
||||||
#define meshtastic_ModuleConfig_AudioConfig_FIELDLIST(X, a) \
|
#define meshtastic_ModuleConfig_AudioConfig_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, codec2_enabled, 1) \
|
X(a, STATIC, SINGULAR, BOOL, codec2_enabled, 1) \
|
||||||
@@ -471,7 +551,8 @@ X(a, STATIC, SINGULAR, UINT32, rxd, 3) \
|
|||||||
X(a, STATIC, SINGULAR, UINT32, txd, 4) \
|
X(a, STATIC, SINGULAR, UINT32, txd, 4) \
|
||||||
X(a, STATIC, SINGULAR, UENUM, baud, 5) \
|
X(a, STATIC, SINGULAR, UENUM, baud, 5) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, timeout, 6) \
|
X(a, STATIC, SINGULAR, UINT32, timeout, 6) \
|
||||||
X(a, STATIC, SINGULAR, UENUM, mode, 7)
|
X(a, STATIC, SINGULAR, UENUM, mode, 7) \
|
||||||
|
X(a, STATIC, SINGULAR, BOOL, override_console_serial_port, 8)
|
||||||
#define meshtastic_ModuleConfig_SerialConfig_CALLBACK NULL
|
#define meshtastic_ModuleConfig_SerialConfig_CALLBACK NULL
|
||||||
#define meshtastic_ModuleConfig_SerialConfig_DEFAULT NULL
|
#define meshtastic_ModuleConfig_SerialConfig_DEFAULT NULL
|
||||||
|
|
||||||
@@ -535,9 +616,17 @@ X(a, STATIC, SINGULAR, BOOL, send_bell, 11)
|
|||||||
#define meshtastic_ModuleConfig_CannedMessageConfig_CALLBACK NULL
|
#define meshtastic_ModuleConfig_CannedMessageConfig_CALLBACK NULL
|
||||||
#define meshtastic_ModuleConfig_CannedMessageConfig_DEFAULT NULL
|
#define meshtastic_ModuleConfig_CannedMessageConfig_DEFAULT NULL
|
||||||
|
|
||||||
|
#define meshtastic_RemoteHardwarePin_FIELDLIST(X, a) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, gpio_pin, 1) \
|
||||||
|
X(a, STATIC, SINGULAR, STRING, name, 2) \
|
||||||
|
X(a, STATIC, SINGULAR, UENUM, type, 3)
|
||||||
|
#define meshtastic_RemoteHardwarePin_CALLBACK NULL
|
||||||
|
#define meshtastic_RemoteHardwarePin_DEFAULT NULL
|
||||||
|
|
||||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_msg;
|
extern const pb_msgdesc_t meshtastic_ModuleConfig_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_MQTTConfig_msg;
|
extern const pb_msgdesc_t meshtastic_ModuleConfig_MQTTConfig_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_RemoteHardwareConfig_msg;
|
extern const pb_msgdesc_t meshtastic_ModuleConfig_RemoteHardwareConfig_msg;
|
||||||
|
extern const pb_msgdesc_t meshtastic_ModuleConfig_NeighborInfoConfig_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_AudioConfig_msg;
|
extern const pb_msgdesc_t meshtastic_ModuleConfig_AudioConfig_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_SerialConfig_msg;
|
extern const pb_msgdesc_t meshtastic_ModuleConfig_SerialConfig_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_ExternalNotificationConfig_msg;
|
extern const pb_msgdesc_t meshtastic_ModuleConfig_ExternalNotificationConfig_msg;
|
||||||
@@ -545,11 +634,13 @@ extern const pb_msgdesc_t meshtastic_ModuleConfig_StoreForwardConfig_msg;
|
|||||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_RangeTestConfig_msg;
|
extern const pb_msgdesc_t meshtastic_ModuleConfig_RangeTestConfig_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_TelemetryConfig_msg;
|
extern const pb_msgdesc_t meshtastic_ModuleConfig_TelemetryConfig_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_ModuleConfig_CannedMessageConfig_msg;
|
extern const pb_msgdesc_t meshtastic_ModuleConfig_CannedMessageConfig_msg;
|
||||||
|
extern const pb_msgdesc_t meshtastic_RemoteHardwarePin_msg;
|
||||||
|
|
||||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||||
#define meshtastic_ModuleConfig_fields &meshtastic_ModuleConfig_msg
|
#define meshtastic_ModuleConfig_fields &meshtastic_ModuleConfig_msg
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_fields &meshtastic_ModuleConfig_MQTTConfig_msg
|
#define meshtastic_ModuleConfig_MQTTConfig_fields &meshtastic_ModuleConfig_MQTTConfig_msg
|
||||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_fields &meshtastic_ModuleConfig_RemoteHardwareConfig_msg
|
#define meshtastic_ModuleConfig_RemoteHardwareConfig_fields &meshtastic_ModuleConfig_RemoteHardwareConfig_msg
|
||||||
|
#define meshtastic_ModuleConfig_NeighborInfoConfig_fields &meshtastic_ModuleConfig_NeighborInfoConfig_msg
|
||||||
#define meshtastic_ModuleConfig_AudioConfig_fields &meshtastic_ModuleConfig_AudioConfig_msg
|
#define meshtastic_ModuleConfig_AudioConfig_fields &meshtastic_ModuleConfig_AudioConfig_msg
|
||||||
#define meshtastic_ModuleConfig_SerialConfig_fields &meshtastic_ModuleConfig_SerialConfig_msg
|
#define meshtastic_ModuleConfig_SerialConfig_fields &meshtastic_ModuleConfig_SerialConfig_msg
|
||||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_fields &meshtastic_ModuleConfig_ExternalNotificationConfig_msg
|
#define meshtastic_ModuleConfig_ExternalNotificationConfig_fields &meshtastic_ModuleConfig_ExternalNotificationConfig_msg
|
||||||
@@ -557,18 +648,21 @@ extern const pb_msgdesc_t meshtastic_ModuleConfig_CannedMessageConfig_msg;
|
|||||||
#define meshtastic_ModuleConfig_RangeTestConfig_fields &meshtastic_ModuleConfig_RangeTestConfig_msg
|
#define meshtastic_ModuleConfig_RangeTestConfig_fields &meshtastic_ModuleConfig_RangeTestConfig_msg
|
||||||
#define meshtastic_ModuleConfig_TelemetryConfig_fields &meshtastic_ModuleConfig_TelemetryConfig_msg
|
#define meshtastic_ModuleConfig_TelemetryConfig_fields &meshtastic_ModuleConfig_TelemetryConfig_msg
|
||||||
#define meshtastic_ModuleConfig_CannedMessageConfig_fields &meshtastic_ModuleConfig_CannedMessageConfig_msg
|
#define meshtastic_ModuleConfig_CannedMessageConfig_fields &meshtastic_ModuleConfig_CannedMessageConfig_msg
|
||||||
|
#define meshtastic_RemoteHardwarePin_fields &meshtastic_RemoteHardwarePin_msg
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define meshtastic_ModuleConfig_AudioConfig_size 19
|
#define meshtastic_ModuleConfig_AudioConfig_size 19
|
||||||
#define meshtastic_ModuleConfig_CannedMessageConfig_size 49
|
#define meshtastic_ModuleConfig_CannedMessageConfig_size 49
|
||||||
#define meshtastic_ModuleConfig_ExternalNotificationConfig_size 40
|
#define meshtastic_ModuleConfig_ExternalNotificationConfig_size 40
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_size 201
|
#define meshtastic_ModuleConfig_MQTTConfig_size 220
|
||||||
|
#define meshtastic_ModuleConfig_NeighborInfoConfig_size 8
|
||||||
#define meshtastic_ModuleConfig_RangeTestConfig_size 10
|
#define meshtastic_ModuleConfig_RangeTestConfig_size 10
|
||||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_size 2
|
#define meshtastic_ModuleConfig_RemoteHardwareConfig_size 96
|
||||||
#define meshtastic_ModuleConfig_SerialConfig_size 26
|
#define meshtastic_ModuleConfig_SerialConfig_size 28
|
||||||
#define meshtastic_ModuleConfig_StoreForwardConfig_size 22
|
#define meshtastic_ModuleConfig_StoreForwardConfig_size 22
|
||||||
#define meshtastic_ModuleConfig_TelemetryConfig_size 26
|
#define meshtastic_ModuleConfig_TelemetryConfig_size 26
|
||||||
#define meshtastic_ModuleConfig_size 204
|
#define meshtastic_ModuleConfig_size 223
|
||||||
|
#define meshtastic_RemoteHardwarePin_size 21
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user