mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-08 02:47:35 +00:00
Compare commits
103 Commits
v1.3.29.7a
...
v1.3.36.dd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd720f2fe6 | ||
|
|
808fef7e91 | ||
|
|
70e6dc3c67 | ||
|
|
279149e40f | ||
|
|
4588995fba | ||
|
|
11ae248c5e | ||
|
|
a0a5147c42 | ||
|
|
b8aac2c5b6 | ||
|
|
de22f20876 | ||
|
|
9b5211dc65 | ||
|
|
0b4fb72d58 | ||
|
|
7e03019cc4 | ||
|
|
780f4383f4 | ||
|
|
8148f06773 | ||
|
|
d5780af362 | ||
|
|
82ed7a2084 | ||
|
|
dd5fd3744d | ||
|
|
afb5fca6e1 | ||
|
|
95d75fdfee | ||
|
|
029a6b16ba | ||
|
|
9be3099ca6 | ||
|
|
b6126e6e63 | ||
|
|
d6dfdc314e | ||
|
|
78666e9b36 | ||
|
|
3abba0ce39 | ||
|
|
2c8e030b3d | ||
|
|
eed7408f00 | ||
|
|
cabd1eb8c0 | ||
|
|
f46c11a047 | ||
|
|
cdd5e16e25 | ||
|
|
a6c9a819f8 | ||
|
|
2e72397898 | ||
|
|
f554226226 | ||
|
|
2d1897a36f | ||
|
|
fe1ed3f284 | ||
|
|
3251cd510a | ||
|
|
7d0411cd15 | ||
|
|
1d1ccd6b19 | ||
|
|
3b8566747c | ||
|
|
3cc584d855 | ||
|
|
90d3cc2ff8 | ||
|
|
d125b0ec3c | ||
|
|
5e842dd735 | ||
|
|
bbc0baa31d | ||
|
|
31788feab1 | ||
|
|
2c37be58ac | ||
|
|
836782b3c1 | ||
|
|
cfc44cd608 | ||
|
|
519f31ed60 | ||
|
|
e04d6b3f56 | ||
|
|
25c851a929 | ||
|
|
0c8fb6e27f | ||
|
|
8490bdd14e | ||
|
|
22a5cf04d3 | ||
|
|
ddc5a59ece | ||
|
|
6382f67b89 | ||
|
|
401b5d92aa | ||
|
|
572f9f9295 | ||
|
|
96ce40040c | ||
|
|
d0a1aad7d1 | ||
|
|
ab0095cb05 | ||
|
|
591ae7a803 | ||
|
|
de47cc55a0 | ||
|
|
7e6c22f542 | ||
|
|
2fac581fa3 | ||
|
|
1155727a45 | ||
|
|
1c8e64319c | ||
|
|
ca1e687fd4 | ||
|
|
4c215530f6 | ||
|
|
472fb6e5b0 | ||
|
|
00846439d0 | ||
|
|
a10e56265b | ||
|
|
9fe2ddb082 | ||
|
|
a9ad314307 | ||
|
|
688ac3f8ee | ||
|
|
e79ef0dd35 | ||
|
|
9bc2b4d8d7 | ||
|
|
720cd62943 | ||
|
|
4073ba7572 | ||
|
|
39aa7f9880 | ||
|
|
71a9f46451 | ||
|
|
18d5712ecd | ||
|
|
295dca8415 | ||
|
|
7b438cd16b | ||
|
|
d285a2e70a | ||
|
|
2ad9e238e2 | ||
|
|
2d2f306982 | ||
|
|
1f8878bd89 | ||
|
|
b39b58c87b | ||
|
|
5e2acc43f5 | ||
|
|
25a229ce85 | ||
|
|
edd6f049cf | ||
|
|
69ac8c0353 | ||
|
|
a41735544b | ||
|
|
dcc6a4b5e7 | ||
|
|
c292e539d4 | ||
|
|
4daf2cc3fa | ||
|
|
9c21064634 | ||
|
|
20d7d1b162 | ||
|
|
97a2bf6221 | ||
|
|
7485c312dd | ||
|
|
6ff5ada7d6 | ||
|
|
cf331dc58b |
145
.github/workflows/main_matrix.yml
vendored
145
.github/workflows/main_matrix.yml
vendored
@@ -6,7 +6,6 @@ on:
|
|||||||
paths-ignore:
|
paths-ignore:
|
||||||
- "**.md"
|
- "**.md"
|
||||||
- "**.yml"
|
- "**.yml"
|
||||||
- "version.properties"
|
|
||||||
|
|
||||||
# Note: This is different from "pull_request". Need to specify ref when doing checkouts.
|
# Note: This is different from "pull_request". Need to specify ref when doing checkouts.
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
@@ -41,6 +40,7 @@ jobs:
|
|||||||
- board: station-g1
|
- board: station-g1
|
||||||
- board: m5stack-core
|
- board: m5stack-core
|
||||||
- board: m5stack-coreink
|
- board: m5stack-coreink
|
||||||
|
# - board: pico
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -125,7 +125,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install -U platformio adafruit-nrfutil littlefs-python
|
pip install -U platformio adafruit-nrfutil littlefs-python
|
||||||
pip install -U --pre meshtastic
|
|
||||||
|
|
||||||
- name: Upgrade platformio
|
- name: Upgrade platformio
|
||||||
run: |
|
run: |
|
||||||
@@ -196,7 +195,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install -U platformio adafruit-nrfutil
|
pip install -U platformio adafruit-nrfutil
|
||||||
pip install -U --pre meshtastic
|
|
||||||
|
|
||||||
- name: Upgrade platformio
|
- name: Upgrade platformio
|
||||||
run: |
|
run: |
|
||||||
@@ -218,6 +216,60 @@ jobs:
|
|||||||
release/*.elf
|
release/*.elf
|
||||||
retention-days: 90
|
retention-days: 90
|
||||||
|
|
||||||
|
build-rpi2040:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
max-parallel: 2
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- board: pico
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: "recursive"
|
||||||
|
ref: ${{github.event.pull_request.head.ref}}
|
||||||
|
repository: ${{github.event.pull_request.head.repo.full_name}}
|
||||||
|
|
||||||
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
|
||||||
|
- name: Cache python libs
|
||||||
|
uses: actions/cache@v1
|
||||||
|
id: cache-pip # needed in if test
|
||||||
|
with:
|
||||||
|
path: ~/.cache/pip
|
||||||
|
key: ${{ runner.os }}-pip
|
||||||
|
|
||||||
|
- name: Upgrade python tools
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install -U platformio adafruit-nrfutil
|
||||||
|
|
||||||
|
- name: Upgrade platformio
|
||||||
|
run: |
|
||||||
|
pio upgrade
|
||||||
|
|
||||||
|
- name: Build Raspberry Pi 2040
|
||||||
|
run: ./bin/build-rpi2040.sh ${{ matrix.board }}
|
||||||
|
|
||||||
|
- name: Get release version string
|
||||||
|
run: echo "::set-output name=version::$(./bin/buildinfo.py long)"
|
||||||
|
id: version
|
||||||
|
|
||||||
|
- name: Store binaries as an artifact
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: firmware-${{ matrix.board }}-${{ steps.version.outputs.version }}.zip
|
||||||
|
path: |
|
||||||
|
release/*.uf2
|
||||||
|
release/*.elf
|
||||||
|
retention-days: 90
|
||||||
|
|
||||||
build-native:
|
build-native:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -289,7 +341,7 @@ jobs:
|
|||||||
|
|
||||||
gather-artifacts:
|
gather-artifacts:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build-esp32, build-nrf52, build-native]
|
needs: [build-esp32, build-nrf52, build-native, build-rpi2040]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -350,3 +402,88 @@ jobs:
|
|||||||
artifacts-branch: device
|
artifacts-branch: device
|
||||||
artifacts-dir: pr
|
artifacts-dir: pr
|
||||||
artifacts: ./firmware-${{ steps.version.outputs.version }}.zip
|
artifacts: ./firmware-${{ steps.version.outputs.version }}.zip
|
||||||
|
|
||||||
|
release-artifacts:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||||
|
needs: [gather-artifacts, after-checks]
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
|
||||||
|
- name: Get release version string
|
||||||
|
run: echo "::set-output name=version::$(./bin/buildinfo.py long)"
|
||||||
|
id: version
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: firmware-${{ steps.version.outputs.version }}
|
||||||
|
path: ./output
|
||||||
|
|
||||||
|
- name: Zip firmware
|
||||||
|
run: zip -j -r ./firmware-${{ steps.version.outputs.version }}.zip ./output
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: debug-elfs-${{ steps.version.outputs.version }}.zip
|
||||||
|
path: ./elfs
|
||||||
|
|
||||||
|
- name: Zip Elfs
|
||||||
|
run: zip -j -r ./debug-elfs-${{ steps.version.outputs.version }}.zip ./elfs
|
||||||
|
|
||||||
|
# For diagnostics
|
||||||
|
- name: Show artifacts
|
||||||
|
run: ls -lR
|
||||||
|
|
||||||
|
- name: Create release
|
||||||
|
uses: actions/create-release@v1
|
||||||
|
id: create_release
|
||||||
|
with:
|
||||||
|
draft: true
|
||||||
|
prerelease: true
|
||||||
|
release_name: Meshtastic Device ${{ steps.version.outputs.version }} alpha - Public Preview
|
||||||
|
tag_name: v${{ steps.version.outputs.version }}
|
||||||
|
body: |
|
||||||
|
Autogenerated by github action, developer should edit as required before publishing...
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
|
||||||
|
- name: Add bins to release
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ./firmware-${{ steps.version.outputs.version }}.zip
|
||||||
|
asset_name: firmware-${{ steps.version.outputs.version }}.zip
|
||||||
|
asset_content_type: application/zip
|
||||||
|
|
||||||
|
- name: Add debug elfs to release
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ./debug-elfs-${{ steps.version.outputs.version }}.zip
|
||||||
|
asset_name: debug-elfs-${{ steps.version.outputs.version }}.zip
|
||||||
|
asset_content_type: application/zip
|
||||||
|
|
||||||
|
- name: Bump version
|
||||||
|
run: >-
|
||||||
|
bin/bump_version.py
|
||||||
|
|
||||||
|
- name: Commit updated version.py
|
||||||
|
id: commit_updated
|
||||||
|
run: |
|
||||||
|
git config --global user.name 'github-actions'
|
||||||
|
git config --global user.email 'bot@noreply.github.com'
|
||||||
|
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
|
||||||
|
git add version.properties
|
||||||
|
git commit -m "bump version" && git push || echo "No changes to commit"
|
||||||
|
git log -n 1 --pretty=format:"%H" | tail -n 1 | awk '{print "::set-output name=sha::"$0}'
|
||||||
|
|
||||||
|
|||||||
92
.github/workflows/release.yml
vendored
92
.github/workflows/release.yml
vendored
@@ -1,92 +0,0 @@
|
|||||||
name: Make Release
|
|
||||||
on:
|
|
||||||
# Can optionally take parameters from the github UI, more info here https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/#:~:text=You%20can%20now%20create%20workflows,the%20workflow%20is%20run%20on.
|
|
||||||
workflow_dispatch:
|
|
||||||
# inputs:
|
|
||||||
|
|
||||||
# Only want to run if version.properties is bumped in master
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
paths:
|
|
||||||
- "version.properties"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release-build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
submodules: "recursive"
|
|
||||||
|
|
||||||
- name: Setup Python
|
|
||||||
uses: actions/setup-python@v2
|
|
||||||
with:
|
|
||||||
python-version: 3.x
|
|
||||||
|
|
||||||
# Will be available in steps.version.outputs.version
|
|
||||||
- name: Get release version string
|
|
||||||
run: echo "::set-output name=version::$(./bin/buildinfo.py long)"
|
|
||||||
id: version
|
|
||||||
# Note: we don't use caches on release builds because we don't want to accidentally not have a virgin build machine
|
|
||||||
|
|
||||||
- name: Upgrade python tools
|
|
||||||
# We actually want to run this every time
|
|
||||||
# if: steps.cache-pip.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip install -U platformio meshtastic adafruit-nrfutil littlefs-python
|
|
||||||
|
|
||||||
- name: Upgrade platformio
|
|
||||||
run: |
|
|
||||||
pio upgrade
|
|
||||||
|
|
||||||
- name: Pull web ui
|
|
||||||
uses: dsaltares/fetch-gh-release-asset@master
|
|
||||||
with:
|
|
||||||
repo: "meshtastic/meshtastic-web"
|
|
||||||
file: "build.tar"
|
|
||||||
target: "build.tar"
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Unpack web ui
|
|
||||||
run: |
|
|
||||||
tar -xf build.tar -C data/static
|
|
||||||
rm build.tar
|
|
||||||
|
|
||||||
- name: Build everything
|
|
||||||
run: bin/build-all.sh
|
|
||||||
|
|
||||||
- name: Create release
|
|
||||||
uses: actions/create-release@v1
|
|
||||||
id: create_release
|
|
||||||
with:
|
|
||||||
draft: true
|
|
||||||
prerelease: true
|
|
||||||
release_name: ${{ steps.version.outputs.version }} alpha
|
|
||||||
tag_name: v${{ steps.version.outputs.version }}
|
|
||||||
body: |
|
|
||||||
Autogenerated by github action, developer should edit as required before publishing...
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
|
||||||
|
|
||||||
- name: Add bins to release
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: release/archive/firmware-${{ steps.version.outputs.version }}.zip
|
|
||||||
asset_name: firmware-${{ steps.version.outputs.version }}.zip
|
|
||||||
asset_content_type: application/zip
|
|
||||||
|
|
||||||
- name: Add debug elfs to release
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: release/archive/elfs-${{ steps.version.outputs.version }}.zip
|
|
||||||
asset_name: debug-elfs-${{ steps.version.outputs.version }}.zip
|
|
||||||
asset_content_type: application/zip
|
|
||||||
36
bin/build-rpi2040.sh
Executable file
36
bin/build-rpi2040.sh
Executable file
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
VERSION=`bin/buildinfo.py long`
|
||||||
|
SHORT_VERSION=`bin/buildinfo.py short`
|
||||||
|
|
||||||
|
OUTDIR=release/
|
||||||
|
|
||||||
|
rm -f $OUTDIR/firmware*
|
||||||
|
rm -r $OUTDIR/* || true
|
||||||
|
|
||||||
|
# Make sure our submodules are current
|
||||||
|
git submodule update
|
||||||
|
|
||||||
|
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
|
||||||
|
platformio lib update
|
||||||
|
|
||||||
|
echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS"
|
||||||
|
rm -f .pio/build/$1/firmware.*
|
||||||
|
|
||||||
|
# The shell vars the build tool expects to find
|
||||||
|
export APP_VERSION=$VERSION
|
||||||
|
|
||||||
|
basename=firmware-$1-$VERSION
|
||||||
|
|
||||||
|
pio run --environment $1 # -v
|
||||||
|
SRCELF=.pio/build/$1/firmware.elf
|
||||||
|
cp $SRCELF $OUTDIR/$basename.elf
|
||||||
|
|
||||||
|
echo "Copying uf2 file"
|
||||||
|
SRCBIN=.pio/build/$1/firmware.uf2
|
||||||
|
cp $SRCBIN $OUTDIR/$basename.uf2
|
||||||
|
|
||||||
|
cp bin/device-install.* $OUTDIR
|
||||||
|
cp bin/device-update.* $OUTDIR
|
||||||
16
bin/bump_version.py
Executable file
16
bin/bump_version.py
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
"""Bump the version number"""
|
||||||
|
|
||||||
|
lines = None
|
||||||
|
|
||||||
|
with open('version.properties', 'r', encoding='utf-8') as f:
|
||||||
|
lines = f.readlines()
|
||||||
|
|
||||||
|
with open('version.properties', 'w', encoding='utf-8') as f:
|
||||||
|
for line in lines:
|
||||||
|
if line.lstrip().startswith("build = "):
|
||||||
|
words = line.split(" = ")
|
||||||
|
ver = f'build = {int(words[1]) + 1}'
|
||||||
|
f.write(f'{ver}\n')
|
||||||
|
else:
|
||||||
|
f.write(line)
|
||||||
@@ -65,7 +65,7 @@ lib_deps =
|
|||||||
|
|
||||||
build_flags = ${env.build_flags} -Os
|
build_flags = ${env.build_flags} -Os
|
||||||
# -DRADIOLIB_GODMODE
|
# -DRADIOLIB_GODMODE
|
||||||
build_src_filter = ${env.build_src_filter} -<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]
|
||||||
@@ -92,7 +92,7 @@ lib_deps =
|
|||||||
extends = arduino_base
|
extends = arduino_base
|
||||||
platform = espressif32@3.5.0
|
platform = espressif32@3.5.0
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
${arduino_base.build_src_filter} -<nrf52/> -<stm32wl>
|
${arduino_base.build_src_filter} -<platform/nrf52/> -<platform/stm32wl> -<platform/rp2040>
|
||||||
upload_speed = 115200
|
upload_speed = 115200
|
||||||
debug_init_break = tbreak setup
|
debug_init_break = tbreak setup
|
||||||
|
|
||||||
@@ -101,15 +101,15 @@ debug_init_break = tbreak setup
|
|||||||
# This overrides the BLE logging default of LOG_LEVEL_INFO (1) from: .pio/libdeps/tbeam/NimBLE-Arduino/src/esp_nimble_cfg.h
|
# This overrides the BLE logging default of LOG_LEVEL_INFO (1) from: .pio/libdeps/tbeam/NimBLE-Arduino/src/esp_nimble_cfg.h
|
||||||
# -DUSE_NEW_ESP32_BLUETOOTH will enable the new NimBLE C++ api
|
# -DUSE_NEW_ESP32_BLUETOOTH will enable the new NimBLE C++ api
|
||||||
build_flags =
|
build_flags =
|
||||||
${arduino_base.build_flags} -Wall -Wextra -Isrc/esp32 -Isrc/esp32-mfix-esp32-psram-cache-issue -lnimble -std=c++11
|
${arduino_base.build_flags} -Wall -Wextra -Isrc/platform/esp32 -lnimble -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
|
-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 -DUSE_NEW_ESP32_BLUETOOTH
|
-DAXP_DEBUG_PORT=Serial -DUSE_NEW_ESP32_BLUETOOTH -DCONFIG_BT_NIMBLE_ENABLED -DCONFIG_NIMBLE_CPP_LOG_LEVEL=1
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${arduino_base.lib_deps}
|
${arduino_base.lib_deps}
|
||||||
${networking_base.lib_deps}
|
${networking_base.lib_deps}
|
||||||
${environmental_base.lib_deps}
|
${environmental_base.lib_deps}
|
||||||
https://github.com/meshtastic/esp32_https_server.git
|
https://github.com/meshtastic/esp32_https_server.git
|
||||||
h2zero/NimBLE-Arduino@1.3.7
|
h2zero/NimBLE-Arduino@1.4.0
|
||||||
arduino-libraries/NTPClient@^3.1.0
|
arduino-libraries/NTPClient@^3.1.0
|
||||||
lorol/LittleFS_esp32@^1.0.6
|
lorol/LittleFS_esp32@^1.0.6
|
||||||
https://github.com/meshtastic/AXP202X_Library.git#8404abb6d4b486748636bc6ad72d2a47baaf5460
|
https://github.com/meshtastic/AXP202X_Library.git#8404abb6d4b486748636bc6ad72d2a47baaf5460
|
||||||
@@ -142,9 +142,9 @@ build_type = debug ; I'm debugging with ICE a lot now
|
|||||||
; note: liboberon provides the AES256 implementation for NRF52 (though not using the hardware acceleration of the NRF52840 - FIXME)
|
; note: liboberon provides the AES256 implementation for NRF52 (though not using the hardware acceleration of the NRF52840 - FIXME)
|
||||||
build_flags =
|
build_flags =
|
||||||
${arduino_base.build_flags} -Wno-unused-variable
|
${arduino_base.build_flags} -Wno-unused-variable
|
||||||
-Isrc/nrf52
|
-Isrc/platform/nrf52
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
${arduino_base.build_src_filter} -<esp32/> -<stm32wl> -<nimble/> -<mesh/wifi/> -<mesh/http/> -<modules/esp32> -<mqtt/>
|
${arduino_base.build_src_filter} -<platform/esp32/> -<platform/stm32wl> -<nimble/> -<mesh/wifi/> -<mesh/http/> -<modules/esp32> -<mqtt/> -<platform/rp2040>
|
||||||
lib_ignore =
|
lib_ignore =
|
||||||
BluetoothOTA
|
BluetoothOTA
|
||||||
|
|
||||||
@@ -165,3 +165,23 @@ board = nrf52840_dk
|
|||||||
[env:feather_nrf52832]
|
[env:feather_nrf52832]
|
||||||
extends = nrf52_base
|
extends = nrf52_base
|
||||||
board = adafruit_feather_nrf52832
|
board = adafruit_feather_nrf52832
|
||||||
|
|
||||||
|
; Common settings for rp2040 Processor based targets
|
||||||
|
[rp2040_base]
|
||||||
|
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
|
||||||
|
extends = arduino_base
|
||||||
|
board_build.core = earlephilhower
|
||||||
|
board_build.filesystem_size = 0.5m
|
||||||
|
build_flags =
|
||||||
|
${arduino_base.build_flags} -Wno-unused-variable
|
||||||
|
-Isrc/platform/rp2040
|
||||||
|
-D__PLAT_RP2040__
|
||||||
|
# -D _POSIX_THREADS
|
||||||
|
build_src_filter =
|
||||||
|
${arduino_base.build_src_filter} -<platform/esp32/> -<nimble/> -<mesh/wifi/> -<mesh/http/> -<modules/esp32> -<mqtt/> -<platform/nrf52/> -<platform/stm32wl>
|
||||||
|
lib_ignore =
|
||||||
|
BluetoothOTA
|
||||||
|
lib_deps =
|
||||||
|
${arduino_base.lib_deps}
|
||||||
|
${environmental_base.lib_deps}
|
||||||
|
https://github.com/kokke/tiny-AES-c.git
|
||||||
Submodule protobufs updated: 59293c211a...c473ed7a6a
@@ -132,7 +132,7 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
#endif
|
#endif
|
||||||
// If user button is held down for 5 seconds, shutdown the device.
|
// If user button is held down for 5 seconds, shutdown the device.
|
||||||
if ((millis() - longPressTime > 5 * 1000) && (longPressTime > 0)) {
|
if ((millis() - longPressTime > 5 * 1000) && (longPressTime > 0)) {
|
||||||
#ifdef TBEAM_V10
|
#ifdef HAS_AXP192
|
||||||
if (axp192_found == true) {
|
if (axp192_found == true) {
|
||||||
setLed(false);
|
setLed(false);
|
||||||
power->shutdown();
|
power->shutdown();
|
||||||
@@ -144,8 +144,15 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
screen->startShutdownScreen();
|
screen->startShutdownScreen();
|
||||||
DEBUG_MSG("Shutdown from long press");
|
DEBUG_MSG("Shutdown from long press");
|
||||||
playBeep();
|
playBeep();
|
||||||
|
#ifdef PIN_LED1
|
||||||
ledOff(PIN_LED1);
|
ledOff(PIN_LED1);
|
||||||
|
#endif
|
||||||
|
#ifdef PIN_LED2
|
||||||
ledOff(PIN_LED2);
|
ledOff(PIN_LED2);
|
||||||
|
#endif
|
||||||
|
#ifdef PIN_LED3
|
||||||
|
ledOff(PIN_LED3);
|
||||||
|
#endif
|
||||||
shutdown_on_long_stop = true;
|
shutdown_on_long_stop = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,10 +1,50 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "FSCommon.h"
|
#include "FSCommon.h"
|
||||||
|
|
||||||
|
|
||||||
|
bool copyFile(const char* from, const char* to)
|
||||||
|
{
|
||||||
|
#ifdef FSCom
|
||||||
|
unsigned char cbuffer[16];
|
||||||
|
|
||||||
|
File f1 = FSCom.open(from, FILE_O_READ);
|
||||||
|
if (!f1){
|
||||||
|
DEBUG_MSG("Failed to open file");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
File f2 = FSCom.open(to, FILE_O_WRITE);
|
||||||
|
if (!f2) {
|
||||||
|
DEBUG_MSG("Failed to open file");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (f1.available() > 0) {
|
||||||
|
byte i = f1.read(cbuffer, 16);
|
||||||
|
f2.write(cbuffer, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
f2.close();
|
||||||
|
f1.close();
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool renameFile(const char* pathFrom, const char* pathTo)
|
||||||
|
{
|
||||||
|
#ifdef FSCom
|
||||||
|
if (copyFile(pathFrom, pathTo) && FSCom.remove(pathFrom) ) {
|
||||||
|
return true;
|
||||||
|
} else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void listDir(const char * dirname, uint8_t levels)
|
void listDir(const char * dirname, uint8_t levels)
|
||||||
{
|
{
|
||||||
#ifdef FSCom
|
#ifdef FSCom
|
||||||
File root = FSCom.open(dirname);
|
File root = FSCom.open(dirname, FILE_O_READ);
|
||||||
if(!root){
|
if(!root){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -31,7 +71,7 @@ void listDir(const char * dirname, uint8_t levels)
|
|||||||
void rmDir(const char * dirname)
|
void rmDir(const char * dirname)
|
||||||
{
|
{
|
||||||
#ifdef FSCom
|
#ifdef FSCom
|
||||||
File file = FSCom.open(dirname);
|
File file = FSCom.open(dirname, FILE_O_READ);
|
||||||
if(!file){
|
if(!file){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,15 @@
|
|||||||
#define FILE_O_READ "r"
|
#define FILE_O_READ "r"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(ARCH_RP2040)
|
||||||
|
// RP2040
|
||||||
|
#include "LittleFS.h"
|
||||||
|
#define FSCom LittleFS
|
||||||
|
#define FSBegin() FSCom.begin()
|
||||||
|
#define FILE_O_WRITE "w"
|
||||||
|
#define FILE_O_READ "r"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(ARCH_ESP32)
|
#if defined(ARCH_ESP32)
|
||||||
// ESP32 version
|
// ESP32 version
|
||||||
#include "LITTLEFS.h"
|
#include "LITTLEFS.h"
|
||||||
@@ -31,5 +40,6 @@ using namespace Adafruit_LittleFS_Namespace;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void fsInit();
|
void fsInit();
|
||||||
|
bool renameFile(const char* pathFrom, const char* pathTo);
|
||||||
void listDir(const char * dirname, uint8_t levels);
|
void listDir(const char * dirname, uint8_t levels);
|
||||||
void rmDir(const char * dirname);
|
void rmDir(const char * dirname);
|
||||||
|
|||||||
@@ -7,9 +7,7 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "buzz/buzz.h"
|
#include "buzz/buzz.h"
|
||||||
|
|
||||||
#ifdef TBEAM_V10
|
#ifdef HAS_AXP192
|
||||||
// FIXME. nasty hack cleanup how we load axp192
|
|
||||||
#undef AXP192_SLAVE_ADDRESS
|
|
||||||
#include "axp20x.h"
|
#include "axp20x.h"
|
||||||
|
|
||||||
AXP20X_Class axp;
|
AXP20X_Class axp;
|
||||||
@@ -158,8 +156,21 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
/// If we see a battery voltage higher than physics allows - assume charger is pumping
|
/// If we see a battery voltage higher than physics allows - assume charger is pumping
|
||||||
/// in power
|
/// in power
|
||||||
|
|
||||||
|
#ifndef BAT_FULLVOLT
|
||||||
|
#define BAT_FULLVOLT 4200
|
||||||
|
#endif
|
||||||
|
#ifndef BAT_EMPTYVOLT
|
||||||
|
#define BAT_EMPTYVOLT 3270
|
||||||
|
#endif
|
||||||
|
#ifndef BAT_CHARGINGVOLT
|
||||||
|
#define BAT_CHARGINGVOLT 4210
|
||||||
|
#endif
|
||||||
|
#ifndef BAT_NOBATVOLT
|
||||||
|
#define BAT_NOBATVOLT 2230
|
||||||
|
#endif
|
||||||
|
|
||||||
/// For heltecs with no battery connected, the measured voltage is 2204, so raising to 2230 from 2100
|
/// For heltecs with no battery connected, the measured voltage is 2204, so raising to 2230 from 2100
|
||||||
const float fullVolt = 4200, emptyVolt = 3270, chargingVolt = 4210, noBatVolt = 2230;
|
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;
|
||||||
};
|
};
|
||||||
@@ -221,7 +232,7 @@ bool Power::setup()
|
|||||||
|
|
||||||
void Power::shutdown()
|
void Power::shutdown()
|
||||||
{
|
{
|
||||||
#ifdef TBEAM_V10
|
#ifdef HAS_AXP192
|
||||||
DEBUG_MSG("Shutting down\n");
|
DEBUG_MSG("Shutting down\n");
|
||||||
axp.setChgLEDMode(AXP20X_LED_OFF);
|
axp.setChgLEDMode(AXP20X_LED_OFF);
|
||||||
axp.shutdown();
|
axp.shutdown();
|
||||||
@@ -293,7 +304,7 @@ int32_t Power::runOnce()
|
|||||||
{
|
{
|
||||||
readPowerStatus();
|
readPowerStatus();
|
||||||
|
|
||||||
#ifdef TBEAM_V10
|
#ifdef HAS_AXP192
|
||||||
// WE no longer use the IRQ line to wake the CPU (due to false wakes from sleep), but we do poll
|
// WE no longer use the IRQ line to wake the CPU (due to false wakes from sleep), but we do poll
|
||||||
// the IRQ status by reading the registers over I2C
|
// the IRQ status by reading the registers over I2C
|
||||||
axp.readIRQ();
|
axp.readIRQ();
|
||||||
@@ -343,7 +354,7 @@ int32_t Power::runOnce()
|
|||||||
*/
|
*/
|
||||||
bool Power::axp192Init()
|
bool Power::axp192Init()
|
||||||
{
|
{
|
||||||
#ifdef TBEAM_V10
|
#ifdef HAS_AXP192
|
||||||
if (axp192_found) {
|
if (axp192_found) {
|
||||||
if (!axp.begin(Wire, AXP192_SLAVE_ADDRESS)) {
|
if (!axp.begin(Wire, AXP192_SLAVE_ADDRESS)) {
|
||||||
batteryLevel = &axp;
|
batteryLevel = &axp;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
static bool isPowered()
|
static bool isPowered()
|
||||||
{
|
{
|
||||||
// Circumvent the battery sensing logic and assumes constant power if no battery pin or power mgmt IC
|
// Circumvent the battery sensing logic and assumes constant power if no battery pin or power mgmt IC
|
||||||
#if !defined(BATTERY_PIN) && !defined(AXP192_SLAVE_ADDRESS)
|
#if !defined(BATTERY_PIN) && !defined(HAS_AXP192)
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
// #define DISABLE_NTP
|
// #define DISABLE_NTP
|
||||||
|
|
||||||
// Disable the welcome screen and allow
|
// Disable the welcome screen and allow
|
||||||
#define DISABLE_WELCOME_UNSET
|
//#define DISABLE_WELCOME_UNSET
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// OLED & Input
|
// OLED & Input
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
// Placeholder FIXME
|
|
||||||
@@ -3,6 +3,10 @@
|
|||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include "mesh/generated/telemetry.pb.h"
|
#include "mesh/generated/telemetry.pb.h"
|
||||||
|
|
||||||
|
#ifdef HAS_AXP192
|
||||||
|
#include "axp20x.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HAS_WIRE
|
#if HAS_WIRE
|
||||||
uint16_t getRegisterValue(uint8_t address, uint8_t reg, uint8_t length) {
|
uint16_t getRegisterValue(uint8_t address, uint8_t reg, uint8_t length) {
|
||||||
uint16_t value = 0x00;
|
uint16_t value = 0x00;
|
||||||
@@ -110,7 +114,7 @@ void scanI2Cdevice(void)
|
|||||||
screen_found = addr;
|
screen_found = addr;
|
||||||
DEBUG_MSG("st7567 display found\n");
|
DEBUG_MSG("st7567 display found\n");
|
||||||
}
|
}
|
||||||
#ifdef AXP192_SLAVE_ADDRESS
|
#ifdef HAS_AXP192
|
||||||
if (addr == AXP192_SLAVE_ADDRESS) {
|
if (addr == AXP192_SLAVE_ADDRESS) {
|
||||||
axp192_found = true;
|
axp192_found = true;
|
||||||
DEBUG_MSG("axp192 PMU found\n");
|
DEBUG_MSG("axp192 PMU found\n");
|
||||||
@@ -64,7 +64,7 @@ namespace graphics
|
|||||||
static FrameCallback normalFrames[MAX_NUM_NODES + NUM_EXTRA_FRAMES];
|
static FrameCallback normalFrames[MAX_NUM_NODES + NUM_EXTRA_FRAMES];
|
||||||
static uint32_t targetFramerate = IDLE_FRAMERATE;
|
static uint32_t targetFramerate = IDLE_FRAMERATE;
|
||||||
static char btPIN[16] = "888888";
|
static char btPIN[16] = "888888";
|
||||||
|
|
||||||
// This image definition is here instead of images.h because it's modified dynamically by the drawBattery function
|
// This image definition is here instead of images.h because it's modified dynamically by the drawBattery function
|
||||||
uint8_t imgBattery[16] = {0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xE7, 0x3C};
|
uint8_t imgBattery[16] = {0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xE7, 0x3C};
|
||||||
|
|
||||||
@@ -595,7 +595,7 @@ class Point
|
|||||||
void rotate(float radian)
|
void rotate(float radian)
|
||||||
{
|
{
|
||||||
float cos = cosf(radian), sin = sinf(radian);
|
float cos = cosf(radian), sin = sinf(radian);
|
||||||
float rx = x * cos - y * sin, ry = x * sin + y * cos;
|
float rx = x * cos + y * sin, ry = -x * sin + y * cos;
|
||||||
|
|
||||||
x = rx;
|
x = rx;
|
||||||
y = ry;
|
y = ry;
|
||||||
@@ -609,8 +609,10 @@ class Point
|
|||||||
|
|
||||||
void scale(float f)
|
void scale(float f)
|
||||||
{
|
{
|
||||||
|
//We use -f here to counter the flip that happens
|
||||||
|
//on the y axis when drawing and rotating on screen
|
||||||
x *= f;
|
x *= f;
|
||||||
y *= f;
|
y *= -f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -682,16 +684,21 @@ static void drawNodeHeading(OLEDDisplay *display, int16_t compassX, int16_t comp
|
|||||||
drawLine(display, rightArrow, tip);
|
drawLine(display, rightArrow, tip);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the compass heading
|
// Draw north
|
||||||
static void drawCompassHeading(OLEDDisplay *display, int16_t compassX, int16_t compassY, float myHeading)
|
static void drawCompassNorth(OLEDDisplay *display, int16_t compassX, int16_t compassY, float myHeading)
|
||||||
{
|
{
|
||||||
Point N1(-0.04f, -0.65f), N2(0.04f, -0.65f);
|
//If north is supposed to be at the top of the compass we want rotation to be +0
|
||||||
Point N3(-0.04f, -0.55f), N4(0.04f, -0.55f);
|
if(config.display.compass_north_top)
|
||||||
|
myHeading = -0;
|
||||||
|
|
||||||
|
Point N1(-0.04f, 0.65f), N2(0.04f, 0.65f);
|
||||||
|
Point N3(-0.04f, 0.55f), N4(0.04f, 0.55f);
|
||||||
Point *rosePoints[] = {&N1, &N2, &N3, &N4};
|
Point *rosePoints[] = {&N1, &N2, &N3, &N4};
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
rosePoints[i]->rotate(myHeading);
|
// North on compass will be negative of heading
|
||||||
rosePoints[i]->scale(-1 * COMPASS_DIAM);
|
rosePoints[i]->rotate(-myHeading);
|
||||||
|
rosePoints[i]->scale(COMPASS_DIAM);
|
||||||
rosePoints[i]->translate(compassX, compassY);
|
rosePoints[i]->translate(compassX, compassY);
|
||||||
}
|
}
|
||||||
drawLine(display, N1, N3);
|
drawLine(display, N1, N3);
|
||||||
@@ -762,7 +769,7 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
|
|||||||
if (ourNode && hasPosition(ourNode)) {
|
if (ourNode && hasPosition(ourNode)) {
|
||||||
Position &op = ourNode->position;
|
Position &op = ourNode->position;
|
||||||
float myHeading = estimatedHeading(DegD(op.latitude_i), DegD(op.longitude_i));
|
float myHeading = estimatedHeading(DegD(op.latitude_i), DegD(op.longitude_i));
|
||||||
drawCompassHeading(display, compassX, compassY, myHeading);
|
drawCompassNorth(display, compassX, compassY, myHeading);
|
||||||
|
|
||||||
if (hasPosition(node)) {
|
if (hasPosition(node)) {
|
||||||
// display direction toward node
|
// display direction toward node
|
||||||
@@ -775,12 +782,13 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
|
|||||||
else
|
else
|
||||||
snprintf(distStr, sizeof(distStr), "%.1f km", d / 1000);
|
snprintf(distStr, sizeof(distStr), "%.1f km", d / 1000);
|
||||||
|
|
||||||
// FIXME, also keep the guess at the operators heading and add/substract
|
|
||||||
// it. currently we don't do this and instead draw north up only.
|
|
||||||
float bearingToOther =
|
float bearingToOther =
|
||||||
GeoCoord::bearing(DegD(p.latitude_i), DegD(p.longitude_i), DegD(op.latitude_i), DegD(op.longitude_i));
|
GeoCoord::bearing(DegD(op.latitude_i), DegD(op.longitude_i), DegD(p.latitude_i), DegD(p.longitude_i));
|
||||||
float headingRadian = bearingToOther - myHeading;
|
// If the top of the compass is a static north then bearingToOther can be drawn on the compass directly
|
||||||
drawNodeHeading(display, compassX, compassY, headingRadian);
|
// If the top of the compass is not a static north we need adjust bearingToOther based on heading
|
||||||
|
if(!config.display.compass_north_top)
|
||||||
|
bearingToOther -= myHeading;
|
||||||
|
drawNodeHeading(display, compassX, compassY, bearingToOther);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hasNodeHeading)
|
if (!hasNodeHeading)
|
||||||
@@ -935,9 +943,11 @@ void Screen::setup()
|
|||||||
handleSetOn(true);
|
handleSetOn(true);
|
||||||
|
|
||||||
// On some ssd1306 clones, the first draw command is discarded, so draw it
|
// On some ssd1306 clones, the first draw command is discarded, so draw it
|
||||||
// twice initially.
|
// twice initially. Skip this for EINK Displays to save a few seconds during boot
|
||||||
ui.update();
|
ui.update();
|
||||||
|
#ifndef USE_EINK
|
||||||
ui.update();
|
ui.update();
|
||||||
|
#endif
|
||||||
serialSinceMsec = millis();
|
serialSinceMsec = millis();
|
||||||
|
|
||||||
// Subscribe to status updates
|
// Subscribe to status updates
|
||||||
@@ -1355,7 +1365,7 @@ void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, i
|
|||||||
|
|
||||||
if (isSoftAPForced()) {
|
if (isSoftAPForced()) {
|
||||||
display->drawString(x, y, String("WiFi: Software AP (Admin)"));
|
display->drawString(x, y, String("WiFi: Software AP (Admin)"));
|
||||||
} else if (config.wifi.ap_mode) {
|
} else if (config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPoint || config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPointHidden) {
|
||||||
display->drawString(x, y, String("WiFi: Software AP"));
|
display->drawString(x, y, String("WiFi: Software AP"));
|
||||||
} else if (WiFi.status() != WL_CONNECTED) {
|
} else if (WiFi.status() != WL_CONNECTED) {
|
||||||
display->drawString(x, y, String("WiFi: Not Connected"));
|
display->drawString(x, y, String("WiFi: Not Connected"));
|
||||||
@@ -1378,8 +1388,8 @@ void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, i
|
|||||||
- WL_NO_SHIELD: assigned when no WiFi shield is present;
|
- WL_NO_SHIELD: assigned when no WiFi shield is present;
|
||||||
|
|
||||||
*/
|
*/
|
||||||
if (WiFi.status() == WL_CONNECTED || isSoftAPForced() || config.wifi.ap_mode) {
|
if (WiFi.status() == WL_CONNECTED || isSoftAPForced() || config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPoint || config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPointHidden) {
|
||||||
if (config.wifi.ap_mode || isSoftAPForced()) {
|
if (config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPoint || config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPointHidden || isSoftAPForced()) {
|
||||||
display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "IP: " + String(WiFi.softAPIP().toString().c_str()));
|
display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "IP: " + String(WiFi.softAPIP().toString().c_str()));
|
||||||
|
|
||||||
// Number of connections to the AP. Default max for the esp32 is 4
|
// Number of connections to the AP. Default max for the esp32 is 4
|
||||||
@@ -1471,7 +1481,7 @@ void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (config.wifi.ap_mode) {
|
if (config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPoint || config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPointHidden) {
|
||||||
if ((millis() / 10000) % 2) {
|
if ((millis() / 10000) % 2) {
|
||||||
display->drawString(x, y + FONT_HEIGHT_SMALL * 2, "SSID: " + String(wifiName));
|
display->drawString(x, y + FONT_HEIGHT_SMALL * 2, "SSID: " + String(wifiName));
|
||||||
} else {
|
} else {
|
||||||
@@ -1665,4 +1675,5 @@ int Screen::handleUIFrameEvent(const UIFrameEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace graphics
|
} // namespace graphics
|
||||||
#endif // HAS_SCREEN
|
|
||||||
|
#endif // HAS_SCREEN
|
||||||
|
|||||||
10
src/main.cpp
10
src/main.cpp
@@ -17,9 +17,9 @@
|
|||||||
#include "SPILock.h"
|
#include "SPILock.h"
|
||||||
#include "concurrency/OSThread.h"
|
#include "concurrency/OSThread.h"
|
||||||
#include "concurrency/Periodic.h"
|
#include "concurrency/Periodic.h"
|
||||||
#include "debug/axpDebug.h"
|
#include "detect/axpDebug.h"
|
||||||
#include "debug/einkScan.h"
|
#include "detect/einkScan.h"
|
||||||
#include "debug/i2cScan.h"
|
#include "detect/i2cScan.h"
|
||||||
#include "graphics/Screen.h"
|
#include "graphics/Screen.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "modules/Modules.h"
|
#include "modules/Modules.h"
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
#include "mesh/http/WebServer.h"
|
#include "mesh/http/WebServer.h"
|
||||||
|
|
||||||
#ifdef USE_NEW_ESP32_BLUETOOTH
|
#ifdef USE_NEW_ESP32_BLUETOOTH
|
||||||
#include "esp32/ESP32Bluetooth.h"
|
#include "platform/esp32/ESP32Bluetooth.h"
|
||||||
#else
|
#else
|
||||||
#include "nimble/BluetoothUtil.h"
|
#include "nimble/BluetoothUtil.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -307,7 +307,7 @@ void setup()
|
|||||||
setupModules();
|
setupModules();
|
||||||
|
|
||||||
// Do this after service.init (because that clears error_code)
|
// Do this after service.init (because that clears error_code)
|
||||||
#ifdef AXP192_SLAVE_ADDRESS
|
#ifdef HAS_AXP192
|
||||||
if (!axp192_found)
|
if (!axp192_found)
|
||||||
RECORD_CRITICALERROR(CriticalErrorCode_NoAXP192); // Record a hardware fault for missing hardware
|
RECORD_CRITICALERROR(CriticalErrorCode_NoAXP192); // Record a hardware fault for missing hardware
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ void MeshService::sendNetworkPing(NodeNum dest, bool wantReplies)
|
|||||||
NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
||||||
assert(node);
|
assert(node);
|
||||||
|
|
||||||
if (node->has_position) {
|
if (node->has_position && (node->position.latitude_i != 0 || node->position.longitude_i != 0)) {
|
||||||
if (positionModule) {
|
if (positionModule) {
|
||||||
DEBUG_MSG("Sending position ping to 0x%x, wantReplies=%d\n", dest, wantReplies);
|
DEBUG_MSG("Sending position ping to 0x%x, wantReplies=%d\n", dest, wantReplies);
|
||||||
positionModule->sendOurPosition(dest, wantReplies);
|
positionModule->sendOurPosition(dest, wantReplies);
|
||||||
|
|||||||
@@ -43,14 +43,6 @@ ChannelFile channelFile;
|
|||||||
*/
|
*/
|
||||||
uint32_t radioGeneration;
|
uint32_t radioGeneration;
|
||||||
|
|
||||||
/*
|
|
||||||
DeviceState versions used to be defined in the .proto file but really only this function cares. So changed to a
|
|
||||||
#define here.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define DEVICESTATE_CUR_VER 13
|
|
||||||
#define DEVICESTATE_MIN_VER DEVICESTATE_CUR_VER
|
|
||||||
|
|
||||||
// FIXME - move this somewhere else
|
// FIXME - move this somewhere else
|
||||||
extern void getMacAddr(uint8_t *dmac);
|
extern void getMacAddr(uint8_t *dmac);
|
||||||
|
|
||||||
@@ -305,7 +297,7 @@ bool loadProto(const char *filename, size_t protoSize, size_t objSize, const pb_
|
|||||||
#ifdef FSCom
|
#ifdef FSCom
|
||||||
// static DeviceState scratch; We no longer read into a tempbuf because this structure is 15KB of valuable RAM
|
// static DeviceState scratch; We no longer read into a tempbuf because this structure is 15KB of valuable RAM
|
||||||
|
|
||||||
auto f = FSCom.open(filename);
|
auto f = FSCom.open(filename, FILE_O_READ);
|
||||||
|
|
||||||
if (f) {
|
if (f) {
|
||||||
DEBUG_MSG("Loading %s\n", filename);
|
DEBUG_MSG("Loading %s\n", filename);
|
||||||
@@ -414,7 +406,7 @@ bool saveProto(const char *filename, size_t protoSize, size_t objSize, const pb_
|
|||||||
// brief window of risk here ;-)
|
// brief window of risk here ;-)
|
||||||
if (FSCom.exists(filename) && !FSCom.remove(filename))
|
if (FSCom.exists(filename) && !FSCom.remove(filename))
|
||||||
DEBUG_MSG("Warning: Can't remove old pref file\n");
|
DEBUG_MSG("Warning: Can't remove old pref file\n");
|
||||||
if (!FSCom.rename(filenameTmp.c_str(), filename))
|
if (!renameFile(filenameTmp.c_str(), filename))
|
||||||
DEBUG_MSG("Error: can't rename new pref file\n");
|
DEBUG_MSG("Error: can't rename new pref file\n");
|
||||||
} else {
|
} else {
|
||||||
DEBUG_MSG("Can't write prefs\n");
|
DEBUG_MSG("Can't write prefs\n");
|
||||||
|
|||||||
@@ -8,6 +8,14 @@
|
|||||||
#include "NodeStatus.h"
|
#include "NodeStatus.h"
|
||||||
#include "mesh-pb-constants.h"
|
#include "mesh-pb-constants.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
DeviceState versions used to be defined in the .proto file but really only this function cares. So changed to a
|
||||||
|
#define here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define DEVICESTATE_CUR_VER 14
|
||||||
|
#define DEVICESTATE_MIN_VER DEVICESTATE_CUR_VER
|
||||||
|
|
||||||
extern DeviceState devicestate;
|
extern DeviceState devicestate;
|
||||||
extern ChannelFile channelFile;
|
extern ChannelFile channelFile;
|
||||||
extern MyNodeInfo &myNodeInfo;
|
extern MyNodeInfo &myNodeInfo;
|
||||||
|
|||||||
@@ -79,20 +79,17 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
|
|||||||
memset(&toRadioScratch, 0, sizeof(toRadioScratch));
|
memset(&toRadioScratch, 0, sizeof(toRadioScratch));
|
||||||
if (pb_decode_from_bytes(buf, bufLength, ToRadio_fields, &toRadioScratch)) {
|
if (pb_decode_from_bytes(buf, bufLength, ToRadio_fields, &toRadioScratch)) {
|
||||||
switch (toRadioScratch.which_payloadVariant) {
|
switch (toRadioScratch.which_payloadVariant) {
|
||||||
case ToRadio_packet_tag:
|
case ToRadio_packet_tag:
|
||||||
return handleToRadioPacket(toRadioScratch.packet);
|
return handleToRadioPacket(toRadioScratch.packet);
|
||||||
|
case ToRadio_want_config_id_tag:
|
||||||
case ToRadio_want_config_id_tag:
|
config_nonce = toRadioScratch.want_config_id;
|
||||||
config_nonce = toRadioScratch.want_config_id;
|
DEBUG_MSG("Client wants config, nonce=%u\n", config_nonce);
|
||||||
DEBUG_MSG("Client wants config, nonce=%u\n", config_nonce);
|
|
||||||
|
|
||||||
handleStartConfig();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ToRadio_disconnect_tag:
|
|
||||||
close();
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
handleStartConfig();
|
||||||
|
break;
|
||||||
|
case ToRadio_disconnect_tag:
|
||||||
|
close();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// Ignore nop messages
|
// Ignore nop messages
|
||||||
// DEBUG_MSG("Error: unexpected ToRadio variant\n");
|
// DEBUG_MSG("Error: unexpected ToRadio variant\n");
|
||||||
@@ -112,9 +109,8 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
|
|||||||
*
|
*
|
||||||
* Our sending states progress in the following sequence (the client app ASSUMES THIS SEQUENCE, DO NOT CHANGE IT):
|
* Our sending states progress in the following sequence (the client app ASSUMES THIS SEQUENCE, DO NOT CHANGE IT):
|
||||||
* STATE_SEND_MY_INFO, // send our my info record
|
* STATE_SEND_MY_INFO, // send our my info record
|
||||||
* STATE_SEND_GROUPS
|
* STATE_SEND_NODEINFO, // states progress in this order as the device sends to the client
|
||||||
STATE_SEND_CONFIG,
|
STATE_SEND_CONFIG,
|
||||||
STATE_SEND_NODEINFO, // states progress in this order as the device sends to to the client
|
|
||||||
STATE_SEND_COMPLETE_ID,
|
STATE_SEND_COMPLETE_ID,
|
||||||
STATE_SEND_PACKETS // send packets or debug strings
|
STATE_SEND_PACKETS // send packets or debug strings
|
||||||
*/
|
*/
|
||||||
@@ -141,11 +137,30 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||||||
myNodeInfo.has_gps = gps && gps->isConnected(); // Update with latest GPS connect info
|
myNodeInfo.has_gps = gps && gps->isConnected(); // Update with latest GPS connect info
|
||||||
fromRadioScratch.which_payloadVariant = FromRadio_my_info_tag;
|
fromRadioScratch.which_payloadVariant = FromRadio_my_info_tag;
|
||||||
fromRadioScratch.my_info = myNodeInfo;
|
fromRadioScratch.my_info = myNodeInfo;
|
||||||
state = STATE_SEND_CONFIG;
|
state = STATE_SEND_NODEINFO;
|
||||||
|
|
||||||
service.refreshMyNodeInfo(); // Update my NodeInfo because the client will be asking for it soon.
|
service.refreshMyNodeInfo(); // Update my NodeInfo because the client will be asking for it soon.
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case STATE_SEND_NODEINFO: {
|
||||||
|
const NodeInfo *info = nodeInfoForPhone;
|
||||||
|
nodeInfoForPhone = NULL; // We just consumed a nodeinfo, will need a new one next time
|
||||||
|
|
||||||
|
if (info) {
|
||||||
|
DEBUG_MSG("Sending nodeinfo: num=0x%x, lastseen=%u, id=%s, name=%s\n", info->num, info->last_heard, info->user.id,
|
||||||
|
info->user.long_name);
|
||||||
|
fromRadioScratch.which_payloadVariant = FromRadio_node_info_tag;
|
||||||
|
fromRadioScratch.node_info = *info;
|
||||||
|
// Stay in current state until done sending nodeinfos
|
||||||
|
} else {
|
||||||
|
DEBUG_MSG("Done sending nodeinfos\n");
|
||||||
|
state = STATE_SEND_CONFIG;
|
||||||
|
// Go ahead and send that ID right now
|
||||||
|
return getFromRadio(buf);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case STATE_SEND_CONFIG:
|
case STATE_SEND_CONFIG:
|
||||||
fromRadioScratch.which_payloadVariant = FromRadio_config_tag;
|
fromRadioScratch.which_payloadVariant = FromRadio_config_tag;
|
||||||
switch (config_state) {
|
switch (config_state) {
|
||||||
@@ -220,28 +235,10 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||||||
config_state++;
|
config_state++;
|
||||||
// Advance when we have sent all of our ModuleConfig objects
|
// Advance when we have sent all of our ModuleConfig objects
|
||||||
if (config_state > ModuleConfig_canned_message_tag) {
|
if (config_state > ModuleConfig_canned_message_tag) {
|
||||||
state = STATE_SEND_NODEINFO;
|
state = STATE_SEND_COMPLETE_ID;
|
||||||
config_state = Config_device_tag;
|
config_state = Config_device_tag;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case STATE_SEND_NODEINFO: {
|
|
||||||
const NodeInfo *info = nodeInfoForPhone;
|
|
||||||
nodeInfoForPhone = NULL; // We just consumed a nodeinfo, will need a new one next time
|
|
||||||
|
|
||||||
if (info) {
|
|
||||||
DEBUG_MSG("Sending nodeinfo: num=0x%x, lastseen=%u, id=%s, name=%s\n", info->num, info->last_heard, info->user.id,
|
|
||||||
info->user.long_name);
|
|
||||||
fromRadioScratch.which_payloadVariant = FromRadio_node_info_tag;
|
|
||||||
fromRadioScratch.node_info = *info;
|
|
||||||
// Stay in current state until done sending nodeinfos
|
|
||||||
} else {
|
|
||||||
DEBUG_MSG("Done sending nodeinfos\n");
|
|
||||||
state = STATE_SEND_COMPLETE_ID;
|
|
||||||
// Go ahead and send that ID right now
|
|
||||||
return getFromRadio(buf);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case STATE_SEND_COMPLETE_ID:
|
case STATE_SEND_COMPLETE_ID:
|
||||||
fromRadioScratch.which_payloadVariant = FromRadio_config_complete_id_tag;
|
fromRadioScratch.which_payloadVariant = FromRadio_config_complete_id_tag;
|
||||||
|
|||||||
@@ -22,10 +22,9 @@ class PhoneAPI
|
|||||||
enum State {
|
enum State {
|
||||||
STATE_SEND_NOTHING, // Initial state, don't send anything until the client starts asking for config
|
STATE_SEND_NOTHING, // Initial state, don't send anything until the client starts asking for config
|
||||||
STATE_SEND_MY_INFO, // send our my info record
|
STATE_SEND_MY_INFO, // send our my info record
|
||||||
STATE_SEND_GROUPS, // new in 1.3?
|
STATE_SEND_NODEINFO, // states progress in this order as the device sends to to the client
|
||||||
STATE_SEND_CONFIG, // Replacement for the old Radioconfig
|
STATE_SEND_CONFIG, // Replacement for the old Radioconfig
|
||||||
STATE_SEND_MODULECONFIG, // Send Module specific config
|
STATE_SEND_MODULECONFIG, // Send Module specific config
|
||||||
STATE_SEND_NODEINFO, // states progress in this order as the device sends to to the client
|
|
||||||
STATE_SEND_COMPLETE_ID,
|
STATE_SEND_COMPLETE_ID,
|
||||||
STATE_SEND_PACKETS // send packets or debug strings
|
STATE_SEND_PACKETS // send packets or debug strings
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
#include "channel.pb.h"
|
#include "channel.pb.h"
|
||||||
#include "config.pb.h"
|
#include "config.pb.h"
|
||||||
|
#include "device_metadata.pb.h"
|
||||||
#include "mesh.pb.h"
|
#include "mesh.pb.h"
|
||||||
#include "module_config.pb.h"
|
#include "module_config.pb.h"
|
||||||
|
|
||||||
@@ -73,6 +74,8 @@ typedef struct _AdminMessage {
|
|||||||
ModuleConfig set_module_config;
|
ModuleConfig set_module_config;
|
||||||
/* Sent immediatly after a config change has been sent to ensure comms, if this is not recieved, the config will be reverted after 10 mins */
|
/* Sent immediatly after a config change has been sent to ensure comms, if this is not recieved, the config will be reverted after 10 mins */
|
||||||
bool confirm_set_module_config;
|
bool confirm_set_module_config;
|
||||||
|
/* Send all channels in the response to this message */
|
||||||
|
bool get_all_channel_request;
|
||||||
/* Setting channels/radio config remotely carries the risk that you might send an invalid config and the radio never talks to your mesh again.
|
/* Setting channels/radio config remotely carries the risk that you might send an invalid config and the radio never talks to your mesh again.
|
||||||
Therefore if setting either of these properties remotely, you must send a confirm_xxx message within 10 minutes.
|
Therefore if setting either of these properties remotely, you must send a confirm_xxx message within 10 minutes.
|
||||||
If you fail to do so, the radio will assume loss of comms and revert your changes.
|
If you fail to do so, the radio will assume loss of comms and revert your changes.
|
||||||
@@ -111,6 +114,10 @@ typedef struct _AdminMessage {
|
|||||||
char set_canned_message_module_part4[201];
|
char set_canned_message_module_part4[201];
|
||||||
/* Tell the node to shutdown in this many seconds (or <0 to cancel shutdown) */
|
/* Tell the node to shutdown in this many seconds (or <0 to cancel shutdown) */
|
||||||
int32_t shutdown_seconds;
|
int32_t shutdown_seconds;
|
||||||
|
/* Request the node to send device metadata (firmware, protobuf version, etc) */
|
||||||
|
uint32_t get_device_metadata_request;
|
||||||
|
/* Device metadata response */
|
||||||
|
DeviceMetadata get_device_metadata_response;
|
||||||
};
|
};
|
||||||
} AdminMessage;
|
} AdminMessage;
|
||||||
|
|
||||||
@@ -148,6 +155,7 @@ extern "C" {
|
|||||||
#define AdminMessage_get_module_config_response_tag 15
|
#define AdminMessage_get_module_config_response_tag 15
|
||||||
#define AdminMessage_set_module_config_tag 16
|
#define AdminMessage_set_module_config_tag 16
|
||||||
#define AdminMessage_confirm_set_module_config_tag 17
|
#define AdminMessage_confirm_set_module_config_tag 17
|
||||||
|
#define AdminMessage_get_all_channel_request_tag 18
|
||||||
#define AdminMessage_confirm_set_channel_tag 32
|
#define AdminMessage_confirm_set_channel_tag 32
|
||||||
#define AdminMessage_confirm_set_radio_tag 33
|
#define AdminMessage_confirm_set_radio_tag 33
|
||||||
#define AdminMessage_exit_simulator_tag 34
|
#define AdminMessage_exit_simulator_tag 34
|
||||||
@@ -165,6 +173,8 @@ extern "C" {
|
|||||||
#define AdminMessage_set_canned_message_module_part3_tag 46
|
#define AdminMessage_set_canned_message_module_part3_tag 46
|
||||||
#define AdminMessage_set_canned_message_module_part4_tag 47
|
#define AdminMessage_set_canned_message_module_part4_tag 47
|
||||||
#define AdminMessage_shutdown_seconds_tag 51
|
#define AdminMessage_shutdown_seconds_tag 51
|
||||||
|
#define AdminMessage_get_device_metadata_request_tag 52
|
||||||
|
#define AdminMessage_get_device_metadata_response_tag 53
|
||||||
|
|
||||||
/* Struct field encoding specification for nanopb */
|
/* Struct field encoding specification for nanopb */
|
||||||
#define AdminMessage_FIELDLIST(X, a) \
|
#define AdminMessage_FIELDLIST(X, a) \
|
||||||
@@ -182,6 +192,7 @@ X(a, STATIC, ONEOF, UENUM, (variant,get_module_config_request,get_module
|
|||||||
X(a, STATIC, ONEOF, MESSAGE, (variant,get_module_config_response,get_module_config_response), 15) \
|
X(a, STATIC, ONEOF, MESSAGE, (variant,get_module_config_response,get_module_config_response), 15) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (variant,set_module_config,set_module_config), 16) \
|
X(a, STATIC, ONEOF, MESSAGE, (variant,set_module_config,set_module_config), 16) \
|
||||||
X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_module_config,confirm_set_module_config), 17) \
|
X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_module_config,confirm_set_module_config), 17) \
|
||||||
|
X(a, STATIC, ONEOF, BOOL, (variant,get_all_channel_request,get_all_channel_request), 18) \
|
||||||
X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_channel,confirm_set_channel), 32) \
|
X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_channel,confirm_set_channel), 32) \
|
||||||
X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_radio,confirm_set_radio), 33) \
|
X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_radio,confirm_set_radio), 33) \
|
||||||
X(a, STATIC, ONEOF, BOOL, (variant,exit_simulator,exit_simulator), 34) \
|
X(a, STATIC, ONEOF, BOOL, (variant,exit_simulator,exit_simulator), 34) \
|
||||||
@@ -198,7 +209,9 @@ X(a, STATIC, ONEOF, STRING, (variant,set_canned_message_module_part1,set_
|
|||||||
X(a, STATIC, ONEOF, STRING, (variant,set_canned_message_module_part2,set_canned_message_module_part2), 45) \
|
X(a, STATIC, ONEOF, STRING, (variant,set_canned_message_module_part2,set_canned_message_module_part2), 45) \
|
||||||
X(a, STATIC, ONEOF, STRING, (variant,set_canned_message_module_part3,set_canned_message_module_part3), 46) \
|
X(a, STATIC, ONEOF, STRING, (variant,set_canned_message_module_part3,set_canned_message_module_part3), 46) \
|
||||||
X(a, STATIC, ONEOF, STRING, (variant,set_canned_message_module_part4,set_canned_message_module_part4), 47) \
|
X(a, STATIC, ONEOF, STRING, (variant,set_canned_message_module_part4,set_canned_message_module_part4), 47) \
|
||||||
X(a, STATIC, ONEOF, INT32, (variant,shutdown_seconds,shutdown_seconds), 51)
|
X(a, STATIC, ONEOF, INT32, (variant,shutdown_seconds,shutdown_seconds), 51) \
|
||||||
|
X(a, STATIC, ONEOF, UINT32, (variant,get_device_metadata_request,get_device_metadata_request), 52) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (variant,get_device_metadata_response,get_device_metadata_response), 53)
|
||||||
#define AdminMessage_CALLBACK NULL
|
#define AdminMessage_CALLBACK NULL
|
||||||
#define AdminMessage_DEFAULT NULL
|
#define AdminMessage_DEFAULT NULL
|
||||||
#define AdminMessage_variant_set_owner_MSGTYPE User
|
#define AdminMessage_variant_set_owner_MSGTYPE User
|
||||||
@@ -209,6 +222,7 @@ X(a, STATIC, ONEOF, INT32, (variant,shutdown_seconds,shutdown_seconds),
|
|||||||
#define AdminMessage_variant_set_config_MSGTYPE Config
|
#define AdminMessage_variant_set_config_MSGTYPE Config
|
||||||
#define AdminMessage_variant_get_module_config_response_MSGTYPE ModuleConfig
|
#define AdminMessage_variant_get_module_config_response_MSGTYPE ModuleConfig
|
||||||
#define AdminMessage_variant_set_module_config_MSGTYPE ModuleConfig
|
#define AdminMessage_variant_set_module_config_MSGTYPE ModuleConfig
|
||||||
|
#define AdminMessage_variant_get_device_metadata_response_MSGTYPE DeviceMetadata
|
||||||
|
|
||||||
extern const pb_msgdesc_t AdminMessage_msg;
|
extern const pb_msgdesc_t AdminMessage_msg;
|
||||||
|
|
||||||
|
|||||||
@@ -34,3 +34,4 @@ PB_BIND(Config_LoRaConfig, Config_LoRaConfig, 2)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,12 @@ typedef enum _Config_PowerConfig_ChargeCurrent {
|
|||||||
Config_PowerConfig_ChargeCurrent_MA1320 = 16
|
Config_PowerConfig_ChargeCurrent_MA1320 = 16
|
||||||
} Config_PowerConfig_ChargeCurrent;
|
} Config_PowerConfig_ChargeCurrent;
|
||||||
|
|
||||||
|
typedef enum _Config_WiFiConfig_WiFiMode {
|
||||||
|
Config_WiFiConfig_WiFiMode_Client = 0,
|
||||||
|
Config_WiFiConfig_WiFiMode_AccessPoint = 1,
|
||||||
|
Config_WiFiConfig_WiFiMode_AccessPointHidden = 2
|
||||||
|
} Config_WiFiConfig_WiFiMode;
|
||||||
|
|
||||||
typedef enum _Config_DisplayConfig_GpsCoordinateFormat {
|
typedef enum _Config_DisplayConfig_GpsCoordinateFormat {
|
||||||
Config_DisplayConfig_GpsCoordinateFormat_GpsFormatDec = 0,
|
Config_DisplayConfig_GpsCoordinateFormat_GpsFormatDec = 0,
|
||||||
Config_DisplayConfig_GpsCoordinateFormat_GpsFormatDMS = 1,
|
Config_DisplayConfig_GpsCoordinateFormat_GpsFormatDMS = 1,
|
||||||
@@ -99,6 +105,7 @@ typedef struct _Config_DisplayConfig {
|
|||||||
uint32_t screen_on_secs;
|
uint32_t screen_on_secs;
|
||||||
Config_DisplayConfig_GpsCoordinateFormat gps_format;
|
Config_DisplayConfig_GpsCoordinateFormat gps_format;
|
||||||
uint32_t auto_screen_carousel_secs;
|
uint32_t auto_screen_carousel_secs;
|
||||||
|
bool compass_north_top;
|
||||||
} Config_DisplayConfig;
|
} Config_DisplayConfig;
|
||||||
|
|
||||||
typedef struct _Config_LoRaConfig {
|
typedef struct _Config_LoRaConfig {
|
||||||
@@ -138,10 +145,10 @@ typedef struct _Config_PowerConfig {
|
|||||||
} Config_PowerConfig;
|
} Config_PowerConfig;
|
||||||
|
|
||||||
typedef struct _Config_WiFiConfig {
|
typedef struct _Config_WiFiConfig {
|
||||||
|
bool enabled;
|
||||||
|
Config_WiFiConfig_WiFiMode mode;
|
||||||
char ssid[33];
|
char ssid[33];
|
||||||
char psk[64];
|
char psk[64];
|
||||||
bool ap_mode;
|
|
||||||
bool ap_hidden;
|
|
||||||
} Config_WiFiConfig;
|
} Config_WiFiConfig;
|
||||||
|
|
||||||
typedef struct _Config {
|
typedef struct _Config {
|
||||||
@@ -170,6 +177,10 @@ typedef struct _Config {
|
|||||||
#define _Config_PowerConfig_ChargeCurrent_MAX Config_PowerConfig_ChargeCurrent_MA1320
|
#define _Config_PowerConfig_ChargeCurrent_MAX Config_PowerConfig_ChargeCurrent_MA1320
|
||||||
#define _Config_PowerConfig_ChargeCurrent_ARRAYSIZE ((Config_PowerConfig_ChargeCurrent)(Config_PowerConfig_ChargeCurrent_MA1320+1))
|
#define _Config_PowerConfig_ChargeCurrent_ARRAYSIZE ((Config_PowerConfig_ChargeCurrent)(Config_PowerConfig_ChargeCurrent_MA1320+1))
|
||||||
|
|
||||||
|
#define _Config_WiFiConfig_WiFiMode_MIN Config_WiFiConfig_WiFiMode_Client
|
||||||
|
#define _Config_WiFiConfig_WiFiMode_MAX Config_WiFiConfig_WiFiMode_AccessPointHidden
|
||||||
|
#define _Config_WiFiConfig_WiFiMode_ARRAYSIZE ((Config_WiFiConfig_WiFiMode)(Config_WiFiConfig_WiFiMode_AccessPointHidden+1))
|
||||||
|
|
||||||
#define _Config_DisplayConfig_GpsCoordinateFormat_MIN Config_DisplayConfig_GpsCoordinateFormat_GpsFormatDec
|
#define _Config_DisplayConfig_GpsCoordinateFormat_MIN Config_DisplayConfig_GpsCoordinateFormat_GpsFormatDec
|
||||||
#define _Config_DisplayConfig_GpsCoordinateFormat_MAX Config_DisplayConfig_GpsCoordinateFormat_GpsFormatOSGR
|
#define _Config_DisplayConfig_GpsCoordinateFormat_MAX Config_DisplayConfig_GpsCoordinateFormat_GpsFormatOSGR
|
||||||
#define _Config_DisplayConfig_GpsCoordinateFormat_ARRAYSIZE ((Config_DisplayConfig_GpsCoordinateFormat)(Config_DisplayConfig_GpsCoordinateFormat_GpsFormatOSGR+1))
|
#define _Config_DisplayConfig_GpsCoordinateFormat_ARRAYSIZE ((Config_DisplayConfig_GpsCoordinateFormat)(Config_DisplayConfig_GpsCoordinateFormat_GpsFormatOSGR+1))
|
||||||
@@ -192,15 +203,15 @@ extern "C" {
|
|||||||
#define Config_DeviceConfig_init_default {_Config_DeviceConfig_Role_MIN, 0, 0, 0, ""}
|
#define Config_DeviceConfig_init_default {_Config_DeviceConfig_Role_MIN, 0, 0, 0, ""}
|
||||||
#define Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0}
|
#define Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0}
|
||||||
#define Config_PowerConfig_init_default {_Config_PowerConfig_ChargeCurrent_MIN, 0, 0, 0, 0, 0, 0, 0, 0}
|
#define Config_PowerConfig_init_default {_Config_PowerConfig_ChargeCurrent_MIN, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define Config_WiFiConfig_init_default {"", "", 0, 0}
|
#define Config_WiFiConfig_init_default {0, _Config_WiFiConfig_WiFiMode_MIN, "", ""}
|
||||||
#define Config_DisplayConfig_init_default {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0}
|
#define Config_DisplayConfig_init_default {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0}
|
||||||
#define Config_LoRaConfig_init_default {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, {0, 0, 0}}
|
#define Config_LoRaConfig_init_default {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, {0, 0, 0}}
|
||||||
#define Config_init_zero {0, {Config_DeviceConfig_init_zero}}
|
#define Config_init_zero {0, {Config_DeviceConfig_init_zero}}
|
||||||
#define Config_DeviceConfig_init_zero {_Config_DeviceConfig_Role_MIN, 0, 0, 0, ""}
|
#define Config_DeviceConfig_init_zero {_Config_DeviceConfig_Role_MIN, 0, 0, 0, ""}
|
||||||
#define Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0}
|
#define Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0}
|
||||||
#define Config_PowerConfig_init_zero {_Config_PowerConfig_ChargeCurrent_MIN, 0, 0, 0, 0, 0, 0, 0, 0}
|
#define Config_PowerConfig_init_zero {_Config_PowerConfig_ChargeCurrent_MIN, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define Config_WiFiConfig_init_zero {"", "", 0, 0}
|
#define Config_WiFiConfig_init_zero {0, _Config_WiFiConfig_WiFiMode_MIN, "", ""}
|
||||||
#define Config_DisplayConfig_init_zero {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0}
|
#define Config_DisplayConfig_init_zero {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0}
|
||||||
#define Config_LoRaConfig_init_zero {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, {0, 0, 0}}
|
#define Config_LoRaConfig_init_zero {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, {0, 0, 0}}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
@@ -212,6 +223,7 @@ extern "C" {
|
|||||||
#define Config_DisplayConfig_screen_on_secs_tag 1
|
#define Config_DisplayConfig_screen_on_secs_tag 1
|
||||||
#define Config_DisplayConfig_gps_format_tag 2
|
#define Config_DisplayConfig_gps_format_tag 2
|
||||||
#define Config_DisplayConfig_auto_screen_carousel_secs_tag 3
|
#define Config_DisplayConfig_auto_screen_carousel_secs_tag 3
|
||||||
|
#define Config_DisplayConfig_compass_north_top_tag 4
|
||||||
#define Config_LoRaConfig_tx_power_tag 1
|
#define Config_LoRaConfig_tx_power_tag 1
|
||||||
#define Config_LoRaConfig_modem_preset_tag 2
|
#define Config_LoRaConfig_modem_preset_tag 2
|
||||||
#define Config_LoRaConfig_bandwidth_tag 3
|
#define Config_LoRaConfig_bandwidth_tag 3
|
||||||
@@ -238,10 +250,10 @@ extern "C" {
|
|||||||
#define Config_PowerConfig_sds_secs_tag 10
|
#define Config_PowerConfig_sds_secs_tag 10
|
||||||
#define Config_PowerConfig_ls_secs_tag 11
|
#define Config_PowerConfig_ls_secs_tag 11
|
||||||
#define Config_PowerConfig_min_wake_secs_tag 12
|
#define Config_PowerConfig_min_wake_secs_tag 12
|
||||||
#define Config_WiFiConfig_ssid_tag 1
|
#define Config_WiFiConfig_enabled_tag 1
|
||||||
#define Config_WiFiConfig_psk_tag 2
|
#define Config_WiFiConfig_mode_tag 2
|
||||||
#define Config_WiFiConfig_ap_mode_tag 3
|
#define Config_WiFiConfig_ssid_tag 3
|
||||||
#define Config_WiFiConfig_ap_hidden_tag 4
|
#define Config_WiFiConfig_psk_tag 4
|
||||||
#define Config_device_tag 1
|
#define Config_device_tag 1
|
||||||
#define Config_position_tag 2
|
#define Config_position_tag 2
|
||||||
#define Config_power_tag 3
|
#define Config_power_tag 3
|
||||||
@@ -300,17 +312,18 @@ X(a, STATIC, SINGULAR, UINT32, min_wake_secs, 12)
|
|||||||
#define Config_PowerConfig_DEFAULT NULL
|
#define Config_PowerConfig_DEFAULT NULL
|
||||||
|
|
||||||
#define Config_WiFiConfig_FIELDLIST(X, a) \
|
#define Config_WiFiConfig_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, SINGULAR, STRING, ssid, 1) \
|
X(a, STATIC, SINGULAR, BOOL, enabled, 1) \
|
||||||
X(a, STATIC, SINGULAR, STRING, psk, 2) \
|
X(a, STATIC, SINGULAR, UENUM, mode, 2) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, ap_mode, 3) \
|
X(a, STATIC, SINGULAR, STRING, ssid, 3) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, ap_hidden, 4)
|
X(a, STATIC, SINGULAR, STRING, psk, 4)
|
||||||
#define Config_WiFiConfig_CALLBACK NULL
|
#define Config_WiFiConfig_CALLBACK NULL
|
||||||
#define Config_WiFiConfig_DEFAULT NULL
|
#define Config_WiFiConfig_DEFAULT NULL
|
||||||
|
|
||||||
#define Config_DisplayConfig_FIELDLIST(X, a) \
|
#define Config_DisplayConfig_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, screen_on_secs, 1) \
|
X(a, STATIC, SINGULAR, UINT32, screen_on_secs, 1) \
|
||||||
X(a, STATIC, SINGULAR, UENUM, gps_format, 2) \
|
X(a, STATIC, SINGULAR, UENUM, gps_format, 2) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, auto_screen_carousel_secs, 3)
|
X(a, STATIC, SINGULAR, UINT32, auto_screen_carousel_secs, 3) \
|
||||||
|
X(a, STATIC, SINGULAR, BOOL, compass_north_top, 4)
|
||||||
#define Config_DisplayConfig_CALLBACK NULL
|
#define Config_DisplayConfig_CALLBACK NULL
|
||||||
#define Config_DisplayConfig_DEFAULT NULL
|
#define Config_DisplayConfig_DEFAULT NULL
|
||||||
|
|
||||||
@@ -347,7 +360,7 @@ extern const pb_msgdesc_t Config_LoRaConfig_msg;
|
|||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define Config_DeviceConfig_size 42
|
#define Config_DeviceConfig_size 42
|
||||||
#define Config_DisplayConfig_size 14
|
#define Config_DisplayConfig_size 16
|
||||||
#define Config_LoRaConfig_size 67
|
#define Config_LoRaConfig_size 67
|
||||||
#define Config_PositionConfig_size 30
|
#define Config_PositionConfig_size 30
|
||||||
#define Config_PowerConfig_size 45
|
#define Config_PowerConfig_size 45
|
||||||
|
|||||||
12
src/mesh/generated/device_metadata.pb.c
Normal file
12
src/mesh/generated/device_metadata.pb.c
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
/* Automatically generated nanopb constant definitions */
|
||||||
|
/* Generated by nanopb-0.4.6 */
|
||||||
|
|
||||||
|
#include "device_metadata.pb.h"
|
||||||
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PB_BIND(DeviceMetadata, DeviceMetadata, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
53
src/mesh/generated/device_metadata.pb.h
Normal file
53
src/mesh/generated/device_metadata.pb.h
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/* Automatically generated nanopb header */
|
||||||
|
/* Generated by nanopb-0.4.6 */
|
||||||
|
|
||||||
|
#ifndef PB_DEVICE_METADATA_PB_H_INCLUDED
|
||||||
|
#define PB_DEVICE_METADATA_PB_H_INCLUDED
|
||||||
|
#include <pb.h>
|
||||||
|
|
||||||
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Struct definitions */
|
||||||
|
/* Device metadata response */
|
||||||
|
typedef struct _DeviceMetadata {
|
||||||
|
/* Device firmware version string */
|
||||||
|
char firmware_version[18];
|
||||||
|
/* Device state version */
|
||||||
|
uint32_t device_state_version;
|
||||||
|
} DeviceMetadata;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Initializer values for message structs */
|
||||||
|
#define DeviceMetadata_init_default {"", 0}
|
||||||
|
#define DeviceMetadata_init_zero {"", 0}
|
||||||
|
|
||||||
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
|
#define DeviceMetadata_firmware_version_tag 1
|
||||||
|
#define DeviceMetadata_device_state_version_tag 2
|
||||||
|
|
||||||
|
/* Struct field encoding specification for nanopb */
|
||||||
|
#define DeviceMetadata_FIELDLIST(X, a) \
|
||||||
|
X(a, STATIC, SINGULAR, STRING, firmware_version, 1) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, device_state_version, 2)
|
||||||
|
#define DeviceMetadata_CALLBACK NULL
|
||||||
|
#define DeviceMetadata_DEFAULT NULL
|
||||||
|
|
||||||
|
extern const pb_msgdesc_t DeviceMetadata_msg;
|
||||||
|
|
||||||
|
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||||
|
#define DeviceMetadata_fields &DeviceMetadata_msg
|
||||||
|
|
||||||
|
/* Maximum encoded size of messages (where known) */
|
||||||
|
#define DeviceMetadata_size 25
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -165,7 +165,7 @@ extern const pb_msgdesc_t OEMStore_msg;
|
|||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define ChannelFile_size 630
|
#define ChannelFile_size 630
|
||||||
#define DeviceState_size 23728
|
#define DeviceState_size 23994
|
||||||
#define OEMStore_size 2106
|
#define OEMStore_size 2106
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ extern const pb_msgdesc_t LocalModuleConfig_msg;
|
|||||||
#define LocalModuleConfig_fields &LocalModuleConfig_msg
|
#define LocalModuleConfig_fields &LocalModuleConfig_msg
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define LocalConfig_size 319
|
#define LocalConfig_size 321
|
||||||
#define LocalModuleConfig_size 268
|
#define LocalModuleConfig_size 268
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -257,6 +257,11 @@ typedef struct _Location {
|
|||||||
uint32_t expire;
|
uint32_t expire;
|
||||||
/* If true, only allow the original sender to update the location. */
|
/* If true, only allow the original sender to update the location. */
|
||||||
bool locked;
|
bool locked;
|
||||||
|
/* Name of the location - max 30 chars */
|
||||||
|
char name[30];
|
||||||
|
/* *
|
||||||
|
Description of the location - max 100 chars */
|
||||||
|
char description[100];
|
||||||
} Location;
|
} Location;
|
||||||
|
|
||||||
/* Debug output from the device.
|
/* Debug output from the device.
|
||||||
@@ -737,7 +742,7 @@ extern "C" {
|
|||||||
#define RouteDiscovery_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}}
|
#define RouteDiscovery_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}}
|
||||||
#define Routing_init_default {0, {RouteDiscovery_init_default}}
|
#define Routing_init_default {0, {RouteDiscovery_init_default}}
|
||||||
#define Data_init_default {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, Location_init_default}
|
#define Data_init_default {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, Location_init_default}
|
||||||
#define Location_init_default {0, 0, 0, 0, 0}
|
#define Location_init_default {0, 0, 0, 0, 0, "", ""}
|
||||||
#define MeshPacket_init_default {0, 0, 0, 0, {Data_init_default}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0, _MeshPacket_Delayed_MIN}
|
#define MeshPacket_init_default {0, 0, 0, 0, {Data_init_default}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0, _MeshPacket_Delayed_MIN}
|
||||||
#define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0, false, DeviceMetrics_init_default}
|
#define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0, false, DeviceMetrics_init_default}
|
||||||
#define MyNodeInfo_init_default {0, 0, "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0}
|
#define MyNodeInfo_init_default {0, 0, "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0}
|
||||||
@@ -751,7 +756,7 @@ extern "C" {
|
|||||||
#define RouteDiscovery_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}}
|
#define RouteDiscovery_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}}
|
||||||
#define Routing_init_zero {0, {RouteDiscovery_init_zero}}
|
#define Routing_init_zero {0, {RouteDiscovery_init_zero}}
|
||||||
#define Data_init_zero {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, Location_init_zero}
|
#define Data_init_zero {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, Location_init_zero}
|
||||||
#define Location_init_zero {0, 0, 0, 0, 0}
|
#define Location_init_zero {0, 0, 0, 0, 0, "", ""}
|
||||||
#define MeshPacket_init_zero {0, 0, 0, 0, {Data_init_zero}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0, _MeshPacket_Delayed_MIN}
|
#define MeshPacket_init_zero {0, 0, 0, 0, {Data_init_zero}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0, _MeshPacket_Delayed_MIN}
|
||||||
#define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0, false, DeviceMetrics_init_zero}
|
#define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0, false, DeviceMetrics_init_zero}
|
||||||
#define MyNodeInfo_init_zero {0, 0, "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0}
|
#define MyNodeInfo_init_zero {0, 0, "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0}
|
||||||
@@ -769,6 +774,8 @@ extern "C" {
|
|||||||
#define Location_longitude_i_tag 3
|
#define Location_longitude_i_tag 3
|
||||||
#define Location_expire_tag 4
|
#define Location_expire_tag 4
|
||||||
#define Location_locked_tag 5
|
#define Location_locked_tag 5
|
||||||
|
#define Location_name_tag 6
|
||||||
|
#define Location_description_tag 7
|
||||||
#define LogRecord_message_tag 1
|
#define LogRecord_message_tag 1
|
||||||
#define LogRecord_time_tag 2
|
#define LogRecord_time_tag 2
|
||||||
#define LogRecord_source_tag 3
|
#define LogRecord_source_tag 3
|
||||||
@@ -941,7 +948,9 @@ X(a, STATIC, SINGULAR, UINT32, id, 1) \
|
|||||||
X(a, STATIC, SINGULAR, SFIXED32, latitude_i, 2) \
|
X(a, STATIC, SINGULAR, SFIXED32, latitude_i, 2) \
|
||||||
X(a, STATIC, SINGULAR, SFIXED32, longitude_i, 3) \
|
X(a, STATIC, SINGULAR, SFIXED32, longitude_i, 3) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, expire, 4) \
|
X(a, STATIC, SINGULAR, UINT32, expire, 4) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, locked, 5)
|
X(a, STATIC, SINGULAR, BOOL, locked, 5) \
|
||||||
|
X(a, STATIC, SINGULAR, STRING, name, 6) \
|
||||||
|
X(a, STATIC, SINGULAR, STRING, description, 7)
|
||||||
#define Location_CALLBACK NULL
|
#define Location_CALLBACK NULL
|
||||||
#define Location_DEFAULT NULL
|
#define Location_DEFAULT NULL
|
||||||
|
|
||||||
@@ -1078,18 +1087,18 @@ extern const pb_msgdesc_t Compressed_msg;
|
|||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define Compressed_size 243
|
#define Compressed_size 243
|
||||||
#define Data_size 296
|
#define Data_size 429
|
||||||
#define FromRadio_size 356
|
#define FromRadio_size 489
|
||||||
#define Location_size 24
|
#define Location_size 156
|
||||||
#define LogRecord_size 81
|
#define LogRecord_size 81
|
||||||
#define MeshPacket_size 347
|
#define MeshPacket_size 480
|
||||||
#define MyNodeInfo_size 197
|
#define MyNodeInfo_size 197
|
||||||
#define NodeInfo_size 281
|
#define NodeInfo_size 281
|
||||||
#define Position_size 142
|
#define Position_size 142
|
||||||
#define RouteDiscovery_size 40
|
#define RouteDiscovery_size 40
|
||||||
#define Routing_size 42
|
#define Routing_size 42
|
||||||
#define ToRadio_PeerInfo_size 8
|
#define ToRadio_PeerInfo_size 8
|
||||||
#define ToRadio_size 350
|
#define ToRadio_size 483
|
||||||
#define User_size 95
|
#define User_size 95
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -610,7 +610,7 @@ void handleReport(HTTPRequest *req, HTTPResponse *res)
|
|||||||
|
|
||||||
// data->wifi
|
// data->wifi
|
||||||
String ipStr;
|
String ipStr;
|
||||||
if (config.wifi.ap_mode || isSoftAPForced()) {
|
if (config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPoint || config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPointHidden || isSoftAPForced()) {
|
||||||
ipStr = String(WiFi.softAPIP().toString());
|
ipStr = String(WiFi.softAPIP().toString());
|
||||||
} else {
|
} else {
|
||||||
ipStr = String(WiFi.localIP().toString());
|
ipStr = String(WiFi.localIP().toString());
|
||||||
|
|||||||
@@ -191,10 +191,14 @@ bool initWifi(bool forceSoftAP)
|
|||||||
|
|
||||||
if (forceSoftAP) {
|
if (forceSoftAP) {
|
||||||
DEBUG_MSG("WiFi ... Forced AP Mode\n");
|
DEBUG_MSG("WiFi ... Forced AP Mode\n");
|
||||||
} else if (config.wifi.ap_mode) {
|
} else if (config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPoint) {
|
||||||
DEBUG_MSG("WiFi ... AP Mode\n");
|
DEBUG_MSG("WiFi ... AP Mode\n");
|
||||||
} else {
|
} else if (config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPointHidden) {
|
||||||
|
DEBUG_MSG("WiFi ... Hidden AP Mode\n");
|
||||||
|
} else if (config.wifi.mode == Config_WiFiConfig_WiFiMode_Client) {
|
||||||
DEBUG_MSG("WiFi ... Client Mode\n");
|
DEBUG_MSG("WiFi ... Client Mode\n");
|
||||||
|
} else {
|
||||||
|
DEBUG_MSG("WiFi ... WiFi Disabled\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
createSSLCert();
|
createSSLCert();
|
||||||
@@ -203,7 +207,7 @@ bool initWifi(bool forceSoftAP)
|
|||||||
wifiPsw = NULL;
|
wifiPsw = NULL;
|
||||||
|
|
||||||
if (*wifiName || forceSoftAP) {
|
if (*wifiName || forceSoftAP) {
|
||||||
if (config.wifi.ap_mode || forceSoftAP) {
|
if (config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPoint || config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPointHidden || forceSoftAP) {
|
||||||
|
|
||||||
IPAddress apIP(192, 168, 42, 1);
|
IPAddress apIP(192, 168, 42, 1);
|
||||||
WiFi.onEvent(WiFiEvent);
|
WiFi.onEvent(WiFiEvent);
|
||||||
@@ -218,7 +222,7 @@ bool initWifi(bool forceSoftAP)
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
// If AP is configured to be hidden hidden
|
// If AP is configured to be hidden hidden
|
||||||
if (config.wifi.ap_hidden) {
|
if (config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPointHidden) {
|
||||||
|
|
||||||
// The configurations on softAP are from the espresif library
|
// The configurations on softAP are from the espresif library
|
||||||
int ok = WiFi.softAP(wifiName, wifiPsw, 1, 1, 4);
|
int ok = WiFi.softAP(wifiName, wifiPsw, 1, 1, 4);
|
||||||
@@ -373,7 +377,7 @@ static void WiFiEvent(WiFiEvent_t event)
|
|||||||
|
|
||||||
void handleDNSResponse()
|
void handleDNSResponse()
|
||||||
{
|
{
|
||||||
if (config.wifi.ap_mode || isSoftAPForced()) {
|
if (config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPoint || config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPointHidden || isSoftAPForced()) {
|
||||||
dnsServer.processNextRequest();
|
dnsServer.processNextRequest();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,6 +109,11 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
|
|||||||
shutdownAtMsec = (s < 0) ? 0 : (millis() + s * 1000);
|
shutdownAtMsec = (s < 0) ? 0 : (millis() + s * 1000);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case AdminMessage_get_device_metadata_request_tag: {
|
||||||
|
DEBUG_MSG("Client is getting device metadata\n");
|
||||||
|
handleGetDeviceMetadata(mp);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef ARCH_PORTDUINO
|
#ifdef ARCH_PORTDUINO
|
||||||
case AdminMessage_exit_simulator_tag:
|
case AdminMessage_exit_simulator_tag:
|
||||||
@@ -374,6 +379,18 @@ void AdminModule::handleGetModuleConfig(const MeshPacket &req, const uint32_t co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AdminModule::handleGetDeviceMetadata(const MeshPacket &req) {
|
||||||
|
AdminMessage r = AdminMessage_init_default;
|
||||||
|
|
||||||
|
DeviceMetadata deviceMetadata;
|
||||||
|
strncpy(deviceMetadata.firmware_version, myNodeInfo.firmware_version, 18);
|
||||||
|
deviceMetadata.device_state_version = DEVICESTATE_CUR_VER;
|
||||||
|
|
||||||
|
r.get_device_metadata_response = deviceMetadata;
|
||||||
|
r.which_variant = AdminMessage_get_device_metadata_response_tag;
|
||||||
|
myReply = allocDataProtobuf(r);
|
||||||
|
}
|
||||||
|
|
||||||
void AdminModule::handleGetChannel(const MeshPacket &req, uint32_t channelIndex)
|
void AdminModule::handleGetChannel(const MeshPacket &req, uint32_t channelIndex)
|
||||||
{
|
{
|
||||||
if (req.decoded.want_response) {
|
if (req.decoded.want_response) {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class AdminModule : public ProtobufModule<AdminMessage>
|
|||||||
void handleGetConfig(const MeshPacket &req, uint32_t configType);
|
void handleGetConfig(const MeshPacket &req, uint32_t configType);
|
||||||
void handleGetModuleConfig(const MeshPacket &req, uint32_t configType);
|
void handleGetModuleConfig(const MeshPacket &req, uint32_t configType);
|
||||||
void handleGetChannel(const MeshPacket &req, uint32_t channelIndex);
|
void handleGetChannel(const MeshPacket &req, uint32_t channelIndex);
|
||||||
|
void handleGetDeviceMetadata(const MeshPacket &req);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setters
|
* Setters
|
||||||
|
|||||||
@@ -103,6 +103,8 @@ MeshPacket *PositionModule::allocReply()
|
|||||||
} else
|
} else
|
||||||
DEBUG_MSG("Providing time to mesh %u\n", p.time);
|
DEBUG_MSG("Providing time to mesh %u\n", p.time);
|
||||||
|
|
||||||
|
DEBUG_MSG("Position reply: time=%i, latI=%i, lonI=-%i\n", p.time, p.latitude_i, p.longitude_i);
|
||||||
|
|
||||||
return allocDataProtobuf(p);
|
return allocDataProtobuf(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +146,6 @@ int32_t PositionModule::runOnce()
|
|||||||
currentGeneration = radioGeneration;
|
currentGeneration = radioGeneration;
|
||||||
|
|
||||||
DEBUG_MSG("Sending pos@%x:6 to mesh (wantReplies=%d)\n", node->position.pos_timestamp, requestReplies);
|
DEBUG_MSG("Sending pos@%x:6 to mesh (wantReplies=%d)\n", node->position.pos_timestamp, requestReplies);
|
||||||
|
|
||||||
sendOurPosition(NODENUM_BROADCAST, requestReplies);
|
sendOurPosition(NODENUM_BROADCAST, requestReplies);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -44,4 +44,5 @@ void RoutingModule::sendAckNak(Routing_Error err, NodeNum to, PacketId idFrom, C
|
|||||||
RoutingModule::RoutingModule() : ProtobufModule("routing", PortNum_ROUTING_APP, Routing_fields)
|
RoutingModule::RoutingModule() : ProtobufModule("routing", PortNum_ROUTING_APP, Routing_fields)
|
||||||
{
|
{
|
||||||
isPromiscuous = true;
|
isPromiscuous = true;
|
||||||
|
encryptedOk = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,9 +62,9 @@ PhoneAPI *bluetoothPhoneAPI;
|
|||||||
class ESP32BluetoothToRadioCallback : public NimBLECharacteristicCallbacks {
|
class ESP32BluetoothToRadioCallback : public NimBLECharacteristicCallbacks {
|
||||||
virtual void onWrite(NimBLECharacteristic *pCharacteristic) {
|
virtual void onWrite(NimBLECharacteristic *pCharacteristic) {
|
||||||
DEBUG_MSG("To Radio onwrite\n");
|
DEBUG_MSG("To Radio onwrite\n");
|
||||||
auto valueString = pCharacteristic->getValue();
|
auto val = pCharacteristic->getValue();
|
||||||
|
|
||||||
bluetoothPhoneAPI->handleToRadio(reinterpret_cast<const uint8_t*>(&valueString[0]), pCharacteristic->getDataLength());
|
bluetoothPhoneAPI->handleToRadio(val.data(), val.length());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -109,9 +109,11 @@ class ESP32BluetoothServerCallback : public NimBLEServerCallbacks {
|
|||||||
screen->stopBluetoothPinScreen();
|
screen->stopBluetoothPinScreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
virtual void onDisconnect(NimBLEServer* pServer, ble_gap_conn_desc *desc) {
|
||||||
|
DEBUG_MSG("BLE disconnect\n");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static ESP32BluetoothToRadioCallback *toRadioCallbacks;
|
static ESP32BluetoothToRadioCallback *toRadioCallbacks;
|
||||||
static ESP32BluetoothFromRadioCallback *fromRadioCallbacks;
|
static ESP32BluetoothFromRadioCallback *fromRadioCallbacks;
|
||||||
|
|
||||||
@@ -120,6 +122,9 @@ void ESP32Bluetooth::shutdown()
|
|||||||
// Shutdown bluetooth for minimum power draw
|
// Shutdown bluetooth for minimum power draw
|
||||||
DEBUG_MSG("Disable bluetooth\n");
|
DEBUG_MSG("Disable bluetooth\n");
|
||||||
//Bluefruit.Advertising.stop();
|
//Bluefruit.Advertising.stop();
|
||||||
|
NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising();
|
||||||
|
pAdvertising->reset();
|
||||||
|
pAdvertising->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESP32Bluetooth::setup()
|
void ESP32Bluetooth::setup()
|
||||||
@@ -175,7 +180,7 @@ void ESP32Bluetooth::setup()
|
|||||||
bleServer = NimBLEDevice::createServer();
|
bleServer = NimBLEDevice::createServer();
|
||||||
|
|
||||||
ESP32BluetoothServerCallback *serverCallbacks = new ESP32BluetoothServerCallback();
|
ESP32BluetoothServerCallback *serverCallbacks = new ESP32BluetoothServerCallback();
|
||||||
bleServer->setCallbacks(serverCallbacks);
|
bleServer->setCallbacks(serverCallbacks, true);
|
||||||
|
|
||||||
NimBLEService *bleService = bleServer->createService(MESH_SERVICE_UUID);
|
NimBLEService *bleService = bleServer->createService(MESH_SERVICE_UUID);
|
||||||
//NimBLECharacteristic *pNonSecureCharacteristic = bleService->createCharacteristic("1234", NIMBLE_PROPERTY::READ );
|
//NimBLECharacteristic *pNonSecureCharacteristic = bleService->createCharacteristic("1234", NIMBLE_PROPERTY::READ );
|
||||||
@@ -208,9 +213,9 @@ void ESP32Bluetooth::setup()
|
|||||||
//ToRadioCharacteristic->setCallbacks()
|
//ToRadioCharacteristic->setCallbacks()
|
||||||
|
|
||||||
NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising();
|
NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising();
|
||||||
|
pAdvertising->reset();
|
||||||
pAdvertising->addServiceUUID(MESH_SERVICE_UUID);
|
pAdvertising->addServiceUUID(MESH_SERVICE_UUID);
|
||||||
pAdvertising->start();
|
pAdvertising->start(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -228,7 +233,7 @@ void ESP32Bluetooth::clearBonds()
|
|||||||
|
|
||||||
//Bluefruit.Periph.clearBonds();
|
//Bluefruit.Periph.clearBonds();
|
||||||
//Bluefruit.Central.clearBonds();
|
//Bluefruit.Central.clearBonds();
|
||||||
|
NimBLEDevice::deleteAllBonds();
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearNVS() {
|
void clearNVS() {
|
||||||
@@ -103,3 +103,4 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SERIAL0_RX_GPIO 3 // Always GPIO3 on ESP32
|
#define SERIAL0_RX_GPIO 3 // Always GPIO3 on ESP32
|
||||||
|
|
||||||
@@ -1,120 +1,120 @@
|
|||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* SEGGER Microcontroller GmbH & Co. KG *
|
* SEGGER Microcontroller GmbH & Co. KG *
|
||||||
* The Embedded Experts *
|
* The Embedded Experts *
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
* *
|
* *
|
||||||
* (c) 1995 - 2015 SEGGER Microcontroller GmbH & Co. KG *
|
* (c) 1995 - 2015 SEGGER Microcontroller GmbH & Co. KG *
|
||||||
* *
|
* *
|
||||||
* www.segger.com Support: support@segger.com *
|
* www.segger.com Support: support@segger.com *
|
||||||
* *
|
* *
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
File : JLINK_MONITOR.c
|
File : JLINK_MONITOR.c
|
||||||
Purpose : Implementation of debug monitor for J-Link monitor mode debug on Cortex-M devices.
|
Purpose : Implementation of debug monitor for J-Link monitor mode debug on Cortex-M devices.
|
||||||
-------- END-OF-HEADER ---------------------------------------------
|
-------- END-OF-HEADER ---------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "JLINK_MONITOR.h"
|
#include "JLINK_MONITOR.h"
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
*
|
*
|
||||||
* Configuration
|
* Configuration
|
||||||
*
|
*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
*
|
*
|
||||||
* Defines
|
* Defines
|
||||||
*
|
*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
*
|
*
|
||||||
* Types
|
* Types
|
||||||
*
|
*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
*
|
*
|
||||||
* Static data
|
* Static data
|
||||||
*
|
*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
volatile int MAIN_MonCnt; // Incremented in JLINK_MONITOR_OnPoll() while CPU is in debug mode
|
volatile int MAIN_MonCnt; // Incremented in JLINK_MONITOR_OnPoll() while CPU is in debug mode
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
*
|
*
|
||||||
* Local functions
|
* Local functions
|
||||||
*
|
*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
*
|
*
|
||||||
* Global functions
|
* Global functions
|
||||||
*
|
*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
*
|
*
|
||||||
* JLINK_MONITOR_OnExit()
|
* JLINK_MONITOR_OnExit()
|
||||||
*
|
*
|
||||||
* Function description
|
* Function description
|
||||||
* Called from DebugMon_Handler(), once per debug exit.
|
* Called from DebugMon_Handler(), once per debug exit.
|
||||||
* May perform some target specific operations to be done on debug mode exit.
|
* May perform some target specific operations to be done on debug mode exit.
|
||||||
*
|
*
|
||||||
* Notes
|
* Notes
|
||||||
* (1) Must not keep the CPU busy for more than 100 ms
|
* (1) Must not keep the CPU busy for more than 100 ms
|
||||||
*/
|
*/
|
||||||
void JLINK_MONITOR_OnExit(void) {
|
void JLINK_MONITOR_OnExit(void) {
|
||||||
//
|
//
|
||||||
// Add custom code here
|
// Add custom code here
|
||||||
//
|
//
|
||||||
// BSP_ClrLED(0);
|
// BSP_ClrLED(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
*
|
*
|
||||||
* JLINK_MONITOR_OnEnter()
|
* JLINK_MONITOR_OnEnter()
|
||||||
*
|
*
|
||||||
* Function description
|
* Function description
|
||||||
* Called from DebugMon_Handler(), once per debug entry.
|
* Called from DebugMon_Handler(), once per debug entry.
|
||||||
* May perform some target specific operations to be done on debug mode entry
|
* May perform some target specific operations to be done on debug mode entry
|
||||||
*
|
*
|
||||||
* Notes
|
* Notes
|
||||||
* (1) Must not keep the CPU busy for more than 100 ms
|
* (1) Must not keep the CPU busy for more than 100 ms
|
||||||
*/
|
*/
|
||||||
void JLINK_MONITOR_OnEnter(void) {
|
void JLINK_MONITOR_OnEnter(void) {
|
||||||
//
|
//
|
||||||
// Add custom code here
|
// Add custom code here
|
||||||
//
|
//
|
||||||
// BSP_SetLED(0);
|
// BSP_SetLED(0);
|
||||||
// BSP_ClrLED(1);
|
// BSP_ClrLED(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
*
|
*
|
||||||
* JLINK_MONITOR_OnPoll()
|
* JLINK_MONITOR_OnPoll()
|
||||||
*
|
*
|
||||||
* Function description
|
* Function description
|
||||||
* Called periodically from DebugMon_Handler(), to perform some actions that need to be performed periodically during debug mode.
|
* Called periodically from DebugMon_Handler(), to perform some actions that need to be performed periodically during debug mode.
|
||||||
*
|
*
|
||||||
* Notes
|
* Notes
|
||||||
* (1) Must not keep the CPU busy for more than 100 ms
|
* (1) Must not keep the CPU busy for more than 100 ms
|
||||||
*/
|
*/
|
||||||
void JLINK_MONITOR_OnPoll(void) {
|
void JLINK_MONITOR_OnPoll(void) {
|
||||||
//
|
//
|
||||||
// Add custom code here
|
// Add custom code here
|
||||||
//
|
//
|
||||||
MAIN_MonCnt++;
|
MAIN_MonCnt++;
|
||||||
// BSP_ToggleLED(0);
|
// BSP_ToggleLED(0);
|
||||||
// _Delay(500000);
|
// _Delay(500000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****** End Of File *************************************************/
|
/****** End Of File *************************************************/
|
||||||
@@ -1,27 +1,27 @@
|
|||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* SEGGER Microcontroller GmbH & Co. KG *
|
* SEGGER Microcontroller GmbH & Co. KG *
|
||||||
* The Embedded Experts *
|
* The Embedded Experts *
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
* *
|
* *
|
||||||
* (c) 1995 - 2015 SEGGER Microcontroller GmbH & Co. KG *
|
* (c) 1995 - 2015 SEGGER Microcontroller GmbH & Co. KG *
|
||||||
* *
|
* *
|
||||||
* www.segger.com Support: support@segger.com *
|
* www.segger.com Support: support@segger.com *
|
||||||
* *
|
* *
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
File : JLINK_MONITOR.h
|
File : JLINK_MONITOR.h
|
||||||
Purpose : Header file of debug monitor for J-Link monitor mode debug on Cortex-M devices.
|
Purpose : Header file of debug monitor for J-Link monitor mode debug on Cortex-M devices.
|
||||||
-------- END-OF-HEADER ---------------------------------------------
|
-------- END-OF-HEADER ---------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef JLINK_MONITOR_H
|
#ifndef JLINK_MONITOR_H
|
||||||
#define JLINK_MONITOR_H
|
#define JLINK_MONITOR_H
|
||||||
|
|
||||||
void JLINK_MONITOR_OnExit (void);
|
void JLINK_MONITOR_OnExit (void);
|
||||||
void JLINK_MONITOR_OnEnter (void);
|
void JLINK_MONITOR_OnEnter (void);
|
||||||
void JLINK_MONITOR_OnPoll (void);
|
void JLINK_MONITOR_OnPoll (void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****** End Of File *************************************************/
|
/****** End Of File *************************************************/
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -40,6 +40,8 @@
|
|||||||
#define HW_VENDOR HardwareModel_T_ECHO
|
#define HW_VENDOR HardwareModel_T_ECHO
|
||||||
#elif defined(NORDIC_PCA10059)
|
#elif defined(NORDIC_PCA10059)
|
||||||
#define HW_VENDOR HardwareModel_NRF52840_PCA10059
|
#define HW_VENDOR HardwareModel_NRF52840_PCA10059
|
||||||
|
#elif defined(PRIVATE_HW)
|
||||||
|
#define HW_VENDOR HardwareModel_PRIVATE_HW
|
||||||
#else
|
#else
|
||||||
#define HW_VENDOR HardwareModel_NRF52_UNKNOWN
|
#define HW_VENDOR HardwareModel_NRF52_UNKNOWN
|
||||||
#endif
|
#endif
|
||||||
7
src/platform/rp2040/architecture.h
Normal file
7
src/platform/rp2040/architecture.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define ARCH_RP2040
|
||||||
|
|
||||||
|
#if defined(PRIVATE_HW)
|
||||||
|
#define HW_VENDOR HardwareModel_PRIVATE_HW
|
||||||
|
#endif
|
||||||
30
src/platform/rp2040/main-rp2040.cpp
Normal file
30
src/platform/rp2040/main-rp2040.cpp
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#include "configuration.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <pico/unique_id.h>
|
||||||
|
|
||||||
|
void setBluetoothEnable(bool on)
|
||||||
|
{
|
||||||
|
// not needed
|
||||||
|
}
|
||||||
|
|
||||||
|
void cpuDeepSleep(uint64_t msecs)
|
||||||
|
{
|
||||||
|
// not needed
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateBatteryLevel(uint8_t level)
|
||||||
|
{
|
||||||
|
// not needed
|
||||||
|
}
|
||||||
|
|
||||||
|
void getMacAddr(uint8_t *dmac)
|
||||||
|
{
|
||||||
|
pico_unique_board_id_t src;
|
||||||
|
pico_get_unique_board_id(&src);
|
||||||
|
dmac[5] = src.id[0];
|
||||||
|
dmac[4] = src.id[1];
|
||||||
|
dmac[3] = src.id[2];
|
||||||
|
dmac[2] = src.id[3];
|
||||||
|
dmac[1] = src.id[4];
|
||||||
|
dmac[0] = src.id[5];
|
||||||
|
}
|
||||||
36
src/platform/rp2040/rp2040CryptoEngine.cpp
Normal file
36
src/platform/rp2040/rp2040CryptoEngine.cpp
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
#include "configuration.h"
|
||||||
|
#include "CryptoEngine.h"
|
||||||
|
#include "aes.hpp"
|
||||||
|
|
||||||
|
class RP2040CryptoEngine : public CryptoEngine
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RP2040CryptoEngine() {}
|
||||||
|
|
||||||
|
~RP2040CryptoEngine() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encrypt a packet
|
||||||
|
*
|
||||||
|
* @param bytes is updated in place
|
||||||
|
*/
|
||||||
|
virtual void encrypt(uint32_t fromNode, uint64_t packetNum, size_t numBytes, uint8_t *bytes) override
|
||||||
|
{
|
||||||
|
if (key.length > 0) {
|
||||||
|
AES_ctx ctx;
|
||||||
|
initNonce(fromNode, packetNum);
|
||||||
|
AES_init_ctx_iv(&ctx, key.bytes, nonce);
|
||||||
|
AES_CTR_xcrypt_buffer(&ctx, bytes, numBytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void decrypt(uint32_t fromNode, uint64_t packetNum, size_t numBytes, uint8_t *bytes) override
|
||||||
|
{
|
||||||
|
// For CTR, the implementation is the same
|
||||||
|
encrypt(fromNode, packetNum, numBytes, bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
CryptoEngine *crypto = new RP2040CryptoEngine();
|
||||||
@@ -21,14 +21,21 @@ void powerCommandsCheck()
|
|||||||
if (shutdownAtMsec) {
|
if (shutdownAtMsec) {
|
||||||
screen->startShutdownScreen();
|
screen->startShutdownScreen();
|
||||||
playBeep();
|
playBeep();
|
||||||
|
#ifdef PIN_LED1
|
||||||
ledOff(PIN_LED1);
|
ledOff(PIN_LED1);
|
||||||
|
#endif
|
||||||
|
#ifdef PIN_LED2
|
||||||
ledOff(PIN_LED2);
|
ledOff(PIN_LED2);
|
||||||
|
#endif
|
||||||
|
#ifdef PIN_LED3
|
||||||
|
ledOff(PIN_LED3);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (shutdownAtMsec && millis() > shutdownAtMsec) {
|
if (shutdownAtMsec && millis() > shutdownAtMsec) {
|
||||||
DEBUG_MSG("Shutting down from admin command\n");
|
DEBUG_MSG("Shutting down from admin command\n");
|
||||||
#ifdef TBEAM_V10
|
#ifdef HAS_AXP192
|
||||||
if (axp192_found == true) {
|
if (axp192_found == true) {
|
||||||
playShutdownMelody();
|
playShutdownMelody();
|
||||||
power->shutdown();
|
power->shutdown();
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
esp_sleep_source_t wakeCause; // the reason we booted this time
|
esp_sleep_source_t wakeCause; // the reason we booted this time
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TBEAM_V10
|
#ifdef HAS_AXP192
|
||||||
#include "axp20x.h"
|
#include "axp20x.h"
|
||||||
extern AXP20X_Class axp;
|
extern AXP20X_Class axp;
|
||||||
#endif
|
#endif
|
||||||
@@ -80,7 +80,7 @@ void setLed(bool ledOn)
|
|||||||
digitalWrite(LED_PIN, ledOn ^ LED_INVERTED);
|
digitalWrite(LED_PIN, ledOn ^ LED_INVERTED);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TBEAM_V10
|
#ifdef HAS_AXP192
|
||||||
if (axp192_found) {
|
if (axp192_found) {
|
||||||
// blink the axp led
|
// blink the axp led
|
||||||
axp.setChgLEDMode(ledOn ? AXP20X_LED_LOW_LEVEL : AXP20X_LED_OFF);
|
axp.setChgLEDMode(ledOn ? AXP20X_LED_LOW_LEVEL : AXP20X_LED_OFF);
|
||||||
@@ -92,7 +92,7 @@ void setGPSPower(bool on)
|
|||||||
{
|
{
|
||||||
DEBUG_MSG("Setting GPS power=%d\n", on);
|
DEBUG_MSG("Setting GPS power=%d\n", on);
|
||||||
|
|
||||||
#ifdef TBEAM_V10
|
#ifdef HAS_AXP192
|
||||||
if (axp192_found)
|
if (axp192_found)
|
||||||
axp.setPowerOutPut(AXP192_LDO3, on ? AXP202_ON : AXP202_OFF); // GPS main power
|
axp.setPowerOutPut(AXP192_LDO3, on ? AXP202_ON : AXP202_OFF); // GPS main power
|
||||||
#endif
|
#endif
|
||||||
@@ -187,7 +187,7 @@ void doDeepSleep(uint64_t msecToWake)
|
|||||||
digitalWrite(VEXT_ENABLE, 1); // turn off the display power
|
digitalWrite(VEXT_ENABLE, 1); // turn off the display power
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TBEAM_V10
|
#ifdef HAS_AXP192
|
||||||
if (axp192_found) {
|
if (axp192_found) {
|
||||||
// Obsolete comment: from back when we we used to receive lora packets while CPU was in deep sleep.
|
// Obsolete comment: from back when we we used to receive lora packets while CPU was in deep sleep.
|
||||||
// We no longer do that, because our light-sleep current draws are low enough and it provides fast start/low cost
|
// We no longer do that, because our light-sleep current draws are low enough and it provides fast start/low cost
|
||||||
|
|||||||
17
variants/pico/platformio.ini
Normal file
17
variants/pico/platformio.ini
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
[env:pico]
|
||||||
|
extends = rp2040_base
|
||||||
|
board = pico
|
||||||
|
upload_protocol = picotool
|
||||||
|
|
||||||
|
# add our variants files to the include and src paths
|
||||||
|
build_flags = ${rp2040_base.build_flags}
|
||||||
|
-DPRIVATE_HW
|
||||||
|
-Ivariants/pico
|
||||||
|
-DARDUINO_AVR_NANO_EVERY
|
||||||
|
-DDEBUG_RP2040_WIRE
|
||||||
|
-DDEBUG_RP2040_SPI
|
||||||
|
-DDEBUG_RP2040_CORE
|
||||||
|
-DDEBUG_RP2040_PORT=Serial
|
||||||
|
-DUSE_TINYUSB
|
||||||
|
lib_deps =
|
||||||
|
${rp2040_base.lib_deps}
|
||||||
52
variants/pico/variant.h
Normal file
52
variants/pico/variant.h
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
// #define RADIOLIB_CUSTOM_ARDUINO 1
|
||||||
|
// #define RADIOLIB_TONE_UNSUPPORTED 1
|
||||||
|
// #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED 1
|
||||||
|
|
||||||
|
#define ARDUINO_ARCH_AVR
|
||||||
|
|
||||||
|
#define CBC 0
|
||||||
|
#define CTR 1
|
||||||
|
#define ECB 0
|
||||||
|
|
||||||
|
#define NO_GPS 1
|
||||||
|
#define USE_SH1106 1
|
||||||
|
#undef GPS_SERIAL_NUM
|
||||||
|
|
||||||
|
// #define I2C_SDA 6
|
||||||
|
// #define I2C_SCL 7
|
||||||
|
|
||||||
|
#define BUTTON_PIN 17
|
||||||
|
#define EXT_NOTIFY_OUT 4
|
||||||
|
|
||||||
|
#define BATTERY_PIN 26
|
||||||
|
// ratio of voltage divider = 3.0 (R17=200k, R18=100k)
|
||||||
|
#define ADC_MULTIPLIER 3.1 // 3.0 + a bit for being optimistic
|
||||||
|
|
||||||
|
#define USE_RF95
|
||||||
|
#define USE_SX1262
|
||||||
|
|
||||||
|
#undef RF95_SCK
|
||||||
|
#undef RF95_MISO
|
||||||
|
#undef RF95_MOSI
|
||||||
|
#undef RF95_NSS
|
||||||
|
|
||||||
|
#define RF95_SCK 10
|
||||||
|
#define RF95_MISO 12
|
||||||
|
#define RF95_MOSI 11
|
||||||
|
#define RF95_NSS 3
|
||||||
|
|
||||||
|
#define LORA_DIO0 RADIOLIB_NC
|
||||||
|
#define LORA_RESET 15
|
||||||
|
#define LORA_DIO1 20
|
||||||
|
#define LORA_DIO2 2
|
||||||
|
#define LORA_DIO3 RADIOLIB_NC
|
||||||
|
|
||||||
|
#ifdef USE_SX1262
|
||||||
|
#define SX126X_CS RF95_NSS
|
||||||
|
#define SX126X_DIO1 LORA_DIO1
|
||||||
|
#define SX126X_BUSY LORA_DIO2
|
||||||
|
#define SX126X_RESET LORA_RESET
|
||||||
|
#define SX126X_E22
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <Adafruit_TinyUSB.h>
|
||||||
@@ -2,10 +2,11 @@
|
|||||||
[portduino_base]
|
[portduino_base]
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
${env.build_src_filter}
|
${env.build_src_filter}
|
||||||
-<esp32/>
|
-<platform/esp32/>
|
||||||
-<nimble/>
|
-<nimble/>
|
||||||
-<nrf52/>
|
-<platform/nrf52/>
|
||||||
-<stm32wl/>
|
-<platform/stm32wl/>
|
||||||
|
-<platform/rp2040>
|
||||||
-<mesh/http/>
|
-<mesh/http/>
|
||||||
-<modules/esp32>
|
-<modules/esp32>
|
||||||
-<modules/Telemetry>
|
-<modules/Telemetry>
|
||||||
@@ -15,7 +16,7 @@ lib_deps =
|
|||||||
${networking_base.lib_deps}
|
${networking_base.lib_deps}
|
||||||
rweather/Crypto
|
rweather/Crypto
|
||||||
https://github.com/meshtastic/RadioLib.git#5582ac30578ff3f53f20630a00b2a8a4b8f92c74
|
https://github.com/meshtastic/RadioLib.git#5582ac30578ff3f53f20630a00b2a8a4b8f92c74
|
||||||
build_flags = ${arduino_base.build_flags} -Isrc/portduino
|
build_flags = ${arduino_base.build_flags} -Isrc/platform/portduino
|
||||||
|
|
||||||
[env:native]
|
[env:native]
|
||||||
platform = https://github.com/meshtastic/platform-native.git
|
platform = https://github.com/meshtastic/platform-native.git
|
||||||
|
|||||||
@@ -26,11 +26,16 @@
|
|||||||
//#define SX126X_E22 // Not really an E22
|
//#define SX126X_E22 // Not really an E22
|
||||||
// Internally the module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface
|
// Internally the module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface
|
||||||
// code)
|
// code)
|
||||||
|
#define SX126X_MAX_POWER 16 //Ensure the PA does not exceed the saturation output power. More Info:https://uniteng.com/wiki/doku.php?id=meshtastic:station#rf_design_-_lora_station_edition_g1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
#define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
||||||
#define BATTERY_SENSE_SAMPLES 30 //Set the number of samples, It has an effect of increasing sensitivity.
|
#define BATTERY_SENSE_SAMPLES 30 //Set the number of samples, It has an effect of increasing sensitivity.
|
||||||
#define ADC_MULTIPLIER 2.15
|
#define ADC_MULTIPLIER 6.45
|
||||||
|
#define BAT_FULLVOLT 12600
|
||||||
|
#define BAT_EMPTYVOLT 8200
|
||||||
|
#define BAT_CHARGINGVOLT 12600
|
||||||
|
#define BAT_NOBATVOLT 6690
|
||||||
|
|
||||||
// different screen
|
// different screen
|
||||||
#define USE_SH1106
|
#define USE_SH1106
|
||||||
|
|||||||
@@ -34,4 +34,4 @@
|
|||||||
// Leave undefined to disable our PMU IRQ handler. DO NOT ENABLE THIS because the pmuirq can cause sperious interrupts
|
// Leave undefined to disable our PMU IRQ handler. DO NOT ENABLE THIS because the pmuirq can cause sperious interrupts
|
||||||
// and waking from light sleep
|
// and waking from light sleep
|
||||||
// #define PMU_IRQ 35
|
// #define PMU_IRQ 35
|
||||||
#define AXP192_SLAVE_ADDRESS 0x34
|
#define HAS_AXP192
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
[VERSION]
|
[VERSION]
|
||||||
major = 1
|
major = 1
|
||||||
minor = 3
|
minor = 3
|
||||||
build = 29
|
build = 36
|
||||||
|
|||||||
Reference in New Issue
Block a user