mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-06 18:08:00 +00:00
Compare commits
174 Commits
v2.1.8.ee9
...
v2.1.16.a2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a2c5b92840 | ||
|
|
685d27f566 | ||
|
|
f71869215d | ||
|
|
81f80546b4 | ||
|
|
44a54278b3 | ||
|
|
194833d77f | ||
|
|
207d421fca | ||
|
|
fb14487f2f | ||
|
|
365a91f3d9 | ||
|
|
5edc872c31 | ||
|
|
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 | ||
|
|
4b89f7dfcb | ||
|
|
f8db02c622 | ||
|
|
39d8ae64e7 | ||
|
|
6e685b0a54 | ||
|
|
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 |
2
.github/ISSUE_TEMPLATE/Bug Report.yml
vendored
2
.github/ISSUE_TEMPLATE/Bug Report.yml
vendored
@@ -40,10 +40,12 @@ body:
|
|||||||
- T-Echo
|
- T-Echo
|
||||||
- Rak4631
|
- Rak4631
|
||||||
- Rak11200
|
- Rak11200
|
||||||
|
- Rak11310
|
||||||
- Heltec v1
|
- Heltec v1
|
||||||
- Heltec v2
|
- Heltec v2
|
||||||
- Heltec v2.1
|
- Heltec v2.1
|
||||||
- Heltec V3
|
- Heltec V3
|
||||||
|
- Raspberry Pi Pico (W)
|
||||||
- Relay v1
|
- Relay v1
|
||||||
- Relay v2
|
- Relay v2
|
||||||
- DIY
|
- DIY
|
||||||
|
|||||||
5
.github/pull_request_template.md
vendored
5
.github/pull_request_template.md
vendored
@@ -7,7 +7,8 @@
|
|||||||
is appreciated." This will allow other devs to potentially save you time by not accidentially duplicating work etc...
|
is appreciated." This will allow other devs to potentially save you time by not accidentially duplicating work etc...
|
||||||
- Please do not check in files that don't have real changes
|
- Please do not check in files that don't have real changes
|
||||||
- Please do not reformat lines that you didn't have to change the code on
|
- Please do not reformat lines that you didn't have to change the code on
|
||||||
- We recommend using the [Visual Studio Code](https://platformio.org/install/ide?install=vscode) editor and the 'clang-format' extension,
|
- We recommend using the [Visual Studio Code](https://platformio.org/install/ide?install=vscode) editor along with the ['Trunk Check' extension](https://marketplace.visualstudio.com/items?itemName=trunk.io) (WSL2 is required on windows),
|
||||||
because automatically follows our indentation rules and it's auto reformatting will not cause spurious changes to lines.
|
because it automatically follows our indentation rules and its auto reformatting will not cause spurious changes to lines.
|
||||||
- If your PR fixes a bug, mention "fixes #bugnum" somewhere in your pull request description.
|
- If your PR fixes a bug, mention "fixes #bugnum" somewhere in your pull request description.
|
||||||
- If your other co-developers have comments on your PR please tweak as needed.
|
- If your other co-developers have comments on your PR please tweak as needed.
|
||||||
|
- Please also enable "Allow edits by maintainers".
|
||||||
|
|||||||
39
.github/workflows/main_matrix.yml
vendored
39
.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:
|
||||||
@@ -57,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
|
||||||
@@ -103,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
|
||||||
@@ -186,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
|
||||||
|
|||||||
@@ -1,36 +1,37 @@
|
|||||||
version: 0.1
|
version: 0.1
|
||||||
cli:
|
cli:
|
||||||
version: 1.7.0
|
version: 1.9.1
|
||||||
plugins:
|
plugins:
|
||||||
sources:
|
sources:
|
||||||
- id: trunk
|
- id: trunk
|
||||||
ref: v0.0.14
|
ref: v0.0.17
|
||||||
uri: https://github.com/trunk-io/plugins
|
uri: https://github.com/trunk-io/plugins
|
||||||
lint:
|
lint:
|
||||||
enabled:
|
enabled:
|
||||||
- ruff@0.0.260
|
- taplo@0.7.0
|
||||||
- yamllint@1.30.0
|
- ruff@0.0.265
|
||||||
|
- yamllint@1.31.0
|
||||||
- isort@5.12.0
|
- isort@5.12.0
|
||||||
- markdownlint@0.33.0
|
- markdownlint@0.34.0
|
||||||
- oxipng@8.0.0
|
- oxipng@8.0.0
|
||||||
- svgo@3.0.2
|
- svgo@3.0.2
|
||||||
- actionlint@1.6.23
|
- actionlint@1.6.24
|
||||||
- flake8@6.0.0
|
- flake8@6.0.0
|
||||||
- hadolint@2.12.0
|
- hadolint@2.12.0
|
||||||
- shfmt@3.5.0
|
- shfmt@3.5.0
|
||||||
- shellcheck@0.9.0
|
- shellcheck@0.9.0
|
||||||
- black@23.3.0
|
- black@23.3.0
|
||||||
- git-diff-check
|
- git-diff-check
|
||||||
- gitleaks@8.16.2
|
- gitleaks@8.16.3
|
||||||
- clang-format@14.0.0
|
- clang-format@14.0.0
|
||||||
- prettier@2.8.7
|
- prettier@2.8.8
|
||||||
disabled:
|
disabled:
|
||||||
- taplo@0.7.0
|
- 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:
|
||||||
|
|||||||
@@ -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.2
|
||||||
|
|
||||||
board_build.core = earlephilhower
|
board_build.core = earlephilhower
|
||||||
board_build.filesystem_size = 0.5m
|
board_build.filesystem_size = 0.5m
|
||||||
build_flags =
|
build_flags =
|
||||||
@@ -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))
|
||||||
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"
|
||||||
|
|||||||
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,16 +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
|
||||||
; temp: do this till > 5.7.0 release to keep (some) SX1262 and SX1280 working - resolves -705 error during init
|
|
||||||
https://github.com/jgromes/RadioLib.git#45c5859338590b7eede23cb2f95284c3fb0cf08e
|
|
||||||
; 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
|
||||||
@@ -85,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 =
|
||||||
@@ -105,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
|
||||||
@@ -114,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: ee6f408bb3...5f3daac5fa
@@ -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
|
||||||
@@ -123,9 +125,8 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
static void userButtonPressedLong()
|
static void userButtonPressedLong()
|
||||||
{
|
{
|
||||||
// LOG_DEBUG("Long press!\n");
|
// LOG_DEBUG("Long press!\n");
|
||||||
screen->adjustBrightness();
|
// If user button is held down for 5 seconds, shutdown the device.
|
||||||
// If user button is held down for 10 seconds, shutdown the device.
|
if ((millis() - longPressTime > 5000) && (longPressTime > 0)) {
|
||||||
if ((millis() - longPressTime > 10000) && (longPressTime > 0)) {
|
|
||||||
#if defined(ARCH_NRF52) || defined(ARCH_ESP32)
|
#if 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.
|
||||||
@@ -156,7 +157,7 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
digitalWrite(PIN_EINK_EN, digitalRead(PIN_EINK_EN) == LOW);
|
digitalWrite(PIN_EINK_EN, digitalRead(PIN_EINK_EN) == LOW);
|
||||||
#endif
|
#endif
|
||||||
screen->print("Sent ad-hoc ping\n");
|
screen->print("Sent ad-hoc ping\n");
|
||||||
service.refreshMyNodeInfo();
|
service.refreshLocalMeshNode();
|
||||||
service.sendNetworkPing(NODENUM_BROADCAST, true);
|
service.sendNetworkPing(NODENUM_BROADCAST, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,4 +196,4 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace concurrency
|
} // namespace concurrency
|
||||||
@@ -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();
|
||||||
@@ -55,7 +55,7 @@ class GPSStatus : public Status
|
|||||||
#ifdef GPS_EXTRAVERBOSE
|
#ifdef GPS_EXTRAVERBOSE
|
||||||
LOG_WARN("Using fixed latitude\n");
|
LOG_WARN("Using fixed latitude\n");
|
||||||
#endif
|
#endif
|
||||||
meshtastic_NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
meshtastic_NodeInfoLite *node = nodeDB.getMeshNode(nodeDB.getNodeNum());
|
||||||
return node->position.latitude_i;
|
return node->position.latitude_i;
|
||||||
} else {
|
} else {
|
||||||
return p.latitude_i;
|
return p.latitude_i;
|
||||||
@@ -68,7 +68,7 @@ class GPSStatus : public Status
|
|||||||
#ifdef GPS_EXTRAVERBOSE
|
#ifdef GPS_EXTRAVERBOSE
|
||||||
LOG_WARN("Using fixed longitude\n");
|
LOG_WARN("Using fixed longitude\n");
|
||||||
#endif
|
#endif
|
||||||
meshtastic_NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
meshtastic_NodeInfoLite *node = nodeDB.getMeshNode(nodeDB.getNodeNum());
|
||||||
return node->position.longitude_i;
|
return node->position.longitude_i;
|
||||||
} else {
|
} else {
|
||||||
return p.longitude_i;
|
return p.longitude_i;
|
||||||
@@ -81,7 +81,7 @@ class GPSStatus : public Status
|
|||||||
#ifdef GPS_EXTRAVERBOSE
|
#ifdef GPS_EXTRAVERBOSE
|
||||||
LOG_WARN("Using fixed altitude\n");
|
LOG_WARN("Using fixed altitude\n");
|
||||||
#endif
|
#endif
|
||||||
meshtastic_NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
meshtastic_NodeInfoLite *node = nodeDB.getMeshNode(nodeDB.getNodeNum());
|
||||||
return node->position.altitude;
|
return node->position.altitude;
|
||||||
} else {
|
} else {
|
||||||
return p.altitude;
|
return p.altitude;
|
||||||
@@ -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;
|
||||||
@@ -148,4 +149,4 @@ class GPSStatus : public Status
|
|||||||
|
|
||||||
} // namespace meshtastic
|
} // namespace meshtastic
|
||||||
|
|
||||||
extern meshtastic::GPSStatus *gpsStatus;
|
extern meshtastic::GPSStatus *gpsStatus;
|
||||||
320
src/Power.cpp
320
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
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -203,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;
|
||||||
@@ -212,7 +297,7 @@ 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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,25 +313,52 @@ bool Power::analogInit()
|
|||||||
// 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
|
||||||
@@ -302,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();
|
||||||
@@ -327,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++) {
|
||||||
@@ -338,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) {
|
||||||
@@ -349,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);
|
||||||
@@ -444,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()
|
||||||
@@ -537,85 +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) {
|
||||||
|
|
||||||
/*The alternative version of T-Beam 1.1 differs from T-Beam V1.1 in that it uses an AXP2101 power chip*/
|
/*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)
|
if (HW_VENDOR == meshtastic_HardwareModel_TBEAM) {
|
||||||
// Unuse power channel
|
// Unuse power channel
|
||||||
PMU->disablePowerOutput(XPOWERS_DCDC2);
|
PMU->disablePowerOutput(XPOWERS_DCDC2);
|
||||||
PMU->disablePowerOutput(XPOWERS_DCDC3);
|
PMU->disablePowerOutput(XPOWERS_DCDC3);
|
||||||
PMU->disablePowerOutput(XPOWERS_DCDC4);
|
PMU->disablePowerOutput(XPOWERS_DCDC4);
|
||||||
PMU->disablePowerOutput(XPOWERS_DCDC5);
|
PMU->disablePowerOutput(XPOWERS_DCDC5);
|
||||||
PMU->disablePowerOutput(XPOWERS_ALDO1);
|
PMU->disablePowerOutput(XPOWERS_ALDO1);
|
||||||
PMU->disablePowerOutput(XPOWERS_ALDO4);
|
PMU->disablePowerOutput(XPOWERS_ALDO4);
|
||||||
PMU->disablePowerOutput(XPOWERS_BLDO1);
|
PMU->disablePowerOutput(XPOWERS_BLDO1);
|
||||||
PMU->disablePowerOutput(XPOWERS_BLDO2);
|
PMU->disablePowerOutput(XPOWERS_BLDO2);
|
||||||
PMU->disablePowerOutput(XPOWERS_DLDO1);
|
PMU->disablePowerOutput(XPOWERS_DLDO1);
|
||||||
PMU->disablePowerOutput(XPOWERS_DLDO2);
|
PMU->disablePowerOutput(XPOWERS_DLDO2);
|
||||||
|
|
||||||
// GNSS RTC PowerVDD 3300mV
|
// GNSS RTC PowerVDD 3300mV
|
||||||
PMU->setPowerChannelVoltage(XPOWERS_VBACKUP, 3300);
|
PMU->setPowerChannelVoltage(XPOWERS_VBACKUP, 3300);
|
||||||
PMU->enablePowerOutput(XPOWERS_VBACKUP);
|
PMU->enablePowerOutput(XPOWERS_VBACKUP);
|
||||||
|
|
||||||
// ESP32 VDD 3300mV
|
// ESP32 VDD 3300mV
|
||||||
// ! No need to set, automatically open , Don't close it
|
// ! No need to set, automatically open , Don't close it
|
||||||
// PMU->setPowerChannelVoltage(XPOWERS_DCDC1, 3300);
|
// PMU->setPowerChannelVoltage(XPOWERS_DCDC1, 3300);
|
||||||
// PMU->setProtectedChannel(XPOWERS_DCDC1);
|
// PMU->setProtectedChannel(XPOWERS_DCDC1);
|
||||||
|
|
||||||
// LoRa VDD 3300mV
|
// LoRa VDD 3300mV
|
||||||
PMU->setPowerChannelVoltage(XPOWERS_ALDO2, 3300);
|
PMU->setPowerChannelVoltage(XPOWERS_ALDO2, 3300);
|
||||||
PMU->enablePowerOutput(XPOWERS_ALDO2);
|
PMU->enablePowerOutput(XPOWERS_ALDO2);
|
||||||
|
|
||||||
// GNSS VDD 3300mV
|
// GNSS VDD 3300mV
|
||||||
PMU->setPowerChannelVoltage(XPOWERS_ALDO3, 3300);
|
PMU->setPowerChannelVoltage(XPOWERS_ALDO3, 3300);
|
||||||
PMU->enablePowerOutput(XPOWERS_ALDO3);
|
PMU->enablePowerOutput(XPOWERS_ALDO3);
|
||||||
|
} else if (HW_VENDOR == meshtastic_HardwareModel_LILYGO_TBEAM_S3_CORE) {
|
||||||
|
// t-beam s3 core
|
||||||
|
/**
|
||||||
|
* gnss module power channel
|
||||||
|
* 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);
|
||||||
|
|
||||||
#elif (HW_VENDOR == meshtastic_HardwareModel_LILYGO_TBEAM_S3_CORE)
|
// lora radio power channel
|
||||||
// t-beam s3 core
|
PMU->setPowerChannelVoltage(XPOWERS_ALDO3, 3300);
|
||||||
/**
|
PMU->enablePowerOutput(XPOWERS_ALDO3);
|
||||||
* gnss module power channel
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
// lora radio power channel
|
// m.2 interface
|
||||||
PMU->setPowerChannelVoltage(XPOWERS_ALDO3, 3300);
|
PMU->setPowerChannelVoltage(XPOWERS_DCDC3, 3300);
|
||||||
PMU->enablePowerOutput(XPOWERS_ALDO3);
|
PMU->enablePowerOutput(XPOWERS_DCDC3);
|
||||||
|
|
||||||
// m.2 interface
|
/**
|
||||||
PMU->setPowerChannelVoltage(XPOWERS_DCDC3, 3300);
|
* ALDO2 cannot be turned off.
|
||||||
PMU->enablePowerOutput(XPOWERS_DCDC3);
|
* 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);
|
||||||
|
|
||||||
/**
|
// 6-axis , magnetometer ,bme280 , oled screen power channel
|
||||||
* ALDO2 cannot be turned off.
|
PMU->setPowerChannelVoltage(XPOWERS_ALDO1, 3300);
|
||||||
* It is a necessary condition for sensor communication.
|
PMU->enablePowerOutput(XPOWERS_ALDO1);
|
||||||
* 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);
|
|
||||||
|
|
||||||
// 6-axis , magnetometer ,bme280 , oled screen power channel
|
// sdcard power channle
|
||||||
PMU->setPowerChannelVoltage(XPOWERS_ALDO1, 3300);
|
PMU->setPowerChannelVoltage(XPOWERS_BLDO1, 3300);
|
||||||
PMU->enablePowerOutput(XPOWERS_ALDO1);
|
PMU->enablePowerOutput(XPOWERS_BLDO1);
|
||||||
|
|
||||||
// sdcard power channle
|
// PMU->setPowerChannelVoltage(XPOWERS_DCDC4, 3300);
|
||||||
PMU->setPowerChannelVoltage(XPOWERS_BLDO1, 3300);
|
// PMU->enablePowerOutput(XPOWERS_DCDC4);
|
||||||
PMU->enablePowerOutput(XPOWERS_BLDO1);
|
|
||||||
|
|
||||||
// PMU->setPowerChannelVoltage(XPOWERS_DCDC4, 3300);
|
// not use channel
|
||||||
// PMU->enablePowerOutput(XPOWERS_DCDC4);
|
PMU->disablePowerOutput(XPOWERS_DCDC2); // not elicited
|
||||||
|
PMU->disablePowerOutput(XPOWERS_DCDC5); // not elicited
|
||||||
// not use channel
|
PMU->disablePowerOutput(XPOWERS_DLDO1); // Invalid power channel, it does not exist
|
||||||
PMU->disablePowerOutput(XPOWERS_DCDC2); // not elicited
|
PMU->disablePowerOutput(XPOWERS_DLDO2); // Invalid power channel, it does not exist
|
||||||
PMU->disablePowerOutput(XPOWERS_DCDC5); // not elicited
|
PMU->disablePowerOutput(XPOWERS_VBACKUP);
|
||||||
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);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// disable all axp chip interrupt
|
// disable all axp chip interrupt
|
||||||
PMU->disableIRQ(XPOWERS_AXP2101_ALL_IRQ);
|
PMU->disableIRQ(XPOWERS_AXP2101_ALL_IRQ);
|
||||||
@@ -729,4 +839,4 @@ bool Power::axpChipInit()
|
|||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,7 @@ static bool isPowered()
|
|||||||
|
|
||||||
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));
|
||||||
}
|
}
|
||||||
@@ -44,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ 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
|
||||||
@@ -135,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);
|
||||||
|
|
||||||
@@ -150,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");
|
||||||
@@ -163,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");
|
||||||
@@ -198,7 +198,7 @@ static void powerExit()
|
|||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
@@ -218,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");
|
||||||
@@ -295,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
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -6,20 +6,22 @@ AirTime *airTime = NULL;
|
|||||||
|
|
||||||
// Don't read out of this directly. Use the helper functions.
|
// Don't read out of this directly. Use the helper functions.
|
||||||
|
|
||||||
|
uint32_t air_period_tx[PERIODS_TO_LOG];
|
||||||
|
uint32_t air_period_rx[PERIODS_TO_LOG];
|
||||||
|
|
||||||
void AirTime::logAirtime(reportTypes reportType, uint32_t airtime_ms)
|
void AirTime::logAirtime(reportTypes reportType, uint32_t airtime_ms)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (reportType == TX_LOG) {
|
if (reportType == TX_LOG) {
|
||||||
LOG_DEBUG("AirTime - Packet transmitted : %ums\n", airtime_ms);
|
LOG_DEBUG("AirTime - Packet transmitted : %ums\n", airtime_ms);
|
||||||
this->airtimes.periodTX[0] = this->airtimes.periodTX[0] + airtime_ms;
|
this->airtimes.periodTX[0] = this->airtimes.periodTX[0] + airtime_ms;
|
||||||
myNodeInfo.air_period_tx[0] = myNodeInfo.air_period_tx[0] + airtime_ms;
|
air_period_tx[0] = air_period_tx[0] + airtime_ms;
|
||||||
|
|
||||||
this->utilizationTX[this->getPeriodUtilHour()] = this->utilizationTX[this->getPeriodUtilHour()] + airtime_ms;
|
this->utilizationTX[this->getPeriodUtilHour()] = this->utilizationTX[this->getPeriodUtilHour()] + airtime_ms;
|
||||||
|
|
||||||
} else if (reportType == RX_LOG) {
|
} else if (reportType == RX_LOG) {
|
||||||
LOG_DEBUG("AirTime - Packet received : %ums\n", airtime_ms);
|
LOG_DEBUG("AirTime - Packet received : %ums\n", airtime_ms);
|
||||||
this->airtimes.periodRX[0] = this->airtimes.periodRX[0] + airtime_ms;
|
this->airtimes.periodRX[0] = this->airtimes.periodRX[0] + airtime_ms;
|
||||||
myNodeInfo.air_period_rx[0] = myNodeInfo.air_period_rx[0] + airtime_ms;
|
air_period_rx[0] = air_period_rx[0] + airtime_ms;
|
||||||
} else if (reportType == RX_ALL_LOG) {
|
} else if (reportType == RX_ALL_LOG) {
|
||||||
LOG_DEBUG("AirTime - Packet received (noise?) : %ums\n", airtime_ms);
|
LOG_DEBUG("AirTime - Packet received (noise?) : %ums\n", airtime_ms);
|
||||||
this->airtimes.periodRX_ALL[0] = this->airtimes.periodRX_ALL[0] + airtime_ms;
|
this->airtimes.periodRX_ALL[0] = this->airtimes.periodRX_ALL[0] + airtime_ms;
|
||||||
@@ -55,16 +57,16 @@ void AirTime::airtimeRotatePeriod()
|
|||||||
this->airtimes.periodRX[i + 1] = this->airtimes.periodRX[i];
|
this->airtimes.periodRX[i + 1] = this->airtimes.periodRX[i];
|
||||||
this->airtimes.periodRX_ALL[i + 1] = this->airtimes.periodRX_ALL[i];
|
this->airtimes.periodRX_ALL[i + 1] = this->airtimes.periodRX_ALL[i];
|
||||||
|
|
||||||
myNodeInfo.air_period_tx[i + 1] = this->airtimes.periodTX[i];
|
air_period_tx[i + 1] = this->airtimes.periodTX[i];
|
||||||
myNodeInfo.air_period_rx[i + 1] = this->airtimes.periodRX[i];
|
air_period_rx[i + 1] = this->airtimes.periodRX[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
this->airtimes.periodTX[0] = 0;
|
this->airtimes.periodTX[0] = 0;
|
||||||
this->airtimes.periodRX[0] = 0;
|
this->airtimes.periodRX[0] = 0;
|
||||||
this->airtimes.periodRX_ALL[0] = 0;
|
this->airtimes.periodRX_ALL[0] = 0;
|
||||||
|
|
||||||
myNodeInfo.air_period_tx[0] = 0;
|
air_period_tx[0] = 0;
|
||||||
myNodeInfo.air_period_rx[0] = 0;
|
air_period_rx[0] = 0;
|
||||||
|
|
||||||
this->airtimes.lastPeriodIndex = this->currentPeriodIndex();
|
this->airtimes.lastPeriodIndex = this->currentPeriodIndex();
|
||||||
}
|
}
|
||||||
@@ -179,18 +181,17 @@ int32_t AirTime::runOnce()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Init airtime windows to all 0
|
// Init airtime windows to all 0
|
||||||
for (int i = 0; i < myNodeInfo.air_period_rx_count; i++) {
|
for (int i = 0; i < PERIODS_TO_LOG; i++) {
|
||||||
this->airtimes.periodTX[i] = 0;
|
this->airtimes.periodTX[i] = 0;
|
||||||
this->airtimes.periodRX[i] = 0;
|
this->airtimes.periodRX[i] = 0;
|
||||||
this->airtimes.periodRX_ALL[i] = 0;
|
this->airtimes.periodRX_ALL[i] = 0;
|
||||||
|
|
||||||
// myNodeInfo.air_period_tx[i] = 0;
|
// air_period_tx[i] = 0;
|
||||||
// myNodeInfo.air_period_rx[i] = 0;
|
// air_period_rx[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
firstTime = false;
|
firstTime = false;
|
||||||
lastUtilPeriod = utilPeriod;
|
lastUtilPeriod = utilPeriod;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this->airtimeRotatePeriod();
|
this->airtimeRotatePeriod();
|
||||||
|
|
||||||
@@ -206,12 +207,6 @@ int32_t AirTime::runOnce()
|
|||||||
|
|
||||||
this->utilizationTX[utilPeriodTX] = 0;
|
this->utilizationTX[utilPeriodTX] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update channel_utilization every second.
|
|
||||||
myNodeInfo.channel_utilization = airTime->channelUtilizationPercent();
|
|
||||||
|
|
||||||
// Update channel_utilization every second.
|
|
||||||
myNodeInfo.air_util_tx = airTime->utilizationTXPercent();
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
LOG_DEBUG("utilPeriodTX %d TX Airtime %3.2f%\n", utilPeriodTX, airTime->utilizationTXPercent());
|
LOG_DEBUG("utilPeriodTX %d TX Airtime %3.2f%\n", utilPeriodTX, airTime->utilizationTXPercent());
|
||||||
@@ -223,4 +218,4 @@ int32_t AirTime::runOnce()
|
|||||||
LOG_DEBUG("\n");
|
LOG_DEBUG("\n");
|
||||||
*/
|
*/
|
||||||
return (1000 * 1);
|
return (1000 * 1);
|
||||||
}
|
}
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -9,4 +9,4 @@
|
|||||||
|
|
||||||
/// Record an error that should be reported via analytics
|
/// Record an error that should be reported via analytics
|
||||||
void recordCriticalError(meshtastic_CriticalErrorCode code = meshtastic_CriticalErrorCode_UNSPECIFIED, uint32_t address = 0,
|
void recordCriticalError(meshtastic_CriticalErrorCode code = meshtastic_CriticalErrorCode_UNSPECIFIED, uint32_t address = 0,
|
||||||
const char *filename = NULL);
|
const char *filename = NULL);
|
||||||
@@ -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) || defined(ARDUINO_ARCH_RP2040)
|
||||||
#define HAS_FREE_RTOS
|
#define HAS_FREE_RTOS
|
||||||
|
|
||||||
#include <FreeRTOS.h>
|
#include <FreeRTOS.h>
|
||||||
@@ -44,4 +44,4 @@ typedef uint32_t BaseType_t;
|
|||||||
|
|
||||||
enum eNotifyAction { eNoAction, eSetValueWithoutOverwrite, eSetValueWithOverwrite };
|
enum eNotifyAction { eNoAction, eSetValueWithoutOverwrite, eSetValueWithOverwrite };
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -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_PositionLite &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);
|
||||||
@@ -31,6 +34,21 @@ uint32_t printWPL(char *buf, size_t bufsz, const meshtastic_Position &pos, const
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
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(),
|
||||||
|
geoCoord.getDMSLonDeg(), (abs(geoCoord.getLongitude()) - geoCoord.getDMSLonDeg() * 1e+7) * 6e-6,
|
||||||
|
geoCoord.getDMSLonCP(), name);
|
||||||
|
uint32_t chk = 0;
|
||||||
|
for (uint32_t i = 1; i < len; i++) {
|
||||||
|
chk ^= buf[i];
|
||||||
|
}
|
||||||
|
len += snprintf(buf + len, bufsz - len, "*%02X\r\n", chk);
|
||||||
|
return len;
|
||||||
|
}
|
||||||
/* -------------------------------------------
|
/* -------------------------------------------
|
||||||
* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||||
* | | | | | | | | | | | | | | |
|
* | | | | | | | | | | | | | | |
|
||||||
@@ -56,12 +74,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,6 @@
|
|||||||
#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 printWPL(char *buf, size_t bufsz, const meshtastic_PositionLite &pos, const char *name, bool isCaltopoMode = false);
|
||||||
|
uint32_t printGGA(char *buf, size_t bufsz, const meshtastic_Position &pos);
|
||||||
@@ -27,6 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "GPS.h"
|
#include "GPS.h"
|
||||||
#include "MeshService.h"
|
#include "MeshService.h"
|
||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
|
#include "error.h"
|
||||||
#include "gps/GeoCoord.h"
|
#include "gps/GeoCoord.h"
|
||||||
#include "gps/RTC.h"
|
#include "gps/RTC.h"
|
||||||
#include "graphics/images.h"
|
#include "graphics/images.h"
|
||||||
@@ -352,7 +353,7 @@ static void drawCriticalFaultFrame(OLEDDisplay *display, OLEDDisplayUiState *sta
|
|||||||
display->setFont(FONT_MEDIUM);
|
display->setFont(FONT_MEDIUM);
|
||||||
|
|
||||||
char tempBuf[24];
|
char tempBuf[24];
|
||||||
snprintf(tempBuf, sizeof(tempBuf), "Critical fault #%d", myNodeInfo.error_code);
|
snprintf(tempBuf, sizeof(tempBuf), "Critical fault #%d", error_code);
|
||||||
display->drawString(0 + x, 0 + y, tempBuf);
|
display->drawString(0 + x, 0 + y, tempBuf);
|
||||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
display->setFont(FONT_SMALL);
|
display->setFont(FONT_SMALL);
|
||||||
@@ -372,7 +373,7 @@ static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state
|
|||||||
static char tempBuf[237];
|
static char tempBuf[237];
|
||||||
|
|
||||||
meshtastic_MeshPacket &mp = devicestate.rx_text_message;
|
meshtastic_MeshPacket &mp = devicestate.rx_text_message;
|
||||||
meshtastic_NodeInfo *node = nodeDB.getNode(getFrom(&mp));
|
meshtastic_NodeInfoLite *node = nodeDB.getMeshNode(getFrom(&mp));
|
||||||
// LOG_DEBUG("drawing text message from 0x%x: %s\n", mp.from,
|
// LOG_DEBUG("drawing text message from 0x%x: %s\n", mp.from,
|
||||||
// mp.decoded.variant.data.decoded.bytes);
|
// mp.decoded.variant.data.decoded.bytes);
|
||||||
|
|
||||||
@@ -404,6 +405,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_NodeInfoLite *node = nodeDB.getMeshNode(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)
|
||||||
{
|
{
|
||||||
@@ -674,13 +712,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;
|
||||||
@@ -762,16 +793,16 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
|
|||||||
if (state->currentFrame != prevFrame) {
|
if (state->currentFrame != prevFrame) {
|
||||||
prevFrame = state->currentFrame;
|
prevFrame = state->currentFrame;
|
||||||
|
|
||||||
nodeIndex = (nodeIndex + 1) % nodeDB.getNumNodes();
|
nodeIndex = (nodeIndex + 1) % nodeDB.getNumMeshNodes();
|
||||||
meshtastic_NodeInfo *n = nodeDB.getNodeByIndex(nodeIndex);
|
meshtastic_NodeInfoLite *n = nodeDB.getMeshNodeByIndex(nodeIndex);
|
||||||
if (n->num == nodeDB.getNodeNum()) {
|
if (n->num == nodeDB.getNodeNum()) {
|
||||||
// Don't show our node, just skip to next
|
// Don't show our node, just skip to next
|
||||||
nodeIndex = (nodeIndex + 1) % nodeDB.getNumNodes();
|
nodeIndex = (nodeIndex + 1) % nodeDB.getNumMeshNodes();
|
||||||
n = nodeDB.getNodeByIndex(nodeIndex);
|
n = nodeDB.getMeshNodeByIndex(nodeIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
meshtastic_NodeInfo *node = nodeDB.getNodeByIndex(nodeIndex);
|
meshtastic_NodeInfoLite *node = nodeDB.getMeshNodeByIndex(nodeIndex);
|
||||||
|
|
||||||
display->setFont(FONT_SMALL);
|
display->setFont(FONT_SMALL);
|
||||||
|
|
||||||
@@ -805,7 +836,7 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
|
|||||||
|
|
||||||
static char distStr[20];
|
static char distStr[20];
|
||||||
strncpy(distStr, "? km", sizeof(distStr)); // might not have location data
|
strncpy(distStr, "? km", sizeof(distStr)); // might not have location data
|
||||||
meshtastic_NodeInfo *ourNode = nodeDB.getNode(nodeDB.getNodeNum());
|
meshtastic_NodeInfoLite *ourNode = nodeDB.getMeshNode(nodeDB.getNodeNum());
|
||||||
const char *fields[] = {username, distStr, signalStr, lastStr, NULL};
|
const char *fields[] = {username, distStr, signalStr, lastStr, NULL};
|
||||||
int16_t compassX = 0, compassY = 0;
|
int16_t compassX = 0, compassY = 0;
|
||||||
|
|
||||||
@@ -819,15 +850,15 @@ 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_PositionLite &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_PositionLite &p = node->position;
|
||||||
float d =
|
float d =
|
||||||
GeoCoord::latLongToMeter(DegD(p.latitude_i), DegD(p.longitude_i), DegD(op.latitude_i), DegD(op.longitude_i));
|
GeoCoord::latLongToMeter(DegD(p.latitude_i), DegD(p.longitude_i), DegD(op.latitude_i), DegD(op.longitude_i));
|
||||||
|
|
||||||
@@ -855,7 +886,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);
|
||||||
@@ -1202,13 +1234,15 @@ 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 = nodeDB.getNumNodes();
|
size_t numMeshNodes = nodeDB.getNumMeshNodes();
|
||||||
if (numnodes > 0)
|
if (numMeshNodes > 0)
|
||||||
numnodes--;
|
numMeshNodes--;
|
||||||
|
|
||||||
size_t numframes = 0;
|
size_t numframes = 0;
|
||||||
|
|
||||||
@@ -1225,17 +1259,21 @@ void Screen::setFrames()
|
|||||||
LOG_DEBUG("Added modules. numframes: %d\n", numframes);
|
LOG_DEBUG("Added modules. numframes: %d\n", numframes);
|
||||||
|
|
||||||
// If we have a critical fault, show it first
|
// If we have a critical fault, show it first
|
||||||
if (myNodeInfo.error_code)
|
if (error_code)
|
||||||
normalFrames[numframes++] = drawCriticalFaultFrame;
|
normalFrames[numframes++] = drawCriticalFaultFrame;
|
||||||
|
|
||||||
// If we have a text message - show it next, unless it's a phone message and we aren't using any special modules
|
// If we have a text message - show it next, unless it's a phone message and we aren't using any special modules
|
||||||
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
|
||||||
size_t numToShow = min(numnodes, 4U);
|
size_t numToShow = min(numMeshNodes, 4U);
|
||||||
for (size_t i = 0; i < numToShow; i++)
|
for (size_t i = 0; i < numToShow; i++)
|
||||||
normalFrames[numframes++] = drawNodeInfo;
|
normalFrames[numframes++] = drawNodeInfo;
|
||||||
|
|
||||||
@@ -1812,4 +1850,4 @@ int Screen::handleUIFrameEvent(const UIFrameEvent *event)
|
|||||||
} // namespace graphics
|
} // namespace graphics
|
||||||
#else
|
#else
|
||||||
graphics::Screen::Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY) {}
|
graphics::Screen::Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY) {}
|
||||||
#endif // HAS_SCREEN
|
#endif // HAS_SCREEN
|
||||||
114
src/main.cpp
114
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
|
||||||
@@ -270,6 +263,12 @@ void setup()
|
|||||||
// We need to enable 3.3V periphery in order to scan it
|
// We need to enable 3.3V periphery in order to scan it
|
||||||
pinMode(PIN_3V3_EN, OUTPUT);
|
pinMode(PIN_3V3_EN, OUTPUT);
|
||||||
digitalWrite(PIN_3V3_EN, HIGH);
|
digitalWrite(PIN_3V3_EN, HIGH);
|
||||||
|
|
||||||
|
#ifndef USE_EINK
|
||||||
|
// RAK-12039 set pin for Air quality sensor
|
||||||
|
pinMode(AQ_SET_PIN, OUTPUT);
|
||||||
|
digitalWrite(AQ_SET_PIN, HIGH);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Currently only the tbeam has a PMU
|
// Currently only the tbeam has a PMU
|
||||||
@@ -358,7 +357,10 @@ void setup()
|
|||||||
* "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);
|
||||||
@@ -400,10 +402,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);
|
||||||
@@ -427,6 +426,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();
|
||||||
|
|
||||||
@@ -443,7 +449,7 @@ 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)
|
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
||||||
if (acc_info.type != ScanI2C::DeviceType::NONE) {
|
if (acc_info.type != ScanI2C::DeviceType::NONE) {
|
||||||
accelerometerThread = new AccelerometerThread(acc_info.type);
|
accelerometerThread = new AccelerometerThread(acc_info.type);
|
||||||
}
|
}
|
||||||
@@ -451,7 +457,21 @@ void setup()
|
|||||||
|
|
||||||
// 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
|
||||||
@@ -466,10 +486,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);
|
||||||
|
|
||||||
@@ -512,7 +533,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) {
|
||||||
@@ -529,7 +568,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;
|
||||||
@@ -542,7 +581,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;
|
||||||
@@ -555,7 +594,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;
|
||||||
@@ -568,7 +607,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;
|
||||||
@@ -581,7 +620,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;
|
||||||
@@ -634,12 +673,10 @@ void setup()
|
|||||||
else {
|
else {
|
||||||
router->addInterface(rIf);
|
router->addInterface(rIf);
|
||||||
|
|
||||||
// Calculate and save the bit rate to myNodeInfo
|
// Log bit rate to debug output
|
||||||
// TODO: This needs to be added what ever method changes the channel from the phone.
|
LOG_DEBUG("LoRA bitrate = %f bytes / sec\n", (float(meshtastic_Constants_DATA_PAYLOAD_LEN) /
|
||||||
myNodeInfo.bitrate =
|
(float(rIf->getPacketTime(meshtastic_Constants_DATA_PAYLOAD_LEN)))) *
|
||||||
(float(meshtastic_Constants_DATA_PAYLOAD_LEN) / (float(rIf->getPacketTime(meshtastic_Constants_DATA_PAYLOAD_LEN)))) *
|
1000);
|
||||||
1000;
|
|
||||||
LOG_DEBUG("myNodeInfo.bitrate = %f bytes / sec\n", myNodeInfo.bitrate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This must be _after_ service.init because we need our preferences loaded from flash to have proper timeout values
|
// This must be _after_ service.init because we need our preferences loaded from flash to have proper timeout values
|
||||||
@@ -660,7 +697,7 @@ bool runASAP;
|
|||||||
extern meshtastic_DeviceMetadata getDeviceMetadata()
|
extern meshtastic_DeviceMetadata getDeviceMetadata()
|
||||||
{
|
{
|
||||||
meshtastic_DeviceMetadata deviceMetadata;
|
meshtastic_DeviceMetadata deviceMetadata;
|
||||||
strncpy(deviceMetadata.firmware_version, myNodeInfo.firmware_version, 18);
|
strncpy(deviceMetadata.firmware_version, optstr(APP_VERSION), sizeof(deviceMetadata.firmware_version));
|
||||||
deviceMetadata.device_state_version = DEVICESTATE_CUR_VER;
|
deviceMetadata.device_state_version = DEVICESTATE_CUR_VER;
|
||||||
deviceMetadata.canShutdown = pmu_found || HAS_CPU_SHUTDOWN;
|
deviceMetadata.canShutdown = pmu_found || HAS_CPU_SHUTDOWN;
|
||||||
deviceMetadata.hasBluetooth = HAS_BLUETOOTH;
|
deviceMetadata.hasBluetooth = HAS_BLUETOOTH;
|
||||||
@@ -669,6 +706,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -716,4 +754,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
|
||||||
|
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "PowerFSM.h"
|
#include "PowerFSM.h"
|
||||||
#include "RTC.h"
|
#include "RTC.h"
|
||||||
|
#include "TypeConversions.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "mesh-pb-constants.h"
|
#include "mesh-pb-constants.h"
|
||||||
#include "modules/NodeInfoModule.h"
|
#include "modules/NodeInfoModule.h"
|
||||||
@@ -76,7 +77,8 @@ int MeshService::handleFromRadio(const meshtastic_MeshPacket *mp)
|
|||||||
powerFSM.trigger(EVENT_PACKET_FOR_PHONE); // Possibly keep the node from sleeping
|
powerFSM.trigger(EVENT_PACKET_FOR_PHONE); // Possibly keep the node from sleeping
|
||||||
|
|
||||||
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.getMeshNode(mp->from)->has_user &&
|
||||||
|
nodeInfoModule) {
|
||||||
LOG_INFO("Heard a node on channel %d we don't know, sending NodeInfo and asking for a response.\n", mp->channel);
|
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, mp->channel);
|
nodeInfoModule->sendOurNodeInfo(mp->from, true, mp->channel);
|
||||||
}
|
}
|
||||||
@@ -236,10 +238,11 @@ void MeshService::sendToMesh(meshtastic_MeshPacket *p, RxSource src, bool ccToPh
|
|||||||
|
|
||||||
void MeshService::sendNetworkPing(NodeNum dest, bool wantReplies)
|
void MeshService::sendNetworkPing(NodeNum dest, bool wantReplies)
|
||||||
{
|
{
|
||||||
meshtastic_NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
meshtastic_NodeInfoLite *node = nodeDB.getMeshNode(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, channel=%d\n", dest, wantReplies, node->channel);
|
LOG_INFO("Sending position ping to 0x%x, wantReplies=%d, channel=%d\n", dest, wantReplies, node->channel);
|
||||||
positionModule->sendOurPosition(dest, wantReplies, node->channel);
|
positionModule->sendOurPosition(dest, wantReplies, node->channel);
|
||||||
@@ -266,9 +269,9 @@ void MeshService::sendToPhone(meshtastic_MeshPacket *p)
|
|||||||
fromNum++;
|
fromNum++;
|
||||||
}
|
}
|
||||||
|
|
||||||
meshtastic_NodeInfo *MeshService::refreshMyNodeInfo()
|
meshtastic_NodeInfoLite *MeshService::refreshLocalMeshNode()
|
||||||
{
|
{
|
||||||
meshtastic_NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
meshtastic_NodeInfoLite *node = nodeDB.getMeshNode(nodeDB.getNodeNum());
|
||||||
assert(node);
|
assert(node);
|
||||||
|
|
||||||
// We might not have a position yet for our local node, in that case, at least try to send the time
|
// We might not have a position yet for our local node, in that case, at least try to send the time
|
||||||
@@ -277,7 +280,7 @@ meshtastic_NodeInfo *MeshService::refreshMyNodeInfo()
|
|||||||
node->has_position = true;
|
node->has_position = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
meshtastic_Position &position = node->position;
|
meshtastic_PositionLite &position = node->position;
|
||||||
|
|
||||||
// Update our local node info with our time (even if we don't decide to update anyone else)
|
// Update our local node info with our time (even if we don't decide to update anyone else)
|
||||||
node->last_heard =
|
node->last_heard =
|
||||||
@@ -293,7 +296,7 @@ meshtastic_NodeInfo *MeshService::refreshMyNodeInfo()
|
|||||||
int MeshService::onGPSChanged(const meshtastic::GPSStatus *newStatus)
|
int MeshService::onGPSChanged(const meshtastic::GPSStatus *newStatus)
|
||||||
{
|
{
|
||||||
// Update our local node info with our position (even if we don't decide to update anyone else)
|
// Update our local node info with our position (even if we don't decide to update anyone else)
|
||||||
meshtastic_NodeInfo *node = refreshMyNodeInfo();
|
meshtastic_NodeInfoLite *node = refreshLocalMeshNode();
|
||||||
meshtastic_Position pos = meshtastic_Position_init_default;
|
meshtastic_Position pos = meshtastic_Position_init_default;
|
||||||
|
|
||||||
if (newStatus->getHasLock()) {
|
if (newStatus->getHasLock()) {
|
||||||
@@ -307,12 +310,12 @@ int MeshService::onGPSChanged(const meshtastic::GPSStatus *newStatus)
|
|||||||
#endif
|
#endif
|
||||||
if (config.position.fixed_position) {
|
if (config.position.fixed_position) {
|
||||||
LOG_WARN("Using fixed position\n");
|
LOG_WARN("Using fixed position\n");
|
||||||
pos = node->position;
|
pos = ConvertToPosition(node->position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally add a fresh timestamp and battery level reading
|
// Finally add a fresh timestamp and battery level reading
|
||||||
// I KNOW this is redundant with refreshMyNodeInfo() above, but these are
|
// I KNOW this is redundant with refreshLocalMeshNode() above, but these are
|
||||||
// inexpensive nonblocking calls and can be refactored in due course
|
// inexpensive nonblocking calls and can be refactored in due course
|
||||||
pos.time = getValidTime(RTCQualityGPS);
|
pos.time = getValidTime(RTCQualityGPS);
|
||||||
|
|
||||||
@@ -329,4 +332,4 @@ int MeshService::onGPSChanged(const meshtastic::GPSStatus *newStatus)
|
|||||||
bool MeshService::isToPhoneQueueEmpty()
|
bool MeshService::isToPhoneQueueEmpty()
|
||||||
{
|
{
|
||||||
return toPhoneQueue.isEmpty();
|
return toPhoneQueue.isEmpty();
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ class MeshService
|
|||||||
bool cancelSending(PacketId id);
|
bool cancelSending(PacketId id);
|
||||||
|
|
||||||
/// Pull the latest power and time info into my nodeinfo
|
/// Pull the latest power and time info into my nodeinfo
|
||||||
meshtastic_NodeInfo *refreshMyNodeInfo();
|
meshtastic_NodeInfoLite *refreshLocalMeshNode();
|
||||||
|
|
||||||
/// Send a packet to the phone
|
/// Send a packet to the phone
|
||||||
void sendToPhone(meshtastic_MeshPacket *p);
|
void sendToPhone(meshtastic_MeshPacket *p);
|
||||||
@@ -118,4 +118,4 @@ class MeshService
|
|||||||
ErrorCode sendQueueStatusToPhone(const meshtastic_QueueStatus &qs, ErrorCode res, uint32_t mesh_packet_id);
|
ErrorCode sendQueueStatusToPhone(const meshtastic_QueueStatus &qs, ErrorCode res, uint32_t mesh_packet_id);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern MeshService service;
|
extern MeshService service;
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "PowerFSM.h"
|
#include "PowerFSM.h"
|
||||||
#include "RTC.h"
|
#include "RTC.h"
|
||||||
#include "Router.h"
|
#include "Router.h"
|
||||||
|
#include "TypeConversions.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "mesh-pb-constants.h"
|
#include "mesh-pb-constants.h"
|
||||||
@@ -55,10 +56,18 @@ extern void getMacAddr(uint8_t *dmac);
|
|||||||
* we use !macaddr (no colons).
|
* we use !macaddr (no colons).
|
||||||
*/
|
*/
|
||||||
meshtastic_User &owner = devicestate.owner;
|
meshtastic_User &owner = devicestate.owner;
|
||||||
|
meshtastic_Position localPosition = meshtastic_Position_init_default;
|
||||||
|
meshtastic_CriticalErrorCode error_code =
|
||||||
|
meshtastic_CriticalErrorCode_NONE; // For the error code, only show values from this boot (discard value from flash)
|
||||||
|
uint32_t error_address = 0;
|
||||||
|
|
||||||
static uint8_t ourMacAddr[6];
|
static uint8_t ourMacAddr[6];
|
||||||
|
|
||||||
NodeDB::NodeDB() : nodes(devicestate.node_db), numNodes(&devicestate.node_db_count) {}
|
NodeDB::NodeDB()
|
||||||
|
: nodes(devicestate.node_db), numNodes(&devicestate.node_db_count), meshNodes(devicestate.node_db_lite),
|
||||||
|
numMeshNodes(&devicestate.node_db_lite_count)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Most (but not always) of the time we want to treat packets 'from' the local phone (where from == 0), as if they originated on
|
* Most (but not always) of the time we want to treat packets 'from' the local phone (where from == 0), as if they originated on
|
||||||
@@ -258,6 +267,9 @@ void NodeDB::resetNodes()
|
|||||||
{
|
{
|
||||||
devicestate.node_db_count = 0;
|
devicestate.node_db_count = 0;
|
||||||
memset(devicestate.node_db, 0, sizeof(devicestate.node_db));
|
memset(devicestate.node_db, 0, sizeof(devicestate.node_db));
|
||||||
|
|
||||||
|
devicestate.node_db_lite_count = 0;
|
||||||
|
memset(devicestate.node_db_lite, 0, sizeof(devicestate.node_db_lite));
|
||||||
saveDeviceStateToDisk();
|
saveDeviceStateToDisk();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,12 +284,10 @@ void NodeDB::installDefaultDeviceState()
|
|||||||
devicestate.has_my_node = true;
|
devicestate.has_my_node = true;
|
||||||
devicestate.has_owner = true;
|
devicestate.has_owner = true;
|
||||||
devicestate.node_db_count = 0;
|
devicestate.node_db_count = 0;
|
||||||
|
devicestate.node_db_lite_count = 0;
|
||||||
devicestate.version = DEVICESTATE_CUR_VER;
|
devicestate.version = DEVICESTATE_CUR_VER;
|
||||||
devicestate.receive_queue_count = 0; // Not yet implemented FIXME
|
devicestate.receive_queue_count = 0; // Not yet implemented FIXME
|
||||||
|
|
||||||
// default to no GPS, until one has been found by probing
|
|
||||||
myNodeInfo.has_gps = false;
|
|
||||||
myNodeInfo.message_timeout_msec = FLOOD_EXPIRE_TIME;
|
|
||||||
generatePacketId(); // FIXME - ugly way to init current_packet_id;
|
generatePacketId(); // FIXME - ugly way to init current_packet_id;
|
||||||
|
|
||||||
// Init our blank owner info to reasonable defaults
|
// Init our blank owner info to reasonable defaults
|
||||||
@@ -289,7 +299,6 @@ void NodeDB::installDefaultDeviceState()
|
|||||||
snprintf(owner.short_name, sizeof(owner.short_name), "%02x%02x", ourMacAddr[4], ourMacAddr[5]);
|
snprintf(owner.short_name, sizeof(owner.short_name), "%02x%02x", ourMacAddr[4], ourMacAddr[5]);
|
||||||
|
|
||||||
snprintf(owner.id, sizeof(owner.id), "!%08x", getNodeNum()); // Default node ID now based on nodenum
|
snprintf(owner.id, sizeof(owner.id), "!%08x", getNodeNum()); // Default node ID now based on nodenum
|
||||||
memcpy(owner.macaddr, ourMacAddr, sizeof(owner.macaddr));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeDB::init()
|
void NodeDB::init()
|
||||||
@@ -303,28 +312,34 @@ void NodeDB::init()
|
|||||||
|
|
||||||
int saveWhat = 0;
|
int saveWhat = 0;
|
||||||
|
|
||||||
myNodeInfo.max_channels = MAX_NUM_CHANNELS; // tell others the max # of channels we can understand
|
|
||||||
|
|
||||||
myNodeInfo.error_code =
|
|
||||||
meshtastic_CriticalErrorCode_NONE; // For the error code, only show values from this boot (discard value from flash)
|
|
||||||
myNodeInfo.error_address = 0;
|
|
||||||
|
|
||||||
// likewise - we always want the app requirements to come from the running appload
|
// likewise - we always want the app requirements to come from the running appload
|
||||||
myNodeInfo.min_app_version = 20300; // format is Mmmss (where M is 1+the numeric major number. i.e. 20120 means 1.1.20
|
myNodeInfo.min_app_version = 20300; // format is Mmmss (where M is 1+the numeric major number. i.e. 20120 means 1.1.20
|
||||||
|
myNodeInfo.max_channels = MAX_NUM_CHANNELS; // tell others the max # of channels we can understand
|
||||||
// Note! We do this after loading saved settings, so that if somehow an invalid nodenum was stored in preferences we won't
|
// Note! We do this after loading saved settings, so that if somehow an invalid nodenum was stored in preferences we won't
|
||||||
// keep using that nodenum forever. Crummy guess at our nodenum (but we will check against the nodedb to avoid conflicts)
|
// keep using that nodenum forever. Crummy guess at our nodenum (but we will check against the nodedb to avoid conflicts)
|
||||||
|
strncpy(myNodeInfo.firmware_version, optstr(APP_VERSION), sizeof(myNodeInfo.firmware_version));
|
||||||
pickNewNodeNum();
|
pickNewNodeNum();
|
||||||
|
|
||||||
// Set our board type so we can share it with others
|
// Set our board type so we can share it with others
|
||||||
owner.hw_model = HW_VENDOR;
|
owner.hw_model = HW_VENDOR;
|
||||||
|
|
||||||
// Include our owner in the node db under our nodenum
|
// Include our owner in the node db under our nodenum
|
||||||
meshtastic_NodeInfo *info = getOrCreateNode(getNodeNum());
|
meshtastic_NodeInfoLite *info = getOrCreateMeshNode(getNodeNum());
|
||||||
info->user = owner;
|
info->user = owner;
|
||||||
info->has_user = true;
|
info->has_user = true;
|
||||||
|
|
||||||
strncpy(myNodeInfo.firmware_version, optstr(APP_VERSION), sizeof(myNodeInfo.firmware_version));
|
if (*numNodes > 0) {
|
||||||
|
LOG_DEBUG("Legacy NodeDB detected... Migrating to NodeDBLite\n");
|
||||||
|
uint32_t readIndex = 0;
|
||||||
|
const meshtastic_NodeInfo *oldNodeInfo = nodeDB.readNextNodeInfo(readIndex);
|
||||||
|
while (oldNodeInfo != NULL) {
|
||||||
|
migrateToNodeInfoLite(oldNodeInfo);
|
||||||
|
oldNodeInfo = nodeDB.readNextNodeInfo(readIndex);
|
||||||
|
}
|
||||||
|
LOG_DEBUG("Migration complete! Clearing out legacy NodeDB...\n");
|
||||||
|
devicestate.node_db_count = 0;
|
||||||
|
memset(devicestate.node_db, 0, sizeof(devicestate.node_db));
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32
|
||||||
Preferences preferences;
|
Preferences preferences;
|
||||||
@@ -332,11 +347,6 @@ void NodeDB::init()
|
|||||||
myNodeInfo.reboot_count = preferences.getUInt("rebootCounter", 0);
|
myNodeInfo.reboot_count = preferences.getUInt("rebootCounter", 0);
|
||||||
preferences.end();
|
preferences.end();
|
||||||
LOG_DEBUG("Number of Device Reboots: %d\n", myNodeInfo.reboot_count);
|
LOG_DEBUG("Number of Device Reboots: %d\n", myNodeInfo.reboot_count);
|
||||||
|
|
||||||
/* The ESP32 has a wifi radio. This will need to be modified at some point so
|
|
||||||
* the test isn't so simplistic.
|
|
||||||
*/
|
|
||||||
myNodeInfo.has_wifi = true;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
resetRadioConfig(); // If bogus settings got saved, then fix them
|
resetRadioConfig(); // If bogus settings got saved, then fix them
|
||||||
@@ -349,6 +359,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,8 +384,8 @@ void NodeDB::pickNewNodeNum()
|
|||||||
if (r == NODENUM_BROADCAST || r < NUM_RESERVED)
|
if (r == NODENUM_BROADCAST || r < NUM_RESERVED)
|
||||||
r = NUM_RESERVED; // don't pick a reserved node number
|
r = NUM_RESERVED; // don't pick a reserved node number
|
||||||
|
|
||||||
meshtastic_NodeInfo *found;
|
meshtastic_NodeInfoLite *found;
|
||||||
while ((found = getNode(r)) && memcmp(found->user.macaddr, owner.macaddr, sizeof(owner.macaddr))) {
|
while ((found = getMeshNode(r)) && memcmp(found->user.macaddr, owner.macaddr, sizeof(owner.macaddr))) {
|
||||||
NodeNum n = random(NUM_RESERVED, NODENUM_BROADCAST); // try a new random choice
|
NodeNum n = random(NUM_RESERVED, NODENUM_BROADCAST); // try a new random choice
|
||||||
LOG_DEBUG("NOTE! Our desired nodenum 0x%x is in use, so trying for 0x%x\n", r, n);
|
LOG_DEBUG("NOTE! Our desired nodenum 0x%x is in use, so trying for 0x%x\n", r, n);
|
||||||
r = n;
|
r = n;
|
||||||
@@ -468,8 +483,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 */
|
||||||
@@ -490,13 +506,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
|
||||||
@@ -575,16 +594,24 @@ void NodeDB::saveToDisk(int saveWhat)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const meshtastic_NodeInfo *NodeDB::readNextInfo()
|
const meshtastic_NodeInfo *NodeDB::readNextNodeInfo(uint32_t &readIndex)
|
||||||
{
|
{
|
||||||
if (readPointer < *numNodes)
|
if (readIndex < *numNodes)
|
||||||
return &nodes[readPointer++];
|
return &nodes[readIndex++];
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const meshtastic_NodeInfoLite *NodeDB::readNextMeshNode(uint32_t &readIndex)
|
||||||
|
{
|
||||||
|
if (readIndex < *numMeshNodes)
|
||||||
|
return &meshNodes[readIndex++];
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Given a node, return how many seconds in the past (vs now) that we last heard from it
|
/// Given a node, return how many seconds in the past (vs now) that we last heard from it
|
||||||
uint32_t sinceLastSeen(const meshtastic_NodeInfo *n)
|
uint32_t sinceLastSeen(const meshtastic_NodeInfoLite *n)
|
||||||
{
|
{
|
||||||
uint32_t now = getTime();
|
uint32_t now = getTime();
|
||||||
|
|
||||||
@@ -608,13 +635,13 @@ uint32_t sinceReceived(const meshtastic_MeshPacket *p)
|
|||||||
|
|
||||||
#define NUM_ONLINE_SECS (60 * 60 * 2) // 2 hrs to consider someone offline
|
#define NUM_ONLINE_SECS (60 * 60 * 2) // 2 hrs to consider someone offline
|
||||||
|
|
||||||
size_t NodeDB::getNumOnlineNodes()
|
size_t NodeDB::getNumOnlineMeshNodes()
|
||||||
{
|
{
|
||||||
size_t numseen = 0;
|
size_t numseen = 0;
|
||||||
|
|
||||||
// FIXME this implementation is kinda expensive
|
// FIXME this implementation is kinda expensive
|
||||||
for (int i = 0; i < *numNodes; i++)
|
for (int i = 0; i < *numMeshNodes; i++)
|
||||||
if (sinceLastSeen(&nodes[i]) < NUM_ONLINE_SECS)
|
if (sinceLastSeen(&meshNodes[i]) < NUM_ONLINE_SECS)
|
||||||
numseen++;
|
numseen++;
|
||||||
|
|
||||||
return numseen;
|
return numseen;
|
||||||
@@ -626,7 +653,7 @@ size_t NodeDB::getNumOnlineNodes()
|
|||||||
*/
|
*/
|
||||||
void NodeDB::updatePosition(uint32_t nodeId, const meshtastic_Position &p, RxSource src)
|
void NodeDB::updatePosition(uint32_t nodeId, const meshtastic_Position &p, RxSource src)
|
||||||
{
|
{
|
||||||
meshtastic_NodeInfo *info = getOrCreateNode(nodeId);
|
meshtastic_NodeInfoLite *info = getOrCreateMeshNode(nodeId);
|
||||||
if (!info) {
|
if (!info) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -635,7 +662,9 @@ void NodeDB::updatePosition(uint32_t nodeId, const meshtastic_Position &p, RxSou
|
|||||||
// Local packet, fully authoritative
|
// Local packet, fully authoritative
|
||||||
LOG_INFO("updatePosition LOCAL pos@%x, time=%u, latI=%d, lonI=%d, alt=%d\n", p.timestamp, p.time, p.latitude_i,
|
LOG_INFO("updatePosition LOCAL pos@%x, time=%u, latI=%d, lonI=%d, alt=%d\n", p.timestamp, p.time, p.latitude_i,
|
||||||
p.longitude_i, p.altitude);
|
p.longitude_i, p.altitude);
|
||||||
info->position = p;
|
|
||||||
|
info->position = ConvertToPositionLite(p);
|
||||||
|
localPosition = p;
|
||||||
} else if ((p.time > 0) && !p.latitude_i && !p.longitude_i && !p.timestamp && !p.location_source) {
|
} else if ((p.time > 0) && !p.latitude_i && !p.longitude_i && !p.timestamp && !p.location_source) {
|
||||||
// FIXME SPECIAL TIME SETTING PACKET FROM EUD TO RADIO
|
// FIXME SPECIAL TIME SETTING PACKET FROM EUD TO RADIO
|
||||||
// (stop-gap fix for issue #900)
|
// (stop-gap fix for issue #900)
|
||||||
@@ -653,7 +682,7 @@ void NodeDB::updatePosition(uint32_t nodeId, const meshtastic_Position &p, RxSou
|
|||||||
uint32_t tmp_time = info->position.time;
|
uint32_t tmp_time = info->position.time;
|
||||||
|
|
||||||
// Next, update atomically
|
// Next, update atomically
|
||||||
info->position = p;
|
info->position = ConvertToPositionLite(p);
|
||||||
|
|
||||||
// Last, restore any fields that may have been overwritten
|
// Last, restore any fields that may have been overwritten
|
||||||
if (!info->position.time)
|
if (!info->position.time)
|
||||||
@@ -669,7 +698,7 @@ void NodeDB::updatePosition(uint32_t nodeId, const meshtastic_Position &p, RxSou
|
|||||||
*/
|
*/
|
||||||
void NodeDB::updateTelemetry(uint32_t nodeId, const meshtastic_Telemetry &t, RxSource src)
|
void NodeDB::updateTelemetry(uint32_t nodeId, const meshtastic_Telemetry &t, RxSource src)
|
||||||
{
|
{
|
||||||
meshtastic_NodeInfo *info = getOrCreateNode(nodeId);
|
meshtastic_NodeInfoLite *info = getOrCreateMeshNode(nodeId);
|
||||||
// Environment metrics should never go to NodeDb but we'll safegaurd anyway
|
// Environment metrics should never go to NodeDb but we'll safegaurd anyway
|
||||||
if (!info || t.which_variant != meshtastic_Telemetry_device_metrics_tag) {
|
if (!info || t.which_variant != meshtastic_Telemetry_device_metrics_tag) {
|
||||||
return;
|
return;
|
||||||
@@ -691,7 +720,7 @@ void NodeDB::updateTelemetry(uint32_t nodeId, const meshtastic_Telemetry &t, RxS
|
|||||||
*/
|
*/
|
||||||
bool 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_NodeInfoLite *info = getOrCreateMeshNode(nodeId);
|
||||||
if (!info) {
|
if (!info) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -724,7 +753,7 @@ 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, channel=%d\n", mp.from, mp.rx_time, mp.channel);
|
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_NodeInfoLite *info = getOrCreateMeshNode(getFrom(&mp));
|
||||||
if (!info) {
|
if (!info) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -741,9 +770,9 @@ void NodeDB::updateFrom(const meshtastic_MeshPacket &mp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t NodeDB::getNodeChannel(NodeNum n)
|
uint8_t NodeDB::getMeshNodeChannel(NodeNum n)
|
||||||
{
|
{
|
||||||
meshtastic_NodeInfo *info = getNode(n);
|
meshtastic_NodeInfoLite *info = getMeshNode(n);
|
||||||
if (!info) {
|
if (!info) {
|
||||||
return 0; // defaults to PRIMARY
|
return 0; // defaults to PRIMARY
|
||||||
}
|
}
|
||||||
@@ -752,7 +781,7 @@ uint8_t NodeDB::getNodeChannel(NodeNum n)
|
|||||||
|
|
||||||
/// 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::getNodeInfo(NodeNum n)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < *numNodes; i++)
|
for (int i = 0; i < *numNodes; i++)
|
||||||
if (nodes[i].num == n)
|
if (nodes[i].num == n)
|
||||||
@@ -761,38 +790,100 @@ meshtastic_NodeInfo *NodeDB::getNode(NodeNum n)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Find a node in our DB, create an empty NodeInfo if missing
|
/// Find a node in our DB, return null for missing
|
||||||
meshtastic_NodeInfo *NodeDB::getOrCreateNode(NodeNum n)
|
/// NOTE: This function might be called from an ISR
|
||||||
|
meshtastic_NodeInfoLite *NodeDB::getMeshNode(NodeNum n)
|
||||||
{
|
{
|
||||||
meshtastic_NodeInfo *info = getNode(n);
|
for (int i = 0; i < *numMeshNodes; i++)
|
||||||
|
if (meshNodes[i].num == n)
|
||||||
|
return &meshNodes[i];
|
||||||
|
|
||||||
if (!info) {
|
return NULL;
|
||||||
if (*numNodes >= MAX_NUM_NODES) {
|
}
|
||||||
screen->print("warning: node_db full! erasing oldest entry\n");
|
|
||||||
|
/// Find a node in our DB, create an empty NodeInfo if missing
|
||||||
|
meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n)
|
||||||
|
{
|
||||||
|
meshtastic_NodeInfoLite *lite = getMeshNode(n);
|
||||||
|
|
||||||
|
if (!lite) {
|
||||||
|
if ((*numMeshNodes >= MAX_NUM_NODES) || (memGet.getFreeHeap() < meshtastic_NodeInfoLite_size * 3)) {
|
||||||
|
screen->print("warning: node_db_lite 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;
|
||||||
int oldestIndex = -1;
|
int oldestIndex = -1;
|
||||||
for (int i = 0; i < *numNodes; i++) {
|
for (int i = 0; i < *numMeshNodes; i++) {
|
||||||
if (nodes[i].last_heard < oldest) {
|
if (meshNodes[i].last_heard < oldest) {
|
||||||
oldest = nodes[i].last_heard;
|
oldest = meshNodes[i].last_heard;
|
||||||
oldestIndex = i;
|
oldestIndex = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Shove the remaining nodes down the chain
|
// Shove the remaining nodes down the chain
|
||||||
for (int i = oldestIndex; i < *numNodes - 1; i++) {
|
for (int i = oldestIndex; i < *numMeshNodes - 1; i++) {
|
||||||
nodes[i] = nodes[i + 1];
|
meshNodes[i] = meshNodes[i + 1];
|
||||||
}
|
}
|
||||||
(*numNodes)--;
|
(*numMeshNodes)--;
|
||||||
}
|
}
|
||||||
// add the node at the end
|
// add the node at the end
|
||||||
info = &nodes[(*numNodes)++];
|
lite = &meshNodes[(*numMeshNodes)++];
|
||||||
|
|
||||||
// everything is missing except the nodenum
|
// everything is missing except the nodenum
|
||||||
memset(info, 0, sizeof(*info));
|
memset(lite, 0, sizeof(*lite));
|
||||||
info->num = n;
|
lite->num = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
return info;
|
return lite;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NodeDB::migrateToNodeInfoLite(const meshtastic_NodeInfo *node)
|
||||||
|
{
|
||||||
|
meshtastic_NodeInfoLite *lite = getMeshNode(node->num);
|
||||||
|
|
||||||
|
if (!lite) {
|
||||||
|
if ((*numMeshNodes >= MAX_NUM_NODES) || (memGet.getFreeHeap() < meshtastic_NodeInfoLite_size * 3)) {
|
||||||
|
screen->print("warning: node_db_lite full! erasing oldest entry\n");
|
||||||
|
// look for oldest node and erase it
|
||||||
|
uint32_t oldest = UINT32_MAX;
|
||||||
|
int oldestIndex = -1;
|
||||||
|
for (int i = 0; i < *numMeshNodes; i++) {
|
||||||
|
if (meshNodes[i].last_heard < oldest) {
|
||||||
|
oldest = meshNodes[i].last_heard;
|
||||||
|
oldestIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Shove the remaining nodes down the chain
|
||||||
|
for (int i = oldestIndex; i < *numMeshNodes - 1; i++) {
|
||||||
|
meshNodes[i] = meshNodes[i + 1];
|
||||||
|
}
|
||||||
|
(*numMeshNodes)--;
|
||||||
|
}
|
||||||
|
// add the node at the end
|
||||||
|
lite = &meshNodes[(*numMeshNodes)++];
|
||||||
|
|
||||||
|
// everything is missing except the nodenum
|
||||||
|
memset(lite, 0, sizeof(*lite));
|
||||||
|
lite->num = node->num;
|
||||||
|
lite->snr = node->snr;
|
||||||
|
lite->last_heard = node->last_heard;
|
||||||
|
lite->channel = node->channel;
|
||||||
|
|
||||||
|
if (node->has_position) {
|
||||||
|
lite->has_position = true;
|
||||||
|
lite->position.latitude_i = node->position.latitude_i;
|
||||||
|
lite->position.longitude_i = node->position.longitude_i;
|
||||||
|
lite->position.altitude = node->position.altitude;
|
||||||
|
lite->position.location_source = node->position.location_source;
|
||||||
|
lite->position.time = node->position.time;
|
||||||
|
}
|
||||||
|
if (node->has_user) {
|
||||||
|
lite->has_user = true;
|
||||||
|
lite->user = node->user;
|
||||||
|
}
|
||||||
|
if (node->has_device_metrics) {
|
||||||
|
lite->has_device_metrics = true;
|
||||||
|
lite->device_metrics = node->device_metrics;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Record an error that should be reported via analytics
|
/// Record an error that should be reported via analytics
|
||||||
@@ -801,19 +892,19 @@ 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;
|
error_code = code;
|
||||||
myNodeInfo.error_address = address;
|
error_address = address;
|
||||||
myNodeInfo.error_count++;
|
|
||||||
|
|
||||||
// Currently portuino is mostly used for simulation. Make sue the user notices something really bad happend
|
// Currently portuino is mostly used for simulation. Make sue the user notices something really bad happend
|
||||||
#ifdef ARCH_PORTDUINO
|
#ifdef ARCH_PORTDUINO
|
||||||
LOG_ERROR("A critical failure occurred, portduino is exiting...");
|
LOG_ERROR("A critical failure occurred, portduino is exiting...");
|
||||||
exit(2);
|
exit(2);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "MeshTypes.h"
|
#include "MeshTypes.h"
|
||||||
#include "NodeStatus.h"
|
#include "NodeStatus.h"
|
||||||
#include "mesh-pb-constants.h"
|
#include "mesh-pb-constants.h"
|
||||||
|
#include "mesh/generated/meshtastic/mesh.pb.h" // For CriticalErrorCode
|
||||||
|
|
||||||
/*
|
/*
|
||||||
DeviceState versions used to be defined in the .proto file but really only this function cares. So changed to a
|
DeviceState versions used to be defined in the .proto file but really only this function cares. So changed to a
|
||||||
@@ -28,9 +29,10 @@ extern meshtastic_LocalConfig config;
|
|||||||
extern meshtastic_LocalModuleConfig moduleConfig;
|
extern meshtastic_LocalModuleConfig moduleConfig;
|
||||||
extern meshtastic_OEMStore oemStore;
|
extern meshtastic_OEMStore oemStore;
|
||||||
extern meshtastic_User &owner;
|
extern meshtastic_User &owner;
|
||||||
|
extern meshtastic_Position localPosition;
|
||||||
|
|
||||||
/// Given a node, return how many seconds in the past (vs now) that we last heard from it
|
/// Given a node, return how many seconds in the past (vs now) that we last heard from it
|
||||||
uint32_t sinceLastSeen(const meshtastic_NodeInfo *n);
|
uint32_t sinceLastSeen(const meshtastic_NodeInfoLite *n);
|
||||||
|
|
||||||
/// Given a packet, return how many seconds in the past (vs now) it was received
|
/// Given a packet, return how many seconds in the past (vs now) it was received
|
||||||
uint32_t sinceReceived(const meshtastic_MeshPacket *p);
|
uint32_t sinceReceived(const meshtastic_MeshPacket *p);
|
||||||
@@ -46,11 +48,12 @@ class NodeDB
|
|||||||
meshtastic_NodeInfo *nodes;
|
meshtastic_NodeInfo *nodes;
|
||||||
pb_size_t *numNodes;
|
pb_size_t *numNodes;
|
||||||
|
|
||||||
uint32_t readPointer = 0;
|
meshtastic_NodeInfoLite *meshNodes;
|
||||||
|
pb_size_t *numMeshNodes;
|
||||||
|
|
||||||
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_NodeInfoLite *updateGUIforNode = NULL; // if currently showing this node, we think you should update the GUI
|
||||||
Observable<const meshtastic::NodeStatus *> newStatus;
|
Observable<const meshtastic::NodeStatus *> newStatus;
|
||||||
|
|
||||||
/// don't do mesh based algoritm for node id assignment (initially)
|
/// don't do mesh based algoritm for node id assignment (initially)
|
||||||
@@ -91,8 +94,6 @@ class NodeDB
|
|||||||
/// @return our node number
|
/// @return our node number
|
||||||
NodeNum getNodeNum() { return myNodeInfo.my_node_num; }
|
NodeNum getNodeNum() { return myNodeInfo.my_node_num; }
|
||||||
|
|
||||||
size_t getNumNodes() { return *numNodes; }
|
|
||||||
|
|
||||||
/// if returns false, that means our node should send a DenyNodeNum response. If true, we think the number is okay for use
|
/// if returns false, that means our node should send a DenyNodeNum response. If true, we think the number is okay for use
|
||||||
// bool handleWantNodeNum(NodeNum n);
|
// bool handleWantNodeNum(NodeNum n);
|
||||||
|
|
||||||
@@ -104,29 +105,14 @@ 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
|
|
||||||
const meshtastic_NodeInfo *readNextInfo();
|
|
||||||
|
|
||||||
/// 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
|
// get channel channel index we heard a nodeNum on, defaults to 0 if not found
|
||||||
uint8_t getNodeChannel(NodeNum n);
|
uint8_t getMeshNodeChannel(NodeNum n);
|
||||||
|
|
||||||
/// Find a node in our DB, return null for missing
|
|
||||||
meshtastic_NodeInfo *getNode(NodeNum n);
|
|
||||||
|
|
||||||
meshtastic_NodeInfo *getNodeByIndex(size_t x)
|
|
||||||
{
|
|
||||||
assert(x < *numNodes);
|
|
||||||
return &nodes[x];
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Return the number of nodes we've heard from recently (within the last 2 hrs?)
|
/// Return the number of nodes we've heard from recently (within the last 2 hrs?)
|
||||||
size_t getNumOnlineNodes();
|
size_t getNumOnlineMeshNodes();
|
||||||
|
|
||||||
void initConfigIntervals(), initModuleConfigIntervals(), resetNodes();
|
void initConfigIntervals(), initModuleConfigIntervals(), resetNodes();
|
||||||
|
|
||||||
@@ -137,15 +123,38 @@ class NodeDB
|
|||||||
|
|
||||||
void installRoleDefaults(meshtastic_Config_DeviceConfig_Role role);
|
void installRoleDefaults(meshtastic_Config_DeviceConfig_Role role);
|
||||||
|
|
||||||
|
const meshtastic_NodeInfoLite *readNextMeshNode(uint32_t &readIndex);
|
||||||
|
|
||||||
|
meshtastic_NodeInfoLite *getMeshNodeByIndex(size_t x)
|
||||||
|
{
|
||||||
|
assert(x < *numMeshNodes);
|
||||||
|
return &meshNodes[x];
|
||||||
|
}
|
||||||
|
|
||||||
|
meshtastic_NodeInfoLite *getMeshNode(NodeNum n);
|
||||||
|
size_t getNumMeshNodes() { return *numMeshNodes; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Find a node in our DB, create an empty NodeInfo if missing
|
/// Find a node in our DB, create an empty NodeInfoLite if missing
|
||||||
meshtastic_NodeInfo *getOrCreateNode(NodeNum n);
|
meshtastic_NodeInfoLite *getOrCreateMeshNode(NodeNum n);
|
||||||
|
void migrateToNodeInfoLite(const meshtastic_NodeInfo *node);
|
||||||
|
/// Find a node in our DB, return null for missing
|
||||||
|
meshtastic_NodeInfo *getNodeInfo(NodeNum n);
|
||||||
|
/// Allow the bluetooth layer to read our next nodeinfo record, or NULL if done reading
|
||||||
|
const meshtastic_NodeInfo *readNextNodeInfo(uint32_t &readIndex);
|
||||||
|
size_t getNumNodes() { return *numNodes; }
|
||||||
|
|
||||||
|
meshtastic_NodeInfo *getNodeByIndex(size_t x)
|
||||||
|
{
|
||||||
|
assert(x < *numNodes);
|
||||||
|
return &nodes[x];
|
||||||
|
}
|
||||||
|
|
||||||
/// Notify observers of changes to the DB
|
/// Notify observers of changes to the DB
|
||||||
void notifyObservers(bool forceUpdate = false)
|
void notifyObservers(bool forceUpdate = false)
|
||||||
{
|
{
|
||||||
// Notify observers of the current node state
|
// Notify observers of the current node state
|
||||||
const meshtastic::NodeStatus status = meshtastic::NodeStatus(getNumOnlineNodes(), getNumNodes(), forceUpdate);
|
const meshtastic::NodeStatus status = meshtastic::NodeStatus(getNumOnlineMeshNodes(), getNumMeshNodes(), forceUpdate);
|
||||||
newStatus.notifyObservers(&status);
|
newStatus.notifyObservers(&status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,12 +226,30 @@ 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);
|
||||||
|
}
|
||||||
|
static inline bool hasValidPosition(const meshtastic_NodeInfoLite *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.
|
||||||
*/
|
*/
|
||||||
extern uint32_t radioGeneration;
|
extern uint32_t radioGeneration;
|
||||||
|
|
||||||
|
extern meshtastic_CriticalErrorCode error_code;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A numeric error address (nonzero if available)
|
||||||
|
*/
|
||||||
|
extern uint32_t error_address;
|
||||||
|
|
||||||
#define Module_Config_size \
|
#define Module_Config_size \
|
||||||
(ModuleConfig_CannedMessageConfig_size + ModuleConfig_ExternalNotificationConfig_size + ModuleConfig_MQTTConfig_size + \
|
(ModuleConfig_CannedMessageConfig_size + ModuleConfig_ExternalNotificationConfig_size + ModuleConfig_MQTTConfig_size + \
|
||||||
ModuleConfig_RangeTestConfig_size + ModuleConfig_SerialConfig_size + ModuleConfig_StoreForwardConfig_size + \
|
ModuleConfig_RangeTestConfig_size + ModuleConfig_SerialConfig_size + ModuleConfig_StoreForwardConfig_size + \
|
||||||
ModuleConfig_TelemetryConfig_size + ModuleConfig_size)
|
ModuleConfig_TelemetryConfig_size + ModuleConfig_size)
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "PowerFSM.h"
|
#include "PowerFSM.h"
|
||||||
#include "RadioInterface.h"
|
#include "RadioInterface.h"
|
||||||
|
#include "TypeConversions.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "xmodem.h"
|
#include "xmodem.h"
|
||||||
@@ -40,9 +41,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.num = 0; // 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()
|
||||||
@@ -144,25 +144,23 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||||||
LOG_INFO("getFromRadio=STATE_SEND_MY_INFO\n");
|
LOG_INFO("getFromRadio=STATE_SEND_MY_INFO\n");
|
||||||
// If the user has specified they don't want our node to share its location, make sure to tell the phone
|
// If the user has specified they don't want our node to share its location, make sure to tell the phone
|
||||||
// app not to send locations on our behalf.
|
// app not to send locations on our behalf.
|
||||||
myNodeInfo.has_gps = gps && gps->isConnected(); // Update with latest GPS connect info
|
|
||||||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_my_info_tag;
|
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_my_info_tag;
|
||||||
fromRadioScratch.my_info = myNodeInfo;
|
fromRadioScratch.my_info = myNodeInfo;
|
||||||
state = STATE_SEND_NODEINFO;
|
state = STATE_SEND_NODEINFO;
|
||||||
|
|
||||||
service.refreshMyNodeInfo(); // Update my NodeInfo because the client will be asking for it soon.
|
service.refreshLocalMeshNode(); // Update my NodeInfo because the client will be asking for it soon.
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STATE_SEND_NODEINFO: {
|
case STATE_SEND_NODEINFO: {
|
||||||
LOG_INFO("getFromRadio=STATE_SEND_NODEINFO\n");
|
LOG_INFO("getFromRadio=STATE_SEND_NODEINFO\n");
|
||||||
const meshtastic_NodeInfo *info = nodeInfoForPhone;
|
|
||||||
nodeInfoForPhone = NULL; // We just consumed a nodeinfo, will need a new one next time
|
|
||||||
|
|
||||||
if (info) {
|
if (nodeInfoForPhone.num != 0) {
|
||||||
LOG_INFO("Sending nodeinfo: num=0x%x, lastseen=%u, id=%s, name=%s\n", info->num, info->last_heard, info->user.id,
|
LOG_INFO("nodeinfo: num=0x%x, lastseen=%u, id=%s, name=%s\n", nodeInfoForPhone.num, nodeInfoForPhone.last_heard,
|
||||||
info->user.long_name);
|
nodeInfoForPhone.user.id, nodeInfoForPhone.user.long_name);
|
||||||
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_node_info_tag;
|
fromRadioScratch.which_payload_variant = meshtastic_FromRadio_node_info_tag;
|
||||||
fromRadioScratch.node_info = *info;
|
fromRadioScratch.node_info = nodeInfoForPhone;
|
||||||
// Stay in current state until done sending nodeinfos
|
// Stay in current state until done sending nodeinfos
|
||||||
|
nodeInfoForPhone.num = 0; // We just consumed a nodeinfo, will need a new one next time
|
||||||
} else {
|
} else {
|
||||||
LOG_INFO("Done sending nodeinfos\n");
|
LOG_INFO("Done sending nodeinfos\n");
|
||||||
state = STATE_SEND_CHANNELS;
|
state = STATE_SEND_CHANNELS;
|
||||||
@@ -372,8 +370,12 @@ bool PhoneAPI::available()
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case STATE_SEND_NODEINFO:
|
case STATE_SEND_NODEINFO:
|
||||||
if (!nodeInfoForPhone)
|
if (nodeInfoForPhone.num == 0) {
|
||||||
nodeInfoForPhone = nodeDB.readNextInfo();
|
auto nextNode = nodeDB.readNextMeshNode(readIndex);
|
||||||
|
if (nextNode) {
|
||||||
|
nodeInfoForPhone = ConvertToNodeInfo(nextNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
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 +425,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;
|
||||||
}
|
}
|
||||||
@@ -51,13 +51,16 @@ class PhoneAPI
|
|||||||
meshtastic_QueueStatus *queueStatusPacketForPhone = NULL;
|
meshtastic_QueueStatus *queueStatusPacketForPhone = NULL;
|
||||||
|
|
||||||
/// We temporarily keep the nodeInfo here between the call to available and getFromRadio
|
/// We temporarily keep the nodeInfo here between the call to available and getFromRadio
|
||||||
const meshtastic_NodeInfo *nodeInfoForPhone = NULL;
|
meshtastic_NodeInfo nodeInfoForPhone = meshtastic_NodeInfo_init_default;
|
||||||
|
|
||||||
meshtastic_ToRadio toRadioScratch = {
|
meshtastic_ToRadio toRadioScratch = {
|
||||||
0}; // this is a static scratch object, any data must be copied elsewhere before returning
|
0}; // this is a static scratch object, any data must be copied elsewhere before returning
|
||||||
|
|
||||||
/// 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();
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ template <class T> class ProtobufModule : protected SinglePortModule
|
|||||||
*/
|
*/
|
||||||
const char *getSenderShortName(const meshtastic_MeshPacket &mp)
|
const char *getSenderShortName(const meshtastic_MeshPacket &mp)
|
||||||
{
|
{
|
||||||
auto node = nodeDB.getNode(getFrom(&mp));
|
auto node = nodeDB.getMeshNode(getFrom(&mp));
|
||||||
const char *sender = (node) ? node->user.short_name : "???";
|
const char *sender = (node) ? node->user.short_name : "???";
|
||||||
return sender;
|
return sender;
|
||||||
}
|
}
|
||||||
@@ -86,4 +86,4 @@ template <class T> class ProtobufModule : protected SinglePortModule
|
|||||||
|
|
||||||
return handleReceivedProtobuf(mp, decoded) ? ProcessMessage::STOP : ProcessMessage::CONTINUE;
|
return handleReceivedProtobuf(mp, decoded) ? ProcessMessage::STOP : ProcessMessage::CONTINUE;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -11,9 +11,9 @@
|
|||||||
|
|
||||||
#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)
|
||||||
{
|
{
|
||||||
LOG_WARN("RF95Interface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy);
|
LOG_WARN("RF95Interface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -232,7 +232,8 @@ uint32_t RadioInterface::getTxDelayMsecWeighted(float snr)
|
|||||||
delay = random(0, 2 * CWsize) * slotTimeMsec;
|
delay = random(0, 2 * CWsize) * slotTimeMsec;
|
||||||
LOG_DEBUG("rx_snr found in packet. As a router, setting tx delay:%d\n", delay);
|
LOG_DEBUG("rx_snr found in packet. As a router, setting tx delay:%d\n", delay);
|
||||||
} else {
|
} else {
|
||||||
delay = random(0, pow(2, CWsize)) * slotTimeMsec;
|
// offset the maximum delay for routers: (2 * CWmax * slotTimeMsec)
|
||||||
|
delay = (2 * CWmax * slotTimeMsec) + random(0, pow(2, CWsize)) * slotTimeMsec;
|
||||||
LOG_DEBUG("rx_snr found in packet. Setting tx delay:%d\n", delay);
|
LOG_DEBUG("rx_snr found in packet. Setting tx delay:%d\n", delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,6 +242,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) {
|
||||||
@@ -283,6 +285,7 @@ void printPacket(const char *prefix, const meshtastic_MeshPacket *p)
|
|||||||
|
|
||||||
out += ")";
|
out += ")";
|
||||||
LOG_DEBUG("%s\n", 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
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ ErrorCode Router::sendLocal(meshtastic_MeshPacket *p, RxSource src)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!p->channel) { // don't override if a channel was requested
|
if (!p->channel) { // don't override if a channel was requested
|
||||||
p->channel = nodeDB.getNodeChannel(p->to);
|
p->channel = nodeDB.getMeshNodeChannel(p->to);
|
||||||
LOG_DEBUG("localSend to channel %d\n", p->channel);
|
LOG_DEBUG("localSend to channel %d\n", p->channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,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);
|
||||||
@@ -479,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -491,4 +493,4 @@ void Router::perhapsHandleReceived(meshtastic_MeshPacket *p)
|
|||||||
handleReceived(p);
|
handleReceived(p);
|
||||||
|
|
||||||
packetPool.release(p);
|
packetPool.release(p);
|
||||||
}
|
}
|
||||||
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,9 +9,9 @@
|
|||||||
#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);
|
LOG_WARN("SX128xInterface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy);
|
||||||
}
|
}
|
||||||
@@ -151,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().
|
||||||
|
|||||||
54
src/mesh/TypeConversions.h
Normal file
54
src/mesh/TypeConversions.h
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#include "mesh/generated/meshtastic/deviceonly.pb.h"
|
||||||
|
#include "mesh/generated/meshtastic/mesh.pb.h"
|
||||||
|
|
||||||
|
inline static meshtastic_NodeInfo ConvertToNodeInfo(const meshtastic_NodeInfoLite *lite)
|
||||||
|
{
|
||||||
|
meshtastic_NodeInfo info = meshtastic_NodeInfo_init_default;
|
||||||
|
|
||||||
|
info.num = lite->num;
|
||||||
|
info.snr = lite->snr;
|
||||||
|
info.last_heard = lite->last_heard;
|
||||||
|
info.channel = lite->channel;
|
||||||
|
|
||||||
|
if (lite->has_position) {
|
||||||
|
info.has_position = true;
|
||||||
|
info.position.latitude_i = lite->position.latitude_i;
|
||||||
|
info.position.longitude_i = lite->position.longitude_i;
|
||||||
|
info.position.altitude = lite->position.altitude;
|
||||||
|
info.position.location_source = lite->position.location_source;
|
||||||
|
info.position.time = lite->position.time;
|
||||||
|
}
|
||||||
|
if (lite->has_user) {
|
||||||
|
info.has_user = true;
|
||||||
|
info.user = lite->user;
|
||||||
|
}
|
||||||
|
if (lite->has_device_metrics) {
|
||||||
|
info.has_device_metrics = true;
|
||||||
|
info.device_metrics = lite->device_metrics;
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline static meshtastic_PositionLite ConvertToPositionLite(meshtastic_Position position)
|
||||||
|
{
|
||||||
|
meshtastic_PositionLite lite = meshtastic_PositionLite_init_default;
|
||||||
|
lite.latitude_i = position.latitude_i;
|
||||||
|
lite.longitude_i = position.longitude_i;
|
||||||
|
lite.altitude = position.altitude;
|
||||||
|
lite.location_source = position.location_source;
|
||||||
|
lite.time = position.time;
|
||||||
|
|
||||||
|
return lite;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline static meshtastic_Position ConvertToPosition(meshtastic_PositionLite lite)
|
||||||
|
{
|
||||||
|
meshtastic_Position position = meshtastic_Position_init_default;
|
||||||
|
position.latitude_i = lite.latitude_i;
|
||||||
|
position.longitude_i = lite.longitude_i;
|
||||||
|
position.altitude = lite.altitude;
|
||||||
|
position.location_source = lite.location_source;
|
||||||
|
position.time = lite.time;
|
||||||
|
|
||||||
|
return position;
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -98,6 +98,11 @@ static int32_t reconnectETH()
|
|||||||
return 5000; // every 5 seconds
|
return 5000; // every 5 seconds
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint32_t bigToLittleEndian(uint32_t value)
|
||||||
|
{
|
||||||
|
return ((value >> 24) & 0xFF) | ((value >> 8) & 0xFF00) | ((value << 8) & 0xFF0000) | ((value << 24) & 0xFF000000);
|
||||||
|
}
|
||||||
|
|
||||||
// Startup Ethernet
|
// Startup Ethernet
|
||||||
bool initEthernet()
|
bool initEthernet()
|
||||||
{
|
{
|
||||||
@@ -126,7 +131,15 @@ bool initEthernet()
|
|||||||
status = Ethernet.begin(mac);
|
status = Ethernet.begin(mac);
|
||||||
} else if (config.network.address_mode == meshtastic_Config_NetworkConfig_AddressMode_STATIC) {
|
} else if (config.network.address_mode == meshtastic_Config_NetworkConfig_AddressMode_STATIC) {
|
||||||
LOG_INFO("starting Ethernet Static\n");
|
LOG_INFO("starting Ethernet Static\n");
|
||||||
Ethernet.begin(mac, config.network.ipv4_config.ip, config.network.ipv4_config.dns, config.network.ipv4_config.subnet);
|
|
||||||
|
IPAddress ip = IPAddress(bigToLittleEndian(config.network.ipv4_config.ip));
|
||||||
|
IPAddress dns = IPAddress(bigToLittleEndian(config.network.ipv4_config.dns));
|
||||||
|
IPAddress gateway = IPAddress(bigToLittleEndian(config.network.ipv4_config.gateway));
|
||||||
|
IPAddress subnet = IPAddress(bigToLittleEndian(config.network.ipv4_config.subnet));
|
||||||
|
|
||||||
|
Ethernet.begin(mac, ip, dns, gateway, subnet);
|
||||||
|
|
||||||
|
status = 1;
|
||||||
} else {
|
} else {
|
||||||
LOG_INFO("Ethernet Disabled\n");
|
LOG_INFO("Ethernet Disabled\n");
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -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" */
|
||||||
|
|||||||
@@ -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,
|
||||||
@@ -233,6 +233,9 @@ typedef struct _meshtastic_Config_DeviceConfig {
|
|||||||
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 */
|
/* Treat double tap interrupt on supported accelerometers as a button press if set to true */
|
||||||
bool double_tap_as_button_press;
|
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 */
|
||||||
@@ -290,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;
|
||||||
@@ -308,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 {
|
||||||
@@ -353,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 */
|
||||||
@@ -416,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;
|
||||||
@@ -529,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, 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, 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, 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, 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}
|
||||||
@@ -556,6 +561,7 @@ extern "C" {
|
|||||||
#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_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
|
||||||
@@ -575,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
|
||||||
@@ -650,7 +657,8 @@ 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, 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
|
||||||
|
|
||||||
@@ -677,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
|
||||||
|
|
||||||
@@ -765,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 28
|
#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 54
|
#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
|
||||||
|
|||||||
@@ -9,11 +9,20 @@
|
|||||||
PB_BIND(meshtastic_DeviceState, meshtastic_DeviceState, 4)
|
PB_BIND(meshtastic_DeviceState, meshtastic_DeviceState, 4)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(meshtastic_NodeInfoLite, meshtastic_NodeInfoLite, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(meshtastic_PositionLite, meshtastic_PositionLite, AUTO)
|
||||||
|
|
||||||
|
|
||||||
PB_BIND(meshtastic_ChannelFile, meshtastic_ChannelFile, 2)
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -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 456
|
#define meshtastic_LocalConfig_size 461
|
||||||
#define meshtastic_LocalModuleConfig_size 439
|
#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.
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------ */
|
------------------------------------------------------------------------------------------------------------------------------------------ */
|
||||||
@@ -368,7 +372,8 @@ typedef struct _meshtastic_User {
|
|||||||
/* A VERY short name, ideally two characters.
|
/* A VERY short name, ideally two characters.
|
||||||
Suitable for a tiny OLED screen */
|
Suitable for a tiny OLED screen */
|
||||||
char short_name[5];
|
char short_name[5];
|
||||||
/* This is the addr of the radio.
|
/* Deprecated in Meshtastic 2.1.x
|
||||||
|
This is the addr of the radio.
|
||||||
Not populated by the phone, but added by the esp32 when broadcasting */
|
Not populated by the phone, but added by the esp32 when broadcasting */
|
||||||
pb_byte_t macaddr[6];
|
pb_byte_t macaddr[6];
|
||||||
/* TBEAM, HELTEC, etc...
|
/* TBEAM, HELTEC, etc...
|
||||||
@@ -574,12 +579,15 @@ typedef struct _meshtastic_MyNodeInfo {
|
|||||||
/* Tells the phone what our node number is, default starting value is
|
/* Tells the phone what our node number is, default starting value is
|
||||||
lowbyte of macaddr, but it will be fixed if that is already in use */
|
lowbyte of macaddr, but it will be fixed if that is already in use */
|
||||||
uint32_t my_node_num;
|
uint32_t my_node_num;
|
||||||
/* Note: This flag merely means we detected a hardware GPS in our node.
|
/* Deprecated in 2.1.x (Source from device_metadata)
|
||||||
|
Note: This flag merely means we detected a hardware GPS in our node.
|
||||||
Not the same as UserPreferences.location_sharing */
|
Not the same as UserPreferences.location_sharing */
|
||||||
bool has_gps;
|
bool has_gps;
|
||||||
/* The maximum number of 'software' channels that can be set on this node. */
|
/* Deprecated in 2.1.x
|
||||||
|
The maximum number of 'software' channels that can be set on this node. */
|
||||||
uint32_t max_channels;
|
uint32_t max_channels;
|
||||||
/* 0.0.5 etc... */
|
/* Deprecated in 2.1.x (Source from device_metadata)
|
||||||
|
0.0.5 etc... */
|
||||||
char firmware_version[18];
|
char firmware_version[18];
|
||||||
/* An error message we'd like to report back to the mothership through analytics.
|
/* An error message we'd like to report back to the mothership through analytics.
|
||||||
It indicates a serious bug occurred on the device, the device coped with it,
|
It indicates a serious bug occurred on the device, the device coped with it,
|
||||||
@@ -596,9 +604,11 @@ typedef struct _meshtastic_MyNodeInfo {
|
|||||||
/* The total number of reboots this node has ever encountered
|
/* The total number of reboots this node has ever encountered
|
||||||
(well - since the last time we discarded preferences) */
|
(well - since the last time we discarded preferences) */
|
||||||
uint32_t reboot_count;
|
uint32_t reboot_count;
|
||||||
/* Calculated bitrate of the current channel (in Bytes Per Second) */
|
/* Deprecated in 2.1.x
|
||||||
|
Calculated bitrate of the current channel (in Bytes Per Second) */
|
||||||
float bitrate;
|
float bitrate;
|
||||||
/* How long before we consider a message abandoned and we can clear our
|
/* Deprecated in 2.1.x
|
||||||
|
How long before we consider a message abandoned and we can clear our
|
||||||
caches of any messages in flight Normally quite large to handle the worst case
|
caches of any messages in flight Normally quite large to handle the worst case
|
||||||
message delivery time, 5 minutes.
|
message delivery time, 5 minutes.
|
||||||
Formerly called FLOOD_EXPIRE_TIME in the device code */
|
Formerly called FLOOD_EXPIRE_TIME in the device code */
|
||||||
@@ -606,17 +616,22 @@ typedef struct _meshtastic_MyNodeInfo {
|
|||||||
/* The minimum app version that can talk to this device.
|
/* The minimum app version that can talk to this device.
|
||||||
Phone/PC apps should compare this to their build number and if too low tell the user they must update their app */
|
Phone/PC apps should compare this to their build number and if too low tell the user they must update their app */
|
||||||
uint32_t min_app_version;
|
uint32_t min_app_version;
|
||||||
/* 24 time windows of 1hr each with the airtime transmitted out of the device per hour. */
|
/* Deprecated in 2.1.x (Only used on device to keep track of utilization)
|
||||||
|
24 time windows of 1hr each with the airtime transmitted out of the device per hour. */
|
||||||
pb_size_t air_period_tx_count;
|
pb_size_t air_period_tx_count;
|
||||||
uint32_t air_period_tx[8];
|
uint32_t air_period_tx[8];
|
||||||
/* 24 time windows of 1hr each with the airtime of valid packets for your mesh. */
|
/* Deprecated in 2.1.x (Only used on device to keep track of utilization)
|
||||||
|
24 time windows of 1hr each with the airtime of valid packets for your mesh. */
|
||||||
pb_size_t air_period_rx_count;
|
pb_size_t air_period_rx_count;
|
||||||
uint32_t air_period_rx[8];
|
uint32_t air_period_rx[8];
|
||||||
/* Is the device wifi capable? */
|
/* Deprecated in 2.1.x (Source from DeviceMetadata instead)
|
||||||
|
Is the device wifi capable? */
|
||||||
bool has_wifi;
|
bool has_wifi;
|
||||||
/* Utilization for the current channel, including well formed TX, RX and malformed RX (aka noise). */
|
/* Deprecated in 2.1.x (Source from DeviceMetrics telemetry payloads)
|
||||||
|
Utilization for the current channel, including well formed TX, RX and malformed RX (aka noise). */
|
||||||
float channel_utilization;
|
float channel_utilization;
|
||||||
/* Percent of airtime for transmission used within the last hour. */
|
/* Deprecated in 2.1.x (Source from DeviceMetrics telemetry payloads)
|
||||||
|
Percent of airtime for transmission used within the last hour. */
|
||||||
float air_util_tx;
|
float air_util_tx;
|
||||||
} meshtastic_MyNodeInfo;
|
} meshtastic_MyNodeInfo;
|
||||||
|
|
||||||
@@ -680,6 +695,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 */
|
||||||
@@ -700,6 +734,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.
|
||||||
@@ -813,6 +849,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
|
||||||
|
|
||||||
@@ -832,7 +870,9 @@ extern "C" {
|
|||||||
#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}}
|
||||||
@@ -847,7 +887,9 @@ extern "C" {
|
|||||||
#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
|
||||||
@@ -948,6 +990,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
|
||||||
@@ -957,6 +1004,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
|
||||||
@@ -1157,6 +1205,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) \
|
||||||
@@ -1166,7 +1228,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
|
||||||
|
|
||||||
@@ -1184,6 +1247,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 */
|
||||||
@@ -1201,16 +1266,20 @@ 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_NeighborInfo_size 142
|
||||||
|
#define meshtastic_Neighbor_size 11
|
||||||
#define meshtastic_NodeInfo_size 261
|
#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
|
||||||
|
|||||||
@@ -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 */
|
||||||
@@ -103,11 +114,14 @@ typedef struct _meshtastic_ModuleConfig_MQTTConfig {
|
|||||||
char root[16];
|
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 {
|
||||||
@@ -129,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 */
|
||||||
@@ -208,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;
|
||||||
@@ -262,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;
|
||||||
@@ -284,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;
|
||||||
|
|
||||||
@@ -293,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))
|
||||||
@@ -302,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
|
||||||
@@ -312,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
|
||||||
@@ -325,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, 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, 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
|
||||||
@@ -357,7 +408,8 @@ extern "C" {
|
|||||||
#define meshtastic_ModuleConfig_MQTTConfig_json_enabled_tag 6
|
#define meshtastic_ModuleConfig_MQTTConfig_json_enabled_tag 6
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_tls_enabled_tag 7
|
#define meshtastic_ModuleConfig_MQTTConfig_tls_enabled_tag 7
|
||||||
#define meshtastic_ModuleConfig_MQTTConfig_root_tag 8
|
#define meshtastic_ModuleConfig_MQTTConfig_root_tag 8
|
||||||
#define meshtastic_ModuleConfig_RemoteHardwareConfig_enabled_tag 1
|
#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
|
||||||
@@ -372,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
|
||||||
@@ -412,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
|
||||||
@@ -421,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) \
|
||||||
@@ -432,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
|
||||||
@@ -444,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) \
|
||||||
@@ -458,9 +520,18 @@ X(a, STATIC, SINGULAR, STRING, root, 8)
|
|||||||
#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) \
|
||||||
@@ -480,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
|
||||||
|
|
||||||
@@ -544,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;
|
||||||
@@ -554,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
|
||||||
@@ -566,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 220
|
#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 223
|
#define meshtastic_ModuleConfig_size 223
|
||||||
|
#define meshtastic_RemoteHardwarePin_size 21
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|||||||
@@ -77,14 +77,16 @@ typedef enum _meshtastic_PortNum {
|
|||||||
Maintained by Github user a-f-G-U-C (a Meshtastic contributor)
|
Maintained by Github user a-f-G-U-C (a Meshtastic contributor)
|
||||||
Project files at https://github.com/a-f-G-U-C/Meshtastic-ZPS */
|
Project files at https://github.com/a-f-G-U-C/Meshtastic-ZPS */
|
||||||
meshtastic_PortNum_ZPS_APP = 68,
|
meshtastic_PortNum_ZPS_APP = 68,
|
||||||
/* Used to let multiple instances of Linux native applications communicate
|
/* Used to let multiple instances of Linux native applications communicate
|
||||||
as if they did using their LoRa chip.
|
as if they did using their LoRa chip.
|
||||||
Maintained by GitHub user GUVWAF.
|
Maintained by GitHub user GUVWAF.
|
||||||
Project files at https://github.com/GUVWAF/Meshtasticator */
|
Project files at https://github.com/GUVWAF/Meshtasticator */
|
||||||
meshtastic_PortNum_SIMULATOR_APP = 69,
|
meshtastic_PortNum_SIMULATOR_APP = 69,
|
||||||
/* Provides a traceroute functionality to show the route a packet towards
|
/* Provides a traceroute functionality to show the route a packet towards
|
||||||
a certain destination would take on the mesh. */
|
a certain destination would take on the mesh. */
|
||||||
meshtastic_PortNum_TRACEROUTE_APP = 70,
|
meshtastic_PortNum_TRACEROUTE_APP = 70,
|
||||||
|
/* Aggregates edge info for the network by sending out a list of each node's neighbors */
|
||||||
|
meshtastic_PortNum_NEIGHBORINFO_APP = 71,
|
||||||
/* Private applications should use portnums >= 256.
|
/* Private applications should use portnums >= 256.
|
||||||
To simplify initial development and testing you can use "PRIVATE_APP"
|
To simplify initial development and testing you can use "PRIVATE_APP"
|
||||||
in your code without needing to rebuild protobuf files (via [regen-protos.sh](https://github.com/meshtastic/firmware/blob/master/bin/regen-protos.sh)) */
|
in your code without needing to rebuild protobuf files (via [regen-protos.sh](https://github.com/meshtastic/firmware/blob/master/bin/regen-protos.sh)) */
|
||||||
|
|||||||
@@ -234,15 +234,18 @@ void htmlDeleteDir(const char *dirname)
|
|||||||
while (file) {
|
while (file) {
|
||||||
if (file.isDirectory() && !String(file.name()).endsWith(".")) {
|
if (file.isDirectory() && !String(file.name()).endsWith(".")) {
|
||||||
htmlDeleteDir(file.name());
|
htmlDeleteDir(file.name());
|
||||||
|
file.flush();
|
||||||
file.close();
|
file.close();
|
||||||
} else {
|
} else {
|
||||||
String fileName = String(file.name());
|
String fileName = String(file.name());
|
||||||
|
file.flush();
|
||||||
file.close();
|
file.close();
|
||||||
LOG_DEBUG(" %s\n", fileName.c_str());
|
LOG_DEBUG(" %s\n", fileName.c_str());
|
||||||
FSCom.remove(fileName);
|
FSCom.remove(fileName);
|
||||||
}
|
}
|
||||||
file = root.openNextFile();
|
file = root.openNextFile();
|
||||||
}
|
}
|
||||||
|
root.flush();
|
||||||
root.close();
|
root.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -521,7 +524,7 @@ void handleFormUpload(HTTPRequest *req, HTTPResponse *res)
|
|||||||
std::string pathname = "/static/" + filename;
|
std::string pathname = "/static/" + filename;
|
||||||
|
|
||||||
// Create a new file to stream the data into
|
// Create a new file to stream the data into
|
||||||
File file = FSCom.open(pathname.c_str(), "w");
|
File file = FSCom.open(pathname.c_str(), FILE_O_WRITE);
|
||||||
size_t fileLength = 0;
|
size_t fileLength = 0;
|
||||||
didwrite = true;
|
didwrite = true;
|
||||||
|
|
||||||
@@ -536,6 +539,7 @@ void handleFormUpload(HTTPRequest *req, HTTPResponse *res)
|
|||||||
|
|
||||||
// Abort the transfer if there is less than 50k space left on the filesystem.
|
// Abort the transfer if there is less than 50k space left on the filesystem.
|
||||||
if (FSCom.totalBytes() - FSCom.usedBytes() < 51200) {
|
if (FSCom.totalBytes() - FSCom.usedBytes() < 51200) {
|
||||||
|
file.flush();
|
||||||
file.close();
|
file.close();
|
||||||
res->println("<p>Write aborted! Reserving 50k on filesystem.</p>");
|
res->println("<p>Write aborted! Reserving 50k on filesystem.</p>");
|
||||||
|
|
||||||
@@ -553,6 +557,7 @@ void handleFormUpload(HTTPRequest *req, HTTPResponse *res)
|
|||||||
}
|
}
|
||||||
// enableLoopWDT();
|
// enableLoopWDT();
|
||||||
|
|
||||||
|
file.flush();
|
||||||
file.close();
|
file.close();
|
||||||
res->printf("<p>Saved %d bytes to %s</p>", (int)fileLength, pathname.c_str());
|
res->printf("<p>Saved %d bytes to %s</p>", (int)fileLength, pathname.c_str());
|
||||||
}
|
}
|
||||||
@@ -622,10 +627,10 @@ void handleReport(HTTPRequest *req, HTTPResponse *res)
|
|||||||
|
|
||||||
// data->memory
|
// data->memory
|
||||||
JSONObject jsonObjMemory;
|
JSONObject jsonObjMemory;
|
||||||
jsonObjMemory["heap_total"] = new JSONValue((int)ESP.getHeapSize());
|
jsonObjMemory["heap_total"] = new JSONValue((int)memGet.getHeapSize());
|
||||||
jsonObjMemory["heap_free"] = new JSONValue((int)ESP.getFreeHeap());
|
jsonObjMemory["heap_free"] = new JSONValue((int)memGet.getFreeHeap());
|
||||||
jsonObjMemory["psram_total"] = new JSONValue((int)ESP.getPsramSize());
|
jsonObjMemory["psram_total"] = new JSONValue((int)memGet.getPsramSize());
|
||||||
jsonObjMemory["psram_free"] = new JSONValue((int)ESP.getFreePsram());
|
jsonObjMemory["psram_free"] = new JSONValue((int)memGet.getFreePsram());
|
||||||
jsonObjMemory["fs_total"] = new JSONValue((int)FSCom.totalBytes());
|
jsonObjMemory["fs_total"] = new JSONValue((int)FSCom.totalBytes());
|
||||||
jsonObjMemory["fs_used"] = new JSONValue((int)FSCom.usedBytes());
|
jsonObjMemory["fs_used"] = new JSONValue((int)FSCom.usedBytes());
|
||||||
jsonObjMemory["fs_free"] = new JSONValue(int(FSCom.totalBytes() - FSCom.usedBytes()));
|
jsonObjMemory["fs_free"] = new JSONValue(int(FSCom.totalBytes() - FSCom.usedBytes()));
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ static void writeSecret(char *buf, size_t bufsz, const char *currentVal)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Handle recieved protobuf message
|
* @brief Handle received protobuf message
|
||||||
*
|
*
|
||||||
* @param mp Recieved MeshPacket
|
* @param mp Received MeshPacket
|
||||||
* @param r Decoded AdminMessage
|
* @param r Decoded AdminMessage
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
@@ -50,6 +50,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||||||
// if handled == false, then let others look at this message also if they want
|
// if handled == false, then let others look at this message also if they want
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
assert(r);
|
assert(r);
|
||||||
|
bool fromOthers = mp.from != 0 && mp.from != nodeDB.getNodeNum();
|
||||||
|
|
||||||
switch (r->which_payload_variant) {
|
switch (r->which_payload_variant) {
|
||||||
|
|
||||||
@@ -175,6 +176,14 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||||||
handleGetDeviceConnectionStatus(mp);
|
handleGetDeviceConnectionStatus(mp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case meshtastic_AdminMessage_get_module_config_response_tag: {
|
||||||
|
LOG_INFO("Client is receiving a get_module_config response.\n");
|
||||||
|
if (fromOthers && r->get_module_config_response.which_payload_variant ==
|
||||||
|
meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG) {
|
||||||
|
handleGetModuleConfigResponse(mp, r);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
#ifdef ARCH_PORTDUINO
|
#ifdef ARCH_PORTDUINO
|
||||||
case meshtastic_AdminMessage_exit_simulator_tag:
|
case meshtastic_AdminMessage_exit_simulator_tag:
|
||||||
LOG_INFO("Exiting simulator\n");
|
LOG_INFO("Exiting simulator\n");
|
||||||
@@ -205,6 +214,29 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AdminModule::handleGetModuleConfigResponse(const meshtastic_MeshPacket &mp, meshtastic_AdminMessage *r)
|
||||||
|
{
|
||||||
|
// Skip if it's disabled or no pins are exposed
|
||||||
|
if (!r->get_module_config_response.payload_variant.remote_hardware.enabled ||
|
||||||
|
!r->get_module_config_response.payload_variant.remote_hardware.available_pins) {
|
||||||
|
LOG_DEBUG("Remote hardware module disabled or no vailable_pins. Skipping...\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (uint8_t i = 0; i < devicestate.node_remote_hardware_pins_count; i++) {
|
||||||
|
if (devicestate.node_remote_hardware_pins[i].node_num == 0 || !devicestate.node_remote_hardware_pins[i].has_pin) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (uint8_t j = 0; j < sizeof(r->get_module_config_response.payload_variant.remote_hardware.available_pins); j++) {
|
||||||
|
auto availablePin = r->get_module_config_response.payload_variant.remote_hardware.available_pins[j];
|
||||||
|
if (i < devicestate.node_remote_hardware_pins_count) {
|
||||||
|
devicestate.node_remote_hardware_pins[i].node_num = mp.from;
|
||||||
|
devicestate.node_remote_hardware_pins[i].pin = availablePin;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter methods
|
* Setter methods
|
||||||
*/
|
*/
|
||||||
@@ -487,6 +519,28 @@ void AdminModule::handleGetModuleConfig(const meshtastic_MeshPacket &req, const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AdminModule::handleGetNodeRemoteHardwarePins(const meshtastic_MeshPacket &req)
|
||||||
|
{
|
||||||
|
meshtastic_AdminMessage r = meshtastic_AdminMessage_init_default;
|
||||||
|
r.which_payload_variant = meshtastic_AdminMessage_get_node_remote_hardware_pins_response_tag;
|
||||||
|
for (uint8_t i = 0; i < devicestate.node_remote_hardware_pins_count; i++) {
|
||||||
|
if (devicestate.node_remote_hardware_pins[i].node_num == 0 || !devicestate.node_remote_hardware_pins[i].has_pin) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
r.get_node_remote_hardware_pins_response.node_remote_hardware_pins[i] = devicestate.node_remote_hardware_pins[i];
|
||||||
|
}
|
||||||
|
for (uint8_t i = 0; i < moduleConfig.remote_hardware.available_pins_count; i++) {
|
||||||
|
if (!moduleConfig.remote_hardware.available_pins[i].gpio_pin) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
meshtastic_NodeRemoteHardwarePin nodePin = meshtastic_NodeRemoteHardwarePin_init_default;
|
||||||
|
nodePin.node_num = nodeDB.getNodeNum();
|
||||||
|
nodePin.pin = moduleConfig.remote_hardware.available_pins[i];
|
||||||
|
r.get_node_remote_hardware_pins_response.node_remote_hardware_pins[i + 12] = nodePin;
|
||||||
|
}
|
||||||
|
myReply = allocDataProtobuf(r);
|
||||||
|
}
|
||||||
|
|
||||||
void AdminModule::handleGetDeviceMetadata(const meshtastic_MeshPacket &req)
|
void AdminModule::handleGetDeviceMetadata(const meshtastic_MeshPacket &req)
|
||||||
{
|
{
|
||||||
meshtastic_AdminMessage r = meshtastic_AdminMessage_init_default;
|
meshtastic_AdminMessage r = meshtastic_AdminMessage_init_default;
|
||||||
@@ -499,9 +553,8 @@ void AdminModule::handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &r
|
|||||||
{
|
{
|
||||||
meshtastic_AdminMessage r = meshtastic_AdminMessage_init_default;
|
meshtastic_AdminMessage r = meshtastic_AdminMessage_init_default;
|
||||||
|
|
||||||
meshtastic_DeviceConnectionStatus conn;
|
meshtastic_DeviceConnectionStatus conn = meshtastic_DeviceConnectionStatus_init_zero;
|
||||||
|
|
||||||
conn.wifi = {0};
|
|
||||||
#if HAS_WIFI
|
#if HAS_WIFI
|
||||||
conn.has_wifi = true;
|
conn.has_wifi = true;
|
||||||
conn.wifi.has_status = true;
|
conn.wifi.has_status = true;
|
||||||
@@ -517,11 +570,8 @@ void AdminModule::handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &r
|
|||||||
conn.wifi.status.is_mqtt_connected = mqtt && mqtt->connected();
|
conn.wifi.status.is_mqtt_connected = mqtt && mqtt->connected();
|
||||||
conn.wifi.status.is_syslog_connected = false; // FIXME wire this up
|
conn.wifi.status.is_syslog_connected = false; // FIXME wire this up
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
conn.has_wifi = false;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
conn.ethernet = {0};
|
|
||||||
#if HAS_ETHERNET
|
#if HAS_ETHERNET
|
||||||
conn.has_ethernet = true;
|
conn.has_ethernet = true;
|
||||||
conn.ethernet.has_status = true;
|
conn.ethernet.has_status = true;
|
||||||
@@ -533,8 +583,6 @@ void AdminModule::handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &r
|
|||||||
} else {
|
} else {
|
||||||
conn.ethernet.status.is_connected = false;
|
conn.ethernet.status.is_connected = false;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
conn.has_ethernet = false;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_BLUETOOTH
|
#if HAS_BLUETOOTH
|
||||||
|
|||||||
@@ -26,15 +26,18 @@ class AdminModule : public ProtobufModule<meshtastic_AdminMessage>
|
|||||||
bool hasOpenEditTransaction = false;
|
bool hasOpenEditTransaction = false;
|
||||||
|
|
||||||
void saveChanges(int saveWhat, bool shouldReboot = true);
|
void saveChanges(int saveWhat, bool shouldReboot = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getters
|
* Getters
|
||||||
*/
|
*/
|
||||||
|
void handleGetModuleConfigResponse(const meshtastic_MeshPacket &req, meshtastic_AdminMessage *p);
|
||||||
void handleGetOwner(const meshtastic_MeshPacket &req);
|
void handleGetOwner(const meshtastic_MeshPacket &req);
|
||||||
void handleGetConfig(const meshtastic_MeshPacket &req, uint32_t configType);
|
void handleGetConfig(const meshtastic_MeshPacket &req, uint32_t configType);
|
||||||
void handleGetModuleConfig(const meshtastic_MeshPacket &req, uint32_t configType);
|
void handleGetModuleConfig(const meshtastic_MeshPacket &req, uint32_t configType);
|
||||||
void handleGetChannel(const meshtastic_MeshPacket &req, uint32_t channelIndex);
|
void handleGetChannel(const meshtastic_MeshPacket &req, uint32_t channelIndex);
|
||||||
void handleGetDeviceMetadata(const meshtastic_MeshPacket &req);
|
void handleGetDeviceMetadata(const meshtastic_MeshPacket &req);
|
||||||
void handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &req);
|
void handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &req);
|
||||||
|
void handleGetNodeRemoteHardwarePins(const meshtastic_MeshPacket &req);
|
||||||
/**
|
/**
|
||||||
* Setters
|
* Setters
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -305,13 +305,14 @@ int32_t CannedMessageModule::runOnce()
|
|||||||
switch (this->payload) {
|
switch (this->payload) {
|
||||||
case 0xb4: // left
|
case 0xb4: // left
|
||||||
if (this->destSelect) {
|
if (this->destSelect) {
|
||||||
size_t numNodes = nodeDB.getNumNodes();
|
size_t numMeshNodes = nodeDB.getNumMeshNodes();
|
||||||
if (this->dest == NODENUM_BROADCAST) {
|
if (this->dest == NODENUM_BROADCAST) {
|
||||||
this->dest = nodeDB.getNodeNum();
|
this->dest = nodeDB.getNodeNum();
|
||||||
}
|
}
|
||||||
for (unsigned int i = 0; i < numNodes; i++) {
|
for (unsigned int i = 0; i < numMeshNodes; i++) {
|
||||||
if (nodeDB.getNodeByIndex(i)->num == this->dest) {
|
if (nodeDB.getMeshNodeByIndex(i)->num == this->dest) {
|
||||||
this->dest = (i > 0) ? nodeDB.getNodeByIndex(i - 1)->num : nodeDB.getNodeByIndex(numNodes - 1)->num;
|
this->dest =
|
||||||
|
(i > 0) ? nodeDB.getMeshNodeByIndex(i - 1)->num : nodeDB.getMeshNodeByIndex(numMeshNodes - 1)->num;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -326,13 +327,14 @@ int32_t CannedMessageModule::runOnce()
|
|||||||
break;
|
break;
|
||||||
case 0xb7: // right
|
case 0xb7: // right
|
||||||
if (this->destSelect) {
|
if (this->destSelect) {
|
||||||
size_t numNodes = nodeDB.getNumNodes();
|
size_t numMeshNodes = nodeDB.getNumMeshNodes();
|
||||||
if (this->dest == NODENUM_BROADCAST) {
|
if (this->dest == NODENUM_BROADCAST) {
|
||||||
this->dest = nodeDB.getNodeNum();
|
this->dest = nodeDB.getNodeNum();
|
||||||
}
|
}
|
||||||
for (unsigned int i = 0; i < numNodes; i++) {
|
for (unsigned int i = 0; i < numMeshNodes; i++) {
|
||||||
if (nodeDB.getNodeByIndex(i)->num == this->dest) {
|
if (nodeDB.getMeshNodeByIndex(i)->num == this->dest) {
|
||||||
this->dest = (i < numNodes - 1) ? nodeDB.getNodeByIndex(i + 1)->num : nodeDB.getNodeByIndex(0)->num;
|
this->dest =
|
||||||
|
(i < numMeshNodes - 1) ? nodeDB.getMeshNodeByIndex(i + 1)->num : nodeDB.getMeshNodeByIndex(0)->num;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -409,7 +411,7 @@ const char *CannedMessageModule::getNodeName(NodeNum node)
|
|||||||
if (node == NODENUM_BROADCAST) {
|
if (node == NODENUM_BROADCAST) {
|
||||||
return "Broadcast";
|
return "Broadcast";
|
||||||
} else {
|
} else {
|
||||||
meshtastic_NodeInfo *info = nodeDB.getNode(node);
|
meshtastic_NodeInfoLite *info = nodeDB.getMeshNode(node);
|
||||||
if (info != NULL) {
|
if (info != NULL) {
|
||||||
return info->user.long_name;
|
return info->user.long_name;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -8,6 +8,17 @@
|
|||||||
#include "mesh/generated/meshtastic/rtttl.pb.h"
|
#include "mesh/generated/meshtastic/rtttl.pb.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
#ifdef RAK4630
|
||||||
|
#include <NCP5623.h>
|
||||||
|
NCP5623 rgb;
|
||||||
|
|
||||||
|
uint8_t red = 0;
|
||||||
|
uint8_t green = 0;
|
||||||
|
uint8_t blue = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef PIN_BUZZER
|
#ifndef PIN_BUZZER
|
||||||
#define PIN_BUZZER false
|
#define PIN_BUZZER false
|
||||||
#endif
|
#endif
|
||||||
@@ -73,6 +84,15 @@ int32_t ExternalNotificationModule::runOnce()
|
|||||||
millis()) {
|
millis()) {
|
||||||
getExternal(2) ? setExternalOff(2) : setExternalOn(2);
|
getExternal(2) ? setExternalOff(2) : setExternalOn(2);
|
||||||
}
|
}
|
||||||
|
#ifdef RAK4630
|
||||||
|
if (rgb_found.type == ScanI2C::NCP5623) {
|
||||||
|
green = (green + 50) % 255;
|
||||||
|
red = abs(red - green) % 255;
|
||||||
|
blue = abs(blue / red) % 255;
|
||||||
|
|
||||||
|
rgb.setColor(red, green, blue);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// now let the PWM buzzer play
|
// now let the PWM buzzer play
|
||||||
@@ -84,6 +104,7 @@ int32_t ExternalNotificationModule::runOnce()
|
|||||||
rtttl::begin(config.device.buzzer_gpio, rtttlConfig.ringtone);
|
rtttl::begin(config.device.buzzer_gpio, rtttlConfig.ringtone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 25;
|
return 25;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -106,6 +127,11 @@ void ExternalNotificationModule::setExternalOn(uint8_t index)
|
|||||||
digitalWrite(output, (moduleConfig.external_notification.active ? true : false));
|
digitalWrite(output, (moduleConfig.external_notification.active ? true : false));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef RAK4630
|
||||||
|
if (rgb_found.type == ScanI2C::NCP5623) {
|
||||||
|
rgb.setColor(red, green, blue);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExternalNotificationModule::setExternalOff(uint8_t index)
|
void ExternalNotificationModule::setExternalOff(uint8_t index)
|
||||||
@@ -126,6 +152,15 @@ void ExternalNotificationModule::setExternalOff(uint8_t index)
|
|||||||
digitalWrite(output, (moduleConfig.external_notification.active ? false : true));
|
digitalWrite(output, (moduleConfig.external_notification.active ? false : true));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef RAK4630
|
||||||
|
if (rgb_found.type == ScanI2C::NCP5623) {
|
||||||
|
red = 0;
|
||||||
|
green = 0;
|
||||||
|
blue = 0;
|
||||||
|
rgb.setColor(red, green, blue);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExternalNotificationModule::getExternal(uint8_t index)
|
bool ExternalNotificationModule::getExternal(uint8_t index)
|
||||||
@@ -200,6 +235,12 @@ ExternalNotificationModule::ExternalNotificationModule()
|
|||||||
LOG_INFO("Using Pin %i in PWM mode\n", config.device.buzzer_gpio);
|
LOG_INFO("Using Pin %i in PWM mode\n", config.device.buzzer_gpio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef RAK4630
|
||||||
|
if (rgb_found.type == ScanI2C::NCP5623) {
|
||||||
|
rgb.begin();
|
||||||
|
rgb.setCurrent(10);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
LOG_INFO("External Notification Module Disabled\n");
|
LOG_INFO("External Notification Module Disabled\n");
|
||||||
disable();
|
disable();
|
||||||
@@ -300,7 +341,6 @@ ProcessMessage ExternalNotificationModule::handleReceived(const meshtastic_MeshP
|
|||||||
nagCycleCutoff = millis() + moduleConfig.external_notification.output_ms;
|
nagCycleCutoff = millis() + moduleConfig.external_notification.output_ms;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setIntervalFromNow(0); // run once so we know if we should do something
|
setIntervalFromNow(0); // run once so we know if we should do something
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "SinglePortModule.h"
|
#include "SinglePortModule.h"
|
||||||
#include "concurrency/OSThread.h"
|
#include "concurrency/OSThread.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#ifndef ARCH_PORTDUINO
|
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
|
||||||
#include <NonBlockingRtttl.h>
|
#include <NonBlockingRtttl.h>
|
||||||
#else
|
#else
|
||||||
// Noop class for portduino.
|
// Noop class for portduino.
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user