Compare commits
417
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c482b4315 | ||
|
|
5b986a36fc | ||
|
|
e2ff6879dc | ||
|
|
0d2d1e9c66 | ||
|
|
d8d155ca5e | ||
|
|
f31e78069c | ||
|
|
dfca574481 | ||
|
|
01cf9d8535 | ||
|
|
f1c2c96fb8 | ||
|
|
f615e9f5b7 | ||
|
|
06684438b3 | ||
|
|
c8fa816dfc | ||
|
|
b4b2ca2063 | ||
|
|
882e5ba1c0 | ||
|
|
bf48fefd44 | ||
|
|
8f3d8da5db | ||
|
|
ed69024cae | ||
|
|
6fa77381d2 | ||
|
|
c6ff5ee850 | ||
|
|
696dbded26 | ||
|
|
c1c378b40c | ||
|
|
2424d026dc | ||
|
|
83138bd39a | ||
|
|
e12d7bf699 | ||
|
|
c97c27561a | ||
|
|
7fff6dfe5c | ||
|
|
63845b0d5c | ||
|
|
2722ee8f55 | ||
|
|
e20c74b12a | ||
|
|
3768540b9b | ||
|
|
51a6ce0f62 | ||
|
|
0a73a96864 | ||
|
|
e921af46b7 | ||
|
|
783529325f | ||
|
|
83008d287b | ||
|
|
e951143446 | ||
|
|
83c9dd6fa4 | ||
|
|
a0ccea47c3 | ||
|
|
fe653b2836 | ||
|
|
71af826344 | ||
|
|
0516c65709 | ||
|
|
292349c7e0 | ||
|
|
1320b4cea6 | ||
|
|
1b6ccc1c8d | ||
|
|
41918efd6d | ||
|
|
7947d331d2 | ||
|
|
325569c526 | ||
|
|
b626dbca8a | ||
|
|
a0633bdbb1 | ||
|
|
d068193481 | ||
|
|
c5a69d4c72 | ||
|
|
c18cde7ee2 | ||
|
|
aabdabe232 | ||
|
|
2bd3bc1a15 | ||
|
|
b87f9b3b55 | ||
|
|
5fcdbd357b | ||
|
|
5d7deaffc9 | ||
|
|
3bc9d094ac | ||
|
|
46cb2afb4f | ||
|
|
58852bcbd8 | ||
|
|
9c27e887ba | ||
|
|
3598836d19 | ||
|
|
debdfef299 | ||
|
|
d617e78558 | ||
|
|
911fd2994a | ||
|
|
331caffa98 | ||
|
|
797538bfae | ||
|
|
ebfcf3abcc | ||
|
|
9af1948674 | ||
|
|
ad8c2e4a65 | ||
|
|
b2c393ff58 | ||
|
|
5b4ac86b06 | ||
|
|
cc9c9b4d57 | ||
|
|
c07dc51368 | ||
|
|
3aa7cf5652 | ||
|
|
d29ee95a49 | ||
|
|
c20d3b7dda | ||
|
|
8825b74746 | ||
|
|
dc6a250133 | ||
|
|
356f0b762d | ||
|
|
c7e1faca80 | ||
|
|
7c90cd3e38 | ||
|
|
28fb5875b2 | ||
|
|
a5ba20da35 | ||
|
|
6f79ddc025 | ||
|
|
34e16cb0d0 | ||
|
|
304deff1c4 | ||
|
|
91405ac70a | ||
|
|
35b13beb8e | ||
|
|
9d46aa4307 | ||
|
|
968ccc47a3 | ||
|
|
3c9a15fd14 | ||
|
|
3c437fba6a | ||
|
|
1f16b58822 | ||
|
|
787658dab7 | ||
|
|
5b74d68a10 | ||
|
|
0edb67ae38 | ||
|
|
a166613cc7 | ||
|
|
0e8fe7579b | ||
|
|
0546edc51f | ||
|
|
a63a6ec6d4 | ||
|
|
05e02babe6 | ||
|
|
46454ad7e3 | ||
|
|
fd04cb818c | ||
|
|
935bc8a0de | ||
|
|
7565014945 | ||
|
|
6d0d9b7d18 | ||
|
|
d247ec9c24 | ||
|
|
c00ee96d86 | ||
|
|
54260688f0 | ||
|
|
fc30e9eb2d | ||
|
|
21bec6c32b | ||
|
|
8c7e4779a4 | ||
|
|
0e9ce66d2c | ||
|
|
7a08f33604 | ||
|
|
7ffab96733 | ||
|
|
fef133124a | ||
|
|
c5dfb3d8c3 | ||
|
|
b2c8b4dbc4 | ||
|
|
bb05858bb6 | ||
|
|
84dbc284ad | ||
|
|
c3a3309f5e | ||
|
|
cc3c2ba958 | ||
|
|
5ad461d033 | ||
|
|
f01933f2c3 | ||
|
|
c107a515d0 | ||
|
|
3dbe6bb11f | ||
|
|
f94f63f5db | ||
|
|
9bbe6626bc | ||
|
|
9a8857b24e | ||
|
|
47625da085 | ||
|
|
60982b3821 | ||
|
|
6db852f421 | ||
|
|
c0379858b6 | ||
|
|
4863508e95 | ||
|
|
6cb1be33d1 | ||
|
|
8b586e1b66 | ||
|
|
a38b0455f3 | ||
|
|
f441697205 | ||
|
|
31648b0fdb | ||
|
|
782c4a5a69 | ||
|
|
e71237258c | ||
|
|
eebc4753c3 | ||
|
|
533f87e93b | ||
|
|
319218b7ba | ||
|
|
7fa0677fd3 | ||
|
|
aada976237 | ||
|
|
d41b535ba8 | ||
|
|
340d618258 | ||
|
|
afd52de03d | ||
|
|
a88a3401c4 | ||
|
|
8f0fea86ca | ||
|
|
5e71294069 | ||
|
|
7e34f95f43 | ||
|
|
8a964b4bcb | ||
|
|
c5011e8b74 | ||
|
|
2a8d42791f | ||
|
|
2df1820424 | ||
|
|
31aca85109 | ||
|
|
aabd6ef396 | ||
|
|
82b53fb64d | ||
|
|
5b384a0122 | ||
|
|
bc4f4d0e66 | ||
|
|
ae2e9d9724 | ||
|
|
c32c4c0107 | ||
|
|
f7523c0eb3 | ||
|
|
b215e46196 | ||
|
|
d8391a90ea | ||
|
|
b6f9bd6a76 | ||
|
|
ad7289c88a | ||
|
|
c09157c407 | ||
|
|
211fa85c19 | ||
|
|
f38c17e98e | ||
|
|
09cb6935aa | ||
|
|
89f068e662 | ||
|
|
83e50fc5aa | ||
|
|
c108b842a0 | ||
|
|
8d7694383d | ||
|
|
39f286bdab | ||
|
|
e643722ef3 | ||
|
|
04cc772a4f | ||
|
|
a1e89e524f | ||
|
|
c1f51e8996 | ||
|
|
ddded8a3e6 | ||
|
|
c762c4440d | ||
|
|
8379a785cc | ||
|
|
4af80aa1d6 | ||
|
|
21537d0085 | ||
|
|
0bc42c62a6 | ||
|
|
dd0fe675a7 | ||
|
|
ffb0ba36d9 | ||
|
|
5a685bc829 | ||
|
|
4154632d63 | ||
|
|
f4740815db | ||
|
|
89dde05929 | ||
|
|
27ff6349dc | ||
|
|
4da58a8141 | ||
|
|
bbdf3eb2b9 | ||
|
|
f32a8093d4 | ||
|
|
8d09e0f5c0 | ||
|
|
22b3d7c435 | ||
|
|
cb2211e1ca | ||
|
|
2719e5195a | ||
|
|
300844e4d4 | ||
|
|
ea6f0bfaa5 | ||
|
|
7f8a529297 | ||
|
|
652b70a36e | ||
|
|
6bc5946661 | ||
|
|
9c2da990d2 | ||
|
|
30e0047809 | ||
|
|
103fb04a7d | ||
|
|
aa00004949 | ||
|
|
bcb78e2c19 | ||
|
|
11179b6808 | ||
|
|
c47c33e07b | ||
|
|
4aa925eada | ||
|
|
dba81f5b0c | ||
|
|
75a8c8a7d9 | ||
|
|
945553157c | ||
|
|
1ac71296d7 | ||
|
|
ab0b2e3781 | ||
|
|
a4464b608d | ||
|
|
db5b44e546 | ||
|
|
5e463f6474 | ||
|
|
e5b701a97b | ||
|
|
d26a201819 | ||
|
|
fd882cbfd9 | ||
|
|
e07ca873dc | ||
|
|
4d1b9e3893 | ||
|
|
7f543df20c | ||
|
|
48ca4ab772 | ||
|
|
19ad023fc5 | ||
|
|
ee1fd75150 | ||
|
|
bac3f1456e | ||
|
|
1058b5bca6 | ||
|
|
dfbc10f4ed | ||
|
|
9b887361d8 | ||
|
|
7c063806d9 | ||
|
|
11ec8c535f | ||
|
|
a531537984 | ||
|
|
3df3aac8ab | ||
|
|
aab1326516 | ||
|
|
7c1c273255 | ||
|
|
d39710160a | ||
|
|
fcb213bf4d | ||
|
|
0d33e2e70a | ||
|
|
1d8057e232 | ||
|
|
f072eb32b5 | ||
|
|
6018775741 | ||
|
|
eb8089616b | ||
|
|
13b1d8c274 | ||
|
|
e232b1ce12 | ||
|
|
e6ca98f91e | ||
|
|
f841d27d4d | ||
|
|
6d38a1b502 | ||
|
|
9bb9e989fa | ||
|
|
b4b9705c7d | ||
|
|
91bce664a5 | ||
|
|
91d04dfdf1 | ||
|
|
509964427a | ||
|
|
a896b9c5f7 | ||
|
|
395b026e6c | ||
|
|
4bf16344cd | ||
|
|
a8f2551c78 | ||
|
|
2c7af7a643 | ||
|
|
4027bef7b9 | ||
|
|
5cd282b15b | ||
|
|
fa13ef1969 | ||
|
|
6af88ed02f | ||
|
|
159c4ce8c2 | ||
|
|
c468459061 | ||
|
|
706bc0cf48 | ||
|
|
e32003f8a3 | ||
|
|
73c4ae748e | ||
|
|
01e8096e66 | ||
|
|
88ac6b6ee8 | ||
|
|
4cccaf6d47 | ||
|
|
bea3ccb116 | ||
|
|
ce20ec8f13 | ||
|
|
18b4e60bb0 | ||
|
|
f01daa2f78 | ||
|
|
4a6f669aa3 | ||
|
|
5685bbd272 | ||
|
|
62703330ac | ||
|
|
e01ee62c72 | ||
|
|
edf52ad4f3 | ||
|
|
9083d4db9b | ||
|
|
04553004af | ||
|
|
2081030449 | ||
|
|
a06f5a8407 | ||
|
|
4048d1bd90 | ||
|
|
d350a7c341 | ||
|
|
b9579718fa | ||
|
|
bf8b9a61b9 | ||
|
|
de36c12362 | ||
|
|
fc075ecaa5 | ||
|
|
2532210cdf | ||
|
|
0ff94be3b3 | ||
|
|
fe9fa4766a | ||
|
|
a2a8747be8 | ||
|
|
1762662419 | ||
|
|
36a00175f4 | ||
|
|
8a952334e4 | ||
|
|
2b71e9b3c2 | ||
|
|
bd42947f8b | ||
|
|
afd6889557 | ||
|
|
79399eb766 | ||
|
|
5d62c1c247 | ||
|
|
759e50bd5d | ||
|
|
f5cd4333fd | ||
|
|
e05aa5da67 | ||
|
|
5a762aa511 | ||
|
|
9699cf3ae4 | ||
|
|
e140649e4d | ||
|
|
aff21068b0 | ||
|
|
ff014ccf06 | ||
|
|
8b298d7c76 | ||
|
|
9bc8494bf8 | ||
|
|
af33db165f | ||
|
|
523336b059 | ||
|
|
73c4664a68 | ||
|
|
e83022c3fb | ||
|
|
d0f7e351aa | ||
|
|
f609f45fa1 | ||
|
|
2603c5272f | ||
|
|
f10cdb0a3d | ||
|
|
91ef5bbfa8 | ||
|
|
04716c817c | ||
|
|
c7a06d4f86 | ||
|
|
547cb0f734 | ||
|
|
63381dac25 | ||
|
|
1369a3c127 | ||
|
|
6f087fb2b8 | ||
|
|
d4eba69a74 | ||
|
|
e25fb26ef3 | ||
|
|
12012a517f | ||
|
|
db9f6d7ba0 | ||
|
|
c2025820f2 | ||
|
|
60f0ff4642 | ||
|
|
3a2eccbba1 | ||
|
|
4a601f8241 | ||
|
|
2cb55d3936 | ||
|
|
0a6a8c40a7 | ||
|
|
59fc55208b | ||
|
|
08ef5f804c | ||
|
|
78e4f86b2a | ||
|
|
5a5efcbbfb | ||
|
|
70279933fd | ||
|
|
8044d92c40 | ||
|
|
0177d4dbd4 | ||
|
|
55f7ed31f1 | ||
|
|
959196de99 | ||
|
|
7ffaf710b5 | ||
|
|
9af5adb861 | ||
|
|
f94d5f7423 | ||
|
|
659e66e3d1 | ||
|
|
77a7656b99 | ||
|
|
f46263a263 | ||
|
|
2e3d2d13b2 | ||
|
|
4f0acbd8da | ||
|
|
e53f0d0725 | ||
|
|
fe306a311e | ||
|
|
dc11fe85cb | ||
|
|
cd81878e92 | ||
|
|
d9dc76f197 | ||
|
|
52f9c358b7 | ||
|
|
6fc21b815d | ||
|
|
37a6c230ad | ||
|
|
9a9b4fca82 | ||
|
|
6c00653272 | ||
|
|
40c3dfa20b | ||
|
|
a3ce65c770 | ||
|
|
42af720b02 | ||
|
|
6d5e69ae04 | ||
|
|
e58d866949 | ||
|
|
00a9e93754 | ||
|
|
a3b7701bc0 | ||
|
|
e78aa66d57 | ||
|
|
068aeee87f | ||
|
|
2d34ac58ee | ||
|
|
b8a5c3369f | ||
|
|
f5f978a398 | ||
|
|
932d845922 | ||
|
|
d69d2be722 | ||
|
|
22e87836db | ||
|
|
6d10fab4f3 | ||
|
|
47567b003f | ||
|
|
96724cd26a | ||
|
|
de27dfacb6 | ||
|
|
e838f405a7 | ||
|
|
c9579a7b7c | ||
|
|
515285e3c9 | ||
|
|
eb685db693 | ||
|
|
e4ec9aec0b | ||
|
|
919e6d380c | ||
|
|
88f21d9aa4 | ||
|
|
07ad40cac0 | ||
|
|
382b73f6c5 | ||
|
|
67b0dfa868 | ||
|
|
f1ab110ae1 | ||
|
|
4bf7d7d58f | ||
|
|
9b09545379 | ||
|
|
86f11d08aa | ||
|
|
ec92bfa6b1 | ||
|
|
cd92308c41 | ||
|
|
57b7fc45b8 | ||
|
|
20cd756c88 | ||
|
|
cc5f21ab09 | ||
|
|
daa157cf49 | ||
|
|
a05b951018 | ||
|
|
c44f124616 | ||
|
|
20fccac2b7 | ||
|
|
8983584dd8 | ||
|
|
d06532d6f1 | ||
|
|
d291c6d31e | ||
|
|
2faff914f6 | ||
|
|
6c7efdd0f6 |
No files matched your search
@@ -0,0 +1,29 @@
|
||||
name: Setup Build Environment
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
|
||||
- name: Init Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cache/pip
|
||||
~/.platformio/.cache
|
||||
key: ${{ runner.os }}-pio
|
||||
|
||||
- name: Install Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install PlatformIO
|
||||
shell: bash
|
||||
run: |
|
||||
pip install --upgrade platformio
|
||||
|
||||
# a git tag of "room-server-v1.2.3" should set "v1.2.3" as GIT_TAG_VERSION
|
||||
- name: Extract Version from Git Tag
|
||||
shell: bash
|
||||
run: |
|
||||
GIT_TAG_NAME="${GITHUB_REF#refs/tags/}"
|
||||
echo "GIT_TAG_VERSION=${GIT_TAG_NAME##*-}" >> $GITHUB_ENV
|
||||
@@ -0,0 +1,42 @@
|
||||
name: Build Companion Firmwares
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
tags:
|
||||
- 'companion-*'
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Clone Repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Build Environment
|
||||
uses: ./.github/actions/setup-build-environment
|
||||
|
||||
- name: Build Firmwares
|
||||
env:
|
||||
FIRMWARE_VERSION: ${{ env.GIT_TAG_VERSION }}
|
||||
run: /usr/bin/env bash build.sh build-companion-firmwares
|
||||
|
||||
- name: Upload Workflow Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: companion-firmwares
|
||||
path: out
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
name: Companion Firmware ${{ env.GIT_TAG_VERSION }}
|
||||
body: ""
|
||||
draft: true
|
||||
files: out/*
|
||||
@@ -0,0 +1,42 @@
|
||||
name: Build Repeater Firmwares
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
tags:
|
||||
- 'repeater-*'
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Clone Repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Build Environment
|
||||
uses: ./.github/actions/setup-build-environment
|
||||
|
||||
- name: Build Firmwares
|
||||
env:
|
||||
FIRMWARE_VERSION: ${{ env.GIT_TAG_VERSION }}
|
||||
run: /usr/bin/env bash build.sh build-repeater-firmwares
|
||||
|
||||
- name: Upload Workflow Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: repeater-firmwares
|
||||
path: out
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
name: Repeater Firmware ${{ env.GIT_TAG_VERSION }}
|
||||
body: ""
|
||||
draft: true
|
||||
files: out/*
|
||||
@@ -0,0 +1,42 @@
|
||||
name: Build Room Server Firmwares
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
tags:
|
||||
- 'room-server-*'
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Clone Repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Build Environment
|
||||
uses: ./.github/actions/setup-build-environment
|
||||
|
||||
- name: Build Firmwares
|
||||
env:
|
||||
FIRMWARE_VERSION: ${{ env.GIT_TAG_VERSION }}
|
||||
run: /usr/bin/env bash build.sh build-room-server-firmwares
|
||||
|
||||
- name: Upload Workflow Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: room-server-firmwares
|
||||
path: out
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
name: Room Server Firmware ${{ env.GIT_TAG_VERSION }}
|
||||
body: ""
|
||||
draft: true
|
||||
files: out/*
|
||||
@@ -0,0 +1,6 @@
|
||||
.pio
|
||||
.vscode/.browse.c_cpp.db*
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/ipch
|
||||
out/
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
{
|
||||
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"platformio.platformio-ide"
|
||||
],
|
||||
"unwantedRecommendations": [
|
||||
"ms-vscode.cpptools-extension-pack"
|
||||
]
|
||||
}
|
||||
@@ -1,574 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<meta name="generator" content="mkdocs-1.6.1, mkdocs-terminal-4.8.0">
|
||||
|
||||
<meta name="description" content="MeshCore fork meshcore-tth -- repeater antispam, diagnostics, OTA, Czech mesh defaults">
|
||||
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="/meshcore-tth/img/android-chrome-192x192.png" />
|
||||
<link rel="icon" type="image/png" sizes="512x512" href="/meshcore-tth/img/android-chrome-512x512.png" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/meshcore-tth/img/apple-touch-icon.png" />
|
||||
<link rel="shortcut icon" type="image/png" sizes="48x48" href="/meshcore-tth/img/favicon.ico" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/meshcore-tth/img/favicon-16x16.png" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/meshcore-tth/img/favicon-32x32.png" />
|
||||
<title>404 - MeshCore TTH</title>
|
||||
|
||||
|
||||
|
||||
<link href="/meshcore-tth/css/fontawesome/css/fontawesome.min.css" rel="stylesheet">
|
||||
<link href="/meshcore-tth/css/fontawesome/css/solid.min.css" rel="stylesheet">
|
||||
<link href="/meshcore-tth/css/normalize.css" rel="stylesheet">
|
||||
<link href="/meshcore-tth/css/terminal.css" rel="stylesheet">
|
||||
<link href="/meshcore-tth/css/theme.css" rel="stylesheet">
|
||||
<link href="/meshcore-tth/css/theme.tile_grid.css" rel="stylesheet">
|
||||
<link href="/meshcore-tth/css/theme.footer.css" rel="stylesheet">
|
||||
<!-- dark color palette -->
|
||||
<link href="/meshcore-tth/css/palettes/dark.css" rel="stylesheet">
|
||||
|
||||
<!-- page layout -->
|
||||
<style>
|
||||
/* initially set page layout to a one column grid */
|
||||
.terminal-mkdocs-main-grid {
|
||||
display: grid;
|
||||
grid-column-gap: 1.4em;
|
||||
grid-template-columns: auto;
|
||||
grid-template-rows: auto;
|
||||
}
|
||||
|
||||
/*
|
||||
* when side navigation is not hidden, use a two column grid.
|
||||
* if the screen is too narrow, fall back to the initial one column grid layout.
|
||||
* in this case the main content will be placed under the navigation panel.
|
||||
*/
|
||||
@media only screen and (min-width: 70em) {
|
||||
.terminal-mkdocs-main-grid {
|
||||
grid-template-columns: 4fr 9fr;
|
||||
}
|
||||
}</style>
|
||||
|
||||
<!-- cursor_animation override -->
|
||||
<style>
|
||||
#mkdocs-terminal-site-name.terminal-prompt::after {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<link href="/meshcore-tth/_stylesheets/tth.css" rel="stylesheet">
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- search css support -->
|
||||
<link href="/meshcore-tth/css/search/bootstrap-modal.css" rel="stylesheet">
|
||||
<!-- search scripts -->
|
||||
<script>
|
||||
var base_url = "/meshcore-tth/",
|
||||
shortcuts = "{}";
|
||||
</script>
|
||||
<script src="/meshcore-tth/js/jquery/jquery-1.10.1.min.js" defer></script>
|
||||
<script src="/meshcore-tth/js/bootstrap/bootstrap.min.js" defer></script>
|
||||
<script src="/meshcore-tth/js/mkdocs/base.js" defer></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="/meshcore-tth/search/main.js"></script>
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body class="terminal"><div class="container">
|
||||
<div class="terminal-nav">
|
||||
<header class="terminal-logo">
|
||||
<div id="mkdocs-terminal-site-name" class="logo terminal-prompt"><a href="https://tth-pub.pages.rfa.cz/meshcore-tth/" class="no-style">MeshCore TTH</a></div>
|
||||
</header>
|
||||
|
||||
<nav class="terminal-menu">
|
||||
|
||||
<ul vocab="https://schema.org/" typeof="BreadcrumbList">
|
||||
|
||||
|
||||
<li property="itemListElement" typeof="ListItem">
|
||||
<a href="/meshcore-tth/." class="menu-item " property="item" typeof="WebPage">
|
||||
<span property="name">About the fork</span>
|
||||
</a>
|
||||
<meta property="position" content="0">
|
||||
</li>
|
||||
|
||||
|
||||
<li property="itemListElement" typeof="ListItem">
|
||||
<a href="/meshcore-tth/cs/" class="menu-item " property="item" typeof="WebPage">
|
||||
<span property="name">Česky</span>
|
||||
</a>
|
||||
<meta property="position" content="1">
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li property="itemListElement" typeof="ListItem">
|
||||
<a href="#" class="menu-item" data-toggle="modal" data-target="#mkdocs_search_modal" property="item" typeof="SearchAction">
|
||||
<i aria-hidden="true" class="fa fa-search"></i> <span property="name">Search</span>
|
||||
</a>
|
||||
<meta property="position" content="2">
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="terminal-mkdocs-main-grid"><aside id="terminal-mkdocs-side-panel"><nav>
|
||||
<ul class="terminal-mkdocs-side-nav-items">
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/.">About the fork</a>
|
||||
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/cs/">Česky</a>
|
||||
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="
|
||||
|
||||
|
||||
|
||||
terminal-mkdocs-side-nav-item terminal-mkdocs-side-nav-section-no-index">Fork meshcore-tth</span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="terminal-mkdocs-side-nav-li-ul">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/tth-commands/">Console commands</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/ota/">Firmware update by the admin (OTA)</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/power/">Power saving</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/budka-sensor/">Budka as a sensor</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/ble-lora-coexistence/">BLE/LoRa coexistence</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="
|
||||
|
||||
|
||||
|
||||
terminal-mkdocs-side-nav-item terminal-mkdocs-side-nav-section-no-index">MeshCore (upstream)</span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="terminal-mkdocs-side-nav-li-ul">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/meshcore/">Introduction</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/faq/">FAQ</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/cli_commands/">CLI commands</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/companion_cli/">Companion CLI</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/companion_protocol/">Companion protocol</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/terminal_chat_cli/">Terminal chat CLI</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/kiss_modem_protocol/">KISS modem protocol</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/packet_format/">Packet format</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/payloads/">Payloads</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/stats_binary_frames/">Stats binary frames</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/number_allocations/">Number allocations</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/qr_codes/">QR codes</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/radio_presets/">Radio presets</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/nrf52_power_management/">nRF52 power management</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</aside>
|
||||
<main id="terminal-mkdocs-main-content">
|
||||
<br>
|
||||
<div class="terminal-alert terminal-alert-error">The page you requested could not be found.</div>
|
||||
<a href="https://tth-pub.pages.rfa.cz/meshcore-tth/"><button class="btn btn-default">Return Home</button></a>
|
||||
|
||||
</main>
|
||||
</div>
|
||||
<hr><footer>
|
||||
<div class="terminal-mkdocs-footer-grid">
|
||||
<div id="terminal-mkdocs-footer-copyright-info">
|
||||
Site built with <a href="http://www.mkdocs.org">MkDocs</a> and <a href="https://github.com/ntno/mkdocs-terminal">Terminal for MkDocs</a>.
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal" id="mkdocs_search_modal" tabindex="-1" role="alertdialog" aria-modal="true" aria-labelledby="searchModalLabel">
|
||||
<div class="modal-dialog modal-lg" role="search">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="searchModalLabel">Search</h5>
|
||||
<button type="button" class="close btn btn-default btn-ghost" data-dismiss="modal" aria-label="Close">x</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p id="searchInputLabel">Type to start searching</p>
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<input type="search" class="form-control" aria-labelledby="searchInputLabel" placeholder="" id="mkdocs-search-query" title="Please enter search terms here">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results" data-no-results-text="No document matches found"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,76 @@
|
||||
## About MeshCore
|
||||
|
||||
MeshCore is a lightweight, portable C++ library that enables multi-hop packet routing for embedded projects using LoRa and other packet radios. It is designed for developers who want to create resilient, decentralized communication networks that work without the internet.
|
||||
|
||||
## 🔍 What is MeshCore?
|
||||
|
||||
MeshCore now supports a range of LoRa devices, allowing for easy flashing without the need to compile firmware manually. Users can flash a pre-built binary using tools like Adafruit ESPTool and interact with the network through a serial console.
|
||||
MeshCore provides the ability to create wireless mesh networks, similar to Meshtastic and Reticulum but with a focus on lightweight multi-hop packet routing for embedded projects. Unlike Meshtastic, which is tailored for casual LoRa communication, or Reticulum, which offers advanced networking, MeshCore balances simplicity with scalability, making it ideal for custom embedded solutions., where devices (nodes) can communicate over long distances by relaying messages through intermediate nodes. This is especially useful in off-grid, emergency, or tactical situations where traditional communication infrastructure is unavailable.
|
||||
|
||||
## ⚡ Key Features
|
||||
|
||||
* Multi-Hop Packet Routing – Devices can forward messages across multiple nodes, extending range beyond a single radio's reach. MeshCore supports up to a configurable number of hops to balance network efficiency and prevent excessive traffic.
|
||||
* Supports LoRa Radios – Works with Heltec, RAK Wireless, and other LoRa-based hardware.
|
||||
* Decentralized & Resilient – No central server or internet required; the network is self-healing.
|
||||
* Low Power Consumption – Ideal for battery-powered or solar-powered devices.
|
||||
* Simple to Deploy – Pre-built example applications make it easy to get started.
|
||||
|
||||
## 🎯 What Can You Use MeshCore For?
|
||||
|
||||
* Off-Grid Communication: Stay connected even in remote areas.
|
||||
* Emergency Response & Disaster Recovery: Set up instant networks where infrastructure is down.
|
||||
* Outdoor Activities: Hiking, camping, and adventure racing communication.
|
||||
* Tactical & Security Applications: Military, law enforcement, and private security use cases.
|
||||
* IoT & Sensor Networks: Collect data from remote sensors and relay it back to a central location.
|
||||
|
||||
## 🚀 How to Get Started
|
||||
|
||||
Andy Kirby has published a very useful [intro video](https://www.youtube.com/watch?v=t1qne8uJBAc) which explains the steps for beginners.
|
||||
|
||||
For developers, install [PlatformIO](https://docs.platformio.org) in Visual Studio Code.
|
||||
Download & Open the MeshCore repository.
|
||||
Select a Sample Application: Choose from chat, repeater, other example app.
|
||||
Monitor & Communicate using the Serial Monitor (e.g., Serial USB Terminal on Android).
|
||||
|
||||
📁 Included Example Applications
|
||||
* 📡 Terminal Chat: Secure text communication between devices.
|
||||
* 📡 Simple Repeater: Extends network coverage by relaying messages.
|
||||
* 📡 Companion Radio: For use with an external chat app, over BLE or USB.
|
||||
* 📡 Room Server: A simple BBS server for shared Posts.
|
||||
|
||||
## 🛠 Hardware Compatibility
|
||||
|
||||
MeshCore is designed for use with:
|
||||
* Heltec V3 LoRa Boards
|
||||
* RAK4631
|
||||
* XiaoS3 WIO (sx1262 combo)
|
||||
* XiaoC3 (plus external sx126x module)
|
||||
* LilyGo T3S3
|
||||
* Heltec T114
|
||||
* Station G2
|
||||
* Sensecap T1000e
|
||||
* Heltec V2
|
||||
* LilyGo TLora32 v1.6
|
||||
|
||||
## 📜 License
|
||||
MeshCore is open-source software released under the MIT License. You are free to use, modify, and distribute it for personal and commercial projects.
|
||||
|
||||
## Contributing
|
||||
|
||||
Please submit PR's using 'dev' as the base branch!
|
||||
For minor changes just submit your PR and I'll try to review it, but for anything more 'impactful' please open an Issue first and start a discussion. Is better to sound out what it is you want to achieve first, and try to come to a consensus on what the best approach is, especially when it impacts the structure or architecture of this codebase.
|
||||
|
||||
## 📞 Get Support
|
||||
|
||||
Check out the GitHub Issues page to report bugs or request features.
|
||||
|
||||
You will be able to find additional guides and components at [my site](https://buymeacoffee.com/ripplebiz), or [join Andy Kirby's Discord](https://discord.gg/GBxVx2JMAy) for discussions.
|
||||
|
||||
## RAK Wireless Board Support in PlatformIO
|
||||
|
||||
Before building/flashing the RAK4631 targets in this project, there is, unfortunately, some patching you have to do to your platformIO packages to make it work. There is a guide here on the process:
|
||||
[RAK Wireless: How to Perform Installation of Board Support Package in PlatformIO](https://learn.rakwireless.com/hc/en-us/articles/26687276346775-How-To-Perform-Installation-of-Board-Support-Package-in-PlatformIO)
|
||||
|
||||
After building, you will need to convert the output firmware.hex file into a .uf2 file you can copy over to your RAK4631 device (after doing a full erase) by using the command `uf2conv.py -f 0xADA52840 -c firmware.hex` with the python script available from:
|
||||
[GitHub: Microsoft - uf2](https://github.com/Microsoft/uf2/blob/master/utils/uf2conv.py)
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
# Releasing Firmware
|
||||
|
||||
GitHub Actions is set up to automatically build and release firmware.
|
||||
|
||||
It will automatically build firmware when one of the following tag formats are pushed.
|
||||
|
||||
- `companion-v1.0.0`
|
||||
- `repeater-v1.0.0`
|
||||
- `room-server-v1.0.0`
|
||||
|
||||
> NOTE: replace `v1.0.0` with the version you want to release as.
|
||||
|
||||
- You can push one, or more tags on the same commit, and they will all build separately.
|
||||
- Once the firmware has been built, a new (draft) GitHub Release will be created.
|
||||
- You will need to update the release notes, and publish it.
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="100%" height="100%" viewBox="0 0 134 15" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||
<path d="M3.277,0.053C2.829,0.053 2.401,0.41 2.321,0.851L0.013,13.623C-0.067,14.064 0.232,14.421 0.681,14.421L3.13,14.421C3.578,14.421 4.006,14.064 4.086,13.623L5.004,8.54L6.684,13.957C6.766,14.239 7.02,14.421 7.337,14.421L10.58,14.421C10.897,14.421 11.217,14.239 11.401,13.957L15.043,8.513L14.119,13.623C14.038,14.064 14.338,14.421 14.787,14.421L17.236,14.421C17.684,14.421 18.112,14.064 18.192,13.623L20.5,0.851C20.582,0.41 20.283,0.053 19.834,0.053L16.69,0.053C16.373,0.053 16.053,0.235 15.87,0.517L9.897,9.473C9.803,9.616 9.578,9.578 9.528,9.41L7.074,0.517C6.992,0.235 6.738,0.053 6.421,0.053L3.277,0.053Z" style="fill:white;fill-rule:nonzero;"/>
|
||||
<path d="M21.146,14.421C21.146,14.421 33.257,14.421 33.257,14.421C33.526,14.421 33.784,14.205 33.831,13.942L34.337,11.128C34.385,10.863 34.206,10.649 33.936,10.649L25.519,10.649C25.429,10.649 25.37,10.576 25.385,10.488L25.635,9.105C25.65,9.017 25.736,8.944 25.826,8.944L32.596,8.944C32.865,8.944 33.123,8.728 33.171,8.465L33.621,5.974C33.669,5.709 33.49,5.495 33.221,5.495L26.45,5.495C26.361,5.495 26.301,5.423 26.317,5.335L26.584,3.852C26.599,3.764 26.685,3.691 26.775,3.691L35.192,3.691C35.462,3.691 35.719,3.476 35.767,3.21L36.258,0.498C36.306,0.235 36.126,0.019 35.857,0.019L23.746,0.019C23.297,0.019 22.867,0.378 22.788,0.819L20.474,13.621C20.396,14.062 20.695,14.421 21.146,14.421Z" style="fill:white;fill-rule:nonzero;"/>
|
||||
<path d="M45.926,14.419L45.926,14.421L46.346,14.421C48.453,14.421 50.465,12.742 50.839,10.67L51.081,9.327C51.456,7.256 50.05,5.576 47.943,5.576L41.455,5.576C41.186,5.576 41.007,5.363 41.054,5.097L41.218,4.192C41.266,3.927 41.524,3.713 41.793,3.713L50.569,3.713C51.018,3.713 51.446,3.356 51.526,2.915L51.9,0.85C51.98,0.407 51.68,0.05 51.232,0.05L41.638,0.05C39.531,0.05 37.519,1.73 37.145,3.801L36.88,5.267C36.505,7.339 37.91,9.018 40.018,9.018L46.506,9.018C46.775,9.018 46.954,9.231 46.907,9.497L46.785,10.176C46.737,10.441 46.479,10.655 46.21,10.655L37.189,10.655C36.741,10.655 36.313,11.012 36.233,11.453L35.841,13.621C35.761,14.062 36.061,14.419 36.51,14.419L45.926,14.419Z" style="fill:white;fill-rule:nonzero;"/>
|
||||
<path d="M68.008,0.046C68.008,0.046 65.296,0.046 65.296,0.046C64.847,0.046 64.42,0.403 64.34,0.844L63.532,5.31C63.517,5.398 63.431,5.469 63.341,5.469L58.085,5.469C57.995,5.469 57.936,5.398 57.951,5.31L58.758,0.844C58.837,0.403 58.539,0.046 58.09,0.046L55.378,0.046C54.93,0.046 54.502,0.403 54.422,0.844L52.112,13.623C52.032,14.064 52.331,14.421 52.78,14.421L55.492,14.421C55.941,14.421 56.369,14.064 56.449,13.623L57.272,9.074C57.287,8.986 57.373,8.914 57.462,8.914L62.719,8.914C62.809,8.914 62.868,8.985 62.853,9.074L62.032,13.623C61.952,14.064 62.252,14.421 62.7,14.421L65.413,14.421C65.861,14.421 66.289,14.064 66.369,13.623L68.678,0.844C68.755,0.403 68.457,0.046 68.008,0.046Z" style="fill:white;fill-rule:nonzero;"/>
|
||||
<path d="M72.099,14.421C72.099,14.421 80.066,14.421 80.066,14.421C80.515,14.421 80.943,14.064 81.022,13.623L81.414,11.453C81.494,11.012 81.194,10.655 80.746,10.655L73.828,10.655C73.559,10.655 73.38,10.441 73.427,10.176L74.51,4.215C74.558,3.951 74.815,3.736 75.082,3.736L82,3.736C82.448,3.736 82.876,3.379 82.956,2.938L83.34,0.817C83.42,0.376 83.12,0.019 82.672,0.019L74.724,0.019C72.622,0.019 70.614,1.691 70.236,3.757L68.965,10.665C68.587,12.738 69.99,14.421 72.099,14.421Z" style="fill:white;fill-rule:nonzero;"/>
|
||||
<path d="M97.176,-0C97.176,0 88.882,0 88.882,0C86.775,0 84.763,1.68 84.389,3.751L83.139,10.67C82.765,12.741 84.169,14.421 86.277,14.421L94.571,14.421C96.678,14.421 98.69,12.741 99.064,10.67L100.314,3.751C100.689,1.68 99.284,-0 97.176,-0ZM94.798,10.178C94.75,10.443 94.492,10.657 94.223,10.657L87.978,10.657C87.709,10.657 87.529,10.443 87.577,10.178L88.659,4.192C88.707,3.927 88.964,3.713 89.234,3.713L95.477,3.713C95.747,3.713 95.926,3.927 95.878,4.192L94.798,10.178Z" style="fill:white;fill-rule:nonzero;"/>
|
||||
<path d="M101.284,14.421L103.995,14.421C104.443,14.421 104.871,14.065 104.951,13.624L105.43,10.97C105.446,10.882 105.531,10.81 105.621,10.81L108.902,10.806C109.064,10.806 109.2,10.886 109.267,11.018L110.813,14.035C110.992,14.392 111.319,14.434 112.303,14.419C112.88,14.426 113.756,14.382 115.169,14.382C115.623,14.382 115.902,13.907 115.678,13.51L113.989,10.569C113.945,10.491 113.993,10.386 114.086,10.34C115.39,9.707 116.423,8.477 116.681,7.055L117.27,3.785C117.646,1.713 116.242,0.033 114.134,0.033L103.884,0.033C103.436,0.033 103.008,0.39 102.928,0.831L100.616,13.623C100.536,14.064 100.836,14.421 101.284,14.421L101.284,14.421ZM106.73,3.791C106.745,3.703 106.831,3.631 106.921,3.631L112.225,3.631C112.626,3.631 112.891,3.949 112.821,4.343L112.431,6.494C112.359,6.885 111.979,7.204 111.58,7.204L106.276,7.204C106.186,7.204 106.127,7.133 106.142,7.043L106.73,3.791Z" style="fill:white;fill-rule:nonzero;"/>
|
||||
<path d="M118.277,14.421C118.277,14.421 130.388,14.421 130.388,14.421C130.657,14.421 130.915,14.205 130.963,13.942L131.468,11.128C131.516,10.863 131.337,10.649 131.068,10.649L122.65,10.649C122.56,10.649 122.501,10.576 122.516,10.488L122.766,9.105C122.781,9.017 122.867,8.944 122.957,8.944L129.728,8.944C129.997,8.944 130.254,8.728 130.302,8.465L130.753,5.974C130.801,5.709 130.621,5.495 130.352,5.495L123.581,5.495C123.492,5.495 123.432,5.423 123.448,5.335L123.715,3.852C123.73,3.764 123.816,3.691 123.906,3.691L132.324,3.691C132.593,3.691 132.851,3.476 132.898,3.21L133.389,0.498C133.437,0.235 133.257,0.019 132.988,0.019L120.877,0.019C120.428,0.019 119.999,0.378 119.919,0.819L117.605,13.621C117.527,14.062 117.827,14.421 118.277,14.421Z" style="fill:white;fill-rule:nonzero;"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 5.9 KiB |
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="100%" height="100%" viewBox="0 0 139 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||
<path d="M3.232,3.582C2.789,3.582 2.368,3.934 2.289,4.369L0.013,16.964C-0.066,17.399 0.229,17.751 0.671,17.751L3.087,17.751C3.529,17.751 3.951,17.399 4.03,16.964L4.935,11.951L6.592,17.293C6.672,17.572 6.923,17.751 7.235,17.751L10.434,17.751C10.746,17.751 11.062,17.572 11.243,17.293L14.835,11.925L13.924,16.964C13.844,17.399 14.14,17.751 14.583,17.751L16.998,17.751C17.44,17.751 17.862,17.399 17.941,16.964L20.217,4.369C20.298,3.934 20.002,3.582 19.56,3.582L16.46,3.582C16.147,3.582 15.831,3.761 15.65,4.04L9.76,12.872C9.668,13.013 9.446,12.975 9.397,12.81L6.976,4.04C6.895,3.761 6.645,3.582 6.332,3.582L3.232,3.582Z" style="fill:white;fill-rule:nonzero;"/>
|
||||
<path d="M20.853,17.751C20.853,17.751 32.797,17.751 32.797,17.751C33.063,17.751 33.317,17.538 33.364,17.278L33.863,14.504C33.91,14.242 33.733,14.031 33.467,14.031L25.166,14.031C25.077,14.031 25.019,13.96 25.034,13.873L25.281,12.508C25.296,12.421 25.38,12.35 25.469,12.35L32.146,12.35C32.411,12.35 32.665,12.137 32.712,11.877L33.157,9.421C33.204,9.159 33.027,8.949 32.761,8.949L26.085,8.949C25.996,8.949 25.938,8.877 25.953,8.79L26.216,7.328C26.232,7.241 26.316,7.17 26.405,7.17L34.706,7.17C34.971,7.17 35.226,6.957 35.272,6.695L35.756,4.021C35.804,3.761 35.627,3.548 35.361,3.548L23.417,3.548C22.975,3.548 22.551,3.902 22.473,4.337L20.191,16.962C20.114,17.397 20.409,17.751 20.853,17.751Z" style="fill:white;fill-rule:nonzero;"/>
|
||||
<path d="M45.291,17.749L45.291,17.751L45.705,17.751C47.783,17.751 49.767,16.095 50.136,14.052L50.375,12.727C50.744,10.685 49.359,9.029 47.28,9.029L40.882,9.029C40.617,9.029 40.44,8.818 40.487,8.556L40.649,7.664C40.696,7.402 40.95,7.191 41.215,7.191L49.87,7.191C50.313,7.191 50.735,6.839 50.814,6.404L51.183,4.368C51.262,3.931 50.966,3.579 50.523,3.579L41.063,3.579C38.985,3.579 37,5.235 36.631,7.278L36.37,8.723C36.001,10.767 37.386,12.422 39.465,12.422L45.863,12.422C46.128,12.422 46.305,12.633 46.258,12.895L46.138,13.565C46.091,13.826 45.837,14.037 45.571,14.037L36.675,14.037C36.233,14.037 35.811,14.389 35.732,14.824L35.346,16.962C35.267,17.397 35.562,17.749 36.005,17.749L45.291,17.749Z" style="fill:white;fill-rule:nonzero;"/>
|
||||
<path d="M67.068,3.575C67.068,3.575 64.393,3.575 64.393,3.575C63.951,3.575 63.529,3.927 63.45,4.361L62.654,8.766C62.639,8.853 62.554,8.923 62.466,8.923L57.282,8.923C57.193,8.923 57.135,8.853 57.15,8.766L57.946,4.361C58.023,3.927 57.73,3.575 57.287,3.575L54.613,3.575C54.17,3.575 53.748,3.927 53.669,4.361L51.392,16.964C51.313,17.399 51.608,17.751 52.05,17.751L54.725,17.751C55.168,17.751 55.589,17.399 55.668,16.964L56.48,12.478C56.495,12.392 56.58,12.32 56.668,12.32L61.852,12.32C61.941,12.32 61.999,12.39 61.984,12.478L61.174,16.964C61.096,17.399 61.391,17.751 61.834,17.751L64.508,17.751C64.951,17.751 65.372,17.399 65.451,16.964L67.729,4.361C67.804,3.927 67.511,3.575 67.068,3.575Z" style="fill:white;fill-rule:nonzero;"/>
|
||||
<path d="M71.102,17.751C71.102,17.751 78.96,17.751 78.96,17.751C79.402,17.751 79.824,17.399 79.903,16.964L80.288,14.824C80.367,14.389 80.072,14.037 79.629,14.037L72.808,14.037C72.542,14.037 72.365,13.826 72.412,13.565L73.48,7.686C73.527,7.426 73.781,7.213 74.045,7.213L80.866,7.213C81.309,7.213 81.73,6.861 81.81,6.427L82.188,4.335C82.267,3.9 81.971,3.548 81.529,3.548L73.691,3.548C71.618,3.548 69.638,5.197 69.265,7.234L68.011,14.046C67.639,16.091 69.022,17.751 71.102,17.751Z" style="fill:white;fill-rule:nonzero;"/>
|
||||
<path d="M95.833,3.529C95.833,3.529 87.654,3.529 87.654,3.529C85.576,3.529 83.592,5.186 83.223,7.228L81.99,14.052C81.621,16.094 83.006,17.751 85.084,17.751L93.263,17.751C95.341,17.751 97.326,16.095 97.695,14.052L98.928,7.228C99.297,5.186 97.911,3.529 95.833,3.529ZM93.488,13.567C93.44,13.828 93.186,14.039 92.921,14.039L86.762,14.039C86.496,14.039 86.319,13.828 86.366,13.567L87.434,7.663C87.481,7.402 87.735,7.191 88,7.191L94.157,7.191C94.423,7.191 94.6,7.402 94.553,7.663L93.488,13.567Z" style="fill:white;fill-rule:nonzero;"/>
|
||||
<path d="M99.884,17.751L102.557,17.751C102.999,17.751 103.421,17.399 103.5,16.965L103.973,14.348C103.988,14.261 104.073,14.19 104.161,14.19L107.397,14.186C107.557,14.186 107.69,14.265 107.756,14.395L109.281,17.37C109.458,17.722 109.78,17.764 110.751,17.749C111.32,17.756 112.184,17.713 113.577,17.713C114.025,17.713 114.3,17.244 114.079,16.853L112.413,13.953C112.37,13.876 112.417,13.772 112.509,13.727C113.795,13.102 114.814,11.889 115.068,10.487L115.649,7.262C116.02,5.218 114.635,3.562 112.557,3.562L102.448,3.562C102.006,3.562 101.584,3.914 101.505,4.349L99.225,16.964C99.146,17.399 99.442,17.751 99.884,17.751L99.884,17.751ZM105.255,7.268C105.27,7.181 105.354,7.11 105.443,7.11L110.674,7.11C111.069,7.11 111.331,7.424 111.261,7.812L110.877,9.933C110.806,10.319 110.431,10.634 110.038,10.634L104.806,10.634C104.718,10.634 104.66,10.564 104.675,10.475L105.255,7.268Z" style="fill:white;fill-rule:nonzero;"/>
|
||||
<path d="M116.642,17.751C116.642,17.751 128.586,17.751 128.586,17.751C128.851,17.751 129.105,17.538 129.152,17.278L129.651,14.504C129.698,14.242 129.521,14.031 129.256,14.031L120.955,14.031C120.866,14.031 120.808,13.96 120.823,13.873L121.069,12.508C121.084,12.421 121.169,12.35 121.257,12.35L127.934,12.35C128.2,12.35 128.454,12.137 128.501,11.877L128.945,9.421C128.992,9.159 128.815,8.949 128.55,8.949L121.873,8.949C121.785,8.949 121.726,8.877 121.741,8.79L122.005,7.328C122.02,7.241 122.105,7.17 122.193,7.17L130.495,7.17C130.76,7.17 131.014,6.957 131.061,6.695L131.545,4.021C131.592,3.761 131.415,3.548 131.15,3.548L119.206,3.548C118.763,3.548 118.34,3.902 118.261,4.337L115.98,16.962C115.902,17.397 116.198,17.751 116.642,17.751Z" style="fill:white;fill-rule:nonzero;"/>
|
||||
<path d="M134.674,0C134.674,0 132.059,0 132.059,0C131.965,0 131.877,0.074 131.86,0.166L131.783,0.594C131.766,0.686 131.828,0.76 131.921,0.76L132.745,0.76C132.764,0.76 132.776,0.775 132.773,0.793L132.406,2.819C132.39,2.91 132.452,2.984 132.545,2.984L133.108,2.984C133.201,2.984 133.29,2.91 133.307,2.819L133.673,0.793C133.676,0.775 133.694,0.76 133.713,0.76L134.536,0.76C134.629,0.76 134.718,0.686 134.735,0.594L134.812,0.166C134.828,0.074 134.767,0 134.674,0Z" style="fill:white;fill-rule:nonzero;"/>
|
||||
<path d="M135.278,0.002C135.185,0.002 135.096,0.076 135.079,0.167L134.6,2.819C134.583,2.91 134.646,2.984 134.739,2.984L135.247,2.984C135.34,2.984 135.429,2.91 135.446,2.819L135.636,1.763L135.985,2.888C136.002,2.947 136.055,2.984 136.121,2.984L136.794,2.984C136.86,2.984 136.926,2.947 136.964,2.888L137.72,1.758L137.528,2.819C137.512,2.91 137.574,2.984 137.667,2.984L138.176,2.984C138.269,2.984 138.358,2.91 138.374,2.819L138.853,0.167C138.87,0.076 138.808,0.002 138.715,0.002L138.062,0.002C137.997,0.002 137.93,0.039 137.892,0.098L136.652,1.957C136.633,1.987 136.586,1.979 136.575,1.944L136.066,0.098C136.049,0.039 135.996,0.002 135.93,0.002L135.278,0.002Z" style="fill:white;fill-rule:nonzero;"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 7.1 KiB |
@@ -1,16 +0,0 @@
|
||||
:root {
|
||||
--md-primary-fg-color: #1F2937;
|
||||
--md-primary-fg-color--light: #1F2937;
|
||||
--md-primary-fg-color--dark: #1F2937;
|
||||
--md-accent-fg-color: #1F2937;
|
||||
}
|
||||
|
||||
/* hide git repo version */
|
||||
.md-source__fact--version {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* underline links */
|
||||
.md-typeset a {
|
||||
text-decoration: underline;
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/* Docs site of the meshcore-tth fork (mkdocs.tth.yml, theme mkdocs-terminal,
|
||||
palette "dark"): only what the palette lacks. Green instead of its blue,
|
||||
and the GitHub callouts (> [!WARNING]) the theme does not style. */
|
||||
:root {
|
||||
--primary-color: #5fd38d;
|
||||
--progress-bar-fill: #5fd38d;
|
||||
/* plain black; the palette's 60em column was a thin noodle on a wide
|
||||
screen (user, 2. 12. 2026) */
|
||||
--background-color: #000;
|
||||
--invert-font-color: #000;
|
||||
--code-bg-color: #161616;
|
||||
--page-width: min(110em, 94vw);
|
||||
}
|
||||
|
||||
.admonition {
|
||||
border: 1px solid var(--secondary-color);
|
||||
padding: 0.2em 1em;
|
||||
margin: var(--global-line-height) 0;
|
||||
}
|
||||
.admonition-title {
|
||||
font-weight: bold;
|
||||
margin: 0.4em 0 0;
|
||||
}
|
||||
.admonition.warning, .admonition.caution, .admonition.danger {
|
||||
border-color: #e5a50a;
|
||||
}
|
||||
.admonition.warning > .admonition-title,
|
||||
.admonition.caution > .admonition-title,
|
||||
.admonition.danger > .admonition-title {
|
||||
color: #e5a50a;
|
||||
}
|
||||
.admonition.note > .admonition-title,
|
||||
.admonition.tip > .admonition-title,
|
||||
.admonition.important > .admonition-title {
|
||||
color: var(--primary-color);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Ayush Sharma
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,2 @@
|
||||
AsyncElegantOTA KEYWORD1
|
||||
begin KEYWORD2
|
||||
@@ -0,0 +1,9 @@
|
||||
name=AsyncElegantOTA
|
||||
version=2.2.8
|
||||
author=Ayush Sharma
|
||||
category=Communication
|
||||
maintainer=Ayush Sharma <asrocks5@gmail.com>
|
||||
sentence=Perform OTAs for ESP8266 & ESP32 Asynchronously.
|
||||
paragraph=A User Interface Library which provides interactive elements for your Over the Air Updates on ESP8266/ESP32.
|
||||
url=https://github.com/ayushsharma82/AsyncElegantOTA
|
||||
architectures=esp8266,esp32
|
||||
@@ -0,0 +1,129 @@
|
||||
#include <AsyncElegantOTA.h>
|
||||
|
||||
AsyncElegantOtaClass AsyncElegantOTA;
|
||||
|
||||
void AsyncElegantOtaClass::setID(const char* id){
|
||||
_id = id;
|
||||
}
|
||||
|
||||
void AsyncElegantOtaClass::begin(AsyncWebServer *server, const char* username, const char* password){
|
||||
_server = server;
|
||||
|
||||
if(strlen(username) > 0){
|
||||
_authRequired = true;
|
||||
_username = username;
|
||||
_password = password;
|
||||
}else{
|
||||
_authRequired = false;
|
||||
_username = "";
|
||||
_password = "";
|
||||
}
|
||||
|
||||
_server->on("/update/identity", HTTP_GET, [&](AsyncWebServerRequest *request){
|
||||
if(_authRequired){
|
||||
if(!request->authenticate(_username.c_str(), _password.c_str())){
|
||||
return request->requestAuthentication();
|
||||
}
|
||||
}
|
||||
#if defined(ESP8266)
|
||||
request->send(200, "application/json", "{\"id\": \""+_id+"\", \"hardware\": \"ESP8266\"}");
|
||||
#elif defined(ESP32)
|
||||
request->send(200, "application/json", "{\"id\": \""+_id+"\", \"hardware\": \"ESP32\"}");
|
||||
#endif
|
||||
});
|
||||
|
||||
_server->on("/update", HTTP_GET, [&](AsyncWebServerRequest *request){
|
||||
if(_authRequired){
|
||||
if(!request->authenticate(_username.c_str(), _password.c_str())){
|
||||
return request->requestAuthentication();
|
||||
}
|
||||
}
|
||||
AsyncWebServerResponse *response = request->beginResponse_P(200, "text/html", ELEGANT_HTML, ELEGANT_HTML_SIZE);
|
||||
response->addHeader("Content-Encoding", "gzip");
|
||||
request->send(response);
|
||||
});
|
||||
|
||||
_server->on("/update", HTTP_POST, [&](AsyncWebServerRequest *request) {
|
||||
if(_authRequired){
|
||||
if(!request->authenticate(_username.c_str(), _password.c_str())){
|
||||
return request->requestAuthentication();
|
||||
}
|
||||
}
|
||||
// the request handler is triggered after the upload has finished...
|
||||
// create the response, add header, and send response
|
||||
AsyncWebServerResponse *response = request->beginResponse((Update.hasError())?500:200, "text/plain", (Update.hasError())?"FAIL":"OK");
|
||||
response->addHeader("Connection", "close");
|
||||
response->addHeader("Access-Control-Allow-Origin", "*");
|
||||
request->send(response);
|
||||
restart();
|
||||
}, [&](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final) {
|
||||
//Upload handler chunks in data
|
||||
if(_authRequired){
|
||||
if(!request->authenticate(_username.c_str(), _password.c_str())){
|
||||
return request->requestAuthentication();
|
||||
}
|
||||
}
|
||||
|
||||
if (!index) {
|
||||
if(!request->hasParam("MD5", true)) {
|
||||
return request->send(400, "text/plain", "MD5 parameter missing");
|
||||
}
|
||||
|
||||
if(!Update.setMD5(request->getParam("MD5", true)->value().c_str())) {
|
||||
return request->send(400, "text/plain", "MD5 parameter invalid");
|
||||
}
|
||||
|
||||
#if defined(ESP8266)
|
||||
int cmd = (filename == "filesystem") ? U_FS : U_FLASH;
|
||||
Update.runAsync(true);
|
||||
size_t fsSize = ((size_t) &_FS_end - (size_t) &_FS_start);
|
||||
uint32_t maxSketchSpace = (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000;
|
||||
if (!Update.begin((cmd == U_FS)?fsSize:maxSketchSpace, cmd)){ // Start with max available size
|
||||
#elif defined(ESP32)
|
||||
int cmd = (filename == "filesystem") ? U_SPIFFS : U_FLASH;
|
||||
if (!Update.begin(UPDATE_SIZE_UNKNOWN, cmd)) { // Start with max available size
|
||||
#endif
|
||||
Update.printError(Serial);
|
||||
return request->send(400, "text/plain", "OTA could not begin");
|
||||
}
|
||||
}
|
||||
|
||||
// Write chunked data to the free sketch space
|
||||
if(len){
|
||||
if (Update.write(data, len) != len) {
|
||||
return request->send(400, "text/plain", "OTA could not begin");
|
||||
}
|
||||
}
|
||||
|
||||
if (final) { // if the final flag is set then this is the last frame of data
|
||||
if (!Update.end(true)) { //true to set the size to the current progress
|
||||
Update.printError(Serial);
|
||||
return request->send(400, "text/plain", "Could not end OTA");
|
||||
}
|
||||
}else{
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// deprecated, keeping for backward compatibility
|
||||
void AsyncElegantOtaClass::loop() {
|
||||
}
|
||||
|
||||
void AsyncElegantOtaClass::restart() {
|
||||
yield();
|
||||
delay(1000);
|
||||
yield();
|
||||
ESP.restart();
|
||||
}
|
||||
|
||||
String AsyncElegantOtaClass::getID(){
|
||||
String id = "";
|
||||
#if defined(ESP8266)
|
||||
id = String(ESP.getChipId());
|
||||
#elif defined(ESP32)
|
||||
id = String((uint32_t)ESP.getEfuseMac(), HEX);
|
||||
#endif
|
||||
id.toUpperCase();
|
||||
return id;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
#ifndef AsyncElegantOTA_h
|
||||
#define AsyncElegantOTA_h
|
||||
|
||||
#warning AsyncElegantOTA library is deprecated, Please consider moving to newer ElegantOTA library which now comes with an Async Mode. Learn More: https://docs.elegantota.pro/async-mode/
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "stdlib_noniso.h"
|
||||
|
||||
#if defined(ESP8266)
|
||||
#include "ESP8266WiFi.h"
|
||||
#include "ESPAsyncTCP.h"
|
||||
#include "flash_hal.h"
|
||||
#include "FS.h"
|
||||
#elif defined(ESP32)
|
||||
#include "WiFi.h"
|
||||
#include "AsyncTCP.h"
|
||||
#include "Update.h"
|
||||
#include "esp_int_wdt.h"
|
||||
#include "esp_task_wdt.h"
|
||||
#endif
|
||||
|
||||
#include "Hash.h"
|
||||
#include "ESPAsyncWebServer.h"
|
||||
#include "FS.h"
|
||||
|
||||
#include "elegantWebpage.h"
|
||||
|
||||
|
||||
class AsyncElegantOtaClass{
|
||||
|
||||
public:
|
||||
void
|
||||
setID(const char* id),
|
||||
begin(AsyncWebServer *server, const char* username = "", const char* password = ""),
|
||||
loop(),
|
||||
restart();
|
||||
|
||||
private:
|
||||
AsyncWebServer *_server;
|
||||
|
||||
String getID();
|
||||
|
||||
String _id = getID();
|
||||
String _username = "";
|
||||
String _password = "";
|
||||
bool _authRequired = false;
|
||||
|
||||
};
|
||||
|
||||
extern AsyncElegantOtaClass AsyncElegantOTA;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @file Hash.h
|
||||
* @date 20.05.2015
|
||||
* @author Markus Sattler
|
||||
*
|
||||
* Copyright (c) 2015 Markus Sattler. All rights reserved.
|
||||
* This file is part of the esp8266 core for Arduino environment.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HASH_H_
|
||||
#define HASH_H_
|
||||
|
||||
//#define DEBUG_SHA1
|
||||
|
||||
void sha1(const uint8_t* data, uint32_t size, uint8_t hash[20]);
|
||||
void sha1(const char* data, uint32_t size, uint8_t hash[20]);
|
||||
void sha1(const String& data, uint8_t hash[20]);
|
||||
|
||||
String sha1(const uint8_t* data, uint32_t size);
|
||||
String sha1(const char* data, uint32_t size);
|
||||
String sha1(const String& data);
|
||||
|
||||
#endif /* HASH_H_ */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,361 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import struct
|
||||
import subprocess
|
||||
import re
|
||||
import os
|
||||
import os.path
|
||||
import argparse
|
||||
import json
|
||||
from time import sleep
|
||||
|
||||
|
||||
UF2_MAGIC_START0 = 0x0A324655 # "UF2\n"
|
||||
UF2_MAGIC_START1 = 0x9E5D5157 # Randomly selected
|
||||
UF2_MAGIC_END = 0x0AB16F30 # Ditto
|
||||
|
||||
INFO_FILE = "/INFO_UF2.TXT"
|
||||
|
||||
appstartaddr = 0x2000
|
||||
familyid = 0x0
|
||||
|
||||
|
||||
def is_uf2(buf):
|
||||
w = struct.unpack("<II", buf[0:8])
|
||||
return w[0] == UF2_MAGIC_START0 and w[1] == UF2_MAGIC_START1
|
||||
|
||||
def is_hex(buf):
|
||||
try:
|
||||
w = buf[0:30].decode("utf-8")
|
||||
except UnicodeDecodeError:
|
||||
return False
|
||||
if w[0] == ':' and re.match(rb"^[:0-9a-fA-F\r\n]+$", buf):
|
||||
return True
|
||||
return False
|
||||
|
||||
def convert_from_uf2(buf):
|
||||
global appstartaddr
|
||||
global familyid
|
||||
numblocks = len(buf) // 512
|
||||
curraddr = None
|
||||
currfamilyid = None
|
||||
families_found = {}
|
||||
prev_flag = None
|
||||
all_flags_same = True
|
||||
outp = []
|
||||
for blockno in range(numblocks):
|
||||
ptr = blockno * 512
|
||||
block = buf[ptr:ptr + 512]
|
||||
hd = struct.unpack(b"<IIIIIIII", block[0:32])
|
||||
if hd[0] != UF2_MAGIC_START0 or hd[1] != UF2_MAGIC_START1:
|
||||
print("Skipping block at " + ptr + "; bad magic")
|
||||
continue
|
||||
if hd[2] & 1:
|
||||
# NO-flash flag set; skip block
|
||||
continue
|
||||
datalen = hd[4]
|
||||
if datalen > 476:
|
||||
assert False, "Invalid UF2 data size at " + ptr
|
||||
newaddr = hd[3]
|
||||
if (hd[2] & 0x2000) and (currfamilyid == None):
|
||||
currfamilyid = hd[7]
|
||||
if curraddr == None or ((hd[2] & 0x2000) and hd[7] != currfamilyid):
|
||||
currfamilyid = hd[7]
|
||||
curraddr = newaddr
|
||||
if familyid == 0x0 or familyid == hd[7]:
|
||||
appstartaddr = newaddr
|
||||
padding = newaddr - curraddr
|
||||
if padding < 0:
|
||||
assert False, "Block out of order at " + ptr
|
||||
if padding > 10*1024*1024:
|
||||
assert False, "More than 10M of padding needed at " + ptr
|
||||
if padding % 4 != 0:
|
||||
assert False, "Non-word padding size at " + ptr
|
||||
while padding > 0:
|
||||
padding -= 4
|
||||
outp.append(b"\x00\x00\x00\x00")
|
||||
if familyid == 0x0 or ((hd[2] & 0x2000) and familyid == hd[7]):
|
||||
outp.append(block[32 : 32 + datalen])
|
||||
curraddr = newaddr + datalen
|
||||
if hd[2] & 0x2000:
|
||||
if hd[7] in families_found.keys():
|
||||
if families_found[hd[7]] > newaddr:
|
||||
families_found[hd[7]] = newaddr
|
||||
else:
|
||||
families_found[hd[7]] = newaddr
|
||||
if prev_flag == None:
|
||||
prev_flag = hd[2]
|
||||
if prev_flag != hd[2]:
|
||||
all_flags_same = False
|
||||
if blockno == (numblocks - 1):
|
||||
print("--- UF2 File Header Info ---")
|
||||
families = load_families()
|
||||
for family_hex in families_found.keys():
|
||||
family_short_name = ""
|
||||
for name, value in families.items():
|
||||
if value == family_hex:
|
||||
family_short_name = name
|
||||
print("Family ID is {:s}, hex value is 0x{:08x}".format(family_short_name,family_hex))
|
||||
print("Target Address is 0x{:08x}".format(families_found[family_hex]))
|
||||
if all_flags_same:
|
||||
print("All block flag values consistent, 0x{:04x}".format(hd[2]))
|
||||
else:
|
||||
print("Flags were not all the same")
|
||||
print("----------------------------")
|
||||
if len(families_found) > 1 and familyid == 0x0:
|
||||
outp = []
|
||||
appstartaddr = 0x0
|
||||
return b"".join(outp)
|
||||
|
||||
def convert_to_carray(file_content):
|
||||
outp = "const unsigned long bindata_len = %d;\n" % len(file_content)
|
||||
outp += "const unsigned char bindata[] __attribute__((aligned(16))) = {"
|
||||
for i in range(len(file_content)):
|
||||
if i % 16 == 0:
|
||||
outp += "\n"
|
||||
outp += "0x%02x, " % file_content[i]
|
||||
outp += "\n};\n"
|
||||
return bytes(outp, "utf-8")
|
||||
|
||||
def convert_to_uf2(file_content):
|
||||
global familyid
|
||||
datapadding = b""
|
||||
while len(datapadding) < 512 - 256 - 32 - 4:
|
||||
datapadding += b"\x00\x00\x00\x00"
|
||||
numblocks = (len(file_content) + 255) // 256
|
||||
outp = []
|
||||
for blockno in range(numblocks):
|
||||
ptr = 256 * blockno
|
||||
chunk = file_content[ptr:ptr + 256]
|
||||
flags = 0x0
|
||||
if familyid:
|
||||
flags |= 0x2000
|
||||
hd = struct.pack(b"<IIIIIIII",
|
||||
UF2_MAGIC_START0, UF2_MAGIC_START1,
|
||||
flags, ptr + appstartaddr, 256, blockno, numblocks, familyid)
|
||||
while len(chunk) < 256:
|
||||
chunk += b"\x00"
|
||||
block = hd + chunk + datapadding + struct.pack(b"<I", UF2_MAGIC_END)
|
||||
assert len(block) == 512
|
||||
outp.append(block)
|
||||
return b"".join(outp)
|
||||
|
||||
class Block:
|
||||
def __init__(self, addr, default_data=0xFF):
|
||||
self.addr = addr
|
||||
self.bytes = bytearray([default_data] * 256)
|
||||
|
||||
def encode(self, blockno, numblocks):
|
||||
global familyid
|
||||
flags = 0x0
|
||||
if familyid:
|
||||
flags |= 0x2000
|
||||
hd = struct.pack("<IIIIIIII",
|
||||
UF2_MAGIC_START0, UF2_MAGIC_START1,
|
||||
flags, self.addr, 256, blockno, numblocks, familyid)
|
||||
hd += self.bytes[0:256]
|
||||
while len(hd) < 512 - 4:
|
||||
hd += b"\x00"
|
||||
hd += struct.pack("<I", UF2_MAGIC_END)
|
||||
return hd
|
||||
|
||||
def convert_from_hex_to_uf2(buf):
|
||||
global appstartaddr
|
||||
appstartaddr = None
|
||||
upper = 0
|
||||
currblock = None
|
||||
blocks = []
|
||||
for line in buf.split('\n'):
|
||||
if line[0] != ":":
|
||||
continue
|
||||
i = 1
|
||||
rec = []
|
||||
while i < len(line) - 1:
|
||||
rec.append(int(line[i:i+2], 16))
|
||||
i += 2
|
||||
tp = rec[3]
|
||||
if tp == 4:
|
||||
upper = ((rec[4] << 8) | rec[5]) << 16
|
||||
elif tp == 2:
|
||||
upper = ((rec[4] << 8) | rec[5]) << 4
|
||||
elif tp == 1:
|
||||
break
|
||||
elif tp == 0:
|
||||
addr = upper + ((rec[1] << 8) | rec[2])
|
||||
if appstartaddr == None:
|
||||
appstartaddr = addr
|
||||
i = 4
|
||||
while i < len(rec) - 1:
|
||||
if not currblock or currblock.addr & ~0xff != addr & ~0xff:
|
||||
currblock = Block(addr & ~0xff)
|
||||
blocks.append(currblock)
|
||||
currblock.bytes[addr & 0xff] = rec[i]
|
||||
addr += 1
|
||||
i += 1
|
||||
numblocks = len(blocks)
|
||||
resfile = b""
|
||||
for i in range(0, numblocks):
|
||||
resfile += blocks[i].encode(i, numblocks)
|
||||
return resfile
|
||||
|
||||
def to_str(b):
|
||||
return b.decode("utf-8")
|
||||
|
||||
def get_drives():
|
||||
drives = []
|
||||
if sys.platform == "win32":
|
||||
r = subprocess.check_output(["wmic", "PATH", "Win32_LogicalDisk",
|
||||
"get", "DeviceID,", "VolumeName,",
|
||||
"FileSystem,", "DriveType"])
|
||||
for line in to_str(r).split('\n'):
|
||||
words = re.split(r'\s+', line)
|
||||
if len(words) >= 3 and words[1] == "2" and words[2] == "FAT":
|
||||
drives.append(words[0])
|
||||
else:
|
||||
searchpaths = ["/media"]
|
||||
if sys.platform == "darwin":
|
||||
searchpaths = ["/Volumes"]
|
||||
elif sys.platform == "linux":
|
||||
searchpaths += ["/media/" + os.environ["USER"], '/run/media/' + os.environ["USER"]]
|
||||
|
||||
for rootpath in searchpaths:
|
||||
if os.path.isdir(rootpath):
|
||||
for d in os.listdir(rootpath):
|
||||
if os.path.isdir(rootpath):
|
||||
drives.append(os.path.join(rootpath, d))
|
||||
|
||||
|
||||
def has_info(d):
|
||||
try:
|
||||
return os.path.isfile(d + INFO_FILE)
|
||||
except:
|
||||
return False
|
||||
|
||||
return list(filter(has_info, drives))
|
||||
|
||||
|
||||
def board_id(path):
|
||||
with open(path + INFO_FILE, mode='r') as file:
|
||||
file_content = file.read()
|
||||
return re.search(r"Board-ID: ([^\r\n]*)", file_content).group(1)
|
||||
|
||||
|
||||
def list_drives():
|
||||
for d in get_drives():
|
||||
print(d, board_id(d))
|
||||
|
||||
|
||||
def write_file(name, buf):
|
||||
with open(name, "wb") as f:
|
||||
f.write(buf)
|
||||
print("Wrote %d bytes to %s" % (len(buf), name))
|
||||
|
||||
|
||||
def load_families():
|
||||
# The expectation is that the `uf2families.json` file is in the same
|
||||
# directory as this script. Make a path that works using `__file__`
|
||||
# which contains the full path to this script.
|
||||
filename = "uf2families.json"
|
||||
pathname = os.path.join(os.path.dirname(os.path.abspath(__file__)), filename)
|
||||
with open(pathname) as f:
|
||||
raw_families = json.load(f)
|
||||
|
||||
families = {}
|
||||
for family in raw_families:
|
||||
families[family["short_name"]] = int(family["id"], 0)
|
||||
|
||||
return families
|
||||
|
||||
|
||||
def main():
|
||||
global appstartaddr, familyid
|
||||
def error(msg):
|
||||
print(msg, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
parser = argparse.ArgumentParser(description='Convert to UF2 or flash directly.')
|
||||
parser.add_argument('input', metavar='INPUT', type=str, nargs='?',
|
||||
help='input file (HEX, BIN or UF2)')
|
||||
parser.add_argument('-b', '--base', dest='base', type=str,
|
||||
default="0x2000",
|
||||
help='set base address of application for BIN format (default: 0x2000)')
|
||||
parser.add_argument('-f', '--family', dest='family', type=str,
|
||||
default="0x0",
|
||||
help='specify familyID - number or name (default: 0x0)')
|
||||
parser.add_argument('-o', '--output', metavar="FILE", dest='output', type=str,
|
||||
help='write output to named file; defaults to "flash.uf2" or "flash.bin" where sensible')
|
||||
parser.add_argument('-d', '--device', dest="device_path",
|
||||
help='select a device path to flash')
|
||||
parser.add_argument('-l', '--list', action='store_true',
|
||||
help='list connected devices')
|
||||
parser.add_argument('-c', '--convert', action='store_true',
|
||||
help='do not flash, just convert')
|
||||
parser.add_argument('-D', '--deploy', action='store_true',
|
||||
help='just flash, do not convert')
|
||||
parser.add_argument('-w', '--wait', action='store_true',
|
||||
help='wait for device to flash')
|
||||
parser.add_argument('-C', '--carray', action='store_true',
|
||||
help='convert binary file to a C array, not UF2')
|
||||
parser.add_argument('-i', '--info', action='store_true',
|
||||
help='display header information from UF2, do not convert')
|
||||
args = parser.parse_args()
|
||||
appstartaddr = int(args.base, 0)
|
||||
|
||||
families = load_families()
|
||||
|
||||
if args.family.upper() in families:
|
||||
familyid = families[args.family.upper()]
|
||||
else:
|
||||
try:
|
||||
familyid = int(args.family, 0)
|
||||
except ValueError:
|
||||
error("Family ID needs to be a number or one of: " + ", ".join(families.keys()))
|
||||
|
||||
if args.list:
|
||||
list_drives()
|
||||
else:
|
||||
if not args.input:
|
||||
error("Need input file")
|
||||
with open(args.input, mode='rb') as f:
|
||||
inpbuf = f.read()
|
||||
from_uf2 = is_uf2(inpbuf)
|
||||
ext = "uf2"
|
||||
if args.deploy:
|
||||
outbuf = inpbuf
|
||||
elif from_uf2 and not args.info:
|
||||
outbuf = convert_from_uf2(inpbuf)
|
||||
ext = "bin"
|
||||
elif from_uf2 and args.info:
|
||||
outbuf = ""
|
||||
convert_from_uf2(inpbuf)
|
||||
elif is_hex(inpbuf):
|
||||
outbuf = convert_from_hex_to_uf2(inpbuf.decode("utf-8"))
|
||||
elif args.carray:
|
||||
outbuf = convert_to_carray(inpbuf)
|
||||
ext = "h"
|
||||
else:
|
||||
outbuf = convert_to_uf2(inpbuf)
|
||||
if not args.deploy and not args.info:
|
||||
print("Converted to %s, output size: %d, start address: 0x%x" %
|
||||
(ext, len(outbuf), appstartaddr))
|
||||
if args.convert or ext != "uf2":
|
||||
if args.output == None:
|
||||
args.output = "flash." + ext
|
||||
if args.output:
|
||||
write_file(args.output, outbuf)
|
||||
if ext == "uf2" and not args.convert and not args.info:
|
||||
drives = get_drives()
|
||||
if len(drives) == 0:
|
||||
if args.wait:
|
||||
print("Waiting for drive to deploy...")
|
||||
while len(drives) == 0:
|
||||
sleep(0.1)
|
||||
drives = get_drives()
|
||||
elif not args.output:
|
||||
error("No drive to deploy.")
|
||||
for d in drives:
|
||||
print("Flashing %s (%s)" % (d, board_id(d)))
|
||||
write_file(d + "/NEW.UF2", outbuf)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,362 @@
|
||||
[
|
||||
{
|
||||
"id": "0x16573617",
|
||||
"short_name": "ATMEGA32",
|
||||
"description": "Microchip (Atmel) ATmega32"
|
||||
},
|
||||
{
|
||||
"id": "0x1851780a",
|
||||
"short_name": "SAML21",
|
||||
"description": "Microchip (Atmel) SAML21"
|
||||
},
|
||||
{
|
||||
"id": "0x1b57745f",
|
||||
"short_name": "NRF52",
|
||||
"description": "Nordic NRF52"
|
||||
},
|
||||
{
|
||||
"id": "0x1c5f21b0",
|
||||
"short_name": "ESP32",
|
||||
"description": "ESP32"
|
||||
},
|
||||
{
|
||||
"id": "0x1e1f432d",
|
||||
"short_name": "STM32L1",
|
||||
"description": "ST STM32L1xx"
|
||||
},
|
||||
{
|
||||
"id": "0x202e3a91",
|
||||
"short_name": "STM32L0",
|
||||
"description": "ST STM32L0xx"
|
||||
},
|
||||
{
|
||||
"id": "0x21460ff0",
|
||||
"short_name": "STM32WL",
|
||||
"description": "ST STM32WLxx"
|
||||
},
|
||||
{
|
||||
"id": "0x22e0d6fc",
|
||||
"short_name": "RTL8710B",
|
||||
"description": "Realtek AmebaZ RTL8710B"
|
||||
},
|
||||
{
|
||||
"id": "0x2abc77ec",
|
||||
"short_name": "LPC55",
|
||||
"description": "NXP LPC55xx"
|
||||
},
|
||||
{
|
||||
"id": "0x300f5633",
|
||||
"short_name": "STM32G0",
|
||||
"description": "ST STM32G0xx"
|
||||
},
|
||||
{
|
||||
"id": "0x31d228c6",
|
||||
"short_name": "GD32F350",
|
||||
"description": "GD32F350"
|
||||
},
|
||||
{
|
||||
"id": "0x3379CFE2",
|
||||
"short_name": "RTL8720D",
|
||||
"description": "Realtek AmebaD RTL8720D"
|
||||
},
|
||||
{
|
||||
"id": "0x04240bdf",
|
||||
"short_name": "STM32L5",
|
||||
"description": "ST STM32L5xx"
|
||||
},
|
||||
{
|
||||
"id": "0x4c71240a",
|
||||
"short_name": "STM32G4",
|
||||
"description": "ST STM32G4xx"
|
||||
},
|
||||
{
|
||||
"id": "0x4fb2d5bd",
|
||||
"short_name": "MIMXRT10XX",
|
||||
"description": "NXP i.MX RT10XX"
|
||||
},
|
||||
{
|
||||
"id": "0x51e903a8",
|
||||
"short_name": "XR809",
|
||||
"description": "Xradiotech 809"
|
||||
},
|
||||
{
|
||||
"id": "0x53b80f00",
|
||||
"short_name": "STM32F7",
|
||||
"description": "ST STM32F7xx"
|
||||
},
|
||||
{
|
||||
"id": "0x55114460",
|
||||
"short_name": "SAMD51",
|
||||
"description": "Microchip (Atmel) SAMD51"
|
||||
},
|
||||
{
|
||||
"id": "0x57755a57",
|
||||
"short_name": "STM32F4",
|
||||
"description": "ST STM32F4xx"
|
||||
},
|
||||
{
|
||||
"id": "0x5a18069b",
|
||||
"short_name": "FX2",
|
||||
"description": "Cypress FX2"
|
||||
},
|
||||
{
|
||||
"id": "0x5d1a0a2e",
|
||||
"short_name": "STM32F2",
|
||||
"description": "ST STM32F2xx"
|
||||
},
|
||||
{
|
||||
"id": "0x5ee21072",
|
||||
"short_name": "STM32F1",
|
||||
"description": "ST STM32F103"
|
||||
},
|
||||
{
|
||||
"id": "0x621e937a",
|
||||
"short_name": "NRF52833",
|
||||
"description": "Nordic NRF52833"
|
||||
},
|
||||
{
|
||||
"id": "0x647824b6",
|
||||
"short_name": "STM32F0",
|
||||
"description": "ST STM32F0xx"
|
||||
},
|
||||
{
|
||||
"id": "0x675a40b0",
|
||||
"short_name": "BK7231U",
|
||||
"description": "Beken 7231U/7231T"
|
||||
},
|
||||
{
|
||||
"id": "0x68ed2b88",
|
||||
"short_name": "SAMD21",
|
||||
"description": "Microchip (Atmel) SAMD21"
|
||||
},
|
||||
{
|
||||
"id": "0x6a82cc42",
|
||||
"short_name": "BK7251",
|
||||
"description": "Beken 7251/7252"
|
||||
},
|
||||
{
|
||||
"id": "0x6b846188",
|
||||
"short_name": "STM32F3",
|
||||
"description": "ST STM32F3xx"
|
||||
},
|
||||
{
|
||||
"id": "0x6d0922fa",
|
||||
"short_name": "STM32F407",
|
||||
"description": "ST STM32F407"
|
||||
},
|
||||
{
|
||||
"id": "0x4e8f1c5d",
|
||||
"short_name": "STM32H5",
|
||||
"description": "ST STM32H5xx"
|
||||
},
|
||||
{
|
||||
"id": "0x6db66082",
|
||||
"short_name": "STM32H7",
|
||||
"description": "ST STM32H7xx"
|
||||
},
|
||||
{
|
||||
"id": "0x70d16653",
|
||||
"short_name": "STM32WB",
|
||||
"description": "ST STM32WBxx"
|
||||
},
|
||||
{
|
||||
"id": "0x7b3ef230",
|
||||
"short_name": "BK7231N",
|
||||
"description": "Beken 7231N"
|
||||
},
|
||||
{
|
||||
"id": "0x7eab61ed",
|
||||
"short_name": "ESP8266",
|
||||
"description": "ESP8266"
|
||||
},
|
||||
{
|
||||
"id": "0x7f83e793",
|
||||
"short_name": "KL32L2",
|
||||
"description": "NXP KL32L2x"
|
||||
},
|
||||
{
|
||||
"id": "0x8fb060fe",
|
||||
"short_name": "STM32F407VG",
|
||||
"description": "ST STM32F407VG"
|
||||
},
|
||||
{
|
||||
"id": "0x9fffd543",
|
||||
"short_name": "RTL8710A",
|
||||
"description": "Realtek Ameba1 RTL8710A"
|
||||
},
|
||||
{
|
||||
"id": "0xada52840",
|
||||
"short_name": "NRF52840",
|
||||
"description": "Nordic NRF52840"
|
||||
},
|
||||
{
|
||||
"id": "0x820d9a5f",
|
||||
"short_name": "NRF52820",
|
||||
"description": "Nordic NRF52820_xxAA"
|
||||
},
|
||||
{
|
||||
"id": "0xbfdd4eee",
|
||||
"short_name": "ESP32S2",
|
||||
"description": "ESP32-S2"
|
||||
},
|
||||
{
|
||||
"id": "0xc47e5767",
|
||||
"short_name": "ESP32S3",
|
||||
"description": "ESP32-S3"
|
||||
},
|
||||
{
|
||||
"id": "0xd42ba06c",
|
||||
"short_name": "ESP32C3",
|
||||
"description": "ESP32-C3"
|
||||
},
|
||||
{
|
||||
"id": "0x2b88d29c",
|
||||
"short_name": "ESP32C2",
|
||||
"description": "ESP32-C2"
|
||||
},
|
||||
{
|
||||
"id": "0x332726f6",
|
||||
"short_name": "ESP32H2",
|
||||
"description": "ESP32-H2"
|
||||
},
|
||||
{
|
||||
"id": "0x540ddf62",
|
||||
"short_name": "ESP32C6",
|
||||
"description": "ESP32-C6"
|
||||
},
|
||||
{
|
||||
"id": "0x3d308e94",
|
||||
"short_name": "ESP32P4",
|
||||
"description": "ESP32-P4"
|
||||
},
|
||||
{
|
||||
"id": "0xf71c0343",
|
||||
"short_name": "ESP32C5",
|
||||
"description": "ESP32-C5"
|
||||
},
|
||||
{
|
||||
"id": "0x77d850c4",
|
||||
"short_name": "ESP32C61",
|
||||
"description": "ESP32-C61"
|
||||
},
|
||||
{
|
||||
"id": "0xb6dd00af",
|
||||
"short_name": "ESP32H21",
|
||||
"description": "ESP32-H21"
|
||||
},
|
||||
{
|
||||
"id": "0x9e0baa8a",
|
||||
"short_name": "ESP32H4",
|
||||
"description": "ESP32-H4"
|
||||
},
|
||||
{
|
||||
"id": "0xde1270b7",
|
||||
"short_name": "BL602",
|
||||
"description": "Boufallo 602"
|
||||
},
|
||||
{
|
||||
"id": "0xe08f7564",
|
||||
"short_name": "RTL8720C",
|
||||
"description": "Realtek AmebaZ2 RTL8720C"
|
||||
},
|
||||
{
|
||||
"id": "0xe48bff56",
|
||||
"short_name": "RP2040",
|
||||
"description": "Raspberry Pi RP2040"
|
||||
},
|
||||
{
|
||||
"id": "0xe48bff57",
|
||||
"short_name": "RP2XXX_ABSOLUTE",
|
||||
"description": "Raspberry Pi Microcontrollers: Absolute (unpartitioned) download"
|
||||
},
|
||||
{
|
||||
"id": "0xe48bff58",
|
||||
"short_name": "RP2XXX_DATA",
|
||||
"description": "Raspberry Pi Microcontrollers: Data partition download"
|
||||
},
|
||||
{
|
||||
"id": "0xe48bff59",
|
||||
"short_name": "RP2350_ARM_S",
|
||||
"description": "Raspberry Pi RP2350, Secure Arm image"
|
||||
},
|
||||
{
|
||||
"id": "0xe48bff5a",
|
||||
"short_name": "RP2350_RISCV",
|
||||
"description": "Raspberry Pi RP2350, RISC-V image"
|
||||
},
|
||||
{
|
||||
"id": "0xe48bff5b",
|
||||
"short_name": "RP2350_ARM_NS",
|
||||
"description": "Raspberry Pi RP2350, Non-secure Arm image"
|
||||
},
|
||||
{
|
||||
"id": "0x00ff6919",
|
||||
"short_name": "STM32L4",
|
||||
"description": "ST STM32L4xx"
|
||||
},
|
||||
{
|
||||
"id": "0x9af03e33",
|
||||
"short_name": "GD32VF103",
|
||||
"description": "GigaDevice GD32VF103"
|
||||
},
|
||||
{
|
||||
"id": "0x4f6ace52",
|
||||
"short_name": "CSK4",
|
||||
"description": "LISTENAI CSK300x/400x"
|
||||
},
|
||||
{
|
||||
"id": "0x6e7348a8",
|
||||
"short_name": "CSK6",
|
||||
"description": "LISTENAI CSK60xx"
|
||||
},
|
||||
{
|
||||
"id": "0x11de784a",
|
||||
"short_name": "M0SENSE",
|
||||
"description": "M0SENSE BL702"
|
||||
},
|
||||
{
|
||||
"id": "0x4b684d71",
|
||||
"short_name": "MaixPlay-U4",
|
||||
"description": "Sipeed MaixPlay-U4(BL618)"
|
||||
},
|
||||
{
|
||||
"id": "0x9517422f",
|
||||
"short_name": "RZA1LU",
|
||||
"description": "Renesas RZ/A1LU (R7S7210xx)"
|
||||
},
|
||||
{
|
||||
"id": "0x2dc309c5",
|
||||
"short_name": "STM32F411xE",
|
||||
"description": "ST STM32F411xE"
|
||||
},
|
||||
{
|
||||
"id": "0x06d1097b",
|
||||
"short_name": "STM32F411xC",
|
||||
"description": "ST STM32F411xC"
|
||||
},
|
||||
{
|
||||
"id": "0x72721d4e",
|
||||
"short_name": "NRF52832xxAA",
|
||||
"description": "Nordic NRF52832xxAA"
|
||||
},
|
||||
{
|
||||
"id": "0x6f752678",
|
||||
"short_name": "NRF52832xxAB",
|
||||
"description": "Nordic NRF52832xxAB"
|
||||
},
|
||||
{
|
||||
"id": "0xa0c97b8e",
|
||||
"short_name": "AT32F415",
|
||||
"description": "ArteryTek AT32F415"
|
||||
},
|
||||
{
|
||||
"id": "0x699b62ec",
|
||||
"short_name": "CH32V",
|
||||
"description": "WCH CH32V2xx and CH32V3xx"
|
||||
},
|
||||
{
|
||||
"id": "0x7be8976d",
|
||||
"short_name": "RA4M1",
|
||||
"description": "Renesas RA4M1"
|
||||
}
|
||||
]
|
||||
@@ -1,919 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<meta name="generator" content="mkdocs-1.6.1, mkdocs-terminal-4.8.0">
|
||||
|
||||
<meta name="description" content="MeshCore fork meshcore-tth -- repeater antispam, diagnostics, OTA, Czech mesh defaults">
|
||||
|
||||
|
||||
<link rel="canonical" href="https://tth-pub.pages.rfa.cz/meshcore-tth/ble-lora-coexistence/"><link rel="icon" type="image/png" sizes="192x192" href="../img/android-chrome-192x192.png" />
|
||||
<link rel="icon" type="image/png" sizes="512x512" href="../img/android-chrome-512x512.png" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="../img/apple-touch-icon.png" />
|
||||
<link rel="shortcut icon" type="image/png" sizes="48x48" href="../img/favicon.ico" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="../img/favicon-16x16.png" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="../img/favicon-32x32.png" />
|
||||
|
||||
|
||||
|
||||
|
||||
<title>BLE/LoRa coexistence - MeshCore TTH</title>
|
||||
|
||||
|
||||
<link href="../css/fontawesome/css/fontawesome.min.css" rel="stylesheet">
|
||||
<link href="../css/fontawesome/css/solid.min.css" rel="stylesheet">
|
||||
<link href="../css/normalize.css" rel="stylesheet">
|
||||
<link href="../css/terminal.css" rel="stylesheet">
|
||||
<link href="../css/theme.css" rel="stylesheet">
|
||||
<link href="../css/theme.tile_grid.css" rel="stylesheet">
|
||||
<link href="../css/theme.footer.css" rel="stylesheet">
|
||||
<!-- dark color palette -->
|
||||
<link href="../css/palettes/dark.css" rel="stylesheet">
|
||||
|
||||
<!-- page layout -->
|
||||
<style>
|
||||
/* initially set page layout to a one column grid */
|
||||
.terminal-mkdocs-main-grid {
|
||||
display: grid;
|
||||
grid-column-gap: 1.4em;
|
||||
grid-template-columns: auto;
|
||||
grid-template-rows: auto;
|
||||
}
|
||||
|
||||
/*
|
||||
* when side navigation is not hidden, use a two column grid.
|
||||
* if the screen is too narrow, fall back to the initial one column grid layout.
|
||||
* in this case the main content will be placed under the navigation panel.
|
||||
*/
|
||||
@media only screen and (min-width: 70em) {
|
||||
.terminal-mkdocs-main-grid {
|
||||
grid-template-columns: 4fr 9fr;
|
||||
}
|
||||
}</style>
|
||||
|
||||
<!-- cursor_animation override -->
|
||||
<style>
|
||||
#mkdocs-terminal-site-name.terminal-prompt::after {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<link href="../_stylesheets/tth.css" rel="stylesheet">
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- search css support -->
|
||||
<link href="../css/search/bootstrap-modal.css" rel="stylesheet">
|
||||
<!-- search scripts -->
|
||||
<script>
|
||||
var base_url = "..",
|
||||
shortcuts = "{}";
|
||||
</script>
|
||||
<script src="../js/jquery/jquery-1.10.1.min.js" defer></script>
|
||||
<script src="../js/bootstrap/bootstrap.min.js" defer></script>
|
||||
<script src="../js/mkdocs/base.js" defer></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="../search/main.js"></script>
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body class="terminal"><div class="container">
|
||||
<div class="terminal-nav">
|
||||
<header class="terminal-logo">
|
||||
<div id="mkdocs-terminal-site-name" class="logo terminal-prompt"><a href="https://tth-pub.pages.rfa.cz/meshcore-tth/" class="no-style">MeshCore TTH</a></div>
|
||||
</header>
|
||||
|
||||
<nav class="terminal-menu">
|
||||
|
||||
<ul vocab="https://schema.org/" typeof="BreadcrumbList">
|
||||
|
||||
|
||||
<li property="itemListElement" typeof="ListItem">
|
||||
<a href=".." class="menu-item " property="item" typeof="WebPage">
|
||||
<span property="name">About the fork</span>
|
||||
</a>
|
||||
<meta property="position" content="0">
|
||||
</li>
|
||||
|
||||
|
||||
<li property="itemListElement" typeof="ListItem">
|
||||
<a href="../cs/" class="menu-item " property="item" typeof="WebPage">
|
||||
<span property="name">Česky</span>
|
||||
</a>
|
||||
<meta property="position" content="1">
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li property="itemListElement" typeof="ListItem">
|
||||
<a href="#" class="menu-item" data-toggle="modal" data-target="#mkdocs_search_modal" property="item" typeof="SearchAction">
|
||||
<i aria-hidden="true" class="fa fa-search"></i> <span property="name">Search</span>
|
||||
</a>
|
||||
<meta property="position" content="2">
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="terminal-mkdocs-main-grid"><aside id="terminal-mkdocs-side-panel"><nav>
|
||||
<ul class="terminal-mkdocs-side-nav-items">
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="..">About the fork</a>
|
||||
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../cs/">Česky</a>
|
||||
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="
|
||||
|
||||
|
||||
|
||||
terminal-mkdocs-side-nav-item--active terminal-mkdocs-side-nav-section-no-index">Fork meshcore-tth</span>
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="terminal-mkdocs-side-nav-li-ul">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../tth-commands/">Console commands</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../ota/">Firmware update by the admin (OTA)</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../power/">Power saving</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../budka-sensor/">Budka as a sensor</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
<span class="terminal-mkdocs-side-nav-item--active">BLE/LoRa coexistence</span>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="
|
||||
|
||||
|
||||
|
||||
terminal-mkdocs-side-nav-item terminal-mkdocs-side-nav-section-no-index">MeshCore (upstream)</span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="terminal-mkdocs-side-nav-li-ul">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../meshcore/">Introduction</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../faq/">FAQ</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../cli_commands/">CLI commands</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../companion_cli/">Companion CLI</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../companion_protocol/">Companion protocol</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../terminal_chat_cli/">Terminal chat CLI</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../kiss_modem_protocol/">KISS modem protocol</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../packet_format/">Packet format</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../payloads/">Payloads</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../stats_binary_frames/">Stats binary frames</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../number_allocations/">Number allocations</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../qr_codes/">QR codes</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../radio_presets/">Radio presets</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../nrf52_power_management/">nRF52 power management</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav><hr>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="#blelora-coexistence-bench-reproduction-attempt">BLE/LoRa coexistence — bench reproduction attempt</a></li>
|
||||
<li><a href="#the-claim-under-test">The claim under test</a></li><li><a href="#rig">Rig</a></li><li><a href="#what-was-measured">What was measured</a></li><li><a href="#on-mast-hardware-with-the-file-log-on">On mast hardware, with the file log on</a></li><li><a href="#still-open">Still open</a></li><li><a href="#airtime-is-a-hard-limit-and-the-firmware-will-not-enforce-it">Airtime is a hard limit, and the firmware will not enforce it</a></li><li><a href="#traps-worth-remembering">Traps worth remembering</a></li><li><a href="#the-two-commands-this-bench-added">The two commands this bench added</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</aside>
|
||||
<main id="terminal-mkdocs-main-content">
|
||||
<section id="mkdocs-terminal-content">
|
||||
<h1 id="blelora-coexistence-bench-reproduction-attempt">BLE/LoRa coexistence — bench reproduction attempt</h1>
|
||||
<p>Working notes for the DIRECT-forward loss seen on <code>mast-three</code> (SenseCap Solar,
|
||||
<code>SenseCap_Solar_repeater_ble</code>). Written down because the result is mostly
|
||||
<strong>negative</strong>, and a negative result is only worth anything if the method and its
|
||||
limits are recorded with it.</p>
|
||||
<h2 id="the-claim-under-test">The claim under test</h2>
|
||||
<p>Commit <code>f6e9aeca</code> widened the BLE connection interval from 15–30 ms to 60–80 ms
|
||||
after an A/B on the mast showed ~40 % of DIRECT-route forwards silently lost
|
||||
with an <strong>idle</strong> BLE connection at 15–30 ms. The stated mechanism is that the
|
||||
SoftDevice's per-connection-event preemption disturbs the SX126x TX path
|
||||
(<code>startTransmit</code> fail / send-complete timeout).</p>
|
||||
<p>The fix is deployed. What was never established is whether a bench rig can
|
||||
<strong>detect</strong> the effect at all — a measurement that reads zero in both the
|
||||
treatment and the control has shown nothing.</p>
|
||||
<h2 id="rig">Rig</h2>
|
||||
<p>Isolated test mesh on <strong>866.5 MHz</strong> (BW 62.5, SF 8, CR 5). Isolation is by
|
||||
frequency, not by tx power: a hilltop repeater with <code>RX_BOOSTED_GAIN</code> hears a
|
||||
few mW just fine. The override is compile-time (<code>platformio.local.ini</code>) because
|
||||
<code>MyMesh.cpp</code> seeds <code>_prefs.freq</code> from <code>LORA_FREQ</code>, so the firmware cannot come
|
||||
up on the production frequency even after <code>erase</code>.</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>node</th>
|
||||
<th>board</th>
|
||||
<th>role</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>bench-board</code></td>
|
||||
<td>XIAO nRF52840 + Wio-SX1262</td>
|
||||
<td>forwarder under test</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>bench-board</code></td>
|
||||
<td>same</td>
|
||||
<td>paired control / radiating witness</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>bench-board</code>, <code>bench-board</code></td>
|
||||
<td>same</td>
|
||||
<td>probe sources</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>bench-rpt</code></td>
|
||||
<td>SenseCap Solar Node</td>
|
||||
<td>forwarder, mast-identical hardware</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>tth-s2-rpt</code></td>
|
||||
<td>same</td>
|
||||
<td>paired control</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Paired controls differ <strong>only</strong> in <code>ADVERT_NAME</code>, verified by diffing strings in
|
||||
the ELF. Any other difference invalidates them.</p>
|
||||
<h3 id="oracle">Oracle</h3>
|
||||
<p>The measured quantity is the node's own <code>direct_rx − direct_tx</code> from
|
||||
<code>stats-packets</code>: how many DIRECT packets it accepted for forwarding versus how
|
||||
many it actually sent. This is self-normalising — it does not depend on channel
|
||||
conditions or on a receiver hearing anything. <code>tx_start_fail</code> and <code>tx_timeout</code>
|
||||
are the mechanism-level counters. A second repeater with <code>repeat off</code> acts as a
|
||||
radiating witness, so "counted a TX" can be distinguished from "actually
|
||||
radiated".</p>
|
||||
<p>Route forcing: a contact is injected into the sender's companion with an
|
||||
explicit <code>out_path</code>, so the DM must traverse the node under test.
|
||||
<strong><code>out_path_len</code> is not a hop count</strong> — it is a packed byte, top two bits =
|
||||
hash size − 1, low six = hop count (<code>Packet.h:85</code>). One hop with a 2-byte hash
|
||||
is <code>0x41</code>, not <code>1</code>. The receiver reads the size out of the packet
|
||||
(<code>Mesh.cpp:93</code>), so a forced path works regardless of the node's
|
||||
<code>path.hash.mode</code>.</p>
|
||||
<h2 id="what-was-measured">What was measured</h2>
|
||||
<p>All cells at a <strong>verified</strong> 22.50 ms connection interval — <code>bleconn</code> reports the
|
||||
parameters actually negotiated, because <code>bleOnSecured()</code> only requests them and
|
||||
the central may refuse. Without that read-back none of the null results below
|
||||
would mean anything.</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align: right;"><code>blepwr</code></th>
|
||||
<th style="text-align: right;">≈RSSI at central</th>
|
||||
<th style="text-align: right;">link up</th>
|
||||
<th style="text-align: right;">direct_rx</th>
|
||||
<th style="text-align: right;">direct_tx</th>
|
||||
<th style="text-align: right;">lost</th>
|
||||
<th style="text-align: right;">tx_timeout</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="text-align: right;">BLE off</td>
|
||||
<td style="text-align: right;">—</td>
|
||||
<td style="text-align: right;">—</td>
|
||||
<td style="text-align: right;">8</td>
|
||||
<td style="text-align: right;">8</td>
|
||||
<td style="text-align: right;">0</td>
|
||||
<td style="text-align: right;">0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right;">0 dBm</td>
|
||||
<td style="text-align: right;">−67</td>
|
||||
<td style="text-align: right;">100 %</td>
|
||||
<td style="text-align: right;">8</td>
|
||||
<td style="text-align: right;">8</td>
|
||||
<td style="text-align: right;">0</td>
|
||||
<td style="text-align: right;">0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right;">−8</td>
|
||||
<td style="text-align: right;">−75</td>
|
||||
<td style="text-align: right;">100 %</td>
|
||||
<td style="text-align: right;">8</td>
|
||||
<td style="text-align: right;">8</td>
|
||||
<td style="text-align: right;">0</td>
|
||||
<td style="text-align: right;">0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right;">−12</td>
|
||||
<td style="text-align: right;">−79</td>
|
||||
<td style="text-align: right;">100 %</td>
|
||||
<td style="text-align: right;">8</td>
|
||||
<td style="text-align: right;">8</td>
|
||||
<td style="text-align: right;">0</td>
|
||||
<td style="text-align: right;">0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right;">−16</td>
|
||||
<td style="text-align: right;">−83</td>
|
||||
<td style="text-align: right;">87 %</td>
|
||||
<td style="text-align: right;">8</td>
|
||||
<td style="text-align: right;">8</td>
|
||||
<td style="text-align: right;">0</td>
|
||||
<td style="text-align: right;">0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right;">−20</td>
|
||||
<td style="text-align: right;">−87</td>
|
||||
<td style="text-align: right;">27 %</td>
|
||||
<td style="text-align: right;">8</td>
|
||||
<td style="text-align: right;">8</td>
|
||||
<td style="text-align: right;">0</td>
|
||||
<td style="text-align: right;">0</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>The −20 dBm row is a bonus condition: the link held only a quarter of the
|
||||
window, so the node spent the rest advertising and re-connecting — close to the
|
||||
reconnect churn the mast reports as HCI 0x3E.</p>
|
||||
<p><strong>Ruled out as the missing factor: BLE link margin.</strong> The whole −75..−90 window
|
||||
the mast sits in is covered, at the known-bad interval, with zero loss.</p>
|
||||
<h3 id="why-idle-weak-link-does-nothing">Why idle + weak link does nothing</h3>
|
||||
<p>In idle the connection events carry empty PDUs, whose retransmission costs
|
||||
almost no radio time. The cost of a retransmission scales with payload size, and
|
||||
the mast has a bridge actively draining the console. Hence the <code>poll</code> mode in
|
||||
the harness.</p>
|
||||
<p>Direction matters too, and it is the reason to weaken <strong>our</strong> side rather than
|
||||
the central's: a connection event ends as soon as either side misses a packet,
|
||||
so if the central misses our PDU we must re-send it at the next anchor — an
|
||||
extra slave TX. If we miss the central's PDU we never transmit in that event at
|
||||
all, and the SoftDevice uses <em>less</em> radio.</p>
|
||||
<h2 id="on-mast-hardware-with-the-file-log-on">On mast hardware, with the file log on</h2>
|
||||
<p>Two SenseCap Solar nodes (<code>bench-rpt</code> forwarder, <code>tth-s2-rpt</code> paired control) —
|
||||
the same board as the mast, so InternalFS logging, INA226/solar telemetry and
|
||||
the SenseCap SPI layout are all in play. Again at a verified 22.50 ms interval
|
||||
(<code>bleconn</code>).</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>file log</th>
|
||||
<th>BLE</th>
|
||||
<th style="text-align: right;">direct_rx</th>
|
||||
<th style="text-align: right;">direct_tx</th>
|
||||
<th style="text-align: right;">lost</th>
|
||||
<th style="text-align: right;">tx_timeout</th>
|
||||
<th style="text-align: right;">witness</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>off</td>
|
||||
<td>off</td>
|
||||
<td style="text-align: right;">8</td>
|
||||
<td style="text-align: right;">8</td>
|
||||
<td style="text-align: right;">0</td>
|
||||
<td style="text-align: right;">0</td>
|
||||
<td style="text-align: right;">+39</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>off</td>
|
||||
<td>idle, 88 % of window</td>
|
||||
<td style="text-align: right;">8</td>
|
||||
<td style="text-align: right;">8</td>
|
||||
<td style="text-align: right;">0</td>
|
||||
<td style="text-align: right;">0</td>
|
||||
<td style="text-align: right;">+37</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>on</strong></td>
|
||||
<td>off</td>
|
||||
<td style="text-align: right;">8</td>
|
||||
<td style="text-align: right;">8</td>
|
||||
<td style="text-align: right;">0</td>
|
||||
<td style="text-align: right;">0</td>
|
||||
<td style="text-align: right;">+39</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>on</strong></td>
|
||||
<td>idle, 90 % of window</td>
|
||||
<td style="text-align: right;">8</td>
|
||||
<td style="text-align: right;">8</td>
|
||||
<td style="text-align: right;">0</td>
|
||||
<td style="text-align: right;">0</td>
|
||||
<td style="text-align: right;">+40</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>The logging condition was real, not nominal: <code>log</code> afterwards held 69 entries
|
||||
with RX/TX lines timestamped inside the measurement window, i.e. an InternalFS
|
||||
write per packet — the mechanism behind the known deaf windows.</p>
|
||||
<p><strong>Ten cells, 80 forced forwards, zero lost, <code>tx_timeout</code> and <code>tx_start_fail</code> at
|
||||
zero throughout.</strong> Against the mast's reported ~40 % loss rate this is not a
|
||||
weak null: a single 8-probe cell would miss a true 40 % effect with probability
|
||||
0.6⁸ ≈ 1.7 %, and ten cells make it vanishing. Whatever the mast is doing, it is
|
||||
not reproduced by the connection interval, the BLE link margin, the board, or
|
||||
InternalFS logging — alone or together.</p>
|
||||
<h2 id="still-open">Still open</h2>
|
||||
<p><strong>Loaded LoRa channel</strong> is the one uncontrolled difference left. Ours is idle;
|
||||
the mast relays flood traffic, so its forwards contend for a busy channel and
|
||||
the TX window lands on a BLE connection event far more often. This cannot be
|
||||
tested legally here: 866.5 is capped at 1 % duty and the 10 % sub-band
|
||||
(869.4–869.65) is where production lives.</p>
|
||||
<p>Practical consequence: <strong>f6e9aeca can be neither confirmed nor refuted on the
|
||||
bench.</strong> Deciding whether the 60–80 ms interval is still needed requires
|
||||
measuring on <code>mast-three</code> itself — the counters (<code>stats-packets</code>, and now
|
||||
<code>bleconn</code> to prove which interval is actually in force) are all reachable over
|
||||
its BLE console.</p>
|
||||
<h2 id="airtime-is-a-hard-limit-and-the-firmware-will-not-enforce-it">Airtime is a hard limit, and the firmware will not enforce it</h2>
|
||||
<p>866.5 MHz sits in 865–868 (CZ VO-R/10): 25 mW ERP, <strong>1 % duty cycle = 36 s of
|
||||
transmission per hour</strong>. The firmware does not police this — <code>airtime_factor</code>
|
||||
defaults to 0 (= 100 %) and is clamped to 9, so the lowest duty MeshCore can
|
||||
enforce is 10 %. The first sweep consumed <code>tx_air_secs</code> 27 s in 18 minutes of
|
||||
uptime, a rate of ~2.5 %. Budget the probes: <code>stats-radio.tx_air_secs</code> is the
|
||||
ground truth, and the harness aborts before crossing a configured cap.</p>
|
||||
<p><code>stats-core.queue_len</code> and <code>errors</code> are a required control, not decoration: when
|
||||
the airtime budget runs out the Dispatcher <strong>defers</strong> a forward
|
||||
(<code>next_tx_time</code>, <code>Dispatcher.cpp:101</code>), which looks identical to loss in the
|
||||
counters. Both were zero throughout.</p>
|
||||
<h2 id="traps-worth-remembering">Traps worth remembering</h2>
|
||||
<ul>
|
||||
<li><strong>USB and BLE consoles share one <code>command[160]</code>.</strong> Two concurrent consoles
|
||||
interleave into one line and crash the node. The harness keeps a strict
|
||||
sequence: counters over USB → close USB → BLE client → probes → stop BLE →
|
||||
counters over USB.</li>
|
||||
<li><strong><code>Bluefruit.setTxPower()</code> is advertising-only</strong> (see the commit message for
|
||||
<code>blepwr</code>); the connection runs at the SoftDevice default 0 dBm.</li>
|
||||
<li><strong>Weakening the link can lock you out of BLE.</strong> Below about −16 dBm the
|
||||
node's replies stop arriving and the value is re-applied on every reconnect
|
||||
(and, since 6. 10. 2026, saved). The way back is <code>blepwr</code> over the mesh admin
|
||||
CLI.</li>
|
||||
<li><strong>~~Runtime <code>set tx</code> does not change radiated LoRa power~~ — retracted.</strong> The
|
||||
original reading (+2 dBm → RSSI −44.1, −9 dBm → −44.0) was made with an
|
||||
instrument that could not report failure: <code>RadioLibWrapper::setTxPower()</code>
|
||||
discarded RadioLib's status, so a refused request looked exactly like an
|
||||
accepted one. Re-measured 2026-08-04 on the repeater build with <code>txpwr</code>
|
||||
confirming each step, x1 transmitting and x4 as witness:</li>
|
||||
</ul>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align: right;"><code>txpwr</code></th>
|
||||
<th style="text-align: right;">witness <code>last_rssi</code></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="text-align: right;">+22</td>
|
||||
<td style="text-align: right;">0 dBm <em>(saturated)</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right;">+14</td>
|
||||
<td style="text-align: right;">−1 dBm <em>(saturated)</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right;">+6</td>
|
||||
<td style="text-align: right;">−7 dBm</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right;">0</td>
|
||||
<td style="text-align: right;">−18 dBm</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right;">−9</td>
|
||||
<td style="text-align: right;">−28 dBm</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>31 dB of command produced 28 dB of RSSI, and the witness <code>recv</code> counter rose
|
||||
by one at every step, so no point was missed. Radiated power does follow the
|
||||
setting. The top two points are saturated — the boards were ~10 cm apart — so
|
||||
the usable range of that particular rig starts around +6 dBm; characterising
|
||||
the top end needs attenuation or distance, not a bigger number.</p>
|
||||
<p>The lesson is not about tx power. It is that a null result from an instrument
|
||||
which cannot distinguish "refused" from "no effect" is not a result at all.</p>
|
||||
<h2 id="the-two-commands-this-bench-added">The two commands this bench added</h2>
|
||||
<p>Both live in <code>examples/simple_repeater/main.cpp</code> and are repeater-only.</p>
|
||||
<h3 id="bleconn-what-the-link-is-actually-doing"><code>bleconn</code> — what the link is actually doing</h3>
|
||||
<div class="highlight"><pre><span></span><code>bleconn
|
||||
-> BLE conn: interval 75.00 ms (req 60-80), latency 0, sup timeout 4000 ms [live]
|
||||
</code></pre></div>
|
||||
<p>Reports the <strong>negotiated</strong> connection parameters, not the requested ones. The
|
||||
central is free to ignore a peripheral's request, so this is the only way to
|
||||
know whether a change like <code>f6e9aeca</code> (widening the requested interval to
|
||||
60–80 ms) is in force on a node you cannot see. The trailing <code>[live]</code> /
|
||||
<code>[last]</code> says whether a client is connected right now or these are the values
|
||||
from the last one; before any client has ever connected it answers
|
||||
<code>nothing seen yet</code>.</p>
|
||||
<h3 id="blepwr-dbm-connection-tx-power-saved"><code>blepwr [dBm]</code> — connection TX power, saved</h3>
|
||||
<div class="highlight"><pre><span></span><code>blepwr # report: BLE conn tx: 0 dBm, adv tx: 8 dBm
|
||||
blepwr 8 # set, apply to live connections and save
|
||||
blepwr default # forget the saved value, back to RPT_BLE_CONN_TX_POWER
|
||||
</code></pre></div>
|
||||
<p>The reply carries how many live connections accepted the value
|
||||
(<code>OK - BLE conn tx 8 dBm (1/1 conn), saved</code>) because the nRF52840 only takes
|
||||
−40, −20, −16, −12, −8, −4, 0 and 2..8 dBm; anything else is rejected and is
|
||||
<em>not</em> latched or saved, so a typo cannot arm itself for the next reconnect.
|
||||
The value lives in <code>/ble_pwr</code> in InternalFS, so it survives a reboot and also a
|
||||
reflash with a different build default: an explicit value is pinned even when
|
||||
it equals the default (no file = follow <code>RPT_BLE_CONN_TX_POWER</code>, which
|
||||
mast-three's env sets to 8).</p>
|
||||
<p>Sets <code>BLE_GAP_TX_POWER_ROLE_CONN</code>, which is <strong>independent of</strong>
|
||||
<code>Bluefruit.setTxPower()</code> — that one only affects advertising, despite reading
|
||||
like a global. The connection otherwise runs at the SoftDevice default of
|
||||
0 dBm; the compile-time starting value is <code>RPT_BLE_CONN_TX_POWER</code>.</p>
|
||||
<p>The value is re-applied on every 'secured' event and saved, so a setting weak
|
||||
enough to break the link persists across reconnects and reboots — at −40 dBm
|
||||
during this bench it locked the BLE console out. Fix it over the mesh admin
|
||||
CLI (<code>blepwr 0</code>), which does not depend on BLE. Until 6. 10. 2026 a weakening
|
||||
auto-reverted after 5 minutes and nothing was saved; that went away once the
|
||||
value started to be saved, because a revert that the next reboot undoes again
|
||||
only made the state harder to read.</p>
|
||||
</section>
|
||||
|
||||
</main>
|
||||
</div>
|
||||
<hr><footer>
|
||||
<div class="terminal-mkdocs-footer-grid">
|
||||
<div id="terminal-mkdocs-footer-copyright-info">
|
||||
Site built with <a href="http://www.mkdocs.org">MkDocs</a> and <a href="https://github.com/ntno/mkdocs-terminal">Terminal for MkDocs</a>.
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal" id="mkdocs_search_modal" tabindex="-1" role="alertdialog" aria-modal="true" aria-labelledby="searchModalLabel">
|
||||
<div class="modal-dialog modal-lg" role="search">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="searchModalLabel">Search</h5>
|
||||
<button type="button" class="close btn btn-default btn-ghost" data-dismiss="modal" aria-label="Close">x</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p id="searchInputLabel">Type to start searching</p>
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<input type="search" class="form-control" aria-labelledby="searchInputLabel" placeholder="" id="mkdocs-search-query" title="Please enter search terms here">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results" data-no-results-text="No document matches found"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"ldscript": "nrf52840_s140_v6.ld"
|
||||
},
|
||||
"core": "nRF5",
|
||||
"cpu": "cortex-m4",
|
||||
"extra_flags": "-DARDUINO_NRF52840_FEATHER -DNRF52840_XXAA",
|
||||
"f_cpu": "64000000L",
|
||||
"hwids": [
|
||||
["0x239A","0x8029"],
|
||||
["0x239A","0x0029"],
|
||||
["0x239A","0x002A"],
|
||||
["0x239A","0x802A"]
|
||||
],
|
||||
"usb_product": "HT-n5262",
|
||||
"mcu": "nrf52840",
|
||||
"variant": "Heltec_T114_Board",
|
||||
"bsp": {
|
||||
"name": "adafruit"
|
||||
},
|
||||
"softdevice": {
|
||||
"sd_flags": "-DS140",
|
||||
"sd_name": "s140",
|
||||
"sd_version": "6.1.1",
|
||||
"sd_fwid": "0x00B6"
|
||||
},
|
||||
"bootloader": {
|
||||
"settings_addr": "0xFF000"
|
||||
}
|
||||
},
|
||||
"connectivity": [
|
||||
"bluetooth"
|
||||
],
|
||||
"debug": {
|
||||
"jlink_device": "nRF52840_xxAA",
|
||||
"svd_path": "nrf52840.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "Heltec T114 Board",
|
||||
"upload": {
|
||||
"maximum_ram_size": 248832,
|
||||
"maximum_size": 815104,
|
||||
"speed": 115200,
|
||||
"protocol": "nrfutil",
|
||||
"protocols": [
|
||||
"jlink",
|
||||
"nrfjprog",
|
||||
"nrfutil",
|
||||
"stlink"
|
||||
],
|
||||
"use_1200bps_touch": true,
|
||||
"require_upload_port": true,
|
||||
"wait_for_upload_port": true
|
||||
},
|
||||
"url": "https://heltec.org/",
|
||||
"vendor": "Heltec"
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/* Linker script to configure memory regions. */
|
||||
|
||||
SEARCH_DIR(.)
|
||||
GROUP(-lgcc -lc -lnosys)
|
||||
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0xED000 - 0x26000
|
||||
|
||||
/* SRAM required by Softdevice depend on
|
||||
* - Attribute Table Size (Number of Services and Characteristics)
|
||||
* - Vendor UUID count
|
||||
* - Max ATT MTU
|
||||
* - Concurrent connection peripheral + central + secure links
|
||||
* - Event Len, HVN queue, Write CMD queue
|
||||
*/
|
||||
RAM (rwx) : ORIGIN = 0x20006000, LENGTH = 0x20040000 - 0x20006000
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = ALIGN(4);
|
||||
.svc_data :
|
||||
{
|
||||
PROVIDE(__start_svc_data = .);
|
||||
KEEP(*(.svc_data))
|
||||
PROVIDE(__stop_svc_data = .);
|
||||
} > RAM
|
||||
|
||||
.fs_data :
|
||||
{
|
||||
PROVIDE(__start_fs_data = .);
|
||||
KEEP(*(.fs_data))
|
||||
PROVIDE(__stop_fs_data = .);
|
||||
} > RAM
|
||||
} INSERT AFTER .data;
|
||||
|
||||
INCLUDE "nrf52_common.ld"
|
||||
@@ -0,0 +1,38 @@
|
||||
/* Linker script to configure memory regions. */
|
||||
|
||||
SEARCH_DIR(.)
|
||||
GROUP(-lgcc -lc -lnosys)
|
||||
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x27000, LENGTH = 0xED000 - 0x27000
|
||||
|
||||
/* SRAM required by Softdevice depend on
|
||||
* - Attribute Table Size (Number of Services and Characteristics)
|
||||
* - Vendor UUID count
|
||||
* - Max ATT MTU
|
||||
* - Concurrent connection peripheral + central + secure links
|
||||
* - Event Len, HVN queue, Write CMD queue
|
||||
*/
|
||||
RAM (rwx) : ORIGIN = 0x20006000, LENGTH = 0x20040000 - 0x20006000
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = ALIGN(4);
|
||||
.svc_data :
|
||||
{
|
||||
PROVIDE(__start_svc_data = .);
|
||||
KEEP(*(.svc_data))
|
||||
PROVIDE(__stop_svc_data = .);
|
||||
} > RAM
|
||||
|
||||
.fs_data :
|
||||
{
|
||||
PROVIDE(__start_fs_data = .);
|
||||
KEEP(*(.fs_data))
|
||||
PROVIDE(__stop_fs_data = .);
|
||||
} > RAM
|
||||
} INSERT AFTER .data;
|
||||
|
||||
INCLUDE "nrf52_common.ld"
|
||||
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino":{
|
||||
"ldscript": "nrf52840_s140_v6.ld"
|
||||
},
|
||||
"core": "nRF5",
|
||||
"cpu": "cortex-m4",
|
||||
"extra_flags": "-DARDUINO_NRF52840_FEATHER -DNRF52840_XXAA",
|
||||
"f_cpu": "64000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x239A",
|
||||
"0x00B3"
|
||||
],
|
||||
[
|
||||
"0x239A",
|
||||
"0x8029"
|
||||
],
|
||||
[
|
||||
"0x239A",
|
||||
"0x0029"
|
||||
],
|
||||
[
|
||||
"0x239A",
|
||||
"0x002A"
|
||||
],
|
||||
[
|
||||
"0x239A",
|
||||
"0x802A"
|
||||
]
|
||||
],
|
||||
"usb_product": "ProMicro NRF52840",
|
||||
"mcu": "nrf52840",
|
||||
"variant": "promicro_nrf52840",
|
||||
"variants_dir": "variants",
|
||||
"bsp": {
|
||||
"name": "adafruit"
|
||||
},
|
||||
"softdevice": {
|
||||
"sd_flags": "-DS140",
|
||||
"sd_name": "s140",
|
||||
"sd_version": "6.1.1",
|
||||
"sd_fwid": "0x00B6"
|
||||
},
|
||||
"bootloader": {
|
||||
"settings_addr": "0xFF000"
|
||||
}
|
||||
},
|
||||
"connectivity": [
|
||||
"bluetooth"
|
||||
],
|
||||
"debug": {
|
||||
"jlink_device": "nRF52840_xxAA",
|
||||
"svd_path": "nrf52840.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino",
|
||||
"zephyr"
|
||||
],
|
||||
"name": "ProMicro NRF52840",
|
||||
"upload": {
|
||||
"maximum_ram_size": 248832,
|
||||
"maximum_size": 815104,
|
||||
"speed": 115200,
|
||||
"protocol": "nrfutil",
|
||||
"protocols": [
|
||||
"jlink",
|
||||
"nrfjprog",
|
||||
"nrfutil",
|
||||
"stlink"
|
||||
],
|
||||
"use_1200bps_touch": true,
|
||||
"require_upload_port": true,
|
||||
"wait_for_upload_port": true
|
||||
},
|
||||
"url": "https://www.nologo.tech/en/product/otherboard/NRF52840.html",
|
||||
"vendor": "Nologo"
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"ldscript": "esp32s3_out.ld",
|
||||
"memory_type": "qio_opi"
|
||||
},
|
||||
"core": "esp32",
|
||||
"extra_flags": [
|
||||
"-DBOARD_HAS_PSRAM",
|
||||
"-DARDUINO_USB_CDC_ON_BOOT=1",
|
||||
"-DARDUINO_USB_MODE=0",
|
||||
"-DARDUINO_RUNNING_CORE=1",
|
||||
"-DARDUINO_EVENT_RUNNING_CORE=0"
|
||||
],
|
||||
"f_cpu": "240000000L",
|
||||
"f_flash": "80000000L",
|
||||
"flash_mode": "qio",
|
||||
"hwids": [["0x303A", "0x1001"]],
|
||||
"mcu": "esp32s3",
|
||||
"variant": "esp32s3"
|
||||
},
|
||||
"connectivity": [
|
||||
"wifi"
|
||||
],
|
||||
"debug": {
|
||||
"default_tool": "esp-builtin",
|
||||
"onboard_tools": ["esp-builtin"],
|
||||
"openocd_target": "esp32s3.cfg"
|
||||
},
|
||||
"frameworks": ["arduino", "espidf"],
|
||||
"name": "BQ Station G2",
|
||||
"upload": {
|
||||
"flash_size": "16MB",
|
||||
"maximum_ram_size": 327680,
|
||||
"maximum_size": 16777216,
|
||||
"use_1200bps_touch": true,
|
||||
"wait_for_upload_port": true,
|
||||
"require_upload_port": true,
|
||||
"speed": 921600
|
||||
},
|
||||
"url": "https://wiki.uniteng.com/en/meshtastic/station-g2",
|
||||
"vendor": "BQ Consulting"
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"ldscript": "nrf52840_s140_v6.ld"
|
||||
},
|
||||
"core": "nRF5",
|
||||
"cpu": "cortex-m4",
|
||||
"extra_flags": "-DARDUINO_NRF52840_PCA10056 -DNRF52840_XXAA",
|
||||
"f_cpu": "64000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x239A",
|
||||
"0x8029"
|
||||
]
|
||||
],
|
||||
"usb_product": "NRF52 DK",
|
||||
"mcu": "nrf52840",
|
||||
"variant": "pca10056",
|
||||
"bsp": {
|
||||
"name": "adafruit"
|
||||
},
|
||||
"softdevice": {
|
||||
"sd_flags": "-DS140",
|
||||
"sd_name": "s140",
|
||||
"sd_version": "6.1.1",
|
||||
"sd_fwid": "0x00B6"
|
||||
},
|
||||
"bootloader": {
|
||||
"settings_addr": "0xFF000"
|
||||
}
|
||||
},
|
||||
"connectivity": [
|
||||
"bluetooth"
|
||||
],
|
||||
"debug": {
|
||||
"jlink_device": "nRF52840_xxAA",
|
||||
"onboard_tools": [
|
||||
"jlink"
|
||||
],
|
||||
"svd_path": "nrf52840.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "LilyGo T-ECHO",
|
||||
"upload": {
|
||||
"maximum_ram_size": 248832,
|
||||
"maximum_size": 815104,
|
||||
"require_upload_port": true,
|
||||
"speed": 115200,
|
||||
"protocol": "jlink",
|
||||
"protocols": [
|
||||
"jlink",
|
||||
"nrfjprog",
|
||||
"stlink",
|
||||
"cmsis-dap",
|
||||
"blackmagic"
|
||||
]
|
||||
},
|
||||
"url": "https://os.mbed.com/platforms/Nordic-nRF52840-DK/",
|
||||
"vendor": "Nordic"
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"ldscript": "esp32s3_out.ld",
|
||||
"partitions": "default.csv",
|
||||
"memory_type": "qio_qspi"
|
||||
},
|
||||
"core": "esp32",
|
||||
"extra_flags": [
|
||||
"-DARDUINO_LILYGO_T3_S3_V1_X",
|
||||
"-DBOARD_HAS_PSRAM",
|
||||
"-DARDUINO_USB_CDC_ON_BOOT=1",
|
||||
"-DARDUINO_RUNNING_CORE=1",
|
||||
"-DARDUINO_EVENT_RUNNING_CORE=1",
|
||||
"-DARDUINO_USB_MODE=1"
|
||||
],
|
||||
"f_cpu": "240000000L",
|
||||
"f_flash": "80000000L",
|
||||
"flash_mode": "qio",
|
||||
"mcu": "esp32s3",
|
||||
"variant": "esp32s3"
|
||||
},
|
||||
"connectivity": [
|
||||
"wifi"
|
||||
],
|
||||
"debug": {
|
||||
"openocd_target": "esp32s3.cfg"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino",
|
||||
"espidf"
|
||||
],
|
||||
"name": "LilyGo T3-S3 Radio",
|
||||
"upload": {
|
||||
"flash_size": "4MB",
|
||||
"maximum_ram_size": 327680,
|
||||
"maximum_size": 4194304,
|
||||
"use_1200bps_touch": true,
|
||||
"wait_for_upload_port": true,
|
||||
"require_upload_port": true,
|
||||
"speed": 460800
|
||||
},
|
||||
"url": "https://www.lilygo.cc",
|
||||
"vendor": "LilyGo"
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"ldscript": "nrf52840_s140_v7.ld"
|
||||
},
|
||||
"core": "nRF5",
|
||||
"cpu": "cortex-m4",
|
||||
"extra_flags": "-DARDUINO_WIO_WM1110 -DNRF52840_XXAA",
|
||||
"f_cpu": "64000000L",
|
||||
"hwids": [
|
||||
["0x239A", "0x8029"],
|
||||
["0x239A", "0x0029"],
|
||||
["0x239A", "0x002A"],
|
||||
["0x239A", "0x802A"]
|
||||
],
|
||||
"usb_product": "T1000-E-BOOT",
|
||||
"mcu": "nrf52840",
|
||||
"variant": "Seeed_T1000-E",
|
||||
"bsp": {
|
||||
"name": "adafruit"
|
||||
},
|
||||
"softdevice": {
|
||||
"sd_flags": "-DS140",
|
||||
"sd_name": "s140",
|
||||
"sd_version": "7.3.0",
|
||||
"sd_fwid": "0x0123"
|
||||
},
|
||||
"bootloader": {
|
||||
"settings_addr": "0xFF000"
|
||||
}
|
||||
},
|
||||
"connectivity": ["bluetooth"],
|
||||
"debug": {
|
||||
"jlink_device": "nRF52840_xxAA",
|
||||
"svd_path": "nrf52840.svd"
|
||||
},
|
||||
"frameworks": ["arduino"],
|
||||
"name": "Seeed T1000-E",
|
||||
"upload": {
|
||||
"maximum_ram_size": 248832,
|
||||
"maximum_size": 815104,
|
||||
"speed": 115200,
|
||||
"protocol": "nrfutil",
|
||||
"protocols": [
|
||||
"jlink",
|
||||
"nrfjprog",
|
||||
"nrfutil",
|
||||
"stlink",
|
||||
"cmsis-dap",
|
||||
"blackmagic"
|
||||
],
|
||||
"use_1200bps_touch": true,
|
||||
"require_upload_port": true,
|
||||
"wait_for_upload_port": true
|
||||
},
|
||||
"url": "https://www.seeedstudio.com/SenseCAP-Card-Tracker-T1000-E-for-Meshtastic-p-5913.html",
|
||||
"vendor": "Seeed Studio"
|
||||
}
|
||||
@@ -1,640 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<meta name="generator" content="mkdocs-1.6.1, mkdocs-terminal-4.8.0">
|
||||
|
||||
<meta name="description" content="MeshCore fork meshcore-tth -- repeater antispam, diagnostics, OTA, Czech mesh defaults">
|
||||
|
||||
|
||||
<link rel="canonical" href="https://tth-pub.pages.rfa.cz/meshcore-tth/budka-sensor/"><link rel="icon" type="image/png" sizes="192x192" href="../img/android-chrome-192x192.png" />
|
||||
<link rel="icon" type="image/png" sizes="512x512" href="../img/android-chrome-512x512.png" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="../img/apple-touch-icon.png" />
|
||||
<link rel="shortcut icon" type="image/png" sizes="48x48" href="../img/favicon.ico" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="../img/favicon-16x16.png" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="../img/favicon-32x32.png" />
|
||||
|
||||
|
||||
|
||||
|
||||
<title>Budka as a sensor - MeshCore TTH</title>
|
||||
|
||||
|
||||
<link href="../css/fontawesome/css/fontawesome.min.css" rel="stylesheet">
|
||||
<link href="../css/fontawesome/css/solid.min.css" rel="stylesheet">
|
||||
<link href="../css/normalize.css" rel="stylesheet">
|
||||
<link href="../css/terminal.css" rel="stylesheet">
|
||||
<link href="../css/theme.css" rel="stylesheet">
|
||||
<link href="../css/theme.tile_grid.css" rel="stylesheet">
|
||||
<link href="../css/theme.footer.css" rel="stylesheet">
|
||||
<!-- dark color palette -->
|
||||
<link href="../css/palettes/dark.css" rel="stylesheet">
|
||||
|
||||
<!-- page layout -->
|
||||
<style>
|
||||
/* initially set page layout to a one column grid */
|
||||
.terminal-mkdocs-main-grid {
|
||||
display: grid;
|
||||
grid-column-gap: 1.4em;
|
||||
grid-template-columns: auto;
|
||||
grid-template-rows: auto;
|
||||
}
|
||||
|
||||
/*
|
||||
* when side navigation is not hidden, use a two column grid.
|
||||
* if the screen is too narrow, fall back to the initial one column grid layout.
|
||||
* in this case the main content will be placed under the navigation panel.
|
||||
*/
|
||||
@media only screen and (min-width: 70em) {
|
||||
.terminal-mkdocs-main-grid {
|
||||
grid-template-columns: 4fr 9fr;
|
||||
}
|
||||
}</style>
|
||||
|
||||
<!-- cursor_animation override -->
|
||||
<style>
|
||||
#mkdocs-terminal-site-name.terminal-prompt::after {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<link href="../_stylesheets/tth.css" rel="stylesheet">
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- search css support -->
|
||||
<link href="../css/search/bootstrap-modal.css" rel="stylesheet">
|
||||
<!-- search scripts -->
|
||||
<script>
|
||||
var base_url = "..",
|
||||
shortcuts = "{}";
|
||||
</script>
|
||||
<script src="../js/jquery/jquery-1.10.1.min.js" defer></script>
|
||||
<script src="../js/bootstrap/bootstrap.min.js" defer></script>
|
||||
<script src="../js/mkdocs/base.js" defer></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="../search/main.js"></script>
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body class="terminal"><div class="container">
|
||||
<div class="terminal-nav">
|
||||
<header class="terminal-logo">
|
||||
<div id="mkdocs-terminal-site-name" class="logo terminal-prompt"><a href="https://tth-pub.pages.rfa.cz/meshcore-tth/" class="no-style">MeshCore TTH</a></div>
|
||||
</header>
|
||||
|
||||
<nav class="terminal-menu">
|
||||
|
||||
<ul vocab="https://schema.org/" typeof="BreadcrumbList">
|
||||
|
||||
|
||||
<li property="itemListElement" typeof="ListItem">
|
||||
<a href=".." class="menu-item " property="item" typeof="WebPage">
|
||||
<span property="name">About the fork</span>
|
||||
</a>
|
||||
<meta property="position" content="0">
|
||||
</li>
|
||||
|
||||
|
||||
<li property="itemListElement" typeof="ListItem">
|
||||
<a href="../cs/" class="menu-item " property="item" typeof="WebPage">
|
||||
<span property="name">Česky</span>
|
||||
</a>
|
||||
<meta property="position" content="1">
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li property="itemListElement" typeof="ListItem">
|
||||
<a href="#" class="menu-item" data-toggle="modal" data-target="#mkdocs_search_modal" property="item" typeof="SearchAction">
|
||||
<i aria-hidden="true" class="fa fa-search"></i> <span property="name">Search</span>
|
||||
</a>
|
||||
<meta property="position" content="2">
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="terminal-mkdocs-main-grid"><aside id="terminal-mkdocs-side-panel"><nav>
|
||||
<ul class="terminal-mkdocs-side-nav-items">
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="..">About the fork</a>
|
||||
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../cs/">Česky</a>
|
||||
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="
|
||||
|
||||
|
||||
|
||||
terminal-mkdocs-side-nav-item--active terminal-mkdocs-side-nav-section-no-index">Fork meshcore-tth</span>
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="terminal-mkdocs-side-nav-li-ul">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../tth-commands/">Console commands</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../ota/">Firmware update by the admin (OTA)</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../power/">Power saving</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
<span class="terminal-mkdocs-side-nav-item--active">Budka as a sensor</span>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../ble-lora-coexistence/">BLE/LoRa coexistence</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="
|
||||
|
||||
|
||||
|
||||
terminal-mkdocs-side-nav-item terminal-mkdocs-side-nav-section-no-index">MeshCore (upstream)</span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="terminal-mkdocs-side-nav-li-ul">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../meshcore/">Introduction</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../faq/">FAQ</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../cli_commands/">CLI commands</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../companion_cli/">Companion CLI</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../companion_protocol/">Companion protocol</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../terminal_chat_cli/">Terminal chat CLI</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../kiss_modem_protocol/">KISS modem protocol</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../packet_format/">Packet format</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../payloads/">Payloads</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../stats_binary_frames/">Stats binary frames</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../number_allocations/">Number allocations</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../qr_codes/">QR codes</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../radio_presets/">Radio presets</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../nrf52_power_management/">nRF52 power management</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav><hr>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="#budka-link-a-chytra-budka-as-a-sensor-source">Budka link — a Chytra Budka as a sensor source</a></li>
|
||||
<li><a href="#build">Build</a></li><li><a href="#wiring">Wiring</a></li><li><a href="#telemetry-layout">Telemetry layout</a></li><li><a href="#bench-result-13-10-2026">Bench result (13. 10. 2026)</a></li><li><a href="#not-done">Not done</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</aside>
|
||||
<main id="terminal-mkdocs-main-content">
|
||||
<section id="mkdocs-terminal-content">
|
||||
<h1 id="budka-link-a-chytra-budka-as-a-sensor-source">Budka link — a Chytra Budka as a sensor source</h1>
|
||||
<p>A Chytra Budka (ESP32-S3 bird box) sends its readings over a one-way UART line
|
||||
to a XIAO nRF52840 running <code>simple_sensor</code>; the sensor serves them as
|
||||
CayenneLPP telemetry to anyone on the mesh. The line format and the budka side
|
||||
are documented in the chytra-budka repo, <code>firmware/MESHCORE.md</code>.</p>
|
||||
<h2 id="build">Build</h2>
|
||||
<p><code>BudkaLinkSensorManager</code> (<code>src/helpers/sensors/</code>) replaces the variant's
|
||||
<code>EnvironmentSensorManager</code> when the env defines <code>BUDKA_LINK_RX_PIN</code>; every
|
||||
other env is unchanged.</p>
|
||||
<div class="highlight"><pre><span></span><code><span class="na">[env</span><span class="o">:</span><span class="s">Xiao_x1_budka]</span><span class="w"> </span><span class="c1">; platformio.local.ini</span>
|
||||
<span class="na">extends</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">env:Xiao_nrf52_sensor</span>
|
||||
<span class="na">build_flags</span><span class="w"> </span><span class="o">=</span>
|
||||
<span class="w"> </span><span class="na">${env</span><span class="o">:</span><span class="s">Xiao_nrf52_sensor.build_flags}</span>
|
||||
<span class="w"> </span><span class="na">${test_radio.build_flags} ; bench</span><span class="o">:</span><span class="w"> </span><span class="s">test band only</span>
|
||||
<span class="w"> </span><span class="na">-D BUDKA_LINK_RX_PIN</span><span class="o">=</span><span class="s">0</span><span class="w"> </span><span class="c1">; D0 = the only pad LoRa + I²C leave free</span>
|
||||
</code></pre></div>
|
||||
<p>Optional: <code>BUDKA_LINK_TX_PIN</code> (default <code>LED_GREEN</code> — nothing is ever sent, the
|
||||
idle-high line keeps that LED dark), <code>BUDKA_LINK_BAUD</code> (115200),
|
||||
<code>BUDKA_LINK_METERS</code> (3), <code>BUDKA_LINK_STALE_MS</code> (120 s).</p>
|
||||
<h2 id="wiring">Wiring</h2>
|
||||
<p>Budka <code>mc_tx</code> pad → XIAO <strong>D0</strong>, GND ↔ GND, each board on its own USB. A
|
||||
1 kΩ series resistor protects against back-powering when one side is off.</p>
|
||||
<h2 id="telemetry-layout">Telemetry layout</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>channel</th>
|
||||
<th>content</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>the node itself</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>next</td>
|
||||
<td>budka: temperature, humidity, pressure, motion count (generic sensor)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>next + k</td>
|
||||
<td>UC96 meter <em>k</em>: voltage, current, power (analog input), energy (kWh)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>A line with a bad checksum is dropped whole; a value not refreshed for 2 min is
|
||||
left out. Meter channels stay reserved while a meter is missing.</p>
|
||||
<p>Read it with <code>.tth/tools/budka_telem.py <companion-port> <sensor-name></code>. The sensor
|
||||
answers only clients in its ACL — a request from anyone else is dropped
|
||||
(<code>recv matches no peers</code> in a <code>MESH_DEBUG</code> build). Add the companion from the
|
||||
sensor's USB console with <code>setperm <companion-pubkey> 1</code>, or log in as admin.
|
||||
The port may be a pyserial URL (<code>socket://…</code> for an openHop companion), and the
|
||||
name may be the sensor's public key when the companion does not have it yet.</p>
|
||||
<h2 id="bench-result-13-10-2026">Bench result (13. 10. 2026)</h2>
|
||||
<p>x1 (sensor, test band) fed by the bench budka; x4 as USB companion:</p>
|
||||
<div class="highlight"><pre><span></span><code>ch2 temp_C 25.3 humidity_% 59.0 generic 29
|
||||
ch3 voltage_V 4.94 current_A 0.10 analog_in 0.49 energy_kWh 0.111
|
||||
ch4 voltage_V 4.94 current_A 0.18 analog_in 0.89 energy_kWh 0.311
|
||||
</code></pre></div>
|
||||
<h2 id="not-done">Not done</h2>
|
||||
<p>Alerts (reed opened, budka WiFi down) and the return direction (mesh → budka).
|
||||
The sensor build has no <code>dfu</code> console command — reflash with
|
||||
<code>pio run -t upload</code>, one touch per power session.</p>
|
||||
</section>
|
||||
|
||||
</main>
|
||||
</div>
|
||||
<hr><footer>
|
||||
<div class="terminal-mkdocs-footer-grid">
|
||||
<div id="terminal-mkdocs-footer-copyright-info">
|
||||
Site built with <a href="http://www.mkdocs.org">MkDocs</a> and <a href="https://github.com/ntno/mkdocs-terminal">Terminal for MkDocs</a>.
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal" id="mkdocs_search_modal" tabindex="-1" role="alertdialog" aria-modal="true" aria-labelledby="searchModalLabel">
|
||||
<div class="modal-dialog modal-lg" role="search">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="searchModalLabel">Search</h5>
|
||||
<button type="button" class="close btn btn-default btn-ghost" data-dismiss="modal" aria-label="Close">x</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p id="searchInputLabel">Type to start searching</p>
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<input type="search" class="form-control" aria-labelledby="searchInputLabel" placeholder="" id="mkdocs-search-query" title="Please enter search terms here">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results" data-no-results-text="No document matches found"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,156 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# usage
|
||||
# sh build.sh build-firmware RAK_4631_Repeater
|
||||
# sh build.sh build-firmwares
|
||||
# sh build.sh build-companion-firmwares
|
||||
# sh build.sh build-repeater-firmwares
|
||||
# sh build.sh build-room-server-firmwares
|
||||
|
||||
# get a list of pio env names that start with "env:"
|
||||
get_pio_envs() {
|
||||
echo $(pio project config | grep 'env:' | sed 's/env://')
|
||||
}
|
||||
|
||||
# $1 should be the string to find (case insensitive)
|
||||
get_pio_envs_containing_string() {
|
||||
shopt -s nocasematch
|
||||
envs=($(get_pio_envs))
|
||||
for env in "${envs[@]}"; do
|
||||
if [[ "$env" == *${1}* ]]; then
|
||||
echo $env
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# build firmware for the provided pio env in $1
|
||||
build_firmware() {
|
||||
|
||||
# get git commit sha
|
||||
COMMIT_HASH=$(git rev-parse --short HEAD)
|
||||
|
||||
# set firmware build date
|
||||
FIRMWARE_BUILD_DATE=$(date '+%d-%b-%Y')
|
||||
|
||||
# get FIRMWARE_VERSION, which should be provided by the environment
|
||||
if [ -z "$FIRMWARE_VERSION" ]; then
|
||||
echo "FIRMWARE_VERSION must be set in environment"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# set firmware version string
|
||||
# e.g: v1.0.0-abcdef
|
||||
FIRMWARE_VERSION_STRING="${FIRMWARE_VERSION}-${COMMIT_HASH}"
|
||||
|
||||
# craft filename
|
||||
# e.g: RAK_4631_Repeater-v1.0.0-SHA
|
||||
FIRMWARE_FILENAME="$1-${FIRMWARE_VERSION_STRING}"
|
||||
|
||||
# export build flags for pio so we can inject firmware version info
|
||||
export PLATFORMIO_BUILD_FLAGS="-DFIRMWARE_BUILD_DATE='\"${FIRMWARE_BUILD_DATE}\"' -DFIRMWARE_VERSION='\"${FIRMWARE_VERSION_STRING}\"'"
|
||||
|
||||
# build firmware target
|
||||
pio run -e $1
|
||||
|
||||
# build merge-bin for esp32 fresh install
|
||||
if [ -f .pio/build/$1/firmware.bin ]; then
|
||||
pio run -t mergebin -e $1
|
||||
fi
|
||||
|
||||
# build .uf2 for nrf52 boards
|
||||
if [[ $1 == *"RAK_4631"* || $1 == *"t1000e"* || $1 == *"t114"* || $1 == *"T-Echo"* || $1 == *"Faketec"* || $1 == *"ProMicro"* ]]; then
|
||||
python bin/uf2conv/uf2conv.py .pio/build/$1/firmware.hex -c -o .pio/build/$1/firmware.uf2 -f 0xADA52840
|
||||
fi
|
||||
|
||||
# copy .bin, .uf2, and .zip to out folder
|
||||
# e.g: Heltec_v3_room_server-v1.0.0-SHA.bin
|
||||
# e.g: RAK_4631_Repeater-v1.0.0-SHA.uf2
|
||||
|
||||
# copy .bin for esp32 boards
|
||||
cp .pio/build/$1/firmware.bin out/${FIRMWARE_FILENAME}.bin 2>/dev/null || true
|
||||
cp .pio/build/$1/firmware-merged.bin out/${FIRMWARE_FILENAME}-merged.bin 2>/dev/null || true
|
||||
|
||||
# copy .zip and .uf2 of nrf52 boards
|
||||
cp .pio/build/$1/firmware.uf2 out/${FIRMWARE_FILENAME}.uf2 2>/dev/null || true
|
||||
cp .pio/build/$1/firmware.zip out/${FIRMWARE_FILENAME}.zip 2>/dev/null || true
|
||||
|
||||
}
|
||||
|
||||
# firmwares containing $1 will be built
|
||||
build_all_firmwares_matching() {
|
||||
envs=($(get_pio_envs_containing_string "$1"))
|
||||
for env in "${envs[@]}"; do
|
||||
build_firmware $env
|
||||
done
|
||||
}
|
||||
|
||||
build_repeater_firmwares() {
|
||||
|
||||
# # build specific repeater firmwares
|
||||
# build_firmware "Heltec_v2_repeater"
|
||||
# build_firmware "Heltec_v3_repeater"
|
||||
# build_firmware "Xiao_C3_Repeater_sx1262"
|
||||
# build_firmware "Xiao_S3_WIO_Repeater"
|
||||
# build_firmware "LilyGo_T3S3_sx1262_Repeater"
|
||||
# build_firmware "RAK_4631_Repeater"
|
||||
|
||||
# build all repeater firmwares
|
||||
build_all_firmwares_matching "repeater"
|
||||
|
||||
}
|
||||
|
||||
build_companion_firmwares() {
|
||||
|
||||
# # build specific companion firmwares
|
||||
# build_firmware "Heltec_v2_companion_radio_usb"
|
||||
# build_firmware "Heltec_v2_companion_radio_ble"
|
||||
# build_firmware "Heltec_v3_companion_radio_usb"
|
||||
# build_firmware "Heltec_v3_companion_radio_ble"
|
||||
# build_firmware "Xiao_S3_WIO_companion_radio_ble"
|
||||
# build_firmware "LilyGo_T3S3_sx1262_companion_radio_usb"
|
||||
# build_firmware "LilyGo_T3S3_sx1262_companion_radio_ble"
|
||||
# build_firmware "RAK_4631_companion_radio_usb"
|
||||
# build_firmware "RAK_4631_companion_radio_ble"
|
||||
# build_firmware "t1000e_companion_radio_ble"
|
||||
|
||||
# build all companion firmwares
|
||||
build_all_firmwares_matching "companion_radio_usb"
|
||||
build_all_firmwares_matching "companion_radio_ble"
|
||||
|
||||
}
|
||||
|
||||
build_room_server_firmwares() {
|
||||
|
||||
# # build specific room server firmwares
|
||||
# build_firmware "Heltec_v3_room_server"
|
||||
# build_firmware "RAK_4631_room_server"
|
||||
|
||||
# build all room server firmwares
|
||||
build_all_firmwares_matching "room_server"
|
||||
|
||||
}
|
||||
|
||||
build_firmwares() {
|
||||
build_companion_firmwares
|
||||
build_repeater_firmwares
|
||||
build_room_server_firmwares
|
||||
}
|
||||
|
||||
# clean build dir
|
||||
rm -rf out
|
||||
mkdir -p out
|
||||
|
||||
# handle script args
|
||||
if [[ $1 == "build-firmware" ]]; then
|
||||
if [ "$2" ]; then
|
||||
build_firmware $2
|
||||
fi
|
||||
elif [[ $1 == "build-firmwares" ]]; then
|
||||
build_firmwares
|
||||
elif [[ $1 == "build-companion-firmwares" ]]; then
|
||||
build_companion_firmwares
|
||||
elif [[ $1 == "build-repeater-firmwares" ]]; then
|
||||
build_repeater_firmwares
|
||||
elif [[ $1 == "build-room-server-firmwares" ]]; then
|
||||
build_room_server_firmwares
|
||||
fi
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
-889
@@ -1,889 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<meta name="generator" content="mkdocs-1.6.1, mkdocs-terminal-4.8.0">
|
||||
|
||||
<meta name="description" content="MeshCore fork meshcore-tth -- repeater antispam, diagnostics, OTA, Czech mesh defaults">
|
||||
|
||||
|
||||
<link rel="canonical" href="https://tth-pub.pages.rfa.cz/meshcore-tth/cs/"><link rel="icon" type="image/png" sizes="192x192" href="../img/android-chrome-192x192.png" />
|
||||
<link rel="icon" type="image/png" sizes="512x512" href="../img/android-chrome-512x512.png" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="../img/apple-touch-icon.png" />
|
||||
<link rel="shortcut icon" type="image/png" sizes="48x48" href="../img/favicon.ico" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="../img/favicon-16x16.png" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="../img/favicon-32x32.png" />
|
||||
|
||||
|
||||
|
||||
|
||||
<title>Česky - MeshCore TTH</title>
|
||||
|
||||
|
||||
<link href="../css/fontawesome/css/fontawesome.min.css" rel="stylesheet">
|
||||
<link href="../css/fontawesome/css/solid.min.css" rel="stylesheet">
|
||||
<link href="../css/normalize.css" rel="stylesheet">
|
||||
<link href="../css/terminal.css" rel="stylesheet">
|
||||
<link href="../css/theme.css" rel="stylesheet">
|
||||
<link href="../css/theme.tile_grid.css" rel="stylesheet">
|
||||
<link href="../css/theme.footer.css" rel="stylesheet">
|
||||
<!-- dark color palette -->
|
||||
<link href="../css/palettes/dark.css" rel="stylesheet">
|
||||
|
||||
<!-- page layout -->
|
||||
<style>
|
||||
/* initially set page layout to a one column grid */
|
||||
.terminal-mkdocs-main-grid {
|
||||
display: grid;
|
||||
grid-column-gap: 1.4em;
|
||||
grid-template-columns: auto;
|
||||
grid-template-rows: auto;
|
||||
}
|
||||
|
||||
/*
|
||||
* when side navigation is not hidden, use a two column grid.
|
||||
* if the screen is too narrow, fall back to the initial one column grid layout.
|
||||
* in this case the main content will be placed under the navigation panel.
|
||||
*/
|
||||
@media only screen and (min-width: 70em) {
|
||||
.terminal-mkdocs-main-grid {
|
||||
grid-template-columns: 4fr 9fr;
|
||||
}
|
||||
}</style>
|
||||
|
||||
<!-- cursor_animation override -->
|
||||
<style>
|
||||
#mkdocs-terminal-site-name.terminal-prompt::after {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<link href="../_stylesheets/tth.css" rel="stylesheet">
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- search css support -->
|
||||
<link href="../css/search/bootstrap-modal.css" rel="stylesheet">
|
||||
<!-- search scripts -->
|
||||
<script>
|
||||
var base_url = "..",
|
||||
shortcuts = "{}";
|
||||
</script>
|
||||
<script src="../js/jquery/jquery-1.10.1.min.js" defer></script>
|
||||
<script src="../js/bootstrap/bootstrap.min.js" defer></script>
|
||||
<script src="../js/mkdocs/base.js" defer></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="../search/main.js"></script>
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body class="terminal"><div class="container">
|
||||
<div class="terminal-nav">
|
||||
<header class="terminal-logo">
|
||||
<div id="mkdocs-terminal-site-name" class="logo terminal-prompt"><a href="https://tth-pub.pages.rfa.cz/meshcore-tth/" class="no-style">MeshCore TTH</a></div>
|
||||
</header>
|
||||
|
||||
<nav class="terminal-menu">
|
||||
|
||||
<ul vocab="https://schema.org/" typeof="BreadcrumbList">
|
||||
|
||||
|
||||
<li property="itemListElement" typeof="ListItem">
|
||||
<a href=".." class="menu-item " property="item" typeof="WebPage">
|
||||
<span property="name">About the fork</span>
|
||||
</a>
|
||||
<meta property="position" content="0">
|
||||
</li>
|
||||
|
||||
|
||||
<li property="itemListElement" typeof="ListItem">
|
||||
<a href="./" class="menu-item active" property="item" typeof="WebPage">
|
||||
<span property="name">Česky</span>
|
||||
</a>
|
||||
<meta property="position" content="1">
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li property="itemListElement" typeof="ListItem">
|
||||
<a href="#" class="menu-item" data-toggle="modal" data-target="#mkdocs_search_modal" property="item" typeof="SearchAction">
|
||||
<i aria-hidden="true" class="fa fa-search"></i> <span property="name">Search</span>
|
||||
</a>
|
||||
<meta property="position" content="2">
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="terminal-mkdocs-main-grid"><aside id="terminal-mkdocs-side-panel"><nav>
|
||||
<ul class="terminal-mkdocs-side-nav-items">
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="..">About the fork</a>
|
||||
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li">
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="terminal-mkdocs-side-nav-item--active">Česky</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="
|
||||
|
||||
|
||||
|
||||
terminal-mkdocs-side-nav-item terminal-mkdocs-side-nav-section-no-index">Fork meshcore-tth</span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="terminal-mkdocs-side-nav-li-ul">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../tth-commands/">Console commands</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../ota/">Firmware update by the admin (OTA)</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../power/">Power saving</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../budka-sensor/">Budka as a sensor</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../ble-lora-coexistence/">BLE/LoRa coexistence</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="
|
||||
|
||||
|
||||
|
||||
terminal-mkdocs-side-nav-item terminal-mkdocs-side-nav-section-no-index">MeshCore (upstream)</span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="terminal-mkdocs-side-nav-li-ul">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../meshcore/">Introduction</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../faq/">FAQ</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../cli_commands/">CLI commands</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../companion_cli/">Companion CLI</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../companion_protocol/">Companion protocol</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../terminal_chat_cli/">Terminal chat CLI</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../kiss_modem_protocol/">KISS modem protocol</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../packet_format/">Packet format</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../payloads/">Payloads</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../stats_binary_frames/">Stats binary frames</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../number_allocations/">Number allocations</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../qr_codes/">QR codes</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../radio_presets/">Radio presets</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="../nrf52_power_management/">nRF52 power management</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav><hr>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="#o-tomto-forku-meshcore-tth">O tomto forku (meshcore-tth)</a></li>
|
||||
<li><a href="#repeater-antispam-vsechno-vypinatelne-nic-z-toho-neni-v-upstreamu">Repeater: antispam (všechno vypínatelné, nic z toho není v upstreamu)</a></li><li><a href="#diagnostika-a-provoz">Diagnostika a provoz</a></li><li><a href="#opravy-jadra">Opravy jádra</a></li><li><a href="#napajeni-hodiny-gps">Napájení, hodiny, GPS</a></li><li><a href="#senzory-a-companiony">Senzory a companiony</a></li><li><a href="#verejne-buildy-vychozi-nastaveni-pro-cesky-mesh">Veřejné buildy: výchozí nastavení pro český mesh</a></li><li><a href="#nahrani-releasu">Nahrání releasu</a></li><li><a href="#experimentalni-aktualizace-firmwaru-od-admina-ota">Experimentální: aktualizace firmwaru od admina (*-ota)</a></li><li><a href="#sestaveni">Sestavení</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</aside>
|
||||
<main id="terminal-mkdocs-main-content">
|
||||
<section id="mkdocs-terminal-content">
|
||||
<h1 id="o-tomto-forku-meshcore-tth">O tomto forku (meshcore-tth)</h1>
|
||||
<p><em><a href="../">English version</a> -- experimental
|
||||
firmware, not meant for regular users.</em></p>
|
||||
<div class="admonition warning">
|
||||
<p class="admonition-title">Warning</p>
|
||||
<p><strong>Experimentální firmware – není určený pro běžné uživatele.</strong> Tenhle fork
|
||||
i všechny jeho releasy jsou osobní vývojová větev pro uzly jedné malé sítě:
|
||||
rolling release nad upstreamovou větví <code>dev</code>, sestavovaný automaticky
|
||||
zhruba dvakrát denně, bez stabilního kanálu, bez podpory a vyzkoušený jen
|
||||
na našich deskách. Může obsahovat chyby, které uzel vyřadí z provozu,
|
||||
a vrátit ho pak jde jen s USB nebo BLE v ruce. Pro běžný provoz nahrajte
|
||||
oficiální MeshCore (<a href="https://flasher.meshcore.io">flasher.meshcore.io</a>).</p>
|
||||
</div>
|
||||
<p>Fork projektu <a href="https://github.com/meshcore-dev/MeshCore">meshcore-dev/MeshCore</a>,
|
||||
na kterém běží repeatery, senzory a testovací desky malé české sítě na CZ
|
||||
meshi (869,432 MHz). Upstreamové větve <code>main</code> a <code>dev</code> se slučují automaticky
|
||||
dvakrát denně; všechno níže je navíc nad nimi. Náš kód je ve zdrojácích
|
||||
označený <code>CUSTOM (TeTeHacko)</code>. Nic z toho nemění protokol na rádiu.</p>
|
||||
<h2 id="repeater-antispam-vsechno-vypinatelne-nic-z-toho-neni-v-upstreamu">Repeater: antispam (všechno vypínatelné, nic z toho není v upstreamu)</h2>
|
||||
<p><strong>Po nahrání je zapnutý jen FairnessLimiter</strong>, s limity se zhruba
|
||||
dvojnásobnou rezervou nad 30 dní skutečného provozu CZ meshe: na kanál dávka
|
||||
100 zpráv a pak jedna za 30 s, na odesílatele 150 a jedna za 10 s, na
|
||||
původce advertu 30 a jeden za 10 min. Je to síť na utržené floody, ne kvóta;
|
||||
<code>fairness off</code> ho vypne natrvalo. Okno na adverty, filtry a dry-run jsou
|
||||
vypnuté, dokud je nezapnete.</p>
|
||||
<ul>
|
||||
<li><strong>FairnessLimiter</strong> – token buckety na přeposílané floody podle 1bajtových
|
||||
identifikátorů, které jsou v paketu stejně v čitelné podobě (hash kanálu,
|
||||
hash odesílatele, původce advertu). Port návrhu Beanowa
|
||||
<a href="https://github.com/meshcore-dev/MeshCore/pull/1502">#1502</a>, limity
|
||||
přepočítané z 30 dní skutečného provozu CZ meshe.
|
||||
<code>fairness [on|off|grid|cap|refill]</code>; přímo směrovaný provoz se neomezuje nikdy.</li>
|
||||
<li><strong>Okno na adverty podle původce</strong> – flood advert každého uzlu se přepošle
|
||||
nejvýš jednou za N hodin (<code>fairness advert <h>|clear</code>), převzato
|
||||
z AdvertLimiteru <a href="https://github.com/Dutch-MeshCore/MeshCore">DutchMeshCore</a>.
|
||||
Míří na uzly, které advertují každou minutu.</li>
|
||||
<li><strong>Dry-run</strong> – <code>fairness dryrun on</code> započítá každý verdikt, ale přepošle
|
||||
i tak; <code>fairness air</code> ukáže ušetřený (nebo ušetřitelný) airtime podle důvodu.</li>
|
||||
<li><strong>Filtr kanálů</strong> – na kanálech, jejichž klíč repeater zná (Public
|
||||
a <code>#hashtag</code> kanály), přestane přeposílat zprávy uvedených jmen odesílatelů
|
||||
(<code>filter add|del|list</code>). Jméno se dá podvrhnout: je to brzda na utrženého
|
||||
bota, ne bezpečnost.</li>
|
||||
<li><strong>Blokace přeposílání podle hashe kanálu</strong> – <code>filter hash add <hex> [s]</code>:
|
||||
bez klíče, takže funguje i na soukromých kanálech; příjem se nemění, jen
|
||||
přeposílání. S <code>s</code> se kanál neodřízne, ale přiškrtí (jeden paket za <code>s</code>
|
||||
sekund).</li>
|
||||
<li><strong>Limit stáří zprávy</strong> – <code>filter age <min>|off</code> (volitelné, 1–10080 min):
|
||||
nepřeposílá skupinové zprávy na dešifrovaných kanálech, jejichž čas od
|
||||
odesílatele je starší; bez nastavených hodin repeateru neplatí. Posuzuje
|
||||
hodiny odesílatele, takže zahodí i companiony bez synchronizace času –
|
||||
nastavuj ho na dny.</li>
|
||||
<li><code>filter dryrun on</code> započítá každý verdikt <code>filter</code>, ale přepošle i tak.</li>
|
||||
</ul>
|
||||
<h2 id="diagnostika-a-provoz">Diagnostika a provoz</h2>
|
||||
<p>Všechny příkazy forku, kde je který build má a výchozí hodnoty:
|
||||
<a href="https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/tth-commands.md">docs/tth-commands.md</a>.</p>
|
||||
<p>Repeater, room server i senzor (všechno s textovou konzolí) mají:</p>
|
||||
<ul>
|
||||
<li><strong>Watchdogy rádia.</strong> Hardwarový watchdog chytí jen zamrzlou smyčku; dva naše
|
||||
uzly ale byly nalezeny hluché s běžící smyčkou a pomohl až restart.</li>
|
||||
<li><code>set radio.silence <min></code> – <strong>hluchý přijímač</strong>: když se za <code><min></code> minut
|
||||
nepohne čítač přijatých rámců (počítá se i rámec s chybou CRC), uzel
|
||||
napřed znovu nahodí příjem, a když ani to nepomůže, restartuje se. Každý
|
||||
takový restart zdvojnásobí práh pro příští start (až 16×), první přijatý
|
||||
rámec ho vrátí, takže tiché místo neskončí ve smyčce restartů. Uloží se;
|
||||
<strong>ve výchozím stavu vypnutý</strong> (<code>0</code>) – práh volte s rezervou nad nejdelší
|
||||
běžné ticho na místě.</li>
|
||||
<li><strong>Zaseknuté vysílání</strong> (jen repeater): pakety čekají ve frontě a čítač
|
||||
odeslaných se nehýbe → znovu nahodí rádio, pak restart. Prázdná fronta se
|
||||
nepočítá. <strong>Zapnutý, 15 min</strong> (<code>RADIO_TXSTALL_MIN</code>); <code>set radio.txstall
|
||||
<min>|off</code> platí jen do restartu.</li>
|
||||
<li><code>get radio.reboots</code> – kolik restartů watchdogy udělaly (přežije i výpadek
|
||||
napájení); <code>get boot</code> – proč se deska naposledy resetovala a záznam
|
||||
o hardfaultu (vypíše se i při startu).</li>
|
||||
<li><code>dfu [uf2|serial|ota]</code> – spolehlivý reboot do bootloaderu (jen z lokální
|
||||
konzole); <code>i2c</code> – sken sběrnice.</li>
|
||||
</ul>
|
||||
<p>Repeater navíc:</p>
|
||||
<ul>
|
||||
<li><code>blink</code> (rozbliká LED, i přes mesh – najdete uzel na stožáru), <code>txpwr</code>
|
||||
(vysílací výkon do restartu, s verdiktem RadioLibu), čítače chyb vysílání
|
||||
ve stavové odpovědi.</li>
|
||||
<li>Jen observer varianty (<code>*-observer</code>): textová konzole přes BLE vedle USB,
|
||||
<code>ble on|off</code> uložené přes reboot (<code>RPT_BLE_DEFAULT_OFF</code>: startuje vypnuté),
|
||||
vlastní BLE PIN (<code>ble pin</code>), uložený vysílací výkon spojení (<code>blepwr</code>),
|
||||
<code>bleconn</code>, neblokující BLE vysílání a parametry spojení, které vydrží i na
|
||||
slabém linku.</li>
|
||||
<li>Taky jen observer varianty: pasivní analyzátor v konzoli – <code>nodes</code>
|
||||
(slyšené repeatery a roomy, klíč pro spojení více cest), <code>rxlog</code> (každý
|
||||
slyšený rámec: typ, cesta, SNR, RSSI), <code>pktlog</code> (surové rámce pro feed
|
||||
observeru), velké stránkované odpovědi.</li>
|
||||
<li>Jen vlastní buildy, ne releasy:</li>
|
||||
<li>kanálový bot (<code>BOT_CHANNEL_PSK</code>: <code>!link</code>, <code>!path</code>, <code>!snr</code>, <code>!heard</code>,
|
||||
<code>!noise</code>, <code>!ping</code>, <code>!help</code>, výběr přes <code>BOT_COMMANDS</code>, cooldown na
|
||||
odesílatele, ignore list) – odpovídá, aniž by přeposílal;</li>
|
||||
<li><code>RADIO_DIAG</code>: <code>radiostat</code> (stav přijímače SX1262 bez zásahu) a
|
||||
<code>radiokick rx|clrirq|standby|agc</code> (jeden krok obnovy, od nejjemnějšího –
|
||||
první, který pomůže, ukáže rozbitou vrstvu);</li>
|
||||
<li><code>PIN_DIAG</code>: <code>dio1</code> (stav přerušení v čipu proti úrovni na pinu – který
|
||||
konec mrtvé linky DIO1 je přerušený);</li>
|
||||
<li><code>LORA_POLL_IRQ</code>: provoz bez DIO1 pro desku s mrtvou linkou přerušení.</li>
|
||||
</ul>
|
||||
<h2 id="opravy-jadra">Opravy jádra</h2>
|
||||
<ul>
|
||||
<li><strong>Ochrana proti přehrání admin příkazů přežije reboot.</strong> Upstream si
|
||||
poslední timestamp klienta drží jen v RAM, takže po každém restartu projde
|
||||
libovolný zachycený příkaz znovu – zachycený <code>reboot</code> uzel restartuje
|
||||
pořád dokola. Repeater, room server i sensor ho teď zapíšou do flash dřív,
|
||||
než příkaz provedou (<code>/s_acl_ts0|1</code>, střídavě s kontrolním součtem, takže
|
||||
ho nesmaže ani výpadek napájení při zápisu). Timestamp víc než den před
|
||||
hodinami uzlu (<code>ACL_TS_MAX_AHEAD</code>) se přijme, ale neuloží, aby companion
|
||||
s rozhozenými hodinami nezamkl admina. Ukládá se jen u adminů: host smí
|
||||
jen číst a s prázdným guest heslem se jím stane kdokoli, takže by každý
|
||||
jeho dotaz znamenal zápis do flash. Klientů se to nijak netýká.</li>
|
||||
<li><strong>Hesla nejde hádat přes éter plnou rychlostí.</strong> Upstream kontroluje každý
|
||||
login bez omezení a na špatné heslo ani neodpoví. Po 4 špatných heslech
|
||||
během 3 minut (<code>LOGIN_FAIL_MAX</code>, <code>LOGIN_FAIL_SECS</code>) se hesla do konce okna
|
||||
nekontrolují. Klient, který už je v ACL jako admin, projde vždy – login
|
||||
jeho jménem nikdo jiný poslat nedokáže, takže útok adminy nezamkne.</li>
|
||||
<li><strong>Přehraný login bez hesla už nevyvolá flood odpověď.</strong> Login klienta z ACL
|
||||
s prázdným heslem neměl ochranu proti přehrání; útočník tím nic nezískal,
|
||||
ale každá kopie donutila uzel poslat odpověď floodem přes celý mesh.</li>
|
||||
<li>TRACE už nepřipisuje cestu za konec payloadu; parsování TRACE/PATH
|
||||
a <code>Packet::readFrom</code> hlídají meze.</li>
|
||||
<li><code>markSeen</code> je zase idempotentní (odesílací cesta ujídala okno deduplikace).</li>
|
||||
<li>Záložní výpočet v <code>calcMaxPacketMillis</code> už nepodteče (uzel na tom ohluchl).</li>
|
||||
<li>Šířka path hashe se bere z nastavení uzlu na všech cestách vysílání včetně
|
||||
<code>sendZeroHop</code>; výchozí jsou 2bajtové path hashe (<code>PATH_HASH_MODE_DEFAULT</code>).</li>
|
||||
<li>Nepovedené vysílání se zařadí znovu s odstupem, místo aby se zahodilo.</li>
|
||||
<li>RSSI každého paketu se zaznamená při příjmu; <code>ContactInfo</code> se před
|
||||
částečným vyplněním vynuluje.</li>
|
||||
</ul>
|
||||
<h2 id="napajeni-hodiny-gps">Napájení, hodiny, GPS</h2>
|
||||
<ul>
|
||||
<li>GPS duty cycle (<code>gps duty</code>), i na T1000-E, kde nebyl: přijímač běží jen
|
||||
kolem synchronizace hodin (jednou denně, po neúspěšném okně znovu za 6 h).
|
||||
Dotaz na polohu přijímač probudí pro příští dotaz.</li>
|
||||
<li>Uzel bez GPS startuje na čase sestavení firmwaru, ne v roce 2024; hodiny
|
||||
a záznam o hardfaultu přežijí teplý reset (<code>.noinit</code>); <code>clkreboot</code>.</li>
|
||||
<li>Na solárních uzlech žádná blikající LED a pomalejší BLE advertising.</li>
|
||||
<li>Stav baterie jako ikona na konci advertovaného jména: <code>set batt.icon on</code>,
|
||||
prahy <code>set batt.icon.lo|hi <mV></code> (výchozí vypnuté; dlouhé jméno ikonu
|
||||
nepojme a příkaz na to upozorní).</li>
|
||||
<li>Volitelný RX duty cycle (<code>set radio.rxps off|on|balanced|max</code>, jemněji
|
||||
<code>level <1-10></code>; port PowerSaving z EasySkyMesh): SX1262 mezi krátkými okny
|
||||
poslechu spí. Ve veřejných buildech je zabudovaný a <strong>vypnutý</strong>; <code>max</code> na
|
||||
lavici ušetřil ~2,3 mA bez ztráty paketů (<a href="https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/power.md">docs/power.md</a>),
|
||||
na ostrém meshi ale jeden náš stožár ztratil 16 % příjmu – zapínat s rozmyslem. Jen
|
||||
SX1262, ne LR1110 (T1000-E).</li>
|
||||
<li>Podpěťová pojistka při startu (<code>PWRMGT_VOLTAGE_BOOTLOCK</code>) je na nRF52
|
||||
<strong>vypnutá</strong>, stejně jako v upstreamu od v1.18.0
|
||||
(<a href="https://github.com/meshcore-dev/MeshCore/pull/2377">#2377</a>): pevný práh
|
||||
3,3 V nepouštěl k životu uzly na LiFePO4 nebo LTO. Firmware tak naběhne na
|
||||
jakékoli chemii článku; před hlubokým vybitím má chránit BMS nebo ochranná
|
||||
destička článku. Konfigurovatelná pojistka podle chemie čeká na upstream
|
||||
(<a href="https://github.com/meshcore-dev/MeshCore/pull/2088">#2088</a>). Výjimkou je
|
||||
<code>SenseCap_Solar_repeater</code> (Li-ion, naše stožáry): pojistka je zapnutá
|
||||
a oba prahy jdou nastavit za běhu, i přes mesh jako admin –
|
||||
<code>set pwr.bootlock <mV>|off</code> (výchozí 3300, pod ním uzel nenaběhne a spí,
|
||||
dokud se článek nezotaví) a <code>set pwr.cutoff <mV>|off</code> (výchozí vypnuto,
|
||||
pod ním se běžící uzel vypne); <code>get pwr</code> (<a href="https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/power.md">docs/power.md</a>).</li>
|
||||
</ul>
|
||||
<h2 id="senzory-a-companiony">Senzory a companiony</h2>
|
||||
<ul>
|
||||
<li><code>simple_sensor</code>: telemetrie z externí stanice po UART
|
||||
(<code>BudkaLinkSensorManager</code>, jeden LPP kanál na veličinu), <code>sensor read</code>.</li>
|
||||
<li>Senzory, které jinak měří nepřetržitě (INA219, INA226, INA260, INA3221,
|
||||
BMP280), mezi čteními telemetrie spí a měří jen na vyžádání (nápad a první
|
||||
patch pro INA219: Alkel Brostl). Čipy INA se rozlišují podle ID, takže
|
||||
INA226 už se nedetekuje jako INA219. Odpor bočníku se nastavuje za běhu
|
||||
a ukládá se: <code>sensor set ina.shunt <mΩ></code>.</li>
|
||||
<li>Companion: <code>gps duty</code> přežije reboot, kopie data sestavení má hlídanou
|
||||
délku. Export privátního klíče, čtení BLE PINu a jeho změna (i přes CLI
|
||||
<code>set pin</code>) jdou jen přes spárované BLE, ne přes USB, UART ani WiFi/TCP,
|
||||
a odpověď s klíčem či PINem jde jen tam, odkud přišel dotaz. (Merge v1.17
|
||||
tu kontrolu potichu vyřadil; build bez BLE bere své jediné rozhraní dál
|
||||
jako důvěryhodné.) KISS modem: oprava o jedna vedle při zkracování jména.</li>
|
||||
</ul>
|
||||
<h2 id="verejne-buildy-vychozi-nastaveni-pro-cesky-mesh">Veřejné buildy: výchozí nastavení pro český mesh</h2>
|
||||
<p>Releasy z tohoto repozitáře (<code>pub-release</code>) jsou přednastavené pro český
|
||||
mesh podle wiki <a href="https://meshcore.cz/">meshcore.cz</a>, takže čerstvě nahraný
|
||||
uzel nepotřebuje obvyklé kolečko nastavování:</p>
|
||||
<ul>
|
||||
<li>rádio 869,432 MHz / 62,5 kHz / SF7 / CR5 (všechny buildy);</li>
|
||||
<li>repeater a room server: zero-hop advert vypnutý, flood advert každých 25 h,
|
||||
duty cycle 10 % (<code>get dutycycle</code> → <code>10.0%</code>; zastaralé <code>af</code> je 9);</li>
|
||||
<li>repeater: regiony <code>cz</code> a <code>cs</code> vedle <code>*</code> – vlastní <code>cz-<kraj></code> přidáš přes
|
||||
<code>region put cz-xxx cz</code> + <code>region save</code>;</li>
|
||||
<li>2bajtové path hashe (výchozí v tomto forku);</li>
|
||||
<li>repeater: filtr kanálů (<code>filter add <jméno></code>) je zabudovaný pro Public,
|
||||
<code>#meshcore</code> a <code>#test</code>, s prázdným seznamem – nedělá nic, dokud do něj
|
||||
nepřidáš jméno.</li>
|
||||
</ul>
|
||||
<p>Platí jen pro uzel bez uloženého nastavení (nový nebo po <code>erase</code>): nové
|
||||
nahrání ponechá, co už uzel má, a regiony, které jsi smazal a uložil,
|
||||
zůstanou smazané. Jméno a admin heslo si nastav sám.</p>
|
||||
<p><strong>BLE PIN companionu je veřejný <code>123456</code></strong> (desky s displejem si losují
|
||||
vlastní a ukážou ho). Kdo se s ním spáruje, má companion celý: zprávy,
|
||||
kontakty, export privátního klíče. Po prvním spárování ho proto změň
|
||||
v aplikaci. A s deskou v ruce nechrání nic ani PIN, ani heslo: flash není
|
||||
zamčená a bootloader přijme jakýkoli firmware. Ztracený nebo ukradený uzel
|
||||
ber jako vyzrazený – u repeateru změň admin heslo všude, kde bylo stejné,
|
||||
a vyhoď jeho klíč z ACL; u companionu ber kanály, které na něm byly, jako
|
||||
známé.</p>
|
||||
<p>Varianty observer (<code>*_repeater-observer-*</code>) nRF52 repeaterů (XIAO, SenseCAP
|
||||
Solar, RAK4631, T1000-E, Heltec T114) přidávají buffery <code>nodes</code> / <code>rxlog</code> /
|
||||
<code>pktlog</code> a textovou konzoli přes BLE, aby šel repeater číst přes USB nebo BLE
|
||||
(<a href="https://git.rfa.cz/tth-pub/meshcore-repeater-observer">meshcore-repeater-observer</a>).
|
||||
BLE konzole je po nahrání <strong>vypnutá</strong> (<code>RPT_BLE_DEFAULT_OFF</code>). Nemá vlastní
|
||||
přihlášení, jen BLE PIN, a PIN v buildu je veřejný zástupný <code>123456</code>. Nejdřív
|
||||
si proto nastav vlastní – v USB konzoli, nebo jako admin přes mesh (vzdálené
|
||||
CLI v aplikaci): <code>ble pin <6 číslic></code> (uloží se a přežije reboot i nové
|
||||
nahrání; zároveň smaže všechny bondy, takže spárovaná zařízení se párují
|
||||
znovu). Teprve pak <code>ble on</code> – dokud je PIN zástupný, tyhle buildy ho odmítnou.
|
||||
<code>ble</code> ukáže, jestli je PIN <code>own</code> nebo <code>build default</code>, samotný PIN nikdy.
|
||||
Releasy do <code>tth-654d53f3</code> <code>ble pin</code> nemají: BLE tam nech vypnuté a používej USB.</p>
|
||||
<h2 id="nahrani-releasu">Nahrání releasu</h2>
|
||||
<p>Každý release je automatický build nad upstreamovým <code>dev</code> (viz upozornění
|
||||
nahoře), ne stabilní verze. Nahrávejte ho jen na uzly, na které dosáhnete,
|
||||
a nový release vždy nejdřív na jeden z nich.</p>
|
||||
<p>Soubory jsou v <a href="https://git.rfa.cz/tth-pub/meshcore-tth/releases">Releases</a>.
|
||||
Release se jmenuje podle upstreamové verze a data, např.
|
||||
<code>v1.18.0+tth.20261112</code> (druhý téhož dne <code>.2</code>), a v popisu má změny od
|
||||
předchozího releasu. Pro každou desku a roli je jedna sada
|
||||
(<code><deska>_<role>-<release></code>, např. <code>Xiao_nrf52_repeater-v1.18.0+tth.20261112.zip</code>):
|
||||
<code>.zip</code> a <code>.uf2</code> pro nRF52, <code>.bin</code> pro ESP32 (<code>-merged.bin</code> je celý obraz pro
|
||||
prázdnou desku, obyčejný <code>.bin</code> aktualizace). Kontrolní součty jsou
|
||||
v <code>SHA256SUMS</code>. Releasy do 12. 11. 2026 se jmenovaly <code>tth-<sha></code>.</p>
|
||||
<p><strong>nRF52 (XIAO, RAK4631, SenseCAP Solar, T1000-E, T114) přes
|
||||
<a href="https://flasher.meshcore.io">webový flasher MeshCore</a></strong> – Chrome, Edge nebo
|
||||
Chromium na počítači (Web Serial; ne Firefox ani Safari):</p>
|
||||
<ol>
|
||||
<li>Připoj desku přes USB.</li>
|
||||
<li>Klikni na <strong>Custom Firmware</strong> a vyber <code>.zip</code> pro svou desku.</li>
|
||||
<li>Klikni na <strong>Enter DFU mode</strong> a vyber sériový port desky. Deska se
|
||||
restartuje do bootloaderu a objeví se jako nový port.</li>
|
||||
<li>Klikni na <strong>Flash!</strong> a vyber ten nový port. Zhruba 30 s, pak se deska
|
||||
restartuje do nového firmwaru.</li>
|
||||
<li><strong>Console</strong> ve flasheru (nebo jakýkoli sériový terminál, 115200) ověří
|
||||
výsledek: <code>ver</code> ukáže <code>v1.xx.x-tth<sha></code>, stejně jako řádek „Verze v uzlu“
|
||||
v popisu releasu.</li>
|
||||
</ol>
|
||||
<p><strong>Neklikej na Erase Flash</strong>, pokud nechceš nový uzel: smaže identitu (klíč
|
||||
uzlu a všechno, co ho zná) i veškeré nastavení. Obyčejné nahrání je zachová.</p>
|
||||
<p>Vyzkoušeno na XIAO (repeater-observer, 3. 11. 2026). ESP32 <code>.bin</code> přes stejné
|
||||
tlačítko Custom Firmware tu vyzkoušené není.</p>
|
||||
<p>Bez webového flasheru: na většině desek otevře dvojí stisk resetu bootloader
|
||||
jako USB disk; zkopíruj na něj <code>.uf2</code>. Nebo
|
||||
<code>adafruit-nrfutil dfu serial -pkg <soubor>.zip -p <port> -b 115200</code> s deskou
|
||||
v bootloaderu.</p>
|
||||
<p>Nový uzel po nahrání nastav v konzoli: <code>set name <jméno></code>,
|
||||
<code>password <admin heslo></code> (nejvýš 15 znaků), vlastní region přes
|
||||
<code>region put cz-<kraj> cz</code> + <code>region save</code>. Repeater přeposílá od prvního
|
||||
startu (výchozí v upstreamu) a tyhle buildy jsou na ostré CZ frekvenci: na
|
||||
stole bez antény dej <code>set repeat off</code>, dokud není na místě.</p>
|
||||
<h2 id="experimentalni-aktualizace-firmwaru-od-admina-ota">Experimentální: aktualizace firmwaru od admina (<code>*-ota</code>)</h2>
|
||||
<p>Každý nRF52 build s textovou konzolí (repeater, observer, room server,
|
||||
senzor) je v releasu ještě jednou jako <strong>experimentální</strong> <code>*-ota</code> /
|
||||
<code>*-observer-ota</code>. Ten umí přijmout nový firmware od admina příkazy <code>fw …</code>:
|
||||
v USB nebo BLE konzoli, nebo <strong>přes mesh jako vzdálené admin CLI</strong>. Bez změny
|
||||
bootloaderu a bez druhé banky: uzel si balíček uloží do volné flash,
|
||||
zkontroluje ho celý (podpis, hashe, nanečisto provedená delta) a přepíše se
|
||||
až na <code>fw apply</code>, rutinou běžící z RAM. Když během přepisu vypadne napájení,
|
||||
zůstane v bootloaderu a vrátí se přes USB/BLE DFU.</p>
|
||||
<ul>
|
||||
<li>V releasu je ke každému <code>*-ota</code> obrazu plný balíček
|
||||
<code><deska>_<role>-ota-<release>.mcfw</code> (jen přes USB/BLE) a delta
|
||||
<code>….from-<starší release>.mcfw</code> od každého drženého předchozího releasu,
|
||||
typicky jednotky kB.</li>
|
||||
<li><strong>Přes mesh uzel přijme jen deltu, a nikdy ne starší verzi, než má</strong> –
|
||||
vynucuje to uzel, ne nástroj. Plný obraz nebo návrat ke starší verzi jen
|
||||
lokálně (<code>fw apply downgrade</code>). <code>fw apply</code> čeká na baterii ≥ 3,8 V, pokud
|
||||
uzel neběží z USB.</li>
|
||||
<li>Balíčky i <code>SHA256SUMS</code> jsou podepsané klíčem <code>meshcore-ota@tth-pub</code>
|
||||
a <code>*-ota</code> obraz jiný podpis nepřijme. Ověření stažených souborů:
|
||||
<code>ssh-keygen -Y verify -f tools/ota_allowed_signers -I meshcore-ota@tth-pub
|
||||
-n meshcore-ota -s SHA256SUMS.sig < SHA256SUMS</code>. Vlastní build s vlastním
|
||||
klíčem: <code>[ota] pubkey</code> v <code>platformio.local.ini</code>.</li>
|
||||
<li>První <code>*-ota</code> obraz se nahraje obyčejně (viz výše), další už jako delta.
|
||||
Nástroje: <code>tools/ota_push.py</code> (USB), <code>tools/ota_mesh_push.py</code> (přes mesh
|
||||
skrz companion; potřebuje pythonovou knihovnu <code>meshcore</code>, admin heslo bere
|
||||
z <code>[secrets] admin_pw</code> v <code>platformio.local.ini</code>; s <code>--side</code> jde přenos po
|
||||
vedlejším kanálu mimo sdílený mesh), <code>tools/ota_pack.py info</code>. Přenos samotný
|
||||
je OTA engine kolekce
|
||||
<a href="https://git.rfa.cz/tth-pub/meshcore-ansible">tth.meshcore</a> (modul
|
||||
<code>meshcore_fw_ota</code>), stejný kód pro nástroje i Ansible. Z telefonu: fork
|
||||
aplikace <a href="https://git.rfa.cz/tth-pub/meshcore-open">meshcore-open</a>, správa
|
||||
repeateru → Firmware update (OTA), deltu si najde v releasu sám.
|
||||
Postup a čísla: <a href="https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/ota.md">docs/ota.md</a>.</li>
|
||||
<li><strong>Experimentální i v rámci tohoto forku</strong>: obrazy přicházejí s každým
|
||||
releasem (viz upozornění nahoře) a nemají druhou banku ani automatický
|
||||
návrat. Vadný firmware, který nabootuje, běží, dokud nepošlete další;
|
||||
takový, který nenabootuje, chce USB/BLE DFU v ruce. Vyzkoušeno na lavici
|
||||
(XIAO, USB, mesh, vedlejší kanál) a od 13. 11. 2026 na dvou našich
|
||||
stožárech. Proti obrazu, který nabootuje s mrtvým rádiem, jsou watchdogy
|
||||
rádia (viz Diagnostika a provoz): pro uzly, kam posíláte OTA, zapněte
|
||||
<code>set radio.silence</code>. Stojí ~10 kB RAM navíc.</li>
|
||||
</ul>
|
||||
<h2 id="sestaveni">Sestavení</h2>
|
||||
<ul>
|
||||
<li>Razítko verze v každém nRF52 envu (<code>v1.18.0-tth<sha></code>, <code>+</code> = neuklizený
|
||||
strom), základní verze z upstreamového tagu (<code>tools/build_version.py</code>).</li>
|
||||
<li><code>tools/</code>: nástroje na uzly – konzole (USB, BLE), flashování, testy na
|
||||
lavici, diagnostika (<a href="https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/tools/README.md">tools/README.md</a>). Desky podle jména
|
||||
bere z lokálního configu mimo repo (<code>tools/config.example.ini</code>).</li>
|
||||
<li><code>hardware/cavity-box</code>: parametrická krabička pro dutinový filtr na stožár.</li>
|
||||
</ul>
|
||||
<hr />
|
||||
</section>
|
||||
|
||||
</main>
|
||||
</div>
|
||||
<hr><footer>
|
||||
<div class="terminal-mkdocs-footer-grid">
|
||||
<div id="terminal-mkdocs-footer-copyright-info">
|
||||
Site built with <a href="http://www.mkdocs.org">MkDocs</a> and <a href="https://github.com/ntno/mkdocs-terminal">Terminal for MkDocs</a>.
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal" id="mkdocs_search_modal" tabindex="-1" role="alertdialog" aria-modal="true" aria-labelledby="searchModalLabel">
|
||||
<div class="modal-dialog modal-lg" role="search">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="searchModalLabel">Search</h5>
|
||||
<button type="button" class="close btn btn-default btn-ghost" data-dismiss="modal" aria-label="Close">x</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p id="searchInputLabel">Type to start searching</p>
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<input type="search" class="form-control" aria-labelledby="searchInputLabel" placeholder="" id="mkdocs-search-query" title="Please enter search terms here">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results" data-no-results-text="No document matches found"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Vendored
-6369
File diff suppressed because it is too large.
Load diff
-6
@@ -1,6 +0,0 @@
|
||||
/*!
|
||||
* Font Awesome Free 6.2.1 by @fontawesome - https://fontawesome.com
|
||||
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
||||
* Copyright 2022 Fonticons, Inc.
|
||||
*/
|
||||
.fa{font-family:var(--fa-style-family,"Font Awesome 6 Free");font-weight:var(--fa-style,900)}.fa,.fa-brands,.fa-classic,.fa-regular,.fa-sharp,.fa-solid,.fab,.far,.fas{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:var(--fa-display,inline-block);font-style:normal;font-variant:normal;line-height:1;text-rendering:auto}.fa-classic,.fa-regular,.fa-solid,.far,.fas{font-family:"Font Awesome 6 Free"}.fa-brands,.fab{font-family:"Font Awesome 6 Brands"}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-2xs{font-size:.625em;line-height:.1em;vertical-align:.225em}.fa-xs{font-size:.75em;line-height:.08333em;vertical-align:.125em}.fa-sm{font-size:.875em;line-height:.07143em;vertical-align:.05357em}.fa-lg{font-size:1.25em;line-height:.05em;vertical-align:-.075em}.fa-xl{font-size:1.5em;line-height:.04167em;vertical-align:-.125em}.fa-2xl{font-size:2em;line-height:.03125em;vertical-align:-.1875em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:var(--fa-li-margin,2.5em);padding-left:0}.fa-ul>li{position:relative}.fa-li{left:calc(var(--fa-li-width, 2em)*-1);position:absolute;text-align:center;width:var(--fa-li-width,2em);line-height:inherit}.fa-border{border-radius:var(--fa-border-radius,.1em);border:var(--fa-border-width,.08em) var(--fa-border-style,solid) var(--fa-border-color,#eee);padding:var(--fa-border-padding,.2em .25em .15em)}.fa-pull-left{float:left;margin-right:var(--fa-pull-margin,.3em)}.fa-pull-right{float:right;margin-left:var(--fa-pull-margin,.3em)}.fa-beat{-webkit-animation-name:fa-beat;animation-name:fa-beat;-webkit-animation-delay:var(--fa-animation-delay,0s);animation-delay:var(--fa-animation-delay,0s);-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s);-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,ease-in-out);animation-timing-function:var(--fa-animation-timing,ease-in-out)}.fa-bounce{-webkit-animation-name:fa-bounce;animation-name:fa-bounce;-webkit-animation-delay:var(--fa-animation-delay,0s);animation-delay:var(--fa-animation-delay,0s);-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s);-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,cubic-bezier(.28,.84,.42,1));animation-timing-function:var(--fa-animation-timing,cubic-bezier(.28,.84,.42,1))}.fa-fade{-webkit-animation-name:fa-fade;animation-name:fa-fade;-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4,0,.6,1));animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4,0,.6,1))}.fa-beat-fade,.fa-fade{-webkit-animation-delay:var(--fa-animation-delay,0s);animation-delay:var(--fa-animation-delay,0s);-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s)}.fa-beat-fade{-webkit-animation-name:fa-beat-fade;animation-name:fa-beat-fade;-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4,0,.6,1));animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4,0,.6,1))}.fa-flip{-webkit-animation-name:fa-flip;animation-name:fa-flip;-webkit-animation-delay:var(--fa-animation-delay,0s);animation-delay:var(--fa-animation-delay,0s);-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s);-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,ease-in-out);animation-timing-function:var(--fa-animation-timing,ease-in-out)}.fa-shake{-webkit-animation-name:fa-shake;animation-name:fa-shake;-webkit-animation-duration:var(--fa-animatLine truncated
|
||||
Vendored
-19
@@ -1,19 +0,0 @@
|
||||
/*!
|
||||
* Font Awesome Free 6.2.1 by @fontawesome - https://fontawesome.com
|
||||
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
||||
* Copyright 2022 Fonticons, Inc.
|
||||
*/
|
||||
:root, :host {
|
||||
--fa-style-family-classic: 'Font Awesome 6 Free';
|
||||
--fa-font-solid: normal 900 1em/1 'Font Awesome 6 Free'; }
|
||||
|
||||
@font-face {
|
||||
font-family: 'Font Awesome 6 Free';
|
||||
font-style: normal;
|
||||
font-weight: 900;
|
||||
font-display: block;
|
||||
src: url("../webfonts/fa-solid-900.woff2") format("woff2"), url("../webfonts/fa-solid-900.ttf") format("truetype"); }
|
||||
|
||||
.fas,
|
||||
.fa-solid {
|
||||
font-weight: 900; }
|
||||
Vendored
-6
@@ -1,6 +0,0 @@
|
||||
/*!
|
||||
* Font Awesome Free 6.2.1 by @fontawesome - https://fontawesome.com
|
||||
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
||||
* Copyright 2022 Fonticons, Inc.
|
||||
*/
|
||||
:host,:root{--fa-style-family-classic:"Font Awesome 6 Free";--fa-font-solid:normal 900 1em/1 "Font Awesome 6 Free"}@font-face{font-family:"Font Awesome 6 Free";font-style:normal;font-weight:900;font-display:block;src:url(../webfonts/fa-solid-900.woff2) format("woff2"),url(../webfonts/fa-solid-900.ttf) format("truetype")}.fa-solid,.fas{font-weight:900}
|
||||
Binary file not shown.
Binary file not shown.
Vendored
-419
@@ -1,419 +0,0 @@
|
||||
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
|
||||
|
||||
|
||||
/* Document
|
||||
========================================================================== */
|
||||
|
||||
|
||||
/**
|
||||
* 1. Correct the line height in all browsers.
|
||||
* 2. Prevent adjustments of font size after orientation changes in iOS.
|
||||
*/
|
||||
|
||||
html {
|
||||
line-height: 1.15;
|
||||
/* 1 */
|
||||
-webkit-text-size-adjust: 100%;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
|
||||
/* Sections
|
||||
========================================================================== */
|
||||
|
||||
|
||||
/**
|
||||
* Remove the margin in all browsers.
|
||||
*/
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render the `main` element consistently in IE.
|
||||
*/
|
||||
|
||||
main {
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Correct the font size and margin on `h1` elements within `section` and
|
||||
* `article` contexts in Chrome, Firefox, and Safari.
|
||||
*/
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin: 0.67em 0;
|
||||
}
|
||||
|
||||
|
||||
/* Grouping content
|
||||
========================================================================== */
|
||||
|
||||
|
||||
/**
|
||||
* 1. Add the correct box sizing in Firefox.
|
||||
* 2. Show the overflow in Edge and IE.
|
||||
*/
|
||||
|
||||
hr {
|
||||
box-sizing: content-box;
|
||||
/* 1 */
|
||||
height: 0;
|
||||
/* 1 */
|
||||
overflow: visible;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. Correct the inheritance and scaling of font size in all browsers.
|
||||
* 2. Correct the odd `em` font sizing in all browsers.
|
||||
*/
|
||||
|
||||
pre {
|
||||
font-family: monospace, monospace;
|
||||
/* 1 */
|
||||
font-size: 1em;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
|
||||
/* Text-level semantics
|
||||
========================================================================== */
|
||||
|
||||
|
||||
/**
|
||||
* Remove the gray background on active links in IE 10.
|
||||
*/
|
||||
|
||||
a {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. Remove the bottom border in Chrome 57-
|
||||
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
|
||||
*/
|
||||
|
||||
abbr[title] {
|
||||
border-bottom: none;
|
||||
/* 1 */
|
||||
text-decoration: underline;
|
||||
/* 2 */
|
||||
text-decoration: underline dotted;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add the correct font weight in Chrome, Edge, and Safari.
|
||||
*/
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. Correct the inheritance and scaling of font size in all browsers.
|
||||
* 2. Correct the odd `em` font sizing in all browsers.
|
||||
*/
|
||||
|
||||
code,
|
||||
kbd,
|
||||
samp {
|
||||
font-family: monospace, monospace;
|
||||
/* 1 */
|
||||
font-size: 1em;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add the correct font size in all browsers.
|
||||
*/
|
||||
|
||||
small {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prevent `sub` and `sup` elements from affecting the line height in
|
||||
* all browsers.
|
||||
*/
|
||||
|
||||
sub,
|
||||
sup {
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
|
||||
|
||||
/* Embedded content
|
||||
========================================================================== */
|
||||
|
||||
|
||||
/**
|
||||
* Remove the border on images inside links in IE 10.
|
||||
*/
|
||||
|
||||
img {
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
|
||||
/* Forms
|
||||
========================================================================== */
|
||||
|
||||
|
||||
/**
|
||||
* 1. Change the font styles in all browsers.
|
||||
* 2. Remove the margin in Firefox and Safari.
|
||||
*/
|
||||
|
||||
button,
|
||||
input,
|
||||
optgroup,
|
||||
select,
|
||||
textarea {
|
||||
font-family: inherit;
|
||||
/* 1 */
|
||||
font-size: 100%;
|
||||
/* 1 */
|
||||
line-height: 1.15;
|
||||
/* 1 */
|
||||
margin: 0;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show the overflow in IE.
|
||||
* 1. Show the overflow in Edge.
|
||||
*/
|
||||
|
||||
button,
|
||||
input {
|
||||
/* 1 */
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove the inheritance of text transform in Edge, Firefox, and IE.
|
||||
* 1. Remove the inheritance of text transform in Firefox.
|
||||
*/
|
||||
|
||||
button,
|
||||
select {
|
||||
/* 1 */
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Correct the inability to style clickable types in iOS and Safari.
|
||||
*/
|
||||
|
||||
button,
|
||||
[type="button"],
|
||||
[type="reset"],
|
||||
[type="submit"] {
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove the inner border and padding in Firefox.
|
||||
*/
|
||||
|
||||
button::-moz-focus-inner,
|
||||
[type="button"]::-moz-focus-inner,
|
||||
[type="reset"]::-moz-focus-inner,
|
||||
[type="submit"]::-moz-focus-inner {
|
||||
border-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Restore the focus styles unset by the previous rule.
|
||||
*/
|
||||
|
||||
button:-moz-focusring,
|
||||
[type="button"]:-moz-focusring,
|
||||
[type="reset"]:-moz-focusring,
|
||||
[type="submit"]:-moz-focusring {
|
||||
outline: 1px dotted ButtonText;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Correct the padding in Firefox.
|
||||
*/
|
||||
|
||||
fieldset {
|
||||
padding: 0.35em 0.75em 0.625em;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. Correct the text wrapping in Edge and IE.
|
||||
* 2. Correct the color inheritance from `fieldset` elements in IE.
|
||||
* 3. Remove the padding so developers are not caught out when they zero out
|
||||
* `fieldset` elements in all browsers.
|
||||
*/
|
||||
|
||||
legend {
|
||||
box-sizing: border-box;
|
||||
/* 1 */
|
||||
color: inherit;
|
||||
/* 2 */
|
||||
display: table;
|
||||
/* 1 */
|
||||
max-width: 100%;
|
||||
/* 1 */
|
||||
padding: 0;
|
||||
/* 3 */
|
||||
white-space: normal;
|
||||
/* 1 */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
|
||||
*/
|
||||
|
||||
progress {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove the default vertical scrollbar in IE 10+.
|
||||
*/
|
||||
|
||||
textarea {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. Add the correct box sizing in IE 10.
|
||||
* 2. Remove the padding in IE 10.
|
||||
*/
|
||||
|
||||
[type="checkbox"],
|
||||
[type="radio"] {
|
||||
box-sizing: border-box;
|
||||
/* 1 */
|
||||
padding: 0;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Correct the cursor style of increment and decrement buttons in Chrome.
|
||||
*/
|
||||
|
||||
[type="number"]::-webkit-inner-spin-button,
|
||||
[type="number"]::-webkit-outer-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. Correct the odd appearance in Chrome and Safari.
|
||||
* 2. Correct the outline style in Safari.
|
||||
*/
|
||||
|
||||
[type="search"] {
|
||||
-webkit-appearance: textfield;
|
||||
/* 1 */
|
||||
outline-offset: -2px;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove the inner padding in Chrome and Safari on macOS.
|
||||
*/
|
||||
|
||||
[type="search"]::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. Correct the inability to style clickable types in iOS and Safari.
|
||||
* 2. Change font properties to `inherit` in Safari.
|
||||
*/
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
-webkit-appearance: button;
|
||||
/* 1 */
|
||||
font: inherit;
|
||||
/* 2 */
|
||||
}
|
||||
|
||||
|
||||
/* Interactive
|
||||
========================================================================== */
|
||||
|
||||
|
||||
/*
|
||||
* Add the correct display in Edge, IE 10+, and Firefox.
|
||||
*/
|
||||
|
||||
details {
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Add the correct display in all browsers.
|
||||
*/
|
||||
|
||||
summary {
|
||||
display: list-item;
|
||||
}
|
||||
|
||||
|
||||
/* Misc
|
||||
========================================================================== */
|
||||
|
||||
|
||||
/**
|
||||
* Add the correct display in IE 10+.
|
||||
*/
|
||||
|
||||
template {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add the correct display in IE 10.
|
||||
*/
|
||||
|
||||
[hidden] {
|
||||
display: none;
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*! blueberry.css | MIT License | github.com/ntno/mkdocs-terminal */
|
||||
|
||||
:root {
|
||||
--cream: #ffffcc;
|
||||
--black: #190910;
|
||||
--digital-navy: #000080;
|
||||
--authentic-blue: #3737aa;
|
||||
--corn-harvest: #8a6801;
|
||||
--light-grey: #d4d4d4;
|
||||
--dark-grey: #5e5e5e;
|
||||
--white: #f7f7f7;
|
||||
|
||||
--global-font-size: 15px;
|
||||
--global-line-height: 1.4em;
|
||||
--global-space: 10px;
|
||||
--font-stack: "Fira Code", Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
|
||||
--mono-font-stack: "Fira Code", Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
|
||||
--background-color: var(--cream);
|
||||
--page-width: 60em;
|
||||
--font-color: var(--black);
|
||||
--invert-font-color: var(--white);
|
||||
--primary-color: var(--digital-navy);
|
||||
--secondary-color: var(--authentic-blue);
|
||||
--tertiary-color: var(--authentic-blue);
|
||||
--error-color: var(--corn-harvest);
|
||||
--progress-bar-background: var(--light-grey);
|
||||
--progress-bar-fill: var(--dark-grey);
|
||||
--code-bg-color: var(--white);
|
||||
--input-style: solid;
|
||||
--display-h1-decoration: none;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
/*! dark.css 0.7.5 | MIT License | github.com/Gioni06/terminal.css */
|
||||
|
||||
:root {
|
||||
--global-font-size: 15px;
|
||||
--global-line-height: 1.4em;
|
||||
--global-space: 10px;
|
||||
--font-stack: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
|
||||
--mono-font-stack: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
|
||||
--background-color: #222225;
|
||||
--page-width: 60em;
|
||||
--font-color: #e8e9ed;
|
||||
--invert-font-color: #222225;
|
||||
--secondary-color: #a3abba;
|
||||
--tertiary-color: #a3abba;
|
||||
--primary-color: #62c4ff;
|
||||
--error-color: #ff3c74;
|
||||
--progress-bar-background: #3f3f44;
|
||||
--progress-bar-fill: #62c4ff;
|
||||
--code-bg-color: #3f3f44;
|
||||
--input-style: solid;
|
||||
--display-h1-decoration: none;
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
/*! terminal.css 0.7.5 | MIT License | github.com/Gioni06/terminal.css */
|
||||
|
||||
|
||||
/* this document is intentionally left empty. for root configuration, see terminal/css/terminal.css */
|
||||
@@ -1,50 +0,0 @@
|
||||
/*! gruvbox_dark.css | MIT License | github.com/Gioni06/terminal.css/issues/9 */
|
||||
|
||||
:root {
|
||||
--gb-dm-bg0: #282828;
|
||||
--gb-dm-bg0-hard: #1d2021;
|
||||
--gb-dm-bg0-soft: #32302f;
|
||||
--gb-dm-bg1: #3c3836;
|
||||
--gb-dm-bg2: #504945;
|
||||
--gb-dm-bg3: #665c54;
|
||||
--gb-dm-bg4: #7c6f64;
|
||||
--gb-dm-fg0: #fbf1c7;
|
||||
--gb-dm-fg1: #ebdbb2;
|
||||
--gb-dm-fg2: #d5c4a1;
|
||||
--gb-dm-fg3: #bdae93;
|
||||
--gb-dm-fg4: #a89984;
|
||||
--gb-dm-dark-red: #cc241d;
|
||||
--gb-dm-dark-green: #98971a;
|
||||
--gb-dm-dark-yellow: #d79921;
|
||||
--gb-dm-dark-blue: #458588;
|
||||
--gb-dm-dark-purple: #b16286;
|
||||
--gb-dm-dark-aqua: #689d6a;
|
||||
--gb-dm-dark-orange: #d65d0e;
|
||||
--gb-dm-dark-gray: #928374;
|
||||
--gb-dm-light-red: #fb4934;
|
||||
--gb-dm-light-green: #b8bb26;
|
||||
--gb-dm-light-yellow: #fabd2f;
|
||||
--gb-dm-light-blue: #83a598;
|
||||
--gb-dm-light-purple: #d3869b;
|
||||
--gb-dm-light-aqua: #8ec07c;
|
||||
--gb-dm-light-orange: #f38019;
|
||||
--gb-dm-light-gray: #a89984;
|
||||
--global-font-size: 15px;
|
||||
--global-line-height: 1.4em;
|
||||
--global-space: 10px;
|
||||
--font-stack: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
|
||||
--mono-font-stack: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
|
||||
--background-color: var(--gb-dm-bg0);
|
||||
--page-width: 60em;
|
||||
--font-color: var(--gb-dm-fg1);
|
||||
--invert-font-color: var(--gb-dm-bg0-hard);
|
||||
--primary-color: var(--gb-dm-light-yellow);
|
||||
--secondary-color: var(--gb-dm-fg3);
|
||||
--tertiary-color: var(--gb-dm-light-gray);
|
||||
--error-color: var(--gb-dm-light-red);
|
||||
--progress-bar-background: var(--gb-dm-bg2);
|
||||
--progress-bar-fill: var(--gb-dm-fg2);
|
||||
--code-bg-color: var(--gb-dm-bg2);
|
||||
--input-style: solid;
|
||||
--display-h1-decoration: none;
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*! lightyear.css | MIT License | github.com/ntno/mkdocs-terminal */
|
||||
|
||||
:root {
|
||||
--mint: #e0ffe0;
|
||||
--black: #190910;
|
||||
--white: #f7f7f7;
|
||||
--dark-purple: #4b0082;
|
||||
--grape: #805b9c;
|
||||
--red: #cc2517;
|
||||
--light-grey: #d4d4d4;
|
||||
--dark-grey: #5e5e5e;
|
||||
|
||||
--global-font-size: 15px;
|
||||
--global-line-height: 1.4em;
|
||||
--global-space: 10px;
|
||||
--font-stack: "Fira Code", Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
|
||||
--mono-font-stack: "Fira Code", Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
|
||||
--background-color: var(--mint);
|
||||
--page-width: 60em;
|
||||
--font-color: var(--black);
|
||||
--invert-font-color: var(--white);
|
||||
--primary-color: var(--dark-purple);
|
||||
--secondary-color: var(--grape);
|
||||
--tertiary-color: var(--grape);
|
||||
--error-color: var(--red);
|
||||
--progress-bar-background: var(--light-grey);
|
||||
--progress-bar-fill: var(--dark-grey);
|
||||
--code-bg-color: var(--white);
|
||||
--input-style: solid;
|
||||
--display-h1-decoration: none;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
/*! pink.css | MIT License | github.com/Gioni06/terminal.css/issues/9 */
|
||||
|
||||
:root {
|
||||
--global-font-size: 15px;
|
||||
--global-line-height: 1.4em;
|
||||
--global-space: 10px;
|
||||
--font-stack: 'Fira Code', Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
|
||||
--mono-font-stack: 'Fira Code', Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
|
||||
--background-color: #ffffff;
|
||||
--page-width: 60em;
|
||||
--font-color: #190910;
|
||||
--invert-font-color: #f7f7f7;
|
||||
--primary-color: #f90d7a;
|
||||
--secondary-color: #715864;
|
||||
--tertiary-color: #715864;
|
||||
--error-color: #bb0047;
|
||||
--progress-bar-background: #d4d4d4;
|
||||
--progress-bar-fill: #5e5e5e;
|
||||
--code-bg-color: #f7f7f7;
|
||||
--input-style: solid;
|
||||
--display-h1-decoration: none;
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*! red_drum.css | MIT License | github.com/ntno/mkdocs-terminal */
|
||||
|
||||
:root {
|
||||
--pale-goldenrod: #eee8aa;
|
||||
--black: #190910;
|
||||
--white: #f7f7f7;
|
||||
--dark-red: #8b0000;
|
||||
--old-rose: #8b5a5b;
|
||||
--sea-blue: #00678c;
|
||||
--light-grey: #d4d4d4;
|
||||
--dark-grey: #5e5e5e;
|
||||
|
||||
--global-font-size: 15px;
|
||||
--global-line-height: 1.4em;
|
||||
--global-space: 10px;
|
||||
--font-stack: "Fira Code", Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
|
||||
--mono-font-stack: "Fira Code", Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
|
||||
--background-color: var(--pale-goldenrod);
|
||||
--page-width: 60em;
|
||||
--font-color: var(--black);
|
||||
--invert-font-color: var(--white);
|
||||
--primary-color: var(--dark-red);
|
||||
--secondary-color: var(--old-rose);
|
||||
--tertiary-color: var(--old-rose);
|
||||
--error-color: var(--sea-blue);
|
||||
--progress-bar-background: var(--light-grey);
|
||||
--progress-bar-fill: var(--dark-grey);
|
||||
--code-bg-color: var(--white);
|
||||
--input-style: solid;
|
||||
--display-h1-decoration: none;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
/*! sans.css 0.7.5 | MIT License | github.com/Gioni06/terminal.css */
|
||||
|
||||
:root {
|
||||
--global-font-size: 15px;
|
||||
--global-line-height: 1.4em;
|
||||
--font-stack: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
|
||||
--input-style: solid;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/*! sans_dark.css 0.7.5 | MIT License | github.com/Gioni06/terminal.css */
|
||||
|
||||
:root {
|
||||
--global-font-size: 15px;
|
||||
--global-line-height: 1.4em;
|
||||
--font-stack: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
|
||||
--background-color: #222225;
|
||||
--page-width: 60em;
|
||||
--font-color: #e8e9ed;
|
||||
--invert-font-color: #222225;
|
||||
--secondary-color: #a3abba;
|
||||
--tertiary-color: #a3abba;
|
||||
--primary-color: #62c4ff;
|
||||
--error-color: #ff3c74;
|
||||
--progress-bar-background: #3f3f44;
|
||||
--progress-bar-fill: #62c4ff;
|
||||
--code-bg-color: #3f3f44;
|
||||
--input-style: solid;
|
||||
--display-h1-decoration: none;
|
||||
}
|
||||
Vendored
-211
@@ -1,211 +0,0 @@
|
||||
/*! Terminal for MkDocs | MIT License | github.com/ntno/mkdocs-terminal */
|
||||
/*!
|
||||
/*! Bootstrap v4.3.1 | MIT License | github.com/twbs/bootstrap
|
||||
* Copyright 2011-2019 The Bootstrap Authors
|
||||
* Copyright 2011-2019 Twitter, Inc.
|
||||
*/
|
||||
|
||||
.modal-open {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.modal-open .modal {
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.modal {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1050;
|
||||
display: none;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.modal-dialog {
|
||||
position: relative;
|
||||
width: auto;
|
||||
margin: 0.5rem;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.modal.fade .modal-dialog {
|
||||
transition: -webkit-transform 0.3s ease-out;
|
||||
transition: transform 0.3s ease-out;
|
||||
transition: transform 0.3s ease-out, -webkit-transform 0.3s ease-out;
|
||||
-webkit-transform: translate(0, -50px);
|
||||
transform: translate(0, -50px);
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.modal.fade .modal-dialog {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
|
||||
.modal.show .modal-dialog {
|
||||
-webkit-transform: none;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.modal-dialog-scrollable {
|
||||
display: flex;
|
||||
max-height: calc(100% - 1rem);
|
||||
}
|
||||
|
||||
.modal-dialog-scrollable .modal-content {
|
||||
max-height: calc(100vh - 1rem);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.modal-dialog-scrollable .modal-header,
|
||||
.modal-dialog-scrollable .modal-footer {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.modal-dialog-scrollable .modal-body {
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.modal-dialog-centered {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: calc(100% - 1rem);
|
||||
}
|
||||
|
||||
.modal-dialog-centered::before {
|
||||
display: block;
|
||||
height: calc(100vh - 1rem);
|
||||
content: "";
|
||||
}
|
||||
|
||||
.modal-dialog-centered.modal-dialog-scrollable {
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.modal-dialog-centered.modal-dialog-scrollable .modal-content {
|
||||
max-height: none;
|
||||
}
|
||||
|
||||
.modal-dialog-centered.modal-dialog-scrollable::before {
|
||||
content: none;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
pointer-events: auto;
|
||||
background-color: var(--code-bg-color);
|
||||
background-clip: padding-box;
|
||||
border: 1px solid var(--font-color);
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.modal-backdrop {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1040;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background-color: #000;
|
||||
}
|
||||
|
||||
.modal-backdrop.fade {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.modal-backdrop.show {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
padding: 1rem 1rem;
|
||||
border-bottom: 1px solid var(--secondary-color);
|
||||
}
|
||||
|
||||
.modal-header .close {
|
||||
padding: 1rem 1.5rem;
|
||||
margin: -.7rem -.7rem -.7rem auto;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
margin-bottom: 0;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
position: relative;
|
||||
flex: 1 1 auto;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.modal-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
padding: 1rem;
|
||||
border-top: 1px solid var(--secondary-color);
|
||||
}
|
||||
|
||||
.modal-footer> :not(:first-child) {
|
||||
margin-left: .25rem;
|
||||
}
|
||||
|
||||
.modal-footer> :not(:last-child) {
|
||||
margin-right: .25rem;
|
||||
}
|
||||
|
||||
.modal-scrollbar-measure {
|
||||
position: absolute;
|
||||
top: -9999px;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
@media (min-width: 576px) {
|
||||
.modal-dialog {
|
||||
max-width: 500px;
|
||||
margin: 1.75rem auto;
|
||||
}
|
||||
.modal-dialog-scrollable {
|
||||
max-height: calc(100% - 3.5rem);
|
||||
}
|
||||
.modal-dialog-scrollable .modal-content {
|
||||
max-height: calc(100vh - 3.5rem);
|
||||
}
|
||||
.modal-dialog-centered {
|
||||
min-height: calc(100% - 3.5rem);
|
||||
}
|
||||
.modal-dialog-centered::before {
|
||||
height: calc(100vh - 3.5rem);
|
||||
}
|
||||
.modal-sm {
|
||||
max-width: 300px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 992px) {
|
||||
.modal-lg,
|
||||
.modal-xl {
|
||||
max-width: 800px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
.modal-xl {
|
||||
max-width: 1140px;
|
||||
}
|
||||
}
|
||||
-1055
File diff suppressed because it is too large.
Load diff
@@ -1,92 +0,0 @@
|
||||
/*! Terminal for MkDocs | MIT License | github.com/ntno/mkdocs-terminal */
|
||||
|
||||
|
||||
/*! terminal.css 0.7.5 | MIT License | github.com/Gioni06/terminal.css */
|
||||
|
||||
body {
|
||||
padding-top: 50px;
|
||||
padding-bottom: 50px;
|
||||
}
|
||||
|
||||
|
||||
/* underline links in main content (except header anchor links) */
|
||||
|
||||
#terminal-mkdocs-main-content a:not(.headerlink) {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
||||
/* do not underline button links */
|
||||
|
||||
a.btn {
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
.terminal-mkdocs-side-nav-item--active {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.terminal-mkdocs-side-nav-section-no-index {
|
||||
color: var(--secondary-color);
|
||||
}
|
||||
|
||||
.terminal-mkdocs-pad-to-match-side-nav {
|
||||
padding-top: calc(var(--global-space) * 2);
|
||||
}
|
||||
|
||||
.terminal-mkdocs-thin-border {
|
||||
border: solid !important;
|
||||
border-color: var(--secondary-color) !important;
|
||||
border-width: thin !important;
|
||||
}
|
||||
|
||||
.terminal-mkdocs-macro-error-banner {
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: .65em 2em;
|
||||
border-color: var(--error-color);
|
||||
}
|
||||
|
||||
p.terminal-mkdocs-macro-error-banner {
|
||||
color: var(--font-color);
|
||||
}
|
||||
|
||||
p.terminal-mkdocs-macro-error-banner>code {
|
||||
color: var(--code-font-color);
|
||||
}
|
||||
|
||||
|
||||
/* set figcaption paragraph text to the secondary color. this occurs when using markdown inside the figcaption */
|
||||
|
||||
figure>figcaption>p {
|
||||
color: var(--secondary-color);
|
||||
}
|
||||
|
||||
|
||||
/* ***************************************************************** */
|
||||
|
||||
|
||||
/* Terminal.css Overrides */
|
||||
|
||||
|
||||
/* ***************************************************************** */
|
||||
|
||||
|
||||
/* don't display backticks on `code` items, just highlight */
|
||||
|
||||
code::after,
|
||||
code::before {
|
||||
content: "" !important;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
|
||||
/* use the `code-bg-color` and `code-font-color` for `<code>` blocks */
|
||||
|
||||
pre code {
|
||||
background-color: var(--code-bg-color);
|
||||
color: var(--code-font-color);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/* grid for footer */
|
||||
|
||||
.terminal-mkdocs-footer-grid {
|
||||
display: grid;
|
||||
grid-row-gap: 2em;
|
||||
grid-column-gap: 2em;
|
||||
grid-template-columns: auto;
|
||||
grid-template-rows: auto;
|
||||
}
|
||||
|
||||
|
||||
/* place prev/next links to the right of copyright info when screen is wide enough */
|
||||
|
||||
@media only screen and (min-width: 50em) {
|
||||
.terminal-mkdocs-footer-grid {
|
||||
grid-template-columns: 6fr 3fr;
|
||||
}
|
||||
#terminal-mkdocs-footer-prev-next {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
#terminal-mkdocs-footer-copyright-info {
|
||||
text-align: left;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/*! Terminal for MkDocs | MIT License | github.com/ntno/mkdocs-terminal */
|
||||
|
||||
.terminal-mkdocs-tile-grid {
|
||||
display: grid;
|
||||
grid-gap: 1em;
|
||||
grid-template-rows: auto;
|
||||
grid-template-columns: repeat(auto-fit, minmax(calc(var(--page-width) / 6), 1fr));
|
||||
}
|
||||
|
||||
|
||||
/* center link text within the tile */
|
||||
|
||||
.terminal-mkdocs-tile {
|
||||
border: none;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
/* center images within the tile */
|
||||
|
||||
.terminal-mkdocs-tile div>figure>img,
|
||||
.terminal-mkdocs-tile div>figure>a>img {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
+375
@@ -0,0 +1,375 @@
|
||||
# MeshCore-FAQ
|
||||
A list of frequently-asked questions and answers for MeshCore
|
||||
|
||||
The current version of this MeshCore FAQ is at https://github.com/ripplebiz/MeshCore/blob/main/docs/faq.md.
|
||||
This MeshCore FAQ is also mirrored at https://github.com/LitBomb/MeshCore-FAQ and might have newer updates if pull requests on Scott's MeshCore repo are not approved yet.
|
||||
|
||||
author: https://github.com/LitBomb
|
||||
---
|
||||
|
||||
## Q: What is MeshCore?
|
||||
|
||||
**A:** MeshCore is free and open source
|
||||
* MeshCore is the routing and firmware etc, available on GitHub under MIT license
|
||||
* There are clients made by the community, such as the web clients, these are free to use, and some are open source too
|
||||
* The cross platform mobile app developed by [Liam Cottle](https://liamcottle.net) for Android/iOS/PC etc is free to download and use
|
||||
* The T-Deck firmware is developed by Scott at Ripple Radios, the creator of MeshCore, is also free to flash on your devices and use
|
||||
|
||||
|
||||
Some more advanced, but optional features are available on T-Deck if you register your device for a key to unlock. On the MeshCore smartphone clients for Android and iOS/iPadOS, you can unlock the wait timer for repeater and room server remote management over RF feature.
|
||||
|
||||
These features are completely optional and aren't needed for the core messaging experience. They're like super bonus features and to help the developers continue to work on these amazing features, they may charge a small fee for an unlock code to utilise the advanced features.
|
||||
|
||||
Anyone is able to build anything they like on top of MeshCore without paying anything.
|
||||
|
||||
## Q: What do you need to start using MeshCore?
|
||||
**A:** Everything you need for MeshCore is available at:
|
||||
Main web site: [https://meshcore.co.uk/](https://meshcore.co.uk/)
|
||||
Firmware Flasher: https://flasher.meshcore.co.uk/
|
||||
Phone Client Applications: https://meshcore.co.uk/apps.html
|
||||
MeshCore Fimrware Github: https://github.com/ripplebiz/MeshCore
|
||||
|
||||
NOTE: Andy Kirby has a very useful [intro video](https://www.youtube.com/watch?v=t1qne8uJBAc) for beginners.
|
||||
|
||||
|
||||
You need LoRa hardware devices to run MeshCore firmware as clients or server (repeater and room server).
|
||||
|
||||
### Hardware
|
||||
To use MeshCore without using a phone as the client interface, you can run MeshCore on a T-Deck or T-Deck Plus. It is a complete off-grid secure communication solution.
|
||||
|
||||
MeshCore is also available on a variety of 868MHz and 915MHz LoRa devices. For example, RAK4631 devices (19003, 19007, 19026), Heltec V3, Xiao S3 WIO, Xiao C3, Heltec T114, Station G2, Seeed Studio T1000-E. More devices will be supported later.
|
||||
|
||||
### Firmware
|
||||
MeshCore has four firmware types that are not available on other LoRa systems. MeshCore has the following:
|
||||
|
||||
#### Companion Radio Firmware
|
||||
Companion radios are for connecting to the Android app or web app as a messenger client. There are two different companion radio firmware versions:
|
||||
|
||||
1. **BLE Companion**
|
||||
BLE Companion firmware runs on a supported LoRa device and connects to a smart device running the Android MeshCore client over BLE (iOS MeshCore client will be available soon)
|
||||
<https://meshcore.co.uk/apps.html>
|
||||
|
||||
2. **USB Serial Companion**
|
||||
USB Serial Companion firmware runs on a supported LoRa device and connects to a smart device or a computer over USB Serial running the MeshCore web client
|
||||
<https://meshcore.liamcottle.net/#/>
|
||||
<https://client.meshcore.co.uk/tabs/devices>
|
||||
|
||||
#### Repeater
|
||||
Repeaters are used to extend the range of a MeshCore network. Repeater firmware runs on the same devices that run client firmware. A repeater's job is to forward MeshCore packets to the destination device. It does **not** forward or retransmit every packet it receives, unlike other LoRa mesh systems.
|
||||
|
||||
A repeater can be remotely administered using a T-Deck running the MeshCore firwmware with remote admistration features unlocked, or from a BLE Companion client connected to a smartphone running the MeshCore app.
|
||||
|
||||
#### Room Server
|
||||
A room server is a simple BBS server for sharing posts. T-Deck devices running MeshCore firmware or a BLE Companion client connected to a smartphone running the MeshCore app can connect to a room server.
|
||||
|
||||
room servers store message history on them, and push the stored messages to users. Room servers allow roaming users to come back later and retrieve message history. Contrast to channels, messages are either received when it's sent, or not received and missed if the a room user is out of range. You can think of room servers like email servers where you can come back later and get your emails from your mail server
|
||||
|
||||
A room server can be remotely administered using a T-Deck running the MeshCore firwmware with remote admistration features unlocked, or from a BLE Companion client connected to a smartphone running the MeshCore app.
|
||||
|
||||
When a client logs into a room server, the client will receive the previously 16 unseen messages.
|
||||
|
||||
A room server can also take on the repeater role. To enable repeater role on a room server, use this command:
|
||||
|
||||
`set repeat {on|off}`
|
||||
|
||||
---
|
||||
|
||||
## Initial Setup
|
||||
|
||||
### Q: How many devices do I need to start using meshcore?
|
||||
**A:** If you have one supported device, flash the BLE Companion firmware and use your device as a client. You can connect to the device using the Android client via bluetooth (iOS client will be available later). You can start communiating with other MeshCore users near you.
|
||||
|
||||
If you have two supported devices, and there are not many MeshCore users near you, flash both of them to BLE Companion firmware so you can use your devices to communiate with your near-by friends and family.
|
||||
|
||||
If you have two supported devices, and there are other MeshcCore users near by, you can flash one of your devices with BLE Companion firmware, and flash another supported device to repeater firmware. Place the repeater high above ground o extend your MeshCore network's reach.
|
||||
|
||||
After you flashed the latest firmware onto your repeater device, keep the device connected to your computer via USB serial, use the console feature on the web flasher and set the frequency for your region or country, so your client can remote administer the rpeater or room server over RF:
|
||||
|
||||
`set freq {frequency}`
|
||||
|
||||
The repeater and room server CLI reference is here: https://github.com/ripplebiz/MeshCore/wiki/Repeater-&-Room-Server-CLI-Reference
|
||||
|
||||
If you have more supported devices, you can use your additional deivces with the room server firmware.
|
||||
|
||||
### Q: Does MeshCore cost any money?
|
||||
|
||||
**A:** All radio firmware versions (e.g. for Heltec V3, RAK, T-1000E, etc) are free and open source developed by Scott at Ripple Radios.
|
||||
|
||||
The native Android and iOS client uses the freemium model and is developed by Liam Cottle, developer of meshtastic map at [meshtastic.liamcottle.net](https://meshtastic.liamcottle.net) on [github ](https://github.com/liamcottle/meshtastic-map)and [reticulum-meshchat on github](https://github.com/liamcottle/reticulum-meshchat).
|
||||
|
||||
The T-Deck firmware is free to download and most features are available without cost. To support the firmware developer, you can pay for a registration key to unlock your T-Deck for deeper map zoom and remote server administration over RF using the T-Deck. You do not need to pay for the registration to use your T-Deck for direct messaging and connecting to repeaters and room servers.
|
||||
|
||||
|
||||
### Q: What frequencies are supported by MeshCore?
|
||||
**A:** It supports the 868MHz range in the UK/EU and the 915MHz range in New Zealand, Australia, and the USA. Countries and regions in these two frequency ranges are also supported. The firmware and client allow users to set their preferred frequency.
|
||||
- Australia and New Zealand are on **915.8MHz**
|
||||
- UK and EU are on **869.525MHz**
|
||||
- Canada and USA are on **910.525MHz**
|
||||
- For other regions and countries, please check your local LoRa frequency
|
||||
|
||||
the rest of the radio settings are the same for all frequencies:
|
||||
- Spread Factor (SF): 10
|
||||
- Coding Rate (CR): 5
|
||||
- Bandwidth (BW): 250.00
|
||||
|
||||
### Q: What is an "advert" in MeshCore?
|
||||
**A:**
|
||||
Advert means to advertise yourself on the network. In Reticulum terms it would be to announce. In Meshtastic terms it would be the node sending it's node info.
|
||||
|
||||
MeshCore allows you to manually broadcast your name, position and public encryption key, which is also signed to prevent spoofing. When you click the advert button, it broadcasts that data over LoRa. MeshCore calls that an Advert. There's two ways to advert, "zero hop" and "flood".
|
||||
|
||||
* Zero hop means your advert is broadcasted out to anyone that can hear it, and that's it.
|
||||
* Flooded means it's broadcasted out, and then repeated by all the repeaters that hear it.
|
||||
|
||||
MeshCore clients only advertise themselves when the user initiates it. A repeater (and room server?) advertises its presence once every 240 minutes. This interval can be configured using the following command:
|
||||
|
||||
`set advert.interval {minutes}`
|
||||
|
||||
### Q: Is there a hop limit?
|
||||
|
||||
**A:** Internally the firmware has maximum limit of 64 hops. In real world settings it will be difficult to get close to the limit due to the environments and timing as packets travel further and further. We want to hear how far your MeshCore conversations go.
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Server Administration
|
||||
|
||||
### Q: How do you configure a repeater or a room server?
|
||||
**A:** One of these servers can be administered with one of the options below:
|
||||
- Connect the server device using a USB cable to a computer running Chrome on https://flasher.meshcore.co.uk/, then use the `console` feature to connect to the device
|
||||
- this is necessary to set the server device's frequency if it doesn't match the frequency for your local region or country
|
||||
- MeshCore smart device clients have the ability to remotely administer servers.
|
||||
- A T-Deck running unlocked/registered MeshCore firmware. Remote server administration is enabled through registering your T-Deck with Ripple Radios. It is one of the ways to support MeshCore development. You can register your T-Deck at:
|
||||
<https://buymeacoffee.com/ripplebiz/e/249834>
|
||||
|
||||
### Q: Do I need to set the location for a repeater?
|
||||
**A:** With location set for a repeater, it can show up on a MeshCore map in the future. Set location with the following commands:
|
||||
|
||||
`set lat <GPS Lat> set long <GPS Lon>`
|
||||
|
||||
You can get the latitude and longitude from Google Maps by right-clicking the location you are at on the map.
|
||||
|
||||
### Q: What is the password to administer a repeater or a room server?
|
||||
**A:** The default admin password to a repeater and room server is `password`. Use the following command to change the admin password:
|
||||
|
||||
`password {new-password}`
|
||||
|
||||
|
||||
### Q: What is the password to join a room server?
|
||||
**A:** The default guest password to a room server is `hello`. Use the following command to change the guest password:
|
||||
|
||||
`set guest.password {guest-password}`
|
||||
|
||||
|
||||
---
|
||||
|
||||
## T-Deck Related
|
||||
|
||||
### Q: What are the steps to get a T-Deck into DFU (Device Firmware Update) mode?
|
||||
**A:**
|
||||
1. Device off
|
||||
2. Connect USB cable to device
|
||||
3. Hold down trackball (keep holding)
|
||||
4. Turn on device
|
||||
5. Hear USB connection sound
|
||||
6. Release trackball
|
||||
7. T-Deck in DFU mode now
|
||||
8. At this point you can begin flashing using <https://flasher.meshcore.co.uk/>
|
||||
|
||||
### Q: Why is my T-Deck Plus not getting any satellite lock?
|
||||
**A:** For T-Deck Plus, the GPS baud rate should be set to **38400**. Also, a number of T-Deck Plus devices were found to have the GPS module installed upside down, with the GPS antenna facing down instead of up. If your T-Deck Plus still doesn't get any satellite lock after setting the baud rate to 38400, you might need to open up the device to check the GPS orientation.
|
||||
|
||||
### Q: Why is my OG (non-Plus) T-Deck not getting any satellite lock?
|
||||
**A:** The OG (non-Plus) T-Deck doesn't come with a GPS. If you added a GPS to your OG T-Deck, please refer to the manual of your GPS to see what baud rate it requires. Alternatively, you can try to set the baud rate from 9600, 19200, etc., and up to 115200 to see which one works.
|
||||
|
||||
### Q: What size of SD card does the T-Deck support?
|
||||
**A:** Users have had no issues using 16GB or 32GB SD cards. Format the SD card to **FAT32**.
|
||||
|
||||
### Q: How do I get maps on T-Deck?
|
||||
**A:** You need map tiles. You can get pre-downloaded map tiles here (a good way to support development):
|
||||
- <https://buymeacoffee.com/ripplebiz/e/342543> (Europe)
|
||||
- <https://buymeacoffee.com/ripplebiz/e/342542> (US)
|
||||
|
||||
Another way to download map tiles is to use this Python script to get the tiles in the areas you want:
|
||||
<https://github.com/fistulareffigy/MTD-Script>
|
||||
|
||||
There is also a modified script that adds additional error handling and parallel downloads:
|
||||
<https://discord.com/channels/826570251612323860/1330643963501351004/1338775811548905572>
|
||||
|
||||
UK map tiles are available separately from Andy Kirby on his discord server:
|
||||
<https://discord.com/channels/826570251612323860/1330643963501351004/1331346597367386224>
|
||||
|
||||
### Q: Where do the map tiles go?
|
||||
Once you have the tiles downloaded, copy the `\tiles` folder to the root of your T-Deck's SD card.
|
||||
|
||||
### Q: How to unlock deeper map zoom and server management features on T-Deck?
|
||||
**A:** You can download, install, and use the T-Deck firmware for free, but it has some features (map zoom, server administration) that are enabled if you purchase an unlock code for \$10 per T-Deck device.
|
||||
Unlock page: <https://buymeacoffee.com/ripplebiz/e/249834>
|
||||
|
||||
|
||||
### Q: The T-Deck sound is too loud?
|
||||
### Q: Can you customize the sound?
|
||||
|
||||
**A:** You can customise the sounds on the T-Deck, just by placing `.mp3` files onto the `root` dir of the SD card. `startup.mp3`, `alert.mp3` and `new-advert.mp3`
|
||||
|
||||
### Q: What is the 'Import from Clipboard' feature on the t-deck and is there a way to manually add nodes without having to receive adverts?
|
||||
|
||||
**A:** 'Import from Clipboard' is for importing a contact via a file named 'clipboard.txt' on the SD card. The opposite, is in the Identity screen, the 'Card to Clipboard' menu, which writes to 'clipboard.txt' so you can share yourself (call these 'biz cards', that start with "meshcore://...")
|
||||
|
||||
---
|
||||
|
||||
## General
|
||||
|
||||
### Q: What are BW, SF, and CR?
|
||||
|
||||
**A:**
|
||||
|
||||
**BW is bandwidth** - width of frequency spectrum that is used for transmission
|
||||
|
||||
**SF is spreading factor** - how much should the communication spread in time
|
||||
|
||||
**CR is coding rate** - https://www.thethingsnetwork.org/docs/lorawan/fec-and-code-rate/
|
||||
Making the bandwidth 2x wider (from BW125 to BW250) allows you to send 2x more bytes in the same time. Making the spreading factor 1 step lower (from SF10 to SF9) allows you to send 2x more bytes in the same time.
|
||||
|
||||
Lowering the spreading factor makes it more difficult for the gateway to receive a transmission, as it will be more sensitive to noise. You could compare this to two people taking in a noisy place (a bar for example). If you’re far from each other, you have to talk slow (SF10), but if you’re close, you can talk faster (SF7)
|
||||
|
||||
So it's balancing act between speed of the transmission and resistance to noise.
|
||||
things network is mainly focused on LoRaWAN, but the LoRa low-level stuff still checks out for any LoRa project
|
||||
|
||||
### Q: What happens when a node learns a route via a mobile repeater, and that repeater is gone?
|
||||
|
||||
**A:** If you used to reach a node through a repeater and the repeater is no longer reachable, the client will send the message using the existing (but now broken) known path, the message will fail after 3 retries, and the app will reset the path and send the message as flood on the last retry by default. This can be turned off in settings. If the destination is reachable directly or through another repeater, the new path will be used going forward. Or you can set the path manually if you know a specific repeater to use to reach that destination.
|
||||
|
||||
In the case if users are moving around frequently, and the paths are breaking, they just see the phone client retries and revert to flood to attempt to reestablish a path.
|
||||
|
||||
|
||||
### Q: Is MeshCore open source?
|
||||
**A:** Most of the firmware is freely available. Everything is open source except the T-Deck firmware and Liam's native mobile apps.
|
||||
- Firmware repo: <https://github.com/ripplebiz/MeshCore>
|
||||
|
||||
### Q: How can I support MeshCore?
|
||||
**A:** Provide your honest feedback on GitHub and on AndyKirby's Discord server <http://discord.com/invite/H62Re4DCeD>. Spread the word of MeshCore to your friends and communities; help them get started with MeshCore. Support Scott's MeshCore development at <https://buymeacoffee.com/ripplebiz>.
|
||||
|
||||
Support Liam Cottle's smartphone client development by unlocking the server administration wait gate with in-app purchase
|
||||
|
||||
Support Rastislav Vysoky (recrof)'s flasher web site and the map web site development through [PayPal](https://www.paypal.com/donate/?business=DREHF5HM265ES&no_recurring=0&item_name=If+you+enjoy+my+work%2C+you+can+support+me+here%3A¤cy_code=EUR) or [Revolut](https://revolut.me/recrof)
|
||||
|
||||
### Q: How do I build MeshCore firmware from source?
|
||||
**A:** See instructions here:
|
||||
<https://discord.com/channels/826570251612323860/1330643963501351004/1342120825251299388>
|
||||
|
||||
Andy also has a video on how to build using VS Code:
|
||||
*How to build and flash Meshcore repeater firmware | Heltec V3*
|
||||
<https://www.youtube.com/watch?v=WJvg6dt13hk> *(Link referenced in the Discord post)*
|
||||
|
||||
### Q: Are there other MeshCore related open source projects?
|
||||
|
||||
**A:** [Liam Cottle](https://liamcottle.net)'s MeshCore web client and MeshCore Javascript libary are open source under MIT license.
|
||||
|
||||
Web client: https://github.com/liamcottle/meshcore-web
|
||||
Javascript: https://github.com/liamcottle/meshcore.js
|
||||
|
||||
### Q: Does MeshCore support ATAK
|
||||
**A:** ATAK is not currently on MeshCore's roadmap.
|
||||
|
||||
### Q: How do I add a node to the [MeshCore Map]([url](https://meshcore.co.uk/map.html))
|
||||
**A:** From the smartphone app, connect to a BLE Companion radio
|
||||
- To add the BLE Companion radio your smartphone is connected to to the map, tap the `advert` icon, then tap `Advert (To Clipboard)`.
|
||||
- To add a Repeater or Room Server to the map, tap the 3 dots next to the Repeater or Room Server you want to add to the map, then tap `Share (To Clipboard)`.
|
||||
- Go to the [MeshCore Map web site]([url](https://meshcore.co.uk/map.html)), tap the plus sign on the lower right corner and paste in the meshcore://... blob, then tap `Add Node`
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Q: My client says another client or a repeater or a room server was last seen many, many days ago.
|
||||
### Q: A repeater or a client or a room server I expect to see on my discover list (on T-Deck) or contact list (on a smart device client) are not listed.
|
||||
**A:**
|
||||
- If your client is a T-Deck, it may not have its time set (no GPS installed, no GPS lock, or wrong GPS baud rate).
|
||||
- If you are using the Android or iOS client, the other client, repeater, or room server may have the wrong time.
|
||||
|
||||
You can get the epoch time on <https://www.epochconverter.com/> and use it to set your T-Deck clock. For a repeater and room server, the admin can use a T-Deck to remotely set their clock (clock sync), or use the `time` command in the USB serial console with the server device connected.
|
||||
|
||||
### Q: How to connect to a repeater via BLE (bluetooth)?
|
||||
**A:** You can't connect to a device running repeater firmware via bluetooth. Devices running the BLE companion firmware you can connect to it via bluetooth using the android app
|
||||
|
||||
### Q: I can't connect via bluetooth, what is the bluetooth pairing code?
|
||||
|
||||
**A:** the default bluetooth pairing code is `123456`
|
||||
|
||||
### Q: My Heltec V3 keeps disconnecting from my smartphone. It can't hold a solid Bluetooth connection.
|
||||
|
||||
**A:** Heltec V3 has a very small coil antenna on its PCB for WiFi and Bluetooth connectivty. It has a very short range, only a few feet. It is possible to remove the coil antenna and replace it with a 31mm wire. The BT range is much improved with the modification.
|
||||
|
||||
---
|
||||
## Other Questions:
|
||||
### Q: How to Update repeater and room server firmware over the air?
|
||||
|
||||
**A:** Only nRF-based RAK4631 and Heltec T114 OTA firmware update are verified using nRF smartphone app. Lilygo T-Echo doesn't work currently.
|
||||
You can update repeater and room server firmware with a bluetooth connection between your smartphone and your LoRa radio using the nRF app.
|
||||
|
||||
1. Download the ZIP file for the specific node from the web flasher to your smartphone
|
||||
2. On the phone client, log on to the repeater as administrator (default password is `password`) to issue the `start ota`command to the repeater or room server to get the device into OTA DFU mode
|
||||
|
||||

|
||||
1. `start ota` can be initiated from USB serial console on the web flasher page or a T-Deck
|
||||
4. On the smartphone, download and run the nRF app and scan for Bluetooth devices
|
||||
5. Connect to the repeater/room server node you want to update
|
||||
1. nRF app is available on both Android and iOS
|
||||
|
||||
**Android continues after the iOS section:**
|
||||
|
||||
**iOS continues here:**
|
||||
5. Once connected successfully, a `DFU` icon 
|
||||
appears in the top right corner of the app
|
||||
|
||||
6. Scroll down to change the `PRN(s)` number:
|
||||
|
||||

|
||||
|
||||
- For the T114, change the number of packets `(PRN(s)` to 8
|
||||
- For RAK, it can be 10, but it also works on 8.
|
||||
|
||||
7. Click the `DFU` icon , select the type of file to upload (choose ZIP), then select the ZIP file that was downloaded earlier from the web flasher
|
||||
8. The upload process will start now. If everything goes well, the node resets and is flashed successfully.
|
||||

|
||||
|
||||
|
||||
|
||||
**Android steps continues below:**
|
||||
1. on the top left corner of the nRF Connect app on Android, tap the 3-bar hamburger menu, then `Settings`, then `nRF5 DFU Options`
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
2. Change `Number of packets` to `10` for RAK, `8` for Heltec T114
|
||||
|
||||

|
||||
|
||||
3. Go back to the main screen
|
||||
4. Your LoRa device should already ben in DFU mode from previous steps
|
||||
5. tap `SCANNER` and then `SCAN` to find the device you want to update, tap `CONNECT`
|
||||
|
||||

|
||||
|
||||
6. On the top left corner of the nRF Connect app, tap the `DFU` icon next to the three dots
|
||||
|
||||

|
||||
|
||||
7. Choose `Distribution packet (ZIP)` and then `OK`
|
||||
|
||||

|
||||
|
||||
8. Choose the firmware file in ZIP formate that you downloaded earlier from the MeshCore web flasher, update will start as soon as you tap the file
|
||||
|
||||

|
||||
|
||||
9. When the update process is done, the device will disconnect from nRF app and the LoRa device is updated
|
||||
|
||||
|
||||
---
|
||||
|
||||
@@ -0,0 +1,187 @@
|
||||
#include "UITask.h"
|
||||
#include <Arduino.h>
|
||||
#include <helpers/TxtDataHelpers.h>
|
||||
|
||||
#define AUTO_OFF_MILLIS 15000 // 15 seconds
|
||||
|
||||
#ifndef USER_BTN_PRESSED
|
||||
#define USER_BTN_PRESSED LOW
|
||||
#endif
|
||||
|
||||
// 'meshcore', 128x13px
|
||||
static const uint8_t meshcore_logo [] PROGMEM = {
|
||||
0x3c, 0x01, 0xe3, 0xff, 0xc7, 0xff, 0x8f, 0x03, 0x87, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe,
|
||||
0x3c, 0x03, 0xe3, 0xff, 0xc7, 0xff, 0x8e, 0x03, 0x8f, 0xfe, 0x3f, 0xfe, 0x1f, 0xff, 0x1f, 0xfe,
|
||||
0x3e, 0x03, 0xc3, 0xff, 0x8f, 0xff, 0x0e, 0x07, 0x8f, 0xfe, 0x7f, 0xfe, 0x1f, 0xff, 0x1f, 0xfc,
|
||||
0x3e, 0x07, 0xc7, 0x80, 0x0e, 0x00, 0x0e, 0x07, 0x9e, 0x00, 0x78, 0x0e, 0x3c, 0x0f, 0x1c, 0x00,
|
||||
0x3e, 0x0f, 0xc7, 0x80, 0x1e, 0x00, 0x0e, 0x07, 0x1e, 0x00, 0x70, 0x0e, 0x38, 0x0f, 0x3c, 0x00,
|
||||
0x7f, 0x0f, 0xc7, 0xfe, 0x1f, 0xfc, 0x1f, 0xff, 0x1c, 0x00, 0x70, 0x0e, 0x38, 0x0e, 0x3f, 0xf8,
|
||||
0x7f, 0x1f, 0xc7, 0xfe, 0x0f, 0xff, 0x1f, 0xff, 0x1c, 0x00, 0xf0, 0x0e, 0x38, 0x0e, 0x3f, 0xf8,
|
||||
0x7f, 0x3f, 0xc7, 0xfe, 0x0f, 0xff, 0x1f, 0xff, 0x1c, 0x00, 0xf0, 0x1e, 0x3f, 0xfe, 0x3f, 0xf0,
|
||||
0x77, 0x3b, 0x87, 0x00, 0x00, 0x07, 0x1c, 0x0f, 0x3c, 0x00, 0xe0, 0x1c, 0x7f, 0xfc, 0x38, 0x00,
|
||||
0x77, 0xfb, 0x8f, 0x00, 0x00, 0x07, 0x1c, 0x0f, 0x3c, 0x00, 0xe0, 0x1c, 0x7f, 0xf8, 0x38, 0x00,
|
||||
0x73, 0xf3, 0x8f, 0xff, 0x0f, 0xff, 0x1c, 0x0e, 0x3f, 0xf8, 0xff, 0xfc, 0x70, 0x78, 0x7f, 0xf8,
|
||||
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfe, 0x3c, 0x0e, 0x3f, 0xf8, 0xff, 0xfc, 0x70, 0x3c, 0x7f, 0xf8,
|
||||
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfc, 0x3c, 0x0e, 0x1f, 0xf8, 0xff, 0xf8, 0x70, 0x3c, 0x7f, 0xf8,
|
||||
};
|
||||
|
||||
void UITask::begin(DisplayDriver* display, const char* node_name, const char* build_date, uint32_t pin_code) {
|
||||
_display = display;
|
||||
_auto_off = millis() + AUTO_OFF_MILLIS;
|
||||
clearMsgPreview();
|
||||
_node_name = node_name;
|
||||
_build_date = build_date;
|
||||
_pin_code = pin_code;
|
||||
if (_display != NULL) {
|
||||
_display->turnOn();
|
||||
}
|
||||
}
|
||||
|
||||
void UITask::msgRead(int msgcount) {
|
||||
_msgcount = msgcount;
|
||||
if (msgcount == 0) {
|
||||
clearMsgPreview();
|
||||
}
|
||||
}
|
||||
|
||||
void UITask::clearMsgPreview() {
|
||||
_origin[0] = 0;
|
||||
_msg[0] = 0;
|
||||
}
|
||||
|
||||
void UITask::newMsg(uint8_t path_len, const char* from_name, const char* text, int msgcount) {
|
||||
_msgcount = msgcount;
|
||||
|
||||
if (path_len == 0xFF) {
|
||||
sprintf(_origin, "(F) %s", from_name);
|
||||
} else {
|
||||
sprintf(_origin, "(%d) %s", (uint32_t) path_len, from_name);
|
||||
}
|
||||
StrHelper::strncpy(_msg, text, sizeof(_msg));
|
||||
|
||||
if (_display != NULL) {
|
||||
if (!_display->isOn()) _display->turnOn();
|
||||
_auto_off = millis() + AUTO_OFF_MILLIS; // extend the auto-off timer
|
||||
}
|
||||
}
|
||||
|
||||
void UITask::renderCurrScreen() {
|
||||
if (_display == NULL) return; // assert() ??
|
||||
|
||||
char tmp[80];
|
||||
if (_origin[0] && _msg[0]) {
|
||||
// render message preview
|
||||
_display->setCursor(0, 0);
|
||||
_display->setTextSize(1);
|
||||
_display->print(_node_name);
|
||||
|
||||
_display->setCursor(0, 12);
|
||||
_display->print(_origin);
|
||||
_display->setCursor(0, 24);
|
||||
_display->print(_msg);
|
||||
|
||||
_display->setCursor(100, 9);
|
||||
_display->setTextSize(2);
|
||||
sprintf(tmp, "%d", _msgcount);
|
||||
_display->print(tmp);
|
||||
} else {
|
||||
// render 'home' screen
|
||||
_display->drawXbm(0, 0, meshcore_logo, 128, 13);
|
||||
_display->setCursor(0, 20);
|
||||
_display->setTextSize(1);
|
||||
_display->print(_node_name);
|
||||
|
||||
sprintf(tmp, "Build: %s", _build_date);
|
||||
_display->setCursor(0, 32);
|
||||
_display->print(tmp);
|
||||
|
||||
if (_connected) {
|
||||
//_display->printf("freq : %03.2f sf %d\n", _prefs.freq, _prefs.sf);
|
||||
//_display->printf("bw : %03.2f cr %d\n", _prefs.bw, _prefs.cr);
|
||||
} else if (_pin_code != 0) {
|
||||
_display->setTextSize(2);
|
||||
_display->setCursor(0, 43);
|
||||
sprintf(tmp, "Pin:%d", _pin_code);
|
||||
_display->print(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UITask::userLedHandler() {
|
||||
#ifdef PIN_STATUS_LED
|
||||
static int state = 0;
|
||||
static int next_change = 0;
|
||||
int cur_time = millis();
|
||||
if (cur_time > next_change) {
|
||||
if (state == 0) {
|
||||
state = 1; // led on, short = unread msg
|
||||
if (_msgcount > 0) {
|
||||
next_change = cur_time + 500;
|
||||
} else {
|
||||
next_change = cur_time + 2000;
|
||||
}
|
||||
} else {
|
||||
state = 0;
|
||||
if (_board->getBattMilliVolts() > 3800) {
|
||||
next_change = cur_time + 2000;
|
||||
} else {
|
||||
next_change = cur_time + 4000; // 4s blank if bat level low
|
||||
}
|
||||
}
|
||||
digitalWrite(PIN_STATUS_LED, state);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void UITask::buttonHandler() {
|
||||
#ifdef PIN_USER_BTN
|
||||
static int prev_btn_state = !USER_BTN_PRESSED;
|
||||
static unsigned long btn_state_change_time = 0;
|
||||
static unsigned long next_read = 0;
|
||||
int cur_time = millis();
|
||||
if (cur_time >= next_read) {
|
||||
int btn_state = digitalRead(PIN_USER_BTN);
|
||||
if (btn_state != prev_btn_state) {
|
||||
if (btn_state == USER_BTN_PRESSED) { // pressed?
|
||||
if (_display != NULL) {
|
||||
if (_display->isOn()) {
|
||||
clearMsgPreview();
|
||||
} else {
|
||||
_display->turnOn();
|
||||
}
|
||||
_auto_off = cur_time + AUTO_OFF_MILLIS; // extend auto-off timer
|
||||
}
|
||||
} else { // unpressed ? check pressed time ...
|
||||
if ((cur_time - btn_state_change_time) > 5000) {
|
||||
#ifdef PIN_STATUS_LED
|
||||
digitalWrite(PIN_STATUS_LED, LOW);
|
||||
delay(10);
|
||||
#endif
|
||||
_board->powerOff();
|
||||
}
|
||||
}
|
||||
btn_state_change_time = millis();
|
||||
prev_btn_state = btn_state;
|
||||
}
|
||||
next_read = millis() + 100; // 10 reads per second
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void UITask::loop() {
|
||||
buttonHandler();
|
||||
userLedHandler();
|
||||
|
||||
if (_display != NULL && _display->isOn()) {
|
||||
if (millis() >= _next_refresh) {
|
||||
_display->startFrame();
|
||||
renderCurrScreen();
|
||||
_display->endFrame();
|
||||
|
||||
_next_refresh = millis() + 1000; // refresh every second
|
||||
}
|
||||
if (millis() > _auto_off) {
|
||||
_display->turnOff();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include <MeshCore.h>
|
||||
#include <helpers/ui/DisplayDriver.h>
|
||||
#include <stddef.h>
|
||||
|
||||
class UITask {
|
||||
DisplayDriver* _display;
|
||||
mesh::MainBoard* _board;
|
||||
unsigned long _next_refresh, _auto_off;
|
||||
bool _connected;
|
||||
uint32_t _pin_code;
|
||||
const char* _node_name;
|
||||
const char* _build_date;
|
||||
char _origin[62];
|
||||
char _msg[80];
|
||||
int _msgcount;
|
||||
|
||||
void renderCurrScreen();
|
||||
void buttonHandler();
|
||||
void userLedHandler();
|
||||
|
||||
public:
|
||||
|
||||
UITask(mesh::MainBoard* board) : _board(board), _display(NULL) {
|
||||
_next_refresh = 0;
|
||||
_connected = false;
|
||||
}
|
||||
void begin(DisplayDriver* display, const char* node_name, const char* build_date, uint32_t pin_code);
|
||||
|
||||
void setHasConnection(bool connected) { _connected = connected; }
|
||||
bool hasDisplay() const { return _display != NULL; }
|
||||
void clearMsgPreview();
|
||||
void msgRead(int msgcount);
|
||||
void newMsg(uint8_t path_len, const char* from_name, const char* text, int msgcount);
|
||||
void loop();
|
||||
};
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,79 @@
|
||||
#include "UITask.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
#define AUTO_OFF_MILLIS 20000 // 20 seconds
|
||||
|
||||
// 'meshcore', 128x13px
|
||||
static const uint8_t meshcore_logo [] PROGMEM = {
|
||||
0x3c, 0x01, 0xe3, 0xff, 0xc7, 0xff, 0x8f, 0x03, 0x87, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe,
|
||||
0x3c, 0x03, 0xe3, 0xff, 0xc7, 0xff, 0x8e, 0x03, 0x8f, 0xfe, 0x3f, 0xfe, 0x1f, 0xff, 0x1f, 0xfe,
|
||||
0x3e, 0x03, 0xc3, 0xff, 0x8f, 0xff, 0x0e, 0x07, 0x8f, 0xfe, 0x7f, 0xfe, 0x1f, 0xff, 0x1f, 0xfc,
|
||||
0x3e, 0x07, 0xc7, 0x80, 0x0e, 0x00, 0x0e, 0x07, 0x9e, 0x00, 0x78, 0x0e, 0x3c, 0x0f, 0x1c, 0x00,
|
||||
0x3e, 0x0f, 0xc7, 0x80, 0x1e, 0x00, 0x0e, 0x07, 0x1e, 0x00, 0x70, 0x0e, 0x38, 0x0f, 0x3c, 0x00,
|
||||
0x7f, 0x0f, 0xc7, 0xfe, 0x1f, 0xfc, 0x1f, 0xff, 0x1c, 0x00, 0x70, 0x0e, 0x38, 0x0e, 0x3f, 0xf8,
|
||||
0x7f, 0x1f, 0xc7, 0xfe, 0x0f, 0xff, 0x1f, 0xff, 0x1c, 0x00, 0xf0, 0x0e, 0x38, 0x0e, 0x3f, 0xf8,
|
||||
0x7f, 0x3f, 0xc7, 0xfe, 0x0f, 0xff, 0x1f, 0xff, 0x1c, 0x00, 0xf0, 0x1e, 0x3f, 0xfe, 0x3f, 0xf0,
|
||||
0x77, 0x3b, 0x87, 0x00, 0x00, 0x07, 0x1c, 0x0f, 0x3c, 0x00, 0xe0, 0x1c, 0x7f, 0xfc, 0x38, 0x00,
|
||||
0x77, 0xfb, 0x8f, 0x00, 0x00, 0x07, 0x1c, 0x0f, 0x3c, 0x00, 0xe0, 0x1c, 0x7f, 0xf8, 0x38, 0x00,
|
||||
0x73, 0xf3, 0x8f, 0xff, 0x0f, 0xff, 0x1c, 0x0e, 0x3f, 0xf8, 0xff, 0xfc, 0x70, 0x78, 0x7f, 0xf8,
|
||||
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfe, 0x3c, 0x0e, 0x3f, 0xf8, 0xff, 0xfc, 0x70, 0x3c, 0x7f, 0xf8,
|
||||
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfc, 0x3c, 0x0e, 0x1f, 0xf8, 0xff, 0xf8, 0x70, 0x3c, 0x7f, 0xf8,
|
||||
};
|
||||
|
||||
void UITask::begin(const char* node_name, const char* build_date) {
|
||||
_prevBtnState = HIGH;
|
||||
_auto_off = millis() + AUTO_OFF_MILLIS;
|
||||
_node_name = node_name;
|
||||
_build_date = build_date;
|
||||
_display->turnOn();
|
||||
}
|
||||
|
||||
void UITask::renderCurrScreen() {
|
||||
char tmp[80];
|
||||
// render 'home' screen
|
||||
_display->drawXbm(0, 0, meshcore_logo, 128, 13);
|
||||
_display->setCursor(0, 20);
|
||||
_display->setTextSize(1);
|
||||
_display->print(_node_name);
|
||||
|
||||
sprintf(tmp, "Build: %s", _build_date);
|
||||
_display->setCursor(0, 32);
|
||||
_display->print(tmp);
|
||||
_display->setCursor(0, 43);
|
||||
_display->print("< Repeater >");
|
||||
//_display->printf("freq : %03.2f sf %d\n", _prefs.freq, _prefs.sf);
|
||||
//_display->printf("bw : %03.2f cr %d\n", _prefs.bw, _prefs.cr);
|
||||
}
|
||||
|
||||
void UITask::loop() {
|
||||
#ifdef PIN_USER_BTN
|
||||
if (millis() >= _next_read) {
|
||||
int btnState = digitalRead(PIN_USER_BTN);
|
||||
if (btnState != _prevBtnState) {
|
||||
if (btnState == LOW) { // pressed?
|
||||
if (_display->isOn()) {
|
||||
// TODO: any action ?
|
||||
} else {
|
||||
_display->turnOn();
|
||||
}
|
||||
_auto_off = millis() + AUTO_OFF_MILLIS; // extend auto-off timer
|
||||
}
|
||||
_prevBtnState = btnState;
|
||||
}
|
||||
_next_read = millis() + 200; // 5 reads per second
|
||||
}
|
||||
#endif
|
||||
|
||||
if (_display->isOn()) {
|
||||
if (millis() >= _next_refresh) {
|
||||
_display->startFrame();
|
||||
renderCurrScreen();
|
||||
_display->endFrame();
|
||||
|
||||
_next_refresh = millis() + 1000; // refresh every second
|
||||
}
|
||||
if (millis() > _auto_off) {
|
||||
_display->turnOff();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <helpers/ui/DisplayDriver.h>
|
||||
|
||||
class UITask {
|
||||
DisplayDriver* _display;
|
||||
unsigned long _next_read, _next_refresh, _auto_off;
|
||||
int _prevBtnState;
|
||||
const char* _node_name;
|
||||
const char* _build_date;
|
||||
|
||||
void renderCurrScreen();
|
||||
public:
|
||||
UITask(DisplayDriver& display) : _display(&display) { _next_read = _next_refresh = 0; }
|
||||
void begin(const char* node_name, const char* build_date);
|
||||
|
||||
void loop();
|
||||
};
|
||||
@@ -0,0 +1,683 @@
|
||||
#include <Arduino.h> // needed for PlatformIO
|
||||
#include <Mesh.h>
|
||||
|
||||
#if defined(NRF52_PLATFORM)
|
||||
#include <InternalFileSystem.h>
|
||||
#elif defined(ESP32)
|
||||
#include <SPIFFS.h>
|
||||
#endif
|
||||
|
||||
#include <helpers/ArduinoHelpers.h>
|
||||
#include <helpers/StaticPoolPacketManager.h>
|
||||
#include <helpers/SimpleMeshTables.h>
|
||||
#include <helpers/IdentityStore.h>
|
||||
#include <helpers/AdvertDataHelpers.h>
|
||||
#include <helpers/TxtDataHelpers.h>
|
||||
#include <helpers/CommonCLI.h>
|
||||
#include <RTClib.h>
|
||||
#include <target.h>
|
||||
|
||||
/* ------------------------------ Config -------------------------------- */
|
||||
|
||||
#ifndef FIRMWARE_BUILD_DATE
|
||||
#define FIRMWARE_BUILD_DATE "30 Mar 2025"
|
||||
#endif
|
||||
|
||||
#ifndef FIRMWARE_VERSION
|
||||
#define FIRMWARE_VERSION "v1.4.2"
|
||||
#endif
|
||||
|
||||
#ifndef LORA_FREQ
|
||||
#define LORA_FREQ 915.0
|
||||
#endif
|
||||
#ifndef LORA_BW
|
||||
#define LORA_BW 250
|
||||
#endif
|
||||
#ifndef LORA_SF
|
||||
#define LORA_SF 10
|
||||
#endif
|
||||
#ifndef LORA_CR
|
||||
#define LORA_CR 5
|
||||
#endif
|
||||
#ifndef LORA_TX_POWER
|
||||
#define LORA_TX_POWER 20
|
||||
#endif
|
||||
|
||||
#ifndef ADVERT_NAME
|
||||
#define ADVERT_NAME "repeater"
|
||||
#endif
|
||||
#ifndef ADVERT_LAT
|
||||
#define ADVERT_LAT 0.0
|
||||
#endif
|
||||
#ifndef ADVERT_LON
|
||||
#define ADVERT_LON 0.0
|
||||
#endif
|
||||
|
||||
#ifndef ADMIN_PASSWORD
|
||||
#define ADMIN_PASSWORD "password"
|
||||
#endif
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
#include <helpers/ui/SSD1306Display.h>
|
||||
|
||||
static DISPLAY_CLASS display;
|
||||
|
||||
#include "UITask.h"
|
||||
static UITask ui_task(display);
|
||||
#endif
|
||||
|
||||
#define FIRMWARE_ROLE "repeater"
|
||||
|
||||
#define PACKET_LOG_FILE "/packet_log"
|
||||
|
||||
/* ------------------------------ Code -------------------------------- */
|
||||
|
||||
#define CMD_GET_STATUS 0x01
|
||||
|
||||
#define RESP_SERVER_LOGIN_OK 0 // response to ANON_REQ
|
||||
|
||||
struct RepeaterStats {
|
||||
uint16_t batt_milli_volts;
|
||||
uint16_t curr_tx_queue_len;
|
||||
uint16_t curr_free_queue_len;
|
||||
int16_t last_rssi;
|
||||
uint32_t n_packets_recv;
|
||||
uint32_t n_packets_sent;
|
||||
uint32_t total_air_time_secs;
|
||||
uint32_t total_up_time_secs;
|
||||
uint32_t n_sent_flood, n_sent_direct;
|
||||
uint32_t n_recv_flood, n_recv_direct;
|
||||
uint16_t n_full_events;
|
||||
int16_t last_snr; // x 4
|
||||
uint16_t n_direct_dups, n_flood_dups;
|
||||
};
|
||||
|
||||
struct ClientInfo {
|
||||
mesh::Identity id;
|
||||
uint32_t last_timestamp, last_activity;
|
||||
uint8_t secret[PUB_KEY_SIZE];
|
||||
bool is_admin;
|
||||
int8_t out_path_len;
|
||||
uint8_t out_path[MAX_PATH_SIZE];
|
||||
};
|
||||
|
||||
#define MAX_CLIENTS 4
|
||||
|
||||
// NOTE: need to space the ACK and the reply text apart (in CLI)
|
||||
#define CLI_REPLY_DELAY_MILLIS 1500
|
||||
|
||||
class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
|
||||
FILESYSTEM* _fs;
|
||||
unsigned long next_local_advert, next_flood_advert;
|
||||
bool _logging;
|
||||
NodePrefs _prefs;
|
||||
CommonCLI _cli;
|
||||
uint8_t reply_data[MAX_PACKET_PAYLOAD];
|
||||
ClientInfo known_clients[MAX_CLIENTS];
|
||||
|
||||
ClientInfo* putClient(const mesh::Identity& id) {
|
||||
uint32_t min_time = 0xFFFFFFFF;
|
||||
ClientInfo* oldest = &known_clients[0];
|
||||
for (int i = 0; i < MAX_CLIENTS; i++) {
|
||||
if (known_clients[i].last_activity < min_time) {
|
||||
oldest = &known_clients[i];
|
||||
min_time = oldest->last_activity;
|
||||
}
|
||||
if (id.matches(known_clients[i].id)) return &known_clients[i]; // already known
|
||||
}
|
||||
|
||||
oldest->id = id;
|
||||
oldest->out_path_len = -1; // initially out_path is unknown
|
||||
oldest->last_timestamp = 0;
|
||||
self_id.calcSharedSecret(oldest->secret, id); // calc ECDH shared secret
|
||||
return oldest;
|
||||
}
|
||||
|
||||
int handleRequest(ClientInfo* sender, uint8_t* payload, size_t payload_len) {
|
||||
uint32_t now = getRTCClock()->getCurrentTimeUnique();
|
||||
memcpy(reply_data, &now, 4); // response packets always prefixed with timestamp
|
||||
|
||||
switch (payload[0]) {
|
||||
case CMD_GET_STATUS: { // guests can also access this now
|
||||
RepeaterStats stats;
|
||||
stats.batt_milli_volts = board.getBattMilliVolts();
|
||||
stats.curr_tx_queue_len = _mgr->getOutboundCount();
|
||||
stats.curr_free_queue_len = _mgr->getFreeCount();
|
||||
stats.last_rssi = (int16_t) radio_driver.getLastRSSI();
|
||||
stats.n_packets_recv = radio_driver.getPacketsRecv();
|
||||
stats.n_packets_sent = radio_driver.getPacketsSent();
|
||||
stats.total_air_time_secs = getTotalAirTime() / 1000;
|
||||
stats.total_up_time_secs = _ms->getMillis() / 1000;
|
||||
stats.n_sent_flood = getNumSentFlood();
|
||||
stats.n_sent_direct = getNumSentDirect();
|
||||
stats.n_recv_flood = getNumRecvFlood();
|
||||
stats.n_recv_direct = getNumRecvDirect();
|
||||
stats.n_full_events = getNumFullEvents();
|
||||
stats.last_snr = (int16_t)(radio_driver.getLastSNR() * 4);
|
||||
stats.n_direct_dups = ((SimpleMeshTables *)getTables())->getNumDirectDups();
|
||||
stats.n_flood_dups = ((SimpleMeshTables *)getTables())->getNumFloodDups();
|
||||
|
||||
memcpy(&reply_data[4], &stats, sizeof(stats));
|
||||
|
||||
return 4 + sizeof(stats); // reply_len
|
||||
}
|
||||
}
|
||||
// unknown command
|
||||
return 0; // reply_len
|
||||
}
|
||||
|
||||
mesh::Packet* createSelfAdvert() {
|
||||
uint8_t app_data[MAX_ADVERT_DATA_SIZE];
|
||||
uint8_t app_data_len;
|
||||
{
|
||||
AdvertDataBuilder builder(ADV_TYPE_REPEATER, _prefs.node_name, _prefs.node_lat, _prefs.node_lon);
|
||||
app_data_len = builder.encodeTo(app_data);
|
||||
}
|
||||
|
||||
return createAdvert(self_id, app_data, app_data_len);
|
||||
}
|
||||
|
||||
File openAppend(const char* fname) {
|
||||
#if defined(NRF52_PLATFORM)
|
||||
return _fs->open(fname, FILE_O_WRITE);
|
||||
#else
|
||||
return _fs->open(fname, "a", true);
|
||||
#endif
|
||||
}
|
||||
|
||||
protected:
|
||||
float getAirtimeBudgetFactor() const override {
|
||||
return _prefs.airtime_factor;
|
||||
}
|
||||
|
||||
bool allowPacketForward(const mesh::Packet* packet) override {
|
||||
if (_prefs.disable_fwd) return false;
|
||||
if (packet->isRouteFlood() && packet->path_len >= _prefs.flood_max) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* getLogDateTime() override {
|
||||
static char tmp[32];
|
||||
uint32_t now = getRTCClock()->getCurrentTime();
|
||||
DateTime dt = DateTime(now);
|
||||
sprintf(tmp, "%02d:%02d:%02d - %d/%d/%d U", dt.hour(), dt.minute(), dt.second(), dt.day(), dt.month(), dt.year());
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void logRxRaw(float snr, float rssi, const uint8_t raw[], int len) override {
|
||||
#if MESH_PACKET_LOGGING
|
||||
Serial.print(getLogDateTime());
|
||||
Serial.print(" RAW: ");
|
||||
mesh::Utils::printHex(Serial, raw, len);
|
||||
Serial.println();
|
||||
#endif
|
||||
}
|
||||
|
||||
void logRx(mesh::Packet* pkt, int len, float score) override {
|
||||
if (_logging) {
|
||||
File f = openAppend(PACKET_LOG_FILE);
|
||||
if (f) {
|
||||
f.print(getLogDateTime());
|
||||
f.printf(": RX, len=%d (type=%d, route=%s, payload_len=%d) SNR=%d RSSI=%d score=%d",
|
||||
len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len,
|
||||
(int)_radio->getLastSNR(), (int)_radio->getLastRSSI(), (int)(score*1000));
|
||||
|
||||
if (pkt->getPayloadType() == PAYLOAD_TYPE_PATH || pkt->getPayloadType() == PAYLOAD_TYPE_REQ
|
||||
|| pkt->getPayloadType() == PAYLOAD_TYPE_RESPONSE || pkt->getPayloadType() == PAYLOAD_TYPE_TXT_MSG) {
|
||||
f.printf(" [%02X -> %02X]\n", (uint32_t)pkt->payload[1], (uint32_t)pkt->payload[0]);
|
||||
} else {
|
||||
f.printf("\n");
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
void logTx(mesh::Packet* pkt, int len) override {
|
||||
if (_logging) {
|
||||
File f = openAppend(PACKET_LOG_FILE);
|
||||
if (f) {
|
||||
f.print(getLogDateTime());
|
||||
f.printf(": TX, len=%d (type=%d, route=%s, payload_len=%d)",
|
||||
len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len);
|
||||
|
||||
if (pkt->getPayloadType() == PAYLOAD_TYPE_PATH || pkt->getPayloadType() == PAYLOAD_TYPE_REQ
|
||||
|| pkt->getPayloadType() == PAYLOAD_TYPE_RESPONSE || pkt->getPayloadType() == PAYLOAD_TYPE_TXT_MSG) {
|
||||
f.printf(" [%02X -> %02X]\n", (uint32_t)pkt->payload[1], (uint32_t)pkt->payload[0]);
|
||||
} else {
|
||||
f.printf("\n");
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
void logTxFail(mesh::Packet* pkt, int len) override {
|
||||
if (_logging) {
|
||||
File f = openAppend(PACKET_LOG_FILE);
|
||||
if (f) {
|
||||
f.print(getLogDateTime());
|
||||
f.printf(": TX FAIL!, len=%d (type=%d, route=%s, payload_len=%d)\n",
|
||||
len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len);
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int calcRxDelay(float score, uint32_t air_time) const override {
|
||||
if (_prefs.rx_delay_base <= 0.0f) return 0;
|
||||
return (int) ((pow(_prefs.rx_delay_base, 0.85f - score) - 1.0) * air_time);
|
||||
}
|
||||
|
||||
uint32_t getRetransmitDelay(const mesh::Packet* packet) override {
|
||||
uint32_t t = (_radio->getEstAirtimeFor(packet->path_len + packet->payload_len + 2) * _prefs.tx_delay_factor);
|
||||
return getRNG()->nextInt(0, 6)*t;
|
||||
}
|
||||
uint32_t getDirectRetransmitDelay(const mesh::Packet* packet) override {
|
||||
uint32_t t = (_radio->getEstAirtimeFor(packet->path_len + packet->payload_len + 2) * _prefs.direct_tx_delay_factor);
|
||||
return getRNG()->nextInt(0, 6)*t;
|
||||
}
|
||||
|
||||
void onAnonDataRecv(mesh::Packet* packet, uint8_t type, const mesh::Identity& sender, uint8_t* data, size_t len) override {
|
||||
if (type == PAYLOAD_TYPE_ANON_REQ) { // received an initial request by a possible admin client (unknown at this stage)
|
||||
uint32_t timestamp;
|
||||
memcpy(×tamp, data, 4);
|
||||
|
||||
bool is_admin;
|
||||
data[len] = 0; // ensure null terminator
|
||||
if (strcmp((char *) &data[4], _prefs.password) == 0) { // check for valid password
|
||||
is_admin = true;
|
||||
} else if (strcmp((char *) &data[4], _prefs.guest_password) == 0) { // check guest password
|
||||
is_admin = false;
|
||||
} else {
|
||||
#if MESH_DEBUG
|
||||
MESH_DEBUG_PRINTLN("Invalid password: %s", &data[4]);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
auto client = putClient(sender); // add to known clients (if not already known)
|
||||
if (timestamp <= client->last_timestamp) {
|
||||
MESH_DEBUG_PRINTLN("Possible login replay attack!");
|
||||
return; // FATAL: client table is full -OR- replay attack
|
||||
}
|
||||
|
||||
MESH_DEBUG_PRINTLN("Login success!");
|
||||
client->last_timestamp = timestamp;
|
||||
client->last_activity = getRTCClock()->getCurrentTime();
|
||||
client->is_admin = is_admin;
|
||||
|
||||
uint32_t now = getRTCClock()->getCurrentTimeUnique();
|
||||
memcpy(reply_data, &now, 4); // response packets always prefixed with timestamp
|
||||
#if 0
|
||||
memcpy(&reply_data[4], "OK", 2); // legacy response
|
||||
#else
|
||||
reply_data[4] = RESP_SERVER_LOGIN_OK;
|
||||
reply_data[5] = 0; // NEW: recommended keep-alive interval (secs / 16)
|
||||
reply_data[6] = is_admin ? 1 : 0;
|
||||
reply_data[7] = 0; // FUTURE: reserved
|
||||
getRNG()->random(&reply_data[8], 4); // random blob to help packet-hash uniqueness
|
||||
#endif
|
||||
|
||||
if (packet->isRouteFlood()) {
|
||||
// let this sender know path TO here, so they can use sendDirect(), and ALSO encode the response
|
||||
mesh::Packet* path = createPathReturn(sender, client->secret, packet->path, packet->path_len,
|
||||
PAYLOAD_TYPE_RESPONSE, reply_data, 12);
|
||||
if (path) sendFlood(path);
|
||||
} else {
|
||||
mesh::Packet* reply = createDatagram(PAYLOAD_TYPE_RESPONSE, sender, client->secret, reply_data, 12);
|
||||
if (reply) {
|
||||
if (client->out_path_len >= 0) { // we have an out_path, so send DIRECT
|
||||
sendDirect(reply, client->out_path, client->out_path_len);
|
||||
} else {
|
||||
sendFlood(reply);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int matching_peer_indexes[MAX_CLIENTS];
|
||||
|
||||
int searchPeersByHash(const uint8_t* hash) override {
|
||||
int n = 0;
|
||||
for (int i = 0; i < MAX_CLIENTS; i++) {
|
||||
if (known_clients[i].id.isHashMatch(hash)) {
|
||||
matching_peer_indexes[n++] = i; // store the INDEXES of matching contacts (for subsequent 'peer' methods)
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
void getPeerSharedSecret(uint8_t* dest_secret, int peer_idx) override {
|
||||
int i = matching_peer_indexes[peer_idx];
|
||||
if (i >= 0 && i < MAX_CLIENTS) {
|
||||
// lookup pre-calculated shared_secret
|
||||
memcpy(dest_secret, known_clients[i].secret, PUB_KEY_SIZE);
|
||||
} else {
|
||||
MESH_DEBUG_PRINTLN("getPeerSharedSecret: Invalid peer idx: %d", i);
|
||||
}
|
||||
}
|
||||
|
||||
void onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender_idx, const uint8_t* secret, uint8_t* data, size_t len) override {
|
||||
int i = matching_peer_indexes[sender_idx];
|
||||
if (i < 0 || i >= MAX_CLIENTS) { // get from our known_clients table (sender SHOULD already be known in this context)
|
||||
MESH_DEBUG_PRINTLN("onPeerDataRecv: invalid peer idx: %d", i);
|
||||
return;
|
||||
}
|
||||
auto client = &known_clients[i];
|
||||
if (type == PAYLOAD_TYPE_REQ) { // request (from a Known admin client!)
|
||||
uint32_t timestamp;
|
||||
memcpy(×tamp, data, 4);
|
||||
|
||||
if (timestamp > client->last_timestamp) { // prevent replay attacks
|
||||
int reply_len = handleRequest(client, &data[4], len - 4);
|
||||
if (reply_len == 0) return; // invalid command
|
||||
|
||||
client->last_timestamp = timestamp;
|
||||
client->last_activity = getRTCClock()->getCurrentTime();
|
||||
|
||||
if (packet->isRouteFlood()) {
|
||||
// let this sender know path TO here, so they can use sendDirect(), and ALSO encode the response
|
||||
mesh::Packet* path = createPathReturn(client->id, secret, packet->path, packet->path_len,
|
||||
PAYLOAD_TYPE_RESPONSE, reply_data, reply_len);
|
||||
if (path) sendFlood(path);
|
||||
} else {
|
||||
mesh::Packet* reply = createDatagram(PAYLOAD_TYPE_RESPONSE, client->id, secret, reply_data, reply_len);
|
||||
if (reply) {
|
||||
if (client->out_path_len >= 0) { // we have an out_path, so send DIRECT
|
||||
sendDirect(reply, client->out_path, client->out_path_len);
|
||||
} else {
|
||||
sendFlood(reply);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
MESH_DEBUG_PRINTLN("onPeerDataRecv: possible replay attack detected");
|
||||
}
|
||||
} else if (type == PAYLOAD_TYPE_TXT_MSG && len > 5 && client->is_admin) { // a CLI command
|
||||
uint32_t sender_timestamp;
|
||||
memcpy(&sender_timestamp, data, 4); // timestamp (by sender's RTC clock - which could be wrong)
|
||||
uint flags = (data[4] >> 2); // message attempt number, and other flags
|
||||
|
||||
if (!(flags == TXT_TYPE_PLAIN || flags == TXT_TYPE_CLI_DATA)) {
|
||||
MESH_DEBUG_PRINTLN("onPeerDataRecv: unsupported text type received: flags=%02x", (uint32_t)flags);
|
||||
} else if (sender_timestamp >= client->last_timestamp) { // prevent replay attacks
|
||||
bool is_retry = (sender_timestamp == client->last_timestamp);
|
||||
client->last_timestamp = sender_timestamp;
|
||||
client->last_activity = getRTCClock()->getCurrentTime();
|
||||
|
||||
// len can be > original length, but 'text' will be padded with zeroes
|
||||
data[len] = 0; // need to make a C string again, with null terminator
|
||||
|
||||
if (flags == TXT_TYPE_PLAIN) { // for legacy CLI, send Acks
|
||||
uint32_t ack_hash; // calc truncated hash of the message timestamp + text + sender pub_key, to prove to sender that we got it
|
||||
mesh::Utils::sha256((uint8_t *) &ack_hash, 4, data, 5 + strlen((char *)&data[5]), client->id.pub_key, PUB_KEY_SIZE);
|
||||
|
||||
mesh::Packet* ack = createAck(ack_hash);
|
||||
if (ack) {
|
||||
if (client->out_path_len < 0) {
|
||||
sendFlood(ack);
|
||||
} else {
|
||||
sendDirect(ack, client->out_path, client->out_path_len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t temp[166];
|
||||
if (is_retry) {
|
||||
temp[0] = 0;
|
||||
} else {
|
||||
_cli.handleCommand(sender_timestamp, (const char *) &data[5], (char *) &temp[5]);
|
||||
}
|
||||
int text_len = strlen((char *) &temp[5]);
|
||||
if (text_len > 0) {
|
||||
uint32_t timestamp = getRTCClock()->getCurrentTimeUnique();
|
||||
if (timestamp == sender_timestamp) {
|
||||
// WORKAROUND: the two timestamps need to be different, in the CLI view
|
||||
timestamp++;
|
||||
}
|
||||
memcpy(temp, ×tamp, 4); // mostly an extra blob to help make packet_hash unique
|
||||
temp[4] = (TXT_TYPE_CLI_DATA << 2); // NOTE: legacy was: TXT_TYPE_PLAIN
|
||||
|
||||
auto reply = createDatagram(PAYLOAD_TYPE_TXT_MSG, client->id, secret, temp, 5 + text_len);
|
||||
if (reply) {
|
||||
if (client->out_path_len < 0) {
|
||||
sendFlood(reply, CLI_REPLY_DELAY_MILLIS);
|
||||
} else {
|
||||
sendDirect(reply, client->out_path, client->out_path_len, CLI_REPLY_DELAY_MILLIS);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
MESH_DEBUG_PRINTLN("onPeerDataRecv: possible replay attack detected");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool onPeerPathRecv(mesh::Packet* packet, int sender_idx, const uint8_t* secret, uint8_t* path, uint8_t path_len, uint8_t extra_type, uint8_t* extra, uint8_t extra_len) override {
|
||||
// TODO: prevent replay attacks
|
||||
int i = matching_peer_indexes[sender_idx];
|
||||
|
||||
if (i >= 0 && i < MAX_CLIENTS) { // get from our known_clients table (sender SHOULD already be known in this context)
|
||||
MESH_DEBUG_PRINTLN("PATH to client, path_len=%d", (uint32_t) path_len);
|
||||
auto client = &known_clients[i];
|
||||
memcpy(client->out_path, path, client->out_path_len = path_len); // store a copy of path, for sendDirect()
|
||||
} else {
|
||||
MESH_DEBUG_PRINTLN("onPeerPathRecv: invalid peer idx: %d", i);
|
||||
}
|
||||
|
||||
// NOTE: no reciprocal path send!!
|
||||
return false;
|
||||
}
|
||||
|
||||
public:
|
||||
MyMesh(mesh::MainBoard& board, mesh::Radio& radio, mesh::MillisecondClock& ms, mesh::RNG& rng, mesh::RTCClock& rtc, mesh::MeshTables& tables)
|
||||
: mesh::Mesh(radio, ms, rng, rtc, *new StaticPoolPacketManager(32), tables),
|
||||
_cli(board, this, &_prefs, this)
|
||||
{
|
||||
memset(known_clients, 0, sizeof(known_clients));
|
||||
next_local_advert = next_flood_advert = 0;
|
||||
_logging = false;
|
||||
|
||||
// defaults
|
||||
memset(&_prefs, 0, sizeof(_prefs));
|
||||
_prefs.airtime_factor = 1.0; // one half
|
||||
_prefs.rx_delay_base = 0.0f; // turn off by default, was 10.0;
|
||||
_prefs.tx_delay_factor = 0.5f; // was 0.25f
|
||||
StrHelper::strncpy(_prefs.node_name, ADVERT_NAME, sizeof(_prefs.node_name));
|
||||
_prefs.node_lat = ADVERT_LAT;
|
||||
_prefs.node_lon = ADVERT_LON;
|
||||
StrHelper::strncpy(_prefs.password, ADMIN_PASSWORD, sizeof(_prefs.password));
|
||||
_prefs.freq = LORA_FREQ;
|
||||
_prefs.sf = LORA_SF;
|
||||
_prefs.bw = LORA_BW;
|
||||
_prefs.cr = LORA_CR;
|
||||
_prefs.tx_power_dbm = LORA_TX_POWER;
|
||||
_prefs.advert_interval = 1; // default to 2 minutes for NEW installs
|
||||
_prefs.flood_advert_interval = 3; // 3 hours
|
||||
_prefs.flood_max = 64;
|
||||
}
|
||||
|
||||
CommonCLI* getCLI() { return &_cli; }
|
||||
|
||||
void begin(FILESYSTEM* fs) {
|
||||
mesh::Mesh::begin();
|
||||
_fs = fs;
|
||||
// load persisted prefs
|
||||
_cli.loadPrefs(_fs);
|
||||
|
||||
radio_set_params(_prefs.freq, _prefs.bw, _prefs.sf, _prefs.cr);
|
||||
radio_set_tx_power(_prefs.tx_power_dbm);
|
||||
|
||||
updateAdvertTimer();
|
||||
updateFloodAdvertTimer();
|
||||
}
|
||||
|
||||
const char* getFirmwareVer() override { return FIRMWARE_VERSION; }
|
||||
const char* getBuildDate() override { return FIRMWARE_BUILD_DATE; }
|
||||
const char* getRole() override { return FIRMWARE_ROLE; }
|
||||
const char* getNodeName() { return _prefs.node_name; }
|
||||
|
||||
void savePrefs() override {
|
||||
_cli.savePrefs(_fs);
|
||||
}
|
||||
|
||||
bool formatFileSystem() override {
|
||||
#if defined(NRF52_PLATFORM)
|
||||
return InternalFS.format();
|
||||
#elif defined(ESP32)
|
||||
return SPIFFS.format();
|
||||
#else
|
||||
#error "need to implement file system erase"
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void sendSelfAdvertisement(int delay_millis) override {
|
||||
mesh::Packet* pkt = createSelfAdvert();
|
||||
if (pkt) {
|
||||
sendFlood(pkt, delay_millis);
|
||||
} else {
|
||||
MESH_DEBUG_PRINTLN("ERROR: unable to create advertisement packet!");
|
||||
}
|
||||
}
|
||||
|
||||
void updateAdvertTimer() override {
|
||||
if (_prefs.advert_interval > 0) { // schedule local advert timer
|
||||
next_local_advert = futureMillis( ((uint32_t)_prefs.advert_interval) * 2 * 60 * 1000);
|
||||
} else {
|
||||
next_local_advert = 0; // stop the timer
|
||||
}
|
||||
}
|
||||
void updateFloodAdvertTimer() override {
|
||||
if (_prefs.flood_advert_interval > 0) { // schedule flood advert timer
|
||||
next_flood_advert = futureMillis( ((uint32_t)_prefs.flood_advert_interval) * 60 * 60 * 1000);
|
||||
} else {
|
||||
next_flood_advert = 0; // stop the timer
|
||||
}
|
||||
}
|
||||
|
||||
void setLoggingOn(bool enable) override { _logging = enable; }
|
||||
|
||||
void eraseLogFile() override {
|
||||
_fs->remove(PACKET_LOG_FILE);
|
||||
}
|
||||
|
||||
void dumpLogFile() override {
|
||||
File f = _fs->open(PACKET_LOG_FILE);
|
||||
if (f) {
|
||||
while (f.available()) {
|
||||
int c = f.read();
|
||||
if (c < 0) break;
|
||||
Serial.print((char)c);
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
|
||||
void setTxPower(uint8_t power_dbm) override {
|
||||
radio_set_tx_power(power_dbm);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
mesh::Mesh::loop();
|
||||
|
||||
if (next_flood_advert && millisHasNowPassed(next_flood_advert)) {
|
||||
mesh::Packet* pkt = createSelfAdvert();
|
||||
if (pkt) sendFlood(pkt);
|
||||
|
||||
updateFloodAdvertTimer(); // schedule next flood advert
|
||||
updateAdvertTimer(); // also schedule local advert (so they don't overlap)
|
||||
} else if (next_local_advert && millisHasNowPassed(next_local_advert)) {
|
||||
mesh::Packet* pkt = createSelfAdvert();
|
||||
if (pkt) sendZeroHop(pkt);
|
||||
|
||||
updateAdvertTimer(); // schedule next local advert
|
||||
}
|
||||
#ifdef DISPLAY_CLASS
|
||||
ui_task.loop();
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
StdRNG fast_rng;
|
||||
SimpleMeshTables tables;
|
||||
|
||||
MyMesh the_mesh(board, radio_driver, *new ArduinoMillis(), fast_rng, rtc_clock, tables);
|
||||
|
||||
void halt() {
|
||||
while (1) ;
|
||||
}
|
||||
|
||||
static char command[80];
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
delay(1000);
|
||||
|
||||
board.begin();
|
||||
|
||||
if (!radio_init()) { halt(); }
|
||||
|
||||
fast_rng.begin(radio_get_rng_seed());
|
||||
|
||||
FILESYSTEM* fs;
|
||||
#if defined(NRF52_PLATFORM)
|
||||
InternalFS.begin();
|
||||
fs = &InternalFS;
|
||||
IdentityStore store(InternalFS, "");
|
||||
#elif defined(ESP32)
|
||||
SPIFFS.begin(true);
|
||||
fs = &SPIFFS;
|
||||
IdentityStore store(SPIFFS, "/identity");
|
||||
#else
|
||||
#error "need to define filesystem"
|
||||
#endif
|
||||
if (!store.load("_main", the_mesh.self_id)) {
|
||||
MESH_DEBUG_PRINTLN("Generating new keypair");
|
||||
the_mesh.self_id = radio_new_identity(); // create new random identity
|
||||
store.save("_main", the_mesh.self_id);
|
||||
}
|
||||
|
||||
Serial.print("Repeater ID: ");
|
||||
mesh::Utils::printHex(Serial, the_mesh.self_id.pub_key, PUB_KEY_SIZE); Serial.println();
|
||||
|
||||
command[0] = 0;
|
||||
|
||||
the_mesh.begin(fs);
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
display.begin();
|
||||
ui_task.begin(the_mesh.getNodeName(), FIRMWARE_BUILD_DATE);
|
||||
#endif
|
||||
|
||||
// send out initial Advertisement to the mesh
|
||||
the_mesh.sendSelfAdvertisement(16000);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
int len = strlen(command);
|
||||
while (Serial.available() && len < sizeof(command)-1) {
|
||||
char c = Serial.read();
|
||||
if (c != '\n') {
|
||||
command[len++] = c;
|
||||
command[len] = 0;
|
||||
}
|
||||
Serial.print(c);
|
||||
}
|
||||
if (len == sizeof(command)-1) { // command buffer full
|
||||
command[sizeof(command)-1] = '\r';
|
||||
}
|
||||
|
||||
if (len > 0 && command[len - 1] == '\r') { // received complete line
|
||||
command[len - 1] = 0; // replace newline with C string null terminator
|
||||
char reply[160];
|
||||
the_mesh.getCLI()->handleCommand(0, command, reply); // NOTE: there is no sender_timestamp via serial!
|
||||
if (reply[0]) {
|
||||
Serial.print(" -> "); Serial.println(reply);
|
||||
}
|
||||
|
||||
command[0] = 0; // reset command buffer
|
||||
}
|
||||
|
||||
the_mesh.loop();
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
#include "UITask.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
#define AUTO_OFF_MILLIS 20000 // 20 seconds
|
||||
|
||||
// 'meshcore', 128x13px
|
||||
static const uint8_t meshcore_logo [] PROGMEM = {
|
||||
0x3c, 0x01, 0xe3, 0xff, 0xc7, 0xff, 0x8f, 0x03, 0x87, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe,
|
||||
0x3c, 0x03, 0xe3, 0xff, 0xc7, 0xff, 0x8e, 0x03, 0x8f, 0xfe, 0x3f, 0xfe, 0x1f, 0xff, 0x1f, 0xfe,
|
||||
0x3e, 0x03, 0xc3, 0xff, 0x8f, 0xff, 0x0e, 0x07, 0x8f, 0xfe, 0x7f, 0xfe, 0x1f, 0xff, 0x1f, 0xfc,
|
||||
0x3e, 0x07, 0xc7, 0x80, 0x0e, 0x00, 0x0e, 0x07, 0x9e, 0x00, 0x78, 0x0e, 0x3c, 0x0f, 0x1c, 0x00,
|
||||
0x3e, 0x0f, 0xc7, 0x80, 0x1e, 0x00, 0x0e, 0x07, 0x1e, 0x00, 0x70, 0x0e, 0x38, 0x0f, 0x3c, 0x00,
|
||||
0x7f, 0x0f, 0xc7, 0xfe, 0x1f, 0xfc, 0x1f, 0xff, 0x1c, 0x00, 0x70, 0x0e, 0x38, 0x0e, 0x3f, 0xf8,
|
||||
0x7f, 0x1f, 0xc7, 0xfe, 0x0f, 0xff, 0x1f, 0xff, 0x1c, 0x00, 0xf0, 0x0e, 0x38, 0x0e, 0x3f, 0xf8,
|
||||
0x7f, 0x3f, 0xc7, 0xfe, 0x0f, 0xff, 0x1f, 0xff, 0x1c, 0x00, 0xf0, 0x1e, 0x3f, 0xfe, 0x3f, 0xf0,
|
||||
0x77, 0x3b, 0x87, 0x00, 0x00, 0x07, 0x1c, 0x0f, 0x3c, 0x00, 0xe0, 0x1c, 0x7f, 0xfc, 0x38, 0x00,
|
||||
0x77, 0xfb, 0x8f, 0x00, 0x00, 0x07, 0x1c, 0x0f, 0x3c, 0x00, 0xe0, 0x1c, 0x7f, 0xf8, 0x38, 0x00,
|
||||
0x73, 0xf3, 0x8f, 0xff, 0x0f, 0xff, 0x1c, 0x0e, 0x3f, 0xf8, 0xff, 0xfc, 0x70, 0x78, 0x7f, 0xf8,
|
||||
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfe, 0x3c, 0x0e, 0x3f, 0xf8, 0xff, 0xfc, 0x70, 0x3c, 0x7f, 0xf8,
|
||||
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfc, 0x3c, 0x0e, 0x1f, 0xf8, 0xff, 0xf8, 0x70, 0x3c, 0x7f, 0xf8,
|
||||
};
|
||||
|
||||
void UITask::begin(const char* node_name, const char* build_date) {
|
||||
_prevBtnState = HIGH;
|
||||
_auto_off = millis() + AUTO_OFF_MILLIS;
|
||||
_node_name = node_name;
|
||||
_build_date = build_date;
|
||||
_display->turnOn();
|
||||
}
|
||||
|
||||
void UITask::renderCurrScreen() {
|
||||
char tmp[80];
|
||||
// render 'home' screen
|
||||
_display->drawXbm(0, 0, meshcore_logo, 128, 13);
|
||||
_display->setCursor(0, 20);
|
||||
_display->setTextSize(1);
|
||||
_display->print(_node_name);
|
||||
|
||||
sprintf(tmp, "Build: %s", _build_date);
|
||||
_display->setCursor(0, 32);
|
||||
_display->print(tmp);
|
||||
_display->setCursor(0, 43);
|
||||
_display->print("< Room Server >");
|
||||
//_display->printf("freq : %03.2f sf %d\n", _prefs.freq, _prefs.sf);
|
||||
//_display->printf("bw : %03.2f cr %d\n", _prefs.bw, _prefs.cr);
|
||||
}
|
||||
|
||||
void UITask::loop() {
|
||||
#ifdef PIN_USER_BTN
|
||||
if (millis() >= _next_read) {
|
||||
int btnState = digitalRead(PIN_USER_BTN);
|
||||
if (btnState != _prevBtnState) {
|
||||
if (btnState == LOW) { // pressed?
|
||||
if (_display->isOn()) {
|
||||
// TODO: any action ?
|
||||
} else {
|
||||
_display->turnOn();
|
||||
}
|
||||
_auto_off = millis() + AUTO_OFF_MILLIS; // extend auto-off timer
|
||||
}
|
||||
_prevBtnState = btnState;
|
||||
}
|
||||
_next_read = millis() + 200; // 5 reads per second
|
||||
}
|
||||
#endif
|
||||
|
||||
if (_display->isOn()) {
|
||||
if (millis() >= _next_refresh) {
|
||||
_display->startFrame();
|
||||
renderCurrScreen();
|
||||
_display->endFrame();
|
||||
|
||||
_next_refresh = millis() + 1000; // refresh every second
|
||||
}
|
||||
if (millis() > _auto_off) {
|
||||
_display->turnOff();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <helpers/ui/DisplayDriver.h>
|
||||
|
||||
class UITask {
|
||||
DisplayDriver* _display;
|
||||
unsigned long _next_read, _next_refresh, _auto_off;
|
||||
int _prevBtnState;
|
||||
const char* _node_name;
|
||||
const char* _build_date;
|
||||
|
||||
void renderCurrScreen();
|
||||
public:
|
||||
UITask(DisplayDriver& display) : _display(&display) { _next_read = _next_refresh = 0; }
|
||||
void begin(const char* node_name, const char* build_date);
|
||||
|
||||
void loop();
|
||||
};
|
||||
@@ -0,0 +1,905 @@
|
||||
#include <Arduino.h> // needed for PlatformIO
|
||||
#include <Mesh.h>
|
||||
|
||||
#if defined(NRF52_PLATFORM)
|
||||
#include <InternalFileSystem.h>
|
||||
#elif defined(ESP32)
|
||||
#include <SPIFFS.h>
|
||||
#endif
|
||||
|
||||
#include <helpers/ArduinoHelpers.h>
|
||||
#include <helpers/StaticPoolPacketManager.h>
|
||||
#include <helpers/SimpleMeshTables.h>
|
||||
#include <helpers/IdentityStore.h>
|
||||
#include <helpers/AdvertDataHelpers.h>
|
||||
#include <helpers/TxtDataHelpers.h>
|
||||
#include <helpers/CommonCLI.h>
|
||||
#include <RTClib.h>
|
||||
#include <target.h>
|
||||
|
||||
/* ------------------------------ Config -------------------------------- */
|
||||
|
||||
#ifndef FIRMWARE_BUILD_DATE
|
||||
#define FIRMWARE_BUILD_DATE "30 Mar 2025"
|
||||
#endif
|
||||
|
||||
#ifndef FIRMWARE_VERSION
|
||||
#define FIRMWARE_VERSION "v1.4.2"
|
||||
#endif
|
||||
|
||||
#ifndef LORA_FREQ
|
||||
#define LORA_FREQ 915.0
|
||||
#endif
|
||||
#ifndef LORA_BW
|
||||
#define LORA_BW 250
|
||||
#endif
|
||||
#ifndef LORA_SF
|
||||
#define LORA_SF 10
|
||||
#endif
|
||||
#ifndef LORA_CR
|
||||
#define LORA_CR 5
|
||||
#endif
|
||||
#ifndef LORA_TX_POWER
|
||||
#define LORA_TX_POWER 20
|
||||
#endif
|
||||
|
||||
#ifndef ADVERT_NAME
|
||||
#define ADVERT_NAME "Test BBS"
|
||||
#endif
|
||||
#ifndef ADVERT_LAT
|
||||
#define ADVERT_LAT 0.0
|
||||
#endif
|
||||
#ifndef ADVERT_LON
|
||||
#define ADVERT_LON 0.0
|
||||
#endif
|
||||
|
||||
#ifndef ADMIN_PASSWORD
|
||||
#define ADMIN_PASSWORD "password"
|
||||
#endif
|
||||
|
||||
#ifndef MAX_CLIENTS
|
||||
#define MAX_CLIENTS 32
|
||||
#endif
|
||||
|
||||
#ifndef MAX_UNSYNCED_POSTS
|
||||
#define MAX_UNSYNCED_POSTS 16
|
||||
#endif
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
#include <helpers/ui/SSD1306Display.h>
|
||||
|
||||
static DISPLAY_CLASS display;
|
||||
|
||||
#include "UITask.h"
|
||||
static UITask ui_task(display);
|
||||
#endif
|
||||
|
||||
#define FIRMWARE_ROLE "room_server"
|
||||
|
||||
#define PACKET_LOG_FILE "/packet_log"
|
||||
|
||||
/* ------------------------------ Code -------------------------------- */
|
||||
|
||||
enum RoomPermission {
|
||||
ADMIN,
|
||||
GUEST,
|
||||
READ_ONLY
|
||||
};
|
||||
|
||||
struct ClientInfo {
|
||||
mesh::Identity id;
|
||||
uint32_t last_timestamp; // by THEIR clock
|
||||
uint32_t last_activity; // by OUR clock
|
||||
uint32_t sync_since; // sync messages SINCE this timestamp (by OUR clock)
|
||||
uint32_t pending_ack;
|
||||
uint32_t push_post_timestamp;
|
||||
unsigned long ack_timeout;
|
||||
RoomPermission permission;
|
||||
uint8_t push_failures;
|
||||
uint8_t secret[PUB_KEY_SIZE];
|
||||
int out_path_len;
|
||||
uint8_t out_path[MAX_PATH_SIZE];
|
||||
};
|
||||
|
||||
#define MAX_POST_TEXT_LEN (160-9)
|
||||
|
||||
struct PostInfo {
|
||||
mesh::Identity author;
|
||||
uint32_t post_timestamp; // by OUR clock
|
||||
char text[MAX_POST_TEXT_LEN+1];
|
||||
};
|
||||
|
||||
#define REPLY_DELAY_MILLIS 1500
|
||||
#define PUSH_NOTIFY_DELAY_MILLIS 2000
|
||||
#define SYNC_PUSH_INTERVAL 2000
|
||||
|
||||
#define PUSH_ACK_TIMEOUT_FLOOD 12000
|
||||
#define PUSH_TIMEOUT_BASE 4000
|
||||
#define PUSH_ACK_TIMEOUT_FACTOR 2000
|
||||
|
||||
#define CLIENT_KEEP_ALIVE_SECS 128
|
||||
|
||||
#define REQ_TYPE_GET_STATUS 0x01 // same as _GET_STATS
|
||||
#define REQ_TYPE_KEEP_ALIVE 0x02
|
||||
|
||||
#define RESP_SERVER_LOGIN_OK 0 // response to ANON_REQ
|
||||
|
||||
struct ServerStats {
|
||||
uint16_t batt_milli_volts;
|
||||
uint16_t curr_tx_queue_len;
|
||||
uint16_t curr_free_queue_len;
|
||||
int16_t last_rssi;
|
||||
uint32_t n_packets_recv;
|
||||
uint32_t n_packets_sent;
|
||||
uint32_t total_air_time_secs;
|
||||
uint32_t total_up_time_secs;
|
||||
uint32_t n_sent_flood, n_sent_direct;
|
||||
uint32_t n_recv_flood, n_recv_direct;
|
||||
uint16_t n_full_events;
|
||||
int16_t last_snr; // x 4
|
||||
uint16_t n_direct_dups, n_flood_dups;
|
||||
uint16_t n_posted, n_post_push;
|
||||
};
|
||||
|
||||
class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
|
||||
FILESYSTEM* _fs;
|
||||
unsigned long next_local_advert, next_flood_advert;
|
||||
bool _logging;
|
||||
NodePrefs _prefs;
|
||||
CommonCLI _cli;
|
||||
uint8_t reply_data[MAX_PACKET_PAYLOAD];
|
||||
int num_clients;
|
||||
ClientInfo known_clients[MAX_CLIENTS];
|
||||
unsigned long next_push;
|
||||
uint16_t _num_posted, _num_post_pushes;
|
||||
int next_client_idx; // for round-robin polling
|
||||
int next_post_idx;
|
||||
PostInfo posts[MAX_UNSYNCED_POSTS]; // cyclic queue
|
||||
|
||||
ClientInfo* putClient(const mesh::Identity& id) {
|
||||
for (int i = 0; i < num_clients; i++) {
|
||||
if (id.matches(known_clients[i].id)) return &known_clients[i]; // already known
|
||||
}
|
||||
ClientInfo* newClient;
|
||||
if (num_clients < MAX_CLIENTS) {
|
||||
newClient = &known_clients[num_clients++];
|
||||
} else { // table is currently full
|
||||
// evict least active client
|
||||
uint32_t oldest_timestamp = 0xFFFFFFFF;
|
||||
newClient = &known_clients[0];
|
||||
for (int i = 0; i < num_clients; i++) {
|
||||
auto c = &known_clients[i];
|
||||
if (c->last_activity < oldest_timestamp) {
|
||||
oldest_timestamp = c->last_activity;
|
||||
newClient = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
newClient->id = id;
|
||||
newClient->out_path_len = -1; // initially out_path is unknown
|
||||
newClient->last_timestamp = 0;
|
||||
self_id.calcSharedSecret(newClient->secret, id); // calc ECDH shared secret
|
||||
return newClient;
|
||||
}
|
||||
|
||||
void evict(ClientInfo* client) {
|
||||
client->last_activity = 0; // this slot will now be re-used (will be oldest)
|
||||
memset(client->id.pub_key, 0, sizeof(client->id.pub_key));
|
||||
memset(client->secret, 0, sizeof(client->secret));
|
||||
client->pending_ack = 0;
|
||||
}
|
||||
|
||||
void addPost(ClientInfo* client, const char* postData) {
|
||||
// TODO: suggested postData format: <title>/<descrption>
|
||||
posts[next_post_idx].author = client->id; // add to cyclic queue
|
||||
StrHelper::strncpy(posts[next_post_idx].text, postData, MAX_POST_TEXT_LEN);
|
||||
|
||||
posts[next_post_idx].post_timestamp = getRTCClock()->getCurrentTimeUnique();
|
||||
next_post_idx = (next_post_idx + 1) % MAX_UNSYNCED_POSTS;
|
||||
|
||||
next_push = futureMillis(PUSH_NOTIFY_DELAY_MILLIS);
|
||||
_num_posted++; // stats
|
||||
}
|
||||
|
||||
void pushPostToClient(ClientInfo* client, PostInfo& post) {
|
||||
int len = 0;
|
||||
memcpy(&reply_data[len], &post.post_timestamp, 4); len += 4; // this is a PAST timestamp... but should be accepted by client
|
||||
reply_data[len++] = (TXT_TYPE_SIGNED_PLAIN << 2); // 'signed' plain text
|
||||
|
||||
// encode prefix of post.author.pub_key
|
||||
memcpy(&reply_data[len], post.author.pub_key, 4); len += 4; // just first 4 bytes
|
||||
|
||||
int text_len = strlen(post.text);
|
||||
memcpy(&reply_data[len], post.text, text_len); len += text_len;
|
||||
|
||||
// calc expected ACK reply
|
||||
mesh::Utils::sha256((uint8_t *)&client->pending_ack, 4, reply_data, len, client->id.pub_key, PUB_KEY_SIZE);
|
||||
client->push_post_timestamp = post.post_timestamp;
|
||||
|
||||
auto reply = createDatagram(PAYLOAD_TYPE_TXT_MSG, client->id, client->secret, reply_data, len);
|
||||
if (reply) {
|
||||
if (client->out_path_len < 0) {
|
||||
sendFlood(reply);
|
||||
client->ack_timeout = futureMillis(PUSH_ACK_TIMEOUT_FLOOD);
|
||||
} else {
|
||||
sendDirect(reply, client->out_path, client->out_path_len);
|
||||
client->ack_timeout = futureMillis(PUSH_TIMEOUT_BASE + PUSH_ACK_TIMEOUT_FACTOR * (client->out_path_len + 1));
|
||||
}
|
||||
_num_post_pushes++; // stats
|
||||
} else {
|
||||
client->pending_ack = 0;
|
||||
MESH_DEBUG_PRINTLN("Unable to push post to client");
|
||||
}
|
||||
}
|
||||
|
||||
bool processAck(const uint8_t *data) {
|
||||
for (int i = 0; i < num_clients; i++) {
|
||||
auto client = &known_clients[i];
|
||||
if (client->pending_ack && memcmp(data, &client->pending_ack, 4) == 0) { // got an ACK from Client!
|
||||
client->pending_ack = 0; // clear this, so next push can happen
|
||||
client->push_failures = 0;
|
||||
client->sync_since = client->push_post_timestamp; // advance Client's SINCE timestamp, to sync next post
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
mesh::Packet* createSelfAdvert() {
|
||||
uint8_t app_data[MAX_ADVERT_DATA_SIZE];
|
||||
uint8_t app_data_len;
|
||||
{
|
||||
AdvertDataBuilder builder(ADV_TYPE_ROOM, _prefs.node_name, _prefs.node_lat, _prefs.node_lon);
|
||||
app_data_len = builder.encodeTo(app_data);
|
||||
}
|
||||
|
||||
return createAdvert(self_id, app_data, app_data_len);
|
||||
}
|
||||
|
||||
File openAppend(const char* fname) {
|
||||
#if defined(NRF52_PLATFORM)
|
||||
return _fs->open(fname, FILE_O_WRITE);
|
||||
#else
|
||||
return _fs->open(fname, "a", true);
|
||||
#endif
|
||||
}
|
||||
|
||||
protected:
|
||||
float getAirtimeBudgetFactor() const override {
|
||||
return _prefs.airtime_factor;
|
||||
}
|
||||
|
||||
void logRxRaw(float snr, float rssi, const uint8_t raw[], int len) override {
|
||||
#if MESH_PACKET_LOGGING
|
||||
Serial.print(getLogDateTime());
|
||||
Serial.print(" RAW: ");
|
||||
mesh::Utils::printHex(Serial, raw, len);
|
||||
Serial.println();
|
||||
#endif
|
||||
}
|
||||
|
||||
void logRx(mesh::Packet* pkt, int len, float score) override {
|
||||
if (_logging) {
|
||||
File f = openAppend(PACKET_LOG_FILE);
|
||||
if (f) {
|
||||
f.print(getLogDateTime());
|
||||
f.printf(": RX, len=%d (type=%d, route=%s, payload_len=%d) SNR=%d RSSI=%d score=%d",
|
||||
len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len,
|
||||
(int)_radio->getLastSNR(), (int)_radio->getLastRSSI(), (int)(score*1000));
|
||||
|
||||
if (pkt->getPayloadType() == PAYLOAD_TYPE_PATH || pkt->getPayloadType() == PAYLOAD_TYPE_REQ
|
||||
|| pkt->getPayloadType() == PAYLOAD_TYPE_RESPONSE || pkt->getPayloadType() == PAYLOAD_TYPE_TXT_MSG) {
|
||||
f.printf(" [%02X -> %02X]\n", (uint32_t)pkt->payload[1], (uint32_t)pkt->payload[0]);
|
||||
} else {
|
||||
f.printf("\n");
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
void logTx(mesh::Packet* pkt, int len) override {
|
||||
if (_logging) {
|
||||
File f = openAppend(PACKET_LOG_FILE);
|
||||
if (f) {
|
||||
f.print(getLogDateTime());
|
||||
f.printf(": TX, len=%d (type=%d, route=%s, payload_len=%d)",
|
||||
len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len);
|
||||
|
||||
if (pkt->getPayloadType() == PAYLOAD_TYPE_PATH || pkt->getPayloadType() == PAYLOAD_TYPE_REQ
|
||||
|| pkt->getPayloadType() == PAYLOAD_TYPE_RESPONSE || pkt->getPayloadType() == PAYLOAD_TYPE_TXT_MSG) {
|
||||
f.printf(" [%02X -> %02X]\n", (uint32_t)pkt->payload[1], (uint32_t)pkt->payload[0]);
|
||||
} else {
|
||||
f.printf("\n");
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
void logTxFail(mesh::Packet* pkt, int len) override {
|
||||
if (_logging) {
|
||||
File f = openAppend(PACKET_LOG_FILE);
|
||||
if (f) {
|
||||
f.print(getLogDateTime());
|
||||
f.printf(": TX FAIL!, len=%d (type=%d, route=%s, payload_len=%d)\n",
|
||||
len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len);
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int calcRxDelay(float score, uint32_t air_time) const override {
|
||||
if (_prefs.rx_delay_base <= 0.0f) return 0;
|
||||
return (int) ((pow(_prefs.rx_delay_base, 0.85f - score) - 1.0) * air_time);
|
||||
}
|
||||
|
||||
const char* getLogDateTime() override {
|
||||
static char tmp[32];
|
||||
uint32_t now = getRTCClock()->getCurrentTime();
|
||||
DateTime dt = DateTime(now);
|
||||
sprintf(tmp, "%02d:%02d:%02d - %d/%d/%d U", dt.hour(), dt.minute(), dt.second(), dt.day(), dt.month(), dt.year());
|
||||
return tmp;
|
||||
}
|
||||
|
||||
uint32_t getRetransmitDelay(const mesh::Packet* packet) override {
|
||||
uint32_t t = (_radio->getEstAirtimeFor(packet->path_len + packet->payload_len + 2) * _prefs.tx_delay_factor);
|
||||
return getRNG()->nextInt(0, 6)*t;
|
||||
}
|
||||
uint32_t getDirectRetransmitDelay(const mesh::Packet* packet) override {
|
||||
uint32_t t = (_radio->getEstAirtimeFor(packet->path_len + packet->payload_len + 2) * _prefs.direct_tx_delay_factor);
|
||||
return getRNG()->nextInt(0, 6)*t;
|
||||
}
|
||||
|
||||
bool allowPacketForward(const mesh::Packet* packet) override {
|
||||
if (_prefs.disable_fwd) return false;
|
||||
if (packet->isRouteFlood() && packet->path_len >= _prefs.flood_max) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void onAnonDataRecv(mesh::Packet* packet, uint8_t type, const mesh::Identity& sender, uint8_t* data, size_t len) override {
|
||||
if (type == PAYLOAD_TYPE_ANON_REQ) { // received an initial request by a possible admin client (unknown at this stage)
|
||||
uint32_t sender_timestamp, sender_sync_since;
|
||||
memcpy(&sender_timestamp, data, 4);
|
||||
memcpy(&sender_sync_since, &data[4], 4); // sender's "sync messags SINCE x" timestamp
|
||||
|
||||
RoomPermission perm;
|
||||
data[len] = 0; // ensure null terminator
|
||||
if (strcmp((char *) &data[8], _prefs.password) == 0) { // check for valid admin password
|
||||
perm = RoomPermission::ADMIN;
|
||||
} else {
|
||||
if (strcmp((char *) &data[8], _prefs.guest_password) == 0) { // check the room/public password
|
||||
perm = RoomPermission::GUEST;
|
||||
} else if (_prefs.allow_read_only) {
|
||||
perm = RoomPermission::READ_ONLY;
|
||||
} else {
|
||||
MESH_DEBUG_PRINTLN("Incorrect room password");
|
||||
return; // no response. Client will timeout
|
||||
}
|
||||
}
|
||||
|
||||
auto client = putClient(sender); // add to known clients (if not already known)
|
||||
if (sender_timestamp <= client->last_timestamp) {
|
||||
MESH_DEBUG_PRINTLN("possible replay attack!");
|
||||
return;
|
||||
}
|
||||
|
||||
MESH_DEBUG_PRINTLN("Login success!");
|
||||
client->permission = perm;
|
||||
client->last_timestamp = sender_timestamp;
|
||||
client->sync_since = sender_sync_since;
|
||||
client->pending_ack = 0;
|
||||
client->push_failures = 0;
|
||||
|
||||
uint32_t now = getRTCClock()->getCurrentTime();
|
||||
client->last_activity = now;
|
||||
|
||||
now = getRTCClock()->getCurrentTimeUnique();
|
||||
memcpy(reply_data, &now, 4); // response packets always prefixed with timestamp
|
||||
// TODO: maybe reply with count of messages waiting to be synced for THIS client?
|
||||
reply_data[4] = RESP_SERVER_LOGIN_OK;
|
||||
reply_data[5] = (CLIENT_KEEP_ALIVE_SECS >> 4); // NEW: recommended keep-alive interval (secs / 16)
|
||||
reply_data[6] = (perm == RoomPermission::ADMIN ? 1 : (perm == RoomPermission::GUEST ? 0 : 2));
|
||||
reply_data[7] = 0; // FUTURE: reserved
|
||||
memcpy(&reply_data[8], "OK", 2); // REVISIT: not really needed
|
||||
|
||||
next_push = futureMillis(PUSH_NOTIFY_DELAY_MILLIS); // delay next push, give RESPONSE packet time to arrive first
|
||||
|
||||
if (packet->isRouteFlood()) {
|
||||
// let this sender know path TO here, so they can use sendDirect(), and ALSO encode the response
|
||||
mesh::Packet* path = createPathReturn(sender, client->secret, packet->path, packet->path_len,
|
||||
PAYLOAD_TYPE_RESPONSE, reply_data, 8 + 2);
|
||||
if (path) sendFlood(path);
|
||||
} else {
|
||||
mesh::Packet* reply = createDatagram(PAYLOAD_TYPE_RESPONSE, sender, client->secret, reply_data, 8 + 2);
|
||||
if (reply) {
|
||||
if (client->out_path_len >= 0) { // we have an out_path, so send DIRECT
|
||||
sendDirect(reply, client->out_path, client->out_path_len);
|
||||
} else {
|
||||
sendFlood(reply);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int matching_peer_indexes[MAX_CLIENTS];
|
||||
|
||||
int searchPeersByHash(const uint8_t* hash) override {
|
||||
int n = 0;
|
||||
for (int i = 0; i < num_clients; i++) {
|
||||
if (known_clients[i].id.isHashMatch(hash)) {
|
||||
matching_peer_indexes[n++] = i; // store the INDEXES of matching contacts (for subsequent 'peer' methods)
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
void getPeerSharedSecret(uint8_t* dest_secret, int peer_idx) override {
|
||||
int i = matching_peer_indexes[peer_idx];
|
||||
if (i >= 0 && i < num_clients) {
|
||||
// lookup pre-calculated shared_secret
|
||||
memcpy(dest_secret, known_clients[i].secret, PUB_KEY_SIZE);
|
||||
} else {
|
||||
MESH_DEBUG_PRINTLN("getPeerSharedSecret: Invalid peer idx: %d", i);
|
||||
}
|
||||
}
|
||||
|
||||
void onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender_idx, const uint8_t* secret, uint8_t* data, size_t len) override {
|
||||
int i = matching_peer_indexes[sender_idx];
|
||||
if (i < 0 || i >= num_clients) { // get from our known_clients table (sender SHOULD already be known in this context)
|
||||
MESH_DEBUG_PRINTLN("onPeerDataRecv: invalid peer idx: %d", i);
|
||||
return;
|
||||
}
|
||||
auto client = &known_clients[i];
|
||||
if (type == PAYLOAD_TYPE_TXT_MSG && len > 5) { // a CLI command or new Post
|
||||
uint32_t sender_timestamp;
|
||||
memcpy(&sender_timestamp, data, 4); // timestamp (by sender's RTC clock - which could be wrong)
|
||||
uint flags = (data[4] >> 2); // message attempt number, and other flags
|
||||
|
||||
if (!(flags == TXT_TYPE_PLAIN || flags == TXT_TYPE_CLI_DATA)) {
|
||||
MESH_DEBUG_PRINTLN("onPeerDataRecv: unsupported command flags received: flags=%02x", (uint32_t)flags);
|
||||
} else if (sender_timestamp >= client->last_timestamp) { // prevent replay attacks, but send Acks for retries
|
||||
bool is_retry = (sender_timestamp == client->last_timestamp);
|
||||
client->last_timestamp = sender_timestamp;
|
||||
|
||||
uint32_t now = getRTCClock()->getCurrentTimeUnique();
|
||||
client->last_activity = now;
|
||||
client->push_failures = 0; // reset so push can resume (if prev failed)
|
||||
|
||||
// len can be > original length, but 'text' will be padded with zeroes
|
||||
data[len] = 0; // need to make a C string again, with null terminator
|
||||
|
||||
uint32_t ack_hash; // calc truncated hash of the message timestamp + text + sender pub_key, to prove to sender that we got it
|
||||
mesh::Utils::sha256((uint8_t *) &ack_hash, 4, data, 5 + strlen((char *)&data[5]), client->id.pub_key, PUB_KEY_SIZE);
|
||||
|
||||
uint8_t temp[166];
|
||||
bool send_ack;
|
||||
if (flags == TXT_TYPE_CLI_DATA) {
|
||||
if (client->permission == RoomPermission::ADMIN) {
|
||||
if (is_retry) {
|
||||
temp[5] = 0; // no reply
|
||||
} else {
|
||||
_cli.handleCommand(sender_timestamp, (const char *) &data[5], (char *) &temp[5]);
|
||||
temp[4] = (TXT_TYPE_CLI_DATA << 2); // attempt and flags, (NOTE: legacy was: TXT_TYPE_PLAIN)
|
||||
}
|
||||
send_ack = false;
|
||||
} else {
|
||||
temp[5] = 0; // no reply
|
||||
send_ack = false; // and no ACK... user shoudn't be sending these
|
||||
}
|
||||
} else { // TXT_TYPE_PLAIN
|
||||
if (client->permission == RoomPermission::READ_ONLY) {
|
||||
temp[5] = 0; // no reply
|
||||
send_ack = false; // no ACK
|
||||
} else {
|
||||
if (!is_retry) {
|
||||
addPost(client, (const char *) &data[5]);
|
||||
}
|
||||
temp[5] = 0; // no reply (ACK is enough)
|
||||
send_ack = true;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t delay_millis;
|
||||
if (send_ack) {
|
||||
mesh::Packet* ack = createAck(ack_hash);
|
||||
if (ack) {
|
||||
if (client->out_path_len < 0) {
|
||||
sendFlood(ack);
|
||||
} else {
|
||||
sendDirect(ack, client->out_path, client->out_path_len);
|
||||
}
|
||||
}
|
||||
delay_millis = REPLY_DELAY_MILLIS;
|
||||
} else {
|
||||
delay_millis = 0;
|
||||
}
|
||||
|
||||
int text_len = strlen((char *) &temp[5]);
|
||||
if (text_len > 0) {
|
||||
if (now == sender_timestamp) {
|
||||
// WORKAROUND: the two timestamps need to be different, in the CLI view
|
||||
now++;
|
||||
}
|
||||
memcpy(temp, &now, 4); // mostly an extra blob to help make packet_hash unique
|
||||
|
||||
// calc expected ACK reply
|
||||
//mesh::Utils::sha256((uint8_t *)&expected_ack_crc, 4, temp, 5 + text_len, self_id.pub_key, PUB_KEY_SIZE);
|
||||
|
||||
auto reply = createDatagram(PAYLOAD_TYPE_TXT_MSG, client->id, secret, temp, 5 + text_len);
|
||||
if (reply) {
|
||||
if (client->out_path_len < 0) {
|
||||
sendFlood(reply, delay_millis);
|
||||
} else {
|
||||
sendDirect(reply, client->out_path, client->out_path_len, delay_millis);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
MESH_DEBUG_PRINTLN("onPeerDataRecv: possible replay attack detected");
|
||||
}
|
||||
} else if (type == PAYLOAD_TYPE_REQ && len >= 5) {
|
||||
uint32_t sender_timestamp;
|
||||
memcpy(&sender_timestamp, data, 4); // timestamp (by sender's RTC clock - which could be wrong)
|
||||
if (sender_timestamp < client->last_timestamp) { // prevent replay attacks
|
||||
MESH_DEBUG_PRINTLN("onPeerDataRecv: possible replay attack detected");
|
||||
} else {
|
||||
client->last_timestamp = sender_timestamp;
|
||||
|
||||
uint32_t now = getRTCClock()->getCurrentTime();
|
||||
client->last_activity = now; // <-- THIS will keep client connection alive
|
||||
client->push_failures = 0; // reset so push can resume (if prev failed)
|
||||
|
||||
if (data[4] == REQ_TYPE_KEEP_ALIVE && packet->isRouteDirect()) { // request type
|
||||
uint32_t forceSince = 0;
|
||||
if (len >= 9) { // optional - last post_timestamp client received
|
||||
memcpy(&forceSince, &data[5], 4); // NOTE: this may be 0, if part of decrypted PADDING!
|
||||
} else {
|
||||
memcpy(&data[5], &forceSince, 4); // make sure there are zeroes in payload (for ack_hash calc below)
|
||||
}
|
||||
if (forceSince > 0) {
|
||||
client->sync_since = forceSince; // force-update the 'sync since'
|
||||
}
|
||||
|
||||
client->pending_ack = 0;
|
||||
|
||||
// TODO: Throttle KEEP_ALIVE requests!
|
||||
// if client sends too quickly, evict()
|
||||
|
||||
// RULE: only send keep_alive response DIRECT!
|
||||
if (client->out_path_len >= 0) {
|
||||
uint32_t ack_hash; // calc ACK to prove to sender that we got request
|
||||
mesh::Utils::sha256((uint8_t *) &ack_hash, 4, data, 9, client->id.pub_key, PUB_KEY_SIZE);
|
||||
|
||||
auto reply = createAck(ack_hash);
|
||||
if (reply) {
|
||||
sendDirect(reply, client->out_path, client->out_path_len);
|
||||
}
|
||||
}
|
||||
} else if (data[4] == REQ_TYPE_GET_STATUS) {
|
||||
ServerStats stats;
|
||||
stats.batt_milli_volts = board.getBattMilliVolts();
|
||||
stats.curr_tx_queue_len = _mgr->getOutboundCount();
|
||||
stats.curr_free_queue_len = _mgr->getFreeCount();
|
||||
stats.last_rssi = (int16_t) radio_driver.getLastRSSI();
|
||||
stats.n_packets_recv = radio_driver.getPacketsRecv();
|
||||
stats.n_packets_sent = radio_driver.getPacketsSent();
|
||||
stats.total_air_time_secs = getTotalAirTime() / 1000;
|
||||
stats.total_up_time_secs = _ms->getMillis() / 1000;
|
||||
stats.n_sent_flood = getNumSentFlood();
|
||||
stats.n_sent_direct = getNumSentDirect();
|
||||
stats.n_recv_flood = getNumRecvFlood();
|
||||
stats.n_recv_direct = getNumRecvDirect();
|
||||
stats.n_full_events = getNumFullEvents();
|
||||
stats.last_snr = (int16_t)(radio_driver.getLastSNR() * 4);
|
||||
stats.n_direct_dups = ((SimpleMeshTables *)getTables())->getNumDirectDups();
|
||||
stats.n_flood_dups = ((SimpleMeshTables *)getTables())->getNumFloodDups();
|
||||
stats.n_posted = _num_posted;
|
||||
stats.n_post_push = _num_post_pushes;
|
||||
|
||||
now = getRTCClock()->getCurrentTimeUnique();
|
||||
memcpy(reply_data, &now, 4); // response packets always prefixed with timestamp
|
||||
memcpy(&reply_data[4], &stats, sizeof(stats));
|
||||
uint8_t reply_len = 4 + sizeof(stats);
|
||||
|
||||
if (packet->isRouteFlood()) {
|
||||
// let this sender know path TO here, so they can use sendDirect(), and ALSO encode the response
|
||||
mesh::Packet* path = createPathReturn(client->id, secret, packet->path, packet->path_len,
|
||||
PAYLOAD_TYPE_RESPONSE, reply_data, reply_len);
|
||||
if (path) sendFlood(path);
|
||||
} else {
|
||||
mesh::Packet* reply = createDatagram(PAYLOAD_TYPE_RESPONSE, client->id, secret, reply_data, reply_len);
|
||||
if (reply) {
|
||||
if (client->out_path_len >= 0) { // we have an out_path, so send DIRECT
|
||||
sendDirect(reply, client->out_path, client->out_path_len);
|
||||
} else {
|
||||
sendFlood(reply);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool onPeerPathRecv(mesh::Packet* packet, int sender_idx, const uint8_t* secret, uint8_t* path, uint8_t path_len, uint8_t extra_type, uint8_t* extra, uint8_t extra_len) override {
|
||||
// TODO: prevent replay attacks
|
||||
int i = matching_peer_indexes[sender_idx];
|
||||
|
||||
if (i >= 0 && i < num_clients) { // get from our known_clients table (sender SHOULD already be known in this context)
|
||||
MESH_DEBUG_PRINTLN("PATH to client, path_len=%d", (uint32_t) path_len);
|
||||
auto client = &known_clients[i];
|
||||
memcpy(client->out_path, path, client->out_path_len = path_len); // store a copy of path, for sendDirect()
|
||||
} else {
|
||||
MESH_DEBUG_PRINTLN("onPeerPathRecv: invalid peer idx: %d", i);
|
||||
}
|
||||
|
||||
if (extra_type == PAYLOAD_TYPE_ACK && extra_len >= 4) {
|
||||
// also got an encoded ACK!
|
||||
processAck(extra);
|
||||
}
|
||||
|
||||
// NOTE: no reciprocal path send!!
|
||||
return false;
|
||||
}
|
||||
|
||||
void onAckRecv(mesh::Packet* packet, uint32_t ack_crc) override {
|
||||
if (processAck((uint8_t *)&ack_crc)) {
|
||||
packet->markDoNotRetransmit(); // ACK was for this node, so don't retransmit
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
MyMesh(mesh::MainBoard& board, mesh::Radio& radio, mesh::MillisecondClock& ms, mesh::RNG& rng, mesh::RTCClock& rtc, mesh::MeshTables& tables)
|
||||
: mesh::Mesh(radio, ms, rng, rtc, *new StaticPoolPacketManager(32), tables),
|
||||
_cli(board, this, &_prefs, this)
|
||||
{
|
||||
next_local_advert = next_flood_advert = 0;
|
||||
_logging = false;
|
||||
|
||||
// defaults
|
||||
memset(&_prefs, 0, sizeof(_prefs));
|
||||
_prefs.airtime_factor = 1.0; // one half
|
||||
_prefs.rx_delay_base = 0.0f; // off by default, was 10.0
|
||||
_prefs.tx_delay_factor = 0.5f; // was 0.25f;
|
||||
StrHelper::strncpy(_prefs.node_name, ADVERT_NAME, sizeof(_prefs.node_name));
|
||||
_prefs.node_lat = ADVERT_LAT;
|
||||
_prefs.node_lon = ADVERT_LON;
|
||||
StrHelper::strncpy(_prefs.password, ADMIN_PASSWORD, sizeof(_prefs.password));
|
||||
_prefs.freq = LORA_FREQ;
|
||||
_prefs.sf = LORA_SF;
|
||||
_prefs.bw = LORA_BW;
|
||||
_prefs.cr = LORA_CR;
|
||||
_prefs.tx_power_dbm = LORA_TX_POWER;
|
||||
_prefs.disable_fwd = 1;
|
||||
_prefs.advert_interval = 1; // default to 2 minutes for NEW installs
|
||||
_prefs.flood_advert_interval = 3; // 3 hours
|
||||
_prefs.flood_max = 64;
|
||||
#ifdef ROOM_PASSWORD
|
||||
StrHelper::strncpy(_prefs.guest_password, ROOM_PASSWORD, sizeof(_prefs.guest_password));
|
||||
#endif
|
||||
|
||||
num_clients = 0;
|
||||
next_post_idx = 0;
|
||||
next_client_idx = 0;
|
||||
next_push = 0;
|
||||
memset(posts, 0, sizeof(posts));
|
||||
_num_posted = _num_post_pushes = 0;
|
||||
}
|
||||
|
||||
CommonCLI* getCLI() { return &_cli; }
|
||||
|
||||
void begin(FILESYSTEM* fs) {
|
||||
mesh::Mesh::begin();
|
||||
_fs = fs;
|
||||
// load persisted prefs
|
||||
_cli.loadPrefs(_fs);
|
||||
|
||||
radio_set_params(_prefs.freq, _prefs.bw, _prefs.sf, _prefs.cr);
|
||||
radio_set_tx_power(_prefs.tx_power_dbm);
|
||||
|
||||
updateAdvertTimer();
|
||||
updateFloodAdvertTimer();
|
||||
}
|
||||
|
||||
const char* getFirmwareVer() override { return FIRMWARE_VERSION; }
|
||||
const char* getBuildDate() override { return FIRMWARE_BUILD_DATE; }
|
||||
const char* getRole() override { return FIRMWARE_ROLE; }
|
||||
const char* getNodeName() { return _prefs.node_name; }
|
||||
|
||||
void savePrefs() override {
|
||||
_cli.savePrefs(_fs);
|
||||
}
|
||||
|
||||
bool formatFileSystem() override {
|
||||
#if defined(NRF52_PLATFORM)
|
||||
return InternalFS.format();
|
||||
#elif defined(ESP32)
|
||||
return SPIFFS.format();
|
||||
#else
|
||||
#error "need to implement file system erase"
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void sendSelfAdvertisement(int delay_millis) override {
|
||||
mesh::Packet* pkt = createSelfAdvert();
|
||||
if (pkt) {
|
||||
sendFlood(pkt, delay_millis);
|
||||
} else {
|
||||
MESH_DEBUG_PRINTLN("ERROR: unable to create advertisement packet!");
|
||||
}
|
||||
}
|
||||
|
||||
void updateAdvertTimer() override {
|
||||
if (_prefs.advert_interval > 0) { // schedule local advert timer
|
||||
next_local_advert = futureMillis((uint32_t)_prefs.advert_interval * 2 * 60 * 1000);
|
||||
} else {
|
||||
next_local_advert = 0; // stop the timer
|
||||
}
|
||||
}
|
||||
void updateFloodAdvertTimer() override {
|
||||
if (_prefs.flood_advert_interval > 0) { // schedule flood advert timer
|
||||
next_flood_advert = futureMillis( ((uint32_t)_prefs.flood_advert_interval) * 60 * 60 * 1000);
|
||||
} else {
|
||||
next_flood_advert = 0; // stop the timer
|
||||
}
|
||||
}
|
||||
|
||||
void setLoggingOn(bool enable) override { _logging = enable; }
|
||||
|
||||
void eraseLogFile() override {
|
||||
_fs->remove(PACKET_LOG_FILE);
|
||||
}
|
||||
|
||||
void dumpLogFile() override {
|
||||
File f = _fs->open(PACKET_LOG_FILE);
|
||||
if (f) {
|
||||
while (f.available()) {
|
||||
int c = f.read();
|
||||
if (c < 0) break;
|
||||
Serial.print((char)c);
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
|
||||
void setTxPower(uint8_t power_dbm) override {
|
||||
radio_set_tx_power(power_dbm);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
mesh::Mesh::loop();
|
||||
|
||||
if (millisHasNowPassed(next_push) && num_clients > 0) {
|
||||
// check for ACK timeouts
|
||||
for (int i = 0; i < num_clients; i++) {
|
||||
auto c = &known_clients[i];
|
||||
if (c->pending_ack && millisHasNowPassed(c->ack_timeout)) {
|
||||
c->push_failures++;
|
||||
c->pending_ack = 0; // reset (TODO: keep prev expected_ack's in a list, incase they arrive LATER, after we retry)
|
||||
MESH_DEBUG_PRINTLN("pending ACK timed out: push_failures: %d", (uint32_t)c->push_failures);
|
||||
}
|
||||
}
|
||||
// check next Round-Robin client, and sync next new post
|
||||
auto client = &known_clients[next_client_idx];
|
||||
if (client->pending_ack == 0 && client->last_activity != 0 && client->push_failures < 3) { // not already waiting for ACK, AND not evicted, AND retries not max
|
||||
MESH_DEBUG_PRINTLN("loop - checking for client %02X", (uint32_t) client->id.pub_key[0]);
|
||||
for (int k = 0, idx = next_post_idx; k < MAX_UNSYNCED_POSTS; k++) {
|
||||
if (posts[idx].post_timestamp > client->sync_since // is new post for this Client?
|
||||
&& !posts[idx].author.matches(client->id)) { // don't push posts to the author
|
||||
// push this post to Client, then wait for ACK
|
||||
pushPostToClient(client, posts[idx]);
|
||||
MESH_DEBUG_PRINTLN("loop - pushed to client %02X: %s", (uint32_t) client->id.pub_key[0], posts[idx].text);
|
||||
break;
|
||||
}
|
||||
idx = (idx + 1) % MAX_UNSYNCED_POSTS; // wrap to start of cyclic queue
|
||||
}
|
||||
} else {
|
||||
MESH_DEBUG_PRINTLN("loop - skipping busy (or evicted) client %02X", (uint32_t) client->id.pub_key[0]);
|
||||
}
|
||||
next_client_idx = (next_client_idx + 1) % num_clients; // round robin polling for each client
|
||||
|
||||
next_push = futureMillis(SYNC_PUSH_INTERVAL);
|
||||
}
|
||||
|
||||
if (next_flood_advert && millisHasNowPassed(next_flood_advert)) {
|
||||
mesh::Packet* pkt = createSelfAdvert();
|
||||
if (pkt) sendFlood(pkt);
|
||||
|
||||
updateFloodAdvertTimer(); // schedule next flood advert
|
||||
updateAdvertTimer(); // also schedule local advert (so they don't overlap)
|
||||
} else if (next_local_advert && millisHasNowPassed(next_local_advert)) {
|
||||
mesh::Packet* pkt = createSelfAdvert();
|
||||
if (pkt) sendZeroHop(pkt);
|
||||
|
||||
updateAdvertTimer(); // schedule next local advert
|
||||
}
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
ui_task.loop();
|
||||
#endif
|
||||
|
||||
// TODO: periodically check for OLD/inactive entries in known_clients[], and evict
|
||||
}
|
||||
};
|
||||
|
||||
StdRNG fast_rng;
|
||||
SimpleMeshTables tables;
|
||||
MyMesh the_mesh(board, radio_driver, *new ArduinoMillis(), fast_rng, rtc_clock, tables);
|
||||
|
||||
void halt() {
|
||||
while (1) ;
|
||||
}
|
||||
|
||||
static char command[MAX_POST_TEXT_LEN+1];
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
delay(1000);
|
||||
|
||||
board.begin();
|
||||
|
||||
if (!radio_init()) { halt(); }
|
||||
|
||||
fast_rng.begin(radio_get_rng_seed());
|
||||
|
||||
FILESYSTEM* fs;
|
||||
#if defined(NRF52_PLATFORM)
|
||||
InternalFS.begin();
|
||||
fs = &InternalFS;
|
||||
IdentityStore store(InternalFS, "");
|
||||
#elif defined(ESP32)
|
||||
SPIFFS.begin(true);
|
||||
fs = &SPIFFS;
|
||||
IdentityStore store(SPIFFS, "/identity");
|
||||
#else
|
||||
#error "need to define filesystem"
|
||||
#endif
|
||||
if (!store.load("_main", the_mesh.self_id)) {
|
||||
the_mesh.self_id = radio_new_identity(); // create new random identity
|
||||
store.save("_main", the_mesh.self_id);
|
||||
}
|
||||
|
||||
Serial.print("Room ID: ");
|
||||
mesh::Utils::printHex(Serial, the_mesh.self_id.pub_key, PUB_KEY_SIZE); Serial.println();
|
||||
|
||||
command[0] = 0;
|
||||
|
||||
the_mesh.begin(fs);
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
display.begin();
|
||||
ui_task.begin(the_mesh.getNodeName(), FIRMWARE_BUILD_DATE);
|
||||
#endif
|
||||
|
||||
// send out initial Advertisement to the mesh
|
||||
the_mesh.sendSelfAdvertisement(16000);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
int len = strlen(command);
|
||||
while (Serial.available() && len < sizeof(command)-1) {
|
||||
char c = Serial.read();
|
||||
if (c != '\n') {
|
||||
command[len++] = c;
|
||||
command[len] = 0;
|
||||
}
|
||||
Serial.print(c);
|
||||
}
|
||||
if (len == sizeof(command)-1) { // command buffer full
|
||||
command[sizeof(command)-1] = '\r';
|
||||
}
|
||||
|
||||
if (len > 0 && command[len - 1] == '\r') { // received complete line
|
||||
command[len - 1] = 0; // replace newline with C string null terminator
|
||||
char reply[160];
|
||||
the_mesh.getCLI()->handleCommand(0, command, reply); // NOTE: there is no sender_timestamp via serial!
|
||||
if (reply[0]) {
|
||||
Serial.print(" -> "); Serial.println(reply);
|
||||
}
|
||||
|
||||
command[0] = 0; // reset command buffer
|
||||
}
|
||||
|
||||
the_mesh.loop();
|
||||
}
|
||||
@@ -0,0 +1,562 @@
|
||||
#include <Arduino.h> // needed for PlatformIO
|
||||
#include <Mesh.h>
|
||||
|
||||
#if defined(NRF52_PLATFORM)
|
||||
#include <InternalFileSystem.h>
|
||||
#elif defined(ESP32)
|
||||
#include <SPIFFS.h>
|
||||
#endif
|
||||
|
||||
#include <helpers/ArduinoHelpers.h>
|
||||
#include <helpers/StaticPoolPacketManager.h>
|
||||
#include <helpers/SimpleMeshTables.h>
|
||||
#include <helpers/IdentityStore.h>
|
||||
#include <RTClib.h>
|
||||
#include <target.h>
|
||||
|
||||
/* ---------------------------------- CONFIGURATION ------------------------------------- */
|
||||
|
||||
#define FIRMWARE_VER_TEXT "v2 (build: 4 Feb 2025)"
|
||||
|
||||
#ifndef LORA_FREQ
|
||||
#define LORA_FREQ 915.0
|
||||
#endif
|
||||
#ifndef LORA_BW
|
||||
#define LORA_BW 250
|
||||
#endif
|
||||
#ifndef LORA_SF
|
||||
#define LORA_SF 10
|
||||
#endif
|
||||
#ifndef LORA_CR
|
||||
#define LORA_CR 5
|
||||
#endif
|
||||
#ifndef LORA_TX_POWER
|
||||
#define LORA_TX_POWER 20
|
||||
#endif
|
||||
|
||||
#ifndef MAX_CONTACTS
|
||||
#define MAX_CONTACTS 100
|
||||
#endif
|
||||
|
||||
#include <helpers/BaseChatMesh.h>
|
||||
|
||||
#define SEND_TIMEOUT_BASE_MILLIS 500
|
||||
#define FLOOD_SEND_TIMEOUT_FACTOR 16.0f
|
||||
#define DIRECT_SEND_PERHOP_FACTOR 6.0f
|
||||
#define DIRECT_SEND_PERHOP_EXTRA_MILLIS 250
|
||||
|
||||
#define PUBLIC_GROUP_PSK "izOH6cXN6mrJ5e26oRXNcg=="
|
||||
|
||||
// Believe it or not, this std C function is busted on some platforms!
|
||||
static uint32_t _atoi(const char* sp) {
|
||||
uint32_t n = 0;
|
||||
while (*sp && *sp >= '0' && *sp <= '9') {
|
||||
n *= 10;
|
||||
n += (*sp++ - '0');
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------------------- */
|
||||
|
||||
struct NodePrefs { // persisted to file
|
||||
float airtime_factor;
|
||||
char node_name[32];
|
||||
double node_lat, node_lon;
|
||||
float freq;
|
||||
uint8_t tx_power_dbm;
|
||||
uint8_t unused[3];
|
||||
};
|
||||
|
||||
class MyMesh : public BaseChatMesh, ContactVisitor {
|
||||
FILESYSTEM* _fs;
|
||||
NodePrefs _prefs;
|
||||
uint32_t expected_ack_crc;
|
||||
ChannelDetails* _public;
|
||||
unsigned long last_msg_sent;
|
||||
ContactInfo* curr_recipient;
|
||||
char command[512+10];
|
||||
uint8_t tmp_buf[256];
|
||||
char hex_buf[512];
|
||||
|
||||
const char* getTypeName(uint8_t type) const {
|
||||
if (type == ADV_TYPE_CHAT) return "Chat";
|
||||
if (type == ADV_TYPE_REPEATER) return "Repeater";
|
||||
if (type == ADV_TYPE_ROOM) return "Room";
|
||||
return "??"; // unknown
|
||||
}
|
||||
|
||||
void loadContacts() {
|
||||
if (_fs->exists("/contacts")) {
|
||||
File file = _fs->open("/contacts");
|
||||
if (file) {
|
||||
bool full = false;
|
||||
while (!full) {
|
||||
ContactInfo c;
|
||||
uint8_t pub_key[32];
|
||||
uint8_t unused;
|
||||
uint32_t reserved;
|
||||
|
||||
bool success = (file.read(pub_key, 32) == 32);
|
||||
success = success && (file.read((uint8_t *) &c.name, 32) == 32);
|
||||
success = success && (file.read(&c.type, 1) == 1);
|
||||
success = success && (file.read(&c.flags, 1) == 1);
|
||||
success = success && (file.read(&unused, 1) == 1);
|
||||
success = success && (file.read((uint8_t *) &reserved, 4) == 4);
|
||||
success = success && (file.read((uint8_t *) &c.out_path_len, 1) == 1);
|
||||
success = success && (file.read((uint8_t *) &c.last_advert_timestamp, 4) == 4);
|
||||
success = success && (file.read(c.out_path, 64) == 64);
|
||||
c.gps_lat = c.gps_lon = 0; // not yet supported
|
||||
|
||||
if (!success) break; // EOF
|
||||
|
||||
c.id = mesh::Identity(pub_key);
|
||||
c.lastmod = 0;
|
||||
if (!addContact(c)) full = true;
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void saveContacts() {
|
||||
#if defined(NRF52_PLATFORM)
|
||||
File file = _fs->open("/contacts", FILE_O_WRITE);
|
||||
if (file) { file.seek(0); file.truncate(); }
|
||||
#else
|
||||
File file = _fs->open("/contacts", "w", true);
|
||||
#endif
|
||||
if (file) {
|
||||
ContactsIterator iter;
|
||||
ContactInfo c;
|
||||
uint8_t unused = 0;
|
||||
uint32_t reserved = 0;
|
||||
|
||||
while (iter.hasNext(this, c)) {
|
||||
bool success = (file.write(c.id.pub_key, 32) == 32);
|
||||
success = success && (file.write((uint8_t *) &c.name, 32) == 32);
|
||||
success = success && (file.write(&c.type, 1) == 1);
|
||||
success = success && (file.write(&c.flags, 1) == 1);
|
||||
success = success && (file.write(&unused, 1) == 1);
|
||||
success = success && (file.write((uint8_t *) &reserved, 4) == 4);
|
||||
success = success && (file.write((uint8_t *) &c.out_path_len, 1) == 1);
|
||||
success = success && (file.write((uint8_t *) &c.last_advert_timestamp, 4) == 4);
|
||||
success = success && (file.write(c.out_path, 64) == 64);
|
||||
|
||||
if (!success) break; // write failed
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void setClock(uint32_t timestamp) {
|
||||
uint32_t curr = getRTCClock()->getCurrentTime();
|
||||
if (timestamp > curr) {
|
||||
getRTCClock()->setCurrentTime(timestamp);
|
||||
Serial.println(" (OK - clock set!)");
|
||||
} else {
|
||||
Serial.println(" (ERR: clock cannot go backwards)");
|
||||
}
|
||||
}
|
||||
|
||||
void importCard(const char* command) {
|
||||
while (*command == ' ') command++; // skip leading spaces
|
||||
if (memcmp(command, "meshcore://", 11) == 0) {
|
||||
command += 11; // skip the prefix
|
||||
char *ep = strchr(command, 0); // find end of string
|
||||
while (ep > command) {
|
||||
ep--;
|
||||
if (mesh::Utils::isHexChar(*ep)) break; // found tail end of card
|
||||
*ep = 0; // remove trailing spaces and other junk
|
||||
}
|
||||
int len = strlen(command);
|
||||
if (len % 2 == 0) {
|
||||
len >>= 1; // halve, for num bytes
|
||||
if (mesh::Utils::fromHex(tmp_buf, len, command)) {
|
||||
importContact(tmp_buf, len);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
Serial.println(" error: invalid format");
|
||||
}
|
||||
|
||||
protected:
|
||||
float getAirtimeBudgetFactor() const override {
|
||||
return _prefs.airtime_factor;
|
||||
}
|
||||
|
||||
int calcRxDelay(float score, uint32_t air_time) const override {
|
||||
return 0; // disable rxdelay
|
||||
}
|
||||
|
||||
bool allowPacketForward(const mesh::Packet* packet) override {
|
||||
return true;
|
||||
}
|
||||
|
||||
void onDiscoveredContact(ContactInfo& contact, bool is_new) override {
|
||||
// TODO: if not in favs, prompt to add as fav(?)
|
||||
|
||||
Serial.printf("ADVERT from -> %s\n", contact.name);
|
||||
Serial.printf(" type: %s\n", getTypeName(contact.type));
|
||||
Serial.print(" public key: "); mesh::Utils::printHex(Serial, contact.id.pub_key, PUB_KEY_SIZE); Serial.println();
|
||||
|
||||
saveContacts();
|
||||
}
|
||||
|
||||
void onContactPathUpdated(const ContactInfo& contact) override {
|
||||
Serial.printf("PATH to: %s, path_len=%d\n", contact.name, (int32_t) contact.out_path_len);
|
||||
saveContacts();
|
||||
}
|
||||
|
||||
bool processAck(const uint8_t *data) override {
|
||||
if (memcmp(data, &expected_ack_crc, 4) == 0) { // got an ACK from recipient
|
||||
Serial.printf(" Got ACK! (round trip: %d millis)\n", _ms->getMillis() - last_msg_sent);
|
||||
// NOTE: the same ACK can be received multiple times!
|
||||
expected_ack_crc = 0; // reset our expected hash, now that we have received ACK
|
||||
return true;
|
||||
}
|
||||
|
||||
//uint32_t crc;
|
||||
//memcpy(&crc, data, 4);
|
||||
//MESH_DEBUG_PRINTLN("unknown ACK received: %08X (expected: %08X)", crc, expected_ack_crc);
|
||||
return false;
|
||||
}
|
||||
|
||||
void onMessageRecv(const ContactInfo& from, mesh::Packet* pkt, uint32_t sender_timestamp, const char *text) override {
|
||||
Serial.printf("(%s) MSG -> from %s\n", pkt->isRouteDirect() ? "DIRECT" : "FLOOD", from.name);
|
||||
Serial.printf(" %s\n", text);
|
||||
|
||||
if (strcmp(text, "clock sync") == 0) { // special text command
|
||||
setClock(sender_timestamp + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void onCommandDataRecv(const ContactInfo& from, mesh::Packet* pkt, uint32_t sender_timestamp, const char *text) override {
|
||||
}
|
||||
void onSignedMessageRecv(const ContactInfo& from, mesh::Packet* pkt, uint32_t sender_timestamp, const uint8_t *sender_prefix, const char *text) override {
|
||||
}
|
||||
|
||||
void onChannelMessageRecv(const mesh::GroupChannel& channel, mesh::Packet* pkt, uint32_t timestamp, const char *text) override {
|
||||
if (pkt->isRouteDirect()) {
|
||||
Serial.printf("PUBLIC CHANNEL MSG -> (Direct!)\n");
|
||||
} else {
|
||||
Serial.printf("PUBLIC CHANNEL MSG -> (Flood) hops %d\n", pkt->path_len);
|
||||
}
|
||||
Serial.printf(" %s\n", text);
|
||||
}
|
||||
|
||||
void onContactResponse(const ContactInfo& contact, const uint8_t* data, uint8_t len) override {
|
||||
// not supported
|
||||
}
|
||||
|
||||
uint32_t calcFloodTimeoutMillisFor(uint32_t pkt_airtime_millis) const override {
|
||||
return SEND_TIMEOUT_BASE_MILLIS + (FLOOD_SEND_TIMEOUT_FACTOR * pkt_airtime_millis);
|
||||
}
|
||||
uint32_t calcDirectTimeoutMillisFor(uint32_t pkt_airtime_millis, uint8_t path_len) const override {
|
||||
return SEND_TIMEOUT_BASE_MILLIS +
|
||||
( (pkt_airtime_millis*DIRECT_SEND_PERHOP_FACTOR + DIRECT_SEND_PERHOP_EXTRA_MILLIS) * (path_len + 1));
|
||||
}
|
||||
|
||||
void onSendTimeout() override {
|
||||
Serial.println(" ERROR: timed out, no ACK.");
|
||||
}
|
||||
|
||||
public:
|
||||
MyMesh(mesh::Radio& radio, StdRNG& rng, mesh::RTCClock& rtc, SimpleMeshTables& tables)
|
||||
: BaseChatMesh(radio, *new ArduinoMillis(), rng, rtc, *new StaticPoolPacketManager(16), tables)
|
||||
{
|
||||
// defaults
|
||||
memset(&_prefs, 0, sizeof(_prefs));
|
||||
_prefs.airtime_factor = 2.0; // one third
|
||||
strcpy(_prefs.node_name, "NONAME");
|
||||
_prefs.freq = LORA_FREQ;
|
||||
_prefs.tx_power_dbm = LORA_TX_POWER;
|
||||
|
||||
command[0] = 0;
|
||||
curr_recipient = NULL;
|
||||
}
|
||||
|
||||
float getFreqPref() const { return _prefs.freq; }
|
||||
uint8_t getTxPowerPref() const { return _prefs.tx_power_dbm; }
|
||||
|
||||
void begin(FILESYSTEM& fs) {
|
||||
_fs = &fs;
|
||||
|
||||
BaseChatMesh::begin();
|
||||
|
||||
#if defined(NRF52_PLATFORM)
|
||||
IdentityStore store(fs, "");
|
||||
#else
|
||||
IdentityStore store(fs, "/identity");
|
||||
#endif
|
||||
if (!store.load("_main", self_id, _prefs.node_name, sizeof(_prefs.node_name))) { // legacy: node_name was from identity file
|
||||
// Need way to get some entropy to seed RNG
|
||||
Serial.println("Press ENTER to generate key:");
|
||||
char c = 0;
|
||||
while (c != '\n') { // wait for ENTER to be pressed
|
||||
if (Serial.available()) c = Serial.read();
|
||||
}
|
||||
((StdRNG *)getRNG())->begin(millis());
|
||||
|
||||
self_id = mesh::LocalIdentity(getRNG()); // create new random identity
|
||||
store.save("_main", self_id);
|
||||
}
|
||||
|
||||
// load persisted prefs
|
||||
if (_fs->exists("/node_prefs")) {
|
||||
File file = _fs->open("/node_prefs");
|
||||
if (file) {
|
||||
file.read((uint8_t *) &_prefs, sizeof(_prefs));
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
loadContacts();
|
||||
_public = addChannel("Public", PUBLIC_GROUP_PSK); // pre-configure Andy's public channel
|
||||
}
|
||||
|
||||
void savePrefs() {
|
||||
#if defined(NRF52_PLATFORM)
|
||||
File file = _fs->open("/node_prefs", FILE_O_WRITE);
|
||||
if (file) { file.seek(0); file.truncate(); }
|
||||
#else
|
||||
File file = _fs->open("/node_prefs", "w", true);
|
||||
#endif
|
||||
if (file) {
|
||||
file.write((const uint8_t *)&_prefs, sizeof(_prefs));
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void showWelcome() {
|
||||
Serial.println("===== MeshCore Chat Terminal =====");
|
||||
Serial.println();
|
||||
Serial.printf("WELCOME %s\n", _prefs.node_name);
|
||||
mesh::Utils::printHex(Serial, self_id.pub_key, PUB_KEY_SIZE);
|
||||
Serial.println();
|
||||
Serial.println(" (enter 'help' for basic commands)");
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
void sendSelfAdvert(int delay_millis) {
|
||||
auto pkt = createSelfAdvert(_prefs.node_name, _prefs.node_lat, _prefs.node_lon);
|
||||
if (pkt) {
|
||||
sendFlood(pkt, delay_millis);
|
||||
}
|
||||
}
|
||||
|
||||
// ContactVisitor
|
||||
void onContactVisit(const ContactInfo& contact) override {
|
||||
Serial.printf(" %s - ", contact.name);
|
||||
char tmp[40];
|
||||
int32_t secs = contact.last_advert_timestamp - getRTCClock()->getCurrentTime();
|
||||
AdvertTimeHelper::formatRelativeTimeDiff(tmp, secs, false);
|
||||
Serial.println(tmp);
|
||||
}
|
||||
|
||||
void handleCommand(const char* command) {
|
||||
while (*command == ' ') command++; // skip leading spaces
|
||||
|
||||
if (memcmp(command, "send ", 5) == 0) {
|
||||
if (curr_recipient) {
|
||||
const char *text = &command[5];
|
||||
uint32_t est_timeout;
|
||||
|
||||
int result = sendMessage(*curr_recipient, getRTCClock()->getCurrentTime(), 0, text, expected_ack_crc, est_timeout);
|
||||
if (result == MSG_SEND_FAILED) {
|
||||
Serial.println(" ERROR: unable to send.");
|
||||
} else {
|
||||
last_msg_sent = _ms->getMillis();
|
||||
Serial.printf(" (message sent - %s)\n", result == MSG_SEND_SENT_FLOOD ? "FLOOD" : "DIRECT");
|
||||
}
|
||||
} else {
|
||||
Serial.println(" ERROR: no recipient selected (use 'to' cmd).");
|
||||
}
|
||||
} else if (memcmp(command, "public ", 7) == 0) { // send GroupChannel msg
|
||||
uint8_t temp[5+MAX_TEXT_LEN+32];
|
||||
uint32_t timestamp = getRTCClock()->getCurrentTime();
|
||||
memcpy(temp, ×tamp, 4); // mostly an extra blob to help make packet_hash unique
|
||||
temp[4] = 0; // attempt and flags
|
||||
|
||||
sprintf((char *) &temp[5], "%s: %s", _prefs.node_name, &command[7]); // <sender>: <msg>
|
||||
temp[5 + MAX_TEXT_LEN] = 0; // truncate if too long
|
||||
|
||||
int len = strlen((char *) &temp[5]);
|
||||
auto pkt = createGroupDatagram(PAYLOAD_TYPE_GRP_TXT, _public->channel, temp, 5 + len);
|
||||
if (pkt) {
|
||||
sendFlood(pkt);
|
||||
Serial.println(" Sent.");
|
||||
} else {
|
||||
Serial.println(" ERROR: unable to send");
|
||||
}
|
||||
} else if (memcmp(command, "list", 4) == 0) { // show Contact list, by most recent
|
||||
int n = 0;
|
||||
if (command[4] == ' ') { // optional param, last 'N'
|
||||
n = atoi(&command[5]);
|
||||
}
|
||||
scanRecentContacts(n, this);
|
||||
} else if (strcmp(command, "clock") == 0) { // show current time
|
||||
uint32_t now = getRTCClock()->getCurrentTime();
|
||||
DateTime dt = DateTime(now);
|
||||
Serial.printf( "%02d:%02d - %d/%d/%d UTC\n", dt.hour(), dt.minute(), dt.day(), dt.month(), dt.year());
|
||||
} else if (memcmp(command, "time ", 5) == 0) { // set time (to epoch seconds)
|
||||
uint32_t secs = _atoi(&command[5]);
|
||||
setClock(secs);
|
||||
} else if (memcmp(command, "to ", 3) == 0) { // set current recipient
|
||||
curr_recipient = searchContactsByPrefix(&command[3]);
|
||||
if (curr_recipient) {
|
||||
Serial.printf(" Recipient %s now selected.\n", curr_recipient->name);
|
||||
} else {
|
||||
Serial.println(" Error: Name prefix not found.");
|
||||
}
|
||||
} else if (strcmp(command, "to") == 0) { // show current recipient
|
||||
if (curr_recipient) {
|
||||
Serial.printf(" Current: %s\n", curr_recipient->name);
|
||||
} else {
|
||||
Serial.println(" Err: no recipient selected");
|
||||
}
|
||||
} else if (strcmp(command, "advert") == 0) {
|
||||
auto pkt = createSelfAdvert(_prefs.node_name, _prefs.node_lat, _prefs.node_lon);
|
||||
if (pkt) {
|
||||
sendZeroHop(pkt);
|
||||
Serial.println(" (advert sent, zero hop).");
|
||||
} else {
|
||||
Serial.println(" ERR: unable to send");
|
||||
}
|
||||
} else if (strcmp(command, "reset path") == 0) {
|
||||
if (curr_recipient) {
|
||||
resetPathTo(*curr_recipient);
|
||||
saveContacts();
|
||||
Serial.println(" Done.");
|
||||
}
|
||||
} else if (memcmp(command, "card", 4) == 0) {
|
||||
Serial.printf("Hello %s\n", _prefs.node_name);
|
||||
auto pkt = createSelfAdvert(_prefs.node_name, _prefs.node_lat, _prefs.node_lon);
|
||||
if (pkt) {
|
||||
uint8_t len = pkt->writeTo(tmp_buf);
|
||||
releasePacket(pkt); // undo the obtainNewPacket()
|
||||
|
||||
mesh::Utils::toHex(hex_buf, tmp_buf, len);
|
||||
Serial.println("Your MeshCore biz card:");
|
||||
Serial.print("meshcore://"); Serial.println(hex_buf);
|
||||
Serial.println();
|
||||
} else {
|
||||
Serial.println(" Error");
|
||||
}
|
||||
} else if (memcmp(command, "import ", 7) == 0) {
|
||||
importCard(&command[7]);
|
||||
} else if (memcmp(command, "set ", 4) == 0) {
|
||||
const char* config = &command[4];
|
||||
if (memcmp(config, "af ", 3) == 0) {
|
||||
_prefs.airtime_factor = atof(&config[3]);
|
||||
savePrefs();
|
||||
Serial.println(" OK");
|
||||
} else if (memcmp(config, "name ", 5) == 0) {
|
||||
StrHelper::strncpy(_prefs.node_name, &config[5], sizeof(_prefs.node_name));
|
||||
savePrefs();
|
||||
Serial.println(" OK");
|
||||
} else if (memcmp(config, "lat ", 4) == 0) {
|
||||
_prefs.node_lat = atof(&config[4]);
|
||||
savePrefs();
|
||||
Serial.println(" OK");
|
||||
} else if (memcmp(config, "lon ", 4) == 0) {
|
||||
_prefs.node_lon = atof(&config[4]);
|
||||
savePrefs();
|
||||
Serial.println(" OK");
|
||||
} else if (memcmp(config, "tx ", 3) == 0) {
|
||||
_prefs.tx_power_dbm = atoi(&config[3]);
|
||||
savePrefs();
|
||||
Serial.println(" OK - reboot to apply");
|
||||
} else if (memcmp(config, "freq ", 5) == 0) {
|
||||
_prefs.freq = atof(&config[5]);
|
||||
savePrefs();
|
||||
Serial.println(" OK - reboot to apply");
|
||||
} else {
|
||||
Serial.printf(" ERROR: unknown config: %s\n", config);
|
||||
}
|
||||
} else if (memcmp(command, "ver", 3) == 0) {
|
||||
Serial.println(FIRMWARE_VER_TEXT);
|
||||
} else if (memcmp(command, "help", 4) == 0) {
|
||||
Serial.println("Commands:");
|
||||
Serial.println(" set {name|lat|lon|freq|tx|af} {value}");
|
||||
Serial.println(" card");
|
||||
Serial.println(" import {biz card}");
|
||||
Serial.println(" clock");
|
||||
Serial.println(" time <epoch-seconds>");
|
||||
Serial.println(" list {n}");
|
||||
Serial.println(" to <recipient name or prefix>");
|
||||
Serial.println(" to");
|
||||
Serial.println(" send <text>");
|
||||
Serial.println(" advert");
|
||||
Serial.println(" reset path");
|
||||
Serial.println(" public <text>");
|
||||
} else {
|
||||
Serial.print(" ERROR: unknown command: "); Serial.println(command);
|
||||
}
|
||||
}
|
||||
|
||||
void loop() {
|
||||
BaseChatMesh::loop();
|
||||
|
||||
int len = strlen(command);
|
||||
while (Serial.available() && len < sizeof(command)-1) {
|
||||
char c = Serial.read();
|
||||
if (c != '\n') {
|
||||
command[len++] = c;
|
||||
command[len] = 0;
|
||||
}
|
||||
Serial.print(c);
|
||||
}
|
||||
if (len == sizeof(command)-1) { // command buffer full
|
||||
command[sizeof(command)-1] = '\r';
|
||||
}
|
||||
|
||||
if (len > 0 && command[len - 1] == '\r') { // received complete line
|
||||
command[len - 1] = 0; // replace newline with C string null terminator
|
||||
|
||||
handleCommand(command);
|
||||
command[0] = 0; // reset command buffer
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
StdRNG fast_rng;
|
||||
SimpleMeshTables tables;
|
||||
MyMesh the_mesh(radio_driver, fast_rng, *new VolatileRTCClock(), tables); // TODO: test with 'rtc_clock' in target.cpp
|
||||
|
||||
void halt() {
|
||||
while (1) ;
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
board.begin();
|
||||
|
||||
if (!radio_init()) { halt(); }
|
||||
|
||||
fast_rng.begin(radio_get_rng_seed());
|
||||
|
||||
#if defined(NRF52_PLATFORM)
|
||||
InternalFS.begin();
|
||||
the_mesh.begin(InternalFS);
|
||||
#elif defined(ESP32)
|
||||
SPIFFS.begin(true);
|
||||
the_mesh.begin(SPIFFS);
|
||||
#else
|
||||
#error "need to define filesystem"
|
||||
#endif
|
||||
|
||||
radio_set_params(the_mesh.getFreqPref(), LORA_BW, LORA_SF, LORA_CR);
|
||||
radio_set_tx_power(the_mesh.getTxPowerPref());
|
||||
|
||||
the_mesh.showWelcome();
|
||||
|
||||
// send out initial Advertisement to the mesh
|
||||
the_mesh.sendSelfAdvert(1200); // add slight delay
|
||||
}
|
||||
|
||||
void loop() {
|
||||
the_mesh.loop();
|
||||
}
|
||||
-1338
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,39 @@
|
||||
|
||||
This directory is intended for project header files.
|
||||
|
||||
A header file is a file containing C declarations and macro definitions
|
||||
to be shared between several project source files. You request the use of a
|
||||
header file in your project source file (C, C++, etc) located in `src` folder
|
||||
by including it, with the C preprocessing directive `#include'.
|
||||
|
||||
```src/main.c
|
||||
|
||||
#include "header.h"
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Including a header file produces the same results as copying the header file
|
||||
into each source file that needs it. Such copying would be time-consuming
|
||||
and error-prone. With a header file, the related declarations appear
|
||||
in only one place. If they need to be changed, they can be changed in one
|
||||
place, and programs that include the header file will automatically use the
|
||||
new version when next recompiled. The header file eliminates the labor of
|
||||
finding and changing all the copies as well as the risk that a failure to
|
||||
find one copy will result in inconsistencies within a program.
|
||||
|
||||
In C, the usual convention is to give header files names that end with `.h'.
|
||||
It is most portable to use only letters, digits, dashes, and underscores in
|
||||
header file names, and at most one dot.
|
||||
|
||||
Read more about using header files in official GCC documentation:
|
||||
|
||||
* Include Syntax
|
||||
* Include Operation
|
||||
* Once-Only Headers
|
||||
* Computed Includes
|
||||
|
||||
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
|
||||
-894
@@ -1,894 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<meta name="generator" content="mkdocs-1.6.1, mkdocs-terminal-4.8.0">
|
||||
|
||||
<meta name="description" content="MeshCore fork meshcore-tth -- repeater antispam, diagnostics, OTA, Czech mesh defaults">
|
||||
|
||||
|
||||
<link rel="canonical" href="https://tth-pub.pages.rfa.cz/meshcore-tth/"><link rel="icon" type="image/png" sizes="192x192" href="img/android-chrome-192x192.png" />
|
||||
<link rel="icon" type="image/png" sizes="512x512" href="img/android-chrome-512x512.png" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="img/apple-touch-icon.png" />
|
||||
<link rel="shortcut icon" type="image/png" sizes="48x48" href="img/favicon.ico" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="img/favicon-16x16.png" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon-32x32.png" />
|
||||
|
||||
|
||||
|
||||
|
||||
<title>About the fork - MeshCore TTH</title>
|
||||
|
||||
|
||||
<link href="css/fontawesome/css/fontawesome.min.css" rel="stylesheet">
|
||||
<link href="css/fontawesome/css/solid.min.css" rel="stylesheet">
|
||||
<link href="css/normalize.css" rel="stylesheet">
|
||||
<link href="css/terminal.css" rel="stylesheet">
|
||||
<link href="css/theme.css" rel="stylesheet">
|
||||
<link href="css/theme.tile_grid.css" rel="stylesheet">
|
||||
<link href="css/theme.footer.css" rel="stylesheet">
|
||||
<!-- dark color palette -->
|
||||
<link href="css/palettes/dark.css" rel="stylesheet">
|
||||
|
||||
<!-- page layout -->
|
||||
<style>
|
||||
/* initially set page layout to a one column grid */
|
||||
.terminal-mkdocs-main-grid {
|
||||
display: grid;
|
||||
grid-column-gap: 1.4em;
|
||||
grid-template-columns: auto;
|
||||
grid-template-rows: auto;
|
||||
}
|
||||
|
||||
/*
|
||||
* when side navigation is not hidden, use a two column grid.
|
||||
* if the screen is too narrow, fall back to the initial one column grid layout.
|
||||
* in this case the main content will be placed under the navigation panel.
|
||||
*/
|
||||
@media only screen and (min-width: 70em) {
|
||||
.terminal-mkdocs-main-grid {
|
||||
grid-template-columns: 4fr 9fr;
|
||||
}
|
||||
}</style>
|
||||
|
||||
<!-- cursor_animation override -->
|
||||
<style>
|
||||
#mkdocs-terminal-site-name.terminal-prompt::after {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<link href="_stylesheets/tth.css" rel="stylesheet">
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- search css support -->
|
||||
<link href="css/search/bootstrap-modal.css" rel="stylesheet">
|
||||
<!-- search scripts -->
|
||||
<script>
|
||||
var base_url = ".",
|
||||
shortcuts = "{}";
|
||||
</script>
|
||||
<script src="js/jquery/jquery-1.10.1.min.js" defer></script>
|
||||
<script src="js/bootstrap/bootstrap.min.js" defer></script>
|
||||
<script src="js/mkdocs/base.js" defer></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="search/main.js"></script>
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body class="terminal"><div class="container">
|
||||
<div class="terminal-nav">
|
||||
<header class="terminal-logo">
|
||||
<div id="mkdocs-terminal-site-name" class="logo terminal-prompt"><a href="https://tth-pub.pages.rfa.cz/meshcore-tth/" class="no-style">MeshCore TTH</a></div>
|
||||
</header>
|
||||
|
||||
<nav class="terminal-menu">
|
||||
|
||||
<ul vocab="https://schema.org/" typeof="BreadcrumbList">
|
||||
|
||||
|
||||
<li property="itemListElement" typeof="ListItem">
|
||||
<a href="." class="menu-item active" property="item" typeof="WebPage">
|
||||
<span property="name">About the fork</span>
|
||||
</a>
|
||||
<meta property="position" content="0">
|
||||
</li>
|
||||
|
||||
|
||||
<li property="itemListElement" typeof="ListItem">
|
||||
<a href="cs/" class="menu-item " property="item" typeof="WebPage">
|
||||
<span property="name">Česky</span>
|
||||
</a>
|
||||
<meta property="position" content="1">
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li property="itemListElement" typeof="ListItem">
|
||||
<a href="#" class="menu-item" data-toggle="modal" data-target="#mkdocs_search_modal" property="item" typeof="SearchAction">
|
||||
<i aria-hidden="true" class="fa fa-search"></i> <span property="name">Search</span>
|
||||
</a>
|
||||
<meta property="position" content="2">
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="terminal-mkdocs-main-grid"><aside id="terminal-mkdocs-side-panel"><nav>
|
||||
<ul class="terminal-mkdocs-side-nav-items">
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li">
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="terminal-mkdocs-side-nav-item--active">About the fork</span>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="cs/">Česky</a>
|
||||
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="
|
||||
|
||||
|
||||
|
||||
terminal-mkdocs-side-nav-item terminal-mkdocs-side-nav-section-no-index">Fork meshcore-tth</span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="terminal-mkdocs-side-nav-li-ul">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="tth-commands/">Console commands</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="ota/">Firmware update by the admin (OTA)</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="power/">Power saving</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="budka-sensor/">Budka as a sensor</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="ble-lora-coexistence/">BLE/LoRa coexistence</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="
|
||||
|
||||
|
||||
|
||||
terminal-mkdocs-side-nav-item terminal-mkdocs-side-nav-section-no-index">MeshCore (upstream)</span>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="terminal-mkdocs-side-nav-li-ul">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="meshcore/">Introduction</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="faq/">FAQ</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="cli_commands/">CLI commands</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="companion_cli/">Companion CLI</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="companion_protocol/">Companion protocol</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="terminal_chat_cli/">Terminal chat CLI</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="kiss_modem_protocol/">KISS modem protocol</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="packet_format/">Packet format</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="payloads/">Payloads</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="stats_binary_frames/">Stats binary frames</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="number_allocations/">Number allocations</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="qr_codes/">QR codes</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="radio_presets/">Radio presets</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="terminal-mkdocs-side-nav-li-ul-li">
|
||||
|
||||
|
||||
|
||||
<a class="terminal-mkdocs-side-nav-item" href="nrf52_power_management/">nRF52 power management</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav><hr>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="#about-this-fork-meshcore-tth">About this fork (meshcore-tth)</a></li>
|
||||
<li><a href="#repeater-antispam-all-of-it-off-switchable-none-of-it-upstream">Repeater: antispam (all of it off-switchable, none of it upstream)</a></li><li><a href="#diagnostics-and-operations">Diagnostics and operations</a></li><li><a href="#core-fixes">Core fixes</a></li><li><a href="#power-clock-gps">Power, clock, GPS</a></li><li><a href="#sensors-and-companions">Sensors and companions</a></li><li><a href="#public-builds-czech-mesh-defaults">Public builds: Czech mesh defaults</a></li><li><a href="#flashing-a-release">Flashing a release</a></li><li><a href="#experimental-firmware-update-pushed-by-the-admin-ota">Experimental: firmware update pushed by the admin (*-ota)</a></li><li><a href="#build">Build</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</aside>
|
||||
<main id="terminal-mkdocs-main-content">
|
||||
<section id="mkdocs-terminal-content">
|
||||
<h1 id="about-this-fork-meshcore-tth">About this fork (meshcore-tth)</h1>
|
||||
<p><em><a href="cs/">Česká verze</a>.</em></p>
|
||||
<div class="admonition warning">
|
||||
<p class="admonition-title">Warning</p>
|
||||
<p><strong>Experimental firmware -- not meant for regular users.</strong> This fork and all
|
||||
its releases are a personal development branch for the nodes of one small
|
||||
network: a rolling release on upstream <code>dev</code>, built automatically about
|
||||
twice a day, with no stable channel, no support, and tried only on our own
|
||||
boards. It may carry bugs that take a node out of service, and getting one
|
||||
back then needs USB or BLE in hand. For everyday use flash the official
|
||||
MeshCore (<a href="https://flasher.meshcore.io">flasher.meshcore.io</a>).</p>
|
||||
</div>
|
||||
<p>A fork of <a href="https://github.com/meshcore-dev/MeshCore">meshcore-dev/MeshCore</a>
|
||||
that runs the repeaters, sensors and bench boards of a small Czech network on
|
||||
the CZ mesh (869.432 MHz). Upstream <code>main</code> and <code>dev</code> are merged automatically
|
||||
twice a day; everything below is on top of that. Our code is marked
|
||||
<code>CUSTOM (TeTeHacko)</code> in the source. Nothing here changes the wire protocol.</p>
|
||||
<h2 id="repeater-antispam-all-of-it-off-switchable-none-of-it-upstream">Repeater: antispam (all of it off-switchable, none of it upstream)</h2>
|
||||
<p><strong>After flashing only the FairnessLimiter is on</strong>, with limits about twice
|
||||
above 30 days of real CZ mesh traffic: per channel a burst of 100 messages,
|
||||
then one per 30 s; per sender 150 and one per 10 s; per advert origin 30 and
|
||||
one per 10 min. It is a net for runaway floods, not a quota; <code>fairness off</code>
|
||||
switches it off for good. The advert window, the filters and dry-run stay
|
||||
off until you turn them on.</p>
|
||||
<ul>
|
||||
<li><strong>FairnessLimiter</strong> -- token buckets on forwarded floods, keyed on the 1-byte
|
||||
ids already in the clear (channel hash, sender hash, advert origin). Port of
|
||||
Beanow's proposal <a href="https://github.com/meshcore-dev/MeshCore/pull/1502">#1502</a>,
|
||||
limits re-sized from 30 days of real CZ traffic.
|
||||
<code>fairness [on|off|grid|cap|refill]</code>; direct-routed traffic is never limited.</li>
|
||||
<li><strong>Per-origin advert window</strong> -- each node's flood advert forwarded at most
|
||||
once per N hours (<code>fairness advert <h>|clear</code>), ported from
|
||||
<a href="https://github.com/Dutch-MeshCore/MeshCore">DutchMeshCore</a>'s AdvertLimiter.
|
||||
Aimed at nodes that re-advertise every minute.</li>
|
||||
<li><strong>Dry-run</strong> -- <code>fairness dryrun on</code> counts every verdict but forwards anyway;
|
||||
<code>fairness air</code> reports the airtime shed (or that would be) per reason.</li>
|
||||
<li><strong>Channel filter</strong> -- on channels whose key the repeater knows (Public and
|
||||
<code>#hashtag</code> channels), stop forwarding messages of listed sender names
|
||||
(<code>filter add|del|list</code>). Names are spoofable: it contains a runaway bot,
|
||||
it is not security.</li>
|
||||
<li><strong>Channel-hash deny-forward</strong> -- <code>filter hash add <hex> [secs]</code>: keyless,
|
||||
works on private channels too; reception is unaffected, only forwarding.
|
||||
With <code>secs</code> the channel is throttled (one packet per <code>secs</code>) instead of cut.</li>
|
||||
<li><strong>Message age limit</strong> -- <code>filter age <min>|off</code> (opt-in, 1-10080 min): do not
|
||||
forward group texts on the decrypted channels whose sender timestamp is
|
||||
older; inactive while the repeater clock is unset. It judges the sender's
|
||||
clock, so companions without a time sync are dropped too -- keep it in days.</li>
|
||||
<li><code>filter dryrun on</code> counts every <code>filter</code> verdict but forwards anyway.</li>
|
||||
</ul>
|
||||
<h2 id="diagnostics-and-operations">Diagnostics and operations</h2>
|
||||
<p>Every command of the fork, which builds have it and the defaults:
|
||||
<a href="https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/tth-commands.md">docs/tth-commands.md</a>.</p>
|
||||
<p>Repeater, room server and sensor (everything with a text console) have:</p>
|
||||
<ul>
|
||||
<li><strong>Radio watchdogs.</strong> The hardware watchdog only catches a frozen loop; two
|
||||
of our nodes were found deaf with the loop running, and only a reboot
|
||||
helped.</li>
|
||||
<li><code>set radio.silence <min></code> -- <strong>deaf receiver</strong>: when the received-frame
|
||||
counter does not move for <code><min></code> minutes (a frame with a CRC error
|
||||
counts), the node re-arms its receiver first and reboots if that does not
|
||||
help either. Each such reboot doubles the threshold for the next boot (up
|
||||
to 16x) and the first frame received resets it, so a quiet site does not
|
||||
end in a reboot loop. Saved; <strong>off by default</strong> (<code>0</code>) -- pick a threshold
|
||||
well above the longest normal quiet spell of the site.</li>
|
||||
<li><strong>Stalled TX</strong> (repeater only): packets wait in the queue and the sent
|
||||
counter does not move -> re-arm the radio, then reboot. An empty queue
|
||||
never counts. <strong>On, 15 min</strong> (<code>RADIO_TXSTALL_MIN</code>); <code>set radio.txstall
|
||||
<min>|off</code> holds until the next reboot.</li>
|
||||
<li><code>get radio.reboots</code> -- reboots done by the watchdogs (survives power
|
||||
loss); <code>get boot</code> -- why the board last reset, and the hardfault record
|
||||
(also printed at boot).</li>
|
||||
<li><code>dfu [uf2|serial|ota]</code> -- a deterministic reboot into the bootloader (local
|
||||
console only); <code>i2c</code> -- bus scan.</li>
|
||||
</ul>
|
||||
<p>The repeater also has:</p>
|
||||
<ul>
|
||||
<li><code>blink</code> (flashes the LED, also over the mesh -- finds a node on a mast),
|
||||
<code>txpwr</code> (TX power until reboot, with RadioLib's verdict), TX-failure
|
||||
counters in the status reply.</li>
|
||||
<li>Observer variants only (<code>*-observer</code>): text console over BLE next to USB,
|
||||
<code>ble on|off</code> saved across reboots (<code>RPT_BLE_DEFAULT_OFF</code>: starts off), own
|
||||
BLE PIN (<code>ble pin</code>), persisted connection TX power (<code>blepwr</code>), <code>bleconn</code>, a
|
||||
non-blocking BLE TX pump and connection parameters that hold on a weak
|
||||
link.</li>
|
||||
<li>Also observer variants only: a passive analyzer in the console --
|
||||
<code>nodes</code> (heard repeaters/rooms, multi-path join key), <code>rxlog</code> (every frame
|
||||
heard, type/path/SNR/RSSI), <code>pktlog</code> (raw frames for an observer feed), big
|
||||
paged replies.</li>
|
||||
<li>Own builds only, not in the releases:</li>
|
||||
<li>channel bot (<code>BOT_CHANNEL_PSK</code>: <code>!link</code>, <code>!path</code>, <code>!snr</code>, <code>!heard</code>,
|
||||
<code>!noise</code>, <code>!ping</code>, <code>!help</code>, narrowed by <code>BOT_COMMANDS</code>, per-sender
|
||||
cooldown, ignore list) -- answers without repeating;</li>
|
||||
<li><code>RADIO_DIAG</code>: <code>radiostat</code> (SX1262 receiver state, hands off) and
|
||||
<code>radiokick rx|clrirq|standby|agc</code> (one recovery step at a time, gentlest
|
||||
first -- the first that helps names the broken layer);</li>
|
||||
<li><code>PIN_DIAG</code>: <code>dio1</code> (the chip's IRQ status against the level on the pin --
|
||||
which end of a dead DIO1 line is broken);</li>
|
||||
<li><code>LORA_POLL_IRQ</code>: DIO1-less operation for a board with a dead IRQ line.</li>
|
||||
</ul>
|
||||
<h2 id="core-fixes">Core fixes</h2>
|
||||
<ul>
|
||||
<li><strong>Replay protection of admin commands survives a reboot.</strong> Upstream keeps a
|
||||
client's last timestamp in RAM only, so after every restart any captured
|
||||
command is accepted again -- a captured <code>reboot</code> reboots the node forever.
|
||||
Repeater, room server and sensor now write it to flash before acting on the
|
||||
command (<code>/s_acl_ts0|1</code>, alternating with a checksum, so a power cut mid-write
|
||||
does not lose it). A timestamp more than a day ahead of the node's clock
|
||||
(<code>ACL_TS_MAX_AHEAD</code>) is accepted but not stored, so a companion with a runaway
|
||||
clock cannot lock its admin out. Only admins are stored: a guest can only
|
||||
read, and with the empty guest password anybody is one, so its every
|
||||
request would be a flash write. Nothing changes for clients.</li>
|
||||
<li><strong>Passwords can no longer be guessed over the air at full speed.</strong> Upstream
|
||||
checks every login without a limit and does not even answer a wrong one.
|
||||
After 4 wrong passwords within 3 minutes (<code>LOGIN_FAIL_MAX</code>,
|
||||
<code>LOGIN_FAIL_SECS</code>) no password is checked until the window ends. A client
|
||||
that is already an admin in the ACL always gets through -- nobody else can
|
||||
send a login in its name, so the attack cannot lock the admins out.</li>
|
||||
<li><strong>A replayed blank-password login no longer floods a reply.</strong> A login from a
|
||||
client in the ACL with an empty password had no replay check; replayed, it
|
||||
gained nothing, but every copy made the node flood its reply over the mesh.</li>
|
||||
<li>TRACE no longer appends its path past the end of the payload; TRACE/PATH
|
||||
parsing and <code>Packet::readFrom</code> are bounds-checked.</li>
|
||||
<li><code>markSeen</code> is idempotent again (the send path was eating the dedup window).</li>
|
||||
<li><code>calcMaxPacketMillis</code> fallback no longer underflows (a node went deaf on it).</li>
|
||||
<li>Path-hash width comes from the node's prefs on every TX path, including
|
||||
<code>sendZeroHop</code>; 2-byte path hashes are the default (<code>PATH_HASH_MODE_DEFAULT</code>).</li>
|
||||
<li>Failed transmits are re-queued with backoff instead of dropped.</li>
|
||||
<li>Per-packet RSSI captured at RX; <code>ContactInfo</code> zeroed before a partial fill.</li>
|
||||
</ul>
|
||||
<h2 id="power-clock-gps">Power, clock, GPS</h2>
|
||||
<ul>
|
||||
<li>GPS duty cycle (<code>gps duty</code>), also on the T1000-E, which had none: the
|
||||
receiver runs only around a clock sync (once a day, after a window without
|
||||
a fix again in 6 h). A position request warms it for the next request.</li>
|
||||
<li>A node without GPS starts at its build epoch, not in 2024; the clock and a
|
||||
hardfault record survive a warm reset (<code>.noinit</code>); <code>clkreboot</code>.</li>
|
||||
<li>No blinking LED and slower BLE advertising on solar nodes.</li>
|
||||
<li>Battery level as an icon at the end of the advertised name: <code>set batt.icon
|
||||
on</code>, thresholds <code>set batt.icon.lo|hi <mV></code> (off by default; a long name has
|
||||
no room for it and the command says so).</li>
|
||||
<li>Optional RX duty cycle (<code>set radio.rxps off|on|balanced|max</code>, finer
|
||||
<code>level <1-10></code>; ported from EasySkyMesh PowerSaving): the SX1262 sleeps
|
||||
between short listening windows. Built into the public releases and
|
||||
<strong>off</strong>; <code>max</code> saved ~2.3 mA on the bench with no packet loss
|
||||
(<a href="https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/power.md">docs/power.md</a>), but on the live mesh one of our masts lost
|
||||
16 % of its reception -- switch it on with care. SX1262 only, not the LR1110
|
||||
(T1000-E).</li>
|
||||
<li>The nRF52 boot undervoltage lock (<code>PWRMGT_VOLTAGE_BOOTLOCK</code>) is <strong>off</strong>,
|
||||
as in upstream since v1.18.0
|
||||
(<a href="https://github.com/meshcore-dev/MeshCore/pull/2377">#2377</a>): its fixed
|
||||
3.3 V threshold kept LiFePO4 and LTO nodes from booting. The firmware boots
|
||||
on any cell chemistry; deep-discharge protection is up to the BMS or the
|
||||
cell's protection board. A configurable, chemistry-aware lock is waiting
|
||||
for upstream (<a href="https://github.com/meshcore-dev/MeshCore/pull/2088">#2088</a>). The exception
|
||||
is <code>SenseCap_Solar_repeater</code> (Li-ion, our masts): the lock is on and both
|
||||
thresholds are settable at runtime, also as an admin over the mesh --
|
||||
<code>set pwr.bootlock <mV>|off</code> (default 3300; below it the node does not start
|
||||
and sleeps until the cell recovers) and <code>set pwr.cutoff <mV>|off</code> (default
|
||||
off; below it a running node switches off); <code>get pwr</code>
|
||||
(<a href="https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/power.md">docs/power.md</a>).</li>
|
||||
</ul>
|
||||
<h2 id="sensors-and-companions">Sensors and companions</h2>
|
||||
<ul>
|
||||
<li><code>simple_sensor</code>: telemetry from an external station over UART
|
||||
(<code>BudkaLinkSensorManager</code>, one LPP channel per meter), <code>sensor read</code>.</li>
|
||||
<li>Sensors that would otherwise convert continuously (INA219, INA226, INA260,
|
||||
INA3221, BMP280) sleep between telemetry reads and measure on demand (idea
|
||||
and first INA219 patch: Alkel Brostl). INA chips are told apart by their ID,
|
||||
so an INA226 is no longer taken for an INA219. The shunt is set at runtime
|
||||
and saved: <code>sensor set ina.shunt <mOhm></code>.</li>
|
||||
<li>Companion: <code>gps duty</code> persists, bounded build-date copy. Private key
|
||||
export, reading the BLE PIN and changing it (CLI <code>set pin</code> included) work
|
||||
only over paired BLE, never over USB, a UART or WiFi/TCP, and the reply that
|
||||
carries the key or PIN goes back only where the request came from. (The
|
||||
v1.17 merge had silently disabled that gate; a build without BLE still
|
||||
trusts its one transport.) KISS modem: off-by-one in the name clamp.</li>
|
||||
</ul>
|
||||
<h2 id="public-builds-czech-mesh-defaults">Public builds: Czech mesh defaults</h2>
|
||||
<p>Releases built from this repository (<code>pub-release</code>) come preset for the
|
||||
Czech mesh, following the <a href="https://meshcore.cz/">meshcore.cz</a> wiki, so a
|
||||
freshly flashed node does not need the usual round of settings:</p>
|
||||
<ul>
|
||||
<li>radio 869.432 MHz / 62.5 kHz / SF7 / CR5 (all builds);</li>
|
||||
<li>repeater and room server: zero-hop advert off, flood advert every 25 h,
|
||||
10 % duty cycle (<code>get dutycycle</code> → <code>10.0%</code>; the deprecated <code>af</code> reads 9);</li>
|
||||
<li>repeater: regions <code>cz</code> and <code>cs</code> next to <code>*</code> -- add your own <code>cz-<kraj></code>
|
||||
with <code>region put cz-xxx cz</code> + <code>region save</code>;</li>
|
||||
<li>2-byte path hashes (this fork's default);</li>
|
||||
<li>repeater: the channel filter (<code>filter add <name></code>) is built in for Public,
|
||||
<code>#meshcore</code> and <code>#test</code>, with an empty list -- it does nothing until you
|
||||
add a name.</li>
|
||||
</ul>
|
||||
<p>They apply only to a node with no saved settings (new, or after an erase):
|
||||
a reflash keeps whatever the node already has, and regions you removed and
|
||||
saved stay removed. Set a name and an admin password yourself.</p>
|
||||
<p><strong>The companion's BLE PIN is the public <code>123456</code></strong> (boards with a display
|
||||
draw their own and show it). Whoever pairs with it owns the companion:
|
||||
messages, contacts, private key export. So change it in the app after the
|
||||
first pairing. And with the board in hand neither the PIN nor a password
|
||||
protects anything: the flash is not locked and the bootloader takes any
|
||||
firmware. Treat a lost or stolen node as compromised -- for a repeater,
|
||||
change the admin password wherever it was the same and drop its key from
|
||||
ACLs; for a companion, treat the channels it held as known.</p>
|
||||
<p>Observer variants (<code>*_repeater-observer-*</code>) of the nRF52 repeaters (XIAO,
|
||||
SenseCAP Solar, RAK4631, T1000-E, Heltec T114) add the <code>nodes</code> / <code>rxlog</code> /
|
||||
<code>pktlog</code> rings and a text console over BLE, for reading the repeater over
|
||||
USB or BLE (<a href="https://git.rfa.cz/tth-pub/meshcore-repeater-observer">meshcore-repeater-observer</a>).
|
||||
The BLE console is <strong>off</strong> after flashing (<code>RPT_BLE_DEFAULT_OFF</code>). It has no
|
||||
login of its own, only the BLE PIN, and the build's PIN is the public
|
||||
placeholder <code>123456</code>. So first set your own -- in the USB console, or as
|
||||
admin over the mesh (remote CLI in the app): <code>ble pin <6 digits></code> (saved, survives a reboot and a reflash; it also drops
|
||||
every existing bond, so paired devices pair again). Only then <code>ble on</code> --
|
||||
these builds refuse it while the PIN is still the placeholder. <code>ble</code> shows
|
||||
whether the PIN is <code>own</code> or <code>build default</code>, never the PIN itself. Releases
|
||||
up to <code>tth-654d53f3</code> do not have <code>ble pin</code>: keep BLE off there and use USB.</p>
|
||||
<h2 id="flashing-a-release">Flashing a release</h2>
|
||||
<p>Every release is an automatic build on upstream <code>dev</code> (see the warning
|
||||
above), not a stable version. Flash it only on nodes you can reach, and each
|
||||
new release on one of them first.</p>
|
||||
<p>Files are in <a href="https://git.rfa.cz/tth-pub/meshcore-tth/releases">Releases</a>.
|
||||
A release is named after the upstream version and the date, e.g.
|
||||
<code>v1.18.0+tth.20261112</code> (a second one that day <code>.2</code>), and its notes list the
|
||||
changes since the previous release. One set per board and role
|
||||
(<code><board>_<role>-<release></code>, e.g. <code>Xiao_nrf52_repeater-v1.18.0+tth.20261112.zip</code>):
|
||||
<code>.zip</code> and <code>.uf2</code> for nRF52 boards, <code>.bin</code> for ESP32 (<code>-merged.bin</code> is the
|
||||
full image for a blank board, the plain <code>.bin</code> an update). <code>SHA256SUMS</code> lists
|
||||
the checksums. Releases up to 12. 11. 2026 were named <code>tth-<sha></code>.</p>
|
||||
<p><strong>nRF52 (XIAO, RAK4631, SenseCAP Solar, T1000-E, T114) with the
|
||||
<a href="https://flasher.meshcore.io">MeshCore web flasher</a></strong> -- Chrome, Edge or
|
||||
Chromium on a computer (Web Serial; not Firefox or Safari):</p>
|
||||
<ol>
|
||||
<li>Connect the board over USB.</li>
|
||||
<li>Click <strong>Custom Firmware</strong> and choose the <code>.zip</code> for your board.</li>
|
||||
<li>Click <strong>Enter DFU mode</strong> and pick the board's serial port. The board
|
||||
restarts into its bootloader and shows up as a new port.</li>
|
||||
<li>Click <strong>Flash!</strong> and pick that new port. About 30 s, then the board
|
||||
restarts into the new firmware.</li>
|
||||
<li><strong>Console</strong> in the flasher (or any serial terminal, 115200) checks the
|
||||
result: <code>ver</code> shows <code>v1.xx.x-tth<sha></code>, the same as the "Verze v uzlu"
|
||||
(node version) line in the release notes.</li>
|
||||
</ol>
|
||||
<p><strong>Do not click Erase Flash</strong> unless you want a new node: it wipes the
|
||||
identity (the node's key and everything that knows it) together with all
|
||||
settings. A plain flash keeps them.</p>
|
||||
<p>Tried on a XIAO (repeater-observer, 3. 11. 2026). ESP32 <code>.bin</code> through the
|
||||
same Custom Firmware button is untested here.</p>
|
||||
<p>Without the web flasher: on most boards a double-tap of reset opens the
|
||||
bootloader as a USB drive; copy the <code>.uf2</code> onto it. Or
|
||||
<code>adafruit-nrfutil dfu serial -pkg <file>.zip -p <port> -b 115200</code> with the
|
||||
board in the bootloader.</p>
|
||||
<p>After flashing a new node, set it up in the console: <code>set name <name></code>,
|
||||
<code>password <admin password></code> (at most 15 characters), your own region with
|
||||
<code>region put cz-<kraj> cz</code> + <code>region save</code>. A repeater forwards from its
|
||||
first boot (upstream default) and these builds are on the live CZ frequency:
|
||||
on a desk without its antenna, <code>set repeat off</code> until it is in place.</p>
|
||||
<h2 id="experimental-firmware-update-pushed-by-the-admin-ota">Experimental: firmware update pushed by the admin (<code>*-ota</code>)</h2>
|
||||
<p>Every nRF52 build with a text console (repeater, observer, room server,
|
||||
sensor) is in the release once more as an <strong>experimental</strong> <code>*-ota</code> /
|
||||
<code>*-observer-ota</code> image. It takes a new firmware from its admin with the
|
||||
<code>fw …</code> commands: on the USB or BLE console, or <strong>over the mesh as remote admin
|
||||
CLI</strong>. No bootloader change, no second bank: the node stores the package in
|
||||
free flash, checks all of it (signature, hashes, the delta applied dry) and
|
||||
rewrites itself only on <code>fw apply</code>, from a routine running in RAM. A power
|
||||
cut during the rewrite leaves it in the bootloader, back via USB/BLE DFU.</p>
|
||||
<ul>
|
||||
<li>Each <code>*-ota</code> image comes with a full package
|
||||
<code><board>_<role>-ota-<release>.mcfw</code> (USB/BLE only) and a delta
|
||||
<code>….from-<earlier release>.mcfw</code> from every kept earlier release, typically
|
||||
a few kB.</li>
|
||||
<li><strong>Over the mesh a node takes only a delta, and never an older version than
|
||||
it runs</strong> -- enforced by the node, not by the tool. A full image or a step
|
||||
back only locally (<code>fw apply downgrade</code>). <code>fw apply</code> wants the battery at
|
||||
3.8 V or more unless the node runs on USB.</li>
|
||||
<li>Packages and <code>SHA256SUMS</code> are signed by <code>meshcore-ota@tth-pub</code>, and an
|
||||
<code>*-ota</code> image accepts no other signature. Checking the downloads:
|
||||
<code>ssh-keygen -Y verify -f tools/ota_allowed_signers -I meshcore-ota@tth-pub
|
||||
-n meshcore-ota -s SHA256SUMS.sig < SHA256SUMS</code>. Your own build with your own
|
||||
key: <code>[ota] pubkey</code> in <code>platformio.local.ini</code>.</li>
|
||||
<li>The first <code>*-ota</code> image is flashed the usual way (above), later ones go as
|
||||
deltas. Tools: <code>tools/ota_push.py</code> (USB), <code>tools/ota_mesh_push.py</code> (over the
|
||||
mesh through a companion; needs the <code>meshcore</code> Python library, takes the
|
||||
admin password from <code>[secrets] admin_pw</code> in <code>platformio.local.ini</code>; <code>--side</code>
|
||||
carries the transfer on a side channel, off the shared mesh),
|
||||
<code>tools/ota_pack.py info</code>. The transfer itself is the OTA engine of the
|
||||
<a href="https://git.rfa.cz/tth-pub/meshcore-ansible">tth.meshcore</a> Ansible
|
||||
collection (module <code>meshcore_fw_ota</code>), one code for the tools and Ansible.
|
||||
From a phone: the <a href="https://git.rfa.cz/tth-pub/meshcore-open">meshcore-open</a>
|
||||
fork, repeater management → Firmware update (OTA), which finds the delta in
|
||||
the release by itself. How it works and bench numbers:
|
||||
<a href="https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/ota.md">docs/ota.md</a>.</li>
|
||||
<li><strong>Experimental even within this fork</strong>: the images come with every
|
||||
release (see the warning above) and have no second bank and no automatic
|
||||
rollback. A bad firmware that boots keeps running until you push the next
|
||||
one; one that does not boot needs USB/BLE DFU in hand. Tried on the bench
|
||||
(XIAO, USB, mesh, side channel) and on two of our masts since 13. 11. 2026.
|
||||
The radio watchdogs (see Diagnostics and operations) catch an image that
|
||||
boots with a dead radio: switch <code>set radio.silence</code> on for nodes you push
|
||||
to. Costs ~10 kB of RAM.</li>
|
||||
</ul>
|
||||
<h2 id="build">Build</h2>
|
||||
<ul>
|
||||
<li>Version stamping in every nRF52 env (<code>v1.18.0-tth<sha></code>, <code>+</code> = dirty tree),
|
||||
base version from the upstream tag (<code>tools/build_version.py</code>).</li>
|
||||
<li><code>tools/</code>: host tools for the nodes -- consoles (USB, BLE), flashing, bench
|
||||
tests, diagnostics (<a href="https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/tools/README.md">tools/README.md</a>). Board names come
|
||||
from a local config outside the repo (<code>tools/config.example.ini</code>).</li>
|
||||
<li><code>hardware/cavity-box</code>: parametric enclosure for a cavity filter on a mast.</li>
|
||||
</ul>
|
||||
<hr />
|
||||
<p><em>Níže je README upstreamového MeshCore. Jeho flasher, klienti a návody se
|
||||
týkají oficiálního firmwaru, ne releasů tohoto forku. / Below is upstream
|
||||
MeshCore's README: its flasher, clients and guides refer to the official
|
||||
firmware, not to this fork's releases.</em></p>
|
||||
</section>
|
||||
|
||||
</main>
|
||||
</div>
|
||||
<hr><footer>
|
||||
<div class="terminal-mkdocs-footer-grid">
|
||||
<div id="terminal-mkdocs-footer-copyright-info">
|
||||
Site built with <a href="http://www.mkdocs.org">MkDocs</a> and <a href="https://github.com/ntno/mkdocs-terminal">Terminal for MkDocs</a>.
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal" id="mkdocs_search_modal" tabindex="-1" role="alertdialog" aria-modal="true" aria-labelledby="searchModalLabel">
|
||||
<div class="modal-dialog modal-lg" role="search">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="searchModalLabel">Search</h5>
|
||||
<button type="button" class="close btn btn-default btn-ghost" data-dismiss="modal" aria-label="Close">x</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p id="searchInputLabel">Type to start searching</p>
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<input type="search" class="form-control" aria-labelledby="searchInputLabel" placeholder="" id="mkdocs-search-query" title="Please enter search terms here">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mkdocs-search-results" data-no-results-text="No document matches found"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Vendored
-4435
File diff suppressed because it is too large.
Load diff
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"bootstrap.js","sources":["../../js/src/util.js","../../js/src/alert.js","../../js/src/button.js","../../js/src/carousel.js","../../js/src/collapse.js","../../js/src/dropdown.js","../../js/src/modal.js","../../js/src/tools/sanitizer.js","../../js/src/tooltip.js","../../js/src/popover.js","../../js/src/scrollspy.js","../../js/src/tab.js","../../js/src/toast.js","../../js/src/index.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.3.1): util.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport $ from 'jquery'\n\n/**\n * ------------------------------------------------------------------------\n * Private TransitionEnd Helpers\n * ------------------------------------------------------------------------\n */\n\nconst TRANSITION_END = 'transitionend'\nconst MAX_UID = 1000000\nconst MILLISECONDS_MULTIPLIER = 1000\n\n// Shoutout AngusCroll (https://goo.gl/pxwQGp)\nfunction toType(obj) {\n return {}.toString.call(obj).match(/\\s([a-z]+)/i)[1].toLowerCase()\n}\n\nfunction getSpecialTransitionEndEvent() {\n return {\n bindType: TRANSITION_END,\n delegateType: TRANSITION_END,\n handle(event) {\n if ($(event.target).is(this)) {\n return event.handleObj.handler.apply(this, arguments) // eslint-disable-line prefer-rest-params\n }\n return undefined // eslint-disable-line no-undefined\n }\n }\n}\n\nfunction transitionEndEmulator(duration) {\n let called = false\n\n $(this).one(Util.TRANSITION_END, () => {\n called = true\n })\n\n setTimeout(() => {\n if (!called) {\n Util.triggerTransitionEnd(this)\n }\n }, duration)\n\n return this\n}\n\nfunction setTransitionEndSupport() {\n $.fn.emulateTransitionEnd = transitionEndEmulator\n $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent()\n}\n\n/**\n * --------------------------------------------------------------------------\n * Public Util Api\n * --------------------------------------------------------------------------\n */\n\nconst Util = {\n\n TRANSITION_END: 'bsTransitionEnd',\n\n getUID(prefix) {\n do {\n // eslint-disable-next-line no-bitwise\n prefix += ~~(Math.random() * MAX_UID) // \"~~\" acts like a faster Math.floor() here\n } while (document.getElementById(prefix))\n return prefix\n },\n\n getSelectorFromElement(element) {\n let selector = element.getAttribute('data-target')\n\n if (!selector || selector === '#') {\n const hrefAttr = element.getAttribute('href')\n selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : ''\n }\n\n try {\n return document.querySelector(selector) ? selector : null\n } catch (err) {\n return null\n }\n },\n\n getTransitionDurationFromElement(element) {\n if (!element) {\n return 0\n }\n\n // Get transition-duration of the element\n let transitionDuration = $(element).css('transition-duration')\n let transitionDelay = $(element).css('transition-delay')\n\n const floatTransitionDuration = parseFloat(transitionDuration)\n const floatTransitionDelay = parseFloat(transitionDelay)\n\n // Return 0 if element or transition duration is not found\n if (!floatTransitionDuration && !floatTransitionDelay) {\n return 0\n }\n\n // If multiple durations are defined, take the first\n transitionDuration = transitionDuration.split(',')[0]\n transitionDelay = transitionDelay.split(',')[0]\n\n return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER\n },\n\n reflow(element) {\n return element.offsetHeight\n },\n\n triggerTransitionEnd(element) {\n $(element).trigger(TRANSITION_END)\n },\n\n // TODO: Remove in v5\n supportsTransitionEnd() {\n return Boolean(TRANSITION_END)\n },\n\n isElement(obj) {\n return (obj[0] || obj).nodeType\n },\n\n typeCheckConfig(componentName, config, configTypes) {\n for (const property in configTypes) {\n if (Object.prototype.hasOwnProperty.call(configTypes, property)) {\n const expectedTypes = configTypes[property]\n const value = config[property]\n const valueType = value && Util.isElement(value)\n ? 'element' : toType(value)\n\n if (!new RegExp(expectedTypes).test(valueType)) {\n throw new Error(\n `${componentName.toUpperCase()}: ` +\n `Option \"${property}\" provided type \"${valueType}\" ` +\n `but expected type \"${expectedTypes}\".`)\n }\n }\n }\n },\n\n findShadowRoot(element) {\n if (!document.documentElement.attachShadow) {\n return null\n }\n\n // Can find the shadow root otherwise it'll return the document\n if (typeof element.getRootNode === 'function') {\n const root = element.getRootNode()\n return root insLine truncated
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
/*!
|
||||
* Bootstrap v4.3.1 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
*/
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jquery"),require("popper.js")):"function"==typeof define&&define.amd?define(["exports","jquery","popper.js"],e):e((t=t||self).bootstrap={},t.jQuery,t.Popper)}(this,function(t,g,u){"use strict";function i(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function s(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function l(o){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},e=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),e.forEach(function(t){var e,n,i;e=o,i=r[n=t],n in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i})}return o}g=g&&g.hasOwnProperty("default")?g.default:g,u=u&&u.hasOwnProperty("default")?u.default:u;var e="transitionend";function n(t){var e=this,n=!1;return g(this).one(_.TRANSITION_END,function(){n=!0}),setTimeout(function(){n||_.triggerTransitionEnd(e)},t),this}var _={TRANSITION_END:"bsTransitionEnd",getUID:function(t){for(;t+=~~(1e6*Math.random()),document.getElementById(t););return t},getSelectorFromElement:function(t){var e=t.getAttribute("data-target");if(!e||"#"===e){var n=t.getAttribute("href");e=n&&"#"!==n?n.trim():""}try{return document.querySelector(e)?e:null}catch(t){return null}},getTransitionDurationFromElement:function(t){if(!t)return 0;var e=g(t).css("transition-duration"),n=g(t).css("transition-delay"),i=parseFloat(e),o=parseFloat(n);return i||o?(e=e.split(",")[0],n=n.split(",")[0],1e3*(parseFloat(e)+parseFloat(n))):0},reflow:function(t){return t.offsetHeight},triggerTransitionEnd:function(t){g(t).trigger(e)},supportsTransitionEnd:function(){return Boolean(e)},isElement:function(t){return(t[0]||t).nodeType},typeCheckConfig:function(t,e,n){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var o=n[i],r=e[i],s=r&&_.isElement(r)?"element":(a=r,{}.toString.call(a).match(/\s([a-z]+)/i)[1].toLowerCase());if(!new RegExp(o).test(s))throw new Error(t.toUpperCase()+': Option "'+i+'" provided type "'+s+'" but expected type "'+o+'".')}var a},findShadowRoot:function(t){if(!document.documentElement.attachShadow)return null;if("function"!=typeof t.getRootNode)return t instanceof ShadowRoot?t:t.parentNode?_.findShadowRoot(t.parentNode):null;var e=t.getRootNode();return e instanceof ShadowRoot?e:null}};g.fn.emulateTransitionEnd=n,g.event.special[_.TRANSITION_END]={bindType:e,delegateType:e,handle:function(t){if(g(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}};var o="alert",r="bs.alert",a="."+r,c=g.fn[o],h={CLOSE:"close"+a,CLOSED:"closed"+a,CLICK_DATA_API:"click"+a+".data-api"},f="alert",d="fade",m="show",p=function(){function i(t){this._element=t}var t=i.prototype;return t.close=function(t){var e=this._element;t&&(e=this._getRootElement(t)),this._triggerCloseEvent(e).isDefaultPrevented()||this._removeElement(e)},t.dispose=function(){g.removeData(this._element,r),this._element=null},t._getRootElement=function(t){var e=_.getSelectorFromElement(t),n=!1;return e&&(n=document.querySelector(e)),n||(n=g(t).closest("."+f)[0]),n},t._triggerCloseEvent=function(t){var e=g.Event(h.CLOSE);return g(t).trigger(e),e},t._removeElement=function(e){var n=this;if(g(e).removeClass(m),g(e).hasClass(d)){var t=_.getTransitionDurationFromElement(e);g(e).one(_.TRANSITION_END,function(t){return n._destroyElement(e,t)}).emulateTransitionEnd(t)}else this._destroyElement(e)},t._destroyElement=function(t){g(t).detach().trigger(h.CLOSED).remove()},i._jQueryInterface=function(n){return this.each(function(){var t=g(this),e=t.data(r);e||(e=new i(this),t.data(r,e)),"close"===n&&e[n](this)})},i._handleDismiss=function(e){return function(t){t&&t.preventDefault(),e.close(this)}},s(i,null,[{key:"VERSION",get:function(){return"4.3.1"}}]),i}();g(document).on(h.CLICK_DATA_API,'[data-dismiss="alert"]',p._handleDismiss(new p)),g.fn[o]=p._jQueryInterface,g.fn[o].Constructor=p,g.fn[o].noConflict=function(){return g.fn[o]=c,p._jQueryInterface};var v="button",y="bs.button",E="."+y,C=".data-api",T=g.fn[v],S="active",b="btn",I="focus",D='[data-toggle^="button"]',w='[data-toggle="buttons"]',A='input:not([type="hidden"])',N=".active",O=".btn",k={CLICK_DATA_API:"click"+E+C,FOCUS_BLUR_DATA_API:"focus"+E+C+" blur"+E+C},P=function(){function n(t){this._element=t}var t=n.prototype;return t.toggle=function(){var t=!0,e=!0,n=g(this._element).closest(w)[0];if(n){var i=this._element.querySelector(A);if(i){if("radio"===i.type)if(i.checked&&this._element.classList.contains(S))t=!1;else{var o=n.querySelector(N);o&&g(o).removeClass(S)}if(t){if(i.hasAttribute("disabled")||n.hasAttribute("disabled")||i.classList.contains("disabled")||n.classList.contains("disabled"))return;i.checked=!this._element.classList.contains(S),g(i).trigger("chLine truncated
|
||||
//# sourceMappingURL=bootstrap.min.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../js/src/util.js","../../js/src/alert.js","../../js/src/button.js","../../js/src/carousel.js","../../js/src/collapse.js","../../js/src/dropdown.js","../../js/src/modal.js","../../js/src/tools/sanitizer.js","../../js/src/tooltip.js","../../js/src/popover.js","../../js/src/scrollspy.js","../../js/src/tab.js","../../js/src/toast.js","../../js/src/index.js"],"names":["TRANSITION_END","transitionEndEmulator","duration","_this","this","called","$","one","Util","setTimeout","triggerTransitionEnd","getUID","prefix","Math","random","document","getElementById","getSelectorFromElement","element","selector","getAttribute","hrefAttr","trim","querySelector","err","getTransitionDurationFromElement","transitionDuration","css","transitionDelay","floatTransitionDuration","parseFloat","floatTransitionDelay","split","reflow","offsetHeight","trigger","supportsTransitionEnd","Boolean","isElement","obj","nodeType","typeCheckConfig","componentName","config","configTypes","property","Object","prototype","hasOwnProperty","call","expectedTypes","value","valueType","toString","match","toLowerCase","RegExp","test","Error","toUpperCase","findShadowRoot","documentElement","attachShadow","getRootNode","ShadowRoot","parentNode","root","fn","emulateTransitionEnd","event","special","bindType","delegateType","handle","target","is","handleObj","handler","apply","arguments","NAME","DATA_KEY","EVENT_KEY","JQUERY_NO_CONFLICT","Event","CLOSE","CLOSED","CLICK_DATA_API","ClassName","Alert","_element","close","rootElement","_getRootElement","_triggerCloseEvent","isDefaultPrevented","_removeElement","dispose","removeData","parent","closest","closeEvent","removeClass","hasClass","_destroyElement","detach","remove","_jQueryInterface","each","$element","data","_handleDismiss","alertInstance","preventDefault","on","Constructor","noConflict","DATA_API_KEY","Selector","FOCUS_BLUR_DATA_API","Button","toggle","triggerChangeEvent","addAriaPressed","input","type","checked","classList","contains","activeElement","hasAttribute","focus","setAttribute","toggleClass","button","Default","interval","keyboard","slide","pause","wrap","touch","DefaultType","Direction","SLIDE","SLID","KEYDOWN","MOUSEENTER","MOUSELEAVE","TOUCHSTART","TOUCHMOVE","TOUCHEND","POINTERDOWN","POINTERUP","DRAG_START","LOAD_DATA_API","PointerType","TOUCH","PEN","Carousel","_items","_interval","_activeElement","_isPaused","_isSliding","touchTimeout","touchStartX","touchDeltaX","_config","_getConfig","_indicatorsElement","_touchSupported","navigator","maxTouchPoints","_pointerEvent","window","PointerEvent","MSPointerEvent","_addEventListeners","next","_slide","nextWhenVisible","hidden","prev","cycle","clearInterval","setInterval","visibilityState","bind","to","index","activeIndex","_getItemIndex","length","direction","off","_objectSpread","_handleSwipe","absDeltax","abs","_this2","_keydown","_addTouchEventListeners","_this3","start","originalEvent","pointerType","clientX","touches","end","clearTimeout","querySelectorAll","e","add","tagName","which","slice","indexOf","_getItemByDirection","isNextDirection","isPrevDirection","lastItemIndex","itemIndex","_triggerSlideEvent","relatedTarget","eventDirectionName","targetIndex","fromIndex","slideEvent","from","_setActiveIndicatorElement","indicators","nextIndicator","children","addClass","directionalClassName","orderClassName","_this4","activeElementIndex","nextElement","nextElementIndex","isCycling","slidEvent","nextElementInterval","parseInt","defaultInterval","action","TypeError","ride","_dataApiClickHandler","slideIndex","carousels","i","len","$carousel","SHOW","SHOWN","HIDE","HIDDEN","Dimension","Collapse","_isTransitioning","_triggerArray","id","toggleList","elem","filterElement","filter","foundElem","_selector","push","_parent","_getParent","_addAriaAndCollapsedClass","hide","show","actives","activesData","not","startEvent","dimension","_getDimension","style","attr","setTransitioning","scrollSize","getBoundingClientRect","triggerArrayLength","isTransitioning","jquery","_getTargetFromElement","triggerArray","isOpen","$this","currentTarget","$trigger","selectors","$target","REGEXP_KEYDOWN","ARROW_UP_KEYCODE","CLICK","KEYDOWN_DATA_API","KEYUP_DATA_API","AttachmentMap","offset","flip","boundary","reference","display","Dropdown","_popper","_menu","_getMenuElement","_inNavbar","_detectNavbar","disabled","_getParentFromElement","isActive","_clearMenus","showEvent","Popper","referenceElement","_getPopperConfig","body","noop","hideEvent","destroy","update","scheduleUpdate","stopPropagation","constructor","_getPlacement","$parentDropdown","placement","_getOffset","offsets","popperConfig","modifiers","enabled","preventOverflow","boundariesElement","applyStyle","toggles","context","clickEvent","dropdownMenu","_dataApiKeydownHandler","items","backdrop","FOCUSIN","RESIZE","CLICK_DISMISS","KEYDOWN_DISMISS","MOUSEUP_DISMISS","MOUSEDOWN_DISMISS","Modal","_dialog","_backdrop","_isShown","_isBodyOverflowing","_ignoreBackdropClick","_scrolLine truncated
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
(function(window,undefined){var readyList,rootjQuery,core_strundefined=typeof undefined,location=window.location,document=window.document,docElem=document.documentElement,_jQuery=window.jQuery,_$=window.$,class2type={},core_deletedIds=[],core_version="1.10.1",core_concat=core_deletedIds.concat,core_push=core_deletedIds.push,core_slice=core_deletedIds.slice,core_indexOf=core_deletedIds.indexOf,core_toString=class2type.toString,core_hasOwn=class2type.hasOwnProperty,core_trim=core_version.trim,jQuery=function(selector,context){return new jQuery.fn.init(selector,context,rootjQuery)},core_pnum=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,core_rnotwhite=/\S+/g,rtrim=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,rquickExpr=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,rsingleTag=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,rvalidchars=/^[\],:{}\s]*$/,rvalidbraces=/(?:^|:|,)(?:\s*\[)+/g,rvalidescape=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,rvalidtokens=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,rmsPrefix=/^-ms-/,rdashAlpha=/-([\da-z])/gi,fcamelCase=function(all,letter){return letter.toUpperCase()},completed=function(event){if(document.addEventListener||event.type==="load"||document.readyState==="complete"){detach();jQuery.ready()}},detach=function(){if(document.addEventListener){document.removeEventListener("DOMContentLoaded",completed,false);window.removeEventListener("load",completed,false)}else{document.detachEvent("onreadystatechange",completed);window.detachEvent("onload",completed)}};jQuery.fn=jQuery.prototype={jquery:core_version,constructor:jQuery,init:function(selector,context,rootjQuery){var match,elem;if(!selector){return this}if(typeof selector==="string"){if(selector.charAt(0)==="<"&&selector.charAt(selector.length-1)===">"&&selector.length>=3){match=[null,selector,null]}else{match=rquickExpr.exec(selector)}if(match&&(match[1]||!context)){if(match[1]){context=context instanceof jQuery?context[0]:context;jQuery.merge(this,jQuery.parseHTML(match[1],context&&context.nodeType?context.ownerDocument||context:document,true));if(rsingleTag.test(match[1])&&jQuery.isPlainObject(context)){for(match in context){if(jQuery.isFunction(this[match])){this[match](context[match])}else{this.attr(match,context[match])}}}return this}else{elem=document.getElementById(match[2]);if(elem&&elem.parentNode){if(elem.id!==match[2]){return rootjQuery.find(selector)}this.length=1;this[0]=elem}this.context=document;this.selector=selector;return this}}else if(!context||context.jquery){return(context||rootjQuery).find(selector)}else{return this.constructor(context).find(selector)}}else if(selector.nodeType){this.context=this[0]=selector;this.length=1;return this}else if(jQuery.isFunction(selector)){return rootjQuery.ready(selector)}if(selector.selector!==undefined){this.selector=selector.selector;this.context=selector.context}return jQuery.makeArray(selector,this)},selector:"",length:0,toArray:function(){return core_slice.call(this)},get:function(num){return num==null?this.toArray():num<0?this[this.length+num]:this[num]},pushStack:function(elems){var ret=jQuery.merge(this.constructor(),elems);ret.prevObject=this;ret.context=this.context;return ret},each:function(callback,args){return jQuery.each(this,callback,args)},ready:function(fn){jQuery.ready.promise().done(fn);return this},slice:function(){return this.pushStack(core_slice.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(i){var len=this.length,j=+i+(i<0?len:0);return this.pushStack(j>=0&&j<len?[this[j]]:[])},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem)}))},end:function(){return this.prevObject||this.constructor(null)},push:core_push,sort:[].sort,splice:[].splice};jQuery.fn.init.prototype=jQuery.fn;jQuery.extend=jQuery.fn.extend=function(){var src,copyIsArray,copy,name,options,clone,target=arguments[0]||{},i=1,length=arguments.length,deep=false;if(typeof target==="boolean"){deep=target;target=arguments[1]||{};i=2}if(typeof target!=="object"&&!jQuery.isFunction(target)){target={}}if(length===i){target=this;--i}for(;i<length;i++){if((options=arguments[i])!=null){for(name in options){src=target[name];copy=options[name];if(target===copy){continue}if(deep&©&&(jQuery.isPlainObject(copy)||(copyIsArray=jQuery.isArray(copy)))){if(copyIsArray){copyIsArray=false;clone=src&&jQuery.isArray(src)?src:[]}else{clone=src&&jQuery.isPlainObject(src)?src:{}}target[name]=jQuery.extend(deep,clone,copy)}else if(copy!==undefined){target[name]=copy}}}}return target};jQuery.extend({expando:"jQuery"+(core_version+Math.random()).replace(/\D/g,""),noConflict:function(deep){if(window.$===jQuery){window.$=_$}if(deep&&window.jQuery===jQuery){window.jQuery=_jQuery}return jQuery},isReady:false,readyWait:1,holdReady:function(hold){if(hold){jQuery.readyWait++}else{jQuery.ready(true)}},ready:function(wait){if(wait===true?--jQuery.readyWait:jQuery.isReady){return}if(!document.body){return setTimeout(jQueryLine truncated
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["jquery-1.10.1/jquery-1.10.1.js"],"names":["window","undefined","readyList","rootjQuery","core_strundefined","location","document","docElem","documentElement","_jQuery","jQuery","_$","$","class2type","core_deletedIds","core_version","core_concat","concat","core_push","push","core_slice","slice","core_indexOf","indexOf","core_toString","toString","core_hasOwn","hasOwnProperty","core_trim","trim","selector","context","fn","init","core_pnum","source","core_rnotwhite","rtrim","rquickExpr","rsingleTag","rvalidchars","rvalidbraces","rvalidescape","rvalidtokens","rmsPrefix","rdashAlpha","fcamelCase","all","letter","toUpperCase","completed","event","addEventListener","type","readyState","detach","ready","removeEventListener","detachEvent","prototype","jquery","constructor","match","elem","this","charAt","length","exec","merge","parseHTML","nodeType","ownerDocument","test","isPlainObject","isFunction","attr","getElementById","parentNode","id","find","makeArray","toArray","call","get","num","pushStack","elems","ret","prevObject","each","callback","args","promise","done","apply","arguments","first","eq","last","i","len","j","map","end","sort","splice","extend","src","copyIsArray","copy","name","options","clone","target","deep","isArray","expando","Math","random","replace","noConflict","isReady","readyWait","holdReady","hold","wait","body","setTimeout","resolveWith","trigger","off","obj","Array","isWindow","isNumeric","isNaN","parseFloat","isFinite","String","key","e","support","ownLast","isEmptyObject","error","msg","Error","data","keepScripts","parsed","scripts","createElement","buildFragment","remove","childNodes","parseJSON","JSON","parse","Function","parseXML","xml","tmp","DOMParser","parseFromString","ActiveXObject","async","loadXML","getElementsByTagName","noop","globalEval","execScript","camelCase","string","nodeName","toLowerCase","value","isArraylike","text","arr","results","Object","inArray","max","second","l","grep","inv","retVal","arg","guid","proxy","access","chainable","emptyGet","raw","bulk","now","Date","getTime","swap","old","style","Deferred","attachEvent","top","frameElement","doScroll","doScrollCheck","split","cachedruns","Expr","getText","isXML","compile","outermostContext","sortInput","setDocument","documentIsHTML","rbuggyQSA","rbuggyMatches","matches","contains","preferredDoc","dirruns","classCache","createCache","tokenCache","compilerCache","hasDuplicate","sortOrder","strundefined","MAX_NEGATIVE","hasOwn","pop","push_native","booleans","whitespace","characterEncoding","identifier","attributes","pseudos","RegExp","rcomma","rcombinators","rsibling","rattributeQuotes","rpseudo","ridentifier","matchExpr","ID","CLASS","TAG","ATTR","PSEUDO","CHILD","bool","needsContext","rnative","rinputs","rheader","rescape","runescape","funescape","_","escaped","escapedWhitespace","high","fromCharCode","els","Sizzle","seed","m","groups","nid","newContext","newSelector","getElementsByClassName","qsa","tokenize","getAttribute","setAttribute","toSelector","join","querySelectorAll","qsaError","removeAttribute","select","isNative","keys","cache","cacheLength","shift","markFunction","assert","div","removeChild","addHandle","attrs","handler","current","setHandle","attrHandle","boolHandler","val","getAttributeNode","specified","interpolationHandler","valueHandler","defaultValue","siblingCheck","a","b","cur","diff","sourceIndex","nextSibling","createInputPseudo","createButtonPseudo","createPositionalPseudo","argument","matchIndexes","node","doc","parent","parentWindow","innerHTML","firstChild","className","input","appendChild","createComment","getById","getElementsByName","filter","attrId","tag","matchesSelector","webkitMatchesSelector","mozMatchesSelector","oMatchesSelector","msMatchesSelector","disconnectedMatch","compareDocumentPosition","adown","bup","sortDetached","div1","compare","aup","ap","bp","unshift","expr","elements","uniqueSort","duplicates","detectDuplicates","sortStable","textContent","nodeValue","selectors","createPseudo","relative",">","dir"," ","+","~","preFilter","excess","unquoted","nodeNameSelector","pattern","operator","check","result","what","simple","forward","ofType","outerCache","nodeIndex","start","useCache","lastChild","pseudo","setFilters","idx","matched","not","matcher","unmatched","has","innerText","lang","elemLang","hash","root","focus","activeElement","hasFocus","href","tabIndex","enabled","disabled","checked","selected","selectedIndex","empty","header","button","even","odd","lt","gt","radio","checkbox","file","password","image","submit","reset","parseOnly","tokens","soFar","preFilters","cached","addCombinator","combinator","base","checkNonElements","doneName","dirkey","elementMatcher","matchers","condense","newUnmatched","mapped","setMatcher","postFilter","postFinder","postSelector","temp","preMap","postMap","preexisting","multipleContexts","matcherIn","matcherOut","matcherFromTokens","checkContext","leadingRelative","implicitRelative","matchContext","matchAnyContexLine truncated
|
||||
@@ -1,26 +0,0 @@
|
||||
Copyright © 2014-present, Tom Christie. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or
|
||||
without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,284 +0,0 @@
|
||||
function getSearchTerm() {
|
||||
var sPageURL = window.location.search.substring(1);
|
||||
var sURLVariables = sPageURL.split('&');
|
||||
for (var i = 0; i < sURLVariables.length; i++) {
|
||||
var sParameterName = sURLVariables[i].split('=');
|
||||
if (sParameterName[0] == 'q') {
|
||||
return sParameterName[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function applyTopPadding() {
|
||||
// Update various absolute positions to match where the main container
|
||||
// starts. This is necessary for handling multi-line nav headers, since
|
||||
// that pushes the main container down.
|
||||
var offset = $('body > .container').offset();
|
||||
$('html').css('scroll-padding-top', offset.top + 'px');
|
||||
$('.bs-sidebar.affix').css('top', offset.top + 'px');
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
applyTopPadding();
|
||||
|
||||
var search_term = getSearchTerm(),
|
||||
// $keyboard_modal = $('#mkdocs_keyboard_modal'),
|
||||
$search_modal = $('#mkdocs_search_modal');
|
||||
|
||||
if (search_term) {
|
||||
$search_modal.modal();
|
||||
}
|
||||
|
||||
// make sure search input gets autofocus every time modal opens.
|
||||
$search_modal.on('shown.bs.modal', function() {
|
||||
$search_modal.find('#mkdocs-search-query').focus();
|
||||
});
|
||||
|
||||
// Close search modal when result is selected
|
||||
// The links get added later so listen to parent
|
||||
$('#mkdocs-search-results').click(function(e) {
|
||||
if ($(e.target).is('a')) {
|
||||
$search_modal.modal('hide');
|
||||
}
|
||||
});
|
||||
|
||||
// Populate keyboard modal with proper Keys
|
||||
// $keyboard_modal.find('.help.shortcut kbd')[0].innerHTML = keyCodes[shortcuts.help];
|
||||
// $keyboard_modal.find('.prev.shortcut kbd')[0].innerHTML = keyCodes[shortcuts.previous];
|
||||
// $keyboard_modal.find('.next.shortcut kbd')[0].innerHTML = keyCodes[shortcuts.next];
|
||||
// $keyboard_modal.find('.search.shortcut kbd')[0].innerHTML = keyCodes[shortcuts.search];
|
||||
|
||||
// Keyboard navigation
|
||||
document.addEventListener("keydown", function(e) {
|
||||
if ($(e.target).is(':input')) return true;
|
||||
var key = e.which || e.keyCode || window.event && window.event.keyCode;
|
||||
var page;
|
||||
switch (key) {
|
||||
case shortcuts.next:
|
||||
page = $('.navbar a[rel="next"]:first').prop('href');
|
||||
break;
|
||||
case shortcuts.previous:
|
||||
page = $('.navbar a[rel="prev"]:first').prop('href');
|
||||
break;
|
||||
case shortcuts.search:
|
||||
e.preventDefault();
|
||||
// $keyboard_modal.modal('hide');
|
||||
$search_modal.modal('show');
|
||||
$search_modal.find('#mkdocs-search-query').focus();
|
||||
break;
|
||||
case shortcuts.help:
|
||||
$search_modal.modal('hide');
|
||||
// $keyboard_modal.modal('show');
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (page) {
|
||||
// $keyboard_modal.modal('hide');
|
||||
window.location.href = page;
|
||||
}
|
||||
});
|
||||
|
||||
$('table').addClass('table table-striped table-hover');
|
||||
|
||||
// Improve the scrollspy behaviour when users click on a TOC item.
|
||||
$(".bs-sidenav a").on("click", function() {
|
||||
var clicked = this;
|
||||
setTimeout(function() {
|
||||
var active = $('.nav li.active a');
|
||||
active = active[active.length - 1];
|
||||
if (clicked !== active) {
|
||||
$(active).parent().removeClass("active");
|
||||
$(clicked).parent().addClass("active");
|
||||
}
|
||||
}, 50);
|
||||
});
|
||||
|
||||
function showInnerDropdown(item) {
|
||||
var popup = $(item).next('.dropdown-menu');
|
||||
popup.addClass('show');
|
||||
$(item).addClass('open');
|
||||
|
||||
// First, close any sibling dropdowns.
|
||||
var container = $(item).parent().parent();
|
||||
container.find('> .dropdown-submenu > a').each(function(i, el) {
|
||||
if (el !== item) {
|
||||
hideInnerDropdown(el);
|
||||
}
|
||||
});
|
||||
|
||||
var popupMargin = 10;
|
||||
var maxBottom = $(window).height() - popupMargin;
|
||||
var bounds = item.getBoundingClientRect();
|
||||
|
||||
popup.css('left', bounds.right + 'px');
|
||||
if (bounds.top + popup.height() > maxBottom &&
|
||||
bounds.top > $(window).height() / 2) {
|
||||
popup.css({
|
||||
'top': (bounds.bottom - popup.height()) + 'px',
|
||||
'max-height': (bounds.bottom - popupMargin) + 'px',
|
||||
});
|
||||
} else {
|
||||
popup.css({
|
||||
'top': bounds.top + 'px',
|
||||
'max-height': (maxBottom - bounds.top) + 'px',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function hideInnerDropdown(item) {
|
||||
var popup = $(item).next('.dropdown-menu');
|
||||
popup.removeClass('show');
|
||||
$(item).removeClass('open');
|
||||
|
||||
popup.scrollTop(0);
|
||||
popup.find('.dropdown-menu').scrollTop(0).removeClass('show');
|
||||
popup.find('.dropdown-submenu > a').removeClass('open');
|
||||
}
|
||||
|
||||
$('.dropdown-submenu > a').on('click', function(e) {
|
||||
if ($(this).next('.dropdown-menu').hasClass('show')) {
|
||||
hideInnerDropdown(this);
|
||||
} else {
|
||||
showInnerDropdown(this);
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$('.dropdown-menu').parent().on('hide.bs.dropdown', function(e) {
|
||||
$(this).find('.dropdown-menu').scrollTop(0);
|
||||
$(this).find('.dropdown-submenu > a').removeClass('open');
|
||||
$(this).find('.dropdown-menu .dropdown-menu').removeClass('show');
|
||||
});
|
||||
});
|
||||
|
||||
$(window).on('resize', applyTopPadding);
|
||||
|
||||
$('body').scrollspy({
|
||||
target: '.bs-sidebar',
|
||||
offset: 100
|
||||
});
|
||||
|
||||
/* Prevent disabled links from causing a page reload */
|
||||
$("li.disabled a").click(function() {
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
// See https://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes
|
||||
// We only list common keys below. Obscure keys are omitted and their use is discouraged.
|
||||
var keyCodes = {
|
||||
8: 'backspace',
|
||||
9: 'tab',
|
||||
13: 'enter',
|
||||
16: 'shift',
|
||||
17: 'ctrl',
|
||||
18: 'alt',
|
||||
19: 'pause/break',
|
||||
20: 'caps lock',
|
||||
27: 'escape',
|
||||
32: 'spacebar',
|
||||
33: 'page up',
|
||||
34: 'page down',
|
||||
35: 'end',
|
||||
36: 'home',
|
||||
37: '←',
|
||||
38: '↑',
|
||||
39: '→',
|
||||
40: '↓',
|
||||
45: 'insert',
|
||||
46: 'delete',
|
||||
48: '0',
|
||||
49: '1',
|
||||
50: '2',
|
||||
51: '3',
|
||||
52: '4',
|
||||
53: '5',
|
||||
54: '6',
|
||||
55: '7',
|
||||
56: '8',
|
||||
57: '9',
|
||||
65: 'a',
|
||||
66: 'b',
|
||||
67: 'c',
|
||||
68: 'd',
|
||||
69: 'e',
|
||||
70: 'f',
|
||||
71: 'g',
|
||||
72: 'h',
|
||||
73: 'i',
|
||||
74: 'j',
|
||||
75: 'k',
|
||||
76: 'l',
|
||||
77: 'm',
|
||||
78: 'n',
|
||||
79: 'o',
|
||||
80: 'p',
|
||||
81: 'q',
|
||||
82: 'r',
|
||||
83: 's',
|
||||
84: 't',
|
||||
85: 'u',
|
||||
86: 'v',
|
||||
87: 'w',
|
||||
88: 'x',
|
||||
89: 'y',
|
||||
90: 'z',
|
||||
91: 'Left Windows Key / Left ⌘',
|
||||
92: 'Right Windows Key',
|
||||
93: 'Windows Menu / Right ⌘',
|
||||
96: 'numpad 0',
|
||||
97: 'numpad 1',
|
||||
98: 'numpad 2',
|
||||
99: 'numpad 3',
|
||||
100: 'numpad 4',
|
||||
101: 'numpad 5',
|
||||
102: 'numpad 6',
|
||||
103: 'numpad 7',
|
||||
104: 'numpad 8',
|
||||
105: 'numpad 9',
|
||||
106: 'multiply',
|
||||
107: 'add',
|
||||
109: 'subtract',
|
||||
110: 'decimal point',
|
||||
111: 'divide',
|
||||
112: 'f1',
|
||||
113: 'f2',
|
||||
114: 'f3',
|
||||
115: 'f4',
|
||||
116: 'f5',
|
||||
117: 'f6',
|
||||
118: 'f7',
|
||||
119: 'f8',
|
||||
120: 'f9',
|
||||
121: 'f10',
|
||||
122: 'f11',
|
||||
123: 'f12',
|
||||
124: 'f13',
|
||||
125: 'f14',
|
||||
126: 'f15',
|
||||
127: 'f16',
|
||||
128: 'f17',
|
||||
129: 'f18',
|
||||
130: 'f19',
|
||||
131: 'f20',
|
||||
132: 'f21',
|
||||
133: 'f22',
|
||||
134: 'f23',
|
||||
135: 'f24',
|
||||
144: 'num lock',
|
||||
145: 'scroll lock',
|
||||
186: ';',
|
||||
187: '=',
|
||||
188: ',',
|
||||
189: '‐',
|
||||
190: '.',
|
||||
191: '?',
|
||||
192: '`',
|
||||
219: '[',
|
||||
220: '\',
|
||||
221: ']',
|
||||
222: ''',
|
||||
};
|
||||
File diff suppressed because it is too large.
Load diff
+46
@@ -0,0 +1,46 @@
|
||||
|
||||
This directory is intended for project specific (private) libraries.
|
||||
PlatformIO will compile them to static libraries and link into executable file.
|
||||
|
||||
The source code of each library should be placed in a an own separate directory
|
||||
("lib/your_library_name/[here are source files]").
|
||||
|
||||
For example, see a structure of the following two libraries `Foo` and `Bar`:
|
||||
|
||||
|--lib
|
||||
| |
|
||||
| |--Bar
|
||||
| | |--docs
|
||||
| | |--examples
|
||||
| | |--src
|
||||
| | |- Bar.c
|
||||
| | |- Bar.h
|
||||
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
|
||||
| |
|
||||
| |--Foo
|
||||
| | |- Foo.c
|
||||
| | |- Foo.h
|
||||
| |
|
||||
| |- README --> THIS FILE
|
||||
|
|
||||
|- platformio.ini
|
||||
|--src
|
||||
|- main.c
|
||||
|
||||
and a contents of `src/main.c`:
|
||||
```
|
||||
#include <Foo.h>
|
||||
#include <Bar.h>
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
PlatformIO Library Dependency Finder will find automatically dependent
|
||||
libraries scanning project source files.
|
||||
|
||||
More information about PlatformIO Library Dependency Finder
|
||||
- https://docs.platformio.org/page/librarymanager/ldf.html
|
||||
@@ -0,0 +1,69 @@
|
||||
#include "ed_25519.h"
|
||||
#include "ge.h"
|
||||
#include "sc.h"
|
||||
#include "sha512.h"
|
||||
|
||||
|
||||
/* see http://crypto.stackexchange.com/a/6215/4697 */
|
||||
void ed25519_add_scalar(unsigned char *public_key, unsigned char *private_key, const unsigned char *scalar) {
|
||||
const unsigned char SC_1[32] = {1}; /* scalar with value 1 */
|
||||
|
||||
unsigned char n[32];
|
||||
ge_p3 nB;
|
||||
ge_p1p1 A_p1p1;
|
||||
ge_p3 A;
|
||||
ge_p3 public_key_unpacked;
|
||||
ge_cached T;
|
||||
|
||||
sha512_context hash;
|
||||
unsigned char hashbuf[64];
|
||||
|
||||
int i;
|
||||
|
||||
/* copy the scalar and clear highest bit */
|
||||
for (i = 0; i < 31; ++i) {
|
||||
n[i] = scalar[i];
|
||||
}
|
||||
n[31] = scalar[31] & 127;
|
||||
|
||||
/* private key: a = n + t */
|
||||
if (private_key) {
|
||||
sc_muladd(private_key, SC_1, n, private_key);
|
||||
|
||||
// https://github.com/orlp/ed25519/issues/3
|
||||
sha512_init(&hash);
|
||||
sha512_update(&hash, private_key + 32, 32);
|
||||
sha512_update(&hash, scalar, 32);
|
||||
sha512_final(&hash, hashbuf);
|
||||
for (i = 0; i < 32; ++i) {
|
||||
private_key[32 + i] = hashbuf[i];
|
||||
}
|
||||
}
|
||||
|
||||
/* public key: A = nB + T */
|
||||
if (public_key) {
|
||||
/* if we know the private key we don't need a point addition, which is faster */
|
||||
/* using a "timing attack" you could find out wether or not we know the private
|
||||
key, but this information seems rather useless - if this is important pass
|
||||
public_key and private_key seperately in 2 function calls */
|
||||
if (private_key) {
|
||||
ge_scalarmult_base(&A, private_key);
|
||||
} else {
|
||||
/* unpack public key into T */
|
||||
ge_frombytes_negate_vartime(&public_key_unpacked, public_key);
|
||||
fe_neg(public_key_unpacked.X, public_key_unpacked.X); /* undo negate */
|
||||
fe_neg(public_key_unpacked.T, public_key_unpacked.T); /* undo negate */
|
||||
ge_p3_to_cached(&T, &public_key_unpacked);
|
||||
|
||||
/* calculate n*B */
|
||||
ge_scalarmult_base(&nB, n);
|
||||
|
||||
/* A = n*B + T */
|
||||
ge_add(&A_p1p1, &nB, &T);
|
||||
ge_p1p1_to_p3(&A, &A_p1p1);
|
||||
}
|
||||
|
||||
/* pack public key */
|
||||
ge_p3_tobytes(public_key, &A);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
#ifndef ED25519_H
|
||||
#define ED25519_H
|
||||
|
||||
// Nightcracker's Ed25519 - https://github.com/orlp/ed25519
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(ED25519_BUILD_DLL)
|
||||
#define ED25519_DECLSPEC __declspec(dllexport)
|
||||
#elif defined(ED25519_DLL)
|
||||
#define ED25519_DECLSPEC __declspec(dllimport)
|
||||
#else
|
||||
#define ED25519_DECLSPEC
|
||||
#endif
|
||||
#else
|
||||
#define ED25519_DECLSPEC
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef ED25519_NO_SEED
|
||||
int ED25519_DECLSPEC ed25519_create_seed(unsigned char *seed);
|
||||
#endif
|
||||
|
||||
void ED25519_DECLSPEC ed25519_create_keypair(unsigned char *public_key, unsigned char *private_key, const unsigned char *seed);
|
||||
void ED25519_DECLSPEC ed25519_derive_pub(unsigned char *public_key, const unsigned char *private_key);
|
||||
void ED25519_DECLSPEC ed25519_sign(unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *public_key, const unsigned char *private_key);
|
||||
int ED25519_DECLSPEC ed25519_verify(const unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *public_key);
|
||||
void ED25519_DECLSPEC ed25519_add_scalar(unsigned char *public_key, unsigned char *private_key, const unsigned char *scalar);
|
||||
void ED25519_DECLSPEC ed25519_key_exchange(unsigned char *shared_secret, const unsigned char *public_key, const unsigned char *private_key);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+1491
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,41 @@
|
||||
#ifndef FE_H
|
||||
#define FE_H
|
||||
|
||||
#include "fixedint.h"
|
||||
|
||||
|
||||
/*
|
||||
fe means field element.
|
||||
Here the field is \Z/(2^255-19).
|
||||
An element t, entries t[0]...t[9], represents the integer
|
||||
t[0]+2^26 t[1]+2^51 t[2]+2^77 t[3]+2^102 t[4]+...+2^230 t[9].
|
||||
Bounds on each t[i] vary depending on context.
|
||||
*/
|
||||
|
||||
|
||||
typedef int32_t fe[10];
|
||||
|
||||
|
||||
void fe_0(fe h);
|
||||
void fe_1(fe h);
|
||||
|
||||
void fe_frombytes(fe h, const unsigned char *s);
|
||||
void fe_tobytes(unsigned char *s, const fe h);
|
||||
|
||||
void fe_copy(fe h, const fe f);
|
||||
int fe_isnegative(const fe f);
|
||||
int fe_isnonzero(const fe f);
|
||||
void fe_cmov(fe f, const fe g, unsigned int b);
|
||||
void fe_cswap(fe f, fe g, unsigned int b);
|
||||
|
||||
void fe_neg(fe h, const fe f);
|
||||
void fe_add(fe h, const fe f, const fe g);
|
||||
void fe_invert(fe out, const fe z);
|
||||
void fe_sq(fe h, const fe f);
|
||||
void fe_sq2(fe h, const fe f);
|
||||
void fe_mul(fe h, const fe f, const fe g);
|
||||
void fe_mul121666(fe h, fe f);
|
||||
void fe_pow22523(fe out, const fe z);
|
||||
void fe_sub(fe h, const fe f, const fe g);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
Portable header to provide the 32 and 64 bits type.
|
||||
|
||||
Not a compatible replacement for <stdint.h>, do not blindly use it as such.
|
||||
*/
|
||||
|
||||
#if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined(__WATCOMC__) && (defined(_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_) || defined(__UINT_FAST64_TYPE__)) )) && !defined(FIXEDINT_H_INCLUDED)
|
||||
#include <stdint.h>
|
||||
#define FIXEDINT_H_INCLUDED
|
||||
|
||||
#if defined(__WATCOMC__) && __WATCOMC__ >= 1250 && !defined(UINT64_C)
|
||||
#include <limits.h>
|
||||
#define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef FIXEDINT_H_INCLUDED
|
||||
#define FIXEDINT_H_INCLUDED
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
/* (u)int32_t */
|
||||
#ifndef uint32_t
|
||||
#if (ULONG_MAX == 0xffffffffUL)
|
||||
typedef unsigned long uint32_t;
|
||||
#elif (UINT_MAX == 0xffffffffUL)
|
||||
typedef unsigned int uint32_t;
|
||||
#elif (USHRT_MAX == 0xffffffffUL)
|
||||
typedef unsigned short uint32_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef int32_t
|
||||
#if (LONG_MAX == 0x7fffffffL)
|
||||
typedef signed long int32_t;
|
||||
#elif (INT_MAX == 0x7fffffffL)
|
||||
typedef signed int int32_t;
|
||||
#elif (SHRT_MAX == 0x7fffffffL)
|
||||
typedef signed short int32_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* (u)int64_t */
|
||||
#if (defined(__STDC__) && defined(__STDC_VERSION__) && __STDC__ && __STDC_VERSION__ >= 199901L)
|
||||
typedef long long int64_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
|
||||
#define UINT64_C(v) v ##ULL
|
||||
#define INT64_C(v) v ##LL
|
||||
#elif defined(__GNUC__)
|
||||
__extension__ typedef long long int64_t;
|
||||
__extension__ typedef unsigned long long uint64_t;
|
||||
|
||||
#define UINT64_C(v) v ##ULL
|
||||
#define INT64_C(v) v ##LL
|
||||
#elif defined(__MWERKS__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) || defined(__APPLE_CC__) || defined(_LONG_LONG) || defined(_CRAYC)
|
||||
typedef long long int64_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
|
||||
#define UINT64_C(v) v ##ULL
|
||||
#define INT64_C(v) v ##LL
|
||||
#elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined(__BORLANDC__) && __BORLANDC__ > 0x460) || defined(__alpha) || defined(__DECC)
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
|
||||
#define UINT64_C(v) v ##UI64
|
||||
#define INT64_C(v) v ##I64
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,467 @@
|
||||
#include "ge.h"
|
||||
#include "precomp_data.h"
|
||||
|
||||
|
||||
/*
|
||||
r = p + q
|
||||
*/
|
||||
|
||||
void ge_add(ge_p1p1 *r, const ge_p3 *p, const ge_cached *q) {
|
||||
fe t0;
|
||||
fe_add(r->X, p->Y, p->X);
|
||||
fe_sub(r->Y, p->Y, p->X);
|
||||
fe_mul(r->Z, r->X, q->YplusX);
|
||||
fe_mul(r->Y, r->Y, q->YminusX);
|
||||
fe_mul(r->T, q->T2d, p->T);
|
||||
fe_mul(r->X, p->Z, q->Z);
|
||||
fe_add(t0, r->X, r->X);
|
||||
fe_sub(r->X, r->Z, r->Y);
|
||||
fe_add(r->Y, r->Z, r->Y);
|
||||
fe_add(r->Z, t0, r->T);
|
||||
fe_sub(r->T, t0, r->T);
|
||||
}
|
||||
|
||||
|
||||
static void slide(signed char *r, const unsigned char *a) {
|
||||
int i;
|
||||
int b;
|
||||
int k;
|
||||
|
||||
for (i = 0; i < 256; ++i) {
|
||||
r[i] = 1 & (a[i >> 3] >> (i & 7));
|
||||
}
|
||||
|
||||
for (i = 0; i < 256; ++i)
|
||||
if (r[i]) {
|
||||
for (b = 1; b <= 6 && i + b < 256; ++b) {
|
||||
if (r[i + b]) {
|
||||
if (r[i] + (r[i + b] << b) <= 15) {
|
||||
r[i] += r[i + b] << b;
|
||||
r[i + b] = 0;
|
||||
} else if (r[i] - (r[i + b] << b) >= -15) {
|
||||
r[i] -= r[i + b] << b;
|
||||
|
||||
for (k = i + b; k < 256; ++k) {
|
||||
if (!r[k]) {
|
||||
r[k] = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
r[k] = 0;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
r = a * A + b * B
|
||||
where a = a[0]+256*a[1]+...+256^31 a[31].
|
||||
and b = b[0]+256*b[1]+...+256^31 b[31].
|
||||
B is the Ed25519 base point (x,4/5) with x positive.
|
||||
*/
|
||||
|
||||
void ge_double_scalarmult_vartime(ge_p2 *r, const unsigned char *a, const ge_p3 *A, const unsigned char *b) {
|
||||
signed char aslide[256];
|
||||
signed char bslide[256];
|
||||
ge_cached Ai[8]; /* A,3A,5A,7A,9A,11A,13A,15A */
|
||||
ge_p1p1 t;
|
||||
ge_p3 u;
|
||||
ge_p3 A2;
|
||||
int i;
|
||||
slide(aslide, a);
|
||||
slide(bslide, b);
|
||||
ge_p3_to_cached(&Ai[0], A);
|
||||
ge_p3_dbl(&t, A);
|
||||
ge_p1p1_to_p3(&A2, &t);
|
||||
ge_add(&t, &A2, &Ai[0]);
|
||||
ge_p1p1_to_p3(&u, &t);
|
||||
ge_p3_to_cached(&Ai[1], &u);
|
||||
ge_add(&t, &A2, &Ai[1]);
|
||||
ge_p1p1_to_p3(&u, &t);
|
||||
ge_p3_to_cached(&Ai[2], &u);
|
||||
ge_add(&t, &A2, &Ai[2]);
|
||||
ge_p1p1_to_p3(&u, &t);
|
||||
ge_p3_to_cached(&Ai[3], &u);
|
||||
ge_add(&t, &A2, &Ai[3]);
|
||||
ge_p1p1_to_p3(&u, &t);
|
||||
ge_p3_to_cached(&Ai[4], &u);
|
||||
ge_add(&t, &A2, &Ai[4]);
|
||||
ge_p1p1_to_p3(&u, &t);
|
||||
ge_p3_to_cached(&Ai[5], &u);
|
||||
ge_add(&t, &A2, &Ai[5]);
|
||||
ge_p1p1_to_p3(&u, &t);
|
||||
ge_p3_to_cached(&Ai[6], &u);
|
||||
ge_add(&t, &A2, &Ai[6]);
|
||||
ge_p1p1_to_p3(&u, &t);
|
||||
ge_p3_to_cached(&Ai[7], &u);
|
||||
ge_p2_0(r);
|
||||
|
||||
for (i = 255; i >= 0; --i) {
|
||||
if (aslide[i] || bslide[i]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (; i >= 0; --i) {
|
||||
ge_p2_dbl(&t, r);
|
||||
|
||||
if (aslide[i] > 0) {
|
||||
ge_p1p1_to_p3(&u, &t);
|
||||
ge_add(&t, &u, &Ai[aslide[i] / 2]);
|
||||
} else if (aslide[i] < 0) {
|
||||
ge_p1p1_to_p3(&u, &t);
|
||||
ge_sub(&t, &u, &Ai[(-aslide[i]) / 2]);
|
||||
}
|
||||
|
||||
if (bslide[i] > 0) {
|
||||
ge_p1p1_to_p3(&u, &t);
|
||||
ge_madd(&t, &u, &Bi[bslide[i] / 2]);
|
||||
} else if (bslide[i] < 0) {
|
||||
ge_p1p1_to_p3(&u, &t);
|
||||
ge_msub(&t, &u, &Bi[(-bslide[i]) / 2]);
|
||||
}
|
||||
|
||||
ge_p1p1_to_p2(r, &t);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static const fe d = {
|
||||
-10913610, 13857413, -15372611, 6949391, 114729, -8787816, -6275908, -3247719, -18696448, -12055116
|
||||
};
|
||||
|
||||
static const fe sqrtm1 = {
|
||||
-32595792, -7943725, 9377950, 3500415, 12389472, -272473, -25146209, -2005654, 326686, 11406482
|
||||
};
|
||||
|
||||
int ge_frombytes_negate_vartime(ge_p3 *h, const unsigned char *s) {
|
||||
fe u;
|
||||
fe v;
|
||||
fe v3;
|
||||
fe vxx;
|
||||
fe check;
|
||||
fe_frombytes(h->Y, s);
|
||||
fe_1(h->Z);
|
||||
fe_sq(u, h->Y);
|
||||
fe_mul(v, u, d);
|
||||
fe_sub(u, u, h->Z); /* u = y^2-1 */
|
||||
fe_add(v, v, h->Z); /* v = dy^2+1 */
|
||||
fe_sq(v3, v);
|
||||
fe_mul(v3, v3, v); /* v3 = v^3 */
|
||||
fe_sq(h->X, v3);
|
||||
fe_mul(h->X, h->X, v);
|
||||
fe_mul(h->X, h->X, u); /* x = uv^7 */
|
||||
fe_pow22523(h->X, h->X); /* x = (uv^7)^((q-5)/8) */
|
||||
fe_mul(h->X, h->X, v3);
|
||||
fe_mul(h->X, h->X, u); /* x = uv^3(uv^7)^((q-5)/8) */
|
||||
fe_sq(vxx, h->X);
|
||||
fe_mul(vxx, vxx, v);
|
||||
fe_sub(check, vxx, u); /* vx^2-u */
|
||||
|
||||
if (fe_isnonzero(check)) {
|
||||
fe_add(check, vxx, u); /* vx^2+u */
|
||||
|
||||
if (fe_isnonzero(check)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
fe_mul(h->X, h->X, sqrtm1);
|
||||
}
|
||||
|
||||
if (fe_isnegative(h->X) == (s[31] >> 7)) {
|
||||
fe_neg(h->X, h->X);
|
||||
}
|
||||
|
||||
fe_mul(h->T, h->X, h->Y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
r = p + q
|
||||
*/
|
||||
|
||||
void ge_madd(ge_p1p1 *r, const ge_p3 *p, const ge_precomp *q) {
|
||||
fe t0;
|
||||
fe_add(r->X, p->Y, p->X);
|
||||
fe_sub(r->Y, p->Y, p->X);
|
||||
fe_mul(r->Z, r->X, q->yplusx);
|
||||
fe_mul(r->Y, r->Y, q->yminusx);
|
||||
fe_mul(r->T, q->xy2d, p->T);
|
||||
fe_add(t0, p->Z, p->Z);
|
||||
fe_sub(r->X, r->Z, r->Y);
|
||||
fe_add(r->Y, r->Z, r->Y);
|
||||
fe_add(r->Z, t0, r->T);
|
||||
fe_sub(r->T, t0, r->T);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
r = p - q
|
||||
*/
|
||||
|
||||
void ge_msub(ge_p1p1 *r, const ge_p3 *p, const ge_precomp *q) {
|
||||
fe t0;
|
||||
|
||||
fe_add(r->X, p->Y, p->X);
|
||||
fe_sub(r->Y, p->Y, p->X);
|
||||
fe_mul(r->Z, r->X, q->yminusx);
|
||||
fe_mul(r->Y, r->Y, q->yplusx);
|
||||
fe_mul(r->T, q->xy2d, p->T);
|
||||
fe_add(t0, p->Z, p->Z);
|
||||
fe_sub(r->X, r->Z, r->Y);
|
||||
fe_add(r->Y, r->Z, r->Y);
|
||||
fe_sub(r->Z, t0, r->T);
|
||||
fe_add(r->T, t0, r->T);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
r = p
|
||||
*/
|
||||
|
||||
void ge_p1p1_to_p2(ge_p2 *r, const ge_p1p1 *p) {
|
||||
fe_mul(r->X, p->X, p->T);
|
||||
fe_mul(r->Y, p->Y, p->Z);
|
||||
fe_mul(r->Z, p->Z, p->T);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
r = p
|
||||
*/
|
||||
|
||||
void ge_p1p1_to_p3(ge_p3 *r, const ge_p1p1 *p) {
|
||||
fe_mul(r->X, p->X, p->T);
|
||||
fe_mul(r->Y, p->Y, p->Z);
|
||||
fe_mul(r->Z, p->Z, p->T);
|
||||
fe_mul(r->T, p->X, p->Y);
|
||||
}
|
||||
|
||||
|
||||
void ge_p2_0(ge_p2 *h) {
|
||||
fe_0(h->X);
|
||||
fe_1(h->Y);
|
||||
fe_1(h->Z);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
r = 2 * p
|
||||
*/
|
||||
|
||||
void ge_p2_dbl(ge_p1p1 *r, const ge_p2 *p) {
|
||||
fe t0;
|
||||
|
||||
fe_sq(r->X, p->X);
|
||||
fe_sq(r->Z, p->Y);
|
||||
fe_sq2(r->T, p->Z);
|
||||
fe_add(r->Y, p->X, p->Y);
|
||||
fe_sq(t0, r->Y);
|
||||
fe_add(r->Y, r->Z, r->X);
|
||||
fe_sub(r->Z, r->Z, r->X);
|
||||
fe_sub(r->X, t0, r->Y);
|
||||
fe_sub(r->T, r->T, r->Z);
|
||||
}
|
||||
|
||||
|
||||
void ge_p3_0(ge_p3 *h) {
|
||||
fe_0(h->X);
|
||||
fe_1(h->Y);
|
||||
fe_1(h->Z);
|
||||
fe_0(h->T);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
r = 2 * p
|
||||
*/
|
||||
|
||||
void ge_p3_dbl(ge_p1p1 *r, const ge_p3 *p) {
|
||||
ge_p2 q;
|
||||
ge_p3_to_p2(&q, p);
|
||||
ge_p2_dbl(r, &q);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
r = p
|
||||
*/
|
||||
|
||||
static const fe d2 = {
|
||||
-21827239, -5839606, -30745221, 13898782, 229458, 15978800, -12551817, -6495438, 29715968, 9444199
|
||||
};
|
||||
|
||||
void ge_p3_to_cached(ge_cached *r, const ge_p3 *p) {
|
||||
fe_add(r->YplusX, p->Y, p->X);
|
||||
fe_sub(r->YminusX, p->Y, p->X);
|
||||
fe_copy(r->Z, p->Z);
|
||||
fe_mul(r->T2d, p->T, d2);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
r = p
|
||||
*/
|
||||
|
||||
void ge_p3_to_p2(ge_p2 *r, const ge_p3 *p) {
|
||||
fe_copy(r->X, p->X);
|
||||
fe_copy(r->Y, p->Y);
|
||||
fe_copy(r->Z, p->Z);
|
||||
}
|
||||
|
||||
|
||||
void ge_p3_tobytes(unsigned char *s, const ge_p3 *h) {
|
||||
fe recip;
|
||||
fe x;
|
||||
fe y;
|
||||
fe_invert(recip, h->Z);
|
||||
fe_mul(x, h->X, recip);
|
||||
fe_mul(y, h->Y, recip);
|
||||
fe_tobytes(s, y);
|
||||
s[31] ^= fe_isnegative(x) << 7;
|
||||
}
|
||||
|
||||
|
||||
static unsigned char equal(signed char b, signed char c) {
|
||||
unsigned char ub = b;
|
||||
unsigned char uc = c;
|
||||
unsigned char x = ub ^ uc; /* 0: yes; 1..255: no */
|
||||
uint64_t y = x; /* 0: yes; 1..255: no */
|
||||
y -= 1; /* large: yes; 0..254: no */
|
||||
y >>= 63; /* 1: yes; 0: no */
|
||||
return (unsigned char) y;
|
||||
}
|
||||
|
||||
static unsigned char negative(signed char b) {
|
||||
uint64_t x = b; /* 18446744073709551361..18446744073709551615: yes; 0..255: no */
|
||||
x >>= 63; /* 1: yes; 0: no */
|
||||
return (unsigned char) x;
|
||||
}
|
||||
|
||||
static void cmov(ge_precomp *t, const ge_precomp *u, unsigned char b) {
|
||||
fe_cmov(t->yplusx, u->yplusx, b);
|
||||
fe_cmov(t->yminusx, u->yminusx, b);
|
||||
fe_cmov(t->xy2d, u->xy2d, b);
|
||||
}
|
||||
|
||||
|
||||
static void select(ge_precomp *t, int pos, signed char b) {
|
||||
ge_precomp minust;
|
||||
unsigned char bnegative = negative(b);
|
||||
unsigned char babs = b - (((-bnegative) & b) << 1);
|
||||
fe_1(t->yplusx);
|
||||
fe_1(t->yminusx);
|
||||
fe_0(t->xy2d);
|
||||
cmov(t, &base[pos][0], equal(babs, 1));
|
||||
cmov(t, &base[pos][1], equal(babs, 2));
|
||||
cmov(t, &base[pos][2], equal(babs, 3));
|
||||
cmov(t, &base[pos][3], equal(babs, 4));
|
||||
cmov(t, &base[pos][4], equal(babs, 5));
|
||||
cmov(t, &base[pos][5], equal(babs, 6));
|
||||
cmov(t, &base[pos][6], equal(babs, 7));
|
||||
cmov(t, &base[pos][7], equal(babs, 8));
|
||||
fe_copy(minust.yplusx, t->yminusx);
|
||||
fe_copy(minust.yminusx, t->yplusx);
|
||||
fe_neg(minust.xy2d, t->xy2d);
|
||||
cmov(t, &minust, bnegative);
|
||||
}
|
||||
|
||||
/*
|
||||
h = a * B
|
||||
where a = a[0]+256*a[1]+...+256^31 a[31]
|
||||
B is the Ed25519 base point (x,4/5) with x positive.
|
||||
|
||||
Preconditions:
|
||||
a[31] <= 127
|
||||
*/
|
||||
|
||||
void ge_scalarmult_base(ge_p3 *h, const unsigned char *a) {
|
||||
signed char e[64];
|
||||
signed char carry;
|
||||
ge_p1p1 r;
|
||||
ge_p2 s;
|
||||
ge_precomp t;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 32; ++i) {
|
||||
e[2 * i + 0] = (a[i] >> 0) & 15;
|
||||
e[2 * i + 1] = (a[i] >> 4) & 15;
|
||||
}
|
||||
|
||||
/* each e[i] is between 0 and 15 */
|
||||
/* e[63] is between 0 and 7 */
|
||||
carry = 0;
|
||||
|
||||
for (i = 0; i < 63; ++i) {
|
||||
e[i] += carry;
|
||||
carry = e[i] + 8;
|
||||
carry >>= 4;
|
||||
e[i] -= carry << 4;
|
||||
}
|
||||
|
||||
e[63] += carry;
|
||||
/* each e[i] is between -8 and 8 */
|
||||
ge_p3_0(h);
|
||||
|
||||
for (i = 1; i < 64; i += 2) {
|
||||
select(&t, i / 2, e[i]);
|
||||
ge_madd(&r, h, &t);
|
||||
ge_p1p1_to_p3(h, &r);
|
||||
}
|
||||
|
||||
ge_p3_dbl(&r, h);
|
||||
ge_p1p1_to_p2(&s, &r);
|
||||
ge_p2_dbl(&r, &s);
|
||||
ge_p1p1_to_p2(&s, &r);
|
||||
ge_p2_dbl(&r, &s);
|
||||
ge_p1p1_to_p2(&s, &r);
|
||||
ge_p2_dbl(&r, &s);
|
||||
ge_p1p1_to_p3(h, &r);
|
||||
|
||||
for (i = 0; i < 64; i += 2) {
|
||||
select(&t, i / 2, e[i]);
|
||||
ge_madd(&r, h, &t);
|
||||
ge_p1p1_to_p3(h, &r);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
r = p - q
|
||||
*/
|
||||
|
||||
void ge_sub(ge_p1p1 *r, const ge_p3 *p, const ge_cached *q) {
|
||||
fe t0;
|
||||
|
||||
fe_add(r->X, p->Y, p->X);
|
||||
fe_sub(r->Y, p->Y, p->X);
|
||||
fe_mul(r->Z, r->X, q->YminusX);
|
||||
fe_mul(r->Y, r->Y, q->YplusX);
|
||||
fe_mul(r->T, q->T2d, p->T);
|
||||
fe_mul(r->X, p->Z, q->Z);
|
||||
fe_add(t0, r->X, r->X);
|
||||
fe_sub(r->X, r->Z, r->Y);
|
||||
fe_add(r->Y, r->Z, r->Y);
|
||||
fe_sub(r->Z, t0, r->T);
|
||||
fe_add(r->T, t0, r->T);
|
||||
}
|
||||
|
||||
|
||||
void ge_tobytes(unsigned char *s, const ge_p2 *h) {
|
||||
fe recip;
|
||||
fe x;
|
||||
fe y;
|
||||
fe_invert(recip, h->Z);
|
||||
fe_mul(x, h->X, recip);
|
||||
fe_mul(y, h->Y, recip);
|
||||
fe_tobytes(s, y);
|
||||
s[31] ^= fe_isnegative(x) << 7;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
#ifndef GE_H
|
||||
#define GE_H
|
||||
|
||||
#include "fe.h"
|
||||
|
||||
|
||||
/*
|
||||
ge means group element.
|
||||
|
||||
Here the group is the set of pairs (x,y) of field elements (see fe.h)
|
||||
satisfying -x^2 + y^2 = 1 + d x^2y^2
|
||||
where d = -121665/121666.
|
||||
|
||||
Representations:
|
||||
ge_p2 (projective): (X:Y:Z) satisfying x=X/Z, y=Y/Z
|
||||
ge_p3 (extended): (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT
|
||||
ge_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T
|
||||
ge_precomp (Duif): (y+x,y-x,2dxy)
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
fe X;
|
||||
fe Y;
|
||||
fe Z;
|
||||
} ge_p2;
|
||||
|
||||
typedef struct {
|
||||
fe X;
|
||||
fe Y;
|
||||
fe Z;
|
||||
fe T;
|
||||
} ge_p3;
|
||||
|
||||
typedef struct {
|
||||
fe X;
|
||||
fe Y;
|
||||
fe Z;
|
||||
fe T;
|
||||
} ge_p1p1;
|
||||
|
||||
typedef struct {
|
||||
fe yplusx;
|
||||
fe yminusx;
|
||||
fe xy2d;
|
||||
} ge_precomp;
|
||||
|
||||
typedef struct {
|
||||
fe YplusX;
|
||||
fe YminusX;
|
||||
fe Z;
|
||||
fe T2d;
|
||||
} ge_cached;
|
||||
|
||||
void ge_p3_tobytes(unsigned char *s, const ge_p3 *h);
|
||||
void ge_tobytes(unsigned char *s, const ge_p2 *h);
|
||||
int ge_frombytes_negate_vartime(ge_p3 *h, const unsigned char *s);
|
||||
|
||||
void ge_add(ge_p1p1 *r, const ge_p3 *p, const ge_cached *q);
|
||||
void ge_sub(ge_p1p1 *r, const ge_p3 *p, const ge_cached *q);
|
||||
void ge_double_scalarmult_vartime(ge_p2 *r, const unsigned char *a, const ge_p3 *A, const unsigned char *b);
|
||||
void ge_madd(ge_p1p1 *r, const ge_p3 *p, const ge_precomp *q);
|
||||
void ge_msub(ge_p1p1 *r, const ge_p3 *p, const ge_precomp *q);
|
||||
void ge_scalarmult_base(ge_p3 *h, const unsigned char *a);
|
||||
|
||||
void ge_p1p1_to_p2(ge_p2 *r, const ge_p1p1 *p);
|
||||
void ge_p1p1_to_p3(ge_p3 *r, const ge_p1p1 *p);
|
||||
void ge_p2_0(ge_p2 *h);
|
||||
void ge_p2_dbl(ge_p1p1 *r, const ge_p2 *p);
|
||||
void ge_p3_0(ge_p3 *h);
|
||||
void ge_p3_dbl(ge_p1p1 *r, const ge_p3 *p);
|
||||
void ge_p3_to_cached(ge_cached *r, const ge_p3 *p);
|
||||
void ge_p3_to_p2(ge_p2 *r, const ge_p3 *p);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,79 @@
|
||||
#include "ed_25519.h"
|
||||
#include "fe.h"
|
||||
|
||||
void ed25519_key_exchange(unsigned char *shared_secret, const unsigned char *public_key, const unsigned char *private_key) {
|
||||
unsigned char e[32];
|
||||
unsigned int i;
|
||||
|
||||
fe x1;
|
||||
fe x2;
|
||||
fe z2;
|
||||
fe x3;
|
||||
fe z3;
|
||||
fe tmp0;
|
||||
fe tmp1;
|
||||
|
||||
int pos;
|
||||
unsigned int swap;
|
||||
unsigned int b;
|
||||
|
||||
/* copy the private key and make sure it's valid */
|
||||
for (i = 0; i < 32; ++i) {
|
||||
e[i] = private_key[i];
|
||||
}
|
||||
|
||||
e[0] &= 248;
|
||||
e[31] &= 63;
|
||||
e[31] |= 64;
|
||||
|
||||
/* unpack the public key and convert edwards to montgomery */
|
||||
/* due to CodesInChaos: montgomeryX = (edwardsY + 1)*inverse(1 - edwardsY) mod p */
|
||||
fe_frombytes(x1, public_key);
|
||||
fe_1(tmp1);
|
||||
fe_add(tmp0, x1, tmp1);
|
||||
fe_sub(tmp1, tmp1, x1);
|
||||
fe_invert(tmp1, tmp1);
|
||||
fe_mul(x1, tmp0, tmp1);
|
||||
|
||||
fe_1(x2);
|
||||
fe_0(z2);
|
||||
fe_copy(x3, x1);
|
||||
fe_1(z3);
|
||||
|
||||
swap = 0;
|
||||
for (pos = 254; pos >= 0; --pos) {
|
||||
b = e[pos / 8] >> (pos & 7);
|
||||
b &= 1;
|
||||
swap ^= b;
|
||||
fe_cswap(x2, x3, swap);
|
||||
fe_cswap(z2, z3, swap);
|
||||
swap = b;
|
||||
|
||||
/* from montgomery.h */
|
||||
fe_sub(tmp0, x3, z3);
|
||||
fe_sub(tmp1, x2, z2);
|
||||
fe_add(x2, x2, z2);
|
||||
fe_add(z2, x3, z3);
|
||||
fe_mul(z3, tmp0, x2);
|
||||
fe_mul(z2, z2, tmp1);
|
||||
fe_sq(tmp0, tmp1);
|
||||
fe_sq(tmp1, x2);
|
||||
fe_add(x3, z3, z2);
|
||||
fe_sub(z2, z3, z2);
|
||||
fe_mul(x2, tmp1, tmp0);
|
||||
fe_sub(tmp1, tmp1, tmp0);
|
||||
fe_sq(z2, z2);
|
||||
fe_mul121666(z3, tmp1);
|
||||
fe_sq(x3, x3);
|
||||
fe_add(tmp0, tmp0, z3);
|
||||
fe_mul(z3, x1, z2);
|
||||
fe_mul(z2, tmp1, tmp0);
|
||||
}
|
||||
|
||||
fe_cswap(x2, x3, swap);
|
||||
fe_cswap(z2, z3, swap);
|
||||
|
||||
fe_invert(z2, z2);
|
||||
fe_mul(x2, x2, z2);
|
||||
fe_tobytes(shared_secret, x2);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#include "ed_25519.h"
|
||||
#include "sha512.h"
|
||||
#include "ge.h"
|
||||
|
||||
|
||||
void ed25519_create_keypair(unsigned char *public_key, unsigned char *private_key, const unsigned char *seed) {
|
||||
ge_p3 A;
|
||||
|
||||
sha512(seed, 32, private_key);
|
||||
private_key[0] &= 248;
|
||||
private_key[31] &= 63;
|
||||
private_key[31] |= 64;
|
||||
|
||||
ge_scalarmult_base(&A, private_key);
|
||||
ge_p3_tobytes(public_key, &A);
|
||||
}
|
||||
|
||||
void ed25519_derive_pub(unsigned char *public_key, const unsigned char *private_key) {
|
||||
ge_p3 A;
|
||||
|
||||
ge_scalarmult_base(&A, private_key);
|
||||
ge_p3_tobytes(public_key, &A);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
Copyright (c) 2015 Orson Peters <orsonpeters@gmail.com>
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty. In no event will the
|
||||
authors be held liable for any damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose, including commercial
|
||||
applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the
|
||||
original software. If you use this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as
|
||||
being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,809 @@
|
||||
#include "fixedint.h"
|
||||
#include "sc.h"
|
||||
|
||||
static uint64_t load_3(const unsigned char *in) {
|
||||
uint64_t result;
|
||||
|
||||
result = (uint64_t) in[0];
|
||||
result |= ((uint64_t) in[1]) << 8;
|
||||
result |= ((uint64_t) in[2]) << 16;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static uint64_t load_4(const unsigned char *in) {
|
||||
uint64_t result;
|
||||
|
||||
result = (uint64_t) in[0];
|
||||
result |= ((uint64_t) in[1]) << 8;
|
||||
result |= ((uint64_t) in[2]) << 16;
|
||||
result |= ((uint64_t) in[3]) << 24;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
Input:
|
||||
s[0]+256*s[1]+...+256^63*s[63] = s
|
||||
|
||||
Output:
|
||||
s[0]+256*s[1]+...+256^31*s[31] = s mod l
|
||||
where l = 2^252 + 27742317777372353535851937790883648493.
|
||||
Overwrites s in place.
|
||||
*/
|
||||
|
||||
void sc_reduce(unsigned char *s) {
|
||||
int64_t s0 = 2097151 & load_3(s);
|
||||
int64_t s1 = 2097151 & (load_4(s + 2) >> 5);
|
||||
int64_t s2 = 2097151 & (load_3(s + 5) >> 2);
|
||||
int64_t s3 = 2097151 & (load_4(s + 7) >> 7);
|
||||
int64_t s4 = 2097151 & (load_4(s + 10) >> 4);
|
||||
int64_t s5 = 2097151 & (load_3(s + 13) >> 1);
|
||||
int64_t s6 = 2097151 & (load_4(s + 15) >> 6);
|
||||
int64_t s7 = 2097151 & (load_3(s + 18) >> 3);
|
||||
int64_t s8 = 2097151 & load_3(s + 21);
|
||||
int64_t s9 = 2097151 & (load_4(s + 23) >> 5);
|
||||
int64_t s10 = 2097151 & (load_3(s + 26) >> 2);
|
||||
int64_t s11 = 2097151 & (load_4(s + 28) >> 7);
|
||||
int64_t s12 = 2097151 & (load_4(s + 31) >> 4);
|
||||
int64_t s13 = 2097151 & (load_3(s + 34) >> 1);
|
||||
int64_t s14 = 2097151 & (load_4(s + 36) >> 6);
|
||||
int64_t s15 = 2097151 & (load_3(s + 39) >> 3);
|
||||
int64_t s16 = 2097151 & load_3(s + 42);
|
||||
int64_t s17 = 2097151 & (load_4(s + 44) >> 5);
|
||||
int64_t s18 = 2097151 & (load_3(s + 47) >> 2);
|
||||
int64_t s19 = 2097151 & (load_4(s + 49) >> 7);
|
||||
int64_t s20 = 2097151 & (load_4(s + 52) >> 4);
|
||||
int64_t s21 = 2097151 & (load_3(s + 55) >> 1);
|
||||
int64_t s22 = 2097151 & (load_4(s + 57) >> 6);
|
||||
int64_t s23 = (load_4(s + 60) >> 3);
|
||||
int64_t carry0;
|
||||
int64_t carry1;
|
||||
int64_t carry2;
|
||||
int64_t carry3;
|
||||
int64_t carry4;
|
||||
int64_t carry5;
|
||||
int64_t carry6;
|
||||
int64_t carry7;
|
||||
int64_t carry8;
|
||||
int64_t carry9;
|
||||
int64_t carry10;
|
||||
int64_t carry11;
|
||||
int64_t carry12;
|
||||
int64_t carry13;
|
||||
int64_t carry14;
|
||||
int64_t carry15;
|
||||
int64_t carry16;
|
||||
|
||||
s11 += s23 * 666643;
|
||||
s12 += s23 * 470296;
|
||||
s13 += s23 * 654183;
|
||||
s14 -= s23 * 997805;
|
||||
s15 += s23 * 136657;
|
||||
s16 -= s23 * 683901;
|
||||
s23 = 0;
|
||||
s10 += s22 * 666643;
|
||||
s11 += s22 * 470296;
|
||||
s12 += s22 * 654183;
|
||||
s13 -= s22 * 997805;
|
||||
s14 += s22 * 136657;
|
||||
s15 -= s22 * 683901;
|
||||
s22 = 0;
|
||||
s9 += s21 * 666643;
|
||||
s10 += s21 * 470296;
|
||||
s11 += s21 * 654183;
|
||||
s12 -= s21 * 997805;
|
||||
s13 += s21 * 136657;
|
||||
s14 -= s21 * 683901;
|
||||
s21 = 0;
|
||||
s8 += s20 * 666643;
|
||||
s9 += s20 * 470296;
|
||||
s10 += s20 * 654183;
|
||||
s11 -= s20 * 997805;
|
||||
s12 += s20 * 136657;
|
||||
s13 -= s20 * 683901;
|
||||
s20 = 0;
|
||||
s7 += s19 * 666643;
|
||||
s8 += s19 * 470296;
|
||||
s9 += s19 * 654183;
|
||||
s10 -= s19 * 997805;
|
||||
s11 += s19 * 136657;
|
||||
s12 -= s19 * 683901;
|
||||
s19 = 0;
|
||||
s6 += s18 * 666643;
|
||||
s7 += s18 * 470296;
|
||||
s8 += s18 * 654183;
|
||||
s9 -= s18 * 997805;
|
||||
s10 += s18 * 136657;
|
||||
s11 -= s18 * 683901;
|
||||
s18 = 0;
|
||||
carry6 = (s6 + (1 << 20)) >> 21;
|
||||
s7 += carry6;
|
||||
s6 -= carry6 << 21;
|
||||
carry8 = (s8 + (1 << 20)) >> 21;
|
||||
s9 += carry8;
|
||||
s8 -= carry8 << 21;
|
||||
carry10 = (s10 + (1 << 20)) >> 21;
|
||||
s11 += carry10;
|
||||
s10 -= carry10 << 21;
|
||||
carry12 = (s12 + (1 << 20)) >> 21;
|
||||
s13 += carry12;
|
||||
s12 -= carry12 << 21;
|
||||
carry14 = (s14 + (1 << 20)) >> 21;
|
||||
s15 += carry14;
|
||||
s14 -= carry14 << 21;
|
||||
carry16 = (s16 + (1 << 20)) >> 21;
|
||||
s17 += carry16;
|
||||
s16 -= carry16 << 21;
|
||||
carry7 = (s7 + (1 << 20)) >> 21;
|
||||
s8 += carry7;
|
||||
s7 -= carry7 << 21;
|
||||
carry9 = (s9 + (1 << 20)) >> 21;
|
||||
s10 += carry9;
|
||||
s9 -= carry9 << 21;
|
||||
carry11 = (s11 + (1 << 20)) >> 21;
|
||||
s12 += carry11;
|
||||
s11 -= carry11 << 21;
|
||||
carry13 = (s13 + (1 << 20)) >> 21;
|
||||
s14 += carry13;
|
||||
s13 -= carry13 << 21;
|
||||
carry15 = (s15 + (1 << 20)) >> 21;
|
||||
s16 += carry15;
|
||||
s15 -= carry15 << 21;
|
||||
s5 += s17 * 666643;
|
||||
s6 += s17 * 470296;
|
||||
s7 += s17 * 654183;
|
||||
s8 -= s17 * 997805;
|
||||
s9 += s17 * 136657;
|
||||
s10 -= s17 * 683901;
|
||||
s17 = 0;
|
||||
s4 += s16 * 666643;
|
||||
s5 += s16 * 470296;
|
||||
s6 += s16 * 654183;
|
||||
s7 -= s16 * 997805;
|
||||
s8 += s16 * 136657;
|
||||
s9 -= s16 * 683901;
|
||||
s16 = 0;
|
||||
s3 += s15 * 666643;
|
||||
s4 += s15 * 470296;
|
||||
s5 += s15 * 654183;
|
||||
s6 -= s15 * 997805;
|
||||
s7 += s15 * 136657;
|
||||
s8 -= s15 * 683901;
|
||||
s15 = 0;
|
||||
s2 += s14 * 666643;
|
||||
s3 += s14 * 470296;
|
||||
s4 += s14 * 654183;
|
||||
s5 -= s14 * 997805;
|
||||
s6 += s14 * 136657;
|
||||
s7 -= s14 * 683901;
|
||||
s14 = 0;
|
||||
s1 += s13 * 666643;
|
||||
s2 += s13 * 470296;
|
||||
s3 += s13 * 654183;
|
||||
s4 -= s13 * 997805;
|
||||
s5 += s13 * 136657;
|
||||
s6 -= s13 * 683901;
|
||||
s13 = 0;
|
||||
s0 += s12 * 666643;
|
||||
s1 += s12 * 470296;
|
||||
s2 += s12 * 654183;
|
||||
s3 -= s12 * 997805;
|
||||
s4 += s12 * 136657;
|
||||
s5 -= s12 * 683901;
|
||||
s12 = 0;
|
||||
carry0 = (s0 + (1 << 20)) >> 21;
|
||||
s1 += carry0;
|
||||
s0 -= carry0 << 21;
|
||||
carry2 = (s2 + (1 << 20)) >> 21;
|
||||
s3 += carry2;
|
||||
s2 -= carry2 << 21;
|
||||
carry4 = (s4 + (1 << 20)) >> 21;
|
||||
s5 += carry4;
|
||||
s4 -= carry4 << 21;
|
||||
carry6 = (s6 + (1 << 20)) >> 21;
|
||||
s7 += carry6;
|
||||
s6 -= carry6 << 21;
|
||||
carry8 = (s8 + (1 << 20)) >> 21;
|
||||
s9 += carry8;
|
||||
s8 -= carry8 << 21;
|
||||
carry10 = (s10 + (1 << 20)) >> 21;
|
||||
s11 += carry10;
|
||||
s10 -= carry10 << 21;
|
||||
carry1 = (s1 + (1 << 20)) >> 21;
|
||||
s2 += carry1;
|
||||
s1 -= carry1 << 21;
|
||||
carry3 = (s3 + (1 << 20)) >> 21;
|
||||
s4 += carry3;
|
||||
s3 -= carry3 << 21;
|
||||
carry5 = (s5 + (1 << 20)) >> 21;
|
||||
s6 += carry5;
|
||||
s5 -= carry5 << 21;
|
||||
carry7 = (s7 + (1 << 20)) >> 21;
|
||||
s8 += carry7;
|
||||
s7 -= carry7 << 21;
|
||||
carry9 = (s9 + (1 << 20)) >> 21;
|
||||
s10 += carry9;
|
||||
s9 -= carry9 << 21;
|
||||
carry11 = (s11 + (1 << 20)) >> 21;
|
||||
s12 += carry11;
|
||||
s11 -= carry11 << 21;
|
||||
s0 += s12 * 666643;
|
||||
s1 += s12 * 470296;
|
||||
s2 += s12 * 654183;
|
||||
s3 -= s12 * 997805;
|
||||
s4 += s12 * 136657;
|
||||
s5 -= s12 * 683901;
|
||||
s12 = 0;
|
||||
carry0 = s0 >> 21;
|
||||
s1 += carry0;
|
||||
s0 -= carry0 << 21;
|
||||
carry1 = s1 >> 21;
|
||||
s2 += carry1;
|
||||
s1 -= carry1 << 21;
|
||||
carry2 = s2 >> 21;
|
||||
s3 += carry2;
|
||||
s2 -= carry2 << 21;
|
||||
carry3 = s3 >> 21;
|
||||
s4 += carry3;
|
||||
s3 -= carry3 << 21;
|
||||
carry4 = s4 >> 21;
|
||||
s5 += carry4;
|
||||
s4 -= carry4 << 21;
|
||||
carry5 = s5 >> 21;
|
||||
s6 += carry5;
|
||||
s5 -= carry5 << 21;
|
||||
carry6 = s6 >> 21;
|
||||
s7 += carry6;
|
||||
s6 -= carry6 << 21;
|
||||
carry7 = s7 >> 21;
|
||||
s8 += carry7;
|
||||
s7 -= carry7 << 21;
|
||||
carry8 = s8 >> 21;
|
||||
s9 += carry8;
|
||||
s8 -= carry8 << 21;
|
||||
carry9 = s9 >> 21;
|
||||
s10 += carry9;
|
||||
s9 -= carry9 << 21;
|
||||
carry10 = s10 >> 21;
|
||||
s11 += carry10;
|
||||
s10 -= carry10 << 21;
|
||||
carry11 = s11 >> 21;
|
||||
s12 += carry11;
|
||||
s11 -= carry11 << 21;
|
||||
s0 += s12 * 666643;
|
||||
s1 += s12 * 470296;
|
||||
s2 += s12 * 654183;
|
||||
s3 -= s12 * 997805;
|
||||
s4 += s12 * 136657;
|
||||
s5 -= s12 * 683901;
|
||||
s12 = 0;
|
||||
carry0 = s0 >> 21;
|
||||
s1 += carry0;
|
||||
s0 -= carry0 << 21;
|
||||
carry1 = s1 >> 21;
|
||||
s2 += carry1;
|
||||
s1 -= carry1 << 21;
|
||||
carry2 = s2 >> 21;
|
||||
s3 += carry2;
|
||||
s2 -= carry2 << 21;
|
||||
carry3 = s3 >> 21;
|
||||
s4 += carry3;
|
||||
s3 -= carry3 << 21;
|
||||
carry4 = s4 >> 21;
|
||||
s5 += carry4;
|
||||
s4 -= carry4 << 21;
|
||||
carry5 = s5 >> 21;
|
||||
s6 += carry5;
|
||||
s5 -= carry5 << 21;
|
||||
carry6 = s6 >> 21;
|
||||
s7 += carry6;
|
||||
s6 -= carry6 << 21;
|
||||
carry7 = s7 >> 21;
|
||||
s8 += carry7;
|
||||
s7 -= carry7 << 21;
|
||||
carry8 = s8 >> 21;
|
||||
s9 += carry8;
|
||||
s8 -= carry8 << 21;
|
||||
carry9 = s9 >> 21;
|
||||
s10 += carry9;
|
||||
s9 -= carry9 << 21;
|
||||
carry10 = s10 >> 21;
|
||||
s11 += carry10;
|
||||
s10 -= carry10 << 21;
|
||||
|
||||
s[0] = (unsigned char) (s0 >> 0);
|
||||
s[1] = (unsigned char) (s0 >> 8);
|
||||
s[2] = (unsigned char) ((s0 >> 16) | (s1 << 5));
|
||||
s[3] = (unsigned char) (s1 >> 3);
|
||||
s[4] = (unsigned char) (s1 >> 11);
|
||||
s[5] = (unsigned char) ((s1 >> 19) | (s2 << 2));
|
||||
s[6] = (unsigned char) (s2 >> 6);
|
||||
s[7] = (unsigned char) ((s2 >> 14) | (s3 << 7));
|
||||
s[8] = (unsigned char) (s3 >> 1);
|
||||
s[9] = (unsigned char) (s3 >> 9);
|
||||
s[10] = (unsigned char) ((s3 >> 17) | (s4 << 4));
|
||||
s[11] = (unsigned char) (s4 >> 4);
|
||||
s[12] = (unsigned char) (s4 >> 12);
|
||||
s[13] = (unsigned char) ((s4 >> 20) | (s5 << 1));
|
||||
s[14] = (unsigned char) (s5 >> 7);
|
||||
s[15] = (unsigned char) ((s5 >> 15) | (s6 << 6));
|
||||
s[16] = (unsigned char) (s6 >> 2);
|
||||
s[17] = (unsigned char) (s6 >> 10);
|
||||
s[18] = (unsigned char) ((s6 >> 18) | (s7 << 3));
|
||||
s[19] = (unsigned char) (s7 >> 5);
|
||||
s[20] = (unsigned char) (s7 >> 13);
|
||||
s[21] = (unsigned char) (s8 >> 0);
|
||||
s[22] = (unsigned char) (s8 >> 8);
|
||||
s[23] = (unsigned char) ((s8 >> 16) | (s9 << 5));
|
||||
s[24] = (unsigned char) (s9 >> 3);
|
||||
s[25] = (unsigned char) (s9 >> 11);
|
||||
s[26] = (unsigned char) ((s9 >> 19) | (s10 << 2));
|
||||
s[27] = (unsigned char) (s10 >> 6);
|
||||
s[28] = (unsigned char) ((s10 >> 14) | (s11 << 7));
|
||||
s[29] = (unsigned char) (s11 >> 1);
|
||||
s[30] = (unsigned char) (s11 >> 9);
|
||||
s[31] = (unsigned char) (s11 >> 17);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Input:
|
||||
a[0]+256*a[1]+...+256^31*a[31] = a
|
||||
b[0]+256*b[1]+...+256^31*b[31] = b
|
||||
c[0]+256*c[1]+...+256^31*c[31] = c
|
||||
|
||||
Output:
|
||||
s[0]+256*s[1]+...+256^31*s[31] = (ab+c) mod l
|
||||
where l = 2^252 + 27742317777372353535851937790883648493.
|
||||
*/
|
||||
|
||||
void sc_muladd(unsigned char *s, const unsigned char *a, const unsigned char *b, const unsigned char *c) {
|
||||
int64_t a0 = 2097151 & load_3(a);
|
||||
int64_t a1 = 2097151 & (load_4(a + 2) >> 5);
|
||||
int64_t a2 = 2097151 & (load_3(a + 5) >> 2);
|
||||
int64_t a3 = 2097151 & (load_4(a + 7) >> 7);
|
||||
int64_t a4 = 2097151 & (load_4(a + 10) >> 4);
|
||||
int64_t a5 = 2097151 & (load_3(a + 13) >> 1);
|
||||
int64_t a6 = 2097151 & (load_4(a + 15) >> 6);
|
||||
int64_t a7 = 2097151 & (load_3(a + 18) >> 3);
|
||||
int64_t a8 = 2097151 & load_3(a + 21);
|
||||
int64_t a9 = 2097151 & (load_4(a + 23) >> 5);
|
||||
int64_t a10 = 2097151 & (load_3(a + 26) >> 2);
|
||||
int64_t a11 = (load_4(a + 28) >> 7);
|
||||
int64_t b0 = 2097151 & load_3(b);
|
||||
int64_t b1 = 2097151 & (load_4(b + 2) >> 5);
|
||||
int64_t b2 = 2097151 & (load_3(b + 5) >> 2);
|
||||
int64_t b3 = 2097151 & (load_4(b + 7) >> 7);
|
||||
int64_t b4 = 2097151 & (load_4(b + 10) >> 4);
|
||||
int64_t b5 = 2097151 & (load_3(b + 13) >> 1);
|
||||
int64_t b6 = 2097151 & (load_4(b + 15) >> 6);
|
||||
int64_t b7 = 2097151 & (load_3(b + 18) >> 3);
|
||||
int64_t b8 = 2097151 & load_3(b + 21);
|
||||
int64_t b9 = 2097151 & (load_4(b + 23) >> 5);
|
||||
int64_t b10 = 2097151 & (load_3(b + 26) >> 2);
|
||||
int64_t b11 = (load_4(b + 28) >> 7);
|
||||
int64_t c0 = 2097151 & load_3(c);
|
||||
int64_t c1 = 2097151 & (load_4(c + 2) >> 5);
|
||||
int64_t c2 = 2097151 & (load_3(c + 5) >> 2);
|
||||
int64_t c3 = 2097151 & (load_4(c + 7) >> 7);
|
||||
int64_t c4 = 2097151 & (load_4(c + 10) >> 4);
|
||||
int64_t c5 = 2097151 & (load_3(c + 13) >> 1);
|
||||
int64_t c6 = 2097151 & (load_4(c + 15) >> 6);
|
||||
int64_t c7 = 2097151 & (load_3(c + 18) >> 3);
|
||||
int64_t c8 = 2097151 & load_3(c + 21);
|
||||
int64_t c9 = 2097151 & (load_4(c + 23) >> 5);
|
||||
int64_t c10 = 2097151 & (load_3(c + 26) >> 2);
|
||||
int64_t c11 = (load_4(c + 28) >> 7);
|
||||
int64_t s0;
|
||||
int64_t s1;
|
||||
int64_t s2;
|
||||
int64_t s3;
|
||||
int64_t s4;
|
||||
int64_t s5;
|
||||
int64_t s6;
|
||||
int64_t s7;
|
||||
int64_t s8;
|
||||
int64_t s9;
|
||||
int64_t s10;
|
||||
int64_t s11;
|
||||
int64_t s12;
|
||||
int64_t s13;
|
||||
int64_t s14;
|
||||
int64_t s15;
|
||||
int64_t s16;
|
||||
int64_t s17;
|
||||
int64_t s18;
|
||||
int64_t s19;
|
||||
int64_t s20;
|
||||
int64_t s21;
|
||||
int64_t s22;
|
||||
int64_t s23;
|
||||
int64_t carry0;
|
||||
int64_t carry1;
|
||||
int64_t carry2;
|
||||
int64_t carry3;
|
||||
int64_t carry4;
|
||||
int64_t carry5;
|
||||
int64_t carry6;
|
||||
int64_t carry7;
|
||||
int64_t carry8;
|
||||
int64_t carry9;
|
||||
int64_t carry10;
|
||||
int64_t carry11;
|
||||
int64_t carry12;
|
||||
int64_t carry13;
|
||||
int64_t carry14;
|
||||
int64_t carry15;
|
||||
int64_t carry16;
|
||||
int64_t carry17;
|
||||
int64_t carry18;
|
||||
int64_t carry19;
|
||||
int64_t carry20;
|
||||
int64_t carry21;
|
||||
int64_t carry22;
|
||||
|
||||
s0 = c0 + a0 * b0;
|
||||
s1 = c1 + a0 * b1 + a1 * b0;
|
||||
s2 = c2 + a0 * b2 + a1 * b1 + a2 * b0;
|
||||
s3 = c3 + a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0;
|
||||
s4 = c4 + a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0;
|
||||
s5 = c5 + a0 * b5 + a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 + a5 * b0;
|
||||
s6 = c6 + a0 * b6 + a1 * b5 + a2 * b4 + a3 * b3 + a4 * b2 + a5 * b1 + a6 * b0;
|
||||
s7 = c7 + a0 * b7 + a1 * b6 + a2 * b5 + a3 * b4 + a4 * b3 + a5 * b2 + a6 * b1 + a7 * b0;
|
||||
s8 = c8 + a0 * b8 + a1 * b7 + a2 * b6 + a3 * b5 + a4 * b4 + a5 * b3 + a6 * b2 + a7 * b1 + a8 * b0;
|
||||
s9 = c9 + a0 * b9 + a1 * b8 + a2 * b7 + a3 * b6 + a4 * b5 + a5 * b4 + a6 * b3 + a7 * b2 + a8 * b1 + a9 * b0;
|
||||
s10 = c10 + a0 * b10 + a1 * b9 + a2 * b8 + a3 * b7 + a4 * b6 + a5 * b5 + a6 * b4 + a7 * b3 + a8 * b2 + a9 * b1 + a10 * b0;
|
||||
s11 = c11 + a0 * b11 + a1 * b10 + a2 * b9 + a3 * b8 + a4 * b7 + a5 * b6 + a6 * b5 + a7 * b4 + a8 * b3 + a9 * b2 + a10 * b1 + a11 * b0;
|
||||
s12 = a1 * b11 + a2 * b10 + a3 * b9 + a4 * b8 + a5 * b7 + a6 * b6 + a7 * b5 + a8 * b4 + a9 * b3 + a10 * b2 + a11 * b1;
|
||||
s13 = a2 * b11 + a3 * b10 + a4 * b9 + a5 * b8 + a6 * b7 + a7 * b6 + a8 * b5 + a9 * b4 + a10 * b3 + a11 * b2;
|
||||
s14 = a3 * b11 + a4 * b10 + a5 * b9 + a6 * b8 + a7 * b7 + a8 * b6 + a9 * b5 + a10 * b4 + a11 * b3;
|
||||
s15 = a4 * b11 + a5 * b10 + a6 * b9 + a7 * b8 + a8 * b7 + a9 * b6 + a10 * b5 + a11 * b4;
|
||||
s16 = a5 * b11 + a6 * b10 + a7 * b9 + a8 * b8 + a9 * b7 + a10 * b6 + a11 * b5;
|
||||
s17 = a6 * b11 + a7 * b10 + a8 * b9 + a9 * b8 + a10 * b7 + a11 * b6;
|
||||
s18 = a7 * b11 + a8 * b10 + a9 * b9 + a10 * b8 + a11 * b7;
|
||||
s19 = a8 * b11 + a9 * b10 + a10 * b9 + a11 * b8;
|
||||
s20 = a9 * b11 + a10 * b10 + a11 * b9;
|
||||
s21 = a10 * b11 + a11 * b10;
|
||||
s22 = a11 * b11;
|
||||
s23 = 0;
|
||||
carry0 = (s0 + (1 << 20)) >> 21;
|
||||
s1 += carry0;
|
||||
s0 -= carry0 << 21;
|
||||
carry2 = (s2 + (1 << 20)) >> 21;
|
||||
s3 += carry2;
|
||||
s2 -= carry2 << 21;
|
||||
carry4 = (s4 + (1 << 20)) >> 21;
|
||||
s5 += carry4;
|
||||
s4 -= carry4 << 21;
|
||||
carry6 = (s6 + (1 << 20)) >> 21;
|
||||
s7 += carry6;
|
||||
s6 -= carry6 << 21;
|
||||
carry8 = (s8 + (1 << 20)) >> 21;
|
||||
s9 += carry8;
|
||||
s8 -= carry8 << 21;
|
||||
carry10 = (s10 + (1 << 20)) >> 21;
|
||||
s11 += carry10;
|
||||
s10 -= carry10 << 21;
|
||||
carry12 = (s12 + (1 << 20)) >> 21;
|
||||
s13 += carry12;
|
||||
s12 -= carry12 << 21;
|
||||
carry14 = (s14 + (1 << 20)) >> 21;
|
||||
s15 += carry14;
|
||||
s14 -= carry14 << 21;
|
||||
carry16 = (s16 + (1 << 20)) >> 21;
|
||||
s17 += carry16;
|
||||
s16 -= carry16 << 21;
|
||||
carry18 = (s18 + (1 << 20)) >> 21;
|
||||
s19 += carry18;
|
||||
s18 -= carry18 << 21;
|
||||
carry20 = (s20 + (1 << 20)) >> 21;
|
||||
s21 += carry20;
|
||||
s20 -= carry20 << 21;
|
||||
carry22 = (s22 + (1 << 20)) >> 21;
|
||||
s23 += carry22;
|
||||
s22 -= carry22 << 21;
|
||||
carry1 = (s1 + (1 << 20)) >> 21;
|
||||
s2 += carry1;
|
||||
s1 -= carry1 << 21;
|
||||
carry3 = (s3 + (1 << 20)) >> 21;
|
||||
s4 += carry3;
|
||||
s3 -= carry3 << 21;
|
||||
carry5 = (s5 + (1 << 20)) >> 21;
|
||||
s6 += carry5;
|
||||
s5 -= carry5 << 21;
|
||||
carry7 = (s7 + (1 << 20)) >> 21;
|
||||
s8 += carry7;
|
||||
s7 -= carry7 << 21;
|
||||
carry9 = (s9 + (1 << 20)) >> 21;
|
||||
s10 += carry9;
|
||||
s9 -= carry9 << 21;
|
||||
carry11 = (s11 + (1 << 20)) >> 21;
|
||||
s12 += carry11;
|
||||
s11 -= carry11 << 21;
|
||||
carry13 = (s13 + (1 << 20)) >> 21;
|
||||
s14 += carry13;
|
||||
s13 -= carry13 << 21;
|
||||
carry15 = (s15 + (1 << 20)) >> 21;
|
||||
s16 += carry15;
|
||||
s15 -= carry15 << 21;
|
||||
carry17 = (s17 + (1 << 20)) >> 21;
|
||||
s18 += carry17;
|
||||
s17 -= carry17 << 21;
|
||||
carry19 = (s19 + (1 << 20)) >> 21;
|
||||
s20 += carry19;
|
||||
s19 -= carry19 << 21;
|
||||
carry21 = (s21 + (1 << 20)) >> 21;
|
||||
s22 += carry21;
|
||||
s21 -= carry21 << 21;
|
||||
s11 += s23 * 666643;
|
||||
s12 += s23 * 470296;
|
||||
s13 += s23 * 654183;
|
||||
s14 -= s23 * 997805;
|
||||
s15 += s23 * 136657;
|
||||
s16 -= s23 * 683901;
|
||||
s23 = 0;
|
||||
s10 += s22 * 666643;
|
||||
s11 += s22 * 470296;
|
||||
s12 += s22 * 654183;
|
||||
s13 -= s22 * 997805;
|
||||
s14 += s22 * 136657;
|
||||
s15 -= s22 * 683901;
|
||||
s22 = 0;
|
||||
s9 += s21 * 666643;
|
||||
s10 += s21 * 470296;
|
||||
s11 += s21 * 654183;
|
||||
s12 -= s21 * 997805;
|
||||
s13 += s21 * 136657;
|
||||
s14 -= s21 * 683901;
|
||||
s21 = 0;
|
||||
s8 += s20 * 666643;
|
||||
s9 += s20 * 470296;
|
||||
s10 += s20 * 654183;
|
||||
s11 -= s20 * 997805;
|
||||
s12 += s20 * 136657;
|
||||
s13 -= s20 * 683901;
|
||||
s20 = 0;
|
||||
s7 += s19 * 666643;
|
||||
s8 += s19 * 470296;
|
||||
s9 += s19 * 654183;
|
||||
s10 -= s19 * 997805;
|
||||
s11 += s19 * 136657;
|
||||
s12 -= s19 * 683901;
|
||||
s19 = 0;
|
||||
s6 += s18 * 666643;
|
||||
s7 += s18 * 470296;
|
||||
s8 += s18 * 654183;
|
||||
s9 -= s18 * 997805;
|
||||
s10 += s18 * 136657;
|
||||
s11 -= s18 * 683901;
|
||||
s18 = 0;
|
||||
carry6 = (s6 + (1 << 20)) >> 21;
|
||||
s7 += carry6;
|
||||
s6 -= carry6 << 21;
|
||||
carry8 = (s8 + (1 << 20)) >> 21;
|
||||
s9 += carry8;
|
||||
s8 -= carry8 << 21;
|
||||
carry10 = (s10 + (1 << 20)) >> 21;
|
||||
s11 += carry10;
|
||||
s10 -= carry10 << 21;
|
||||
carry12 = (s12 + (1 << 20)) >> 21;
|
||||
s13 += carry12;
|
||||
s12 -= carry12 << 21;
|
||||
carry14 = (s14 + (1 << 20)) >> 21;
|
||||
s15 += carry14;
|
||||
s14 -= carry14 << 21;
|
||||
carry16 = (s16 + (1 << 20)) >> 21;
|
||||
s17 += carry16;
|
||||
s16 -= carry16 << 21;
|
||||
carry7 = (s7 + (1 << 20)) >> 21;
|
||||
s8 += carry7;
|
||||
s7 -= carry7 << 21;
|
||||
carry9 = (s9 + (1 << 20)) >> 21;
|
||||
s10 += carry9;
|
||||
s9 -= carry9 << 21;
|
||||
carry11 = (s11 + (1 << 20)) >> 21;
|
||||
s12 += carry11;
|
||||
s11 -= carry11 << 21;
|
||||
carry13 = (s13 + (1 << 20)) >> 21;
|
||||
s14 += carry13;
|
||||
s13 -= carry13 << 21;
|
||||
carry15 = (s15 + (1 << 20)) >> 21;
|
||||
s16 += carry15;
|
||||
s15 -= carry15 << 21;
|
||||
s5 += s17 * 666643;
|
||||
s6 += s17 * 470296;
|
||||
s7 += s17 * 654183;
|
||||
s8 -= s17 * 997805;
|
||||
s9 += s17 * 136657;
|
||||
s10 -= s17 * 683901;
|
||||
s17 = 0;
|
||||
s4 += s16 * 666643;
|
||||
s5 += s16 * 470296;
|
||||
s6 += s16 * 654183;
|
||||
s7 -= s16 * 997805;
|
||||
s8 += s16 * 136657;
|
||||
s9 -= s16 * 683901;
|
||||
s16 = 0;
|
||||
s3 += s15 * 666643;
|
||||
s4 += s15 * 470296;
|
||||
s5 += s15 * 654183;
|
||||
s6 -= s15 * 997805;
|
||||
s7 += s15 * 136657;
|
||||
s8 -= s15 * 683901;
|
||||
s15 = 0;
|
||||
s2 += s14 * 666643;
|
||||
s3 += s14 * 470296;
|
||||
s4 += s14 * 654183;
|
||||
s5 -= s14 * 997805;
|
||||
s6 += s14 * 136657;
|
||||
s7 -= s14 * 683901;
|
||||
s14 = 0;
|
||||
s1 += s13 * 666643;
|
||||
s2 += s13 * 470296;
|
||||
s3 += s13 * 654183;
|
||||
s4 -= s13 * 997805;
|
||||
s5 += s13 * 136657;
|
||||
s6 -= s13 * 683901;
|
||||
s13 = 0;
|
||||
s0 += s12 * 666643;
|
||||
s1 += s12 * 470296;
|
||||
s2 += s12 * 654183;
|
||||
s3 -= s12 * 997805;
|
||||
s4 += s12 * 136657;
|
||||
s5 -= s12 * 683901;
|
||||
s12 = 0;
|
||||
carry0 = (s0 + (1 << 20)) >> 21;
|
||||
s1 += carry0;
|
||||
s0 -= carry0 << 21;
|
||||
carry2 = (s2 + (1 << 20)) >> 21;
|
||||
s3 += carry2;
|
||||
s2 -= carry2 << 21;
|
||||
carry4 = (s4 + (1 << 20)) >> 21;
|
||||
s5 += carry4;
|
||||
s4 -= carry4 << 21;
|
||||
carry6 = (s6 + (1 << 20)) >> 21;
|
||||
s7 += carry6;
|
||||
s6 -= carry6 << 21;
|
||||
carry8 = (s8 + (1 << 20)) >> 21;
|
||||
s9 += carry8;
|
||||
s8 -= carry8 << 21;
|
||||
carry10 = (s10 + (1 << 20)) >> 21;
|
||||
s11 += carry10;
|
||||
s10 -= carry10 << 21;
|
||||
carry1 = (s1 + (1 << 20)) >> 21;
|
||||
s2 += carry1;
|
||||
s1 -= carry1 << 21;
|
||||
carry3 = (s3 + (1 << 20)) >> 21;
|
||||
s4 += carry3;
|
||||
s3 -= carry3 << 21;
|
||||
carry5 = (s5 + (1 << 20)) >> 21;
|
||||
s6 += carry5;
|
||||
s5 -= carry5 << 21;
|
||||
carry7 = (s7 + (1 << 20)) >> 21;
|
||||
s8 += carry7;
|
||||
s7 -= carry7 << 21;
|
||||
carry9 = (s9 + (1 << 20)) >> 21;
|
||||
s10 += carry9;
|
||||
s9 -= carry9 << 21;
|
||||
carry11 = (s11 + (1 << 20)) >> 21;
|
||||
s12 += carry11;
|
||||
s11 -= carry11 << 21;
|
||||
s0 += s12 * 666643;
|
||||
s1 += s12 * 470296;
|
||||
s2 += s12 * 654183;
|
||||
s3 -= s12 * 997805;
|
||||
s4 += s12 * 136657;
|
||||
s5 -= s12 * 683901;
|
||||
s12 = 0;
|
||||
carry0 = s0 >> 21;
|
||||
s1 += carry0;
|
||||
s0 -= carry0 << 21;
|
||||
carry1 = s1 >> 21;
|
||||
s2 += carry1;
|
||||
s1 -= carry1 << 21;
|
||||
carry2 = s2 >> 21;
|
||||
s3 += carry2;
|
||||
s2 -= carry2 << 21;
|
||||
carry3 = s3 >> 21;
|
||||
s4 += carry3;
|
||||
s3 -= carry3 << 21;
|
||||
carry4 = s4 >> 21;
|
||||
s5 += carry4;
|
||||
s4 -= carry4 << 21;
|
||||
carry5 = s5 >> 21;
|
||||
s6 += carry5;
|
||||
s5 -= carry5 << 21;
|
||||
carry6 = s6 >> 21;
|
||||
s7 += carry6;
|
||||
s6 -= carry6 << 21;
|
||||
carry7 = s7 >> 21;
|
||||
s8 += carry7;
|
||||
s7 -= carry7 << 21;
|
||||
carry8 = s8 >> 21;
|
||||
s9 += carry8;
|
||||
s8 -= carry8 << 21;
|
||||
carry9 = s9 >> 21;
|
||||
s10 += carry9;
|
||||
s9 -= carry9 << 21;
|
||||
carry10 = s10 >> 21;
|
||||
s11 += carry10;
|
||||
s10 -= carry10 << 21;
|
||||
carry11 = s11 >> 21;
|
||||
s12 += carry11;
|
||||
s11 -= carry11 << 21;
|
||||
s0 += s12 * 666643;
|
||||
s1 += s12 * 470296;
|
||||
s2 += s12 * 654183;
|
||||
s3 -= s12 * 997805;
|
||||
s4 += s12 * 136657;
|
||||
s5 -= s12 * 683901;
|
||||
s12 = 0;
|
||||
carry0 = s0 >> 21;
|
||||
s1 += carry0;
|
||||
s0 -= carry0 << 21;
|
||||
carry1 = s1 >> 21;
|
||||
s2 += carry1;
|
||||
s1 -= carry1 << 21;
|
||||
carry2 = s2 >> 21;
|
||||
s3 += carry2;
|
||||
s2 -= carry2 << 21;
|
||||
carry3 = s3 >> 21;
|
||||
s4 += carry3;
|
||||
s3 -= carry3 << 21;
|
||||
carry4 = s4 >> 21;
|
||||
s5 += carry4;
|
||||
s4 -= carry4 << 21;
|
||||
carry5 = s5 >> 21;
|
||||
s6 += carry5;
|
||||
s5 -= carry5 << 21;
|
||||
carry6 = s6 >> 21;
|
||||
s7 += carry6;
|
||||
s6 -= carry6 << 21;
|
||||
carry7 = s7 >> 21;
|
||||
s8 += carry7;
|
||||
s7 -= carry7 << 21;
|
||||
carry8 = s8 >> 21;
|
||||
s9 += carry8;
|
||||
s8 -= carry8 << 21;
|
||||
carry9 = s9 >> 21;
|
||||
s10 += carry9;
|
||||
s9 -= carry9 << 21;
|
||||
carry10 = s10 >> 21;
|
||||
s11 += carry10;
|
||||
s10 -= carry10 << 21;
|
||||
|
||||
s[0] = (unsigned char) (s0 >> 0);
|
||||
s[1] = (unsigned char) (s0 >> 8);
|
||||
s[2] = (unsigned char) ((s0 >> 16) | (s1 << 5));
|
||||
s[3] = (unsigned char) (s1 >> 3);
|
||||
s[4] = (unsigned char) (s1 >> 11);
|
||||
s[5] = (unsigned char) ((s1 >> 19) | (s2 << 2));
|
||||
s[6] = (unsigned char) (s2 >> 6);
|
||||
s[7] = (unsigned char) ((s2 >> 14) | (s3 << 7));
|
||||
s[8] = (unsigned char) (s3 >> 1);
|
||||
s[9] = (unsigned char) (s3 >> 9);
|
||||
s[10] = (unsigned char) ((s3 >> 17) | (s4 << 4));
|
||||
s[11] = (unsigned char) (s4 >> 4);
|
||||
s[12] = (unsigned char) (s4 >> 12);
|
||||
s[13] = (unsigned char) ((s4 >> 20) | (s5 << 1));
|
||||
s[14] = (unsigned char) (s5 >> 7);
|
||||
s[15] = (unsigned char) ((s5 >> 15) | (s6 << 6));
|
||||
s[16] = (unsigned char) (s6 >> 2);
|
||||
s[17] = (unsigned char) (s6 >> 10);
|
||||
s[18] = (unsigned char) ((s6 >> 18) | (s7 << 3));
|
||||
s[19] = (unsigned char) (s7 >> 5);
|
||||
s[20] = (unsigned char) (s7 >> 13);
|
||||
s[21] = (unsigned char) (s8 >> 0);
|
||||
s[22] = (unsigned char) (s8 >> 8);
|
||||
s[23] = (unsigned char) ((s8 >> 16) | (s9 << 5));
|
||||
s[24] = (unsigned char) (s9 >> 3);
|
||||
s[25] = (unsigned char) (s9 >> 11);
|
||||
s[26] = (unsigned char) ((s9 >> 19) | (s10 << 2));
|
||||
s[27] = (unsigned char) (s10 >> 6);
|
||||
s[28] = (unsigned char) ((s10 >> 14) | (s11 << 7));
|
||||
s[29] = (unsigned char) (s11 >> 1);
|
||||
s[30] = (unsigned char) (s11 >> 9);
|
||||
s[31] = (unsigned char) (s11 >> 17);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifndef SC_H
|
||||
#define SC_H
|
||||
|
||||
/*
|
||||
The set of scalars is \Z/l
|
||||
where l = 2^252 + 27742317777372353535851937790883648493.
|
||||
*/
|
||||
|
||||
void sc_reduce(unsigned char *s);
|
||||
void sc_muladd(unsigned char *s, const unsigned char *a, const unsigned char *b, const unsigned char *c);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
#include "ed_25519.h"
|
||||
|
||||
#ifndef ED25519_NO_SEED
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
int ed25519_create_seed(unsigned char *seed) {
|
||||
#ifdef _WIN32
|
||||
HCRYPTPROV prov;
|
||||
|
||||
if (!CryptAcquireContext(&prov, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!CryptGenRandom(prov, 32, seed)) {
|
||||
CryptReleaseContext(prov, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
CryptReleaseContext(prov, 0);
|
||||
#else
|
||||
FILE *f = fopen("/dev/urandom", "rb");
|
||||
|
||||
if (f == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
fread(seed, 1, 32, f);
|
||||
fclose(f);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,275 @@
|
||||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
#include "fixedint.h"
|
||||
#include "sha512.h"
|
||||
|
||||
/* the K array */
|
||||
static const uint64_t K[80] = {
|
||||
UINT64_C(0x428a2f98d728ae22), UINT64_C(0x7137449123ef65cd),
|
||||
UINT64_C(0xb5c0fbcfec4d3b2f), UINT64_C(0xe9b5dba58189dbbc),
|
||||
UINT64_C(0x3956c25bf348b538), UINT64_C(0x59f111f1b605d019),
|
||||
UINT64_C(0x923f82a4af194f9b), UINT64_C(0xab1c5ed5da6d8118),
|
||||
UINT64_C(0xd807aa98a3030242), UINT64_C(0x12835b0145706fbe),
|
||||
UINT64_C(0x243185be4ee4b28c), UINT64_C(0x550c7dc3d5ffb4e2),
|
||||
UINT64_C(0x72be5d74f27b896f), UINT64_C(0x80deb1fe3b1696b1),
|
||||
UINT64_C(0x9bdc06a725c71235), UINT64_C(0xc19bf174cf692694),
|
||||
UINT64_C(0xe49b69c19ef14ad2), UINT64_C(0xefbe4786384f25e3),
|
||||
UINT64_C(0x0fc19dc68b8cd5b5), UINT64_C(0x240ca1cc77ac9c65),
|
||||
UINT64_C(0x2de92c6f592b0275), UINT64_C(0x4a7484aa6ea6e483),
|
||||
UINT64_C(0x5cb0a9dcbd41fbd4), UINT64_C(0x76f988da831153b5),
|
||||
UINT64_C(0x983e5152ee66dfab), UINT64_C(0xa831c66d2db43210),
|
||||
UINT64_C(0xb00327c898fb213f), UINT64_C(0xbf597fc7beef0ee4),
|
||||
UINT64_C(0xc6e00bf33da88fc2), UINT64_C(0xd5a79147930aa725),
|
||||
UINT64_C(0x06ca6351e003826f), UINT64_C(0x142929670a0e6e70),
|
||||
UINT64_C(0x27b70a8546d22ffc), UINT64_C(0x2e1b21385c26c926),
|
||||
UINT64_C(0x4d2c6dfc5ac42aed), UINT64_C(0x53380d139d95b3df),
|
||||
UINT64_C(0x650a73548baf63de), UINT64_C(0x766a0abb3c77b2a8),
|
||||
UINT64_C(0x81c2c92e47edaee6), UINT64_C(0x92722c851482353b),
|
||||
UINT64_C(0xa2bfe8a14cf10364), UINT64_C(0xa81a664bbc423001),
|
||||
UINT64_C(0xc24b8b70d0f89791), UINT64_C(0xc76c51a30654be30),
|
||||
UINT64_C(0xd192e819d6ef5218), UINT64_C(0xd69906245565a910),
|
||||
UINT64_C(0xf40e35855771202a), UINT64_C(0x106aa07032bbd1b8),
|
||||
UINT64_C(0x19a4c116b8d2d0c8), UINT64_C(0x1e376c085141ab53),
|
||||
UINT64_C(0x2748774cdf8eeb99), UINT64_C(0x34b0bcb5e19b48a8),
|
||||
UINT64_C(0x391c0cb3c5c95a63), UINT64_C(0x4ed8aa4ae3418acb),
|
||||
UINT64_C(0x5b9cca4f7763e373), UINT64_C(0x682e6ff3d6b2b8a3),
|
||||
UINT64_C(0x748f82ee5defb2fc), UINT64_C(0x78a5636f43172f60),
|
||||
UINT64_C(0x84c87814a1f0ab72), UINT64_C(0x8cc702081a6439ec),
|
||||
UINT64_C(0x90befffa23631e28), UINT64_C(0xa4506cebde82bde9),
|
||||
UINT64_C(0xbef9a3f7b2c67915), UINT64_C(0xc67178f2e372532b),
|
||||
UINT64_C(0xca273eceea26619c), UINT64_C(0xd186b8c721c0c207),
|
||||
UINT64_C(0xeada7dd6cde0eb1e), UINT64_C(0xf57d4f7fee6ed178),
|
||||
UINT64_C(0x06f067aa72176fba), UINT64_C(0x0a637dc5a2c898a6),
|
||||
UINT64_C(0x113f9804bef90dae), UINT64_C(0x1b710b35131c471b),
|
||||
UINT64_C(0x28db77f523047d84), UINT64_C(0x32caab7b40c72493),
|
||||
UINT64_C(0x3c9ebe0a15c9bebc), UINT64_C(0x431d67c49c100d4c),
|
||||
UINT64_C(0x4cc5d4becb3e42b6), UINT64_C(0x597f299cfc657e2a),
|
||||
UINT64_C(0x5fcb6fab3ad6faec), UINT64_C(0x6c44198c4a475817)
|
||||
};
|
||||
|
||||
/* Various logical functions */
|
||||
|
||||
#define ROR64c(x, y) \
|
||||
( ((((x)&UINT64_C(0xFFFFFFFFFFFFFFFF))>>((uint64_t)(y)&UINT64_C(63))) | \
|
||||
((x)<<((uint64_t)(64-((y)&UINT64_C(63)))))) & UINT64_C(0xFFFFFFFFFFFFFFFF))
|
||||
|
||||
#define STORE64H(x, y) \
|
||||
{ (y)[0] = (unsigned char)(((x)>>56)&255); (y)[1] = (unsigned char)(((x)>>48)&255); \
|
||||
(y)[2] = (unsigned char)(((x)>>40)&255); (y)[3] = (unsigned char)(((x)>>32)&255); \
|
||||
(y)[4] = (unsigned char)(((x)>>24)&255); (y)[5] = (unsigned char)(((x)>>16)&255); \
|
||||
(y)[6] = (unsigned char)(((x)>>8)&255); (y)[7] = (unsigned char)((x)&255); }
|
||||
|
||||
#define LOAD64H(x, y) \
|
||||
{ x = (((uint64_t)((y)[0] & 255))<<56)|(((uint64_t)((y)[1] & 255))<<48) | \
|
||||
(((uint64_t)((y)[2] & 255))<<40)|(((uint64_t)((y)[3] & 255))<<32) | \
|
||||
(((uint64_t)((y)[4] & 255))<<24)|(((uint64_t)((y)[5] & 255))<<16) | \
|
||||
(((uint64_t)((y)[6] & 255))<<8)|(((uint64_t)((y)[7] & 255))); }
|
||||
|
||||
|
||||
#define Ch(x,y,z) (z ^ (x & (y ^ z)))
|
||||
#define Maj(x,y,z) (((x | y) & z) | (x & y))
|
||||
#define S(x, n) ROR64c(x, n)
|
||||
#define R(x, n) (((x) &UINT64_C(0xFFFFFFFFFFFFFFFF))>>((uint64_t)n))
|
||||
#define Sigma0(x) (S(x, 28) ^ S(x, 34) ^ S(x, 39))
|
||||
#define Sigma1(x) (S(x, 14) ^ S(x, 18) ^ S(x, 41))
|
||||
#define Gamma0(x) (S(x, 1) ^ S(x, 8) ^ R(x, 7))
|
||||
#define Gamma1(x) (S(x, 19) ^ S(x, 61) ^ R(x, 6))
|
||||
#ifndef MIN
|
||||
#define MIN(x, y) ( ((x)<(y))?(x):(y) )
|
||||
#endif
|
||||
|
||||
/* compress 1024-bits */
|
||||
static int sha512_compress(sha512_context *md, unsigned char *buf)
|
||||
{
|
||||
uint64_t S[8], W[80], t0, t1;
|
||||
int i;
|
||||
|
||||
/* copy state into S */
|
||||
for (i = 0; i < 8; i++) {
|
||||
S[i] = md->state[i];
|
||||
}
|
||||
|
||||
/* copy the state into 1024-bits into W[0..15] */
|
||||
for (i = 0; i < 16; i++) {
|
||||
LOAD64H(W[i], buf + (8*i));
|
||||
}
|
||||
|
||||
/* fill W[16..79] */
|
||||
for (i = 16; i < 80; i++) {
|
||||
W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16];
|
||||
}
|
||||
|
||||
/* Compress */
|
||||
#define RND(a,b,c,d,e,f,g,h,i) \
|
||||
t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i]; \
|
||||
t1 = Sigma0(a) + Maj(a, b, c);\
|
||||
d += t0; \
|
||||
h = t0 + t1;
|
||||
|
||||
for (i = 0; i < 80; i += 8) {
|
||||
RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],i+0);
|
||||
RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],i+1);
|
||||
RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],i+2);
|
||||
RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],i+3);
|
||||
RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],i+4);
|
||||
RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],i+5);
|
||||
RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],i+6);
|
||||
RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],i+7);
|
||||
}
|
||||
|
||||
#undef RND
|
||||
|
||||
|
||||
|
||||
/* feedback */
|
||||
for (i = 0; i < 8; i++) {
|
||||
md->state[i] = md->state[i] + S[i];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Initialize the hash state
|
||||
@param md The hash state you wish to initialize
|
||||
@return 0 if successful
|
||||
*/
|
||||
int sha512_init(sha512_context * md) {
|
||||
if (md == NULL) return 1;
|
||||
|
||||
md->curlen = 0;
|
||||
md->length = 0;
|
||||
md->state[0] = UINT64_C(0x6a09e667f3bcc908);
|
||||
md->state[1] = UINT64_C(0xbb67ae8584caa73b);
|
||||
md->state[2] = UINT64_C(0x3c6ef372fe94f82b);
|
||||
md->state[3] = UINT64_C(0xa54ff53a5f1d36f1);
|
||||
md->state[4] = UINT64_C(0x510e527fade682d1);
|
||||
md->state[5] = UINT64_C(0x9b05688c2b3e6c1f);
|
||||
md->state[6] = UINT64_C(0x1f83d9abfb41bd6b);
|
||||
md->state[7] = UINT64_C(0x5be0cd19137e2179);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
Process a block of memory though the hash
|
||||
@param md The hash state
|
||||
@param in The data to hash
|
||||
@param inlen The length of the data (octets)
|
||||
@return 0 if successful
|
||||
*/
|
||||
int sha512_update (sha512_context * md, const unsigned char *in, size_t inlen)
|
||||
{
|
||||
size_t n;
|
||||
size_t i;
|
||||
int err;
|
||||
if (md == NULL) return 1;
|
||||
if (in == NULL) return 1;
|
||||
if (md->curlen > sizeof(md->buf)) {
|
||||
return 1;
|
||||
}
|
||||
while (inlen > 0) {
|
||||
if (md->curlen == 0 && inlen >= 128) {
|
||||
if ((err = sha512_compress (md, (unsigned char *)in)) != 0) {
|
||||
return err;
|
||||
}
|
||||
md->length += 128 * 8;
|
||||
in += 128;
|
||||
inlen -= 128;
|
||||
} else {
|
||||
n = MIN(inlen, (128 - md->curlen));
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
md->buf[i + md->curlen] = in[i];
|
||||
}
|
||||
|
||||
|
||||
md->curlen += n;
|
||||
in += n;
|
||||
inlen -= n;
|
||||
if (md->curlen == 128) {
|
||||
if ((err = sha512_compress (md, md->buf)) != 0) {
|
||||
return err;
|
||||
}
|
||||
md->length += 8*128;
|
||||
md->curlen = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
Terminate the hash to get the digest
|
||||
@param md The hash state
|
||||
@param out [out] The destination of the hash (64 bytes)
|
||||
@return 0 if successful
|
||||
*/
|
||||
int sha512_final(sha512_context * md, unsigned char *out)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (md == NULL) return 1;
|
||||
if (out == NULL) return 1;
|
||||
|
||||
if (md->curlen >= sizeof(md->buf)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* increase the length of the message */
|
||||
md->length += md->curlen * UINT64_C(8);
|
||||
|
||||
/* append the '1' bit */
|
||||
md->buf[md->curlen++] = (unsigned char)0x80;
|
||||
|
||||
/* if the length is currently above 112 bytes we append zeros
|
||||
* then compress. Then we can fall back to padding zeros and length
|
||||
* encoding like normal.
|
||||
*/
|
||||
if (md->curlen > 112) {
|
||||
while (md->curlen < 128) {
|
||||
md->buf[md->curlen++] = (unsigned char)0;
|
||||
}
|
||||
sha512_compress(md, md->buf);
|
||||
md->curlen = 0;
|
||||
}
|
||||
|
||||
/* pad upto 120 bytes of zeroes
|
||||
* note: that from 112 to 120 is the 64 MSB of the length. We assume that you won't hash
|
||||
* > 2^64 bits of data... :-)
|
||||
*/
|
||||
while (md->curlen < 120) {
|
||||
md->buf[md->curlen++] = (unsigned char)0;
|
||||
}
|
||||
|
||||
/* store length */
|
||||
STORE64H(md->length, md->buf+120);
|
||||
sha512_compress(md, md->buf);
|
||||
|
||||
/* copy output */
|
||||
for (i = 0; i < 8; i++) {
|
||||
STORE64H(md->state[i], out+(8*i));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sha512(const unsigned char *message, size_t message_len, unsigned char *out)
|
||||
{
|
||||
sha512_context ctx;
|
||||
int ret;
|
||||
if ((ret = sha512_init(&ctx))) return ret;
|
||||
if ((ret = sha512_update(&ctx, message, message_len))) return ret;
|
||||
if ((ret = sha512_final(&ctx, out))) return ret;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef SHA512_H
|
||||
#define SHA512_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "fixedint.h"
|
||||
|
||||
/* state */
|
||||
typedef struct sha512_context_ {
|
||||
uint64_t length, state[8];
|
||||
size_t curlen;
|
||||
unsigned char buf[128];
|
||||
} sha512_context;
|
||||
|
||||
|
||||
int sha512_init(sha512_context * md);
|
||||
int sha512_final(sha512_context * md, unsigned char *out);
|
||||
int sha512_update(sha512_context * md, const unsigned char *in, size_t inlen);
|
||||
int sha512(const unsigned char *message, size_t message_len, unsigned char *out);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,31 @@
|
||||
#include "ed_25519.h"
|
||||
#include "sha512.h"
|
||||
#include "ge.h"
|
||||
#include "sc.h"
|
||||
|
||||
|
||||
void ed25519_sign(unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *public_key, const unsigned char *private_key) {
|
||||
sha512_context hash;
|
||||
unsigned char hram[64];
|
||||
unsigned char r[64];
|
||||
ge_p3 R;
|
||||
|
||||
|
||||
sha512_init(&hash);
|
||||
sha512_update(&hash, private_key + 32, 32);
|
||||
sha512_update(&hash, message, message_len);
|
||||
sha512_final(&hash, r);
|
||||
|
||||
sc_reduce(r);
|
||||
ge_scalarmult_base(&R, r);
|
||||
ge_p3_tobytes(signature, &R);
|
||||
|
||||
sha512_init(&hash);
|
||||
sha512_update(&hash, signature, 32);
|
||||
sha512_update(&hash, public_key, 32);
|
||||
sha512_update(&hash, message, message_len);
|
||||
sha512_final(&hash, hram);
|
||||
|
||||
sc_reduce(hram);
|
||||
sc_muladd(signature + 32, hram, private_key, r);
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
#include "ed_25519.h"
|
||||
#include "sha512.h"
|
||||
#include "ge.h"
|
||||
#include "sc.h"
|
||||
|
||||
static int consttime_equal(const unsigned char *x, const unsigned char *y) {
|
||||
unsigned char r = 0;
|
||||
|
||||
r = x[0] ^ y[0];
|
||||
#define F(i) r |= x[i] ^ y[i]
|
||||
F(1);
|
||||
F(2);
|
||||
F(3);
|
||||
F(4);
|
||||
F(5);
|
||||
F(6);
|
||||
F(7);
|
||||
F(8);
|
||||
F(9);
|
||||
F(10);
|
||||
F(11);
|
||||
F(12);
|
||||
F(13);
|
||||
F(14);
|
||||
F(15);
|
||||
F(16);
|
||||
F(17);
|
||||
F(18);
|
||||
F(19);
|
||||
F(20);
|
||||
F(21);
|
||||
F(22);
|
||||
F(23);
|
||||
F(24);
|
||||
F(25);
|
||||
F(26);
|
||||
F(27);
|
||||
F(28);
|
||||
F(29);
|
||||
F(30);
|
||||
F(31);
|
||||
#undef F
|
||||
|
||||
return !r;
|
||||
}
|
||||
|
||||
int ed25519_verify(const unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *public_key) {
|
||||
unsigned char h[64];
|
||||
unsigned char checker[32];
|
||||
sha512_context hash;
|
||||
ge_p3 A;
|
||||
ge_p2 R;
|
||||
|
||||
if (signature[63] & 224) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ge_frombytes_negate_vartime(&A, public_key) != 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
sha512_init(&hash);
|
||||
sha512_update(&hash, signature, 32);
|
||||
sha512_update(&hash, public_key, 32);
|
||||
sha512_update(&hash, message, message_len);
|
||||
sha512_final(&hash, h);
|
||||
|
||||
sc_reduce(h);
|
||||
ge_double_scalarmult_vartime(&R, h, &A, signature + 32);
|
||||
ge_tobytes(checker, &R);
|
||||
|
||||
if (!consttime_equal(checker, signature)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
Loaded 100 of 290 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user